[submodule "external/entityframework"]
path = external/entityframework
url = git://github.com/mono/entityframework.git
+[submodule "external/rx"]
+ path = external/rx
+ url = git://github.com/mono/rx.git
+[submodule "external/ikvm"]
+ path = external/ikvm
+ url = git://github.com/mono/ikvm-fork.git
+[submodule "external/Lucene.Net"]
+ path = external/Lucene.Net
+ url = git://github.com/apache/lucene.net.git
Contact mono@xamarin.com for details on obtaining the Mono
runtime under other terms.
+** mono/support: MonoPosixHelper and support code
+
+ This code is dual licensed under the LGPL or commercial licenses, with
+ the same guidelines as mono/mono code.
+
+ The ZLib files are included under a "new BSD"-style license.
+
** mono/eglib: Mono's X11 glib implementation
This is a minimal subset of glib that is to be licensed under
ACLOCAL_AMFLAGS = -I m4
MOONLIGHT_SUBDIRS = $(libgc_dir) eglib/src mono
+MONOTOUCH_SUBDIRS = $(libgc_dir) eglib/src mono
if CROSS_COMPILING
SUBDIRS = po $(libgc_dir) eglib mono $(ikvm_native_dir) data runtime scripts man samples msvc $(docs_dir)
## 'tools' is not normally built
DIST_SUBDIRS = m4 po libgc eglib mono ikvm-native data runtime scripts man samples tools msvc docs
else
+if ONLY_MONOTOUCH
+SUBDIRS = $(MONOTOUCH_SUBDIRS) runtime
+else
if ONLY_MOONLIGHT
SUBDIRS = $(MOONLIGHT_SUBDIRS) runtime
else
DIST_SUBDIRS = m4 po libgc eglib mono ikvm-native support data runtime scripts man samples tools msvc docs
endif
endif
+endif
all: update_submodules
endif
+if INSTALL_MONOTOUCH
+monotouch-do-build: config.h
+ @list='$(MONOTOUCH_SUBDIRS)'; for subdir in $$list; do \
+ case "x$$subdir" in \
+ xmono ) target="monotouch-do-build";; \
+ * ) target="all";; \
+ esac; \
+ echo "Making $$target in $$subdir"; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$target); \
+ done;
+ (cd runtime && $(MAKE) $(AM_MAKEFLAGS) monotouch-do-build)
+
+monotouch-do-clean:
+ @list='$(MONOTOUCH_SUBDIRS)'; for subdir in $$list; do \
+ case "x$$subdir" in \
+ xmono ) target="monotouch-do-clean";; \
+ * ) target="clean";; \
+ esac; \
+ echo "Making $$target in $$subdir"; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$target); \
+ done;
+ (cd runtime && $(MAKE) $(AM_MAKEFLAGS) monotouch-do-clean)
+
+endif
+
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
fi
echo "Running aclocal -I m4 -I . $ACLOCAL_FLAGS ..."
-aclocal -W none -I m4 -I . $ACLOCAL_FLAGS || {
+aclocal -Wnone -I m4 -I . $ACLOCAL_FLAGS || {
echo
echo "**Error**: aclocal failed. This may mean that you have not"
echo "installed all of the packages you need, or you may need to"
# Process this file with autoconf to produce a configure script.
#AC_PREREQ([2.62])
-AC_INIT(mono, [3.0.1],
+AC_INIT(mono, [3.0.3],
[http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono])
AC_CONFIG_SRCDIR([README])
host_win32=no
target_win32=no
platform_android=no
+platform_darwin=no
case "$host" in
*-mingw*|*-*-cygwin*)
AC_DEFINE(HOST_WIN32,1,[Host Platform is Win32])
CPPFLAGS="$CPPFLAGS -no-cpp-precomp -D_THREAD_SAFE -DGC_MACOSX_THREADS -DPLATFORM_MACOSX -DUSE_MMAP -DUSE_MUNMAP"
CPPFLAGS="$CPPFLAGS -DGetCurrentProcess=MonoGetCurrentProcess -DGetCurrentThread=MonoGetCurrentThread -DCreateEvent=MonoCreateEvent"
libmono_cflags="-D_THREAD_SAFE"
- LDFLAGS="$LDFLAGS -pthread"
- libmono_ldflags="-pthread"
need_link_unlink=yes
AC_DEFINE(PTHREAD_POINTER_ID)
AC_DEFINE(USE_MACH_SEMA, 1, [...])
case "$host" in
dnl Snow Leopard and newer config.guess reports as this
i*86-*-darwin*)
- BROKEN_DARWIN_FLAGS="-arch i386 -D_XOPEN_SOURCE -mmacosx-version-min=10.5"
+ BROKEN_DARWIN_FLAGS="-arch i386 -D_XOPEN_SOURCE"
CPPFLAGS="$CPPFLAGS $BROKEN_DARWIN_FLAGS"
CFLAGS="$CFLAGS $BROKEN_DARWIN_FLAGS"
CXXFLAGS="$CXXFLAGS $BROKEN_DARWIN_FLAGS"
CPPFLAGS_FOR_EGLIB="$CPPFLAGS_FOR_EGLIB $BROKEN_DARWIN_FLAGS"
CFLAGS_FOR_EGLIB="$CFLAGS_FOR_EGLIB $BROKEN_DARWIN_FLAGS"
;;
+ arm*-darwin*)
+ has_dtrace=no
+ ;;
esac
;;
*-*-haiku*)
WARN=''
if test x"$GCC" = xyes; then
- WARN='-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wwrite-strings -Wno-switch-enum'
+ WARN='-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wwrite-strings -Wno-switch -Wno-switch-enum -Wno-unused-value'
# The runtime code does not respect ANSI C strict aliasing rules
CFLAGS="$CFLAGS -fno-strict-aliasing"
AC_CACHE_CHECK([for clang],
mono_cv_clang,[
- AC_TRY_RUN([
- int main () {
- #ifdef __clang__
- return 0;
- #else
- return 1;
- #endif
- }
+ AC_TRY_COMPILE([], [
+ #ifdef __clang__
+ #else
+ #error "FAILED"
+ #endif
+ return 0;
],
[mono_cv_clang=yes],
[mono_cv_clang=no],
with_shared_mono=no
fi
+AM_CONDITIONAL(DISABLE_LIBRARIES, test x$enable_libraries = xno)
+
case $host in
*nacl* ) with_shared_mono=yes;;
esac
AC_ARG_ENABLE(minimal, [ --enable-minimal=LIST drop support for LIST subsystems.
LIST is a comma-separated list from: aot, profiler, decimal, pinvoke, debug,
- reflection_emit, reflection_emit_save, large_code, logging, com, ssa, generics, attach, jit, simd, soft_debug, normalization, assembly_remapping, shared_perfcounters.],
+ reflection_emit, reflection_emit_save, large_code, logging, com, ssa, generics, attach, jit, simd, soft_debug, perfcounters, normalization, assembly_remapping, shared_perfcounters,
+ sgen_remset, sgen_marksweep_par, sgen_marksweep_fixed, sgen_marksweep_fixed_par, sgen_copying.],
[
for feature in `echo "$enable_minimal" | sed -e "s/,/ /g"`; do
eval "mono_feature_disable_$feature='yes'"
AC_MSG_NOTICE([Disabled Soft Debugger.])
fi
+if test "x$mono_feature_disable_perfcounters" = "xyes"; then
+ AC_DEFINE(DISABLE_PERFCOUNTERS, 1, [Disable Performance Counters.])
+ AC_MSG_NOTICE([Disabled Performance Counters.])
+fi
if test "x$mono_feature_disable_normalization" = "xyes"; then
AC_DEFINE(DISABLE_NORMALIZATION, 1, [Disable String normalization support.])
AC_MSG_NOTICE([Disabled String normalization support.])
AC_MSG_NOTICE([Disabled Shared perfcounters.])
fi
+if test "x$mono_feature_disable_sgen_remset" = "xyes"; then
+ AC_DEFINE(DISABLE_SGEN_REMSET, 1, [Disable wbarrier=remset support in SGEN.])
+ AC_MSG_NOTICE([Disabled wbarrier=remset support in SGEN.])
+fi
+
+if test "x$mono_feature_disable_sgen_marksweep_par" = "xyes"; then
+ AC_DEFINE(DISABLE_SGEN_MAJOR_MARKSWEEP_PAR, 1, [Disable major=marksweep-par support in SGEN.])
+ AC_MSG_NOTICE([Disabled major=marksweep-par support in SGEN.])
+fi
+
+if test "x$mono_feature_disable_sgen_marksweep_fixed" = "xyes"; then
+ AC_DEFINE(DISABLE_SGEN_MAJOR_MARKSWEEP_FIXED, 1, [Disable major=marksweep-fixed support in SGEN.])
+ AC_MSG_NOTICE([Disabled major=marksweep-fixed support in SGEN.])
+fi
+
+if test "x$mono_feature_disable_sgen_marksweep_fixed_par" = "xyes"; then
+ AC_DEFINE(DISABLE_SGEN_MAJOR_MARKSWEEP_FIXED_PAR, 1, [Disable major=marksweep-fixed-par support in SGEN.])
+ AC_MSG_NOTICE([Disabled major=marksweep-fixed-par support in SGEN.])
+fi
+
+if test "x$mono_feature_disable_sgen_copying" = "xyes"; then
+ AC_DEFINE(DISABLE_SGEN_MAJOR_COPYING, 1, [Disable major=copying support in SGEN.])
+ AC_MSG_NOTICE([Disabled major=copying support in SGEN.])
+fi
+
AC_ARG_ENABLE(executables, [ --disable-executables disable the build of the runtime executables], enable_executables=$enableval, enable_executables=yes)
AM_CONDITIONAL(DISABLE_EXECUTABLES, test x$enable_executables = xno)
return 0;
}
- for (i = 0; i < 3; ++i) {
- sleep (1);
+ for (i = 0; i < 300; ++i) {
waitpid (son, &status, WNOHANG);
if (WIFEXITED (status) && WEXITSTATUS (status) == 0)
return 0;
+ usleep (10000);
}
kill (son, SIGKILL);
havekqueue=no
AC_CHECK_FUNCS(kqueue, , AC_MSG_CHECKING(for kqueue in sys/event.h)
AC_TRY_LINK([#include <sys/event.h>],
- [ kqueue(); ],
- AC_DEFINE(HAVE_KQUEUE, 1, [Have kqueue]) AC_MSG_RESULT(yes),
- AC_MSG_RESULT(no)))
+ [ kqueue(); ],[havekqueue=yes],[]))
+
+ dnl **************************************
+ dnl * Darwin has a race that prevents us from using reliably:
+ dnl * http://lists.apple.com/archives/darwin-dev/2011/Jun/msg00016.html
+ dnl * Since kqueue is mostly used for scaling large web servers,
+ dnl * and very few folks run Mono on large web servers on OSX, falling
+ dnl * back
+ dnl **************************************
+ if test x$havekqueue = xyes; then
+ if x$platform_darwin = xno; then
+ AC_DEFINE(USE_KQUEUE_FOR_THREADPOOL, 1, [Use kqueue for the threadpool])
+ fi
+ fi
+
dnl ******************************
dnl *** Checks for SIOCGIFCONF ***
dnl ******************************
AC_MSG_ERROR([llvm-config not found.])
fi
+ llvm_codegen="x86codegen"
+ case "$target" in
+ arm*)
+ llvm_codegen="armcodegen"
+ ;;
+ esac
+
+
# The output of --cflags seems to include optimizations flags too
LLVM_CFLAGS=`$LLVM_CONFIG --cflags | sed -e 's/-O2//g' | sed -e 's/-O0//g' | sed -e 's/-fomit-frame-pointer//g' | sed -e 's/-fPIC//g'`
# LLVM is compiled with -fno-rtti, so we need this too, since our classes inherit
# from LLVM classes.
LLVM_CXXFLAGS="`$LLVM_CONFIG --cxxflags` -fno-rtti"
LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
- LLVM_LIBS=`$LLVM_CONFIG --libs core bitwriter jit mcjit x86codegen`
+ LLVM_LIBS=`$LLVM_CONFIG --libs core bitwriter jit mcjit $llvm_codegen`
LLVM_LIBS="$LLVM_LDFLAGS $LLVM_LIBS -lstdc++"
# Should be something like '2.6' or '2.7svn'
AC_DEFINE(MONO_CROSS_COMPILE,1,[The runtime is compiled for cross-compiling mode])
enable_mcs_build=no
case "$target" in
+ arm*-darwin*)
+ TARGET=ARM;
+ arch_target=arm;
+ ACCESS_UNALIGNED="no"
+ JIT_SUPPORTED=yes
+ CPPFLAGS="$CPPFLAGS -DARM_FPU_VFP=1 -D__ARM_EABI__ -DHAVE_ARMV6=1"
+ jit_wanted=true
+ # Can't use tls, since it depends on the runtime detection of tls offsets
+ # in mono-compiler.h
+ with_tls=pthread
+ ;;
powerpc64-ps3-linux-gnu)
TARGET=POWERPC64
arch_target=powerpc64
AC_DEFINE(TARGET_X86, 1, [...])
sizeof_register=4
;;
- arm*-unknown-linux-gnueabi*)
+ arm*-unknown-linux-*)
TARGET=ARM;
arch_target=arm;
AC_DEFINE(TARGET_ARM, 1, [...])
esac
if test "x$target_mach" = "xyes"; then
+ AC_TRY_COMPILE([#include "TargetConditionals.h"],[
+ #if TARGET_IPHONE_SIMULATOR == 1 || TARGET_OS_IPHONE == 1
+ #error fail this for ios
+ #endif
+ return 0;
+ ], [
+ AC_DEFINE(TARGET_OSX,1,[The JIT/AOT targets OSX])
+ CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC -DTARGET_OSX"
+ CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC -DTARGET_OSX"
+ ], [
+ AC_DEFINE(TARGET_IOS,1,[The JIT/AOT targets iOS])
+ CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC -DTARGET_IOS"
+ CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC -DTARGET_IOS"
+ ])
+
AC_DEFINE(TARGET_MACH,1,[The JIT/AOT targets Apple platforms])
fi
AC_DEFINE(DISABLE_ICALL_TABLES, 1, [Icall tables disabled])
fi
+if test "x$mono_cv_clang" = "xyes"; then
+ # FIXME: This causes many compilation errors
+ with_tls=pthread
+fi
+
if test "x$with_tls" = "x__thread"; then
AC_DEFINE(HAVE_KW_THREAD, 1, [Have __thread keyword])
# Pass the information to libgc
AC_ARG_WITH(profile4_5,[ --with-profile4_5=yes,no If you want to install the 4.5 FX (defaults to yes)], [], [with_profile4_5=yes])
AC_ARG_WITH(monodroid, [ --with-monodroid=yes,no If you want to build the MonoDroid assemblies (defaults to no)], [], [with_monodroid=no])
AC_ARG_WITH(monotouch, [ --with-monotouch=yes,no,only If you want to build the MonoTouch assemblies (defaults to no)], [], [with_monotouch=no])
+AC_ARG_WITH(mobile, [ --with-mobile=yes,no If you want to build the Mobile assemblies (defaults to no)], [], [with_mobile=no])
OPROFILE=no
AC_ARG_WITH(oprofile,[ --with-oprofile=no,<oprofile install dir> Enable oprofile support (defaults to no)],[
fi
], [with_moon_gc=boehm])
+AC_ARG_WITH(lazy_gc_thread_creation, [ --with-lazy-gc-thread-creation=yes|no Enable lazy runtime thread creation, embedding host must do it explicitly (defaults to no)],[
+ if test x$with_lazy_gc_thread_creation != xno ; then
+ AC_DEFINE(LAZY_GC_THREAD_CREATION,1,[Enable lazy gc thread creation by the embedding host.])
+ fi
+], [with_lazy_gc_thread_creation=no])
+
AC_CHECK_HEADER([malloc.h],
[AC_DEFINE([HAVE_USR_INCLUDE_MALLOC_H], [1],
[Define to 1 if you have /usr/include/malloc.h.])],,)
# When --disable-shared is used, libtool transforms libmono-2.0.la into libmono-2.0.so
# instead of libmono-static.a
-if test "x$enable_shared" = "xno"; then
+if test "x$enable_shared" = "xno" -a "x$enable_executables" = "xyes"; then
LIBMONO_LA=libmini-static.la
else
LIBMONO_LA=libmono-$API_VER.la
AM_CONDITIONAL(INSTALL_4_5, [test "x$with_profile4_5" = xyes])
AM_CONDITIONAL(INSTALL_MONODROID, [test "x$with_monodroid" != "xno"])
AM_CONDITIONAL(INSTALL_MONOTOUCH, [test "x$with_monotouch" != "xno"])
+AM_CONDITIONAL(INSTALL_MOBILE, [test "x$with_mobile" = xyes])
+AM_CONDITIONAL(ONLY_MONOTOUCH, [test "x$with_monotouch" = "xonly"])
AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
AM_CONDITIONAL(HOST_X86, test x$HOST = xX86)
AM_CONDITIONAL(HOST_AMD64, test x$HOST = xAMD64)
AM_CONDITIONAL(HOST_ARM, test x$HOST = xARM)
+AM_CONDITIONAL(CROSS_COMPILE, test "x$host" != "x$target")
AM_CONDITIONAL(JIT_SUPPORTED, test x$JIT_SUPPORTED = xyes)
AM_CONDITIONAL(INTERP_SUPPORTED, test x$interp_wanted = xtrue)
--- /dev/null
+With this change, we bundle Reactive Extensions from Microsoft.
+
+Steps to do:
+
+- Until we add submodule, check out Rx sources from http://rx.codeplex.com:
+
+ $ cd external
+ $ git clone git://github.com/atsushieno/rx.git
+ $ cd rx
+ $ git checkout rx-oss-v1.0
+ $ cd ../..
+
+ Note that the original repo at rx.codeplex.com will *fail* on Linux!
+ codeplex.codeplex.com/workitem/26133
+ Also note that rx.codeplex.com is huge and takes very long time to checkout.
+
+- expand rx-mono-changes-3.tar.bz2
+
+ $ tar jxvf rx-mono-changes-3.tar.bz2
+
+- Apply changes to mcs/class/Makefile:
+
+ $ cd mcs/class
+ $ patch -i add-rx-libs.patch -p3
+ $ cd ../..
+
+Then it should be done.
+
+Note that this does not include Mono.Reactive.Testing into the build yet -
+this library depends on nunit.framework.dll but it wouldn't be built before
+this assembly is built. This needs to be resolved.
+
+** Current Status
+
+- We don't have Microsoft.Reactive.Testing.dll. Instead, I created an
+ alternative Mono.Reactive.Testing.dll which *mostly* uses MS sources for
+ that assembly but uses NUnit.Framework instead.
+
+ To make it happen, I added a small script that automatically replaces
+ MSTest dependency parts with that for NUnit (replacer.sh under rx tree).
+
+ (We'll also have to rename namespaces and have more source changes, but
+ so far it is to get things runnable.)
+
+- To check the build sanity, I imported unit tests (as explained above)
+ and it is supposed to run by "make run-test" in Mono.Reactive.Testing
+ directory (the tests were all in one place in MS tests, so I made it
+ in Mono.Reactive.Testing directory instead).
+
--- /dev/null
+<h1>Decimal Support</h1>
+
+ <p>You can use the mono_decimal functions to access and
+ manipulate <tt>System.Decimal</tt> types from C.
+
+<h4><a name="api:mono_decimal2double">mono_decimal2double</a></h4>
+<h4><a name="api:mono_decimal2Int64">mono_decimal2Int64</a></h4>
+<h4><a name="api:mono_decimal2string">mono_decimal2string</a></h4>
+<h4><a name="api:mono_decimal2UInt64">mono_decimal2UInt64</a></h4>
+<h4><a name="api:mono_decimalCompare">mono_decimalCompare</a></h4>
+<h4><a name="api:mono_decimalDiv">mono_decimalDiv</a></h4>
+<h4><a name="api:mono_decimalFloorAndTrunc">mono_decimalFloorAndTrunc</a></h4>
+<h4><a name="api:mono_decimalIncr">mono_decimalIncr</a></h4>
+<h4><a name="api:mono_decimalIntDiv">mono_decimalIntDiv</a></h4>
+<h4><a name="api:mono_decimalMult">mono_decimalMult</a></h4>
+<h4><a name="api:mono_decimalRound">mono_decimalRound</a></h4>
+<h4><a name="api:mono_decimalSetExponent">mono_decimalSetExponent</a></h4>
+<h4><a name="api:mono_double2decimal">mono_double2decimal</a></h4>
+<h4><a name="api:mono_string2decimal">mono_string2decimal</a></h4>
/* TODO: provide a proper app name */
__android_log_vprint (ANDROID_LOG_ERROR, "mono", format, args);
}
+#elif MONOTOUCH && defined(__arm__)
+#include <asl.h>
+
+static int
+to_asl_priority (GLogLevelFlags log_level)
+{
+ switch (log_level & G_LOG_LEVEL_MASK)
+ {
+ case G_LOG_LEVEL_ERROR: return ASL_LEVEL_CRIT;
+ case G_LOG_LEVEL_CRITICAL: return ASL_LEVEL_ERR;
+ case G_LOG_LEVEL_WARNING: return ASL_LEVEL_WARNING;
+ case G_LOG_LEVEL_MESSAGE: return ASL_LEVEL_NOTICE;
+ case G_LOG_LEVEL_INFO: return ASL_LEVEL_INFO;
+ case G_LOG_LEVEL_DEBUG: return ASL_LEVEL_DEBUG;
+ }
+ return ASL_LEVEL_ERR;
+}
+
+static void
+out_vfprintf (FILE *ignore, const gchar *format, va_list args)
+{
+ asl_vlog (NULL, NULL, ASL_LEVEL_WARNING, format, args);
+}
+
#else
static void
out_vfprintf (FILE *file, const gchar *format, va_list args)
{
#if PLATFORM_ANDROID
__android_log_vprint (to_android_priority (log_level), log_domain, format, args);
+#elif MONOTOUCH && defined(__arm__)
+ asl_vlog (NULL, NULL, to_asl_priority (log_level), format, args);
#else
char *msg;
--- /dev/null
+Subproject commit 88fb67b07621dfed054d8d75fd50672fb26349df
--- /dev/null
+Subproject commit 3db612102e06332eebebd128cd06be68b03c2f0e
--- /dev/null
+Subproject commit 7c59a20c72adc9b4c7568ce0395fe33e0a4bf8ea
fi
fi
+ACLOCAL_FLAGS="$ACLOCAL_FLAGS -Wnone"
echo "Running aclocal $ACLOCAL_FLAGS ..."
aclocal $ACLOCAL_FLAGS || {
echo
fi
echo "Running automake --gnu $am_opt ..."
-automake --add-missing --gnu $am_opt ||
+automake --add-missing --gnu -Wno-obsolete $am_opt ||
{ echo "**Error**: automake failed."; exit 1; }
echo "Running autoconf ..."
autoconf || { echo "**Error**: autoconf failed."; exit 1; }
if(r != KERN_SUCCESS) continue;
#if defined(I386)
-#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
+#if defined (TARGET_IOS) || (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5)
lo = state.__esp;
(natural_t *)&info, &outCount);
if(r != KERN_SUCCESS) continue;
-#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
+#if defined (TARGET_IOS) || (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5)
lo = (void*)info.__esp;
hi = (ptr_t)FindTopOfStack(info.__esp);
# define mach_type_known
# endif
# ifdef DARWIN
+# include "TargetConditionals.h"
# if defined(__ppc__) || defined(__ppc64__)
# define POWERPC
# define mach_type_known
# define mach_type_known
# define DARWIN_DONT_PARSE_STACK
# define OS_TYPE "DARWIN"
-# define DYNAMIC_LOADING
+# if TARGET_IPHONE_SIMULATOR == 0
+# define DYNAMIC_LOADING
+# endif
/* XXX: see get_end(3), get_etext() and get_end() should not be used.
These aren't used when dyld support is enabled (it is by default) */
# define DATASTART ((ptr_t) get_etext())
--> Macro replaced by USE_COMPILER_TLS
# endif
+#ifndef USE_COMPILER_TLS
# if (defined(GC_DGUX386_THREADS) || defined(GC_OSF1_THREADS) || \
defined(GC_DARWIN_THREADS) || defined(GC_AIX_THREADS)) || \
defined(GC_NETBSD_THREADS) && !defined(USE_PTHREAD_SPECIFIC) || \
defined(GC_OPENBSD_THREADS)
# define USE_PTHREAD_SPECIFIC
# endif
+#endif
# if defined(GC_DGUX386_THREADS) && !defined(_POSIX4A_DRAFT10_SOURCE)
# define _POSIX4A_DRAFT10_SOURCE 1
Q_MDOC_UP=$(if $(V),,@echo "MDOC-UP [$(PROFILE)] $(notdir $(@))";)
# net_2_0 is needed because monodoc is only compiled in that profile
MDOC_UP =$(Q_MDOC_UP) \
- MONO_PATH="$(topdir)/class/lib/$(DEFAULT_PROFILE)$(PLATFORM_PATH_SEPARATOR)$(topdir)/class/lib/net_2_0$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(topdir)/tools/mdoc/mdoc.exe \
+ MONO_PATH="$(topdir)/class/lib/$(DEFAULT_PROFILE)$(PLATFORM_PATH_SEPARATOR)$(topdir)/class/lib/net_2_0$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(topdir)/class/lib/$(DEFAULT_PROFILE)/mdoc.exe \
update --delete -o Documentation/en $(the_lib)
doc-update-local: $(the_libdir)/.doc-stamp
BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_GMCS)
MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_GMCS)
+# Use system resgen as we don't want local System.Windows.Forms dependency
+RESGEN = resgen2
+
profile-check:
@:
DEFAULT_REFERENCES = -r:mscorlib.dll
-PROFILE_MCS_FLAGS = -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:MOBILE -d:MONOTOUCH -nowarn:1699 -nostdlib -lib:$(topdir)/class/lib/$(PROFILE) $(DEFAULT_REFERENCES) $(PLATFORM_DEBUG_FLAGS)
+PROFILE_MCS_FLAGS = -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE -d:MONOTOUCH -nowarn:1699 -nostdlib -lib:$(topdir)/class/lib/$(PROFILE) $(DEFAULT_REFERENCES) $(PLATFORM_DEBUG_FLAGS)
FRAMEWORK_VERSION = 2.1
NO_TEST = yes
PROFILE_MCS_FLAGS = -d:NET_1_1 -d:NET_2_0 -d:NET_3_0 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -nowarn:1699 -nostdlib -lib:$(topdir)/class/lib/$(PROFILE) $(DEFAULT_REFERENCES) $(PLATFORM_DEBUG_FLAGS)
FRAMEWORK_VERSION = 4.5
+
+# This is utility build only
+NO_INSTALL = yes
RelaxngGrammar g = null;
RelaxngPattern p;
try {
- if (grammar.IsSourceCompactSyntax) {
- p = RncParser.ParseRnc (new StreamReader ((Stream) grammar.Resolver.GetEntity (uri, null, typeof (Stream))), null, BaseUri, nsContext);
+ if (uri.AbsolutePath.EndsWith(".rnc", StringComparison.InvariantCultureIgnoreCase)) {
+ p = RncParser.ParseRnc (new StreamReader ((Stream) grammar.Resolver.GetEntity (uri, null, typeof (Stream))), null, uri.AbsoluteUri, nsContext);
} else {
xtr = new XmlTextReader (uri.AbsoluteUri, (Stream) grammar.Resolver.GetEntity (uri, null, typeof (Stream)));
RelaxngReader r = new RelaxngReader (xtr, nsContext, grammar.Resolver);
+++ /dev/null
-/*
- Copyright (C) 2009 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Runtime.Serialization;
-
-namespace IKVM.Reflection
-{
- [Serializable]
- public sealed class AmbiguousMatchException : Exception
- {
- public AmbiguousMatchException()
- {
- }
-
- public AmbiguousMatchException(string message)
- : base(message)
- {
- }
-
- public AmbiguousMatchException(string message, Exception inner)
- : base(message, inner)
- {
- }
-
- private AmbiguousMatchException(SerializationInfo info, StreamingContext context)
- : base(info, context)
- {
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009-2012 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-
-namespace IKVM.Reflection
-{
- public abstract class Assembly : ICustomAttributeProvider
- {
- internal readonly Universe universe;
- protected string fullName; // AssemblyBuilder needs access to this field to clear it when the name changes
-
- internal Assembly(Universe universe)
- {
- this.universe = universe;
- }
-
- public sealed override string ToString()
- {
- return FullName;
- }
-
- public abstract Type[] GetTypes();
- public abstract AssemblyName GetName();
- public abstract string ImageRuntimeVersion { get; }
- public abstract Module ManifestModule { get; }
- public abstract MethodInfo EntryPoint { get; }
- public abstract string Location { get; }
- public abstract AssemblyName[] GetReferencedAssemblies();
- public abstract Module[] GetModules(bool getResourceModules);
- public abstract Module[] GetLoadedModules(bool getResourceModules);
- public abstract Module GetModule(string name);
- public abstract string[] GetManifestResourceNames();
- public abstract ManifestResourceInfo GetManifestResourceInfo(string resourceName);
- public abstract System.IO.Stream GetManifestResourceStream(string name);
-
- internal abstract Type FindType(TypeName name);
- internal abstract Type FindTypeIgnoreCase(TypeName lowerCaseName);
-
- // The differences between ResolveType and FindType are:
- // - ResolveType is only used when a type is assumed to exist (because another module's metadata claims it)
- // - ResolveType can return a MissingType
- internal Type ResolveType(TypeName typeName)
- {
- return FindType(typeName) ?? universe.GetMissingTypeOrThrow(this.ManifestModule, null, typeName);
- }
-
- public string FullName
- {
- get { return fullName ?? (fullName = GetName().FullName); }
- }
-
- public Module[] GetModules()
- {
- return GetModules(true);
- }
-
- public Module[] GetLoadedModules()
- {
- return GetLoadedModules(true);
- }
-
- public AssemblyName GetName(bool copiedName)
- {
- return GetName();
- }
-
- public bool ReflectionOnly
- {
- get { return true; }
- }
-
- public Type[] GetExportedTypes()
- {
- List<Type> list = new List<Type>();
- foreach (Type type in GetTypes())
- {
- if (type.IsVisible)
- {
- list.Add(type);
- }
- }
- return list.ToArray();
- }
-
- public Type GetType(string name)
- {
- return GetType(name, false);
- }
-
- public Type GetType(string name, bool throwOnError)
- {
- return GetType(name, throwOnError, false);
- }
-
- public Type GetType(string name, bool throwOnError, bool ignoreCase)
- {
- TypeNameParser parser = TypeNameParser.Parse(name, throwOnError);
- if (parser.Error)
- {
- return null;
- }
- if (parser.AssemblyName != null)
- {
- if (throwOnError)
- {
- throw new ArgumentException("Type names passed to Assembly.GetType() must not specify an assembly.");
- }
- else
- {
- return null;
- }
- }
- TypeName typeName = TypeName.Split(TypeNameParser.Unescape(parser.FirstNamePart));
- Type type = ignoreCase
- ? FindTypeIgnoreCase(typeName.ToLowerInvariant())
- : FindType(typeName);
- if (type == null && __IsMissing)
- {
- throw new MissingAssemblyException((MissingAssembly)this);
- }
- return parser.Expand(type, this, throwOnError, name, false, ignoreCase);
- }
-
- public virtual Module LoadModule(string moduleName, byte[] rawModule)
- {
- throw new NotSupportedException();
- }
-
- public Module LoadModule(string moduleName, byte[] rawModule, byte[] rawSymbolStore)
- {
- return LoadModule(moduleName, rawModule);
- }
-
- public bool IsDefined(Type attributeType, bool inherit)
- {
- return CustomAttributeData.__GetCustomAttributes(this, attributeType, inherit).Count != 0;
- }
-
- public IList<CustomAttributeData> __GetCustomAttributes(Type attributeType, bool inherit)
- {
- return CustomAttributeData.__GetCustomAttributes(this, attributeType, inherit);
- }
-
- public static string CreateQualifiedName(string assemblyName, string typeName)
- {
- return typeName + ", " + assemblyName;
- }
-
- public static Assembly GetAssembly(Type type)
- {
- return type.Assembly;
- }
-
- public string CodeBase
- {
- get
- {
- string path = this.Location.Replace(System.IO.Path.DirectorySeparatorChar, '/');
- if (!path.StartsWith("/"))
- {
- path = "/" + path;
- }
- return "file://" + path;
- }
- }
-
- public virtual bool __IsMissing
- {
- get { return false; }
- }
-
- public virtual AssemblyNameFlags __AssemblyFlags
- {
- get { return GetName().Flags; }
- }
-
- internal abstract IList<CustomAttributeData> GetCustomAttributesData(Type attributeType);
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009-2012 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Globalization;
-using System.Configuration.Assemblies;
-using System.IO;
-using System.Text;
-using IKVM.Reflection.Reader;
-
-namespace IKVM.Reflection
-{
- public sealed class AssemblyName : ICloneable
- {
- private string name;
- private string culture;
- private Version version;
- private byte[] publicKeyToken;
- private byte[] publicKey;
- private StrongNameKeyPair keyPair;
- private AssemblyNameFlags flags;
- private AssemblyHashAlgorithm hashAlgorithm;
- private AssemblyVersionCompatibility versionCompatibility = AssemblyVersionCompatibility.SameMachine;
- private string codeBase;
- internal byte[] hash;
-
- public AssemblyName()
- {
- }
-
- public AssemblyName(string assemblyName)
- {
- if (assemblyName == null)
- {
- throw new ArgumentNullException("assemblyName");
- }
- if (assemblyName == "")
- {
- throw new ArgumentException();
- }
- ParsedAssemblyName parsed;
- switch (Fusion.ParseAssemblyName(assemblyName, out parsed))
- {
- case ParseAssemblyResult.GenericError:
- throw new FileLoadException();
- case ParseAssemblyResult.DuplicateKey:
- throw new System.Runtime.InteropServices.COMException();
- }
- name = parsed.Name;
- if (parsed.Culture != null)
- {
- if (parsed.Culture.Equals("neutral", StringComparison.InvariantCultureIgnoreCase))
- {
- culture = "";
- }
- else if (parsed.Culture == "")
- {
- throw new FileLoadException();
- }
- else
- {
- culture = new CultureInfo(parsed.Culture).Name;
- }
- }
- if (parsed.Version != null && parsed.Version.Major != 65535 && parsed.Version.Minor != 65535)
- {
- // our Fusion parser returns -1 for build and revision for incomplete version numbers (and we want 65535)
- version = new Version(parsed.Version.Major, parsed.Version.Minor, parsed.Version.Build & 0xFFFF, parsed.Version.Revision & 0xFFFF);
- }
- if (parsed.PublicKeyToken != null)
- {
- if (parsed.PublicKeyToken.Equals("null", StringComparison.InvariantCultureIgnoreCase))
- {
- publicKeyToken = Empty<byte>.Array;
- }
- else if (parsed.PublicKeyToken.Length != 16)
- {
- throw new FileLoadException();
- }
- else
- {
- publicKeyToken = new byte[8];
- for (int i = 0, pos = 0; i < publicKeyToken.Length; i++, pos += 2)
- {
- publicKeyToken[i] = (byte)("0123456789abcdef".IndexOf(char.ToLowerInvariant(parsed.PublicKeyToken[pos])) * 16
- + "0123456789abcdef".IndexOf(char.ToLowerInvariant(parsed.PublicKeyToken[pos + 1])));
- }
- }
- }
- if (parsed.Retargetable.HasValue)
- {
- if (parsed.Culture == null || parsed.PublicKeyToken == null || parsed.Version == null || parsed.Version.Build == -1 || parsed.Version.Revision == -1)
- {
- throw new FileLoadException();
- }
- if (parsed.Retargetable.Value)
- {
- flags |= AssemblyNameFlags.Retargetable;
- }
- }
- ProcessorArchitecture = parsed.ProcessorArchitecture;
- if (parsed.WindowsRuntime)
- {
- ContentType = AssemblyContentType.WindowsRuntime;
- }
- }
-
- public override string ToString()
- {
- return FullName;
- }
-
- public string Name
- {
- get { return name; }
- set { name = value; }
- }
-
- public CultureInfo CultureInfo
- {
- get { return culture == null ? null : new CultureInfo(culture); }
- set { culture = value == null ? null : value.Name; }
- }
-
- internal string Culture
- {
- get { return culture; }
- set { culture = value; }
- }
-
- public Version Version
- {
- get { return version; }
- set { version = value; }
- }
-
- public StrongNameKeyPair KeyPair
- {
- get { return keyPair; }
- set { keyPair = value; }
- }
-
- public string CodeBase
- {
- get { return codeBase; }
- set { codeBase = value; }
- }
-
- public string EscapedCodeBase
- {
- get
- {
- // HACK use the real AssemblyName to escape the codebase
- System.Reflection.AssemblyName tmp = new System.Reflection.AssemblyName();
- tmp.CodeBase = codeBase;
- return tmp.EscapedCodeBase;
- }
- }
-
- public ProcessorArchitecture ProcessorArchitecture
- {
- get { return (ProcessorArchitecture)(((int)flags & 0x70) >> 4); }
- set
- {
- if (value >= ProcessorArchitecture.None && value <= ProcessorArchitecture.Arm)
- {
- flags = (flags & ~(AssemblyNameFlags)0x70) | (AssemblyNameFlags)((int)value << 4);
- }
- }
- }
-
- public AssemblyNameFlags Flags
- {
- get { return flags & (AssemblyNameFlags)~0xEF0; }
- set { flags = (flags & (AssemblyNameFlags)0xEF0) | (value & (AssemblyNameFlags)~0xEF0); }
- }
-
- public AssemblyVersionCompatibility VersionCompatibility
- {
- get { return versionCompatibility; }
- set { versionCompatibility = value; }
- }
-
- public AssemblyContentType ContentType
- {
- get { return (AssemblyContentType)(((int)flags & 0xE00) >> 9); }
- set
- {
- if (value >= AssemblyContentType.Default && value <= AssemblyContentType.WindowsRuntime)
- {
- flags = (flags & ~(AssemblyNameFlags)0xE00) | (AssemblyNameFlags)((int)value << 9);
- }
- }
- }
-
- public byte[] GetPublicKey()
- {
- return publicKey;
- }
-
- public void SetPublicKey(byte[] publicKey)
- {
- this.publicKey = publicKey;
- flags = (flags & ~AssemblyNameFlags.PublicKey) | (publicKey == null ? 0 : AssemblyNameFlags.PublicKey);
- }
-
- public byte[] GetPublicKeyToken()
- {
- if (publicKeyToken == null && publicKey != null)
- {
- // note that GetPublicKeyToken() has a side effect in this case, because we retain this token even after the public key subsequently gets changed
- publicKeyToken = ComputePublicKeyToken(publicKey);
- }
- return publicKeyToken;
- }
-
- public void SetPublicKeyToken(byte[] publicKeyToken)
- {
- this.publicKeyToken = publicKeyToken;
- }
-
- public AssemblyHashAlgorithm HashAlgorithm
- {
- get { return hashAlgorithm; }
- set { hashAlgorithm = value; }
- }
-
- public byte[] __Hash
- {
- get { return hash; }
- }
-
- public string FullName
- {
- get
- {
- if (name == null)
- {
- return "";
- }
- StringBuilder sb = new StringBuilder();
- bool doubleQuotes = name.StartsWith(" ") || name.EndsWith(" ") || name.IndexOf('\'') != -1;
- bool singleQuotes = name.IndexOf('"') != -1;
- if (singleQuotes)
- {
- sb.Append('\'');
- }
- else if (doubleQuotes)
- {
- sb.Append('"');
- }
- if (name.IndexOf(',') != -1 || name.IndexOf('\\') != -1 || name.IndexOf('=') != -1 || (singleQuotes && name.IndexOf('\'') != -1))
- {
- for (int i = 0; i < name.Length; i++)
- {
- char c = name[i];
- if (c == ',' || c == '\\' || c == '=' || (singleQuotes && c == '\''))
- {
- sb.Append('\\');
- }
- sb.Append(c);
- }
- }
- else
- {
- sb.Append(name);
- }
- if (singleQuotes)
- {
- sb.Append('\'');
- }
- else if (doubleQuotes)
- {
- sb.Append('"');
- }
- if (version != null)
- {
- if ((version.Major & 0xFFFF) != 0xFFFF)
- {
- sb.Append(", Version=").Append(version.Major & 0xFFFF);
- if ((version.Minor & 0xFFFF) != 0xFFFF)
- {
- sb.Append('.').Append(version.Minor & 0xFFFF);
- if ((version.Build & 0xFFFF) != 0xFFFF)
- {
- sb.Append('.').Append(version.Build & 0xFFFF);
- if ((version.Revision & 0xFFFF) != 0xFFFF)
- {
- sb.Append('.').Append(version.Revision & 0xFFFF);
- }
- }
- }
- }
- }
- if (culture != null)
- {
- sb.Append(", Culture=").Append(culture == "" ? "neutral" : culture);
- }
- byte[] publicKeyToken = this.publicKeyToken;
- if ((publicKeyToken == null || publicKeyToken.Length == 0) && publicKey != null)
- {
- publicKeyToken = ComputePublicKeyToken(publicKey);
- }
- if (publicKeyToken != null)
- {
- sb.Append(", PublicKeyToken=");
- if (publicKeyToken.Length == 0)
- {
- sb.Append("null");
- }
- else
- {
- AppendPublicKey(sb, publicKeyToken);
- }
- }
- if ((Flags & AssemblyNameFlags.Retargetable) != 0)
- {
- sb.Append(", Retargetable=Yes");
- }
- if (ContentType == AssemblyContentType.WindowsRuntime)
- {
- sb.Append(", ContentType=WindowsRuntime");
- }
- return sb.ToString();
- }
- }
-
- private static byte[] ComputePublicKeyToken(byte[] publicKey)
- {
- if (publicKey.Length == 0)
- {
- return publicKey;
- }
- // HACK use the real AssemblyName to convert PublicKey to PublicKeyToken
- StringBuilder sb = new StringBuilder("Foo, PublicKey=", 20 + publicKey.Length * 2);
- AppendPublicKey(sb, publicKey);
- string str = sb.ToString();
- if (str == "Foo, PublicKey=00000000000000000400000000000000")
- {
- // MONOBUG workaround Mono 2.10 bug (fixed in 2.11)
- // it does not return the correct public key token for the ECMA key
- return new byte[] { 0xB7, 0x7A, 0x5C, 0x56, 0x19, 0x34, 0xE0, 0x89 };
- }
- return new System.Reflection.AssemblyName(str).GetPublicKeyToken();
- }
-
- private static void AppendPublicKey(StringBuilder sb, byte[] publicKey)
- {
- for (int i = 0; i < publicKey.Length; i++)
- {
- sb.Append("0123456789abcdef"[publicKey[i] >> 4]);
- sb.Append("0123456789abcdef"[publicKey[i] & 0x0F]);
- }
- }
-
- public override bool Equals(object obj)
- {
- AssemblyName other = obj as AssemblyName;
- return other != null && other.FullName == this.FullName;
- }
-
- public override int GetHashCode()
- {
- return FullName.GetHashCode();
- }
-
- public object Clone()
- {
- AssemblyName copy = (AssemblyName)MemberwiseClone();
- copy.publicKey = Copy(publicKey);
- copy.publicKeyToken = Copy(publicKeyToken);
- return copy;
- }
-
- private static byte[] Copy(byte[] b)
- {
- return b == null || b.Length == 0 ? b : (byte[])b.Clone();
- }
-
- public static bool ReferenceMatchesDefinition(AssemblyName reference, AssemblyName definition)
- {
- // HACK use the real AssemblyName to implement the (broken) ReferenceMatchesDefinition method
- return System.Reflection.AssemblyName.ReferenceMatchesDefinition(new System.Reflection.AssemblyName(reference.FullName), new System.Reflection.AssemblyName(definition.FullName));
- }
-
- public static AssemblyName GetAssemblyName(string path)
- {
- try
- {
- path = Path.GetFullPath(path);
- using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))
- {
- ModuleReader module = new ModuleReader(null, null, fs, path);
- if (module.Assembly == null)
- {
- throw new BadImageFormatException("Module does not contain a manifest");
- }
- return module.Assembly.GetName();
- }
- }
- catch (IOException x)
- {
- throw new FileNotFoundException(x.Message, x);
- }
- catch (UnauthorizedAccessException x)
- {
- throw new FileNotFoundException(x.Message, x);
- }
- }
-
- internal AssemblyNameFlags RawFlags
- {
- get { return flags; }
- set { flags = value; }
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Runtime.Serialization;
-
-namespace IKVM.Reflection
-{
- [Serializable]
- public sealed class BadImageFormatException : Exception
- {
- public BadImageFormatException()
- {
- }
-
- public BadImageFormatException(string message)
- : base(message)
- {
- }
-
- public BadImageFormatException(string message, Exception inner)
- : base(message, inner)
- {
- }
-
- private BadImageFormatException(SerializationInfo info, StreamingContext context)
- : base(info, context)
- {
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2010-2012 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Globalization;
-
-namespace IKVM.Reflection
-{
- public abstract class Binder
- {
- protected Binder()
- {
- }
-
- public virtual MethodBase BindToMethod(BindingFlags bindingAttr, MethodBase[] match, ref object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] names, out object state)
- {
- throw new InvalidOperationException();
- }
-
- public virtual FieldInfo BindToField(BindingFlags bindingAttr, FieldInfo[] match, object value, CultureInfo culture)
- {
- throw new InvalidOperationException();
- }
-
- public virtual object ChangeType(object value, Type type, CultureInfo culture)
- {
- throw new InvalidOperationException();
- }
-
- public virtual void ReorderArgumentArray(ref object[] args, object state)
- {
- throw new InvalidOperationException();
- }
-
- public abstract MethodBase SelectMethod(BindingFlags bindingAttr, MethodBase[] match, Type[] types, ParameterModifier[] modifiers);
- public abstract PropertyInfo SelectProperty(BindingFlags bindingAttr, PropertyInfo[] match, Type returnType, Type[] indexes, ParameterModifier[] modifiers);
- }
-
- sealed class DefaultBinder : Binder
- {
- public override MethodBase SelectMethod(BindingFlags bindingAttr, MethodBase[] match, Type[] types, ParameterModifier[] modifiers)
- {
- int matchCount = 0;
- foreach (MethodBase method in match)
- {
- if (MatchParameterTypes(method.GetParameters(), types))
- {
- match[matchCount++] = method;
- }
- }
-
- if (matchCount == 0)
- {
- return null;
- }
-
- if (matchCount == 1)
- {
- return match[0];
- }
-
- MethodBase bestMatch = match[0];
- bool ambiguous = false;
- for (int i = 1; i < matchCount; i++)
- {
- bestMatch = SelectBestMatch(bestMatch, match[i], types, ref ambiguous);
- }
- if (ambiguous)
- {
- throw new AmbiguousMatchException();
- }
- return bestMatch;
- }
-
- private static bool MatchParameterTypes(ParameterInfo[] parameters, Type[] types)
- {
- if (parameters.Length != types.Length)
- {
- return false;
- }
- for (int i = 0; i < parameters.Length; i++)
- {
- Type sourceType = types[i];
- Type targetType = parameters[i].ParameterType;
- if (sourceType != targetType
- && !targetType.IsAssignableFrom(sourceType)
- && !IsAllowedPrimitiveConversion(sourceType, targetType))
- {
- return false;
- }
- }
- return true;
- }
-
- private static MethodBase SelectBestMatch(MethodBase mb1, MethodBase mb2, Type[] types, ref bool ambiguous)
- {
- switch (MatchSignatures(mb1.MethodSignature, mb2.MethodSignature, types))
- {
- case 1:
- return mb1;
- case 2:
- return mb2;
- }
-
- if (mb1.MethodSignature.MatchParameterTypes(mb2.MethodSignature))
- {
- int depth1 = GetInheritanceDepth(mb1.DeclaringType);
- int depth2 = GetInheritanceDepth(mb2.DeclaringType);
- if (depth1 > depth2)
- {
- return mb1;
- }
- else if (depth1 < depth2)
- {
- return mb2;
- }
- }
-
- ambiguous = true;
- return mb1;
- }
-
- private static int GetInheritanceDepth(Type type)
- {
- int depth = 0;
- while (type != null)
- {
- depth++;
- type = type.BaseType;
- }
- return depth;
- }
-
- private static int MatchSignatures(MethodSignature sig1, MethodSignature sig2, Type[] types)
- {
- for (int i = 0; i < sig1.GetParameterCount(); i++)
- {
- Type type1 = sig1.GetParameterType(i);
- Type type2 = sig2.GetParameterType(i);
- if (type1 != type2)
- {
- return MatchTypes(type1, type2, types[i]);
- }
- }
- return 0;
- }
-
- private static int MatchSignatures(PropertySignature sig1, PropertySignature sig2, Type[] types)
- {
- for (int i = 0; i < sig1.ParameterCount; i++)
- {
- Type type1 = sig1.GetParameter(i);
- Type type2 = sig2.GetParameter(i);
- if (type1 != type2)
- {
- return MatchTypes(type1, type2, types[i]);
- }
- }
- return 0;
- }
-
- private static int MatchTypes(Type type1, Type type2, Type type)
- {
- if (type1 == type)
- {
- return 1;
- }
- if (type2 == type)
- {
- return 2;
- }
- bool conv = type1.IsAssignableFrom(type2);
- return conv == type2.IsAssignableFrom(type1) ? 0 : conv ? 2 : 1;
- }
-
- private static bool IsAllowedPrimitiveConversion(Type source, Type target)
- {
- // we need to check for primitives, because GetTypeCode will return the underlying type for enums
- if (!source.IsPrimitive || !target.IsPrimitive)
- {
- return false;
- }
- TypeCode sourceType = Type.GetTypeCode(source);
- TypeCode targetType = Type.GetTypeCode(target);
- switch (sourceType)
- {
- case TypeCode.Char:
- switch (targetType)
- {
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.Int32:
- case TypeCode.UInt64:
- case TypeCode.Int64:
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- case TypeCode.Byte:
- switch (targetType)
- {
- case TypeCode.Char:
- case TypeCode.UInt16:
- case TypeCode.Int16:
- case TypeCode.UInt32:
- case TypeCode.Int32:
- case TypeCode.UInt64:
- case TypeCode.Int64:
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- case TypeCode.SByte:
- switch (targetType)
- {
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- case TypeCode.UInt16:
- switch (targetType)
- {
- case TypeCode.UInt32:
- case TypeCode.Int32:
- case TypeCode.UInt64:
- case TypeCode.Int64:
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- case TypeCode.Int16:
- switch (targetType)
- {
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- case TypeCode.UInt32:
- switch (targetType)
- {
- case TypeCode.UInt64:
- case TypeCode.Int64:
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- case TypeCode.Int32:
- switch (targetType)
- {
- case TypeCode.Int64:
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- case TypeCode.UInt64:
- switch (targetType)
- {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- case TypeCode.Int64:
- switch (targetType)
- {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- case TypeCode.Single:
- switch (targetType)
- {
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- default:
- return false;
- }
- }
-
- public override PropertyInfo SelectProperty(BindingFlags bindingAttr, PropertyInfo[] match, Type returnType, Type[] indexes, ParameterModifier[] modifiers)
- {
- int matchCount = 0;
- foreach (PropertyInfo property in match)
- {
- if (indexes == null || MatchParameterTypes(property.GetIndexParameters(), indexes))
- {
- if (returnType != null)
- {
- if (property.PropertyType.IsPrimitive)
- {
- if (!IsAllowedPrimitiveConversion(returnType, property.PropertyType))
- {
- continue;
- }
- }
- else
- {
- if (!property.PropertyType.IsAssignableFrom(returnType))
- {
- continue;
- }
- }
- }
- match[matchCount++] = property;
- }
- }
-
- if (matchCount == 0)
- {
- return null;
- }
-
- if (matchCount == 1)
- {
- return match[0];
- }
-
- PropertyInfo bestMatch = match[0];
- bool ambiguous = false;
- for (int i = 1; i < matchCount; i++)
- {
- int best = MatchTypes(bestMatch.PropertyType, match[i].PropertyType, returnType);
- if (best == 0 && indexes != null)
- {
- best = MatchSignatures(bestMatch.PropertySignature, match[i].PropertySignature, indexes);
- }
- if (best == 0)
- {
- int depth1 = GetInheritanceDepth(bestMatch.DeclaringType);
- int depth2 = GetInheritanceDepth(match[i].DeclaringType);
- if (bestMatch.Name == match[i].Name && depth1 != depth2)
- {
- if (depth1 > depth2)
- {
- best = 1;
- }
- else
- {
- best = 2;
- }
- }
- else
- {
- ambiguous = true;
- }
- }
- if (best == 2)
- {
- ambiguous = false;
- bestMatch = match[i];
- }
- }
- if (ambiguous)
- {
- throw new AmbiguousMatchException();
- }
- return bestMatch;
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009-2012 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-
-namespace IKVM.Reflection
-{
- public abstract class ConstructorInfo : MethodBase
- {
- // prevent external subclasses
- internal ConstructorInfo()
- {
- }
-
- public sealed override string ToString()
- {
- return GetMethodInfo().ToString();
- }
-
- public static readonly string ConstructorName = ".ctor";
- public static readonly string TypeConstructorName = ".cctor";
-
- internal abstract MethodInfo GetMethodInfo();
-
- internal override MethodBase BindTypeParameters(Type type)
- {
- return new ConstructorInfoImpl((MethodInfo)GetMethodInfo().BindTypeParameters(type));
- }
-
- public sealed override MethodBase __GetMethodOnTypeDefinition()
- {
- return new ConstructorInfoImpl((MethodInfo)GetMethodInfo().__GetMethodOnTypeDefinition());
- }
-
- public sealed override MemberTypes MemberType
- {
- get { return MemberTypes.Constructor; }
- }
-
- public sealed override int __MethodRVA
- {
- get { return GetMethodInfo().__MethodRVA; }
- }
-
- public sealed override bool ContainsGenericParameters
- {
- get { return GetMethodInfo().ContainsGenericParameters; }
- }
-
- public ParameterInfo __ReturnParameter
- {
- get { return new ParameterInfoWrapper(this, GetMethodInfo().ReturnParameter); }
- }
-
- public sealed override ParameterInfo[] GetParameters()
- {
- ParameterInfo[] parameters = GetMethodInfo().GetParameters();
- for (int i = 0; i < parameters.Length; i++)
- {
- parameters[i] = new ParameterInfoWrapper(this, parameters[i]);
- }
- return parameters;
- }
-
- public sealed override CallingConventions CallingConvention
- {
- get { return GetMethodInfo().CallingConvention; }
- }
-
- public sealed override MethodAttributes Attributes
- {
- get { return GetMethodInfo().Attributes; }
- }
-
- public sealed override MethodImplAttributes GetMethodImplementationFlags()
- {
- return GetMethodInfo().GetMethodImplementationFlags();
- }
-
- public sealed override Type DeclaringType
- {
- get { return GetMethodInfo().DeclaringType; }
- }
-
- public sealed override string Name
- {
- get { return GetMethodInfo().Name; }
- }
-
- public sealed override int MetadataToken
- {
- get { return GetMethodInfo().MetadataToken; }
- }
-
- public sealed override Module Module
- {
- get { return GetMethodInfo().Module; }
- }
-
- public sealed override MethodBody GetMethodBody()
- {
- return GetMethodInfo().GetMethodBody();
- }
-
- public sealed override bool __IsMissing
- {
- get { return GetMethodInfo().__IsMissing; }
- }
-
- internal sealed override int ParameterCount
- {
- get { return GetMethodInfo().ParameterCount; }
- }
-
- internal sealed override MemberInfo SetReflectedType(Type type)
- {
- return new ConstructorInfoWithReflectedType(type, this);
- }
-
- internal sealed override int GetCurrentToken()
- {
- return GetMethodInfo().GetCurrentToken();
- }
-
- internal sealed override List<CustomAttributeData> GetPseudoCustomAttributes(Type attributeType)
- {
- return GetMethodInfo().GetPseudoCustomAttributes(attributeType);
- }
-
- internal sealed override bool IsBaked
- {
- get { return GetMethodInfo().IsBaked; }
- }
-
- internal sealed override MethodSignature MethodSignature
- {
- get { return GetMethodInfo().MethodSignature; }
- }
-
- internal sealed override int ImportTo(Emit.ModuleBuilder module)
- {
- return GetMethodInfo().ImportTo(module);
- }
- }
-
- sealed class ConstructorInfoImpl : ConstructorInfo
- {
- private readonly MethodInfo method;
-
- internal ConstructorInfoImpl(MethodInfo method)
- {
- this.method = method;
- }
-
- public override bool Equals(object obj)
- {
- ConstructorInfoImpl other = obj as ConstructorInfoImpl;
- return other != null && other.method.Equals(method);
- }
-
- public override int GetHashCode()
- {
- return method.GetHashCode();
- }
-
- internal override MethodInfo GetMethodInfo()
- {
- return method;
- }
-
- internal override MethodInfo GetMethodOnTypeDefinition()
- {
- return method.GetMethodOnTypeDefinition();
- }
- }
-
- sealed class ConstructorInfoWithReflectedType : ConstructorInfo
- {
- private readonly Type reflectedType;
- private readonly ConstructorInfo ctor;
-
- internal ConstructorInfoWithReflectedType(Type reflectedType, ConstructorInfo ctor)
- {
- Debug.Assert(reflectedType != ctor.DeclaringType);
- this.reflectedType = reflectedType;
- this.ctor = ctor;
- }
-
- public override bool Equals(object obj)
- {
- ConstructorInfoWithReflectedType other = obj as ConstructorInfoWithReflectedType;
- return other != null
- && other.reflectedType == reflectedType
- && other.ctor == ctor;
- }
-
- public override int GetHashCode()
- {
- return reflectedType.GetHashCode() ^ ctor.GetHashCode();
- }
-
- public override Type ReflectedType
- {
- get { return reflectedType; }
- }
-
- internal override MethodInfo GetMethodInfo()
- {
- return ctor.GetMethodInfo();
- }
-
- internal override MethodInfo GetMethodOnTypeDefinition()
- {
- return ctor.GetMethodOnTypeDefinition();
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009-2012 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.IO;
-using IKVM.Reflection.Reader;
-using IKVM.Reflection.Emit;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection
-{
- public sealed class CustomAttributeData
- {
- internal static readonly IList<CustomAttributeData> EmptyList = new List<CustomAttributeData>(0).AsReadOnly();
-
- /*
- * There are several states a CustomAttributeData object can be in:
- *
- * 1) Unresolved Custom Attribute
- * - customAttributeIndex >= 0
- * - declSecurityIndex == -1
- * - declSecurityBlob == null
- * - lazyConstructor = null
- * - lazyConstructorArguments = null
- * - lazyNamedArguments = null
- *
- * 2) Resolved Custom Attribute
- * - customAttributeIndex >= 0
- * - declSecurityIndex == -1
- * - declSecurityBlob == null
- * - lazyConstructor != null
- * - lazyConstructorArguments != null
- * - lazyNamedArguments != null
- *
- * 3) Pre-resolved Custom Attribute
- * - customAttributeIndex = -1
- * - declSecurityIndex == -1
- * - declSecurityBlob == null
- * - lazyConstructor != null
- * - lazyConstructorArguments != null
- * - lazyNamedArguments != null
- *
- * 4) Pseudo Custom Attribute, .NET 1.x declarative security or result of CustomAttributeBuilder.ToData()
- * - customAttributeIndex = -1
- * - declSecurityIndex == -1
- * - declSecurityBlob == null
- * - lazyConstructor != null
- * - lazyConstructorArguments != null
- * - lazyNamedArguments != null
- *
- * 5) Unresolved declarative security
- * - customAttributeIndex = -1
- * - declSecurityIndex >= 0
- * - declSecurityBlob != null
- * - lazyConstructor != null
- * - lazyConstructorArguments != null
- * - lazyNamedArguments == null
- *
- * 6) Resolved declarative security
- * - customAttributeIndex = -1
- * - declSecurityIndex >= 0
- * - declSecurityBlob == null
- * - lazyConstructor != null
- * - lazyConstructorArguments != null
- * - lazyNamedArguments != null
- *
- */
- private readonly Module module;
- private readonly int customAttributeIndex;
- private readonly int declSecurityIndex;
- private readonly byte[] declSecurityBlob;
- private ConstructorInfo lazyConstructor;
- private IList<CustomAttributeTypedArgument> lazyConstructorArguments;
- private IList<CustomAttributeNamedArgument> lazyNamedArguments;
-
- // 1) Unresolved Custom Attribute
- internal CustomAttributeData(Module module, int index)
- {
- this.module = module;
- this.customAttributeIndex = index;
- this.declSecurityIndex = -1;
- }
-
- // 4) Pseudo Custom Attribute, .NET 1.x declarative security
- internal CustomAttributeData(Module module, ConstructorInfo constructor, object[] args, List<CustomAttributeNamedArgument> namedArguments)
- : this(module, constructor, WrapConstructorArgs(args, constructor.MethodSignature), namedArguments)
- {
- }
-
- private static List<CustomAttributeTypedArgument> WrapConstructorArgs(object[] args, MethodSignature sig)
- {
- List<CustomAttributeTypedArgument> list = new List<CustomAttributeTypedArgument>();
- for (int i = 0; i < args.Length; i++)
- {
- list.Add(new CustomAttributeTypedArgument(sig.GetParameterType(i), args[i]));
- }
- return list;
- }
-
- // 4) Pseudo Custom Attribute, .NET 1.x declarative security or result of CustomAttributeBuilder.ToData()
- internal CustomAttributeData(Module module, ConstructorInfo constructor, List<CustomAttributeTypedArgument> constructorArgs, List<CustomAttributeNamedArgument> namedArguments)
- {
- this.module = module;
- this.customAttributeIndex = -1;
- this.declSecurityIndex = -1;
- this.lazyConstructor = constructor;
- lazyConstructorArguments = constructorArgs.AsReadOnly();
- if (namedArguments == null)
- {
- this.lazyNamedArguments = Empty<CustomAttributeNamedArgument>.Array;
- }
- else
- {
- this.lazyNamedArguments = namedArguments.AsReadOnly();
- }
- }
-
- // 3) Pre-resolved Custom Attribute
- internal CustomAttributeData(Assembly asm, ConstructorInfo constructor, ByteReader br)
- {
- this.module = asm.ManifestModule;
- this.customAttributeIndex = -1;
- this.declSecurityIndex = -1;
- this.lazyConstructor = constructor;
- if (br.Length == 0)
- {
- // it's legal to have an empty blob
- lazyConstructorArguments = Empty<CustomAttributeTypedArgument>.Array;
- lazyNamedArguments = Empty<CustomAttributeNamedArgument>.Array;
- }
- else
- {
- if (br.ReadUInt16() != 1)
- {
- throw new BadImageFormatException();
- }
- lazyConstructorArguments = ReadConstructorArguments(asm, br, constructor);
- lazyNamedArguments = ReadNamedArguments(asm, br, br.ReadUInt16(), constructor.DeclaringType);
- }
- }
-
- public override string ToString()
- {
- StringBuilder sb = new StringBuilder();
- sb.Append('[');
- sb.Append(Constructor.DeclaringType.FullName);
- sb.Append('(');
- string sep = "";
- ParameterInfo[] parameters = Constructor.GetParameters();
- IList<CustomAttributeTypedArgument> args = ConstructorArguments;
- for (int i = 0; i < parameters.Length; i++)
- {
- sb.Append(sep);
- sep = ", ";
- AppendValue(sb, parameters[i].ParameterType, args[i]);
- }
- foreach (CustomAttributeNamedArgument named in NamedArguments)
- {
- sb.Append(sep);
- sep = ", ";
- sb.Append(named.MemberInfo.Name);
- sb.Append(" = ");
- FieldInfo fi = named.MemberInfo as FieldInfo;
- Type type = fi != null ? fi.FieldType : ((PropertyInfo)named.MemberInfo).PropertyType;
- AppendValue(sb, type, named.TypedValue);
- }
- sb.Append(')');
- sb.Append(']');
- return sb.ToString();
- }
-
- private static void AppendValue(StringBuilder sb, Type type, CustomAttributeTypedArgument arg)
- {
- if (arg.ArgumentType == arg.ArgumentType.Module.universe.System_String)
- {
- sb.Append('"').Append(arg.Value).Append('"');
- }
- else if (arg.ArgumentType.IsArray)
- {
- Type elementType = arg.ArgumentType.GetElementType();
- string elementTypeName;
- if (elementType.IsPrimitive
- || elementType == type.Module.universe.System_Object
- || elementType == type.Module.universe.System_String
- || elementType == type.Module.universe.System_Type)
- {
- elementTypeName = elementType.Name;
- }
- else
- {
- elementTypeName = elementType.FullName;
- }
- sb.Append("new ").Append(elementTypeName).Append("[").Append(((Array)arg.Value).Length).Append("] { ");
- string sep = "";
- foreach (CustomAttributeTypedArgument elem in (CustomAttributeTypedArgument[])arg.Value)
- {
- sb.Append(sep);
- sep = ", ";
- AppendValue(sb, elementType, elem);
- }
- sb.Append(" }");
- }
- else
- {
- if (arg.ArgumentType != type || (type.IsEnum && !arg.Value.Equals(0)))
- {
- sb.Append('(');
- sb.Append(arg.ArgumentType.FullName);
- sb.Append(')');
- }
- sb.Append(arg.Value);
- }
- }
-
- internal static void ReadDeclarativeSecurity(Module module, int index, List<CustomAttributeData> list)
- {
- Universe u = module.universe;
- Assembly asm = module.Assembly;
- int action = module.DeclSecurity.records[index].Action;
- ByteReader br = module.GetBlob(module.DeclSecurity.records[index].PermissionSet);
- if (br.PeekByte() == '.')
- {
- br.ReadByte();
- int count = br.ReadCompressedInt();
- for (int j = 0; j < count; j++)
- {
- Type type = ReadType(asm, br);
- ConstructorInfo constructor = type.GetPseudoCustomAttributeConstructor(u.System_Security_Permissions_SecurityAction);
- // LAMESPEC there is an additional length here (probably of the named argument list)
- byte[] blob = br.ReadBytes(br.ReadCompressedInt());
- list.Add(new CustomAttributeData(asm, constructor, action, blob, index));
- }
- }
- else
- {
- // .NET 1.x format (xml)
- char[] buf = new char[br.Length / 2];
- for (int i = 0; i < buf.Length; i++)
- {
- buf[i] = br.ReadChar();
- }
- string xml = new String(buf);
- ConstructorInfo constructor = u.System_Security_Permissions_PermissionSetAttribute.GetPseudoCustomAttributeConstructor(u.System_Security_Permissions_SecurityAction);
- List<CustomAttributeNamedArgument> args = new List<CustomAttributeNamedArgument>();
- args.Add(new CustomAttributeNamedArgument(GetProperty(u.System_Security_Permissions_PermissionSetAttribute, "XML", u.System_String),
- new CustomAttributeTypedArgument(u.System_String, xml)));
- list.Add(new CustomAttributeData(asm.ManifestModule, constructor, new object[] { action }, args));
- }
- }
-
- // 5) Unresolved declarative security
- internal CustomAttributeData(Assembly asm, ConstructorInfo constructor, int securityAction, byte[] blob, int index)
- {
- this.module = asm.ManifestModule;
- this.customAttributeIndex = -1;
- this.declSecurityIndex = index;
- Universe u = constructor.Module.universe;
- this.lazyConstructor = constructor;
- List<CustomAttributeTypedArgument> list = new List<CustomAttributeTypedArgument>();
- list.Add(new CustomAttributeTypedArgument(u.System_Security_Permissions_SecurityAction, securityAction));
- this.lazyConstructorArguments = list.AsReadOnly();
- this.declSecurityBlob = blob;
- }
-
- private static Type ReadFieldOrPropType(Assembly asm, ByteReader br)
- {
- Universe u = asm.universe;
- switch (br.ReadByte())
- {
- case Signature.ELEMENT_TYPE_BOOLEAN:
- return u.System_Boolean;
- case Signature.ELEMENT_TYPE_CHAR:
- return u.System_Char;
- case Signature.ELEMENT_TYPE_I1:
- return u.System_SByte;
- case Signature.ELEMENT_TYPE_U1:
- return u.System_Byte;
- case Signature.ELEMENT_TYPE_I2:
- return u.System_Int16;
- case Signature.ELEMENT_TYPE_U2:
- return u.System_UInt16;
- case Signature.ELEMENT_TYPE_I4:
- return u.System_Int32;
- case Signature.ELEMENT_TYPE_U4:
- return u.System_UInt32;
- case Signature.ELEMENT_TYPE_I8:
- return u.System_Int64;
- case Signature.ELEMENT_TYPE_U8:
- return u.System_UInt64;
- case Signature.ELEMENT_TYPE_R4:
- return u.System_Single;
- case Signature.ELEMENT_TYPE_R8:
- return u.System_Double;
- case Signature.ELEMENT_TYPE_STRING:
- return u.System_String;
- case Signature.ELEMENT_TYPE_SZARRAY:
- return ReadFieldOrPropType(asm, br).MakeArrayType();
- case 0x55:
- return ReadType(asm, br);
- case 0x50:
- return u.System_Type;
- case 0x51:
- return u.System_Object;
- default:
- throw new BadImageFormatException();
- }
- }
-
- private static CustomAttributeTypedArgument ReadFixedArg(Assembly asm, ByteReader br, Type type)
- {
- Universe u = asm.universe;
- if (type == u.System_String)
- {
- return new CustomAttributeTypedArgument(type, br.ReadString());
- }
- else if (type == u.System_Boolean)
- {
- return new CustomAttributeTypedArgument(type, br.ReadByte() != 0);
- }
- else if (type == u.System_Char)
- {
- return new CustomAttributeTypedArgument(type, br.ReadChar());
- }
- else if (type == u.System_Single)
- {
- return new CustomAttributeTypedArgument(type, br.ReadSingle());
- }
- else if (type == u.System_Double)
- {
- return new CustomAttributeTypedArgument(type, br.ReadDouble());
- }
- else if (type == u.System_SByte)
- {
- return new CustomAttributeTypedArgument(type, br.ReadSByte());
- }
- else if (type == u.System_Int16)
- {
- return new CustomAttributeTypedArgument(type, br.ReadInt16());
- }
- else if (type == u.System_Int32)
- {
- return new CustomAttributeTypedArgument(type, br.ReadInt32());
- }
- else if (type == u.System_Int64)
- {
- return new CustomAttributeTypedArgument(type, br.ReadInt64());
- }
- else if (type == u.System_Byte)
- {
- return new CustomAttributeTypedArgument(type, br.ReadByte());
- }
- else if (type == u.System_UInt16)
- {
- return new CustomAttributeTypedArgument(type, br.ReadUInt16());
- }
- else if (type == u.System_UInt32)
- {
- return new CustomAttributeTypedArgument(type, br.ReadUInt32());
- }
- else if (type == u.System_UInt64)
- {
- return new CustomAttributeTypedArgument(type, br.ReadUInt64());
- }
- else if (type == u.System_Type)
- {
- return new CustomAttributeTypedArgument(type, ReadType(asm, br));
- }
- else if (type == u.System_Object)
- {
- return ReadFixedArg(asm, br, ReadFieldOrPropType(asm, br));
- }
- else if (type.IsArray)
- {
- int length = br.ReadInt32();
- if (length == -1)
- {
- return new CustomAttributeTypedArgument(type, null);
- }
- Type elementType = type.GetElementType();
- CustomAttributeTypedArgument[] array = new CustomAttributeTypedArgument[length];
- for (int i = 0; i < length; i++)
- {
- array[i] = ReadFixedArg(asm, br, elementType);
- }
- return new CustomAttributeTypedArgument(type, array);
- }
- else if (type.IsEnum)
- {
- return new CustomAttributeTypedArgument(type, ReadFixedArg(asm, br, type.GetEnumUnderlyingTypeImpl()).Value);
- }
- else
- {
- throw new InvalidOperationException();
- }
- }
-
- private static Type ReadType(Assembly asm, ByteReader br)
- {
- string typeName = br.ReadString();
- if (typeName == null)
- {
- return null;
- }
- if (typeName.Length > 0 && typeName[typeName.Length - 1] == 0)
- {
- // there are broken compilers that emit an extra NUL character after the type name
- typeName = typeName.Substring(0, typeName.Length - 1);
- }
- return TypeNameParser.Parse(typeName, true).GetType(asm.universe, asm, true, typeName, true, false);
- }
-
- private static IList<CustomAttributeTypedArgument> ReadConstructorArguments(Assembly asm, ByteReader br, ConstructorInfo constructor)
- {
- MethodSignature sig = constructor.MethodSignature;
- int count = sig.GetParameterCount();
- List<CustomAttributeTypedArgument> list = new List<CustomAttributeTypedArgument>(count);
- for (int i = 0; i < count; i++)
- {
- list.Add(ReadFixedArg(asm, br, sig.GetParameterType(i)));
- }
- return list.AsReadOnly();
- }
-
- private static IList<CustomAttributeNamedArgument> ReadNamedArguments(Assembly asm, ByteReader br, int named, Type type)
- {
- List<CustomAttributeNamedArgument> list = new List<CustomAttributeNamedArgument>(named);
- for (int i = 0; i < named; i++)
- {
- byte fieldOrProperty = br.ReadByte();
- Type fieldOrPropertyType = ReadFieldOrPropType(asm, br);
- string name = br.ReadString();
- CustomAttributeTypedArgument value = ReadFixedArg(asm, br, fieldOrPropertyType);
- MemberInfo member;
- switch (fieldOrProperty)
- {
- case 0x53:
- member = GetField(type, name, fieldOrPropertyType);
- break;
- case 0x54:
- member = GetProperty(type, name, fieldOrPropertyType);
- break;
- default:
- throw new BadImageFormatException();
- }
- list.Add(new CustomAttributeNamedArgument(member, value));
- }
- return list.AsReadOnly();
- }
-
- private static FieldInfo GetField(Type type, string name, Type fieldType)
- {
- Type org = type;
- for (; type != null && !type.__IsMissing; type = type.BaseType)
- {
- foreach (FieldInfo field in type.__GetDeclaredFields())
- {
- if (field.IsPublic && !field.IsStatic && field.Name == name)
- {
- return field;
- }
- }
- }
- // if the field is missing, we stick the missing field on the first missing base type
- if (type == null)
- {
- type = org;
- }
- FieldSignature sig = FieldSignature.Create(fieldType, new CustomModifiers());
- return type.FindField(name, sig)
- ?? type.Module.universe.GetMissingFieldOrThrow(type, name, sig);
- }
-
- private static PropertyInfo GetProperty(Type type, string name, Type propertyType)
- {
- Type org = type;
- for (; type != null && !type.__IsMissing; type = type.BaseType)
- {
- foreach (PropertyInfo property in type.__GetDeclaredProperties())
- {
- if (property.IsPublic && !property.IsStatic && property.Name == name)
- {
- return property;
- }
- }
- }
- // if the property is missing, we stick the missing property on the first missing base type
- if (type == null)
- {
- type = org;
- }
- return type.Module.universe.GetMissingPropertyOrThrow(type, name, PropertySignature.Create(CallingConventions.Standard | CallingConventions.HasThis, propertyType, null, new PackedCustomModifiers()));
- }
-
- [Obsolete("Use AttributeType property instead.")]
- internal bool __TryReadTypeName(out string ns, out string name)
- {
- if (Constructor.DeclaringType.IsNested)
- {
- ns = null;
- name = null;
- return false;
- }
- ns = Constructor.DeclaringType.__Namespace;
- name = Constructor.DeclaringType.__Name;
- return true;
- }
-
- public byte[] __GetBlob()
- {
- if (declSecurityBlob != null)
- {
- return (byte[])declSecurityBlob.Clone();
- }
- else if (customAttributeIndex == -1)
- {
- return __ToBuilder().GetBlob(module.Assembly);
- }
- else
- {
- return ((ModuleReader)module).GetBlobCopy(module.CustomAttribute.records[customAttributeIndex].Value);
- }
- }
-
- public int __Parent
- {
- get
- {
- return customAttributeIndex >= 0
- ? module.CustomAttribute.records[customAttributeIndex].Parent
- : declSecurityIndex >= 0
- ? module.DeclSecurity.records[declSecurityIndex].Parent
- : 0;
- }
- }
-
- // .NET 4.5 API
- public Type AttributeType
- {
- get { return Constructor.DeclaringType; }
- }
-
- public ConstructorInfo Constructor
- {
- get
- {
- if (lazyConstructor == null)
- {
- lazyConstructor = (ConstructorInfo)module.ResolveMethod(module.CustomAttribute.records[customAttributeIndex].Type);
- }
- return lazyConstructor;
- }
- }
-
- public IList<CustomAttributeTypedArgument> ConstructorArguments
- {
- get
- {
- if (lazyConstructorArguments == null)
- {
- LazyParseArguments();
- }
- return lazyConstructorArguments;
- }
- }
-
- public IList<CustomAttributeNamedArgument> NamedArguments
- {
- get
- {
- if (lazyNamedArguments == null)
- {
- if (customAttributeIndex >= 0)
- {
- // 1) Unresolved Custom Attribute
- LazyParseArguments();
- }
- else
- {
- // 5) Unresolved declarative security
- ByteReader br = new ByteReader(declSecurityBlob, 0, declSecurityBlob.Length);
- // LAMESPEC the count of named arguments is a compressed integer (instead of UInt16 as NumNamed in custom attributes)
- lazyNamedArguments = ReadNamedArguments(module.Assembly, br, br.ReadCompressedInt(), Constructor.DeclaringType);
- }
- }
- return lazyNamedArguments;
- }
- }
-
- private void LazyParseArguments()
- {
- ByteReader br = module.GetBlob(module.CustomAttribute.records[customAttributeIndex].Value);
- if (br.Length == 0)
- {
- // it's legal to have an empty blob
- lazyConstructorArguments = Empty<CustomAttributeTypedArgument>.Array;
- lazyNamedArguments = Empty<CustomAttributeNamedArgument>.Array;
- }
- else
- {
- if (br.ReadUInt16() != 1)
- {
- throw new BadImageFormatException();
- }
- lazyConstructorArguments = ReadConstructorArguments(module.Assembly, br, Constructor);
- lazyNamedArguments = ReadNamedArguments(module.Assembly, br, br.ReadUInt16(), Constructor.DeclaringType);
- }
- }
-
- public CustomAttributeBuilder __ToBuilder()
- {
- ParameterInfo[] parameters = Constructor.GetParameters();
- object[] args = new object[ConstructorArguments.Count];
- for (int i = 0; i < args.Length; i++)
- {
- args[i] = RewrapArray(parameters[i].ParameterType, ConstructorArguments[i]);
- }
- List<PropertyInfo> namedProperties = new List<PropertyInfo>();
- List<object> propertyValues = new List<object>();
- List<FieldInfo> namedFields = new List<FieldInfo>();
- List<object> fieldValues = new List<object>();
- foreach (CustomAttributeNamedArgument named in NamedArguments)
- {
- PropertyInfo pi = named.MemberInfo as PropertyInfo;
- if (pi != null)
- {
- namedProperties.Add(pi);
- propertyValues.Add(RewrapArray(pi.PropertyType, named.TypedValue));
- }
- else
- {
- FieldInfo fi = (FieldInfo)named.MemberInfo;
- namedFields.Add(fi);
- fieldValues.Add(RewrapArray(fi.FieldType, named.TypedValue));
- }
- }
- return new CustomAttributeBuilder(Constructor, args, namedProperties.ToArray(), propertyValues.ToArray(), namedFields.ToArray(), fieldValues.ToArray());
- }
-
- private static object RewrapArray(Type type, CustomAttributeTypedArgument arg)
- {
- IList<CustomAttributeTypedArgument> list = arg.Value as IList<CustomAttributeTypedArgument>;
- if (list != null)
- {
- Type elementType = arg.ArgumentType.GetElementType();
- object[] arr = new object[list.Count];
- for (int i = 0; i < arr.Length; i++)
- {
- arr[i] = RewrapArray(elementType, list[i]);
- }
- if (type == type.Module.universe.System_Object)
- {
- return CustomAttributeBuilder.__MakeTypedArgument(arg.ArgumentType, arr);
- }
- return arr;
- }
- else
- {
- return arg.Value;
- }
- }
-
- public static IList<CustomAttributeData> GetCustomAttributes(MemberInfo member)
- {
- return __GetCustomAttributes(member, null, false);
- }
-
- public static IList<CustomAttributeData> GetCustomAttributes(Assembly assembly)
- {
- return assembly.GetCustomAttributesData(null);
- }
-
- public static IList<CustomAttributeData> GetCustomAttributes(Module module)
- {
- return __GetCustomAttributes(module, null, false);
- }
-
- public static IList<CustomAttributeData> GetCustomAttributes(ParameterInfo parameter)
- {
- return __GetCustomAttributes(parameter, null, false);
- }
-
- public static IList<CustomAttributeData> __GetCustomAttributes(Assembly assembly, Type attributeType, bool inherit)
- {
- return assembly.GetCustomAttributesData(attributeType);
- }
-
- public static IList<CustomAttributeData> __GetCustomAttributes(Module module, Type attributeType, bool inherit)
- {
- if (module.__IsMissing)
- {
- throw new MissingModuleException((MissingModule)module);
- }
- return GetCustomAttributesImpl(null, module, 0x00000001, attributeType) ?? EmptyList;
- }
-
- public static IList<CustomAttributeData> __GetCustomAttributes(ParameterInfo parameter, Type attributeType, bool inherit)
- {
- Module module = parameter.Module;
- List<CustomAttributeData> list = null;
- if (module.universe.ReturnPseudoCustomAttributes)
- {
- if (attributeType == null || attributeType.IsAssignableFrom(parameter.Module.universe.System_Runtime_InteropServices_MarshalAsAttribute))
- {
- FieldMarshal spec;
- if (parameter.__TryGetFieldMarshal(out spec))
- {
- if (list == null)
- {
- list = new List<CustomAttributeData>();
- }
- list.Add(CustomAttributeData.CreateMarshalAsPseudoCustomAttribute(parameter.Module, spec));
- }
- }
- }
- ModuleBuilder mb = module as ModuleBuilder;
- int token = parameter.MetadataToken;
- if (mb != null && mb.IsSaved && mb.IsPseudoToken(token))
- {
- token = mb.ResolvePseudoToken(token);
- }
- return GetCustomAttributesImpl(list, module, token, attributeType) ?? EmptyList;
- }
-
- public static IList<CustomAttributeData> __GetCustomAttributes(MemberInfo member, Type attributeType, bool inherit)
- {
- if (!member.IsBaked)
- {
- // like .NET we we don't return custom attributes for unbaked members
- throw new NotImplementedException();
- }
- if (!inherit || !IsInheritableAttribute(attributeType))
- {
- return GetCustomAttributesImpl(null, member, attributeType) ?? EmptyList;
- }
- List<CustomAttributeData> list = new List<CustomAttributeData>();
- for (; ; )
- {
- GetCustomAttributesImpl(list, member, attributeType);
- Type type = member as Type;
- if (type != null)
- {
- type = type.BaseType;
- if (type == null)
- {
- return list;
- }
- member = type;
- continue;
- }
- MethodInfo method = member as MethodInfo;
- if (method != null)
- {
- MemberInfo prev = member;
- method = method.GetBaseDefinition();
- if (method == null || method == prev)
- {
- return list;
- }
- member = method;
- continue;
- }
- return list;
- }
- }
-
- private static List<CustomAttributeData> GetCustomAttributesImpl(List<CustomAttributeData> list, MemberInfo member, Type attributeType)
- {
- if (member.Module.universe.ReturnPseudoCustomAttributes)
- {
- List<CustomAttributeData> pseudo = member.GetPseudoCustomAttributes(attributeType);
- if (list == null)
- {
- list = pseudo;
- }
- else if (pseudo != null)
- {
- list.AddRange(pseudo);
- }
- }
- return GetCustomAttributesImpl(list, member.Module, member.GetCurrentToken(), attributeType);
- }
-
- internal static List<CustomAttributeData> GetCustomAttributesImpl(List<CustomAttributeData> list, Module module, int token, Type attributeType)
- {
- foreach (int i in module.CustomAttribute.Filter(token))
- {
- if (attributeType == null)
- {
- if (list == null)
- {
- list = new List<CustomAttributeData>();
- }
- list.Add(new CustomAttributeData(module, i));
- }
- else
- {
- if (attributeType.IsAssignableFrom(module.ResolveMethod(module.CustomAttribute.records[i].Type).DeclaringType))
- {
- if (list == null)
- {
- list = new List<CustomAttributeData>();
- }
- list.Add(new CustomAttributeData(module, i));
- }
- }
- }
- return list;
- }
-
- public static IList<CustomAttributeData> __GetCustomAttributes(Type type, Type interfaceType, Type attributeType, bool inherit)
- {
- Module module = type.Module;
- foreach (int i in module.InterfaceImpl.Filter(type.MetadataToken))
- {
- if (module.ResolveType(module.InterfaceImpl.records[i].Interface, type) == interfaceType)
- {
- return GetCustomAttributesImpl(null, module, (InterfaceImplTable.Index << 24) | (i + 1), attributeType) ?? EmptyList;
- }
- }
- return EmptyList;
- }
-
- public static IList<CustomAttributeData> __GetDeclarativeSecurity(Assembly assembly)
- {
- if (assembly.__IsMissing)
- {
- throw new MissingAssemblyException((MissingAssembly)assembly);
- }
- return assembly.ManifestModule.GetDeclarativeSecurity(0x20000001);
- }
-
- public static IList<CustomAttributeData> __GetDeclarativeSecurity(Type type)
- {
- if ((type.Attributes & TypeAttributes.HasSecurity) != 0)
- {
- return type.Module.GetDeclarativeSecurity(type.MetadataToken);
- }
- else
- {
- return EmptyList;
- }
- }
-
- public static IList<CustomAttributeData> __GetDeclarativeSecurity(MethodBase method)
- {
- if ((method.Attributes & MethodAttributes.HasSecurity) != 0)
- {
- return method.Module.GetDeclarativeSecurity(method.MetadataToken);
- }
- else
- {
- return EmptyList;
- }
- }
-
- private static bool IsInheritableAttribute(Type attribute)
- {
- Type attributeUsageAttribute = attribute.Module.universe.System_AttributeUsageAttribute;
- IList<CustomAttributeData> attr = __GetCustomAttributes(attribute, attributeUsageAttribute, false);
- if (attr.Count != 0)
- {
- foreach (CustomAttributeNamedArgument named in attr[0].NamedArguments)
- {
- if (named.MemberInfo.Name == "Inherited")
- {
- return (bool)named.TypedValue.Value;
- }
- }
- }
- return true;
- }
-
- internal static CustomAttributeData CreateDllImportPseudoCustomAttribute(Module module, ImplMapFlags flags, string entryPoint, string dllName, MethodImplAttributes attr)
- {
- Type type = module.universe.System_Runtime_InteropServices_DllImportAttribute;
- ConstructorInfo constructor = type.GetPseudoCustomAttributeConstructor(module.universe.System_String);
- List<CustomAttributeNamedArgument> list = new List<CustomAttributeNamedArgument>();
- System.Runtime.InteropServices.CharSet charSet;
- switch (flags & ImplMapFlags.CharSetMask)
- {
- case ImplMapFlags.CharSetAnsi:
- charSet = System.Runtime.InteropServices.CharSet.Ansi;
- break;
- case ImplMapFlags.CharSetUnicode:
- charSet = System.Runtime.InteropServices.CharSet.Unicode;
- break;
- case ImplMapFlags.CharSetAuto:
- charSet = System.Runtime.InteropServices.CharSet.Auto;
- break;
- case ImplMapFlags.CharSetNotSpec:
- default:
- charSet = System.Runtime.InteropServices.CharSet.None;
- break;
- }
- System.Runtime.InteropServices.CallingConvention callingConvention;
- switch (flags & ImplMapFlags.CallConvMask)
- {
- case ImplMapFlags.CallConvCdecl:
- callingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl;
- break;
- case ImplMapFlags.CallConvFastcall:
- callingConvention = System.Runtime.InteropServices.CallingConvention.FastCall;
- break;
- case ImplMapFlags.CallConvStdcall:
- callingConvention = System.Runtime.InteropServices.CallingConvention.StdCall;
- break;
- case ImplMapFlags.CallConvThiscall:
- callingConvention = System.Runtime.InteropServices.CallingConvention.ThisCall;
- break;
- case ImplMapFlags.CallConvWinapi:
- callingConvention = System.Runtime.InteropServices.CallingConvention.Winapi;
- break;
- default:
- callingConvention = 0;
- break;
- }
- AddNamedArgument(list, type, "EntryPoint", entryPoint);
- AddNamedArgument(list, type, "CharSet", module.universe.System_Runtime_InteropServices_CharSet, (int)charSet);
- AddNamedArgument(list, type, "ExactSpelling", (int)flags, (int)ImplMapFlags.NoMangle);
- AddNamedArgument(list, type, "SetLastError", (int)flags, (int)ImplMapFlags.SupportsLastError);
- AddNamedArgument(list, type, "PreserveSig", (int)attr, (int)MethodImplAttributes.PreserveSig);
- AddNamedArgument(list, type, "CallingConvention", module.universe.System_Runtime_InteropServices_CallingConvention, (int)callingConvention);
- AddNamedArgument(list, type, "BestFitMapping", (int)flags, (int)ImplMapFlags.BestFitOn);
- AddNamedArgument(list, type, "ThrowOnUnmappableChar", (int)flags, (int)ImplMapFlags.CharMapErrorOn);
- return new CustomAttributeData(module, constructor, new object[] { dllName }, list);
- }
-
- internal static CustomAttributeData CreateMarshalAsPseudoCustomAttribute(Module module, FieldMarshal fm)
- {
- Type typeofMarshalAs = module.universe.System_Runtime_InteropServices_MarshalAsAttribute;
- Type typeofUnmanagedType = module.universe.System_Runtime_InteropServices_UnmanagedType;
- Type typeofVarEnum = module.universe.System_Runtime_InteropServices_VarEnum;
- Type typeofType = module.universe.System_Type;
- List<CustomAttributeNamedArgument> named = new List<CustomAttributeNamedArgument>();
- AddNamedArgument(named, typeofMarshalAs, "ArraySubType", typeofUnmanagedType, (int)(fm.ArraySubType ?? 0));
- AddNamedArgument(named, typeofMarshalAs, "SizeParamIndex", module.universe.System_Int16, fm.SizeParamIndex ?? 0);
- AddNamedArgument(named, typeofMarshalAs, "SizeConst", module.universe.System_Int32, fm.SizeConst ?? 0);
- AddNamedArgument(named, typeofMarshalAs, "IidParameterIndex", module.universe.System_Int32, fm.IidParameterIndex ?? 0);
- AddNamedArgument(named, typeofMarshalAs, "SafeArraySubType", typeofVarEnum, (int)(fm.SafeArraySubType ?? 0));
- if (fm.SafeArrayUserDefinedSubType != null)
- {
- AddNamedArgument(named, typeofMarshalAs, "SafeArrayUserDefinedSubType", typeofType, fm.SafeArrayUserDefinedSubType);
- }
- if (fm.MarshalType != null)
- {
- AddNamedArgument(named, typeofMarshalAs, "MarshalType", module.universe.System_String, fm.MarshalType);
- }
- if (fm.MarshalTypeRef != null)
- {
- AddNamedArgument(named, typeofMarshalAs, "MarshalTypeRef", module.universe.System_Type, fm.MarshalTypeRef);
- }
- if (fm.MarshalCookie != null)
- {
- AddNamedArgument(named, typeofMarshalAs, "MarshalCookie", module.universe.System_String, fm.MarshalCookie);
- }
- ConstructorInfo constructor = typeofMarshalAs.GetPseudoCustomAttributeConstructor(typeofUnmanagedType);
- return new CustomAttributeData(module, constructor, new object[] { (int)fm.UnmanagedType }, named);
- }
-
- private static void AddNamedArgument(List<CustomAttributeNamedArgument> list, Type type, string fieldName, string value)
- {
- AddNamedArgument(list, type, fieldName, type.Module.universe.System_String, value);
- }
-
- private static void AddNamedArgument(List<CustomAttributeNamedArgument> list, Type type, string fieldName, int flags, int flagMask)
- {
- AddNamedArgument(list, type, fieldName, type.Module.universe.System_Boolean, (flags & flagMask) != 0);
- }
-
- private static void AddNamedArgument(List<CustomAttributeNamedArgument> list, Type attributeType, string fieldName, Type valueType, object value)
- {
- // some fields are not available on the .NET Compact Framework version of DllImportAttribute/MarshalAsAttribute
- FieldInfo field = attributeType.FindField(fieldName, FieldSignature.Create(valueType, new CustomModifiers()));
- if (field != null)
- {
- list.Add(new CustomAttributeNamedArgument(field, new CustomAttributeTypedArgument(valueType, value)));
- }
- }
-
- internal static CustomAttributeData CreateFieldOffsetPseudoCustomAttribute(Module module, int offset)
- {
- Type type = module.universe.System_Runtime_InteropServices_FieldOffsetAttribute;
- ConstructorInfo constructor = type.GetPseudoCustomAttributeConstructor(module.universe.System_Int32);
- return new CustomAttributeData(module, constructor, new object[] { offset }, null);
- }
-
- internal static CustomAttributeData CreatePreserveSigPseudoCustomAttribute(Module module)
- {
- Type type = module.universe.System_Runtime_InteropServices_PreserveSigAttribute;
- ConstructorInfo constructor = type.GetPseudoCustomAttributeConstructor();
- return new CustomAttributeData(module, constructor, Empty<object>.Array, null);
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace IKVM.Reflection
-{
- public struct CustomAttributeNamedArgument
- {
- private readonly MemberInfo member;
- private readonly CustomAttributeTypedArgument value;
-
- internal CustomAttributeNamedArgument(MemberInfo member, CustomAttributeTypedArgument value)
- {
- this.member = member;
- this.value = value;
- }
-
- public override bool Equals(object obj)
- {
- return this == obj as CustomAttributeNamedArgument?;
- }
-
- public override int GetHashCode()
- {
- return member.GetHashCode() ^ 53 * value.GetHashCode();
- }
-
- public MemberInfo MemberInfo
- {
- get { return member; }
- }
-
- public CustomAttributeTypedArgument TypedValue
- {
- get { return value; }
- }
-
- public static bool operator ==(CustomAttributeNamedArgument arg1, CustomAttributeNamedArgument arg2)
- {
- return arg1.member.Equals(arg2.member) && arg1.value == arg2.value;
- }
-
- public static bool operator !=(CustomAttributeNamedArgument arg1, CustomAttributeNamedArgument arg2)
- {
- return !(arg1 == arg2);
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace IKVM.Reflection
-{
- public struct CustomAttributeTypedArgument
- {
- private readonly Type type;
- private readonly object value;
-
- internal CustomAttributeTypedArgument(Type type, object value)
- {
- this.type = type;
- this.value = value;
- }
-
- public override bool Equals(object obj)
- {
- return this == obj as CustomAttributeTypedArgument?;
- }
-
- public override int GetHashCode()
- {
- return type.GetHashCode() ^ 77 * (value == null ? 0 : value.GetHashCode());
- }
-
- public Type ArgumentType
- {
- get { return type; }
- }
-
- public Object Value
- {
- get { return value; }
- }
-
- public static bool operator ==(CustomAttributeTypedArgument arg1, CustomAttributeTypedArgument arg2)
- {
- return arg1.type.Equals(arg2.type) && (arg1.value == arg2.value || (arg1.value != null && arg1.value.Equals(arg2.value)));
- }
-
- public static bool operator !=(CustomAttributeTypedArgument arg1, CustomAttributeTypedArgument arg2)
- {
- return !(arg1 == arg2);
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2011 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Text;
-using IKVM.Reflection.Emit;
-using IKVM.Reflection.Reader;
-
-namespace IKVM.Reflection
-{
- public struct CustomModifiers : IEquatable<CustomModifiers>, IEnumerable<CustomModifiers.Entry>
- {
- // note that FromReqOpt assumes that Initial == ModOpt
- private static Type Initial { get { return MarkerType.ModOpt; } }
- private readonly Type[] types;
-
- internal CustomModifiers(List<CustomModifiersBuilder.Item> list)
- {
- bool required = Initial == MarkerType.ModReq;
- int count = list.Count;
- foreach (CustomModifiersBuilder.Item item in list)
- {
- if (item.required != required)
- {
- required = item.required;
- count++;
- }
- }
- types = new Type[count];
- required = Initial == MarkerType.ModReq;
- int index = 0;
- foreach (CustomModifiersBuilder.Item item in list)
- {
- if (item.required != required)
- {
- required = item.required;
- types[index++] = required ? MarkerType.ModReq : MarkerType.ModOpt;
- }
- types[index++] = item.type;
- }
- }
-
- private CustomModifiers(Type[] types)
- {
- Debug.Assert(types == null || types.Length != 0);
- this.types = types;
- }
-
- public struct Enumerator : IEnumerator<Entry>
- {
- private readonly Type[] types;
- private int index;
- private bool required;
-
- internal Enumerator(Type[] types)
- {
- this.types = types;
- this.index = -1;
- this.required = Initial == MarkerType.ModReq;
- }
-
- void System.Collections.IEnumerator.Reset()
- {
- this.index = -1;
- this.required = Initial == MarkerType.ModReq;
- }
-
- public Entry Current
- {
- get { return new Entry(types[index], required); }
- }
-
- public bool MoveNext()
- {
- if (types == null || index == types.Length)
- {
- return false;
- }
- index++;
- if (index == types.Length)
- {
- return false;
- }
- else if (types[index] == MarkerType.ModOpt)
- {
- required = false;
- index++;
- }
- else if (types[index] == MarkerType.ModReq)
- {
- required = true;
- index++;
- }
- return true;
- }
-
- object System.Collections.IEnumerator.Current
- {
- get { return Current; }
- }
-
- void IDisposable.Dispose()
- {
- }
- }
-
- public struct Entry
- {
- private readonly Type type;
- private readonly bool required;
-
- internal Entry(Type type, bool required)
- {
- this.type = type;
- this.required = required;
- }
-
- public Type Type
- {
- get { return type; }
- }
-
- public bool IsRequired
- {
- get { return required; }
- }
- }
-
- public Enumerator GetEnumerator()
- {
- return new Enumerator(types);
- }
-
- IEnumerator<Entry> IEnumerable<Entry>.GetEnumerator()
- {
- return GetEnumerator();
- }
-
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
-
- public bool IsEmpty
- {
- get { return types == null; }
- }
-
- public bool Equals(CustomModifiers other)
- {
- return Util.ArrayEquals(types, other.types);
- }
-
- public override bool Equals(object obj)
- {
- CustomModifiers? other = obj as CustomModifiers?;
- return other != null && Equals(other.Value);
- }
-
- public override int GetHashCode()
- {
- return Util.GetHashCode(types);
- }
-
- public override string ToString()
- {
- if (types == null)
- {
- return string.Empty;
- }
- StringBuilder sb = new StringBuilder();
- string sep = "";
- foreach (Entry e in this)
- {
- sb.Append(sep).Append(e.IsRequired ? "modreq(" : "modopt(").Append(e.Type.FullName).Append(')');
- sep = " ";
- }
- return sb.ToString();
- }
-
- private Type[] GetRequiredOrOptional(bool required)
- {
- if (types == null)
- {
- return Type.EmptyTypes;
- }
- int count = 0;
- foreach (Entry e in this)
- {
- if (e.IsRequired == required)
- {
- count++;
- }
- }
- Type[] result = new Type[count];
- foreach (Entry e in this)
- {
- if (e.IsRequired == required)
- {
- // FXBUG reflection (and ildasm) return custom modifiers in reverse order
- // while SRE writes them in the specified order
- result[--count] = e.Type;
- }
- }
- return result;
- }
-
- internal Type[] GetRequired()
- {
- return GetRequiredOrOptional(true);
- }
-
- internal Type[] GetOptional()
- {
- return GetRequiredOrOptional(false);
- }
-
- internal CustomModifiers Bind(IGenericBinder binder)
- {
- if (types == null)
- {
- return this;
- }
- Type[] result = types;
- for (int i = 0; i < types.Length; i++)
- {
- if (types[i] == MarkerType.ModOpt || types[i] == MarkerType.ModReq)
- {
- continue;
- }
- Type type = types[i].BindTypeParameters(binder);
- if (!ReferenceEquals(type, types[i]))
- {
- if (result == types)
- {
- result = (Type[])types.Clone();
- }
- result[i] = type;
- }
- }
- return new CustomModifiers(result);
- }
-
- internal static CustomModifiers Read(ModuleReader module, ByteReader br, IGenericContext context)
- {
- byte b = br.PeekByte();
- if (!IsCustomModifier(b))
- {
- return new CustomModifiers();
- }
- List<Type> list = new List<Type>();
- Type mode = Initial;
- do
- {
- Type cmod = br.ReadByte() == Signature.ELEMENT_TYPE_CMOD_REQD ? MarkerType.ModReq : MarkerType.ModOpt;
- if (mode != cmod)
- {
- mode = cmod;
- list.Add(mode);
- }
- list.Add(Signature.ReadTypeDefOrRefEncoded(module, br, context));
- b = br.PeekByte();
- }
- while (IsCustomModifier(b));
- return new CustomModifiers(list.ToArray());
- }
-
- internal static void Skip(ByteReader br)
- {
- byte b = br.PeekByte();
- while (IsCustomModifier(b))
- {
- br.ReadByte();
- br.ReadCompressedInt();
- b = br.PeekByte();
- }
- }
-
- internal static CustomModifiers FromReqOpt(Type[] req, Type[] opt)
- {
- List<Type> list = null;
- if (opt != null && opt.Length != 0)
- {
- Debug.Assert(Initial == MarkerType.ModOpt);
- list = new List<Type>(opt);
- }
- if (req != null && req.Length != 0)
- {
- if (list == null)
- {
- list = new List<Type>();
- }
- list.Add(MarkerType.ModReq);
- list.AddRange(req);
- }
- if (list == null)
- {
- return new CustomModifiers();
- }
- else
- {
- return new CustomModifiers(list.ToArray());
- }
- }
-
- private static bool IsCustomModifier(byte b)
- {
- return b == Signature.ELEMENT_TYPE_CMOD_OPT || b == Signature.ELEMENT_TYPE_CMOD_REQD;
- }
-
- internal static CustomModifiers Combine(CustomModifiers mods1, CustomModifiers mods2)
- {
- if (mods1.IsEmpty)
- {
- return mods2;
- }
- else if (mods2.IsEmpty)
- {
- return mods1;
- }
- else
- {
- Type[] combo = new Type[mods1.types.Length + mods2.types.Length];
- Array.Copy(mods1.types, combo, mods1.types.Length);
- Array.Copy(mods2.types, 0, combo, mods1.types.Length, mods2.types.Length);
- return new CustomModifiers(combo);
- }
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2008-2012 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Configuration.Assemblies;
-using System.IO;
-using System.Diagnostics;
-using System.Globalization;
-using System.Resources;
-using System.Security.Cryptography;
-using System.Security;
-using IKVM.Reflection.Metadata;
-using IKVM.Reflection.Impl;
-using IKVM.Reflection.Writer;
-
-namespace IKVM.Reflection.Emit
-{
- public sealed class AssemblyBuilder : Assembly
- {
- private readonly string name;
- private ushort majorVersion;
- private ushort minorVersion;
- private ushort buildVersion;
- private ushort revisionVersion;
- private string culture;
- private AssemblyNameFlags flags;
- private AssemblyHashAlgorithm hashAlgorithm;
- private StrongNameKeyPair keyPair;
- private byte[] publicKey;
- internal readonly string dir;
- private readonly PermissionSet requiredPermissions;
- private readonly PermissionSet optionalPermissions;
- private readonly PermissionSet refusedPermissions;
- private PEFileKinds fileKind = PEFileKinds.Dll;
- private MethodInfo entryPoint;
- private VersionInfo versionInfo;
- private byte[] win32icon;
- private byte[] win32manifest;
- private byte[] win32resources;
- private string imageRuntimeVersion;
- internal int mdStreamVersion = 0x20000;
- private Module pseudoManifestModule;
- private readonly List<ResourceFile> resourceFiles = new List<ResourceFile>();
- private readonly List<ModuleBuilder> modules = new List<ModuleBuilder>();
- private readonly List<Module> addedModules = new List<Module>();
- private readonly List<CustomAttributeBuilder> customAttributes = new List<CustomAttributeBuilder>();
- private readonly List<CustomAttributeBuilder> declarativeSecurity = new List<CustomAttributeBuilder>();
- private readonly List<Type> typeForwarders = new List<Type>();
-
- private struct ResourceFile
- {
- internal string Name;
- internal string FileName;
- internal ResourceAttributes Attributes;
- internal ResourceWriter Writer;
- }
-
- internal AssemblyBuilder(Universe universe, AssemblyName name, string dir, PermissionSet requiredPermissions, PermissionSet optionalPermissions, PermissionSet refusedPermissions)
- : base(universe)
- {
- this.name = name.Name;
- SetVersionHelper(name.Version);
- if (!string.IsNullOrEmpty(name.Culture))
- {
- this.culture = name.Culture;
- }
- this.flags = name.RawFlags;
- this.hashAlgorithm = name.HashAlgorithm;
- if (this.hashAlgorithm == AssemblyHashAlgorithm.None)
- {
- this.hashAlgorithm = AssemblyHashAlgorithm.SHA1;
- }
- this.keyPair = name.KeyPair;
- if (this.keyPair != null)
- {
- this.publicKey = this.keyPair.PublicKey;
- }
- else
- {
- byte[] publicKey = name.GetPublicKey();
- if (publicKey != null && publicKey.Length != 0)
- {
- this.publicKey = (byte[])publicKey.Clone();
- }
- }
- this.dir = dir ?? ".";
- this.requiredPermissions = requiredPermissions;
- this.optionalPermissions = optionalPermissions;
- this.refusedPermissions = refusedPermissions;
- if (universe.HasMscorlib && !universe.Mscorlib.__IsMissing && universe.Mscorlib.ImageRuntimeVersion != null)
- {
- this.imageRuntimeVersion = universe.Mscorlib.ImageRuntimeVersion;
- }
- else
- {
- this.imageRuntimeVersion = typeof(object).Assembly.ImageRuntimeVersion;
- }
- }
-
- private void SetVersionHelper(Version version)
- {
- if (version == null)
- {
- majorVersion = 0;
- minorVersion = 0;
- buildVersion = 0;
- revisionVersion = 0;
- }
- else
- {
- majorVersion = (ushort)version.Major;
- minorVersion = (ushort)version.Minor;
- buildVersion = version.Build == -1 ? (ushort)0 : (ushort)version.Build;
- revisionVersion = version.Revision == -1 ? (ushort)0 : (ushort)version.Revision;
- }
- }
-
- private void Rename(AssemblyName oldName)
- {
- this.fullName = null;
- universe.RenameAssembly(this, oldName);
- }
-
- public void __SetAssemblyVersion(Version version)
- {
- AssemblyName oldName = GetName();
- SetVersionHelper(version);
- Rename(oldName);
- }
-
- public void __SetAssemblyCulture(string cultureName)
- {
- AssemblyName oldName = GetName();
- this.culture = cultureName;
- Rename(oldName);
- }
-
- public void __SetAssemblyKeyPair(StrongNameKeyPair keyPair)
- {
- AssemblyName oldName = GetName();
- this.keyPair = keyPair;
- if (keyPair != null)
- {
- this.publicKey = keyPair.PublicKey;
- }
- Rename(oldName);
- }
-
- // this is used in combination with delay signing
- public void __SetAssemblyPublicKey(byte[] publicKey)
- {
- AssemblyName oldName = GetName();
- this.publicKey = publicKey == null ? null : (byte[])publicKey.Clone();
- Rename(oldName);
- }
-
- public void __SetAssemblyAlgorithmId(AssemblyHashAlgorithm hashAlgorithm)
- {
- this.hashAlgorithm = hashAlgorithm;
- }
-
- public void __SetAssemblyFlags(AssemblyNameFlags flags)
- {
- AssemblyName oldName = GetName();
- this.flags = flags;
- Rename(oldName);
- }
-
- public override AssemblyNameFlags __AssemblyFlags
- {
- get { return flags; }
- }
-
- internal string Name
- {
- get { return name; }
- }
-
- public override AssemblyName GetName()
- {
- AssemblyName n = new AssemblyName();
- n.Name = name;
- n.Version = new Version(majorVersion, minorVersion, buildVersion, revisionVersion);
- n.Culture = culture ?? "";
- n.HashAlgorithm = hashAlgorithm;
- n.RawFlags = flags;
- n.SetPublicKey(publicKey != null ? (byte[])publicKey.Clone() : Empty<byte>.Array);
- n.KeyPair = keyPair;
- return n;
- }
-
- public override string Location
- {
- get { throw new NotSupportedException(); }
- }
-
- public ModuleBuilder DefineDynamicModule(string name, string fileName)
- {
- return DefineDynamicModule(name, fileName, false);
- }
-
- public ModuleBuilder DefineDynamicModule(string name, string fileName, bool emitSymbolInfo)
- {
- ModuleBuilder module = new ModuleBuilder(this, name, fileName, emitSymbolInfo);
- modules.Add(module);
- return module;
- }
-
- public ModuleBuilder GetDynamicModule(string name)
- {
- foreach (ModuleBuilder module in modules)
- {
- if (module.Name == name)
- {
- return module;
- }
- }
- return null;
- }
-
- public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
- {
- SetCustomAttribute(new CustomAttributeBuilder(con, binaryAttribute));
- }
-
- public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
- {
- customAttributes.Add(customBuilder);
- }
-
- public void __AddDeclarativeSecurity(CustomAttributeBuilder customBuilder)
- {
- declarativeSecurity.Add(customBuilder);
- }
-
- public void __AddTypeForwarder(Type type)
- {
- typeForwarders.Add(type);
- }
-
- public void SetEntryPoint(MethodInfo entryMethod)
- {
- SetEntryPoint(entryMethod, PEFileKinds.ConsoleApplication);
- }
-
- public void SetEntryPoint(MethodInfo entryMethod, PEFileKinds fileKind)
- {
- this.entryPoint = entryMethod;
- this.fileKind = fileKind;
- }
-
- public void __Save(Stream stream, PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine)
- {
- if (!stream.CanRead || !stream.CanWrite || !stream.CanSeek || stream.Position != 0)
- {
- throw new ArgumentException("Stream must support read/write/seek and current position must be zero.", "stream");
- }
- if (modules.Count != 1)
- {
- throw new NotSupportedException("Saving to a stream is only supported for single module assemblies.");
- }
- SaveImpl(modules[0].fileName, stream, portableExecutableKind, imageFileMachine);
- }
-
- public void Save(string assemblyFileName)
- {
- Save(assemblyFileName, PortableExecutableKinds.ILOnly, ImageFileMachine.I386);
- }
-
- public void Save(string assemblyFileName, PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine)
- {
- SaveImpl(assemblyFileName, null, portableExecutableKind, imageFileMachine);
- }
-
- private void SaveImpl(string assemblyFileName, Stream streamOrNull, PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine)
- {
- ModuleBuilder manifestModule = null;
-
- foreach (ModuleBuilder moduleBuilder in modules)
- {
- moduleBuilder.SetIsSaved();
- moduleBuilder.PopulatePropertyAndEventTables();
-
- if (manifestModule == null
- && string.Compare(moduleBuilder.fileName, assemblyFileName, StringComparison.OrdinalIgnoreCase) == 0)
- {
- manifestModule = moduleBuilder;
- }
- }
-
- if (manifestModule == null)
- {
- manifestModule = DefineDynamicModule("RefEmit_OnDiskManifestModule", assemblyFileName, false);
- }
-
- AssemblyTable.Record assemblyRecord = new AssemblyTable.Record();
- assemblyRecord.HashAlgId = (int)hashAlgorithm;
- assemblyRecord.Name = manifestModule.Strings.Add(name);
- assemblyRecord.MajorVersion = majorVersion;
- assemblyRecord.MinorVersion = minorVersion;
- assemblyRecord.BuildNumber = buildVersion;
- assemblyRecord.RevisionNumber = revisionVersion;
- if (publicKey != null)
- {
- assemblyRecord.PublicKey = manifestModule.Blobs.Add(ByteBuffer.Wrap(publicKey));
- assemblyRecord.Flags = (int)(flags | AssemblyNameFlags.PublicKey);
- }
- else
- {
- assemblyRecord.Flags = (int)(flags & ~AssemblyNameFlags.PublicKey);
- }
- if (culture != null)
- {
- assemblyRecord.Culture = manifestModule.Strings.Add(culture);
- }
- int token = 0x20000000 + manifestModule.AssemblyTable.AddRecord(assemblyRecord);
-
-#pragma warning disable 618
- // this values are obsolete, but we already know that so we disable the warning
- System.Security.Permissions.SecurityAction requestMinimum = System.Security.Permissions.SecurityAction.RequestMinimum;
- System.Security.Permissions.SecurityAction requestOptional = System.Security.Permissions.SecurityAction.RequestOptional;
- System.Security.Permissions.SecurityAction requestRefuse = System.Security.Permissions.SecurityAction.RequestRefuse;
-#pragma warning restore 618
- if (requiredPermissions != null)
- {
- manifestModule.AddDeclarativeSecurity(token, requestMinimum, requiredPermissions);
- }
- if (optionalPermissions != null)
- {
- manifestModule.AddDeclarativeSecurity(token, requestOptional, optionalPermissions);
- }
- if (refusedPermissions != null)
- {
- manifestModule.AddDeclarativeSecurity(token, requestRefuse, refusedPermissions);
- }
-
- ResourceSection unmanagedResources = versionInfo != null || win32icon != null || win32manifest != null || win32resources != null
- ? new ResourceSection()
- : null;
-
- if (versionInfo != null)
- {
- versionInfo.SetName(GetName());
- versionInfo.SetFileName(assemblyFileName);
- foreach (CustomAttributeBuilder cab in customAttributes)
- {
- // .NET doesn't support copying blob custom attributes into the version info
- if (!cab.HasBlob)
- {
- versionInfo.SetAttribute(cab);
- }
- }
- ByteBuffer versionInfoData = new ByteBuffer(512);
- versionInfo.Write(versionInfoData);
- unmanagedResources.AddVersionInfo(versionInfoData);
- }
-
- if (win32icon != null)
- {
- unmanagedResources.AddIcon(win32icon);
- }
-
- if (win32manifest != null)
- {
- unmanagedResources.AddManifest(win32manifest, fileKind == PEFileKinds.Dll ? (ushort)2 : (ushort)1);
- }
-
- if (win32resources != null)
- {
- unmanagedResources.ExtractResources(win32resources);
- }
-
- foreach (CustomAttributeBuilder cab in customAttributes)
- {
- // we intentionally don't filter out the version info (pseudo) custom attributes (to be compatible with .NET)
- manifestModule.SetCustomAttribute(0x20000001, cab);
- }
-
- manifestModule.AddDeclarativeSecurity(0x20000001, declarativeSecurity);
-
- foreach (Type type in typeForwarders)
- {
- manifestModule.AddTypeForwarder(type);
- }
-
- foreach (ResourceFile resfile in resourceFiles)
- {
- if (resfile.Writer != null)
- {
- resfile.Writer.Generate();
- resfile.Writer.Close();
- }
- int fileToken = AddFile(manifestModule, resfile.FileName, 1 /*ContainsNoMetaData*/);
- ManifestResourceTable.Record rec = new ManifestResourceTable.Record();
- rec.Offset = 0;
- rec.Flags = (int)resfile.Attributes;
- rec.Name = manifestModule.Strings.Add(resfile.Name);
- rec.Implementation = fileToken;
- manifestModule.ManifestResource.AddRecord(rec);
- }
-
- int entryPointToken = 0;
-
- foreach (ModuleBuilder moduleBuilder in modules)
- {
- moduleBuilder.FillAssemblyRefTable();
- moduleBuilder.EmitResources();
- if (moduleBuilder != manifestModule)
- {
- int fileToken;
- if (entryPoint != null && entryPoint.Module == moduleBuilder)
- {
- ModuleWriter.WriteModule(null, null, moduleBuilder, fileKind, portableExecutableKind, imageFileMachine, moduleBuilder.unmanagedResources, entryPoint.MetadataToken);
- entryPointToken = fileToken = AddFile(manifestModule, moduleBuilder.fileName, 0 /*ContainsMetaData*/);
- }
- else
- {
- ModuleWriter.WriteModule(null, null, moduleBuilder, fileKind, portableExecutableKind, imageFileMachine, moduleBuilder.unmanagedResources, 0);
- fileToken = AddFile(manifestModule, moduleBuilder.fileName, 0 /*ContainsMetaData*/);
- }
- moduleBuilder.ExportTypes(fileToken, manifestModule);
- }
- }
-
- foreach (Module module in addedModules)
- {
- int fileToken = AddFile(manifestModule, module.FullyQualifiedName, 0 /*ContainsMetaData*/);
- module.ExportTypes(fileToken, manifestModule);
- }
-
- if (entryPointToken == 0 && entryPoint != null)
- {
- entryPointToken = entryPoint.MetadataToken;
- }
-
- // finally, write the manifest module
- ModuleWriter.WriteModule(keyPair, publicKey, manifestModule, fileKind, portableExecutableKind, imageFileMachine, unmanagedResources ?? manifestModule.unmanagedResources, entryPointToken, streamOrNull);
- }
-
- private int AddFile(ModuleBuilder manifestModule, string fileName, int flags)
- {
- SHA1Managed hash = new SHA1Managed();
- string fullPath = fileName;
- if (dir != null)
- {
- fullPath = Path.Combine(dir, fileName);
- }
- using (FileStream fs = new FileStream(fullPath, FileMode.Open, FileAccess.Read))
- {
- using (CryptoStream cs = new CryptoStream(Stream.Null, hash, CryptoStreamMode.Write))
- {
- byte[] buf = new byte[8192];
- ModuleWriter.HashChunk(fs, cs, buf, (int)fs.Length);
- }
- }
- return manifestModule.__AddModule(flags, Path.GetFileName(fileName), hash.Hash);
- }
-
- public void AddResourceFile(string name, string fileName)
- {
- AddResourceFile(name, fileName, ResourceAttributes.Public);
- }
-
- public void AddResourceFile(string name, string fileName, ResourceAttributes attribs)
- {
- ResourceFile resfile = new ResourceFile();
- resfile.Name = name;
- resfile.FileName = fileName;
- resfile.Attributes = attribs;
- resourceFiles.Add(resfile);
- }
-
- public IResourceWriter DefineResource(string name, string description, string fileName)
- {
- return DefineResource(name, description, fileName, ResourceAttributes.Public);
- }
-
- public IResourceWriter DefineResource(string name, string description, string fileName, ResourceAttributes attribute)
- {
- // FXBUG we ignore the description, because there is no such thing
-
- string fullPath = fileName;
- if (dir != null)
- {
- fullPath = Path.Combine(dir, fileName);
- }
- ResourceWriter rw = new ResourceWriter(fullPath);
- ResourceFile resfile;
- resfile.Name = name;
- resfile.FileName = fileName;
- resfile.Attributes = attribute;
- resfile.Writer = rw;
- resourceFiles.Add(resfile);
- return rw;
- }
-
- public void DefineVersionInfoResource()
- {
- if (versionInfo != null || win32resources != null)
- {
- throw new ArgumentException("Native resource has already been defined.");
- }
- versionInfo = new VersionInfo();
- }
-
- public void DefineVersionInfoResource(string product, string productVersion, string company, string copyright, string trademark)
- {
- if (versionInfo != null || win32resources != null)
- {
- throw new ArgumentException("Native resource has already been defined.");
- }
- versionInfo = new VersionInfo();
- versionInfo.product = product;
- versionInfo.informationalVersion = productVersion;
- versionInfo.company = company;
- versionInfo.copyright = copyright;
- versionInfo.trademark = trademark;
- }
-
- public void __DefineIconResource(byte[] iconFile)
- {
- if (win32icon != null || win32resources != null)
- {
- throw new ArgumentException("Native resource has already been defined.");
- }
- win32icon = (byte[])iconFile.Clone();
- }
-
- public void __DefineManifestResource(byte[] manifest)
- {
- if (win32manifest != null || win32resources != null)
- {
- throw new ArgumentException("Native resource has already been defined.");
- }
- win32manifest = (byte[])manifest.Clone();
- }
-
- public void __DefineUnmanagedResource(byte[] resource)
- {
- if (versionInfo != null || win32icon != null || win32manifest != null || win32resources != null)
- {
- throw new ArgumentException("Native resource has already been defined.");
- }
- // The standard .NET DefineUnmanagedResource(byte[]) is useless, because it embeds "resource" (as-is) as the .rsrc section,
- // but it doesn't set the PE file Resource Directory entry to point to it. That's why we have a renamed version, which behaves
- // like DefineUnmanagedResource(string).
- win32resources = (byte[])resource.Clone();
- }
-
- public void DefineUnmanagedResource(string resourceFileName)
- {
- // This method reads the specified resource file (Win32 .res file) and converts it into the appropriate format and embeds it in the .rsrc section,
- // also setting the Resource Directory entry.
- __DefineUnmanagedResource(File.ReadAllBytes(resourceFileName));
- }
-
- public override Type[] GetTypes()
- {
- List<Type> list = new List<Type>();
- foreach (ModuleBuilder module in modules)
- {
- module.GetTypesImpl(list);
- }
- foreach (Module module in addedModules)
- {
- module.GetTypesImpl(list);
- }
- return list.ToArray();
- }
-
- internal override Type FindType(TypeName typeName)
- {
- foreach (ModuleBuilder mb in modules)
- {
- Type type = mb.FindType(typeName);
- if (type != null)
- {
- return type;
- }
- }
- foreach (Module module in addedModules)
- {
- Type type = module.FindType(typeName);
- if (type != null)
- {
- return type;
- }
- }
- return null;
- }
-
- internal override Type FindTypeIgnoreCase(TypeName lowerCaseName)
- {
- foreach (ModuleBuilder mb in modules)
- {
- Type type = mb.FindTypeIgnoreCase(lowerCaseName);
- if (type != null)
- {
- return type;
- }
- }
- foreach (Module module in addedModules)
- {
- Type type = module.FindTypeIgnoreCase(lowerCaseName);
- if (type != null)
- {
- return type;
- }
- }
- return null;
- }
-
- public override string ImageRuntimeVersion
- {
- get { return imageRuntimeVersion; }
- }
-
- public void __SetImageRuntimeVersion(string imageRuntimeVersion, int mdStreamVersion)
- {
- this.imageRuntimeVersion = imageRuntimeVersion;
- this.mdStreamVersion = mdStreamVersion;
- }
-
- public override Module ManifestModule
- {
- get
- {
- if (pseudoManifestModule == null)
- {
- pseudoManifestModule = new ManifestModule(this);
- }
- return pseudoManifestModule;
- }
- }
-
- public override MethodInfo EntryPoint
- {
- get { return entryPoint; }
- }
-
- public override AssemblyName[] GetReferencedAssemblies()
- {
- return Empty<AssemblyName>.Array;
- }
-
- public override Module[] GetLoadedModules(bool getResourceModules)
- {
- return GetModules(getResourceModules);
- }
-
- public override Module[] GetModules(bool getResourceModules)
- {
- List<Module> list = new List<Module>();
- foreach (ModuleBuilder module in modules)
- {
- if (getResourceModules || !module.IsResource())
- {
- list.Add(module);
- }
- }
- foreach (Module module in addedModules)
- {
- if (getResourceModules || !module.IsResource())
- {
- list.Add(module);
- }
- }
- return list.ToArray();
- }
-
- public override Module GetModule(string name)
- {
- foreach (ModuleBuilder module in modules)
- {
- if (module.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase))
- {
- return module;
- }
- }
- foreach (Module module in addedModules)
- {
- if (module.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase))
- {
- return module;
- }
- }
- return null;
- }
-
- public Module __AddModule(RawModule module)
- {
- Module mod = module.ToModule(this);
- addedModules.Add(mod);
- return mod;
- }
-
- public override ManifestResourceInfo GetManifestResourceInfo(string resourceName)
- {
- throw new NotSupportedException();
- }
-
- public override string[] GetManifestResourceNames()
- {
- throw new NotSupportedException();
- }
-
- public override Stream GetManifestResourceStream(string resourceName)
- {
- throw new NotSupportedException();
- }
-
- internal override IList<CustomAttributeData> GetCustomAttributesData(Type attributeType)
- {
- List<CustomAttributeData> list = new List<CustomAttributeData>();
- foreach (CustomAttributeBuilder cab in customAttributes)
- {
- if (attributeType == null || attributeType.IsAssignableFrom(cab.Constructor.DeclaringType))
- {
- list.Add(cab.ToData(this));
- }
- }
- return list;
- }
-
- internal bool IsWindowsRuntime
- {
- get { return (flags & (AssemblyNameFlags)0x200) != 0; }
- }
- }
-
- sealed class ManifestModule : NonPEModule
- {
- private readonly AssemblyBuilder assembly;
- private readonly Guid guid = Guid.NewGuid();
-
- internal ManifestModule(AssemblyBuilder assembly)
- : base(assembly.universe)
- {
- this.assembly = assembly;
- }
-
- public override int MDStreamVersion
- {
- get { return assembly.mdStreamVersion; }
- }
-
- public override Assembly Assembly
- {
- get { return assembly; }
- }
-
- internal override Type FindType(TypeName typeName)
- {
- return null;
- }
-
- internal override Type FindTypeIgnoreCase(TypeName lowerCaseName)
- {
- return null;
- }
-
- internal override void GetTypesImpl(List<Type> list)
- {
- }
-
- public override string FullyQualifiedName
- {
- get { return Path.Combine(assembly.dir, "RefEmit_InMemoryManifestModule"); }
- }
-
- public override string Name
- {
- get { return "<In Memory Module>"; }
- }
-
- public override Guid ModuleVersionId
- {
- get { return guid; }
- }
-
- public override string ScopeName
- {
- get { return "RefEmit_InMemoryManifestModule"; }
- }
-
- protected override Exception NotSupportedException()
- {
- return new InvalidOperationException();
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2008-2011 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-
-namespace IKVM.Reflection.Emit
-{
- public sealed class ConstructorBuilder : ConstructorInfo
- {
- private readonly MethodBuilder methodBuilder;
-
- internal ConstructorBuilder(MethodBuilder mb)
- {
- this.methodBuilder = mb;
- }
-
- public override bool Equals(object obj)
- {
- ConstructorBuilder other = obj as ConstructorBuilder;
- return other != null && other.methodBuilder.Equals(methodBuilder);
- }
-
- public override int GetHashCode()
- {
- return methodBuilder.GetHashCode();
- }
-
- public void __SetSignature(Type returnType, CustomModifiers returnTypeCustomModifiers, Type[] parameterTypes, CustomModifiers[] parameterTypeCustomModifiers)
- {
- methodBuilder.__SetSignature(returnType, returnTypeCustomModifiers, parameterTypes, parameterTypeCustomModifiers);
- }
-
- [Obsolete("Please use __SetSignature(Type, CustomModifiers, Type[], CustomModifiers[]) instead.")]
- public void __SetSignature(Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers)
- {
- methodBuilder.SetSignature(returnType, returnTypeRequiredCustomModifiers, returnTypeOptionalCustomModifiers, parameterTypes, parameterTypeRequiredCustomModifiers, parameterTypeOptionalCustomModifiers);
- }
-
- public ParameterBuilder DefineParameter(int position, ParameterAttributes attributes, string strParamName)
- {
- return methodBuilder.DefineParameter(position, attributes, strParamName);
- }
-
- public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
- {
- methodBuilder.SetCustomAttribute(customBuilder);
- }
-
- public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
- {
- methodBuilder.SetCustomAttribute(con, binaryAttribute);
- }
-
- public void __AddDeclarativeSecurity(CustomAttributeBuilder customBuilder)
- {
- methodBuilder.__AddDeclarativeSecurity(customBuilder);
- }
-
- public void AddDeclarativeSecurity(System.Security.Permissions.SecurityAction securityAction, System.Security.PermissionSet permissionSet)
- {
- methodBuilder.AddDeclarativeSecurity(securityAction, permissionSet);
- }
-
- public void SetImplementationFlags(MethodImplAttributes attributes)
- {
- methodBuilder.SetImplementationFlags(attributes);
- }
-
- public ILGenerator GetILGenerator()
- {
- return methodBuilder.GetILGenerator();
- }
-
- public ILGenerator GetILGenerator(int streamSize)
- {
- return methodBuilder.GetILGenerator(streamSize);
- }
-
- public void __ReleaseILGenerator()
- {
- methodBuilder.__ReleaseILGenerator();
- }
-
- public Type ReturnType
- {
- get { return methodBuilder.ReturnType; }
- }
-
- public Module GetModule()
- {
- return methodBuilder.GetModule();
- }
-
- public MethodToken GetToken()
- {
- return methodBuilder.GetToken();
- }
-
- public bool InitLocals
- {
- get { return methodBuilder.InitLocals; }
- set { methodBuilder.InitLocals = value; }
- }
-
- internal override MethodInfo GetMethodInfo()
- {
- return methodBuilder;
- }
-
- internal override MethodInfo GetMethodOnTypeDefinition()
- {
- return methodBuilder;
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2008-2011 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.IO;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Text;
-using IKVM.Reflection.Writer;
-
-namespace IKVM.Reflection.Emit
-{
- public sealed class CustomAttributeBuilder
- {
- private readonly ConstructorInfo con;
- private readonly byte[] blob;
- private readonly object[] constructorArgs;
- private readonly PropertyInfo[] namedProperties;
- private readonly object[] propertyValues;
- private readonly FieldInfo[] namedFields;
- private readonly object[] fieldValues;
-
- internal CustomAttributeBuilder(ConstructorInfo con, byte[] blob)
- {
- this.con = con;
- this.blob = blob;
- }
-
- private CustomAttributeBuilder(ConstructorInfo con, int securityAction, byte[] blob)
- {
- this.con = con;
- this.blob = blob;
- this.constructorArgs = new object[] { securityAction };
- }
-
- public CustomAttributeBuilder(ConstructorInfo con, object[] constructorArgs)
- : this(con, constructorArgs, null, null, null,null)
- {
- }
-
- public CustomAttributeBuilder(ConstructorInfo con, object[] constructorArgs, FieldInfo[] namedFields, object[] fieldValues)
- : this(con, constructorArgs, null, null, namedFields, fieldValues)
- {
- }
-
- public CustomAttributeBuilder(ConstructorInfo con, object[] constructorArgs, PropertyInfo[] namedProperties, object[] propertyValues)
- : this(con, constructorArgs, namedProperties, propertyValues, null, null)
- {
- }
-
- public CustomAttributeBuilder(ConstructorInfo con, object[] constructorArgs, PropertyInfo[] namedProperties, object[] propertyValues, FieldInfo[] namedFields, object[] fieldValues)
- {
- this.con = con;
- this.constructorArgs = constructorArgs;
- this.namedProperties = namedProperties;
- this.propertyValues = propertyValues;
- this.namedFields = namedFields;
- this.fieldValues = fieldValues;
- }
-
- public static CustomAttributeBuilder __FromBlob(ConstructorInfo con, byte[] blob)
- {
- return new CustomAttributeBuilder(con, blob);
- }
-
- public static CustomAttributeBuilder __FromBlob(ConstructorInfo con, int securityAction, byte[] blob)
- {
- return new CustomAttributeBuilder(con, securityAction, blob);
- }
-
- public static CustomAttributeTypedArgument __MakeTypedArgument(Type type, object value)
- {
- return new CustomAttributeTypedArgument(type, value);
- }
-
- private sealed class BlobWriter
- {
- private readonly Assembly assembly;
- private readonly CustomAttributeBuilder cab;
- private readonly ByteBuffer bb;
-
- internal BlobWriter(Assembly assembly, CustomAttributeBuilder cab, ByteBuffer bb)
- {
- this.assembly = assembly;
- this.cab = cab;
- this.bb = bb;
- }
-
- internal void WriteCustomAttributeBlob()
- {
- // prolog
- WriteUInt16(1);
- ParameterInfo[] pi = cab.con.GetParameters();
- for (int i = 0; i < pi.Length; i++)
- {
- WriteFixedArg(pi[i].ParameterType, cab.constructorArgs[i]);
- }
- WriteNamedArguments(false);
- }
-
- internal void WriteNamedArguments(bool forDeclSecurity)
- {
- // NumNamed
- int named = 0;
- if (cab.namedFields != null)
- {
- named += cab.namedFields.Length;
- }
- if (cab.namedProperties != null)
- {
- named += cab.namedProperties.Length;
- }
- if (forDeclSecurity)
- {
- WritePackedLen(named);
- }
- else
- {
- WriteUInt16((ushort)named);
- }
- if (cab.namedFields != null)
- {
- for (int i = 0; i < cab.namedFields.Length; i++)
- {
- WriteNamedArg(0x53, cab.namedFields[i].FieldType, cab.namedFields[i].Name, cab.fieldValues[i]);
- }
- }
- if (cab.namedProperties != null)
- {
- for (int i = 0; i < cab.namedProperties.Length; i++)
- {
- WriteNamedArg(0x54, cab.namedProperties[i].PropertyType, cab.namedProperties[i].Name, cab.propertyValues[i]);
- }
- }
- }
-
- private void WriteNamedArg(byte fieldOrProperty, Type type, string name, object value)
- {
- WriteByte(fieldOrProperty);
- WriteFieldOrPropType(type);
- WriteString(name);
- WriteFixedArg(type, value);
- }
-
- private void WriteByte(byte value)
- {
- bb.Write(value);
- }
-
- private void WriteUInt16(ushort value)
- {
- bb.Write(value);
- }
-
- private void WriteInt32(int value)
- {
- bb.Write(value);
- }
-
- private void WriteFixedArg(Type type, object value)
- {
- Universe u = assembly.universe;
- if (type == u.System_String)
- {
- WriteString((string)value);
- }
- else if (type == u.System_Boolean)
- {
- WriteByte((bool)value ? (byte)1 : (byte)0);
- }
- else if (type == u.System_Char)
- {
- WriteUInt16((char)value);
- }
- else if (type == u.System_SByte)
- {
- WriteByte((byte)(sbyte)value);
- }
- else if (type == u.System_Byte)
- {
- WriteByte((byte)value);
- }
- else if (type == u.System_Int16)
- {
- WriteUInt16((ushort)(short)value);
- }
- else if (type == u.System_UInt16)
- {
- WriteUInt16((ushort)value);
- }
- else if (type == u.System_Int32)
- {
- WriteInt32((int)value);
- }
- else if (type == u.System_UInt32)
- {
- WriteInt32((int)(uint)value);
- }
- else if (type == u.System_Int64)
- {
- WriteInt64((long)value);
- }
- else if (type == u.System_UInt64)
- {
- WriteInt64((long)(ulong)value);
- }
- else if (type == u.System_Single)
- {
- WriteSingle((float)value);
- }
- else if (type == u.System_Double)
- {
- WriteDouble((double)value);
- }
- else if (type == u.System_Type)
- {
- WriteTypeName((Type)value);
- }
- else if (type == u.System_Object)
- {
- if (value == null)
- {
- type = u.System_String;
- }
- else if (value is Type)
- {
- // value.GetType() would return a subclass of Type, but we don't want to deal with that
- type = u.System_Type;
- }
- else if (value is CustomAttributeTypedArgument)
- {
- CustomAttributeTypedArgument cta = (CustomAttributeTypedArgument)value;
- value = cta.Value;
- type = cta.ArgumentType;
- }
- else
- {
- type = u.Import(value.GetType());
- }
- WriteFieldOrPropType(type);
- WriteFixedArg(type, value);
- }
- else if (type.IsArray)
- {
- if (value == null)
- {
- WriteInt32(-1);
- }
- else
- {
- Array array = (Array)value;
- Type elemType = type.GetElementType();
- WriteInt32(array.Length);
- foreach (object val in array)
- {
- WriteFixedArg(elemType, val);
- }
- }
- }
- else if (type.IsEnum)
- {
- WriteFixedArg(type.GetEnumUnderlyingTypeImpl(), value);
- }
- else
- {
- throw new ArgumentException();
- }
- }
-
- private void WriteInt64(long value)
- {
- bb.Write(value);
- }
-
- private void WriteSingle(float value)
- {
- bb.Write(value);
- }
-
- private void WriteDouble(double value)
- {
- bb.Write(value);
- }
-
- private void WriteTypeName(Type type)
- {
- string name = null;
- if (type != null)
- {
- StringBuilder sb = new StringBuilder();
- GetTypeName(sb, type, false);
- name = sb.ToString();
- }
- WriteString(name);
- }
-
- private void GetTypeName(StringBuilder sb, Type type, bool isTypeParam)
- {
- bool v1 = !assembly.ManifestModule.__IsMissing && assembly.ManifestModule.MDStreamVersion < 0x20000;
- bool includeAssemblyName = type.Assembly != assembly && (!v1 || type.Assembly != type.Module.universe.Mscorlib);
- if (isTypeParam && includeAssemblyName)
- {
- sb.Append('[');
- }
- GetTypeNameImpl(sb, type);
- if (includeAssemblyName)
- {
- if (v1)
- {
- sb.Append(',');
- }
- else
- {
- sb.Append(", ");
- }
- if (isTypeParam)
- {
- sb.Append(type.Assembly.FullName.Replace("]", "\\]")).Append(']');
- }
- else
- {
- sb.Append(type.Assembly.FullName);
- }
- }
- }
-
- private void GetTypeNameImpl(StringBuilder sb, Type type)
- {
- if (type.HasElementType)
- {
- GetTypeNameImpl(sb, type.GetElementType());
- sb.Append(((ElementHolderType)type).GetSuffix());
- }
- else if (type.IsConstructedGenericType)
- {
- sb.Append(type.GetGenericTypeDefinition().FullName);
- sb.Append('[');
- string sep = "";
- foreach (Type typeParam in type.GetGenericArguments())
- {
- sb.Append(sep);
- GetTypeName(sb, typeParam, true);
- sep = ",";
- }
- sb.Append(']');
- }
- else
- {
- sb.Append(type.FullName);
- }
- }
-
- private void WriteString(string val)
- {
- bb.Write(val);
- }
-
- private void WritePackedLen(int len)
- {
- bb.WriteCompressedInt(len);
- }
-
- private void WriteFieldOrPropType(Type type)
- {
- Universe u = type.Module.universe;
- if (type == u.System_Type)
- {
- WriteByte(0x50);
- }
- else if (type == u.System_Object)
- {
- WriteByte(0x51);
- }
- else if (type == u.System_Boolean)
- {
- WriteByte(0x02);
- }
- else if (type == u.System_Char)
- {
- WriteByte(0x03);
- }
- else if (type == u.System_SByte)
- {
- WriteByte(0x04);
- }
- else if (type == u.System_Byte)
- {
- WriteByte(0x05);
- }
- else if (type == u.System_Int16)
- {
- WriteByte(0x06);
- }
- else if (type == u.System_UInt16)
- {
- WriteByte(0x07);
- }
- else if (type == u.System_Int32)
- {
- WriteByte(0x08);
- }
- else if (type == u.System_UInt32)
- {
- WriteByte(0x09);
- }
- else if (type == u.System_Int64)
- {
- WriteByte(0x0A);
- }
- else if (type == u.System_UInt64)
- {
- WriteByte(0x0B);
- }
- else if (type == u.System_Single)
- {
- WriteByte(0x0C);
- }
- else if (type == u.System_Double)
- {
- WriteByte(0x0D);
- }
- else if (type == u.System_String)
- {
- WriteByte(0x0E);
- }
- else if (type.IsArray)
- {
- WriteByte(0x1D);
- WriteFieldOrPropType(type.GetElementType());
- }
- else if (type.IsEnum)
- {
- WriteByte(0x55);
- WriteTypeName(type);
- }
- else
- {
- throw new ArgumentException();
- }
- }
- }
-
- internal bool IsPseudoCustomAttribute
- {
- get { return con.DeclaringType.IsPseudoCustomAttribute; }
- }
-
- internal ConstructorInfo Constructor
- {
- get { return con; }
- }
-
- internal int WriteBlob(ModuleBuilder moduleBuilder)
- {
- ByteBuffer bb;
- if (blob != null)
- {
- bb = ByteBuffer.Wrap(blob);
- }
- else
- {
- bb = new ByteBuffer(100);
- BlobWriter bw = new BlobWriter(moduleBuilder.Assembly, this, bb);
- bw.WriteCustomAttributeBlob();
- }
- return moduleBuilder.Blobs.Add(bb);
- }
-
- internal object GetConstructorArgument(int pos)
- {
- return constructorArgs[pos];
- }
-
- internal int ConstructorArgumentCount
- {
- get { return constructorArgs == null ? 0 : constructorArgs.Length; }
- }
-
- internal T? GetFieldValue<T>(string name) where T : struct
- {
- object val = GetFieldValue(name);
- if (val is T)
- {
- return (T)val;
- }
- else if (val != null)
- {
- if (typeof(T).IsEnum)
- {
- Debug.Assert(Enum.GetUnderlyingType(typeof(T)) == val.GetType());
- return (T)Enum.ToObject(typeof(T), val);
- }
- else
- {
- Debug.Assert(Enum.GetUnderlyingType(val.GetType()) == typeof(T));
- return (T)Convert.ChangeType(val, typeof(T));
- }
- }
- else
- {
- return null;
- }
- }
-
- internal object GetFieldValue(string name)
- {
- if (namedFields != null)
- {
- for (int i = 0; i < namedFields.Length; i++)
- {
- if (namedFields[i].Name == name)
- {
- return fieldValues[i];
- }
- }
- }
- return null;
- }
-
- internal string GetLegacyDeclSecurity()
- {
- if (con.DeclaringType == con.Module.universe.System_Security_Permissions_PermissionSetAttribute
- && blob == null
- && (namedFields == null || namedFields.Length == 0)
- && namedProperties != null
- && namedProperties.Length == 1
- && namedProperties[0].Name == "XML")
- {
- return propertyValues[0] as string;
- }
- return null;
- }
-
- internal void WriteNamedArgumentsForDeclSecurity(ModuleBuilder moduleBuilder, ByteBuffer bb)
- {
- if (blob != null)
- {
- bb.Write(blob);
- }
- else
- {
- BlobWriter bw = new BlobWriter(moduleBuilder.Assembly, this, bb);
- bw.WriteNamedArguments(true);
- }
- }
-
- internal CustomAttributeData ToData(Assembly asm)
- {
- if (blob != null)
- {
- if (constructorArgs != null)
- {
- return new CustomAttributeData(asm, con, (int)constructorArgs[0], blob, -1);
- }
- return new CustomAttributeData(asm, con, new IKVM.Reflection.Reader.ByteReader(blob, 0, blob.Length));
- }
- else
- {
- List<CustomAttributeNamedArgument> namedArgs = new List<CustomAttributeNamedArgument>();
- if (namedProperties != null)
- {
- for (int i = 0; i < namedProperties.Length; i++)
- {
- namedArgs.Add(new CustomAttributeNamedArgument(namedProperties[i], RewrapValue(namedProperties[i].PropertyType, propertyValues[i])));
- }
- }
- if (namedFields != null)
- {
- for (int i = 0; i < namedFields.Length; i++)
- {
- namedArgs.Add(new CustomAttributeNamedArgument(namedFields[i], RewrapValue(namedFields[i].FieldType, fieldValues[i])));
- }
- }
- List<CustomAttributeTypedArgument> args = new List<CustomAttributeTypedArgument>(constructorArgs.Length);
- ParameterInfo[] parameters = this.Constructor.GetParameters();
- for (int i = 0; i < constructorArgs.Length; i++)
- {
- args.Add(RewrapValue(parameters[i].ParameterType, constructorArgs[i]));
- }
- return new CustomAttributeData(asm.ManifestModule, con, args, namedArgs);
- }
- }
-
- private static CustomAttributeTypedArgument RewrapValue(Type type, object value)
- {
- if (value is Array)
- {
- Array array = (Array)value;
- Type arrayType = type.Module.universe.Import(array.GetType());
- return RewrapArray(arrayType, array);
- }
- else if (value is CustomAttributeTypedArgument)
- {
- CustomAttributeTypedArgument arg = (CustomAttributeTypedArgument)value;
- if (arg.Value is Array)
- {
- return RewrapArray(arg.ArgumentType, (Array)arg.Value);
- }
- return arg;
- }
- else
- {
- return new CustomAttributeTypedArgument(type, value);
- }
- }
-
- private static CustomAttributeTypedArgument RewrapArray(Type arrayType, Array array)
- {
- Type elementType = arrayType.GetElementType();
- CustomAttributeTypedArgument[] newArray = new CustomAttributeTypedArgument[array.Length];
- for (int i = 0; i < newArray.Length; i++)
- {
- newArray[i] = RewrapValue(elementType, array.GetValue(i));
- }
- return new CustomAttributeTypedArgument(arrayType, newArray);
- }
-
- internal bool HasBlob
- {
- get { return blob != null; }
- }
-
- internal CustomAttributeBuilder DecodeBlob(Assembly asm)
- {
- if (blob == null)
- {
- return this;
- }
- else
- {
- return ToData(asm).__ToBuilder();
- }
- }
-
- internal byte[] GetBlob(Assembly asm)
- {
- ByteBuffer bb = new ByteBuffer(100);
- BlobWriter bw = new BlobWriter(asm, this, bb);
- bw.WriteCustomAttributeBlob();
- return bb.ToArray();
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2011 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace IKVM.Reflection.Emit
-{
- public sealed class CustomModifiersBuilder
- {
- private readonly List<Item> list = new List<Item>();
-
- internal struct Item
- {
- internal Type type;
- internal bool required;
- }
-
- public void AddRequired(Type type)
- {
- Item item;
- item.type = type;
- item.required = true;
- list.Add(item);
- }
-
- public void AddOptional(Type type)
- {
- Item item;
- item.type = type;
- item.required = false;
- list.Add(item);
- }
-
- // this adds the custom modifiers in the same order as the normal SRE APIs
- // (the advantage over using the SRE APIs is that a CustomModifiers object is slightly more efficient,
- // because unlike the Type arrays it doesn't need to be copied)
- public void Add(Type[] requiredCustomModifiers, Type[] optionalCustomModifiers)
- {
- foreach (CustomModifiers.Entry entry in CustomModifiers.FromReqOpt(requiredCustomModifiers, optionalCustomModifiers))
- {
- Item item;
- item.type = entry.Type;
- item.required = entry.IsRequired;
- list.Add(item);
- }
- }
-
- public CustomModifiers Create()
- {
- return new CustomModifiers(list);
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2010 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace IKVM.Reflection.Emit
-{
- public sealed class EnumBuilder : TypeInfo
- {
- private readonly TypeBuilder typeBuilder;
- private readonly FieldBuilder fieldBuilder;
-
- internal EnumBuilder(TypeBuilder typeBuilder, FieldBuilder fieldBuilder)
- : base(typeBuilder)
- {
- this.typeBuilder = typeBuilder;
- this.fieldBuilder = fieldBuilder;
- }
-
- public override string __Name
- {
- get { return typeBuilder.__Name; }
- }
-
- public override string __Namespace
- {
- get { return typeBuilder.__Namespace; }
- }
-
- public override string Name
- {
- get { return typeBuilder.Name; }
- }
-
- public override string FullName
- {
- get { return typeBuilder.FullName; }
- }
-
- public override Type BaseType
- {
- get { return typeBuilder.BaseType; }
- }
-
- public override TypeAttributes Attributes
- {
- get { return typeBuilder.Attributes; }
- }
-
- public override Module Module
- {
- get { return typeBuilder.Module; }
- }
-
- public FieldBuilder DefineLiteral(string literalName, object literalValue)
- {
- FieldBuilder fb = typeBuilder.DefineField(literalName, typeBuilder, FieldAttributes.Public | FieldAttributes.Static | FieldAttributes.Literal);
- fb.SetConstant(literalValue);
- return fb;
- }
-
- public Type CreateType()
- {
- return typeBuilder.CreateType();
- }
-
- public TypeToken TypeToken
- {
- get { return typeBuilder.TypeToken; }
- }
-
- public FieldBuilder UnderlyingField
- {
- get { return fieldBuilder; }
- }
-
- public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
- {
- typeBuilder.SetCustomAttribute(con, binaryAttribute);
- }
-
- public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
- {
- typeBuilder.SetCustomAttribute(customBuilder);
- }
-
- public override Type GetEnumUnderlyingType()
- {
- return fieldBuilder.FieldType;
- }
-
- internal override bool IsBaked
- {
- get { return typeBuilder.IsBaked; }
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2008 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-
-namespace IKVM.Reflection.Emit
-{
- public enum AssemblyBuilderAccess
- {
- Save = 2,
- ReflectionOnly = 6,
- }
-
- public enum OpCodeType
- {
- Annotation = 0,
- Macro = 1,
- Nternal = 2,
- Objmodel = 3,
- Prefix = 4,
- Primitive = 5,
- }
-
- public enum OperandType
- {
- InlineBrTarget = 0,
- InlineField = 1,
- InlineI = 2,
- InlineI8 = 3,
- InlineMethod = 4,
- InlineNone = 5,
- InlinePhi = 6,
- InlineR = 7,
- InlineSig = 9,
- InlineString = 10,
- InlineSwitch = 11,
- InlineTok = 12,
- InlineType = 13,
- InlineVar = 14,
- ShortInlineBrTarget = 15,
- ShortInlineI = 16,
- ShortInlineR = 17,
- ShortInlineVar = 18,
- }
-
- public enum FlowControl
- {
- Branch = 0,
- Break = 1,
- Call = 2,
- Cond_Branch = 3,
- Meta = 4,
- Next = 5,
- Return = 7,
- Throw = 8,
- }
-
- public enum PackingSize
- {
- Unspecified = 0,
- Size1 = 1,
- Size2 = 2,
- Size4 = 4,
- Size8 = 8,
- Size16 = 16,
- Size32 = 32,
- Size64 = 64,
- Size128 = 128,
- }
-
- public enum PEFileKinds
- {
- Dll = 1,
- ConsoleApplication = 2,
- WindowApplication = 3,
- }
-
- public enum StackBehaviour
- {
- Pop0 = 0,
- Pop1 = 1,
- Pop1_pop1 = 2,
- Popi = 3,
- Popi_pop1 = 4,
- Popi_popi = 5,
- Popi_popi8 = 6,
- Popi_popi_popi = 7,
- Popi_popr4 = 8,
- Popi_popr8 = 9,
- Popref = 10,
- Popref_pop1 = 11,
- Popref_popi = 12,
- Popref_popi_popi = 13,
- Popref_popi_popi8 = 14,
- Popref_popi_popr4 = 15,
- Popref_popi_popr8 = 16,
- Popref_popi_popref = 17,
- Push0 = 18,
- Push1 = 19,
- Push1_push1 = 20,
- Pushi = 21,
- Pushi8 = 22,
- Pushr4 = 23,
- Pushr8 = 24,
- Pushref = 25,
- Varpop = 26,
- Varpush = 27,
- Popref_popi_pop1 = 28,
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009-2011 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Runtime.CompilerServices;
-using IKVM.Reflection.Metadata;
-using IKVM.Reflection.Writer;
-
-namespace IKVM.Reflection.Emit
-{
- public sealed class EventBuilder : EventInfo
- {
- private readonly TypeBuilder typeBuilder;
- private readonly string name;
- private EventAttributes attributes;
- private readonly int eventtype;
- private MethodBuilder addOnMethod;
- private MethodBuilder removeOnMethod;
- private MethodBuilder fireMethod;
- private readonly List<Accessor> accessors = new List<Accessor>();
- private int lazyPseudoToken;
-
- private struct Accessor
- {
- internal short Semantics;
- internal MethodBuilder Method;
- }
-
- internal EventBuilder(TypeBuilder typeBuilder, string name, EventAttributes attributes, Type eventtype)
- {
- this.typeBuilder = typeBuilder;
- this.name = name;
- this.attributes = attributes;
- this.eventtype = typeBuilder.ModuleBuilder.GetTypeTokenForMemberRef(eventtype);
- }
-
- public void SetAddOnMethod(MethodBuilder mdBuilder)
- {
- addOnMethod = mdBuilder;
- Accessor acc;
- acc.Semantics = MethodSemanticsTable.AddOn;
- acc.Method = mdBuilder;
- accessors.Add(acc);
- }
-
- public void SetRemoveOnMethod(MethodBuilder mdBuilder)
- {
- removeOnMethod = mdBuilder;
- Accessor acc;
- acc.Semantics = MethodSemanticsTable.RemoveOn;
- acc.Method = mdBuilder;
- accessors.Add(acc);
- }
-
- public void SetRaiseMethod(MethodBuilder mdBuilder)
- {
- fireMethod = mdBuilder;
- Accessor acc;
- acc.Semantics = MethodSemanticsTable.Fire;
- acc.Method = mdBuilder;
- accessors.Add(acc);
- }
-
- public void AddOtherMethod(MethodBuilder mdBuilder)
- {
- Accessor acc;
- acc.Semantics = MethodSemanticsTable.Other;
- acc.Method = mdBuilder;
- accessors.Add(acc);
- }
-
- public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
- {
- SetCustomAttribute(new CustomAttributeBuilder(con, binaryAttribute));
- }
-
- public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
- {
- Universe u = typeBuilder.ModuleBuilder.universe;
- if (customBuilder.Constructor.DeclaringType == u.System_Runtime_CompilerServices_SpecialNameAttribute)
- {
- attributes |= EventAttributes.SpecialName;
- }
- else
- {
- if (lazyPseudoToken == 0)
- {
- lazyPseudoToken = typeBuilder.ModuleBuilder.AllocPseudoToken();
- }
- typeBuilder.ModuleBuilder.SetCustomAttribute(lazyPseudoToken, customBuilder);
- }
- }
-
- public override EventAttributes Attributes
- {
- get { return attributes; }
- }
-
- public override MethodInfo GetAddMethod(bool nonPublic)
- {
- return nonPublic || (addOnMethod != null && addOnMethod.IsPublic) ? addOnMethod : null;
- }
-
- public override MethodInfo GetRemoveMethod(bool nonPublic)
- {
- return nonPublic || (removeOnMethod != null && removeOnMethod.IsPublic) ? removeOnMethod : null;
- }
-
- public override MethodInfo GetRaiseMethod(bool nonPublic)
- {
- return nonPublic || (fireMethod != null && fireMethod.IsPublic) ? fireMethod : null;
- }
-
- public override MethodInfo[] GetOtherMethods(bool nonPublic)
- {
- List<MethodInfo> list = new List<MethodInfo>();
- foreach (Accessor acc in accessors)
- {
- if (acc.Semantics == MethodSemanticsTable.Other && (nonPublic || acc.Method.IsPublic))
- {
- list.Add(acc.Method);
- }
- }
- return list.ToArray();
- }
-
- public override MethodInfo[] __GetMethods()
- {
- List<MethodInfo> list = new List<MethodInfo>();
- foreach (Accessor acc in accessors)
- {
- list.Add(acc.Method);
- }
- return list.ToArray();
- }
-
- public override Type DeclaringType
- {
- get { return typeBuilder; }
- }
-
- public override string Name
- {
- get { return name; }
- }
-
- public override Module Module
- {
- get { return typeBuilder.ModuleBuilder; }
- }
-
- public EventToken GetEventToken()
- {
- if (lazyPseudoToken == 0)
- {
- lazyPseudoToken = typeBuilder.ModuleBuilder.AllocPseudoToken();
- }
- return new EventToken(lazyPseudoToken);
- }
-
- public override Type EventHandlerType
- {
- get { return typeBuilder.ModuleBuilder.ResolveType(eventtype); }
- }
-
- internal void Bake()
- {
- EventTable.Record rec = new EventTable.Record();
- rec.EventFlags = (short)attributes;
- rec.Name = typeBuilder.ModuleBuilder.Strings.Add(name);
- rec.EventType = eventtype;
- int token = 0x14000000 | typeBuilder.ModuleBuilder.Event.AddRecord(rec);
-
- if (lazyPseudoToken == 0)
- {
- lazyPseudoToken = token;
- }
- else
- {
- typeBuilder.ModuleBuilder.RegisterTokenFixup(lazyPseudoToken, token);
- }
-
- foreach (Accessor acc in accessors)
- {
- AddMethodSemantics(acc.Semantics, acc.Method.MetadataToken, token);
- }
- }
-
- private void AddMethodSemantics(short semantics, int methodToken, int propertyToken)
- {
- MethodSemanticsTable.Record rec = new MethodSemanticsTable.Record();
- rec.Semantics = semantics;
- rec.Method = methodToken;
- rec.Association = propertyToken;
- typeBuilder.ModuleBuilder.MethodSemantics.AddRecord(rec);
- }
-
- internal override bool IsPublic
- {
- get
- {
- foreach (Accessor acc in accessors)
- {
- if (acc.Method.IsPublic)
- {
- return true;
- }
- }
- return false;
- }
- }
-
- internal override bool IsNonPrivate
- {
- get
- {
- foreach (Accessor acc in accessors)
- {
- if ((acc.Method.Attributes & MethodAttributes.MemberAccessMask) > MethodAttributes.Private)
- {
- return true;
- }
- }
- return false;
- }
- }
-
- internal override bool IsStatic
- {
- get
- {
- foreach (Accessor acc in accessors)
- {
- if (acc.Method.IsStatic)
- {
- return true;
- }
- }
- return false;
- }
- }
-
- internal override bool IsBaked
- {
- get { return typeBuilder.IsBaked; }
- }
-
- internal override int GetCurrentToken()
- {
- if (typeBuilder.ModuleBuilder.IsSaved && typeBuilder.ModuleBuilder.IsPseudoToken(lazyPseudoToken))
- {
- return typeBuilder.ModuleBuilder.ResolvePseudoToken(lazyPseudoToken);
- }
- else
- {
- return lazyPseudoToken;
- }
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2008-2012 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Runtime.CompilerServices;
-using IKVM.Reflection.Metadata;
-using IKVM.Reflection.Writer;
-
-namespace IKVM.Reflection.Emit
-{
- public sealed class FieldBuilder : FieldInfo
- {
- private readonly TypeBuilder typeBuilder;
- private readonly string name;
- private readonly int pseudoToken;
- private FieldAttributes attribs;
- private readonly int nameIndex;
- private readonly int signature;
- private readonly FieldSignature fieldSig;
-
- internal FieldBuilder(TypeBuilder type, string name, Type fieldType, CustomModifiers customModifiers, FieldAttributes attribs)
- {
- this.typeBuilder = type;
- this.name = name;
- this.pseudoToken = type.ModuleBuilder.AllocPseudoToken();
- this.nameIndex = type.ModuleBuilder.Strings.Add(name);
- this.fieldSig = FieldSignature.Create(fieldType, customModifiers);
- ByteBuffer sig = new ByteBuffer(5);
- fieldSig.WriteSig(this.typeBuilder.ModuleBuilder, sig);
- this.signature = this.typeBuilder.ModuleBuilder.Blobs.Add(sig);
- this.attribs = attribs;
- this.typeBuilder.ModuleBuilder.Field.AddVirtualRecord();
- }
-
- public void SetConstant(object defaultValue)
- {
- attribs |= FieldAttributes.HasDefault;
- typeBuilder.ModuleBuilder.AddConstant(pseudoToken, defaultValue);
- }
-
- public override object GetRawConstantValue()
- {
- if (!typeBuilder.IsCreated())
- {
- // the .NET FieldBuilder doesn't support this method
- // (since we dont' have a different FieldInfo object after baking, we will support it once we're baked)
- throw new NotSupportedException();
- }
- return typeBuilder.Module.Constant.GetRawConstantValue(typeBuilder.Module, GetCurrentToken());
- }
-
- public void __SetDataAndRVA(byte[] data)
- {
- SetDataAndRvaImpl(data, typeBuilder.ModuleBuilder.initializedData, 0);
- }
-
- public void __SetReadOnlyDataAndRVA(byte[] data)
- {
- SetDataAndRvaImpl(data, typeBuilder.ModuleBuilder.methodBodies, unchecked((int)0x80000000));
- }
-
- private void SetDataAndRvaImpl(byte[] data, ByteBuffer bb, int readonlyMarker)
- {
- attribs |= FieldAttributes.HasFieldRVA;
- FieldRVATable.Record rec = new FieldRVATable.Record();
- bb.Align(8);
- rec.RVA = bb.Position + readonlyMarker;
- rec.Field = pseudoToken;
- typeBuilder.ModuleBuilder.FieldRVA.AddRecord(rec);
- bb.Write(data);
- }
-
- public override void __GetDataFromRVA(byte[] data, int offset, int length)
- {
- throw new NotImplementedException();
- }
-
- public override int __FieldRVA
- {
- get { throw new NotImplementedException(); }
- }
-
- public override bool __TryGetFieldOffset(out int offset)
- {
- int pseudoTokenOrIndex = pseudoToken;
- if (typeBuilder.ModuleBuilder.IsSaved)
- {
- pseudoTokenOrIndex = typeBuilder.ModuleBuilder.ResolvePseudoToken(pseudoToken) & 0xFFFFFF;
- }
- foreach (int i in this.Module.FieldLayout.Filter(pseudoTokenOrIndex))
- {
- offset = this.Module.FieldLayout.records[i].Offset;
- return true;
- }
- offset = 0;
- return false;
- }
-
- public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
- {
- SetCustomAttribute(new CustomAttributeBuilder(con, binaryAttribute));
- }
-
- public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
- {
- Universe u = this.Module.universe;
- if (customBuilder.Constructor.DeclaringType == u.System_Runtime_InteropServices_FieldOffsetAttribute)
- {
- customBuilder = customBuilder.DecodeBlob(this.Module.Assembly);
- SetOffset((int)customBuilder.GetConstructorArgument(0));
- }
- else if (customBuilder.Constructor.DeclaringType == u.System_Runtime_InteropServices_MarshalAsAttribute)
- {
- FieldMarshal.SetMarshalAsAttribute(typeBuilder.ModuleBuilder, pseudoToken, customBuilder);
- attribs |= FieldAttributes.HasFieldMarshal;
- }
- else if (customBuilder.Constructor.DeclaringType == u.System_NonSerializedAttribute)
- {
- attribs |= FieldAttributes.NotSerialized;
- }
- else if (customBuilder.Constructor.DeclaringType == u.System_Runtime_CompilerServices_SpecialNameAttribute)
- {
- attribs |= FieldAttributes.SpecialName;
- }
- else
- {
- typeBuilder.ModuleBuilder.SetCustomAttribute(pseudoToken, customBuilder);
- }
- }
-
- public void SetOffset(int iOffset)
- {
- FieldLayoutTable.Record rec = new FieldLayoutTable.Record();
- rec.Offset = iOffset;
- rec.Field = pseudoToken;
- typeBuilder.ModuleBuilder.FieldLayout.AddRecord(rec);
- }
-
- public override FieldAttributes Attributes
- {
- get { return attribs; }
- }
-
- public override Type DeclaringType
- {
- get { return typeBuilder.IsModulePseudoType ? null : typeBuilder; }
- }
-
- public override string Name
- {
- get { return name; }
- }
-
- public override int MetadataToken
- {
- get { return pseudoToken; }
- }
-
- public override Module Module
- {
- get { return typeBuilder.Module; }
- }
-
- public FieldToken GetToken()
- {
- return new FieldToken(pseudoToken);
- }
-
- internal void WriteFieldRecords(MetadataWriter mw)
- {
- mw.Write((short)attribs);
- mw.WriteStringIndex(nameIndex);
- mw.WriteBlobIndex(signature);
- }
-
- internal void FixupToken(int token)
- {
- typeBuilder.ModuleBuilder.RegisterTokenFixup(this.pseudoToken, token);
- }
-
- internal override FieldSignature FieldSignature
- {
- get { return fieldSig; }
- }
-
- internal override int ImportTo(ModuleBuilder other)
- {
- return other.ImportMethodOrField(typeBuilder, name, fieldSig);
- }
-
- internal override int GetCurrentToken()
- {
- if (typeBuilder.ModuleBuilder.IsSaved)
- {
- return typeBuilder.ModuleBuilder.ResolvePseudoToken(pseudoToken);
- }
- else
- {
- return pseudoToken;
- }
- }
-
- internal override bool IsBaked
- {
- get { return typeBuilder.IsBaked; }
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2008-2012 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Runtime.InteropServices;
-using System.Collections.Generic;
-using System.Diagnostics.SymbolStore;
-using System.Diagnostics;
-using IKVM.Reflection.Writer;
-
-namespace IKVM.Reflection.Emit
-{
- public struct Label
- {
- // 1-based here, to make sure that an uninitialized Label isn't valid
- private readonly int index1;
-
- internal Label(int index)
- {
- this.index1 = index + 1;
- }
-
- internal int Index
- {
- get { return index1 - 1; }
- }
-
- public bool Equals(Label other)
- {
- return other.index1 == index1;
- }
-
- public override bool Equals(object obj)
- {
- return this == obj as Label?;
- }
-
- public override int GetHashCode()
- {
- return index1;
- }
-
- public static bool operator ==(Label arg1, Label arg2)
- {
- return arg1.index1 == arg2.index1;
- }
-
- public static bool operator !=(Label arg1, Label arg2)
- {
- return !(arg1 == arg2);
- }
- }
-
- public sealed class LocalBuilder
- {
- private readonly Type localType;
- private readonly int index;
- private readonly bool pinned;
- internal string name;
- internal int startOffset;
- internal int endOffset;
-
- internal LocalBuilder(Type localType, int index, bool pinned)
- {
- this.localType = localType;
- this.index = index;
- this.pinned = pinned;
- }
-
- public void SetLocalSymInfo(string name)
- {
- this.name = name;
- }
-
- public void SetLocalSymInfo(string name, int startOffset, int endOffset)
- {
- this.name = name;
- this.startOffset = startOffset;
- this.endOffset = endOffset;
- }
-
- public Type LocalType
- {
- get { return localType; }
- }
-
- public int LocalIndex
- {
- get { return index; }
- }
-
- public bool IsPinned
- {
- get { return pinned; }
- }
- }
-
- public sealed class ILGenerator
- {
- private readonly ModuleBuilder moduleBuilder;
- private readonly ByteBuffer code;
- private readonly SignatureHelper locals;
- private int localsCount;
- private readonly List<int> tokenFixups = new List<int>();
- private readonly List<int> labels = new List<int>();
- private readonly List<int> labelStackHeight = new List<int>();
- private readonly List<LabelFixup> labelFixups = new List<LabelFixup>();
- private readonly List<SequencePoint> sequencePoints = new List<SequencePoint>();
- private readonly List<ExceptionBlock> exceptions = new List<ExceptionBlock>();
- private readonly Stack<ExceptionBlock> exceptionStack = new Stack<ExceptionBlock>();
- private ushort maxStack;
- private bool fatHeader;
- private int stackHeight;
- private Scope scope;
- private byte exceptionBlockAssistanceMode = EBAM_COMPAT;
- private const byte EBAM_COMPAT = 0;
- private const byte EBAM_DISABLE = 1;
- private const byte EBAM_CLEVER = 2;
-
- private struct LabelFixup
- {
- internal int label;
- internal int offset;
- }
-
- private sealed class ExceptionBlock : IComparer<ExceptionBlock>
- {
- internal readonly int ordinal;
- internal Label labelEnd;
- internal int tryOffset;
- internal int tryLength;
- internal int handlerOffset;
- internal int handlerLength;
- internal Type exceptionType; // MarkerType.Finally = finally block, MarkerType.Filter = handler with filter, MarkerType.Fault = fault block
- internal int filterOffset;
-
- internal ExceptionBlock(int ordinal)
- {
- this.ordinal = ordinal;
- }
-
- int IComparer<ExceptionBlock>.Compare(ExceptionBlock x, ExceptionBlock y)
- {
- // Mono's sort insists on doing unnecessary comparisons
- if (x == y)
- {
- return 0;
- }
- else if (x.tryOffset == y.tryOffset && x.tryLength == y.tryLength)
- {
- return x.ordinal < y.ordinal ? -1 : 1;
- }
- else if (x.tryOffset >= y.tryOffset && x.handlerOffset + x.handlerLength <= y.handlerOffset + y.handlerLength)
- {
- return -1;
- }
- else if (y.tryOffset >= x.tryOffset && y.handlerOffset + y.handlerLength <= x.handlerOffset + x.handlerLength)
- {
- return 1;
- }
- else
- {
- return x.ordinal < y.ordinal ? -1 : 1;
- }
- }
- }
-
- private struct SequencePoint
- {
- internal ISymbolDocumentWriter document;
- internal int offset;
- internal int startLine;
- internal int startColumn;
- internal int endLine;
- internal int endColumn;
- }
-
- private sealed class Scope
- {
- internal readonly Scope parent;
- internal readonly List<Scope> children = new List<Scope>();
- internal readonly List<LocalBuilder> locals = new List<LocalBuilder>();
- internal int startOffset;
- internal int endOffset;
-
- internal Scope(Scope parent)
- {
- this.parent = parent;
- }
- }
-
- internal ILGenerator(ModuleBuilder moduleBuilder, int initialCapacity)
- {
- this.code = new ByteBuffer(initialCapacity);
- this.moduleBuilder = moduleBuilder;
- this.locals = SignatureHelper.GetLocalVarSigHelper(moduleBuilder);
- if (moduleBuilder.symbolWriter != null)
- {
- scope = new Scope(null);
- }
- }
-
- // non-standard API
- public void __DisableExceptionBlockAssistance()
- {
- exceptionBlockAssistanceMode = EBAM_DISABLE;
- }
-
- // non-standard API
- public void __CleverExceptionBlockAssistance()
- {
- exceptionBlockAssistanceMode = EBAM_CLEVER;
- }
-
- // non-standard API
- public int __MaxStackSize
- {
- get { return maxStack; }
- set
- {
- maxStack = (ushort)value;
- fatHeader = true;
- }
- }
-
- // non-standard API
- // returns -1 if the current position is currently unreachable
- public int __StackHeight
- {
- get { return stackHeight; }
- }
-
- // new in .NET 4.0
- public int ILOffset
- {
- get { return code.Position; }
- }
-
- public void BeginCatchBlock(Type exceptionType)
- {
- ExceptionBlock block = exceptionStack.Peek();
- if (exceptionBlockAssistanceMode == EBAM_COMPAT || (exceptionBlockAssistanceMode == EBAM_CLEVER && stackHeight != -1))
- {
- if (exceptionType == null)
- {
- Emit(OpCodes.Endfilter);
- }
- else
- {
- Emit(OpCodes.Leave, block.labelEnd);
- }
- }
- stackHeight = 0;
- UpdateStack(1);
- if (exceptionType == null)
- {
- if (block.exceptionType != MarkerType.Filter || block.handlerOffset != 0)
- {
- throw new ArgumentNullException("exceptionType");
- }
- block.handlerOffset = code.Position;
- }
- else
- {
- if (block.tryLength == 0)
- {
- block.tryLength = code.Position - block.tryOffset;
- }
- else
- {
- block.handlerLength = code.Position - block.handlerOffset;
- exceptionStack.Pop();
- ExceptionBlock newBlock = new ExceptionBlock(exceptions.Count);
- newBlock.labelEnd = block.labelEnd;
- newBlock.tryOffset = block.tryOffset;
- newBlock.tryLength = block.tryLength;
- block = newBlock;
- exceptions.Add(block);
- exceptionStack.Push(block);
- }
- block.exceptionType = exceptionType;
- if (exceptionType == MarkerType.Filter)
- {
- block.filterOffset = code.Position;
- }
- else
- {
- block.handlerOffset = code.Position;
- }
- }
- }
-
- public Label BeginExceptionBlock()
- {
- ExceptionBlock block = new ExceptionBlock(exceptions.Count);
- block.labelEnd = DefineLabel();
- block.tryOffset = code.Position;
- exceptionStack.Push(block);
- exceptions.Add(block);
- stackHeight = 0;
- return block.labelEnd;
- }
-
- public void BeginExceptFilterBlock()
- {
- BeginCatchBlock(MarkerType.Filter);
- }
-
- public void BeginFaultBlock()
- {
- BeginFinallyFaultBlock(MarkerType.Fault);
- }
-
- public void BeginFinallyBlock()
- {
- BeginFinallyFaultBlock(MarkerType.Finally);
- }
-
- private void BeginFinallyFaultBlock(Type type)
- {
- ExceptionBlock block = exceptionStack.Peek();
- if (exceptionBlockAssistanceMode == EBAM_COMPAT || (exceptionBlockAssistanceMode == EBAM_CLEVER && stackHeight != -1))
- {
- Emit(OpCodes.Leave, block.labelEnd);
- }
- if (block.handlerOffset == 0)
- {
- block.tryLength = code.Position - block.tryOffset;
- }
- else
- {
- block.handlerLength = code.Position - block.handlerOffset;
- Label labelEnd;
- if (exceptionBlockAssistanceMode != EBAM_COMPAT)
- {
- labelEnd = block.labelEnd;
- }
- else
- {
- MarkLabel(block.labelEnd);
- labelEnd = DefineLabel();
- Emit(OpCodes.Leave, labelEnd);
- }
- exceptionStack.Pop();
- ExceptionBlock newBlock = new ExceptionBlock(exceptions.Count);
- newBlock.labelEnd = labelEnd;
- newBlock.tryOffset = block.tryOffset;
- newBlock.tryLength = code.Position - block.tryOffset;
- block = newBlock;
- exceptions.Add(block);
- exceptionStack.Push(block);
- }
- block.handlerOffset = code.Position;
- block.exceptionType = type;
- stackHeight = 0;
- }
-
- public void EndExceptionBlock()
- {
- ExceptionBlock block = exceptionStack.Pop();
- if (exceptionBlockAssistanceMode == EBAM_COMPAT || (exceptionBlockAssistanceMode == EBAM_CLEVER && stackHeight != -1))
- {
- if (block.filterOffset != 0 || (block.exceptionType != MarkerType.Finally && block.exceptionType != MarkerType.Fault))
- {
- Emit(OpCodes.Leave, block.labelEnd);
- }
- else
- {
- Emit(OpCodes.Endfinally);
- }
- }
- MarkLabel(block.labelEnd);
- block.handlerLength = code.Position - block.handlerOffset;
- }
-
- public void BeginScope()
- {
- Scope newScope = new Scope(scope);
- scope.children.Add(newScope);
- scope = newScope;
- scope.startOffset = code.Position;
- }
-
- public void UsingNamespace(string usingNamespace)
- {
- if (moduleBuilder.symbolWriter != null)
- {
- moduleBuilder.symbolWriter.UsingNamespace(usingNamespace);
- }
- }
-
- public LocalBuilder DeclareLocal(Type localType)
- {
- return DeclareLocal(localType, false);
- }
-
- public LocalBuilder DeclareLocal(Type localType, bool pinned)
- {
- LocalBuilder local = new LocalBuilder(localType, localsCount++, pinned);
- locals.AddArgument(localType, pinned);
- if (scope != null)
- {
- scope.locals.Add(local);
- }
- return local;
- }
-
- public LocalBuilder __DeclareLocal(Type localType, bool pinned, CustomModifiers customModifiers)
- {
- LocalBuilder local = new LocalBuilder(localType, localsCount++, pinned);
- locals.__AddArgument(localType, pinned, customModifiers);
- if (scope != null)
- {
- scope.locals.Add(local);
- }
- return local;
- }
-
- public Label DefineLabel()
- {
- Label label = new Label(labels.Count);
- labels.Add(-1);
- labelStackHeight.Add(-1);
- return label;
- }
-
- public void Emit(OpCode opc)
- {
- Debug.Assert(opc != OpCodes.Ret || (opc == OpCodes.Ret && stackHeight <= 1));
- if (opc.Value < 0)
- {
- code.Write((byte)(opc.Value >> 8));
- }
- code.Write((byte)opc.Value);
- switch (opc.FlowControl)
- {
- case FlowControl.Branch:
- case FlowControl.Break:
- case FlowControl.Return:
- case FlowControl.Throw:
- stackHeight = -1;
- break;
- default:
- UpdateStack(opc.StackDiff);
- break;
- }
- }
-
- private void UpdateStack(int stackdiff)
- {
- if (stackHeight == -1)
- {
- // we're about to emit code that is either unreachable or reachable only via a backward branch
- stackHeight = 0;
- }
- Debug.Assert(stackHeight >= 0 && stackHeight <= ushort.MaxValue);
- stackHeight += stackdiff;
- Debug.Assert(stackHeight >= 0 && stackHeight <= ushort.MaxValue);
- maxStack = Math.Max(maxStack, (ushort)stackHeight);
- }
-
- public void Emit(OpCode opc, byte arg)
- {
- Emit(opc);
- code.Write(arg);
- }
-
- public void Emit(OpCode opc, double arg)
- {
- Emit(opc);
- code.Write(arg);
- }
-
- public void Emit(OpCode opc, FieldInfo field)
- {
- Emit(opc);
- WriteToken(moduleBuilder.GetFieldToken(field));
- }
-
- public void Emit(OpCode opc, short arg)
- {
- Emit(opc);
- code.Write(arg);
- }
-
- public void Emit(OpCode opc, int arg)
- {
- Emit(opc);
- code.Write(arg);
- }
-
- public void Emit(OpCode opc, long arg)
- {
- Emit(opc);
- code.Write(arg);
- }
-
- public void Emit(OpCode opc, Label label)
- {
- // We need special stackHeight handling for unconditional branches,
- // because the branch and next flows have differing stack heights.
- // Note that this assumes that unconditional branches do not push/pop.
- int flowStackHeight = this.stackHeight;
- Emit(opc);
- if (opc == OpCodes.Leave || opc == OpCodes.Leave_S)
- {
- flowStackHeight = 0;
- }
- else if (opc.FlowControl != FlowControl.Branch)
- {
- flowStackHeight = this.stackHeight;
- }
- // if the label has already been marked, we can emit the branch offset directly
- if (labels[label.Index] != -1)
- {
- if (labelStackHeight[label.Index] != flowStackHeight && (labelStackHeight[label.Index] != 0 || flowStackHeight != -1))
- {
- // the "backward branch constraint" prohibits this, so we don't need to support it
- throw new NotSupportedException("'Backward branch constraints' violated");
- }
- if (opc.OperandType == OperandType.ShortInlineBrTarget)
- {
- WriteByteBranchOffset(labels[label.Index] - (code.Position + 1));
- }
- else
- {
- code.Write(labels[label.Index] - (code.Position + 4));
- }
- }
- else
- {
- Debug.Assert(labelStackHeight[label.Index] == -1 || labelStackHeight[label.Index] == flowStackHeight || (flowStackHeight == -1 && labelStackHeight[label.Index] == 0));
- labelStackHeight[label.Index] = flowStackHeight;
- LabelFixup fix = new LabelFixup();
- fix.label = label.Index;
- fix.offset = code.Position;
- labelFixups.Add(fix);
- if (opc.OperandType == OperandType.ShortInlineBrTarget)
- {
- code.Write((byte)1);
- }
- else
- {
- code.Write(4);
- }
- }
- }
-
- private void WriteByteBranchOffset(int offset)
- {
- if (offset < -128 || offset > 127)
- {
- throw new NotSupportedException("Branch offset of " + offset + " does not fit in one-byte branch target at position " + code.Position);
- }
- code.Write((byte)offset);
- }
-
- public void Emit(OpCode opc, Label[] labels)
- {
- Emit(opc);
- LabelFixup fix = new LabelFixup();
- fix.label = -1;
- fix.offset = code.Position;
- labelFixups.Add(fix);
- code.Write(labels.Length);
- foreach (Label label in labels)
- {
- code.Write(label.Index);
- if (this.labels[label.Index] != -1)
- {
- if (labelStackHeight[label.Index] != stackHeight)
- {
- // the "backward branch constraint" prohibits this, so we don't need to support it
- throw new NotSupportedException();
- }
- }
- else
- {
- Debug.Assert(labelStackHeight[label.Index] == -1 || labelStackHeight[label.Index] == stackHeight);
- labelStackHeight[label.Index] = stackHeight;
- }
- }
- }
-
- public void Emit(OpCode opc, LocalBuilder local)
- {
- if ((opc == OpCodes.Ldloc || opc == OpCodes.Ldloca || opc == OpCodes.Stloc) && local.LocalIndex < 256)
- {
- if (opc == OpCodes.Ldloc)
- {
- switch (local.LocalIndex)
- {
- case 0:
- Emit(OpCodes.Ldloc_0);
- break;
- case 1:
- Emit(OpCodes.Ldloc_1);
- break;
- case 2:
- Emit(OpCodes.Ldloc_2);
- break;
- case 3:
- Emit(OpCodes.Ldloc_3);
- break;
- default:
- Emit(OpCodes.Ldloc_S);
- code.Write((byte)local.LocalIndex);
- break;
- }
- }
- else if (opc == OpCodes.Ldloca)
- {
- Emit(OpCodes.Ldloca_S);
- code.Write((byte)local.LocalIndex);
- }
- else if (opc == OpCodes.Stloc)
- {
- switch (local.LocalIndex)
- {
- case 0:
- Emit(OpCodes.Stloc_0);
- break;
- case 1:
- Emit(OpCodes.Stloc_1);
- break;
- case 2:
- Emit(OpCodes.Stloc_2);
- break;
- case 3:
- Emit(OpCodes.Stloc_3);
- break;
- default:
- Emit(OpCodes.Stloc_S);
- code.Write((byte)local.LocalIndex);
- break;
- }
- }
- }
- else
- {
- Emit(opc);
- switch (opc.OperandType)
- {
- case OperandType.InlineVar:
- code.Write((ushort)local.LocalIndex);
- break;
- case OperandType.ShortInlineVar:
- code.Write((byte)local.LocalIndex);
- break;
- }
- }
- }
-
- private void WriteToken(FieldToken token)
- {
- if (token.IsPseudoToken)
- {
- tokenFixups.Add(code.Position);
- }
- code.Write(token.Token);
- }
-
- private void WriteToken(MethodToken token)
- {
- if (token.IsPseudoToken)
- {
- tokenFixups.Add(code.Position);
- }
- code.Write(token.Token);
- }
-
- private void UpdateStack(OpCode opc, bool hasthis, Type returnType, int parameterCount)
- {
- if (opc == OpCodes.Jmp)
- {
- stackHeight = -1;
- }
- else if (opc.FlowControl == FlowControl.Call)
- {
- int stackdiff = 0;
- if ((hasthis && opc != OpCodes.Newobj) || opc == OpCodes.Calli)
- {
- // pop this
- stackdiff--;
- }
- // pop parameters
- stackdiff -= parameterCount;
- if (returnType != moduleBuilder.universe.System_Void)
- {
- // push return value
- stackdiff++;
- }
- UpdateStack(stackdiff);
- }
- }
-
- public void Emit(OpCode opc, MethodInfo method)
- {
- UpdateStack(opc, method.HasThis, method.ReturnType, method.ParameterCount);
- Emit(opc);
- WriteToken(moduleBuilder.GetMethodTokenForIL(method));
- }
-
- public void Emit(OpCode opc, ConstructorInfo constructor)
- {
- Emit(opc, constructor.GetMethodInfo());
- }
-
- public void Emit(OpCode opc, sbyte arg)
- {
- Emit(opc);
- code.Write(arg);
- }
-
- public void Emit(OpCode opc, float arg)
- {
- Emit(opc);
- code.Write(arg);
- }
-
- public void Emit(OpCode opc, string str)
- {
- Emit(opc);
- code.Write(moduleBuilder.GetStringConstant(str).Token);
- }
-
- public void Emit(OpCode opc, Type type)
- {
- Emit(opc);
- if (opc == OpCodes.Ldtoken)
- {
- code.Write(moduleBuilder.GetTypeToken(type).Token);
- }
- else
- {
- code.Write(moduleBuilder.GetTypeTokenForMemberRef(type));
- }
- }
-
- public void Emit(OpCode opcode, SignatureHelper signature)
- {
- Emit(opcode);
- UpdateStack(opcode, signature.HasThis, signature.ReturnType, signature.ParameterCount);
- code.Write(moduleBuilder.GetSignatureToken(signature).Token);
- }
-
- public void EmitCall(OpCode opc, MethodInfo method, Type[] optionalParameterTypes)
- {
- __EmitCall(opc, method, optionalParameterTypes, null);
- }
-
- public void __EmitCall(OpCode opc, MethodInfo method, Type[] optionalParameterTypes, CustomModifiers[] customModifiers)
- {
- if (optionalParameterTypes == null || optionalParameterTypes.Length == 0)
- {
- Emit(opc, method);
- }
- else
- {
- Emit(opc);
- UpdateStack(opc, method.HasThis, method.ReturnType, method.ParameterCount + optionalParameterTypes.Length);
- code.Write(moduleBuilder.__GetMethodToken(method, optionalParameterTypes, customModifiers).Token);
- }
- }
-
- public void __EmitCall(OpCode opc, ConstructorInfo constructor, Type[] optionalParameterTypes)
- {
- EmitCall(opc, constructor.GetMethodInfo(), optionalParameterTypes);
- }
-
- public void __EmitCall(OpCode opc, ConstructorInfo constructor, Type[] optionalParameterTypes, CustomModifiers[] customModifiers)
- {
- __EmitCall(opc, constructor.GetMethodInfo(), optionalParameterTypes, customModifiers);
- }
-
- public void EmitCalli(OpCode opc, CallingConvention callingConvention, Type returnType, Type[] parameterTypes)
- {
- SignatureHelper sig = SignatureHelper.GetMethodSigHelper(moduleBuilder, callingConvention, returnType);
- sig.AddArguments(parameterTypes, null, null);
- Emit(opc, sig);
- }
-
- public void EmitCalli(OpCode opc, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, Type[] optionalParameterTypes)
- {
- SignatureHelper sig = SignatureHelper.GetMethodSigHelper(moduleBuilder, callingConvention, returnType);
- sig.AddArguments(parameterTypes, null, null);
- sig.AddSentinel();
- sig.AddArguments(optionalParameterTypes, null, null);
- Emit(opc, sig);
- }
-
- public void __EmitCalli(OpCode opc, __StandAloneMethodSig sig)
- {
- Emit(opc);
- if (sig.IsUnmanaged)
- {
- UpdateStack(opc, false, sig.ReturnType, sig.ParameterCount);
- }
- else
- {
- CallingConventions callingConvention = sig.CallingConvention;
- UpdateStack(opc, (callingConvention & CallingConventions.HasThis | CallingConventions.ExplicitThis) == CallingConventions.HasThis, sig.ReturnType, sig.ParameterCount);
- }
- ByteBuffer bb = new ByteBuffer(16);
- Signature.WriteStandAloneMethodSig(moduleBuilder, bb, sig);
- code.Write(0x11000000 | moduleBuilder.StandAloneSig.FindOrAddRecord(moduleBuilder.Blobs.Add(bb)));
- }
-
- public void EmitWriteLine(string text)
- {
- Universe u = moduleBuilder.universe;
- Emit(OpCodes.Ldstr, text);
- Emit(OpCodes.Call, u.Import(typeof(Console)).GetMethod("WriteLine", new Type[] { u.System_String }));
- }
-
- public void EmitWriteLine(FieldInfo field)
- {
- Universe u = moduleBuilder.universe;
- Emit(OpCodes.Call, u.Import(typeof(Console)).GetMethod("get_Out"));
- if (field.IsStatic)
- {
- Emit(OpCodes.Ldsfld, field);
- }
- else
- {
- Emit(OpCodes.Ldarg_0);
- Emit(OpCodes.Ldfld, field);
- }
- Emit(OpCodes.Callvirt, u.Import(typeof(System.IO.TextWriter)).GetMethod("WriteLine", new Type[] { field.FieldType }));
- }
-
- public void EmitWriteLine(LocalBuilder local)
- {
- Universe u = moduleBuilder.universe;
- Emit(OpCodes.Call, u.Import(typeof(Console)).GetMethod("get_Out"));
- Emit(OpCodes.Ldloc, local);
- Emit(OpCodes.Callvirt, u.Import(typeof(System.IO.TextWriter)).GetMethod("WriteLine", new Type[] { local.LocalType }));
- }
-
- public void EndScope()
- {
- scope.endOffset = code.Position;
- scope = scope.parent;
- }
-
- public void MarkLabel(Label loc)
- {
- Debug.Assert(stackHeight == -1 || labelStackHeight[loc.Index] == -1 || stackHeight == labelStackHeight[loc.Index]);
- labels[loc.Index] = code.Position;
- if (labelStackHeight[loc.Index] == -1)
- {
- if (stackHeight == -1)
- {
- // We're at a location that can only be reached by a backward branch,
- // so according to the "backward branch constraint" that must mean the stack is empty,
- // but note that this may be an unused label followed by another label that is used and
- // that does have a non-zero stack height, so we don't yet set stackHeight here.
- labelStackHeight[loc.Index] = 0;
- }
- else
- {
- labelStackHeight[loc.Index] = stackHeight;
- }
- }
- else
- {
- Debug.Assert(stackHeight == -1 || stackHeight == labelStackHeight[loc.Index]);
- stackHeight = labelStackHeight[loc.Index];
- }
- }
-
- public void MarkSequencePoint(ISymbolDocumentWriter document, int startLine, int startColumn, int endLine, int endColumn)
- {
- SequencePoint sp = new SequencePoint();
- sp.document = document;
- sp.offset = code.Position;
- sp.startLine = startLine;
- sp.startColumn = startColumn;
- sp.endLine = endLine;
- sp.endColumn = endColumn;
- sequencePoints.Add(sp);
- }
-
- public void ThrowException(Type excType)
- {
- Emit(OpCodes.Newobj, excType.GetConstructor(Type.EmptyTypes));
- Emit(OpCodes.Throw);
- }
-
- internal int WriteBody(bool initLocals)
- {
- if (moduleBuilder.symbolWriter != null)
- {
- Debug.Assert(scope != null && scope.parent == null);
- scope.endOffset = code.Position;
- }
-
- ResolveBranches();
-
- ByteBuffer bb = moduleBuilder.methodBodies;
-
- int localVarSigTok = 0;
-
- int rva;
- if (localsCount == 0 && exceptions.Count == 0 && maxStack <= 8 && code.Length < 64 && !fatHeader)
- {
- rva = WriteTinyHeaderAndCode(bb);
- }
- else
- {
- rva = WriteFatHeaderAndCode(bb, ref localVarSigTok, initLocals);
- }
-
- if (moduleBuilder.symbolWriter != null)
- {
- if (sequencePoints.Count != 0)
- {
- ISymbolDocumentWriter document = sequencePoints[0].document;
- int[] offsets = new int[sequencePoints.Count];
- int[] lines = new int[sequencePoints.Count];
- int[] columns = new int[sequencePoints.Count];
- int[] endLines = new int[sequencePoints.Count];
- int[] endColumns = new int[sequencePoints.Count];
- for (int i = 0; i < sequencePoints.Count; i++)
- {
- if (sequencePoints[i].document != document)
- {
- throw new NotImplementedException();
- }
- offsets[i] = sequencePoints[i].offset;
- lines[i] = sequencePoints[i].startLine;
- columns[i] = sequencePoints[i].startColumn;
- endLines[i] = sequencePoints[i].endLine;
- endColumns[i] = sequencePoints[i].endColumn;
- }
- moduleBuilder.symbolWriter.DefineSequencePoints(document, offsets, lines, columns, endLines, endColumns);
- }
-
- WriteScope(scope, localVarSigTok);
- }
- return rva;
- }
-
- private void ResolveBranches()
- {
- foreach (LabelFixup fixup in labelFixups)
- {
- // is it a switch?
- if (fixup.label == -1)
- {
- code.Position = fixup.offset;
- int count = code.GetInt32AtCurrentPosition();
- int offset = fixup.offset + 4 + 4 * count;
- code.Position += 4;
- for (int i = 0; i < count; i++)
- {
- int index = code.GetInt32AtCurrentPosition();
- code.Write(labels[index] - offset);
- }
- }
- else
- {
- code.Position = fixup.offset;
- byte size = code.GetByteAtCurrentPosition();
- int branchOffset = labels[fixup.label] - (code.Position + size);
- if (size == 1)
- {
- WriteByteBranchOffset(branchOffset);
- }
- else
- {
- code.Write(branchOffset);
- }
- }
- }
- }
-
- private int WriteTinyHeaderAndCode(ByteBuffer bb)
- {
- int rva = bb.Position;
- const byte CorILMethod_TinyFormat = 0x2;
- bb.Write((byte)(CorILMethod_TinyFormat | (code.Length << 2)));
- WriteCode(bb);
- return rva;
- }
-
- private int WriteFatHeaderAndCode(ByteBuffer bb, ref int localVarSigTok, bool initLocals)
- {
- // fat headers require 4-byte alignment
- bb.Align(4);
- int rva = bb.Position;
-
- if (localsCount != 0)
- {
- localVarSigTok = moduleBuilder.GetSignatureToken(locals).Token;
- }
-
- const byte CorILMethod_FatFormat = 0x03;
- const byte CorILMethod_MoreSects = 0x08;
- const byte CorILMethod_InitLocals = 0x10;
-
- short flagsAndSize = (short)(CorILMethod_FatFormat | (3 << 12));
- if (initLocals)
- {
- flagsAndSize |= CorILMethod_InitLocals;
- }
-
- if (exceptions.Count > 0)
- {
- flagsAndSize |= CorILMethod_MoreSects;
- }
-
- bb.Write(flagsAndSize);
- bb.Write(maxStack);
- bb.Write(code.Length);
- bb.Write(localVarSigTok);
-
- WriteCode(bb);
-
- if (exceptions.Count > 0)
- {
- bb.Align(4);
-
- bool fat = false;
- foreach (ExceptionBlock block in exceptions)
- {
- if (block.tryOffset > 65535 || block.tryLength > 255 || block.handlerOffset > 65535 || block.handlerLength > 255)
- {
- fat = true;
- break;
- }
- }
- exceptions.Sort(exceptions[0]);
- if (exceptions.Count * 12 + 4 > 255)
- {
- fat = true;
- }
- const byte CorILMethod_Sect_EHTable = 0x1;
- const byte CorILMethod_Sect_FatFormat = 0x40;
- const short COR_ILEXCEPTION_CLAUSE_EXCEPTION = 0x0000;
- const short COR_ILEXCEPTION_CLAUSE_FILTER = 0x0001;
- const short COR_ILEXCEPTION_CLAUSE_FINALLY = 0x0002;
- const short COR_ILEXCEPTION_CLAUSE_FAULT = 0x0004;
-
- if (fat)
- {
- bb.Write((byte)(CorILMethod_Sect_EHTable | CorILMethod_Sect_FatFormat));
- int dataSize = exceptions.Count * 24 + 4;
- bb.Write((byte)dataSize);
- bb.Write((short)(dataSize >> 8));
- foreach (ExceptionBlock block in exceptions)
- {
- if (block.exceptionType == MarkerType.Fault)
- {
- bb.Write((int)COR_ILEXCEPTION_CLAUSE_FAULT);
- }
- else if (block.exceptionType == MarkerType.Filter)
- {
- bb.Write((int)COR_ILEXCEPTION_CLAUSE_FILTER);
- }
- else if (block.exceptionType == MarkerType.Finally)
- {
- bb.Write((int)COR_ILEXCEPTION_CLAUSE_FINALLY);
- }
- else
- {
- bb.Write((int)COR_ILEXCEPTION_CLAUSE_EXCEPTION);
- }
- bb.Write(block.tryOffset);
- bb.Write(block.tryLength);
- bb.Write(block.handlerOffset);
- bb.Write(block.handlerLength);
- if (block.exceptionType != MarkerType.Fault && block.exceptionType != MarkerType.Filter && block.exceptionType != MarkerType.Finally)
- {
- bb.Write(moduleBuilder.GetTypeTokenForMemberRef(block.exceptionType));
- }
- else
- {
- bb.Write(block.filterOffset);
- }
- }
- }
- else
- {
- bb.Write(CorILMethod_Sect_EHTable);
- bb.Write((byte)(exceptions.Count * 12 + 4));
- bb.Write((short)0);
- foreach (ExceptionBlock block in exceptions)
- {
- if (block.exceptionType == MarkerType.Fault)
- {
- bb.Write(COR_ILEXCEPTION_CLAUSE_FAULT);
- }
- else if (block.exceptionType == MarkerType.Filter)
- {
- bb.Write(COR_ILEXCEPTION_CLAUSE_FILTER);
- }
- else if (block.exceptionType == MarkerType.Finally)
- {
- bb.Write(COR_ILEXCEPTION_CLAUSE_FINALLY);
- }
- else
- {
- bb.Write(COR_ILEXCEPTION_CLAUSE_EXCEPTION);
- }
- bb.Write((short)block.tryOffset);
- bb.Write((byte)block.tryLength);
- bb.Write((short)block.handlerOffset);
- bb.Write((byte)block.handlerLength);
- if (block.exceptionType != MarkerType.Fault && block.exceptionType != MarkerType.Filter && block.exceptionType != MarkerType.Finally)
- {
- bb.Write(moduleBuilder.GetTypeTokenForMemberRef(block.exceptionType));
- }
- else
- {
- bb.Write(block.filterOffset);
- }
- }
- }
- }
- return rva;
- }
-
- private void WriteCode(ByteBuffer bb)
- {
- int codeOffset = bb.Position;
- foreach (int fixup in this.tokenFixups)
- {
- moduleBuilder.tokenFixupOffsets.Add(fixup + codeOffset);
- }
- bb.Write(code);
- }
-
- private void WriteScope(Scope scope, int localVarSigTok)
- {
- moduleBuilder.symbolWriter.OpenScope(scope.startOffset);
- foreach (LocalBuilder local in scope.locals)
- {
- if (local.name != null)
- {
- int startOffset = local.startOffset;
- int endOffset = local.endOffset;
- if (startOffset == 0 && endOffset == 0)
- {
- startOffset = scope.startOffset;
- endOffset = scope.endOffset;
- }
- moduleBuilder.symbolWriter.DefineLocalVariable2(local.name, 0, localVarSigTok, SymAddressKind.ILOffset, local.LocalIndex, 0, 0, startOffset, endOffset);
- }
- }
- foreach (Scope child in scope.children)
- {
- WriteScope(child, localVarSigTok);
- }
- moduleBuilder.symbolWriter.CloseScope(scope.endOffset);
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2008-2012 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.IO;
-using System.Diagnostics;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-using System.Runtime.CompilerServices;
-using System.Diagnostics.SymbolStore;
-using IKVM.Reflection.Metadata;
-using IKVM.Reflection.Writer;
-
-namespace IKVM.Reflection.Emit
-{
- public sealed class MethodBuilder : MethodInfo
- {
- private readonly TypeBuilder typeBuilder;
- private readonly string name;
- private readonly int pseudoToken;
- private int nameIndex;
- private int signature;
- private Type returnType;
- private Type[] parameterTypes;
- private PackedCustomModifiers customModifiers;
- private MethodAttributes attributes;
- private MethodImplAttributes implFlags;
- private ILGenerator ilgen;
- private int rva = -1;
- private CallingConventions callingConvention;
- private List<ParameterBuilder> parameters;
- private GenericTypeParameterBuilder[] gtpb;
- private List<CustomAttributeBuilder> declarativeSecurity;
- private MethodSignature methodSignature;
- private bool initLocals = true;
-
- internal MethodBuilder(TypeBuilder typeBuilder, string name, MethodAttributes attributes, CallingConventions callingConvention)
- {
- this.typeBuilder = typeBuilder;
- this.name = name;
- this.pseudoToken = typeBuilder.ModuleBuilder.AllocPseudoToken();
- this.attributes = attributes;
- if ((attributes & MethodAttributes.Static) == 0)
- {
- callingConvention |= CallingConventions.HasThis;
- }
- this.callingConvention = callingConvention;
- }
-
- public ILGenerator GetILGenerator()
- {
- return GetILGenerator(16);
- }
-
- public ILGenerator GetILGenerator(int streamSize)
- {
- if (rva != -1)
- {
- throw new InvalidOperationException();
- }
- if (ilgen == null)
- {
- ilgen = new ILGenerator(typeBuilder.ModuleBuilder, streamSize);
- }
- return ilgen;
- }
-
- public void __ReleaseILGenerator()
- {
- if (ilgen != null)
- {
- if (this.ModuleBuilder.symbolWriter != null)
- {
- this.ModuleBuilder.symbolWriter.OpenMethod(new SymbolToken(-pseudoToken | 0x06000000), this);
- }
- rva = ilgen.WriteBody(initLocals);
- if (this.ModuleBuilder.symbolWriter != null)
- {
- this.ModuleBuilder.symbolWriter.CloseMethod();
- }
- ilgen = null;
- }
- }
-
- public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
- {
- SetCustomAttribute(new CustomAttributeBuilder(con, binaryAttribute));
- }
-
- private void SetDllImportPseudoCustomAttribute(CustomAttributeBuilder customBuilder)
- {
- CallingConvention? callingConvention = customBuilder.GetFieldValue<CallingConvention>("CallingConvention");
- CharSet? charSet = customBuilder.GetFieldValue<CharSet>("CharSet");
- SetDllImportPseudoCustomAttribute((string)customBuilder.GetConstructorArgument(0),
- (string)customBuilder.GetFieldValue("EntryPoint"),
- callingConvention,
- charSet,
- (bool?)customBuilder.GetFieldValue("BestFitMapping"),
- (bool?)customBuilder.GetFieldValue("ThrowOnUnmappableChar"),
- (bool?)customBuilder.GetFieldValue("SetLastError"),
- (bool?)customBuilder.GetFieldValue("PreserveSig"),
- (bool?)customBuilder.GetFieldValue("ExactSpelling"));
- }
-
- internal void SetDllImportPseudoCustomAttribute(string dllName, string entryName, CallingConvention? nativeCallConv, CharSet? nativeCharSet,
- bool? bestFitMapping, bool? throwOnUnmappableChar, bool? setLastError, bool? preserveSig, bool? exactSpelling)
- {
- const short NoMangle = 0x0001;
- const short CharSetMask = 0x0006;
- const short CharSetNotSpec = 0x0000;
- const short CharSetAnsi = 0x0002;
- const short CharSetUnicode = 0x0004;
- const short CharSetAuto = 0x0006;
- const short SupportsLastError = 0x0040;
- const short CallConvMask = 0x0700;
- const short CallConvWinapi = 0x0100;
- const short CallConvCdecl = 0x0200;
- const short CallConvStdcall = 0x0300;
- const short CallConvThiscall = 0x0400;
- const short CallConvFastcall = 0x0500;
- // non-standard flags
- const short BestFitOn = 0x0010;
- const short BestFitOff = 0x0020;
- const short CharMapErrorOn = 0x1000;
- const short CharMapErrorOff = 0x2000;
- short flags = CharSetNotSpec | CallConvWinapi;
- if (bestFitMapping.HasValue)
- {
- flags |= bestFitMapping.Value ? BestFitOn : BestFitOff;
- }
- if (throwOnUnmappableChar.HasValue)
- {
- flags |= throwOnUnmappableChar.Value ? CharMapErrorOn : CharMapErrorOff;
- }
- if (nativeCallConv.HasValue)
- {
- flags &= ~CallConvMask;
- switch (nativeCallConv.Value)
- {
- case System.Runtime.InteropServices.CallingConvention.Cdecl:
- flags |= CallConvCdecl;
- break;
- case System.Runtime.InteropServices.CallingConvention.FastCall:
- flags |= CallConvFastcall;
- break;
- case System.Runtime.InteropServices.CallingConvention.StdCall:
- flags |= CallConvStdcall;
- break;
- case System.Runtime.InteropServices.CallingConvention.ThisCall:
- flags |= CallConvThiscall;
- break;
- case System.Runtime.InteropServices.CallingConvention.Winapi:
- flags |= CallConvWinapi;
- break;
- }
- }
- if (nativeCharSet.HasValue)
- {
- flags &= ~CharSetMask;
- switch (nativeCharSet.Value)
- {
- case CharSet.Ansi:
- case CharSet.None:
- flags |= CharSetAnsi;
- break;
- case CharSet.Auto:
- flags |= CharSetAuto;
- break;
- case CharSet.Unicode:
- flags |= CharSetUnicode;
- break;
- }
- }
- if (exactSpelling.HasValue && exactSpelling.Value)
- {
- flags |= NoMangle;
- }
- if (!preserveSig.HasValue || preserveSig.Value)
- {
- implFlags |= MethodImplAttributes.PreserveSig;
- }
- if (setLastError.HasValue && setLastError.Value)
- {
- flags |= SupportsLastError;
- }
- ImplMapTable.Record rec = new ImplMapTable.Record();
- rec.MappingFlags = flags;
- rec.MemberForwarded = pseudoToken;
- rec.ImportName = this.ModuleBuilder.Strings.Add(entryName ?? name);
- rec.ImportScope = this.ModuleBuilder.ModuleRef.FindOrAddRecord(dllName == null ? 0 : this.ModuleBuilder.Strings.Add(dllName));
- this.ModuleBuilder.ImplMap.AddRecord(rec);
- }
-
- private void SetMethodImplAttribute(CustomAttributeBuilder customBuilder)
- {
- MethodImplOptions opt;
- switch (customBuilder.Constructor.ParameterCount)
- {
- case 0:
- opt = 0;
- break;
- case 1:
- {
- object val = customBuilder.GetConstructorArgument(0);
- if (val is short)
- {
- opt = (MethodImplOptions)(short)val;
- }
- else if (val is int)
- {
- opt = (MethodImplOptions)(int)val;
- }
- else
- {
- opt = (MethodImplOptions)val;
- }
- break;
- }
- default:
- throw new NotSupportedException();
- }
- MethodCodeType? type = customBuilder.GetFieldValue<MethodCodeType>("MethodCodeType");
- implFlags = (MethodImplAttributes)opt;
- if (type.HasValue)
- {
- implFlags |= (MethodImplAttributes)type;
- }
- }
-
- public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
- {
- Universe u = this.ModuleBuilder.universe;
- Type type = customBuilder.Constructor.DeclaringType;
- if (type == u.System_Runtime_InteropServices_DllImportAttribute)
- {
- attributes |= MethodAttributes.PinvokeImpl;
- SetDllImportPseudoCustomAttribute(customBuilder.DecodeBlob(this.Module.Assembly));
- }
- else if (type == u.System_Runtime_CompilerServices_MethodImplAttribute)
- {
- SetMethodImplAttribute(customBuilder.DecodeBlob(this.Module.Assembly));
- }
- else if (type == u.System_Runtime_InteropServices_PreserveSigAttribute)
- {
- implFlags |= MethodImplAttributes.PreserveSig;
- }
- else if (type == u.System_Runtime_CompilerServices_SpecialNameAttribute)
- {
- attributes |= MethodAttributes.SpecialName;
- }
- else
- {
- if (type == u.System_Security_SuppressUnmanagedCodeSecurityAttribute)
- {
- attributes |= MethodAttributes.HasSecurity;
- }
- this.ModuleBuilder.SetCustomAttribute(pseudoToken, customBuilder);
- }
- }
-
- public void __AddDeclarativeSecurity(CustomAttributeBuilder customBuilder)
- {
- attributes |= MethodAttributes.HasSecurity;
- if (declarativeSecurity == null)
- {
- declarativeSecurity = new List<CustomAttributeBuilder>();
- }
- declarativeSecurity.Add(customBuilder);
- }
-
- public void AddDeclarativeSecurity(System.Security.Permissions.SecurityAction securityAction, System.Security.PermissionSet permissionSet)
- {
- this.ModuleBuilder.AddDeclarativeSecurity(pseudoToken, securityAction, permissionSet);
- this.attributes |= MethodAttributes.HasSecurity;
- }
-
- public void SetImplementationFlags(MethodImplAttributes attributes)
- {
- implFlags = attributes;
- }
-
- public ParameterBuilder DefineParameter(int position, ParameterAttributes attributes, string strParamName)
- {
- if (parameters == null)
- {
- parameters = new List<ParameterBuilder>();
- }
- this.ModuleBuilder.Param.AddVirtualRecord();
- ParameterBuilder pb = new ParameterBuilder(this.ModuleBuilder, position, attributes, strParamName);
- if (parameters.Count == 0 || position > parameters[parameters.Count - 1].Position)
- {
- parameters.Add(pb);
- }
- else
- {
- for (int i = 0; i < parameters.Count; i++)
- {
- if (parameters[i].Position > position)
- {
- parameters.Insert(i, pb);
- break;
- }
- }
- }
- return pb;
- }
-
- private void CheckSig()
- {
- if (methodSignature != null)
- {
- throw new InvalidOperationException("The method signature can not be modified after it has been used.");
- }
- }
-
- public void SetParameters(params Type[] parameterTypes)
- {
- CheckSig();
- this.parameterTypes = Util.Copy(parameterTypes);
- }
-
- public void SetReturnType(Type returnType)
- {
- CheckSig();
- this.returnType = returnType ?? this.Module.universe.System_Void;
- }
-
- public void SetSignature(Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers)
- {
- SetSignature(returnType, parameterTypes, PackedCustomModifiers.CreateFromExternal(returnTypeOptionalCustomModifiers, returnTypeRequiredCustomModifiers,
- parameterTypeOptionalCustomModifiers, parameterTypeRequiredCustomModifiers, Util.NullSafeLength(parameterTypes)));
- }
-
- public void __SetSignature(Type returnType, CustomModifiers returnTypeCustomModifiers, Type[] parameterTypes, CustomModifiers[] parameterTypeCustomModifiers)
- {
- SetSignature(returnType, parameterTypes, PackedCustomModifiers.CreateFromExternal(returnTypeCustomModifiers, parameterTypeCustomModifiers, Util.NullSafeLength(parameterTypes)));
- }
-
- private void SetSignature(Type returnType, Type[] parameterTypes, PackedCustomModifiers customModifiers)
- {
- CheckSig();
- this.returnType = returnType ?? this.Module.universe.System_Void;
- this.parameterTypes = Util.Copy(parameterTypes);
- this.customModifiers = customModifiers;
- }
-
- public GenericTypeParameterBuilder[] DefineGenericParameters(params string[] names)
- {
- CheckSig();
- gtpb = new GenericTypeParameterBuilder[names.Length];
- for (int i = 0; i < names.Length; i++)
- {
- gtpb[i] = new GenericTypeParameterBuilder(names[i], null, this, i);
- }
- return (GenericTypeParameterBuilder[])gtpb.Clone();
- }
-
- public override MethodInfo MakeGenericMethod(params Type[] typeArguments)
- {
- return new GenericMethodInstance(typeBuilder, this, typeArguments);
- }
-
- public override MethodInfo GetGenericMethodDefinition()
- {
- if (gtpb == null)
- {
- throw new InvalidOperationException();
- }
- return this;
- }
-
- public override Type[] GetGenericArguments()
- {
- return Util.Copy(gtpb);
- }
-
- internal override Type GetGenericMethodArgument(int index)
- {
- return gtpb[index];
- }
-
- internal override int GetGenericMethodArgumentCount()
- {
- return gtpb == null ? 0 : gtpb.Length;
- }
-
- public override Type ReturnType
- {
- get { return returnType; }
- }
-
- public override ParameterInfo ReturnParameter
- {
- get { return new ParameterInfoImpl(this, -1); }
- }
-
- public override MethodAttributes Attributes
- {
- get { return attributes; }
- }
-
- public void __SetAttributes(MethodAttributes attributes)
- {
- this.attributes = attributes;
- }
-
- public void __SetCallingConvention(CallingConventions callingConvention)
- {
- this.callingConvention = callingConvention;
- this.methodSignature = null;
- }
-
- public override MethodImplAttributes GetMethodImplementationFlags()
- {
- return implFlags;
- }
-
- private sealed class ParameterInfoImpl : ParameterInfo
- {
- private readonly MethodBuilder method;
- private readonly int parameter;
-
- internal ParameterInfoImpl(MethodBuilder method, int parameter)
- {
- this.method = method;
- this.parameter = parameter;
- }
-
- private ParameterBuilder ParameterBuilder
- {
- get
- {
- if (method.parameters != null)
- {
- foreach (ParameterBuilder pb in method.parameters)
- {
- // ParameterBuilder.Position is 1-based
- if (pb.Position - 1 == parameter)
- {
- return pb;
- }
- }
- }
- return null;
- }
- }
-
- public override string Name
- {
- get
- {
- ParameterBuilder pb = this.ParameterBuilder;
- return pb != null ? pb.Name : null;
- }
- }
-
- public override Type ParameterType
- {
- get { return parameter == -1 ? method.returnType : method.parameterTypes[parameter]; }
- }
-
- public override ParameterAttributes Attributes
- {
- get
- {
- ParameterBuilder pb = this.ParameterBuilder;
- return pb != null ? (ParameterAttributes)pb.Attributes : ParameterAttributes.None;
- }
- }
-
- public override int Position
- {
- get { return parameter; }
- }
-
- public override object RawDefaultValue
- {
- get
- {
- ParameterBuilder pb = this.ParameterBuilder;
- if (pb != null && (pb.Attributes & (int)ParameterAttributes.HasDefault) != 0)
- {
- return method.ModuleBuilder.Constant.GetRawConstantValue(method.ModuleBuilder, pb.PseudoToken);
- }
- if (pb != null && (pb.Attributes & (int)ParameterAttributes.Optional) != 0)
- {
- return Missing.Value;
- }
- return null;
- }
- }
-
- public override CustomModifiers __GetCustomModifiers()
- {
- return method.customModifiers.GetParameterCustomModifiers(parameter);
- }
-
- public override bool __TryGetFieldMarshal(out FieldMarshal fieldMarshal)
- {
- fieldMarshal = new FieldMarshal();
- return false;
- }
-
- public override MemberInfo Member
- {
- get { return method; }
- }
-
- public override int MetadataToken
- {
- get
- {
- ParameterBuilder pb = this.ParameterBuilder;
- return pb != null ? pb.PseudoToken : 0x08000000;
- }
- }
-
- internal override Module Module
- {
- get { return method.Module; }
- }
- }
-
- public override ParameterInfo[] GetParameters()
- {
- ParameterInfo[] parameters = new ParameterInfo[parameterTypes.Length];
- for (int i = 0; i < parameters.Length; i++)
- {
- parameters[i] = new ParameterInfoImpl(this, i);
- }
- return parameters;
- }
-
- internal override int ParameterCount
- {
- get { return parameterTypes.Length; }
- }
-
- public override Type DeclaringType
- {
- get { return typeBuilder.IsModulePseudoType ? null : typeBuilder; }
- }
-
- public override string Name
- {
- get { return name; }
- }
-
- public override CallingConventions CallingConvention
- {
- get { return callingConvention; }
- }
-
- public override int MetadataToken
- {
- get { return pseudoToken; }
- }
-
- public override bool IsGenericMethod
- {
- get { return gtpb != null; }
- }
-
- public override bool IsGenericMethodDefinition
- {
- get { return gtpb != null; }
- }
-
- public override Module Module
- {
- get { return typeBuilder.Module; }
- }
-
- public Module GetModule()
- {
- return typeBuilder.Module;
- }
-
- public MethodToken GetToken()
- {
- return new MethodToken(pseudoToken);
- }
-
- public override MethodBody GetMethodBody()
- {
- throw new NotSupportedException();
- }
-
- public override int __MethodRVA
- {
- get { throw new NotImplementedException(); }
- }
-
- public bool InitLocals
- {
- get { return initLocals; }
- set { initLocals = value; }
- }
-
- public void __AddUnmanagedExport(string name, int ordinal)
- {
- this.ModuleBuilder.AddUnmanagedExport(name, ordinal, this, new RelativeVirtualAddress(0xFFFFFFFF));
- }
-
- internal void Bake()
- {
- this.nameIndex = this.ModuleBuilder.Strings.Add(name);
- this.signature = this.ModuleBuilder.GetSignatureBlobIndex(this.MethodSignature);
-
- __ReleaseILGenerator();
-
- if (declarativeSecurity != null)
- {
- this.ModuleBuilder.AddDeclarativeSecurity(pseudoToken, declarativeSecurity);
- }
- }
-
- internal ModuleBuilder ModuleBuilder
- {
- get { return typeBuilder.ModuleBuilder; }
- }
-
- internal void WriteMethodDefRecord(int baseRVA, MetadataWriter mw, ref int paramList)
- {
- if (rva != -1)
- {
- mw.Write(rva + baseRVA);
- }
- else
- {
- mw.Write(0);
- }
- mw.Write((short)implFlags);
- mw.Write((short)attributes);
- mw.WriteStringIndex(nameIndex);
- mw.WriteBlobIndex(signature);
- mw.WriteParam(paramList);
- if (parameters != null)
- {
- paramList += parameters.Count;
- }
- }
-
- internal void WriteParamRecords(MetadataWriter mw)
- {
- if (parameters != null)
- {
- foreach (ParameterBuilder pb in parameters)
- {
- pb.WriteParamRecord(mw);
- }
- }
- }
-
- internal void FixupToken(int token, ref int parameterToken)
- {
- typeBuilder.ModuleBuilder.RegisterTokenFixup(this.pseudoToken, token);
- if (parameters != null)
- {
- foreach (ParameterBuilder pb in parameters)
- {
- pb.FixupToken(parameterToken++);
- }
- }
- }
-
- internal override MethodSignature MethodSignature
- {
- get
- {
- if (methodSignature == null)
- {
- methodSignature = MethodSignature.MakeFromBuilder(returnType, parameterTypes, customModifiers, callingConvention, gtpb == null ? 0 : gtpb.Length);
- }
- return methodSignature;
- }
- }
-
- internal override int ImportTo(ModuleBuilder other)
- {
- return other.ImportMethodOrField(typeBuilder, name, this.MethodSignature);
- }
-
- internal void CheckBaked()
- {
- typeBuilder.CheckBaked();
- }
-
- internal override int GetCurrentToken()
- {
- if (typeBuilder.ModuleBuilder.IsSaved)
- {
- return typeBuilder.ModuleBuilder.ResolvePseudoToken(pseudoToken);
- }
- else
- {
- return pseudoToken;
- }
- }
-
- internal override bool IsBaked
- {
- get { return typeBuilder.IsBaked; }
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2008-2012 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Diagnostics;
-using System.Diagnostics.SymbolStore;
-using System.Security.Cryptography;
-using System.Resources;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using IKVM.Reflection.Impl;
-using IKVM.Reflection.Metadata;
-using IKVM.Reflection.Writer;
-
-namespace IKVM.Reflection.Emit
-{
- public sealed class ModuleBuilder : Module, ITypeOwner
- {
- private static readonly bool usePublicKeyAssemblyReference = false;
- private Guid mvid = Guid.NewGuid();
- private long imageBaseAddress = 0x00400000;
- private long stackReserve = -1;
- private int fileAlignment = 0x200;
- private DllCharacteristics dllCharacteristics = DllCharacteristics.DynamicBase | DllCharacteristics.NoSEH | DllCharacteristics.NXCompat | DllCharacteristics.TerminalServerAware;
- private readonly AssemblyBuilder asm;
- internal readonly string moduleName;
- internal readonly string fileName;
- internal readonly ISymbolWriterImpl symbolWriter;
- private readonly TypeBuilder moduleType;
- private readonly List<TypeBuilder> types = new List<TypeBuilder>();
- private readonly Dictionary<Type, int> typeTokens = new Dictionary<Type, int>();
- private readonly Dictionary<Type, int> memberRefTypeTokens = new Dictionary<Type, int>();
- internal readonly ByteBuffer methodBodies = new ByteBuffer(128 * 1024);
- internal readonly List<int> tokenFixupOffsets = new List<int>();
- internal readonly ByteBuffer initializedData = new ByteBuffer(512);
- internal readonly ByteBuffer manifestResources = new ByteBuffer(512);
- internal ResourceSection unmanagedResources;
- private readonly Dictionary<MemberRefKey, int> importedMemberRefs = new Dictionary<MemberRefKey, int>();
- private readonly Dictionary<MethodSpecKey, int> importedMethodSpecs = new Dictionary<MethodSpecKey, int>();
- private readonly Dictionary<Assembly, int> referencedAssemblies = new Dictionary<Assembly, int>();
- private List<AssemblyName> referencedAssemblyNames;
- private int nextPseudoToken = -1;
- private readonly List<int> resolvedTokens = new List<int>();
- internal readonly TableHeap Tables = new TableHeap();
- internal readonly StringHeap Strings = new StringHeap();
- internal readonly UserStringHeap UserStrings = new UserStringHeap();
- internal readonly GuidHeap Guids = new GuidHeap();
- internal readonly BlobHeap Blobs = new BlobHeap();
- internal readonly List<VTableFixups> vtablefixups = new List<VTableFixups>();
- internal readonly List<UnmanagedExport> unmanagedExports = new List<UnmanagedExport>();
- private List<InterfaceImplCustomAttribute> interfaceImplCustomAttributes;
- private List<ResourceWriterRecord> resourceWriters;
- private bool saved;
-
- private struct ResourceWriterRecord
- {
- private readonly string name;
- private readonly ResourceWriter rw;
- private readonly MemoryStream mem;
- private readonly ResourceAttributes attributes;
-
- internal ResourceWriterRecord(string name, ResourceWriter rw, MemoryStream mem, ResourceAttributes attributes)
- {
- this.name = name;
- this.rw = rw;
- this.mem = mem;
- this.attributes = attributes;
- }
-
- internal void Emit(ModuleBuilder mb)
- {
- rw.Generate();
- mem.Position = 0;
- mb.DefineManifestResource(name, mem, attributes);
- rw.Close();
- }
- }
-
- internal struct VTableFixups
- {
- internal uint initializedDataOffset;
- internal ushort count;
- internal ushort type;
-
- internal int SlotWidth
- {
- get { return (type & 0x02) == 0 ? 4 : 8; }
- }
- }
-
- struct InterfaceImplCustomAttribute
- {
- internal int type;
- internal int interfaceType;
- internal int pseudoToken;
- }
-
- struct MemberRefKey : IEquatable<MemberRefKey>
- {
- private readonly Type type;
- private readonly string name;
- private readonly Signature signature;
-
- internal MemberRefKey(Type type, string name, Signature signature)
- {
- this.type = type;
- this.name = name;
- this.signature = signature;
- }
-
- public bool Equals(MemberRefKey other)
- {
- return other.type.Equals(type)
- && other.name == name
- && other.signature.Equals(signature);
- }
-
- public override bool Equals(object obj)
- {
- MemberRefKey? other = obj as MemberRefKey?;
- return other != null && Equals(other);
- }
-
- public override int GetHashCode()
- {
- return type.GetHashCode() + name.GetHashCode() + signature.GetHashCode();
- }
-
- internal MethodBase LookupMethod()
- {
- return type.FindMethod(name, (MethodSignature)signature);
- }
- }
-
- struct MethodSpecKey : IEquatable<MethodSpecKey>
- {
- private readonly Type type;
- private readonly string name;
- private readonly MethodSignature signature;
- private readonly Type[] genericParameters;
-
- internal MethodSpecKey(Type type, string name, MethodSignature signature, Type[] genericParameters)
- {
- this.type = type;
- this.name = name;
- this.signature = signature;
- this.genericParameters = genericParameters;
- }
-
- public bool Equals(MethodSpecKey other)
- {
- return other.type.Equals(type)
- && other.name == name
- && other.signature.Equals(signature)
- && Util.ArrayEquals(other.genericParameters, genericParameters);
- }
-
- public override bool Equals(object obj)
- {
- MethodSpecKey? other = obj as MethodSpecKey?;
- return other != null && Equals(other);
- }
-
- public override int GetHashCode()
- {
- return type.GetHashCode() + name.GetHashCode() + signature.GetHashCode() + Util.GetHashCode(genericParameters);
- }
- }
-
- internal ModuleBuilder(AssemblyBuilder asm, string moduleName, string fileName, bool emitSymbolInfo)
- : base(asm.universe)
- {
- this.asm = asm;
- this.moduleName = moduleName;
- this.fileName = fileName;
- if (emitSymbolInfo)
- {
- symbolWriter = SymbolSupport.CreateSymbolWriterFor(this);
- }
- // <Module> must be the first record in the TypeDef table
- moduleType = new TypeBuilder(this, null, "<Module>");
- types.Add(moduleType);
- }
-
- internal void PopulatePropertyAndEventTables()
- {
- // LAMESPEC the PropertyMap and EventMap tables are not required to be sorted by the CLI spec,
- // but .NET sorts them and Mono requires them to be sorted, so we have to populate the
- // tables in the right order
- foreach (TypeBuilder type in types)
- {
- type.PopulatePropertyAndEventTables();
- }
- }
-
- internal void WriteTypeDefTable(MetadataWriter mw)
- {
- int fieldList = 1;
- int methodList = 1;
- foreach (TypeBuilder type in types)
- {
- type.WriteTypeDefRecord(mw, ref fieldList, ref methodList);
- }
- }
-
- internal void WriteMethodDefTable(int baseRVA, MetadataWriter mw)
- {
- int paramList = 1;
- foreach (TypeBuilder type in types)
- {
- type.WriteMethodDefRecords(baseRVA, mw, ref paramList);
- }
- }
-
- internal void WriteParamTable(MetadataWriter mw)
- {
- foreach (TypeBuilder type in types)
- {
- type.WriteParamRecords(mw);
- }
- }
-
- internal void WriteFieldTable(MetadataWriter mw)
- {
- foreach (TypeBuilder type in types)
- {
- type.WriteFieldRecords(mw);
- }
- }
-
- internal int AllocPseudoToken()
- {
- return nextPseudoToken--;
- }
-
- public TypeBuilder DefineType(string name)
- {
- return DefineType(name, TypeAttributes.Class);
- }
-
- public TypeBuilder DefineType(string name, TypeAttributes attr)
- {
- return DefineType(name, attr, null);
- }
-
- public TypeBuilder DefineType(string name, TypeAttributes attr, Type parent)
- {
- return DefineType(name, attr, parent, PackingSize.Unspecified, 0);
- }
-
- public TypeBuilder DefineType(string name, TypeAttributes attr, Type parent, int typesize)
- {
- return DefineType(name, attr, parent, PackingSize.Unspecified, typesize);
- }
-
- public TypeBuilder DefineType(string name, TypeAttributes attr, Type parent, PackingSize packsize)
- {
- return DefineType(name, attr, parent, packsize, 0);
- }
-
- public TypeBuilder DefineType(string name, TypeAttributes attr, Type parent, Type[] interfaces)
- {
- TypeBuilder tb = DefineType(name, attr, parent);
- foreach (Type iface in interfaces)
- {
- tb.AddInterfaceImplementation(iface);
- }
- return tb;
- }
-
- public TypeBuilder DefineType(string name, TypeAttributes attr, Type parent, PackingSize packingSize, int typesize)
- {
- string ns = null;
- int lastdot = name.LastIndexOf('.');
- if (lastdot > 0)
- {
- ns = name.Substring(0, lastdot);
- name = name.Substring(lastdot + 1);
- }
- TypeBuilder typeBuilder = __DefineType(ns, name);
- typeBuilder.__SetAttributes(attr);
- typeBuilder.SetParent(parent);
- if (packingSize != PackingSize.Unspecified || typesize != 0)
- {
- typeBuilder.__SetLayout((int)packingSize, typesize);
- }
- return typeBuilder;
- }
-
- public TypeBuilder __DefineType(string ns, string name)
- {
- return DefineType(this, ns, name);
- }
-
- internal TypeBuilder DefineType(ITypeOwner owner, string ns, string name)
- {
- TypeBuilder typeBuilder = new TypeBuilder(owner, ns, name);
- types.Add(typeBuilder);
- return typeBuilder;
- }
-
- public EnumBuilder DefineEnum(string name, TypeAttributes visibility, Type underlyingType)
- {
- TypeBuilder tb = DefineType(name, (visibility & TypeAttributes.VisibilityMask) | TypeAttributes.Sealed, universe.System_Enum);
- FieldBuilder fb = tb.DefineField("value__", underlyingType, FieldAttributes.Public | FieldAttributes.SpecialName | FieldAttributes.RTSpecialName);
- return new EnumBuilder(tb, fb);
- }
-
- public FieldBuilder __DefineField(string name, Type type, CustomModifiers customModifiers, FieldAttributes attributes)
- {
- return moduleType.__DefineField(name, type, customModifiers, attributes);
- }
-
- [Obsolete("Please use __DefineField(string, Type, CustomModifiers, FieldAttributes) instead.")]
- public FieldBuilder __DefineField(string name, Type type, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers, FieldAttributes attributes)
- {
- return moduleType.DefineField(name, type, requiredCustomModifiers, optionalCustomModifiers, attributes);
- }
-
- public ConstructorBuilder __DefineModuleInitializer(MethodAttributes visibility)
- {
- return moduleType.DefineConstructor(visibility | MethodAttributes.Static | MethodAttributes.SpecialName | MethodAttributes.RTSpecialName, CallingConventions.Standard, Type.EmptyTypes);
- }
-
- public FieldBuilder DefineUninitializedData(string name, int size, FieldAttributes attributes)
- {
- return moduleType.DefineUninitializedData(name, size, attributes);
- }
-
- public FieldBuilder DefineInitializedData(string name, byte[] data, FieldAttributes attributes)
- {
- return moduleType.DefineInitializedData(name, data, attributes);
- }
-
- public MethodBuilder DefineGlobalMethod(string name, MethodAttributes attributes, Type returnType, Type[] parameterTypes)
- {
- return moduleType.DefineMethod(name, attributes, returnType, parameterTypes);
- }
-
- public MethodBuilder DefineGlobalMethod(string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes)
- {
- return moduleType.DefineMethod(name, attributes, callingConvention, returnType, parameterTypes);
- }
-
- public MethodBuilder DefineGlobalMethod(string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] requiredReturnTypeCustomModifiers, Type[] optionalReturnTypeCustomModifiers, Type[] parameterTypes, Type[][] requiredParameterTypeCustomModifiers, Type[][] optionalParameterTypeCustomModifiers)
- {
- return moduleType.DefineMethod(name, attributes, callingConvention, returnType, requiredReturnTypeCustomModifiers, optionalReturnTypeCustomModifiers, parameterTypes, requiredParameterTypeCustomModifiers, optionalParameterTypeCustomModifiers);
- }
-
- public MethodBuilder DefinePInvokeMethod(string name, string dllName, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, CallingConvention nativeCallConv, CharSet nativeCharSet)
- {
- return moduleType.DefinePInvokeMethod(name, dllName, attributes, callingConvention, returnType, parameterTypes, nativeCallConv, nativeCharSet);
- }
-
- public MethodBuilder DefinePInvokeMethod(string name, string dllName, string entryName, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, CallingConvention nativeCallConv, CharSet nativeCharSet)
- {
- return moduleType.DefinePInvokeMethod(name, dllName, entryName, attributes, callingConvention, returnType, parameterTypes, nativeCallConv, nativeCharSet);
- }
-
- public void CreateGlobalFunctions()
- {
- moduleType.CreateType();
- }
-
- internal void AddTypeForwarder(Type type)
- {
- ExportType(type);
- if (!type.__IsMissing)
- {
- foreach (Type nested in type.GetNestedTypes(BindingFlags.Public | BindingFlags.NonPublic))
- {
- // we export all nested types (i.e. even the private ones)
- // (this behavior is the same as the C# compiler)
- AddTypeForwarder(nested);
- }
- }
- }
-
- private int ExportType(Type type)
- {
- ExportedTypeTable.Record rec = new ExportedTypeTable.Record();
- rec.TypeDefId = type.MetadataToken;
- rec.TypeName = this.Strings.Add(type.__Name);
- string ns = type.__Namespace;
- rec.TypeNamespace = ns == null ? 0 : this.Strings.Add(ns);
- if (type.IsNested)
- {
- rec.Flags = 0;
- rec.Implementation = ExportType(type.DeclaringType);
- }
- else
- {
- rec.Flags = 0x00200000; // CorTypeAttr.tdForwarder
- rec.Implementation = ImportAssemblyRef(type.Assembly);
- }
- return 0x27000000 | this.ExportedType.FindOrAddRecord(rec);
- }
-
- public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
- {
- SetCustomAttribute(new CustomAttributeBuilder(con, binaryAttribute));
- }
-
- public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
- {
- SetCustomAttribute(0x00000001, customBuilder);
- }
-
- internal void SetCustomAttribute(int token, CustomAttributeBuilder customBuilder)
- {
- Debug.Assert(!customBuilder.IsPseudoCustomAttribute);
- CustomAttributeTable.Record rec = new CustomAttributeTable.Record();
- rec.Parent = token;
- rec.Type = asm.IsWindowsRuntime ? customBuilder.Constructor.ImportTo(this) : GetConstructorToken(customBuilder.Constructor).Token;
- rec.Value = customBuilder.WriteBlob(this);
- this.CustomAttribute.AddRecord(rec);
- }
-
- internal void AddDeclarativeSecurity(int token, System.Security.Permissions.SecurityAction securityAction, System.Security.PermissionSet permissionSet)
- {
- DeclSecurityTable.Record rec = new DeclSecurityTable.Record();
- rec.Action = (short)securityAction;
- rec.Parent = token;
- // like Ref.Emit, we're using the .NET 1.x xml format
- rec.PermissionSet = this.Blobs.Add(ByteBuffer.Wrap(System.Text.Encoding.Unicode.GetBytes(permissionSet.ToXml().ToString())));
- this.DeclSecurity.AddRecord(rec);
- }
-
- internal void AddDeclarativeSecurity(int token, List<CustomAttributeBuilder> declarativeSecurity)
- {
- Dictionary<int, List<CustomAttributeBuilder>> ordered = new Dictionary<int, List<CustomAttributeBuilder>>();
- foreach (CustomAttributeBuilder cab in declarativeSecurity)
- {
- int action;
- // check for HostProtectionAttribute without SecurityAction
- if (cab.ConstructorArgumentCount == 0)
- {
- action = (int)System.Security.Permissions.SecurityAction.LinkDemand;
- }
- else
- {
- action = (int)cab.GetConstructorArgument(0);
- }
- List<CustomAttributeBuilder> list;
- if (!ordered.TryGetValue(action, out list))
- {
- list = new List<CustomAttributeBuilder>();
- ordered.Add(action, list);
- }
- list.Add(cab);
- }
- foreach (KeyValuePair<int, List<CustomAttributeBuilder>> kv in ordered)
- {
- DeclSecurityTable.Record rec = new DeclSecurityTable.Record();
- rec.Action = (short)kv.Key;
- rec.Parent = token;
- rec.PermissionSet = WriteDeclSecurityBlob(kv.Value);
- this.DeclSecurity.AddRecord(rec);
- }
- }
-
- private int WriteDeclSecurityBlob(List<CustomAttributeBuilder> list)
- {
- string xml;
- if (list.Count == 1 && (xml = list[0].GetLegacyDeclSecurity()) != null)
- {
- // write .NET 1.1 format
- return this.Blobs.Add(ByteBuffer.Wrap(System.Text.Encoding.Unicode.GetBytes(xml)));
- }
- ByteBuffer namedArgs = new ByteBuffer(100);
- ByteBuffer bb = new ByteBuffer(list.Count * 100);
- bb.Write((byte)'.');
- bb.WriteCompressedInt(list.Count);
- foreach (CustomAttributeBuilder cab in list)
- {
- bb.Write(cab.Constructor.DeclaringType.AssemblyQualifiedName);
- namedArgs.Clear();
- cab.WriteNamedArgumentsForDeclSecurity(this, namedArgs);
- bb.WriteCompressedInt(namedArgs.Length);
- bb.Write(namedArgs);
- }
- return this.Blobs.Add(bb);
- }
-
- public void DefineManifestResource(string name, Stream stream, ResourceAttributes attribute)
- {
- manifestResources.Align(8);
- ManifestResourceTable.Record rec = new ManifestResourceTable.Record();
- rec.Offset = manifestResources.Position;
- rec.Flags = (int)attribute;
- rec.Name = this.Strings.Add(name);
- rec.Implementation = 0;
- this.ManifestResource.AddRecord(rec);
- manifestResources.Write(0); // placeholder for the length
- manifestResources.Write(stream);
- int savePosition = manifestResources.Position;
- manifestResources.Position = rec.Offset;
- manifestResources.Write(savePosition - (manifestResources.Position + 4));
- manifestResources.Position = savePosition;
- }
-
- public IResourceWriter DefineResource(string name, string description)
- {
- return DefineResource(name, description, ResourceAttributes.Public);
- }
-
- public IResourceWriter DefineResource(string name, string description, ResourceAttributes attribute)
- {
- // FXBUG we ignore the description, because there is no such thing
-
- if (resourceWriters == null)
- {
- resourceWriters = new List<ResourceWriterRecord>();
- }
- MemoryStream mem = new MemoryStream();
- ResourceWriter rw = new ResourceWriter(mem);
- resourceWriters.Add(new ResourceWriterRecord(name, rw, mem, attribute));
- return rw;
- }
-
- internal void EmitResources()
- {
- if (resourceWriters != null)
- {
- foreach (ResourceWriterRecord rwr in resourceWriters)
- {
- rwr.Emit(this);
- }
- }
- }
-
- public override Assembly Assembly
- {
- get { return asm; }
- }
-
- internal override Type FindType(TypeName name)
- {
- foreach (Type type in types)
- {
- if (type.__Namespace == name.Namespace && type.__Name == name.Name)
- {
- return type;
- }
- }
- return null;
- }
-
- internal override Type FindTypeIgnoreCase(TypeName lowerCaseName)
- {
- foreach (Type type in types)
- {
- if (new TypeName(type.__Namespace, type.__Name).ToLowerInvariant() == lowerCaseName)
- {
- return type;
- }
- }
- return null;
- }
-
- internal override void GetTypesImpl(List<Type> list)
- {
- foreach (Type type in types)
- {
- if (type != moduleType)
- {
- list.Add(type);
- }
- }
- }
-
- public ISymbolDocumentWriter DefineDocument(string url, Guid language, Guid languageVendor, Guid documentType)
- {
- return symbolWriter.DefineDocument(url, language, languageVendor, documentType);
- }
-
- public int __GetAssemblyToken(Assembly assembly)
- {
- return ImportAssemblyRef(assembly);
- }
-
- public TypeToken GetTypeToken(string name)
- {
- return new TypeToken(GetType(name, true, false).MetadataToken);
- }
-
- public TypeToken GetTypeToken(Type type)
- {
- if (type.Module == this && !asm.IsWindowsRuntime)
- {
- return new TypeToken(type.GetModuleBuilderToken());
- }
- else
- {
- return new TypeToken(ImportType(type));
- }
- }
-
- internal int GetTypeTokenForMemberRef(Type type)
- {
- if (type.__IsMissing)
- {
- return ImportType(type);
- }
- else if (type.IsGenericTypeDefinition)
- {
- int token;
- if (!memberRefTypeTokens.TryGetValue(type, out token))
- {
- ByteBuffer spec = new ByteBuffer(5);
- Signature.WriteTypeSpec(this, spec, type);
- token = 0x1B000000 | this.TypeSpec.AddRecord(this.Blobs.Add(spec));
- memberRefTypeTokens.Add(type, token);
- }
- return token;
- }
- else if (type.IsModulePseudoType)
- {
- return 0x1A000000 | this.ModuleRef.FindOrAddRecord(this.Strings.Add(type.Module.ScopeName));
- }
- else
- {
- return GetTypeToken(type).Token;
- }
- }
-
- private static bool IsFromGenericTypeDefinition(MemberInfo member)
- {
- Type decl = member.DeclaringType;
- return decl != null && !decl.__IsMissing && decl.IsGenericTypeDefinition;
- }
-
- public FieldToken GetFieldToken(FieldInfo field)
- {
- // NOTE for some reason, when TypeBuilder.GetFieldToken() is used on a field in a generic type definition,
- // a memberref token is returned (confirmed on .NET) unlike for Get(Method|Constructor)Token which always
- // simply returns the MethodDef token (if the method is from the same module).
- FieldBuilder fb = field as FieldBuilder;
- if (fb != null && fb.Module == this && !IsFromGenericTypeDefinition(fb))
- {
- return new FieldToken(fb.MetadataToken);
- }
- else
- {
- return new FieldToken(field.ImportTo(this));
- }
- }
-
- public MethodToken GetMethodToken(MethodInfo method)
- {
- MethodBuilder mb = method as MethodBuilder;
- if (mb != null && mb.ModuleBuilder == this)
- {
- return new MethodToken(mb.MetadataToken);
- }
- else
- {
- return new MethodToken(method.ImportTo(this));
- }
- }
-
- // new in .NET 4.5
- public MethodToken GetMethodToken(MethodInfo method, IEnumerable<Type> optionalParameterTypes)
- {
- return __GetMethodToken(method, Util.ToArray(optionalParameterTypes), null);
- }
-
- public MethodToken __GetMethodToken(MethodInfo method, Type[] optionalParameterTypes, CustomModifiers[] customModifiers)
- {
- ByteBuffer sig = new ByteBuffer(16);
- method.MethodSignature.WriteMethodRefSig(this, sig, optionalParameterTypes, customModifiers);
- MemberRefTable.Record record = new MemberRefTable.Record();
- if (method.Module == this)
- {
- record.Class = method.MetadataToken;
- }
- else
- {
- record.Class = GetTypeTokenForMemberRef(method.DeclaringType ?? method.Module.GetModuleType());
- }
- record.Name = Strings.Add(method.Name);
- record.Signature = Blobs.Add(sig);
- return new MethodToken(0x0A000000 | MemberRef.FindOrAddRecord(record));
- }
-
- // when we refer to a method on a generic type definition in the IL stream,
- // we need to use a MemberRef (even if the method is in the same module)
- internal MethodToken GetMethodTokenForIL(MethodInfo method)
- {
- if (method.IsGenericMethodDefinition)
- {
- method = method.MakeGenericMethod(method.GetGenericArguments());
- }
- if (IsFromGenericTypeDefinition(method))
- {
- return new MethodToken(method.ImportTo(this));
- }
- else
- {
- return GetMethodToken(method);
- }
- }
-
- internal int GetMethodTokenWinRT(MethodInfo method)
- {
- return asm.IsWindowsRuntime ? method.ImportTo(this) : GetMethodToken(method).Token;
- }
-
- public MethodToken GetConstructorToken(ConstructorInfo constructor)
- {
- return GetMethodToken(constructor.GetMethodInfo());
- }
-
- // new in .NET 4.5
- public MethodToken GetConstructorToken(ConstructorInfo constructor, IEnumerable<Type> optionalParameterTypes)
- {
- return GetMethodToken(constructor.GetMethodInfo(), optionalParameterTypes);
- }
-
- public MethodToken __GetConstructorToken(ConstructorInfo constructor, Type[] optionalParameterTypes, CustomModifiers[] customModifiers)
- {
- return __GetMethodToken(constructor.GetMethodInfo(), optionalParameterTypes, customModifiers);
- }
-
- internal int ImportMethodOrField(Type declaringType, string name, Signature sig)
- {
- int token;
- MemberRefKey key = new MemberRefKey(declaringType, name, sig);
- if (!importedMemberRefs.TryGetValue(key, out token))
- {
- MemberRefTable.Record rec = new MemberRefTable.Record();
- rec.Class = GetTypeTokenForMemberRef(declaringType);
- rec.Name = this.Strings.Add(name);
- ByteBuffer bb = new ByteBuffer(16);
- sig.WriteSig(this, bb);
- rec.Signature = this.Blobs.Add(bb);
- token = 0x0A000000 | this.MemberRef.AddRecord(rec);
- importedMemberRefs.Add(key, token);
- }
- return token;
- }
-
- internal int ImportMethodSpec(Type declaringType, MethodInfo method, Type[] genericParameters)
- {
- Debug.Assert(method.__IsMissing || method.GetMethodOnTypeDefinition() == method);
- int token;
- MethodSpecKey key = new MethodSpecKey(declaringType, method.Name, method.MethodSignature, genericParameters);
- if (!importedMethodSpecs.TryGetValue(key, out token))
- {
- MethodSpecTable.Record rec = new MethodSpecTable.Record();
- MethodBuilder mb = method as MethodBuilder;
- if (mb != null && mb.ModuleBuilder == this && !declaringType.IsGenericType)
- {
- rec.Method = mb.MetadataToken;
- }
- else
- {
- // we're calling ImportMethodOrField directly here, because 'method' may be a MethodDef on a generic TypeDef and 'declaringType' the type instance
- // (in order words the method and type have already been decoupled by the caller)
- rec.Method = ImportMethodOrField(declaringType, method.Name, method.MethodSignature);
- }
- Writer.ByteBuffer spec = new Writer.ByteBuffer(10);
- Signature.WriteMethodSpec(this, spec, genericParameters);
- rec.Instantiation = this.Blobs.Add(spec);
- token = 0x2B000000 | this.MethodSpec.FindOrAddRecord(rec);
- importedMethodSpecs.Add(key, token);
- }
- return token;
- }
-
- internal int ImportType(Type type)
- {
- int token;
- if (!typeTokens.TryGetValue(type, out token))
- {
- if (type.HasElementType || type.IsConstructedGenericType || type.__IsFunctionPointer)
- {
- ByteBuffer spec = new ByteBuffer(5);
- Signature.WriteTypeSpec(this, spec, type);
- token = 0x1B000000 | this.TypeSpec.AddRecord(this.Blobs.Add(spec));
- }
- else
- {
- TypeRefTable.Record rec = new TypeRefTable.Record();
- if (type.IsNested)
- {
- rec.ResolutionScope = GetTypeToken(type.DeclaringType).Token;
- }
- else if (type.Module == this)
- {
- rec.ResolutionScope = 1;
- }
- else
- {
- rec.ResolutionScope = ImportAssemblyRef(type.Assembly);
- }
- rec.TypeName = this.Strings.Add(type.__Name);
- string ns = type.__Namespace;
- rec.TypeNameSpace = ns == null ? 0 : this.Strings.Add(ns);
- token = 0x01000000 | this.TypeRef.AddRecord(rec);
- }
- typeTokens.Add(type, token);
- }
- return token;
- }
-
- private int ImportAssemblyRef(Assembly asm)
- {
- int token;
- if (!referencedAssemblies.TryGetValue(asm, out token))
- {
- // We can't write the AssemblyRef record here yet, because the identity of the assembly can still change
- // (if it's an AssemblyBuilder).
- token = AllocPseudoToken();
- referencedAssemblies.Add(asm, token);
- }
- return token;
- }
-
- internal void FillAssemblyRefTable()
- {
- foreach (KeyValuePair<Assembly, int> kv in referencedAssemblies)
- {
- if (IsPseudoToken(kv.Value))
- {
- RegisterTokenFixup(kv.Value, FindOrAddAssemblyRef(kv.Key.GetName(), false));
- }
- }
- }
-
- private int FindOrAddAssemblyRef(AssemblyName name, bool alwaysAdd)
- {
- AssemblyRefTable.Record rec = new AssemblyRefTable.Record();
- Version ver = name.Version ?? new Version(0, 0, 0, 0);
- rec.MajorVersion = (ushort)ver.Major;
- rec.MinorVersion = (ushort)ver.Minor;
- rec.BuildNumber = (ushort)ver.Build;
- rec.RevisionNumber = (ushort)ver.Revision;
- rec.Flags = (int)(name.Flags & ~AssemblyNameFlags.PublicKey);
- const AssemblyNameFlags afPA_Specified = (AssemblyNameFlags)0x0080;
- const AssemblyNameFlags afPA_Mask = (AssemblyNameFlags)0x0070;
- if ((name.RawFlags & afPA_Specified) != 0)
- {
- rec.Flags |= (int)(name.RawFlags & afPA_Mask);
- }
- if (name.ContentType == AssemblyContentType.WindowsRuntime)
- {
- rec.Flags |= 0x0200;
- }
- byte[] publicKeyOrToken = null;
- if (usePublicKeyAssemblyReference)
- {
- publicKeyOrToken = name.GetPublicKey();
- }
- if (publicKeyOrToken == null || publicKeyOrToken.Length == 0)
- {
- publicKeyOrToken = name.GetPublicKeyToken() ?? Empty<byte>.Array;
- }
- else
- {
- const int PublicKey = 0x0001;
- rec.Flags |= PublicKey;
- }
- rec.PublicKeyOrToken = this.Blobs.Add(ByteBuffer.Wrap(publicKeyOrToken));
- rec.Name = this.Strings.Add(name.Name);
- rec.Culture = name.Culture == null ? 0 : this.Strings.Add(name.Culture);
- if (name.hash != null)
- {
- rec.HashValue = this.Blobs.Add(ByteBuffer.Wrap(name.hash));
- }
- else
- {
- rec.HashValue = 0;
- }
- return 0x23000000 | (alwaysAdd ? this.AssemblyRef.AddRecord(rec) : this.AssemblyRef.FindOrAddRecord(rec));
- }
-
- internal void WriteSymbolTokenMap()
- {
- for (int i = 0; i < resolvedTokens.Count; i++)
- {
- int newToken = resolvedTokens[i];
- // The symbol API doesn't support remapping arbitrary integers, the types have to be the same,
- // so we copy the type from the newToken, because our pseudo tokens don't have a type.
- // (see MethodToken.SymbolToken)
- int oldToken = (i + 1) | (newToken & ~0xFFFFFF);
- SymbolSupport.RemapToken(symbolWriter, oldToken, newToken);
- }
- }
-
- internal void RegisterTokenFixup(int pseudoToken, int realToken)
- {
- int index = -(pseudoToken + 1);
- while (resolvedTokens.Count <= index)
- {
- resolvedTokens.Add(0);
- }
- resolvedTokens[index] = realToken;
- }
-
- internal bool IsPseudoToken(int token)
- {
- return token < 0;
- }
-
- internal int ResolvePseudoToken(int pseudoToken)
- {
- int index = -(pseudoToken + 1);
- return resolvedTokens[index];
- }
-
- internal void ApplyUnmanagedExports(ImageFileMachine imageFileMachine)
- {
- if (unmanagedExports.Count != 0)
- {
- int type;
- int size;
- if (imageFileMachine == ImageFileMachine.I386)
- {
- type = 0x05;
- size = 4;
- }
- else
- {
- type = 0x06;
- size = 8;
- }
- List<MethodBuilder> methods = new List<MethodBuilder>();
- for (int i = 0; i < unmanagedExports.Count; i++)
- {
- if (unmanagedExports[i].mb != null)
- {
- methods.Add(unmanagedExports[i].mb);
- }
- }
- if (methods.Count != 0)
- {
- RelativeVirtualAddress rva = __AddVTableFixups(methods.ToArray(), type);
- for (int i = 0; i < unmanagedExports.Count; i++)
- {
- if (unmanagedExports[i].mb != null)
- {
- UnmanagedExport exp = unmanagedExports[i];
- exp.rva = new RelativeVirtualAddress(rva.initializedDataOffset + (uint)(methods.IndexOf(unmanagedExports[i].mb) * size));
- unmanagedExports[i] = exp;
- }
- }
- }
- }
- }
-
- internal void FixupMethodBodyTokens()
- {
- int methodToken = 0x06000001;
- int fieldToken = 0x04000001;
- int parameterToken = 0x08000001;
- foreach (TypeBuilder type in types)
- {
- type.ResolveMethodAndFieldTokens(ref methodToken, ref fieldToken, ref parameterToken);
- }
- foreach (int offset in tokenFixupOffsets)
- {
- methodBodies.Position = offset;
- int pseudoToken = methodBodies.GetInt32AtCurrentPosition();
- methodBodies.Write(ResolvePseudoToken(pseudoToken));
- }
- foreach (VTableFixups fixup in vtablefixups)
- {
- for (int i = 0; i < fixup.count; i++)
- {
- initializedData.Position = (int)fixup.initializedDataOffset + i * fixup.SlotWidth;
- initializedData.Write(ResolvePseudoToken(initializedData.GetInt32AtCurrentPosition()));
- }
- }
- }
-
- private int GetHeaderLength()
- {
- return
- 4 + // Signature
- 2 + // MajorVersion
- 2 + // MinorVersion
- 4 + // Reserved
- 4 + // ImageRuntimeVersion Length
- StringToPaddedUTF8Length(asm.ImageRuntimeVersion) +
- 2 + // Flags
- 2 + // Streams
- 4 + // #~ Offset
- 4 + // #~ Size
- 4 + // StringToPaddedUTF8Length("#~")
- 4 + // #Strings Offset
- 4 + // #Strings Size
- 12 + // StringToPaddedUTF8Length("#Strings")
- 4 + // #US Offset
- 4 + // #US Size
- 4 + // StringToPaddedUTF8Length("#US")
- 4 + // #GUID Offset
- 4 + // #GUID Size
- 8 + // StringToPaddedUTF8Length("#GUID")
- (Blobs.IsEmpty ? 0 :
- (
- 4 + // #Blob Offset
- 4 + // #Blob Size
- 8 // StringToPaddedUTF8Length("#Blob")
- ));
- }
-
- internal int MetadataLength
- {
- get
- {
- return GetHeaderLength() + (Blobs.IsEmpty ? 0 : Blobs.Length) + Tables.Length + Strings.Length + UserStrings.Length + Guids.Length;
- }
- }
-
- internal void WriteMetadata(MetadataWriter mw)
- {
- mw.Write(0x424A5342); // Signature ("BSJB")
- mw.Write((ushort)1); // MajorVersion
- mw.Write((ushort)1); // MinorVersion
- mw.Write(0); // Reserved
- byte[] version = StringToPaddedUTF8(asm.ImageRuntimeVersion);
- mw.Write(version.Length); // Length
- mw.Write(version);
- mw.Write((ushort)0); // Flags
- // #Blob is the only optional heap
- if (Blobs.IsEmpty)
- {
- mw.Write((ushort)4); // Streams
- }
- else
- {
- mw.Write((ushort)5); // Streams
- }
-
- int offset = GetHeaderLength();
-
- // Streams
- mw.Write(offset); // Offset
- mw.Write(Tables.Length); // Size
- mw.Write(StringToPaddedUTF8("#~"));
- offset += Tables.Length;
-
- mw.Write(offset); // Offset
- mw.Write(Strings.Length); // Size
- mw.Write(StringToPaddedUTF8("#Strings"));
- offset += Strings.Length;
-
- mw.Write(offset); // Offset
- mw.Write(UserStrings.Length); // Size
- mw.Write(StringToPaddedUTF8("#US"));
- offset += UserStrings.Length;
-
- mw.Write(offset); // Offset
- mw.Write(Guids.Length); // Size
- mw.Write(StringToPaddedUTF8("#GUID"));
- offset += Guids.Length;
-
- if (!Blobs.IsEmpty)
- {
- mw.Write(offset); // Offset
- mw.Write(Blobs.Length); // Size
- mw.Write(StringToPaddedUTF8("#Blob"));
- }
-
- Tables.Write(mw);
- Strings.Write(mw);
- UserStrings.Write(mw);
- Guids.Write(mw);
- if (!Blobs.IsEmpty)
- {
- Blobs.Write(mw);
- }
- }
-
- private static int StringToPaddedUTF8Length(string str)
- {
- return (System.Text.Encoding.UTF8.GetByteCount(str) + 4) & ~3;
- }
-
- private static byte[] StringToPaddedUTF8(string str)
- {
- byte[] buf = new byte[(System.Text.Encoding.UTF8.GetByteCount(str) + 4) & ~3];
- System.Text.Encoding.UTF8.GetBytes(str, 0, str.Length, buf, 0);
- return buf;
- }
-
- internal override void ExportTypes(int fileToken, ModuleBuilder manifestModule)
- {
- manifestModule.ExportTypes(types.ToArray(), fileToken);
- }
-
- internal void ExportTypes(Type[] types, int fileToken)
- {
- Dictionary<Type, int> declaringTypes = new Dictionary<Type, int>();
- foreach (Type type in types)
- {
- if (!type.IsModulePseudoType && IsVisible(type))
- {
- ExportedTypeTable.Record rec = new ExportedTypeTable.Record();
- rec.Flags = (int)type.Attributes;
- // LAMESPEC ECMA says that TypeDefId is a row index, but it should be a token
- rec.TypeDefId = type.MetadataToken;
- rec.TypeName = this.Strings.Add(type.__Name);
- string ns = type.__Namespace;
- rec.TypeNamespace = ns == null ? 0 : this.Strings.Add(ns);
- if (type.IsNested)
- {
- rec.Implementation = declaringTypes[type.DeclaringType];
- }
- else
- {
- rec.Implementation = fileToken;
- }
- int exportTypeToken = 0x27000000 | this.ExportedType.AddRecord(rec);
- declaringTypes.Add(type, exportTypeToken);
- }
- }
- }
-
- private static bool IsVisible(Type type)
- {
- // NOTE this is not the same as Type.IsVisible, because that doesn't take into account family access
- return type.IsPublic || ((type.IsNestedFamily || type.IsNestedFamORAssem || type.IsNestedPublic) && IsVisible(type.DeclaringType));
- }
-
- internal void AddConstant(int parentToken, object defaultValue)
- {
- ConstantTable.Record rec = new ConstantTable.Record();
- rec.Parent = parentToken;
- ByteBuffer val = new ByteBuffer(16);
- if (defaultValue == null)
- {
- rec.Type = Signature.ELEMENT_TYPE_CLASS;
- val.Write((int)0);
- }
- else if (defaultValue is bool)
- {
- rec.Type = Signature.ELEMENT_TYPE_BOOLEAN;
- val.Write((bool)defaultValue ? (byte)1 : (byte)0);
- }
- else if (defaultValue is char)
- {
- rec.Type = Signature.ELEMENT_TYPE_CHAR;
- val.Write((char)defaultValue);
- }
- else if (defaultValue is sbyte)
- {
- rec.Type = Signature.ELEMENT_TYPE_I1;
- val.Write((sbyte)defaultValue);
- }
- else if (defaultValue is byte)
- {
- rec.Type = Signature.ELEMENT_TYPE_U1;
- val.Write((byte)defaultValue);
- }
- else if (defaultValue is short)
- {
- rec.Type = Signature.ELEMENT_TYPE_I2;
- val.Write((short)defaultValue);
- }
- else if (defaultValue is ushort)
- {
- rec.Type = Signature.ELEMENT_TYPE_U2;
- val.Write((ushort)defaultValue);
- }
- else if (defaultValue is int)
- {
- rec.Type = Signature.ELEMENT_TYPE_I4;
- val.Write((int)defaultValue);
- }
- else if (defaultValue is uint)
- {
- rec.Type = Signature.ELEMENT_TYPE_U4;
- val.Write((uint)defaultValue);
- }
- else if (defaultValue is long)
- {
- rec.Type = Signature.ELEMENT_TYPE_I8;
- val.Write((long)defaultValue);
- }
- else if (defaultValue is ulong)
- {
- rec.Type = Signature.ELEMENT_TYPE_U8;
- val.Write((ulong)defaultValue);
- }
- else if (defaultValue is float)
- {
- rec.Type = Signature.ELEMENT_TYPE_R4;
- val.Write((float)defaultValue);
- }
- else if (defaultValue is double)
- {
- rec.Type = Signature.ELEMENT_TYPE_R8;
- val.Write((double)defaultValue);
- }
- else if (defaultValue is string)
- {
- rec.Type = Signature.ELEMENT_TYPE_STRING;
- foreach (char c in (string)defaultValue)
- {
- val.Write(c);
- }
- }
- else if (defaultValue is DateTime)
- {
- rec.Type = Signature.ELEMENT_TYPE_I8;
- val.Write(((DateTime)defaultValue).Ticks);
- }
- else
- {
- throw new ArgumentException();
- }
- rec.Value = this.Blobs.Add(val);
- this.Constant.AddRecord(rec);
- }
-
- ModuleBuilder ITypeOwner.ModuleBuilder
- {
- get { return this; }
- }
-
- internal override Type ResolveType(int metadataToken, IGenericContext context)
- {
- if (metadataToken >> 24 != TypeDefTable.Index)
- {
- throw new NotImplementedException();
- }
- return types[(metadataToken & 0xFFFFFF) - 1];
- }
-
- public override MethodBase ResolveMethod(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
- {
- if (genericTypeArguments != null || genericMethodArguments != null)
- {
- throw new NotImplementedException();
- }
- // this method is inefficient, but since it isn't used we don't care
- if ((metadataToken >> 24) == MemberRefTable.Index)
- {
- foreach (KeyValuePair<MemberRefKey, int> kv in importedMemberRefs)
- {
- if (kv.Value == metadataToken)
- {
- return kv.Key.LookupMethod();
- }
- }
- }
- // HACK if we're given a SymbolToken, we need to convert back
- if ((metadataToken & 0xFF000000) == 0x06000000)
- {
- metadataToken = -(metadataToken & 0x00FFFFFF);
- }
- foreach (Type type in types)
- {
- MethodBase method = ((TypeBuilder)type).LookupMethod(metadataToken);
- if (method != null)
- {
- return method;
- }
- }
- return ((TypeBuilder)moduleType).LookupMethod(metadataToken);
- }
-
- public override FieldInfo ResolveField(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
- {
- throw new NotImplementedException();
- }
-
- public override MemberInfo ResolveMember(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
- {
- throw new NotImplementedException();
- }
-
- public override string ResolveString(int metadataToken)
- {
- throw new NotImplementedException();
- }
-
- public override string FullyQualifiedName
- {
- get { return Path.GetFullPath(Path.Combine(asm.dir, fileName)); }
- }
-
- public override string Name
- {
- get { return fileName; }
- }
-
- public override Guid ModuleVersionId
- {
- get { return mvid; }
- }
-
- public void __SetModuleVersionId(Guid guid)
- {
- mvid = guid;
- }
-
- public override Type[] __ResolveOptionalParameterTypes(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments, out CustomModifiers[] customModifiers)
- {
- throw new NotImplementedException();
- }
-
- public override string ScopeName
- {
- get { return moduleName; }
- }
-
- public ISymbolWriter GetSymWriter()
- {
- return symbolWriter;
- }
-
- public void DefineUnmanagedResource(string resourceFileName)
- {
- // This method reads the specified resource file (Win32 .res file) and converts it into the appropriate format and embeds it in the .rsrc section,
- // also setting the Resource Directory entry.
- unmanagedResources = new ResourceSection();
- unmanagedResources.ExtractResources(System.IO.File.ReadAllBytes(resourceFileName));
- }
-
- public bool IsTransient()
- {
- return false;
- }
-
- public void SetUserEntryPoint(MethodInfo entryPoint)
- {
- int token = entryPoint.MetadataToken;
- if (token < 0)
- {
- token = -token | 0x06000000;
- }
- if (symbolWriter != null)
- {
- symbolWriter.SetUserEntryPoint(new SymbolToken(token));
- }
- }
-
- public StringToken GetStringConstant(string str)
- {
- return new StringToken(this.UserStrings.Add(str) | (0x70 << 24));
- }
-
- public SignatureToken GetSignatureToken(SignatureHelper sigHelper)
- {
- return new SignatureToken(this.StandAloneSig.FindOrAddRecord(this.Blobs.Add(sigHelper.GetSignature(this))) | (StandAloneSigTable.Index << 24));
- }
-
- public SignatureToken GetSignatureToken(byte[] sigBytes, int sigLength)
- {
- return new SignatureToken(this.StandAloneSig.FindOrAddRecord(this.Blobs.Add(ByteBuffer.Wrap(sigBytes, sigLength))) | (StandAloneSigTable.Index << 24));
- }
-
- public MethodInfo GetArrayMethod(Type arrayClass, string methodName, CallingConventions callingConvention, Type returnType, Type[] parameterTypes)
- {
- return new ArrayMethod(this, arrayClass, methodName, callingConvention, returnType, parameterTypes);
- }
-
- public MethodToken GetArrayMethodToken(Type arrayClass, string methodName, CallingConventions callingConvention, Type returnType, Type[] parameterTypes)
- {
- return GetMethodToken(GetArrayMethod(arrayClass, methodName, callingConvention, returnType, parameterTypes));
- }
-
- internal override Type GetModuleType()
- {
- return moduleType;
- }
-
- internal override IKVM.Reflection.Reader.ByteReader GetBlob(int blobIndex)
- {
- return Blobs.GetBlob(blobIndex);
- }
-
- internal int GetSignatureBlobIndex(Signature sig)
- {
- ByteBuffer bb = new ByteBuffer(16);
- sig.WriteSig(this, bb);
- return this.Blobs.Add(bb);
- }
-
- // non-standard API
- public new long __ImageBase
- {
- get { return imageBaseAddress; }
- set { imageBaseAddress = value; }
- }
-
- protected override long GetImageBaseImpl()
- {
- return imageBaseAddress;
- }
-
- public new long __StackReserve
- {
- get { return stackReserve; }
- set { stackReserve = value; }
- }
-
- protected override long GetStackReserveImpl()
- {
- return stackReserve;
- }
-
- [Obsolete("Use __StackReserve property.")]
- public void __SetStackReserve(long stackReserve)
- {
- __StackReserve = stackReserve;
- }
-
- internal ulong GetStackReserve(ulong defaultValue)
- {
- return stackReserve == -1 ? defaultValue : (ulong)stackReserve;
- }
-
- public new int __FileAlignment
- {
- get { return fileAlignment; }
- set { fileAlignment = value; }
- }
-
- protected override int GetFileAlignmentImpl()
- {
- return fileAlignment;
- }
-
- public new DllCharacteristics __DllCharacteristics
- {
- get { return dllCharacteristics; }
- set { dllCharacteristics = value; }
- }
-
- protected override DllCharacteristics GetDllCharacteristicsImpl()
- {
- return dllCharacteristics;
- }
-
- public override int MDStreamVersion
- {
- get { return asm.mdStreamVersion; }
- }
-
- private int AddTypeRefByName(int resolutionScope, string ns, string name)
- {
- TypeRefTable.Record rec = new TypeRefTable.Record();
- rec.ResolutionScope = resolutionScope;
- rec.TypeName = this.Strings.Add(name);
- rec.TypeNameSpace = ns == null ? 0 : this.Strings.Add(ns);
- return 0x01000000 | this.TypeRef.AddRecord(rec);
- }
-
- public void __Save(PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine)
- {
- SaveImpl(null, portableExecutableKind, imageFileMachine);
- }
-
- public void __Save(Stream stream, PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine)
- {
- if (!stream.CanRead || !stream.CanWrite || !stream.CanSeek || stream.Position != 0)
- {
- throw new ArgumentException("Stream must support read/write/seek and current position must be zero.", "stream");
- }
- SaveImpl(stream, portableExecutableKind, imageFileMachine);
- }
-
- private void SaveImpl(Stream streamOrNull, PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine)
- {
- SetIsSaved();
- PopulatePropertyAndEventTables();
- IList<CustomAttributeData> attributes = asm.GetCustomAttributesData(null);
- if (attributes.Count > 0)
- {
- int mscorlib = ImportAssemblyRef(universe.Mscorlib);
- int[] placeholderTokens = new int[4];
- string[] placeholderTypeNames = new string[] { "AssemblyAttributesGoHere", "AssemblyAttributesGoHereM", "AssemblyAttributesGoHereS", "AssemblyAttributesGoHereSM" };
- foreach (CustomAttributeData cad in attributes)
- {
- int index;
- if (cad.Constructor.DeclaringType.BaseType == universe.System_Security_Permissions_CodeAccessSecurityAttribute)
- {
- if (cad.Constructor.DeclaringType.IsAllowMultipleCustomAttribute)
- {
- index = 3;
- }
- else
- {
- index = 2;
- }
- }
- else if (cad.Constructor.DeclaringType.IsAllowMultipleCustomAttribute)
- {
- index = 1;
- }
- else
- {
- index = 0;
- }
- if (placeholderTokens[index] == 0)
- {
- // we manually add a TypeRef without looking it up in mscorlib, because Mono and Silverlight's mscorlib don't have these types
- placeholderTokens[index] = AddTypeRefByName(mscorlib, "System.Runtime.CompilerServices", placeholderTypeNames[index]);
- }
- SetCustomAttribute(placeholderTokens[index], cad.__ToBuilder());
- }
- }
- FillAssemblyRefTable();
- EmitResources();
- ModuleWriter.WriteModule(null, null, this, PEFileKinds.Dll, portableExecutableKind, imageFileMachine, unmanagedResources, 0, streamOrNull);
- }
-
- public void __AddAssemblyReference(AssemblyName assemblyName)
- {
- __AddAssemblyReference(assemblyName, null);
- }
-
- public void __AddAssemblyReference(AssemblyName assemblyName, Assembly assembly)
- {
- if (referencedAssemblyNames == null)
- {
- referencedAssemblyNames = new List<AssemblyName>();
- }
- referencedAssemblyNames.Add((AssemblyName)assemblyName.Clone());
- int token = FindOrAddAssemblyRef(assemblyName, true);
- if (assembly != null)
- {
- referencedAssemblies.Add(assembly, token);
- }
- }
-
- public override AssemblyName[] __GetReferencedAssemblies()
- {
- List<AssemblyName> list = new List<AssemblyName>();
- if (referencedAssemblyNames != null)
- {
- foreach (AssemblyName name in referencedAssemblyNames)
- {
- if (!list.Contains(name))
- {
- list.Add(name);
- }
- }
- }
- foreach (Assembly asm in referencedAssemblies.Keys)
- {
- AssemblyName name = asm.GetName();
- if (!list.Contains(name))
- {
- list.Add(name);
- }
- }
- return list.ToArray();
- }
-
- public void __AddModuleReference(string module)
- {
- this.ModuleRef.FindOrAddRecord(module == null ? 0 : this.Strings.Add(module));
- }
-
- public override string[] __GetReferencedModules()
- {
- string[] arr = new string[this.ModuleRef.RowCount];
- for (int i = 0; i < arr.Length; i++)
- {
- arr[i] = this.Strings.Find(this.ModuleRef.records[i]);
- }
- return arr;
- }
-
- public override Type[] __GetReferencedTypes()
- {
- List<Type> list = new List<Type>();
- foreach (KeyValuePair<Type, int> kv in typeTokens)
- {
- if (kv.Value >> 24 == TypeRefTable.Index)
- {
- list.Add(kv.Key);
- }
- }
- return list.ToArray();
- }
-
- public override Type[] __GetExportedTypes()
- {
- throw new NotImplementedException();
- }
-
- public int __AddModule(int flags, string name, byte[] hash)
- {
- FileTable.Record file = new FileTable.Record();
- file.Flags = flags;
- file.Name = this.Strings.Add(name);
- file.HashValue = this.Blobs.Add(ByteBuffer.Wrap(hash));
- return 0x26000000 + this.File.AddRecord(file);
- }
-
- public int __AddManifestResource(int offset, ResourceAttributes flags, string name, int implementation)
- {
- ManifestResourceTable.Record res = new ManifestResourceTable.Record();
- res.Offset = offset;
- res.Flags = (int)flags;
- res.Name = this.Strings.Add(name);
- res.Implementation = implementation;
- return 0x28000000 + this.ManifestResource.AddRecord(res);
- }
-
- public void __SetCustomAttributeFor(int token, CustomAttributeBuilder customBuilder)
- {
- SetCustomAttribute(token, customBuilder);
- }
-
- public RelativeVirtualAddress __AddVTableFixups(MethodBuilder[] methods, int type)
- {
- initializedData.Align(8);
- VTableFixups fixups;
- fixups.initializedDataOffset = (uint)initializedData.Position;
- fixups.count = (ushort)methods.Length;
- fixups.type = (ushort)type;
- foreach (MethodBuilder mb in methods)
- {
- initializedData.Write(mb.MetadataToken);
- if (fixups.SlotWidth == 8)
- {
- initializedData.Write(0);
- }
- }
- vtablefixups.Add(fixups);
- return new RelativeVirtualAddress(fixups.initializedDataOffset);
- }
-
- public void __AddUnmanagedExportStub(string name, int ordinal, RelativeVirtualAddress rva)
- {
- AddUnmanagedExport(name, ordinal, null, rva);
- }
-
- internal void AddUnmanagedExport(string name, int ordinal, MethodBuilder methodBuilder, RelativeVirtualAddress rva)
- {
- UnmanagedExport export;
- export.name = name;
- export.ordinal = ordinal;
- export.mb = methodBuilder;
- export.rva = rva;
- unmanagedExports.Add(export);
- }
-
- internal void SetInterfaceImplementationCustomAttribute(TypeBuilder typeBuilder, Type interfaceType, CustomAttributeBuilder cab)
- {
- // NOTE since interfaceimpls are extremely common and custom attributes on them are extremely rare,
- // we store (and resolve) the custom attributes in such away as to avoid impacting the common case performance
- if (interfaceImplCustomAttributes == null)
- {
- interfaceImplCustomAttributes = new List<InterfaceImplCustomAttribute>();
- }
- InterfaceImplCustomAttribute rec;
- rec.type = typeBuilder.MetadataToken;
- int token = GetTypeToken(interfaceType).Token;
- switch (token >> 24)
- {
- case TypeDefTable.Index:
- token = (token & 0xFFFFFF) << 2 | 0;
- break;
- case TypeRefTable.Index:
- token = (token & 0xFFFFFF) << 2 | 1;
- break;
- case TypeSpecTable.Index:
- token = (token & 0xFFFFFF) << 2 | 2;
- break;
- default:
- throw new InvalidOperationException();
- }
- rec.interfaceType = token;
- rec.pseudoToken = AllocPseudoToken();
- interfaceImplCustomAttributes.Add(rec);
- SetCustomAttribute(rec.pseudoToken, cab);
- }
-
- internal void ResolveInterfaceImplPseudoTokens()
- {
- if (interfaceImplCustomAttributes != null)
- {
- foreach (InterfaceImplCustomAttribute rec in interfaceImplCustomAttributes)
- {
- for (int i = 0; i < InterfaceImpl.records.Length; i++)
- {
- if (InterfaceImpl.records[i].Class == rec.type && InterfaceImpl.records[i].Interface == rec.interfaceType)
- {
- RegisterTokenFixup(rec.pseudoToken, (InterfaceImplTable.Index << 24) | (i + 1));
- break;
- }
- }
- }
- }
- }
-
- internal void FixupPseudoToken(ref int token)
- {
- if (IsPseudoToken(token))
- {
- token = ResolvePseudoToken(token);
- }
- }
-
- internal void SetIsSaved()
- {
- if (saved)
- {
- throw new InvalidOperationException();
- }
- saved = true;
- }
-
- internal bool IsSaved
- {
- get { return saved; }
- }
-
- internal override string GetString(int index)
- {
- return this.Strings.Find(index);
- }
- }
-
- struct UnmanagedExport
- {
- internal string name;
- internal int ordinal;
- internal RelativeVirtualAddress rva;
- internal MethodBuilder mb;
- }
-
- public struct RelativeVirtualAddress
- {
- internal readonly uint initializedDataOffset;
-
- internal RelativeVirtualAddress(uint initializedDataOffset)
- {
- this.initializedDataOffset = initializedDataOffset;
- }
-
- public static RelativeVirtualAddress operator +(RelativeVirtualAddress rva, int offset)
- {
- return new RelativeVirtualAddress(rva.initializedDataOffset + (uint)offset);
- }
- }
-
- class ArrayMethod : MethodInfo
- {
- private readonly Module module;
- private readonly Type arrayClass;
- private readonly string methodName;
- private readonly CallingConventions callingConvention;
- private readonly Type returnType;
- protected readonly Type[] parameterTypes;
- private MethodSignature methodSignature;
-
- internal ArrayMethod(Module module, Type arrayClass, string methodName, CallingConventions callingConvention, Type returnType, Type[] parameterTypes)
- {
- this.module = module;
- this.arrayClass = arrayClass;
- this.methodName = methodName;
- this.callingConvention = callingConvention;
- this.returnType = returnType ?? module.universe.System_Void;
- this.parameterTypes = Util.Copy(parameterTypes);
- }
-
- public override MethodBody GetMethodBody()
- {
- throw new InvalidOperationException();
- }
-
- public override int __MethodRVA
- {
- get { throw new InvalidOperationException(); }
- }
-
- public override MethodImplAttributes GetMethodImplementationFlags()
- {
- throw new NotSupportedException();
- }
-
- public override ParameterInfo[] GetParameters()
- {
- throw new NotSupportedException();
- }
-
- internal override int ImportTo(ModuleBuilder module)
- {
- return module.ImportMethodOrField(arrayClass, methodName, MethodSignature);
- }
-
- public override MethodAttributes Attributes
- {
- get { throw new NotSupportedException(); }
- }
-
- public override CallingConventions CallingConvention
- {
- get { return callingConvention; }
- }
-
- public override Type DeclaringType
- {
- get { return arrayClass; }
- }
-
- internal override MethodSignature MethodSignature
- {
- get
- {
- if (methodSignature == null)
- {
- methodSignature = MethodSignature.MakeFromBuilder(returnType, parameterTypes, new PackedCustomModifiers(), callingConvention, 0);
- }
- return methodSignature;
- }
- }
-
- public override Module Module
- {
- // FXBUG like .NET, we return the module that GetArrayMethod was called on, not the module associated with the array type
- get { return module; }
- }
-
- public override string Name
- {
- get { return methodName; }
- }
-
- internal override int ParameterCount
- {
- get { return parameterTypes.Length; }
- }
-
- public override ParameterInfo ReturnParameter
- {
- // FXBUG like .NET, we throw NotImplementedException
- get { throw new NotImplementedException(); }
- }
-
- public override Type ReturnType
- {
- get { return returnType; }
- }
-
- internal override bool HasThis
- {
- get { return (callingConvention & (CallingConventions.HasThis | CallingConventions.ExplicitThis)) == CallingConventions.HasThis; }
- }
-
- internal override int GetCurrentToken()
- {
- return this.MetadataToken;
- }
-
- internal override bool IsBaked
- {
- get { return arrayClass.IsBaked; }
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2008, 2010 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Diagnostics;
-
-namespace IKVM.Reflection.Emit
-{
- public struct OpCode
- {
- private const int ValueCount = 1024;
- private const int OperandTypeCount = 19;
- private const int FlowControlCount = 9;
- private const int StackDiffCount = 5;
- private const int OpCodeTypeCount = 6;
- private const int StackBehaviourPopCount = 20;
- private const int StackBehaviourPushCount = 9;
- private static readonly StackBehaviour[] pop = {
- StackBehaviour.Pop0,
- StackBehaviour.Pop1,
- StackBehaviour.Pop1_pop1,
- StackBehaviour.Popi,
- StackBehaviour.Popi_pop1,
- StackBehaviour.Popi_popi,
- StackBehaviour.Popi_popi8,
- StackBehaviour.Popi_popi_popi,
- StackBehaviour.Popi_popr4,
- StackBehaviour.Popi_popr8,
- StackBehaviour.Popref,
- StackBehaviour.Popref_pop1,
- StackBehaviour.Popref_popi,
- StackBehaviour.Popref_popi_popi,
- StackBehaviour.Popref_popi_popi8,
- StackBehaviour.Popref_popi_popr4,
- StackBehaviour.Popref_popi_popr8,
- StackBehaviour.Popref_popi_popref,
- StackBehaviour.Varpop,
- StackBehaviour.Popref_popi_pop1
- };
- private static readonly StackBehaviour[] push = {
- StackBehaviour.Push0,
- StackBehaviour.Push1,
- StackBehaviour.Push1_push1,
- StackBehaviour.Pushi,
- StackBehaviour.Pushi8,
- StackBehaviour.Pushr4,
- StackBehaviour.Pushr8,
- StackBehaviour.Pushref,
- StackBehaviour.Varpush
- };
- private readonly int value;
-
- internal OpCode(int value)
- {
- this.value = value;
- }
-
- public override bool Equals(object obj)
- {
- return this == obj as OpCode?;
- }
-
- public override int GetHashCode()
- {
- return value;
- }
-
- public bool Equals(OpCode other)
- {
- return this == other;
- }
-
- public static bool operator ==(OpCode a, OpCode b)
- {
- return a.value == b.value;
- }
-
- public static bool operator !=(OpCode a, OpCode b)
- {
- return !(a == b);
- }
-
- public short Value
- {
- get { return (short)(value >> 22); }
- }
-
- public int Size
- {
- get { return value < 0 ? 2 : 1; }
- }
-
-#if !GENERATOR
- public string Name
- {
- get { return OpCodes.GetName(this.Value); }
- }
-#endif
-
- public OperandType OperandType
- {
- get { return (OperandType)((value & 0x3FFFFF) % OperandTypeCount); }
- }
-
- public FlowControl FlowControl
- {
- get { return (FlowControl)(((value & 0x3FFFFF) / OperandTypeCount) % FlowControlCount); }
- }
-
- internal int StackDiff
- {
- get { return ((((value & 0x3FFFFF) / (OperandTypeCount * FlowControlCount)) % StackDiffCount) - 3); }
- }
-
- public OpCodeType OpCodeType
- {
- get { return (OpCodeType)(((value & 0x3FFFFF) / (OperandTypeCount * FlowControlCount * StackDiffCount)) % OpCodeTypeCount); }
- }
-
- public StackBehaviour StackBehaviourPop
- {
- get { return pop[(((value & 0x3FFFFF) / (OperandTypeCount * FlowControlCount * StackDiffCount * OpCodeTypeCount)) % StackBehaviourPopCount)]; }
- }
-
- public StackBehaviour StackBehaviourPush
- {
- get { return push[(((value & 0x3FFFFF) / (OperandTypeCount * FlowControlCount * StackDiffCount * OpCodeTypeCount * StackBehaviourPopCount)) % StackBehaviourPushCount)]; }
- }
-
-#if GENERATOR
- static void Main(string[] args)
- {
- Debug.Assert(pop.Length == StackBehaviourPopCount);
- Debug.Assert(push.Length == StackBehaviourPushCount);
- CheckEnumRange(typeof(FlowControl), FlowControlCount);
- CheckEnumRange(typeof(OpCodeType), OpCodeTypeCount);
- CheckEnumRange(typeof(OperandType), OperandTypeCount);
- foreach (var field in typeof(System.Reflection.Emit.OpCodes).GetFields(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static))
- {
- System.Reflection.Emit.OpCode opc1 = (System.Reflection.Emit.OpCode)field.GetValue(null);
- IKVM.Reflection.Emit.OpCode opc2 = new IKVM.Reflection.Emit.OpCode(Pack(opc1));
- Debug.Assert(opc1.Value == opc2.Value);
- Debug.Assert(opc1.Size == opc2.Size);
- Debug.Assert((int)opc1.FlowControl == (int)opc2.FlowControl);
- Debug.Assert((int)opc1.OpCodeType == (int)opc2.OpCodeType);
- Debug.Assert((int)opc1.OperandType == (int)opc2.OperandType);
- Debug.Assert((int)opc1.StackBehaviourPop == (int)opc2.StackBehaviourPop);
- Debug.Assert((int)opc1.StackBehaviourPush == (int)opc2.StackBehaviourPush);
- Console.WriteLine("\t\tpublic static readonly OpCode {0} = new OpCode({1});", field.Name, Pack(opc1));
- }
- Console.WriteLine();
- Console.WriteLine("\t\tinternal static string GetName(int value)");
- Console.WriteLine("\t\t{");
- Console.WriteLine("\t\t\tswitch (value)");
- Console.WriteLine("\t\t\t{");
- foreach (var field in typeof(System.Reflection.Emit.OpCodes).GetFields(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static))
- {
- System.Reflection.Emit.OpCode opc1 = (System.Reflection.Emit.OpCode)field.GetValue(null);
- Console.WriteLine("\t\t\t\tcase {0}:", opc1.Value);
- Console.WriteLine("\t\t\t\t\treturn \"{0}\";", opc1.Name);
- }
- Console.WriteLine("\t\t\t}");
- Console.WriteLine("\t\t\tthrow new ArgumentOutOfRangeException();");
- Console.WriteLine("\t\t}");
- Console.WriteLine();
- Console.WriteLine("\t\tpublic static bool TakesSingleByteArgument(OpCode inst)");
- Console.WriteLine("\t\t{");
- Console.WriteLine("\t\t\tswitch (inst.Value)");
- Console.WriteLine("\t\t\t{");
- foreach (var field in typeof(System.Reflection.Emit.OpCodes).GetFields(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static))
- {
- System.Reflection.Emit.OpCode opc1 = (System.Reflection.Emit.OpCode)field.GetValue(null);
- if (System.Reflection.Emit.OpCodes.TakesSingleByteArgument(opc1))
- {
- Console.WriteLine("\t\t\t\tcase {0}:", opc1.Value);
- }
- }
- Console.WriteLine("\t\t\t\t\treturn true;");
- Console.WriteLine("\t\t\t\tdefault:");
- Console.WriteLine("\t\t\t\t\treturn false;");
- Console.WriteLine("\t\t\t}");
- Console.WriteLine("\t\t}");
- }
-
- private static void CheckEnumRange(System.Type type, int count)
- {
- foreach (var field in type.GetFields(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static))
- {
- int value = (int)field.GetValue(null);
- Debug.Assert(value >= 0 && value < count);
- }
- }
-
- static int Pack(System.Reflection.Emit.OpCode opcode)
- {
- int value = 0;
- value *= StackBehaviourPushCount;
- value += Map(push, opcode.StackBehaviourPush);
- value *= StackBehaviourPopCount;
- value += Map(pop, opcode.StackBehaviourPop);
- value *= OpCodeTypeCount;
- value += (int)opcode.OpCodeType;
- value *= StackDiffCount;
- value += 3 + GetStackDiff(opcode.StackBehaviourPush) + GetStackDiff(opcode.StackBehaviourPop);
- value *= FlowControlCount;
- value += (int)opcode.FlowControl;
- value *= OperandTypeCount;
- value += (int)opcode.OperandType;
- return (opcode.Value << 22) | value;
- }
-
- private static int Map(StackBehaviour[] array, System.Reflection.Emit.StackBehaviour stackBehaviour)
- {
- for (int i = 0; i < array.Length; i++)
- {
- if ((int)array[i] == (int)stackBehaviour)
- {
- return i;
- }
- }
- throw new InvalidOperationException();
- }
-
- static int GetStackDiff(System.Reflection.Emit.StackBehaviour sb)
- {
- switch (sb)
- {
- case System.Reflection.Emit.StackBehaviour.Pop0:
- case System.Reflection.Emit.StackBehaviour.Push0:
- case System.Reflection.Emit.StackBehaviour.Varpop:
- case System.Reflection.Emit.StackBehaviour.Varpush:
- return 0;
- case System.Reflection.Emit.StackBehaviour.Pop1:
- case System.Reflection.Emit.StackBehaviour.Popi:
- case System.Reflection.Emit.StackBehaviour.Popref:
- return -1;
- case System.Reflection.Emit.StackBehaviour.Pop1_pop1:
- case System.Reflection.Emit.StackBehaviour.Popi_pop1:
- case System.Reflection.Emit.StackBehaviour.Popi_popi:
- case System.Reflection.Emit.StackBehaviour.Popi_popi8:
- case System.Reflection.Emit.StackBehaviour.Popi_popr4:
- case System.Reflection.Emit.StackBehaviour.Popi_popr8:
- case System.Reflection.Emit.StackBehaviour.Popref_pop1:
- case System.Reflection.Emit.StackBehaviour.Popref_popi:
- return -2;
- case System.Reflection.Emit.StackBehaviour.Popi_popi_popi:
- case System.Reflection.Emit.StackBehaviour.Popref_popi_pop1:
- case System.Reflection.Emit.StackBehaviour.Popref_popi_popi:
- case System.Reflection.Emit.StackBehaviour.Popref_popi_popi8:
- case System.Reflection.Emit.StackBehaviour.Popref_popi_popr4:
- case System.Reflection.Emit.StackBehaviour.Popref_popi_popr8:
- case System.Reflection.Emit.StackBehaviour.Popref_popi_popref:
- return -3;
- case System.Reflection.Emit.StackBehaviour.Push1:
- case System.Reflection.Emit.StackBehaviour.Pushi:
- case System.Reflection.Emit.StackBehaviour.Pushi8:
- case System.Reflection.Emit.StackBehaviour.Pushr4:
- case System.Reflection.Emit.StackBehaviour.Pushr8:
- case System.Reflection.Emit.StackBehaviour.Pushref:
- return 1;
- case System.Reflection.Emit.StackBehaviour.Push1_push1:
- return 2;
- }
- throw new InvalidOperationException();
- }
-#endif // GENERATOR
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2008 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-
-namespace IKVM.Reflection.Emit
-{
- public sealed class OpCodes
- {
- public static readonly OpCode Nop = new OpCode(4888);
- public static readonly OpCode Break = new OpCode(4199116);
- public static readonly OpCode Ldarg_0 = new OpCode(8492847);
- public static readonly OpCode Ldarg_1 = new OpCode(12687151);
- public static readonly OpCode Ldarg_2 = new OpCode(16881455);
- public static readonly OpCode Ldarg_3 = new OpCode(21075759);
- public static readonly OpCode Ldloc_0 = new OpCode(25270063);
- public static readonly OpCode Ldloc_1 = new OpCode(29464367);
- public static readonly OpCode Ldloc_2 = new OpCode(33658671);
- public static readonly OpCode Ldloc_3 = new OpCode(37852975);
- public static readonly OpCode Stloc_0 = new OpCode(41949467);
- public static readonly OpCode Stloc_1 = new OpCode(46143771);
- public static readonly OpCode Stloc_2 = new OpCode(50338075);
- public static readonly OpCode Stloc_3 = new OpCode(54532379);
- public static readonly OpCode Ldarg_S = new OpCode(58824508);
- public static readonly OpCode Ldarga_S = new OpCode(63224012);
- public static readonly OpCode Starg_S = new OpCode(67115304);
- public static readonly OpCode Ldloc_S = new OpCode(71407420);
- public static readonly OpCode Ldloca_S = new OpCode(75806924);
- public static readonly OpCode Stloc_S = new OpCode(79698216);
- public static readonly OpCode Ldnull = new OpCode(84609339);
- public static readonly OpCode Ldc_I4_M1 = new OpCode(88389823);
- public static readonly OpCode Ldc_I4_0 = new OpCode(92584127);
- public static readonly OpCode Ldc_I4_1 = new OpCode(96778431);
- public static readonly OpCode Ldc_I4_2 = new OpCode(100972735);
- public static readonly OpCode Ldc_I4_3 = new OpCode(105167039);
- public static readonly OpCode Ldc_I4_4 = new OpCode(109361343);
- public static readonly OpCode Ldc_I4_5 = new OpCode(113555647);
- public static readonly OpCode Ldc_I4_6 = new OpCode(117749951);
- public static readonly OpCode Ldc_I4_7 = new OpCode(121944255);
- public static readonly OpCode Ldc_I4_8 = new OpCode(126138559);
- public static readonly OpCode Ldc_I4_S = new OpCode(130332874);
- public static readonly OpCode Ldc_I4 = new OpCode(134530584);
- public static readonly OpCode Ldc_I8 = new OpCode(138827489);
- public static readonly OpCode Ldc_R4 = new OpCode(143124407);
- public static readonly OpCode Ldc_R8 = new OpCode(147421301);
- public static readonly OpCode Dup = new OpCode(155404637);
- public static readonly OpCode Pop = new OpCode(159393399);
- public static readonly OpCode Jmp = new OpCode(163582686);
- public static readonly OpCode Call = new OpCode(168690130);
- public static readonly OpCode Calli = new OpCode(172884439);
- public static readonly OpCode Ret = new OpCode(176258034);
- public static readonly OpCode Br_S = new OpCode(180356455);
- public static readonly OpCode Brfalse_S = new OpCode(184566035);
- public static readonly OpCode Brtrue_S = new OpCode(188760339);
- public static readonly OpCode Beq_S = new OpCode(192949342);
- public static readonly OpCode Bge_S = new OpCode(197143646);
- public static readonly OpCode Bgt_S = new OpCode(201337950);
- public static readonly OpCode Ble_S = new OpCode(205532254);
- public static readonly OpCode Blt_S = new OpCode(209726558);
- public static readonly OpCode Bne_Un_S = new OpCode(213920862);
- public static readonly OpCode Bge_Un_S = new OpCode(218115166);
- public static readonly OpCode Bgt_Un_S = new OpCode(222309470);
- public static readonly OpCode Ble_Un_S = new OpCode(226503774);
- public static readonly OpCode Blt_Un_S = new OpCode(230698078);
- public static readonly OpCode Br = new OpCode(234885812);
- public static readonly OpCode Brfalse = new OpCode(239095392);
- public static readonly OpCode Brtrue = new OpCode(243289696);
- public static readonly OpCode Beq = new OpCode(247475279);
- public static readonly OpCode Bge = new OpCode(251669583);
- public static readonly OpCode Bgt = new OpCode(255863887);
- public static readonly OpCode Ble = new OpCode(260058191);
- public static readonly OpCode Blt = new OpCode(264252495);
- public static readonly OpCode Bne_Un = new OpCode(268446799);
- public static readonly OpCode Bge_Un = new OpCode(272641103);
- public static readonly OpCode Bgt_Un = new OpCode(276835407);
- public static readonly OpCode Ble_Un = new OpCode(281029711);
- public static readonly OpCode Blt_Un = new OpCode(285224015);
- public static readonly OpCode Switch = new OpCode(289427051);
- public static readonly OpCode Ldind_I1 = new OpCode(293929358);
- public static readonly OpCode Ldind_U1 = new OpCode(298123662);
- public static readonly OpCode Ldind_I2 = new OpCode(302317966);
- public static readonly OpCode Ldind_U2 = new OpCode(306512270);
- public static readonly OpCode Ldind_I4 = new OpCode(310706574);
- public static readonly OpCode Ldind_U4 = new OpCode(314900878);
- public static readonly OpCode Ldind_I8 = new OpCode(319197782);
- public static readonly OpCode Ldind_I = new OpCode(323289486);
- public static readonly OpCode Ldind_R4 = new OpCode(327688990);
- public static readonly OpCode Ldind_R8 = new OpCode(331985894);
- public static readonly OpCode Ldind_Ref = new OpCode(336282798);
- public static readonly OpCode Stind_Ref = new OpCode(339768820);
- public static readonly OpCode Stind_I1 = new OpCode(343963124);
- public static readonly OpCode Stind_I2 = new OpCode(348157428);
- public static readonly OpCode Stind_I4 = new OpCode(352351732);
- public static readonly OpCode Stind_I8 = new OpCode(356551166);
- public static readonly OpCode Stind_R4 = new OpCode(360755730);
- public static readonly OpCode Stind_R8 = new OpCode(364955164);
- public static readonly OpCode Add = new OpCode(369216329);
- public static readonly OpCode Sub = new OpCode(373410633);
- public static readonly OpCode Mul = new OpCode(377604937);
- public static readonly OpCode Div = new OpCode(381799241);
- public static readonly OpCode Div_Un = new OpCode(385993545);
- public static readonly OpCode Rem = new OpCode(390187849);
- public static readonly OpCode Rem_Un = new OpCode(394382153);
- public static readonly OpCode And = new OpCode(398576457);
- public static readonly OpCode Or = new OpCode(402770761);
- public static readonly OpCode Xor = new OpCode(406965065);
- public static readonly OpCode Shl = new OpCode(411159369);
- public static readonly OpCode Shr = new OpCode(415353673);
- public static readonly OpCode Shr_Un = new OpCode(419547977);
- public static readonly OpCode Neg = new OpCode(423737322);
- public static readonly OpCode Not = new OpCode(427931626);
- public static readonly OpCode Conv_I1 = new OpCode(432331130);
- public static readonly OpCode Conv_I2 = new OpCode(436525434);
- public static readonly OpCode Conv_I4 = new OpCode(440719738);
- public static readonly OpCode Conv_I8 = new OpCode(445016642);
- public static readonly OpCode Conv_R4 = new OpCode(449313546);
- public static readonly OpCode Conv_R8 = new OpCode(453610450);
- public static readonly OpCode Conv_U4 = new OpCode(457496954);
- public static readonly OpCode Conv_U8 = new OpCode(461793858);
- public static readonly OpCode Callvirt = new OpCode(466484004);
- public static readonly OpCode Cpobj = new OpCode(469790542);
- public static readonly OpCode Ldobj = new OpCode(474077528);
- public static readonly OpCode Ldstr = new OpCode(478872210);
- public static readonly OpCode Newobj = new OpCode(483158791);
- public static readonly OpCode Castclass = new OpCode(487311950);
- public static readonly OpCode Isinst = new OpCode(491095854);
- public static readonly OpCode Conv_R_Un = new OpCode(495553490);
- public static readonly OpCode Unbox = new OpCode(507874780);
- public static readonly OpCode Throw = new OpCode(511759452);
- public static readonly OpCode Ldfld = new OpCode(516056466);
- public static readonly OpCode Ldflda = new OpCode(520455970);
- public static readonly OpCode Stfld = new OpCode(524347262);
- public static readonly OpCode Ldsfld = new OpCode(528588249);
- public static readonly OpCode Ldsflda = new OpCode(532987753);
- public static readonly OpCode Stsfld = new OpCode(536879045);
- public static readonly OpCode Stobj = new OpCode(541090290);
- public static readonly OpCode Conv_Ovf_I1_Un = new OpCode(545577338);
- public static readonly OpCode Conv_Ovf_I2_Un = new OpCode(549771642);
- public static readonly OpCode Conv_Ovf_I4_Un = new OpCode(553965946);
- public static readonly OpCode Conv_Ovf_I8_Un = new OpCode(558262850);
- public static readonly OpCode Conv_Ovf_U1_Un = new OpCode(562354554);
- public static readonly OpCode Conv_Ovf_U2_Un = new OpCode(566548858);
- public static readonly OpCode Conv_Ovf_U4_Un = new OpCode(570743162);
- public static readonly OpCode Conv_Ovf_U8_Un = new OpCode(575040066);
- public static readonly OpCode Conv_Ovf_I_Un = new OpCode(579131770);
- public static readonly OpCode Conv_Ovf_U_Un = new OpCode(583326074);
- public static readonly OpCode Box = new OpCode(587930786);
- public static readonly OpCode Newarr = new OpCode(592133640);
- public static readonly OpCode Ldlen = new OpCode(595953446);
- public static readonly OpCode Ldelema = new OpCode(600157847);
- public static readonly OpCode Ldelem_I1 = new OpCode(604352143);
- public static readonly OpCode Ldelem_U1 = new OpCode(608546447);
- public static readonly OpCode Ldelem_I2 = new OpCode(612740751);
- public static readonly OpCode Ldelem_U2 = new OpCode(616935055);
- public static readonly OpCode Ldelem_I4 = new OpCode(621129359);
- public static readonly OpCode Ldelem_U4 = new OpCode(625323663);
- public static readonly OpCode Ldelem_I8 = new OpCode(629620567);
- public static readonly OpCode Ldelem_I = new OpCode(633712271);
- public static readonly OpCode Ldelem_R4 = new OpCode(638111775);
- public static readonly OpCode Ldelem_R8 = new OpCode(642408679);
- public static readonly OpCode Ldelem_Ref = new OpCode(646705583);
- public static readonly OpCode Stelem_I = new OpCode(650186475);
- public static readonly OpCode Stelem_I1 = new OpCode(654380779);
- public static readonly OpCode Stelem_I2 = new OpCode(658575083);
- public static readonly OpCode Stelem_I4 = new OpCode(662769387);
- public static readonly OpCode Stelem_I8 = new OpCode(666968821);
- public static readonly OpCode Stelem_R4 = new OpCode(671168255);
- public static readonly OpCode Stelem_R8 = new OpCode(675367689);
- public static readonly OpCode Stelem_Ref = new OpCode(679567123);
- public static readonly OpCode Ldelem = new OpCode(683838727);
- public static readonly OpCode Stelem = new OpCode(687965999);
- public static readonly OpCode Unbox_Any = new OpCode(692217246);
- public static readonly OpCode Conv_Ovf_I1 = new OpCode(751098234);
- public static readonly OpCode Conv_Ovf_U1 = new OpCode(755292538);
- public static readonly OpCode Conv_Ovf_I2 = new OpCode(759486842);
- public static readonly OpCode Conv_Ovf_U2 = new OpCode(763681146);
- public static readonly OpCode Conv_Ovf_I4 = new OpCode(767875450);
- public static readonly OpCode Conv_Ovf_U4 = new OpCode(772069754);
- public static readonly OpCode Conv_Ovf_I8 = new OpCode(776366658);
- public static readonly OpCode Conv_Ovf_U8 = new OpCode(780560962);
- public static readonly OpCode Refanyval = new OpCode(814012802);
- public static readonly OpCode Ckfinite = new OpCode(818514898);
- public static readonly OpCode Mkrefany = new OpCode(830595078);
- public static readonly OpCode Ldtoken = new OpCode(872728098);
- public static readonly OpCode Conv_U2 = new OpCode(876927354);
- public static readonly OpCode Conv_U1 = new OpCode(881121658);
- public static readonly OpCode Conv_I = new OpCode(885315962);
- public static readonly OpCode Conv_Ovf_I = new OpCode(889510266);
- public static readonly OpCode Conv_Ovf_U = new OpCode(893704570);
- public static readonly OpCode Add_Ovf = new OpCode(897698633);
- public static readonly OpCode Add_Ovf_Un = new OpCode(901892937);
- public static readonly OpCode Mul_Ovf = new OpCode(906087241);
- public static readonly OpCode Mul_Ovf_Un = new OpCode(910281545);
- public static readonly OpCode Sub_Ovf = new OpCode(914475849);
- public static readonly OpCode Sub_Ovf_Un = new OpCode(918670153);
- public static readonly OpCode Endfinally = new OpCode(922751806);
- public static readonly OpCode Leave = new OpCode(926945972);
- public static readonly OpCode Leave_S = new OpCode(931140291);
- public static readonly OpCode Stind_I = new OpCode(935359988);
- public static readonly OpCode Conv_U = new OpCode(939841914);
- public static readonly OpCode Prefix7 = new OpCode(1040189696);
- public static readonly OpCode Prefix6 = new OpCode(1044384000);
- public static readonly OpCode Prefix5 = new OpCode(1048578304);
- public static readonly OpCode Prefix4 = new OpCode(1052772608);
- public static readonly OpCode Prefix3 = new OpCode(1056966912);
- public static readonly OpCode Prefix2 = new OpCode(1061161216);
- public static readonly OpCode Prefix1 = new OpCode(1065355520);
- public static readonly OpCode Prefixref = new OpCode(1069549824);
- public static readonly OpCode Arglist = new OpCode(-2147170789);
- public static readonly OpCode Ceq = new OpCode(-2142966567);
- public static readonly OpCode Cgt = new OpCode(-2138772263);
- public static readonly OpCode Cgt_Un = new OpCode(-2134577959);
- public static readonly OpCode Clt = new OpCode(-2130383655);
- public static readonly OpCode Clt_Un = new OpCode(-2126189351);
- public static readonly OpCode Ldftn = new OpCode(-2122004966);
- public static readonly OpCode Ldvirtftn = new OpCode(-2117759533);
- public static readonly OpCode Ldarg = new OpCode(-2109627244);
- public static readonly OpCode Ldarga = new OpCode(-2105227740);
- public static readonly OpCode Starg = new OpCode(-2101336448);
- public static readonly OpCode Ldloc = new OpCode(-2097044332);
- public static readonly OpCode Ldloca = new OpCode(-2092644828);
- public static readonly OpCode Stloc = new OpCode(-2088753536);
- public static readonly OpCode Localloc = new OpCode(-2084241010);
- public static readonly OpCode Endfilter = new OpCode(-2076160335);
- public static readonly OpCode Unaligned = new OpCode(-2071982151);
- public static readonly OpCode Volatile = new OpCode(-2067787858);
- public static readonly OpCode Tailcall = new OpCode(-2063593554);
- public static readonly OpCode Initobj = new OpCode(-2059384859);
- public static readonly OpCode Constrained = new OpCode(-2055204938);
- public static readonly OpCode Cpblk = new OpCode(-2050974371);
- public static readonly OpCode Initblk = new OpCode(-2046780067);
- public static readonly OpCode Rethrow = new OpCode(-2038428509);
- public static readonly OpCode Sizeof = new OpCode(-2029730269);
- public static readonly OpCode Refanytype = new OpCode(-2025531014);
- public static readonly OpCode Readonly = new OpCode(-2021650514);
-
- internal static string GetName(int value)
- {
- switch (value)
- {
- case 0:
- return "nop";
- case 1:
- return "break";
- case 2:
- return "ldarg.0";
- case 3:
- return "ldarg.1";
- case 4:
- return "ldarg.2";
- case 5:
- return "ldarg.3";
- case 6:
- return "ldloc.0";
- case 7:
- return "ldloc.1";
- case 8:
- return "ldloc.2";
- case 9:
- return "ldloc.3";
- case 10:
- return "stloc.0";
- case 11:
- return "stloc.1";
- case 12:
- return "stloc.2";
- case 13:
- return "stloc.3";
- case 14:
- return "ldarg.s";
- case 15:
- return "ldarga.s";
- case 16:
- return "starg.s";
- case 17:
- return "ldloc.s";
- case 18:
- return "ldloca.s";
- case 19:
- return "stloc.s";
- case 20:
- return "ldnull";
- case 21:
- return "ldc.i4.m1";
- case 22:
- return "ldc.i4.0";
- case 23:
- return "ldc.i4.1";
- case 24:
- return "ldc.i4.2";
- case 25:
- return "ldc.i4.3";
- case 26:
- return "ldc.i4.4";
- case 27:
- return "ldc.i4.5";
- case 28:
- return "ldc.i4.6";
- case 29:
- return "ldc.i4.7";
- case 30:
- return "ldc.i4.8";
- case 31:
- return "ldc.i4.s";
- case 32:
- return "ldc.i4";
- case 33:
- return "ldc.i8";
- case 34:
- return "ldc.r4";
- case 35:
- return "ldc.r8";
- case 37:
- return "dup";
- case 38:
- return "pop";
- case 39:
- return "jmp";
- case 40:
- return "call";
- case 41:
- return "calli";
- case 42:
- return "ret";
- case 43:
- return "br.s";
- case 44:
- return "brfalse.s";
- case 45:
- return "brtrue.s";
- case 46:
- return "beq.s";
- case 47:
- return "bge.s";
- case 48:
- return "bgt.s";
- case 49:
- return "ble.s";
- case 50:
- return "blt.s";
- case 51:
- return "bne.un.s";
- case 52:
- return "bge.un.s";
- case 53:
- return "bgt.un.s";
- case 54:
- return "ble.un.s";
- case 55:
- return "blt.un.s";
- case 56:
- return "br";
- case 57:
- return "brfalse";
- case 58:
- return "brtrue";
- case 59:
- return "beq";
- case 60:
- return "bge";
- case 61:
- return "bgt";
- case 62:
- return "ble";
- case 63:
- return "blt";
- case 64:
- return "bne.un";
- case 65:
- return "bge.un";
- case 66:
- return "bgt.un";
- case 67:
- return "ble.un";
- case 68:
- return "blt.un";
- case 69:
- return "switch";
- case 70:
- return "ldind.i1";
- case 71:
- return "ldind.u1";
- case 72:
- return "ldind.i2";
- case 73:
- return "ldind.u2";
- case 74:
- return "ldind.i4";
- case 75:
- return "ldind.u4";
- case 76:
- return "ldind.i8";
- case 77:
- return "ldind.i";
- case 78:
- return "ldind.r4";
- case 79:
- return "ldind.r8";
- case 80:
- return "ldind.ref";
- case 81:
- return "stind.ref";
- case 82:
- return "stind.i1";
- case 83:
- return "stind.i2";
- case 84:
- return "stind.i4";
- case 85:
- return "stind.i8";
- case 86:
- return "stind.r4";
- case 87:
- return "stind.r8";
- case 88:
- return "add";
- case 89:
- return "sub";
- case 90:
- return "mul";
- case 91:
- return "div";
- case 92:
- return "div.un";
- case 93:
- return "rem";
- case 94:
- return "rem.un";
- case 95:
- return "and";
- case 96:
- return "or";
- case 97:
- return "xor";
- case 98:
- return "shl";
- case 99:
- return "shr";
- case 100:
- return "shr.un";
- case 101:
- return "neg";
- case 102:
- return "not";
- case 103:
- return "conv.i1";
- case 104:
- return "conv.i2";
- case 105:
- return "conv.i4";
- case 106:
- return "conv.i8";
- case 107:
- return "conv.r4";
- case 108:
- return "conv.r8";
- case 109:
- return "conv.u4";
- case 110:
- return "conv.u8";
- case 111:
- return "callvirt";
- case 112:
- return "cpobj";
- case 113:
- return "ldobj";
- case 114:
- return "ldstr";
- case 115:
- return "newobj";
- case 116:
- return "castclass";
- case 117:
- return "isinst";
- case 118:
- return "conv.r.un";
- case 121:
- return "unbox";
- case 122:
- return "throw";
- case 123:
- return "ldfld";
- case 124:
- return "ldflda";
- case 125:
- return "stfld";
- case 126:
- return "ldsfld";
- case 127:
- return "ldsflda";
- case 128:
- return "stsfld";
- case 129:
- return "stobj";
- case 130:
- return "conv.ovf.i1.un";
- case 131:
- return "conv.ovf.i2.un";
- case 132:
- return "conv.ovf.i4.un";
- case 133:
- return "conv.ovf.i8.un";
- case 134:
- return "conv.ovf.u1.un";
- case 135:
- return "conv.ovf.u2.un";
- case 136:
- return "conv.ovf.u4.un";
- case 137:
- return "conv.ovf.u8.un";
- case 138:
- return "conv.ovf.i.un";
- case 139:
- return "conv.ovf.u.un";
- case 140:
- return "box";
- case 141:
- return "newarr";
- case 142:
- return "ldlen";
- case 143:
- return "ldelema";
- case 144:
- return "ldelem.i1";
- case 145:
- return "ldelem.u1";
- case 146:
- return "ldelem.i2";
- case 147:
- return "ldelem.u2";
- case 148:
- return "ldelem.i4";
- case 149:
- return "ldelem.u4";
- case 150:
- return "ldelem.i8";
- case 151:
- return "ldelem.i";
- case 152:
- return "ldelem.r4";
- case 153:
- return "ldelem.r8";
- case 154:
- return "ldelem.ref";
- case 155:
- return "stelem.i";
- case 156:
- return "stelem.i1";
- case 157:
- return "stelem.i2";
- case 158:
- return "stelem.i4";
- case 159:
- return "stelem.i8";
- case 160:
- return "stelem.r4";
- case 161:
- return "stelem.r8";
- case 162:
- return "stelem.ref";
- case 163:
- return "ldelem";
- case 164:
- return "stelem";
- case 165:
- return "unbox.any";
- case 179:
- return "conv.ovf.i1";
- case 180:
- return "conv.ovf.u1";
- case 181:
- return "conv.ovf.i2";
- case 182:
- return "conv.ovf.u2";
- case 183:
- return "conv.ovf.i4";
- case 184:
- return "conv.ovf.u4";
- case 185:
- return "conv.ovf.i8";
- case 186:
- return "conv.ovf.u8";
- case 194:
- return "refanyval";
- case 195:
- return "ckfinite";
- case 198:
- return "mkrefany";
- case 208:
- return "ldtoken";
- case 209:
- return "conv.u2";
- case 210:
- return "conv.u1";
- case 211:
- return "conv.i";
- case 212:
- return "conv.ovf.i";
- case 213:
- return "conv.ovf.u";
- case 214:
- return "add.ovf";
- case 215:
- return "add.ovf.un";
- case 216:
- return "mul.ovf";
- case 217:
- return "mul.ovf.un";
- case 218:
- return "sub.ovf";
- case 219:
- return "sub.ovf.un";
- case 220:
- return "endfinally";
- case 221:
- return "leave";
- case 222:
- return "leave.s";
- case 223:
- return "stind.i";
- case 224:
- return "conv.u";
- case 248:
- return "prefix7";
- case 249:
- return "prefix6";
- case 250:
- return "prefix5";
- case 251:
- return "prefix4";
- case 252:
- return "prefix3";
- case 253:
- return "prefix2";
- case 254:
- return "prefix1";
- case 255:
- return "prefixref";
- case -512:
- return "arglist";
- case -511:
- return "ceq";
- case -510:
- return "cgt";
- case -509:
- return "cgt.un";
- case -508:
- return "clt";
- case -507:
- return "clt.un";
- case -506:
- return "ldftn";
- case -505:
- return "ldvirtftn";
- case -503:
- return "ldarg";
- case -502:
- return "ldarga";
- case -501:
- return "starg";
- case -500:
- return "ldloc";
- case -499:
- return "ldloca";
- case -498:
- return "stloc";
- case -497:
- return "localloc";
- case -495:
- return "endfilter";
- case -494:
- return "unaligned.";
- case -493:
- return "volatile.";
- case -492:
- return "tail.";
- case -491:
- return "initobj";
- case -490:
- return "constrained.";
- case -489:
- return "cpblk";
- case -488:
- return "initblk";
- case -486:
- return "rethrow";
- case -484:
- return "sizeof";
- case -483:
- return "refanytype";
- case -482:
- return "readonly.";
- }
- throw new ArgumentOutOfRangeException();
- }
-
- public static bool TakesSingleByteArgument(OpCode inst)
- {
- switch (inst.Value)
- {
- case 14:
- case 15:
- case 16:
- case 17:
- case 18:
- case 19:
- case 31:
- case 43:
- case 44:
- case 45:
- case 46:
- case 47:
- case 48:
- case 49:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 222:
- case -494:
- return true;
- default:
- return false;
- }
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2008 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using IKVM.Reflection.Writer;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection.Emit
-{
- public sealed class ParameterBuilder
- {
- private readonly ModuleBuilder moduleBuilder;
- private short flags;
- private readonly short sequence;
- private readonly int nameIndex;
- private readonly string name;
- private int lazyPseudoToken;
-
- internal ParameterBuilder(ModuleBuilder moduleBuilder, int sequence, ParameterAttributes attribs, string name)
- {
- this.moduleBuilder = moduleBuilder;
- this.flags = (short)attribs;
- this.sequence = (short)sequence;
- this.nameIndex = name == null ? 0 : moduleBuilder.Strings.Add(name);
- this.name = name;
- }
-
- internal int PseudoToken
- {
- get
- {
- if (lazyPseudoToken == 0)
- {
- // we lazily create the token, because if we don't need it we don't want the token fixup cost
- lazyPseudoToken = moduleBuilder.AllocPseudoToken();
- }
- return lazyPseudoToken;
- }
- }
-
- public string Name
- {
- get { return name; }
- }
-
- public int Position
- {
- // note that this differs from ParameterInfo.Position, which is zero based
- get { return sequence; }
- }
-
- public int Attributes
- {
- get { return flags; }
- }
-
- public bool IsIn
- {
- get { return (flags & (short)ParameterAttributes.In) != 0; }
- }
-
- public bool IsOut
- {
- get { return (flags & (short)ParameterAttributes.Out) != 0; }
- }
-
- public bool IsOptional
- {
- get { return (flags & (short)ParameterAttributes.Optional) != 0; }
- }
-
- public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
- {
- SetCustomAttribute(new CustomAttributeBuilder(con, binaryAttribute));
- }
-
- public void SetCustomAttribute(CustomAttributeBuilder customAttributeBuilder)
- {
- Universe u = moduleBuilder.universe;
- if (customAttributeBuilder.Constructor.DeclaringType == u.System_Runtime_InteropServices_InAttribute)
- {
- flags |= (short)ParameterAttributes.In;
- }
- else if (customAttributeBuilder.Constructor.DeclaringType == u.System_Runtime_InteropServices_OutAttribute)
- {
- flags |= (short)ParameterAttributes.Out;
- }
- else if (customAttributeBuilder.Constructor.DeclaringType == u.System_Runtime_InteropServices_OptionalAttribute)
- {
- flags |= (short)ParameterAttributes.Optional;
- }
- else if (customAttributeBuilder.Constructor.DeclaringType == u.System_Runtime_InteropServices_MarshalAsAttribute)
- {
- FieldMarshal.SetMarshalAsAttribute(moduleBuilder, PseudoToken, customAttributeBuilder);
- flags |= (short)ParameterAttributes.HasFieldMarshal;
- }
- else
- {
- moduleBuilder.SetCustomAttribute(PseudoToken, customAttributeBuilder);
- }
- }
-
- public void SetConstant(object defaultValue)
- {
- flags |= (short)ParameterAttributes.HasDefault;
- moduleBuilder.AddConstant(PseudoToken, defaultValue);
- }
-
- internal void WriteParamRecord(MetadataWriter mw)
- {
- mw.Write(flags);
- mw.Write(sequence);
- mw.WriteStringIndex(nameIndex);
- }
-
- internal void FixupToken(int parameterToken)
- {
- if (lazyPseudoToken != 0)
- {
- moduleBuilder.RegisterTokenFixup(lazyPseudoToken, parameterToken);
- }
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2008-2011 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Runtime.CompilerServices;
-using IKVM.Reflection.Writer;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection.Emit
-{
- public sealed class PropertyBuilder : PropertyInfo
- {
- private readonly TypeBuilder typeBuilder;
- private readonly string name;
- private PropertyAttributes attributes;
- private PropertySignature sig;
- private MethodBuilder getter;
- private MethodBuilder setter;
- private readonly List<Accessor> accessors = new List<Accessor>();
- private int lazyPseudoToken;
- private bool patchCallingConvention;
-
- private struct Accessor
- {
- internal short Semantics;
- internal MethodBuilder Method;
- }
-
- internal PropertyBuilder(TypeBuilder typeBuilder, string name, PropertyAttributes attributes, PropertySignature sig, bool patchCallingConvention)
- {
- this.typeBuilder = typeBuilder;
- this.name = name;
- this.attributes = attributes;
- this.sig = sig;
- this.patchCallingConvention = patchCallingConvention;
- }
-
- internal override PropertySignature PropertySignature
- {
- get { return sig; }
- }
-
- public void SetGetMethod(MethodBuilder mdBuilder)
- {
- getter = mdBuilder;
- Accessor acc;
- acc.Semantics = MethodSemanticsTable.Getter;
- acc.Method = mdBuilder;
- accessors.Add(acc);
- }
-
- public void SetSetMethod(MethodBuilder mdBuilder)
- {
- setter = mdBuilder;
- Accessor acc;
- acc.Semantics = MethodSemanticsTable.Setter;
- acc.Method = mdBuilder;
- accessors.Add(acc);
- }
-
- public void AddOtherMethod(MethodBuilder mdBuilder)
- {
- Accessor acc;
- acc.Semantics = MethodSemanticsTable.Other;
- acc.Method = mdBuilder;
- accessors.Add(acc);
- }
-
- public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
- {
- SetCustomAttribute(new CustomAttributeBuilder(con, binaryAttribute));
- }
-
- public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
- {
- Universe u = typeBuilder.ModuleBuilder.universe;
- if (customBuilder.Constructor.DeclaringType == u.System_Runtime_CompilerServices_SpecialNameAttribute)
- {
- attributes |= PropertyAttributes.SpecialName;
- }
- else
- {
- if (lazyPseudoToken == 0)
- {
- lazyPseudoToken = typeBuilder.ModuleBuilder.AllocPseudoToken();
- }
- typeBuilder.ModuleBuilder.SetCustomAttribute(lazyPseudoToken, customBuilder);
- }
- }
-
- public override object GetRawConstantValue()
- {
- if (lazyPseudoToken != 0)
- {
- return typeBuilder.ModuleBuilder.Constant.GetRawConstantValue(typeBuilder.ModuleBuilder, lazyPseudoToken);
- }
- throw new InvalidOperationException();
- }
-
- public override PropertyAttributes Attributes
- {
- get { return attributes; }
- }
-
- public override bool CanRead
- {
- get { return getter != null; }
- }
-
- public override bool CanWrite
- {
- get { return setter != null; }
- }
-
- public override MethodInfo GetGetMethod(bool nonPublic)
- {
- return nonPublic || (getter != null && getter.IsPublic) ? getter : null;
- }
-
- public override MethodInfo GetSetMethod(bool nonPublic)
- {
- return nonPublic || (setter != null && setter.IsPublic) ? setter : null;
- }
-
- public override MethodInfo[] GetAccessors(bool nonPublic)
- {
- List<MethodInfo> list = new List<MethodInfo>();
- foreach (Accessor acc in accessors)
- {
- AddAccessor(list, nonPublic, acc.Method);
- }
- return list.ToArray();
- }
-
- private static void AddAccessor(List<MethodInfo> list, bool nonPublic, MethodInfo method)
- {
- if (method != null && (nonPublic || method.IsPublic))
- {
- list.Add(method);
- }
- }
-
- public override Type DeclaringType
- {
- get { return typeBuilder; }
- }
-
- public override string Name
- {
- get { return name; }
- }
-
- public override Module Module
- {
- get { return typeBuilder.Module; }
- }
-
- public void SetConstant(object defaultValue)
- {
- if (lazyPseudoToken == 0)
- {
- lazyPseudoToken = typeBuilder.ModuleBuilder.AllocPseudoToken();
- }
- attributes |= PropertyAttributes.HasDefault;
- typeBuilder.ModuleBuilder.AddConstant(lazyPseudoToken, defaultValue);
- }
-
- internal void Bake()
- {
- if (patchCallingConvention)
- {
- sig.HasThis = !this.IsStatic;
- }
-
- PropertyTable.Record rec = new PropertyTable.Record();
- rec.Flags = (short)attributes;
- rec.Name = typeBuilder.ModuleBuilder.Strings.Add(name);
- rec.Type = typeBuilder.ModuleBuilder.GetSignatureBlobIndex(sig);
- int token = 0x17000000 | typeBuilder.ModuleBuilder.Property.AddRecord(rec);
-
- if (lazyPseudoToken == 0)
- {
- lazyPseudoToken = token;
- }
- else
- {
- typeBuilder.ModuleBuilder.RegisterTokenFixup(lazyPseudoToken, token);
- }
-
- foreach (Accessor acc in accessors)
- {
- AddMethodSemantics(acc.Semantics, acc.Method.MetadataToken, token);
- }
- }
-
- private void AddMethodSemantics(short semantics, int methodToken, int propertyToken)
- {
- MethodSemanticsTable.Record rec = new MethodSemanticsTable.Record();
- rec.Semantics = semantics;
- rec.Method = methodToken;
- rec.Association = propertyToken;
- typeBuilder.ModuleBuilder.MethodSemantics.AddRecord(rec);
- }
-
- internal override bool IsPublic
- {
- get
- {
- foreach (Accessor acc in accessors)
- {
- if (acc.Method.IsPublic)
- {
- return true;
- }
- }
- return false;
- }
- }
-
- internal override bool IsNonPrivate
- {
- get
- {
- foreach (Accessor acc in accessors)
- {
- if ((acc.Method.Attributes & MethodAttributes.MemberAccessMask) > MethodAttributes.Private)
- {
- return true;
- }
- }
- return false;
- }
- }
-
- internal override bool IsStatic
- {
- get
- {
- foreach (Accessor acc in accessors)
- {
- if (acc.Method.IsStatic)
- {
- return true;
- }
- }
- return false;
- }
- }
-
- internal override bool IsBaked
- {
- get { return typeBuilder.IsBaked; }
- }
-
- internal override int GetCurrentToken()
- {
- if (typeBuilder.ModuleBuilder.IsSaved && typeBuilder.ModuleBuilder.IsPseudoToken(lazyPseudoToken))
- {
- return typeBuilder.ModuleBuilder.ResolvePseudoToken(lazyPseudoToken);
- }
- else
- {
- return lazyPseudoToken;
- }
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2008-2012 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-using IKVM.Reflection;
-using IKVM.Reflection.Writer;
-
-namespace IKVM.Reflection.Emit
-{
- public abstract class SignatureHelper
- {
- protected readonly byte type;
- protected ushort paramCount;
-
- sealed class Lazy : SignatureHelper
- {
- private readonly List<Type> args = new List<Type>();
-
- internal Lazy(byte type)
- : base(type)
- {
- }
-
- internal override Type ReturnType
- {
- get { return args[0]; }
- }
-
- public override byte[] GetSignature()
- {
- throw new NotSupportedException();
- }
-
- internal override ByteBuffer GetSignature(ModuleBuilder module)
- {
- ByteBuffer bb = new ByteBuffer(16);
- Signature.WriteSignatureHelper(module, bb, type, paramCount, args);
- return bb;
- }
-
- public override void AddSentinel()
- {
- args.Add(MarkerType.Sentinel);
- }
-
- public override void __AddArgument(Type argument, bool pinned, CustomModifiers customModifiers)
- {
- if (pinned)
- {
- args.Add(MarkerType.Pinned);
- }
- foreach (CustomModifiers.Entry mod in customModifiers)
- {
- args.Add(mod.IsRequired ? MarkerType.ModReq : MarkerType.ModOpt);
- args.Add(mod.Type);
- }
- args.Add(argument);
- paramCount++;
- }
- }
-
- sealed class Eager : SignatureHelper
- {
- private readonly ModuleBuilder module;
- private readonly ByteBuffer bb = new ByteBuffer(16);
- private readonly Type returnType;
-
- internal Eager(ModuleBuilder module, byte type, Type returnType)
- : base(type)
- {
- this.module = module;
- this.returnType = returnType;
- bb.Write(type);
- if (type != Signature.FIELD)
- {
- // space for parameterCount
- bb.Write((byte)0);
- }
- }
-
- internal override Type ReturnType
- {
- get { return returnType; }
- }
-
- public override byte[] GetSignature()
- {
- return GetSignature(null).ToArray();
- }
-
- internal override ByteBuffer GetSignature(ModuleBuilder module)
- {
- if (type != Signature.FIELD)
- {
- bb.Position = 1;
- bb.Insert(MetadataWriter.GetCompressedIntLength(paramCount) - bb.GetCompressedIntLength());
- bb.WriteCompressedInt(paramCount);
- }
- return bb;
- }
-
- public override void AddSentinel()
- {
- bb.Write(Signature.SENTINEL);
- }
-
- public override void __AddArgument(Type argument, bool pinned, CustomModifiers customModifiers)
- {
- if (pinned)
- {
- bb.Write(Signature.ELEMENT_TYPE_PINNED);
- }
- foreach (CustomModifiers.Entry mod in customModifiers)
- {
- bb.Write(mod.IsRequired ? Signature.ELEMENT_TYPE_CMOD_REQD : Signature.ELEMENT_TYPE_CMOD_OPT);
- Signature.WriteTypeSpec(module, bb, mod.Type);
- }
- Signature.WriteTypeSpec(module, bb, argument ?? module.universe.System_Void);
- paramCount++;
- }
- }
-
- private SignatureHelper(byte type)
- {
- this.type = type;
- }
-
- internal bool HasThis
- {
- get { return (type & Signature.HASTHIS) != 0; }
- }
-
- internal abstract Type ReturnType
- {
- get;
- }
-
- internal int ParameterCount
- {
- get { return paramCount; }
- }
-
- private static SignatureHelper Create(Module mod, byte type, Type returnType)
- {
- ModuleBuilder mb = mod as ModuleBuilder;
- return mb == null
- ? (SignatureHelper)new Lazy(type)
- : new Eager(mb, type, returnType);
- }
-
- public static SignatureHelper GetFieldSigHelper(Module mod)
- {
- return Create(mod, Signature.FIELD, null);
- }
-
- public static SignatureHelper GetLocalVarSigHelper()
- {
- return new Lazy(Signature.LOCAL_SIG);
- }
-
- public static SignatureHelper GetLocalVarSigHelper(Module mod)
- {
- return Create(mod, Signature.LOCAL_SIG, null);
- }
-
- public static SignatureHelper GetPropertySigHelper(Module mod, Type returnType, Type[] parameterTypes)
- {
- SignatureHelper sig = Create(mod, Signature.PROPERTY, returnType);
- sig.AddArgument(returnType);
- sig.paramCount = 0;
- sig.AddArguments(parameterTypes, null, null);
- return sig;
- }
-
- public static SignatureHelper GetPropertySigHelper(Module mod, Type returnType, Type[] requiredReturnTypeCustomModifiers, Type[] optionalReturnTypeCustomModifiers, Type[] parameterTypes, Type[][] requiredParameterTypeCustomModifiers, Type[][] optionalParameterTypeCustomModifiers)
- {
- return GetPropertySigHelper(mod, CallingConventions.Standard, returnType, requiredReturnTypeCustomModifiers, optionalReturnTypeCustomModifiers, parameterTypes, requiredParameterTypeCustomModifiers, optionalParameterTypeCustomModifiers);
- }
-
- public static SignatureHelper GetPropertySigHelper(Module mod, CallingConventions callingConvention, Type returnType, Type[] requiredReturnTypeCustomModifiers, Type[] optionalReturnTypeCustomModifiers, Type[] parameterTypes, Type[][] requiredParameterTypeCustomModifiers, Type[][] optionalParameterTypeCustomModifiers)
- {
- byte type = Signature.PROPERTY;
- if ((callingConvention & CallingConventions.HasThis) != 0)
- {
- type |= Signature.HASTHIS;
- }
- SignatureHelper sig = Create(mod, type, returnType);
- sig.AddArgument(returnType, requiredReturnTypeCustomModifiers, optionalReturnTypeCustomModifiers);
- sig.paramCount = 0;
- sig.AddArguments(parameterTypes, requiredParameterTypeCustomModifiers, optionalParameterTypeCustomModifiers);
- return sig;
- }
-
- public static SignatureHelper GetMethodSigHelper(CallingConvention unmanagedCallingConvention, Type returnType)
- {
- return GetMethodSigHelper(null, unmanagedCallingConvention, returnType);
- }
-
- public static SignatureHelper GetMethodSigHelper(CallingConventions callingConvention, Type returnType)
- {
- return GetMethodSigHelper(null, callingConvention, returnType);
- }
-
- public static SignatureHelper GetMethodSigHelper(Module mod, CallingConvention unmanagedCallConv, Type returnType)
- {
- byte type;
- switch (unmanagedCallConv)
- {
- case CallingConvention.Cdecl:
- type = 0x01; // C
- break;
- case CallingConvention.StdCall:
- case CallingConvention.Winapi:
- type = 0x02; // STDCALL
- break;
- case CallingConvention.ThisCall:
- type = 0x03; // THISCALL
- break;
- case CallingConvention.FastCall:
- type = 0x04; // FASTCALL
- break;
- default:
- throw new ArgumentOutOfRangeException("unmanagedCallConv");
- }
- SignatureHelper sig = Create(mod, type, returnType);
- sig.AddArgument(returnType);
- sig.paramCount = 0;
- return sig;
- }
-
- public static SignatureHelper GetMethodSigHelper(Module mod, CallingConventions callingConvention, Type returnType)
- {
- byte type = 0;
- if ((callingConvention & CallingConventions.HasThis) != 0)
- {
- type |= Signature.HASTHIS;
- }
- if ((callingConvention & CallingConventions.ExplicitThis) != 0)
- {
- type |= Signature.EXPLICITTHIS;
- }
- if ((callingConvention & CallingConventions.VarArgs) != 0)
- {
- type |= Signature.VARARG;
- }
- SignatureHelper sig = Create(mod, type, returnType);
- sig.AddArgument(returnType);
- sig.paramCount = 0;
- return sig;
- }
-
- public static SignatureHelper GetMethodSigHelper(Module mod, Type returnType, Type[] parameterTypes)
- {
- SignatureHelper sig = Create(mod, 0, returnType);
- sig.AddArgument(returnType);
- sig.paramCount = 0;
- sig.AddArguments(parameterTypes, null, null);
- return sig;
- }
-
- public abstract byte[] GetSignature();
-
- internal abstract ByteBuffer GetSignature(ModuleBuilder module);
-
- public abstract void AddSentinel();
-
- public void AddArgument(Type clsArgument)
- {
- AddArgument(clsArgument, false);
- }
-
- public void AddArgument(Type argument, bool pinned)
- {
- __AddArgument(argument, pinned, new CustomModifiers());
- }
-
- public void AddArgument(Type argument, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers)
- {
- __AddArgument(argument, false, CustomModifiers.FromReqOpt(requiredCustomModifiers, optionalCustomModifiers));
- }
-
- public abstract void __AddArgument(Type argument, bool pinned, CustomModifiers customModifiers);
-
- public void AddArguments(Type[] arguments, Type[][] requiredCustomModifiers, Type[][] optionalCustomModifiers)
- {
- if (arguments != null)
- {
- for (int i = 0; i < arguments.Length; i++)
- {
- __AddArgument(arguments[i], false, CustomModifiers.FromReqOpt(Util.NullSafeElementAt(requiredCustomModifiers, i), Util.NullSafeElementAt(optionalCustomModifiers, i)));
- }
- }
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2008 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-
-namespace IKVM.Reflection.Emit
-{
- public struct EventToken
- {
- public static readonly EventToken Empty;
- private readonly int token;
-
- internal EventToken(int token)
- {
- this.token = token;
- }
-
- public int Token
- {
- get { return token; }
- }
-
- public override bool Equals(object obj)
- {
- return obj as EventToken? == this;
- }
-
- public override int GetHashCode()
- {
- return token;
- }
-
- public bool Equals(EventToken other)
- {
- return this == other;
- }
-
- public static bool operator ==(EventToken et1, EventToken et2)
- {
- return et1.token == et2.token;
- }
-
- public static bool operator !=(EventToken et1, EventToken et2)
- {
- return et1.token != et2.token;
- }
- }
-
- public struct FieldToken
- {
- public static readonly FieldToken Empty;
- private readonly int token;
-
- internal FieldToken(int token)
- {
- this.token = token;
- }
-
- internal bool IsPseudoToken
- {
- get { return token < 0; }
- }
-
- public int Token
- {
- get { return token; }
- }
-
- public override bool Equals(object obj)
- {
- return obj as FieldToken? == this;
- }
-
- public override int GetHashCode()
- {
- return token;
- }
-
- public bool Equals(FieldToken other)
- {
- return this == other;
- }
-
- public static bool operator ==(FieldToken ft1, FieldToken ft2)
- {
- return ft1.token == ft2.token;
- }
-
- public static bool operator !=(FieldToken ft1, FieldToken ft2)
- {
- return ft1.token != ft2.token;
- }
- }
-
- public struct MethodToken
- {
- public static readonly MethodToken Empty;
- private readonly int token;
-
- internal MethodToken(int token)
- {
- this.token = token;
- }
-
- internal bool IsPseudoToken
- {
- get { return token < 0; }
- }
-
- public int Token
- {
- get { return token; }
- }
-
- public override bool Equals(object obj)
- {
- return obj as MethodToken? == this;
- }
-
- public override int GetHashCode()
- {
- return token;
- }
-
- public bool Equals(MethodToken other)
- {
- return this == other;
- }
-
- public static bool operator ==(MethodToken mt1, MethodToken mt2)
- {
- return mt1.token == mt2.token;
- }
-
- public static bool operator !=(MethodToken mt1, MethodToken mt2)
- {
- return mt1.token != mt2.token;
- }
- }
-
- public struct SignatureToken
- {
- public static readonly SignatureToken Empty;
- private readonly int token;
-
- internal SignatureToken(int token)
- {
- this.token = token;
- }
-
- public int Token
- {
- get { return token; }
- }
-
- public override bool Equals(object obj)
- {
- return obj as SignatureToken? == this;
- }
-
- public override int GetHashCode()
- {
- return token;
- }
-
- public bool Equals(SignatureToken other)
- {
- return this == other;
- }
-
- public static bool operator ==(SignatureToken st1, SignatureToken st2)
- {
- return st1.token == st2.token;
- }
-
- public static bool operator !=(SignatureToken st1, SignatureToken st2)
- {
- return st1.token != st2.token;
- }
- }
-
- public struct StringToken
- {
- private readonly int token;
-
- internal StringToken(int token)
- {
- this.token = token;
- }
-
- public int Token
- {
- get { return token; }
- }
-
- public override bool Equals(object obj)
- {
- return obj as StringToken? == this;
- }
-
- public override int GetHashCode()
- {
- return token;
- }
-
- public bool Equals(StringToken other)
- {
- return this == other;
- }
-
- public static bool operator ==(StringToken st1, StringToken st2)
- {
- return st1.token == st2.token;
- }
-
- public static bool operator !=(StringToken st1, StringToken st2)
- {
- return st1.token != st2.token;
- }
- }
-
- public struct TypeToken
- {
- public static readonly TypeToken Empty;
- private readonly int token;
-
- internal TypeToken(int token)
- {
- this.token = token;
- }
-
- public int Token
- {
- get { return token; }
- }
-
- public override bool Equals(object obj)
- {
- return obj as TypeToken? == this;
- }
-
- public override int GetHashCode()
- {
- return token;
- }
-
- public bool Equals(TypeToken other)
- {
- return this == other;
- }
-
- public static bool operator ==(TypeToken tt1, TypeToken tt2)
- {
- return tt1.token == tt2.token;
- }
-
- public static bool operator !=(TypeToken tt1, TypeToken tt2)
- {
- return tt1.token != tt2.token;
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2008-2011 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Runtime.InteropServices;
-using IKVM.Reflection.Impl;
-using IKVM.Reflection.Metadata;
-using IKVM.Reflection.Writer;
-
-namespace IKVM.Reflection.Emit
-{
- public sealed class GenericTypeParameterBuilder : TypeInfo
- {
- private readonly string name;
- private readonly TypeBuilder type;
- private readonly MethodBuilder method;
- private readonly int paramPseudoIndex;
- private readonly int position;
- private int typeToken;
- private Type baseType;
- private GenericParameterAttributes attr;
-
- internal GenericTypeParameterBuilder(string name, TypeBuilder type, MethodBuilder method, int position)
- {
- this.name = name;
- this.type = type;
- this.method = method;
- this.position = position;
- GenericParamTable.Record rec = new GenericParamTable.Record();
- rec.Number = (short)position;
- rec.Flags = 0;
- rec.Owner = type != null ? type.MetadataToken : method.MetadataToken;
- rec.Name = this.ModuleBuilder.Strings.Add(name);
- this.paramPseudoIndex = this.ModuleBuilder.GenericParam.AddRecord(rec);
- }
-
- public override string AssemblyQualifiedName
- {
- get { return null; }
- }
-
- public override bool IsValueType
- {
- get { return (this.GenericParameterAttributes & GenericParameterAttributes.NotNullableValueTypeConstraint) != 0; }
- }
-
- public override Type BaseType
- {
- get { return baseType; }
- }
-
- public override Type[] __GetDeclaredInterfaces()
- {
- throw new NotImplementedException();
- }
-
- public override TypeAttributes Attributes
- {
- get { return TypeAttributes.Public; }
- }
-
- public override string Namespace
- {
- get { return DeclaringType.Namespace; }
- }
-
- public override string Name
- {
- get { return name; }
- }
-
- public override string FullName
- {
- get { return null; }
- }
-
- public override string ToString()
- {
- return this.Name;
- }
-
- private ModuleBuilder ModuleBuilder
- {
- get { return type != null ? type.ModuleBuilder : method.ModuleBuilder; }
- }
-
- public override Module Module
- {
- get { return ModuleBuilder; }
- }
-
- public override bool IsGenericParameter
- {
- get { return true; }
- }
-
- public override int GenericParameterPosition
- {
- get { return position; }
- }
-
- public override Type DeclaringType
- {
- get { return type; }
- }
-
- public override MethodBase DeclaringMethod
- {
- get { return method; }
- }
-
- public override Type[] GetGenericParameterConstraints()
- {
- throw new NotImplementedException();
- }
-
- public override GenericParameterAttributes GenericParameterAttributes
- {
- get
- {
- CheckBaked();
- return attr;
- }
- }
-
- internal override void CheckBaked()
- {
- if (type != null)
- {
- type.CheckBaked();
- }
- else
- {
- method.CheckBaked();
- }
- }
-
- private void AddConstraint(Type type)
- {
- GenericParamConstraintTable.Record rec = new GenericParamConstraintTable.Record();
- rec.Owner = paramPseudoIndex;
- rec.Constraint = this.ModuleBuilder.GetTypeTokenForMemberRef(type);
- this.ModuleBuilder.GenericParamConstraint.AddRecord(rec);
- }
-
- public void SetBaseTypeConstraint(Type baseTypeConstraint)
- {
- this.baseType = baseTypeConstraint;
- AddConstraint(baseTypeConstraint);
- }
-
- public void SetInterfaceConstraints(params Type[] interfaceConstraints)
- {
- foreach (Type type in interfaceConstraints)
- {
- AddConstraint(type);
- }
- }
-
- public void SetGenericParameterAttributes(GenericParameterAttributes genericParameterAttributes)
- {
- this.attr = genericParameterAttributes;
- // for now we'll back patch the table
- this.ModuleBuilder.GenericParam.PatchAttribute(paramPseudoIndex, genericParameterAttributes);
- }
-
- public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
- {
- this.ModuleBuilder.SetCustomAttribute((GenericParamTable.Index << 24) | paramPseudoIndex, customBuilder);
- }
-
- public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
- {
- SetCustomAttribute(new CustomAttributeBuilder(con, binaryAttribute));
- }
-
- public override int MetadataToken
- {
- get
- {
- CheckBaked();
- return (GenericParamTable.Index << 24) | paramPseudoIndex;
- }
- }
-
- internal override int GetModuleBuilderToken()
- {
- if (typeToken == 0)
- {
- ByteBuffer spec = new ByteBuffer(5);
- Signature.WriteTypeSpec(this.ModuleBuilder, spec, this);
- typeToken = 0x1B000000 | this.ModuleBuilder.TypeSpec.AddRecord(this.ModuleBuilder.Blobs.Add(spec));
- }
- return typeToken;
- }
-
- internal override Type BindTypeParameters(IGenericBinder binder)
- {
- if (type != null)
- {
- return binder.BindTypeParameter(this);
- }
- else
- {
- return binder.BindMethodParameter(this);
- }
- }
-
- internal override int GetCurrentToken()
- {
- if (this.ModuleBuilder.IsSaved)
- {
- return (GenericParamTable.Index << 24) | this.Module.GenericParam.GetIndexFixup()[paramPseudoIndex - 1] + 1;
- }
- else
- {
- return (GenericParamTable.Index << 24) | paramPseudoIndex;
- }
- }
-
- internal override bool IsBaked
- {
- get { return ((MemberInfo)type ?? method).IsBaked; }
- }
- }
-
- public sealed class TypeBuilder : TypeInfo, ITypeOwner
- {
- public const int UnspecifiedTypeSize = 0;
- private readonly ITypeOwner owner;
- private readonly int token;
- private int extends;
- private Type lazyBaseType; // (lazyBaseType == null && attribs & TypeAttributes.Interface) == 0) => BaseType == System.Object
- private readonly int typeName;
- private readonly int typeNameSpace;
- private readonly string ns;
- private readonly string name;
- private readonly List<MethodBuilder> methods = new List<MethodBuilder>();
- private readonly List<FieldBuilder> fields = new List<FieldBuilder>();
- private List<PropertyBuilder> properties;
- private List<EventBuilder> events;
- private TypeAttributes attribs;
- private GenericTypeParameterBuilder[] gtpb;
- private List<CustomAttributeBuilder> declarativeSecurity;
- private List<Type> interfaces;
- private int size;
- private short pack;
- private bool hasLayout;
-
- internal TypeBuilder(ITypeOwner owner, string ns, string name)
- {
- this.owner = owner;
- this.token = this.ModuleBuilder.TypeDef.AllocToken();
- this.ns = ns;
- this.name = name;
- this.typeNameSpace = ns == null ? 0 : this.ModuleBuilder.Strings.Add(ns);
- this.typeName = this.ModuleBuilder.Strings.Add(name);
- MarkEnumOrValueType(ns, name);
- }
-
- public ConstructorBuilder DefineDefaultConstructor(MethodAttributes attributes)
- {
- ConstructorBuilder cb = DefineConstructor(attributes, CallingConventions.Standard, Type.EmptyTypes);
- ILGenerator ilgen = cb.GetILGenerator();
- ilgen.Emit(OpCodes.Ldarg_0);
- ilgen.Emit(OpCodes.Call, BaseType.GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null));
- ilgen.Emit(OpCodes.Ret);
- return cb;
- }
-
- public ConstructorBuilder DefineConstructor(MethodAttributes attribs, CallingConventions callConv, Type[] parameterTypes)
- {
- return DefineConstructor(attribs, callConv, parameterTypes, null, null);
- }
-
- public ConstructorBuilder DefineConstructor(MethodAttributes attribs, CallingConventions callingConvention, Type[] parameterTypes, Type[][] requiredCustomModifiers, Type[][] optionalCustomModifiers)
- {
- attribs |= MethodAttributes.RTSpecialName | MethodAttributes.SpecialName;
- string name = (attribs & MethodAttributes.Static) == 0 ? ConstructorInfo.ConstructorName : ConstructorInfo.TypeConstructorName;
- MethodBuilder mb = DefineMethod(name, attribs, callingConvention, null, null, null, parameterTypes, requiredCustomModifiers, optionalCustomModifiers);
- return new ConstructorBuilder(mb);
- }
-
- public ConstructorBuilder DefineTypeInitializer()
- {
- MethodBuilder mb = DefineMethod(ConstructorInfo.TypeConstructorName, MethodAttributes.Private | MethodAttributes.Static | MethodAttributes.RTSpecialName | MethodAttributes.SpecialName, null, Type.EmptyTypes);
- return new ConstructorBuilder(mb);
- }
-
- private MethodBuilder CreateMethodBuilder(string name, MethodAttributes attributes, CallingConventions callingConvention)
- {
- this.ModuleBuilder.MethodDef.AddVirtualRecord();
- MethodBuilder mb = new MethodBuilder(this, name, attributes, callingConvention);
- methods.Add(mb);
- return mb;
- }
-
- public MethodBuilder DefineMethod(string name, MethodAttributes attribs)
- {
- return DefineMethod(name, attribs, CallingConventions.Standard);
- }
-
- public MethodBuilder DefineMethod(string name, MethodAttributes attribs, CallingConventions callingConvention)
- {
- return CreateMethodBuilder(name, attribs, callingConvention);
- }
-
- public MethodBuilder DefineMethod(string name, MethodAttributes attribs, Type returnType, Type[] parameterTypes)
- {
- return DefineMethod(name, attribs, CallingConventions.Standard, returnType, null, null, parameterTypes, null, null);
- }
-
- public MethodBuilder DefineMethod(string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes)
- {
- return DefineMethod(name, attributes, callingConvention, returnType, null, null, parameterTypes, null, null);
- }
-
- public MethodBuilder DefineMethod(string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers)
- {
- MethodBuilder mb = CreateMethodBuilder(name, attributes, callingConvention);
- mb.SetSignature(returnType, returnTypeRequiredCustomModifiers, returnTypeOptionalCustomModifiers, parameterTypes, parameterTypeRequiredCustomModifiers, parameterTypeOptionalCustomModifiers);
- return mb;
- }
-
- public MethodBuilder DefinePInvokeMethod(string name, string dllName, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, CallingConvention nativeCallConv, CharSet nativeCharSet)
- {
- return DefinePInvokeMethod(name, dllName, null, attributes, callingConvention, returnType, null, null, parameterTypes, null, null, nativeCallConv, nativeCharSet);
- }
-
- public MethodBuilder DefinePInvokeMethod(string name, string dllName, string entryName, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, CallingConvention nativeCallConv, CharSet nativeCharSet)
- {
- return DefinePInvokeMethod(name, dllName, entryName, attributes, callingConvention, returnType, null, null, parameterTypes, null, null, nativeCallConv, nativeCharSet);
- }
-
- public MethodBuilder DefinePInvokeMethod(string name, string dllName, string entryName, MethodAttributes attributes, CallingConventions callingConvention,
- Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers,
- Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers,
- CallingConvention nativeCallConv, CharSet nativeCharSet)
- {
- MethodBuilder mb = DefineMethod(name, attributes | MethodAttributes.PinvokeImpl, callingConvention,
- returnType, returnTypeRequiredCustomModifiers, returnTypeOptionalCustomModifiers,
- parameterTypes, parameterTypeRequiredCustomModifiers, parameterTypeOptionalCustomModifiers);
- mb.SetDllImportPseudoCustomAttribute(dllName, entryName, nativeCallConv, nativeCharSet, null, null, null, null, null);
- return mb;
- }
-
- public void DefineMethodOverride(MethodInfo methodInfoBody, MethodInfo methodInfoDeclaration)
- {
- MethodImplTable.Record rec = new MethodImplTable.Record();
- rec.Class = token;
- rec.MethodBody = this.ModuleBuilder.GetMethodToken(methodInfoBody).Token;
- rec.MethodDeclaration = this.ModuleBuilder.GetMethodTokenWinRT(methodInfoDeclaration);
- this.ModuleBuilder.MethodImpl.AddRecord(rec);
- }
-
- public FieldBuilder DefineField(string name, Type fieldType, FieldAttributes attribs)
- {
- return DefineField(name, fieldType, null, null, attribs);
- }
-
- public FieldBuilder DefineField(string fieldName, Type type, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers, FieldAttributes attributes)
- {
- return __DefineField(fieldName, type, CustomModifiers.FromReqOpt(requiredCustomModifiers, optionalCustomModifiers), attributes);
- }
-
- public FieldBuilder __DefineField(string fieldName, Type type, CustomModifiers customModifiers, FieldAttributes attributes)
- {
- FieldBuilder fb = new FieldBuilder(this, fieldName, type, customModifiers, attributes);
- fields.Add(fb);
- return fb;
- }
-
- public PropertyBuilder DefineProperty(string name, PropertyAttributes attributes, Type returnType, Type[] parameterTypes)
- {
- return DefineProperty(name, attributes, returnType, null, null, parameterTypes, null, null);
- }
-
- public PropertyBuilder DefineProperty(string name, PropertyAttributes attributes, Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers,
- Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers)
- {
- return DefinePropertyImpl(name, attributes, CallingConventions.Standard, true, returnType, parameterTypes,
- PackedCustomModifiers.CreateFromExternal(returnTypeOptionalCustomModifiers, returnTypeRequiredCustomModifiers, parameterTypeOptionalCustomModifiers, parameterTypeRequiredCustomModifiers, Util.NullSafeLength(parameterTypes)));
- }
-
- public PropertyBuilder DefineProperty(string name, PropertyAttributes attributes, CallingConventions callingConvention,
- Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers,
- Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers)
- {
- return DefinePropertyImpl(name, attributes, callingConvention, false, returnType, parameterTypes,
- PackedCustomModifiers.CreateFromExternal(returnTypeOptionalCustomModifiers, returnTypeRequiredCustomModifiers, parameterTypeOptionalCustomModifiers, parameterTypeRequiredCustomModifiers, Util.NullSafeLength(parameterTypes)));
- }
-
- public PropertyBuilder __DefineProperty(string name, PropertyAttributes attributes, CallingConventions callingConvention,
- Type returnType, CustomModifiers returnTypeCustomModifiers, Type[] parameterTypes, CustomModifiers[] parameterTypeCustomModifiers)
- {
- return DefinePropertyImpl(name, attributes, callingConvention, false, returnType, parameterTypes,
- PackedCustomModifiers.CreateFromExternal(returnTypeCustomModifiers, parameterTypeCustomModifiers, Util.NullSafeLength(parameterTypes)));
- }
-
- private PropertyBuilder DefinePropertyImpl(string name, PropertyAttributes attributes, CallingConventions callingConvention, bool patchCallingConvention,
- Type returnType, Type[] parameterTypes, PackedCustomModifiers customModifiers)
- {
- if (properties == null)
- {
- properties = new List<PropertyBuilder>();
- }
- PropertySignature sig = PropertySignature.Create(callingConvention, returnType, parameterTypes, customModifiers);
- PropertyBuilder pb = new PropertyBuilder(this, name, attributes, sig, patchCallingConvention);
- properties.Add(pb);
- return pb;
- }
-
- public EventBuilder DefineEvent(string name, EventAttributes attributes, Type eventtype)
- {
- if (events == null)
- {
- events = new List<EventBuilder>();
- }
- EventBuilder eb = new EventBuilder(this, name, attributes, eventtype);
- events.Add(eb);
- return eb;
- }
-
- public TypeBuilder DefineNestedType(string name)
- {
- return DefineNestedType(name, TypeAttributes.Class | TypeAttributes.NestedPrivate);
- }
-
- public TypeBuilder DefineNestedType(string name, TypeAttributes attribs)
- {
- return DefineNestedType(name, attribs, null);
- }
-
- public TypeBuilder DefineNestedType(string name, TypeAttributes attr, Type parent, Type[] interfaces)
- {
- TypeBuilder tb = DefineNestedType(name, attr, parent);
- if (interfaces != null)
- {
- foreach (Type iface in interfaces)
- {
- tb.AddInterfaceImplementation(iface);
- }
- }
- return tb;
- }
-
- public TypeBuilder DefineNestedType(string name, TypeAttributes attr, Type parent)
- {
- return DefineNestedType(name, attr, parent, 0);
- }
-
- public TypeBuilder DefineNestedType(string name, TypeAttributes attr, Type parent, int typeSize)
- {
- return DefineNestedType(name, attr, parent, PackingSize.Unspecified, typeSize);
- }
-
- public TypeBuilder DefineNestedType(string name, TypeAttributes attr, Type parent, PackingSize packSize)
- {
- return DefineNestedType(name, attr, parent, packSize, 0);
- }
-
- private TypeBuilder DefineNestedType(string name, TypeAttributes attr, Type parent, PackingSize packSize, int typeSize)
- {
- string ns = null;
- int lastdot = name.LastIndexOf('.');
- if (lastdot > 0)
- {
- ns = name.Substring(0, lastdot);
- name = name.Substring(lastdot + 1);
- }
- TypeBuilder typeBuilder = __DefineNestedType(ns, name);
- typeBuilder.__SetAttributes(attr);
- typeBuilder.SetParent(parent);
- if (packSize != PackingSize.Unspecified || typeSize != 0)
- {
- typeBuilder.__SetLayout((int)packSize, typeSize);
- }
- return typeBuilder;
- }
-
- public TypeBuilder __DefineNestedType(string ns, string name)
- {
- this.typeFlags |= TypeFlags.HasNestedTypes;
- TypeBuilder typeBuilder = this.ModuleBuilder.DefineType(this, ns, name);
- NestedClassTable.Record rec = new NestedClassTable.Record();
- rec.NestedClass = typeBuilder.MetadataToken;
- rec.EnclosingClass = this.MetadataToken;
- this.ModuleBuilder.NestedClass.AddRecord(rec);
- return typeBuilder;
- }
-
- public void SetParent(Type parent)
- {
- lazyBaseType = parent;
- }
-
- public void AddInterfaceImplementation(Type interfaceType)
- {
- if (interfaces == null)
- {
- interfaces = new List<Type>();
- }
- interfaces.Add(interfaceType);
- }
-
- public void __SetInterfaceImplementationCustomAttribute(Type interfaceType, CustomAttributeBuilder cab)
- {
- this.ModuleBuilder.SetInterfaceImplementationCustomAttribute(this, interfaceType, cab);
- }
-
- public int Size
- {
- get { return size; }
- }
-
- public PackingSize PackingSize
- {
- get { return (PackingSize)pack; }
- }
-
- public override bool __GetLayout(out int packingSize, out int typeSize)
- {
- packingSize = this.pack;
- typeSize = this.size;
- return hasLayout;
- }
-
- public void __SetLayout(int packingSize, int typesize)
- {
- this.pack = (short)packingSize;
- this.size = typesize;
- this.hasLayout = true;
- }
-
- private void SetStructLayoutPseudoCustomAttribute(CustomAttributeBuilder customBuilder)
- {
- object val = customBuilder.GetConstructorArgument(0);
- LayoutKind layout;
- if (val is short)
- {
- layout = (LayoutKind)(short)val;
- }
- else
- {
- layout = (LayoutKind)val;
- }
- StructLayoutAttribute attr = new StructLayoutAttribute(layout);
- attr.Pack = (int?)customBuilder.GetFieldValue("Pack") ?? 0;
- attr.Size = (int?)customBuilder.GetFieldValue("Size") ?? 0;
- attr.CharSet = customBuilder.GetFieldValue<CharSet>("CharSet") ?? CharSet.None;
- attribs &= ~TypeAttributes.LayoutMask;
- switch (attr.Value)
- {
- case LayoutKind.Auto:
- attribs |= TypeAttributes.AutoLayout;
- break;
- case LayoutKind.Explicit:
- attribs |= TypeAttributes.ExplicitLayout;
- break;
- case LayoutKind.Sequential:
- attribs |= TypeAttributes.SequentialLayout;
- break;
- }
- attribs &= ~TypeAttributes.StringFormatMask;
- switch (attr.CharSet)
- {
- case CharSet.None:
- case CharSet.Ansi:
- attribs |= TypeAttributes.AnsiClass;
- break;
- case CharSet.Auto:
- attribs |= TypeAttributes.AutoClass;
- break;
- case CharSet.Unicode:
- attribs |= TypeAttributes.UnicodeClass;
- break;
- }
- pack = (short)attr.Pack;
- size = attr.Size;
- hasLayout = pack != 0 || size != 0;
- }
-
- public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
- {
- SetCustomAttribute(new CustomAttributeBuilder(con, binaryAttribute));
- }
-
- public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
- {
- Universe u = this.ModuleBuilder.universe;
- Type type = customBuilder.Constructor.DeclaringType;
- if (type == u.System_Runtime_InteropServices_StructLayoutAttribute)
- {
- SetStructLayoutPseudoCustomAttribute(customBuilder.DecodeBlob(this.Assembly));
- }
- else if (type == u.System_SerializableAttribute)
- {
- attribs |= TypeAttributes.Serializable;
- }
- else if (type == u.System_Runtime_InteropServices_ComImportAttribute)
- {
- attribs |= TypeAttributes.Import;
- }
- else if (type == u.System_Runtime_CompilerServices_SpecialNameAttribute)
- {
- attribs |= TypeAttributes.SpecialName;
- }
- else
- {
- if (type == u.System_Security_SuppressUnmanagedCodeSecurityAttribute)
- {
- attribs |= TypeAttributes.HasSecurity;
- }
- this.ModuleBuilder.SetCustomAttribute(token, customBuilder);
- }
- }
-
- public void __AddDeclarativeSecurity(CustomAttributeBuilder customBuilder)
- {
- attribs |= TypeAttributes.HasSecurity;
- if (declarativeSecurity == null)
- {
- declarativeSecurity = new List<CustomAttributeBuilder>();
- }
- declarativeSecurity.Add(customBuilder);
- }
-
- public void AddDeclarativeSecurity(System.Security.Permissions.SecurityAction securityAction, System.Security.PermissionSet permissionSet)
- {
- this.ModuleBuilder.AddDeclarativeSecurity(token, securityAction, permissionSet);
- this.attribs |= TypeAttributes.HasSecurity;
- }
-
- public GenericTypeParameterBuilder[] DefineGenericParameters(params string[] names)
- {
- typeFlags |= TypeFlags.IsGenericTypeDefinition;
- gtpb = new GenericTypeParameterBuilder[names.Length];
- for (int i = 0; i < names.Length; i++)
- {
- gtpb[i] = new GenericTypeParameterBuilder(names[i], this, null, i);
- }
- return (GenericTypeParameterBuilder[])gtpb.Clone();
- }
-
- public override Type[] GetGenericArguments()
- {
- return Util.Copy(gtpb);
- }
-
- public override CustomModifiers[] __GetGenericArgumentsCustomModifiers()
- {
- return gtpb == null ? Empty<CustomModifiers>.Array : new CustomModifiers[gtpb.Length];
- }
-
- internal override Type GetGenericTypeArgument(int index)
- {
- return gtpb[index];
- }
-
- public override bool ContainsGenericParameters
- {
- get { return gtpb != null; }
- }
-
- public override Type GetGenericTypeDefinition()
- {
- return this;
- }
-
- public Type CreateType()
- {
- if ((typeFlags & TypeFlags.Baked) != 0)
- {
- // .NET allows multiple invocations (subsequent invocations return the same baked type)
- throw new NotImplementedException();
- }
- typeFlags |= TypeFlags.Baked;
- if (hasLayout)
- {
- ClassLayoutTable.Record rec = new ClassLayoutTable.Record();
- rec.PackingSize = pack;
- rec.ClassSize = size;
- rec.Parent = token;
- this.ModuleBuilder.ClassLayout.AddRecord(rec);
- }
- bool hasConstructor = false;
- foreach (MethodBuilder mb in methods)
- {
- hasConstructor |= mb.IsSpecialName && mb.Name == ConstructorInfo.ConstructorName;
- mb.Bake();
- }
- if (!hasConstructor && !IsModulePseudoType && !IsInterface && !IsValueType && !(IsAbstract && IsSealed))
- {
- ((MethodBuilder)DefineDefaultConstructor(MethodAttributes.Public).GetMethodInfo()).Bake();
- }
- if (declarativeSecurity != null)
- {
- this.ModuleBuilder.AddDeclarativeSecurity(token, declarativeSecurity);
- }
- if (!IsModulePseudoType)
- {
- Type baseType = this.BaseType;
- if (baseType != null)
- {
- extends = this.ModuleBuilder.GetTypeToken(baseType).Token;
- }
- }
- if (interfaces != null)
- {
- foreach (Type interfaceType in interfaces)
- {
- InterfaceImplTable.Record rec = new InterfaceImplTable.Record();
- rec.Class = token;
- rec.Interface = this.ModuleBuilder.GetTypeToken(interfaceType).Token;
- this.ModuleBuilder.InterfaceImpl.AddRecord(rec);
- }
- }
- return new BakedType(this);
- }
-
- internal void PopulatePropertyAndEventTables()
- {
- if (properties != null)
- {
- PropertyMapTable.Record rec = new PropertyMapTable.Record();
- rec.Parent = token;
- rec.PropertyList = this.ModuleBuilder.Property.RowCount + 1;
- this.ModuleBuilder.PropertyMap.AddRecord(rec);
- foreach (PropertyBuilder pb in properties)
- {
- pb.Bake();
- }
- }
- if (events != null)
- {
- EventMapTable.Record rec = new EventMapTable.Record();
- rec.Parent = token;
- rec.EventList = this.ModuleBuilder.Event.RowCount + 1;
- this.ModuleBuilder.EventMap.AddRecord(rec);
- foreach (EventBuilder eb in events)
- {
- eb.Bake();
- }
- }
- }
-
- public override Type BaseType
- {
- get
- {
- if (lazyBaseType == null && !IsInterface)
- {
- Type obj = Module.universe.System_Object;
- if (this != obj)
- {
- lazyBaseType = obj;
- }
- }
- return lazyBaseType;
- }
- }
-
- public override string FullName
- {
- get
- {
- if (this.IsNested)
- {
- return this.DeclaringType.FullName + "+" + TypeNameParser.Escape(name);
- }
- if (ns == null)
- {
- return TypeNameParser.Escape(name);
- }
- else
- {
- return TypeNameParser.Escape(ns) + "." + TypeNameParser.Escape(name);
- }
- }
- }
-
- public override string __Name
- {
- get { return name; }
- }
-
- public override string __Namespace
- {
- get { return ns; }
- }
-
- public override string Name
- {
- // FXBUG for a TypeBuilder the name is not escaped
- get { return name; }
- }
-
- public override string Namespace
- {
- get
- {
- // for some reason, TypeBuilder doesn't return null (and mcs depends on this)
- // note also that we don't return the declaring type namespace for nested types
- return ns ?? "";
- }
- }
-
- public override TypeAttributes Attributes
- {
- get { return attribs; }
- }
-
- public void __SetAttributes(TypeAttributes attributes)
- {
- this.attribs = attributes;
- }
-
- public override Type[] __GetDeclaredInterfaces()
- {
- return Util.ToArray(interfaces, Type.EmptyTypes);
- }
-
- public override MethodBase[] __GetDeclaredMethods()
- {
- MethodBase[] methods = new MethodBase[this.methods.Count];
- for (int i = 0; i < methods.Length; i++)
- {
- MethodBuilder mb = this.methods[i];
- if (mb.IsConstructor)
- {
- methods[i] = new ConstructorInfoImpl(mb);
- }
- else
- {
- methods[i] = mb;
- }
- }
- return methods;
- }
-
- public override StructLayoutAttribute StructLayoutAttribute
- {
- get
- {
- LayoutKind layout;
- switch (attribs & TypeAttributes.LayoutMask)
- {
- case TypeAttributes.ExplicitLayout:
- layout = LayoutKind.Explicit;
- break;
- case TypeAttributes.SequentialLayout:
- layout = LayoutKind.Sequential;
- break;
- default:
- layout = LayoutKind.Auto;
- break;
- }
- StructLayoutAttribute attr = new StructLayoutAttribute(layout);
- attr.Pack = (ushort)pack;
- attr.Size = size;
- switch (attribs & TypeAttributes.StringFormatMask)
- {
- case TypeAttributes.AutoClass:
- attr.CharSet = CharSet.Auto;
- break;
- case TypeAttributes.UnicodeClass:
- attr.CharSet = CharSet.Unicode;
- break;
- case TypeAttributes.AnsiClass:
- attr.CharSet = CharSet.Ansi;
- break;
- default:
- attr.CharSet = CharSet.None;
- break;
- }
- return attr;
- }
- }
-
- public override Type DeclaringType
- {
- get { return owner as TypeBuilder; }
- }
-
- public override bool IsGenericType
- {
- get { return IsGenericTypeDefinition; }
- }
-
- public override bool IsGenericTypeDefinition
- {
- get { return (typeFlags & TypeFlags.IsGenericTypeDefinition) != 0; }
- }
-
- public override int MetadataToken
- {
- get { return token; }
- }
-
- public FieldBuilder DefineUninitializedData(string name, int size, FieldAttributes attributes)
- {
- return DefineInitializedData(name, new byte[size], attributes);
- }
-
- public FieldBuilder DefineInitializedData(string name, byte[] data, FieldAttributes attributes)
- {
- Type fieldType = this.ModuleBuilder.GetType("$ArrayType$" + data.Length);
- if (fieldType == null)
- {
- TypeBuilder tb = this.ModuleBuilder.DefineType("$ArrayType$" + data.Length, TypeAttributes.Public | TypeAttributes.Sealed | TypeAttributes.ExplicitLayout, this.Module.universe.System_ValueType, PackingSize.Size1, data.Length);
- tb.CreateType();
- fieldType = tb;
- }
- FieldBuilder fb = DefineField(name, fieldType, attributes | FieldAttributes.Static);
- fb.__SetDataAndRVA(data);
- return fb;
- }
-
- public static MethodInfo GetMethod(Type type, MethodInfo method)
- {
- return new GenericMethodInstance(type, method, null);
- }
-
- public static ConstructorInfo GetConstructor(Type type, ConstructorInfo constructor)
- {
- return new ConstructorInfoImpl(GetMethod(type, constructor.GetMethodInfo()));
- }
-
- public static FieldInfo GetField(Type type, FieldInfo field)
- {
- return new GenericFieldInstance(type, field);
- }
-
- public override Module Module
- {
- get { return owner.ModuleBuilder; }
- }
-
- public TypeToken TypeToken
- {
- get { return new TypeToken(token); }
- }
-
- internal void WriteTypeDefRecord(MetadataWriter mw, ref int fieldList, ref int methodList)
- {
- mw.Write((int)attribs);
- mw.WriteStringIndex(typeName);
- mw.WriteStringIndex(typeNameSpace);
- mw.WriteTypeDefOrRef(extends);
- mw.WriteField(fieldList);
- mw.WriteMethodDef(methodList);
- methodList += methods.Count;
- fieldList += fields.Count;
- }
-
- internal void WriteMethodDefRecords(int baseRVA, MetadataWriter mw, ref int paramList)
- {
- foreach (MethodBuilder mb in methods)
- {
- mb.WriteMethodDefRecord(baseRVA, mw, ref paramList);
- }
- }
-
- internal void ResolveMethodAndFieldTokens(ref int methodToken, ref int fieldToken, ref int parameterToken)
- {
- foreach (MethodBuilder method in methods)
- {
- method.FixupToken(methodToken++, ref parameterToken);
- }
- foreach (FieldBuilder field in fields)
- {
- field.FixupToken(fieldToken++);
- }
- }
-
- internal void WriteParamRecords(MetadataWriter mw)
- {
- foreach (MethodBuilder mb in methods)
- {
- mb.WriteParamRecords(mw);
- }
- }
-
- internal void WriteFieldRecords(MetadataWriter mw)
- {
- foreach (FieldBuilder fb in fields)
- {
- fb.WriteFieldRecords(mw);
- }
- }
-
- internal ModuleBuilder ModuleBuilder
- {
- get { return owner.ModuleBuilder; }
- }
-
- ModuleBuilder ITypeOwner.ModuleBuilder
- {
- get { return owner.ModuleBuilder; }
- }
-
- internal override int GetModuleBuilderToken()
- {
- return token;
- }
-
- internal bool HasNestedTypes
- {
- get { return (typeFlags & TypeFlags.HasNestedTypes) != 0; }
- }
-
- // helper for ModuleBuilder.ResolveMethod()
- internal MethodBase LookupMethod(int token)
- {
- foreach (MethodBuilder method in methods)
- {
- if (method.MetadataToken == token)
- {
- return method;
- }
- }
- return null;
- }
-
- public bool IsCreated()
- {
- return (typeFlags & TypeFlags.Baked) != 0;
- }
-
- internal override void CheckBaked()
- {
- if ((typeFlags & TypeFlags.Baked) == 0)
- {
- throw new NotSupportedException();
- }
- }
-
- public override Type[] __GetDeclaredTypes()
- {
- if (this.HasNestedTypes)
- {
- List<Type> types = new List<Type>();
- List<int> classes = this.ModuleBuilder.NestedClass.GetNestedClasses(token);
- foreach (int nestedClass in classes)
- {
- types.Add(this.ModuleBuilder.ResolveType(nestedClass));
- }
- return types.ToArray();
- }
- else
- {
- return Type.EmptyTypes;
- }
- }
-
- public override FieldInfo[] __GetDeclaredFields()
- {
- return Util.ToArray(fields, Empty<FieldInfo>.Array);
- }
-
- public override EventInfo[] __GetDeclaredEvents()
- {
- return Util.ToArray(events, Empty<EventInfo>.Array);
- }
-
- public override PropertyInfo[] __GetDeclaredProperties()
- {
- return Util.ToArray(properties, Empty<PropertyInfo>.Array);
- }
-
- internal override bool IsModulePseudoType
- {
- get { return token == 0x02000001; }
- }
-
- internal override bool IsBaked
- {
- get { return IsCreated(); }
- }
- }
-
- sealed class BakedType : TypeInfo
- {
- internal BakedType(TypeBuilder typeBuilder)
- : base(typeBuilder)
- {
- }
-
- public override string AssemblyQualifiedName
- {
- get { return underlyingType.AssemblyQualifiedName; }
- }
-
- public override Type BaseType
- {
- get { return underlyingType.BaseType; }
- }
-
- public override string __Name
- {
- get { return underlyingType.__Name; }
- }
-
- public override string __Namespace
- {
- get { return underlyingType.__Namespace; }
- }
-
- public override string Name
- {
- // we need to escape here, because TypeBuilder.Name does not escape
- get { return TypeNameParser.Escape(underlyingType.__Name); }
- }
-
- public override string FullName
- {
- get { return GetFullName(); }
- }
-
- public override TypeAttributes Attributes
- {
- get { return underlyingType.Attributes; }
- }
-
- public override Type[] __GetDeclaredInterfaces()
- {
- return underlyingType.__GetDeclaredInterfaces();
- }
-
- public override MethodBase[] __GetDeclaredMethods()
- {
- return underlyingType.__GetDeclaredMethods();
- }
-
- public override __MethodImplMap __GetMethodImplMap()
- {
- return underlyingType.__GetMethodImplMap();
- }
-
- public override FieldInfo[] __GetDeclaredFields()
- {
- return underlyingType.__GetDeclaredFields();
- }
-
- public override EventInfo[] __GetDeclaredEvents()
- {
- return underlyingType.__GetDeclaredEvents();
- }
-
- public override PropertyInfo[] __GetDeclaredProperties()
- {
- return underlyingType.__GetDeclaredProperties();
- }
-
- public override Type[] __GetDeclaredTypes()
- {
- return underlyingType.__GetDeclaredTypes();
- }
-
- public override Type DeclaringType
- {
- get { return underlyingType.DeclaringType; }
- }
-
- public override StructLayoutAttribute StructLayoutAttribute
- {
- get { return underlyingType.StructLayoutAttribute; }
- }
-
- public override Type[] GetGenericArguments()
- {
- return underlyingType.GetGenericArguments();
- }
-
- internal override Type GetGenericTypeArgument(int index)
- {
- return underlyingType.GetGenericTypeArgument(index);
- }
-
- public override CustomModifiers[] __GetGenericArgumentsCustomModifiers()
- {
- return underlyingType.__GetGenericArgumentsCustomModifiers();
- }
-
- public override bool IsGenericType
- {
- get { return underlyingType.IsGenericType; }
- }
-
- public override bool IsGenericTypeDefinition
- {
- get { return underlyingType.IsGenericTypeDefinition; }
- }
-
- public override bool ContainsGenericParameters
- {
- get { return underlyingType.ContainsGenericParameters; }
- }
-
- public override int MetadataToken
- {
- get { return underlyingType.MetadataToken; }
- }
-
- public override Module Module
- {
- get { return underlyingType.Module; }
- }
-
- internal override int GetModuleBuilderToken()
- {
- return underlyingType.GetModuleBuilderToken();
- }
-
- internal override bool IsBaked
- {
- get { return true; }
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009-2012 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-
-namespace IKVM.Reflection
-{
- [Flags]
- public enum AssemblyNameFlags
- {
- None = 0,
- PublicKey = 1,
- Retargetable = 256,
- EnableJITcompileOptimizer = 16384,
- EnableJITcompileTracking = 32768,
- }
-
- public enum AssemblyContentType
- {
- Default = 0,
- WindowsRuntime = 1,
- }
-
- [Flags]
- public enum BindingFlags
- {
- Default = 0,
- IgnoreCase = 1,
- DeclaredOnly = 2,
- Instance = 4,
- Static = 8,
- Public = 16,
- NonPublic = 32,
- FlattenHierarchy = 64,
- }
-
- [Flags]
- public enum CallingConventions
- {
- Standard = 1,
- VarArgs = 2,
- Any = 3,
- HasThis = 32,
- ExplicitThis = 64,
- }
-
- [Flags]
- public enum EventAttributes
- {
- None = 0,
- SpecialName = 512,
- RTSpecialName = 1024,
- ReservedMask = 1024,
- }
-
- [Flags]
- public enum FieldAttributes
- {
- PrivateScope = 0,
- Private = 1,
- FamANDAssem = 2,
- Assembly = 3,
- Family = 4,
- FamORAssem = 5,
- Public = 6,
- FieldAccessMask = 7,
- Static = 16,
- InitOnly = 32,
- Literal = 64,
- NotSerialized = 128,
- HasFieldRVA = 256,
- SpecialName = 512,
- RTSpecialName = 1024,
- HasFieldMarshal = 4096,
- PinvokeImpl = 8192,
- HasDefault = 32768,
- ReservedMask = 38144,
- }
-
- [Flags]
- public enum GenericParameterAttributes
- {
- None = 0,
- Covariant = 1,
- Contravariant = 2,
- VarianceMask = 3,
- ReferenceTypeConstraint = 4,
- NotNullableValueTypeConstraint = 8,
- DefaultConstructorConstraint = 16,
- SpecialConstraintMask = 28,
- }
-
- public enum ImageFileMachine
- {
- I386 = 332,
- ARM = 452,
- IA64 = 512,
- AMD64 = 34404,
- }
-
- [FlagsAttribute]
- public enum MemberTypes
- {
- Constructor = 0x01,
- Event = 0x02,
- Field = 0x04,
- Method = 0x08,
- Property = 0x10,
- TypeInfo = 0x20,
- Custom = 0x40,
- NestedType = 0x80,
- All = Constructor | Event | Field | Method | Property | TypeInfo | NestedType
- }
-
- [Flags]
- public enum MethodAttributes
- {
- MemberAccessMask = 0x0007,
- PrivateScope = 0x0000,
- Private = 0x0001,
- FamANDAssem = 0x0002,
- Assembly = 0x0003,
- Family = 0x0004,
- FamORAssem = 0x0005,
- Public = 0x0006,
- Static = 0x0010,
- Final = 0x0020,
- Virtual = 0x0040,
- HideBySig = 0x0080,
- VtableLayoutMask = 0x0100,
- ReuseSlot = 0x0000,
- NewSlot = 0x0100,
- CheckAccessOnOverride = 0x0200,
- Abstract = 0x0400,
- SpecialName = 0x0800,
-
- PinvokeImpl = 0x2000,
- UnmanagedExport = 0x0008,
-
- RTSpecialName = 0x1000,
- HasSecurity = 0x4000,
- RequireSecObject = 0x8000,
-
- ReservedMask = 0xd000,
- }
-
- [Flags]
- public enum MethodImplAttributes
- {
- CodeTypeMask = 0x0003,
- IL = 0x0000,
- Native = 0x0001,
- OPTIL = 0x0002,
- Runtime = 0x0003,
- ManagedMask = 0x0004,
- Unmanaged = 0x0004,
- Managed = 0x0000,
-
- ForwardRef = 0x0010,
- PreserveSig = 0x0080,
- InternalCall = 0x1000,
- Synchronized = 0x0020,
- NoInlining = 0x0008,
- NoOptimization = 0x0040,
- AggressiveInlining = 0x0100,
-
- MaxMethodImplVal = 0xffff,
- }
-
- [Flags]
- public enum ParameterAttributes
- {
- None = 0,
- In = 1,
- Out = 2,
- Lcid = 4,
- Retval = 8,
- Optional = 16,
- HasDefault = 4096,
- HasFieldMarshal = 8192,
- Reserved3 = 16384,
- Reserved4 = 32768,
- ReservedMask = 61440,
- }
-
- [Flags]
- public enum PortableExecutableKinds
- {
- NotAPortableExecutableImage = 0,
- ILOnly = 1,
- Required32Bit = 2,
- PE32Plus = 4,
- Unmanaged32Bit = 8,
- Preferred32Bit = 16,
- }
-
- public enum ProcessorArchitecture
- {
- None = 0,
- MSIL = 1,
- X86 = 2,
- IA64 = 3,
- Amd64 = 4,
- Arm = 5,
- // if an item is added here, make sure to update AssemblyName.ProcessorArchitecture and Fusion.ParseAssemblyName as well
- }
-
- [Flags]
- public enum PropertyAttributes
- {
- None = 0,
- SpecialName = 512,
- RTSpecialName = 1024,
- HasDefault = 4096,
- }
-
- [Flags]
- public enum ResourceAttributes
- {
- Public = 1,
- Private = 2,
- }
-
- [Flags]
- public enum ResourceLocation
- {
- Embedded = 1,
- ContainedInAnotherAssembly = 2,
- ContainedInManifestFile = 4,
- }
-
- [Flags]
- public enum TypeAttributes
- {
- AnsiClass = 0,
- Class = 0,
- AutoLayout = 0,
- NotPublic = 0,
- Public = 1,
- NestedPublic = 2,
- NestedPrivate = 3,
- NestedFamily = 4,
- NestedAssembly = 5,
- NestedFamANDAssem = 6,
- VisibilityMask = 7,
- NestedFamORAssem = 7,
- SequentialLayout = 8,
- ExplicitLayout = 16,
- LayoutMask = 24,
- ClassSemanticsMask = 32,
- Interface = 32,
- Abstract = 128,
- Sealed = 256,
- SpecialName = 1024,
- RTSpecialName = 2048,
- Import = 4096,
- Serializable = 8192,
- WindowsRuntime = 16384,
- UnicodeClass = 65536,
- AutoClass = 131072,
- CustomFormatClass = 196608,
- StringFormatMask = 196608,
- HasSecurity = 262144,
- ReservedMask = 264192,
- BeforeFieldInit = 1048576,
- CustomFormatMask = 12582912,
- }
-
- // IKVM.Reflection specific type
- [Flags]
- public enum DllCharacteristics
- {
- HighEntropyVA = 0x0020, // IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA
- DynamicBase = 0x0040, // IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE
- NoSEH = 0x0400, // IMAGE_DLLCHARACTERISTICS_NO_SEH
- NXCompat = 0x0100, // IMAGE_DLLCHARACTERISTICS_NX_COMPAT
- AppContainer = 0x1000, // IMAGE_DLLCHARACTERISTICS_APPCONTAINER
- TerminalServerAware = 0x8000, // IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE
- }
-
- // IKVM.Reflection specific type
- [Flags]
- public enum ImplMapFlags
- {
- NoMangle = 0x0001,
- CharSetMask = 0x0006,
- CharSetNotSpec = 0x0000,
- CharSetAnsi = 0x0002,
- CharSetUnicode = 0x0004,
- CharSetAuto = 0x0006,
- SupportsLastError = 0x0040,
- CallConvMask = 0x0700,
- CallConvWinapi = 0x0100,
- CallConvCdecl = 0x0200,
- CallConvStdcall = 0x0300,
- CallConvThiscall = 0x0400,
- CallConvFastcall = 0x0500,
- // non-standard flags (i.e. CLR specific)
- BestFitOn = 0x0010,
- BestFitOff = 0x0020,
- CharMapErrorOn = 0x1000,
- CharMapErrorOff = 0x2000,
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009-2012 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System.Collections.Generic;
-using System.Diagnostics;
-
-namespace IKVM.Reflection
-{
- public abstract class EventInfo : MemberInfo
- {
- // prevent external subclasses
- internal EventInfo()
- {
- }
-
- public sealed override MemberTypes MemberType
- {
- get { return MemberTypes.Event; }
- }
-
- public abstract EventAttributes Attributes { get; }
- public abstract MethodInfo GetAddMethod(bool nonPublic);
- public abstract MethodInfo GetRaiseMethod(bool nonPublic);
- public abstract MethodInfo GetRemoveMethod(bool nonPublic);
- public abstract MethodInfo[] GetOtherMethods(bool nonPublic);
- public abstract MethodInfo[] __GetMethods();
- public abstract Type EventHandlerType { get; }
- internal abstract bool IsPublic { get; }
- internal abstract bool IsNonPrivate { get; }
- internal abstract bool IsStatic { get; }
-
- public bool IsSpecialName
- {
- get { return (Attributes & EventAttributes.SpecialName) != 0; }
- }
-
- public MethodInfo GetAddMethod()
- {
- return GetAddMethod(false);
- }
-
- public MethodInfo GetRaiseMethod()
- {
- return GetRaiseMethod(false);
- }
-
- public MethodInfo GetRemoveMethod()
- {
- return GetRemoveMethod(false);
- }
-
- public MethodInfo[] GetOtherMethods()
- {
- return GetOtherMethods(false);
- }
-
- internal virtual EventInfo BindTypeParameters(Type type)
- {
- return new GenericEventInfo(this.DeclaringType.BindTypeParameters(type), this);
- }
-
- public override string ToString()
- {
- return this.DeclaringType.ToString() + " " + Name;
- }
-
- internal sealed override bool BindingFlagsMatch(BindingFlags flags)
- {
- return BindingFlagsMatch(IsPublic, flags, BindingFlags.Public, BindingFlags.NonPublic)
- && BindingFlagsMatch(IsStatic, flags, BindingFlags.Static, BindingFlags.Instance);
- }
-
- internal sealed override bool BindingFlagsMatchInherited(BindingFlags flags)
- {
- return IsNonPrivate
- && BindingFlagsMatch(IsPublic, flags, BindingFlags.Public, BindingFlags.NonPublic)
- && BindingFlagsMatch(IsStatic, flags, BindingFlags.Static | BindingFlags.FlattenHierarchy, BindingFlags.Instance);
- }
-
- internal sealed override MemberInfo SetReflectedType(Type type)
- {
- return new EventInfoWithReflectedType(type, this);
- }
-
- internal sealed override List<CustomAttributeData> GetPseudoCustomAttributes(Type attributeType)
- {
- // events don't have pseudo custom attributes
- return null;
- }
- }
-
- sealed class EventInfoWithReflectedType : EventInfo
- {
- private readonly Type reflectedType;
- private readonly EventInfo eventInfo;
-
- internal EventInfoWithReflectedType(Type reflectedType, EventInfo eventInfo)
- {
- Debug.Assert(reflectedType != eventInfo.DeclaringType);
- this.reflectedType = reflectedType;
- this.eventInfo = eventInfo;
- }
-
- public override EventAttributes Attributes
- {
- get { return eventInfo.Attributes; }
- }
-
- public override MethodInfo GetAddMethod(bool nonPublic)
- {
- return SetReflectedType(eventInfo.GetAddMethod(nonPublic), reflectedType);
- }
-
- public override MethodInfo GetRaiseMethod(bool nonPublic)
- {
- return SetReflectedType(eventInfo.GetRaiseMethod(nonPublic), reflectedType);
- }
-
- public override MethodInfo GetRemoveMethod(bool nonPublic)
- {
- return SetReflectedType(eventInfo.GetRemoveMethod(nonPublic), reflectedType);
- }
-
- public override MethodInfo[] GetOtherMethods(bool nonPublic)
- {
- return SetReflectedType(eventInfo.GetOtherMethods(nonPublic), reflectedType);
- }
-
- public override MethodInfo[] __GetMethods()
- {
- return SetReflectedType(eventInfo.__GetMethods(), reflectedType);
- }
-
- public override Type EventHandlerType
- {
- get { return eventInfo.EventHandlerType; }
- }
-
- internal override bool IsPublic
- {
- get { return eventInfo.IsPublic; }
- }
-
- internal override bool IsNonPrivate
- {
- get { return eventInfo.IsNonPrivate; }
- }
-
- internal override bool IsStatic
- {
- get { return eventInfo.IsStatic; }
- }
-
- internal override EventInfo BindTypeParameters(Type type)
- {
- return eventInfo.BindTypeParameters(type);
- }
-
- public override string ToString()
- {
- return eventInfo.ToString();
- }
-
- public override bool __IsMissing
- {
- get { return eventInfo.__IsMissing; }
- }
-
- public override Type DeclaringType
- {
- get { return eventInfo.DeclaringType; }
- }
-
- public override Type ReflectedType
- {
- get { return reflectedType; }
- }
-
- public override bool Equals(object obj)
- {
- EventInfoWithReflectedType other = obj as EventInfoWithReflectedType;
- return other != null
- && other.reflectedType == reflectedType
- && other.eventInfo == eventInfo;
- }
-
- public override int GetHashCode()
- {
- return reflectedType.GetHashCode() ^ eventInfo.GetHashCode();
- }
-
- public override int MetadataToken
- {
- get { return eventInfo.MetadataToken; }
- }
-
- public override Module Module
- {
- get { return eventInfo.Module; }
- }
-
- public override string Name
- {
- get { return eventInfo.Name; }
- }
-
- internal override bool IsBaked
- {
- get { return eventInfo.IsBaked; }
- }
-
- internal override int GetCurrentToken()
- {
- return eventInfo.GetCurrentToken();
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using IKVM.Reflection.Reader;
-
-namespace IKVM.Reflection
-{
- [Flags]
- public enum ExceptionHandlingClauseOptions
- {
- Clause = 0x0000,
- Filter = 0x0001,
- Finally = 0x0002,
- Fault = 0x0004,
- }
-
- public sealed class ExceptionHandlingClause
- {
- private readonly int flags;
- private readonly int tryOffset;
- private readonly int tryLength;
- private readonly int handlerOffset;
- private readonly int handlerLength;
- private readonly Type catchType;
- private readonly int filterOffset;
-
- internal ExceptionHandlingClause(ModuleReader module, int flags, int tryOffset, int tryLength, int handlerOffset, int handlerLength, int classTokenOrfilterOffset, IGenericContext context)
- {
- this.flags = flags;
- this.tryOffset = tryOffset;
- this.tryLength = tryLength;
- this.handlerOffset = handlerOffset;
- this.handlerLength = handlerLength;
- this.catchType = flags == (int)ExceptionHandlingClauseOptions.Clause && classTokenOrfilterOffset != 0 ? module.ResolveType(classTokenOrfilterOffset, context) : null;
- this.filterOffset = flags == (int)ExceptionHandlingClauseOptions.Filter ? classTokenOrfilterOffset : 0;
- }
-
- public Type CatchType
- {
- get { return catchType; }
- }
-
- public int FilterOffset
- {
- get { return filterOffset; }
- }
-
- public ExceptionHandlingClauseOptions Flags
- {
- get { return (ExceptionHandlingClauseOptions)flags; }
- }
-
- public int HandlerLength
- {
- get { return handlerLength; }
- }
-
- public int HandlerOffset
- {
- get { return handlerOffset; }
- }
-
- public int TryLength
- {
- get { return tryLength; }
- }
-
- public int TryOffset
- {
- get { return tryOffset; }
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009-2012 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-
-namespace IKVM.Reflection
-{
- public abstract class FieldInfo : MemberInfo
- {
- // prevent external subclasses
- internal FieldInfo()
- {
- }
-
- public sealed override MemberTypes MemberType
- {
- get { return MemberTypes.Field; }
- }
-
- public abstract FieldAttributes Attributes { get; }
- public abstract void __GetDataFromRVA(byte[] data, int offset, int length);
- public abstract int __FieldRVA { get; }
- public abstract Object GetRawConstantValue();
- internal abstract FieldSignature FieldSignature { get; }
-
- public Type FieldType
- {
- get { return this.FieldSignature.FieldType; }
- }
-
- public CustomModifiers __GetCustomModifiers()
- {
- return this.FieldSignature.GetCustomModifiers();
- }
-
- public Type[] GetOptionalCustomModifiers()
- {
- return __GetCustomModifiers().GetOptional();
- }
-
- public Type[] GetRequiredCustomModifiers()
- {
- return __GetCustomModifiers().GetRequired();
- }
-
- public bool IsStatic
- {
- get { return (Attributes & FieldAttributes.Static) != 0; }
- }
-
- public bool IsLiteral
- {
- get { return (Attributes & FieldAttributes.Literal) != 0; }
- }
-
- public bool IsInitOnly
- {
- get { return (Attributes & FieldAttributes.InitOnly) != 0; }
- }
-
- public bool IsNotSerialized
- {
- get { return (Attributes & FieldAttributes.NotSerialized) != 0; }
- }
-
- public bool IsSpecialName
- {
- get { return (Attributes & FieldAttributes.SpecialName) != 0; }
- }
-
- public bool IsPublic
- {
- get { return (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Public; }
- }
-
- public bool IsPrivate
- {
- get { return (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Private; }
- }
-
- public bool IsFamily
- {
- get { return (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Family; }
- }
-
- public bool IsFamilyOrAssembly
- {
- get { return (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.FamORAssem; }
- }
-
- public bool IsAssembly
- {
- get { return (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Assembly; }
- }
-
- public bool IsFamilyAndAssembly
- {
- get { return (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.FamANDAssem; }
- }
-
- public bool IsPinvokeImpl
- {
- get { return (Attributes & FieldAttributes.PinvokeImpl) != 0; }
- }
-
- public virtual FieldInfo __GetFieldOnTypeDefinition()
- {
- return this;
- }
-
- public abstract bool __TryGetFieldOffset(out int offset);
-
- public bool __TryGetFieldMarshal(out FieldMarshal fieldMarshal)
- {
- return FieldMarshal.ReadFieldMarshal(this.Module, GetCurrentToken(), out fieldMarshal);
- }
-
- internal abstract int ImportTo(Emit.ModuleBuilder module);
-
- internal virtual FieldInfo BindTypeParameters(Type type)
- {
- return new GenericFieldInstance(this.DeclaringType.BindTypeParameters(type), this);
- }
-
- internal sealed override bool BindingFlagsMatch(BindingFlags flags)
- {
- return BindingFlagsMatch(IsPublic, flags, BindingFlags.Public, BindingFlags.NonPublic)
- && BindingFlagsMatch(IsStatic, flags, BindingFlags.Static, BindingFlags.Instance);
- }
-
- internal sealed override bool BindingFlagsMatchInherited(BindingFlags flags)
- {
- return (Attributes & FieldAttributes.FieldAccessMask) > FieldAttributes.Private
- && BindingFlagsMatch(IsPublic, flags, BindingFlags.Public, BindingFlags.NonPublic)
- && BindingFlagsMatch(IsStatic, flags, BindingFlags.Static | BindingFlags.FlattenHierarchy, BindingFlags.Instance);
- }
-
- internal sealed override MemberInfo SetReflectedType(Type type)
- {
- return new FieldInfoWithReflectedType(type, this);
- }
-
- internal sealed override List<CustomAttributeData> GetPseudoCustomAttributes(Type attributeType)
- {
- Module module = this.Module;
- List<CustomAttributeData> list = new List<CustomAttributeData>();
- if (attributeType == null || attributeType.IsAssignableFrom(module.universe.System_Runtime_InteropServices_MarshalAsAttribute))
- {
- FieldMarshal spec;
- if (__TryGetFieldMarshal(out spec))
- {
- list.Add(CustomAttributeData.CreateMarshalAsPseudoCustomAttribute(module, spec));
- }
- }
- if (attributeType == null || attributeType.IsAssignableFrom(module.universe.System_Runtime_InteropServices_FieldOffsetAttribute))
- {
- int offset;
- if (__TryGetFieldOffset(out offset))
- {
- list.Add(CustomAttributeData.CreateFieldOffsetPseudoCustomAttribute(module, offset));
- }
- }
- return list;
- }
- }
-
- sealed class FieldInfoWithReflectedType : FieldInfo
- {
- private readonly Type reflectedType;
- private readonly FieldInfo field;
-
- internal FieldInfoWithReflectedType(Type reflectedType, FieldInfo field)
- {
- Debug.Assert(reflectedType != field.DeclaringType);
- this.reflectedType = reflectedType;
- this.field = field;
- }
-
- public override FieldAttributes Attributes
- {
- get { return field.Attributes; }
- }
-
- public override void __GetDataFromRVA(byte[] data, int offset, int length)
- {
- field.__GetDataFromRVA(data, offset, length);
- }
-
- public override int __FieldRVA
- {
- get { return field.__FieldRVA; }
- }
-
- public override bool __TryGetFieldOffset(out int offset)
- {
- return field.__TryGetFieldOffset(out offset);
- }
-
- public override Object GetRawConstantValue()
- {
- return field.GetRawConstantValue();
- }
-
- internal override FieldSignature FieldSignature
- {
- get { return field.FieldSignature; }
- }
-
- public override FieldInfo __GetFieldOnTypeDefinition()
- {
- return field.__GetFieldOnTypeDefinition();
- }
-
- internal override int ImportTo(Emit.ModuleBuilder module)
- {
- return field.ImportTo(module);
- }
-
- internal override FieldInfo BindTypeParameters(Type type)
- {
- return field.BindTypeParameters(type);
- }
-
- public override bool __IsMissing
- {
- get { return field.__IsMissing; }
- }
-
- public override Type DeclaringType
- {
- get { return field.DeclaringType; }
- }
-
- public override Type ReflectedType
- {
- get { return reflectedType; }
- }
-
- public override bool Equals(object obj)
- {
- FieldInfoWithReflectedType other = obj as FieldInfoWithReflectedType;
- return other != null
- && other.reflectedType == reflectedType
- && other.field == field;
- }
-
- public override int GetHashCode()
- {
- return reflectedType.GetHashCode() ^ field.GetHashCode();
- }
-
- public override int MetadataToken
- {
- get { return field.MetadataToken; }
- }
-
- public override Module Module
- {
- get { return field.Module; }
- }
-
- public override string Name
- {
- get { return field.Name; }
- }
-
- public override string ToString()
- {
- return field.ToString();
- }
-
- internal override int GetCurrentToken()
- {
- return field.GetCurrentToken();
- }
-
- internal override bool IsBaked
- {
- get { return field.IsBaked; }
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Text;
-using IKVM.Reflection.Emit;
-using IKVM.Reflection.Writer;
-using IKVM.Reflection.Reader;
-
-namespace IKVM.Reflection
-{
- sealed class FieldSignature : Signature
- {
- private readonly Type fieldType;
- private readonly CustomModifiers mods;
-
- internal static FieldSignature Create(Type fieldType, CustomModifiers customModifiers)
- {
- return new FieldSignature(fieldType, customModifiers);
- }
-
- private FieldSignature(Type fieldType, CustomModifiers mods)
- {
- this.fieldType = fieldType;
- this.mods = mods;
- }
-
- public override bool Equals(object obj)
- {
- FieldSignature other = obj as FieldSignature;
- return other != null
- && other.fieldType.Equals(fieldType)
- && other.mods.Equals(mods);
- }
-
- public override int GetHashCode()
- {
- return fieldType.GetHashCode() ^ mods.GetHashCode();
- }
-
- internal Type FieldType
- {
- get { return fieldType; }
- }
-
- internal CustomModifiers GetCustomModifiers()
- {
- return mods;
- }
-
- internal FieldSignature ExpandTypeParameters(Type declaringType)
- {
- return new FieldSignature(
- fieldType.BindTypeParameters(declaringType),
- mods.Bind(declaringType));
- }
-
- internal static FieldSignature ReadSig(ModuleReader module, ByteReader br, IGenericContext context)
- {
- if (br.ReadByte() != FIELD)
- {
- throw new BadImageFormatException();
- }
- CustomModifiers mods = CustomModifiers.Read(module, br, context);
- Type fieldType = ReadType(module, br, context);
- return new FieldSignature(fieldType, mods);
- }
-
- internal override void WriteSig(ModuleBuilder module, ByteBuffer bb)
- {
- bb.Write(FIELD);
- WriteCustomModifiers(module, bb, mods);
- WriteType(module, bb, fieldType);
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2010-2012 Jeroen Frijters
- Copyright (C) 2011 Marek Safar
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-
-using System;
-using System.Runtime.InteropServices;
-using System.Text;
-
-namespace IKVM.Reflection
-{
- struct ParsedAssemblyName
- {
- internal string Name;
- internal Version Version;
- internal string Culture;
- internal string PublicKeyToken;
- internal bool? Retargetable;
- internal ProcessorArchitecture ProcessorArchitecture;
- internal bool HasPublicKey;
- internal bool WindowsRuntime;
- }
-
- enum ParseAssemblyResult
- {
- OK,
- GenericError,
- DuplicateKey,
- }
-
- static class Fusion
- {
- internal static bool CompareAssemblyIdentityNative(string assemblyIdentity1, bool unified1, string assemblyIdentity2, bool unified2, out AssemblyComparisonResult result)
- {
- bool equivalent;
- Marshal.ThrowExceptionForHR(CompareAssemblyIdentity(assemblyIdentity1, unified1, assemblyIdentity2, unified2, out equivalent, out result));
- return equivalent;
- }
-
- [DllImport("fusion", CharSet = CharSet.Unicode)]
- private static extern int CompareAssemblyIdentity(string pwzAssemblyIdentity1, bool fUnified1, string pwzAssemblyIdentity2, bool fUnified2, out bool pfEquivalent, out AssemblyComparisonResult pResult);
-
- // internal for use by mcs
- internal static bool CompareAssemblyIdentityPure(string assemblyIdentity1, bool unified1, string assemblyIdentity2, bool unified2, out AssemblyComparisonResult result)
- {
- ParsedAssemblyName name1;
- ParsedAssemblyName name2;
-
- ParseAssemblyResult r = ParseAssemblyName(assemblyIdentity1, out name1);
- if (r != ParseAssemblyResult.OK || (r = ParseAssemblyName(assemblyIdentity2, out name2)) != ParseAssemblyResult.OK)
- {
- result = AssemblyComparisonResult.NonEquivalent;
- switch (r)
- {
- case ParseAssemblyResult.DuplicateKey:
- throw new System.IO.FileLoadException();
- case ParseAssemblyResult.GenericError:
- default:
- throw new ArgumentException();
- }
- }
-
- bool partial = IsPartial(name1);
-
- if ((partial && unified1) || IsPartial(name2))
- {
- result = AssemblyComparisonResult.NonEquivalent;
- throw new ArgumentException();
- }
- if (!name1.Name.Equals(name2.Name, StringComparison.InvariantCultureIgnoreCase))
- {
- result = AssemblyComparisonResult.NonEquivalent;
- return false;
- }
- if (name1.Name.Equals("mscorlib", StringComparison.InvariantCultureIgnoreCase))
- {
- result = AssemblyComparisonResult.EquivalentFullMatch;
- return true;
- }
- if (partial && name1.Culture == null)
- {
- }
- else if (!name1.Culture.Equals(name2.Culture, StringComparison.InvariantCultureIgnoreCase))
- {
- result = AssemblyComparisonResult.NonEquivalent;
- return false;
- }
- if (IsStrongNamed(name2))
- {
- if (partial && name1.PublicKeyToken == null)
- {
- }
- else if (name1.PublicKeyToken != name2.PublicKeyToken)
- {
- result = AssemblyComparisonResult.NonEquivalent;
- return false;
- }
- if (partial && name1.Version == null)
- {
- result = AssemblyComparisonResult.EquivalentPartialMatch;
- return true;
- }
- else if (IsFrameworkAssembly(name2))
- {
- result = partial ? AssemblyComparisonResult.EquivalentPartialFXUnified : AssemblyComparisonResult.EquivalentFXUnified;
- return true;
- }
- else if (name1.Version.Revision == -1 || name2.Version.Revision == -1)
- {
- result = AssemblyComparisonResult.NonEquivalent;
- throw new ArgumentException();
- }
- else if (name1.Version < name2.Version)
- {
- if (unified2)
- {
- result = partial ? AssemblyComparisonResult.EquivalentPartialUnified : AssemblyComparisonResult.EquivalentUnified;
- return true;
- }
- else
- {
- result = partial ? AssemblyComparisonResult.NonEquivalentPartialVersion : AssemblyComparisonResult.NonEquivalentVersion;
- return false;
- }
- }
- else if (name1.Version > name2.Version)
- {
- if (unified1)
- {
- result = partial ? AssemblyComparisonResult.EquivalentPartialUnified : AssemblyComparisonResult.EquivalentUnified;
- return true;
- }
- else
- {
- result = partial ? AssemblyComparisonResult.NonEquivalentPartialVersion : AssemblyComparisonResult.NonEquivalentVersion;
- return false;
- }
- }
- else
- {
- result = partial ? AssemblyComparisonResult.EquivalentPartialMatch : AssemblyComparisonResult.EquivalentFullMatch;
- return true;
- }
- }
- else if (IsStrongNamed(name1))
- {
- result = AssemblyComparisonResult.NonEquivalent;
- return false;
- }
- else
- {
- result = partial ? AssemblyComparisonResult.EquivalentPartialWeakNamed : AssemblyComparisonResult.EquivalentWeakNamed;
- return true;
- }
- }
-
- static bool IsFrameworkAssembly(ParsedAssemblyName name)
- {
- // A list of FX assemblies which require some form of remapping
- // When 4.0 + 1 version is release, assemblies introduced in v4.0
- // will have to be added
- switch (name.Name)
- {
- case "System":
- case "System.Core":
- case "System.Data":
- case "System.Data.DataSetExtensions":
- case "System.Data.Linq":
- case "System.Data.OracleClient":
- case "System.Data.Services":
- case "System.Data.Services.Client":
- case "System.IdentityModel":
- case "System.IdentityModel.Selectors":
- case "System.Runtime.Remoting":
- case "System.Runtime.Serialization":
- case "System.ServiceModel":
- case "System.Transactions":
- case "System.Windows.Forms":
- case "System.Xml":
- case "System.Xml.Linq":
- return name.PublicKeyToken == "b77a5c561934e089";
-
- case "System.Configuration":
- case "System.Configuration.Install":
- case "System.Design":
- case "System.DirectoryServices":
- case "System.Drawing":
- case "System.Drawing.Design":
- case "System.EnterpriseServices":
- case "System.Management":
- case "System.Messaging":
- case "System.Runtime.Serialization.Formatters.Soap":
- case "System.Security":
- case "System.ServiceProcess":
- case "System.Web":
- case "System.Web.Mobile":
- case "System.Web.Services":
- return name.PublicKeyToken == "b03f5f7f11d50a3a";
-
- case "System.ComponentModel.DataAnnotations":
- case "System.ServiceModel.Web":
- case "System.Web.Abstractions":
- case "System.Web.Extensions":
- case "System.Web.Extensions.Design":
- case "System.Web.DynamicData":
- case "System.Web.Routing":
- return name.PublicKeyToken == "31bf3856ad364e35";
- }
-
- return false;
- }
-
- internal static ParseAssemblyResult ParseAssemblySimpleName(string fullName, out int pos, out string simpleName)
- {
- StringBuilder sb = new StringBuilder();
- pos = 0;
- simpleName = null;
- while (pos < fullName.Length && char.IsWhiteSpace(fullName[pos]))
- {
- pos++;
- }
- char quoteOrComma = ',';
- if (pos < fullName.Length && (fullName[pos] == '\"' || fullName[pos] == '\''))
- {
- quoteOrComma = fullName[pos++];
- }
- while (pos < fullName.Length)
- {
- char ch = fullName[pos++];
- if (ch == '\\')
- {
- if (pos == fullName.Length)
- {
- return ParseAssemblyResult.GenericError;
- }
- ch = fullName[pos++];
- if (ch == '\\')
- {
- return ParseAssemblyResult.GenericError;
- }
- }
- else if (ch == quoteOrComma)
- {
- if (ch != ',')
- {
- while (pos != fullName.Length)
- {
- ch = fullName[pos++];
- if (ch == ',')
- {
- break;
- }
- if (!char.IsWhiteSpace(ch))
- {
- return ParseAssemblyResult.GenericError;
- }
- }
- }
- break;
- }
- else if (ch == '=' || (quoteOrComma == ',' && (ch == '\'' || ch == '"')))
- {
- return ParseAssemblyResult.GenericError;
- }
- sb.Append(ch);
- }
- simpleName = sb.ToString().Trim();
- if (simpleName.Length == 0)
- {
- return ParseAssemblyResult.GenericError;
- }
- if (pos == fullName.Length && fullName[fullName.Length - 1] == ',')
- {
- return ParseAssemblyResult.GenericError;
- }
- return ParseAssemblyResult.OK;
- }
-
- internal static ParseAssemblyResult ParseAssemblyName(string fullName, out ParsedAssemblyName parsedName)
- {
- parsedName = new ParsedAssemblyName();
- int pos;
- ParseAssemblyResult res = ParseAssemblySimpleName(fullName, out pos, out parsedName.Name);
- if (res != ParseAssemblyResult.OK || pos == fullName.Length)
- {
- return res;
- }
- else
- {
- System.Collections.Generic.Dictionary<string, string> unknownAttributes = null;
- bool hasProcessorArchitecture = false;
- bool hasContentType = false;
- string[] parts = fullName.Substring(pos).Split(',');
- for (int i = 0; i < parts.Length; i++)
- {
- string[] kv = parts[i].Split('=');
- if (kv.Length != 2)
- {
- return ParseAssemblyResult.GenericError;
- }
- switch (kv[0].Trim().ToLowerInvariant())
- {
- case "version":
- if (parsedName.Version != null)
- {
- return ParseAssemblyResult.DuplicateKey;
- }
- if (!ParseVersion(kv[1].Trim(), out parsedName.Version))
- {
- return ParseAssemblyResult.GenericError;
- }
- break;
- case "culture":
- if (parsedName.Culture != null)
- {
- return ParseAssemblyResult.DuplicateKey;
- }
- if (!ParseCulture(kv[1].Trim(), out parsedName.Culture))
- {
- return ParseAssemblyResult.GenericError;
- }
- break;
- case "publickeytoken":
- if (parsedName.PublicKeyToken != null)
- {
- return ParseAssemblyResult.DuplicateKey;
- }
- if (!ParsePublicKeyToken(kv[1].Trim(), out parsedName.PublicKeyToken))
- {
- return ParseAssemblyResult.GenericError;
- }
- break;
- case "publickey":
- if (parsedName.PublicKeyToken != null)
- {
- return ParseAssemblyResult.DuplicateKey;
- }
- if (!ParsePublicKey(kv[1].Trim(), out parsedName.PublicKeyToken))
- {
- return ParseAssemblyResult.GenericError;
- }
- parsedName.HasPublicKey = true;
- break;
- case "retargetable":
- if (parsedName.Retargetable.HasValue)
- {
- return ParseAssemblyResult.DuplicateKey;
- }
- switch (kv[1].Trim().ToLowerInvariant())
- {
- case "yes":
- parsedName.Retargetable = true;
- break;
- case "no":
- parsedName.Retargetable = false;
- break;
- default:
- return ParseAssemblyResult.GenericError;
- }
- break;
- case "processorarchitecture":
- if (hasProcessorArchitecture)
- {
- return ParseAssemblyResult.DuplicateKey;
- }
- hasProcessorArchitecture = true;
- switch (kv[1].Trim().ToLowerInvariant())
- {
- case "none":
- parsedName.ProcessorArchitecture = ProcessorArchitecture.None;
- break;
- case "msil":
- parsedName.ProcessorArchitecture = ProcessorArchitecture.MSIL;
- break;
- case "x86":
- parsedName.ProcessorArchitecture = ProcessorArchitecture.X86;
- break;
- case "ia64":
- parsedName.ProcessorArchitecture = ProcessorArchitecture.IA64;
- break;
- case "amd64":
- parsedName.ProcessorArchitecture = ProcessorArchitecture.Amd64;
- break;
- case "arm":
- parsedName.ProcessorArchitecture = ProcessorArchitecture.Arm;
- break;
- default:
- return ParseAssemblyResult.GenericError;
- }
- break;
- case "contenttype":
- if (hasContentType)
- {
- return ParseAssemblyResult.DuplicateKey;
- }
- hasContentType = true;
- if (kv[1].Trim().ToLowerInvariant() != "windowsruntime")
- {
- return ParseAssemblyResult.GenericError;
- }
- parsedName.WindowsRuntime = true;
- break;
- default:
- if (kv[1].Trim() == "")
- {
- return ParseAssemblyResult.GenericError;
- }
- if (unknownAttributes == null)
- {
- unknownAttributes = new System.Collections.Generic.Dictionary<string, string>();
- }
- if (unknownAttributes.ContainsKey(kv[0].Trim().ToLowerInvariant()))
- {
- return ParseAssemblyResult.DuplicateKey;
- }
- unknownAttributes.Add(kv[0].Trim().ToLowerInvariant(), null);
- break;
- }
- }
- }
- return ParseAssemblyResult.OK;
- }
-
- private static bool ParseVersion(string str, out Version version)
- {
- string[] parts = str.Split('.');
- if (parts.Length < 2 || parts.Length > 4)
- {
- version = null;
- ushort dummy;
- // if the version consists of a single integer, it is invalid, but not invalid enough to fail the parse of the whole assembly name
- return parts.Length == 1 && ushort.TryParse(parts[0], System.Globalization.NumberStyles.Integer, null, out dummy);
- }
- if (parts[0] == "" || parts[1] == "")
- {
- // this is a strange scenario, the version is invalid, but not invalid enough to fail the parse of the whole assembly name
- version = null;
- return true;
- }
- ushort major, minor, build = 65535, revision = 65535;
- if (ushort.TryParse(parts[0], System.Globalization.NumberStyles.Integer, null, out major)
- && ushort.TryParse(parts[1], System.Globalization.NumberStyles.Integer, null, out minor)
- && (parts.Length <= 2 || parts[2] == "" || ushort.TryParse(parts[2], System.Globalization.NumberStyles.Integer, null, out build))
- && (parts.Length <= 3 || parts[3] == "" || (parts[2] != "" && ushort.TryParse(parts[3], System.Globalization.NumberStyles.Integer, null, out revision))))
- {
- if (parts.Length == 4 && parts[3] != "" && parts[2] != "")
- {
- version = new Version(major, minor, build, revision);
- }
- else if (parts.Length == 3 && parts[2] != "")
- {
- version = new Version(major, minor, build);
- }
- else
- {
- version = new Version(major, minor);
- }
- return true;
- }
- version = null;
- return false;
- }
-
- private static bool ParseCulture(string str, out string culture)
- {
- if (str == null)
- {
- culture = null;
- return false;
- }
- culture = str;
- return true;
- }
-
- private static bool ParsePublicKeyToken(string str, out string publicKeyToken)
- {
- if (str == null)
- {
- publicKeyToken = null;
- return false;
- }
- publicKeyToken = str.ToLowerInvariant();
- return true;
- }
-
- private static bool ParsePublicKey(string str, out string publicKeyToken)
- {
- if (str == null)
- {
- publicKeyToken = null;
- return false;
- }
- // HACK use AssemblyName to convert PublicKey to PublicKeyToken
- byte[] token = new System.Reflection.AssemblyName("Foo, PublicKey=" + str).GetPublicKeyToken();
- StringBuilder sb = new StringBuilder(token.Length * 2);
- for (int i = 0; i < token.Length; i++)
- {
- sb.AppendFormat("{0:x2}", token[i]);
- }
- publicKeyToken = sb.ToString();
- return true;
- }
-
- private static bool IsPartial(ParsedAssemblyName name)
- {
- return name.Version == null || name.Culture == null || name.PublicKeyToken == null;
- }
-
- private static bool IsStrongNamed(ParsedAssemblyName name)
- {
- return name.PublicKeyToken != null && name.PublicKeyToken != "null";
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009, 2010 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace IKVM.Reflection
-{
- // this represents both generic method instantiations and non-generic methods on generic type instantations
- // (this means that it can be a generic method declaration as well as a generic method instance)
- sealed class GenericMethodInstance : MethodInfo
- {
- private readonly Type declaringType;
- private readonly MethodInfo method;
- private readonly Type[] methodArgs;
- private MethodSignature lazyMethodSignature;
-
- internal GenericMethodInstance(Type declaringType, MethodInfo method, Type[] methodArgs)
- {
- System.Diagnostics.Debug.Assert(!(method is GenericMethodInstance));
- this.declaringType = declaringType;
- this.method = method;
- this.methodArgs = methodArgs;
- }
-
- public override bool Equals(object obj)
- {
- GenericMethodInstance other = obj as GenericMethodInstance;
- return other != null
- && other.method.Equals(method)
- && other.declaringType.Equals(declaringType)
- && Util.ArrayEquals(other.methodArgs, methodArgs);
- }
-
- public override int GetHashCode()
- {
- return declaringType.GetHashCode() * 33 ^ method.GetHashCode() ^ Util.GetHashCode(methodArgs);
- }
-
- public override Type ReturnType
- {
- get { return method.ReturnType.BindTypeParameters(this); }
- }
-
- public override ParameterInfo ReturnParameter
- {
- get { return new GenericParameterInfoImpl(this, method.ReturnParameter); }
- }
-
- public override ParameterInfo[] GetParameters()
- {
- ParameterInfo[] parameters = method.GetParameters();
- for (int i = 0; i < parameters.Length; i++)
- {
- parameters[i] = new GenericParameterInfoImpl(this, parameters[i]);
- }
- return parameters;
- }
-
- internal override int ParameterCount
- {
- get { return method.ParameterCount; }
- }
-
- public override CallingConventions CallingConvention
- {
- get { return method.CallingConvention; }
- }
-
- public override MethodAttributes Attributes
- {
- get { return method.Attributes; }
- }
-
- public override MethodImplAttributes GetMethodImplementationFlags()
- {
- return method.GetMethodImplementationFlags();
- }
-
- public override string Name
- {
- get { return method.Name; }
- }
-
- public override Type DeclaringType
- {
- get { return declaringType.IsModulePseudoType ? null : declaringType; }
- }
-
- public override Module Module
- {
- get { return method.Module; }
- }
-
- public override int MetadataToken
- {
- get { return method.MetadataToken; }
- }
-
- public override MethodBody GetMethodBody()
- {
- IKVM.Reflection.Reader.MethodDefImpl md = method as IKVM.Reflection.Reader.MethodDefImpl;
- if (md != null)
- {
- return md.GetMethodBody(this);
- }
- throw new NotSupportedException();
- }
-
- public override int __MethodRVA
- {
- get { return method.__MethodRVA; }
- }
-
- public override MethodInfo MakeGenericMethod(params Type[] typeArguments)
- {
- return new GenericMethodInstance(declaringType, method, typeArguments);
- }
-
- public override bool IsGenericMethod
- {
- get { return method.IsGenericMethod; }
- }
-
- public override bool IsGenericMethodDefinition
- {
- get { return method.IsGenericMethodDefinition && methodArgs == null; }
- }
-
- public override bool ContainsGenericParameters
- {
- get
- {
- if (declaringType.ContainsGenericParameters)
- {
- return true;
- }
- if (methodArgs != null)
- {
- foreach (Type type in methodArgs)
- {
- if (type.ContainsGenericParameters)
- {
- return true;
- }
- }
- }
- return false;
- }
- }
-
- public override MethodInfo GetGenericMethodDefinition()
- {
- if (this.IsGenericMethod)
- {
- if (this.IsGenericMethodDefinition)
- {
- return this;
- }
- else if (declaringType.IsConstructedGenericType)
- {
- return new GenericMethodInstance(declaringType, method, null);
- }
- else
- {
- return method;
- }
- }
- throw new InvalidOperationException();
- }
-
- public override MethodBase __GetMethodOnTypeDefinition()
- {
- return method;
- }
-
- public override Type[] GetGenericArguments()
- {
- if (methodArgs == null)
- {
- return method.GetGenericArguments();
- }
- else
- {
- return (Type[])methodArgs.Clone();
- }
- }
-
- internal override Type GetGenericMethodArgument(int index)
- {
- if (methodArgs == null)
- {
- return method.GetGenericMethodArgument(index);
- }
- else
- {
- return methodArgs[index];
- }
- }
-
- internal override int GetGenericMethodArgumentCount()
- {
- return method.GetGenericMethodArgumentCount();
- }
-
- internal override MethodInfo GetMethodOnTypeDefinition()
- {
- return method.GetMethodOnTypeDefinition();
- }
-
- internal override int ImportTo(Emit.ModuleBuilder module)
- {
- if (methodArgs == null)
- {
- return module.ImportMethodOrField(declaringType, method.Name, method.MethodSignature);
- }
- else
- {
- return module.ImportMethodSpec(declaringType, method, methodArgs);
- }
- }
-
- internal override MethodSignature MethodSignature
- {
- get { return lazyMethodSignature ?? (lazyMethodSignature = method.MethodSignature.Bind(declaringType, methodArgs)); }
- }
-
- internal override MethodBase BindTypeParameters(Type type)
- {
- System.Diagnostics.Debug.Assert(methodArgs == null);
- return new GenericMethodInstance(declaringType.BindTypeParameters(type), method, null);
- }
-
- internal override bool HasThis
- {
- get { return method.HasThis; }
- }
-
- public override MethodInfo[] __GetMethodImpls()
- {
- MethodInfo[] methods = method.__GetMethodImpls();
- for (int i = 0; i < methods.Length; i++)
- {
- methods[i] = (MethodInfo)methods[i].BindTypeParameters(declaringType);
- }
- return methods;
- }
-
- internal override int GetCurrentToken()
- {
- return method.GetCurrentToken();
- }
-
- internal override bool IsBaked
- {
- get { return method.IsBaked; }
- }
- }
-
- sealed class GenericFieldInstance : FieldInfo
- {
- private readonly Type declaringType;
- private readonly FieldInfo field;
-
- internal GenericFieldInstance(Type declaringType, FieldInfo field)
- {
- this.declaringType = declaringType;
- this.field = field;
- }
-
- public override bool Equals(object obj)
- {
- GenericFieldInstance other = obj as GenericFieldInstance;
- return other != null && other.declaringType.Equals(declaringType) && other.field.Equals(field);
- }
-
- public override int GetHashCode()
- {
- return declaringType.GetHashCode() * 3 ^ field.GetHashCode();
- }
-
- public override FieldAttributes Attributes
- {
- get { return field.Attributes; }
- }
-
- public override string Name
- {
- get { return field.Name; }
- }
-
- public override Type DeclaringType
- {
- get { return declaringType; }
- }
-
- public override Module Module
- {
- get { return declaringType.Module; }
- }
-
- public override int MetadataToken
- {
- get { return field.MetadataToken; }
- }
-
- public override object GetRawConstantValue()
- {
- return field.GetRawConstantValue();
- }
-
- public override void __GetDataFromRVA(byte[] data, int offset, int length)
- {
- field.__GetDataFromRVA(data, offset, length);
- }
-
- public override int __FieldRVA
- {
- get { return field.__FieldRVA; }
- }
-
- public override bool __TryGetFieldOffset(out int offset)
- {
- return field.__TryGetFieldOffset(out offset);
- }
-
- public override FieldInfo __GetFieldOnTypeDefinition()
- {
- return field;
- }
-
- internal override FieldSignature FieldSignature
- {
- get { return field.FieldSignature.ExpandTypeParameters(declaringType); }
- }
-
- internal override int ImportTo(Emit.ModuleBuilder module)
- {
- return module.ImportMethodOrField(declaringType, field.Name, field.FieldSignature);
- }
-
- internal override FieldInfo BindTypeParameters(Type type)
- {
- return new GenericFieldInstance(declaringType.BindTypeParameters(type), field);
- }
-
- internal override int GetCurrentToken()
- {
- return field.GetCurrentToken();
- }
-
- internal override bool IsBaked
- {
- get { return field.IsBaked; }
- }
- }
-
- sealed class GenericParameterInfoImpl : ParameterInfo
- {
- private readonly GenericMethodInstance method;
- private readonly ParameterInfo parameterInfo;
-
- internal GenericParameterInfoImpl(GenericMethodInstance method, ParameterInfo parameterInfo)
- {
- this.method = method;
- this.parameterInfo = parameterInfo;
- }
-
- public override string Name
- {
- get { return parameterInfo.Name; }
- }
-
- public override Type ParameterType
- {
- get { return parameterInfo.ParameterType.BindTypeParameters(method); }
- }
-
- public override ParameterAttributes Attributes
- {
- get { return parameterInfo.Attributes; }
- }
-
- public override int Position
- {
- get { return parameterInfo.Position; }
- }
-
- public override object RawDefaultValue
- {
- get { return parameterInfo.RawDefaultValue; }
- }
-
- public override CustomModifiers __GetCustomModifiers()
- {
- return parameterInfo.__GetCustomModifiers().Bind(method);
- }
-
- public override bool __TryGetFieldMarshal(out FieldMarshal fieldMarshal)
- {
- return parameterInfo.__TryGetFieldMarshal(out fieldMarshal);
- }
-
- public override MemberInfo Member
- {
- get { return method; }
- }
-
- public override int MetadataToken
- {
- get { return parameterInfo.MetadataToken; }
- }
-
- internal override Module Module
- {
- get { return method.Module; }
- }
- }
-
- sealed class GenericPropertyInfo : PropertyInfo
- {
- private readonly Type typeInstance;
- private readonly PropertyInfo property;
-
- internal GenericPropertyInfo(Type typeInstance, PropertyInfo property)
- {
- this.typeInstance = typeInstance;
- this.property = property;
- }
-
- public override bool Equals(object obj)
- {
- GenericPropertyInfo other = obj as GenericPropertyInfo;
- return other != null && other.typeInstance == typeInstance && other.property == property;
- }
-
- public override int GetHashCode()
- {
- return typeInstance.GetHashCode() * 537 + property.GetHashCode();
- }
-
- public override PropertyAttributes Attributes
- {
- get { return property.Attributes; }
- }
-
- public override bool CanRead
- {
- get { return property.CanRead; }
- }
-
- public override bool CanWrite
- {
- get { return property.CanWrite; }
- }
-
- private MethodInfo Wrap(MethodInfo method)
- {
- if (method == null)
- {
- return null;
- }
- return new GenericMethodInstance(typeInstance, method, null);
- }
-
- public override MethodInfo GetGetMethod(bool nonPublic)
- {
- return Wrap(property.GetGetMethod(nonPublic));
- }
-
- public override MethodInfo GetSetMethod(bool nonPublic)
- {
- return Wrap(property.GetSetMethod(nonPublic));
- }
-
- public override MethodInfo[] GetAccessors(bool nonPublic)
- {
- MethodInfo[] accessors = property.GetAccessors(nonPublic);
- for (int i = 0; i < accessors.Length; i++)
- {
- accessors[i] = Wrap(accessors[i]);
- }
- return accessors;
- }
-
- public override object GetRawConstantValue()
- {
- return property.GetRawConstantValue();
- }
-
- internal override bool IsPublic
- {
- get { return property.IsPublic; }
- }
-
- internal override bool IsNonPrivate
- {
- get { return property.IsNonPrivate; }
- }
-
- internal override bool IsStatic
- {
- get { return property.IsStatic; }
- }
-
- internal override PropertySignature PropertySignature
- {
- get { return property.PropertySignature.ExpandTypeParameters(typeInstance); }
- }
-
- public override string Name
- {
- get { return property.Name; }
- }
-
- public override Type DeclaringType
- {
- get { return typeInstance; }
- }
-
- public override Module Module
- {
- get { return typeInstance.Module; }
- }
-
- public override int MetadataToken
- {
- get { return property.MetadataToken; }
- }
-
- internal override PropertyInfo BindTypeParameters(Type type)
- {
- return new GenericPropertyInfo(typeInstance.BindTypeParameters(type), property);
- }
-
- internal override bool IsBaked
- {
- get { return property.IsBaked; }
- }
-
- internal override int GetCurrentToken()
- {
- return property.GetCurrentToken();
- }
- }
-
- sealed class GenericEventInfo : EventInfo
- {
- private readonly Type typeInstance;
- private readonly EventInfo eventInfo;
-
- internal GenericEventInfo(Type typeInstance, EventInfo eventInfo)
- {
- this.typeInstance = typeInstance;
- this.eventInfo = eventInfo;
- }
-
- public override bool Equals(object obj)
- {
- GenericEventInfo other = obj as GenericEventInfo;
- return other != null && other.typeInstance == typeInstance && other.eventInfo == eventInfo;
- }
-
- public override int GetHashCode()
- {
- return typeInstance.GetHashCode() * 777 + eventInfo.GetHashCode();
- }
-
- public override EventAttributes Attributes
- {
- get { return eventInfo.Attributes; }
- }
-
- private MethodInfo Wrap(MethodInfo method)
- {
- if (method == null)
- {
- return null;
- }
- return new GenericMethodInstance(typeInstance, method, null);
- }
-
- public override MethodInfo GetAddMethod(bool nonPublic)
- {
- return Wrap(eventInfo.GetAddMethod(nonPublic));
- }
-
- public override MethodInfo GetRaiseMethod(bool nonPublic)
- {
- return Wrap(eventInfo.GetRaiseMethod(nonPublic));
- }
-
- public override MethodInfo GetRemoveMethod(bool nonPublic)
- {
- return Wrap(eventInfo.GetRemoveMethod(nonPublic));
- }
-
- public override MethodInfo[] GetOtherMethods(bool nonPublic)
- {
- MethodInfo[] others = eventInfo.GetOtherMethods(nonPublic);
- for (int i = 0; i < others.Length; i++)
- {
- others[i] = Wrap(others[i]);
- }
- return others;
- }
-
- public override MethodInfo[] __GetMethods()
- {
- MethodInfo[] others = eventInfo.__GetMethods();
- for (int i = 0; i < others.Length; i++)
- {
- others[i] = Wrap(others[i]);
- }
- return others;
- }
-
- public override Type EventHandlerType
- {
- get { return eventInfo.EventHandlerType.BindTypeParameters(typeInstance); }
- }
-
- public override string Name
- {
- get { return eventInfo.Name; }
- }
-
- public override Type DeclaringType
- {
- get { return typeInstance; }
- }
-
- public override Module Module
- {
- get { return eventInfo.Module; }
- }
-
- public override int MetadataToken
- {
- get { return eventInfo.MetadataToken; }
- }
-
- internal override EventInfo BindTypeParameters(Type type)
- {
- return new GenericEventInfo(typeInstance.BindTypeParameters(type), eventInfo);
- }
-
- internal override bool IsPublic
- {
- get { return eventInfo.IsPublic; }
- }
-
- internal override bool IsNonPrivate
- {
- get { return eventInfo.IsNonPrivate; }
- }
-
- internal override bool IsStatic
- {
- get { return eventInfo.IsStatic; }
- }
-
- internal override bool IsBaked
- {
- get { return eventInfo.IsBaked; }
- }
-
- internal override int GetCurrentToken()
- {
- return eventInfo.GetCurrentToken();
- }
- }
-}
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>9.0.30729</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{4CB170EF-DFE6-4A56-9E1B-A85449E827A7}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>IKVM.Reflection</RootNamespace>
- <AssemblyName>IKVM.Reflection</AssemblyName>
- <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- <TargetFrameworkSubset>
- </TargetFrameworkSubset>
- <SccProjectName>
- </SccProjectName>
- <SccLocalPath>
- </SccLocalPath>
- <SccAuxPath>
- </SccAuxPath>
- <SccProvider>
- </SccProvider>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Compile Include="AmbiguousMatchException.cs" />
- <Compile Include="Assembly.cs" />
- <Compile Include="AssemblyName.cs" />
- <Compile Include="BadImageFormatException.cs" />
- <Compile Include="Binder.cs" />
- <Compile Include="ConstructorInfo.cs" />
- <Compile Include="CustomAttributeData.cs" />
- <Compile Include="CustomAttributeNamedArgument.cs" />
- <Compile Include="CustomAttributeTypedArgument.cs" />
- <Compile Include="CustomModifiers.cs" />
- <Compile Include="Emit\AssemblyBuilder.cs" />
- <Compile Include="Emit\ConstructorBuilder.cs" />
- <Compile Include="Emit\CustomAttributeBuilder.cs" />
- <Compile Include="Emit\CustomModifiersBuilder.cs" />
- <Compile Include="Emit\EnumBuilder.cs" />
- <Compile Include="Emit\Enums.cs" />
- <Compile Include="Emit\EventBuilder.cs" />
- <Compile Include="Emit\FieldBuilder.cs" />
- <Compile Include="Emit\ILGenerator.cs" />
- <Compile Include="Emit\MethodBuilder.cs" />
- <Compile Include="Emit\ModuleBuilder.cs" />
- <Compile Include="Emit\OpCode.cs" />
- <Compile Include="Emit\OpCodes.cs" />
- <Compile Include="Emit\ParameterBuilder.cs" />
- <Compile Include="Emit\PropertyBuilder.cs" />
- <Compile Include="Emit\SignatureHelper.cs" />
- <Compile Include="Emit\Tokens.cs" />
- <Compile Include="Emit\TypeBuilder.cs" />
- <Compile Include="Enums.cs" />
- <Compile Include="EventInfo.cs" />
- <Compile Include="ExceptionHandlingClause.cs" />
- <Compile Include="FieldInfo.cs" />
- <Compile Include="FieldSignature.cs" />
- <Compile Include="Fusion.cs" />
- <Compile Include="GenericWrappers.cs" />
- <Compile Include="Impl\ITypeOwner.cs" />
- <Compile Include="Impl\MdbWriter.cs" />
- <Compile Include="Impl\PdbWriter.cs" />
- <Compile Include="Impl\SymbolSupport.cs" />
- <Compile Include="InterfaceMapping.cs" />
- <Compile Include="LocalVariableInfo.cs" />
- <Compile Include="ManifestResourceInfo.cs" />
- <Compile Include="MarshalSpec.cs" />
- <Compile Include="MemberInfo.cs" />
- <Compile Include="Metadata\CliHeader.cs" />
- <Compile Include="Metadata\MetadataRW.cs" />
- <Compile Include="Metadata\Tables.cs" />
- <Compile Include="MethodBase.cs" />
- <Compile Include="MethodBody.cs" />
- <Compile Include="MethodImplMap.cs" />
- <Compile Include="MethodInfo.cs" />
- <Compile Include="MethodSignature.cs" />
- <Compile Include="Missing.cs" />
- <Compile Include="Module.cs" />
- <Compile Include="ParameterInfo.cs" />
- <Compile Include="ParameterModifier.cs" />
- <Compile Include="PropertyInfo.cs" />
- <Compile Include="PropertySignature.cs" />
- <Compile Include="Reader\AssemblyReader.cs" />
- <Compile Include="Reader\ByteReader.cs" />
- <Compile Include="Reader\EventInfoImpl.cs" />
- <Compile Include="Reader\Field.cs" />
- <Compile Include="Reader\GenericTypeParameter.cs" />
- <Compile Include="Reader\MetadataReader.cs" />
- <Compile Include="Reader\Method.cs" />
- <Compile Include="Reader\ModuleReader.cs" />
- <Compile Include="Reader\PEReader.cs" />
- <Compile Include="Reader\PropertyInfoImpl.cs" />
- <Compile Include="Reader\ResourceModule.cs" />
- <Compile Include="Reader\TypeDefImpl.cs" />
- <Compile Include="Signature.cs" />
- <Compile Include="StandAloneMethodSig.cs" />
- <Compile Include="StrongNameKeyPair.cs" />
- <Compile Include="Type.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="TypeNameParser.cs" />
- <Compile Include="Universe.cs" />
- <Compile Include="Util.cs" />
- <Compile Include="Writer\ByteBuffer.cs" />
- <Compile Include="Writer\Heaps.cs" />
- <Compile Include="Writer\MetadataWriter.cs" />
- <Compile Include="Writer\ModuleWriter.cs" />
- <Compile Include="Writer\PEWriter.cs" />
- <Compile Include="Writer\ResourceSection.cs" />
- <Compile Include="Writer\TextSection.cs" />
- <Compile Include="Writer\VersionInfo.cs" />
- </ItemGroup>
- <ItemGroup>
- <Reference Include="System" />
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
-</Project>
\ No newline at end of file
+++ /dev/null
-/*
- Copyright (C) 2008 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using IKVM.Reflection.Emit;
-
-namespace IKVM.Reflection.Impl
-{
- interface ITypeOwner
- {
- ModuleBuilder ModuleBuilder { get; }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-#if MONO
-using System;
-using System.Collections.Generic;
-using Mono.CompilerServices.SymbolWriter;
-using IKVM.Reflection.Emit;
-
-namespace IKVM.Reflection.Impl
-{
- sealed class Method : IMethodDef
- {
- internal int token;
- internal string name;
- internal SymbolDocumentWriter document;
- internal int[] offsets;
- internal int[] lines;
- internal int[] columns;
- internal List<string> variables = new List<string>();
-
- public string Name
- {
- get { return name; }
- }
-
- public int Token
- {
- get { return token; }
- }
- }
-
- sealed class SymbolDocumentWriter : System.Diagnostics.SymbolStore.ISymbolDocumentWriter
- {
- internal readonly string url;
- internal SourceFileEntry source;
-
- internal SymbolDocumentWriter(string url)
- {
- this.url = url;
- }
-
- public void SetCheckSum(Guid algorithmId, byte[] checkSum)
- {
- }
-
- public void SetSource(byte[] source)
- {
- }
- }
-
- sealed class MdbWriter : ISymbolWriterImpl
- {
- private readonly ModuleBuilder moduleBuilder;
- private readonly Dictionary<int, Method> methods = new Dictionary<int, Method>();
- private readonly Dictionary<string, SymbolDocumentWriter> documents = new Dictionary<string, SymbolDocumentWriter>();
- private Method currentMethod;
-
- internal MdbWriter(ModuleBuilder moduleBuilder)
- {
- this.moduleBuilder = moduleBuilder;
- }
-
- public byte[] GetDebugInfo(ref IMAGE_DEBUG_DIRECTORY idd)
- {
- return Empty<byte>.Array;
- }
-
- public void RemapToken(int oldToken, int newToken)
- {
- if (methods.ContainsKey(oldToken))
- {
- methods[oldToken].token = newToken;
- }
- }
-
- public void Close()
- {
- MonoSymbolWriter writer = new MonoSymbolWriter(moduleBuilder.FullyQualifiedName);
-
- foreach (Method method in methods.Values)
- {
- if (method.document != null)
- {
- if (method.document.source == null)
- {
- method.document.source = new SourceFileEntry(writer.SymbolFile, method.document.url);
- }
- ICompileUnit file = new CompileUnitEntry(writer.SymbolFile, method.document.source);
- SourceMethodBuilder smb = writer.OpenMethod(file, 0, method);
- for (int i = 0; i < method.offsets.Length; i++)
- {
- smb.MarkSequencePoint(method.offsets[i], method.document.source, method.lines[i], method.columns[i], false);
- }
- for (int i = 0; i < method.variables.Count; i++)
- {
- writer.DefineLocalVariable(i, method.variables[i]);
- }
- writer.CloseMethod();
- }
- }
-
- writer.WriteSymbolFile(moduleBuilder.ModuleVersionId);
- }
-
- public System.Diagnostics.SymbolStore.ISymbolDocumentWriter DefineDocument(string url, Guid language, Guid languageVendor, Guid documentType)
- {
- SymbolDocumentWriter writer;
- if (!documents.TryGetValue(url, out writer))
- {
- writer = new SymbolDocumentWriter(url);
- documents.Add(url, writer);
- }
- return writer;
- }
-
- public void OpenMethod(System.Diagnostics.SymbolStore.SymbolToken method)
- {
- throw new NotImplementedException();
- }
-
- public void OpenMethod(System.Diagnostics.SymbolStore.SymbolToken token, MethodBase mb)
- {
- Method method = new Method();
- method.token = token.GetToken();
- method.name = mb.Name;
- methods.Add(token.GetToken(), method);
- currentMethod = method;
- }
-
- public void CloseMethod()
- {
- currentMethod = null;
- }
-
- public void DefineLocalVariable(string name, System.Reflection.FieldAttributes attributes, byte[] signature, System.Diagnostics.SymbolStore.SymAddressKind addrKind, int addr1, int addr2, int addr3, int startOffset, int endOffset)
- {
- }
-
- public void DefineLocalVariable2(string name, FieldAttributes attributes, int signature, System.Diagnostics.SymbolStore.SymAddressKind addrKind, int addr1, int addr2, int addr3, int startOffset, int endOffset)
- {
- currentMethod.variables.Add(name);
- }
-
- public void DefineSequencePoints(System.Diagnostics.SymbolStore.ISymbolDocumentWriter document, int[] offsets, int[] lines, int[] columns, int[] endLines, int[] endColumns)
- {
- currentMethod.document = (SymbolDocumentWriter)document;
- currentMethod.offsets = offsets;
- currentMethod.lines = lines;
- currentMethod.columns = columns;
- }
-
- public void DefineParameter(string name, System.Reflection.ParameterAttributes attributes, int sequence, System.Diagnostics.SymbolStore.SymAddressKind addrKind, int addr1, int addr2, int addr3)
- {
- }
-
- public void DefineField(System.Diagnostics.SymbolStore.SymbolToken parent, string name, System.Reflection.FieldAttributes attributes, byte[] signature, System.Diagnostics.SymbolStore.SymAddressKind addrKind, int addr1, int addr2, int addr3)
- {
- }
-
- public void DefineGlobalVariable(string name, System.Reflection.FieldAttributes attributes, byte[] signature, System.Diagnostics.SymbolStore.SymAddressKind addrKind, int addr1, int addr2, int addr3)
- {
- }
-
- public void OpenNamespace(string name)
- {
- }
-
- public void CloseNamespace()
- {
- }
-
- public void UsingNamespace(string fullName)
- {
- }
-
- public int OpenScope(int startOffset)
- {
- return 0;
- }
-
- public void CloseScope(int endOffset)
- {
- }
-
- public void SetMethodSourceRange(System.Diagnostics.SymbolStore.ISymbolDocumentWriter startDoc, int startLine, int startColumn, System.Diagnostics.SymbolStore.ISymbolDocumentWriter endDoc, int endLine, int endColumn)
- {
- }
-
- public void SetScopeRange(int scopeID, int startOffset, int endOffset)
- {
- }
-
- public void SetSymAttribute(System.Diagnostics.SymbolStore.SymbolToken parent, string name, byte[] data)
- {
- }
-
- public void SetUserEntryPoint(System.Diagnostics.SymbolStore.SymbolToken entryMethod)
- {
- }
-
- public void SetUnderlyingWriter(IntPtr underlyingWriter)
- {
- throw new InvalidOperationException();
- }
-
- public void Initialize(IntPtr emitter, string filename, bool fFullBuild)
- {
- throw new InvalidOperationException();
- }
- }
-}
-#endif // MONO
+++ /dev/null
-/*
- Copyright (C) 2008-2010 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-using System.Diagnostics.SymbolStore;
-using IKVM.Reflection.Emit;
-
-namespace IKVM.Reflection.Impl
-{
- [Guid("7dac8207-d3ae-4c75-9b67-92801a497d44")]
- [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
- [ComImport]
- interface IMetaDataImport
- {
- void PlaceHolder_CloseEnum();
- void PlaceHolder_CountEnum();
- void PlaceHolder_ResetEnum();
- void PlaceHolder_EnumTypeDefs();
- void PlaceHolder_EnumInterfaceImpls();
- void PlaceHolder_EnumTypeRefs();
- void PlaceHolder_FindTypeDefByName();
- void PlaceHolder_GetScopeProps();
- void PlaceHolder_GetModuleFromScope();
-
- void GetTypeDefProps(
- int td, // [IN] TypeDef token for inquiry.
- IntPtr szTypeDef, // [OUT] Put name here.
- int cchTypeDef, // [IN] size of name buffer in wide chars.
- IntPtr pchTypeDef, // [OUT] put size of name (wide chars) here.
- IntPtr pdwTypeDefFlags, // [OUT] Put flags here.
- IntPtr ptkExtends); // [OUT] Put base class TypeDef/TypeRef here.
-
- void PlaceHolder_GetInterfaceImplProps();
- void PlaceHolder_GetTypeRefProps();
- void PlaceHolder_ResolveTypeRef();
- void PlaceHolder_EnumMembers();
- void PlaceHolder_EnumMembersWithName();
- void PlaceHolder_EnumMethods();
- void PlaceHolder_EnumMethodsWithName();
- void PlaceHolder_EnumFields();
- void PlaceHolder_EnumFieldsWithName();
- void PlaceHolder_EnumParams();
- void PlaceHolder_EnumMemberRefs();
- void PlaceHolder_EnumMethodImpls();
- void PlaceHolder_EnumPermissionSets();
- void PlaceHolder_FindMember();
- void PlaceHolder_FindMethod();
- void PlaceHolder_FindField();
- void PlaceHolder_FindMemberRef();
-
- void GetMethodProps(
- int mb, // The method for which to get props.
- IntPtr pClass, // Put method's class here.
- IntPtr szMethod, // Put method's name here.
- int cchMethod, // Size of szMethod buffer in wide chars.
- IntPtr pchMethod, // Put actual size here
- IntPtr pdwAttr, // Put flags here.
- IntPtr ppvSigBlob, // [OUT] point to the blob value of meta data
- IntPtr pcbSigBlob, // [OUT] actual size of signature blob
- IntPtr pulCodeRVA, // [OUT] codeRVA
- IntPtr pdwImplFlags); // [OUT] Impl. Flags
-
- void PlaceHolder_GetMemberRefProps();
- void PlaceHolder_EnumProperties();
- void PlaceHolder_EnumEvents();
- void PlaceHolder_GetEventProps();
- void PlaceHolder_EnumMethodSemantics();
- void PlaceHolder_GetMethodSemantics();
- void PlaceHolder_GetClassLayout();
- void PlaceHolder_GetFieldMarshal();
- void PlaceHolder_GetRVA();
- void PlaceHolder_GetPermissionSetProps();
- void PlaceHolder_GetSigFromToken();
- void PlaceHolder_GetModuleRefProps();
- void PlaceHolder_EnumModuleRefs();
- void PlaceHolder_GetTypeSpecFromToken();
- void PlaceHolder_GetNameFromToken();
- void PlaceHolder_EnumUnresolvedMethods();
- void PlaceHolder_GetUserString();
- void PlaceHolder_GetPinvokeMap();
- void PlaceHolder_EnumSignatures();
- void PlaceHolder_EnumTypeSpecs();
- void PlaceHolder_EnumUserStrings();
- void PlaceHolder_GetParamForMethodIndex();
- void PlaceHolder_EnumCustomAttributes();
- void PlaceHolder_GetCustomAttributeProps();
- void PlaceHolder_FindTypeRef();
- void PlaceHolder_GetMemberProps();
- void PlaceHolder_GetFieldProps();
- void PlaceHolder_GetPropertyProps();
- void PlaceHolder_GetParamProps();
- void PlaceHolder_GetCustomAttributeByName();
- void PlaceHolder_IsValidToken();
-
- void GetNestedClassProps(
- int tdNestedClass, // [IN] NestedClass token.
- IntPtr ptdEnclosingClass); // [OUT] EnclosingClass token.
-
- void PlaceHolder_GetNativeCallConvFromSig();
- void PlaceHolder_IsGlobal();
- }
-
- [Guid("ba3fee4c-ecb9-4e41-83b7-183fa41cd859")]
- [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
- [ComImport]
- interface IMetaDataEmit
- {
- void PlaceHolder_SetModuleProps();
- void PlaceHolder_Save();
- void PlaceHolder_SaveToStream();
- void PlaceHolder_GetSaveSize();
- void PlaceHolder_DefineTypeDef();
- void PlaceHolder_DefineNestedType();
- void PlaceHolder_SetHandler();
- void PlaceHolder_DefineMethod();
- void PlaceHolder_DefineMethodImpl();
- void PlaceHolder_DefineTypeRefByName();
- void PlaceHolder_DefineImportType();
- void PlaceHolder_DefineMemberRef();
- void PlaceHolder_DefineImportMember();
- void PlaceHolder_DefineEvent();
- void PlaceHolder_SetClassLayout();
- void PlaceHolder_DeleteClassLayout();
- void PlaceHolder_SetFieldMarshal();
- void PlaceHolder_DeleteFieldMarshal();
- void PlaceHolder_DefinePermissionSet();
- void PlaceHolder_SetRVA();
- void PlaceHolder_GetTokenFromSig();
- void PlaceHolder_DefineModuleRef();
- void PlaceHolder_SetParent();
- void PlaceHolder_GetTokenFromTypeSpec();
- void PlaceHolder_SaveToMemory();
- void PlaceHolder_DefineUserString();
- void PlaceHolder_DeleteToken();
- void PlaceHolder_SetMethodProps();
- void PlaceHolder_SetTypeDefProps();
- void PlaceHolder_SetEventProps();
- void PlaceHolder_SetPermissionSetProps();
- void PlaceHolder_DefinePinvokeMap();
- void PlaceHolder_SetPinvokeMap();
- void PlaceHolder_DeletePinvokeMap();
- void PlaceHolder_DefineCustomAttribute();
- void PlaceHolder_SetCustomAttributeValue();
- void PlaceHolder_DefineField();
- void PlaceHolder_DefineProperty();
- void PlaceHolder_DefineParam();
- void PlaceHolder_SetFieldProps();
- void PlaceHolder_SetPropertyProps();
- void PlaceHolder_SetParamProps();
- void PlaceHolder_DefineSecurityAttributeSet();
- void PlaceHolder_ApplyEditAndContinue();
- void PlaceHolder_TranslateSigWithScope();
- void PlaceHolder_SetMethodImplFlags();
- void PlaceHolder_SetFieldRVA();
- void PlaceHolder_Merge();
- void PlaceHolder_MergeEnd();
- }
-
- [Guid("B01FAFEB-C450-3A4D-BEEC-B4CEEC01E006")]
- [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
- [ComImport]
- internal interface ISymUnmanagedDocumentWriter { }
-
- [Guid("0b97726e-9e6d-4f05-9a26-424022093caa")]
- [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
- [ComImport]
- [CoClass(typeof(CorSymWriterClass))]
- interface ISymUnmanagedWriter2
- {
- ISymUnmanagedDocumentWriter DefineDocument(string url, ref Guid language, ref Guid languageVendor, ref Guid documentType);
- void PlaceHolder_SetUserEntryPoint();
- void OpenMethod(int method);
- void CloseMethod();
- int OpenScope(int startOffset);
- void CloseScope(int endOffset);
- void PlaceHolder_SetScopeRange();
- void DefineLocalVariable(string name, int attributes, int cSig, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] signature, int addrKind, int addr1, int addr2, int startOffset, int endOffset);
- void PlaceHolder_DefineParameter();
- void PlaceHolder_DefineField();
- void PlaceHolder_DefineGlobalVariable();
- void Close();
- void PlaceHolder_SetSymAttribute();
- void PlaceHolder_OpenNamespace();
- void PlaceHolder_CloseNamespace();
- void PlaceHolder_UsingNamespace();
- void PlaceHolder_SetMethodSourceRange();
- void Initialize([MarshalAs(UnmanagedType.IUnknown)] object emitter, string filename, [MarshalAs(UnmanagedType.IUnknown)] object pIStream, bool fFullBuild);
-
- void GetDebugInfo(
- [In, Out] ref IMAGE_DEBUG_DIRECTORY pIDD,
- [In] uint cData,
- [Out] out uint pcData,
- [Out, MarshalAs(UnmanagedType.LPArray)] byte[] data);
-
- void DefineSequencePoints(ISymUnmanagedDocumentWriter document, int spCount,
- [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] int[] offsets,
- [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] int[] lines,
- [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] int[] columns,
- [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] int[] endLines,
- [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] int[] endColumns);
-
- void RemapToken(
- [In] int oldToken,
- [In] int newToken);
-
- void PlaceHolder_Initialize2();
- void PlaceHolder_DefineConstant();
- void PlaceHolder_Abort();
-
- void DefineLocalVariable2(string name, int attributes, int token, int addrKind, int addr1, int addr2, int addr3, int startOffset, int endOffset);
-
- void PlaceHolder_DefineGlobalVariable2();
- void PlaceHolder_DefineConstant2();
- }
-
- [Guid("108296c1-281e-11d3-bd22-0000f80849bd")]
- [ComImport]
- class CorSymWriterClass { }
-
- sealed class PdbWriter : ISymbolWriterImpl, IMetaDataEmit, IMetaDataImport
- {
- private readonly ModuleBuilder moduleBuilder;
- private ISymUnmanagedWriter2 symUnmanagedWriter;
- private readonly Dictionary<string, Document> documents = new Dictionary<string, Document>();
- private readonly List<Method> methods = new List<Method>();
- private readonly Dictionary<int, int> remap = new Dictionary<int, int>();
- private readonly Dictionary<int, int> reversemap = new Dictionary<int, int>();
- private readonly Dictionary<int, MethodBase> methodMap = new Dictionary<int, MethodBase>();
- private Method currentMethod;
-
- internal PdbWriter(ModuleBuilder moduleBuilder)
- {
- this.moduleBuilder = moduleBuilder;
- }
-
- private sealed class Document : ISymbolDocumentWriter
- {
- internal readonly string url;
- private Guid language;
- private Guid languageVendor;
- private Guid documentType;
- private ISymUnmanagedDocumentWriter unmanagedDocument;
-
- internal Document(string url, Guid language, Guid languageVendor, Guid documentType)
- {
- this.url = url;
- this.language = language;
- this.languageVendor = languageVendor;
- this.documentType = documentType;
- }
-
- public void SetCheckSum(Guid algorithmId, byte[] checkSum)
- {
- throw new NotImplementedException();
- }
-
- public void SetSource(byte[] source)
- {
- throw new NotImplementedException();
- }
-
- internal ISymUnmanagedDocumentWriter GetUnmanagedDocument(ISymUnmanagedWriter2 symUnmanagedWriter)
- {
- if (unmanagedDocument == null)
- {
- unmanagedDocument = symUnmanagedWriter.DefineDocument(url, ref language, ref languageVendor, ref documentType);
- }
- return unmanagedDocument;
- }
-
- internal void Release()
- {
- if (unmanagedDocument != null)
- {
- Marshal.ReleaseComObject(unmanagedDocument);
- unmanagedDocument = null;
- }
- }
- }
-
- private sealed class LocalVar
- {
- internal readonly FieldAttributes attributes;
- internal readonly int signature;
- internal readonly SymAddressKind addrKind;
- internal readonly int addr1;
- internal readonly int addr2;
- internal readonly int addr3;
- internal readonly int startOffset;
- internal readonly int endOffset;
-
- internal LocalVar(FieldAttributes attributes, int signature, SymAddressKind addrKind, int addr1, int addr2, int addr3, int startOffset, int endOffset)
- {
- this.attributes = attributes;
- this.signature = signature;
- this.addrKind = addrKind;
- this.addr1 = addr1;
- this.addr2 = addr2;
- this.addr3 = addr3;
- this.startOffset = startOffset;
- this.endOffset = endOffset;
- }
- }
-
- private sealed class Scope
- {
- internal readonly int startOffset;
- internal int endOffset;
- internal readonly List<Scope> scopes = new List<Scope>();
- internal readonly Dictionary<string, LocalVar> locals = new Dictionary<string, LocalVar>();
-
- internal Scope(int startOffset)
- {
- this.startOffset = startOffset;
- }
-
- internal void Do(ISymUnmanagedWriter2 symUnmanagedWriter)
- {
- symUnmanagedWriter.OpenScope(startOffset);
- foreach (KeyValuePair<string, LocalVar> kv in locals)
- {
- symUnmanagedWriter.DefineLocalVariable2(kv.Key, (int)kv.Value.attributes, kv.Value.signature, (int)kv.Value.addrKind, kv.Value.addr1, kv.Value.addr2, kv.Value.addr3, kv.Value.startOffset, kv.Value.endOffset);
- }
- foreach (Scope scope in scopes)
- {
- scope.Do(symUnmanagedWriter);
- }
- symUnmanagedWriter.CloseScope(endOffset);
- }
- }
-
- private sealed class Method
- {
- internal readonly int token;
- internal Document document;
- internal int[] offsets;
- internal int[] lines;
- internal int[] columns;
- internal int[] endLines;
- internal int[] endColumns;
- internal readonly List<Scope> scopes = new List<Scope>();
- internal readonly Stack<Scope> scopeStack = new Stack<Scope>();
-
- internal Method(int token)
- {
- this.token = token;
- }
- }
-
- public ISymbolDocumentWriter DefineDocument(string url, Guid language, Guid languageVendor, Guid documentType)
- {
- Document doc;
- if (!documents.TryGetValue(url, out doc))
- {
- doc = new Document(url, language, languageVendor, documentType);
- documents.Add(url, doc);
- }
- return doc;
- }
-
- public void OpenMethod(SymbolToken method)
- {
- throw new NotImplementedException();
- }
-
- public void OpenMethod(SymbolToken method, MethodBase mb)
- {
- int token = method.GetToken();
- currentMethod = new Method(token);
- methodMap.Add(token, mb);
- }
-
- public void CloseMethod()
- {
- methods.Add(currentMethod);
- currentMethod = null;
- }
-
- public void DefineSequencePoints(ISymbolDocumentWriter document, int[] offsets, int[] lines, int[] columns, int[] endLines, int[] endColumns)
- {
- currentMethod.document = (Document)document;
- currentMethod.offsets = offsets;
- currentMethod.lines = lines;
- currentMethod.columns = columns;
- currentMethod.endLines = endLines;
- currentMethod.endColumns = endColumns;
- }
-
- public int OpenScope(int startOffset)
- {
- Scope scope = new Scope(startOffset);
- if (currentMethod.scopeStack.Count == 0)
- {
- currentMethod.scopes.Add(scope);
- }
- else
- {
- currentMethod.scopeStack.Peek().scopes.Add(scope);
- }
- currentMethod.scopeStack.Push(scope);
- return 0;
- }
-
- public void CloseScope(int endOffset)
- {
- currentMethod.scopeStack.Pop().endOffset = endOffset;
- }
-
- public void DefineLocalVariable2(string name, FieldAttributes attributes, int signature, SymAddressKind addrKind, int addr1, int addr2, int addr3, int startOffset, int endOffset)
- {
- currentMethod.scopeStack.Peek().locals[name] = new LocalVar(attributes, signature, addrKind, addr1, addr2, addr3, startOffset, endOffset);
- }
-
- private void InitWriter()
- {
- if (symUnmanagedWriter == null)
- {
- string fileName = System.IO.Path.ChangeExtension(moduleBuilder.FullyQualifiedName, ".pdb");
- // pro-actively delete the .pdb to get a meaningful IOException, instead of COMInteropException if the file can't be overwritten (or is corrupt, or who knows what)
- System.IO.File.Delete(fileName);
- symUnmanagedWriter = new ISymUnmanagedWriter2();
- symUnmanagedWriter.Initialize(this, fileName, null, true);
- }
- }
-
- public byte[] GetDebugInfo(ref IMAGE_DEBUG_DIRECTORY idd)
- {
- InitWriter();
- uint cData;
- symUnmanagedWriter.GetDebugInfo(ref idd, 0, out cData, null);
- byte[] buf = new byte[cData];
- symUnmanagedWriter.GetDebugInfo(ref idd, (uint)buf.Length, out cData, buf);
- return buf;
- }
-
- public void RemapToken(int oldToken, int newToken)
- {
- remap.Add(oldToken, newToken);
- reversemap.Add(newToken, oldToken);
- }
-
- public void Close()
- {
- InitWriter();
-
- foreach (Method method in methods)
- {
- int remappedToken = method.token;
- remap.TryGetValue(remappedToken, out remappedToken);
- symUnmanagedWriter.OpenMethod(remappedToken);
- if (method.document != null)
- {
- ISymUnmanagedDocumentWriter doc = method.document.GetUnmanagedDocument(symUnmanagedWriter);
- symUnmanagedWriter.DefineSequencePoints(doc, method.offsets.Length, method.offsets, method.lines, method.columns, method.endLines, method.endColumns);
- }
- foreach (Scope scope in method.scopes)
- {
- scope.Do(symUnmanagedWriter);
- }
- symUnmanagedWriter.CloseMethod();
- }
-
- foreach (Document doc in documents.Values)
- {
- doc.Release();
- }
-
- symUnmanagedWriter.Close();
- Marshal.ReleaseComObject(symUnmanagedWriter);
- symUnmanagedWriter = null;
- documents.Clear();
- methods.Clear();
- remap.Clear();
- reversemap.Clear();
- }
-
- public void DefineLocalVariable(string name, System.Reflection.FieldAttributes attributes, byte[] signature, SymAddressKind addrKind, int addr1, int addr2, int addr3, int startOffset, int endOffset)
- {
- throw new NotImplementedException();
- }
-
- public void CloseNamespace()
- {
- throw new NotImplementedException();
- }
-
- public void DefineField(SymbolToken parent, string name, System.Reflection.FieldAttributes attributes, byte[] signature, SymAddressKind addrKind, int addr1, int addr2, int addr3)
- {
- throw new NotImplementedException();
- }
-
- public void DefineGlobalVariable(string name, System.Reflection.FieldAttributes attributes, byte[] signature, SymAddressKind addrKind, int addr1, int addr2, int addr3)
- {
- throw new NotImplementedException();
- }
-
- public void DefineParameter(string name, System.Reflection.ParameterAttributes attributes, int sequence, SymAddressKind addrKind, int addr1, int addr2, int addr3)
- {
- throw new NotImplementedException();
- }
-
- public void Initialize(IntPtr emitter, string filename, bool fFullBuild)
- {
- throw new NotImplementedException();
- }
-
- public void OpenNamespace(string name)
- {
- throw new NotImplementedException();
- }
-
- public void SetMethodSourceRange(ISymbolDocumentWriter startDoc, int startLine, int startColumn, ISymbolDocumentWriter endDoc, int endLine, int endColumn)
- {
- throw new NotImplementedException();
- }
-
- public void SetScopeRange(int scopeID, int startOffset, int endOffset)
- {
- throw new NotImplementedException();
- }
-
- public void SetSymAttribute(SymbolToken parent, string name, byte[] data)
- {
- throw new NotImplementedException();
- }
-
- public void SetUnderlyingWriter(IntPtr underlyingWriter)
- {
- throw new NotImplementedException();
- }
-
- public void SetUserEntryPoint(SymbolToken entryMethod)
- {
- throw new NotImplementedException();
- }
-
- public void UsingNamespace(string fullName)
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_CloseEnum()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_CountEnum()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_ResetEnum()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_EnumTypeDefs()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_EnumInterfaceImpls()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_EnumTypeRefs()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_FindTypeDefByName()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_GetScopeProps()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_GetModuleFromScope()
- {
- throw new NotImplementedException();
- }
-
- private static void WriteString(IntPtr ptrString, IntPtr ptrLength, string str, int length)
- {
- if (ptrString != IntPtr.Zero)
- {
- for (int i = 0; i < Math.Min(length, str.Length); i++)
- {
- Marshal.WriteInt16(ptrString, i, str[i]);
- }
- }
- if (ptrLength != IntPtr.Zero)
- {
- Marshal.WriteInt32(ptrLength, str.Length);
- }
- }
-
- private static void WriteToken(IntPtr ptr, MemberInfo member)
- {
- if (ptr != IntPtr.Zero)
- {
- Marshal.WriteInt32(ptr, member == null ? 0 : member.MetadataToken);
- }
- }
-
- private static void WriteInt32(IntPtr ptr, int value)
- {
- if (ptr != IntPtr.Zero)
- {
- Marshal.WriteInt32(ptr, value);
- }
- }
-
- public void GetTypeDefProps(
- int td, // [IN] TypeDef token for inquiry.
- IntPtr szTypeDef, // [OUT] Put name here.
- int cchTypeDef, // [IN] size of name buffer in wide chars.
- IntPtr pchTypeDef, // [OUT] put size of name (wide chars) here.
- IntPtr pdwTypeDefFlags, // [OUT] Put flags here.
- IntPtr ptkExtends) // [OUT] Put base class TypeDef/TypeRef here.
- {
- if (td == 0)
- {
- // why are we being called with an invalid token?
- WriteString(szTypeDef, pchTypeDef, "", cchTypeDef);
- WriteInt32(pdwTypeDefFlags, 0);
- WriteToken(ptkExtends, null);
- }
- else
- {
- Type type = moduleBuilder.ResolveType(td);
- WriteString(szTypeDef, pchTypeDef, type.FullName, cchTypeDef);
- WriteInt32(pdwTypeDefFlags, (int)type.Attributes);
- WriteToken(ptkExtends, type.BaseType);
- }
- }
-
- public void PlaceHolder_GetInterfaceImplProps()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_GetTypeRefProps()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_ResolveTypeRef()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_EnumMembers()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_EnumMembersWithName()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_EnumMethods()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_EnumMethodsWithName()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_EnumFields()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_EnumFieldsWithName()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_EnumParams()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_EnumMemberRefs()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_EnumMethodImpls()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_EnumPermissionSets()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_FindMember()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_FindMethod()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_FindField()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_FindMemberRef()
- {
- throw new NotImplementedException();
- }
-
- public void GetMethodProps(
- int mb, // The method for which to get props.
- IntPtr pClass, // [OUT] Put method's class here.
- IntPtr szMethod, // [OUT] Put method's name here.
- int cchMethod, // Size of szMethod buffer in wide chars.
- IntPtr pchMethod, // [OUT] Put actual size here
- IntPtr pdwAttr, // [OUT] Put flags here.
- IntPtr ppvSigBlob, // [OUT] point to the blob value of meta data
- IntPtr pcbSigBlob, // [OUT] actual size of signature blob
- IntPtr pulCodeRVA, // [OUT] codeRVA
- IntPtr pdwImplFlags) // [OUT] Impl. Flags
- {
- if (pdwAttr != IntPtr.Zero || ppvSigBlob != IntPtr.Zero || pcbSigBlob != IntPtr.Zero || pulCodeRVA != IntPtr.Zero || pdwImplFlags != IntPtr.Zero)
- {
- throw new NotImplementedException();
- }
- MethodBase method = methodMap[reversemap[mb]];
- WriteToken(pClass, method.DeclaringType);
- WriteString(szMethod, pchMethod, method.Name, cchMethod);
- }
-
- public void PlaceHolder_GetMemberRefProps()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_EnumProperties()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_EnumEvents()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_GetEventProps()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_EnumMethodSemantics()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_GetMethodSemantics()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_GetClassLayout()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_GetFieldMarshal()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_GetRVA()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_GetPermissionSetProps()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_GetSigFromToken()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_GetModuleRefProps()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_EnumModuleRefs()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_GetTypeSpecFromToken()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_GetNameFromToken()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_EnumUnresolvedMethods()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_GetUserString()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_GetPinvokeMap()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_EnumSignatures()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_EnumTypeSpecs()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_EnumUserStrings()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_GetParamForMethodIndex()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_EnumCustomAttributes()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_GetCustomAttributeProps()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_FindTypeRef()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_GetMemberProps()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_GetFieldProps()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_GetPropertyProps()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_GetParamProps()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_GetCustomAttributeByName()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_IsValidToken()
- {
- throw new NotImplementedException();
- }
-
- public void GetNestedClassProps(
- int tdNestedClass, // [IN] NestedClass token.
- IntPtr ptdEnclosingClass) // [OUT] EnclosingClass token.
- {
- Type type = moduleBuilder.ResolveType(tdNestedClass);
- WriteToken(ptdEnclosingClass, type.DeclaringType);
- }
-
- public void PlaceHolder_GetNativeCallConvFromSig()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_IsGlobal()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_SetModuleProps()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_Save()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_SaveToStream()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_GetSaveSize()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_DefineTypeDef()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_DefineNestedType()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_SetHandler()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_DefineMethod()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_DefineMethodImpl()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_DefineTypeRefByName()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_DefineImportType()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_DefineMemberRef()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_DefineImportMember()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_DefineEvent()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_SetClassLayout()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_DeleteClassLayout()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_SetFieldMarshal()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_DeleteFieldMarshal()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_DefinePermissionSet()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_SetRVA()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_GetTokenFromSig()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_DefineModuleRef()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_SetParent()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_GetTokenFromTypeSpec()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_SaveToMemory()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_DefineUserString()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_DeleteToken()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_SetMethodProps()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_SetTypeDefProps()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_SetEventProps()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_SetPermissionSetProps()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_DefinePinvokeMap()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_SetPinvokeMap()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_DeletePinvokeMap()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_DefineCustomAttribute()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_SetCustomAttributeValue()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_DefineField()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_DefineProperty()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_DefineParam()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_SetFieldProps()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_SetPropertyProps()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_SetParamProps()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_DefineSecurityAttributeSet()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_ApplyEditAndContinue()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_TranslateSigWithScope()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_SetMethodImplFlags()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_SetFieldRVA()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_Merge()
- {
- throw new NotImplementedException();
- }
-
- public void PlaceHolder_MergeEnd()
- {
- throw new NotImplementedException();
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2008, 2009 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Runtime.InteropServices;
-using System.Diagnostics.SymbolStore;
-using IKVM.Reflection.Emit;
-
-namespace IKVM.Reflection.Impl
-{
- [StructLayout(LayoutKind.Sequential)]
- struct IMAGE_DEBUG_DIRECTORY
- {
- public uint Characteristics;
- public uint TimeDateStamp;
- public ushort MajorVersion;
- public ushort MinorVersion;
- public uint Type;
- public uint SizeOfData;
- public uint AddressOfRawData;
- public uint PointerToRawData;
- }
-
- interface ISymbolWriterImpl : ISymbolWriter
- {
- byte[] GetDebugInfo(ref IMAGE_DEBUG_DIRECTORY idd);
- void RemapToken(int oldToken, int newToken);
- void DefineLocalVariable2(string name, FieldAttributes attributes, int signature, SymAddressKind addrKind, int addr1, int addr2, int addr3, int startOffset, int endOffset);
- void OpenMethod(SymbolToken symbolToken, MethodBase mb);
- }
-
- static class SymbolSupport
- {
- internal static ISymbolWriterImpl CreateSymbolWriterFor(ModuleBuilder moduleBuilder)
- {
-#if NO_SYMBOL_WRITER
- throw new NotSupportedException("IKVM.Reflection compiled with NO_SYMBOL_WRITER does not support writing debugging symbols.");
-#else
- if (Universe.MonoRuntime)
- {
-#if MONO
- return new MdbWriter(moduleBuilder);
-#else
- throw new NotSupportedException("IKVM.Reflection must be compiled with MONO defined to support writing Mono debugging symbols.");
-#endif
- }
- else
- {
- return new PdbWriter(moduleBuilder);
- }
-#endif
- }
-
- internal static byte[] GetDebugInfo(ISymbolWriterImpl writer, ref IMAGE_DEBUG_DIRECTORY idd)
- {
- return writer.GetDebugInfo(ref idd);
- }
-
- internal static void RemapToken(ISymbolWriterImpl writer, int oldToken, int newToken)
- {
- writer.RemapToken(oldToken, newToken);
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-
-namespace IKVM.Reflection
-{
- public struct InterfaceMapping
- {
- public MethodInfo[] InterfaceMethods;
- public Type InterfaceType;
- public MethodInfo[] TargetMethods;
- public Type TargetType;
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009-2011 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-
-namespace IKVM.Reflection
-{
- public sealed class LocalVariableInfo
- {
- private readonly int index;
- private readonly Type type;
- private readonly bool pinned;
- private readonly CustomModifiers customModifiers;
-
- internal LocalVariableInfo(int index, Type type, bool pinned, CustomModifiers customModifiers)
- {
- this.index = index;
- this.type = type;
- this.pinned = pinned;
- this.customModifiers = customModifiers;
- }
-
- public bool IsPinned
- {
- get { return pinned; }
- }
-
- public int LocalIndex
- {
- get { return index; }
- }
-
- public Type LocalType
- {
- get { return type; }
- }
-
- public CustomModifiers __GetCustomModifiers()
- {
- return customModifiers;
- }
- }
-}
+++ /dev/null
-thisdir = class/IKVM.Reflection
-SUBDIRS =
-
-include ../../build/rules.make
-
-DISTFILES = \
- Emit/*.cs \
- Impl/*.cs \
- Metadata/*.cs \
- Properties/*.cs \
- Reader/*.cs \
- Writer/*.cs \
- *.cs *.csproj \
- Makefile
-
-all-local install-local clean-local test-local run-test-local run-test-ondotnet-local uninstall-local doc-update-local csproj-local:
-
-dist-local: dist-default
+++ /dev/null
-/*
- Copyright (C) 2009-2012 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using IKVM.Reflection.Reader;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection
-{
- public sealed class ManifestResourceInfo
- {
- private readonly ModuleReader module;
- private readonly int index;
-
- internal ManifestResourceInfo(ModuleReader module, int index)
- {
- this.module = module;
- this.index = index;
- }
-
- public ResourceAttributes __ResourceAttributes
- {
- get { return (ResourceAttributes)module.ManifestResource.records[index].Flags; }
- }
-
- public int __Offset
- {
- get { return module.ManifestResource.records[index].Offset; }
- }
-
- public ResourceLocation ResourceLocation
- {
- get
- {
- int implementation = module.ManifestResource.records[index].Implementation;
- if ((implementation >> 24) == AssemblyRefTable.Index)
- {
- Assembly asm = ReferencedAssembly;
- if (asm == null || asm.__IsMissing)
- {
- return ResourceLocation.ContainedInAnotherAssembly;
- }
- return asm.GetManifestResourceInfo(module.GetString(module.ManifestResource.records[index].Name)).ResourceLocation | ResourceLocation.ContainedInAnotherAssembly;
- }
- else if ((implementation >> 24) == FileTable.Index)
- {
- if ((implementation & 0xFFFFFF) == 0)
- {
- return ResourceLocation.ContainedInManifestFile | ResourceLocation.Embedded;
- }
- return 0;
- }
- else
- {
- throw new BadImageFormatException();
- }
- }
- }
-
- public Assembly ReferencedAssembly
- {
- get
- {
- int implementation = module.ManifestResource.records[index].Implementation;
- if ((implementation >> 24) == AssemblyRefTable.Index)
- {
- return module.ResolveAssemblyRef((implementation & 0xFFFFFF) - 1);
- }
- return null;
- }
- }
-
- public string FileName
- {
- get
- {
- int implementation = module.ManifestResource.records[index].Implementation;
- if ((implementation >> 24) == FileTable.Index)
- {
- if ((implementation & 0xFFFFFF) == 0)
- {
- return null;
- }
- else
- {
- return module.GetString(module.File.records[(implementation & 0xFFFFFF) - 1].Name);
- }
- }
- return null;
- }
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2008-2012 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-using System.Text;
-using IKVM.Reflection.Emit;
-using IKVM.Reflection.Reader;
-using IKVM.Reflection.Writer;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection
-{
- public struct FieldMarshal
- {
- private const UnmanagedType NATIVE_TYPE_MAX = (UnmanagedType)0x50;
- public UnmanagedType UnmanagedType;
- public UnmanagedType? ArraySubType;
- public short? SizeParamIndex;
- public int? SizeConst;
- public VarEnum? SafeArraySubType;
- public Type SafeArrayUserDefinedSubType;
- public int? IidParameterIndex;
- public string MarshalType;
- public string MarshalCookie;
- public Type MarshalTypeRef;
-
- internal static bool ReadFieldMarshal(Module module, int token, out FieldMarshal fm)
- {
- fm = new FieldMarshal();
- foreach (int i in module.FieldMarshal.Filter(token))
- {
- ByteReader blob = module.GetBlob(module.FieldMarshal.records[i].NativeType);
- fm.UnmanagedType = (UnmanagedType)blob.ReadCompressedInt();
- if (fm.UnmanagedType == UnmanagedType.LPArray)
- {
- fm.ArraySubType = (UnmanagedType)blob.ReadCompressedInt();
- if (fm.ArraySubType == NATIVE_TYPE_MAX)
- {
- fm.ArraySubType = null;
- }
- if (blob.Length != 0)
- {
- fm.SizeParamIndex = (short)blob.ReadCompressedInt();
- if (blob.Length != 0)
- {
- fm.SizeConst = blob.ReadCompressedInt();
- if (blob.Length != 0 && blob.ReadCompressedInt() == 0)
- {
- fm.SizeParamIndex = null;
- }
- }
- }
- }
- else if (fm.UnmanagedType == UnmanagedType.SafeArray)
- {
- if (blob.Length != 0)
- {
- fm.SafeArraySubType = (VarEnum)blob.ReadCompressedInt();
- if (blob.Length != 0)
- {
- fm.SafeArrayUserDefinedSubType = ReadType(module, blob);
- }
- }
- }
- else if (fm.UnmanagedType == UnmanagedType.ByValArray)
- {
- fm.SizeConst = blob.ReadCompressedInt();
- if (blob.Length != 0)
- {
- fm.ArraySubType = (UnmanagedType)blob.ReadCompressedInt();
- }
- }
- else if (fm.UnmanagedType == UnmanagedType.ByValTStr)
- {
- fm.SizeConst = blob.ReadCompressedInt();
- }
- else if (fm.UnmanagedType == UnmanagedType.Interface
- || fm.UnmanagedType == UnmanagedType.IDispatch
- || fm.UnmanagedType == UnmanagedType.IUnknown)
- {
- if (blob.Length != 0)
- {
- fm.IidParameterIndex = blob.ReadCompressedInt();
- }
- }
- else if (fm.UnmanagedType == UnmanagedType.CustomMarshaler)
- {
- blob.ReadCompressedInt();
- blob.ReadCompressedInt();
- fm.MarshalType = ReadString(blob);
- fm.MarshalCookie = ReadString(blob);
-
- TypeNameParser parser = TypeNameParser.Parse(fm.MarshalType, false);
- if (!parser.Error)
- {
- fm.MarshalTypeRef = parser.GetType(module.universe, module.Assembly, false, fm.MarshalType, false, false);
- }
- }
- return true;
- }
- return false;
- }
-
- internal static void SetMarshalAsAttribute(ModuleBuilder module, int token, CustomAttributeBuilder attribute)
- {
- attribute = attribute.DecodeBlob(module.Assembly);
- FieldMarshalTable.Record rec = new FieldMarshalTable.Record();
- rec.Parent = token;
- rec.NativeType = WriteMarshallingDescriptor(module, attribute);
- module.FieldMarshal.AddRecord(rec);
- }
-
- private static int WriteMarshallingDescriptor(ModuleBuilder module, CustomAttributeBuilder attribute)
- {
- UnmanagedType unmanagedType;
- object val = attribute.GetConstructorArgument(0);
- if (val is short)
- {
- unmanagedType = (UnmanagedType)(short)val;
- }
- else if (val is int)
- {
- unmanagedType = (UnmanagedType)(int)val;
- }
- else
- {
- unmanagedType = (UnmanagedType)val;
- }
-
- ByteBuffer bb = new ByteBuffer(5);
- bb.WriteCompressedInt((int)unmanagedType);
-
- if (unmanagedType == UnmanagedType.LPArray)
- {
- UnmanagedType arraySubType = attribute.GetFieldValue<UnmanagedType>("ArraySubType") ?? NATIVE_TYPE_MAX;
- bb.WriteCompressedInt((int)arraySubType);
- int? sizeParamIndex = attribute.GetFieldValue<short>("SizeParamIndex");
- int? sizeConst = attribute.GetFieldValue<int>("SizeConst");
- if (sizeParamIndex != null)
- {
- bb.WriteCompressedInt(sizeParamIndex.Value);
- if (sizeConst != null)
- {
- bb.WriteCompressedInt(sizeConst.Value);
- bb.WriteCompressedInt(1); // flag that says that SizeParamIndex was specified
- }
- }
- else if (sizeConst != null)
- {
- bb.WriteCompressedInt(0); // SizeParamIndex
- bb.WriteCompressedInt(sizeConst.Value);
- bb.WriteCompressedInt(0); // flag that says that SizeParamIndex was not specified
- }
- }
- else if (unmanagedType == UnmanagedType.SafeArray)
- {
- VarEnum? safeArraySubType = attribute.GetFieldValue<VarEnum>("SafeArraySubType");
- if (safeArraySubType != null)
- {
- bb.WriteCompressedInt((int)safeArraySubType);
- Type safeArrayUserDefinedSubType = (Type)attribute.GetFieldValue("SafeArrayUserDefinedSubType");
- if (safeArrayUserDefinedSubType != null)
- {
- WriteType(module, bb, safeArrayUserDefinedSubType);
- }
- }
- }
- else if (unmanagedType == UnmanagedType.ByValArray)
- {
- bb.WriteCompressedInt(attribute.GetFieldValue<int>("SizeConst") ?? 1);
- UnmanagedType? arraySubType = attribute.GetFieldValue<UnmanagedType>("ArraySubType");
- if (arraySubType != null)
- {
- bb.WriteCompressedInt((int)arraySubType);
- }
- }
- else if (unmanagedType == UnmanagedType.ByValTStr)
- {
- bb.WriteCompressedInt(attribute.GetFieldValue<int>("SizeConst").Value);
- }
- else if (unmanagedType == UnmanagedType.Interface
- || unmanagedType == UnmanagedType.IDispatch
- || unmanagedType == UnmanagedType.IUnknown)
- {
- int? iidParameterIndex = attribute.GetFieldValue<int>("IidParameterIndex");
- if (iidParameterIndex != null)
- {
- bb.WriteCompressedInt(iidParameterIndex.Value);
- }
- }
- else if (unmanagedType == UnmanagedType.CustomMarshaler)
- {
- bb.WriteCompressedInt(0);
- bb.WriteCompressedInt(0);
- string marshalType = (string)attribute.GetFieldValue("MarshalType");
- if (marshalType != null)
- {
- WriteString(bb, marshalType);
- }
- else
- {
- WriteType(module, bb, (Type)attribute.GetFieldValue("MarshalTypeRef"));
- }
- WriteString(bb, (string)attribute.GetFieldValue("MarshalCookie") ?? "");
- }
-
- return module.Blobs.Add(bb);
- }
-
- private static Type ReadType(Module module, ByteReader br)
- {
- string str = ReadString(br);
- if (str == "")
- {
- return null;
- }
- return module.Assembly.GetType(str) ?? module.universe.GetType(str, true);
- }
-
- private static void WriteType(Module module, ByteBuffer bb, Type type)
- {
- WriteString(bb, type.Assembly == module.Assembly ? type.FullName : type.AssemblyQualifiedName);
- }
-
- private static string ReadString(ByteReader br)
- {
- return Encoding.UTF8.GetString(br.ReadBytes(br.ReadCompressedInt()));
- }
-
- private static void WriteString(ByteBuffer bb, string str)
- {
- byte[] buf = Encoding.UTF8.GetBytes(str);
- bb.WriteCompressedInt(buf.Length);
- bb.Write(buf);
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace IKVM.Reflection
-{
-// disable warnings that complain about us having == and != operators without also overriding Equals/GetHashCode,
-// this is intentional because most subtypes use reference equality
-#pragma warning disable 660, 661
- public abstract class MemberInfo : ICustomAttributeProvider
- {
- // prevent external subclasses
- internal MemberInfo()
- {
- }
-
- public abstract string Name { get; }
- public abstract Type DeclaringType { get; }
- public abstract MemberTypes MemberType { get; }
-
- public virtual Type ReflectedType
- {
- get { return DeclaringType; }
- }
-
- internal abstract MemberInfo SetReflectedType(Type type);
-
- public virtual int MetadataToken
- {
- get { throw new NotSupportedException(); }
- }
-
- public abstract Module Module
- {
- get;
- }
-
- public virtual bool __IsMissing
- {
- get { return false; }
- }
-
- public bool IsDefined(Type attributeType, bool inherit)
- {
- return CustomAttributeData.__GetCustomAttributes(this, attributeType, inherit).Count != 0;
- }
-
- public IList<CustomAttributeData> __GetCustomAttributes(Type attributeType, bool inherit)
- {
- return CustomAttributeData.__GetCustomAttributes(this, attributeType, inherit);
- }
-
- public static bool operator ==(MemberInfo m1, MemberInfo m2)
- {
- return ReferenceEquals(m1, m2) || (!ReferenceEquals(m1, null) && m1.Equals(m2));
- }
-
- public static bool operator !=(MemberInfo m1, MemberInfo m2)
- {
- return !(m1 == m2);
- }
-
- internal abstract int GetCurrentToken();
-
- internal abstract List<CustomAttributeData> GetPseudoCustomAttributes(Type attributeType);
-
- internal abstract bool IsBaked { get; }
-
- internal virtual bool BindingFlagsMatch(BindingFlags flags)
- {
- throw new InvalidOperationException();
- }
-
- internal virtual bool BindingFlagsMatchInherited(BindingFlags flags)
- {
- throw new InvalidOperationException();
- }
-
- protected static bool BindingFlagsMatch(bool state, BindingFlags flags, BindingFlags trueFlag, BindingFlags falseFlag)
- {
- return (state && (flags & trueFlag) == trueFlag)
- || (!state && (flags & falseFlag) == falseFlag);
- }
-
- protected static T SetReflectedType<T>(T member, Type type)
- where T : MemberInfo
- {
- return member == null ? null : (T)member.SetReflectedType(type);
- }
-
- protected static T[] SetReflectedType<T>(T[] members, Type type)
- where T : MemberInfo
- {
- for (int i = 0; i < members.Length; i++)
- {
- members[i] = SetReflectedType(members[i], type);
- }
- return members;
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2008 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System.IO;
-using IMAGE_DATA_DIRECTORY = IKVM.Reflection.Reader.IMAGE_DATA_DIRECTORY;
-
-namespace IKVM.Reflection.Metadata
-{
- sealed class CliHeader
- {
- internal const uint COMIMAGE_FLAGS_ILONLY = 0x00000001;
- internal const uint COMIMAGE_FLAGS_32BITREQUIRED = 0x00000002;
- internal const uint COMIMAGE_FLAGS_STRONGNAMESIGNED = 0x00000008;
- internal const uint COMIMAGE_FLAGS_NATIVE_ENTRYPOINT = 0x00000010;
- internal const uint COMIMAGE_FLAGS_32BITPREFERRED = 0x00020000;
-
- internal uint Cb = 0x48;
- internal ushort MajorRuntimeVersion;
- internal ushort MinorRuntimeVersion;
- internal IMAGE_DATA_DIRECTORY MetaData;
- internal uint Flags;
- internal uint EntryPointToken;
- internal IMAGE_DATA_DIRECTORY Resources;
- internal IMAGE_DATA_DIRECTORY StrongNameSignature;
- internal IMAGE_DATA_DIRECTORY CodeManagerTable;
- internal IMAGE_DATA_DIRECTORY VTableFixups;
- internal IMAGE_DATA_DIRECTORY ExportAddressTableJumps;
- internal IMAGE_DATA_DIRECTORY ManagedNativeHeader;
-
- internal void Read(BinaryReader br)
- {
- Cb = br.ReadUInt32();
- MajorRuntimeVersion = br.ReadUInt16();
- MinorRuntimeVersion = br.ReadUInt16();
- MetaData.Read(br);
- Flags = br.ReadUInt32();
- EntryPointToken = br.ReadUInt32();
- Resources.Read(br);
- StrongNameSignature.Read(br);
- CodeManagerTable.Read(br);
- VTableFixups.Read(br);
- ExportAddressTableJumps.Read(br);
- ManagedNativeHeader.Read(br);
- }
-
- internal void Write(IKVM.Reflection.Writer.MetadataWriter mw)
- {
- mw.Write(Cb);
- mw.Write(MajorRuntimeVersion);
- mw.Write(MinorRuntimeVersion);
- MetaData.Write(mw);
- mw.Write(Flags);
- mw.Write(EntryPointToken);
- Resources.Write(mw);
- StrongNameSignature.Write(mw);
- CodeManagerTable.Write(mw);
- VTableFixups.Write(mw);
- ExportAddressTableJumps.Write(mw);
- ManagedNativeHeader.Write(mw);
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace IKVM.Reflection.Metadata
-{
- // base class for MetadataReader and MetadataWriter
- abstract class MetadataRW
- {
- internal readonly bool bigStrings;
- internal readonly bool bigGuids;
- internal readonly bool bigBlobs;
- internal readonly bool bigResolutionScope;
- internal readonly bool bigTypeDefOrRef;
- internal readonly bool bigMemberRefParent;
- internal readonly bool bigHasCustomAttribute;
- internal readonly bool bigCustomAttributeType;
- internal readonly bool bigMethodDefOrRef;
- internal readonly bool bigHasConstant;
- internal readonly bool bigHasSemantics;
- internal readonly bool bigHasFieldMarshal;
- internal readonly bool bigHasDeclSecurity;
- internal readonly bool bigTypeOrMethodDef;
- internal readonly bool bigMemberForwarded;
- internal readonly bool bigImplementation;
- internal readonly bool bigField;
- internal readonly bool bigMethodDef;
- internal readonly bool bigParam;
- internal readonly bool bigTypeDef;
- internal readonly bool bigProperty;
- internal readonly bool bigEvent;
- internal readonly bool bigGenericParam;
- internal readonly bool bigModuleRef;
-
- protected MetadataRW(Module module, bool bigStrings, bool bigGuids, bool bigBlobs)
- {
- this.bigStrings = bigStrings;
- this.bigGuids = bigGuids;
- this.bigBlobs = bigBlobs;
- this.bigField = module.Field.IsBig;
- this.bigMethodDef = module.MethodDef.IsBig;
- this.bigParam = module.Param.IsBig;
- this.bigTypeDef = module.TypeDef.IsBig;
- this.bigProperty = module.Property.IsBig;
- this.bigEvent = module.Event.IsBig;
- this.bigGenericParam = module.GenericParam.IsBig;
- this.bigModuleRef = module.ModuleRef.IsBig;
- this.bigResolutionScope = IsBig(2, module.ModuleTable, module.ModuleRef, module.AssemblyRef, module.TypeRef);
- this.bigTypeDefOrRef = IsBig(2, module.TypeDef, module.TypeRef, module.TypeSpec);
- this.bigMemberRefParent = IsBig(3, module.TypeDef, module.TypeRef, module.ModuleRef, module.MethodDef, module.TypeSpec);
- this.bigMethodDefOrRef = IsBig(1, module.MethodDef, module.MemberRef);
- this.bigHasCustomAttribute = IsBig(5, module.MethodDef, module.Field, module.TypeRef, module.TypeDef, module.Param, module.InterfaceImpl, module.MemberRef,
- module.ModuleTable, /*module.Permission,*/ module.Property, module.Event, module.StandAloneSig, module.ModuleRef, module.TypeSpec, module.AssemblyTable,
- module.AssemblyRef, module.File, module.ExportedType, module.ManifestResource);
- this.bigCustomAttributeType = IsBig(3, module.MethodDef, module.MemberRef);
- this.bigHasConstant = IsBig(2, module.Field, module.Param, module.Property);
- this.bigHasSemantics = IsBig(1, module.Event, module.Property);
- this.bigHasFieldMarshal = IsBig(1, module.Field, module.Param);
- this.bigHasDeclSecurity = IsBig(2, module.TypeDef, module.MethodDef, module.AssemblyTable);
- this.bigTypeOrMethodDef = IsBig(1, module.TypeDef, module.MethodDef);
- this.bigMemberForwarded = IsBig(1, module.Field, module.MethodDef);
- this.bigImplementation = IsBig(2, module.File, module.AssemblyRef, module.ExportedType);
- }
-
- private static bool IsBig(int bitsUsed, params Table[] tables)
- {
- int limit = 1 << (16 - bitsUsed);
- foreach (Table table in tables)
- {
- if (table.RowCount >= limit)
- {
- return true;
- }
- }
- return false;
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009-2012 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-using IKVM.Reflection.Emit;
-using IKVM.Reflection.Writer;
-using IKVM.Reflection.Reader;
-
-namespace IKVM.Reflection.Metadata
-{
- internal abstract class Table
- {
- internal bool Sorted;
-
- internal bool IsBig
- {
- get { return RowCount > 65535; }
- }
-
- internal abstract int RowCount { get; set; }
-
- internal abstract void Write(MetadataWriter mw);
- internal abstract void Read(MetadataReader mr);
-
- internal int GetLength(MetadataWriter md)
- {
- return RowCount * GetRowSize(new RowSizeCalc(md));
- }
-
- protected abstract int GetRowSize(RowSizeCalc rsc);
-
- protected sealed class RowSizeCalc
- {
- private readonly MetadataWriter mw;
- private int size;
-
- internal RowSizeCalc(MetadataWriter mw)
- {
- this.mw = mw;
- }
-
- internal RowSizeCalc AddFixed(int size)
- {
- this.size += size;
- return this;
- }
-
- internal RowSizeCalc WriteStringIndex()
- {
- if (mw.bigStrings)
- {
- this.size += 4;
- }
- else
- {
- this.size += 2;
- }
- return this;
- }
-
- internal RowSizeCalc WriteGuidIndex()
- {
- if (mw.bigGuids)
- {
- this.size += 4;
- }
- else
- {
- this.size += 2;
- }
- return this;
- }
-
- internal RowSizeCalc WriteBlobIndex()
- {
- if (mw.bigBlobs)
- {
- this.size += 4;
- }
- else
- {
- this.size += 2;
- }
- return this;
- }
-
- internal RowSizeCalc WriteTypeDefOrRef()
- {
- if (mw.bigTypeDefOrRef)
- {
- this.size += 4;
- }
- else
- {
- this.size += 2;
- }
- return this;
- }
-
- internal RowSizeCalc WriteField()
- {
- if (mw.bigField)
- {
- size += 4;
- }
- else
- {
- size += 2;
- }
- return this;
- }
-
- internal RowSizeCalc WriteMethodDef()
- {
- if (mw.bigMethodDef)
- {
- this.size += 4;
- }
- else
- {
- this.size += 2;
- }
- return this;
- }
-
- internal RowSizeCalc WriteParam()
- {
- if (mw.bigParam)
- {
- this.size += 4;
- }
- else
- {
- this.size += 2;
- }
- return this;
- }
-
- internal RowSizeCalc WriteResolutionScope()
- {
- if (mw.bigResolutionScope)
- {
- this.size += 4;
- }
- else
- {
- this.size += 2;
- }
- return this;
- }
-
- internal RowSizeCalc WriteMemberRefParent()
- {
- if (mw.bigMemberRefParent)
- {
- this.size += 4;
- }
- else
- {
- this.size += 2;
- }
- return this;
- }
-
- internal RowSizeCalc WriteHasCustomAttribute()
- {
- if (mw.bigHasCustomAttribute)
- {
- size += 4;
- }
- else
- {
- size += 2;
- }
- return this;
- }
-
- internal RowSizeCalc WriteCustomAttributeType()
- {
- if (mw.bigCustomAttributeType)
- {
- this.size += 4;
- }
- else
- {
- this.size += 2;
- }
- return this;
- }
-
- internal RowSizeCalc WriteHasConstant()
- {
- if (mw.bigHasConstant)
- {
- size += 4;
- }
- else
- {
- size += 2;
- }
- return this;
- }
-
- internal RowSizeCalc WriteTypeDef()
- {
- if (mw.bigTypeDef)
- {
- this.size += 4;
- }
- else
- {
- this.size += 2;
- }
- return this;
- }
-
- internal RowSizeCalc WriteMethodDefOrRef()
- {
- if (mw.bigMethodDefOrRef)
- {
- this.size += 4;
- }
- else
- {
- this.size += 2;
- }
- return this;
- }
-
- internal RowSizeCalc WriteEvent()
- {
- if (mw.bigEvent)
- {
- this.size += 4;
- }
- else
- {
- this.size += 2;
- }
- return this;
- }
-
- internal RowSizeCalc WriteProperty()
- {
- if (mw.bigProperty)
- {
- this.size += 4;
- }
- else
- {
- this.size += 2;
- }
- return this;
- }
-
- internal RowSizeCalc WriteHasSemantics()
- {
- if (mw.bigHasSemantics)
- {
- this.size += 4;
- }
- else
- {
- this.size += 2;
- }
- return this;
- }
-
- internal RowSizeCalc WriteImplementation()
- {
- if (mw.bigImplementation)
- {
- this.size += 4;
- }
- else
- {
- this.size += 2;
- }
- return this;
- }
-
- internal RowSizeCalc WriteTypeOrMethodDef()
- {
- if (mw.bigTypeOrMethodDef)
- {
- this.size += 4;
- }
- else
- {
- this.size += 2;
- }
- return this;
- }
-
- internal RowSizeCalc WriteGenericParam()
- {
- if (mw.bigGenericParam)
- {
- this.size += 4;
- }
- else
- {
- this.size += 2;
- }
- return this;
- }
-
- internal RowSizeCalc WriteHasDeclSecurity()
- {
- if (mw.bigHasDeclSecurity)
- {
- this.size += 4;
- }
- else
- {
- this.size += 2;
- }
- return this;
- }
-
- internal RowSizeCalc WriteMemberForwarded()
- {
- if (mw.bigMemberForwarded)
- {
- this.size += 4;
- }
- else
- {
- this.size += 2;
- }
- return this;
- }
-
- internal RowSizeCalc WriteModuleRef()
- {
- if (mw.bigModuleRef)
- {
- this.size += 4;
- }
- else
- {
- this.size += 2;
- }
- return this;
- }
-
- internal RowSizeCalc WriteHasFieldMarshal()
- {
- if (mw.bigHasFieldMarshal)
- {
- this.size += 4;
- }
- else
- {
- this.size += 2;
- }
- return this;
- }
-
- internal int Value
- {
- get { return size; }
- }
- }
- }
-
- abstract class Table<T> : Table
- {
- internal T[] records = new T[1];
- protected int rowCount;
-
- internal sealed override int RowCount
- {
- get { return rowCount; }
- set { rowCount = value; records = new T[value]; }
- }
-
- protected override int GetRowSize(RowSizeCalc rsc)
- {
- throw new InvalidOperationException();
- }
-
- internal int AddRecord(T newRecord)
- {
- if (rowCount == records.Length)
- {
- T[] newarr = new T[records.Length * 2];
- Array.Copy(records, newarr, records.Length);
- records = newarr;
- }
- records[rowCount++] = newRecord;
- return rowCount;
- }
-
- internal int AddVirtualRecord()
- {
- return ++rowCount;
- }
-
- internal override void Write(MetadataWriter mw)
- {
- throw new InvalidOperationException();
- }
- }
-
- abstract class SortedTable<T> : Table<T>
- where T : SortedTable<T>.IRecord
- {
- internal interface IRecord
- {
- int SortKey { get; }
- int FilterKey { get; }
- }
-
- internal struct Enumerable
- {
- private readonly SortedTable<T> table;
- private readonly int token;
-
- internal Enumerable(SortedTable<T> table, int token)
- {
- this.table = table;
- this.token = token;
- }
-
- public Enumerator GetEnumerator()
- {
- T[] records = table.records;
- if (!table.Sorted)
- {
- return new Enumerator(records, table.RowCount - 1, -1, token);
- }
- int index = BinarySearch(records, table.RowCount, token & 0xFFFFFF);
- if (index < 0)
- {
- return new Enumerator(null, 0, 1, -1);
- }
- int start = index;
- while (start > 0 && (records[start - 1].FilterKey & 0xFFFFFF) == (token & 0xFFFFFF))
- {
- start--;
- }
- int end = index;
- int max = table.RowCount - 1;
- while (end < max && (records[end + 1].FilterKey & 0xFFFFFF) == (token & 0xFFFFFF))
- {
- end++;
- }
- return new Enumerator(records, end, start - 1, token);
- }
-
- private static int BinarySearch(T[] records, int length, int maskedToken)
- {
- int min = 0;
- int max = length - 1;
- while (min <= max)
- {
- int mid = min + ((max - min) / 2);
- int maskedValue = records[mid].FilterKey & 0xFFFFFF;
- if (maskedToken == maskedValue)
- {
- return mid;
- }
- else if (maskedToken < maskedValue)
- {
- max = mid - 1;
- }
- else
- {
- min = mid + 1;
- }
- }
- return -1;
- }
- }
-
- internal struct Enumerator
- {
- private readonly T[] records;
- private readonly int token;
- private readonly int max;
- private int index;
-
- internal Enumerator(T[] records, int max, int index, int token)
- {
- this.records = records;
- this.token = token;
- this.max = max;
- this.index = index;
- }
-
- public int Current
- {
- get { return index; }
- }
-
- public bool MoveNext()
- {
- while (index < max)
- {
- index++;
- if (records[index].FilterKey == token)
- {
- return true;
- }
- }
- return false;
- }
- }
-
- internal Enumerable Filter(int token)
- {
- return new Enumerable(this, token);
- }
-
- protected void Sort()
- {
- ulong[] map = new ulong[rowCount];
- for (uint i = 0; i < map.Length; i++)
- {
- map[i] = ((ulong)records[i].SortKey << 32) | i;
- }
- Array.Sort(map);
- T[] newRecords = new T[rowCount];
- for (int i = 0; i < map.Length; i++)
- {
- newRecords[i] = records[(int)map[i]];
- }
- records = newRecords;
- }
- }
-
- sealed class ModuleTable : Table<ModuleTable.Record>
- {
- internal const int Index = 0x00;
-
- internal struct Record
- {
- internal short Generation;
- internal int Name; // -> StringHeap
- internal int Mvid; // -> GuidHeap
- internal int EncId; // -> GuidHeap
- internal int EncBaseId; // -> GuidHeap
- }
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i].Generation = mr.ReadInt16();
- records[i].Name = mr.ReadStringIndex();
- records[i].Mvid = mr.ReadGuidIndex();
- records[i].EncId = mr.ReadGuidIndex();
- records[i].EncBaseId = mr.ReadGuidIndex();
- }
- }
-
- internal override void Write(MetadataWriter mw)
- {
- for (int i = 0; i < rowCount; i++)
- {
- mw.Write(records[i].Generation);
- mw.WriteStringIndex(records[i].Name);
- mw.WriteGuidIndex(records[i].Mvid);
- mw.WriteGuidIndex(records[i].EncId);
- mw.WriteGuidIndex(records[i].EncBaseId);
- }
- }
-
- protected override int GetRowSize(RowSizeCalc rsc)
- {
- return rsc
- .AddFixed(2)
- .WriteStringIndex()
- .WriteGuidIndex()
- .WriteGuidIndex()
- .WriteGuidIndex()
- .Value;
- }
-
- internal void Add(short generation, int name, int mvid, int encid, int encbaseid)
- {
- Record record = new Record();
- record.Generation = generation;
- record.Name = name;
- record.Mvid = mvid;
- record.EncId = encid;
- record.EncBaseId = encbaseid;
- AddRecord(record);
- }
- }
-
- sealed class TypeRefTable : Table<TypeRefTable.Record>
- {
- internal const int Index = 0x01;
-
- internal struct Record
- {
- internal int ResolutionScope;
- internal int TypeName;
- internal int TypeNameSpace;
- }
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i].ResolutionScope = mr.ReadResolutionScope();
- records[i].TypeName = mr.ReadStringIndex();
- records[i].TypeNameSpace = mr.ReadStringIndex();
- }
- }
-
- internal override void Write(MetadataWriter mw)
- {
- for (int i = 0; i < rowCount; i++)
- {
- mw.WriteResolutionScope(records[i].ResolutionScope);
- mw.WriteStringIndex(records[i].TypeName);
- mw.WriteStringIndex(records[i].TypeNameSpace);
- }
- }
-
- protected override int GetRowSize(RowSizeCalc rsc)
- {
- return rsc
- .WriteResolutionScope()
- .WriteStringIndex()
- .WriteStringIndex()
- .Value;
- }
-
- internal void Fixup(ModuleBuilder moduleBuilder)
- {
- for (int i = 0; i < rowCount; i++)
- {
- moduleBuilder.FixupPseudoToken(ref records[i].ResolutionScope);
- }
- }
- }
-
- sealed class TypeDefTable : Table<TypeDefTable.Record>
- {
- internal const int Index = 0x02;
-
- internal struct Record
- {
- internal int Flags;
- internal int TypeName;
- internal int TypeNamespace;
- internal int Extends;
- internal int FieldList;
- internal int MethodList;
- }
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i].Flags = mr.ReadInt32();
- records[i].TypeName = mr.ReadStringIndex();
- records[i].TypeNamespace = mr.ReadStringIndex();
- records[i].Extends = mr.ReadTypeDefOrRef();
- records[i].FieldList = mr.ReadField();
- records[i].MethodList = mr.ReadMethodDef();
- }
- }
-
- internal override void Write(MetadataWriter mw)
- {
- mw.ModuleBuilder.WriteTypeDefTable(mw);
- }
-
- internal int AllocToken()
- {
- return 0x02000000 + AddVirtualRecord();
- }
-
- protected override int GetRowSize(RowSizeCalc rsc)
- {
- return rsc
- .AddFixed(4)
- .WriteStringIndex()
- .WriteStringIndex()
- .WriteTypeDefOrRef()
- .WriteField()
- .WriteMethodDef()
- .Value;
- }
- }
-
- sealed class FieldPtrTable : Table<int>
- {
- internal const int Index = 0x03;
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i] = mr.ReadField();
- }
- }
- }
-
- sealed class FieldTable : Table<FieldTable.Record>
- {
- internal const int Index = 0x04;
-
- internal struct Record
- {
- internal short Flags;
- internal int Name;
- internal int Signature;
- }
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i].Flags = mr.ReadInt16();
- records[i].Name = mr.ReadStringIndex();
- records[i].Signature = mr.ReadBlobIndex();
- }
- }
-
- internal override void Write(MetadataWriter mw)
- {
- mw.ModuleBuilder.WriteFieldTable(mw);
- }
-
- protected override int GetRowSize(RowSizeCalc rsc)
- {
- return rsc
- .AddFixed(2)
- .WriteStringIndex()
- .WriteBlobIndex()
- .Value;
- }
- }
-
- sealed class MethodPtrTable : Table<int>
- {
- internal const int Index = 0x05;
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i] = mr.ReadMethodDef();
- }
- }
- }
-
- sealed class MethodDefTable : Table<MethodDefTable.Record>
- {
- internal const int Index = 0x06;
- private int baseRVA;
-
- internal struct Record
- {
- internal int RVA;
- internal short ImplFlags;
- internal short Flags;
- internal int Name;
- internal int Signature;
- internal int ParamList;
- }
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i].RVA = mr.ReadInt32();
- records[i].ImplFlags = mr.ReadInt16();
- records[i].Flags = mr.ReadInt16();
- records[i].Name = mr.ReadStringIndex();
- records[i].Signature = mr.ReadBlobIndex();
- records[i].ParamList = mr.ReadParam();
- }
- }
-
- internal override void Write(MetadataWriter mw)
- {
- mw.ModuleBuilder.WriteMethodDefTable(baseRVA, mw);
- }
-
- protected override int GetRowSize(RowSizeCalc rsc)
- {
- return rsc
- .AddFixed(8)
- .WriteStringIndex()
- .WriteBlobIndex()
- .WriteParam()
- .Value;
- }
-
- internal void Fixup(TextSection code)
- {
- baseRVA = (int)code.MethodBodiesRVA;
- }
- }
-
- sealed class ParamPtrTable : Table<int>
- {
- internal const int Index = 0x07;
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i] = mr.ReadParam();
- }
- }
- }
-
- sealed class ParamTable : Table<ParamTable.Record>
- {
- internal const int Index = 0x08;
-
- internal struct Record
- {
- internal short Flags;
- internal short Sequence;
- internal int Name;
- }
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i].Flags = mr.ReadInt16();
- records[i].Sequence = mr.ReadInt16();
- records[i].Name = mr.ReadStringIndex();
- }
- }
-
- internal override void Write(MetadataWriter mw)
- {
- mw.ModuleBuilder.WriteParamTable(mw);
- }
-
- protected override int GetRowSize(RowSizeCalc rsc)
- {
- return rsc
- .AddFixed(4)
- .WriteStringIndex()
- .Value;
- }
- }
-
- sealed class InterfaceImplTable : SortedTable<InterfaceImplTable.Record>
- {
- internal const int Index = 0x09;
-
- internal struct Record : IRecord
- {
- internal int Class;
- internal int Interface;
-
- int IRecord.SortKey
- {
- get { return Class; }
- }
-
- int IRecord.FilterKey
- {
- get { return Class; }
- }
- }
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i].Class = mr.ReadTypeDef();
- records[i].Interface = mr.ReadTypeDefOrRef();
- }
- }
-
- internal override void Write(MetadataWriter mw)
- {
- for (int i = 0; i < rowCount; i++)
- {
- mw.WriteTypeDef(records[i].Class);
- mw.WriteEncodedTypeDefOrRef(records[i].Interface);
- }
- }
-
- protected override int GetRowSize(RowSizeCalc rsc)
- {
- return rsc
- .WriteTypeDef()
- .WriteTypeDefOrRef()
- .Value;
- }
-
- internal void Fixup()
- {
- for (int i = 0; i < rowCount; i++)
- {
- int token = records[i].Interface;
- switch (token >> 24)
- {
- case 0:
- break;
- case TypeDefTable.Index:
- token = (token & 0xFFFFFF) << 2 | 0;
- break;
- case TypeRefTable.Index:
- token = (token & 0xFFFFFF) << 2 | 1;
- break;
- case TypeSpecTable.Index:
- token = (token & 0xFFFFFF) << 2 | 2;
- break;
- default:
- throw new InvalidOperationException();
- }
- records[i].Interface = token;
- }
- // LAMESPEC the CLI spec says that InterfaceImpl should be sorted by { Class, Interface },
- // but it appears to only be necessary to sort by Class (and csc emits InterfaceImpl records in
- // source file order, so to be able to support round tripping, we need to retain ordering as well).
- Sort();
- }
- }
-
- sealed class MemberRefTable : Table<MemberRefTable.Record>
- {
- internal const int Index = 0x0A;
-
- internal struct Record
- {
- internal int Class;
- internal int Name;
- internal int Signature;
- }
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i].Class = mr.ReadMemberRefParent();
- records[i].Name = mr.ReadStringIndex();
- records[i].Signature = mr.ReadBlobIndex();
- }
- }
-
- internal override void Write(MetadataWriter mw)
- {
- for (int i = 0; i < rowCount; i++)
- {
- mw.WriteMemberRefParent(records[i].Class);
- mw.WriteStringIndex(records[i].Name);
- mw.WriteBlobIndex(records[i].Signature);
- }
- }
-
- protected override int GetRowSize(RowSizeCalc rsc)
- {
- return rsc
- .WriteMemberRefParent()
- .WriteStringIndex()
- .WriteBlobIndex()
- .Value;
- }
-
- internal int FindOrAddRecord(Record record)
- {
- for (int i = 0; i < rowCount; i++)
- {
- if (records[i].Class == record.Class
- && records[i].Name == record.Name
- && records[i].Signature == record.Signature)
- {
- return i + 1;
- }
- }
- return AddRecord(record);
- }
-
- internal void Fixup(ModuleBuilder moduleBuilder)
- {
- for (int i = 0; i < rowCount; i++)
- {
- moduleBuilder.FixupPseudoToken(ref records[i].Class);
- }
- }
- }
-
- sealed class ConstantTable : SortedTable<ConstantTable.Record>
- {
- internal const int Index = 0x0B;
-
- internal struct Record : IRecord
- {
- internal short Type;
- internal int Parent;
- internal int Value;
-
- int IRecord.SortKey
- {
- get { return EncodeHasConstant(Parent); }
- }
-
- int IRecord.FilterKey
- {
- get { return Parent; }
- }
- }
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i].Type = mr.ReadInt16();
- records[i].Parent = mr.ReadHasConstant();
- records[i].Value = mr.ReadBlobIndex();
- }
- }
-
- internal override void Write(MetadataWriter mw)
- {
- for (int i = 0; i < rowCount; i++)
- {
- mw.Write(records[i].Type);
- mw.WriteHasConstant(records[i].Parent);
- mw.WriteBlobIndex(records[i].Value);
- }
- }
-
- protected override int GetRowSize(RowSizeCalc rsc)
- {
- return rsc
- .AddFixed(2)
- .WriteHasConstant()
- .WriteBlobIndex()
- .Value;
- }
-
- internal void Fixup(ModuleBuilder moduleBuilder)
- {
- for (int i = 0; i < rowCount; i++)
- {
- moduleBuilder.FixupPseudoToken(ref records[i].Parent);
- }
- Sort();
- }
-
- internal static int EncodeHasConstant(int token)
- {
- switch (token >> 24)
- {
- case FieldTable.Index:
- return (token & 0xFFFFFF) << 2 | 0;
- case ParamTable.Index:
- return (token & 0xFFFFFF) << 2 | 1;
- case PropertyTable.Index:
- return (token & 0xFFFFFF) << 2 | 2;
- default:
- throw new InvalidOperationException();
- }
- }
-
- internal object GetRawConstantValue(Module module, int parent)
- {
- foreach (int i in Filter(parent))
- {
- ByteReader br = module.GetBlob(module.Constant.records[i].Value);
- switch (module.Constant.records[i].Type)
- {
- // see ModuleBuilder.AddConstant for the encodings
- case Signature.ELEMENT_TYPE_BOOLEAN:
- return br.ReadByte() != 0;
- case Signature.ELEMENT_TYPE_I1:
- return br.ReadSByte();
- case Signature.ELEMENT_TYPE_I2:
- return br.ReadInt16();
- case Signature.ELEMENT_TYPE_I4:
- return br.ReadInt32();
- case Signature.ELEMENT_TYPE_I8:
- return br.ReadInt64();
- case Signature.ELEMENT_TYPE_U1:
- return br.ReadByte();
- case Signature.ELEMENT_TYPE_U2:
- return br.ReadUInt16();
- case Signature.ELEMENT_TYPE_U4:
- return br.ReadUInt32();
- case Signature.ELEMENT_TYPE_U8:
- return br.ReadUInt64();
- case Signature.ELEMENT_TYPE_R4:
- return br.ReadSingle();
- case Signature.ELEMENT_TYPE_R8:
- return br.ReadDouble();
- case Signature.ELEMENT_TYPE_CHAR:
- return br.ReadChar();
- case Signature.ELEMENT_TYPE_STRING:
- {
- char[] chars = new char[br.Length / 2];
- for (int j = 0; j < chars.Length; j++)
- {
- chars[j] = br.ReadChar();
- }
- return new String(chars);
- }
- case Signature.ELEMENT_TYPE_CLASS:
- if (br.ReadInt32() != 0)
- {
- throw new BadImageFormatException();
- }
- return null;
- default:
- throw new BadImageFormatException();
- }
- }
- throw new InvalidOperationException();
- }
- }
-
- sealed class CustomAttributeTable : SortedTable<CustomAttributeTable.Record>
- {
- internal const int Index = 0x0C;
-
- internal struct Record : IRecord
- {
- internal int Parent;
- internal int Type;
- internal int Value;
-
- int IRecord.SortKey
- {
- get { return EncodeHasCustomAttribute(Parent); }
- }
-
- int IRecord.FilterKey
- {
- get { return Parent; }
- }
- }
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i].Parent = mr.ReadHasCustomAttribute();
- records[i].Type = mr.ReadCustomAttributeType();
- records[i].Value = mr.ReadBlobIndex();
- }
- }
-
- internal override void Write(MetadataWriter mw)
- {
- for (int i = 0; i < rowCount; i++)
- {
- mw.WriteHasCustomAttribute(records[i].Parent);
- mw.WriteCustomAttributeType(records[i].Type);
- mw.WriteBlobIndex(records[i].Value);
- }
- }
-
- protected override int GetRowSize(RowSizeCalc rsc)
- {
- return rsc
- .WriteHasCustomAttribute()
- .WriteCustomAttributeType()
- .WriteBlobIndex()
- .Value;
- }
-
- internal void Fixup(ModuleBuilder moduleBuilder)
- {
- int[] genericParamFixup = moduleBuilder.GenericParam.GetIndexFixup();
- for (int i = 0; i < rowCount; i++)
- {
- moduleBuilder.FixupPseudoToken(ref records[i].Type);
- moduleBuilder.FixupPseudoToken(ref records[i].Parent);
- if (records[i].Parent >> 24 == GenericParamTable.Index)
- {
- records[i].Parent = (GenericParamTable.Index << 24) + genericParamFixup[(records[i].Parent & 0xFFFFFF) - 1] + 1;
- }
- }
- Sort();
- }
-
- internal static int EncodeHasCustomAttribute(int token)
- {
- switch (token >> 24)
- {
- case MethodDefTable.Index:
- return (token & 0xFFFFFF) << 5 | 0;
- case FieldTable.Index:
- return (token & 0xFFFFFF) << 5 | 1;
- case TypeRefTable.Index:
- return (token & 0xFFFFFF) << 5 | 2;
- case TypeDefTable.Index:
- return (token & 0xFFFFFF) << 5 | 3;
- case ParamTable.Index:
- return (token & 0xFFFFFF) << 5 | 4;
- case InterfaceImplTable.Index:
- return (token & 0xFFFFFF) << 5 | 5;
- case MemberRefTable.Index:
- return (token & 0xFFFFFF) << 5 | 6;
- case ModuleTable.Index:
- return (token & 0xFFFFFF) << 5 | 7;
- // Permission (8) table doesn't exist in the spec
- case PropertyTable.Index:
- return (token & 0xFFFFFF) << 5 | 9;
- case EventTable.Index:
- return (token & 0xFFFFFF) << 5 | 10;
- case StandAloneSigTable.Index:
- return (token & 0xFFFFFF) << 5 | 11;
- case ModuleRefTable.Index:
- return (token & 0xFFFFFF) << 5 | 12;
- case TypeSpecTable.Index:
- return (token & 0xFFFFFF) << 5 | 13;
- case AssemblyTable.Index:
- return (token & 0xFFFFFF) << 5 | 14;
- case AssemblyRefTable.Index:
- return (token & 0xFFFFFF) << 5 | 15;
- case FileTable.Index:
- return (token & 0xFFFFFF) << 5 | 16;
- case ExportedTypeTable.Index:
- return (token & 0xFFFFFF) << 5 | 17;
- case ManifestResourceTable.Index:
- return (token & 0xFFFFFF) << 5 | 18;
- case GenericParamTable.Index:
- return (token & 0xFFFFFF) << 5 | 19;
- default:
- throw new InvalidOperationException();
- }
- }
- }
-
- sealed class FieldMarshalTable : SortedTable<FieldMarshalTable.Record>
- {
- internal const int Index = 0x0D;
-
- internal struct Record : IRecord
- {
- internal int Parent;
- internal int NativeType;
-
- int IRecord.SortKey
- {
- get { return EncodeHasFieldMarshal(Parent); }
- }
-
- int IRecord.FilterKey
- {
- get { return Parent; }
- }
- }
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i].Parent = mr.ReadHasFieldMarshal();
- records[i].NativeType = mr.ReadBlobIndex();
- }
- }
-
- internal override void Write(MetadataWriter mw)
- {
- for (int i = 0; i < rowCount; i++)
- {
- mw.WriteHasFieldMarshal(records[i].Parent);
- mw.WriteBlobIndex(records[i].NativeType);
- }
- }
-
- protected override int GetRowSize(RowSizeCalc rsc)
- {
- return rsc
- .WriteHasFieldMarshal()
- .WriteBlobIndex()
- .Value;
- }
-
- internal void Fixup(ModuleBuilder moduleBuilder)
- {
- for (int i = 0; i < rowCount; i++)
- {
- records[i].Parent = moduleBuilder.ResolvePseudoToken(records[i].Parent);
- }
- Sort();
- }
-
- internal static int EncodeHasFieldMarshal(int token)
- {
- switch (token >> 24)
- {
- case FieldTable.Index:
- return (token & 0xFFFFFF) << 1 | 0;
- case ParamTable.Index:
- return (token & 0xFFFFFF) << 1 | 1;
- default:
- throw new InvalidOperationException();
- }
- }
- }
-
- sealed class DeclSecurityTable : SortedTable<DeclSecurityTable.Record>
- {
- internal const int Index = 0x0E;
-
- internal struct Record : IRecord
- {
- internal short Action;
- internal int Parent;
- internal int PermissionSet;
-
- int IRecord.SortKey
- {
- get { return Parent; }
- }
-
- int IRecord.FilterKey
- {
- get { return Parent; }
- }
- }
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i].Action = mr.ReadInt16();
- records[i].Parent = mr.ReadHasDeclSecurity();
- records[i].PermissionSet = mr.ReadBlobIndex();
- }
- }
-
- internal override void Write(MetadataWriter mw)
- {
- for (int i = 0; i < rowCount; i++)
- {
- mw.Write(records[i].Action);
- mw.WriteHasDeclSecurity(records[i].Parent);
- mw.WriteBlobIndex(records[i].PermissionSet);
- }
- }
-
- protected override int GetRowSize(RowSizeCalc rsc)
- {
- return rsc
- .AddFixed(2)
- .WriteHasDeclSecurity()
- .WriteBlobIndex()
- .Value;
- }
-
- internal void Fixup(ModuleBuilder moduleBuilder)
- {
- for (int i = 0; i < rowCount; i++)
- {
- int token = records[i].Parent;
- moduleBuilder.FixupPseudoToken(ref token);
- // do the HasDeclSecurity encoding, so that we can sort the table
- switch (token >> 24)
- {
- case TypeDefTable.Index:
- token = (token & 0xFFFFFF) << 2 | 0;
- break;
- case MethodDefTable.Index:
- token = (token & 0xFFFFFF) << 2 | 1;
- break;
- case AssemblyTable.Index:
- token = (token & 0xFFFFFF) << 2 | 2;
- break;
- default:
- throw new InvalidOperationException();
- }
- records[i].Parent = token;
- }
- Sort();
- }
- }
-
- sealed class ClassLayoutTable : SortedTable<ClassLayoutTable.Record>
- {
- internal const int Index = 0x0f;
-
- internal struct Record : IRecord
- {
- internal short PackingSize;
- internal int ClassSize;
- internal int Parent;
-
- int IRecord.SortKey
- {
- get { return Parent; }
- }
-
- int IRecord.FilterKey
- {
- get { return Parent; }
- }
- }
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i].PackingSize = mr.ReadInt16();
- records[i].ClassSize = mr.ReadInt32();
- records[i].Parent = mr.ReadTypeDef();
- }
- }
-
- internal override void Write(MetadataWriter mw)
- {
- Sort();
- for (int i = 0; i < rowCount; i++)
- {
- mw.Write(records[i].PackingSize);
- mw.Write(records[i].ClassSize);
- mw.WriteTypeDef(records[i].Parent);
- }
- }
-
- protected override int GetRowSize(RowSizeCalc rsc)
- {
- return rsc
- .AddFixed(6)
- .WriteTypeDef()
- .Value;
- }
- }
-
- sealed class FieldLayoutTable : SortedTable<FieldLayoutTable.Record>
- {
- internal const int Index = 0x10;
-
- internal struct Record : IRecord
- {
- internal int Offset;
- internal int Field;
-
- int IRecord.SortKey
- {
- get { return Field; }
- }
-
- int IRecord.FilterKey
- {
- get { return Field; }
- }
- }
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i].Offset = mr.ReadInt32();
- records[i].Field = mr.ReadField();
- }
- }
-
- internal override void Write(MetadataWriter mw)
- {
- for (int i = 0; i < rowCount; i++)
- {
- mw.Write(records[i].Offset);
- mw.WriteField(records[i].Field);
- }
- }
-
- protected override int GetRowSize(RowSizeCalc rsc)
- {
- return rsc
- .AddFixed(4)
- .WriteField()
- .Value;
- }
-
- internal void Fixup(ModuleBuilder moduleBuilder)
- {
- for (int i = 0; i < rowCount; i++)
- {
- records[i].Field = moduleBuilder.ResolvePseudoToken(records[i].Field) & 0xFFFFFF;
- }
- Sort();
- }
- }
-
- sealed class StandAloneSigTable : Table<int>
- {
- internal const int Index = 0x11;
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i] = mr.ReadBlobIndex();
- }
- }
-
- internal override void Write(MetadataWriter mw)
- {
- for (int i = 0; i < rowCount; i++)
- {
- mw.WriteBlobIndex(records[i]);
- }
- }
-
- protected override int GetRowSize(Table.RowSizeCalc rsc)
- {
- return rsc.WriteBlobIndex().Value;
- }
-
- internal int FindOrAddRecord(int blob)
- {
- for (int i = 0; i < rowCount; i++)
- {
- if (records[i] == blob)
- {
- return i + 1;
- }
- }
- return AddRecord(blob);
- }
- }
-
- sealed class EventMapTable : SortedTable<EventMapTable.Record>
- {
- internal const int Index = 0x12;
-
- internal struct Record : IRecord
- {
- internal int Parent;
- internal int EventList;
-
- int IRecord.SortKey
- {
- get { return Parent; }
- }
-
- int IRecord.FilterKey
- {
- get { return Parent; }
- }
- }
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i].Parent = mr.ReadTypeDef();
- records[i].EventList = mr.ReadEvent();
- }
- }
-
- internal override void Write(MetadataWriter mw)
- {
- for (int i = 0; i < rowCount; i++)
- {
- mw.WriteTypeDef(records[i].Parent);
- mw.WriteEvent(records[i].EventList);
- }
- }
-
- protected override int GetRowSize(RowSizeCalc rsc)
- {
- return rsc
- .WriteTypeDef()
- .WriteEvent()
- .Value;
- }
- }
-
- sealed class EventPtrTable : Table<int>
- {
- internal const int Index = 0x13;
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i] = mr.ReadEvent();
- }
- }
- }
-
- sealed class EventTable : Table<EventTable.Record>
- {
- internal const int Index = 0x14;
-
- internal struct Record
- {
- internal short EventFlags;
- internal int Name;
- internal int EventType;
- }
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i].EventFlags = mr.ReadInt16();
- records[i].Name = mr.ReadStringIndex();
- records[i].EventType = mr.ReadTypeDefOrRef();
- }
- }
-
- internal override void Write(MetadataWriter mw)
- {
- for (int i = 0; i < rowCount; i++)
- {
- mw.Write(records[i].EventFlags);
- mw.WriteStringIndex(records[i].Name);
- mw.WriteTypeDefOrRef(records[i].EventType);
- }
- }
-
- protected override int GetRowSize(RowSizeCalc rsc)
- {
- return rsc
- .AddFixed(2)
- .WriteStringIndex()
- .WriteTypeDefOrRef()
- .Value;
- }
- }
-
- sealed class PropertyMapTable : SortedTable<PropertyMapTable.Record>
- {
- internal const int Index = 0x15;
-
- internal struct Record : IRecord
- {
- internal int Parent;
- internal int PropertyList;
-
- int IRecord.SortKey
- {
- get { return Parent; }
- }
-
- int IRecord.FilterKey
- {
- get { return Parent; }
- }
- }
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i].Parent = mr.ReadTypeDef();
- records[i].PropertyList = mr.ReadProperty();
- }
- }
-
- internal override void Write(MetadataWriter mw)
- {
- for (int i = 0; i < rowCount; i++)
- {
- mw.WriteTypeDef(records[i].Parent);
- mw.WriteProperty(records[i].PropertyList);
- }
- }
-
- protected override int GetRowSize(RowSizeCalc rsc)
- {
- return rsc
- .WriteTypeDef()
- .WriteProperty()
- .Value;
- }
- }
-
- sealed class PropertyPtrTable : Table<int>
- {
- internal const int Index = 0x16;
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i] = mr.ReadProperty();
- }
- }
- }
-
- sealed class PropertyTable : Table<PropertyTable.Record>
- {
- internal const int Index = 0x17;
-
- internal struct Record
- {
- internal short Flags;
- internal int Name;
- internal int Type;
- }
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i].Flags = mr.ReadInt16();
- records[i].Name = mr.ReadStringIndex();
- records[i].Type = mr.ReadBlobIndex();
- }
- }
-
- internal override void Write(MetadataWriter mw)
- {
- for (int i = 0; i < rowCount; i++)
- {
- mw.Write(records[i].Flags);
- mw.WriteStringIndex(records[i].Name);
- mw.WriteBlobIndex(records[i].Type);
- }
- }
-
- protected override int GetRowSize(RowSizeCalc rsc)
- {
- return rsc
- .AddFixed(2)
- .WriteStringIndex()
- .WriteBlobIndex()
- .Value;
- }
- }
-
- sealed class MethodSemanticsTable : SortedTable<MethodSemanticsTable.Record>
- {
- internal const int Index = 0x18;
-
- // semantics
- internal const short Setter = 0x0001;
- internal const short Getter = 0x0002;
- internal const short Other = 0x0004;
- internal const short AddOn = 0x0008;
- internal const short RemoveOn = 0x0010;
- internal const short Fire = 0x0020;
-
- internal struct Record : IRecord
- {
- internal short Semantics;
- internal int Method;
- internal int Association;
-
- int IRecord.SortKey
- {
- get { return Association; }
- }
-
- int IRecord.FilterKey
- {
- get { return Association; }
- }
- }
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i].Semantics = mr.ReadInt16();
- records[i].Method = mr.ReadMethodDef();
- records[i].Association = mr.ReadHasSemantics();
- }
- }
-
- internal override void Write(MetadataWriter mw)
- {
- for (int i = 0; i < rowCount; i++)
- {
- mw.Write(records[i].Semantics);
- mw.WriteMethodDef(records[i].Method);
- mw.WriteHasSemantics(records[i].Association);
- }
- }
-
- protected override int GetRowSize(RowSizeCalc rsc)
- {
- return rsc
- .AddFixed(2)
- .WriteMethodDef()
- .WriteHasSemantics()
- .Value;
- }
-
- internal void Fixup(ModuleBuilder moduleBuilder)
- {
- for (int i = 0; i < rowCount; i++)
- {
- moduleBuilder.FixupPseudoToken(ref records[i].Method);
- int token = records[i].Association;
- // do the HasSemantics encoding, so that we can sort the table
- switch (token >> 24)
- {
- case EventTable.Index:
- token = (token & 0xFFFFFF) << 1 | 0;
- break;
- case PropertyTable.Index:
- token = (token & 0xFFFFFF) << 1 | 1;
- break;
- default:
- throw new InvalidOperationException();
- }
- records[i].Association = token;
- }
- Sort();
- }
-
- internal MethodInfo GetMethod(Module module, int token, bool nonPublic, short semantics)
- {
- foreach (int i in Filter(token))
- {
- if ((records[i].Semantics & semantics) != 0)
- {
- MethodBase method = module.ResolveMethod((MethodDefTable.Index << 24) + records[i].Method);
- if (nonPublic || method.IsPublic)
- {
- return (MethodInfo)method;
- }
- }
- }
- return null;
- }
-
- internal MethodInfo[] GetMethods(Module module, int token, bool nonPublic, short semantics)
- {
- List<MethodInfo> methods = new List<MethodInfo>();
- foreach (int i in Filter(token))
- {
- if ((records[i].Semantics & semantics) != 0)
- {
- MethodInfo method = (MethodInfo)module.ResolveMethod((MethodDefTable.Index << 24) + records[i].Method);
- if (nonPublic || method.IsPublic)
- {
- methods.Add(method);
- }
- }
- }
- return methods.ToArray();
- }
-
- internal void ComputeFlags(Module module, int token, out bool isPublic, out bool isNonPrivate, out bool isStatic)
- {
- isPublic = false;
- isNonPrivate = false;
- isStatic = false;
- foreach (int i in Filter(token))
- {
- MethodBase method = module.ResolveMethod((MethodDefTable.Index << 24) + records[i].Method);
- isPublic |= method.IsPublic;
- isNonPrivate |= (method.Attributes & MethodAttributes.MemberAccessMask) > MethodAttributes.Private;
- isStatic |= method.IsStatic;
- }
- }
- }
-
- sealed class MethodImplTable : SortedTable<MethodImplTable.Record>
- {
- internal const int Index = 0x19;
-
- internal struct Record : IRecord
- {
- internal int Class;
- internal int MethodBody;
- internal int MethodDeclaration;
-
- int IRecord.SortKey
- {
- get { return Class; }
- }
-
- int IRecord.FilterKey
- {
- get { return Class; }
- }
- }
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i].Class = mr.ReadTypeDef();
- records[i].MethodBody = mr.ReadMethodDefOrRef();
- records[i].MethodDeclaration = mr.ReadMethodDefOrRef();
- }
- }
-
- internal override void Write(MetadataWriter mw)
- {
- for (int i = 0; i < rowCount; i++)
- {
- mw.WriteTypeDef(records[i].Class);
- mw.WriteMethodDefOrRef(records[i].MethodBody);
- mw.WriteMethodDefOrRef(records[i].MethodDeclaration);
- }
- }
-
- protected override int GetRowSize(RowSizeCalc rsc)
- {
- return rsc
- .WriteTypeDef()
- .WriteMethodDefOrRef()
- .WriteMethodDefOrRef()
- .Value;
- }
-
- internal void Fixup(ModuleBuilder moduleBuilder)
- {
- for (int i = 0; i < rowCount; i++)
- {
- moduleBuilder.FixupPseudoToken(ref records[i].MethodBody);
- moduleBuilder.FixupPseudoToken(ref records[i].MethodDeclaration);
- }
- Sort();
- }
- }
-
- sealed class ModuleRefTable : Table<int>
- {
- internal const int Index = 0x1A;
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i] = mr.ReadStringIndex();
- }
- }
-
- internal override void Write(MetadataWriter mw)
- {
- for (int i = 0; i < rowCount; i++)
- {
- mw.WriteStringIndex(records[i]);
- }
- }
-
- protected override int GetRowSize(RowSizeCalc rsc)
- {
- return rsc
- .WriteStringIndex()
- .Value;
- }
-
- internal int FindOrAddRecord(int str)
- {
- for (int i = 0; i < rowCount; i++)
- {
- if (records[i] == str)
- {
- return i + 1;
- }
- }
- return AddRecord(str);
- }
- }
-
- sealed class TypeSpecTable : Table<int>
- {
- internal const int Index = 0x1B;
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i] = mr.ReadBlobIndex();
- }
- }
-
- internal override void Write(MetadataWriter mw)
- {
- for (int i = 0; i < rowCount; i++)
- {
- mw.WriteBlobIndex(records[i]);
- }
- }
-
- protected override int GetRowSize(Table.RowSizeCalc rsc)
- {
- return rsc.WriteBlobIndex().Value;
- }
- }
-
- sealed class ImplMapTable : SortedTable<ImplMapTable.Record>
- {
- internal const int Index = 0x1C;
-
- internal struct Record : IRecord
- {
- internal short MappingFlags;
- internal int MemberForwarded;
- internal int ImportName;
- internal int ImportScope;
-
- int IRecord.SortKey
- {
- get { return MemberForwarded; }
- }
-
- int IRecord.FilterKey
- {
- get { return MemberForwarded; }
- }
- }
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i].MappingFlags = mr.ReadInt16();
- records[i].MemberForwarded = mr.ReadMemberForwarded();
- records[i].ImportName = mr.ReadStringIndex();
- records[i].ImportScope = mr.ReadModuleRef();
- }
- }
-
- internal override void Write(MetadataWriter mw)
- {
- for (int i = 0; i < rowCount; i++)
- {
- mw.Write(records[i].MappingFlags);
- mw.WriteMemberForwarded(records[i].MemberForwarded);
- mw.WriteStringIndex(records[i].ImportName);
- mw.WriteModuleRef(records[i].ImportScope);
- }
- }
-
- protected override int GetRowSize(RowSizeCalc rsc)
- {
- return rsc
- .AddFixed(2)
- .WriteMemberForwarded()
- .WriteStringIndex()
- .WriteModuleRef()
- .Value;
- }
-
- internal void Fixup(ModuleBuilder moduleBuilder)
- {
- for (int i = 0; i < rowCount; i++)
- {
- moduleBuilder.FixupPseudoToken(ref records[i].MemberForwarded);
- }
- Sort();
- }
- }
-
- sealed class FieldRVATable : SortedTable<FieldRVATable.Record>
- {
- internal const int Index = 0x1D;
-
- internal struct Record : IRecord
- {
- internal int RVA; // we set the high bit to signify that the RVA is in the CIL stream (instead of .sdata)
- internal int Field;
-
- int IRecord.SortKey
- {
- get { return Field; }
- }
-
- int IRecord.FilterKey
- {
- get { return Field; }
- }
- }
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i].RVA = mr.ReadInt32();
- records[i].Field = mr.ReadField();
- }
- }
-
- internal override void Write(MetadataWriter mw)
- {
- for (int i = 0; i < rowCount; i++)
- {
- mw.Write(records[i].RVA);
- mw.WriteField(records[i].Field);
- }
- }
-
- protected override int GetRowSize(RowSizeCalc rsc)
- {
- return rsc
- .AddFixed(4)
- .WriteField()
- .Value;
- }
-
- internal void Fixup(ModuleBuilder moduleBuilder, int sdataRVA, int cilRVA)
- {
- for (int i = 0; i < rowCount; i++)
- {
- if (records[i].RVA < 0)
- {
- records[i].RVA = (records[i].RVA & 0x7fffffff) + cilRVA;
- }
- else
- {
- records[i].RVA += sdataRVA;
- }
- moduleBuilder.FixupPseudoToken(ref records[i].Field);
- }
- Sort();
- }
- }
-
- sealed class AssemblyTable : Table<AssemblyTable.Record>
- {
- internal const int Index = 0x20;
-
- internal struct Record
- {
- internal int HashAlgId;
- internal ushort MajorVersion;
- internal ushort MinorVersion;
- internal ushort BuildNumber;
- internal ushort RevisionNumber;
- internal int Flags;
- internal int PublicKey;
- internal int Name;
- internal int Culture;
- }
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i].HashAlgId = mr.ReadInt32();
- records[i].MajorVersion = mr.ReadUInt16();
- records[i].MinorVersion = mr.ReadUInt16();
- records[i].BuildNumber = mr.ReadUInt16();
- records[i].RevisionNumber = mr.ReadUInt16();
- records[i].Flags = mr.ReadInt32();
- records[i].PublicKey = mr.ReadBlobIndex();
- records[i].Name = mr.ReadStringIndex();
- records[i].Culture = mr.ReadStringIndex();
- }
- }
-
- internal override void Write(MetadataWriter mw)
- {
- for (int i = 0; i < rowCount; i++)
- {
- mw.Write(records[i].HashAlgId);
- mw.Write(records[i].MajorVersion);
- mw.Write(records[i].MinorVersion);
- mw.Write(records[i].BuildNumber);
- mw.Write(records[i].RevisionNumber);
- mw.Write(records[i].Flags);
- mw.WriteBlobIndex(records[i].PublicKey);
- mw.WriteStringIndex(records[i].Name);
- mw.WriteStringIndex(records[i].Culture);
- }
- }
-
- protected override int GetRowSize(RowSizeCalc rsc)
- {
- return rsc
- .AddFixed(16)
- .WriteBlobIndex()
- .WriteStringIndex()
- .WriteStringIndex()
- .Value;
- }
- }
-
- sealed class AssemblyRefTable : Table<AssemblyRefTable.Record>
- {
- internal const int Index = 0x23;
-
- internal struct Record
- {
- internal ushort MajorVersion;
- internal ushort MinorVersion;
- internal ushort BuildNumber;
- internal ushort RevisionNumber;
- internal int Flags;
- internal int PublicKeyOrToken;
- internal int Name;
- internal int Culture;
- internal int HashValue;
- }
-
- internal int FindOrAddRecord(Record rec)
- {
- for (int i = 0; i < rowCount; i++)
- {
- // note that we ignore HashValue here!
- if (records[i].Name == rec.Name
- && records[i].MajorVersion == rec.MajorVersion
- && records[i].MinorVersion == rec.MinorVersion
- && records[i].BuildNumber == rec.BuildNumber
- && records[i].RevisionNumber == rec.RevisionNumber
- && records[i].Flags == rec.Flags
- && records[i].PublicKeyOrToken == rec.PublicKeyOrToken
- && records[i].Culture == rec.Culture
- )
- {
- return i + 1;
- }
- }
- return AddRecord(rec);
- }
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i].MajorVersion = mr.ReadUInt16();
- records[i].MinorVersion = mr.ReadUInt16();
- records[i].BuildNumber = mr.ReadUInt16();
- records[i].RevisionNumber = mr.ReadUInt16();
- records[i].Flags = mr.ReadInt32();
- records[i].PublicKeyOrToken = mr.ReadBlobIndex();
- records[i].Name = mr.ReadStringIndex();
- records[i].Culture = mr.ReadStringIndex();
- records[i].HashValue = mr.ReadBlobIndex();
- }
- }
-
- internal override void Write(MetadataWriter mw)
- {
- for (int i = 0; i < rowCount; i++)
- {
- mw.Write(records[i].MajorVersion);
- mw.Write(records[i].MinorVersion);
- mw.Write(records[i].BuildNumber);
- mw.Write(records[i].RevisionNumber);
- mw.Write(records[i].Flags);
- mw.WriteBlobIndex(records[i].PublicKeyOrToken);
- mw.WriteStringIndex(records[i].Name);
- mw.WriteStringIndex(records[i].Culture);
- mw.WriteBlobIndex(records[i].HashValue);
- }
- }
-
- protected override int GetRowSize(RowSizeCalc rsc)
- {
- return rsc
- .AddFixed(12)
- .WriteBlobIndex()
- .WriteStringIndex()
- .WriteStringIndex()
- .WriteBlobIndex()
- .Value;
- }
- }
-
- sealed class FileTable : Table<FileTable.Record>
- {
- internal const int Index = 0x26;
-
- internal struct Record
- {
- internal int Flags;
- internal int Name;
- internal int HashValue;
- }
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i].Flags = mr.ReadInt32();
- records[i].Name = mr.ReadStringIndex();
- records[i].HashValue = mr.ReadBlobIndex();
- }
- }
-
- internal override void Write(MetadataWriter mw)
- {
- for (int i = 0; i < rowCount; i++)
- {
- mw.Write(records[i].Flags);
- mw.WriteStringIndex(records[i].Name);
- mw.WriteBlobIndex(records[i].HashValue);
- }
- }
-
- protected override int GetRowSize(RowSizeCalc rsc)
- {
- return rsc
- .AddFixed(4)
- .WriteStringIndex()
- .WriteBlobIndex()
- .Value;
- }
- }
-
- sealed class ExportedTypeTable : Table<ExportedTypeTable.Record>
- {
- internal const int Index = 0x27;
-
- internal struct Record
- {
- internal int Flags;
- internal int TypeDefId;
- internal int TypeName;
- internal int TypeNamespace;
- internal int Implementation;
- }
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i].Flags = mr.ReadInt32();
- records[i].TypeDefId = mr.ReadInt32();
- records[i].TypeName = mr.ReadStringIndex();
- records[i].TypeNamespace = mr.ReadStringIndex();
- records[i].Implementation = mr.ReadImplementation();
- }
- }
-
- internal override void Write(MetadataWriter mw)
- {
- for (int i = 0; i < rowCount; i++)
- {
- mw.Write(records[i].Flags);
- mw.Write(records[i].TypeDefId);
- mw.WriteStringIndex(records[i].TypeName);
- mw.WriteStringIndex(records[i].TypeNamespace);
- mw.WriteImplementation(records[i].Implementation);
- }
- }
-
- protected override int GetRowSize(RowSizeCalc rsc)
- {
- return rsc
- .AddFixed(8)
- .WriteStringIndex()
- .WriteStringIndex()
- .WriteImplementation()
- .Value;
- }
-
- internal int FindOrAddRecord(Record rec)
- {
- for (int i = 0; i < rowCount; i++)
- {
- if (records[i].Implementation == rec.Implementation
- && records[i].TypeName == rec.TypeName
- && records[i].TypeNamespace == rec.TypeNamespace)
- {
- return i + 1;
- }
- }
- return AddRecord(rec);
- }
-
- internal void Fixup(ModuleBuilder moduleBuilder)
- {
- for (int i = 0; i < rowCount; i++)
- {
- moduleBuilder.FixupPseudoToken(ref records[i].Implementation);
- }
- }
- }
-
- sealed class ManifestResourceTable : Table<ManifestResourceTable.Record>
- {
- internal const int Index = 0x28;
-
- internal struct Record
- {
- internal int Offset;
- internal int Flags;
- internal int Name;
- internal int Implementation;
- }
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i].Offset = mr.ReadInt32();
- records[i].Flags = mr.ReadInt32();
- records[i].Name = mr.ReadStringIndex();
- records[i].Implementation = mr.ReadImplementation();
- }
- }
-
- internal override void Write(MetadataWriter mw)
- {
- for (int i = 0; i < rowCount; i++)
- {
- mw.Write(records[i].Offset);
- mw.Write(records[i].Flags);
- mw.WriteStringIndex(records[i].Name);
- mw.WriteImplementation(records[i].Implementation);
- }
- }
-
- protected override int GetRowSize(RowSizeCalc rsc)
- {
- return rsc
- .AddFixed(8)
- .WriteStringIndex()
- .WriteImplementation()
- .Value;
- }
-
- internal void Fixup(ModuleBuilder moduleBuilder)
- {
- for (int i = 0; i < rowCount; i++)
- {
- moduleBuilder.FixupPseudoToken(ref records[i].Implementation);
- }
- }
- }
-
- sealed class NestedClassTable : SortedTable<NestedClassTable.Record>
- {
- internal const int Index = 0x29;
-
- internal struct Record : IRecord
- {
- internal int NestedClass;
- internal int EnclosingClass;
-
- int IRecord.SortKey
- {
- get { return NestedClass; }
- }
-
- int IRecord.FilterKey
- {
- get { return NestedClass; }
- }
- }
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i].NestedClass = mr.ReadTypeDef();
- records[i].EnclosingClass = mr.ReadTypeDef();
- }
- }
-
- internal override void Write(MetadataWriter mw)
- {
- for (int i = 0; i < rowCount; i++)
- {
- mw.WriteTypeDef(records[i].NestedClass);
- mw.WriteTypeDef(records[i].EnclosingClass);
- }
- }
-
- protected override int GetRowSize(RowSizeCalc rsc)
- {
- return rsc
- .WriteTypeDef()
- .WriteTypeDef()
- .Value;
- }
-
- internal List<int> GetNestedClasses(int enclosingClass)
- {
- List<int> nestedClasses = new List<int>();
- for (int i = 0; i < rowCount; i++)
- {
- if (records[i].EnclosingClass == enclosingClass)
- {
- nestedClasses.Add(records[i].NestedClass);
- }
- }
- return nestedClasses;
- }
- }
-
- sealed class GenericParamTable : SortedTable<GenericParamTable.Record>, IComparer<GenericParamTable.Record>
- {
- internal const int Index = 0x2A;
-
- internal struct Record : IRecord
- {
- internal short Number;
- internal short Flags;
- internal int Owner;
- internal int Name;
- // not part of the table, we use it to be able to fixup the GenericParamConstraint table
- internal int unsortedIndex;
-
- int IRecord.SortKey
- {
- get { return Owner; }
- }
-
- int IRecord.FilterKey
- {
- get { return Owner; }
- }
- }
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i].Number = mr.ReadInt16();
- records[i].Flags = mr.ReadInt16();
- records[i].Owner = mr.ReadTypeOrMethodDef();
- records[i].Name = mr.ReadStringIndex();
- }
- }
-
- internal override void Write(MetadataWriter mw)
- {
- for (int i = 0; i < rowCount; i++)
- {
- mw.Write(records[i].Number);
- mw.Write(records[i].Flags);
- mw.WriteTypeOrMethodDef(records[i].Owner);
- mw.WriteStringIndex(records[i].Name);
- }
- }
-
- protected override int GetRowSize(RowSizeCalc rsc)
- {
- return rsc
- .AddFixed(4)
- .WriteTypeOrMethodDef()
- .WriteStringIndex()
- .Value;
- }
-
- internal void Fixup(ModuleBuilder moduleBuilder)
- {
- for (int i = 0; i < rowCount; i++)
- {
- int token = records[i].Owner;
- moduleBuilder.FixupPseudoToken(ref token);
- // do the TypeOrMethodDef encoding, so that we can sort the table
- switch (token >> 24)
- {
- case TypeDefTable.Index:
- records[i].Owner = (token & 0xFFFFFF) << 1 | 0;
- break;
- case MethodDefTable.Index:
- records[i].Owner = (token & 0xFFFFFF) << 1 | 1;
- break;
- default:
- throw new InvalidOperationException();
- }
- records[i].unsortedIndex = i;
- }
- // FXBUG the unnecessary (IComparer<Record>) cast is a workaround for a .NET 2.0 C# compiler bug
- Array.Sort(records, 0, rowCount, (IComparer<Record>)this);
- }
-
- int IComparer<Record>.Compare(Record x, Record y)
- {
- if (x.Owner == y.Owner)
- {
- return x.Number == y.Number ? 0 : (x.Number > y.Number ? 1 : -1);
- }
- return x.Owner > y.Owner ? 1 : -1;
- }
-
- internal void PatchAttribute(int token, GenericParameterAttributes genericParameterAttributes)
- {
- records[(token & 0xFFFFFF) - 1].Flags = (short)genericParameterAttributes;
- }
-
- internal int[] GetIndexFixup()
- {
- int[] array = new int[rowCount];
- for (int i = 0; i < rowCount; i++)
- {
- array[records[i].unsortedIndex] = i;
- }
- return array;
- }
-
- internal int FindFirstByOwner(int token)
- {
- foreach (int i in Filter(token))
- {
- return i;
- }
- return -1;
- }
- }
-
- sealed class MethodSpecTable : Table<MethodSpecTable.Record>
- {
- internal const int Index = 0x2B;
-
- internal struct Record
- {
- internal int Method;
- internal int Instantiation;
- }
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i].Method = mr.ReadMethodDefOrRef();
- records[i].Instantiation = mr.ReadBlobIndex();
- }
- }
-
- internal override void Write(MetadataWriter mw)
- {
- for (int i = 0; i < rowCount; i++)
- {
- mw.WriteMethodDefOrRef(records[i].Method);
- mw.WriteBlobIndex(records[i].Instantiation);
- }
- }
-
- protected override int GetRowSize(RowSizeCalc rsc)
- {
- return rsc
- .WriteMethodDefOrRef()
- .WriteBlobIndex()
- .Value;
- }
-
- internal int FindOrAddRecord(Record record)
- {
- for (int i = 0; i < rowCount; i++)
- {
- if (records[i].Method == record.Method
- && records[i].Instantiation == record.Instantiation)
- {
- return i + 1;
- }
- }
- return AddRecord(record);
- }
-
- internal void Fixup(ModuleBuilder moduleBuilder)
- {
- for (int i = 0; i < rowCount; i++)
- {
- moduleBuilder.FixupPseudoToken(ref records[i].Method);
- }
- }
- }
-
- sealed class GenericParamConstraintTable : SortedTable<GenericParamConstraintTable.Record>
- {
- internal const int Index = 0x2C;
-
- internal struct Record : IRecord
- {
- internal int Owner;
- internal int Constraint;
-
- int IRecord.SortKey
- {
- get { return Owner; }
- }
-
- int IRecord.FilterKey
- {
- get { return Owner; }
- }
- }
-
- internal override void Read(MetadataReader mr)
- {
- for (int i = 0; i < records.Length; i++)
- {
- records[i].Owner = mr.ReadGenericParam();
- records[i].Constraint = mr.ReadTypeDefOrRef();
- }
- }
-
- internal override void Write(MetadataWriter mw)
- {
- for (int i = 0; i < rowCount; i++)
- {
- mw.WriteGenericParam(records[i].Owner);
- mw.WriteTypeDefOrRef(records[i].Constraint);
- }
- }
-
- protected override int GetRowSize(RowSizeCalc rsc)
- {
- return rsc
- .WriteGenericParam()
- .WriteTypeDefOrRef()
- .Value;
- }
-
- internal void Fixup(ModuleBuilder moduleBuilder)
- {
- int[] fixups = moduleBuilder.GenericParam.GetIndexFixup();
- for (int i = 0; i < rowCount; i++)
- {
- records[i].Owner = fixups[records[i].Owner - 1] + 1;
- }
- Sort();
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-
-namespace IKVM.Reflection
-{
- public abstract class MethodBase : MemberInfo
- {
- // prevent external subclasses
- internal MethodBase()
- {
- }
-
- internal abstract MethodSignature MethodSignature { get; }
- internal abstract int ParameterCount { get; }
- public abstract ParameterInfo[] GetParameters();
- public abstract MethodAttributes Attributes { get; }
- public abstract MethodImplAttributes GetMethodImplementationFlags();
- public abstract MethodBody GetMethodBody();
- public abstract CallingConventions CallingConvention { get; }
- public abstract int __MethodRVA { get; }
-
- public bool IsConstructor
- {
- get
- {
- if ((this.Attributes & MethodAttributes.RTSpecialName) != 0)
- {
- string name = this.Name;
- return name == ConstructorInfo.ConstructorName || name == ConstructorInfo.TypeConstructorName;
- }
- return false;
- }
- }
-
- public bool IsStatic
- {
- get { return (Attributes & MethodAttributes.Static) != 0; }
- }
-
- public bool IsVirtual
- {
- get { return (Attributes & MethodAttributes.Virtual) != 0; }
- }
-
- public bool IsAbstract
- {
- get { return (Attributes & MethodAttributes.Abstract) != 0; }
- }
-
- public bool IsFinal
- {
- get { return (Attributes & MethodAttributes.Final) != 0; }
- }
-
- public bool IsPublic
- {
- get { return (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Public; }
- }
-
- public bool IsFamily
- {
- get { return (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Family; }
- }
-
- public bool IsFamilyOrAssembly
- {
- get { return (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.FamORAssem; }
- }
-
- public bool IsAssembly
- {
- get { return (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Assembly; }
- }
-
- public bool IsFamilyAndAssembly
- {
- get { return (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.FamANDAssem; }
- }
-
- public bool IsPrivate
- {
- get { return (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Private; }
- }
-
- public bool IsSpecialName
- {
- get { return (Attributes & MethodAttributes.SpecialName) != 0; }
- }
-
- public bool IsHideBySig
- {
- get { return (Attributes & MethodAttributes.HideBySig) != 0; }
- }
-
- public virtual Type[] GetGenericArguments()
- {
- return Type.EmptyTypes;
- }
-
- public virtual bool IsGenericMethod
- {
- get { return false; }
- }
-
- public virtual bool IsGenericMethodDefinition
- {
- get { return false; }
- }
-
- public virtual bool ContainsGenericParameters
- {
- get { return IsGenericMethodDefinition; }
- }
-
- public virtual MethodBase __GetMethodOnTypeDefinition()
- {
- return this;
- }
-
- // This goes to the (uninstantiated) MethodInfo on the (uninstantiated) Type. For constructors
- // it also has the effect of removing the ConstructorInfo wrapper and returning the underlying MethodInfo.
- internal abstract MethodInfo GetMethodOnTypeDefinition();
-
- internal abstract int ImportTo(Emit.ModuleBuilder module);
-
- internal abstract MethodBase BindTypeParameters(Type type);
-
- internal sealed override bool BindingFlagsMatch(BindingFlags flags)
- {
- return BindingFlagsMatch(IsPublic, flags, BindingFlags.Public, BindingFlags.NonPublic)
- && BindingFlagsMatch(IsStatic, flags, BindingFlags.Static, BindingFlags.Instance);
- }
-
- internal sealed override bool BindingFlagsMatchInherited(BindingFlags flags)
- {
- return (Attributes & MethodAttributes.MemberAccessMask) > MethodAttributes.Private
- && BindingFlagsMatch(IsPublic, flags, BindingFlags.Public, BindingFlags.NonPublic)
- && BindingFlagsMatch(IsStatic, flags, BindingFlags.Static | BindingFlags.FlattenHierarchy, BindingFlags.Instance);
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using IKVM.Reflection.Reader;
-using System.IO;
-
-namespace IKVM.Reflection
-{
- public sealed class MethodBody
- {
- private readonly IList<ExceptionHandlingClause> exceptionClauses;
- private readonly IList<LocalVariableInfo> locals;
- private readonly bool initLocals;
- private readonly int maxStack;
- private readonly int localVarSigTok;
- private byte[] body;
-
- internal MethodBody(ModuleReader module, int rva, IGenericContext context)
- {
- const byte CorILMethod_TinyFormat = 0x02;
- const byte CorILMethod_FatFormat = 0x03;
- const byte CorILMethod_MoreSects = 0x08;
- const byte CorILMethod_InitLocals = 0x10;
- const byte CorILMethod_Sect_EHTable = 0x01;
- const byte CorILMethod_Sect_FatFormat = 0x40;
- const byte CorILMethod_Sect_MoreSects = 0x80;
-
- List<ExceptionHandlingClause> exceptionClauses = new List<ExceptionHandlingClause>();
- List<LocalVariableInfo> locals = new List<LocalVariableInfo>();
- module.SeekRVA(rva);
- BinaryReader br = new BinaryReader(module.stream);
- byte b = br.ReadByte();
- if ((b & 3) == CorILMethod_TinyFormat)
- {
- initLocals = true;
- body = br.ReadBytes(b >> 2);
- maxStack = 8;
- }
- else if ((b & 3) == CorILMethod_FatFormat)
- {
- initLocals = (b & CorILMethod_InitLocals) != 0;
- short flagsAndSize = (short)(b | (br.ReadByte() << 8));
- if ((flagsAndSize >> 12) != 3)
- {
- throw new BadImageFormatException("Fat format method header size should be 3");
- }
- maxStack = br.ReadUInt16();
- int codeLength = br.ReadInt32();
- localVarSigTok = br.ReadInt32();
- body = br.ReadBytes(codeLength);
- if ((b & CorILMethod_MoreSects) != 0)
- {
- module.stream.Position = (module.stream.Position + 3) & ~3;
- int hdr = br.ReadInt32();
- if ((hdr & CorILMethod_Sect_MoreSects) != 0 || (hdr & CorILMethod_Sect_EHTable) == 0)
- {
- throw new NotImplementedException();
- }
- else if ((hdr & CorILMethod_Sect_FatFormat) != 0)
- {
- int count = ComputeExceptionCount((hdr >> 8) & 0xFFFFFF, 24);
- for (int i = 0; i < count; i++)
- {
- int flags = br.ReadInt32();
- int tryOffset = br.ReadInt32();
- int tryLength = br.ReadInt32();
- int handlerOffset = br.ReadInt32();
- int handlerLength = br.ReadInt32();
- int classTokenOrFilterOffset = br.ReadInt32();
- exceptionClauses.Add(new ExceptionHandlingClause(module, flags, tryOffset, tryLength, handlerOffset, handlerLength, classTokenOrFilterOffset, context));
- }
- }
- else
- {
- int count = ComputeExceptionCount((hdr >> 8) & 0xFF, 12);
- for (int i = 0; i < count; i++)
- {
- int flags = br.ReadUInt16();
- int tryOffset = br.ReadUInt16();
- int tryLength = br.ReadByte();
- int handlerOffset = br.ReadUInt16();
- int handlerLength = br.ReadByte();
- int classTokenOrFilterOffset = br.ReadInt32();
- exceptionClauses.Add(new ExceptionHandlingClause(module, flags, tryOffset, tryLength, handlerOffset, handlerLength, classTokenOrFilterOffset, context));
- }
- }
- }
- if (localVarSigTok != 0)
- {
- ByteReader sig = module.GetStandAloneSig((localVarSigTok & 0xFFFFFF) - 1);
- Signature.ReadLocalVarSig(module, sig, context, locals);
- }
- }
- else
- {
- throw new BadImageFormatException();
- }
- this.exceptionClauses = exceptionClauses.AsReadOnly();
- this.locals = locals.AsReadOnly();
- }
-
- private static int ComputeExceptionCount(int size, int itemLength)
- {
- // LAMESPEC according to the spec, the count should be calculated as "(size - 4) / itemLength",
- // FXBUG but to workaround a VB compiler bug that specifies the size incorrectly,
- // we do a truncating division instead.
- return size / itemLength;
- }
-
- public IList<ExceptionHandlingClause> ExceptionHandlingClauses
- {
- get { return exceptionClauses; }
- }
-
- public bool InitLocals
- {
- get { return initLocals; }
- }
-
- public IList<LocalVariableInfo> LocalVariables
- {
- get { return locals; }
- }
-
- public byte[] GetILAsByteArray()
- {
- return body;
- }
-
- public int LocalSignatureMetadataToken
- {
- get { return localVarSigTok; }
- }
-
- public int MaxStackSize
- {
- get { return maxStack; }
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace IKVM.Reflection
-{
- public struct __MethodImplMap
- {
- public Type TargetType;
- public MethodInfo[] MethodBodies;
- public MethodInfo[][] MethodDeclarations;
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009-2012 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Text;
-
-namespace IKVM.Reflection
-{
- public abstract class MethodInfo : MethodBase, IGenericContext, IGenericBinder
- {
- // prevent external subclasses
- internal MethodInfo()
- {
- }
-
- public sealed override MemberTypes MemberType
- {
- get { return MemberTypes.Method; }
- }
-
- public abstract Type ReturnType { get; }
- public abstract ParameterInfo ReturnParameter { get; }
-
- public virtual MethodInfo MakeGenericMethod(params Type[] typeArguments)
- {
- throw new NotSupportedException(this.GetType().FullName);
- }
-
- public virtual MethodInfo GetGenericMethodDefinition()
- {
- throw new NotSupportedException(this.GetType().FullName);
- }
-
- public override string ToString()
- {
- StringBuilder sb = new StringBuilder();
- sb.Append(this.ReturnType.Name).Append(' ').Append(this.Name);
- string sep;
- if (this.IsGenericMethod)
- {
- sb.Append('[');
- sep = "";
- foreach (Type arg in GetGenericArguments())
- {
- sb.Append(sep).Append(arg);
- sep = ", ";
- }
- sb.Append(']');
- }
- sb.Append('(');
- sep = "";
- foreach (ParameterInfo arg in GetParameters())
- {
- sb.Append(sep).Append(arg.ParameterType);
- sep = ", ";
- }
- sb.Append(')');
- return sb.ToString();
- }
-
- internal bool IsNewSlot
- {
- get { return (this.Attributes & MethodAttributes.NewSlot) != 0; }
- }
-
- public MethodInfo GetBaseDefinition()
- {
- MethodInfo match = this;
- if (match.IsVirtual)
- {
- for (Type type = this.DeclaringType.BaseType; type != null && !match.IsNewSlot; type = type.BaseType)
- {
- MethodInfo method = type.FindMethod(this.Name, this.MethodSignature) as MethodInfo;
- if (method != null && method.IsVirtual)
- {
- match = method;
- }
- }
- }
- return match;
- }
-
- public virtual MethodInfo[] __GetMethodImpls()
- {
- throw new NotSupportedException();
- }
-
- public bool __TryGetImplMap(out ImplMapFlags mappingFlags, out string importName, out string importScope)
- {
- Module module = this.Module;
- foreach (int i in module.ImplMap.Filter(GetCurrentToken()))
- {
- mappingFlags = (ImplMapFlags)(ushort)module.ImplMap.records[i].MappingFlags;
- importName = module.GetString(module.ImplMap.records[i].ImportName);
- importScope = module.GetString(module.ModuleRef.records[(module.ImplMap.records[i].ImportScope & 0xFFFFFF) - 1]);
- return true;
- }
- mappingFlags = 0;
- importName = null;
- importScope = null;
- return false;
- }
-
- public ConstructorInfo __AsConstructorInfo()
- {
- return new ConstructorInfoImpl(this);
- }
-
- Type IGenericContext.GetGenericTypeArgument(int index)
- {
- return this.DeclaringType.GetGenericTypeArgument(index);
- }
-
- Type IGenericContext.GetGenericMethodArgument(int index)
- {
- return GetGenericMethodArgument(index);
- }
-
- internal virtual Type GetGenericMethodArgument(int index)
- {
- throw new InvalidOperationException();
- }
-
- internal virtual int GetGenericMethodArgumentCount()
- {
- throw new InvalidOperationException();
- }
-
- internal override MethodInfo GetMethodOnTypeDefinition()
- {
- return this;
- }
-
- Type IGenericBinder.BindTypeParameter(Type type)
- {
- return this.DeclaringType.GetGenericTypeArgument(type.GenericParameterPosition);
- }
-
- Type IGenericBinder.BindMethodParameter(Type type)
- {
- return GetGenericMethodArgument(type.GenericParameterPosition);
- }
-
- internal override MethodBase BindTypeParameters(Type type)
- {
- return new GenericMethodInstance(this.DeclaringType.BindTypeParameters(type), this, null);
- }
-
- // This method is used by ILGenerator and exists to allow ArrayMethod to override it,
- // because ArrayMethod doesn't have a working MethodAttributes property, so it needs
- // to base the result of this on the CallingConvention.
- internal virtual bool HasThis
- {
- get { return !IsStatic; }
- }
-
- internal sealed override MemberInfo SetReflectedType(Type type)
- {
- return new MethodInfoWithReflectedType(type, this);
- }
-
- internal sealed override List<CustomAttributeData> GetPseudoCustomAttributes(Type attributeType)
- {
- Module module = this.Module;
- List<CustomAttributeData> list = new List<CustomAttributeData>();
- if ((this.Attributes & MethodAttributes.PinvokeImpl) != 0
- && (attributeType == null || attributeType.IsAssignableFrom(module.universe.System_Runtime_InteropServices_DllImportAttribute)))
- {
- ImplMapFlags flags;
- string importName;
- string importScope;
- if (__TryGetImplMap(out flags, out importName, out importScope))
- {
- list.Add(CustomAttributeData.CreateDllImportPseudoCustomAttribute(module, flags, importName, importScope, GetMethodImplementationFlags()));
- }
- }
- if ((GetMethodImplementationFlags() & MethodImplAttributes.PreserveSig) != 0
- && (attributeType == null || attributeType.IsAssignableFrom(module.universe.System_Runtime_InteropServices_PreserveSigAttribute)))
- {
- list.Add(CustomAttributeData.CreatePreserveSigPseudoCustomAttribute(module));
- }
- return list;
- }
- }
-
- sealed class MethodInfoWithReflectedType : MethodInfo
- {
- private readonly Type reflectedType;
- private readonly MethodInfo method;
-
- internal MethodInfoWithReflectedType(Type reflectedType, MethodInfo method)
- {
- Debug.Assert(reflectedType != method.DeclaringType);
- this.reflectedType = reflectedType;
- this.method = method;
- }
-
- public override bool Equals(object obj)
- {
- MethodInfoWithReflectedType other = obj as MethodInfoWithReflectedType;
- return other != null
- && other.reflectedType == reflectedType
- && other.method == method;
- }
-
- public override int GetHashCode()
- {
- return reflectedType.GetHashCode() ^ method.GetHashCode();
- }
-
- internal override MethodSignature MethodSignature
- {
- get { return method.MethodSignature; }
- }
-
- internal override int ParameterCount
- {
- get { return method.ParameterCount; }
- }
-
- public override ParameterInfo[] GetParameters()
- {
- ParameterInfo[] parameters = method.GetParameters();
- for (int i = 0; i < parameters.Length; i++)
- {
- parameters[i] = new ParameterInfoWrapper(this, parameters[i]);
- }
- return parameters;
- }
-
- public override MethodAttributes Attributes
- {
- get { return method.Attributes; }
- }
-
- public override MethodImplAttributes GetMethodImplementationFlags()
- {
- return method.GetMethodImplementationFlags();
- }
-
- public override MethodBody GetMethodBody()
- {
- return method.GetMethodBody();
- }
-
- public override CallingConventions CallingConvention
- {
- get { return method.CallingConvention; }
- }
-
- public override int __MethodRVA
- {
- get { return method.__MethodRVA; }
- }
-
- public override Type ReturnType
- {
- get { return method.ReturnType; }
- }
-
- public override ParameterInfo ReturnParameter
- {
- get { return new ParameterInfoWrapper(this, method.ReturnParameter); }
- }
-
- public override MethodInfo MakeGenericMethod(params Type[] typeArguments)
- {
- return SetReflectedType(method.MakeGenericMethod(typeArguments), reflectedType);
- }
-
- public override MethodInfo GetGenericMethodDefinition()
- {
- return method.GetGenericMethodDefinition();
- }
-
- public override string ToString()
- {
- return method.ToString();
- }
-
- public override MethodInfo[] __GetMethodImpls()
- {
- return method.__GetMethodImpls();
- }
-
- internal override Type GetGenericMethodArgument(int index)
- {
- return method.GetGenericMethodArgument(index);
- }
-
- internal override int GetGenericMethodArgumentCount()
- {
- return method.GetGenericMethodArgumentCount();
- }
-
- internal override MethodInfo GetMethodOnTypeDefinition()
- {
- return method.GetMethodOnTypeDefinition();
- }
-
- internal override bool HasThis
- {
- get { return method.HasThis; }
- }
-
- public override Module Module
- {
- get { return method.Module; }
- }
-
- public override Type DeclaringType
- {
- get { return method.DeclaringType; }
- }
-
- public override Type ReflectedType
- {
- get { return reflectedType; }
- }
-
- public override string Name
- {
- get { return method.Name; }
- }
-
- internal override int ImportTo(IKVM.Reflection.Emit.ModuleBuilder module)
- {
- return method.ImportTo(module);
- }
-
- public override MethodBase __GetMethodOnTypeDefinition()
- {
- return method.__GetMethodOnTypeDefinition();
- }
-
- public override bool __IsMissing
- {
- get { return method.__IsMissing; }
- }
-
- internal override MethodBase BindTypeParameters(Type type)
- {
- return method.BindTypeParameters(type);
- }
-
- public override bool ContainsGenericParameters
- {
- get { return method.ContainsGenericParameters; }
- }
-
- public override Type[] GetGenericArguments()
- {
- return method.GetGenericArguments();
- }
-
- public override bool IsGenericMethod
- {
- get { return method.IsGenericMethod; }
- }
-
- public override bool IsGenericMethodDefinition
- {
- get { return method.IsGenericMethodDefinition; }
- }
-
- public override int MetadataToken
- {
- get { return method.MetadataToken; }
- }
-
- internal override int GetCurrentToken()
- {
- return method.GetCurrentToken();
- }
-
- internal override bool IsBaked
- {
- get { return method.IsBaked; }
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009-2011 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using IKVM.Reflection.Reader;
-using IKVM.Reflection.Writer;
-using IKVM.Reflection.Emit;
-
-namespace IKVM.Reflection
-{
- sealed class MethodSignature : Signature
- {
- private readonly Type returnType;
- private readonly Type[] parameterTypes;
- private readonly PackedCustomModifiers modifiers;
- private readonly CallingConventions callingConvention;
- private readonly int genericParamCount;
-
- internal MethodSignature(Type returnType, Type[] parameterTypes, PackedCustomModifiers modifiers, CallingConventions callingConvention, int genericParamCount)
- {
- this.returnType = returnType;
- this.parameterTypes = parameterTypes;
- this.modifiers = modifiers;
- this.callingConvention = callingConvention;
- this.genericParamCount = genericParamCount;
- }
-
- public override bool Equals(object obj)
- {
- MethodSignature other = obj as MethodSignature;
- return other != null
- && other.callingConvention == callingConvention
- && other.genericParamCount == genericParamCount
- && other.returnType.Equals(returnType)
- && Util.ArrayEquals(other.parameterTypes, parameterTypes)
- && other.modifiers.Equals(modifiers);
- }
-
- public override int GetHashCode()
- {
- return genericParamCount ^ 77 * (int)callingConvention
- ^ 3 * returnType.GetHashCode()
- ^ Util.GetHashCode(parameterTypes) * 5
- ^ modifiers.GetHashCode() * 55;
- }
-
- private sealed class UnboundGenericMethodContext : IGenericContext
- {
- private readonly IGenericContext original;
-
- internal UnboundGenericMethodContext(IGenericContext original)
- {
- this.original = original;
- }
-
- public Type GetGenericTypeArgument(int index)
- {
- return original.GetGenericTypeArgument(index);
- }
-
- public Type GetGenericMethodArgument(int index)
- {
- return UnboundGenericMethodParameter.Make(index);
- }
- }
-
- internal static MethodSignature ReadSig(ModuleReader module, ByteReader br, IGenericContext context)
- {
- CallingConventions callingConvention;
- int genericParamCount;
- Type returnType;
- Type[] parameterTypes;
- byte flags = br.ReadByte();
- switch (flags & 7)
- {
- case DEFAULT:
- callingConvention = CallingConventions.Standard;
- break;
- case VARARG:
- callingConvention = CallingConventions.VarArgs;
- break;
- default:
- throw new BadImageFormatException();
- }
- if ((flags & HASTHIS) != 0)
- {
- callingConvention |= CallingConventions.HasThis;
- }
- if ((flags & EXPLICITTHIS) != 0)
- {
- callingConvention |= CallingConventions.ExplicitThis;
- }
- genericParamCount = 0;
- if ((flags & GENERIC) != 0)
- {
- genericParamCount = br.ReadCompressedInt();
- context = new UnboundGenericMethodContext(context);
- }
- int paramCount = br.ReadCompressedInt();
- CustomModifiers[] modifiers = null;
- PackedCustomModifiers.Pack(ref modifiers, 0, CustomModifiers.Read(module, br, context), paramCount + 1);
- returnType = ReadRetType(module, br, context);
- parameterTypes = new Type[paramCount];
- for (int i = 0; i < parameterTypes.Length; i++)
- {
- if ((callingConvention & CallingConventions.VarArgs) != 0 && br.PeekByte() == SENTINEL)
- {
- Array.Resize(ref parameterTypes, i);
- if (modifiers != null)
- {
- Array.Resize(ref modifiers, i + 1);
- }
- break;
- }
- PackedCustomModifiers.Pack(ref modifiers, i + 1, CustomModifiers.Read(module, br, context), paramCount + 1);
- parameterTypes[i] = ReadParam(module, br, context);
- }
- return new MethodSignature(returnType, parameterTypes, PackedCustomModifiers.Wrap(modifiers), callingConvention, genericParamCount);
- }
-
- internal static __StandAloneMethodSig ReadStandAloneMethodSig(ModuleReader module, ByteReader br, IGenericContext context)
- {
- CallingConventions callingConvention = 0;
- System.Runtime.InteropServices.CallingConvention unmanagedCallingConvention = 0;
- bool unmanaged;
- byte flags = br.ReadByte();
- switch (flags & 7)
- {
- case DEFAULT:
- callingConvention = CallingConventions.Standard;
- unmanaged = false;
- break;
- case 0x01: // C
- unmanagedCallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl;
- unmanaged = true;
- break;
- case 0x02: // STDCALL
- unmanagedCallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall;
- unmanaged = true;
- break;
- case 0x03: // THISCALL
- unmanagedCallingConvention = System.Runtime.InteropServices.CallingConvention.ThisCall;
- unmanaged = true;
- break;
- case 0x04: // FASTCALL
- unmanagedCallingConvention = System.Runtime.InteropServices.CallingConvention.FastCall;
- unmanaged = true;
- break;
- case VARARG:
- callingConvention = CallingConventions.VarArgs;
- unmanaged = false;
- break;
- default:
- throw new BadImageFormatException();
- }
- if ((flags & HASTHIS) != 0)
- {
- callingConvention |= CallingConventions.HasThis;
- }
- if ((flags & EXPLICITTHIS) != 0)
- {
- callingConvention |= CallingConventions.ExplicitThis;
- }
- if ((flags & GENERIC) != 0)
- {
- throw new BadImageFormatException();
- }
- int paramCount = br.ReadCompressedInt();
- CustomModifiers[] customModifiers = null;
- PackedCustomModifiers.Pack(ref customModifiers, 0, CustomModifiers.Read(module, br, context), paramCount + 1);
- Type returnType = ReadRetType(module, br, context);
- List<Type> parameterTypes = new List<Type>();
- List<Type> optionalParameterTypes = new List<Type>();
- List<Type> curr = parameterTypes;
- for (int i = 0; i < paramCount; i++)
- {
- if (br.PeekByte() == SENTINEL)
- {
- br.ReadByte();
- curr = optionalParameterTypes;
- }
- PackedCustomModifiers.Pack(ref customModifiers, i + 1, CustomModifiers.Read(module, br, context), paramCount + 1);
- curr.Add(ReadParam(module, br, context));
- }
- return new __StandAloneMethodSig(unmanaged, unmanagedCallingConvention, callingConvention, returnType, parameterTypes.ToArray(), optionalParameterTypes.ToArray(), PackedCustomModifiers.Wrap(customModifiers));
- }
-
- internal int GetParameterCount()
- {
- return parameterTypes.Length;
- }
-
- internal Type GetParameterType(int index)
- {
- return parameterTypes[index];
- }
-
- internal Type GetReturnType(IGenericBinder binder)
- {
- return returnType.BindTypeParameters(binder);
- }
-
- internal CustomModifiers GetReturnTypeCustomModifiers(IGenericBinder binder)
- {
- return modifiers.GetReturnTypeCustomModifiers().Bind(binder);
- }
-
- internal Type GetParameterType(IGenericBinder binder, int index)
- {
- return parameterTypes[index].BindTypeParameters(binder);
- }
-
- internal CustomModifiers GetParameterCustomModifiers(IGenericBinder binder, int index)
- {
- return modifiers.GetParameterCustomModifiers(index).Bind(binder);
- }
-
- internal CallingConventions CallingConvention
- {
- get { return callingConvention; }
- }
-
- internal int GenericParameterCount
- {
- get { return genericParamCount; }
- }
-
- private sealed class Binder : IGenericBinder
- {
- private readonly Type declaringType;
- private readonly Type[] methodArgs;
-
- internal Binder(Type declaringType, Type[] methodArgs)
- {
- this.declaringType = declaringType;
- this.methodArgs = methodArgs;
- }
-
- public Type BindTypeParameter(Type type)
- {
- return declaringType.GetGenericTypeArgument(type.GenericParameterPosition);
- }
-
- public Type BindMethodParameter(Type type)
- {
- if (methodArgs == null)
- {
- return type;
- }
- return methodArgs[type.GenericParameterPosition];
- }
- }
-
- internal MethodSignature Bind(Type type, Type[] methodArgs)
- {
- Binder binder = new Binder(type, methodArgs);
- return new MethodSignature(returnType.BindTypeParameters(binder),
- BindTypeParameters(binder, parameterTypes),
- modifiers.Bind(binder),
- callingConvention, genericParamCount);
- }
-
- private sealed class Unbinder : IGenericBinder
- {
- internal static readonly Unbinder Instance = new Unbinder();
-
- private Unbinder()
- {
- }
-
- public Type BindTypeParameter(Type type)
- {
- return type;
- }
-
- public Type BindMethodParameter(Type type)
- {
- return UnboundGenericMethodParameter.Make(type.GenericParameterPosition);
- }
- }
-
- internal static MethodSignature MakeFromBuilder(Type returnType, Type[] parameterTypes, PackedCustomModifiers modifiers, CallingConventions callingConvention, int genericParamCount)
- {
- if (genericParamCount > 0)
- {
- returnType = returnType.BindTypeParameters(Unbinder.Instance);
- parameterTypes = BindTypeParameters(Unbinder.Instance, parameterTypes);
- modifiers = modifiers.Bind(Unbinder.Instance);
- }
- return new MethodSignature(returnType, parameterTypes, modifiers, callingConvention, genericParamCount);
- }
-
- internal bool MatchParameterTypes(MethodSignature other)
- {
- return Util.ArrayEquals(other.parameterTypes, parameterTypes);
- }
-
- internal bool MatchParameterTypes(Type[] types)
- {
- return Util.ArrayEquals(types, parameterTypes);
- }
-
- internal override void WriteSig(ModuleBuilder module, ByteBuffer bb)
- {
- WriteSigImpl(module, bb, parameterTypes.Length);
- }
-
- internal void WriteMethodRefSig(ModuleBuilder module, ByteBuffer bb, Type[] optionalParameterTypes, CustomModifiers[] customModifiers)
- {
- WriteSigImpl(module, bb, parameterTypes.Length + optionalParameterTypes.Length);
- if (optionalParameterTypes.Length > 0)
- {
- bb.Write(SENTINEL);
- for (int i = 0; i < optionalParameterTypes.Length; i++)
- {
- WriteCustomModifiers(module, bb, Util.NullSafeElementAt(customModifiers, i));
- WriteType(module, bb, optionalParameterTypes[i]);
- }
- }
- }
-
- private void WriteSigImpl(ModuleBuilder module, ByteBuffer bb, int parameterCount)
- {
- byte first;
- if ((callingConvention & CallingConventions.Any) == CallingConventions.VarArgs)
- {
- Debug.Assert(genericParamCount == 0);
- first = VARARG;
- }
- else if (genericParamCount > 0)
- {
- first = GENERIC;
- }
- else
- {
- first = DEFAULT;
- }
- if ((callingConvention & CallingConventions.HasThis) != 0)
- {
- first |= HASTHIS;
- }
- if ((callingConvention & CallingConventions.ExplicitThis) != 0)
- {
- first |= EXPLICITTHIS;
- }
- bb.Write(first);
- if (genericParamCount > 0)
- {
- bb.WriteCompressedInt(genericParamCount);
- }
- bb.WriteCompressedInt(parameterCount);
- // RetType
- WriteCustomModifiers(module, bb, modifiers.GetReturnTypeCustomModifiers());
- WriteType(module, bb, returnType);
- // Param
- for (int i = 0; i < parameterTypes.Length; i++)
- {
- WriteCustomModifiers(module, bb, modifiers.GetParameterCustomModifiers(i));
- WriteType(module, bb, parameterTypes[i]);
- }
- }
- }
-
- struct PackedCustomModifiers
- {
- // element 0 is the return type, the rest are the parameters
- private readonly CustomModifiers[] customModifiers;
-
- private PackedCustomModifiers(CustomModifiers[] customModifiers)
- {
- this.customModifiers = customModifiers;
- }
-
- public override int GetHashCode()
- {
- return Util.GetHashCode(customModifiers);
- }
-
- public override bool Equals(object obj)
- {
- PackedCustomModifiers? other = obj as PackedCustomModifiers?;
- return other != null && Equals(other.Value);
- }
-
- internal bool Equals(PackedCustomModifiers other)
- {
- return Util.ArrayEquals(customModifiers, other.customModifiers);
- }
-
- internal CustomModifiers GetReturnTypeCustomModifiers()
- {
- if (customModifiers == null)
- {
- return new CustomModifiers();
- }
- return customModifiers[0];
- }
-
- internal CustomModifiers GetParameterCustomModifiers(int index)
- {
- if (customModifiers == null)
- {
- return new CustomModifiers();
- }
- return customModifiers[index + 1];
- }
-
- internal PackedCustomModifiers Bind(IGenericBinder binder)
- {
- if (customModifiers == null)
- {
- return new PackedCustomModifiers();
- }
- CustomModifiers[] expanded = new CustomModifiers[customModifiers.Length];
- for (int i = 0; i < customModifiers.Length; i++)
- {
- expanded[i] = customModifiers[i].Bind(binder);
- }
- return new PackedCustomModifiers(expanded);
- }
-
- // this method make a copy of the incoming arrays (where necessary) and returns a normalized modifiers array
- internal static PackedCustomModifiers CreateFromExternal(Type[] returnOptional, Type[] returnRequired, Type[][] parameterOptional, Type[][] parameterRequired, int parameterCount)
- {
- CustomModifiers[] modifiers = null;
- Pack(ref modifiers, 0, CustomModifiers.FromReqOpt(returnRequired, returnOptional), parameterCount + 1);
- for (int i = 0; i < parameterCount; i++)
- {
- Pack(ref modifiers, i + 1, CustomModifiers.FromReqOpt(Util.NullSafeElementAt(parameterRequired, i), Util.NullSafeElementAt(parameterOptional, i)), parameterCount + 1);
- }
- return new PackedCustomModifiers(modifiers);
- }
-
- internal static PackedCustomModifiers CreateFromExternal(CustomModifiers returnTypeCustomModifiers, CustomModifiers[] parameterTypeCustomModifiers, int parameterCount)
- {
- CustomModifiers[] customModifiers = null;
- Pack(ref customModifiers, 0, returnTypeCustomModifiers, parameterCount + 1);
- if (parameterTypeCustomModifiers != null)
- {
- for (int i = 0; i < parameterCount; i++)
- {
- Pack(ref customModifiers, i + 1, parameterTypeCustomModifiers[i], parameterCount + 1);
- }
- }
- return new PackedCustomModifiers(customModifiers);
- }
-
- internal static PackedCustomModifiers Wrap(CustomModifiers[] modifiers)
- {
- return new PackedCustomModifiers(modifiers);
- }
-
- internal static void Pack(ref CustomModifiers[] array, int index, CustomModifiers mods, int count)
- {
- if (!mods.IsEmpty)
- {
- if (array == null)
- {
- array = new CustomModifiers[count];
- }
- array[index] = mods;
- }
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2011-2012 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-
-namespace IKVM.Reflection
-{
- [Serializable]
- public sealed class MissingAssemblyException : InvalidOperationException
- {
- [NonSerialized]
- private readonly MissingAssembly assembly;
-
- internal MissingAssemblyException(MissingAssembly assembly)
- : base("Assembly '" + assembly.FullName + "' is a missing assembly and does not support the requested operation.")
- {
- this.assembly = assembly;
- }
-
- private MissingAssemblyException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
- : base(info, context)
- {
- }
-
- public Assembly Assembly
- {
- get { return assembly; }
- }
- }
-
- [Serializable]
- public sealed class MissingModuleException : InvalidOperationException
- {
- [NonSerialized]
- private readonly MissingModule module;
-
- internal MissingModuleException(MissingModule module)
- : base("Module from missing assembly '" + module.Assembly.FullName + "' does not support the requested operation.")
- {
- this.module = module;
- }
-
- private MissingModuleException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
- : base(info, context)
- {
- }
-
- public Module Module
- {
- get { return module; }
- }
- }
-
- [Serializable]
- public sealed class MissingMemberException : InvalidOperationException
- {
- [NonSerialized]
- private readonly MemberInfo member;
-
- internal MissingMemberException(MemberInfo member)
- : base("Member '" + member + "' is a missing member and does not support the requested operation.")
- {
- this.member = member;
- }
-
- private MissingMemberException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
- : base(info, context)
- {
- }
-
- public MemberInfo MemberInfo
- {
- get { return member; }
- }
- }
-
- public struct MissingGenericMethodBuilder
- {
- private readonly MissingMethod method;
-
- public MissingGenericMethodBuilder(Type declaringType, CallingConventions callingConvention, string name, int genericParameterCount)
- {
- method = new MissingMethod(declaringType, name, new MethodSignature(null, null, new PackedCustomModifiers(), callingConvention, genericParameterCount));
- }
-
- public Type[] GetGenericArguments()
- {
- return method.GetGenericArguments();
- }
-
- public void SetSignature(Type returnType, CustomModifiers returnTypeCustomModifiers, Type[] parameterTypes, CustomModifiers[] parameterTypeCustomModifiers)
- {
- method.signature = new MethodSignature(
- returnType ?? method.Module.universe.System_Void,
- Util.Copy(parameterTypes),
- PackedCustomModifiers.CreateFromExternal(returnTypeCustomModifiers, parameterTypeCustomModifiers, parameterTypes.Length),
- method.signature.CallingConvention,
- method.signature.GenericParameterCount);
- }
-
- [Obsolete("Please use SetSignature(Type, CustomModifiers, Type[], CustomModifiers[]) instead.")]
- public void SetSignature(Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers)
- {
- method.signature = new MethodSignature(
- returnType ?? method.Module.universe.System_Void,
- Util.Copy(parameterTypes),
- PackedCustomModifiers.CreateFromExternal(returnTypeOptionalCustomModifiers, returnTypeRequiredCustomModifiers, parameterTypeOptionalCustomModifiers, parameterTypeRequiredCustomModifiers, parameterTypes.Length),
- method.signature.CallingConvention,
- method.signature.GenericParameterCount);
- }
-
- public MethodInfo Finish()
- {
- return method;
- }
- }
-
- sealed class MissingAssembly : Assembly
- {
- private readonly MissingModule module;
-
- internal MissingAssembly(Universe universe, string name)
- : base(universe)
- {
- module = new MissingModule(this);
- this.fullName = name;
- }
-
- public override Type[] GetTypes()
- {
- throw new MissingAssemblyException(this);
- }
-
- public override AssemblyName GetName()
- {
- return new AssemblyName(fullName);
- }
-
- public override string ImageRuntimeVersion
- {
- get { throw new MissingAssemblyException(this); }
- }
-
- public override Module ManifestModule
- {
- get { return module; }
- }
-
- public override MethodInfo EntryPoint
- {
- get { throw new MissingAssemblyException(this); }
- }
-
- public override string Location
- {
- get { throw new MissingAssemblyException(this); }
- }
-
- public override AssemblyName[] GetReferencedAssemblies()
- {
- throw new MissingAssemblyException(this);
- }
-
- public override Module[] GetModules(bool getResourceModules)
- {
- throw new MissingAssemblyException(this);
- }
-
- public override Module[] GetLoadedModules(bool getResourceModules)
- {
- throw new MissingAssemblyException(this);
- }
-
- public override Module GetModule(string name)
- {
- throw new MissingAssemblyException(this);
- }
-
- public override string[] GetManifestResourceNames()
- {
- throw new MissingAssemblyException(this);
- }
-
- public override ManifestResourceInfo GetManifestResourceInfo(string resourceName)
- {
- throw new MissingAssemblyException(this);
- }
-
- public override System.IO.Stream GetManifestResourceStream(string resourceName)
- {
- throw new MissingAssemblyException(this);
- }
-
- public override bool __IsMissing
- {
- get { return true; }
- }
-
- internal override Type FindType(TypeName typeName)
- {
- return null;
- }
-
- internal override Type FindTypeIgnoreCase(TypeName lowerCaseName)
- {
- return null;
- }
-
- internal override IList<CustomAttributeData> GetCustomAttributesData(Type attributeType)
- {
- throw new MissingAssemblyException(this);
- }
- }
-
- sealed class MissingModule : NonPEModule
- {
- private readonly MissingAssembly assembly;
-
- internal MissingModule(MissingAssembly assembly)
- : base(assembly.universe)
- {
- this.assembly = assembly;
- }
-
- public override int MDStreamVersion
- {
- get { throw new MissingModuleException(this); }
- }
-
- public override Assembly Assembly
- {
- get { return assembly; }
- }
-
- public override string FullyQualifiedName
- {
- get { throw new MissingModuleException(this); }
- }
-
- public override string Name
- {
- get { throw new MissingModuleException(this); }
- }
-
- public override Guid ModuleVersionId
- {
- get { throw new MissingModuleException(this); }
- }
-
- public override string ScopeName
- {
- get { throw new MissingModuleException(this); }
- }
-
- internal override Type FindType(TypeName typeName)
- {
- return null;
- }
-
- internal override Type FindTypeIgnoreCase(TypeName lowerCaseName)
- {
- return null;
- }
-
- internal override void GetTypesImpl(System.Collections.Generic.List<Type> list)
- {
- throw new MissingModuleException(this);
- }
-
- public override void __GetDataDirectoryEntry(int index, out int rva, out int length)
- {
- throw new MissingModuleException(this);
- }
-
- public override IList<CustomAttributeData> __GetPlaceholderAssemblyCustomAttributes(bool multiple, bool security)
- {
- throw new MissingModuleException(this);
- }
-
- public override long __RelativeVirtualAddressToFileOffset(int rva)
- {
- throw new MissingModuleException(this);
- }
-
- public override __StandAloneMethodSig __ResolveStandAloneMethodSig(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
- {
- throw new MissingModuleException(this);
- }
-
- public override int __Subsystem
- {
- get { throw new MissingModuleException(this); }
- }
-
- internal override void ExportTypes(int fileToken, IKVM.Reflection.Emit.ModuleBuilder manifestModule)
- {
- throw new MissingModuleException(this);
- }
-
- public override void GetPEKind(out PortableExecutableKinds peKind, out ImageFileMachine machine)
- {
- throw new MissingModuleException(this);
- }
-
- public override bool __IsMissing
- {
- get { return true; }
- }
-
- protected override Exception InvalidOperationException()
- {
- return new MissingModuleException(this);
- }
-
- protected override Exception NotSupportedException()
- {
- return new MissingModuleException(this);
- }
-
- protected override Exception ArgumentOutOfRangeException()
- {
- return new MissingModuleException(this);
- }
- }
-
- sealed class MissingType : Type
- {
- private readonly Module module;
- private readonly Type declaringType;
- private readonly string ns;
- private readonly string name;
- private Type[] typeArgs;
- private int token;
-
- internal MissingType(Module module, Type declaringType, string ns, string name)
- {
- this.module = module;
- this.declaringType = declaringType;
- this.ns = ns;
- this.name = name;
- MarkEnumOrValueType(ns, name);
- }
-
- internal override MethodBase FindMethod(string name, MethodSignature signature)
- {
- MethodInfo method = new MissingMethod(this, name, signature);
- if (name == ".ctor")
- {
- return new ConstructorInfoImpl(method);
- }
- return method;
- }
-
- internal override FieldInfo FindField(string name, FieldSignature signature)
- {
- return new MissingField(this, name, signature);
- }
-
- internal override Type FindNestedType(TypeName name)
- {
- return null;
- }
-
- internal override Type FindNestedTypeIgnoreCase(TypeName lowerCaseName)
- {
- return null;
- }
-
- public override bool __IsMissing
- {
- get { return true; }
- }
-
- public override Type DeclaringType
- {
- get { return declaringType; }
- }
-
- public override string __Name
- {
- get { return name; }
- }
-
- public override string __Namespace
- {
- get { return ns; }
- }
-
- public override string Name
- {
- get { return TypeNameParser.Escape(name); }
- }
-
- public override string FullName
- {
- get { return GetFullName(); }
- }
-
- public override Module Module
- {
- get { return module; }
- }
-
- public override int MetadataToken
- {
- get { return token; }
- }
-
- public override bool IsValueType
- {
- get
- {
- switch (typeFlags & (TypeFlags.ValueType | TypeFlags.NotValueType))
- {
- case TypeFlags.ValueType:
- return true;
- case TypeFlags.NotValueType:
- return false;
- default:
- if (module.universe.ResolveMissingTypeIsValueType(this))
- {
- typeFlags |= TypeFlags.ValueType;
- }
- else
- {
- typeFlags |= TypeFlags.NotValueType;
- }
- return (typeFlags & TypeFlags.ValueType) != 0;
- }
- }
- }
-
- public override Type BaseType
- {
- get { throw new MissingMemberException(this); }
- }
-
- public override TypeAttributes Attributes
- {
- get { throw new MissingMemberException(this); }
- }
-
- public override Type[] __GetDeclaredTypes()
- {
- throw new MissingMemberException(this);
- }
-
- public override Type[] __GetDeclaredInterfaces()
- {
- throw new MissingMemberException(this);
- }
-
- public override MethodBase[] __GetDeclaredMethods()
- {
- throw new MissingMemberException(this);
- }
-
- public override __MethodImplMap __GetMethodImplMap()
- {
- throw new MissingMemberException(this);
- }
-
- public override FieldInfo[] __GetDeclaredFields()
- {
- throw new MissingMemberException(this);
- }
-
- public override EventInfo[] __GetDeclaredEvents()
- {
- throw new MissingMemberException(this);
- }
-
- public override PropertyInfo[] __GetDeclaredProperties()
- {
- throw new MissingMemberException(this);
- }
-
- public override CustomModifiers __GetCustomModifiers()
- {
- throw new MissingMemberException(this);
- }
-
- public override Type[] GetGenericArguments()
- {
- throw new MissingMemberException(this);
- }
-
- public override CustomModifiers[] __GetGenericArgumentsCustomModifiers()
- {
- throw new MissingMemberException(this);
- }
-
- public override StructLayoutAttribute StructLayoutAttribute
- {
- get { throw new MissingMemberException(this); }
- }
-
- public override bool IsGenericType
- {
- get { throw new MissingMemberException(this); }
- }
-
- public override bool IsGenericTypeDefinition
- {
- get { throw new MissingMemberException(this); }
- }
-
- internal override Type GetGenericTypeArgument(int index)
- {
- if (typeArgs == null)
- {
- typeArgs = new Type[index + 1];
- }
- else if (typeArgs.Length <= index)
- {
- Array.Resize(ref typeArgs, index + 1);
- }
- return typeArgs[index] ?? (typeArgs[index] = new MissingTypeParameter(this, index));
- }
-
- internal override Type BindTypeParameters(IGenericBinder binder)
- {
- return this;
- }
-
- internal override Type SetMetadataTokenForMissing(int token)
- {
- this.token = token;
- return this;
- }
-
- internal override bool IsBaked
- {
- get { throw new MissingMemberException(this); }
- }
- }
-
- sealed class MissingTypeParameter : IKVM.Reflection.Reader.TypeParameterType
- {
- private readonly MemberInfo owner;
- private readonly int index;
-
- internal MissingTypeParameter(MemberInfo owner, int index)
- {
- this.owner = owner;
- this.index = index;
- }
-
- public override Module Module
- {
- get { return owner.Module; }
- }
-
- public override string Name
- {
- get { return null; }
- }
-
- public override int GenericParameterPosition
- {
- get { return index; }
- }
-
- public override MethodBase DeclaringMethod
- {
- get { return owner as MethodBase; }
- }
-
- public override Type DeclaringType
- {
- get { return owner as Type; }
- }
-
- internal override Type BindTypeParameters(IGenericBinder binder)
- {
- if (owner is MethodBase)
- {
- return binder.BindMethodParameter(this);
- }
- else
- {
- return binder.BindTypeParameter(this);
- }
- }
-
- internal override bool IsBaked
- {
- get { return owner.IsBaked; }
- }
- }
-
- sealed class MissingMethod : MethodInfo
- {
- private readonly Type declaringType;
- private readonly string name;
- internal MethodSignature signature;
- private MethodInfo forwarder;
- private Type[] typeArgs;
-
- internal MissingMethod(Type declaringType, string name, MethodSignature signature)
- {
- this.declaringType = declaringType;
- this.name = name;
- this.signature = signature;
- }
-
- private MethodInfo Forwarder
- {
- get
- {
- MethodInfo method = TryGetForwarder();
- if (method == null)
- {
- throw new MissingMemberException(this);
- }
- return method;
- }
- }
-
- private MethodInfo TryGetForwarder()
- {
- if (forwarder == null && !declaringType.__IsMissing)
- {
- MethodBase mb = declaringType.FindMethod(name, signature);
- ConstructorInfo ci = mb as ConstructorInfo;
- if (ci != null)
- {
- forwarder = ci.GetMethodInfo();
- }
- else
- {
- forwarder = (MethodInfo)mb;
- }
- }
- return forwarder;
- }
-
- public override bool __IsMissing
- {
- get { return TryGetForwarder() == null; }
- }
-
- public override Type ReturnType
- {
- get { return signature.GetReturnType(this); }
- }
-
- public override ParameterInfo ReturnParameter
- {
- get { return new ParameterInfoImpl(this, -1); }
- }
-
- internal override MethodSignature MethodSignature
- {
- get { return signature; }
- }
-
- internal override int ParameterCount
- {
- get { return signature.GetParameterCount(); }
- }
-
- private sealed class ParameterInfoImpl : ParameterInfo
- {
- private readonly MissingMethod method;
- private readonly int index;
-
- internal ParameterInfoImpl(MissingMethod method, int index)
- {
- this.method = method;
- this.index = index;
- }
-
- private ParameterInfo Forwarder
- {
- get { return index == -1 ? method.Forwarder.ReturnParameter : method.Forwarder.GetParameters()[index]; }
- }
-
- public override string Name
- {
- get { return Forwarder.Name; }
- }
-
- public override Type ParameterType
- {
- get { return index == -1 ? method.signature.GetReturnType(method) : method.signature.GetParameterType(method, index); }
- }
-
- public override ParameterAttributes Attributes
- {
- get { return Forwarder.Attributes; }
- }
-
- public override int Position
- {
- get { return index; }
- }
-
- public override object RawDefaultValue
- {
- get { return Forwarder.RawDefaultValue; }
- }
-
- public override CustomModifiers __GetCustomModifiers()
- {
- return index == -1
- ? method.signature.GetReturnTypeCustomModifiers(method)
- : method.signature.GetParameterCustomModifiers(method, index);
- }
-
- public override bool __TryGetFieldMarshal(out FieldMarshal fieldMarshal)
- {
- return Forwarder.__TryGetFieldMarshal(out fieldMarshal);
- }
-
- public override MemberInfo Member
- {
- get { return method; }
- }
-
- public override int MetadataToken
- {
- get { return Forwarder.MetadataToken; }
- }
-
- internal override Module Module
- {
- get { return method.Module; }
- }
-
- public override string ToString()
- {
- return Forwarder.ToString();
- }
- }
-
- public override ParameterInfo[] GetParameters()
- {
- ParameterInfo[] parameters = new ParameterInfo[signature.GetParameterCount()];
- for (int i = 0; i < parameters.Length; i++)
- {
- parameters[i] = new ParameterInfoImpl(this, i);
- }
- return parameters;
- }
-
- public override MethodAttributes Attributes
- {
- get { return Forwarder.Attributes; }
- }
-
- public override MethodImplAttributes GetMethodImplementationFlags()
- {
- return Forwarder.GetMethodImplementationFlags();
- }
-
- public override MethodBody GetMethodBody()
- {
- return Forwarder.GetMethodBody();
- }
-
- public override int __MethodRVA
- {
- get { return Forwarder.__MethodRVA; }
- }
-
- public override CallingConventions CallingConvention
- {
- get { return signature.CallingConvention; }
- }
-
- internal override int ImportTo(IKVM.Reflection.Emit.ModuleBuilder module)
- {
- MethodInfo method = TryGetForwarder();
- if (method != null)
- {
- return method.ImportTo(module);
- }
- return module.ImportMethodOrField(declaringType, this.Name, this.MethodSignature);
- }
-
- public override string Name
- {
- get { return name; }
- }
-
- public override Type DeclaringType
- {
- get { return declaringType.IsModulePseudoType ? null : declaringType; }
- }
-
- public override Module Module
- {
- get { return declaringType.Module; }
- }
-
- public override bool Equals(object obj)
- {
- MissingMethod other = obj as MissingMethod;
- return other != null
- && other.declaringType == declaringType
- && other.name == name
- && other.signature.Equals(signature);
- }
-
- public override int GetHashCode()
- {
- return declaringType.GetHashCode() ^ name.GetHashCode() ^ signature.GetHashCode();
- }
-
- internal override MethodBase BindTypeParameters(Type type)
- {
- MethodInfo forwarder = TryGetForwarder();
- if (forwarder != null)
- {
- return forwarder.BindTypeParameters(type);
- }
- return new GenericMethodInstance(type, this, null);
- }
-
- public override bool ContainsGenericParameters
- {
- get { return Forwarder.ContainsGenericParameters; }
- }
-
- public override Type[] GetGenericArguments()
- {
- MethodInfo method = TryGetForwarder();
- if (method != null)
- {
- return Forwarder.GetGenericArguments();
- }
- if (typeArgs == null)
- {
- typeArgs = new Type[signature.GenericParameterCount];
- for (int i = 0; i < typeArgs.Length; i++)
- {
- typeArgs[i] = new MissingTypeParameter(this, i);
- }
- }
- return Util.Copy(typeArgs);
- }
-
- internal override Type GetGenericMethodArgument(int index)
- {
- return GetGenericArguments()[index];
- }
-
- internal override int GetGenericMethodArgumentCount()
- {
- return Forwarder.GetGenericMethodArgumentCount();
- }
-
- public override MethodInfo GetGenericMethodDefinition()
- {
- return Forwarder.GetGenericMethodDefinition();
- }
-
- internal override MethodInfo GetMethodOnTypeDefinition()
- {
- return Forwarder.GetMethodOnTypeDefinition();
- }
-
- internal override bool HasThis
- {
- get { return (signature.CallingConvention & (CallingConventions.HasThis | CallingConventions.ExplicitThis)) == CallingConventions.HasThis; }
- }
-
- public override bool IsGenericMethod
- {
- get { return IsGenericMethodDefinition; }
- }
-
- public override bool IsGenericMethodDefinition
- {
- get { return signature.GenericParameterCount != 0; }
- }
-
- public override MethodInfo MakeGenericMethod(params Type[] typeArguments)
- {
- MethodInfo method = TryGetForwarder();
- if (method != null)
- {
- return method.MakeGenericMethod(typeArguments);
- }
- return new GenericMethodInstance(declaringType, this, typeArguments);
- }
-
- public override int MetadataToken
- {
- get { return Forwarder.MetadataToken; }
- }
-
- internal override int GetCurrentToken()
- {
- return Forwarder.GetCurrentToken();
- }
-
- internal override bool IsBaked
- {
- get { return Forwarder.IsBaked; }
- }
- }
-
- sealed class MissingField : FieldInfo
- {
- private readonly Type declaringType;
- private readonly string name;
- private readonly FieldSignature signature;
- private FieldInfo forwarder;
-
- internal MissingField(Type declaringType, string name, FieldSignature signature)
- {
- this.declaringType = declaringType;
- this.name = name;
- this.signature = signature;
- }
-
- private FieldInfo Forwarder
- {
- get
- {
- FieldInfo field = TryGetForwarder();
- if (field == null)
- {
- throw new MissingMemberException(this);
- }
- return field;
- }
- }
-
- private FieldInfo TryGetForwarder()
- {
- if (forwarder == null && !declaringType.__IsMissing)
- {
- forwarder = declaringType.FindField(name, signature);
- }
- return forwarder;
- }
-
- public override bool __IsMissing
- {
- get { return TryGetForwarder() == null; }
- }
-
- public override FieldAttributes Attributes
- {
- get { return Forwarder.Attributes; }
- }
-
- public override void __GetDataFromRVA(byte[] data, int offset, int length)
- {
- Forwarder.__GetDataFromRVA(data, offset, length);
- }
-
- public override int __FieldRVA
- {
- get { return Forwarder.__FieldRVA; }
- }
-
- public override bool __TryGetFieldOffset(out int offset)
- {
- return Forwarder.__TryGetFieldOffset(out offset);
- }
-
- public override object GetRawConstantValue()
- {
- return Forwarder.GetRawConstantValue();
- }
-
- internal override FieldSignature FieldSignature
- {
- get { return signature; }
- }
-
- internal override int ImportTo(IKVM.Reflection.Emit.ModuleBuilder module)
- {
- FieldInfo field = TryGetForwarder();
- if (field != null)
- {
- return field.ImportTo(module);
- }
- return module.ImportMethodOrField(declaringType, this.Name, this.FieldSignature);
- }
-
- public override string Name
- {
- get { return name; }
- }
-
- public override Type DeclaringType
- {
- get { return declaringType.IsModulePseudoType ? null : declaringType; }
- }
-
- public override Module Module
- {
- get { return declaringType.Module; }
- }
-
- internal override FieldInfo BindTypeParameters(Type type)
- {
- FieldInfo forwarder = TryGetForwarder();
- if (forwarder != null)
- {
- return forwarder.BindTypeParameters(type);
- }
- return new GenericFieldInstance(type, this);
- }
-
- public override int MetadataToken
- {
- get { return Forwarder.MetadataToken; }
- }
-
- public override bool Equals(object obj)
- {
- MissingField other = obj as MissingField;
- return other != null
- && other.declaringType == declaringType
- && other.name == name
- && other.signature.Equals(signature);
- }
-
- public override int GetHashCode()
- {
- return declaringType.GetHashCode() ^ name.GetHashCode() ^ signature.GetHashCode();
- }
-
- public override string ToString()
- {
- return this.FieldType.Name + " " + this.Name;
- }
-
- internal override int GetCurrentToken()
- {
- return Forwarder.GetCurrentToken();
- }
-
- internal override bool IsBaked
- {
- get { return Forwarder.IsBaked; }
- }
- }
-
- // NOTE this is currently only used by CustomAttributeData (because there is no other way to refer to a property)
- sealed class MissingProperty : PropertyInfo
- {
- private readonly Type declaringType;
- private readonly string name;
- private readonly PropertySignature signature;
-
- internal MissingProperty(Type declaringType, string name, PropertySignature signature)
- {
- this.declaringType = declaringType;
- this.name = name;
- this.signature = signature;
- }
-
- public override PropertyAttributes Attributes
- {
- get { throw new MissingMemberException(this); }
- }
-
- public override bool CanRead
- {
- get { throw new MissingMemberException(this); }
- }
-
- public override bool CanWrite
- {
- get { throw new MissingMemberException(this); }
- }
-
- public override MethodInfo GetGetMethod(bool nonPublic)
- {
- throw new MissingMemberException(this);
- }
-
- public override MethodInfo GetSetMethod(bool nonPublic)
- {
- throw new MissingMemberException(this);
- }
-
- public override MethodInfo[] GetAccessors(bool nonPublic)
- {
- throw new MissingMemberException(this);
- }
-
- public override object GetRawConstantValue()
- {
- throw new MissingMemberException(this);
- }
-
- internal override bool IsPublic
- {
- get { throw new MissingMemberException(this); }
- }
-
- internal override bool IsNonPrivate
- {
- get { throw new MissingMemberException(this); }
- }
-
- internal override bool IsStatic
- {
- get { throw new MissingMemberException(this); }
- }
-
- internal override PropertySignature PropertySignature
- {
- get { return signature; }
- }
-
- public override string Name
- {
- get { return name; }
- }
-
- public override Type DeclaringType
- {
- get { return declaringType; }
- }
-
- public override Module Module
- {
- get { return declaringType.Module; }
- }
-
- internal override bool IsBaked
- {
- get { return declaringType.IsBaked; }
- }
-
- internal override int GetCurrentToken()
- {
- throw new MissingMemberException(this);
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009-2012 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using IKVM.Reflection.Metadata;
-using IKVM.Reflection.Reader;
-
-namespace IKVM.Reflection
-{
- public sealed class RawModule : IDisposable
- {
- private readonly ModuleReader module;
- private readonly bool isManifestModule;
- private bool imported;
-
- internal RawModule(ModuleReader module)
- {
- this.module = module;
- this.isManifestModule = module.Assembly != null;
- }
-
- public string Location
- {
- get { return module.FullyQualifiedName; }
- }
-
- public bool IsManifestModule
- {
- get { return isManifestModule; }
- }
-
- public Guid ModuleVersionId
- {
- get { return module.ModuleVersionId; }
- }
-
- private void CheckManifestModule()
- {
- if (!IsManifestModule)
- {
- throw new BadImageFormatException("Module does not contain a manifest");
- }
- }
-
- public AssemblyName GetAssemblyName()
- {
- CheckManifestModule();
- return module.Assembly.GetName();
- }
-
- public AssemblyName[] GetReferencedAssemblies()
- {
- return module.__GetReferencedAssemblies();
- }
-
- public void Dispose()
- {
- if (!imported)
- {
- module.stream.Dispose();
- }
- }
-
- internal AssemblyReader ToAssembly()
- {
- if (imported)
- {
- throw new InvalidOperationException();
- }
- imported = true;
- return (AssemblyReader)module.Assembly;
- }
-
- internal Module ToModule(Assembly assembly)
- {
- if (module.Assembly != null)
- {
- throw new InvalidOperationException();
- }
- imported = true;
- module.SetAssembly(assembly);
- return module;
- }
- }
-
- public abstract class Module : ICustomAttributeProvider
- {
- internal readonly Universe universe;
- internal readonly ModuleTable ModuleTable = new ModuleTable();
- internal readonly TypeRefTable TypeRef = new TypeRefTable();
- internal readonly TypeDefTable TypeDef = new TypeDefTable();
- internal readonly FieldPtrTable FieldPtr = new FieldPtrTable();
- internal readonly FieldTable Field = new FieldTable();
- internal readonly MemberRefTable MemberRef = new MemberRefTable();
- internal readonly ConstantTable Constant = new ConstantTable();
- internal readonly CustomAttributeTable CustomAttribute = new CustomAttributeTable();
- internal readonly FieldMarshalTable FieldMarshal = new FieldMarshalTable();
- internal readonly DeclSecurityTable DeclSecurity = new DeclSecurityTable();
- internal readonly ClassLayoutTable ClassLayout = new ClassLayoutTable();
- internal readonly FieldLayoutTable FieldLayout = new FieldLayoutTable();
- internal readonly ParamPtrTable ParamPtr = new ParamPtrTable();
- internal readonly ParamTable Param = new ParamTable();
- internal readonly InterfaceImplTable InterfaceImpl = new InterfaceImplTable();
- internal readonly StandAloneSigTable StandAloneSig = new StandAloneSigTable();
- internal readonly EventMapTable EventMap = new EventMapTable();
- internal readonly EventPtrTable EventPtr = new EventPtrTable();
- internal readonly EventTable Event = new EventTable();
- internal readonly PropertyMapTable PropertyMap = new PropertyMapTable();
- internal readonly PropertyPtrTable PropertyPtr = new PropertyPtrTable();
- internal readonly PropertyTable Property = new PropertyTable();
- internal readonly MethodSemanticsTable MethodSemantics = new MethodSemanticsTable();
- internal readonly MethodImplTable MethodImpl = new MethodImplTable();
- internal readonly ModuleRefTable ModuleRef = new ModuleRefTable();
- internal readonly TypeSpecTable TypeSpec = new TypeSpecTable();
- internal readonly ImplMapTable ImplMap = new ImplMapTable();
- internal readonly FieldRVATable FieldRVA = new FieldRVATable();
- internal readonly AssemblyTable AssemblyTable = new AssemblyTable();
- internal readonly AssemblyRefTable AssemblyRef = new AssemblyRefTable();
- internal readonly MethodPtrTable MethodPtr = new MethodPtrTable();
- internal readonly MethodDefTable MethodDef = new MethodDefTable();
- internal readonly NestedClassTable NestedClass = new NestedClassTable();
- internal readonly FileTable File = new FileTable();
- internal readonly ExportedTypeTable ExportedType = new ExportedTypeTable();
- internal readonly ManifestResourceTable ManifestResource = new ManifestResourceTable();
- internal readonly GenericParamTable GenericParam = new GenericParamTable();
- internal readonly MethodSpecTable MethodSpec = new MethodSpecTable();
- internal readonly GenericParamConstraintTable GenericParamConstraint = new GenericParamConstraintTable();
-
- protected Module(Universe universe)
- {
- this.universe = universe;
- }
-
- internal Table[] GetTables()
- {
- Table[] tables = new Table[64];
- tables[ModuleTable.Index] = ModuleTable;
- tables[TypeRefTable.Index] = TypeRef;
- tables[TypeDefTable.Index] = TypeDef;
- tables[FieldPtrTable.Index] = FieldPtr;
- tables[FieldTable.Index] = Field;
- tables[MemberRefTable.Index] = MemberRef;
- tables[ConstantTable.Index] = Constant;
- tables[CustomAttributeTable.Index] = CustomAttribute;
- tables[FieldMarshalTable.Index] = FieldMarshal;
- tables[DeclSecurityTable.Index] = DeclSecurity;
- tables[ClassLayoutTable.Index] = ClassLayout;
- tables[FieldLayoutTable.Index] = FieldLayout;
- tables[ParamPtrTable.Index] = ParamPtr;
- tables[ParamTable.Index] = Param;
- tables[InterfaceImplTable.Index] = InterfaceImpl;
- tables[StandAloneSigTable.Index] = StandAloneSig;
- tables[EventMapTable.Index] = EventMap;
- tables[EventPtrTable.Index] = EventPtr;
- tables[EventTable.Index] = Event;
- tables[PropertyMapTable.Index] = PropertyMap;
- tables[PropertyPtrTable.Index] = PropertyPtr;
- tables[PropertyTable.Index] = Property;
- tables[MethodSemanticsTable.Index] = MethodSemantics;
- tables[MethodImplTable.Index] = MethodImpl;
- tables[ModuleRefTable.Index] = ModuleRef;
- tables[TypeSpecTable.Index] = TypeSpec;
- tables[ImplMapTable.Index] = ImplMap;
- tables[FieldRVATable.Index] = FieldRVA;
- tables[AssemblyTable.Index] = AssemblyTable;
- tables[AssemblyRefTable.Index] = AssemblyRef;
- tables[MethodPtrTable.Index] = MethodPtr;
- tables[MethodDefTable.Index] = MethodDef;
- tables[NestedClassTable.Index] = NestedClass;
- tables[FileTable.Index] = File;
- tables[ExportedTypeTable.Index] = ExportedType;
- tables[ManifestResourceTable.Index] = ManifestResource;
- tables[GenericParamTable.Index] = GenericParam;
- tables[MethodSpecTable.Index] = MethodSpec;
- tables[GenericParamConstraintTable.Index] = GenericParamConstraint;
- return tables;
- }
-
- public virtual void __GetDataDirectoryEntry(int index, out int rva, out int length)
- {
- throw new NotSupportedException();
- }
-
- public virtual long __RelativeVirtualAddressToFileOffset(int rva)
- {
- throw new NotSupportedException();
- }
-
- public virtual bool __GetSectionInfo(int rva, out string name, out int characteristics)
- {
- throw new NotSupportedException();
- }
-
- public virtual int __ReadDataFromRVA(int rva, byte[] data, int offset, int length)
- {
- throw new NotSupportedException();
- }
-
- public virtual void GetPEKind(out PortableExecutableKinds peKind, out ImageFileMachine machine)
- {
- throw new NotSupportedException();
- }
-
- public virtual int __Subsystem
- {
- get { throw new NotSupportedException(); }
- }
-
- public FieldInfo GetField(string name)
- {
- return GetField(name, BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly);
- }
-
- public FieldInfo GetField(string name, BindingFlags bindingFlags)
- {
- return IsResource() ? null : GetModuleType().GetField(name, bindingFlags | BindingFlags.DeclaredOnly);
- }
-
- public FieldInfo[] GetFields()
- {
- return GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly);
- }
-
- public FieldInfo[] GetFields(BindingFlags bindingFlags)
- {
- return IsResource() ? Empty<FieldInfo>.Array : GetModuleType().GetFields(bindingFlags | BindingFlags.DeclaredOnly);
- }
-
- public MethodInfo GetMethod(string name)
- {
- return IsResource() ? null : GetModuleType().GetMethod(name, BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly);
- }
-
- public MethodInfo GetMethod(string name, Type[] types)
- {
- return IsResource() ? null : GetModuleType().GetMethod(name, BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly, null, types, null);
- }
-
- public MethodInfo GetMethod(string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConv, Type[] types, ParameterModifier[] modifiers)
- {
- return IsResource() ? null : GetModuleType().GetMethod(name, bindingAttr | BindingFlags.DeclaredOnly, binder, callConv, types, modifiers);
- }
-
- public MethodInfo[] GetMethods()
- {
- return GetMethods(BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly);
- }
-
- public MethodInfo[] GetMethods(BindingFlags bindingFlags)
- {
- return IsResource() ? Empty<MethodInfo>.Array : GetModuleType().GetMethods(bindingFlags | BindingFlags.DeclaredOnly);
- }
-
- public ConstructorInfo __ModuleInitializer
- {
- get { return IsResource() ? null : GetModuleType().TypeInitializer; }
- }
-
- public virtual byte[] ResolveSignature(int metadataToken)
- {
- throw new NotSupportedException();
- }
-
- public virtual __StandAloneMethodSig __ResolveStandAloneMethodSig(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
- {
- throw new NotSupportedException();
- }
-
- public int MetadataToken
- {
- get { return IsResource() ? 0 : 1; }
- }
-
- public abstract int MDStreamVersion { get ;}
- public abstract Assembly Assembly { get; }
- public abstract string FullyQualifiedName { get; }
- public abstract string Name { get; }
- public abstract Guid ModuleVersionId { get; }
- public abstract MethodBase ResolveMethod(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments);
- public abstract FieldInfo ResolveField(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments);
- public abstract MemberInfo ResolveMember(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments);
-
- public abstract string ResolveString(int metadataToken);
- public abstract Type[] __ResolveOptionalParameterTypes(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments, out CustomModifiers[] customModifiers);
- public abstract string ScopeName { get; }
-
- internal abstract void GetTypesImpl(List<Type> list);
-
- internal abstract Type FindType(TypeName name);
- internal abstract Type FindTypeIgnoreCase(TypeName lowerCaseName);
-
- [Obsolete("Please use __ResolveOptionalParameterTypes(int, Type[], Type[], out CustomModifiers[]) instead.")]
- public Type[] __ResolveOptionalParameterTypes(int metadataToken)
- {
- CustomModifiers[] dummy;
- return __ResolveOptionalParameterTypes(metadataToken, null, null, out dummy);
- }
-
- public Type GetType(string className)
- {
- return GetType(className, false, false);
- }
-
- public Type GetType(string className, bool ignoreCase)
- {
- return GetType(className, false, ignoreCase);
- }
-
- public Type GetType(string className, bool throwOnError, bool ignoreCase)
- {
- TypeNameParser parser = TypeNameParser.Parse(className, throwOnError);
- if (parser.Error)
- {
- return null;
- }
- if (parser.AssemblyName != null)
- {
- if (throwOnError)
- {
- throw new ArgumentException("Type names passed to Module.GetType() must not specify an assembly.");
- }
- else
- {
- return null;
- }
- }
- TypeName typeName = TypeName.Split(TypeNameParser.Unescape(parser.FirstNamePart));
- Type type = ignoreCase
- ? FindTypeIgnoreCase(typeName.ToLowerInvariant())
- : FindType(typeName);
- if (type == null && __IsMissing)
- {
- throw new MissingModuleException((MissingModule)this);
- }
- return parser.Expand(type, this.Assembly, throwOnError, className, false, ignoreCase);
- }
-
- public Type[] GetTypes()
- {
- List<Type> list = new List<Type>();
- GetTypesImpl(list);
- return list.ToArray();
- }
-
- public Type[] FindTypes(TypeFilter filter, object filterCriteria)
- {
- List<Type> list = new List<Type>();
- foreach (Type type in GetTypes())
- {
- if (filter(type, filterCriteria))
- {
- list.Add(type);
- }
- }
- return list.ToArray();
- }
-
- public virtual bool IsResource()
- {
- return false;
- }
-
- public Type ResolveType(int metadataToken)
- {
- return ResolveType(metadataToken, null, null);
- }
-
- internal sealed class GenericContext : IGenericContext
- {
- private readonly Type[] genericTypeArguments;
- private readonly Type[] genericMethodArguments;
-
- internal GenericContext(Type[] genericTypeArguments, Type[] genericMethodArguments)
- {
- this.genericTypeArguments = genericTypeArguments;
- this.genericMethodArguments = genericMethodArguments;
- }
-
- public Type GetGenericTypeArgument(int index)
- {
- return genericTypeArguments[index];
- }
-
- public Type GetGenericMethodArgument(int index)
- {
- return genericMethodArguments[index];
- }
- }
-
- public Type ResolveType(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
- {
- if ((metadataToken >> 24) == TypeSpecTable.Index)
- {
- return ResolveType(metadataToken, new GenericContext(genericTypeArguments, genericMethodArguments));
- }
- else
- {
- return ResolveType(metadataToken, null);
- }
- }
-
- internal abstract Type ResolveType(int metadataToken, IGenericContext context);
-
- public MethodBase ResolveMethod(int metadataToken)
- {
- return ResolveMethod(metadataToken, null, null);
- }
-
- public FieldInfo ResolveField(int metadataToken)
- {
- return ResolveField(metadataToken, null, null);
- }
-
- public MemberInfo ResolveMember(int metadataToken)
- {
- return ResolveMember(metadataToken, null, null);
- }
-
- public bool IsDefined(Type attributeType, bool inherit)
- {
- return CustomAttributeData.__GetCustomAttributes(this, attributeType, inherit).Count != 0;
- }
-
- public IList<CustomAttributeData> __GetCustomAttributes(Type attributeType, bool inherit)
- {
- return CustomAttributeData.__GetCustomAttributes(this, attributeType, inherit);
- }
-
- public virtual IList<CustomAttributeData> __GetPlaceholderAssemblyCustomAttributes(bool multiple, bool security)
- {
- return Empty<CustomAttributeData>.Array;
- }
-
- public abstract AssemblyName[] __GetReferencedAssemblies();
-
- public virtual void __ResolveReferencedAssemblies(Assembly[] assemblies)
- {
- throw new NotSupportedException();
- }
-
- public abstract string[] __GetReferencedModules();
-
- public abstract Type[] __GetReferencedTypes();
-
- public abstract Type[] __GetExportedTypes();
-
- public virtual bool __IsMissing
- {
- get { return false; }
- }
-
- public long __ImageBase
- {
- get { return GetImageBaseImpl(); }
- }
-
- protected abstract long GetImageBaseImpl();
-
- public long __StackReserve
- {
- get { return GetStackReserveImpl(); }
- }
-
- protected abstract long GetStackReserveImpl();
-
- public int __FileAlignment
- {
- get { return GetFileAlignmentImpl(); }
- }
-
- protected abstract int GetFileAlignmentImpl();
-
- public DllCharacteristics __DllCharacteristics
- {
- get { return GetDllCharacteristicsImpl(); }
- }
-
- protected abstract DllCharacteristics GetDllCharacteristicsImpl();
-
- public virtual byte[] __ModuleHash
- {
- get { throw new NotSupportedException(); }
- }
-
- public virtual int __EntryPointRVA
- {
- get { throw new NotSupportedException(); }
- }
-
- public virtual int __EntryPointToken
- {
- get { throw new NotSupportedException(); }
- }
-
- public virtual string __ImageRuntimeVersion
- {
- get { throw new NotSupportedException(); }
- }
-
- public IEnumerable<CustomAttributeData> __EnumerateCustomAttributeTable()
- {
- List<CustomAttributeData> list = new List<CustomAttributeData>(CustomAttribute.RowCount);
- for (int i = 0; i < CustomAttribute.RowCount; i++)
- {
- list.Add(new CustomAttributeData(this, i));
- }
- return list;
- }
-
- [Obsolete]
- public List<CustomAttributeData> __GetCustomAttributesFor(int token)
- {
- return CustomAttributeData.GetCustomAttributesImpl(new List<CustomAttributeData>(), this, token, null);
- }
-
- internal abstract Type GetModuleType();
-
- internal abstract ByteReader GetBlob(int blobIndex);
-
- internal IList<CustomAttributeData> GetDeclarativeSecurity(int metadataToken)
- {
- List<CustomAttributeData> list = new List<CustomAttributeData>();
- foreach (int i in DeclSecurity.Filter(metadataToken))
- {
- CustomAttributeData.ReadDeclarativeSecurity(this, i, list);
- }
- return list;
- }
-
- internal virtual void Dispose()
- {
- }
-
- internal virtual void ExportTypes(int fileToken, IKVM.Reflection.Emit.ModuleBuilder manifestModule)
- {
- }
-
- internal virtual string GetString(int index)
- {
- throw new NotSupportedException();
- }
- }
-
- abstract class NonPEModule : Module
- {
- protected NonPEModule(Universe universe)
- : base(universe)
- {
- }
-
- protected virtual Exception InvalidOperationException()
- {
- return new InvalidOperationException();
- }
-
- protected virtual Exception NotSupportedException()
- {
- return new NotSupportedException();
- }
-
- protected virtual Exception ArgumentOutOfRangeException()
- {
- return new ArgumentOutOfRangeException();
- }
-
- internal sealed override Type GetModuleType()
- {
- throw InvalidOperationException();
- }
-
- internal sealed override ByteReader GetBlob(int blobIndex)
- {
- throw InvalidOperationException();
- }
-
- public sealed override AssemblyName[] __GetReferencedAssemblies()
- {
- throw NotSupportedException();
- }
-
- public sealed override string[] __GetReferencedModules()
- {
- throw NotSupportedException();
- }
-
- public override Type[] __GetReferencedTypes()
- {
- throw NotSupportedException();
- }
-
- public override Type[] __GetExportedTypes()
- {
- throw NotSupportedException();
- }
-
- protected sealed override long GetImageBaseImpl()
- {
- throw NotSupportedException();
- }
-
- protected sealed override long GetStackReserveImpl()
- {
- throw NotSupportedException();
- }
-
- protected sealed override int GetFileAlignmentImpl()
- {
- throw NotSupportedException();
- }
-
- protected override DllCharacteristics GetDllCharacteristicsImpl()
- {
- throw NotSupportedException();
- }
-
- internal sealed override Type ResolveType(int metadataToken, IGenericContext context)
- {
- throw ArgumentOutOfRangeException();
- }
-
- public sealed override MethodBase ResolveMethod(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
- {
- throw ArgumentOutOfRangeException();
- }
-
- public sealed override FieldInfo ResolveField(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
- {
- throw ArgumentOutOfRangeException();
- }
-
- public sealed override MemberInfo ResolveMember(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
- {
- throw ArgumentOutOfRangeException();
- }
-
- public sealed override string ResolveString(int metadataToken)
- {
- throw ArgumentOutOfRangeException();
- }
-
- public sealed override Type[] __ResolveOptionalParameterTypes(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments, out CustomModifiers[] customModifiers)
- {
- throw ArgumentOutOfRangeException();
- }
- }
-
- public delegate bool TypeFilter(Type m, object filterCriteria);
- public delegate bool MemberFilter(MemberInfo m, object filterCriteria);
-}
+++ /dev/null
-/*
- Copyright (C) 2009 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System.Collections.Generic;
-
-namespace IKVM.Reflection
-{
- public abstract class ParameterInfo : ICustomAttributeProvider
- {
- // prevent external subclasses
- internal ParameterInfo()
- {
- }
-
- public sealed override bool Equals(object obj)
- {
- ParameterInfo other = obj as ParameterInfo;
- return other != null && other.Member == this.Member && other.Position == this.Position;
- }
-
- public sealed override int GetHashCode()
- {
- return this.Member.GetHashCode() * 1777 + this.Position;
- }
-
- public static bool operator ==(ParameterInfo p1, ParameterInfo p2)
- {
- return ReferenceEquals(p1, p2) || (!ReferenceEquals(p1, null) && p1.Equals(p2));
- }
-
- public static bool operator !=(ParameterInfo p1, ParameterInfo p2)
- {
- return !(p1 == p2);
- }
-
- public abstract string Name { get; }
- public abstract Type ParameterType { get; }
- public abstract ParameterAttributes Attributes { get; }
- public abstract int Position { get; }
- public abstract object RawDefaultValue { get; }
- public abstract CustomModifiers __GetCustomModifiers();
- public abstract bool __TryGetFieldMarshal(out FieldMarshal fieldMarshal);
- public abstract MemberInfo Member { get; }
- public abstract int MetadataToken { get; }
- internal abstract Module Module { get; }
-
- public Type[] GetOptionalCustomModifiers()
- {
- return __GetCustomModifiers().GetOptional();
- }
-
- public Type[] GetRequiredCustomModifiers()
- {
- return __GetCustomModifiers().GetRequired();
- }
-
- public bool IsIn
- {
- get { return (Attributes & ParameterAttributes.In) != 0; }
- }
-
- public bool IsOut
- {
- get { return (Attributes & ParameterAttributes.Out) != 0; }
- }
-
- public bool IsLcid
- {
- get { return (Attributes & ParameterAttributes.Lcid) != 0; }
- }
-
- public bool IsRetval
- {
- get { return (Attributes & ParameterAttributes.Retval) != 0; }
- }
-
- public bool IsOptional
- {
- get { return (Attributes & ParameterAttributes.Optional) != 0; }
- }
-
- public bool IsDefined(Type attributeType, bool inherit)
- {
- return CustomAttributeData.__GetCustomAttributes(this, attributeType, inherit).Count != 0;
- }
-
- public IList<CustomAttributeData> __GetCustomAttributes(Type attributeType, bool inherit)
- {
- return CustomAttributeData.__GetCustomAttributes(this, attributeType, inherit);
- }
- }
-
- sealed class ParameterInfoWrapper : ParameterInfo
- {
- private readonly MemberInfo member;
- private readonly ParameterInfo forward;
-
- internal ParameterInfoWrapper(MemberInfo member, ParameterInfo forward)
- {
- this.member = member;
- this.forward = forward;
- }
-
- public override string Name
- {
- get { return forward.Name; }
- }
-
- public override Type ParameterType
- {
- get { return forward.ParameterType; }
- }
-
- public override ParameterAttributes Attributes
- {
- get { return forward.Attributes; }
- }
-
- public override int Position
- {
- get { return forward.Position; }
- }
-
- public override object RawDefaultValue
- {
- get { return forward.RawDefaultValue; }
- }
-
- public override CustomModifiers __GetCustomModifiers()
- {
- return forward.__GetCustomModifiers();
- }
-
- public override bool __TryGetFieldMarshal(out FieldMarshal fieldMarshal)
- {
- return forward.__TryGetFieldMarshal(out fieldMarshal);
- }
-
- public override MemberInfo Member
- {
- get { return member; }
- }
-
- public override int MetadataToken
- {
- get { return forward.MetadataToken; }
- }
-
- internal override Module Module
- {
- get { return member.Module; }
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace IKVM.Reflection
-{
- public struct ParameterModifier
- {
- private readonly bool[] values;
-
- public ParameterModifier(int parameterCount)
- {
- values = new bool[parameterCount];
- }
-
- public bool this[int index]
- {
- get { return values[index]; }
- set { values[index] = value; }
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2008 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System.Reflection;
-
-[assembly: AssemblyTitle("IKVM.Reflection")]
-[assembly: AssemblyDescription("Alternative implementation of System.Reflection[.Emit]")]
+++ /dev/null
-/*
- Copyright (C) 2009-2012 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-
-namespace IKVM.Reflection
-{
- public abstract class PropertyInfo : MemberInfo
- {
- // prevent external subclasses
- internal PropertyInfo()
- {
- }
-
- public sealed override MemberTypes MemberType
- {
- get { return MemberTypes.Property; }
- }
-
- public abstract PropertyAttributes Attributes { get; }
- public abstract bool CanRead { get; }
- public abstract bool CanWrite { get; }
- public abstract MethodInfo GetGetMethod(bool nonPublic);
- public abstract MethodInfo GetSetMethod(bool nonPublic);
- public abstract MethodInfo[] GetAccessors(bool nonPublic);
- public abstract object GetRawConstantValue();
- internal abstract bool IsPublic { get; }
- internal abstract bool IsNonPrivate { get; }
- internal abstract bool IsStatic { get; }
- internal abstract PropertySignature PropertySignature { get; }
-
- private sealed class ParameterInfoImpl : ParameterInfo
- {
- private readonly PropertyInfo property;
- private readonly int parameter;
-
- internal ParameterInfoImpl(PropertyInfo property, int parameter)
- {
- this.property = property;
- this.parameter = parameter;
- }
-
- public override string Name
- {
- get { return null; }
- }
-
- public override Type ParameterType
- {
- get { return property.PropertySignature.GetParameter(parameter); }
- }
-
- public override ParameterAttributes Attributes
- {
- get { return ParameterAttributes.None; }
- }
-
- public override int Position
- {
- get { return parameter; }
- }
-
- public override object RawDefaultValue
- {
- get { throw new InvalidOperationException(); }
- }
-
- public override CustomModifiers __GetCustomModifiers()
- {
- return property.PropertySignature.GetParameterCustomModifiers(parameter);
- }
-
- public override bool __TryGetFieldMarshal(out FieldMarshal fieldMarshal)
- {
- fieldMarshal = new FieldMarshal();
- return false;
- }
-
- public override MemberInfo Member
- {
- get { return property; }
- }
-
- public override int MetadataToken
- {
- get { return 0x08000000; }
- }
-
- internal override Module Module
- {
- get { return property.Module; }
- }
- }
-
- public virtual ParameterInfo[] GetIndexParameters()
- {
- ParameterInfo[] parameters = new ParameterInfo[this.PropertySignature.ParameterCount];
- for (int i = 0; i < parameters.Length; i++)
- {
- parameters[i] = new ParameterInfoImpl(this, i);
- }
- return parameters;
- }
-
- public Type PropertyType
- {
- get { return this.PropertySignature.PropertyType; }
- }
-
- public CustomModifiers __GetCustomModifiers()
- {
- return this.PropertySignature.GetCustomModifiers();
- }
-
- public Type[] GetRequiredCustomModifiers()
- {
- return __GetCustomModifiers().GetRequired();
- }
-
- public Type[] GetOptionalCustomModifiers()
- {
- return __GetCustomModifiers().GetOptional();
- }
-
- public bool IsSpecialName
- {
- get { return (Attributes & PropertyAttributes.SpecialName) != 0; }
- }
-
- public MethodInfo GetGetMethod()
- {
- return GetGetMethod(false);
- }
-
- public MethodInfo GetSetMethod()
- {
- return GetSetMethod(false);
- }
-
- public MethodInfo[] GetAccessors()
- {
- return GetAccessors(false);
- }
-
- public CallingConventions __CallingConvention
- {
- get { return this.PropertySignature.CallingConvention; }
- }
-
- internal virtual PropertyInfo BindTypeParameters(Type type)
- {
- return new GenericPropertyInfo(this.DeclaringType.BindTypeParameters(type), this);
- }
-
- public override string ToString()
- {
- return this.DeclaringType.ToString() + " " + Name;
- }
-
- internal sealed override bool BindingFlagsMatch(BindingFlags flags)
- {
- return BindingFlagsMatch(IsPublic, flags, BindingFlags.Public, BindingFlags.NonPublic)
- && BindingFlagsMatch(IsStatic, flags, BindingFlags.Static, BindingFlags.Instance);
- }
-
- internal sealed override bool BindingFlagsMatchInherited(BindingFlags flags)
- {
- return IsNonPrivate
- && BindingFlagsMatch(IsPublic, flags, BindingFlags.Public, BindingFlags.NonPublic)
- && BindingFlagsMatch(IsStatic, flags, BindingFlags.Static | BindingFlags.FlattenHierarchy, BindingFlags.Instance);
- }
-
- internal sealed override MemberInfo SetReflectedType(Type type)
- {
- return new PropertyInfoWithReflectedType(type, this);
- }
-
- internal sealed override List<CustomAttributeData> GetPseudoCustomAttributes(Type attributeType)
- {
- // properties don't have pseudo custom attributes
- return null;
- }
- }
-
- sealed class PropertyInfoWithReflectedType : PropertyInfo
- {
- private readonly Type reflectedType;
- private readonly PropertyInfo property;
-
- internal PropertyInfoWithReflectedType(Type reflectedType, PropertyInfo property)
- {
- this.reflectedType = reflectedType;
- this.property = property;
- }
-
- public override PropertyAttributes Attributes
- {
- get { return property.Attributes; }
- }
-
- public override bool CanRead
- {
- get { return property.CanRead; }
- }
-
- public override bool CanWrite
- {
- get { return property.CanWrite; }
- }
-
- public override MethodInfo GetGetMethod(bool nonPublic)
- {
- return SetReflectedType(property.GetGetMethod(nonPublic), reflectedType);
- }
-
- public override MethodInfo GetSetMethod(bool nonPublic)
- {
- return SetReflectedType(property.GetSetMethod(nonPublic), reflectedType);
- }
-
- public override MethodInfo[] GetAccessors(bool nonPublic)
- {
- return SetReflectedType(property.GetAccessors(nonPublic), reflectedType);
- }
-
- public override object GetRawConstantValue()
- {
- return property.GetRawConstantValue();
- }
-
- internal override bool IsPublic
- {
- get { return property.IsPublic; }
- }
-
- internal override bool IsNonPrivate
- {
- get { return property.IsNonPrivate; }
- }
-
- internal override bool IsStatic
- {
- get { return property.IsStatic; }
- }
-
- internal override PropertySignature PropertySignature
- {
- get { return property.PropertySignature; }
- }
-
- public override ParameterInfo[] GetIndexParameters()
- {
- ParameterInfo[] parameters = property.GetIndexParameters();
- for (int i = 0; i < parameters.Length; i++)
- {
- parameters[i] = new ParameterInfoWrapper(this, parameters[i]);
- }
- return parameters;
- }
-
- internal override PropertyInfo BindTypeParameters(Type type)
- {
- return property.BindTypeParameters(type);
- }
-
- public override string ToString()
- {
- return property.ToString();
- }
-
- public override bool __IsMissing
- {
- get { return property.__IsMissing; }
- }
-
- public override Type DeclaringType
- {
- get { return property.DeclaringType; }
- }
-
- public override Type ReflectedType
- {
- get { return reflectedType; }
- }
-
- public override bool Equals(object obj)
- {
- PropertyInfoWithReflectedType other = obj as PropertyInfoWithReflectedType;
- return other != null
- && other.reflectedType == reflectedType
- && other.property == property;
- }
-
- public override int GetHashCode()
- {
- return reflectedType.GetHashCode() ^ property.GetHashCode();
- }
-
- public override int MetadataToken
- {
- get { return property.MetadataToken; }
- }
-
- public override Module Module
- {
- get { return property.Module; }
- }
-
- public override string Name
- {
- get { return property.Name; }
- }
-
- internal override bool IsBaked
- {
- get { return property.IsBaked; }
- }
-
- internal override int GetCurrentToken()
- {
- return property.GetCurrentToken();
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009-2011 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Text;
-using IKVM.Reflection.Emit;
-using IKVM.Reflection.Writer;
-using IKVM.Reflection.Reader;
-
-namespace IKVM.Reflection
-{
- sealed class PropertySignature : Signature
- {
- private CallingConventions callingConvention;
- private readonly Type propertyType;
- private readonly Type[] parameterTypes;
- private readonly PackedCustomModifiers customModifiers;
-
- internal static PropertySignature Create(CallingConventions callingConvention, Type propertyType, Type[] parameterTypes, PackedCustomModifiers customModifiers)
- {
- return new PropertySignature(callingConvention, propertyType, Util.Copy(parameterTypes), customModifiers);
- }
-
- private PropertySignature(CallingConventions callingConvention, Type propertyType, Type[] parameterTypes, PackedCustomModifiers customModifiers)
- {
- this.callingConvention = callingConvention;
- this.propertyType = propertyType;
- this.parameterTypes = parameterTypes;
- this.customModifiers = customModifiers;
- }
-
- public override bool Equals(object obj)
- {
- PropertySignature other = obj as PropertySignature;
- return other != null
- && other.propertyType.Equals(propertyType)
- && other.customModifiers.Equals(customModifiers);
- }
-
- public override int GetHashCode()
- {
- return propertyType.GetHashCode() ^ customModifiers.GetHashCode();
- }
-
- internal int ParameterCount
- {
- get { return parameterTypes.Length; }
- }
-
- internal bool HasThis
- {
- set
- {
- if (value)
- {
- callingConvention |= CallingConventions.HasThis;
- }
- else
- {
- callingConvention &= ~CallingConventions.HasThis;
- }
- }
- }
-
- internal Type PropertyType
- {
- get { return propertyType; }
- }
-
- internal CustomModifiers GetCustomModifiers()
- {
- return customModifiers.GetReturnTypeCustomModifiers();
- }
-
- internal PropertySignature ExpandTypeParameters(Type declaringType)
- {
- return new PropertySignature(
- callingConvention,
- propertyType.BindTypeParameters(declaringType),
- BindTypeParameters(declaringType, parameterTypes),
- customModifiers.Bind(declaringType));
- }
-
- internal override void WriteSig(ModuleBuilder module, ByteBuffer bb)
- {
- byte flags = PROPERTY;
- if ((callingConvention & CallingConventions.HasThis) != 0)
- {
- flags |= HASTHIS;
- }
- if ((callingConvention & CallingConventions.ExplicitThis) != 0)
- {
- flags |= EXPLICITTHIS;
- }
- if ((callingConvention & CallingConventions.VarArgs) != 0)
- {
- flags |= VARARG;
- }
- bb.Write(flags);
- bb.WriteCompressedInt(parameterTypes == null ? 0 : parameterTypes.Length);
- WriteCustomModifiers(module, bb, customModifiers.GetReturnTypeCustomModifiers());
- WriteType(module, bb, propertyType);
- if (parameterTypes != null)
- {
- for (int i = 0; i < parameterTypes.Length; i++)
- {
- WriteCustomModifiers(module, bb, customModifiers.GetParameterCustomModifiers(i));
- WriteType(module, bb, parameterTypes[i]);
- }
- }
- }
-
- internal Type GetParameter(int parameter)
- {
- return parameterTypes[parameter];
- }
-
- internal CustomModifiers GetParameterCustomModifiers(int parameter)
- {
- return customModifiers.GetParameterCustomModifiers(parameter);
- }
-
- internal CallingConventions CallingConvention
- {
- get { return callingConvention; }
- }
-
- internal bool MatchParameterTypes(Type[] types)
- {
- return Util.ArrayEquals(types, parameterTypes);
- }
-
- internal static PropertySignature ReadSig(ModuleReader module, ByteReader br, IGenericContext context)
- {
- byte flags = br.ReadByte();
- if ((flags & PROPERTY) == 0)
- {
- throw new BadImageFormatException();
- }
- CallingConventions callingConvention = CallingConventions.Standard;
- if ((flags & HASTHIS) != 0)
- {
- callingConvention |= CallingConventions.HasThis;
- }
- if ((flags & EXPLICITTHIS) != 0)
- {
- callingConvention |= CallingConventions.ExplicitThis;
- }
- Type returnType;
- Type[] parameterTypes;
- int paramCount = br.ReadCompressedInt();
- CustomModifiers[] mods = null;
- PackedCustomModifiers.Pack(ref mods, 0, CustomModifiers.Read(module, br, context), paramCount + 1);
- returnType = ReadRetType(module, br, context);
- parameterTypes = new Type[paramCount];
- for (int i = 0; i < parameterTypes.Length; i++)
- {
- PackedCustomModifiers.Pack(ref mods, i + 1, CustomModifiers.Read(module, br, context), paramCount + 1);
- parameterTypes[i] = ReadParam(module, br, context);
- }
- return new PropertySignature(callingConvention, returnType, parameterTypes, PackedCustomModifiers.Wrap(mods));
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Configuration.Assemblies;
-using System.IO;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection.Reader
-{
- sealed class AssemblyReader : Assembly
- {
- private const int ContainsNoMetaData = 0x0001;
- private readonly string location;
- private readonly ModuleReader manifestModule;
- private readonly Module[] externalModules;
-
- internal AssemblyReader(string location, ModuleReader manifestModule)
- : base(manifestModule.universe)
- {
- this.location = location;
- this.manifestModule = manifestModule;
- externalModules = new Module[manifestModule.File.records.Length];
- }
-
- public override string Location
- {
- get { return location; }
- }
-
- public override AssemblyName GetName()
- {
- return GetNameImpl(ref manifestModule.AssemblyTable.records[0]);
- }
-
- private AssemblyName GetNameImpl(ref AssemblyTable.Record rec)
- {
- AssemblyName name = new AssemblyName();
- name.Name = manifestModule.GetString(rec.Name);
- name.Version = new Version(rec.MajorVersion, rec.MinorVersion, rec.BuildNumber, rec.RevisionNumber);
- if (rec.PublicKey != 0)
- {
- name.SetPublicKey(manifestModule.GetBlobCopy(rec.PublicKey));
- }
- else
- {
- name.SetPublicKey(Empty<byte>.Array);
- }
- if (rec.Culture != 0)
- {
- name.Culture = manifestModule.GetString(rec.Culture);
- }
- else
- {
- name.Culture = "";
- }
- name.HashAlgorithm = (AssemblyHashAlgorithm)rec.HashAlgId;
- name.CodeBase = this.CodeBase;
- name.RawFlags = (AssemblyNameFlags)rec.Flags;
- return name;
- }
-
- public override Type[] GetTypes()
- {
- if (externalModules.Length == 0)
- {
- return manifestModule.GetTypes();
- }
-
- List<Type> list = new List<Type>();
- foreach (Module module in GetModules(false))
- {
- list.AddRange(module.GetTypes());
- }
- return list.ToArray();
- }
-
- internal override Type FindType(TypeName typeName)
- {
- Type type = manifestModule.FindType(typeName);
- for (int i = 0; type == null && i < externalModules.Length; i++)
- {
- if ((manifestModule.File.records[i].Flags & ContainsNoMetaData) == 0)
- {
- type = GetModule(i).FindType(typeName);
- }
- }
- return type;
- }
-
- internal override Type FindTypeIgnoreCase(TypeName lowerCaseName)
- {
- Type type = manifestModule.FindTypeIgnoreCase(lowerCaseName);
- for (int i = 0; type == null && i < externalModules.Length; i++)
- {
- if ((manifestModule.File.records[i].Flags & ContainsNoMetaData) == 0)
- {
- type = GetModule(i).FindTypeIgnoreCase(lowerCaseName);
- }
- }
- return type;
- }
-
- public override string ImageRuntimeVersion
- {
- get { return manifestModule.__ImageRuntimeVersion; }
- }
-
- public override Module ManifestModule
- {
- get { return manifestModule; }
- }
-
- public override Module[] GetLoadedModules(bool getResourceModules)
- {
- List<Module> list = new List<Module>();
- list.Add(manifestModule);
- foreach (Module m in externalModules)
- {
- if (m != null)
- {
- list.Add(m);
- }
- }
- return list.ToArray();
- }
-
- public override Module[] GetModules(bool getResourceModules)
- {
- if (externalModules.Length == 0)
- {
- return new Module[] { manifestModule };
- }
- else
- {
- List<Module> list = new List<Module>();
- list.Add(manifestModule);
- for (int i = 0; i < manifestModule.File.records.Length; i++)
- {
- if (getResourceModules || (manifestModule.File.records[i].Flags & ContainsNoMetaData) == 0)
- {
- list.Add(GetModule(i));
- }
- }
- return list.ToArray();
- }
- }
-
- public override Module GetModule(string name)
- {
- if (name.Equals(manifestModule.ScopeName, StringComparison.InvariantCultureIgnoreCase))
- {
- return manifestModule;
- }
- int index = GetModuleIndex(name);
- if (index != -1)
- {
- return GetModule(index);
- }
- return null;
- }
-
- private int GetModuleIndex(string name)
- {
- for (int i = 0; i < manifestModule.File.records.Length; i++)
- {
- if (name.Equals(manifestModule.GetString(manifestModule.File.records[i].Name), StringComparison.InvariantCultureIgnoreCase))
- {
- return i;
- }
- }
- return -1;
- }
-
- private Module GetModule(int index)
- {
- if (externalModules[index] != null)
- {
- return externalModules[index];
- }
- // TODO add ModuleResolve event
- string location = Path.Combine(Path.GetDirectoryName(this.location), manifestModule.GetString(manifestModule.File.records[index].Name));
- return LoadModule(index, null, location);
- }
-
- private Module LoadModule(int index, byte[] rawModule, string location)
- {
- if ((manifestModule.File.records[index].Flags & ContainsNoMetaData) != 0)
- {
- return externalModules[index] = new ResourceModule(manifestModule, index, location);
- }
- else
- {
- if (rawModule == null)
- {
- rawModule = File.ReadAllBytes(location);
- }
- return externalModules[index] = new ModuleReader(this, manifestModule.universe, new MemoryStream(rawModule), location);
- }
- }
-
- public override Module LoadModule(string moduleName, byte[] rawModule)
- {
- int index = GetModuleIndex(moduleName);
- if (index == -1)
- {
- throw new ArgumentException();
- }
- if (externalModules[index] != null)
- {
- return externalModules[index];
- }
- return LoadModule(index, rawModule, null);
- }
-
- public override MethodInfo EntryPoint
- {
- get { return manifestModule.GetEntryPoint(); }
- }
-
- public override string[] GetManifestResourceNames()
- {
- return manifestModule.GetManifestResourceNames();
- }
-
- public override ManifestResourceInfo GetManifestResourceInfo(string resourceName)
- {
- return manifestModule.GetManifestResourceInfo(resourceName);
- }
-
- public override Stream GetManifestResourceStream(string resourceName)
- {
- return manifestModule.GetManifestResourceStream(resourceName);
- }
-
- public override AssemblyName[] GetReferencedAssemblies()
- {
- return manifestModule.__GetReferencedAssemblies();
- }
-
- public override AssemblyNameFlags __AssemblyFlags
- {
- get { return (AssemblyNameFlags)manifestModule.AssemblyTable.records[0].Flags; }
- }
-
- internal string Name
- {
- get { return manifestModule.GetString(manifestModule.AssemblyTable.records[0].Name); }
- }
-
- internal override IList<CustomAttributeData> GetCustomAttributesData(Type attributeType)
- {
- return CustomAttributeData.GetCustomAttributesImpl(null, manifestModule, 0x20000001, attributeType) ?? CustomAttributeData.EmptyList;
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace IKVM.Reflection.Reader
-{
- sealed class ByteReader
- {
- private byte[] buffer;
- private int pos;
- private int end;
-
- internal ByteReader(byte[] buffer, int offset, int length)
- {
- this.buffer = buffer;
- this.pos = offset;
- this.end = pos + length;
- }
-
- internal static ByteReader FromBlob(byte[] blobHeap, int blob)
- {
- ByteReader br = new ByteReader(blobHeap, blob, 4);
- int length = br.ReadCompressedInt();
- br.end = br.pos + length;
- return br;
- }
-
- internal int Length
- {
- get { return end - pos; }
- }
-
- internal byte PeekByte()
- {
- if (pos == end)
- throw new BadImageFormatException();
- return buffer[pos];
- }
-
- internal byte ReadByte()
- {
- if (pos == end)
- throw new BadImageFormatException();
- return buffer[pos++];
- }
-
- internal byte[] ReadBytes(int count)
- {
- if (count < 0)
- throw new BadImageFormatException();
- if (end - pos < count)
- throw new BadImageFormatException();
- byte[] buf = new byte[count];
- Buffer.BlockCopy(buffer, pos, buf, 0, count);
- pos += count;
- return buf;
- }
-
- internal int ReadCompressedInt()
- {
- byte b1 = ReadByte();
- if (b1 <= 0x7F)
- {
- return b1;
- }
- else if ((b1 & 0xC0) == 0x80)
- {
- byte b2 = ReadByte();
- return ((b1 & 0x3F) << 8) | b2;
- }
- else
- {
- byte b2 = ReadByte();
- byte b3 = ReadByte();
- byte b4 = ReadByte();
- return ((b1 & 0x3F) << 24) + (b2 << 16) + (b3 << 8) + b4;
- }
- }
-
- internal string ReadString()
- {
- if (PeekByte() == 0xFF)
- {
- pos++;
- return null;
- }
- int length = ReadCompressedInt();
- string str = Encoding.UTF8.GetString(buffer, pos, length);
- pos += length;
- return str;
- }
-
- internal char ReadChar()
- {
- return (char)ReadInt16();
- }
-
- internal sbyte ReadSByte()
- {
- return (sbyte)ReadByte();
- }
-
- internal short ReadInt16()
- {
- if (end - pos < 2)
- throw new BadImageFormatException();
- byte b1 = buffer[pos++];
- byte b2 = buffer[pos++];
- return (short)(b1 | (b2 << 8));
- }
-
- internal ushort ReadUInt16()
- {
- return (ushort)ReadInt16();
- }
-
- internal int ReadInt32()
- {
- if (end - pos < 4)
- throw new BadImageFormatException();
- byte b1 = buffer[pos++];
- byte b2 = buffer[pos++];
- byte b3 = buffer[pos++];
- byte b4 = buffer[pos++];
- return (int)(b1 | (b2 << 8) | (b3 << 16) | (b4 << 24));
- }
-
- internal uint ReadUInt32()
- {
- return (uint)ReadInt32();
- }
-
- internal long ReadInt64()
- {
- ulong lo = ReadUInt32();
- ulong hi = ReadUInt32();
- return (long)(lo | (hi << 32));
- }
-
- internal ulong ReadUInt64()
- {
- return (ulong)ReadInt64();
- }
-
- internal float ReadSingle()
- {
- return SingleConverter.Int32BitsToSingle(ReadInt32());
- }
-
- internal double ReadDouble()
- {
- return BitConverter.Int64BitsToDouble(ReadInt64());
- }
-
- internal ByteReader Slice(int length)
- {
- if (end - pos < length)
- throw new BadImageFormatException();
- ByteReader br = new ByteReader(buffer, pos, length);
- pos += length;
- return br;
- }
-
- // NOTE this method only works if the original offset was aligned and for alignments that are a power of 2
- internal void Align(int alignment)
- {
- alignment--;
- pos = (pos + alignment) & ~alignment;
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009-2012 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection.Reader
-{
- sealed class EventInfoImpl : EventInfo
- {
- private readonly ModuleReader module;
- private readonly Type declaringType;
- private readonly int index;
- private bool isPublic;
- private bool isNonPrivate;
- private bool isStatic;
- private bool flagsCached;
-
- internal EventInfoImpl(ModuleReader module, Type declaringType, int index)
- {
- this.module = module;
- this.declaringType = declaringType;
- this.index = index;
- }
-
- public override bool Equals(object obj)
- {
- EventInfoImpl other = obj as EventInfoImpl;
- return other != null && other.declaringType == declaringType && other.index == index;
- }
-
- public override int GetHashCode()
- {
- return declaringType.GetHashCode() * 123 + index;
- }
-
- public override EventAttributes Attributes
- {
- get { return (EventAttributes)module.Event.records[index].EventFlags; }
- }
-
- public override MethodInfo GetAddMethod(bool nonPublic)
- {
- return module.MethodSemantics.GetMethod(module, this.MetadataToken, nonPublic, MethodSemanticsTable.AddOn);
- }
-
- public override MethodInfo GetRaiseMethod(bool nonPublic)
- {
- return module.MethodSemantics.GetMethod(module, this.MetadataToken, nonPublic, MethodSemanticsTable.Fire);
- }
-
- public override MethodInfo GetRemoveMethod(bool nonPublic)
- {
- return module.MethodSemantics.GetMethod(module, this.MetadataToken, nonPublic, MethodSemanticsTable.RemoveOn);
- }
-
- public override MethodInfo[] GetOtherMethods(bool nonPublic)
- {
- return module.MethodSemantics.GetMethods(module, this.MetadataToken, nonPublic, MethodSemanticsTable.Other);
- }
-
- public override MethodInfo[] __GetMethods()
- {
- return module.MethodSemantics.GetMethods(module, this.MetadataToken, true, -1);
- }
-
- public override Type EventHandlerType
- {
- get { return module.ResolveType(module.Event.records[index].EventType, declaringType); }
- }
-
- public override string Name
- {
- get { return module.GetString(module.Event.records[index].Name); }
- }
-
- public override Type DeclaringType
- {
- get { return declaringType; }
- }
-
- public override Module Module
- {
- get { return module; }
- }
-
- public override int MetadataToken
- {
- get { return (EventTable.Index << 24) + index + 1; }
- }
-
- internal override bool IsPublic
- {
- get
- {
- if (!flagsCached)
- {
- ComputeFlags();
- }
- return isPublic;
- }
- }
-
- internal override bool IsNonPrivate
- {
- get
- {
- if (!flagsCached)
- {
- ComputeFlags();
- }
- return isNonPrivate;
- }
- }
-
- internal override bool IsStatic
- {
- get
- {
- if (!flagsCached)
- {
- ComputeFlags();
- }
- return isStatic;
- }
- }
-
- private void ComputeFlags()
- {
- module.MethodSemantics.ComputeFlags(module, this.MetadataToken, out isPublic, out isNonPrivate, out isStatic);
- flagsCached = true;
- }
-
- internal override bool IsBaked
- {
- get { return true; }
- }
-
- internal override int GetCurrentToken()
- {
- return this.MetadataToken;
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.IO;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection.Reader
-{
- sealed class FieldDefImpl : FieldInfo
- {
- private readonly ModuleReader module;
- private readonly TypeDefImpl declaringType;
- private readonly int index;
- private FieldSignature lazyFieldSig;
-
- internal FieldDefImpl(ModuleReader module, TypeDefImpl declaringType, int index)
- {
- this.module = module;
- this.declaringType = declaringType;
- this.index = index;
- }
-
- public override FieldAttributes Attributes
- {
- get { return (FieldAttributes)module.Field.records[index].Flags; }
- }
-
- public override Type DeclaringType
- {
- get { return declaringType.IsModulePseudoType ? null : declaringType; }
- }
-
- public override string Name
- {
- get { return module.GetString(module.Field.records[index].Name); }
- }
-
- public override string ToString()
- {
- return this.FieldType.Name + " " + this.Name;
- }
-
- public override Module Module
- {
- get { return module; }
- }
-
- public override int MetadataToken
- {
- get { return (FieldTable.Index << 24) + index + 1; }
- }
-
- public override object GetRawConstantValue()
- {
- return module.Constant.GetRawConstantValue(module, this.MetadataToken);
- }
-
- public override void __GetDataFromRVA(byte[] data, int offset, int length)
- {
- int rva = this.__FieldRVA;
- if (rva == 0)
- {
- // C++ assemblies can have fields that have an RVA that is zero
- Array.Clear(data, offset, length);
- return;
- }
- module.__ReadDataFromRVA(rva, data, offset, length);
- }
-
- public override int __FieldRVA
- {
- get
- {
- foreach (int i in module.FieldRVA.Filter(index + 1))
- {
- return module.FieldRVA.records[i].RVA;
- }
- throw new InvalidOperationException();
- }
- }
-
- public override bool __TryGetFieldOffset(out int offset)
- {
- foreach (int i in this.Module.FieldLayout.Filter(index + 1))
- {
- offset = this.Module.FieldLayout.records[i].Offset;
- return true;
- }
- offset = 0;
- return false;
- }
-
- internal override FieldSignature FieldSignature
- {
- get { return lazyFieldSig ?? (lazyFieldSig = FieldSignature.ReadSig(module, module.GetBlob(module.Field.records[index].Signature), declaringType)); }
- }
-
- internal override int ImportTo(Emit.ModuleBuilder module)
- {
- return module.ImportMethodOrField(declaringType, this.Name, this.FieldSignature);
- }
-
- internal override int GetCurrentToken()
- {
- return this.MetadataToken;
- }
-
- internal override bool IsBaked
- {
- get { return true; }
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009-2012 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection.Reader
-{
- abstract class TypeParameterType : TypeInfo
- {
- public sealed override string AssemblyQualifiedName
- {
- get { return null; }
- }
-
- public sealed override bool IsValueType
- {
- get { return (this.GenericParameterAttributes & GenericParameterAttributes.NotNullableValueTypeConstraint) != 0; }
- }
-
- public sealed override Type BaseType
- {
- get
- {
- foreach (Type type in GetGenericParameterConstraints())
- {
- if (!type.IsInterface && !type.IsGenericParameter)
- {
- return type;
- }
- }
- return this.IsValueType ? this.Module.universe.System_ValueType : this.Module.universe.System_Object;
- }
- }
-
- public override Type[] __GetDeclaredInterfaces()
- {
- List<Type> list = new List<Type>();
- foreach (Type type in GetGenericParameterConstraints())
- {
- if (type.IsInterface)
- {
- list.Add(type);
- }
- }
- return list.ToArray();
- }
-
- public sealed override TypeAttributes Attributes
- {
- get { return TypeAttributes.Public; }
- }
-
- public sealed override string FullName
- {
- get { return null; }
- }
-
- public sealed override string ToString()
- {
- return this.Name;
- }
-
- public sealed override bool IsGenericParameter
- {
- get { return true; }
- }
-
- public sealed override bool __ContainsMissingType
- {
- get
- {
- bool freeList = false;
- try
- {
- foreach (Type type in GetGenericParameterConstraints())
- {
- if (type.__IsMissing)
- {
- return true;
- }
- else if (type.IsConstructedGenericType || type.HasElementType || type.__IsFunctionPointer)
- {
- // if a constructed type contains generic parameters,
- // it might contain this type parameter again and
- // to prevent infinite recurssion, we keep a thread local
- // list of type parameters we've already processed
- if (type.ContainsGenericParameters)
- {
- if (containsMissingTypeHack == null)
- {
- freeList = true;
- containsMissingTypeHack = new List<Type>();
- }
- else if (containsMissingTypeHack.Contains(this))
- {
- return false;
- }
- containsMissingTypeHack.Add(this);
- }
- if (type.__ContainsMissingType)
- {
- return true;
- }
- }
- }
- return false;
- }
- finally
- {
- if (freeList)
- {
- containsMissingTypeHack = null;
- }
- }
- }
- }
-
- [ThreadStatic]
- private static List<Type> containsMissingTypeHack;
- }
-
- sealed class UnboundGenericMethodParameter : TypeParameterType
- {
- private static readonly DummyModule module = new DummyModule();
- private readonly int position;
-
- private sealed class DummyModule : NonPEModule
- {
- internal DummyModule()
- : base(new Universe())
- {
- }
-
- protected override Exception NotSupportedException()
- {
- return new InvalidOperationException();
- }
-
- protected override Exception ArgumentOutOfRangeException()
- {
- return new InvalidOperationException();
- }
-
- public override bool Equals(object obj)
- {
- throw new InvalidOperationException();
- }
-
- public override int GetHashCode()
- {
- throw new InvalidOperationException();
- }
-
- public override string ToString()
- {
- throw new InvalidOperationException();
- }
-
- public override int MDStreamVersion
- {
- get { throw new InvalidOperationException(); }
- }
-
- public override Assembly Assembly
- {
- get { throw new InvalidOperationException(); }
- }
-
- internal override Type FindType(TypeName typeName)
- {
- throw new InvalidOperationException();
- }
-
- internal override Type FindTypeIgnoreCase(TypeName lowerCaseName)
- {
- throw new InvalidOperationException();
- }
-
- internal override void GetTypesImpl(List<Type> list)
- {
- throw new InvalidOperationException();
- }
-
- public override string FullyQualifiedName
- {
- get { throw new InvalidOperationException(); }
- }
-
- public override string Name
- {
- get { throw new InvalidOperationException(); }
- }
-
- public override Guid ModuleVersionId
- {
- get { throw new InvalidOperationException(); }
- }
-
- public override string ScopeName
- {
- get { throw new InvalidOperationException(); }
- }
- }
-
- internal static Type Make(int position)
- {
- return module.universe.CanonicalizeType(new UnboundGenericMethodParameter(position));
- }
-
- private UnboundGenericMethodParameter(int position)
- {
- this.position = position;
- }
-
- public override bool Equals(object obj)
- {
- UnboundGenericMethodParameter other = obj as UnboundGenericMethodParameter;
- return other != null && other.position == position;
- }
-
- public override int GetHashCode()
- {
- return position;
- }
-
- public override string Namespace
- {
- get { throw new InvalidOperationException(); }
- }
-
- public override string Name
- {
- get { throw new InvalidOperationException(); }
- }
-
- public override int MetadataToken
- {
- get { throw new InvalidOperationException(); }
- }
-
- public override Module Module
- {
- get { return module; }
- }
-
- public override int GenericParameterPosition
- {
- get { return position; }
- }
-
- public override Type DeclaringType
- {
- get { return null; }
- }
-
- public override MethodBase DeclaringMethod
- {
- get { throw new InvalidOperationException(); }
- }
-
- public override Type[] GetGenericParameterConstraints()
- {
- throw new InvalidOperationException();
- }
-
- public override GenericParameterAttributes GenericParameterAttributes
- {
- get { throw new InvalidOperationException(); }
- }
-
- internal override Type BindTypeParameters(IGenericBinder binder)
- {
- return binder.BindMethodParameter(this);
- }
-
- internal override bool IsBaked
- {
- get { throw new InvalidOperationException(); }
- }
- }
-
- sealed class GenericTypeParameter : TypeParameterType
- {
- private readonly ModuleReader module;
- private readonly int index;
-
- internal GenericTypeParameter(ModuleReader module, int index)
- {
- this.module = module;
- this.index = index;
- }
-
- public override bool Equals(object obj)
- {
- return base.Equals(obj);
- }
-
- public override int GetHashCode()
- {
- return base.GetHashCode();
- }
-
- public override string Namespace
- {
- get { return DeclaringType.Namespace; }
- }
-
- public override string Name
- {
- get { return module.GetString(module.GenericParam.records[index].Name); }
- }
-
- public override Module Module
- {
- get { return module; }
- }
-
- public override int MetadataToken
- {
- get { return (GenericParamTable.Index << 24) + index + 1; }
- }
-
- public override int GenericParameterPosition
- {
- get { return module.GenericParam.records[index].Number; }
- }
-
- public override Type DeclaringType
- {
- get
- {
- int owner = module.GenericParam.records[index].Owner;
- return (owner >> 24) == TypeDefTable.Index ? module.ResolveType(owner) : null;
- }
- }
-
- public override MethodBase DeclaringMethod
- {
- get
- {
- int owner = module.GenericParam.records[index].Owner;
- return (owner >> 24) == MethodDefTable.Index ? module.ResolveMethod(owner) : null;
- }
- }
-
- public override Type[] GetGenericParameterConstraints()
- {
- IGenericContext context = (this.DeclaringMethod as IGenericContext) ?? this.DeclaringType;
- List<Type> list = new List<Type>();
- foreach (int i in module.GenericParamConstraint.Filter(this.MetadataToken))
- {
- list.Add(module.ResolveType(module.GenericParamConstraint.records[i].Constraint, context));
- }
- return list.ToArray();
- }
-
- public override GenericParameterAttributes GenericParameterAttributes
- {
- get { return (GenericParameterAttributes)module.GenericParam.records[index].Flags; }
- }
-
- internal override Type BindTypeParameters(IGenericBinder binder)
- {
- int owner = module.GenericParam.records[index].Owner;
- if ((owner >> 24) == MethodDefTable.Index)
- {
- return binder.BindMethodParameter(this);
- }
- else
- {
- return binder.BindTypeParameter(this);
- }
- }
-
- internal override bool IsBaked
- {
- get { return true; }
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009-2011 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.IO;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection.Reader
-{
- sealed class MetadataReader : MetadataRW
- {
- private readonly Stream stream;
- private const int bufferLength = 2048;
- private readonly byte[] buffer = new byte[bufferLength];
- private int pos = bufferLength;
-
- internal MetadataReader(ModuleReader module, Stream stream, byte heapSizes)
- : base(module, (heapSizes & 0x01) != 0, (heapSizes & 0x02) != 0, (heapSizes & 0x04) != 0)
- {
- this.stream = stream;
- }
-
- private void FillBuffer(int needed)
- {
- int count = bufferLength - pos;
- if (count != 0)
- {
- // move remaining bytes to the front of the buffer
- Buffer.BlockCopy(buffer, pos, buffer, 0, count);
- }
- pos = 0;
-
- while (count < needed)
- {
- int len = stream.Read(buffer, count, bufferLength - count);
- if (len == 0)
- {
- throw new BadImageFormatException();
- }
- count += len;
- }
-
- if (count != bufferLength)
- {
- // we didn't fill the buffer completely, so have to restore the invariant
- // that all data from pos up until the end of the buffer is valid
- Buffer.BlockCopy(buffer, 0, buffer, bufferLength - count, count);
- pos = bufferLength - count;
- }
- }
-
- internal ushort ReadUInt16()
- {
- return (ushort)ReadInt16();
- }
-
- internal short ReadInt16()
- {
- if (pos > bufferLength - 2)
- {
- FillBuffer(2);
- }
- byte b1 = buffer[pos++];
- byte b2 = buffer[pos++];
- return (short)(b1 | (b2 << 8));
- }
-
- internal int ReadInt32()
- {
- if (pos > bufferLength - 4)
- {
- FillBuffer(4);
- }
- byte b1 = buffer[pos++];
- byte b2 = buffer[pos++];
- byte b3 = buffer[pos++];
- byte b4 = buffer[pos++];
- return b1 | (b2 << 8) | (b3 << 16) | (b4 << 24);
- }
-
- private int ReadIndex(bool big)
- {
- if (big)
- {
- return ReadInt32();
- }
- else
- {
- return ReadUInt16();
- }
- }
-
- internal int ReadStringIndex()
- {
- return ReadIndex(bigStrings);
- }
-
- internal int ReadGuidIndex()
- {
- return ReadIndex(bigGuids);
- }
-
- internal int ReadBlobIndex()
- {
- return ReadIndex(bigBlobs);
- }
-
- internal int ReadResolutionScope()
- {
- int codedIndex = ReadIndex(bigResolutionScope);
- switch (codedIndex & 3)
- {
- case 0:
- return (ModuleTable.Index << 24) + (codedIndex >> 2);
- case 1:
- return (ModuleRefTable.Index << 24) + (codedIndex >> 2);
- case 2:
- return (AssemblyRefTable.Index << 24) + (codedIndex >> 2);
- case 3:
- return (TypeRefTable.Index << 24) + (codedIndex >> 2);
- default:
- throw new BadImageFormatException();
- }
- }
-
- internal int ReadTypeDefOrRef()
- {
- int codedIndex = ReadIndex(bigTypeDefOrRef);
- switch (codedIndex & 3)
- {
- case 0:
- return (TypeDefTable.Index << 24) + (codedIndex >> 2);
- case 1:
- return (TypeRefTable.Index << 24) + (codedIndex >> 2);
- case 2:
- return (TypeSpecTable.Index << 24) + (codedIndex >> 2);
- default:
- throw new BadImageFormatException();
- }
- }
-
- internal int ReadMemberRefParent()
- {
- int codedIndex = ReadIndex(bigMemberRefParent);
- switch (codedIndex & 7)
- {
- case 0:
- return (TypeDefTable.Index << 24) + (codedIndex >> 3);
- case 1:
- return (TypeRefTable.Index << 24) + (codedIndex >> 3);
- case 2:
- return (ModuleRefTable.Index << 24) + (codedIndex >> 3);
- case 3:
- return (MethodDefTable.Index << 24) + (codedIndex >> 3);
- case 4:
- return (TypeSpecTable.Index << 24) + (codedIndex >> 3);
- default:
- throw new BadImageFormatException();
- }
- }
-
- internal int ReadHasCustomAttribute()
- {
- int codedIndex = ReadIndex(bigHasCustomAttribute);
- switch (codedIndex & 31)
- {
- case 0:
- return (MethodDefTable.Index << 24) + (codedIndex >> 5);
- case 1:
- return (FieldTable.Index << 24) + (codedIndex >> 5);
- case 2:
- return (TypeRefTable.Index << 24) + (codedIndex >> 5);
- case 3:
- return (TypeDefTable.Index << 24) + (codedIndex >> 5);
- case 4:
- return (ParamTable.Index << 24) + (codedIndex >> 5);
- case 5:
- return (InterfaceImplTable.Index << 24) + (codedIndex >> 5);
- case 6:
- return (MemberRefTable.Index << 24) + (codedIndex >> 5);
- case 7:
- return (ModuleTable.Index << 24) + (codedIndex >> 5);
- case 8:
- throw new BadImageFormatException();
- case 9:
- return (PropertyTable.Index << 24) + (codedIndex >> 5);
- case 10:
- return (EventTable.Index << 24) + (codedIndex >> 5);
- case 11:
- return (StandAloneSigTable.Index << 24) + (codedIndex >> 5);
- case 12:
- return (ModuleRefTable.Index << 24) + (codedIndex >> 5);
- case 13:
- return (TypeSpecTable.Index << 24) + (codedIndex >> 5);
- case 14:
- return (AssemblyTable.Index << 24) + (codedIndex >> 5);
- case 15:
- return (AssemblyRefTable.Index << 24) + (codedIndex >> 5);
- case 16:
- return (FileTable.Index << 24) + (codedIndex >> 5);
- case 17:
- return (ExportedTypeTable.Index << 24) + (codedIndex >> 5);
- case 18:
- return (ManifestResourceTable.Index << 24) + (codedIndex >> 5);
- case 19:
- return (GenericParamTable.Index << 24) + (codedIndex >> 5);
- default:
- throw new BadImageFormatException();
- }
- }
-
- internal int ReadCustomAttributeType()
- {
- int codedIndex = ReadIndex(bigCustomAttributeType);
- switch (codedIndex & 7)
- {
- case 2:
- return (MethodDefTable.Index << 24) + (codedIndex >> 3);
- case 3:
- return (MemberRefTable.Index << 24) + (codedIndex >> 3);
- default:
- throw new BadImageFormatException();
- }
- }
-
- internal int ReadMethodDefOrRef()
- {
- int codedIndex = ReadIndex(bigMethodDefOrRef);
- switch (codedIndex & 1)
- {
- case 0:
- return (MethodDefTable.Index << 24) + (codedIndex >> 1);
- case 1:
- return (MemberRefTable.Index << 24) + (codedIndex >> 1);
- default:
- throw new BadImageFormatException();
- }
- }
-
- internal int ReadHasConstant()
- {
- int codedIndex = ReadIndex(bigHasConstant);
- switch (codedIndex & 3)
- {
- case 0:
- return (FieldTable.Index << 24) + (codedIndex >> 2);
- case 1:
- return (ParamTable.Index << 24) + (codedIndex >> 2);
- case 2:
- return (PropertyTable.Index << 24) + (codedIndex >> 2);
- default:
- throw new BadImageFormatException();
- }
- }
-
- internal int ReadHasSemantics()
- {
- int codedIndex = ReadIndex(bigHasSemantics);
- switch (codedIndex & 1)
- {
- case 0:
- return (EventTable.Index << 24) + (codedIndex >> 1);
- case 1:
- return (PropertyTable.Index << 24) + (codedIndex >> 1);
- default:
- throw new BadImageFormatException();
- }
- }
-
- internal int ReadHasFieldMarshal()
- {
- int codedIndex = ReadIndex(bigHasFieldMarshal);
- switch (codedIndex & 1)
- {
- case 0:
- return (FieldTable.Index << 24) + (codedIndex >> 1);
- case 1:
- return (ParamTable.Index << 24) + (codedIndex >> 1);
- default:
- throw new BadImageFormatException();
- }
- }
-
- internal int ReadHasDeclSecurity()
- {
- int codedIndex = ReadIndex(bigHasDeclSecurity);
- switch (codedIndex & 3)
- {
- case 0:
- return (TypeDefTable.Index << 24) + (codedIndex >> 2);
- case 1:
- return (MethodDefTable.Index << 24) + (codedIndex >> 2);
- case 2:
- return (AssemblyTable.Index << 24) + (codedIndex >> 2);
- default:
- throw new BadImageFormatException();
- }
- }
-
- internal int ReadTypeOrMethodDef()
- {
- int codedIndex = ReadIndex(bigTypeOrMethodDef);
- switch (codedIndex & 1)
- {
- case 0:
- return (TypeDefTable.Index << 24) + (codedIndex >> 1);
- case 1:
- return (MethodDefTable.Index << 24) + (codedIndex >> 1);
- default:
- throw new BadImageFormatException();
- }
- }
-
- internal int ReadMemberForwarded()
- {
- int codedIndex = ReadIndex(bigMemberForwarded);
- switch (codedIndex & 1)
- {
- case 0:
- return (FieldTable.Index << 24) + (codedIndex >> 1);
- case 1:
- return (MethodDefTable.Index << 24) + (codedIndex >> 1);
- default:
- throw new BadImageFormatException();
- }
- }
-
- internal int ReadImplementation()
- {
- int codedIndex = ReadIndex(bigImplementation);
- switch (codedIndex & 3)
- {
- case 0:
- return (FileTable.Index << 24) + (codedIndex >> 2);
- case 1:
- return (AssemblyRefTable.Index << 24) + (codedIndex >> 2);
- case 2:
- return (ExportedTypeTable.Index << 24) + (codedIndex >> 2);
- default:
- throw new BadImageFormatException();
- }
- }
-
- internal int ReadField()
- {
- return ReadIndex(bigField);
- }
-
- internal int ReadMethodDef()
- {
- return ReadIndex(bigMethodDef);
- }
-
- internal int ReadParam()
- {
- return ReadIndex(bigParam);
- }
-
- internal int ReadProperty()
- {
- return ReadIndex(bigProperty);
- }
-
- internal int ReadEvent()
- {
- return ReadIndex(bigEvent);
- }
-
- internal int ReadTypeDef()
- {
- return ReadIndex(bigTypeDef) | (TypeDefTable.Index << 24);
- }
-
- internal int ReadGenericParam()
- {
- return ReadIndex(bigGenericParam) | (GenericParamTable.Index << 24);
- }
-
- internal int ReadModuleRef()
- {
- return ReadIndex(bigModuleRef) | (ModuleRefTable.Index << 24);
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009-2012 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection.Reader
-{
- sealed class MethodDefImpl : MethodInfo
- {
- private readonly ModuleReader module;
- private readonly int index;
- private readonly TypeDefImpl declaringType;
- private MethodSignature lazyMethodSignature;
- private ParameterInfo returnParameter;
- private ParameterInfo[] parameters;
- private Type[] typeArgs;
-
- internal MethodDefImpl(ModuleReader module, TypeDefImpl declaringType, int index)
- {
- this.module = module;
- this.index = index;
- this.declaringType = declaringType;
- }
-
- public override MethodBody GetMethodBody()
- {
- return GetMethodBody(this);
- }
-
- internal MethodBody GetMethodBody(IGenericContext context)
- {
- if ((GetMethodImplementationFlags() & MethodImplAttributes.CodeTypeMask) != MethodImplAttributes.IL)
- {
- // method is not IL
- return null;
- }
- int rva = module.MethodDef.records[index].RVA;
- return rva == 0 ? null : new MethodBody(module, rva, context);
- }
-
- public override int __MethodRVA
- {
- get { return module.MethodDef.records[index].RVA; }
- }
-
- public override CallingConventions CallingConvention
- {
- get { return this.MethodSignature.CallingConvention; }
- }
-
- public override MethodAttributes Attributes
- {
- get { return (MethodAttributes)module.MethodDef.records[index].Flags; }
- }
-
- public override MethodImplAttributes GetMethodImplementationFlags()
- {
- return (MethodImplAttributes)module.MethodDef.records[index].ImplFlags;
- }
-
- public override ParameterInfo[] GetParameters()
- {
- PopulateParameters();
- return (ParameterInfo[])parameters.Clone();
- }
-
- private void PopulateParameters()
- {
- if (parameters == null)
- {
- MethodSignature methodSignature = this.MethodSignature;
- parameters = new ParameterInfo[methodSignature.GetParameterCount()];
- int parameter = module.MethodDef.records[index].ParamList - 1;
- int end = module.MethodDef.records.Length > index + 1 ? module.MethodDef.records[index + 1].ParamList - 1 : module.Param.records.Length;
- for (; parameter < end; parameter++)
- {
- int seq = module.Param.records[parameter].Sequence - 1;
- if (seq == -1)
- {
- returnParameter = new ParameterInfoImpl(this, seq, parameter);
- }
- else
- {
- parameters[seq] = new ParameterInfoImpl(this, seq, parameter);
- }
- }
- for (int i = 0; i < parameters.Length; i++)
- {
- if (parameters[i] == null)
- {
- parameters[i] = new ParameterInfoImpl(this, i, -1);
- }
- }
- if (returnParameter == null)
- {
- returnParameter = new ParameterInfoImpl(this, -1, -1);
- }
- }
- }
-
- internal override int ParameterCount
- {
- get { return this.MethodSignature.GetParameterCount(); }
- }
-
- public override ParameterInfo ReturnParameter
- {
- get
- {
- PopulateParameters();
- return returnParameter;
- }
- }
-
- public override Type ReturnType
- {
- get
- {
- return this.ReturnParameter.ParameterType;
- }
- }
-
- public override Type DeclaringType
- {
- get { return declaringType.IsModulePseudoType ? null : declaringType; }
- }
-
- public override string Name
- {
- get { return module.GetString(module.MethodDef.records[index].Name); }
- }
-
- public override int MetadataToken
- {
- get { return (MethodDefTable.Index << 24) + index + 1; }
- }
-
- public override bool IsGenericMethodDefinition
- {
- get
- {
- PopulateGenericArguments();
- return typeArgs.Length > 0;
- }
- }
-
- public override bool IsGenericMethod
- {
- get { return IsGenericMethodDefinition; }
- }
-
- public override Type[] GetGenericArguments()
- {
- PopulateGenericArguments();
- return Util.Copy(typeArgs);
- }
-
- private void PopulateGenericArguments()
- {
- if (typeArgs == null)
- {
- int token = this.MetadataToken;
- int first = module.GenericParam.FindFirstByOwner(token);
- if (first == -1)
- {
- typeArgs = Type.EmptyTypes;
- }
- else
- {
- List<Type> list = new List<Type>();
- int len = module.GenericParam.records.Length;
- for (int i = first; i < len && module.GenericParam.records[i].Owner == token; i++)
- {
- list.Add(new GenericTypeParameter(module, i));
- }
- typeArgs = list.ToArray();
- }
- }
- }
-
- internal override Type GetGenericMethodArgument(int index)
- {
- PopulateGenericArguments();
- return typeArgs[index];
- }
-
- internal override int GetGenericMethodArgumentCount()
- {
- PopulateGenericArguments();
- return typeArgs.Length;
- }
-
- public override MethodInfo GetGenericMethodDefinition()
- {
- if (this.IsGenericMethodDefinition)
- {
- return this;
- }
- throw new InvalidOperationException();
- }
-
- public override MethodInfo MakeGenericMethod(params Type[] typeArguments)
- {
- return new GenericMethodInstance(declaringType, this, typeArguments);
- }
-
- public override Module Module
- {
- get { return module; }
- }
-
- internal override MethodSignature MethodSignature
- {
- get { return lazyMethodSignature ?? (lazyMethodSignature = MethodSignature.ReadSig(module, module.GetBlob(module.MethodDef.records[index].Signature), this)); }
- }
-
- internal override int ImportTo(Emit.ModuleBuilder module)
- {
- return module.ImportMethodOrField(declaringType, this.Name, this.MethodSignature);
- }
-
- public override MethodInfo[] __GetMethodImpls()
- {
- Type[] typeArgs = null;
- List<MethodInfo> list = null;
- foreach (int i in module.MethodImpl.Filter(declaringType.MetadataToken))
- {
- if (module.MethodImpl.records[i].MethodBody == this.MetadataToken)
- {
- if (typeArgs == null)
- {
- typeArgs = declaringType.GetGenericArguments();
- }
- if (list == null)
- {
- list = new List<MethodInfo>();
- }
- list.Add((MethodInfo)module.ResolveMethod(module.MethodImpl.records[i].MethodDeclaration, typeArgs, null));
- }
- }
- return Util.ToArray(list, Empty<MethodInfo>.Array);
- }
-
- internal override int GetCurrentToken()
- {
- return this.MetadataToken;
- }
-
- internal override bool IsBaked
- {
- get { return true; }
- }
- }
-
- sealed class ParameterInfoImpl : ParameterInfo
- {
- private readonly MethodDefImpl method;
- private readonly int position;
- private readonly int index;
-
- internal ParameterInfoImpl(MethodDefImpl method, int position, int index)
- {
- this.method = method;
- this.position = position;
- this.index = index;
- }
-
- public override string Name
- {
- get { return index == -1 ? null : ((ModuleReader)this.Module).GetString(this.Module.Param.records[index].Name); }
- }
-
- public override Type ParameterType
- {
- get { return position == -1 ? method.MethodSignature.GetReturnType(method) : method.MethodSignature.GetParameterType(method, position); }
- }
-
- public override ParameterAttributes Attributes
- {
- get { return index == -1 ? ParameterAttributes.None : (ParameterAttributes)this.Module.Param.records[index].Flags; }
- }
-
- public override int Position
- {
- get { return position; }
- }
-
- public override object RawDefaultValue
- {
- get
- {
- if ((this.Attributes & ParameterAttributes.HasDefault) != 0)
- {
- return this.Module.Constant.GetRawConstantValue(this.Module, this.MetadataToken);
- }
- Universe universe = this.Module.universe;
- if (this.ParameterType == universe.System_Decimal)
- {
- Type attr = universe.System_Runtime_CompilerServices_DecimalConstantAttribute;
- if (attr != null)
- {
- foreach (CustomAttributeData cad in CustomAttributeData.__GetCustomAttributes(this, attr, false))
- {
- IList<CustomAttributeTypedArgument> args = cad.ConstructorArguments;
- if (args.Count == 5)
- {
- if (args[0].ArgumentType == universe.System_Byte
- && args[1].ArgumentType == universe.System_Byte
- && args[2].ArgumentType == universe.System_Int32
- && args[3].ArgumentType == universe.System_Int32
- && args[4].ArgumentType == universe.System_Int32)
- {
- return new Decimal((int)args[4].Value, (int)args[3].Value, (int)args[2].Value, (byte)args[1].Value != 0, (byte)args[0].Value);
- }
- else if (args[0].ArgumentType == universe.System_Byte
- && args[1].ArgumentType == universe.System_Byte
- && args[2].ArgumentType == universe.System_UInt32
- && args[3].ArgumentType == universe.System_UInt32
- && args[4].ArgumentType == universe.System_UInt32)
- {
- return new Decimal(unchecked((int)(uint)args[4].Value), unchecked((int)(uint)args[3].Value), unchecked((int)(uint)args[2].Value), (byte)args[1].Value != 0, (byte)args[0].Value);
- }
- }
- }
- }
- }
- if ((this.Attributes & ParameterAttributes.Optional) != 0)
- {
- return Missing.Value;
- }
- return null;
- }
- }
-
- public override CustomModifiers __GetCustomModifiers()
- {
- return position == -1
- ? method.MethodSignature.GetReturnTypeCustomModifiers(method)
- : method.MethodSignature.GetParameterCustomModifiers(method, position);
- }
-
- public override bool __TryGetFieldMarshal(out FieldMarshal fieldMarshal)
- {
- return FieldMarshal.ReadFieldMarshal(this.Module, this.MetadataToken, out fieldMarshal);
- }
-
- public override MemberInfo Member
- {
- get
- {
- // return the right ConstructorInfo wrapper
- return method.Module.ResolveMethod(method.MetadataToken);
- }
- }
-
- public override int MetadataToken
- {
- get
- {
- // for parameters that don't have a row in the Param table, we return 0x08000000 (because index is -1 in that case),
- // just like .NET
- return (ParamTable.Index << 24) + index + 1;
- }
- }
-
- internal override Module Module
- {
- get { return method.Module; }
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009-2012 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.IO;
-using System.Text;
-using System.Collections.Generic;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection.Reader
-{
- sealed class StreamHeader
- {
- internal uint Offset;
- internal uint Size;
- internal string Name;
-
- internal void Read(BinaryReader br)
- {
- Offset = br.ReadUInt32();
- Size = br.ReadUInt32();
- byte[] buf = new byte[32];
- byte b;
- int len = 0;
- while ((b = br.ReadByte()) != 0)
- {
- buf[len++] = b;
- }
- Name = Encoding.UTF8.GetString(buf, 0, len); ;
- int padding = -1 + ((len + 4) & ~3) - len;
- br.BaseStream.Seek(padding, SeekOrigin.Current);
- }
- }
-
- sealed class ModuleReader : Module
- {
- internal readonly Stream stream;
- private readonly string location;
- private Assembly assembly;
- private readonly PEReader peFile = new PEReader();
- private readonly CliHeader cliHeader = new CliHeader();
- private string imageRuntimeVersion;
- private int metadataStreamVersion;
- private byte[] stringHeap;
- private byte[] blobHeap;
- private byte[] userStringHeap;
- private byte[] guidHeap;
- private TypeDefImpl[] typeDefs;
- private TypeDefImpl moduleType;
- private Assembly[] assemblyRefs;
- private Type[] typeRefs;
- private Type[] typeSpecs;
- private FieldInfo[] fields;
- private MethodBase[] methods;
- private MemberInfo[] memberRefs;
- private Dictionary<int, string> strings = new Dictionary<int, string>();
- private Dictionary<TypeName, Type> types = new Dictionary<TypeName, Type>();
- private Dictionary<TypeName, LazyForwardedType> forwardedTypes = new Dictionary<TypeName, LazyForwardedType>();
-
- private sealed class LazyForwardedType
- {
- private readonly int assemblyRef;
- private Type type;
-
- internal LazyForwardedType(int assemblyRef)
- {
- this.assemblyRef = assemblyRef;
- }
-
- internal Type GetType(ModuleReader module, TypeName typeName)
- {
- if (type == null)
- {
- Assembly asm = module.ResolveAssemblyRef(assemblyRef);
- type = asm.ResolveType(typeName);
- if (type == null)
- {
- throw new TypeLoadException(typeName.ToString());
- }
- }
- return type;
- }
- }
-
- internal ModuleReader(AssemblyReader assembly, Universe universe, Stream stream, string location)
- : base(universe)
- {
- this.stream = stream;
- this.location = location;
- Read();
- if (assembly == null && AssemblyTable.records.Length != 0)
- {
- assembly = new AssemblyReader(location, this);
- }
- this.assembly = assembly;
- }
-
- private void Read()
- {
- BinaryReader br = new BinaryReader(stream);
- peFile.Read(br);
- stream.Seek(peFile.RvaToFileOffset(peFile.GetComDescriptorVirtualAddress()), SeekOrigin.Begin);
- cliHeader.Read(br);
- stream.Seek(peFile.RvaToFileOffset(cliHeader.MetaData.VirtualAddress), SeekOrigin.Begin);
- foreach (StreamHeader sh in ReadStreamHeaders(br, out imageRuntimeVersion))
- {
- switch (sh.Name)
- {
- case "#Strings":
- stringHeap = ReadHeap(stream, sh);
- break;
- case "#Blob":
- blobHeap = ReadHeap(stream, sh);
- break;
- case "#US":
- userStringHeap = ReadHeap(stream, sh);
- break;
- case "#GUID":
- guidHeap = ReadHeap(stream, sh);
- break;
- case "#~":
- case "#-":
- stream.Seek(peFile.RvaToFileOffset(cliHeader.MetaData.VirtualAddress + sh.Offset), SeekOrigin.Begin);
- ReadTables(br);
- break;
- default:
- // we ignore unknown streams, because the CLR does so too
- // (and some obfuscators add bogus streams)
- break;
- }
- }
- }
-
- internal void SetAssembly(Assembly assembly)
- {
- this.assembly = assembly;
- }
-
- private static StreamHeader[] ReadStreamHeaders(BinaryReader br, out string Version)
- {
- uint Signature = br.ReadUInt32();
- if (Signature != 0x424A5342)
- {
- throw new BadImageFormatException("Invalid metadata signature");
- }
- /*ushort MajorVersion =*/ br.ReadUInt16();
- /*ushort MinorVersion =*/ br.ReadUInt16();
- /*uint Reserved =*/ br.ReadUInt32();
- uint Length = br.ReadUInt32();
- byte[] buf = br.ReadBytes((int)Length);
- Version = Encoding.UTF8.GetString(buf).TrimEnd('\u0000');
- /*ushort Flags =*/ br.ReadUInt16();
- ushort Streams = br.ReadUInt16();
- StreamHeader[] streamHeaders = new StreamHeader[Streams];
- for (int i = 0; i < streamHeaders.Length; i++)
- {
- streamHeaders[i] = new StreamHeader();
- streamHeaders[i].Read(br);
- }
- return streamHeaders;
- }
-
- private void ReadTables(BinaryReader br)
- {
- Table[] tables = GetTables();
- /*uint Reserved0 =*/ br.ReadUInt32();
- byte MajorVersion = br.ReadByte();
- byte MinorVersion = br.ReadByte();
- metadataStreamVersion = MajorVersion << 16 | MinorVersion;
- byte HeapSizes = br.ReadByte();
- /*byte Reserved7 =*/ br.ReadByte();
- ulong Valid = br.ReadUInt64();
- ulong Sorted = br.ReadUInt64();
- for (int i = 0; i < 64; i++)
- {
- if ((Valid & (1UL << i)) != 0)
- {
- tables[i].Sorted = (Sorted & (1UL << i)) != 0;
- tables[i].RowCount = br.ReadInt32();
- }
- else if (tables[i] != null)
- {
- tables[i].RowCount = 0;
- }
- }
- MetadataReader mr = new MetadataReader(this, br.BaseStream, HeapSizes);
- for (int i = 0; i < 64; i++)
- {
- if ((Valid & (1UL << i)) != 0)
- {
- tables[i].Read(mr);
- }
- }
- if (ParamPtr.RowCount != 0)
- {
- throw new NotImplementedException("ParamPtr table support has not yet been implemented.");
- }
- }
-
- private byte[] ReadHeap(Stream stream, StreamHeader sh)
- {
- byte[] buf = new byte[sh.Size];
- stream.Seek(peFile.RvaToFileOffset(cliHeader.MetaData.VirtualAddress + sh.Offset), SeekOrigin.Begin);
- for (int pos = 0; pos < buf.Length; )
- {
- int read = stream.Read(buf, pos, buf.Length - pos);
- if (read == 0)
- {
- throw new BadImageFormatException();
- }
- pos += read;
- }
- return buf;
- }
-
- internal void SeekRVA(int rva)
- {
- stream.Seek(peFile.RvaToFileOffset((uint)rva), SeekOrigin.Begin);
- }
-
- internal override void GetTypesImpl(List<Type> list)
- {
- PopulateTypeDef();
- foreach (TypeDefImpl type in typeDefs)
- {
- if (type != moduleType)
- {
- list.Add(type);
- }
- }
- }
-
- private void PopulateTypeDef()
- {
- if (typeDefs == null)
- {
- typeDefs = new TypeDefImpl[TypeDef.records.Length];
- for (int i = 0; i < typeDefs.Length; i++)
- {
- TypeDefImpl type = new TypeDefImpl(this, i);
- typeDefs[i] = type;
- if (type.IsModulePseudoType)
- {
- moduleType = type;
- }
- else if (!type.IsNestedByFlags)
- {
- types.Add(new TypeName(type.__Namespace, type.__Name), type);
- }
- }
- // add forwarded types to forwardedTypes dictionary (because Module.GetType(string) should return them)
- for (int i = 0; i < ExportedType.records.Length; i++)
- {
- int implementation = ExportedType.records[i].Implementation;
- if (implementation >> 24 == AssemblyRefTable.Index)
- {
- TypeName typeName = GetTypeName(ExportedType.records[i].TypeNamespace, ExportedType.records[i].TypeName);
- forwardedTypes.Add(typeName, new LazyForwardedType((implementation & 0xFFFFFF) - 1));
- }
- }
- }
- }
-
- internal override string GetString(int index)
- {
- if (index == 0)
- {
- return null;
- }
- string str;
- if (!strings.TryGetValue(index, out str))
- {
- int len = 0;
- while (stringHeap[index + len] != 0)
- {
- len++;
- }
- str = Encoding.UTF8.GetString(stringHeap, index, len);
- strings.Add(index, str);
- }
- return str;
- }
-
- private static int ReadCompressedInt(byte[] buffer, ref int offset)
- {
- byte b1 = buffer[offset++];
- if (b1 <= 0x7F)
- {
- return b1;
- }
- else if ((b1 & 0xC0) == 0x80)
- {
- byte b2 = buffer[offset++];
- return ((b1 & 0x3F) << 8) | b2;
- }
- else
- {
- byte b2 = buffer[offset++];
- byte b3 = buffer[offset++];
- byte b4 = buffer[offset++];
- return ((b1 & 0x3F) << 24) + (b2 << 16) + (b3 << 8) + b4;
- }
- }
-
- internal byte[] GetBlobCopy(int blobIndex)
- {
- int len = ReadCompressedInt(blobHeap, ref blobIndex);
- byte[] buf = new byte[len];
- Buffer.BlockCopy(blobHeap, blobIndex, buf, 0, len);
- return buf;
- }
-
- internal override ByteReader GetBlob(int blobIndex)
- {
- return ByteReader.FromBlob(blobHeap, blobIndex);
- }
-
- public override string ResolveString(int metadataToken)
- {
- string str;
- if (!strings.TryGetValue(metadataToken, out str))
- {
- if ((metadataToken >> 24) != 0x70)
- {
- throw TokenOutOfRangeException(metadataToken);
- }
- int index = metadataToken & 0xFFFFFF;
- int len = ReadCompressedInt(userStringHeap, ref index) & ~1;
- StringBuilder sb = new StringBuilder(len / 2);
- for (int i = 0; i < len; i += 2)
- {
- char ch = (char)(userStringHeap[index + i] | userStringHeap[index + i + 1] << 8);
- sb.Append(ch);
- }
- str = sb.ToString();
- strings.Add(metadataToken, str);
- }
- return str;
- }
-
- internal override Type ResolveType(int metadataToken, IGenericContext context)
- {
- int index = (metadataToken & 0xFFFFFF) - 1;
- if (index < 0)
- {
- throw TokenOutOfRangeException(metadataToken);
- }
- else if ((metadataToken >> 24) == TypeDefTable.Index && index < TypeDef.RowCount)
- {
- PopulateTypeDef();
- return typeDefs[index];
- }
- else if ((metadataToken >> 24) == TypeRefTable.Index && index < TypeRef.RowCount)
- {
- if (typeRefs == null)
- {
- typeRefs = new Type[TypeRef.records.Length];
- }
- if (typeRefs[index] == null)
- {
- int scope = TypeRef.records[index].ResolutionScope;
- switch (scope >> 24)
- {
- case AssemblyRefTable.Index:
- {
- Assembly assembly = ResolveAssemblyRef((scope & 0xFFFFFF) - 1);
- TypeName typeName = GetTypeName(TypeRef.records[index].TypeNameSpace, TypeRef.records[index].TypeName);
- typeRefs[index] = assembly.ResolveType(typeName);
- break;
- }
- case TypeRefTable.Index:
- {
- Type outer = ResolveType(scope, null);
- TypeName typeName = GetTypeName(TypeRef.records[index].TypeNameSpace, TypeRef.records[index].TypeName);
- typeRefs[index] = outer.ResolveNestedType(typeName);
- break;
- }
- case ModuleTable.Index:
- case ModuleRefTable.Index:
- {
- Module module;
- if (scope >> 24 == ModuleTable.Index)
- {
- if (scope == 0 || scope == 1)
- {
- module = this;
- }
- else
- {
- throw new NotImplementedException("self reference scope?");
- }
- }
- else
- {
- module = ResolveModuleRef(ModuleRef.records[(scope & 0xFFFFFF) - 1]);
- }
- TypeName typeName = GetTypeName(TypeRef.records[index].TypeNameSpace, TypeRef.records[index].TypeName);
- typeRefs[index] = module.FindType(typeName) ?? module.universe.GetMissingTypeOrThrow(module, null, typeName);
- break;
- }
- default:
- throw new NotImplementedException("ResolutionScope = " + scope.ToString("X"));
- }
- }
- return typeRefs[index];
- }
- else if ((metadataToken >> 24) == TypeSpecTable.Index && index < TypeSpec.RowCount)
- {
- if (typeSpecs == null)
- {
- typeSpecs = new Type[TypeSpec.records.Length];
- }
- Type type = typeSpecs[index];
- if (type == null)
- {
- TrackingGenericContext tc = context == null ? null : new TrackingGenericContext(context);
- type = Signature.ReadTypeSpec(this, ByteReader.FromBlob(blobHeap, TypeSpec.records[index]), tc);
- if (tc == null || !tc.IsUsed)
- {
- typeSpecs[index] = type;
- }
- }
- return type;
- }
- else
- {
- throw TokenOutOfRangeException(metadataToken);
- }
- }
-
- private Module ResolveModuleRef(int moduleNameIndex)
- {
- string moduleName = GetString(moduleNameIndex);
- Module module = assembly.GetModule(moduleName);
- if (module == null)
- {
- throw new FileNotFoundException(moduleName);
- }
- return module;
- }
-
- private sealed class TrackingGenericContext : IGenericContext
- {
- private readonly IGenericContext context;
- private bool used;
-
- internal TrackingGenericContext(IGenericContext context)
- {
- this.context = context;
- }
-
- internal bool IsUsed
- {
- get { return used; }
- }
-
- public Type GetGenericTypeArgument(int index)
- {
- used = true;
- return context.GetGenericTypeArgument(index);
- }
-
- public Type GetGenericMethodArgument(int index)
- {
- used = true;
- return context.GetGenericMethodArgument(index);
- }
- }
-
- private TypeName GetTypeName(int typeNamespace, int typeName)
- {
- return new TypeName(GetString(typeNamespace), GetString(typeName));
- }
-
- internal Assembly ResolveAssemblyRef(int index)
- {
- if (assemblyRefs == null)
- {
- assemblyRefs = new Assembly[AssemblyRef.RowCount];
- }
- if (assemblyRefs[index] == null)
- {
- assemblyRefs[index] = ResolveAssemblyRefImpl(ref AssemblyRef.records[index]);
- }
- return assemblyRefs[index];
- }
-
- private Assembly ResolveAssemblyRefImpl(ref AssemblyRefTable.Record rec)
- {
- const int PublicKey = 0x0001;
- string name = String.Format("{0}, Version={1}.{2}.{3}.{4}, Culture={5}, {6}={7}",
- GetString(rec.Name),
- rec.MajorVersion,
- rec.MinorVersion,
- rec.BuildNumber,
- rec.RevisionNumber,
- rec.Culture == 0 ? "neutral" : GetString(rec.Culture),
- (rec.Flags & PublicKey) == 0 ? "PublicKeyToken" : "PublicKey",
- PublicKeyOrTokenToString(rec.PublicKeyOrToken));
- return universe.Load(name, this.Assembly, true);
- }
-
- private string PublicKeyOrTokenToString(int publicKeyOrToken)
- {
- if (publicKeyOrToken == 0)
- {
- return "null";
- }
- ByteReader br = GetBlob(publicKeyOrToken);
- if (br.Length == 0)
- {
- return "null";
- }
- StringBuilder sb = new StringBuilder(br.Length * 2);
- while (br.Length > 0)
- {
- sb.AppendFormat("{0:x2}", br.ReadByte());
- }
- return sb.ToString();
- }
-
- public override Guid ModuleVersionId
- {
- get
- {
- byte[] buf = new byte[16];
- Buffer.BlockCopy(guidHeap, 16 * (ModuleTable.records[0].Mvid - 1), buf, 0, 16);
- return new Guid(buf);
- }
- }
-
- public override string FullyQualifiedName
- {
- get { return location ?? "<Unknown>"; }
- }
-
- public override string Name
- {
- get { return location == null ? "<Unknown>" : System.IO.Path.GetFileName(location); }
- }
-
- public override Assembly Assembly
- {
- get { return assembly; }
- }
-
- internal override Type FindType(TypeName typeName)
- {
- PopulateTypeDef();
- Type type;
- if (!types.TryGetValue(typeName, out type))
- {
- LazyForwardedType fw;
- if (forwardedTypes.TryGetValue(typeName, out fw))
- {
- return fw.GetType(this, typeName);
- }
- }
- return type;
- }
-
- internal override Type FindTypeIgnoreCase(TypeName lowerCaseName)
- {
- PopulateTypeDef();
- foreach (Type type in types.Values)
- {
- if (new TypeName(type.__Namespace, type.__Name).ToLowerInvariant() == lowerCaseName)
- {
- return type;
- }
- }
- foreach (TypeName name in forwardedTypes.Keys)
- {
- if (name.ToLowerInvariant() == lowerCaseName)
- {
- return forwardedTypes[name].GetType(this, name);
- }
- }
- return null;
- }
-
- private Exception TokenOutOfRangeException(int metadataToken)
- {
- return new ArgumentOutOfRangeException("metadataToken", String.Format("Token 0x{0:x8} is not valid in the scope of module {1}.", metadataToken, this.Name));
- }
-
- public override MemberInfo ResolveMember(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
- {
- switch (metadataToken >> 24)
- {
- case FieldTable.Index:
- return ResolveField(metadataToken, genericTypeArguments, genericMethodArguments);
- case MemberRefTable.Index:
- int index = (metadataToken & 0xFFFFFF) - 1;
- if (index < 0 || index >= MemberRef.RowCount)
- {
- goto default;
- }
- return GetMemberRef(index, genericTypeArguments, genericMethodArguments);
- case MethodDefTable.Index:
- case MethodSpecTable.Index:
- return ResolveMethod(metadataToken, genericTypeArguments, genericMethodArguments);
- default:
- throw TokenOutOfRangeException(metadataToken);
- }
- }
-
- internal FieldInfo GetFieldAt(TypeDefImpl owner, int index)
- {
- if (fields == null)
- {
- fields = new FieldInfo[Field.records.Length];
- }
- if (fields[index] == null)
- {
- fields[index] = new FieldDefImpl(this, owner ?? FindFieldOwner(index), index);
- }
- return fields[index];
- }
-
- public override FieldInfo ResolveField(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
- {
- int index = (metadataToken & 0xFFFFFF) - 1;
- if (index < 0)
- {
- throw TokenOutOfRangeException(metadataToken);
- }
- else if ((metadataToken >> 24) == FieldTable.Index && index < Field.RowCount)
- {
- return GetFieldAt(null, index);
- }
- else if ((metadataToken >> 24) == MemberRefTable.Index && index < MemberRef.RowCount)
- {
- FieldInfo field = GetMemberRef(index, genericTypeArguments, genericMethodArguments) as FieldInfo;
- if (field != null)
- {
- return field;
- }
- throw new ArgumentException(String.Format("Token 0x{0:x8} is not a valid FieldInfo token in the scope of module {1}.", metadataToken, this.Name), "metadataToken");
- }
- else
- {
- throw TokenOutOfRangeException(metadataToken);
- }
- }
-
- private TypeDefImpl FindFieldOwner(int fieldIndex)
- {
- // TODO use binary search?
- for (int i = 0; i < TypeDef.records.Length; i++)
- {
- int field = TypeDef.records[i].FieldList - 1;
- int end = TypeDef.records.Length > i + 1 ? TypeDef.records[i + 1].FieldList - 1 : Field.records.Length;
- if (field <= fieldIndex && fieldIndex < end)
- {
- PopulateTypeDef();
- return typeDefs[i];
- }
- }
- throw new InvalidOperationException();
- }
-
- internal MethodBase GetMethodAt(TypeDefImpl owner, int index)
- {
- if (methods == null)
- {
- methods = new MethodBase[MethodDef.records.Length];
- }
- if (methods[index] == null)
- {
- MethodDefImpl method = new MethodDefImpl(this, owner ?? FindMethodOwner(index), index);
- methods[index] = method.IsConstructor ? new ConstructorInfoImpl(method) : (MethodBase)method;
- }
- return methods[index];
- }
-
- public override MethodBase ResolveMethod(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
- {
- int index = (metadataToken & 0xFFFFFF) - 1;
- if (index < 0)
- {
- throw TokenOutOfRangeException(metadataToken);
- }
- else if ((metadataToken >> 24) == MethodDefTable.Index && index < MethodDef.RowCount)
- {
- return GetMethodAt(null, index);
- }
- else if ((metadataToken >> 24) == MemberRefTable.Index && index < MemberRef.RowCount)
- {
- MethodBase method = GetMemberRef(index, genericTypeArguments, genericMethodArguments) as MethodBase;
- if (method != null)
- {
- return method;
- }
- throw new ArgumentException(String.Format("Token 0x{0:x8} is not a valid MethodBase token in the scope of module {1}.", metadataToken, this.Name), "metadataToken");
- }
- else if ((metadataToken >> 24) == MethodSpecTable.Index && index < MethodSpec.RowCount)
- {
- MethodInfo method = (MethodInfo)ResolveMethod(MethodSpec.records[index].Method, genericTypeArguments, genericMethodArguments);
- ByteReader instantiation = ByteReader.FromBlob(blobHeap, MethodSpec.records[index].Instantiation);
- return method.MakeGenericMethod(Signature.ReadMethodSpec(this, instantiation, new GenericContext(genericTypeArguments, genericMethodArguments)));
- }
- else
- {
- throw TokenOutOfRangeException(metadataToken);
- }
- }
-
- public override Type[] __ResolveOptionalParameterTypes(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments, out CustomModifiers[] customModifiers)
- {
- int index = (metadataToken & 0xFFFFFF) - 1;
- if (index < 0)
- {
- throw TokenOutOfRangeException(metadataToken);
- }
- else if ((metadataToken >> 24) == MemberRefTable.Index && index < MemberRef.RowCount)
- {
- int sig = MemberRef.records[index].Signature;
- return Signature.ReadOptionalParameterTypes(this, GetBlob(sig), new GenericContext(genericTypeArguments, genericMethodArguments), out customModifiers);
- }
- else if ((metadataToken >> 24) == MethodDefTable.Index && index < MethodDef.RowCount)
- {
- // for convenience, we support passing a MethodDef token as well, because in some places
- // it makes sense to have a vararg method that is referred to by its methoddef (e.g. ldftn).
- // Note that MethodSpec doesn't make sense, because generic methods cannot be vararg.
- customModifiers = Empty<CustomModifiers>.Array;
- return Type.EmptyTypes;
- }
- else
- {
- throw TokenOutOfRangeException(metadataToken);
- }
- }
-
- public override string ScopeName
- {
- get { return GetString(ModuleTable.records[0].Name); }
- }
-
- private TypeDefImpl FindMethodOwner(int methodIndex)
- {
- // TODO use binary search?
- for (int i = 0; i < TypeDef.records.Length; i++)
- {
- int method = TypeDef.records[i].MethodList - 1;
- int end = TypeDef.records.Length > i + 1 ? TypeDef.records[i + 1].MethodList - 1 : MethodDef.records.Length;
- if (method <= methodIndex && methodIndex < end)
- {
- PopulateTypeDef();
- return typeDefs[i];
- }
- }
- throw new InvalidOperationException();
- }
-
- private MemberInfo GetMemberRef(int index, Type[] genericTypeArguments, Type[] genericMethodArguments)
- {
- if (memberRefs == null)
- {
- memberRefs = new MemberInfo[MemberRef.records.Length];
- }
- if (memberRefs[index] == null)
- {
- int owner = MemberRef.records[index].Class;
- int sig = MemberRef.records[index].Signature;
- string name = GetString(MemberRef.records[index].Name);
- switch (owner >> 24)
- {
- case MethodDefTable.Index:
- return GetMethodAt(null, (owner & 0xFFFFFF) - 1);
- case ModuleRefTable.Index:
- memberRefs[index] = ResolveTypeMemberRef(ResolveModuleType(owner), name, ByteReader.FromBlob(blobHeap, sig));
- break;
- case TypeDefTable.Index:
- case TypeRefTable.Index:
- memberRefs[index] = ResolveTypeMemberRef(ResolveType(owner), name, ByteReader.FromBlob(blobHeap, sig));
- break;
- case TypeSpecTable.Index:
- {
- Type type = ResolveType(owner, genericTypeArguments, genericMethodArguments);
- if (type.IsArray)
- {
- MethodSignature methodSig = MethodSignature.ReadSig(this, ByteReader.FromBlob(blobHeap, sig), new GenericContext(genericTypeArguments, genericMethodArguments));
- return type.FindMethod(name, methodSig)
- ?? universe.GetMissingMethodOrThrow(type, name, methodSig);
- }
- else if (type.IsConstructedGenericType)
- {
- MemberInfo member = ResolveTypeMemberRef(type.GetGenericTypeDefinition(), name, ByteReader.FromBlob(blobHeap, sig));
- MethodBase mb = member as MethodBase;
- if (mb != null)
- {
- member = mb.BindTypeParameters(type);
- }
- FieldInfo fi = member as FieldInfo;
- if (fi != null)
- {
- member = fi.BindTypeParameters(type);
- }
- return member;
- }
- else
- {
- return ResolveTypeMemberRef(type, name, ByteReader.FromBlob(blobHeap, sig));
- }
- }
- default:
- throw new BadImageFormatException();
- }
- }
- return memberRefs[index];
- }
-
- private Type ResolveModuleType(int token)
- {
- int index = (token & 0xFFFFFF) - 1;
- string name = GetString(ModuleRef.records[index]);
- Module module = assembly.GetModule(name);
- if (module == null || module.IsResource())
- {
- throw new BadImageFormatException();
- }
- return module.GetModuleType();
- }
-
- private MemberInfo ResolveTypeMemberRef(Type type, string name, ByteReader sig)
- {
- if (sig.PeekByte() == Signature.FIELD)
- {
- Type org = type;
- FieldSignature fieldSig = FieldSignature.ReadSig(this, sig, type);
- FieldInfo field = type.FindField(name, fieldSig);
- if (field == null && universe.MissingMemberResolution)
- {
- return universe.GetMissingFieldOrThrow(type, name, fieldSig);
- }
- while (field == null && (type = type.BaseType) != null)
- {
- field = type.FindField(name, fieldSig);
- }
- if (field != null)
- {
- return field;
- }
- throw new MissingFieldException(org.ToString(), name);
- }
- else
- {
- Type org = type;
- MethodSignature methodSig = MethodSignature.ReadSig(this, sig, type);
- MethodBase method = type.FindMethod(name, methodSig);
- if (method == null && universe.MissingMemberResolution)
- {
- return universe.GetMissingMethodOrThrow(type, name, methodSig);
- }
- while (method == null && (type = type.BaseType) != null)
- {
- method = type.FindMethod(name, methodSig);
- }
- if (method != null)
- {
- return method;
- }
- throw new MissingMethodException(org.ToString(), name);
- }
- }
-
- internal ByteReader GetStandAloneSig(int index)
- {
- return ByteReader.FromBlob(blobHeap, StandAloneSig.records[index]);
- }
-
- public override byte[] ResolveSignature(int metadataToken)
- {
- int index = (metadataToken & 0xFFFFFF) - 1;
- if ((metadataToken >> 24) == StandAloneSigTable.Index && index >= 0 && index < StandAloneSig.RowCount)
- {
- ByteReader br = GetStandAloneSig(index);
- return br.ReadBytes(br.Length);
- }
- else
- {
- throw TokenOutOfRangeException(metadataToken);
- }
- }
-
- public override __StandAloneMethodSig __ResolveStandAloneMethodSig(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
- {
- int index = (metadataToken & 0xFFFFFF) - 1;
- if ((metadataToken >> 24) == StandAloneSigTable.Index && index >= 0 && index < StandAloneSig.RowCount)
- {
- return MethodSignature.ReadStandAloneMethodSig(this, GetStandAloneSig(index), new GenericContext(genericTypeArguments, genericMethodArguments));
- }
- else
- {
- throw TokenOutOfRangeException(metadataToken);
- }
- }
-
- internal MethodInfo GetEntryPoint()
- {
- if (cliHeader.EntryPointToken != 0 && (cliHeader.Flags & CliHeader.COMIMAGE_FLAGS_NATIVE_ENTRYPOINT) == 0)
- {
- return (MethodInfo)ResolveMethod((int)cliHeader.EntryPointToken);
- }
- return null;
- }
-
- internal string[] GetManifestResourceNames()
- {
- string[] names = new string[ManifestResource.records.Length];
- for (int i = 0; i < ManifestResource.records.Length; i++)
- {
- names[i] = GetString(ManifestResource.records[i].Name);
- }
- return names;
- }
-
- internal ManifestResourceInfo GetManifestResourceInfo(string resourceName)
- {
- for (int i = 0; i < ManifestResource.records.Length; i++)
- {
- if (resourceName == GetString(ManifestResource.records[i].Name))
- {
- ManifestResourceInfo info = new ManifestResourceInfo(this, i);
- Assembly asm = info.ReferencedAssembly;
- if (asm != null && !asm.__IsMissing && asm.GetManifestResourceInfo(resourceName) == null)
- {
- return null;
- }
- return info;
- }
- }
- return null;
- }
-
- internal Stream GetManifestResourceStream(string resourceName)
- {
- for (int i = 0; i < ManifestResource.records.Length; i++)
- {
- if (resourceName == GetString(ManifestResource.records[i].Name))
- {
- if (ManifestResource.records[i].Implementation != 0x26000000)
- {
- ManifestResourceInfo info = new ManifestResourceInfo(this, i);
- switch (ManifestResource.records[i].Implementation >> 24)
- {
- case FileTable.Index:
- string fileName = Path.Combine(Path.GetDirectoryName(location), info.FileName);
- if (System.IO.File.Exists(fileName))
- {
- // note that, like System.Reflection, we return null for zero length files and
- // ManifestResource.Offset is ignored
- FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete);
- if (fs.Length == 0)
- {
- fs.Close();
- return null;
- }
- return fs;
- }
- return null;
- case AssemblyRefTable.Index:
- Assembly asm = info.ReferencedAssembly;
- if (asm.__IsMissing)
- {
- return null;
- }
- return asm.GetManifestResourceStream(resourceName);
- default:
- throw new BadImageFormatException();
- }
- }
- SeekRVA((int)cliHeader.Resources.VirtualAddress + ManifestResource.records[i].Offset);
- BinaryReader br = new BinaryReader(stream);
- int length = br.ReadInt32();
- return new MemoryStream(br.ReadBytes(length));
- }
- }
- return null;
- }
-
- public override AssemblyName[] __GetReferencedAssemblies()
- {
- List<AssemblyName> list = new List<AssemblyName>();
- for (int i = 0; i < AssemblyRef.records.Length; i++)
- {
- AssemblyName name = new AssemblyName();
- name.Name = GetString(AssemblyRef.records[i].Name);
- name.Version = new Version(
- AssemblyRef.records[i].MajorVersion,
- AssemblyRef.records[i].MinorVersion,
- AssemblyRef.records[i].BuildNumber,
- AssemblyRef.records[i].RevisionNumber);
- if (AssemblyRef.records[i].PublicKeyOrToken != 0)
- {
- byte[] keyOrToken = GetBlobCopy(AssemblyRef.records[i].PublicKeyOrToken);
- const int PublicKey = 0x0001;
- if ((AssemblyRef.records[i].Flags & PublicKey) != 0)
- {
- name.SetPublicKey(keyOrToken);
- }
- else
- {
- name.SetPublicKeyToken(keyOrToken);
- }
- }
- else
- {
- name.SetPublicKeyToken(Empty<byte>.Array);
- }
- if (AssemblyRef.records[i].Culture != 0)
- {
- name.Culture = GetString(AssemblyRef.records[i].Culture);
- }
- else
- {
- name.Culture = "";
- }
- if (AssemblyRef.records[i].HashValue != 0)
- {
- name.hash = GetBlobCopy(AssemblyRef.records[i].HashValue);
- }
- name.Flags = (AssemblyNameFlags)AssemblyRef.records[i].Flags;
- list.Add(name);
- }
- return list.ToArray();
- }
-
- public override void __ResolveReferencedAssemblies(Assembly[] assemblies)
- {
- if (assemblyRefs == null)
- {
- assemblyRefs = new Assembly[AssemblyRef.RowCount];
- }
- for (int i = 0; i < assemblies.Length; i++)
- {
- if (assemblyRefs[i] == null)
- {
- assemblyRefs[i] = assemblies[i];
- }
- }
- }
-
- public override string[] __GetReferencedModules()
- {
- string[] arr = new string[this.ModuleRef.RowCount];
- for (int i = 0; i < arr.Length; i++)
- {
- arr[i] = GetString(this.ModuleRef.records[i]);
- }
- return arr;
- }
-
- public override Type[] __GetReferencedTypes()
- {
- Type[] arr = new Type[this.TypeRef.RowCount];
- for (int i = 0; i < arr.Length; i++)
- {
- arr[i] = ResolveType((TypeRefTable.Index << 24) + i + 1);
- }
- return arr;
- }
-
- public override Type[] __GetExportedTypes()
- {
- Type[] arr = new Type[this.ExportedType.RowCount];
- for (int i = 0; i < arr.Length; i++)
- {
- arr[i] = ResolveExportedType(i);
- }
- return arr;
- }
-
- private Type ResolveExportedType(int index)
- {
- TypeName typeName = GetTypeName(ExportedType.records[index].TypeNamespace, ExportedType.records[index].TypeName);
- int implementation = ExportedType.records[index].Implementation;
- int token = ExportedType.records[index].TypeDefId;
- switch (implementation >> 24)
- {
- case AssemblyRefTable.Index:
- return ResolveAssemblyRef((implementation & 0xFFFFFF) - 1).ResolveType(typeName).SetMetadataTokenForMissing(token);
- case ExportedTypeTable.Index:
- return ResolveExportedType((implementation & 0xFFFFFF) - 1).ResolveNestedType(typeName).SetMetadataTokenForMissing(token);
- default:
- throw new NotImplementedException();
- }
- }
-
- internal override Type GetModuleType()
- {
- PopulateTypeDef();
- return moduleType;
- }
-
- public override string __ImageRuntimeVersion
- {
- get { return imageRuntimeVersion; }
- }
-
- public override int MDStreamVersion
- {
- get { return metadataStreamVersion; }
- }
-
- public override void __GetDataDirectoryEntry(int index, out int rva, out int length)
- {
- peFile.GetDataDirectoryEntry(index, out rva, out length);
- }
-
- public override long __RelativeVirtualAddressToFileOffset(int rva)
- {
- return peFile.RvaToFileOffset((uint)rva);
- }
-
- public override bool __GetSectionInfo(int rva, out string name, out int characteristics)
- {
- return peFile.GetSectionInfo(rva, out name, out characteristics);
- }
-
- public override int __ReadDataFromRVA(int rva, byte[] data, int offset, int length)
- {
- SeekRVA(rva);
- int totalBytesRead = 0;
- while (length > 0)
- {
- int read = stream.Read(data, offset, length);
- if (read == 0)
- {
- // C++ assemblies can have fields that have an RVA that lies outside of the file
- break;
- }
- offset += read;
- length -= read;
- totalBytesRead += read;
- }
- return totalBytesRead;
- }
-
- public override void GetPEKind(out PortableExecutableKinds peKind, out ImageFileMachine machine)
- {
- peKind = 0;
- if ((cliHeader.Flags & CliHeader.COMIMAGE_FLAGS_ILONLY) != 0)
- {
- peKind |= PortableExecutableKinds.ILOnly;
- }
- switch (cliHeader.Flags & (CliHeader.COMIMAGE_FLAGS_32BITREQUIRED | CliHeader.COMIMAGE_FLAGS_32BITPREFERRED))
- {
- case CliHeader.COMIMAGE_FLAGS_32BITREQUIRED:
- peKind |= PortableExecutableKinds.Required32Bit;
- break;
- case CliHeader.COMIMAGE_FLAGS_32BITREQUIRED | CliHeader.COMIMAGE_FLAGS_32BITPREFERRED:
- peKind |= PortableExecutableKinds.Preferred32Bit;
- break;
- default:
- // COMIMAGE_FLAGS_32BITPREFERRED by itself is illegal, so we ignore it
- // (not setting any flag is ok)
- break;
- }
- if (peFile.OptionalHeader.Magic == IMAGE_OPTIONAL_HEADER.IMAGE_NT_OPTIONAL_HDR64_MAGIC)
- {
- peKind |= PortableExecutableKinds.PE32Plus;
- }
-
- machine = (ImageFileMachine)peFile.FileHeader.Machine;
- }
-
- public override int __Subsystem
- {
- get { return peFile.OptionalHeader.Subsystem; }
- }
-
- public override IList<CustomAttributeData> __GetPlaceholderAssemblyCustomAttributes(bool multiple, bool security)
- {
- TypeName typeName;
- switch ((multiple ? 1 : 0) + (security ? 2 : 0))
- {
- case 0:
- typeName = new TypeName("System.Runtime.CompilerServices", "AssemblyAttributesGoHere");
- break;
- case 1:
- typeName = new TypeName("System.Runtime.CompilerServices", "AssemblyAttributesGoHereM");
- break;
- case 2:
- typeName = new TypeName("System.Runtime.CompilerServices", "AssemblyAttributesGoHereS");
- break;
- case 3:
- default:
- typeName = new TypeName("System.Runtime.CompilerServices", "AssemblyAttributesGoHereSM");
- break;
- }
- List<CustomAttributeData> list = new List<CustomAttributeData>();
- for (int i = 0; i < CustomAttribute.records.Length; i++)
- {
- if ((CustomAttribute.records[i].Parent >> 24) == TypeRefTable.Index)
- {
- int index = (CustomAttribute.records[i].Parent & 0xFFFFFF) - 1;
- if (typeName == GetTypeName(TypeRef.records[index].TypeNameSpace, TypeRef.records[index].TypeName))
- {
- list.Add(new CustomAttributeData(this, i));
- }
- }
- }
- return list;
- }
-
- internal override void Dispose()
- {
- stream.Close();
- }
-
- internal override void ExportTypes(int fileToken, IKVM.Reflection.Emit.ModuleBuilder manifestModule)
- {
- PopulateTypeDef();
- manifestModule.ExportTypes(typeDefs, fileToken);
- }
-
- protected override long GetImageBaseImpl()
- {
- return (long)peFile.OptionalHeader.ImageBase;
- }
-
- protected override long GetStackReserveImpl()
- {
- return (long)peFile.OptionalHeader.SizeOfStackReserve;
- }
-
- protected override int GetFileAlignmentImpl()
- {
- return (int)peFile.OptionalHeader.FileAlignment;
- }
-
- protected override DllCharacteristics GetDllCharacteristicsImpl()
- {
- return (DllCharacteristics)peFile.OptionalHeader.DllCharacteristics;
- }
-
- public override int __EntryPointRVA
- {
- get { return (cliHeader.Flags & CliHeader.COMIMAGE_FLAGS_NATIVE_ENTRYPOINT) != 0 ? (int)cliHeader.EntryPointToken : 0; }
- }
-
- public override int __EntryPointToken
- {
- get { return (cliHeader.Flags & CliHeader.COMIMAGE_FLAGS_NATIVE_ENTRYPOINT) == 0 ? (int)cliHeader.EntryPointToken : 0; }
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using BYTE = System.Byte;
-using WORD = System.UInt16;
-using DWORD = System.UInt32;
-using ULONGLONG = System.UInt64;
-using System.IO;
-
-namespace IKVM.Reflection.Reader
-{
- sealed class MSDOS_HEADER
- {
- internal const WORD MAGIC_MZ = 0x5A4D;
-
- internal WORD signature; // 'MZ'
- // skip 58 bytes
- internal DWORD peSignatureOffset;
- }
-
- sealed class IMAGE_NT_HEADERS
- {
- public const DWORD MAGIC_SIGNATURE = 0x00004550; // "PE\0\0"
-
- public DWORD Signature;
- public IMAGE_FILE_HEADER FileHeader = new IMAGE_FILE_HEADER();
- public IMAGE_OPTIONAL_HEADER OptionalHeader = new IMAGE_OPTIONAL_HEADER();
-
- internal void Read(BinaryReader br)
- {
- Signature = br.ReadUInt32();
- if (Signature != IMAGE_NT_HEADERS.MAGIC_SIGNATURE)
- {
- throw new BadImageFormatException();
- }
- FileHeader.Read(br);
- OptionalHeader.Read(br);
- }
- }
-
- sealed class IMAGE_FILE_HEADER
- {
- public const WORD IMAGE_FILE_MACHINE_I386 = 0x014c;
- public const WORD IMAGE_FILE_MACHINE_IA64 = 0x0200;
- public const WORD IMAGE_FILE_MACHINE_AMD64 = 0x8664;
-
- public const WORD IMAGE_FILE_32BIT_MACHINE = 0x0100;
- public const WORD IMAGE_FILE_EXECUTABLE_IMAGE = 0x0002;
- public const WORD IMAGE_FILE_LARGE_ADDRESS_AWARE = 0x0020;
- public const WORD IMAGE_FILE_DLL = 0x2000;
-
- public WORD Machine;
- public WORD NumberOfSections;
- public DWORD TimeDateStamp;
- public DWORD PointerToSymbolTable;
- public DWORD NumberOfSymbols;
- public WORD SizeOfOptionalHeader;
- public WORD Characteristics;
-
- internal void Read(BinaryReader br)
- {
- Machine = br.ReadUInt16();
- NumberOfSections = br.ReadUInt16();
- TimeDateStamp = br.ReadUInt32();
- PointerToSymbolTable = br.ReadUInt32();
- NumberOfSymbols = br.ReadUInt32();
- SizeOfOptionalHeader = br.ReadUInt16();
- Characteristics = br.ReadUInt16();
- }
- }
-
- sealed class IMAGE_OPTIONAL_HEADER
- {
- public const WORD IMAGE_NT_OPTIONAL_HDR32_MAGIC = 0x10b;
- public const WORD IMAGE_NT_OPTIONAL_HDR64_MAGIC = 0x20b;
-
- public const WORD IMAGE_SUBSYSTEM_WINDOWS_GUI = 2;
- public const WORD IMAGE_SUBSYSTEM_WINDOWS_CUI = 3;
-
- public WORD Magic;
- public BYTE MajorLinkerVersion;
- public BYTE MinorLinkerVersion;
- public DWORD SizeOfCode;
- public DWORD SizeOfInitializedData;
- public DWORD SizeOfUninitializedData;
- public DWORD AddressOfEntryPoint;
- public DWORD BaseOfCode;
- public DWORD BaseOfData;
- public ULONGLONG ImageBase;
- public DWORD SectionAlignment;
- public DWORD FileAlignment;
- public WORD MajorOperatingSystemVersion;
- public WORD MinorOperatingSystemVersion;
- public WORD MajorImageVersion;
- public WORD MinorImageVersion;
- public WORD MajorSubsystemVersion;
- public WORD MinorSubsystemVersion;
- public DWORD Win32VersionValue;
- public DWORD SizeOfImage;
- public DWORD SizeOfHeaders;
- public DWORD CheckSum;
- public WORD Subsystem;
- public WORD DllCharacteristics;
- public ULONGLONG SizeOfStackReserve;
- public ULONGLONG SizeOfStackCommit;
- public ULONGLONG SizeOfHeapReserve;
- public ULONGLONG SizeOfHeapCommit;
- public DWORD LoaderFlags;
- public DWORD NumberOfRvaAndSizes;
- public IMAGE_DATA_DIRECTORY[] DataDirectory;
-
- internal void Read(BinaryReader br)
- {
- Magic = br.ReadUInt16();
- if (Magic != IMAGE_NT_OPTIONAL_HDR32_MAGIC && Magic != IMAGE_NT_OPTIONAL_HDR64_MAGIC)
- {
- throw new BadImageFormatException();
- }
- MajorLinkerVersion = br.ReadByte();
- MinorLinkerVersion = br.ReadByte();
- SizeOfCode = br.ReadUInt32();
- SizeOfInitializedData = br.ReadUInt32();
- SizeOfUninitializedData = br.ReadUInt32();
- AddressOfEntryPoint = br.ReadUInt32();
- BaseOfCode = br.ReadUInt32();
- if (Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC)
- {
- BaseOfData = br.ReadUInt32();
- ImageBase = br.ReadUInt32();
- }
- else
- {
- ImageBase = br.ReadUInt64();
- }
- SectionAlignment = br.ReadUInt32();
- FileAlignment = br.ReadUInt32();
- MajorOperatingSystemVersion = br.ReadUInt16();
- MinorOperatingSystemVersion = br.ReadUInt16();
- MajorImageVersion = br.ReadUInt16();
- MinorImageVersion = br.ReadUInt16();
- MajorSubsystemVersion = br.ReadUInt16();
- MinorSubsystemVersion = br.ReadUInt16();
- Win32VersionValue = br.ReadUInt32();
- SizeOfImage = br.ReadUInt32();
- SizeOfHeaders = br.ReadUInt32();
- CheckSum = br.ReadUInt32();
- Subsystem = br.ReadUInt16();
- DllCharacteristics = br.ReadUInt16();
- if (Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC)
- {
- SizeOfStackReserve = br.ReadUInt32();
- SizeOfStackCommit = br.ReadUInt32();
- SizeOfHeapReserve = br.ReadUInt32();
- SizeOfHeapCommit = br.ReadUInt32();
- }
- else
- {
- SizeOfStackReserve = br.ReadUInt64();
- SizeOfStackCommit = br.ReadUInt64();
- SizeOfHeapReserve = br.ReadUInt64();
- SizeOfHeapCommit = br.ReadUInt64();
- }
- LoaderFlags = br.ReadUInt32();
- NumberOfRvaAndSizes = br.ReadUInt32();
- DataDirectory = new IMAGE_DATA_DIRECTORY[NumberOfRvaAndSizes];
- for (uint i = 0; i < NumberOfRvaAndSizes; i++)
- {
- DataDirectory[i] = new IMAGE_DATA_DIRECTORY();
- DataDirectory[i].Read(br);
- }
- }
- }
-
- struct IMAGE_DATA_DIRECTORY
- {
- public DWORD VirtualAddress;
- public DWORD Size;
-
- internal void Read(BinaryReader br)
- {
- VirtualAddress = br.ReadUInt32();
- Size = br.ReadUInt32();
- }
-
- internal void Write(IKVM.Reflection.Writer.MetadataWriter mw)
- {
- mw.Write(VirtualAddress);
- mw.Write(Size);
- }
- }
-
- class SectionHeader
- {
- public const DWORD IMAGE_SCN_CNT_CODE = 0x00000020;
- public const DWORD IMAGE_SCN_CNT_INITIALIZED_DATA = 0x00000040;
- public const DWORD IMAGE_SCN_MEM_DISCARDABLE = 0x02000000;
- public const DWORD IMAGE_SCN_MEM_EXECUTE = 0x20000000;
- public const DWORD IMAGE_SCN_MEM_READ = 0x40000000;
- public const DWORD IMAGE_SCN_MEM_WRITE = 0x80000000;
-
- public string Name; // 8 byte UTF8 encoded 0-padded
- public DWORD VirtualSize;
- public DWORD VirtualAddress;
- public DWORD SizeOfRawData;
- public DWORD PointerToRawData;
- public DWORD PointerToRelocations;
- public DWORD PointerToLinenumbers;
- public WORD NumberOfRelocations;
- public WORD NumberOfLinenumbers;
- public DWORD Characteristics;
-
- internal void Read(BinaryReader br)
- {
- char[] name = new char[8];
- int len = 8;
- for (int i = 0; i < 8; i++)
- {
- byte b = br.ReadByte();
- name[i] = (char)b;
- if (b == 0 && len == 8)
- {
- len = i;
- }
- }
- Name = new String(name, 0, len);
- VirtualSize = br.ReadUInt32();
- VirtualAddress = br.ReadUInt32();
- SizeOfRawData = br.ReadUInt32();
- PointerToRawData = br.ReadUInt32();
- PointerToRelocations = br.ReadUInt32();
- PointerToLinenumbers = br.ReadUInt32();
- NumberOfRelocations = br.ReadUInt16();
- NumberOfLinenumbers = br.ReadUInt16();
- Characteristics = br.ReadUInt32();
- }
- }
-
- sealed class PEReader
- {
- private MSDOS_HEADER msdos = new MSDOS_HEADER();
- private IMAGE_NT_HEADERS headers = new IMAGE_NT_HEADERS();
- private SectionHeader[] sections;
-
- internal void Read(BinaryReader br)
- {
- msdos.signature = br.ReadUInt16();
- br.BaseStream.Seek(58, SeekOrigin.Current);
- msdos.peSignatureOffset = br.ReadUInt32();
-
- if (msdos.signature != MSDOS_HEADER.MAGIC_MZ)
- {
- throw new BadImageFormatException();
- }
-
- br.BaseStream.Seek(msdos.peSignatureOffset, SeekOrigin.Begin);
- headers.Read(br);
- sections = new SectionHeader[headers.FileHeader.NumberOfSections];
- for (int i = 0; i < sections.Length; i++)
- {
- sections[i] = new SectionHeader();
- sections[i].Read(br);
- }
- }
-
- internal IMAGE_FILE_HEADER FileHeader
- {
- get { return headers.FileHeader; }
- }
-
- internal IMAGE_OPTIONAL_HEADER OptionalHeader
- {
- get { return headers.OptionalHeader; }
- }
-
- internal DWORD GetComDescriptorVirtualAddress()
- {
- return headers.OptionalHeader.DataDirectory[14].VirtualAddress;
- }
-
- internal void GetDataDirectoryEntry(int index, out int rva, out int length)
- {
- rva = (int)headers.OptionalHeader.DataDirectory[index].VirtualAddress;
- length = (int)headers.OptionalHeader.DataDirectory[index].Size;
- }
-
- internal long RvaToFileOffset(DWORD rva)
- {
- for (int i = 0; i < sections.Length; i++)
- {
- if (rva >= sections[i].VirtualAddress && rva < sections[i].VirtualAddress + sections[i].VirtualSize)
- {
- return sections[i].PointerToRawData + rva - sections[i].VirtualAddress;
- }
- }
- throw new BadImageFormatException();
- }
-
- internal bool GetSectionInfo(int rva, out string name, out int characteristics)
- {
- for (int i = 0; i < sections.Length; i++)
- {
- if (rva >= sections[i].VirtualAddress && rva < sections[i].VirtualAddress + sections[i].VirtualSize)
- {
- name = sections[i].Name;
- characteristics = (int)sections[i].Characteristics;
- return true;
- }
- }
- name = null;
- characteristics = 0;
- return false;
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009-2012 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection.Reader
-{
- sealed class PropertyInfoImpl : PropertyInfo
- {
- private readonly ModuleReader module;
- private readonly Type declaringType;
- private readonly int index;
- private PropertySignature sig;
- private bool isPublic;
- private bool isNonPrivate;
- private bool isStatic;
- private bool flagsCached;
-
- internal PropertyInfoImpl(ModuleReader module, Type declaringType, int index)
- {
- this.module = module;
- this.declaringType = declaringType;
- this.index = index;
- }
-
- public override bool Equals(object obj)
- {
- PropertyInfoImpl other = obj as PropertyInfoImpl;
- return other != null && other.DeclaringType == declaringType && other.index == index;
- }
-
- public override int GetHashCode()
- {
- return declaringType.GetHashCode() * 77 + index;
- }
-
- internal override PropertySignature PropertySignature
- {
- get
- {
- if (sig == null)
- {
- sig = PropertySignature.ReadSig(module, module.GetBlob(module.Property.records[index].Type), declaringType);
- }
- return sig;
- }
- }
-
- public override PropertyAttributes Attributes
- {
- get { return (PropertyAttributes)module.Property.records[index].Flags; }
- }
-
- public override object GetRawConstantValue()
- {
- return module.Constant.GetRawConstantValue(module, this.MetadataToken);
- }
-
- public override bool CanRead
- {
- get { return GetGetMethod(true) != null; }
- }
-
- public override bool CanWrite
- {
- get { return GetSetMethod(true) != null; }
- }
-
- public override MethodInfo GetGetMethod(bool nonPublic)
- {
- return module.MethodSemantics.GetMethod(module, this.MetadataToken, nonPublic, MethodSemanticsTable.Getter);
- }
-
- public override MethodInfo GetSetMethod(bool nonPublic)
- {
- return module.MethodSemantics.GetMethod(module, this.MetadataToken, nonPublic, MethodSemanticsTable.Setter);
- }
-
- public override MethodInfo[] GetAccessors(bool nonPublic)
- {
- return module.MethodSemantics.GetMethods(module, this.MetadataToken, nonPublic, MethodSemanticsTable.Getter | MethodSemanticsTable.Setter | MethodSemanticsTable.Other);
- }
-
- public override Type DeclaringType
- {
- get { return declaringType; }
- }
-
- public override Module Module
- {
- get { return module; }
- }
-
- public override int MetadataToken
- {
- get { return (PropertyTable.Index << 24) + index + 1; }
- }
-
- public override string Name
- {
- get { return module.GetString(module.Property.records[index].Name); }
- }
-
- internal override bool IsPublic
- {
- get
- {
- if (!flagsCached)
- {
- ComputeFlags();
- }
- return isPublic;
- }
- }
-
- internal override bool IsNonPrivate
- {
- get
- {
- if (!flagsCached)
- {
- ComputeFlags();
- }
- return isNonPrivate;
- }
- }
-
- internal override bool IsStatic
- {
- get
- {
- if (!flagsCached)
- {
- ComputeFlags();
- }
- return isStatic;
- }
- }
-
- private void ComputeFlags()
- {
- module.MethodSemantics.ComputeFlags(module, this.MetadataToken, out isPublic, out isNonPrivate, out isStatic);
- flagsCached = true;
- }
-
- internal override bool IsBaked
- {
- get { return true; }
- }
-
- internal override int GetCurrentToken()
- {
- return this.MetadataToken;
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009-2011 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection.Reader
-{
- sealed class ResourceModule : NonPEModule
- {
- private readonly ModuleReader manifest;
- private readonly int index;
- private readonly string location;
-
- internal ResourceModule(ModuleReader manifest, int index, string location)
- : base(manifest.universe)
- {
- this.manifest = manifest;
- this.index = index;
- this.location = location;
- }
-
- public override int MDStreamVersion
- {
- get { throw new NotSupportedException(); }
- }
-
- public override bool IsResource()
- {
- return true;
- }
-
- public override Assembly Assembly
- {
- get { return manifest.Assembly; }
- }
-
- public override string FullyQualifiedName
- {
- get { return location ?? "<Unknown>"; }
- }
-
- public override string Name
- {
- get { return location == null ? "<Unknown>" : System.IO.Path.GetFileName(location); }
- }
-
- public override string ScopeName
- {
- get { return manifest.GetString(manifest.File.records[index].Name); }
- }
-
- public override Guid ModuleVersionId
- {
- get { throw new NotSupportedException(); }
- }
-
- public override byte[] __ModuleHash
- {
- get
- {
- int blob = manifest.File.records[index].HashValue;
- return blob == 0 ? Empty<byte>.Array : manifest.GetBlobCopy(blob);
- }
- }
-
- internal override Type FindType(TypeName typeName)
- {
- return null;
- }
-
- internal override Type FindTypeIgnoreCase(TypeName lowerCaseName)
- {
- return null;
- }
-
- internal override void GetTypesImpl(List<Type> list)
- {
- }
-
- protected override Exception ArgumentOutOfRangeException()
- {
- return new NotSupportedException();
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009-2011 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Runtime.InteropServices;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection.Reader
-{
- sealed class TypeDefImpl : TypeInfo
- {
- private readonly ModuleReader module;
- private readonly int index;
- private readonly string typeName;
- private readonly string typeNamespace;
- private Type[] typeArgs;
-
- internal TypeDefImpl(ModuleReader module, int index)
- {
- this.module = module;
- this.index = index;
- this.typeName = module.GetString(module.TypeDef.records[index].TypeName);
- this.typeNamespace = module.GetString(module.TypeDef.records[index].TypeNamespace);
- MarkEnumOrValueType(typeNamespace, typeName);
- }
-
- public override Type BaseType
- {
- get
- {
- int extends = module.TypeDef.records[index].Extends;
- if ((extends & 0xFFFFFF) == 0)
- {
- return null;
- }
- return module.ResolveType(extends, this);
- }
- }
-
- public override TypeAttributes Attributes
- {
- get { return (TypeAttributes)module.TypeDef.records[index].Flags; }
- }
-
- public override EventInfo[] __GetDeclaredEvents()
- {
- foreach (int i in module.EventMap.Filter(this.MetadataToken))
- {
- int evt = module.EventMap.records[i].EventList - 1;
- int end = module.EventMap.records.Length > i + 1 ? module.EventMap.records[i + 1].EventList - 1 : module.Event.records.Length;
- EventInfo[] events = new EventInfo[end - evt];
- if (module.EventPtr.RowCount == 0)
- {
- for (int j = 0; evt < end; evt++, j++)
- {
- events[j] = new EventInfoImpl(module, this, evt);
- }
- }
- else
- {
- for (int j = 0; evt < end; evt++, j++)
- {
- events[j] = new EventInfoImpl(module, this, module.EventPtr.records[evt] - 1);
- }
- }
- return events;
- }
- return Empty<EventInfo>.Array;
- }
-
- public override FieldInfo[] __GetDeclaredFields()
- {
- int field = module.TypeDef.records[index].FieldList - 1;
- int end = module.TypeDef.records.Length > index + 1 ? module.TypeDef.records[index + 1].FieldList - 1 : module.Field.records.Length;
- FieldInfo[] fields = new FieldInfo[end - field];
- if (module.FieldPtr.RowCount == 0)
- {
- for (int i = 0; field < end; i++, field++)
- {
- fields[i] = module.GetFieldAt(this, field);
- }
- }
- else
- {
- for (int i = 0; field < end; i++, field++)
- {
- fields[i] = module.GetFieldAt(this, module.FieldPtr.records[field] - 1);
- }
- }
- return fields;
- }
-
- public override Type[] __GetDeclaredInterfaces()
- {
- List<Type> list = null;
- foreach (int i in module.InterfaceImpl.Filter(this.MetadataToken))
- {
- if (list == null)
- {
- list = new List<Type>();
- }
- list.Add(module.ResolveType(module.InterfaceImpl.records[i].Interface, this));
- }
- return Util.ToArray(list, Type.EmptyTypes);
- }
-
- public override MethodBase[] __GetDeclaredMethods()
- {
- int method = module.TypeDef.records[index].MethodList - 1;
- int end = module.TypeDef.records.Length > index + 1 ? module.TypeDef.records[index + 1].MethodList - 1 : module.MethodDef.records.Length;
- MethodBase[] methods = new MethodBase[end - method];
- if (module.MethodPtr.RowCount == 0)
- {
- for (int i = 0; method < end; method++, i++)
- {
- methods[i] = module.GetMethodAt(this, method);
- }
- }
- else
- {
- for (int i = 0; method < end; method++, i++)
- {
- methods[i] = module.GetMethodAt(this, module.MethodPtr.records[method] - 1);
- }
- }
- return methods;
- }
-
- public override __MethodImplMap __GetMethodImplMap()
- {
- PopulateGenericArguments();
- List<MethodInfo> bodies = new List<MethodInfo>();
- List<List<MethodInfo>> declarations = new List<List<MethodInfo>>();
- foreach (int i in module.MethodImpl.Filter(this.MetadataToken))
- {
- MethodInfo body = (MethodInfo)module.ResolveMethod(module.MethodImpl.records[i].MethodBody, typeArgs, null);
- int index = bodies.IndexOf(body);
- if (index == -1)
- {
- index = bodies.Count;
- bodies.Add(body);
- declarations.Add(new List<MethodInfo>());
- }
- MethodInfo declaration = (MethodInfo)module.ResolveMethod(module.MethodImpl.records[i].MethodDeclaration, typeArgs, null);
- declarations[index].Add(declaration);
- }
- __MethodImplMap map = new __MethodImplMap();
- map.TargetType = this;
- map.MethodBodies = bodies.ToArray();
- map.MethodDeclarations = new MethodInfo[declarations.Count][];
- for (int i = 0; i < map.MethodDeclarations.Length; i++)
- {
- map.MethodDeclarations[i] = declarations[i].ToArray();
- }
- return map;
- }
-
- public override Type[] __GetDeclaredTypes()
- {
- int token = this.MetadataToken;
- List<Type> list = new List<Type>();
- // note that the NestedClass table is sorted on NestedClass, so we can't use binary search
- for (int i = 0; i < module.NestedClass.records.Length; i++)
- {
- if (module.NestedClass.records[i].EnclosingClass == token)
- {
- list.Add(module.ResolveType(module.NestedClass.records[i].NestedClass));
- }
- }
- return list.ToArray();
- }
-
- public override PropertyInfo[] __GetDeclaredProperties()
- {
- foreach (int i in module.PropertyMap.Filter(this.MetadataToken))
- {
- int property = module.PropertyMap.records[i].PropertyList - 1;
- int end = module.PropertyMap.records.Length > i + 1 ? module.PropertyMap.records[i + 1].PropertyList - 1 : module.Property.records.Length;
- PropertyInfo[] properties = new PropertyInfo[end - property];
- if (module.PropertyPtr.RowCount == 0)
- {
- for (int j = 0; property < end; property++, j++)
- {
- properties[j] = new PropertyInfoImpl(module, this, property);
- }
- }
- else
- {
- for (int j = 0; property < end; property++, j++)
- {
- properties[j] = new PropertyInfoImpl(module, this, module.PropertyPtr.records[property] - 1);
- }
- }
- return properties;
- }
- return Empty<PropertyInfo>.Array;
- }
-
- public override string __Name
- {
- get { return typeName; }
- }
-
- public override string __Namespace
- {
- get { return typeNamespace; }
- }
-
- public override string Name
- {
- get { return TypeNameParser.Escape(typeName); }
- }
-
- public override string FullName
- {
- get { return GetFullName(); }
- }
-
- public override int MetadataToken
- {
- get { return (TypeDefTable.Index << 24) + index + 1; }
- }
-
- public override Type[] GetGenericArguments()
- {
- PopulateGenericArguments();
- return Util.Copy(typeArgs);
- }
-
- private void PopulateGenericArguments()
- {
- if (typeArgs == null)
- {
- int token = this.MetadataToken;
- int first = module.GenericParam.FindFirstByOwner(token);
- if (first == -1)
- {
- typeArgs = Type.EmptyTypes;
- }
- else
- {
- List<Type> list = new List<Type>();
- int len = module.GenericParam.records.Length;
- for (int i = first; i < len && module.GenericParam.records[i].Owner == token; i++)
- {
- list.Add(new GenericTypeParameter(module, i));
- }
- typeArgs = list.ToArray();
- }
- }
- }
-
- internal override Type GetGenericTypeArgument(int index)
- {
- PopulateGenericArguments();
- return typeArgs[index];
- }
-
- public override CustomModifiers[] __GetGenericArgumentsCustomModifiers()
- {
- PopulateGenericArguments();
- return new CustomModifiers[typeArgs.Length];
- }
-
- public override bool IsGenericType
- {
- get { return IsGenericTypeDefinition; }
- }
-
- public override bool IsGenericTypeDefinition
- {
- get
- {
- if ((typeFlags & (TypeFlags.IsGenericTypeDefinition | TypeFlags.NotGenericTypeDefinition)) == 0)
- {
- typeFlags |= module.GenericParam.FindFirstByOwner(this.MetadataToken) == -1
- ? TypeFlags.NotGenericTypeDefinition
- : TypeFlags.IsGenericTypeDefinition;
- }
- return (typeFlags & TypeFlags.IsGenericTypeDefinition) != 0;
- }
- }
-
- public override Type GetGenericTypeDefinition()
- {
- if (IsGenericTypeDefinition)
- {
- return this;
- }
- throw new InvalidOperationException();
- }
-
- public override string ToString()
- {
- StringBuilder sb = new StringBuilder(this.FullName);
- string sep = "[";
- foreach (Type arg in GetGenericArguments())
- {
- sb.Append(sep);
- sb.Append(arg);
- sep = ",";
- }
- if (sep != "[")
- {
- sb.Append(']');
- }
- return sb.ToString();
- }
-
- internal bool IsNestedByFlags
- {
- get { return (this.Attributes & TypeAttributes.VisibilityMask & ~TypeAttributes.Public) != 0; }
- }
-
- public override Type DeclaringType
- {
- get
- {
- // note that we cannot use Type.IsNested for this, because that calls DeclaringType
- if (!IsNestedByFlags)
- {
- return null;
- }
- foreach (int i in module.NestedClass.Filter(this.MetadataToken))
- {
- return module.ResolveType(module.NestedClass.records[i].EnclosingClass, null, null);
- }
- throw new InvalidOperationException();
- }
- }
-
- public override StructLayoutAttribute StructLayoutAttribute
- {
- get
- {
- StructLayoutAttribute layout;
- switch (this.Attributes & TypeAttributes.LayoutMask)
- {
- case TypeAttributes.AutoLayout:
- layout = new StructLayoutAttribute(LayoutKind.Auto);
- break;
- case TypeAttributes.SequentialLayout:
- layout = new StructLayoutAttribute(LayoutKind.Sequential);
- break;
- case TypeAttributes.ExplicitLayout:
- layout = new StructLayoutAttribute(LayoutKind.Explicit);
- break;
- default:
- throw new BadImageFormatException();
- }
- switch (this.Attributes & TypeAttributes.StringFormatMask)
- {
- case TypeAttributes.AnsiClass:
- layout.CharSet = CharSet.Ansi;
- break;
- case TypeAttributes.UnicodeClass:
- layout.CharSet = CharSet.Unicode;
- break;
- case TypeAttributes.AutoClass:
- layout.CharSet = CharSet.Auto;
- break;
- default:
- layout.CharSet = CharSet.None;
- break;
- }
- if (!__GetLayout(out layout.Pack, out layout.Size))
- {
- // compatibility with System.Reflection
- layout.Pack = 8;
- }
- return layout;
- }
- }
-
- public override bool __GetLayout(out int packingSize, out int typeSize)
- {
- foreach (int i in module.ClassLayout.Filter(this.MetadataToken))
- {
- packingSize = module.ClassLayout.records[i].PackingSize;
- typeSize = module.ClassLayout.records[i].ClassSize;
- return true;
- }
- packingSize = 0;
- typeSize = 0;
- return false;
- }
-
- public override Module Module
- {
- get { return module; }
- }
-
- internal override bool IsModulePseudoType
- {
- get { return index == 0; }
- }
-
- internal override bool IsBaked
- {
- get { return true; }
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009-2012 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Text;
-using CallingConvention = System.Runtime.InteropServices.CallingConvention;
-using IKVM.Reflection.Reader;
-using IKVM.Reflection.Emit;
-using IKVM.Reflection.Writer;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection
-{
- abstract class Signature
- {
- internal const byte DEFAULT = 0x00;
- internal const byte VARARG = 0x05;
- internal const byte GENERIC = 0x10;
- internal const byte HASTHIS = 0x20;
- internal const byte EXPLICITTHIS = 0x40;
- internal const byte FIELD = 0x06;
- internal const byte LOCAL_SIG = 0x07;
- internal const byte PROPERTY = 0x08;
- internal const byte GENERICINST = 0x0A;
- internal const byte SENTINEL = 0x41;
- internal const byte ELEMENT_TYPE_VOID = 0x01;
- internal const byte ELEMENT_TYPE_BOOLEAN = 0x02;
- internal const byte ELEMENT_TYPE_CHAR = 0x03;
- internal const byte ELEMENT_TYPE_I1 = 0x04;
- internal const byte ELEMENT_TYPE_U1 = 0x05;
- internal const byte ELEMENT_TYPE_I2 = 0x06;
- internal const byte ELEMENT_TYPE_U2 = 0x07;
- internal const byte ELEMENT_TYPE_I4 = 0x08;
- internal const byte ELEMENT_TYPE_U4 = 0x09;
- internal const byte ELEMENT_TYPE_I8 = 0x0a;
- internal const byte ELEMENT_TYPE_U8 = 0x0b;
- internal const byte ELEMENT_TYPE_R4 = 0x0c;
- internal const byte ELEMENT_TYPE_R8 = 0x0d;
- internal const byte ELEMENT_TYPE_STRING = 0x0e;
- internal const byte ELEMENT_TYPE_PTR = 0x0f;
- internal const byte ELEMENT_TYPE_BYREF = 0x10;
- internal const byte ELEMENT_TYPE_VALUETYPE = 0x11;
- internal const byte ELEMENT_TYPE_CLASS = 0x12;
- internal const byte ELEMENT_TYPE_VAR = 0x13;
- internal const byte ELEMENT_TYPE_ARRAY = 0x14;
- internal const byte ELEMENT_TYPE_GENERICINST = 0x15;
- internal const byte ELEMENT_TYPE_TYPEDBYREF = 0x16;
- internal const byte ELEMENT_TYPE_I = 0x18;
- internal const byte ELEMENT_TYPE_U = 0x19;
- internal const byte ELEMENT_TYPE_FNPTR = 0x1b;
- internal const byte ELEMENT_TYPE_OBJECT = 0x1c;
- internal const byte ELEMENT_TYPE_SZARRAY = 0x1d;
- internal const byte ELEMENT_TYPE_MVAR = 0x1e;
- internal const byte ELEMENT_TYPE_CMOD_REQD = 0x1f;
- internal const byte ELEMENT_TYPE_CMOD_OPT = 0x20;
- internal const byte ELEMENT_TYPE_PINNED = 0x45;
-
- internal abstract void WriteSig(ModuleBuilder module, ByteBuffer bb);
-
- private static Type ReadGenericInst(ModuleReader module, ByteReader br, IGenericContext context)
- {
- Type type;
- switch (br.ReadByte())
- {
- case ELEMENT_TYPE_CLASS:
- type = ReadTypeDefOrRefEncoded(module, br, context).MarkNotValueType();
- break;
- case ELEMENT_TYPE_VALUETYPE:
- type = ReadTypeDefOrRefEncoded(module, br, context).MarkValueType();
- break;
- default:
- throw new BadImageFormatException();
- }
- if (!type.__IsMissing && !type.IsGenericTypeDefinition)
- {
- throw new BadImageFormatException();
- }
- int genArgCount = br.ReadCompressedInt();
- Type[] args = new Type[genArgCount];
- CustomModifiers[] mods = null;
- for (int i = 0; i < genArgCount; i++)
- {
- // LAMESPEC the Type production (23.2.12) doesn't include CustomMod* for genericinst, but C++ uses it, the verifier allows it and ildasm also supports it
- CustomModifiers cm = CustomModifiers.Read(module, br, context);
- if (!cm.IsEmpty)
- {
- if (mods == null)
- {
- mods = new CustomModifiers[genArgCount];
- }
- mods[i] = cm;
- }
- args[i] = ReadType(module, br, context);
- }
- return GenericTypeInstance.Make(type, args, mods);
- }
-
- internal static Type ReadTypeSpec(ModuleReader module, ByteReader br, IGenericContext context)
- {
- // LAMESPEC a TypeSpec can contain custom modifiers (C++/CLI generates "newarr (TypeSpec with custom modifiers)")
- CustomModifiers.Skip(br);
- // LAMESPEC anything can be adorned by (useless) custom modifiers
- // also, VAR and MVAR are also used in TypeSpec (contrary to what the spec says)
- return ReadType(module, br, context);
- }
-
- private static Type ReadFunctionPointer(ModuleReader module, ByteReader br, IGenericContext context)
- {
- __StandAloneMethodSig sig = MethodSignature.ReadStandAloneMethodSig(module, br, context);
- if (module.universe.EnableFunctionPointers)
- {
- return FunctionPointerType.Make(module.universe, sig);
- }
- else
- {
- // by default, like .NET we return System.IntPtr here
- return module.universe.System_IntPtr;
- }
- }
-
- internal static Type[] ReadMethodSpec(ModuleReader module, ByteReader br, IGenericContext context)
- {
- if (br.ReadByte() != GENERICINST)
- {
- throw new BadImageFormatException();
- }
- Type[] args = new Type[br.ReadCompressedInt()];
- for (int i = 0; i < args.Length; i++)
- {
- args[i] = ReadType(module, br, context);
- }
- return args;
- }
-
- private static int[] ReadArrayBounds(ByteReader br)
- {
- int num = br.ReadCompressedInt();
- if (num == 0)
- {
- return null;
- }
- int[] arr = new int[num];
- for (int i = 0; i < num; i++)
- {
- arr[i] = br.ReadCompressedInt();
- }
- return arr;
- }
-
- private static Type ReadTypeOrVoid(ModuleReader module, ByteReader br, IGenericContext context)
- {
- if (br.PeekByte() == ELEMENT_TYPE_VOID)
- {
- br.ReadByte();
- return module.universe.System_Void;
- }
- else
- {
- return ReadType(module, br, context);
- }
- }
-
- // see ECMA 335 CLI spec June 2006 section 23.2.12 for this production
- protected static Type ReadType(ModuleReader module, ByteReader br, IGenericContext context)
- {
- CustomModifiers mods;
- switch (br.ReadByte())
- {
- case ELEMENT_TYPE_CLASS:
- return ReadTypeDefOrRefEncoded(module, br, context).MarkNotValueType();
- case ELEMENT_TYPE_VALUETYPE:
- return ReadTypeDefOrRefEncoded(module, br, context).MarkValueType();
- case ELEMENT_TYPE_BOOLEAN:
- return module.universe.System_Boolean;
- case ELEMENT_TYPE_CHAR:
- return module.universe.System_Char;
- case ELEMENT_TYPE_I1:
- return module.universe.System_SByte;
- case ELEMENT_TYPE_U1:
- return module.universe.System_Byte;
- case ELEMENT_TYPE_I2:
- return module.universe.System_Int16;
- case ELEMENT_TYPE_U2:
- return module.universe.System_UInt16;
- case ELEMENT_TYPE_I4:
- return module.universe.System_Int32;
- case ELEMENT_TYPE_U4:
- return module.universe.System_UInt32;
- case ELEMENT_TYPE_I8:
- return module.universe.System_Int64;
- case ELEMENT_TYPE_U8:
- return module.universe.System_UInt64;
- case ELEMENT_TYPE_R4:
- return module.universe.System_Single;
- case ELEMENT_TYPE_R8:
- return module.universe.System_Double;
- case ELEMENT_TYPE_I:
- return module.universe.System_IntPtr;
- case ELEMENT_TYPE_U:
- return module.universe.System_UIntPtr;
- case ELEMENT_TYPE_STRING:
- return module.universe.System_String;
- case ELEMENT_TYPE_OBJECT:
- return module.universe.System_Object;
- case ELEMENT_TYPE_VAR:
- return context.GetGenericTypeArgument(br.ReadCompressedInt());
- case ELEMENT_TYPE_MVAR:
- return context.GetGenericMethodArgument(br.ReadCompressedInt());
- case ELEMENT_TYPE_GENERICINST:
- return ReadGenericInst(module, br, context);
- case ELEMENT_TYPE_SZARRAY:
- mods = CustomModifiers.Read(module, br, context);
- return ReadType(module, br, context).__MakeArrayType(mods);
- case ELEMENT_TYPE_ARRAY:
- mods = CustomModifiers.Read(module, br, context);
- return ReadType(module, br, context).__MakeArrayType(br.ReadCompressedInt(), ReadArrayBounds(br), ReadArrayBounds(br), mods);
- case ELEMENT_TYPE_PTR:
- mods = CustomModifiers.Read(module, br, context);
- return ReadTypeOrVoid(module, br, context).__MakePointerType(mods);
- case ELEMENT_TYPE_FNPTR:
- return ReadFunctionPointer(module, br, context);
- default:
- throw new BadImageFormatException();
- }
- }
-
- internal static void ReadLocalVarSig(ModuleReader module, ByteReader br, IGenericContext context, List<LocalVariableInfo> list)
- {
- if (br.Length < 2 || br.ReadByte() != LOCAL_SIG)
- {
- throw new BadImageFormatException("Invalid local variable signature");
- }
- int count = br.ReadCompressedInt();
- for (int i = 0; i < count; i++)
- {
- if (br.PeekByte() == ELEMENT_TYPE_TYPEDBYREF)
- {
- br.ReadByte();
- list.Add(new LocalVariableInfo(i, module.universe.System_TypedReference, false, new CustomModifiers()));
- }
- else
- {
- CustomModifiers mods1 = CustomModifiers.Read(module, br, context);
- bool pinned = false;
- if (br.PeekByte() == ELEMENT_TYPE_PINNED)
- {
- br.ReadByte();
- pinned = true;
- }
- CustomModifiers mods2 = CustomModifiers.Read(module, br, context);
- Type type = ReadTypeOrByRef(module, br, context);
- list.Add(new LocalVariableInfo(i, type, pinned, CustomModifiers.Combine(mods1, mods2)));
- }
- }
- }
-
- private static Type ReadTypeOrByRef(ModuleReader module, ByteReader br, IGenericContext context)
- {
- if (br.PeekByte() == ELEMENT_TYPE_BYREF)
- {
- br.ReadByte();
- // LAMESPEC it is allowed (by C++/CLI, ilasm and peverify) to have custom modifiers after the BYREF
- // (which makes sense, as it is analogous to pointers)
- CustomModifiers mods = CustomModifiers.Read(module, br, context);
- // C++/CLI generates void& local variables, so we need to use ReadTypeOrVoid here
- return ReadTypeOrVoid(module, br, context).__MakeByRefType(mods);
- }
- else
- {
- return ReadType(module, br, context);
- }
- }
-
- protected static Type ReadRetType(ModuleReader module, ByteReader br, IGenericContext context)
- {
- switch (br.PeekByte())
- {
- case ELEMENT_TYPE_VOID:
- br.ReadByte();
- return module.universe.System_Void;
- case ELEMENT_TYPE_TYPEDBYREF:
- br.ReadByte();
- return module.universe.System_TypedReference;
- default:
- return ReadTypeOrByRef(module, br, context);
- }
- }
-
- protected static Type ReadParam(ModuleReader module, ByteReader br, IGenericContext context)
- {
- switch (br.PeekByte())
- {
- case ELEMENT_TYPE_TYPEDBYREF:
- br.ReadByte();
- return module.universe.System_TypedReference;
- default:
- return ReadTypeOrByRef(module, br, context);
- }
- }
-
- protected static void WriteType(ModuleBuilder module, ByteBuffer bb, Type type)
- {
- while (type.HasElementType)
- {
- if (type.__IsVector)
- {
- bb.Write(ELEMENT_TYPE_SZARRAY);
- }
- else if (type.IsArray)
- {
- int rank = type.GetArrayRank();
- bb.Write(ELEMENT_TYPE_ARRAY);
- // LAMESPEC the Type production (23.2.12) doesn't include CustomMod* for arrays, but the verifier allows it and ildasm also supports it
- WriteCustomModifiers(module, bb, type.__GetCustomModifiers());
- WriteType(module, bb, type.GetElementType());
- bb.WriteCompressedInt(rank);
- int[] sizes = type.__GetArraySizes();
- bb.WriteCompressedInt(sizes.Length);
- for (int i = 0; i < sizes.Length; i++)
- {
- bb.WriteCompressedInt(sizes[i]);
- }
- int[] lobounds = type.__GetArrayLowerBounds();
- bb.WriteCompressedInt(lobounds.Length);
- for (int i = 0; i < lobounds.Length; i++)
- {
- bb.WriteCompressedInt(lobounds[i]);
- }
- return;
- }
- else if (type.IsByRef)
- {
- bb.Write(ELEMENT_TYPE_BYREF);
- }
- else if (type.IsPointer)
- {
- bb.Write(ELEMENT_TYPE_PTR);
- }
- WriteCustomModifiers(module, bb, type.__GetCustomModifiers());
- type = type.GetElementType();
- }
- Universe u = module.universe;
- if (type == u.System_Void)
- {
- bb.Write(ELEMENT_TYPE_VOID);
- }
- else if (type == u.System_Int32)
- {
- bb.Write(ELEMENT_TYPE_I4);
- }
- else if (type == u.System_Boolean)
- {
- bb.Write(ELEMENT_TYPE_BOOLEAN);
- }
- else if (type == u.System_String)
- {
- bb.Write(ELEMENT_TYPE_STRING);
- }
- else if (type == u.System_Char)
- {
- bb.Write(ELEMENT_TYPE_CHAR);
- }
- else if (type == u.System_SByte)
- {
- bb.Write(ELEMENT_TYPE_I1);
- }
- else if (type == u.System_Byte)
- {
- bb.Write(ELEMENT_TYPE_U1);
- }
- else if (type == u.System_Int16)
- {
- bb.Write(ELEMENT_TYPE_I2);
- }
- else if (type == u.System_UInt16)
- {
- bb.Write(ELEMENT_TYPE_U2);
- }
- else if (type == u.System_UInt32)
- {
- bb.Write(ELEMENT_TYPE_U4);
- }
- else if (type == u.System_Int64)
- {
- bb.Write(ELEMENT_TYPE_I8);
- }
- else if (type == u.System_UInt64)
- {
- bb.Write(ELEMENT_TYPE_U8);
- }
- else if (type == u.System_Single)
- {
- bb.Write(ELEMENT_TYPE_R4);
- }
- else if (type == u.System_Double)
- {
- bb.Write(ELEMENT_TYPE_R8);
- }
- else if (type == u.System_IntPtr)
- {
- bb.Write(ELEMENT_TYPE_I);
- }
- else if (type == u.System_UIntPtr)
- {
- bb.Write(ELEMENT_TYPE_U);
- }
- else if (type == u.System_TypedReference)
- {
- bb.Write(ELEMENT_TYPE_TYPEDBYREF);
- }
- else if (type == u.System_Object)
- {
- bb.Write(ELEMENT_TYPE_OBJECT);
- }
- else if (type.IsGenericParameter)
- {
- if (type is UnboundGenericMethodParameter || type.DeclaringMethod != null)
- {
- bb.Write(ELEMENT_TYPE_MVAR);
- }
- else
- {
- bb.Write(ELEMENT_TYPE_VAR);
- }
- bb.WriteCompressedInt(type.GenericParameterPosition);
- }
- else if (!type.__IsMissing && type.IsGenericType)
- {
- WriteGenericSignature(module, bb, type);
- }
- else if (type.__IsFunctionPointer)
- {
- bb.Write(ELEMENT_TYPE_FNPTR);
- WriteStandAloneMethodSig(module, bb, type.__MethodSignature);
- }
- else
- {
- if (type.IsValueType)
- {
- bb.Write(ELEMENT_TYPE_VALUETYPE);
- }
- else
- {
- bb.Write(ELEMENT_TYPE_CLASS);
- }
- bb.WriteTypeDefOrRefEncoded(module.GetTypeToken(type).Token);
- }
- }
-
- private static void WriteGenericSignature(ModuleBuilder module, ByteBuffer bb, Type type)
- {
- Type[] typeArguments = type.GetGenericArguments();
- CustomModifiers[] customModifiers = type.__GetGenericArgumentsCustomModifiers();
- if (!type.IsGenericTypeDefinition)
- {
- type = type.GetGenericTypeDefinition();
- }
- bb.Write(ELEMENT_TYPE_GENERICINST);
- if (type.IsValueType)
- {
- bb.Write(ELEMENT_TYPE_VALUETYPE);
- }
- else
- {
- bb.Write(ELEMENT_TYPE_CLASS);
- }
- bb.WriteTypeDefOrRefEncoded(module.GetTypeToken(type).Token);
- bb.WriteCompressedInt(typeArguments.Length);
- for (int i = 0; i < typeArguments.Length; i++)
- {
- WriteCustomModifiers(module, bb, customModifiers[i]);
- WriteType(module, bb, typeArguments[i]);
- }
- }
-
- protected static void WriteCustomModifiers(ModuleBuilder module, ByteBuffer bb, CustomModifiers modifiers)
- {
- foreach (CustomModifiers.Entry entry in modifiers)
- {
- bb.Write(entry.IsRequired ? ELEMENT_TYPE_CMOD_REQD : ELEMENT_TYPE_CMOD_OPT);
- bb.WriteTypeDefOrRefEncoded(module.GetTypeTokenForMemberRef(entry.Type));
- }
- }
-
- internal static Type ReadTypeDefOrRefEncoded(ModuleReader module, ByteReader br, IGenericContext context)
- {
- int encoded = br.ReadCompressedInt();
- switch (encoded & 3)
- {
- case 0:
- return module.ResolveType((TypeDefTable.Index << 24) + (encoded >> 2), null, null);
- case 1:
- return module.ResolveType((TypeRefTable.Index << 24) + (encoded >> 2), null, null);
- case 2:
- return module.ResolveType((TypeSpecTable.Index << 24) + (encoded >> 2), context);
- default:
- throw new BadImageFormatException();
- }
- }
-
- internal static void WriteStandAloneMethodSig(ModuleBuilder module, ByteBuffer bb, __StandAloneMethodSig sig)
- {
- if (sig.IsUnmanaged)
- {
- switch (sig.UnmanagedCallingConvention)
- {
- case CallingConvention.Cdecl:
- bb.Write((byte)0x01); // C
- break;
- case CallingConvention.StdCall:
- case CallingConvention.Winapi:
- bb.Write((byte)0x02); // STDCALL
- break;
- case CallingConvention.ThisCall:
- bb.Write((byte)0x03); // THISCALL
- break;
- case CallingConvention.FastCall:
- bb.Write((byte)0x04); // FASTCALL
- break;
- default:
- throw new ArgumentOutOfRangeException("callingConvention");
- }
- }
- else
- {
- CallingConventions callingConvention = sig.CallingConvention;
- byte flags = 0;
- if ((callingConvention & CallingConventions.HasThis) != 0)
- {
- flags |= HASTHIS;
- }
- if ((callingConvention & CallingConventions.ExplicitThis) != 0)
- {
- flags |= EXPLICITTHIS;
- }
- if ((callingConvention & CallingConventions.VarArgs) != 0)
- {
- flags |= VARARG;
- }
- bb.Write(flags);
- }
- Type[] parameterTypes = sig.ParameterTypes;
- Type[] optionalParameterTypes = sig.OptionalParameterTypes;
- bb.WriteCompressedInt(parameterTypes.Length + optionalParameterTypes.Length);
- WriteCustomModifiers(module, bb, sig.GetReturnTypeCustomModifiers());
- WriteType(module, bb, sig.ReturnType);
- int index = 0;
- foreach (Type t in parameterTypes)
- {
- WriteCustomModifiers(module, bb, sig.GetParameterCustomModifiers(index++));
- WriteType(module, bb, t);
- }
- // note that optional parameters are only allowed for managed signatures (but we don't enforce that)
- if (optionalParameterTypes.Length > 0)
- {
- bb.Write(SENTINEL);
- foreach (Type t in optionalParameterTypes)
- {
- WriteCustomModifiers(module, bb, sig.GetParameterCustomModifiers(index++));
- WriteType(module, bb, t);
- }
- }
- }
-
- internal static void WriteTypeSpec(ModuleBuilder module, ByteBuffer bb, Type type)
- {
- WriteType(module, bb, type);
- }
-
- internal static void WriteMethodSpec(ModuleBuilder module, ByteBuffer bb, Type[] genArgs)
- {
- bb.Write(GENERICINST);
- bb.WriteCompressedInt(genArgs.Length);
- foreach (Type arg in genArgs)
- {
- WriteType(module, bb, arg);
- }
- }
-
- // this reads just the optional parameter types, from a MethodRefSig
- internal static Type[] ReadOptionalParameterTypes(ModuleReader module, ByteReader br, IGenericContext context, out CustomModifiers[] customModifiers)
- {
- br.ReadByte();
- int paramCount = br.ReadCompressedInt();
- CustomModifiers.Skip(br);
- ReadRetType(module, br, context);
- for (int i = 0; i < paramCount; i++)
- {
- if (br.PeekByte() == SENTINEL)
- {
- br.ReadByte();
- Type[] types = new Type[paramCount - i];
- customModifiers = new CustomModifiers[types.Length];
- for (int j = 0; j < types.Length; j++)
- {
- customModifiers[j] = CustomModifiers.Read(module, br, context);
- types[j] = ReadType(module, br, context);
- }
- return types;
- }
- CustomModifiers.Skip(br);
- ReadType(module, br, context);
- }
- customModifiers = Empty<CustomModifiers>.Array;
- return Type.EmptyTypes;
- }
-
- protected static Type[] BindTypeParameters(IGenericBinder binder, Type[] types)
- {
- if (types == null || types.Length == 0)
- {
- return Type.EmptyTypes;
- }
- Type[] expanded = new Type[types.Length];
- for (int i = 0; i < types.Length; i++)
- {
- expanded[i] = types[i].BindTypeParameters(binder);
- }
- return expanded;
- }
-
- internal static void WriteSignatureHelper(ModuleBuilder module, ByteBuffer bb, byte flags, ushort paramCount, List<Type> args)
- {
- bb.Write(flags);
- if (flags != FIELD)
- {
- bb.WriteCompressedInt(paramCount);
- }
- foreach (Type type in args)
- {
- if (type == MarkerType.ModOpt)
- {
- bb.Write(ELEMENT_TYPE_CMOD_OPT);
- }
- else if (type == MarkerType.ModReq)
- {
- bb.Write(ELEMENT_TYPE_CMOD_REQD);
- }
- else if (type == MarkerType.Sentinel)
- {
- bb.Write(SENTINEL);
- }
- else if (type == MarkerType.Pinned)
- {
- bb.Write(ELEMENT_TYPE_PINNED);
- }
- else if (type == null)
- {
- bb.Write(ELEMENT_TYPE_VOID);
- }
- else
- {
- WriteType(module, bb, type);
- }
- }
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2010 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Runtime.InteropServices;
-using IKVM.Reflection.Reader;
-
-namespace IKVM.Reflection
-{
- public sealed class __StandAloneMethodSig
- {
- private readonly bool unmanaged;
- private readonly CallingConvention unmanagedCallingConvention;
- private readonly CallingConventions callingConvention;
- private readonly Type returnType;
- private readonly Type[] parameterTypes;
- private readonly Type[] optionalParameterTypes;
- private readonly PackedCustomModifiers customModifiers;
-
- internal __StandAloneMethodSig(bool unmanaged, CallingConvention unmanagedCallingConvention, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, Type[] optionalParameterTypes, PackedCustomModifiers customModifiers)
- {
- this.unmanaged = unmanaged;
- this.unmanagedCallingConvention = unmanagedCallingConvention;
- this.callingConvention = callingConvention;
- this.returnType = returnType;
- this.parameterTypes = parameterTypes;
- this.optionalParameterTypes = optionalParameterTypes;
- this.customModifiers = customModifiers;
- }
-
- public bool Equals(__StandAloneMethodSig other)
- {
- return other != null
- && other.unmanaged == unmanaged
- && other.unmanagedCallingConvention == unmanagedCallingConvention
- && other.callingConvention == callingConvention
- && other.returnType == returnType
- && Util.ArrayEquals(other.parameterTypes, parameterTypes)
- && Util.ArrayEquals(other.optionalParameterTypes, optionalParameterTypes)
- && other.customModifiers.Equals(customModifiers);
- }
-
- public override bool Equals(object obj)
- {
- return Equals(obj as __StandAloneMethodSig);
- }
-
- public override int GetHashCode()
- {
- return returnType.GetHashCode()
- ^ Util.GetHashCode(parameterTypes);
- }
-
- public bool IsUnmanaged
- {
- get { return unmanaged; }
- }
-
- public CallingConventions CallingConvention
- {
- get { return callingConvention; }
- }
-
- public CallingConvention UnmanagedCallingConvention
- {
- get { return unmanagedCallingConvention; }
- }
-
- public Type ReturnType
- {
- get { return returnType; }
- }
-
- public CustomModifiers GetReturnTypeCustomModifiers()
- {
- return customModifiers.GetReturnTypeCustomModifiers();
- }
-
- public Type[] ParameterTypes
- {
- get { return Util.Copy(parameterTypes); }
- }
-
- public Type[] OptionalParameterTypes
- {
- get { return Util.Copy(optionalParameterTypes); }
- }
-
- public CustomModifiers GetParameterCustomModifiers(int index)
- {
- return customModifiers.GetParameterCustomModifiers(index);
- }
-
- internal int ParameterCount
- {
- get { return parameterTypes.Length + optionalParameterTypes.Length; }
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009-2012 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.IO;
-using System.Security.Cryptography;
-
-namespace IKVM.Reflection
-{
- public sealed class StrongNameKeyPair
- {
- private readonly byte[] keyPairArray;
- private readonly string keyPairContainer;
-
- public StrongNameKeyPair(string keyPairContainer)
- {
- if (keyPairContainer == null)
- {
- throw new ArgumentNullException("keyPairContainer");
- }
- if (Universe.MonoRuntime && Environment.OSVersion.Platform == PlatformID.Win32NT)
- {
- throw new NotSupportedException("IKVM.Reflection does not support key containers when running on Mono");
- }
- this.keyPairContainer = keyPairContainer;
- }
-
- public StrongNameKeyPair(byte[] keyPairArray)
- {
- if (keyPairArray == null)
- {
- throw new ArgumentNullException("keyPairArray");
- }
- this.keyPairArray = (byte[])keyPairArray.Clone();
- }
-
- public StrongNameKeyPair(FileStream keyPairFile)
- : this(ReadAllBytes(keyPairFile))
- {
- }
-
- private static byte[] ReadAllBytes(FileStream keyPairFile)
- {
- if (keyPairFile == null)
- {
- throw new ArgumentNullException("keyPairFile");
- }
- byte[] buf = new byte[keyPairFile.Length - keyPairFile.Position];
- keyPairFile.Read(buf, 0, buf.Length);
- return buf;
- }
-
- public byte[] PublicKey
- {
- get
- {
- if (Universe.MonoRuntime)
- {
- // MONOBUG workaround for https://bugzilla.xamarin.com/show_bug.cgi?id=5299
- return MonoGetPublicKey();
- }
- using (RSACryptoServiceProvider rsa = CreateRSA())
- {
- byte[] cspBlob = rsa.ExportCspBlob(false);
- byte[] publicKey = new byte[12 + cspBlob.Length];
- Buffer.BlockCopy(cspBlob, 0, publicKey, 12, cspBlob.Length);
- publicKey[1] = 36;
- publicKey[4] = 4;
- publicKey[5] = 128;
- publicKey[8] = (byte)(cspBlob.Length >> 0);
- publicKey[9] = (byte)(cspBlob.Length >> 8);
- publicKey[10] = (byte)(cspBlob.Length >> 16);
- publicKey[11] = (byte)(cspBlob.Length >> 24);
- return publicKey;
- }
- }
- }
-
- internal RSACryptoServiceProvider CreateRSA()
- {
- try
- {
- if (keyPairArray != null)
- {
- RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
- rsa.ImportCspBlob(keyPairArray);
- return rsa;
- }
- else
- {
- CspParameters parm = new CspParameters();
- parm.KeyContainerName = keyPairContainer;
- // MONOBUG Mono doesn't like it when Flags or KeyNumber are set
- if (!Universe.MonoRuntime)
- {
- parm.Flags = CspProviderFlags.UseMachineKeyStore | CspProviderFlags.UseExistingKey;
- parm.KeyNumber = 2; // Signature
- }
- return new RSACryptoServiceProvider(parm);
- }
- }
- catch
- {
- throw new ArgumentException("Unable to obtain public key for StrongNameKeyPair.");
- }
- }
-
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
- private byte[] MonoGetPublicKey()
- {
- return keyPairArray != null
- ? new System.Reflection.StrongNameKeyPair(keyPairArray).PublicKey
- : new System.Reflection.StrongNameKeyPair(keyPairContainer).PublicKey;
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009-2012 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Runtime.InteropServices;
-using System.Text;
-using System.Collections.Generic;
-using IKVM.Reflection.Emit;
-
-namespace IKVM.Reflection
-{
- interface IGenericContext
- {
- Type GetGenericTypeArgument(int index);
- Type GetGenericMethodArgument(int index);
- }
-
- interface IGenericBinder
- {
- Type BindTypeParameter(Type type);
- Type BindMethodParameter(Type type);
- }
-
- public abstract class Type : MemberInfo, IGenericContext, IGenericBinder
- {
- public static readonly Type[] EmptyTypes = Empty<Type>.Array;
- protected readonly Type underlyingType;
- protected TypeFlags typeFlags;
-
- [Flags]
- protected enum TypeFlags
- {
- // for use by TypeBuilder or TypeDefImpl
- IsGenericTypeDefinition = 1,
-
- // for use by TypeBuilder
- HasNestedTypes = 2,
- Baked = 4,
-
- // for use by MissingType
- ValueType = 8,
- NotValueType = 16,
-
- // for use by TypeDefImpl, TypeBuilder or MissingType
- PotentialEnumOrValueType = 32,
- EnumOrValueType = 64,
-
- // for use by TypeDefImpl
- NotGenericTypeDefinition = 128,
- }
-
- // prevent subclassing by outsiders
- internal Type()
- {
- this.underlyingType = this;
- }
-
- internal Type(Type underlyingType)
- {
- System.Diagnostics.Debug.Assert(underlyingType.underlyingType == underlyingType);
- this.underlyingType = underlyingType;
- this.typeFlags = underlyingType.typeFlags;
- }
-
- public static Binder DefaultBinder
- {
- get { return new DefaultBinder(); }
- }
-
- public sealed override MemberTypes MemberType
- {
- get { return IsNested ? MemberTypes.NestedType : MemberTypes.TypeInfo; }
- }
-
- public virtual string AssemblyQualifiedName
- {
- // NOTE the assembly name is not escaped here, only when used in a generic type instantiation
- get { return this.FullName + ", " + this.Assembly.FullName; }
- }
-
- public abstract Type BaseType
- {
- get;
- }
-
- public abstract TypeAttributes Attributes
- {
- get;
- }
-
- public virtual Type GetElementType()
- {
- return null;
- }
-
- internal virtual void CheckBaked()
- {
- }
-
- public virtual Type[] __GetDeclaredTypes()
- {
- return Type.EmptyTypes;
- }
-
- public virtual Type[] __GetDeclaredInterfaces()
- {
- return Type.EmptyTypes;
- }
-
- public virtual MethodBase[] __GetDeclaredMethods()
- {
- return Empty<MethodBase>.Array;
- }
-
- public virtual __MethodImplMap __GetMethodImplMap()
- {
- throw new NotSupportedException();
- }
-
- public virtual FieldInfo[] __GetDeclaredFields()
- {
- return Empty<FieldInfo>.Array;
- }
-
- public virtual EventInfo[] __GetDeclaredEvents()
- {
- return Empty<EventInfo>.Array;
- }
-
- public virtual PropertyInfo[] __GetDeclaredProperties()
- {
- return Empty<PropertyInfo>.Array;
- }
-
- public virtual CustomModifiers __GetCustomModifiers()
- {
- return new CustomModifiers();
- }
-
- [Obsolete("Please use __GetCustomModifiers() instead.")]
- public Type[] __GetRequiredCustomModifiers()
- {
- return __GetCustomModifiers().GetRequired();
- }
-
- [Obsolete("Please use __GetCustomModifiers() instead.")]
- public Type[] __GetOptionalCustomModifiers()
- {
- return __GetCustomModifiers().GetOptional();
- }
-
- public virtual __StandAloneMethodSig __MethodSignature
- {
- get { throw new InvalidOperationException(); }
- }
-
- public virtual bool HasElementType
- {
- get { return false; }
- }
-
- public virtual bool IsArray
- {
- get { return false; }
- }
-
- public virtual bool __IsVector
- {
- get { return false; }
- }
-
- public virtual bool IsByRef
- {
- get { return false; }
- }
-
- public virtual bool IsPointer
- {
- get { return false; }
- }
-
- public virtual bool __IsFunctionPointer
- {
- get { return false; }
- }
-
- public virtual bool IsValueType
- {
- get
- {
- Type baseType = this.BaseType;
- return baseType != null
- && baseType.IsEnumOrValueType
- && !this.IsEnumOrValueType;
- }
- }
-
- public virtual bool IsGenericParameter
- {
- get { return false; }
- }
-
- public virtual int GenericParameterPosition
- {
- get { throw new NotSupportedException(); }
- }
-
- public virtual MethodBase DeclaringMethod
- {
- get { return null; }
- }
-
- public Type UnderlyingSystemType
- {
- get { return underlyingType; }
- }
-
- public override Type DeclaringType
- {
- get { return null; }
- }
-
- public virtual string __Name
- {
- get { throw new InvalidOperationException(); }
- }
-
- public virtual string __Namespace
- {
- get { throw new InvalidOperationException(); }
- }
-
- public abstract override string Name
- {
- get;
- }
-
- public virtual string Namespace
- {
- get
- {
- if (IsNested)
- {
- return DeclaringType.Namespace;
- }
- return __Namespace;
- }
- }
-
- internal virtual int GetModuleBuilderToken()
- {
- throw new InvalidOperationException();
- }
-
- public static bool operator ==(Type t1, Type t2)
- {
- // Casting to object results in smaller code than calling ReferenceEquals and makes
- // this method more likely to be inlined.
- // On CLR v2 x86, microbenchmarks show this to be faster than calling ReferenceEquals.
- return (object)t1 == (object)t2
- || ((object)t1 != null && (object)t2 != null && (object)t1.underlyingType == (object)t2.underlyingType);
- }
-
- public static bool operator !=(Type t1, Type t2)
- {
- return !(t1 == t2);
- }
-
- public bool Equals(Type type)
- {
- return this == type;
- }
-
- public override bool Equals(object obj)
- {
- return Equals(obj as Type);
- }
-
- public override int GetHashCode()
- {
- Type type = this.UnderlyingSystemType;
- return ReferenceEquals(type, this) ? base.GetHashCode() : type.GetHashCode();
- }
-
- public virtual Type[] GetGenericArguments()
- {
- return Type.EmptyTypes;
- }
-
- public virtual CustomModifiers[] __GetGenericArgumentsCustomModifiers()
- {
- return Empty<CustomModifiers>.Array;
- }
-
- [Obsolete("Please use __GetGenericArgumentsCustomModifiers() instead")]
- public Type[][] __GetGenericArgumentsRequiredCustomModifiers()
- {
- CustomModifiers[] customModifiers = __GetGenericArgumentsCustomModifiers();
- Type[][] array = new Type[customModifiers.Length][];
- for (int i = 0; i < array.Length; i++)
- {
- array[i] = customModifiers[i].GetRequired();
- }
- return array;
- }
-
- [Obsolete("Please use __GetGenericArgumentsCustomModifiers() instead")]
- public Type[][] __GetGenericArgumentsOptionalCustomModifiers()
- {
- CustomModifiers[] customModifiers = __GetGenericArgumentsCustomModifiers();
- Type[][] array = new Type[customModifiers.Length][];
- for (int i = 0; i < array.Length; i++)
- {
- array[i] = customModifiers[i].GetOptional();
- }
- return array;
- }
-
- public virtual Type GetGenericTypeDefinition()
- {
- throw new InvalidOperationException();
- }
-
- public virtual StructLayoutAttribute StructLayoutAttribute
- {
- get { return null; }
- }
-
- public virtual bool __GetLayout(out int packingSize, out int typeSize)
- {
- packingSize = 0;
- typeSize = 0;
- return false;
- }
-
- public virtual bool IsGenericType
- {
- get { return false; }
- }
-
- public virtual bool IsGenericTypeDefinition
- {
- get { return false; }
- }
-
- // .NET 4.5 API
- public virtual bool IsConstructedGenericType
- {
- get { return false; }
- }
-
- public virtual bool ContainsGenericParameters
- {
- get
- {
- if (this.IsGenericParameter)
- {
- return true;
- }
- foreach (Type arg in this.GetGenericArguments())
- {
- if (arg.ContainsGenericParameters)
- {
- return true;
- }
- }
- return false;
- }
- }
-
- public virtual Type[] GetGenericParameterConstraints()
- {
- throw new InvalidOperationException();
- }
-
- public virtual GenericParameterAttributes GenericParameterAttributes
- {
- get { throw new InvalidOperationException(); }
- }
-
- public virtual int GetArrayRank()
- {
- throw new NotSupportedException();
- }
-
- public virtual int[] __GetArraySizes()
- {
- throw new NotSupportedException();
- }
-
- public virtual int[] __GetArrayLowerBounds()
- {
- throw new NotSupportedException();
- }
-
- // .NET 4.0 API
- public virtual Type GetEnumUnderlyingType()
- {
- if (!this.IsEnum)
- {
- throw new ArgumentException();
- }
- CheckBaked();
- return GetEnumUnderlyingTypeImpl();
- }
-
- internal Type GetEnumUnderlyingTypeImpl()
- {
- foreach (FieldInfo field in __GetDeclaredFields())
- {
- if (!field.IsStatic)
- {
- // the CLR assumes that an enum has only one instance field, so we can do the same
- return field.FieldType;
- }
- }
- throw new InvalidOperationException();
- }
-
- public override string ToString()
- {
- return FullName;
- }
-
- public abstract string FullName
- {
- get;
- }
-
- protected string GetFullName()
- {
- string ns = TypeNameParser.Escape(this.__Namespace);
- Type decl = this.DeclaringType;
- if (decl == null)
- {
- if (ns == null)
- {
- return this.Name;
- }
- else
- {
- return ns + "." + this.Name;
- }
- }
- else
- {
- if (ns == null)
- {
- return decl.FullName + "+" + this.Name;
- }
- else
- {
- return decl.FullName + "+" + ns + "." + this.Name;
- }
- }
- }
-
- internal virtual bool IsModulePseudoType
- {
- get { return false; }
- }
-
- internal virtual Type GetGenericTypeArgument(int index)
- {
- throw new InvalidOperationException();
- }
-
- public MemberInfo[] GetDefaultMembers()
- {
- Type defaultMemberAttribute = this.Module.universe.Import(typeof(System.Reflection.DefaultMemberAttribute));
- foreach (CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(this))
- {
- if (cad.Constructor.DeclaringType.Equals(defaultMemberAttribute))
- {
- return GetMember((string)cad.ConstructorArguments[0].Value);
- }
- }
- return Empty<MemberInfo>.Array;
- }
-
- public MemberInfo[] GetMember(string name)
- {
- return GetMember(name, BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static);
- }
-
- public MemberInfo[] GetMember(string name, BindingFlags bindingAttr)
- {
- return GetMember(name, MemberTypes.All, bindingAttr);
- }
-
- public MemberInfo[] GetMembers()
- {
- return GetMembers(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static);
- }
-
- public MemberInfo[] GetMembers(BindingFlags bindingAttr)
- {
- List<MemberInfo> members = new List<MemberInfo>();
- members.AddRange(GetConstructors(bindingAttr));
- members.AddRange(GetMethods(bindingAttr));
- members.AddRange(GetFields(bindingAttr));
- members.AddRange(GetProperties(bindingAttr));
- members.AddRange(GetEvents(bindingAttr));
- members.AddRange(GetNestedTypes(bindingAttr));
- return members.ToArray();
- }
-
- public MemberInfo[] GetMember(string name, MemberTypes type, BindingFlags bindingAttr)
- {
- MemberFilter filter;
- if ((bindingAttr & BindingFlags.IgnoreCase) != 0)
- {
- name = name.ToLowerInvariant();
- filter = delegate(MemberInfo member, object filterCriteria) { return member.Name.ToLowerInvariant().Equals(filterCriteria); };
- }
- else
- {
- filter = delegate(MemberInfo member, object filterCriteria) { return member.Name.Equals(filterCriteria); };
- }
- return FindMembers(type, bindingAttr, filter, name);
- }
-
- private static void AddMembers(List<MemberInfo> list, MemberFilter filter, object filterCriteria, MemberInfo[] members)
- {
- foreach (MemberInfo member in members)
- {
- if (filter == null || filter(member, filterCriteria))
- {
- list.Add(member);
- }
- }
- }
-
- public MemberInfo[] FindMembers(MemberTypes memberType, BindingFlags bindingAttr, MemberFilter filter, object filterCriteria)
- {
- List<MemberInfo> members = new List<MemberInfo>();
- if ((memberType & MemberTypes.Constructor) != 0)
- {
- AddMembers(members, filter, filterCriteria, GetConstructors(bindingAttr));
- }
- if ((memberType & MemberTypes.Method) != 0)
- {
- AddMembers(members, filter, filterCriteria, GetMethods(bindingAttr));
- }
- if ((memberType & MemberTypes.Field) != 0)
- {
- AddMembers(members, filter, filterCriteria, GetFields(bindingAttr));
- }
- if ((memberType & MemberTypes.Property) != 0)
- {
- AddMembers(members, filter, filterCriteria, GetProperties(bindingAttr));
- }
- if ((memberType & MemberTypes.Event) != 0)
- {
- AddMembers(members, filter, filterCriteria, GetEvents(bindingAttr));
- }
- if ((memberType & MemberTypes.NestedType) != 0)
- {
- AddMembers(members, filter, filterCriteria, GetNestedTypes(bindingAttr));
- }
- return members.ToArray();
- }
-
- private MemberInfo[] GetMembers<T>()
- {
- if (typeof(T) == typeof(ConstructorInfo) || typeof(T) == typeof(MethodInfo))
- {
- return __GetDeclaredMethods();
- }
- else if (typeof(T) == typeof(FieldInfo))
- {
- return __GetDeclaredFields();
- }
- else if (typeof(T) == typeof(PropertyInfo))
- {
- return __GetDeclaredProperties();
- }
- else if (typeof(T) == typeof(EventInfo))
- {
- return __GetDeclaredEvents();
- }
- else if (typeof(T) == typeof(Type))
- {
- return __GetDeclaredTypes();
- }
- else
- {
- throw new InvalidOperationException();
- }
- }
-
- private T[] GetMembers<T>(BindingFlags flags)
- where T : MemberInfo
- {
- CheckBaked();
- List<T> list = new List<T>();
- foreach (MemberInfo member in GetMembers<T>())
- {
- if (member is T && member.BindingFlagsMatch(flags))
- {
- list.Add((T)member);
- }
- }
- if ((flags & BindingFlags.DeclaredOnly) == 0)
- {
- for (Type type = this.BaseType; type != null; type = type.BaseType)
- {
- type.CheckBaked();
- foreach (MemberInfo member in type.GetMembers<T>())
- {
- if (member is T && member.BindingFlagsMatchInherited(flags))
- {
- list.Add((T)member.SetReflectedType(this));
- }
- }
- }
- }
- return list.ToArray();
- }
-
- private T GetMemberByName<T>(string name, BindingFlags flags, Predicate<T> filter)
- where T : MemberInfo
- {
- CheckBaked();
- if ((flags & BindingFlags.IgnoreCase) != 0)
- {
- name = name.ToLowerInvariant();
- }
- T found = null;
- foreach (MemberInfo member in GetMembers<T>())
- {
- if (member is T && member.BindingFlagsMatch(flags))
- {
- string memberName = member.Name;
- if ((flags & BindingFlags.IgnoreCase) != 0)
- {
- memberName = memberName.ToLowerInvariant();
- }
- if (memberName == name && (filter == null || filter((T)member)))
- {
- if (found != null)
- {
- throw new AmbiguousMatchException();
- }
- found = (T)member;
- }
- }
- }
- if ((flags & BindingFlags.DeclaredOnly) == 0)
- {
- for (Type type = this.BaseType; (found == null || typeof(T) == typeof(MethodInfo)) && type != null; type = type.BaseType)
- {
- type.CheckBaked();
- foreach (MemberInfo member in type.GetMembers<T>())
- {
- if (member is T && member.BindingFlagsMatchInherited(flags))
- {
- string memberName = member.Name;
- if ((flags & BindingFlags.IgnoreCase) != 0)
- {
- memberName = memberName.ToLowerInvariant();
- }
- if (memberName == name && (filter == null || filter((T)member)))
- {
- if (found != null)
- {
- MethodInfo mi;
- // TODO does this depend on HideBySig vs HideByName?
- if ((mi = found as MethodInfo) != null
- && mi.MethodSignature.MatchParameterTypes(((MethodBase)member).MethodSignature))
- {
- continue;
- }
- throw new AmbiguousMatchException();
- }
- found = (T)member.SetReflectedType(this);
- }
- }
- }
- }
- }
- return found;
- }
-
- private T GetMemberByName<T>(string name, BindingFlags flags)
- where T : MemberInfo
- {
- return GetMemberByName<T>(name, flags, null);
- }
-
- public EventInfo GetEvent(string name)
- {
- return GetEvent(name, BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static);
- }
-
- public EventInfo GetEvent(string name, BindingFlags bindingAttr)
- {
- return GetMemberByName<EventInfo>(name, bindingAttr);
- }
-
- public EventInfo[] GetEvents()
- {
- return GetEvents(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static);
- }
-
- public EventInfo[] GetEvents(BindingFlags bindingAttr)
- {
- return GetMembers<EventInfo>(bindingAttr);
- }
-
- public FieldInfo GetField(string name)
- {
- return GetField(name, BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static);
- }
-
- public FieldInfo GetField(string name, BindingFlags bindingAttr)
- {
- return GetMemberByName<FieldInfo>(name, bindingAttr);
- }
-
- public FieldInfo[] GetFields()
- {
- return GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance);
- }
-
- public FieldInfo[] GetFields(BindingFlags bindingAttr)
- {
- return GetMembers<FieldInfo>(bindingAttr);
- }
-
- public Type[] GetInterfaces()
- {
- List<Type> list = new List<Type>();
- for (Type type = this; type != null; type = type.BaseType)
- {
- AddInterfaces(list, type);
- }
- return list.ToArray();
- }
-
- private static void AddInterfaces(List<Type> list, Type type)
- {
- foreach (Type iface in type.__GetDeclaredInterfaces())
- {
- if (!list.Contains(iface))
- {
- list.Add(iface);
- AddInterfaces(list, iface);
- }
- }
- }
-
- public MethodInfo[] GetMethods(BindingFlags bindingAttr)
- {
- CheckBaked();
- List<MethodInfo> list = new List<MethodInfo>();
- foreach (MethodBase mb in __GetDeclaredMethods())
- {
- MethodInfo mi = mb as MethodInfo;
- if (mi != null && mi.BindingFlagsMatch(bindingAttr))
- {
- list.Add(mi);
- }
- }
- if ((bindingAttr & BindingFlags.DeclaredOnly) == 0)
- {
- List<MethodInfo> baseMethods = new List<MethodInfo>();
- foreach (MethodInfo mi in list)
- {
- if (mi.IsVirtual)
- {
- baseMethods.Add(mi.GetBaseDefinition());
- }
- }
- for (Type type = this.BaseType; type != null; type = type.BaseType)
- {
- type.CheckBaked();
- foreach (MethodBase mb in type.__GetDeclaredMethods())
- {
- MethodInfo mi = mb as MethodInfo;
- if (mi != null && mi.BindingFlagsMatchInherited(bindingAttr))
- {
- if (mi.IsVirtual)
- {
- if (baseMethods == null)
- {
- baseMethods = new List<MethodInfo>();
- }
- else if (baseMethods.Contains(mi.GetBaseDefinition()))
- {
- continue;
- }
- baseMethods.Add(mi.GetBaseDefinition());
- }
- list.Add((MethodInfo)mi.SetReflectedType(this));
- }
- }
- }
- }
- return list.ToArray();
- }
-
- public MethodInfo[] GetMethods()
- {
- return GetMethods(BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance);
- }
-
- public MethodInfo GetMethod(string name)
- {
- return GetMethod(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public);
- }
-
- public MethodInfo GetMethod(string name, BindingFlags bindingAttr)
- {
- return GetMemberByName<MethodInfo>(name, bindingAttr);
- }
-
- public MethodInfo GetMethod(string name, Type[] types)
- {
- return GetMethod(name, types, null);
- }
-
- public MethodInfo GetMethod(string name, Type[] types, ParameterModifier[] modifiers)
- {
- return GetMethod(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public, null, types, modifiers);
- }
-
- public MethodInfo GetMethod(string name, BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers)
- {
- // first we try an exact match and only if that fails we fall back to using the binder
- return GetMemberByName<MethodInfo>(name, bindingAttr,
- delegate(MethodInfo method) { return method.MethodSignature.MatchParameterTypes(types); })
- ?? GetMethodWithBinder<MethodInfo>(name, bindingAttr, binder ?? DefaultBinder, types, modifiers);
- }
-
- private T GetMethodWithBinder<T>(string name, BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers)
- where T : MethodBase
- {
- List<MethodBase> list = new List<MethodBase>();
- GetMemberByName<T>(name, bindingAttr, delegate(T method) {
- list.Add(method);
- return false;
- });
- return (T)binder.SelectMethod(bindingAttr, list.ToArray(), types, modifiers);
- }
-
- public MethodInfo GetMethod(string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
- {
- // FXBUG callConvention seems to be ignored
- return GetMethod(name, bindingAttr, binder, types, modifiers);
- }
-
- public ConstructorInfo[] GetConstructors()
- {
- return GetConstructors(BindingFlags.Public | BindingFlags.Instance);
- }
-
- public ConstructorInfo[] GetConstructors(BindingFlags bindingAttr)
- {
- return GetMembers<ConstructorInfo>(bindingAttr | BindingFlags.DeclaredOnly);
- }
-
- public ConstructorInfo GetConstructor(Type[] types)
- {
- return GetConstructor(BindingFlags.Public | BindingFlags.Instance, null, CallingConventions.Standard, types, null);
- }
-
- public ConstructorInfo GetConstructor(BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers)
- {
- ConstructorInfo ci1 = null;
- if ((bindingAttr & BindingFlags.Instance) != 0)
- {
- ci1 = GetConstructorImpl(ConstructorInfo.ConstructorName, bindingAttr, binder, types, modifiers);
- }
- if ((bindingAttr & BindingFlags.Static) != 0)
- {
- ConstructorInfo ci2 = GetConstructorImpl(ConstructorInfo.TypeConstructorName, bindingAttr, binder, types, modifiers);
- if (ci2 != null)
- {
- if (ci1 != null)
- {
- throw new AmbiguousMatchException();
- }
- return ci2;
- }
- }
- return ci1;
- }
-
- private ConstructorInfo GetConstructorImpl(string name, BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers)
- {
- // first we try an exact match and only if that fails we fall back to using the binder
- return GetMemberByName<ConstructorInfo>(name, bindingAttr | BindingFlags.DeclaredOnly,
- delegate(ConstructorInfo ctor) { return ctor.MethodSignature.MatchParameterTypes(types); })
- ?? GetMethodWithBinder<ConstructorInfo>(name, bindingAttr, binder ?? DefaultBinder, types, modifiers);
- }
-
- public ConstructorInfo GetConstructor(BindingFlags bindingAttr, Binder binder, CallingConventions callingConvention, Type[] types, ParameterModifier[] modifiers)
- {
- // FXBUG callConvention seems to be ignored
- return GetConstructor(bindingAttr, binder, types, modifiers);
- }
-
- internal Type ResolveNestedType(TypeName typeName)
- {
- return FindNestedType(typeName) ?? Module.universe.GetMissingTypeOrThrow(Module, this, typeName);
- }
-
- // unlike the public API, this takes the namespace and name into account
- internal virtual Type FindNestedType(TypeName name)
- {
- foreach (Type type in __GetDeclaredTypes())
- {
- if (type.__Namespace == name.Namespace && type.__Name == name.Name)
- {
- return type;
- }
- }
- return null;
- }
-
- internal virtual Type FindNestedTypeIgnoreCase(TypeName lowerCaseName)
- {
- foreach (Type type in __GetDeclaredTypes())
- {
- if (new TypeName(type.__Namespace, type.__Name).ToLowerInvariant() == lowerCaseName)
- {
- return type;
- }
- }
- return null;
- }
-
- public Type GetNestedType(string name)
- {
- return GetNestedType(name, BindingFlags.Public);
- }
-
- public Type GetNestedType(string name, BindingFlags bindingAttr)
- {
- // FXBUG the namespace is ignored, so we can use GetMemberByName
- return GetMemberByName<Type>(name, bindingAttr | BindingFlags.DeclaredOnly);
- }
-
- public Type[] GetNestedTypes()
- {
- return GetNestedTypes(BindingFlags.Public);
- }
-
- public Type[] GetNestedTypes(BindingFlags bindingAttr)
- {
- // FXBUG the namespace is ignored, so we can use GetMember
- return GetMembers<Type>(bindingAttr | BindingFlags.DeclaredOnly);
- }
-
- public PropertyInfo[] GetProperties()
- {
- return GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static);
- }
-
- public PropertyInfo[] GetProperties(BindingFlags bindingAttr)
- {
- return GetMembers<PropertyInfo>(bindingAttr);
- }
-
- public PropertyInfo GetProperty(string name)
- {
- return GetProperty(name, BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static);
- }
-
- public PropertyInfo GetProperty(string name, BindingFlags bindingAttr)
- {
- return GetMemberByName<PropertyInfo>(name, bindingAttr);
- }
-
- public PropertyInfo GetProperty(string name, Type returnType)
- {
- const BindingFlags flags = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static;
- return GetMemberByName<PropertyInfo>(name, flags, delegate(PropertyInfo prop) { return prop.PropertyType.Equals(returnType); })
- ?? GetPropertyWithBinder(name, flags, DefaultBinder, returnType, null, null);
- }
-
- public PropertyInfo GetProperty(string name, Type[] types)
- {
- const BindingFlags flags = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static;
- return GetMemberByName<PropertyInfo>(name, flags, delegate(PropertyInfo prop) { return prop.PropertySignature.MatchParameterTypes(types); })
- ?? GetPropertyWithBinder(name, flags, DefaultBinder, null, types, null);
- }
-
- public PropertyInfo GetProperty(string name, Type returnType, Type[] types)
- {
- return GetProperty(name, returnType, types, null);
- }
-
- public PropertyInfo GetProperty(string name, Type returnType, Type[] types, ParameterModifier[] modifiers)
- {
- return GetProperty(name, BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static, null, returnType, types, modifiers);
- }
-
- public PropertyInfo GetProperty(string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers)
- {
- return GetMemberByName<PropertyInfo>(name, bindingAttr,
- delegate(PropertyInfo prop) {
- return prop.PropertyType.Equals(returnType) && prop.PropertySignature.MatchParameterTypes(types);
- })
- ?? GetPropertyWithBinder(name, bindingAttr, binder ?? DefaultBinder, returnType, types, modifiers);
- }
-
- private PropertyInfo GetPropertyWithBinder(string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers)
- {
- List<PropertyInfo> list = new List<PropertyInfo>();
- GetMemberByName<PropertyInfo>(name, bindingAttr, delegate(PropertyInfo property) {
- list.Add(property);
- return false;
- });
- return binder.SelectProperty(bindingAttr, list.ToArray(), returnType, types, modifiers);
- }
-
- public Type GetInterface(string name)
- {
- return GetInterface(name, false);
- }
-
- public Type GetInterface(string name, bool ignoreCase)
- {
- if (ignoreCase)
- {
- name = name.ToLowerInvariant();
- }
- Type found = null;
- foreach (Type type in GetInterfaces())
- {
- string typeName = type.FullName;
- if (ignoreCase)
- {
- typeName = typeName.ToLowerInvariant();
- }
- if (typeName == name)
- {
- if (found != null)
- {
- throw new AmbiguousMatchException();
- }
- found = type;
- }
- }
- return found;
- }
-
- public Type[] FindInterfaces(TypeFilter filter, object filterCriteria)
- {
- List<Type> list = new List<Type>();
- foreach (Type type in GetInterfaces())
- {
- if (filter(type, filterCriteria))
- {
- list.Add(type);
- }
- }
- return list.ToArray();
- }
-
- public ConstructorInfo TypeInitializer
- {
- get { return GetConstructor(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null); }
- }
-
- public bool IsPrimitive
- {
- get
- {
- Universe u = this.Universe;
- return this == u.System_Boolean
- || this == u.System_Byte
- || this == u.System_SByte
- || this == u.System_Int16
- || this == u.System_UInt16
- || this == u.System_Int32
- || this == u.System_UInt32
- || this == u.System_Int64
- || this == u.System_UInt64
- || this == u.System_IntPtr
- || this == u.System_UIntPtr
- || this == u.System_Char
- || this == u.System_Double
- || this == u.System_Single
- ;
- }
- }
-
- public bool IsEnum
- {
- get
- {
- Type baseType = this.BaseType;
- return baseType != null
- && baseType.IsEnumOrValueType
- && baseType.__Name[0] == 'E';
- }
- }
-
- public bool IsSealed
- {
- get { return (Attributes & TypeAttributes.Sealed) != 0; }
- }
-
- public bool IsAbstract
- {
- get { return (Attributes & TypeAttributes.Abstract) != 0; }
- }
-
- private bool CheckVisibility(TypeAttributes access)
- {
- return (Attributes & TypeAttributes.VisibilityMask) == access;
- }
-
- public bool IsPublic
- {
- get { return CheckVisibility(TypeAttributes.Public); }
- }
-
- public bool IsNestedPublic
- {
- get { return CheckVisibility(TypeAttributes.NestedPublic); }
- }
-
- public bool IsNestedPrivate
- {
- get { return CheckVisibility(TypeAttributes.NestedPrivate); }
- }
-
- public bool IsNestedFamily
- {
- get { return CheckVisibility(TypeAttributes.NestedFamily); }
- }
-
- public bool IsNestedAssembly
- {
- get { return CheckVisibility(TypeAttributes.NestedAssembly); }
- }
-
- public bool IsNestedFamANDAssem
- {
- get { return CheckVisibility(TypeAttributes.NestedFamANDAssem); }
- }
-
- public bool IsNestedFamORAssem
- {
- get { return CheckVisibility(TypeAttributes.NestedFamORAssem); }
- }
-
- public bool IsNotPublic
- {
- get { return CheckVisibility(TypeAttributes.NotPublic); }
- }
-
- public bool IsImport
- {
- get { return (Attributes & TypeAttributes.Import) != 0; }
- }
-
- public bool IsCOMObject
- {
- get { return IsClass && IsImport; }
- }
-
- public bool IsContextful
- {
- get { return IsSubclassOf(this.Module.universe.Import(typeof(ContextBoundObject))); }
- }
-
- public bool IsMarshalByRef
- {
- get { return IsSubclassOf(this.Module.universe.Import(typeof(MarshalByRefObject))); }
- }
-
- public virtual bool IsVisible
- {
- get { return IsPublic || (IsNestedPublic && this.DeclaringType.IsVisible); }
- }
-
- public bool IsAnsiClass
- {
- get { return (Attributes & TypeAttributes.StringFormatMask) == TypeAttributes.AnsiClass; }
- }
-
- public bool IsUnicodeClass
- {
- get { return (Attributes & TypeAttributes.StringFormatMask) == TypeAttributes.UnicodeClass; }
- }
-
- public bool IsAutoClass
- {
- get { return (Attributes & TypeAttributes.StringFormatMask) == TypeAttributes.AutoClass; }
- }
-
- public bool IsAutoLayout
- {
- get { return (Attributes & TypeAttributes.LayoutMask) == TypeAttributes.AutoLayout; }
- }
-
- public bool IsLayoutSequential
- {
- get { return (Attributes & TypeAttributes.LayoutMask) == TypeAttributes.SequentialLayout; }
- }
-
- public bool IsExplicitLayout
- {
- get { return (Attributes & TypeAttributes.LayoutMask) == TypeAttributes.ExplicitLayout; }
- }
-
- public bool IsSpecialName
- {
- get { return (Attributes & TypeAttributes.SpecialName) != 0; }
- }
-
- public bool IsSerializable
- {
- get { return (Attributes & TypeAttributes.Serializable) != 0; }
- }
-
- public bool IsClass
- {
- get { return !IsInterface && !IsValueType; }
- }
-
- public bool IsInterface
- {
- get { return (Attributes & TypeAttributes.Interface) != 0; }
- }
-
- public bool IsNested
- {
- // FXBUG we check the declaring type (like .NET) and this results
- // in IsNested returning true for a generic type parameter
- get { return this.DeclaringType != null; }
- }
-
- public virtual bool __ContainsMissingType
- {
- get
- {
- if (this.__IsMissing)
- {
- return true;
- }
- foreach (Type arg in this.GetGenericArguments())
- {
- if (arg.__ContainsMissingType)
- {
- return true;
- }
- }
- return false;
- }
- }
-
- public Type MakeArrayType()
- {
- return ArrayType.Make(this, new CustomModifiers());
- }
-
- public Type __MakeArrayType(CustomModifiers customModifiers)
- {
- return ArrayType.Make(this, customModifiers);
- }
-
- [Obsolete("Please use __MakeArrayType(CustomModifiers) instead.")]
- public Type __MakeArrayType(Type[] requiredCustomModifiers, Type[] optionalCustomModifiers)
- {
- return __MakeArrayType(CustomModifiers.FromReqOpt(requiredCustomModifiers, optionalCustomModifiers));
- }
-
- public Type MakeArrayType(int rank)
- {
- return __MakeArrayType(rank, new CustomModifiers());
- }
-
- public Type __MakeArrayType(int rank, CustomModifiers customModifiers)
- {
- return MultiArrayType.Make(this, rank, Empty<int>.Array, new int[rank], customModifiers);
- }
-
- [Obsolete("Please use __MakeArrayType(int, CustomModifiers) instead.")]
- public Type __MakeArrayType(int rank, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers)
- {
- return __MakeArrayType(rank, CustomModifiers.FromReqOpt(requiredCustomModifiers, optionalCustomModifiers));
- }
-
- public Type __MakeArrayType(int rank, int[] sizes, int[] lobounds, CustomModifiers customModifiers)
- {
- return MultiArrayType.Make(this, rank, sizes ?? Empty<int>.Array, lobounds ?? Empty<int>.Array, customModifiers);
- }
-
- [Obsolete("Please use __MakeArrayType(int, int[], int[], CustomModifiers) instead.")]
- public Type __MakeArrayType(int rank, int[] sizes, int[] lobounds, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers)
- {
- return __MakeArrayType(rank, sizes, lobounds, CustomModifiers.FromReqOpt(requiredCustomModifiers, optionalCustomModifiers));
- }
-
- public Type MakeByRefType()
- {
- return ByRefType.Make(this, new CustomModifiers());
- }
-
- public Type __MakeByRefType(CustomModifiers customModifiers)
- {
- return ByRefType.Make(this, customModifiers);
- }
-
- [Obsolete("Please use __MakeByRefType(CustomModifiers) instead.")]
- public Type __MakeByRefType(Type[] requiredCustomModifiers, Type[] optionalCustomModifiers)
- {
- return __MakeByRefType(CustomModifiers.FromReqOpt(requiredCustomModifiers, optionalCustomModifiers));
- }
-
- public Type MakePointerType()
- {
- return PointerType.Make(this, new CustomModifiers());
- }
-
- public Type __MakePointerType(CustomModifiers customModifiers)
- {
- return PointerType.Make(this, customModifiers);
- }
-
- [Obsolete("Please use __MakeByRefType(CustomModifiers) instead.")]
- public Type __MakePointerType(Type[] requiredCustomModifiers, Type[] optionalCustomModifiers)
- {
- return __MakePointerType(CustomModifiers.FromReqOpt(requiredCustomModifiers, optionalCustomModifiers));
- }
-
- public Type MakeGenericType(params Type[] typeArguments)
- {
- return __MakeGenericType(typeArguments, null);
- }
-
- public Type __MakeGenericType(Type[] typeArguments, CustomModifiers[] customModifiers)
- {
- if (!this.__IsMissing && !this.IsGenericTypeDefinition)
- {
- throw new InvalidOperationException();
- }
- return GenericTypeInstance.Make(this, Util.Copy(typeArguments), customModifiers == null ? null : (CustomModifiers[])customModifiers.Clone());
- }
-
- [Obsolete("Please use __MakeGenericType(Type[], CustomModifiers[]) instead.")]
- public Type __MakeGenericType(Type[] typeArguments, Type[][] requiredCustomModifiers, Type[][] optionalCustomModifiers)
- {
- if (!this.__IsMissing && !this.IsGenericTypeDefinition)
- {
- throw new InvalidOperationException();
- }
- CustomModifiers[] mods = null;
- if (requiredCustomModifiers != null || optionalCustomModifiers != null)
- {
- mods = new CustomModifiers[typeArguments.Length];
- for (int i = 0; i < mods.Length; i++)
- {
- mods[i] = CustomModifiers.FromReqOpt(Util.NullSafeElementAt(requiredCustomModifiers, i), Util.NullSafeElementAt(optionalCustomModifiers, i));
- }
- }
- return GenericTypeInstance.Make(this, Util.Copy(typeArguments), mods);
- }
-
- public static System.Type __GetSystemType(TypeCode typeCode)
- {
- switch (typeCode)
- {
- case TypeCode.Boolean:
- return typeof(System.Boolean);
- case TypeCode.Byte:
- return typeof(System.Byte);
- case TypeCode.Char:
- return typeof(System.Char);
- case TypeCode.DBNull:
- return typeof(System.DBNull);
- case TypeCode.DateTime:
- return typeof(System.DateTime);
- case TypeCode.Decimal:
- return typeof(System.Decimal);
- case TypeCode.Double:
- return typeof(System.Double);
- case TypeCode.Empty:
- return null;
- case TypeCode.Int16:
- return typeof(System.Int16);
- case TypeCode.Int32:
- return typeof(System.Int32);
- case TypeCode.Int64:
- return typeof(System.Int64);
- case TypeCode.Object:
- return typeof(System.Object);
- case TypeCode.SByte:
- return typeof(System.SByte);
- case TypeCode.Single:
- return typeof(System.Single);
- case TypeCode.String:
- return typeof(System.String);
- case TypeCode.UInt16:
- return typeof(System.UInt16);
- case TypeCode.UInt32:
- return typeof(System.UInt32);
- case TypeCode.UInt64:
- return typeof(System.UInt64);
- default:
- throw new ArgumentOutOfRangeException();
- }
- }
-
- public static TypeCode GetTypeCode(Type type)
- {
- if (type == null)
- {
- return TypeCode.Empty;
- }
- if (!type.__IsMissing && type.IsEnum)
- {
- type = type.GetEnumUnderlyingType();
- }
- Universe u = type.Module.universe;
- if (type == u.System_Boolean)
- {
- return TypeCode.Boolean;
- }
- else if (type == u.System_Char)
- {
- return TypeCode.Char;
- }
- else if (type == u.System_SByte)
- {
- return TypeCode.SByte;
- }
- else if (type == u.System_Byte)
- {
- return TypeCode.Byte;
- }
- else if (type == u.System_Int16)
- {
- return TypeCode.Int16;
- }
- else if (type == u.System_UInt16)
- {
- return TypeCode.UInt16;
- }
- else if (type == u.System_Int32)
- {
- return TypeCode.Int32;
- }
- else if (type == u.System_UInt32)
- {
- return TypeCode.UInt32;
- }
- else if (type == u.System_Int64)
- {
- return TypeCode.Int64;
- }
- else if (type == u.System_UInt64)
- {
- return TypeCode.UInt64;
- }
- else if (type == u.System_Single)
- {
- return TypeCode.Single;
- }
- else if (type == u.System_Double)
- {
- return TypeCode.Double;
- }
- else if (type == u.System_DateTime)
- {
- return TypeCode.DateTime;
- }
- else if (type == u.System_DBNull)
- {
- return TypeCode.DBNull;
- }
- else if (type == u.System_Decimal)
- {
- return TypeCode.Decimal;
- }
- else if (type == u.System_String)
- {
- return TypeCode.String;
- }
- else if (type.__IsMissing)
- {
- throw new MissingMemberException(type);
- }
- else
- {
- return TypeCode.Object;
- }
- }
-
- public Assembly Assembly
- {
- get { return Module.Assembly; }
- }
-
- public bool IsAssignableFrom(Type type)
- {
- if (this.Equals(type))
- {
- return true;
- }
- else if (type == null)
- {
- return false;
- }
- else if (this.IsArray && type.IsArray)
- {
- if (this.GetArrayRank() != type.GetArrayRank())
- {
- return false;
- }
- else if (this.__IsVector && !type.__IsVector)
- {
- return false;
- }
- Type e1 = this.GetElementType();
- Type e2 = type.GetElementType();
- return e1.IsValueType == e2.IsValueType && e1.IsAssignableFrom(e2);
- }
- else if (this.IsCovariant(type))
- {
- return true;
- }
- else if (this.IsSealed)
- {
- return false;
- }
- else if (this.IsInterface)
- {
- foreach (Type iface in type.GetInterfaces())
- {
- if (this.Equals(iface) || this.IsCovariant(iface))
- {
- return true;
- }
- }
- return false;
- }
- else if (type.IsInterface)
- {
- return this == this.Module.universe.System_Object;
- }
- else if (type.IsPointer)
- {
- return this == this.Module.universe.System_Object || this == this.Module.universe.System_ValueType;
- }
- else
- {
- return type.IsSubclassOf(this);
- }
- }
-
- private bool IsCovariant(Type other)
- {
- if (this.IsConstructedGenericType
- && other.IsConstructedGenericType
- && this.GetGenericTypeDefinition() == other.GetGenericTypeDefinition())
- {
- Type[] typeParameters = GetGenericTypeDefinition().GetGenericArguments();
- for (int i = 0; i < typeParameters.Length; i++)
- {
- Type t1 = this.GetGenericTypeArgument(i);
- Type t2 = other.GetGenericTypeArgument(i);
- if (t1.IsValueType != t2.IsValueType)
- {
- return false;
- }
- switch (typeParameters[i].GenericParameterAttributes & GenericParameterAttributes.VarianceMask)
- {
- case GenericParameterAttributes.Covariant:
- if (!t1.IsAssignableFrom(t2))
- {
- return false;
- }
- break;
- case GenericParameterAttributes.Contravariant:
- if (!t2.IsAssignableFrom(t1))
- {
- return false;
- }
- break;
- case GenericParameterAttributes.None:
- if (t1 != t2)
- {
- return false;
- }
- break;
- }
- }
- return true;
- }
- return false;
- }
-
- public bool IsSubclassOf(Type type)
- {
- Type thisType = this.BaseType;
- while (thisType != null)
- {
- if (thisType.Equals(type))
- {
- return true;
- }
- thisType = thisType.BaseType;
- }
- return false;
- }
-
- // This returns true if this type directly (i.e. not inherited from the base class) implements the interface.
- // Note that a complicating factor is that the interface itself can be implemented by an interface that extends it.
- private bool IsDirectlyImplementedInterface(Type interfaceType)
- {
- foreach (Type iface in __GetDeclaredInterfaces())
- {
- if (interfaceType.IsAssignableFrom(iface))
- {
- return true;
- }
- }
- return false;
- }
-
- public InterfaceMapping GetInterfaceMap(Type interfaceType)
- {
- CheckBaked();
- InterfaceMapping map = new InterfaceMapping();
- if (!IsDirectlyImplementedInterface(interfaceType))
- {
- Type baseType = this.BaseType;
- if (baseType == null)
- {
- throw new ArgumentException();
- }
- else
- {
- map = baseType.GetInterfaceMap(interfaceType);
- }
- }
- else
- {
- map.InterfaceMethods = interfaceType.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public);
- map.InterfaceType = interfaceType;
- map.TargetMethods = new MethodInfo[map.InterfaceMethods.Length];
- FillInExplicitInterfaceMethods(map.InterfaceMethods, map.TargetMethods);
- MethodInfo[] methods = GetMethods(BindingFlags.Instance | BindingFlags.Public);
- for (int i = 0; i < map.TargetMethods.Length; i++)
- {
- if (map.TargetMethods[i] == null)
- {
- // TODO use proper method resolution (also take into account that no implicit base class implementation is used across assembly boundaries)
- for (int j = 0; j < methods.Length; j++)
- {
- if (methods[j].Name == map.InterfaceMethods[i].Name
- && methods[j].MethodSignature.Equals(map.InterfaceMethods[i].MethodSignature))
- {
- map.TargetMethods[i] = methods[j];
- }
- }
- }
- }
- for (Type baseType = this.BaseType; baseType != null && interfaceType.IsAssignableFrom(baseType); baseType = baseType.BaseType)
- {
- baseType.FillInExplicitInterfaceMethods(map.InterfaceMethods, map.TargetMethods);
- }
- }
- map.TargetType = this;
- return map;
- }
-
- internal void FillInExplicitInterfaceMethods(MethodInfo[] interfaceMethods, MethodInfo[] targetMethods)
- {
- __MethodImplMap impl = __GetMethodImplMap();
- for (int i = 0; i < impl.MethodDeclarations.Length; i++)
- {
- for (int j = 0; j < impl.MethodDeclarations[i].Length; j++)
- {
- int index = Array.IndexOf(interfaceMethods, impl.MethodDeclarations[i][j]);
- if (index != -1 && targetMethods[index] == null)
- {
- targetMethods[index] = impl.MethodBodies[i];
- }
- }
- }
- }
-
- Type IGenericContext.GetGenericTypeArgument(int index)
- {
- return GetGenericTypeArgument(index);
- }
-
- Type IGenericContext.GetGenericMethodArgument(int index)
- {
- throw new BadImageFormatException();
- }
-
- Type IGenericBinder.BindTypeParameter(Type type)
- {
- return GetGenericTypeArgument(type.GenericParameterPosition);
- }
-
- Type IGenericBinder.BindMethodParameter(Type type)
- {
- throw new BadImageFormatException();
- }
-
- internal virtual Type BindTypeParameters(IGenericBinder binder)
- {
- if (IsGenericTypeDefinition)
- {
- Type[] args = GetGenericArguments();
- Type.InplaceBindTypeParameters(binder, args);
- return GenericTypeInstance.Make(this, args, null);
- }
- else
- {
- return this;
- }
- }
-
- private static void InplaceBindTypeParameters(IGenericBinder binder, Type[] types)
- {
- for (int i = 0; i < types.Length; i++)
- {
- types[i] = types[i].BindTypeParameters(binder);
- }
- }
-
- internal virtual MethodBase FindMethod(string name, MethodSignature signature)
- {
- foreach (MethodBase method in __GetDeclaredMethods())
- {
- if (method.Name == name && method.MethodSignature.Equals(signature))
- {
- return method;
- }
- }
- return null;
- }
-
- internal virtual FieldInfo FindField(string name, FieldSignature signature)
- {
- foreach (FieldInfo field in __GetDeclaredFields())
- {
- if (field.Name == name && field.FieldSignature.Equals(signature))
- {
- return field;
- }
- }
- return null;
- }
-
- internal bool IsAllowMultipleCustomAttribute
- {
- get
- {
- IList<CustomAttributeData> cad = CustomAttributeData.__GetCustomAttributes(this, this.Module.universe.System_AttributeUsageAttribute, false);
- if (cad.Count == 1)
- {
- foreach (CustomAttributeNamedArgument arg in cad[0].NamedArguments)
- {
- if (arg.MemberInfo.Name == "AllowMultiple")
- {
- return (bool)arg.TypedValue.Value;
- }
- }
- }
- return false;
- }
- }
-
- internal bool IsPseudoCustomAttribute
- {
- get
- {
- Universe u = this.Module.universe;
- return this == u.System_NonSerializedAttribute
- || this == u.System_SerializableAttribute
- || this == u.System_Runtime_InteropServices_DllImportAttribute
- || this == u.System_Runtime_InteropServices_FieldOffsetAttribute
- || this == u.System_Runtime_InteropServices_InAttribute
- || this == u.System_Runtime_InteropServices_MarshalAsAttribute
- || this == u.System_Runtime_InteropServices_OutAttribute
- || this == u.System_Runtime_InteropServices_StructLayoutAttribute
- || this == u.System_Runtime_InteropServices_OptionalAttribute
- || this == u.System_Runtime_InteropServices_PreserveSigAttribute
- || this == u.System_Runtime_InteropServices_ComImportAttribute
- || this == u.System_Runtime_CompilerServices_SpecialNameAttribute
- || this == u.System_Runtime_CompilerServices_MethodImplAttribute
- ;
- }
- }
-
- internal Type MarkNotValueType()
- {
- typeFlags |= TypeFlags.NotValueType;
- return this;
- }
-
- internal Type MarkValueType()
- {
- typeFlags |= TypeFlags.ValueType;
- return this;
- }
-
- internal ConstructorInfo GetPseudoCustomAttributeConstructor(params Type[] parameterTypes)
- {
- Universe u = this.Module.universe;
- MethodSignature methodSig = MethodSignature.MakeFromBuilder(u.System_Void, parameterTypes, new PackedCustomModifiers(), CallingConventions.Standard | CallingConventions.HasThis, 0);
- MethodBase mb =
- FindMethod(".ctor", methodSig) ??
- u.GetMissingMethodOrThrow(this, ".ctor", methodSig);
- return (ConstructorInfo)mb;
- }
-
- public MethodBase __CreateMissingMethod(string name, CallingConventions callingConvention, Type returnType, CustomModifiers returnTypeCustomModifiers, Type[] parameterTypes, CustomModifiers[] parameterTypeCustomModifiers)
- {
- return CreateMissingMethod(name, callingConvention, returnType, parameterTypes, PackedCustomModifiers.CreateFromExternal(returnTypeCustomModifiers, parameterTypeCustomModifiers, parameterTypes.Length));
- }
-
- private MethodBase CreateMissingMethod(string name, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, PackedCustomModifiers customModifiers)
- {
- MethodSignature sig = new MethodSignature(
- returnType ?? this.Module.universe.System_Void,
- Util.Copy(parameterTypes),
- customModifiers,
- callingConvention,
- 0);
- MethodInfo method = new MissingMethod(this, name, sig);
- if (name == ".ctor" || name == ".cctor")
- {
- return new ConstructorInfoImpl(method);
- }
- return method;
- }
-
- [Obsolete("Please use __CreateMissingMethod(string, CallingConventions, Type, CustomModifiers, Type[], CustomModifiers[]) instead")]
- public MethodBase __CreateMissingMethod(string name, CallingConventions callingConvention, Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers)
- {
- return CreateMissingMethod(name, callingConvention, returnType, parameterTypes, PackedCustomModifiers.CreateFromExternal(returnTypeOptionalCustomModifiers, returnTypeRequiredCustomModifiers, parameterTypeOptionalCustomModifiers, parameterTypeRequiredCustomModifiers, parameterTypes.Length));
- }
-
- public FieldInfo __CreateMissingField(string name, Type fieldType, CustomModifiers customModifiers)
- {
- return new MissingField(this, name, FieldSignature.Create(fieldType, customModifiers));
- }
-
- [Obsolete("Please use __CreateMissingField(string, Type, CustomModifiers) instead")]
- public FieldInfo __CreateMissingField(string name, Type fieldType, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers)
- {
- return __CreateMissingField(name, fieldType, CustomModifiers.FromReqOpt(requiredCustomModifiers, optionalCustomModifiers));
- }
-
- public PropertyInfo __CreateMissingProperty(string name, CallingConventions callingConvention, Type propertyType, CustomModifiers propertyTypeCustomModifiers, Type[] parameterTypes, CustomModifiers[] parameterTypeCustomModifiers)
- {
- PropertySignature sig = PropertySignature.Create(callingConvention,
- propertyType,
- parameterTypes,
- PackedCustomModifiers.CreateFromExternal(propertyTypeCustomModifiers, parameterTypeCustomModifiers, Util.NullSafeLength(parameterTypes)));
- return new MissingProperty(this, name, sig);
- }
-
- internal virtual Type SetMetadataTokenForMissing(int token)
- {
- return this;
- }
-
- protected void MarkEnumOrValueType(string typeNamespace, string typeName)
- {
- // we assume that mscorlib won't have nested types with these names,
- // so we don't check that we're not a nested type
- if (typeNamespace == "System"
- && (typeName == "Enum" || typeName == "ValueType"))
- {
- typeFlags |= TypeFlags.PotentialEnumOrValueType;
- }
- }
-
- private bool ResolvePotentialEnumOrValueType()
- {
- if (this.Assembly == this.Universe.Mscorlib
- || this.Assembly.GetName().Name.Equals("mscorlib", StringComparison.OrdinalIgnoreCase)
- // check if mscorlib forwards the type (.NETCore profile reference mscorlib forwards System.Enum and System.ValueType to System.Runtime.dll)
- || this.Universe.Mscorlib.FindType(new TypeName(__Namespace, __Name)) == this)
- {
- typeFlags = (typeFlags & ~TypeFlags.PotentialEnumOrValueType) | TypeFlags.EnumOrValueType;
- return true;
- }
- else
- {
- typeFlags &= ~TypeFlags.PotentialEnumOrValueType;
- return false;
- }
- }
-
- private bool IsEnumOrValueType
- {
- get
- {
- return (typeFlags & (TypeFlags.EnumOrValueType | TypeFlags.PotentialEnumOrValueType)) != 0
- && ((typeFlags & TypeFlags.EnumOrValueType) != 0 || ResolvePotentialEnumOrValueType());
- }
- }
-
- internal virtual Universe Universe
- {
- get { return Module.universe; }
- }
-
- internal sealed override bool BindingFlagsMatch(BindingFlags flags)
- {
- return BindingFlagsMatch(IsNestedPublic, flags, BindingFlags.Public, BindingFlags.NonPublic);
- }
-
- internal sealed override MemberInfo SetReflectedType(Type type)
- {
- throw new InvalidOperationException();
- }
-
- internal override int GetCurrentToken()
- {
- return this.MetadataToken;
- }
-
- internal sealed override List<CustomAttributeData> GetPseudoCustomAttributes(Type attributeType)
- {
- // types don't have pseudo custom attributes
- return null;
- }
-
- // in .NET this is an extension method, but we target .NET 2.0, so we have an instance method
- public TypeInfo GetTypeInfo()
- {
- TypeInfo type = this as TypeInfo;
- if (type == null)
- {
- throw new MissingMemberException(this);
- }
- return type;
- }
- }
-
- abstract class ElementHolderType : TypeInfo
- {
- protected readonly Type elementType;
- private int token;
- private readonly CustomModifiers mods;
-
- protected ElementHolderType(Type elementType, CustomModifiers mods)
- {
- this.elementType = elementType;
- this.mods = mods;
- }
-
- protected bool EqualsHelper(ElementHolderType other)
- {
- return other != null
- && other.elementType.Equals(elementType)
- && other.mods.Equals(mods);
- }
-
- public override CustomModifiers __GetCustomModifiers()
- {
- return mods;
- }
-
- public sealed override string Name
- {
- get { return elementType.Name + GetSuffix(); }
- }
-
- public sealed override string Namespace
- {
- get { return elementType.Namespace; }
- }
-
- public sealed override string FullName
- {
- get { return elementType.FullName + GetSuffix(); }
- }
-
- public sealed override string ToString()
- {
- return elementType.ToString() + GetSuffix();
- }
-
- public sealed override Type GetElementType()
- {
- return elementType;
- }
-
- public sealed override bool HasElementType
- {
- get { return true; }
- }
-
- public sealed override Module Module
- {
- get { return elementType.Module; }
- }
-
- internal sealed override int GetModuleBuilderToken()
- {
- if (token == 0)
- {
- token = ((ModuleBuilder)elementType.Module).ImportType(this);
- }
- return token;
- }
-
- public sealed override bool ContainsGenericParameters
- {
- get
- {
- Type type = elementType;
- while (type.HasElementType)
- {
- type = type.GetElementType();
- }
- return type.ContainsGenericParameters;
- }
- }
-
- public sealed override bool __ContainsMissingType
- {
- get
- {
- Type type = elementType;
- while (type.HasElementType)
- {
- type = type.GetElementType();
- }
- return type.__ContainsMissingType;
- }
- }
-
- internal sealed override Type BindTypeParameters(IGenericBinder binder)
- {
- Type type = elementType.BindTypeParameters(binder);
- CustomModifiers mods = this.mods.Bind(binder);
- if (ReferenceEquals(type, elementType)
- && mods.Equals(this.mods))
- {
- return this;
- }
- return Wrap(type, mods);
- }
-
- internal override void CheckBaked()
- {
- elementType.CheckBaked();
- }
-
- internal sealed override Universe Universe
- {
- get { return elementType.Universe; }
- }
-
- internal sealed override bool IsBaked
- {
- get { return elementType.IsBaked; }
- }
-
- internal sealed override int GetCurrentToken()
- {
- // we don't have a token, so we return 0 (which is never a valid token)
- return 0;
- }
-
- internal abstract string GetSuffix();
-
- protected abstract Type Wrap(Type type, CustomModifiers mods);
- }
-
- sealed class ArrayType : ElementHolderType
- {
- internal static Type Make(Type type, CustomModifiers mods)
- {
- return type.Universe.CanonicalizeType(new ArrayType(type, mods));
- }
-
- private ArrayType(Type type, CustomModifiers mods)
- : base(type, mods)
- {
- }
-
- public override Type BaseType
- {
- get { return elementType.Module.universe.System_Array; }
- }
-
- public override Type[] __GetDeclaredInterfaces()
- {
- return new Type[] {
- this.Module.universe.Import(typeof(IList<>)).MakeGenericType(elementType),
- this.Module.universe.Import(typeof(ICollection<>)).MakeGenericType(elementType),
- this.Module.universe.Import(typeof(IEnumerable<>)).MakeGenericType(elementType)
- };
- }
-
- public override MethodBase[] __GetDeclaredMethods()
- {
- Type[] int32 = new Type[] { this.Module.universe.System_Int32 };
- List<MethodBase> list = new List<MethodBase>();
- list.Add(new BuiltinArrayMethod(this.Module, this, "Set", CallingConventions.Standard | CallingConventions.HasThis, this.Module.universe.System_Void, new Type[] { this.Module.universe.System_Int32, elementType }));
- list.Add(new BuiltinArrayMethod(this.Module, this, "Address", CallingConventions.Standard | CallingConventions.HasThis, elementType.MakeByRefType(), int32));
- list.Add(new BuiltinArrayMethod(this.Module, this, "Get", CallingConventions.Standard | CallingConventions.HasThis, elementType, int32));
- list.Add(new ConstructorInfoImpl(new BuiltinArrayMethod(this.Module, this, ".ctor", CallingConventions.Standard | CallingConventions.HasThis, this.Module.universe.System_Void, int32)));
- for (Type type = elementType; type.__IsVector; type = type.GetElementType())
- {
- Array.Resize(ref int32, int32.Length + 1);
- int32[int32.Length - 1] = int32[0];
- list.Add(new ConstructorInfoImpl(new BuiltinArrayMethod(this.Module, this, ".ctor", CallingConventions.Standard | CallingConventions.HasThis, this.Module.universe.System_Void, int32)));
- }
- return list.ToArray();
- }
-
- public override TypeAttributes Attributes
- {
- get { return TypeAttributes.Public | TypeAttributes.Sealed | TypeAttributes.Serializable; }
- }
-
- public override bool IsArray
- {
- get { return true; }
- }
-
- public override bool __IsVector
- {
- get { return true; }
- }
-
- public override int GetArrayRank()
- {
- return 1;
- }
-
- public override bool Equals(object o)
- {
- return EqualsHelper(o as ArrayType);
- }
-
- public override int GetHashCode()
- {
- return elementType.GetHashCode() * 5;
- }
-
- internal override string GetSuffix()
- {
- return "[]";
- }
-
- protected override Type Wrap(Type type, CustomModifiers mods)
- {
- return Make(type, mods);
- }
- }
-
- sealed class MultiArrayType : ElementHolderType
- {
- private readonly int rank;
- private readonly int[] sizes;
- private readonly int[] lobounds;
-
- internal static Type Make(Type type, int rank, int[] sizes, int[] lobounds, CustomModifiers mods)
- {
- return type.Universe.CanonicalizeType(new MultiArrayType(type, rank, sizes, lobounds, mods));
- }
-
- private MultiArrayType(Type type, int rank, int[] sizes, int[] lobounds, CustomModifiers mods)
- : base(type, mods)
- {
- this.rank = rank;
- this.sizes = sizes;
- this.lobounds = lobounds;
- }
-
- public override Type BaseType
- {
- get { return elementType.Module.universe.System_Array; }
- }
-
- public override MethodBase[] __GetDeclaredMethods()
- {
- Type int32 = this.Module.universe.System_Int32;
- Type[] setArgs = new Type[rank + 1];
- Type[] getArgs = new Type[rank];
- Type[] ctorArgs = new Type[rank * 2];
- for (int i = 0; i < rank; i++)
- {
- setArgs[i] = int32;
- getArgs[i] = int32;
- ctorArgs[i * 2 + 0] = int32;
- ctorArgs[i * 2 + 1] = int32;
- }
- setArgs[rank] = elementType;
- return new MethodBase[] {
- new ConstructorInfoImpl(new BuiltinArrayMethod(this.Module, this, ".ctor", CallingConventions.Standard | CallingConventions.HasThis, this.Module.universe.System_Void, getArgs)),
- new ConstructorInfoImpl(new BuiltinArrayMethod(this.Module, this, ".ctor", CallingConventions.Standard | CallingConventions.HasThis, this.Module.universe.System_Void, ctorArgs)),
- new BuiltinArrayMethod(this.Module, this, "Set", CallingConventions.Standard | CallingConventions.HasThis, this.Module.universe.System_Void, setArgs),
- new BuiltinArrayMethod(this.Module, this, "Address", CallingConventions.Standard | CallingConventions.HasThis, elementType.MakeByRefType(), getArgs),
- new BuiltinArrayMethod(this.Module, this, "Get", CallingConventions.Standard | CallingConventions.HasThis, elementType, getArgs),
- };
- }
-
- public override TypeAttributes Attributes
- {
- get { return TypeAttributes.Public | TypeAttributes.Sealed | TypeAttributes.Serializable; }
- }
-
- public override bool IsArray
- {
- get { return true; }
- }
-
- public override int GetArrayRank()
- {
- return rank;
- }
-
- public override int[] __GetArraySizes()
- {
- return Util.Copy(sizes);
- }
-
- public override int[] __GetArrayLowerBounds()
- {
- return Util.Copy(lobounds);
- }
-
- public override bool Equals(object o)
- {
- MultiArrayType at = o as MultiArrayType;
- return EqualsHelper(at)
- && at.rank == rank
- && ArrayEquals(at.sizes, sizes)
- && ArrayEquals(at.lobounds, lobounds);
- }
-
- private static bool ArrayEquals(int[] i1, int[] i2)
- {
- if (i1.Length == i2.Length)
- {
- for (int i = 0; i < i1.Length; i++)
- {
- if (i1[i] != i2[i])
- {
- return false;
- }
- }
- return true;
- }
- return false;
- }
-
- public override int GetHashCode()
- {
- return elementType.GetHashCode() * 9 + rank;
- }
-
- internal override string GetSuffix()
- {
- if (rank == 1)
- {
- return "[*]";
- }
- else
- {
- return "[" + new String(',', rank - 1) + "]";
- }
- }
-
- protected override Type Wrap(Type type, CustomModifiers mods)
- {
- return Make(type, rank, sizes, lobounds, mods);
- }
- }
-
- sealed class BuiltinArrayMethod : ArrayMethod
- {
- internal BuiltinArrayMethod(Module module, Type arrayClass, string methodName, CallingConventions callingConvention, Type returnType, Type[] parameterTypes)
- : base(module, arrayClass, methodName, callingConvention, returnType, parameterTypes)
- {
- }
-
- public override MethodAttributes Attributes
- {
- get { return this.Name == ".ctor" ? MethodAttributes.RTSpecialName | MethodAttributes.Public : MethodAttributes.Public; }
- }
-
- public override MethodImplAttributes GetMethodImplementationFlags()
- {
- return MethodImplAttributes.IL;
- }
-
- public override int MetadataToken
- {
- get { return 0x06000000; }
- }
-
- public override MethodBody GetMethodBody()
- {
- return null;
- }
-
- public override ParameterInfo[] GetParameters()
- {
- ParameterInfo[] parameterInfos = new ParameterInfo[parameterTypes.Length];
- for (int i = 0; i < parameterInfos.Length; i++)
- {
- parameterInfos[i] = new ParameterInfoImpl(this, parameterTypes[i], i);
- }
- return parameterInfos;
- }
-
- public override ParameterInfo ReturnParameter
- {
- get { return new ParameterInfoImpl(this, this.ReturnType, -1); }
- }
-
- private sealed class ParameterInfoImpl : ParameterInfo
- {
- private readonly MethodInfo method;
- private readonly Type type;
- private readonly int pos;
-
- internal ParameterInfoImpl(MethodInfo method, Type type, int pos)
- {
- this.method = method;
- this.type = type;
- this.pos = pos;
- }
-
- public override Type ParameterType
- {
- get { return type; }
- }
-
- public override string Name
- {
- get { return null; }
- }
-
- public override ParameterAttributes Attributes
- {
- get { return ParameterAttributes.None; }
- }
-
- public override int Position
- {
- get { return pos; }
- }
-
- public override object RawDefaultValue
- {
- get { return null; }
- }
-
- public override CustomModifiers __GetCustomModifiers()
- {
- return new CustomModifiers();
- }
-
- public override bool __TryGetFieldMarshal(out FieldMarshal fieldMarshal)
- {
- fieldMarshal = new FieldMarshal();
- return false;
- }
-
- public override MemberInfo Member
- {
- get { return method.IsConstructor ? (MethodBase)new ConstructorInfoImpl(method) : method; }
- }
-
- public override int MetadataToken
- {
- get { return 0x08000000; }
- }
-
- internal override Module Module
- {
- get { return method.Module; }
- }
- }
- }
-
- sealed class ByRefType : ElementHolderType
- {
- internal static Type Make(Type type, CustomModifiers mods)
- {
- return type.Universe.CanonicalizeType(new ByRefType(type, mods));
- }
-
- private ByRefType(Type type, CustomModifiers mods)
- : base(type, mods)
- {
- }
-
- public override bool Equals(object o)
- {
- return EqualsHelper(o as ByRefType);
- }
-
- public override int GetHashCode()
- {
- return elementType.GetHashCode() * 3;
- }
-
- public override Type BaseType
- {
- get { return null; }
- }
-
- public override TypeAttributes Attributes
- {
- get { return 0; }
- }
-
- public override bool IsByRef
- {
- get { return true; }
- }
-
- internal override string GetSuffix()
- {
- return "&";
- }
-
- protected override Type Wrap(Type type, CustomModifiers mods)
- {
- return Make(type, mods);
- }
- }
-
- sealed class PointerType : ElementHolderType
- {
- internal static Type Make(Type type, CustomModifiers mods)
- {
- return type.Universe.CanonicalizeType(new PointerType(type, mods));
- }
-
- private PointerType(Type type, CustomModifiers mods)
- : base(type, mods)
- {
- }
-
- public override bool Equals(object o)
- {
- return EqualsHelper(o as PointerType);
- }
-
- public override int GetHashCode()
- {
- return elementType.GetHashCode() * 7;
- }
-
- public override Type BaseType
- {
- get { return null; }
- }
-
- public override TypeAttributes Attributes
- {
- get { return 0; }
- }
-
- public override bool IsPointer
- {
- get { return true; }
- }
-
- internal override string GetSuffix()
- {
- return "*";
- }
-
- protected override Type Wrap(Type type, CustomModifiers mods)
- {
- return Make(type, mods);
- }
- }
-
- sealed class GenericTypeInstance : TypeInfo
- {
- private readonly Type type;
- private readonly Type[] args;
- private readonly CustomModifiers[] mods;
- private Type baseType;
- private int token;
-
- internal static Type Make(Type type, Type[] typeArguments, CustomModifiers[] mods)
- {
- bool identity = true;
- if (type is TypeBuilder || type is BakedType || type.__IsMissing)
- {
- // a TypeBuiler identity must be instantiated
- identity = false;
- }
- else
- {
- // we must not instantiate the identity instance, because typeof(Foo<>).MakeGenericType(typeof(Foo<>).GetGenericArguments()) == typeof(Foo<>)
- for (int i = 0; i < typeArguments.Length; i++)
- {
- if (typeArguments[i] != type.GetGenericTypeArgument(i)
- || !IsEmpty(mods, i))
- {
- identity = false;
- break;
- }
- }
- }
- if (identity)
- {
- return type;
- }
- else
- {
- return type.Universe.CanonicalizeType(new GenericTypeInstance(type, typeArguments, mods));
- }
- }
-
- private static bool IsEmpty(CustomModifiers[] mods, int i)
- {
- // we need to be extra careful, because mods doesn't not need to be in canonical format
- // (Signature.ReadGenericInst() calls Make() directly, without copying the modifier arrays)
- return mods == null || mods[i].IsEmpty;
- }
-
- private GenericTypeInstance(Type type, Type[] args, CustomModifiers[] mods)
- {
- this.type = type;
- this.args = args;
- this.mods = mods;
- }
-
- public override bool Equals(object o)
- {
- GenericTypeInstance gt = o as GenericTypeInstance;
- return gt != null && gt.type.Equals(type) && Util.ArrayEquals(gt.args, args)
- && Util.ArrayEquals(gt.mods, mods);
- }
-
- public override int GetHashCode()
- {
- return type.GetHashCode() * 3 ^ Util.GetHashCode(args);
- }
-
- public override string AssemblyQualifiedName
- {
- get
- {
- string fn = FullName;
- return fn == null ? null : fn + ", " + type.Assembly.FullName;
- }
- }
-
- public override Type BaseType
- {
- get
- {
- if (baseType == null)
- {
- Type rawBaseType = type.BaseType;
- if (rawBaseType == null)
- {
- baseType = rawBaseType;
- }
- else
- {
- baseType = rawBaseType.BindTypeParameters(this);
- }
- }
- return baseType;
- }
- }
-
- public override bool IsValueType
- {
- get { return type.IsValueType; }
- }
-
- public override bool IsVisible
- {
- get
- {
- if (base.IsVisible)
- {
- foreach (Type arg in args)
- {
- if (!arg.IsVisible)
- {
- return false;
- }
- }
- return true;
- }
- return false;
- }
- }
-
- public override Type DeclaringType
- {
- get { return type.DeclaringType; }
- }
-
- public override TypeAttributes Attributes
- {
- get { return type.Attributes; }
- }
-
- internal override void CheckBaked()
- {
- type.CheckBaked();
- }
-
- public override FieldInfo[] __GetDeclaredFields()
- {
- FieldInfo[] fields = type.__GetDeclaredFields();
- for (int i = 0; i < fields.Length; i++)
- {
- fields[i] = fields[i].BindTypeParameters(this);
- }
- return fields;
- }
-
- public override Type[] __GetDeclaredInterfaces()
- {
- Type[] interfaces = type.__GetDeclaredInterfaces();
- for (int i = 0; i < interfaces.Length; i++)
- {
- interfaces[i] = interfaces[i].BindTypeParameters(this);
- }
- return interfaces;
- }
-
- public override MethodBase[] __GetDeclaredMethods()
- {
- MethodBase[] methods = type.__GetDeclaredMethods();
- for (int i = 0; i < methods.Length; i++)
- {
- methods[i] = methods[i].BindTypeParameters(this);
- }
- return methods;
- }
-
- public override Type[] __GetDeclaredTypes()
- {
- return type.__GetDeclaredTypes();
- }
-
- public override EventInfo[] __GetDeclaredEvents()
- {
- EventInfo[] events = type.__GetDeclaredEvents();
- for (int i = 0; i < events.Length; i++)
- {
- events[i] = events[i].BindTypeParameters(this);
- }
- return events;
- }
-
- public override PropertyInfo[] __GetDeclaredProperties()
- {
- PropertyInfo[] properties = type.__GetDeclaredProperties();
- for (int i = 0; i < properties.Length; i++)
- {
- properties[i] = properties[i].BindTypeParameters(this);
- }
- return properties;
- }
-
- public override __MethodImplMap __GetMethodImplMap()
- {
- __MethodImplMap map = type.__GetMethodImplMap();
- map.TargetType = this;
- for (int i = 0; i < map.MethodBodies.Length; i++)
- {
- map.MethodBodies[i] = (MethodInfo)map.MethodBodies[i].BindTypeParameters(this);
- for (int j = 0; j < map.MethodDeclarations[i].Length; j++)
- {
- Type interfaceType = map.MethodDeclarations[i][j].DeclaringType;
- if (interfaceType.IsGenericType)
- {
- map.MethodDeclarations[i][j] = (MethodInfo)map.MethodDeclarations[i][j].BindTypeParameters(this);
- }
- }
- }
- return map;
- }
-
- public override string Namespace
- {
- get { return type.Namespace; }
- }
-
- public override string Name
- {
- get { return type.Name; }
- }
-
- public override string FullName
- {
- get
- {
- if (!this.__ContainsMissingType && this.ContainsGenericParameters)
- {
- return null;
- }
- StringBuilder sb = new StringBuilder(this.type.FullName);
- sb.Append('[');
- string sep = "";
- foreach (Type type in args)
- {
- sb.Append(sep).Append('[').Append(type.FullName).Append(", ").Append(type.Assembly.FullName.Replace("]", "\\]")).Append(']');
- sep = ",";
- }
- sb.Append(']');
- return sb.ToString();
- }
- }
-
- public override string ToString()
- {
- StringBuilder sb = new StringBuilder(type.FullName);
- sb.Append('[');
- string sep = "";
- foreach (Type arg in args)
- {
- sb.Append(sep);
- sb.Append(arg);
- sep = ",";
- }
- sb.Append(']');
- return sb.ToString();
- }
-
- public override Module Module
- {
- get { return type.Module; }
- }
-
- public override bool IsGenericType
- {
- get { return true; }
- }
-
- public override bool IsConstructedGenericType
- {
- get { return true; }
- }
-
- public override Type GetGenericTypeDefinition()
- {
- return type;
- }
-
- public override Type[] GetGenericArguments()
- {
- return Util.Copy(args);
- }
-
- public override CustomModifiers[] __GetGenericArgumentsCustomModifiers()
- {
- return mods != null ? (CustomModifiers[])mods.Clone() : new CustomModifiers[args.Length];
- }
-
- internal override Type GetGenericTypeArgument(int index)
- {
- return args[index];
- }
-
- public override bool ContainsGenericParameters
- {
- get
- {
- foreach (Type type in args)
- {
- if (type.ContainsGenericParameters)
- {
- return true;
- }
- }
- return false;
- }
- }
-
- public override bool __ContainsMissingType
- {
- get
- {
- foreach (Type type in args)
- {
- if (type.__ContainsMissingType)
- {
- return true;
- }
- }
- return this.type.__IsMissing;
- }
- }
-
- public override StructLayoutAttribute StructLayoutAttribute
- {
- get { return type.StructLayoutAttribute; }
- }
-
- internal override int GetModuleBuilderToken()
- {
- if (token == 0)
- {
- token = ((ModuleBuilder)type.Module).ImportType(this);
- }
- return token;
- }
-
- internal override Type BindTypeParameters(IGenericBinder binder)
- {
- for (int i = 0; i < args.Length; i++)
- {
- Type xarg = args[i].BindTypeParameters(binder);
- if (!ReferenceEquals(xarg, args[i]))
- {
- Type[] xargs = new Type[args.Length];
- Array.Copy(args, xargs, i);
- xargs[i++] = xarg;
- for (; i < args.Length; i++)
- {
- xargs[i] = args[i].BindTypeParameters(binder);
- }
- return Make(type, xargs, null);
- }
- }
- return this;
- }
-
- internal override int GetCurrentToken()
- {
- return type.GetCurrentToken();
- }
-
- internal override bool IsBaked
- {
- get { return type.IsBaked; }
- }
- }
-
- sealed class FunctionPointerType : TypeInfo
- {
- private readonly Universe universe;
- private readonly __StandAloneMethodSig sig;
-
- internal static Type Make(Universe universe, __StandAloneMethodSig sig)
- {
- return universe.CanonicalizeType(new FunctionPointerType(universe, sig));
- }
-
- private FunctionPointerType(Universe universe, __StandAloneMethodSig sig)
- {
- this.universe = universe;
- this.sig = sig;
- }
-
- public override bool Equals(object obj)
- {
- FunctionPointerType other = obj as FunctionPointerType;
- return other != null
- && other.universe == universe
- && other.sig.Equals(sig);
- }
-
- public override int GetHashCode()
- {
- return sig.GetHashCode();
- }
-
- public override bool __IsFunctionPointer
- {
- get { return true; }
- }
-
- public override __StandAloneMethodSig __MethodSignature
- {
- get { return sig; }
- }
-
- public override Type BaseType
- {
- get { return null; }
- }
-
- public override TypeAttributes Attributes
- {
- get { return 0; }
- }
-
- public override string Name
- {
- get { throw new InvalidOperationException(); }
- }
-
- public override string FullName
- {
- get { throw new InvalidOperationException(); }
- }
-
- public override Module Module
- {
- get { throw new InvalidOperationException(); }
- }
-
- internal override Universe Universe
- {
- get { return universe; }
- }
-
- public override string ToString()
- {
- return "<FunctionPtr>";
- }
-
- internal override bool IsBaked
- {
- get { return true; }
- }
- }
-
- sealed class MarkerType : Type
- {
- // used by ILGenerator
- internal static readonly Type Fault = new MarkerType();
- internal static readonly Type Finally = new MarkerType();
- internal static readonly Type Filter = new MarkerType();
- // used by CustomModifiers and SignatureHelper
- internal static readonly Type ModOpt = new MarkerType();
- internal static readonly Type ModReq = new MarkerType();
- // used by SignatureHelper
- internal static readonly Type Sentinel = new MarkerType();
- internal static readonly Type Pinned = new MarkerType();
-
- private MarkerType() { }
-
- public override Type BaseType
- {
- get { throw new InvalidOperationException(); }
- }
-
- public override TypeAttributes Attributes
- {
- get { throw new InvalidOperationException(); }
- }
-
- public override string Name
- {
- get { throw new InvalidOperationException(); }
- }
-
- public override string FullName
- {
- get { throw new InvalidOperationException(); }
- }
-
- public override Module Module
- {
- get { throw new InvalidOperationException(); }
- }
-
- internal override bool IsBaked
- {
- get { throw new InvalidOperationException(); }
- }
-
- public override bool __IsMissing
- {
- get { throw new InvalidOperationException(); }
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2012 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-
-namespace IKVM.Reflection
-{
- public interface IReflectableType
- {
- TypeInfo GetTypeInfo();
- }
-
- public static class IntrospectionExtensions
- {
- // we target .NET 2.0 so we can't define an extension method
- public static TypeInfo GetTypeInfo(/*this*/ Type type)
- {
- return type.GetTypeInfo();
- }
- }
-
- public abstract class TypeInfo : Type, IReflectableType
- {
- private const BindingFlags Flags = BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static;
-
- internal TypeInfo()
- {
- }
-
- internal TypeInfo(Type underlyingType)
- : base(underlyingType)
- {
- }
-
- public IEnumerable<ConstructorInfo> DeclaredConstructors
- {
- get { return GetConstructors(Flags); }
- }
-
- public IEnumerable<EventInfo> DeclaredEvents
- {
- get { return GetEvents(Flags); }
- }
-
- public IEnumerable<FieldInfo> DeclaredFields
- {
- get { return GetFields(Flags); }
- }
-
- public IEnumerable<MemberInfo> DeclaredMembers
- {
- get { return GetMembers(Flags); }
- }
-
- public IEnumerable<MethodInfo> DeclaredMethods
- {
- get { return GetMethods(Flags); }
- }
-
- public IEnumerable<TypeInfo> DeclaredNestedTypes
- {
- get
- {
- Type[] types = GetNestedTypes(Flags);
- TypeInfo[] typeInfos = new TypeInfo[types.Length];
- for (int i = 0; i < types.Length; i++)
- {
- typeInfos[i] = types[i].GetTypeInfo();
- }
- return typeInfos;
- }
- }
-
- public IEnumerable<PropertyInfo> DeclaredProperties
- {
- get { return GetProperties(Flags); }
- }
-
- public Type[] GenericTypeParameters
- {
- get { return IsGenericTypeDefinition ? GetGenericArguments() : Type.EmptyTypes; }
- }
-
- public IEnumerable<Type> ImplementedInterfaces
- {
- get { return __GetDeclaredInterfaces(); }
- }
-
- public Type AsType()
- {
- return this;
- }
-
- public EventInfo GetDeclaredEvent(string name)
- {
- return GetEvent(name, Flags);
- }
-
- public FieldInfo GetDeclaredField(string name)
- {
- return GetField(name, Flags);
- }
-
- public MethodInfo GetDeclaredMethod(string name)
- {
- return GetMethod(name, Flags);
- }
-
- public IEnumerable<MethodInfo> GetDeclaredMethods(string name)
- {
- List<MethodInfo> methods = new List<MethodInfo>();
- foreach (MethodInfo method in GetMethods(Flags))
- {
- if (method.Name == name)
- {
- methods.Add(method);
- }
- }
- return methods;
- }
-
- public TypeInfo GetDeclaredNestedType(string name)
- {
- return GetNestedType(name, Flags).GetTypeInfo();
- }
-
- public PropertyInfo GetDeclaredProperty(string name)
- {
- return GetProperty(name, Flags);
- }
-
- public bool IsAssignableFrom(TypeInfo typeInfo)
- {
- return base.IsAssignableFrom(typeInfo);
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009-2012 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Text;
-
-namespace IKVM.Reflection
-{
- // this respresents a type name as in metadata:
- // - ns will be null for empty the namespace (never the empty string)
- // - the strings are not escaped
- struct TypeName : IEquatable<TypeName>
- {
- private readonly string ns;
- private readonly string name;
-
- internal TypeName(string ns, string name)
- {
- if (name == null)
- {
- throw new ArgumentNullException("name");
- }
- this.ns = ns;
- this.name = name;
- }
-
- internal string Name
- {
- get { return name; }
- }
-
- internal string Namespace
- {
- get { return ns; }
- }
-
- public static bool operator ==(TypeName o1, TypeName o2)
- {
- return o1.ns == o2.ns && o1.name == o2.name;
- }
-
- public static bool operator !=(TypeName o1, TypeName o2)
- {
- return o1.ns != o2.ns || o1.name != o2.name;
- }
-
- public override int GetHashCode()
- {
- return ns == null ? name.GetHashCode() : ns.GetHashCode() * 37 + name.GetHashCode();
- }
-
- public override bool Equals(object obj)
- {
- TypeName? other = obj as TypeName?;
- return other != null && other.Value == this;
- }
-
- public override string ToString()
- {
- return ns == null ? name : ns + "." + name;
- }
-
- bool IEquatable<TypeName>.Equals(TypeName other)
- {
- return this == other;
- }
-
- internal TypeName ToLowerInvariant()
- {
- return new TypeName(ns == null ? null : ns.ToLowerInvariant(), name.ToLowerInvariant());
- }
-
- internal static TypeName Split(string name)
- {
- int dot = name.LastIndexOf('.');
- if (dot == -1)
- {
- return new TypeName(null, name);
- }
- else
- {
- return new TypeName(name.Substring(0, dot), name.Substring(dot + 1));
- }
- }
- }
-
- struct TypeNameParser
- {
- private const string SpecialChars = "\\+,[]*&";
- private const short SZARRAY = -1;
- private const short BYREF = -2;
- private const short POINTER = -3;
- private readonly string name;
- private readonly string[] nested;
- private readonly string assemblyName;
- private readonly short[] modifiers;
- private readonly TypeNameParser[] genericParameters;
-
- internal static string Escape(string name)
- {
- if (name == null)
- {
- return null;
- }
- StringBuilder sb = null;
- for (int pos = 0; pos < name.Length; pos++)
- {
- char c = name[pos];
- switch (c)
- {
- case '\\':
- case '+':
- case ',':
- case '[':
- case ']':
- case '*':
- case '&':
- if (sb == null)
- {
- sb = new StringBuilder(name, 0, pos, name.Length + 3);
- }
- sb.Append("\\").Append(c);
- break;
- default:
- if (sb != null)
- {
- sb.Append(c);
- }
- break;
- }
- }
- return sb != null ? sb.ToString() : name;
- }
-
- internal static string Unescape(string name)
- {
- int pos = name.IndexOf('\\');
- if (pos == -1)
- {
- return name;
- }
- StringBuilder sb = new StringBuilder(name, 0, pos, name.Length - 1);
- for (; pos < name.Length; pos++)
- {
- char c = name[pos];
- if (c == '\\')
- {
- c = name[++pos];
- }
- sb.Append(c);
- }
- return sb.ToString();
- }
-
- internal static TypeNameParser Parse(string typeName, bool throwOnError)
- {
- if (throwOnError)
- {
- Parser parser = new Parser(typeName);
- return new TypeNameParser(ref parser, true);
- }
- else
- {
- try
- {
- Parser parser = new Parser(typeName);
- return new TypeNameParser(ref parser, true);
- }
- catch (ArgumentException)
- {
- return new TypeNameParser();
- }
- }
- }
-
- private TypeNameParser(ref Parser parser, bool withAssemblyName)
- {
- bool genericParameter = parser.pos != 0;
- name = parser.NextNamePart();
- nested = null;
- parser.ParseNested(ref nested);
- genericParameters = null;
- parser.ParseGenericParameters(ref genericParameters);
- modifiers = null;
- parser.ParseModifiers(ref modifiers);
- assemblyName = null;
- if (withAssemblyName)
- {
- parser.ParseAssemblyName(genericParameter, ref assemblyName);
- }
- }
-
- internal bool Error
- {
- get { return name == null; }
- }
-
- internal string FirstNamePart
- {
- get { return name; }
- }
-
- internal string AssemblyName
- {
- get { return assemblyName; }
- }
-
- private struct Parser
- {
- private readonly string typeName;
- internal int pos;
-
- internal Parser(string typeName)
- {
- this.typeName = typeName;
- this.pos = 0;
- }
-
- private void Check(bool condition)
- {
- if (!condition)
- {
- throw new ArgumentException("Invalid type name '" + typeName + "'");
- }
- }
-
- private void Consume(char c)
- {
- Check(pos < typeName.Length && typeName[pos++] == c);
- }
-
- private bool TryConsume(char c)
- {
- if (pos < typeName.Length && typeName[pos] == c)
- {
- pos++;
- return true;
- }
- else
- {
- return false;
- }
- }
-
- internal string NextNamePart()
- {
- SkipWhiteSpace();
- int start = pos;
- for (; pos < typeName.Length; pos++)
- {
- char c = typeName[pos];
- if (c == '\\')
- {
- pos++;
- Check(pos < typeName.Length && SpecialChars.IndexOf(typeName[pos]) != -1);
- }
- else if (SpecialChars.IndexOf(c) != -1)
- {
- break;
- }
- }
- Check(pos - start != 0);
- if (start == 0 && pos == typeName.Length)
- {
- return typeName;
- }
- else
- {
- return typeName.Substring(start, pos - start);
- }
- }
-
- internal void ParseNested(ref string[] nested)
- {
- while (TryConsume('+'))
- {
- Add(ref nested, NextNamePart());
- }
- }
-
- internal void ParseGenericParameters(ref TypeNameParser[] genericParameters)
- {
- int saved = pos;
- if (TryConsume('['))
- {
- SkipWhiteSpace();
- if (TryConsume(']') || TryConsume('*') || TryConsume(','))
- {
- // it's not a generic parameter list, but an array instead
- pos = saved;
- return;
- }
- do
- {
- SkipWhiteSpace();
- if (TryConsume('['))
- {
- Add(ref genericParameters, new TypeNameParser(ref this, true));
- Consume(']');
- }
- else
- {
- Add(ref genericParameters, new TypeNameParser(ref this, false));
- }
- }
- while (TryConsume(','));
- Consume(']');
- SkipWhiteSpace();
- }
- }
-
- internal void ParseModifiers(ref short[] modifiers)
- {
- while (pos < typeName.Length)
- {
- switch (typeName[pos])
- {
- case '*':
- pos++;
- Add(ref modifiers, POINTER);
- break;
- case '&':
- pos++;
- Add(ref modifiers, BYREF);
- break;
- case '[':
- pos++;
- Add(ref modifiers, ParseArray());
- Consume(']');
- break;
- default:
- return;
- }
- SkipWhiteSpace();
- }
- }
-
- internal void ParseAssemblyName(bool genericParameter, ref string assemblyName)
- {
- if (pos < typeName.Length)
- {
- if (typeName[pos] == ']' && genericParameter)
- {
- // ok
- }
- else
- {
- Consume(',');
- SkipWhiteSpace();
- if (genericParameter)
- {
- int start = pos;
- while (pos < typeName.Length)
- {
- char c = typeName[pos];
- if (c == '\\')
- {
- pos++;
- // a backslash itself is not legal in an assembly name, so we don't need to check for an escaped backslash
- Check(pos < typeName.Length && typeName[pos++] == ']');
- }
- else if (c == ']')
- {
- break;
- }
- else
- {
- pos++;
- }
- }
- Check(pos < typeName.Length && typeName[pos] == ']');
- assemblyName = typeName.Substring(start, pos - start).Replace("\\]", "]");
- }
- else
- {
- // only when an assembly name is used in a generic type parameter, will it be escaped
- assemblyName = typeName.Substring(pos);
- }
- Check(assemblyName.Length != 0);
- }
- }
- else
- {
- Check(!genericParameter);
- }
- }
-
- private short ParseArray()
- {
- SkipWhiteSpace();
- Check(pos < typeName.Length);
- char c = typeName[pos];
- if (c == ']')
- {
- return SZARRAY;
- }
- else if (c == '*')
- {
- pos++;
- SkipWhiteSpace();
- return 1;
- }
- else
- {
- short rank = 1;
- while (TryConsume(','))
- {
- Check(rank < short.MaxValue);
- rank++;
- SkipWhiteSpace();
- }
- return rank;
- }
- }
-
- private void SkipWhiteSpace()
- {
- while (pos < typeName.Length && Char.IsWhiteSpace(typeName[pos]))
- {
- pos++;
- }
- }
-
- private static void Add<T>(ref T[] array, T elem)
- {
- if (array == null)
- {
- array = new T[] { elem };
- return;
- }
- Array.Resize(ref array, array.Length + 1);
- array[array.Length - 1] = elem;
- }
- }
-
- internal Type GetType(Universe universe, Assembly context, bool throwOnError, string originalName, bool resolve, bool ignoreCase)
- {
- Debug.Assert(!resolve || !ignoreCase);
- TypeName name = TypeName.Split(this.name);
- Type type;
- if (assemblyName != null)
- {
- Assembly asm = universe.Load(assemblyName, context, throwOnError);
- if (asm == null)
- {
- return null;
- }
- if (resolve)
- {
- type = asm.ResolveType(name);
- }
- else if (ignoreCase)
- {
- type = asm.FindTypeIgnoreCase(name.ToLowerInvariant());
- }
- else
- {
- type = asm.FindType(name);
- }
- }
- else if (context == null)
- {
- if (resolve)
- {
- type = universe.Mscorlib.ResolveType(name);
- }
- else if (ignoreCase)
- {
- type = universe.Mscorlib.FindTypeIgnoreCase(name.ToLowerInvariant());
- }
- else
- {
- type = universe.Mscorlib.FindType(name);
- }
- }
- else
- {
- if (ignoreCase)
- {
- name = name.ToLowerInvariant();
- type = context.FindTypeIgnoreCase(name);
- }
- else
- {
- type = context.FindType(name);
- }
- if (type == null && context != universe.Mscorlib)
- {
- if (ignoreCase)
- {
- type = universe.Mscorlib.FindTypeIgnoreCase(name);
- }
- else
- {
- type = universe.Mscorlib.FindType(name);
- }
- }
- if (type == null && resolve)
- {
- if (universe.Mscorlib.__IsMissing && !context.__IsMissing)
- {
- type = universe.Mscorlib.ResolveType(name);
- }
- else
- {
- type = context.ResolveType(name);
- }
- }
- }
- return Expand(type, context, throwOnError, originalName, resolve, ignoreCase);
- }
-
- internal Type Expand(Type type, Assembly context, bool throwOnError, string originalName, bool resolve, bool ignoreCase)
- {
- Debug.Assert(!resolve || !ignoreCase);
- if (type == null)
- {
- if (throwOnError)
- {
- throw new TypeLoadException(originalName);
- }
- return null;
- }
- if (nested != null)
- {
- Type outer;
- foreach (string nest in nested)
- {
- outer = type;
- TypeName name = TypeName.Split(TypeNameParser.Unescape(nest));
- type = ignoreCase
- ? outer.FindNestedTypeIgnoreCase(name.ToLowerInvariant())
- : outer.FindNestedType(name);
- if (type == null)
- {
- if (resolve)
- {
- type = outer.Module.universe.GetMissingTypeOrThrow(outer.Module, outer, name);
- }
- else if (throwOnError)
- {
- throw new TypeLoadException(originalName);
- }
- else
- {
- return null;
- }
- }
- }
- }
- if (genericParameters != null)
- {
- Type[] typeArgs = new Type[genericParameters.Length];
- for (int i = 0; i < typeArgs.Length; i++)
- {
- typeArgs[i] = genericParameters[i].GetType(type.Assembly.universe, context, throwOnError, originalName, resolve, ignoreCase);
- if (typeArgs[i] == null)
- {
- return null;
- }
- }
- type = type.MakeGenericType(typeArgs);
- }
- if (modifiers != null)
- {
- foreach (short modifier in modifiers)
- {
- switch (modifier)
- {
- case SZARRAY:
- type = type.MakeArrayType();
- break;
- case BYREF:
- type = type.MakeByRefType();
- break;
- case POINTER:
- type = type.MakePointerType();
- break;
- default:
- type = type.MakeArrayType(modifier);
- break;
- }
- }
- }
- return type;
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2009-2012 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Security;
-using System.Text;
-using System.Diagnostics;
-using IKVM.Reflection.Reader;
-using IKVM.Reflection.Emit;
-
-namespace IKVM.Reflection
-{
- public sealed class ResolveEventArgs : EventArgs
- {
- private readonly string name;
- private readonly Assembly requestingAssembly;
-
- public ResolveEventArgs(string name)
- : this(name, null)
- {
- }
-
- public ResolveEventArgs(string name, Assembly requestingAssembly)
- {
- this.name = name;
- this.requestingAssembly = requestingAssembly;
- }
-
- public string Name
- {
- get { return name; }
- }
-
- public Assembly RequestingAssembly
- {
- get { return requestingAssembly; }
- }
- }
-
- public enum AssemblyComparisonResult
- {
- Unknown = 0,
- EquivalentFullMatch = 1,
- EquivalentWeakNamed = 2,
- EquivalentFXUnified = 3,
- EquivalentUnified = 4,
- NonEquivalentVersion = 5,
- NonEquivalent = 6,
- EquivalentPartialMatch = 7,
- EquivalentPartialWeakNamed = 8,
- EquivalentPartialUnified = 9,
- EquivalentPartialFXUnified = 10,
- NonEquivalentPartialVersion = 11,
- }
-
- public delegate Assembly ResolveEventHandler(object sender, ResolveEventArgs args);
-
- [Flags]
- public enum UniverseOptions
- {
- None = 0,
- EnableFunctionPointers = 1,
- DisableFusion = 2,
- DisablePseudoCustomAttributeRetrieval = 4,
- }
-
- public sealed class Universe : IDisposable
- {
- internal static readonly bool MonoRuntime = System.Type.GetType("Mono.Runtime") != null;
- private readonly Dictionary<Type, Type> canonicalizedTypes = new Dictionary<Type, Type>();
- private readonly List<AssemblyReader> assemblies = new List<AssemblyReader>();
- private readonly List<AssemblyBuilder> dynamicAssemblies = new List<AssemblyBuilder>();
- private readonly Dictionary<string, Assembly> assembliesByName = new Dictionary<string, Assembly>();
- private readonly Dictionary<System.Type, Type> importedTypes = new Dictionary<System.Type, Type>();
- private Dictionary<ScopedTypeName, Type> missingTypes;
- private bool resolveMissingMembers;
- private readonly bool enableFunctionPointers;
- private readonly bool useNativeFusion;
- private readonly bool returnPseudoCustomAttributes;
- private Type typeof_System_Object;
- private Type typeof_System_ValueType;
- private Type typeof_System_Enum;
- private Type typeof_System_Void;
- private Type typeof_System_Boolean;
- private Type typeof_System_Char;
- private Type typeof_System_SByte;
- private Type typeof_System_Byte;
- private Type typeof_System_Int16;
- private Type typeof_System_UInt16;
- private Type typeof_System_Int32;
- private Type typeof_System_UInt32;
- private Type typeof_System_Int64;
- private Type typeof_System_UInt64;
- private Type typeof_System_Single;
- private Type typeof_System_Double;
- private Type typeof_System_String;
- private Type typeof_System_IntPtr;
- private Type typeof_System_UIntPtr;
- private Type typeof_System_TypedReference;
- private Type typeof_System_Type;
- private Type typeof_System_Array;
- private Type typeof_System_DateTime;
- private Type typeof_System_DBNull;
- private Type typeof_System_Decimal;
- private Type typeof_System_NonSerializedAttribute;
- private Type typeof_System_SerializableAttribute;
- private Type typeof_System_AttributeUsageAttribute;
- private Type typeof_System_Runtime_InteropServices_DllImportAttribute;
- private Type typeof_System_Runtime_InteropServices_FieldOffsetAttribute;
- private Type typeof_System_Runtime_InteropServices_InAttribute;
- private Type typeof_System_Runtime_InteropServices_MarshalAsAttribute;
- private Type typeof_System_Runtime_InteropServices_UnmanagedType;
- private Type typeof_System_Runtime_InteropServices_VarEnum;
- private Type typeof_System_Runtime_InteropServices_OutAttribute;
- private Type typeof_System_Runtime_InteropServices_StructLayoutAttribute;
- private Type typeof_System_Runtime_InteropServices_OptionalAttribute;
- private Type typeof_System_Runtime_InteropServices_PreserveSigAttribute;
- private Type typeof_System_Runtime_InteropServices_CallingConvention;
- private Type typeof_System_Runtime_InteropServices_CharSet;
- private Type typeof_System_Runtime_InteropServices_ComImportAttribute;
- private Type typeof_System_Runtime_CompilerServices_DecimalConstantAttribute;
- private Type typeof_System_Runtime_CompilerServices_SpecialNameAttribute;
- private Type typeof_System_Runtime_CompilerServices_MethodImplAttribute;
- private Type typeof_System_Security_SuppressUnmanagedCodeSecurityAttribute;
- private Type typeof_System_Reflection_AssemblyCopyrightAttribute;
- private Type typeof_System_Reflection_AssemblyTrademarkAttribute;
- private Type typeof_System_Reflection_AssemblyProductAttribute;
- private Type typeof_System_Reflection_AssemblyCompanyAttribute;
- private Type typeof_System_Reflection_AssemblyDescriptionAttribute;
- private Type typeof_System_Reflection_AssemblyTitleAttribute;
- private Type typeof_System_Reflection_AssemblyInformationalVersionAttribute;
- private Type typeof_System_Reflection_AssemblyFileVersionAttribute;
- private Type typeof_System_Security_Permissions_CodeAccessSecurityAttribute;
- private Type typeof_System_Security_Permissions_PermissionSetAttribute;
- private Type typeof_System_Security_Permissions_SecurityAction;
- private List<ResolveEventHandler> resolvers = new List<ResolveEventHandler>();
- private Predicate<Type> missingTypeIsValueType;
-
- public Universe()
- : this(UniverseOptions.None)
- {
- }
-
- public Universe(UniverseOptions options)
- {
- enableFunctionPointers = (options & UniverseOptions.EnableFunctionPointers) != 0;
- useNativeFusion = (options & UniverseOptions.DisableFusion) == 0 && GetUseNativeFusion();
- returnPseudoCustomAttributes = (options & UniverseOptions.DisablePseudoCustomAttributeRetrieval) == 0;
- }
-
- private static bool GetUseNativeFusion()
- {
- try
- {
- return Environment.OSVersion.Platform == PlatformID.Win32NT
- && !MonoRuntime
- && Environment.GetEnvironmentVariable("IKVM_DISABLE_FUSION") == null;
- }
- catch (System.Security.SecurityException)
- {
- return false;
- }
- }
-
- internal Assembly Mscorlib
- {
- get { return Load("mscorlib"); }
- }
-
- private Type ImportMscorlibType(System.Type type)
- {
- if (Mscorlib.__IsMissing)
- {
- return Mscorlib.ResolveType(new TypeName(type.Namespace, type.Name));
- }
- // We use FindType instead of ResolveType here, because on some versions of mscorlib some of
- // the special types we use/support are missing and the type properties are defined to
- // return null in that case.
- // Note that we don't have to unescape type.Name here, because none of the names contain special characters.
- return Mscorlib.FindType(new TypeName(type.Namespace, type.Name));
- }
-
- private Type ResolvePrimitive(string name)
- {
- // Primitive here means that these types have a special metadata encoding, which means that
- // there can be references to them without referring to them by name explicitly.
- // We want these types to be usable even when they don't exist in mscorlib or there is no mscorlib loaded.
- return Mscorlib.FindType(new TypeName("System", name)) ?? GetMissingType(Mscorlib.ManifestModule, null, new TypeName("System", name));
- }
-
- internal Type System_Object
- {
- get { return typeof_System_Object ?? (typeof_System_Object = ResolvePrimitive("Object")); }
- }
-
- internal Type System_ValueType
- {
- // System.ValueType is not a primitive, but generic type parameters can have a ValueType constraint
- // (we also don't want to return null here)
- get { return typeof_System_ValueType ?? (typeof_System_ValueType = ResolvePrimitive("ValueType")); }
- }
-
- internal Type System_Enum
- {
- // System.Enum is not a primitive, but we don't want to return null
- get { return typeof_System_Enum ?? (typeof_System_Enum = ResolvePrimitive("Enum")); }
- }
-
- internal Type System_Void
- {
- get { return typeof_System_Void ?? (typeof_System_Void = ResolvePrimitive("Void")); }
- }
-
- internal Type System_Boolean
- {
- get { return typeof_System_Boolean ?? (typeof_System_Boolean = ResolvePrimitive("Boolean")); }
- }
-
- internal Type System_Char
- {
- get { return typeof_System_Char ?? (typeof_System_Char = ResolvePrimitive("Char")); }
- }
-
- internal Type System_SByte
- {
- get { return typeof_System_SByte ?? (typeof_System_SByte = ResolvePrimitive("SByte")); }
- }
-
- internal Type System_Byte
- {
- get { return typeof_System_Byte ?? (typeof_System_Byte = ResolvePrimitive("Byte")); }
- }
-
- internal Type System_Int16
- {
- get { return typeof_System_Int16 ?? (typeof_System_Int16 = ResolvePrimitive("Int16")); }
- }
-
- internal Type System_UInt16
- {
- get { return typeof_System_UInt16 ?? (typeof_System_UInt16 = ResolvePrimitive("UInt16")); }
- }
-
- internal Type System_Int32
- {
- get { return typeof_System_Int32 ?? (typeof_System_Int32 = ResolvePrimitive("Int32")); }
- }
-
- internal Type System_UInt32
- {
- get { return typeof_System_UInt32 ?? (typeof_System_UInt32 = ResolvePrimitive("UInt32")); }
- }
-
- internal Type System_Int64
- {
- get { return typeof_System_Int64 ?? (typeof_System_Int64 = ResolvePrimitive("Int64")); }
- }
-
- internal Type System_UInt64
- {
- get { return typeof_System_UInt64 ?? (typeof_System_UInt64 = ResolvePrimitive("UInt64")); }
- }
-
- internal Type System_Single
- {
- get { return typeof_System_Single ?? (typeof_System_Single = ResolvePrimitive("Single")); }
- }
-
- internal Type System_Double
- {
- get { return typeof_System_Double ?? (typeof_System_Double = ResolvePrimitive("Double")); }
- }
-
- internal Type System_String
- {
- get { return typeof_System_String ?? (typeof_System_String = ResolvePrimitive("String")); }
- }
-
- internal Type System_IntPtr
- {
- get { return typeof_System_IntPtr ?? (typeof_System_IntPtr = ResolvePrimitive("IntPtr")); }
- }
-
- internal Type System_UIntPtr
- {
- get { return typeof_System_UIntPtr ?? (typeof_System_UIntPtr = ResolvePrimitive("UIntPtr")); }
- }
-
- internal Type System_TypedReference
- {
- get { return typeof_System_TypedReference ?? (typeof_System_TypedReference = ResolvePrimitive("TypedReference")); }
- }
-
- internal Type System_Type
- {
- // System.Type is not a primitive, but it does have a special encoding in custom attributes
- get { return typeof_System_Type ?? (typeof_System_Type = ResolvePrimitive("Type")); }
- }
-
- internal Type System_Array
- {
- // System.Array is not a primitive, but it used as a base type for array types (that are primitives)
- get { return typeof_System_Array ?? (typeof_System_Array = ResolvePrimitive("Array")); }
- }
-
- internal Type System_DateTime
- {
- get { return typeof_System_DateTime ?? (typeof_System_DateTime = ImportMscorlibType(typeof(System.DateTime))); }
- }
-
- internal Type System_DBNull
- {
- get { return typeof_System_DBNull ?? (typeof_System_DBNull = ImportMscorlibType(typeof(System.DBNull))); }
- }
-
- internal Type System_Decimal
- {
- get { return typeof_System_Decimal ?? (typeof_System_Decimal = ImportMscorlibType(typeof(System.Decimal))); }
- }
-
- internal Type System_NonSerializedAttribute
- {
- get { return typeof_System_NonSerializedAttribute ?? (typeof_System_NonSerializedAttribute = ImportMscorlibType(typeof(System.NonSerializedAttribute))); }
- }
-
- internal Type System_SerializableAttribute
- {
- get { return typeof_System_SerializableAttribute ?? (typeof_System_SerializableAttribute = ImportMscorlibType(typeof(System.SerializableAttribute))); }
- }
-
- internal Type System_AttributeUsageAttribute
- {
- get { return typeof_System_AttributeUsageAttribute ?? (typeof_System_AttributeUsageAttribute = ImportMscorlibType(typeof(System.AttributeUsageAttribute))); }
- }
-
- internal Type System_Runtime_InteropServices_DllImportAttribute
- {
- get { return typeof_System_Runtime_InteropServices_DllImportAttribute ?? (typeof_System_Runtime_InteropServices_DllImportAttribute = ImportMscorlibType(typeof(System.Runtime.InteropServices.DllImportAttribute))); }
- }
-
- internal Type System_Runtime_InteropServices_FieldOffsetAttribute
- {
- get { return typeof_System_Runtime_InteropServices_FieldOffsetAttribute ?? (typeof_System_Runtime_InteropServices_FieldOffsetAttribute = ImportMscorlibType(typeof(System.Runtime.InteropServices.FieldOffsetAttribute))); }
- }
-
- internal Type System_Runtime_InteropServices_InAttribute
- {
- get { return typeof_System_Runtime_InteropServices_InAttribute ?? (typeof_System_Runtime_InteropServices_InAttribute = ImportMscorlibType(typeof(System.Runtime.InteropServices.InAttribute))); }
- }
-
- internal Type System_Runtime_InteropServices_MarshalAsAttribute
- {
- get { return typeof_System_Runtime_InteropServices_MarshalAsAttribute ?? (typeof_System_Runtime_InteropServices_MarshalAsAttribute = ImportMscorlibType(typeof(System.Runtime.InteropServices.MarshalAsAttribute))); }
- }
-
- internal Type System_Runtime_InteropServices_UnmanagedType
- {
- get { return typeof_System_Runtime_InteropServices_UnmanagedType ?? (typeof_System_Runtime_InteropServices_UnmanagedType = ImportMscorlibType(typeof(System.Runtime.InteropServices.UnmanagedType))); }
- }
-
- internal Type System_Runtime_InteropServices_VarEnum
- {
- get { return typeof_System_Runtime_InteropServices_VarEnum ?? (typeof_System_Runtime_InteropServices_VarEnum = ImportMscorlibType(typeof(System.Runtime.InteropServices.VarEnum))); }
- }
-
- internal Type System_Runtime_InteropServices_OutAttribute
- {
- get { return typeof_System_Runtime_InteropServices_OutAttribute ?? (typeof_System_Runtime_InteropServices_OutAttribute = ImportMscorlibType(typeof(System.Runtime.InteropServices.OutAttribute))); }
- }
-
- internal Type System_Runtime_InteropServices_StructLayoutAttribute
- {
- get { return typeof_System_Runtime_InteropServices_StructLayoutAttribute ?? (typeof_System_Runtime_InteropServices_StructLayoutAttribute = ImportMscorlibType(typeof(System.Runtime.InteropServices.StructLayoutAttribute))); }
- }
-
- internal Type System_Runtime_InteropServices_OptionalAttribute
- {
- get { return typeof_System_Runtime_InteropServices_OptionalAttribute ?? (typeof_System_Runtime_InteropServices_OptionalAttribute = ImportMscorlibType(typeof(System.Runtime.InteropServices.OptionalAttribute))); }
- }
-
- internal Type System_Runtime_InteropServices_PreserveSigAttribute
- {
- get { return typeof_System_Runtime_InteropServices_PreserveSigAttribute ?? (typeof_System_Runtime_InteropServices_PreserveSigAttribute = ImportMscorlibType(typeof(System.Runtime.InteropServices.PreserveSigAttribute))); }
- }
-
- internal Type System_Runtime_InteropServices_CallingConvention
- {
- get { return typeof_System_Runtime_InteropServices_CallingConvention ?? (typeof_System_Runtime_InteropServices_CallingConvention = ImportMscorlibType(typeof(System.Runtime.InteropServices.CallingConvention))); }
- }
-
- internal Type System_Runtime_InteropServices_CharSet
- {
- get { return typeof_System_Runtime_InteropServices_CharSet ?? (typeof_System_Runtime_InteropServices_CharSet = ImportMscorlibType(typeof(System.Runtime.InteropServices.CharSet))); }
- }
-
- internal Type System_Runtime_InteropServices_ComImportAttribute
- {
- get { return typeof_System_Runtime_InteropServices_ComImportAttribute ?? (typeof_System_Runtime_InteropServices_ComImportAttribute = ImportMscorlibType(typeof(System.Runtime.InteropServices.ComImportAttribute))); }
- }
-
- internal Type System_Runtime_CompilerServices_DecimalConstantAttribute
- {
- get { return typeof_System_Runtime_CompilerServices_DecimalConstantAttribute ?? (typeof_System_Runtime_CompilerServices_DecimalConstantAttribute = ImportMscorlibType(typeof(System.Runtime.CompilerServices.DecimalConstantAttribute))); }
- }
-
- internal Type System_Runtime_CompilerServices_SpecialNameAttribute
- {
- get { return typeof_System_Runtime_CompilerServices_SpecialNameAttribute ?? (typeof_System_Runtime_CompilerServices_SpecialNameAttribute = ImportMscorlibType(typeof(System.Runtime.CompilerServices.SpecialNameAttribute))); }
- }
-
- internal Type System_Runtime_CompilerServices_MethodImplAttribute
- {
- get { return typeof_System_Runtime_CompilerServices_MethodImplAttribute ?? (typeof_System_Runtime_CompilerServices_MethodImplAttribute = ImportMscorlibType(typeof(System.Runtime.CompilerServices.MethodImplAttribute))); }
- }
-
- internal Type System_Security_SuppressUnmanagedCodeSecurityAttribute
- {
- get { return typeof_System_Security_SuppressUnmanagedCodeSecurityAttribute ?? (typeof_System_Security_SuppressUnmanagedCodeSecurityAttribute = ImportMscorlibType(typeof(System.Security.SuppressUnmanagedCodeSecurityAttribute))); }
- }
-
- internal Type System_Reflection_AssemblyCopyrightAttribute
- {
- get { return typeof_System_Reflection_AssemblyCopyrightAttribute ?? (typeof_System_Reflection_AssemblyCopyrightAttribute = ImportMscorlibType(typeof(System.Reflection.AssemblyCopyrightAttribute))); }
- }
-
- internal Type System_Reflection_AssemblyTrademarkAttribute
- {
- get { return typeof_System_Reflection_AssemblyTrademarkAttribute ?? (typeof_System_Reflection_AssemblyTrademarkAttribute = ImportMscorlibType(typeof(System.Reflection.AssemblyTrademarkAttribute))); }
- }
-
- internal Type System_Reflection_AssemblyProductAttribute
- {
- get { return typeof_System_Reflection_AssemblyProductAttribute ?? (typeof_System_Reflection_AssemblyProductAttribute = ImportMscorlibType(typeof(System.Reflection.AssemblyProductAttribute))); }
- }
-
- internal Type System_Reflection_AssemblyCompanyAttribute
- {
- get { return typeof_System_Reflection_AssemblyCompanyAttribute ?? (typeof_System_Reflection_AssemblyCompanyAttribute = ImportMscorlibType(typeof(System.Reflection.AssemblyCompanyAttribute))); }
- }
-
- internal Type System_Reflection_AssemblyDescriptionAttribute
- {
- get { return typeof_System_Reflection_AssemblyDescriptionAttribute ?? (typeof_System_Reflection_AssemblyDescriptionAttribute = ImportMscorlibType(typeof(System.Reflection.AssemblyDescriptionAttribute))); }
- }
-
- internal Type System_Reflection_AssemblyTitleAttribute
- {
- get { return typeof_System_Reflection_AssemblyTitleAttribute ?? (typeof_System_Reflection_AssemblyTitleAttribute = ImportMscorlibType(typeof(System.Reflection.AssemblyTitleAttribute))); }
- }
-
- internal Type System_Reflection_AssemblyInformationalVersionAttribute
- {
- get { return typeof_System_Reflection_AssemblyInformationalVersionAttribute ?? (typeof_System_Reflection_AssemblyInformationalVersionAttribute = ImportMscorlibType(typeof(System.Reflection.AssemblyInformationalVersionAttribute))); }
- }
-
- internal Type System_Reflection_AssemblyFileVersionAttribute
- {
- get { return typeof_System_Reflection_AssemblyFileVersionAttribute ?? (typeof_System_Reflection_AssemblyFileVersionAttribute = ImportMscorlibType(typeof(System.Reflection.AssemblyFileVersionAttribute))); }
- }
-
- internal Type System_Security_Permissions_CodeAccessSecurityAttribute
- {
- get { return typeof_System_Security_Permissions_CodeAccessSecurityAttribute ?? (typeof_System_Security_Permissions_CodeAccessSecurityAttribute = ImportMscorlibType(typeof(System.Security.Permissions.CodeAccessSecurityAttribute))); }
- }
-
- internal Type System_Security_Permissions_PermissionSetAttribute
- {
- get { return typeof_System_Security_Permissions_PermissionSetAttribute ?? (typeof_System_Security_Permissions_PermissionSetAttribute = ImportMscorlibType(typeof(System.Security.Permissions.PermissionSetAttribute))); }
- }
-
- internal Type System_Security_Permissions_SecurityAction
- {
- get { return typeof_System_Security_Permissions_SecurityAction ?? (typeof_System_Security_Permissions_SecurityAction = ImportMscorlibType(typeof(System.Security.Permissions.SecurityAction))); }
- }
-
- internal bool HasMscorlib
- {
- get { return GetLoadedAssembly("mscorlib") != null; }
- }
-
- public event ResolveEventHandler AssemblyResolve
- {
- add { resolvers.Add(value); }
- remove { resolvers.Remove(value); }
- }
-
- public Type Import(System.Type type)
- {
- Type imported;
- if (!importedTypes.TryGetValue(type, out imported))
- {
- imported = ImportImpl(type);
- if (imported != null)
- {
- importedTypes.Add(type, imported);
- }
- }
- return imported;
- }
-
- private Type ImportImpl(System.Type type)
- {
- if (type.Assembly == typeof(IKVM.Reflection.Type).Assembly)
- {
- throw new ArgumentException("Did you really want to import " + type.FullName + "?");
- }
- if (type.HasElementType)
- {
- if (type.IsArray)
- {
- if (type.Name.EndsWith("[]"))
- {
- return Import(type.GetElementType()).MakeArrayType();
- }
- else
- {
- return Import(type.GetElementType()).MakeArrayType(type.GetArrayRank());
- }
- }
- else if (type.IsByRef)
- {
- return Import(type.GetElementType()).MakeByRefType();
- }
- else if (type.IsPointer)
- {
- return Import(type.GetElementType()).MakePointerType();
- }
- else
- {
- throw new InvalidOperationException();
- }
- }
- else if (type.IsGenericParameter)
- {
- if (type.DeclaringMethod != null)
- {
- throw new NotImplementedException();
- }
- else
- {
- return Import(type.DeclaringType).GetGenericArguments()[type.GenericParameterPosition];
- }
- }
- else if (type.IsGenericType && !type.IsGenericTypeDefinition)
- {
- System.Type[] args = type.GetGenericArguments();
- Type[] importedArgs = new Type[args.Length];
- for (int i = 0; i < args.Length; i++)
- {
- importedArgs[i] = Import(args[i]);
- }
- return Import(type.GetGenericTypeDefinition()).MakeGenericType(importedArgs);
- }
- else if (type.IsNested)
- {
- // note that we can't pass in the namespace here, because .NET's Type.Namespace implementation is broken for nested types
- // (it returns the namespace of the declaring type)
- return Import(type.DeclaringType).ResolveNestedType(new TypeName(null, type.Name));
- }
- else if (type.Assembly == typeof(object).Assembly)
- {
- // make sure mscorlib types always end up in our mscorlib
- return Mscorlib.ResolveType(new TypeName(type.Namespace, type.Name));
- }
- else
- {
- return Import(type.Assembly).ResolveType(new TypeName(type.Namespace, type.Name));
- }
- }
-
- private Assembly Import(System.Reflection.Assembly asm)
- {
- return Load(asm.FullName);
- }
-
- public RawModule OpenRawModule(string path)
- {
- path = Path.GetFullPath(path);
- return OpenRawModule(new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read), path);
- }
-
- public RawModule OpenRawModule(Stream stream, string location)
- {
- if (!stream.CanRead || !stream.CanSeek || stream.Position != 0)
- {
- throw new ArgumentException("Stream must support read/seek and current position must be zero.", "stream");
- }
- return new RawModule(new ModuleReader(null, this, stream, location));
- }
-
- public Assembly LoadAssembly(RawModule module)
- {
- string refname = module.GetAssemblyName().FullName;
- Assembly asm = GetLoadedAssembly(refname);
- if (asm == null)
- {
- AssemblyReader asm1 = module.ToAssembly();
- assemblies.Add(asm1);
- asm = asm1;
- }
- return asm;
- }
-
- public Assembly LoadFile(string path)
- {
- try
- {
- using (RawModule module = OpenRawModule(path))
- {
- return LoadAssembly(module);
- }
- }
- catch (IOException x)
- {
- throw new FileNotFoundException(x.Message, x);
- }
- catch (UnauthorizedAccessException x)
- {
- throw new FileNotFoundException(x.Message, x);
- }
- }
-
- private static string GetSimpleAssemblyName(string refname)
- {
- int pos;
- string name;
- if (Fusion.ParseAssemblySimpleName(refname, out pos, out name) != ParseAssemblyResult.OK)
- {
- throw new ArgumentException();
- }
- return name;
- }
-
- private Assembly GetLoadedAssembly(string refname)
- {
- Assembly asm;
- if (!assembliesByName.TryGetValue(refname, out asm))
- {
- string simpleName = GetSimpleAssemblyName(refname);
- for (int i = 0; i < assemblies.Count; i++)
- {
- AssemblyComparisonResult result;
- if (simpleName.Equals(assemblies[i].Name, StringComparison.InvariantCultureIgnoreCase)
- && CompareAssemblyIdentity(refname, false, assemblies[i].FullName, false, out result))
- {
- asm = assemblies[i];
- assembliesByName.Add(refname, asm);
- break;
- }
- }
- }
- return asm;
- }
-
- private Assembly GetDynamicAssembly(string refname)
- {
- string simpleName = GetSimpleAssemblyName(refname);
- foreach (AssemblyBuilder asm in dynamicAssemblies)
- {
- AssemblyComparisonResult result;
- if (simpleName.Equals(asm.Name, StringComparison.InvariantCultureIgnoreCase)
- && CompareAssemblyIdentity(refname, false, asm.FullName, false, out result))
- {
- return asm;
- }
- }
- return null;
- }
-
- public Assembly Load(string refname)
- {
- return Load(refname, null, true);
- }
-
- internal Assembly Load(string refname, Assembly requestingAssembly, bool throwOnError)
- {
- Assembly asm = GetLoadedAssembly(refname);
- if (asm != null)
- {
- return asm;
- }
- if (resolvers.Count == 0)
- {
- asm = DefaultResolver(refname, throwOnError);
- }
- else
- {
- ResolveEventArgs args = new ResolveEventArgs(refname, requestingAssembly);
- foreach (ResolveEventHandler evt in resolvers)
- {
- asm = evt(this, args);
- if (asm != null)
- {
- break;
- }
- }
- if (asm == null)
- {
- asm = GetDynamicAssembly(refname);
- }
- }
- if (asm != null)
- {
- string defname = asm.FullName;
- if (refname != defname)
- {
- assembliesByName.Add(refname, asm);
- }
- return asm;
- }
- if (throwOnError)
- {
- throw new FileNotFoundException(refname);
- }
- return null;
- }
-
- private Assembly DefaultResolver(string refname, bool throwOnError)
- {
- Assembly asm = GetDynamicAssembly(refname);
- if (asm != null)
- {
- return asm;
- }
- string fileName;
- if (throwOnError)
- {
- try
- {
- fileName = System.Reflection.Assembly.ReflectionOnlyLoad(refname).Location;
- }
- catch (System.BadImageFormatException x)
- {
- throw new BadImageFormatException(x.Message, x);
- }
- }
- else
- {
- try
- {
- fileName = System.Reflection.Assembly.ReflectionOnlyLoad(refname).Location;
- }
- catch (System.BadImageFormatException x)
- {
- throw new BadImageFormatException(x.Message, x);
- }
- catch (FileNotFoundException)
- {
- // we intentionally only swallow the FileNotFoundException, if the file exists but isn't a valid assembly,
- // we should throw an exception
- return null;
- }
- }
- return LoadFile(fileName);
- }
-
- public Type GetType(string assemblyQualifiedTypeName)
- {
- // to be more compatible with Type.GetType(), we could call Assembly.GetCallingAssembly(),
- // import that assembly and pass it as the context, but implicitly importing is considered evil
- return GetType(null, assemblyQualifiedTypeName, false, false);
- }
-
- public Type GetType(string assemblyQualifiedTypeName, bool throwOnError)
- {
- // to be more compatible with Type.GetType(), we could call Assembly.GetCallingAssembly(),
- // import that assembly and pass it as the context, but implicitly importing is considered evil
- return GetType(null, assemblyQualifiedTypeName, throwOnError, false);
- }
-
- public Type GetType(string assemblyQualifiedTypeName, bool throwOnError, bool ignoreCase)
- {
- // to be more compatible with Type.GetType(), we could call Assembly.GetCallingAssembly(),
- // import that assembly and pass it as the context, but implicitly importing is considered evil
- return GetType(null, assemblyQualifiedTypeName, throwOnError, ignoreCase);
- }
-
- // note that context is slightly different from the calling assembly (System.Type.GetType),
- // because context is passed to the AssemblyResolve event as the RequestingAssembly
- public Type GetType(Assembly context, string assemblyQualifiedTypeName, bool throwOnError)
- {
- return GetType(context, assemblyQualifiedTypeName, throwOnError, false);
- }
-
- // note that context is slightly different from the calling assembly (System.Type.GetType),
- // because context is passed to the AssemblyResolve event as the RequestingAssembly
- public Type GetType(Assembly context, string assemblyQualifiedTypeName, bool throwOnError, bool ignoreCase)
- {
- TypeNameParser parser = TypeNameParser.Parse(assemblyQualifiedTypeName, throwOnError);
- if (parser.Error)
- {
- return null;
- }
- return parser.GetType(this, context, throwOnError, assemblyQualifiedTypeName, false, ignoreCase);
- }
-
- // this is similar to GetType(Assembly context, string assemblyQualifiedTypeName, bool throwOnError),
- // but instead it assumes that the type must exist (i.e. if EnableMissingMemberResolution is enabled
- // it will create a missing type)
- public Type ResolveType(Assembly context, string assemblyQualifiedTypeName)
- {
- TypeNameParser parser = TypeNameParser.Parse(assemblyQualifiedTypeName, false);
- if (parser.Error)
- {
- return null;
- }
- return parser.GetType(this, context, false, assemblyQualifiedTypeName, true, false);
- }
-
- public Assembly[] GetAssemblies()
- {
- Assembly[] array = new Assembly[assemblies.Count + dynamicAssemblies.Count];
- for (int i = 0; i < assemblies.Count; i++)
- {
- array[i] = assemblies[i];
- }
- for (int i = 0, j = assemblies.Count; j < array.Length; i++, j++)
- {
- array[j] = dynamicAssemblies[i];
- }
- return array;
- }
-
- // this is equivalent to the Fusion CompareAssemblyIdentity API
- public bool CompareAssemblyIdentity(string assemblyIdentity1, bool unified1, string assemblyIdentity2, bool unified2, out AssemblyComparisonResult result)
- {
- return useNativeFusion
- ? Fusion.CompareAssemblyIdentityNative(assemblyIdentity1, unified1, assemblyIdentity2, unified2, out result)
- : Fusion.CompareAssemblyIdentityPure(assemblyIdentity1, unified1, assemblyIdentity2, unified2, out result);
- }
-
- public AssemblyBuilder DefineDynamicAssembly(AssemblyName name, AssemblyBuilderAccess access)
- {
- return DefineDynamicAssemblyImpl(name, access, null, null, null, null);
- }
-
- public AssemblyBuilder DefineDynamicAssembly(AssemblyName name, AssemblyBuilderAccess access, string dir)
- {
- return DefineDynamicAssemblyImpl(name, access, dir, null, null, null);
- }
-
-#if NET_4_0
- [Obsolete]
-#endif
- public AssemblyBuilder DefineDynamicAssembly(AssemblyName name, AssemblyBuilderAccess access, string dir, PermissionSet requiredPermissions, PermissionSet optionalPermissions, PermissionSet refusedPermissions)
- {
- return DefineDynamicAssemblyImpl(name, access, dir, requiredPermissions, optionalPermissions, refusedPermissions);
- }
-
- private AssemblyBuilder DefineDynamicAssemblyImpl(AssemblyName name, AssemblyBuilderAccess access, string dir, PermissionSet requiredPermissions, PermissionSet optionalPermissions, PermissionSet refusedPermissions)
- {
- AssemblyBuilder asm = new AssemblyBuilder(this, name, dir, requiredPermissions, optionalPermissions, refusedPermissions);
- dynamicAssemblies.Add(asm);
- return asm;
- }
-
- internal void RenameAssembly(Assembly assembly, AssemblyName oldName)
- {
- List<string> remove = new List<string>();
- foreach (KeyValuePair<string, Assembly> kv in assembliesByName)
- {
- if (kv.Value == assembly)
- {
- remove.Add(kv.Key);
- }
- }
- foreach (string key in remove)
- {
- assembliesByName.Remove(key);
- }
- }
-
- public void Dispose()
- {
- foreach (Assembly asm in assemblies)
- {
- foreach (Module mod in asm.GetLoadedModules())
- {
- mod.Dispose();
- }
- }
- foreach (AssemblyBuilder asm in dynamicAssemblies)
- {
- foreach (Module mod in asm.GetLoadedModules())
- {
- mod.Dispose();
- }
- }
- }
-
- public Assembly CreateMissingAssembly(string assemblyName)
- {
- Assembly asm = new MissingAssembly(this, assemblyName);
- string name = asm.FullName;
- if (!assembliesByName.ContainsKey(name))
- {
- assembliesByName.Add(name, asm);
- }
- return asm;
- }
-
- public void EnableMissingMemberResolution()
- {
- resolveMissingMembers = true;
- }
-
- internal bool MissingMemberResolution
- {
- get { return resolveMissingMembers; }
- }
-
- internal bool EnableFunctionPointers
- {
- get { return enableFunctionPointers; }
- }
-
- private struct ScopedTypeName : IEquatable<ScopedTypeName>
- {
- private readonly object scope;
- private readonly TypeName name;
-
- internal ScopedTypeName(object scope, TypeName name)
- {
- this.scope = scope;
- this.name = name;
- }
-
- public override bool Equals(object obj)
- {
- ScopedTypeName? other = obj as ScopedTypeName?;
- return other != null && ((IEquatable<ScopedTypeName>)other.Value).Equals(this);
- }
-
- public override int GetHashCode()
- {
- return scope.GetHashCode() * 7 + name.GetHashCode();
- }
-
- bool IEquatable<ScopedTypeName>.Equals(ScopedTypeName other)
- {
- return other.scope == scope && other.name == name;
- }
- }
-
- private Type GetMissingType(Module module, Type declaringType, TypeName typeName)
- {
- if (missingTypes == null)
- {
- missingTypes = new Dictionary<ScopedTypeName, Type>();
- }
- ScopedTypeName stn = new ScopedTypeName(declaringType ?? (object)module, typeName);
- Type type;
- if (!missingTypes.TryGetValue(stn, out type))
- {
- type = new MissingType(module, declaringType, typeName.Namespace, typeName.Name);
- missingTypes.Add(stn, type);
- }
- return type;
- }
-
- internal Type GetMissingTypeOrThrow(Module module, Type declaringType, TypeName typeName)
- {
- if (resolveMissingMembers || module.Assembly.__IsMissing)
- {
- return GetMissingType(module, declaringType, typeName);
- }
- string fullName = TypeNameParser.Escape(typeName.ToString());
- if (declaringType != null)
- {
- fullName = declaringType.FullName + "+" + fullName;
- }
- throw new TypeLoadException(String.Format("Type '{0}' not found in assembly '{1}'", fullName, module.Assembly.FullName));
- }
-
- internal MethodBase GetMissingMethodOrThrow(Type declaringType, string name, MethodSignature signature)
- {
- if (resolveMissingMembers)
- {
- MethodInfo method = new MissingMethod(declaringType, name, signature);
- if (name == ".ctor")
- {
- return new ConstructorInfoImpl(method);
- }
- return method;
- }
- throw new MissingMethodException(declaringType.ToString(), name);
- }
-
- internal FieldInfo GetMissingFieldOrThrow(Type declaringType, string name, FieldSignature signature)
- {
- if (resolveMissingMembers)
- {
- return new MissingField(declaringType, name, signature);
- }
- throw new MissingFieldException(declaringType.ToString(), name);
- }
-
- internal PropertyInfo GetMissingPropertyOrThrow(Type declaringType, string name, PropertySignature propertySignature)
- {
- // HACK we need to check __IsMissing here, because Type doesn't have a FindProperty API
- // since properties are never resolved, except by custom attributes
- if (resolveMissingMembers || declaringType.__IsMissing)
- {
- return new MissingProperty(declaringType, name, propertySignature);
- }
- throw new System.MissingMemberException(declaringType.ToString(), name);
- }
-
- internal Type CanonicalizeType(Type type)
- {
- Type canon;
- if (!canonicalizedTypes.TryGetValue(type, out canon))
- {
- canon = type;
- canonicalizedTypes.Add(canon, canon);
- }
- return canon;
- }
-
- public Type MakeFunctionPointer(__StandAloneMethodSig sig)
- {
- return FunctionPointerType.Make(this, sig);
- }
-
- public __StandAloneMethodSig MakeStandAloneMethodSig(System.Runtime.InteropServices.CallingConvention callingConvention, Type returnType, CustomModifiers returnTypeCustomModifiers, Type[] parameterTypes, CustomModifiers[] parameterTypeCustomModifiers)
- {
- return new __StandAloneMethodSig(true, callingConvention, 0, returnType ?? this.System_Void, Util.Copy(parameterTypes), Type.EmptyTypes,
- PackedCustomModifiers.CreateFromExternal(returnTypeCustomModifiers, parameterTypeCustomModifiers, Util.NullSafeLength(parameterTypes)));
- }
-
- public __StandAloneMethodSig MakeStandAloneMethodSig(CallingConventions callingConvention, Type returnType, CustomModifiers returnTypeCustomModifiers, Type[] parameterTypes, Type[] optionalParameterTypes, CustomModifiers[] parameterTypeCustomModifiers)
- {
- return new __StandAloneMethodSig(false, 0, callingConvention, returnType ?? this.System_Void, Util.Copy(parameterTypes), Util.Copy(optionalParameterTypes),
- PackedCustomModifiers.CreateFromExternal(returnTypeCustomModifiers, parameterTypeCustomModifiers, Util.NullSafeLength(parameterTypes) + Util.NullSafeLength(optionalParameterTypes)));
- }
-
- public event Predicate<Type> MissingTypeIsValueType
- {
- add
- {
- if (missingTypeIsValueType != null)
- {
- throw new InvalidOperationException("Only a single MissingTypeIsValueType handler can be registered.");
- }
- missingTypeIsValueType = value;
- }
- remove
- {
- if (value.Equals(missingTypeIsValueType))
- {
- missingTypeIsValueType = null;
- }
- }
- }
-
- internal bool ResolveMissingTypeIsValueType(MissingType missingType)
- {
- if (missingTypeIsValueType != null)
- {
- return missingTypeIsValueType(missingType);
- }
- throw new MissingMemberException(missingType);
- }
-
- internal bool ReturnPseudoCustomAttributes
- {
- get { return returnPseudoCustomAttributes; }
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2008-2011 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Runtime.Serialization;
-
-namespace IKVM.Reflection
-{
- public interface ICustomAttributeProvider
- {
- bool IsDefined(Type attributeType, bool inherit);
- IList<CustomAttributeData> __GetCustomAttributes(Type attributeType, bool inherit);
- }
-
- [Serializable]
- public sealed class FileFormatLimitationExceededException : InvalidOperationException
- {
- public const int META_E_STRINGSPACE_FULL = unchecked((int)0x80131198);
-
- public FileFormatLimitationExceededException(string message, int hresult)
- : base(message)
- {
- this.HResult = hresult;
- }
-
- private FileFormatLimitationExceededException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
- : base(info, context)
- {
- }
-
- public int ErrorCode
- {
- get { return this.HResult; }
- }
- }
-
- [Serializable]
- public sealed class Missing : ISerializable
- {
- public static readonly Missing Value = new Missing();
-
- private Missing() { }
-
- void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
- {
- info.SetType(typeof(SingletonSerializationHelper));
- }
-
- [Serializable]
- private sealed class SingletonSerializationHelper : IObjectReference
- {
- public object GetRealObject(StreamingContext context)
- {
- return Value;
- }
- }
- }
-
- static class Empty<T>
- {
- internal static readonly T[] Array = new T[0];
- }
-
- static class Util
- {
- internal static int[] Copy(int[] array)
- {
- if (array == null || array.Length == 0)
- {
- return Empty<int>.Array;
- }
- int[] copy = new int[array.Length];
- Array.Copy(array, copy, array.Length);
- return copy;
- }
-
- internal static Type[] Copy(Type[] array)
- {
- if (array == null || array.Length == 0)
- {
- return Type.EmptyTypes;
- }
- Type[] copy = new Type[array.Length];
- Array.Copy(array, copy, array.Length);
- return copy;
- }
-
- internal static T[] ToArray<T, V>(List<V> list, T[] empty) where V : T
- {
- if (list == null || list.Count == 0)
- {
- return empty;
- }
- T[] array = new T[list.Count];
- for (int i = 0; i < array.Length; i++)
- {
- array[i] = list[i];
- }
- return array;
- }
-
- internal static T[] ToArray<T>(IEnumerable<T> values)
- {
- return values == null
- ? Empty<T>.Array
- : new List<T>(values).ToArray();
- }
-
- // note that an empty array matches a null reference
- internal static bool ArrayEquals(Type[] t1, Type[] t2)
- {
- if (t1 == t2)
- {
- return true;
- }
- if (t1 == null)
- {
- return t2.Length == 0;
- }
- else if (t2 == null)
- {
- return t1.Length == 0;
- }
- if (t1.Length == t2.Length)
- {
- for (int i = 0; i < t1.Length; i++)
- {
- if (!TypeEquals(t1[i], t2[i]))
- {
- return false;
- }
- }
- return true;
- }
- return false;
- }
-
- internal static bool TypeEquals(Type t1, Type t2)
- {
- if (t1 == t2)
- {
- return true;
- }
- if (t1 == null)
- {
- return false;
- }
- return t1.Equals(t2);
- }
-
- internal static int GetHashCode(Type[] types)
- {
- if (types == null)
- {
- return 0;
- }
- int h = 0;
- foreach (Type t in types)
- {
- if (t != null)
- {
- h *= 3;
- h ^= t.GetHashCode();
- }
- }
- return h;
- }
-
- internal static bool ArrayEquals(CustomModifiers[] m1, CustomModifiers[] m2)
- {
- if (m1 == null || m2 == null)
- {
- return m1 == m2;
- }
- if (m1.Length != m2.Length)
- {
- return false;
- }
- for (int i = 0; i < m1.Length; i++)
- {
- if (!m1[i].Equals(m2[i]))
- {
- return false;
- }
- }
- return true;
- }
-
- internal static int GetHashCode(CustomModifiers[] mods)
- {
- int h = 0;
- if (mods != null)
- {
- foreach (CustomModifiers mod in mods)
- {
- h ^= mod.GetHashCode();
- }
- }
- return h;
- }
-
- internal static T NullSafeElementAt<T>(T[] array, int index)
- {
- return array == null ? default(T) : array[index];
- }
-
- internal static int NullSafeLength<T>(T[] array)
- {
- return array == null ? 0 : array.Length;
- }
- }
-
- [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Explicit)]
- struct SingleConverter
- {
- [System.Runtime.InteropServices.FieldOffset(0)]
- private int i;
- [System.Runtime.InteropServices.FieldOffset(0)]
- private float f;
-
- internal static int SingleToInt32Bits(float v)
- {
- SingleConverter c = new SingleConverter();
- c.f = v;
- return c.i;
- }
-
- internal static float Int32BitsToSingle(int v)
- {
- SingleConverter c = new SingleConverter();
- c.i = v;
- return c.f;
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2008 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection.Writer
-{
- sealed class ByteBuffer
- {
- private byte[] buffer;
- private int pos;
- private int __length; // __length is only valid if > pos, otherwise pos is the current length
-
- internal ByteBuffer(int initialCapacity)
- {
- buffer = new byte[initialCapacity];
- }
-
- private ByteBuffer(byte[] wrap, int length)
- {
- this.buffer = wrap;
- this.pos = length;
- }
-
- internal int Position
- {
- get { return pos; }
- set
- {
- if (value > this.Length || value > buffer.Length)
- throw new ArgumentOutOfRangeException();
- __length = Math.Max(__length, pos);
- pos = value;
- }
- }
-
- internal int Length
- {
- get { return Math.Max(pos, __length); }
- }
-
- // insert count bytes at the current position (without advancing the current position)
- internal void Insert(int count)
- {
- if (count > 0)
- {
- int len = this.Length;
- int free = buffer.Length - len;
- if (free < count)
- {
- Grow(count - free);
- }
- Buffer.BlockCopy(buffer, pos, buffer, pos + count, len - pos);
- __length = Math.Max(__length, pos) + count;
- }
- else if (count < 0)
- {
- throw new ArgumentOutOfRangeException("count");
- }
- }
-
- private void Grow(int minGrow)
- {
- byte[] newbuf = new byte[Math.Max(buffer.Length + minGrow, buffer.Length * 2)];
- Buffer.BlockCopy(buffer, 0, newbuf, 0, buffer.Length);
- buffer = newbuf;
- }
-
- // NOTE this does not advance the position
- internal int GetInt32AtCurrentPosition()
- {
- return buffer[pos]
- + (buffer[pos + 1] << 8)
- + (buffer[pos + 2] << 16)
- + (buffer[pos + 3] << 24);
- }
-
- // NOTE this does not advance the position
- internal byte GetByteAtCurrentPosition()
- {
- return buffer[pos];
- }
-
- // return the number of bytes that the compressed int at the current position takes
- internal int GetCompressedIntLength()
- {
- switch (buffer[pos] & 0xC0)
- {
- default:
- return 1;
- case 0x80:
- return 2;
- case 0xC0:
- return 4;
- }
- }
-
- internal void Write(byte[] value)
- {
- if (pos + value.Length > buffer.Length)
- Grow(value.Length);
- Buffer.BlockCopy(value, 0, buffer, pos, value.Length);
- pos += value.Length;
- }
-
- internal void Write(byte value)
- {
- if (pos == buffer.Length)
- Grow(1);
- buffer[pos++] = value;
- }
-
- internal void Write(sbyte value)
- {
- Write((byte)value);
- }
-
- internal void Write(ushort value)
- {
- Write((short)value);
- }
-
- internal void Write(short value)
- {
- if (pos + 2 > buffer.Length)
- Grow(2);
- buffer[pos++] = (byte)value;
- buffer[pos++] = (byte)(value >> 8);
- }
-
- internal void Write(uint value)
- {
- Write((int)value);
- }
-
- internal void Write(int value)
- {
- if (pos + 4 > buffer.Length)
- Grow(4);
- buffer[pos++] = (byte)value;
- buffer[pos++] = (byte)(value >> 8);
- buffer[pos++] = (byte)(value >> 16);
- buffer[pos++] = (byte)(value >> 24);
- }
-
- internal void Write(ulong value)
- {
- Write((long)value);
- }
-
- internal void Write(long value)
- {
- if (pos + 8 > buffer.Length)
- Grow(8);
- buffer[pos++] = (byte)value;
- buffer[pos++] = (byte)(value >> 8);
- buffer[pos++] = (byte)(value >> 16);
- buffer[pos++] = (byte)(value >> 24);
- buffer[pos++] = (byte)(value >> 32);
- buffer[pos++] = (byte)(value >> 40);
- buffer[pos++] = (byte)(value >> 48);
- buffer[pos++] = (byte)(value >> 56);
- }
-
- internal void Write(float value)
- {
- Write(SingleConverter.SingleToInt32Bits(value));
- }
-
- internal void Write(double value)
- {
- Write(BitConverter.DoubleToInt64Bits(value));
- }
-
- internal void Write(string str)
- {
- if (str == null)
- {
- Write((byte)0xFF);
- }
- else
- {
- byte[] buf = Encoding.UTF8.GetBytes(str);
- WriteCompressedInt(buf.Length);
- Write(buf);
- }
- }
-
- internal void WriteCompressedInt(int value)
- {
- if (value <= 0x7F)
- {
- Write((byte)value);
- }
- else if (value <= 0x3FFF)
- {
- Write((byte)(0x80 | (value >> 8)));
- Write((byte)value);
- }
- else
- {
- Write((byte)(0xC0 | (value >> 24)));
- Write((byte)(value >> 16));
- Write((byte)(value >> 8));
- Write((byte)value);
- }
- }
-
- internal void Write(ByteBuffer bb)
- {
- if (pos + bb.Length > buffer.Length)
- Grow(bb.Length);
- Buffer.BlockCopy(bb.buffer, 0, buffer, pos, bb.Length);
- pos += bb.Length;
- }
-
- internal void WriteTo(System.IO.Stream stream)
- {
- stream.Write(buffer, 0, this.Length);
- }
-
- internal void Clear()
- {
- pos = 0;
- __length = 0;
- }
-
- internal void Align(int alignment)
- {
- if (pos + alignment > buffer.Length)
- Grow(alignment);
- int newpos = (pos + alignment - 1) & ~(alignment - 1);
- while (pos < newpos)
- buffer[pos++] = 0;
- }
-
- internal void WriteTypeDefOrRefEncoded(int token)
- {
- switch (token >> 24)
- {
- case TypeDefTable.Index:
- WriteCompressedInt((token & 0xFFFFFF) << 2 | 0);
- break;
- case TypeRefTable.Index:
- WriteCompressedInt((token & 0xFFFFFF) << 2 | 1);
- break;
- case TypeSpecTable.Index:
- WriteCompressedInt((token & 0xFFFFFF) << 2 | 2);
- break;
- default:
- throw new InvalidOperationException();
- }
- }
-
- internal void Write(System.IO.Stream stream)
- {
- const int chunkSize = 8192;
- for (; ; )
- {
- if (pos + chunkSize > buffer.Length)
- Grow(chunkSize);
- int read = stream.Read(buffer, pos, chunkSize);
- if (read <= 0)
- {
- break;
- }
- pos += read;
- }
- }
-
- internal byte[] ToArray()
- {
- int len = this.Length;
- byte[] buf = new byte[len];
- Buffer.BlockCopy(buffer, 0, buf, 0, len);
- return buf;
- }
-
- internal static ByteBuffer Wrap(byte[] buf)
- {
- return new ByteBuffer(buf, buf.Length);
- }
-
- internal static ByteBuffer Wrap(byte[] buf, int length)
- {
- return new ByteBuffer(buf, length);
- }
-
- internal bool Match(int pos, ByteBuffer bb2, int pos2, int len)
- {
- for (int i = 0; i < len; i++)
- {
- if (buffer[pos + i] != bb2.buffer[pos2 + i])
- {
- return false;
- }
- }
- return true;
- }
-
- internal int Hash()
- {
- int hash = 0;
- int len = this.Length;
- for (int i = 0; i < len; i++)
- {
- hash *= 37;
- hash ^= buffer[i];
- }
- return hash;
- }
-
- internal IKVM.Reflection.Reader.ByteReader GetBlob(int offset)
- {
- return IKVM.Reflection.Reader.ByteReader.FromBlob(buffer, offset);
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2008 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Diagnostics;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection.Writer
-{
- abstract class Heap
- {
- protected bool frozen;
- protected int unalignedlength;
-
- internal void Write(MetadataWriter mw)
- {
- int pos = mw.Position;
- WriteImpl(mw);
- Debug.Assert(mw.Position == pos + unalignedlength);
- int align = Length - unalignedlength;
- for (int i = 0; i < align; i++)
- {
- mw.Write((byte)0);
- }
- }
-
- internal bool IsBig
- {
- get { return Length > 65535; }
- }
-
- internal int Length
- {
- get
- {
- if (!frozen)
- throw new InvalidOperationException();
- return (unalignedlength + 3) & ~3;
- }
- }
-
- protected abstract void WriteImpl(MetadataWriter mw);
- }
-
- abstract class SimpleHeap : Heap
- {
- internal void Freeze()
- {
- if (frozen)
- throw new InvalidOperationException();
- frozen = true;
- unalignedlength = GetLength();
- }
-
- protected abstract int GetLength();
- }
-
- sealed class TableHeap : Heap
- {
- internal void Freeze(MetadataWriter mw)
- {
- if (frozen)
- throw new InvalidOperationException();
- frozen = true;
- unalignedlength = GetLength(mw);
- }
-
- protected override void WriteImpl(MetadataWriter mw)
- {
- Table[] tables = mw.ModuleBuilder.GetTables();
- // Header
- mw.Write(0); // Reserved
- int ver = mw.ModuleBuilder.MDStreamVersion;
- mw.Write((byte)(ver >> 16)); // MajorVersion
- mw.Write((byte)ver); // MinorVersion
- byte heapSizes = 0;
- if (mw.ModuleBuilder.Strings.IsBig)
- {
- heapSizes |= 0x01;
- }
- if (mw.ModuleBuilder.Guids.IsBig)
- {
- heapSizes |= 0x02;
- }
- if (mw.ModuleBuilder.Blobs.IsBig)
- {
- heapSizes |= 0x04;
- }
- mw.Write(heapSizes);// HeapSizes
- // LAMESPEC spec says reserved, but .NET 2.0 Ref.Emit sets it to 0x10
- mw.Write((byte)0x10); // Reserved
- long bit = 1;
- long valid = 0;
- foreach (Table table in tables)
- {
- if (table != null && table.RowCount > 0)
- {
- valid |= bit;
- }
- bit <<= 1;
- }
- mw.Write(valid); // Valid
- mw.Write(0x0016003301FA00L); // Sorted
- // Rows
- foreach (Table table in tables)
- {
- if (table != null && table.RowCount > 0)
- {
- mw.Write(table.RowCount);
- }
- }
- // Tables
- foreach (Table table in tables)
- {
- if (table != null && table.RowCount > 0)
- {
- int pos = mw.Position;
- table.Write(mw);
- Debug.Assert(mw.Position - pos == table.GetLength(mw));
- }
- }
- // unexplained extra padding
- mw.Write((byte)0);
- }
-
- private static int GetLength(MetadataWriter mw)
- {
- int len = 4 + 4 + 8 + 8;
- foreach (Table table in mw.ModuleBuilder.GetTables())
- {
- if (table != null && table.RowCount > 0)
- {
- len += 4; // row count
- len += table.GetLength(mw);
- }
- }
- // note that we pad one extra (unexplained) byte
- return len + 1;
- }
- }
-
- sealed class StringHeap : SimpleHeap
- {
- private List<string> list = new List<string>();
- private Dictionary<string, int> strings = new Dictionary<string, int>();
- private int nextOffset;
-
- internal StringHeap()
- {
- Add("");
- }
-
- internal int Add(string str)
- {
- Debug.Assert(!frozen);
- int offset;
- if (!strings.TryGetValue(str, out offset))
- {
- offset = nextOffset;
- nextOffset += System.Text.Encoding.UTF8.GetByteCount(str) + 1;
- list.Add(str);
- strings.Add(str, offset);
- }
- return offset;
- }
-
- internal string Find(int index)
- {
- foreach (KeyValuePair<string, int> kv in strings)
- {
- if (kv.Value == index)
- {
- return kv.Key;
- }
- }
- return null;
- }
-
- protected override int GetLength()
- {
- return nextOffset;
- }
-
- protected override void WriteImpl(MetadataWriter mw)
- {
- foreach (string str in list)
- {
- mw.Write(System.Text.Encoding.UTF8.GetBytes(str));
- mw.Write((byte)0);
- }
- }
- }
-
- sealed class UserStringHeap : SimpleHeap
- {
- private List<string> list = new List<string>();
- private Dictionary<string, int> strings = new Dictionary<string, int>();
- private int nextOffset;
-
- internal UserStringHeap()
- {
- nextOffset = 1;
- }
-
- internal bool IsEmpty
- {
- get { return nextOffset == 1; }
- }
-
- internal int Add(string str)
- {
- Debug.Assert(!frozen);
- int offset;
- if (!strings.TryGetValue(str, out offset))
- {
- int length = str.Length * 2 + 1 + MetadataWriter.GetCompressedIntLength(str.Length * 2 + 1);
- if (nextOffset + length > 0xFFFFFF)
- {
- throw new FileFormatLimitationExceededException("No logical space left to create more user strings.", FileFormatLimitationExceededException.META_E_STRINGSPACE_FULL);
- }
- offset = nextOffset;
- nextOffset += length;
- list.Add(str);
- strings.Add(str, offset);
- }
- return offset;
- }
-
- protected override int GetLength()
- {
- return nextOffset;
- }
-
- protected override void WriteImpl(MetadataWriter mw)
- {
- mw.Write((byte)0);
- foreach (string str in list)
- {
- mw.WriteCompressedInt(str.Length * 2 + 1);
- byte hasSpecialChars = 0;
- foreach (char ch in str)
- {
- mw.Write((ushort)ch);
- if (hasSpecialChars == 0 && (ch < 0x20 || ch > 0x7E))
- {
- if (ch > 0x7E
- || (ch >= 0x01 && ch <= 0x08)
- || (ch >= 0x0E && ch <= 0x1F)
- || ch == 0x27
- || ch == 0x2D)
- {
- hasSpecialChars = 1;
- }
- }
- }
- mw.Write(hasSpecialChars);
- }
- }
- }
-
- sealed class GuidHeap : SimpleHeap
- {
- private List<Guid> list = new List<Guid>();
-
- internal GuidHeap()
- {
- }
-
- internal int Add(Guid guid)
- {
- Debug.Assert(!frozen);
- list.Add(guid);
- return list.Count;
- }
-
- protected override int GetLength()
- {
- return list.Count * 16;
- }
-
- protected override void WriteImpl(MetadataWriter mw)
- {
- foreach (Guid guid in list)
- {
- mw.Write(guid.ToByteArray());
- }
- }
- }
-
- sealed class BlobHeap : SimpleHeap
- {
- private Key[] map = new Key[8179];
- private readonly ByteBuffer buf = new ByteBuffer(32);
-
- private struct Key
- {
- internal Key[] next;
- internal int len;
- internal int hash;
- internal int offset;
- }
-
- internal BlobHeap()
- {
- buf.Write((byte)0);
- }
-
- internal int Add(ByteBuffer bb)
- {
- Debug.Assert(!frozen);
- int bblen = bb.Length;
- if (bblen == 0)
- {
- return 0;
- }
- int lenlen = MetadataWriter.GetCompressedIntLength(bblen);
- int hash = bb.Hash();
- int index = (hash & 0x7FFFFFFF) % map.Length;
- Key[] keys = map;
- int last = index;
- while (keys[index].offset != 0)
- {
- if (keys[index].hash == hash
- && keys[index].len == bblen
- && buf.Match(keys[index].offset + lenlen, bb, 0, bblen))
- {
- return keys[index].offset;
- }
- if (index == last)
- {
- if (keys[index].next == null)
- {
- keys[index].next = new Key[4];
- keys = keys[index].next;
- index = 0;
- break;
- }
- keys = keys[index].next;
- index = -1;
- last = keys.Length - 1;
- }
- index++;
- }
- int offset = buf.Position;
- buf.WriteCompressedInt(bblen);
- buf.Write(bb);
- keys[index].len = bblen;
- keys[index].hash = hash;
- keys[index].offset = offset;
- return offset;
- }
-
- protected override int GetLength()
- {
- return buf.Position;
- }
-
- protected override void WriteImpl(MetadataWriter mw)
- {
- mw.Write(buf);
- }
-
- internal bool IsEmpty
- {
- get { return buf.Position == 1; }
- }
-
- internal IKVM.Reflection.Reader.ByteReader GetBlob(int blobIndex)
- {
- return buf.GetBlob(blobIndex);
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2008 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.IO;
-using System.Collections.Generic;
-using System.Text;
-using IKVM.Reflection.Emit;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection.Writer
-{
- sealed class MetadataWriter : MetadataRW
- {
- private readonly ModuleBuilder moduleBuilder;
- private readonly Stream stream;
- private readonly byte[] buffer = new byte[8];
-
- internal MetadataWriter(ModuleBuilder module, Stream stream)
- : base(module, module.Strings.IsBig, module.Guids.IsBig, module.Blobs.IsBig)
- {
- this.moduleBuilder = module;
- this.stream = stream;
- }
-
- internal ModuleBuilder ModuleBuilder
- {
- get { return moduleBuilder; }
- }
-
- internal int Position
- {
- get { return (int)stream.Position; }
- }
-
- internal void Write(ByteBuffer bb)
- {
- bb.WriteTo(stream);
- }
-
- internal void Write(byte[] value)
- {
- stream.Write(value, 0, value.Length);
- }
-
- internal void Write(byte value)
- {
- stream.WriteByte(value);
- }
-
- internal void Write(ushort value)
- {
- Write((short)value);
- }
-
- internal void Write(short value)
- {
- stream.WriteByte((byte)value);
- stream.WriteByte((byte)(value >> 8));
- }
-
- internal void Write(uint value)
- {
- Write((int)value);
- }
-
- internal void Write(int value)
- {
- buffer[0] = (byte)value;
- buffer[1] = (byte)(value >> 8);
- buffer[2] = (byte)(value >> 16);
- buffer[3] = (byte)(value >> 24);
- stream.Write(buffer, 0, 4);
- }
-
- internal void Write(ulong value)
- {
- Write((long)value);
- }
-
- internal void Write(long value)
- {
- buffer[0] = (byte)value;
- buffer[1] = (byte)(value >> 8);
- buffer[2] = (byte)(value >> 16);
- buffer[3] = (byte)(value >> 24);
- buffer[4] = (byte)(value >> 32);
- buffer[5] = (byte)(value >> 40);
- buffer[6] = (byte)(value >> 48);
- buffer[7] = (byte)(value >> 56);
- stream.Write(buffer, 0, 8);
- }
-
- internal void WriteCompressedInt(int value)
- {
- if (value <= 0x7F)
- {
- Write((byte)value);
- }
- else if (value <= 0x3FFF)
- {
- Write((byte)(0x80 | (value >> 8)));
- Write((byte)value);
- }
- else
- {
- Write((byte)(0xC0 | (value >> 24)));
- Write((byte)(value >> 16));
- Write((byte)(value >> 8));
- Write((byte)value);
- }
- }
-
- internal static int GetCompressedIntLength(int value)
- {
- if (value <= 0x7F)
- {
- return 1;
- }
- else if (value <= 0x3FFF)
- {
- return 2;
- }
- else
- {
- return 4;
- }
- }
-
- internal void WriteStringIndex(int index)
- {
- if (bigStrings)
- {
- Write(index);
- }
- else
- {
- Write((short)index);
- }
- }
-
- internal void WriteGuidIndex(int index)
- {
- if (bigGuids)
- {
- Write(index);
- }
- else
- {
- Write((short)index);
- }
- }
-
- internal void WriteBlobIndex(int index)
- {
- if (bigBlobs)
- {
- Write(index);
- }
- else
- {
- Write((short)index);
- }
- }
-
- internal void WriteTypeDefOrRef(int token)
- {
- switch (token >> 24)
- {
- case 0:
- break;
- case TypeDefTable.Index:
- token = (token & 0xFFFFFF) << 2 | 0;
- break;
- case TypeRefTable.Index:
- token = (token & 0xFFFFFF) << 2 | 1;
- break;
- case TypeSpecTable.Index:
- token = (token & 0xFFFFFF) << 2 | 2;
- break;
- default:
- throw new InvalidOperationException();
- }
- if (bigTypeDefOrRef)
- {
- Write(token);
- }
- else
- {
- Write((short)token);
- }
- }
-
- internal void WriteEncodedTypeDefOrRef(int encodedToken)
- {
- if (bigTypeDefOrRef)
- {
- Write(encodedToken);
- }
- else
- {
- Write((short)encodedToken);
- }
- }
-
- internal void WriteHasCustomAttribute(int token)
- {
- int encodedToken = CustomAttributeTable.EncodeHasCustomAttribute(token);
- if (bigHasCustomAttribute)
- {
- Write(encodedToken);
- }
- else
- {
- Write((short)encodedToken);
- }
- }
-
- internal void WriteCustomAttributeType(int token)
- {
- switch (token >> 24)
- {
- case MethodDefTable.Index:
- token = (token & 0xFFFFFF) << 3 | 2;
- break;
- case MemberRefTable.Index:
- token = (token & 0xFFFFFF) << 3 | 3;
- break;
- default:
- throw new InvalidOperationException();
- }
- if (bigCustomAttributeType)
- {
- Write(token);
- }
- else
- {
- Write((short)token);
- }
- }
-
- internal void WriteField(int index)
- {
- if (bigField)
- {
- Write(index & 0xFFFFFF);
- }
- else
- {
- Write((short)index);
- }
- }
-
- internal void WriteMethodDef(int index)
- {
- if (bigMethodDef)
- {
- Write(index & 0xFFFFFF);
- }
- else
- {
- Write((short)index);
- }
- }
-
- internal void WriteParam(int index)
- {
- if (bigParam)
- {
- Write(index & 0xFFFFFF);
- }
- else
- {
- Write((short)index);
- }
- }
-
- internal void WriteTypeDef(int index)
- {
- if (bigTypeDef)
- {
- Write(index & 0xFFFFFF);
- }
- else
- {
- Write((short)index);
- }
- }
-
- internal void WriteEvent(int index)
- {
- if (bigEvent)
- {
- Write(index & 0xFFFFFF);
- }
- else
- {
- Write((short)index);
- }
- }
-
- internal void WriteProperty(int index)
- {
- if (bigProperty)
- {
- Write(index & 0xFFFFFF);
- }
- else
- {
- Write((short)index);
- }
- }
-
- internal void WriteGenericParam(int index)
- {
- if (bigGenericParam)
- {
- Write(index & 0xFFFFFF);
- }
- else
- {
- Write((short)index);
- }
- }
-
- internal void WriteModuleRef(int index)
- {
- if (bigModuleRef)
- {
- Write(index & 0xFFFFFF);
- }
- else
- {
- Write((short)index);
- }
- }
-
- internal void WriteResolutionScope(int token)
- {
- switch (token >> 24)
- {
- case ModuleTable.Index:
- token = (token & 0xFFFFFF) << 2 | 0;
- break;
- case ModuleRefTable.Index:
- token = (token & 0xFFFFFF) << 2 | 1;
- break;
- case AssemblyRefTable.Index:
- token = (token & 0xFFFFFF) << 2 | 2;
- break;
- case TypeRefTable.Index:
- token = (token & 0xFFFFFF) << 2 | 3;
- break;
- default:
- throw new InvalidOperationException();
- }
- if (bigResolutionScope)
- {
- Write(token);
- }
- else
- {
- Write((short)token);
- }
- }
-
- internal void WriteMemberRefParent(int token)
- {
- switch (token >> 24)
- {
- case TypeDefTable.Index:
- token = (token & 0xFFFFFF) << 3 | 0;
- break;
- case TypeRefTable.Index:
- token = (token & 0xFFFFFF) << 3 | 1;
- break;
- case ModuleRefTable.Index:
- token = (token & 0xFFFFFF) << 3 | 2;
- break;
- case MethodDefTable.Index:
- token = (token & 0xFFFFFF) << 3 | 3;
- break;
- case TypeSpecTable.Index:
- token = (token & 0xFFFFFF) << 3 | 4;
- break;
- default:
- throw new InvalidOperationException();
- }
- if (bigMemberRefParent)
- {
- Write(token);
- }
- else
- {
- Write((short)token);
- }
- }
-
- internal void WriteMethodDefOrRef(int token)
- {
- switch (token >> 24)
- {
- case MethodDefTable.Index:
- token = (token & 0xFFFFFF) << 1 | 0;
- break;
- case MemberRefTable.Index:
- token = (token & 0xFFFFFF) << 1 | 1;
- break;
- default:
- throw new InvalidOperationException();
- }
- if (bigMethodDefOrRef)
- {
- Write(token);
- }
- else
- {
- Write((short)token);
- }
- }
-
- internal void WriteHasConstant(int token)
- {
- int encodedToken = ConstantTable.EncodeHasConstant(token);
- if (bigHasConstant)
- {
- Write(encodedToken);
- }
- else
- {
- Write((short)encodedToken);
- }
- }
-
- internal void WriteHasSemantics(int encodedToken)
- {
- // NOTE because we've already had to do the encoding (to be able to sort the table)
- // here we simple write the value
- if (bigHasSemantics)
- {
- Write(encodedToken);
- }
- else
- {
- Write((short)encodedToken);
- }
- }
-
- internal void WriteImplementation(int token)
- {
- switch (token >> 24)
- {
- case 0:
- break;
- case FileTable.Index:
- token = (token & 0xFFFFFF) << 2 | 0;
- break;
- case AssemblyRefTable.Index:
- token = (token & 0xFFFFFF) << 2 | 1;
- break;
- case ExportedTypeTable.Index:
- token = (token & 0xFFFFFF) << 2 | 2;
- break;
- default:
- throw new InvalidOperationException();
- }
- if (bigImplementation)
- {
- Write(token);
- }
- else
- {
- Write((short)token);
- }
- }
-
- internal void WriteTypeOrMethodDef(int encodedToken)
- {
- // NOTE because we've already had to do the encoding (to be able to sort the table)
- // here we simple write the value
- if (bigTypeOrMethodDef)
- {
- Write(encodedToken);
- }
- else
- {
- Write((short)encodedToken);
- }
- }
-
- internal void WriteHasDeclSecurity(int encodedToken)
- {
- // NOTE because we've already had to do the encoding (to be able to sort the table)
- // here we simple write the value
- if (bigHasDeclSecurity)
- {
- Write(encodedToken);
- }
- else
- {
- Write((short)encodedToken);
- }
- }
-
- internal void WriteMemberForwarded(int token)
- {
- switch (token >> 24)
- {
- case FieldTable.Index:
- token = (token & 0xFFFFFF) << 1 | 0;
- break;
- case MethodDefTable.Index:
- token = (token & 0xFFFFFF) << 1 | 1;
- break;
- default:
- throw new InvalidOperationException();
- }
- if (bigMemberForwarded)
- {
- Write(token);
- }
- else
- {
- Write((short)token);
- }
- }
-
- internal void WriteHasFieldMarshal(int token)
- {
- int encodedToken = FieldMarshalTable.EncodeHasFieldMarshal(token);
- if (bigHasFieldMarshal)
- {
- Write(encodedToken);
- }
- else
- {
- Write((short)encodedToken);
- }
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2008-2011 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Security.Cryptography;
-using IKVM.Reflection.Emit;
-using IKVM.Reflection.Impl;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection.Writer
-{
- static class ModuleWriter
- {
- internal static void WriteModule(StrongNameKeyPair keyPair, byte[] publicKey, ModuleBuilder moduleBuilder,
- PEFileKinds fileKind, PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine,
- ResourceSection resources, int entryPointToken)
- {
- WriteModule(keyPair, publicKey, moduleBuilder, fileKind, portableExecutableKind, imageFileMachine, resources, entryPointToken, null);
- }
-
- internal static void WriteModule(StrongNameKeyPair keyPair, byte[] publicKey, ModuleBuilder moduleBuilder,
- PEFileKinds fileKind, PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine,
- ResourceSection resources, int entryPointToken, Stream stream)
- {
- if (stream == null)
- {
- string fileName = moduleBuilder.FullyQualifiedName;
- bool mono = System.Type.GetType("Mono.Runtime") != null;
- if (mono)
- {
- try
- {
- // Mono mmaps the file, so unlink the previous version since it may be in use
- File.Delete(fileName);
- }
- catch { }
- }
- using (FileStream fs = new FileStream(fileName, FileMode.Create))
- {
- WriteModuleImpl(keyPair, publicKey, moduleBuilder, fileKind, portableExecutableKind, imageFileMachine, resources, entryPointToken, fs);
- }
- // if we're running on Mono, mark the module as executable by using a Mono private API extension
- if (mono)
- {
- File.SetAttributes(fileName, (FileAttributes)(unchecked((int)0x80000000)));
- }
- }
- else
- {
- WriteModuleImpl(keyPair, publicKey, moduleBuilder, fileKind, portableExecutableKind, imageFileMachine, resources, entryPointToken, stream);
- }
- }
-
- private static void WriteModuleImpl(StrongNameKeyPair keyPair, byte[] publicKey, ModuleBuilder moduleBuilder,
- PEFileKinds fileKind, PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine,
- ResourceSection resources, int entryPointToken, Stream stream)
- {
- moduleBuilder.ApplyUnmanagedExports(imageFileMachine);
- moduleBuilder.FixupMethodBodyTokens();
-
- moduleBuilder.ModuleTable.Add(0, moduleBuilder.Strings.Add(moduleBuilder.moduleName), moduleBuilder.Guids.Add(moduleBuilder.ModuleVersionId), 0, 0);
-
- if (moduleBuilder.UserStrings.IsEmpty)
- {
- // for compat with Ref.Emit, if there aren't any user strings, we add one
- moduleBuilder.UserStrings.Add(" ");
- }
-
- if (resources != null)
- {
- resources.Finish();
- }
-
- PEWriter writer = new PEWriter(stream);
- writer.Headers.OptionalHeader.FileAlignment = (uint)moduleBuilder.__FileAlignment;
- switch (imageFileMachine)
- {
- case ImageFileMachine.I386:
- writer.Headers.FileHeader.Machine = IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_I386;
- writer.Headers.FileHeader.Characteristics |= IMAGE_FILE_HEADER.IMAGE_FILE_32BIT_MACHINE;
- writer.Headers.OptionalHeader.SizeOfStackReserve = moduleBuilder.GetStackReserve(0x100000);
- break;
- case ImageFileMachine.ARM:
- writer.Headers.FileHeader.Machine = IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_ARM;
- writer.Headers.FileHeader.Characteristics |= IMAGE_FILE_HEADER.IMAGE_FILE_32BIT_MACHINE;
- writer.Headers.OptionalHeader.SizeOfStackReserve = moduleBuilder.GetStackReserve(0x100000);
- break;
- case ImageFileMachine.AMD64:
- writer.Headers.FileHeader.Machine = IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_AMD64;
- writer.Headers.FileHeader.Characteristics |= IMAGE_FILE_HEADER.IMAGE_FILE_LARGE_ADDRESS_AWARE;
- writer.Headers.FileHeader.SizeOfOptionalHeader = 0xF0;
- writer.Headers.OptionalHeader.Magic = IMAGE_OPTIONAL_HEADER.IMAGE_NT_OPTIONAL_HDR64_MAGIC;
- writer.Headers.OptionalHeader.SizeOfStackReserve = moduleBuilder.GetStackReserve(0x400000);
- writer.Headers.OptionalHeader.SizeOfStackCommit = 0x4000;
- writer.Headers.OptionalHeader.SizeOfHeapCommit = 0x2000;
- break;
- case ImageFileMachine.IA64:
- writer.Headers.FileHeader.Machine = IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_IA64;
- writer.Headers.FileHeader.Characteristics |= IMAGE_FILE_HEADER.IMAGE_FILE_LARGE_ADDRESS_AWARE;
- writer.Headers.FileHeader.SizeOfOptionalHeader = 0xF0;
- writer.Headers.OptionalHeader.Magic = IMAGE_OPTIONAL_HEADER.IMAGE_NT_OPTIONAL_HDR64_MAGIC;
- writer.Headers.OptionalHeader.SizeOfStackReserve = moduleBuilder.GetStackReserve(0x400000);
- writer.Headers.OptionalHeader.SizeOfStackCommit = 0x4000;
- writer.Headers.OptionalHeader.SizeOfHeapCommit = 0x2000;
- break;
- default:
- throw new ArgumentOutOfRangeException("imageFileMachine");
- }
- if (fileKind == PEFileKinds.Dll)
- {
- writer.Headers.FileHeader.Characteristics |= IMAGE_FILE_HEADER.IMAGE_FILE_DLL;
- }
-
- switch (fileKind)
- {
- case PEFileKinds.WindowApplication:
- writer.Headers.OptionalHeader.Subsystem = IMAGE_OPTIONAL_HEADER.IMAGE_SUBSYSTEM_WINDOWS_GUI;
- break;
- default:
- writer.Headers.OptionalHeader.Subsystem = IMAGE_OPTIONAL_HEADER.IMAGE_SUBSYSTEM_WINDOWS_CUI;
- break;
- }
- writer.Headers.OptionalHeader.DllCharacteristics = (ushort)moduleBuilder.__DllCharacteristics;
-
- CliHeader cliHeader = new CliHeader();
- cliHeader.Cb = 0x48;
- cliHeader.MajorRuntimeVersion = 2;
- cliHeader.MinorRuntimeVersion = moduleBuilder.MDStreamVersion < 0x20000 ? (ushort)0 : (ushort)5;
- if ((portableExecutableKind & PortableExecutableKinds.ILOnly) != 0)
- {
- cliHeader.Flags |= CliHeader.COMIMAGE_FLAGS_ILONLY;
- }
- if ((portableExecutableKind & PortableExecutableKinds.Required32Bit) != 0)
- {
- cliHeader.Flags |= CliHeader.COMIMAGE_FLAGS_32BITREQUIRED;
- }
- if ((portableExecutableKind & PortableExecutableKinds.Preferred32Bit) != 0)
- {
- cliHeader.Flags |= CliHeader.COMIMAGE_FLAGS_32BITREQUIRED | CliHeader.COMIMAGE_FLAGS_32BITPREFERRED;
- }
- if (keyPair != null)
- {
- cliHeader.Flags |= CliHeader.COMIMAGE_FLAGS_STRONGNAMESIGNED;
- }
- if (moduleBuilder.IsPseudoToken(entryPointToken))
- {
- entryPointToken = moduleBuilder.ResolvePseudoToken(entryPointToken);
- }
- cliHeader.EntryPointToken = (uint)entryPointToken;
-
- moduleBuilder.Strings.Freeze();
- moduleBuilder.UserStrings.Freeze();
- moduleBuilder.Guids.Freeze();
- moduleBuilder.Blobs.Freeze();
- MetadataWriter mw = new MetadataWriter(moduleBuilder, stream);
- moduleBuilder.Tables.Freeze(mw);
- TextSection code = new TextSection(writer, cliHeader, moduleBuilder, ComputeStrongNameSignatureLength(publicKey));
-
- // Export Directory
- if (code.ExportDirectoryLength != 0)
- {
- writer.Headers.OptionalHeader.DataDirectory[0].VirtualAddress = code.ExportDirectoryRVA;
- writer.Headers.OptionalHeader.DataDirectory[0].Size = code.ExportDirectoryLength;
- }
-
- // Import Directory
- if (code.ImportDirectoryLength != 0)
- {
- writer.Headers.OptionalHeader.DataDirectory[1].VirtualAddress = code.ImportDirectoryRVA;
- writer.Headers.OptionalHeader.DataDirectory[1].Size = code.ImportDirectoryLength;
- }
-
- // Import Address Table Directory
- if (code.ImportAddressTableLength != 0)
- {
- writer.Headers.OptionalHeader.DataDirectory[12].VirtualAddress = code.ImportAddressTableRVA;
- writer.Headers.OptionalHeader.DataDirectory[12].Size = code.ImportAddressTableLength;
- }
-
- // COM Descriptor Directory
- writer.Headers.OptionalHeader.DataDirectory[14].VirtualAddress = code.ComDescriptorRVA;
- writer.Headers.OptionalHeader.DataDirectory[14].Size = code.ComDescriptorLength;
-
- // Debug Directory
- if (code.DebugDirectoryLength != 0)
- {
- writer.Headers.OptionalHeader.DataDirectory[6].VirtualAddress = code.DebugDirectoryRVA;
- writer.Headers.OptionalHeader.DataDirectory[6].Size = code.DebugDirectoryLength;
- }
-
- // we need to start by computing the number of sections, because code.PointerToRawData depends on that
- writer.Headers.FileHeader.NumberOfSections = 1;
-
- if (moduleBuilder.initializedData.Length != 0)
- {
- // .sdata
- writer.Headers.FileHeader.NumberOfSections++;
- }
-
- if (resources != null)
- {
- // .rsrc
- writer.Headers.FileHeader.NumberOfSections++;
- }
-
- if (imageFileMachine != ImageFileMachine.ARM)
- {
- // .reloc
- writer.Headers.FileHeader.NumberOfSections++;
- }
-
- SectionHeader text = new SectionHeader();
- text.Name = ".text";
- text.VirtualAddress = code.BaseRVA;
- text.VirtualSize = (uint)code.Length;
- text.PointerToRawData = code.PointerToRawData;
- text.SizeOfRawData = writer.ToFileAlignment((uint)code.Length);
- text.Characteristics = SectionHeader.IMAGE_SCN_CNT_CODE | SectionHeader.IMAGE_SCN_MEM_EXECUTE | SectionHeader.IMAGE_SCN_MEM_READ;
-
- SectionHeader sdata = new SectionHeader();
- sdata.Name = ".sdata";
- sdata.VirtualAddress = text.VirtualAddress + writer.ToSectionAlignment(text.VirtualSize);
- sdata.VirtualSize = (uint)moduleBuilder.initializedData.Length;
- sdata.PointerToRawData = text.PointerToRawData + text.SizeOfRawData;
- sdata.SizeOfRawData = writer.ToFileAlignment((uint)moduleBuilder.initializedData.Length);
- sdata.Characteristics = SectionHeader.IMAGE_SCN_CNT_INITIALIZED_DATA | SectionHeader.IMAGE_SCN_MEM_READ | SectionHeader.IMAGE_SCN_MEM_WRITE;
-
- SectionHeader rsrc = new SectionHeader();
- rsrc.Name = ".rsrc";
- rsrc.VirtualAddress = sdata.VirtualAddress + writer.ToSectionAlignment(sdata.VirtualSize);
- rsrc.PointerToRawData = sdata.PointerToRawData + sdata.SizeOfRawData;
- rsrc.VirtualSize = resources == null ? 0 : (uint)resources.Length;
- rsrc.SizeOfRawData = writer.ToFileAlignment(rsrc.VirtualSize);
- rsrc.Characteristics = SectionHeader.IMAGE_SCN_MEM_READ | SectionHeader.IMAGE_SCN_CNT_INITIALIZED_DATA;
-
- if (rsrc.SizeOfRawData != 0)
- {
- // Resource Directory
- writer.Headers.OptionalHeader.DataDirectory[2].VirtualAddress = rsrc.VirtualAddress;
- writer.Headers.OptionalHeader.DataDirectory[2].Size = rsrc.VirtualSize;
- }
-
- SectionHeader reloc = new SectionHeader();
- reloc.Name = ".reloc";
- reloc.VirtualAddress = rsrc.VirtualAddress + writer.ToSectionAlignment(rsrc.VirtualSize);
- if (imageFileMachine != ImageFileMachine.ARM)
- {
- reloc.VirtualSize = ((uint)moduleBuilder.unmanagedExports.Count + 1) * 12;
- }
- reloc.PointerToRawData = rsrc.PointerToRawData + rsrc.SizeOfRawData;
- reloc.SizeOfRawData = writer.ToFileAlignment(reloc.VirtualSize);
- reloc.Characteristics = SectionHeader.IMAGE_SCN_MEM_READ | SectionHeader.IMAGE_SCN_CNT_INITIALIZED_DATA | SectionHeader.IMAGE_SCN_MEM_DISCARDABLE;
-
- if (reloc.SizeOfRawData != 0)
- {
- // Base Relocation Directory
- writer.Headers.OptionalHeader.DataDirectory[5].VirtualAddress = reloc.VirtualAddress;
- writer.Headers.OptionalHeader.DataDirectory[5].Size = reloc.VirtualSize;
- }
-
- writer.Headers.OptionalHeader.SizeOfCode = text.SizeOfRawData;
- writer.Headers.OptionalHeader.SizeOfInitializedData = sdata.SizeOfRawData + rsrc.SizeOfRawData + reloc.SizeOfRawData;
- writer.Headers.OptionalHeader.SizeOfUninitializedData = 0;
- writer.Headers.OptionalHeader.SizeOfImage = reloc.VirtualAddress + writer.ToSectionAlignment(reloc.VirtualSize);
- writer.Headers.OptionalHeader.SizeOfHeaders = text.PointerToRawData;
- writer.Headers.OptionalHeader.BaseOfCode = code.BaseRVA;
- writer.Headers.OptionalHeader.BaseOfData = sdata.VirtualAddress;
- writer.Headers.OptionalHeader.ImageBase = (ulong)moduleBuilder.__ImageBase;
-
- if (imageFileMachine == ImageFileMachine.IA64)
- {
- // apparently for IA64 AddressOfEntryPoint points to the address of the entry point
- // (i.e. there is an additional layer of indirection), so we add the offset to the pointer
- writer.Headers.OptionalHeader.AddressOfEntryPoint = code.StartupStubRVA + 0x20;
- }
- else if (imageFileMachine != ImageFileMachine.ARM)
- {
- writer.Headers.OptionalHeader.AddressOfEntryPoint = code.StartupStubRVA;
- }
-
- writer.WritePEHeaders();
- writer.WriteSectionHeader(text);
- if (sdata.SizeOfRawData != 0)
- {
- writer.WriteSectionHeader(sdata);
- }
- if (rsrc.SizeOfRawData != 0)
- {
- writer.WriteSectionHeader(rsrc);
- }
- if (reloc.SizeOfRawData != 0)
- {
- writer.WriteSectionHeader(reloc);
- }
-
- stream.Seek(text.PointerToRawData, SeekOrigin.Begin);
- code.Write(mw, sdata.VirtualAddress);
-
- if (sdata.SizeOfRawData != 0)
- {
- stream.Seek(sdata.PointerToRawData, SeekOrigin.Begin);
- mw.Write(moduleBuilder.initializedData);
- }
-
- if (rsrc.SizeOfRawData != 0)
- {
- stream.Seek(rsrc.PointerToRawData, SeekOrigin.Begin);
- resources.Write(mw, rsrc.VirtualAddress);
- }
-
- if (reloc.SizeOfRawData != 0)
- {
- stream.Seek(reloc.PointerToRawData, SeekOrigin.Begin);
- code.WriteRelocations(mw);
- }
-
- // file alignment
- stream.SetLength(reloc.PointerToRawData + reloc.SizeOfRawData);
-
- // do the strong naming
- if (keyPair != null)
- {
- StrongName(stream, keyPair, writer.HeaderSize, text.PointerToRawData, code.StrongNameSignatureRVA - text.VirtualAddress + text.PointerToRawData, code.StrongNameSignatureLength);
- }
-
- if (moduleBuilder.symbolWriter != null)
- {
- moduleBuilder.WriteSymbolTokenMap();
- moduleBuilder.symbolWriter.Close();
- }
- }
-
- private static int ComputeStrongNameSignatureLength(byte[] publicKey)
- {
- if (publicKey == null)
- {
- return 0;
- }
- else if (publicKey.Length == 16)
- {
- // it must be the ECMA pseudo public key, we don't know the key size of the real key, but currently both Mono and Microsoft use a 1024 bit key size
- return 128;
- }
- else
- {
- // for the supported strong naming algorithms, the signature size is the same as the key size
- // (we have to subtract 32 for the header)
- return publicKey.Length - 32;
- }
- }
-
- private static void StrongName(Stream stream, StrongNameKeyPair keyPair, uint headerLength, uint textSectionFileOffset, uint strongNameSignatureFileOffset, uint strongNameSignatureLength)
- {
- SHA1Managed hash = new SHA1Managed();
- using (CryptoStream cs = new CryptoStream(Stream.Null, hash, CryptoStreamMode.Write))
- {
- stream.Seek(0, SeekOrigin.Begin);
- byte[] buf = new byte[8192];
- HashChunk(stream, cs, buf, (int)headerLength);
- stream.Seek(textSectionFileOffset, SeekOrigin.Begin);
- HashChunk(stream, cs, buf, (int)(strongNameSignatureFileOffset - textSectionFileOffset));
- stream.Seek(strongNameSignatureLength, SeekOrigin.Current);
- HashChunk(stream, cs, buf, (int)(stream.Length - (strongNameSignatureFileOffset + strongNameSignatureLength)));
- }
- using (RSA rsa = keyPair.CreateRSA())
- {
- RSAPKCS1SignatureFormatter sign = new RSAPKCS1SignatureFormatter(rsa);
- byte[] signature = sign.CreateSignature(hash);
- Array.Reverse(signature);
- if (signature.Length != strongNameSignatureLength)
- {
- throw new InvalidOperationException("Signature length mismatch");
- }
- stream.Seek(strongNameSignatureFileOffset, SeekOrigin.Begin);
- stream.Write(signature, 0, signature.Length);
- }
-
- // compute the PE checksum
- stream.Seek(0, SeekOrigin.Begin);
- int count = (int)stream.Length / 4;
- BinaryReader br = new BinaryReader(stream);
- long sum = 0;
- for (int i = 0; i < count; i++)
- {
- sum += br.ReadUInt32();
- int carry = (int)(sum >> 32);
- sum &= 0xFFFFFFFFU;
- sum += carry;
- }
- while ((sum >> 16) != 0)
- {
- sum = (sum & 0xFFFF) + (sum >> 16);
- }
- sum += stream.Length;
-
- // write the PE checksum, note that it is always at offset 0xD8 in the file
- ByteBuffer bb = new ByteBuffer(4);
- bb.Write((int)sum);
- stream.Seek(0xD8, SeekOrigin.Begin);
- bb.WriteTo(stream);
- }
-
- internal static void HashChunk(Stream stream, CryptoStream cs, byte[] buf, int length)
- {
- while (length > 0)
- {
- int read = stream.Read(buf, 0, Math.Min(buf.Length, length));
- cs.Write(buf, 0, read);
- length -= read;
- }
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2008 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.IO;
-using BYTE = System.Byte;
-using WORD = System.UInt16;
-using DWORD = System.UInt32;
-using ULONGLONG = System.UInt64;
-using IMAGE_DATA_DIRECTORY = IKVM.Reflection.Reader.IMAGE_DATA_DIRECTORY;
-
-namespace IKVM.Reflection.Writer
-{
- sealed class PEWriter
- {
- private readonly BinaryWriter bw;
- private readonly IMAGE_NT_HEADERS hdr = new IMAGE_NT_HEADERS();
-
- internal PEWriter(Stream stream)
- {
- bw = new BinaryWriter(stream);
- WriteMSDOSHeader();
- }
-
- public IMAGE_NT_HEADERS Headers
- {
- get { return hdr; }
- }
-
- public uint HeaderSize
- {
- get
- {
- return (uint)
- ((8 * 16) + // MSDOS header
- 4 + // signature
- 20 + // IMAGE_FILE_HEADER
- hdr.FileHeader.SizeOfOptionalHeader +
- hdr.FileHeader.NumberOfSections * 40);
- }
- }
-
- private void WriteMSDOSHeader()
- {
- bw.Write(new byte[] {
- 0x4D, 0x5A, 0x90, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00,
- 0xB8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
- 0x0E, 0x1F, 0xBA, 0x0E, 0x00, 0xB4, 0x09, 0xCD,
- 0x21, 0xB8, 0x01, 0x4C, 0xCD, 0x21, 0x54, 0x68,
- 0x69, 0x73, 0x20, 0x70, 0x72, 0x6F, 0x67, 0x72,
- 0x61, 0x6D, 0x20, 0x63, 0x61, 0x6E, 0x6E, 0x6F,
- 0x74, 0x20, 0x62, 0x65, 0x20, 0x72, 0x75, 0x6E,
- 0x20, 0x69, 0x6E, 0x20, 0x44, 0x4F, 0x53, 0x20,
- 0x6D, 0x6F, 0x64, 0x65, 0x2E, 0x0D, 0x0D, 0x0A,
- 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- });
- }
-
- internal void WritePEHeaders()
- {
- bw.Write(hdr.Signature);
-
- // IMAGE_FILE_HEADER
- bw.Write(hdr.FileHeader.Machine);
- bw.Write(hdr.FileHeader.NumberOfSections);
- bw.Write(hdr.FileHeader.TimeDateStamp);
- bw.Write(hdr.FileHeader.PointerToSymbolTable);
- bw.Write(hdr.FileHeader.NumberOfSymbols);
- bw.Write(hdr.FileHeader.SizeOfOptionalHeader);
- bw.Write(hdr.FileHeader.Characteristics);
-
- // IMAGE_OPTIONAL_HEADER
- hdr.OptionalHeader.Write(bw);
- }
-
- internal void WriteSectionHeader(SectionHeader sectionHeader)
- {
- byte[] name = new byte[8];
- System.Text.Encoding.UTF8.GetBytes(sectionHeader.Name, 0, sectionHeader.Name.Length, name, 0);
- bw.Write(name);
- bw.Write(sectionHeader.VirtualSize);
- bw.Write(sectionHeader.VirtualAddress);
- bw.Write(sectionHeader.SizeOfRawData);
- bw.Write(sectionHeader.PointerToRawData);
- bw.Write(sectionHeader.PointerToRelocations);
- bw.Write(sectionHeader.PointerToLinenumbers);
- bw.Write(sectionHeader.NumberOfRelocations);
- bw.Write(sectionHeader.NumberOfLinenumbers);
- bw.Write(sectionHeader.Characteristics);
- }
-
- internal uint ToFileAlignment(uint p)
- {
- return (p + (Headers.OptionalHeader.FileAlignment - 1)) & ~(Headers.OptionalHeader.FileAlignment - 1);
- }
-
- internal uint ToSectionAlignment(uint p)
- {
- return (p + (Headers.OptionalHeader.SectionAlignment - 1)) & ~(Headers.OptionalHeader.SectionAlignment - 1);
- }
- }
-
- sealed class IMAGE_NT_HEADERS
- {
- public DWORD Signature = 0x00004550; // "PE\0\0"
- public IMAGE_FILE_HEADER FileHeader = new IMAGE_FILE_HEADER();
- public IMAGE_OPTIONAL_HEADER OptionalHeader = new IMAGE_OPTIONAL_HEADER();
- }
-
- sealed class IMAGE_FILE_HEADER
- {
- public const WORD IMAGE_FILE_MACHINE_I386 = 0x014c;
- public const WORD IMAGE_FILE_MACHINE_ARM = 0x01c4;
- public const WORD IMAGE_FILE_MACHINE_IA64 = 0x0200;
- public const WORD IMAGE_FILE_MACHINE_AMD64 = 0x8664;
-
- public const WORD IMAGE_FILE_32BIT_MACHINE = 0x0100;
- public const WORD IMAGE_FILE_EXECUTABLE_IMAGE = 0x0002;
- public const WORD IMAGE_FILE_LARGE_ADDRESS_AWARE = 0x0020;
- public const WORD IMAGE_FILE_DLL = 0x2000;
-
- public WORD Machine;
- public WORD NumberOfSections;
- public DWORD TimeDateStamp = (uint)(DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds;
- public DWORD PointerToSymbolTable = 0;
- public DWORD NumberOfSymbols = 0;
- public WORD SizeOfOptionalHeader = 0xE0;
- public WORD Characteristics = IMAGE_FILE_EXECUTABLE_IMAGE;
- }
-
- sealed class IMAGE_OPTIONAL_HEADER
- {
- public const WORD IMAGE_NT_OPTIONAL_HDR32_MAGIC = 0x10b;
- public const WORD IMAGE_NT_OPTIONAL_HDR64_MAGIC = 0x20b;
-
- public const WORD IMAGE_SUBSYSTEM_WINDOWS_GUI = 2;
- public const WORD IMAGE_SUBSYSTEM_WINDOWS_CUI = 3;
-
- public WORD Magic = IMAGE_NT_OPTIONAL_HDR32_MAGIC;
- public BYTE MajorLinkerVersion = 8;
- public BYTE MinorLinkerVersion = 0;
- public DWORD SizeOfCode;
- public DWORD SizeOfInitializedData;
- public DWORD SizeOfUninitializedData;
- public DWORD AddressOfEntryPoint;
- public DWORD BaseOfCode;
- public DWORD BaseOfData;
- public ULONGLONG ImageBase;
- public DWORD SectionAlignment = 0x2000;
- public DWORD FileAlignment;
- public WORD MajorOperatingSystemVersion = 4;
- public WORD MinorOperatingSystemVersion = 0;
- public WORD MajorImageVersion = 0;
- public WORD MinorImageVersion = 0;
- public WORD MajorSubsystemVersion = 4;
- public WORD MinorSubsystemVersion = 0;
- public DWORD Win32VersionValue = 0;
- public DWORD SizeOfImage;
- public DWORD SizeOfHeaders;
- public DWORD CheckSum = 0;
- public WORD Subsystem;
- public WORD DllCharacteristics;
- public ULONGLONG SizeOfStackReserve;
- public ULONGLONG SizeOfStackCommit = 0x1000;
- public ULONGLONG SizeOfHeapReserve = 0x100000;
- public ULONGLONG SizeOfHeapCommit = 0x1000;
- public DWORD LoaderFlags = 0;
- public DWORD NumberOfRvaAndSizes = 16;
- public IMAGE_DATA_DIRECTORY[] DataDirectory = new IMAGE_DATA_DIRECTORY[16];
-
- internal void Write(BinaryWriter bw)
- {
- bw.Write(Magic);
- bw.Write(MajorLinkerVersion);
- bw.Write(MinorLinkerVersion);
- bw.Write(SizeOfCode);
- bw.Write(SizeOfInitializedData);
- bw.Write(SizeOfUninitializedData);
- bw.Write(AddressOfEntryPoint);
- bw.Write(BaseOfCode);
- if (Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC)
- {
- bw.Write(BaseOfData);
- bw.Write((DWORD)ImageBase);
- }
- else
- {
- bw.Write(ImageBase);
- }
- bw.Write(SectionAlignment);
- bw.Write(FileAlignment);
- bw.Write(MajorOperatingSystemVersion);
- bw.Write(MinorOperatingSystemVersion);
- bw.Write(MajorImageVersion);
- bw.Write(MinorImageVersion);
- bw.Write(MajorSubsystemVersion);
- bw.Write(MinorSubsystemVersion);
- bw.Write(Win32VersionValue);
- bw.Write(SizeOfImage);
- bw.Write(SizeOfHeaders);
- bw.Write(CheckSum);
- bw.Write(Subsystem);
- bw.Write(DllCharacteristics);
- if (Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC)
- {
- bw.Write((DWORD)SizeOfStackReserve);
- }
- else
- {
- bw.Write(SizeOfStackReserve);
- }
- if (Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC)
- {
- bw.Write((DWORD)SizeOfStackCommit);
- }
- else
- {
- bw.Write(SizeOfStackCommit);
- }
- if (Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC)
- {
- bw.Write((DWORD)SizeOfHeapReserve);
- }
- else
- {
- bw.Write(SizeOfHeapReserve);
- }
- if (Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC)
- {
- bw.Write((DWORD)SizeOfHeapCommit);
- }
- else
- {
- bw.Write(SizeOfHeapCommit);
- }
- bw.Write(LoaderFlags);
- bw.Write(NumberOfRvaAndSizes);
- for (int i = 0; i < DataDirectory.Length; i++)
- {
- bw.Write(DataDirectory[i].VirtualAddress);
- bw.Write(DataDirectory[i].Size);
- }
- }
- }
-
- class SectionHeader
- {
- public const DWORD IMAGE_SCN_CNT_CODE = 0x00000020;
- public const DWORD IMAGE_SCN_CNT_INITIALIZED_DATA = 0x00000040;
- public const DWORD IMAGE_SCN_MEM_DISCARDABLE = 0x02000000;
- public const DWORD IMAGE_SCN_MEM_EXECUTE = 0x20000000;
- public const DWORD IMAGE_SCN_MEM_READ = 0x40000000;
- public const DWORD IMAGE_SCN_MEM_WRITE = 0x80000000;
-
- public string Name; // 8 byte UTF8 encoded 0-padded
- public DWORD VirtualSize;
- public DWORD VirtualAddress;
- public DWORD SizeOfRawData;
- public DWORD PointerToRawData;
-#pragma warning disable 649 // the follow fields are never assigned to
- public DWORD PointerToRelocations;
- public DWORD PointerToLinenumbers;
- public WORD NumberOfRelocations;
- public WORD NumberOfLinenumbers;
-#pragma warning restore 649
- public DWORD Characteristics;
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2010-2012 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Text;
-using IKVM.Reflection.Reader;
-
-namespace IKVM.Reflection.Writer
-{
- sealed class ResourceSection
- {
- private const int RT_ICON = 3;
- private const int RT_GROUP_ICON = 14;
- private const int RT_VERSION = 16;
- private const int RT_MANIFEST = 24;
- private ResourceDirectoryEntry root = new ResourceDirectoryEntry(new OrdinalOrName("root"));
- private ByteBuffer bb;
- private List<int> linkOffsets;
-
- internal void AddVersionInfo(ByteBuffer versionInfo)
- {
- root[new OrdinalOrName(RT_VERSION)][new OrdinalOrName(1)][new OrdinalOrName(0)].Data = versionInfo;
- }
-
- internal void AddIcon(byte[] iconFile)
- {
- BinaryReader br = new BinaryReader(new MemoryStream(iconFile));
- ushort idReserved = br.ReadUInt16();
- ushort idType = br.ReadUInt16();
- ushort idCount = br.ReadUInt16();
- if (idReserved != 0 || idType != 1)
- {
- throw new ArgumentException("The supplied byte array is not a valid .ico file.");
- }
- ByteBuffer group = new ByteBuffer(6 + 14 * idCount);
- group.Write(idReserved);
- group.Write(idType);
- group.Write(idCount);
- for (int i = 0; i < idCount; i++)
- {
- byte bWidth = br.ReadByte();
- byte bHeight = br.ReadByte();
- byte bColorCount = br.ReadByte();
- byte bReserved = br.ReadByte();
- ushort wPlanes = br.ReadUInt16();
- ushort wBitCount = br.ReadUInt16();
- uint dwBytesInRes = br.ReadUInt32();
- uint dwImageOffset = br.ReadUInt32();
-
- // we start the icon IDs at 2
- ushort id = (ushort)(2 + i);
-
- group.Write(bWidth);
- group.Write(bHeight);
- group.Write(bColorCount);
- group.Write(bReserved);
- group.Write(wPlanes);
- group.Write(wBitCount);
- group.Write(dwBytesInRes);
- group.Write(id);
-
- byte[] icon = new byte[dwBytesInRes];
- Buffer.BlockCopy(iconFile, (int)dwImageOffset, icon, 0, icon.Length);
- root[new OrdinalOrName(RT_ICON)][new OrdinalOrName(id)][new OrdinalOrName(0)].Data = ByteBuffer.Wrap(icon);
- }
- root[new OrdinalOrName(RT_GROUP_ICON)][new OrdinalOrName(32512)][new OrdinalOrName(0)].Data = group;
- }
-
- internal void AddManifest(byte[] manifest, ushort resourceID)
- {
- root[new OrdinalOrName(RT_MANIFEST)][new OrdinalOrName(resourceID)][new OrdinalOrName(0)].Data = ByteBuffer.Wrap(manifest);
- }
-
- internal void ExtractResources(byte[] buf)
- {
- ByteReader br = new ByteReader(buf, 0, buf.Length);
- while (br.Length >= 32)
- {
- br.Align(4);
- RESOURCEHEADER hdr = new RESOURCEHEADER(br);
- if (hdr.DataSize != 0)
- {
- root[hdr.TYPE][hdr.NAME][new OrdinalOrName(hdr.LanguageId)].Data = ByteBuffer.Wrap(br.ReadBytes(hdr.DataSize));
- }
- }
- }
-
- internal void Finish()
- {
- if (bb != null)
- {
- throw new InvalidOperationException();
- }
- bb = new ByteBuffer(1024);
- linkOffsets = new List<int>();
- root.Write(bb, linkOffsets);
- root = null;
- }
-
- internal int Length
- {
- get { return bb.Length; }
- }
-
- internal void Write(MetadataWriter mw, uint rva)
- {
- foreach (int offset in linkOffsets)
- {
- bb.Position = offset;
- bb.Write(bb.GetInt32AtCurrentPosition() + (int)rva);
- }
- mw.Write(bb);
- }
- }
-
- sealed class ResourceDirectoryEntry
- {
- internal readonly OrdinalOrName OrdinalOrName;
- internal ByteBuffer Data;
- private int namedEntries;
- private readonly List<ResourceDirectoryEntry> entries = new List<ResourceDirectoryEntry>();
-
- internal ResourceDirectoryEntry(OrdinalOrName id)
- {
- this.OrdinalOrName = id;
- }
-
- internal ResourceDirectoryEntry this[OrdinalOrName id]
- {
- get
- {
- foreach (ResourceDirectoryEntry entry in entries)
- {
- if (entry.OrdinalOrName.IsEqual(id))
- {
- return entry;
- }
- }
- // the entries must be sorted
- ResourceDirectoryEntry newEntry = new ResourceDirectoryEntry(id);
- if (id.Name == null)
- {
- for (int i = namedEntries; i < entries.Count; i++)
- {
- if (entries[i].OrdinalOrName.IsGreaterThan(id))
- {
- entries.Insert(i, newEntry);
- return newEntry;
- }
- }
- entries.Add(newEntry);
- return newEntry;
- }
- else
- {
- for (int i = 0; i < namedEntries; i++)
- {
- if (entries[i].OrdinalOrName.IsGreaterThan(id))
- {
- entries.Insert(i, newEntry);
- namedEntries++;
- return newEntry;
- }
- }
- entries.Insert(namedEntries++, newEntry);
- return newEntry;
- }
- }
- }
-
- private int DirectoryLength
- {
- get
- {
- if (Data != null)
- {
- return 16;
- }
- else
- {
- int length = 16 + entries.Count * 8;
- foreach (ResourceDirectoryEntry entry in entries)
- {
- length += entry.DirectoryLength;
- }
- return length;
- }
- }
- }
-
- internal void Write(ByteBuffer bb, List<int> linkOffsets)
- {
- if (entries.Count != 0)
- {
- int stringTableOffset = this.DirectoryLength;
- Dictionary<string, int> strings = new Dictionary<string, int>();
- ByteBuffer stringTable = new ByteBuffer(16);
- int offset = 16 + entries.Count * 8;
- for (int pass = 0; pass < 3; pass++)
- {
- Write(bb, pass, 0, ref offset, strings, ref stringTableOffset, stringTable);
- }
- // the pecoff spec says that the string table is between the directory entries and the data entries,
- // but the windows linker puts them after the data entries, so we do too.
- stringTable.Align(4);
- offset += stringTable.Length;
- WriteResourceDataEntries(bb, linkOffsets, ref offset);
- bb.Write(stringTable);
- WriteData(bb);
- }
- }
-
- private void WriteResourceDataEntries(ByteBuffer bb, List<int> linkOffsets, ref int offset)
- {
- foreach (ResourceDirectoryEntry entry in entries)
- {
- if (entry.Data != null)
- {
- linkOffsets.Add(bb.Position);
- bb.Write(offset);
- bb.Write(entry.Data.Length);
- bb.Write(0); // code page
- bb.Write(0); // reserved
- offset += (entry.Data.Length + 3) & ~3;
- }
- else
- {
- entry.WriteResourceDataEntries(bb, linkOffsets, ref offset);
- }
- }
- }
-
- private void WriteData(ByteBuffer bb)
- {
- foreach (ResourceDirectoryEntry entry in entries)
- {
- if (entry.Data != null)
- {
- bb.Write(entry.Data);
- bb.Align(4);
- }
- else
- {
- entry.WriteData(bb);
- }
- }
- }
-
- private void Write(ByteBuffer bb, int writeDepth, int currentDepth, ref int offset, Dictionary<string, int> strings, ref int stringTableOffset, ByteBuffer stringTable)
- {
- if (currentDepth == writeDepth)
- {
- // directory header
- bb.Write(0); // Characteristics
- bb.Write(0); // Time/Date Stamp
- bb.Write(0); // Version (Major / Minor)
- bb.Write((ushort)namedEntries);
- bb.Write((ushort)(entries.Count - namedEntries));
- }
- foreach (ResourceDirectoryEntry entry in entries)
- {
- if (currentDepth == writeDepth)
- {
- entry.WriteEntry(bb, ref offset, strings, ref stringTableOffset, stringTable);
- }
- else
- {
- entry.Write(bb, writeDepth, currentDepth + 1, ref offset, strings, ref stringTableOffset, stringTable);
- }
- }
- }
-
- private void WriteEntry(ByteBuffer bb, ref int offset, Dictionary<string, int> strings, ref int stringTableOffset, ByteBuffer stringTable)
- {
- WriteNameOrOrdinal(bb, OrdinalOrName, strings, ref stringTableOffset, stringTable);
- if (Data == null)
- {
- bb.Write(0x80000000U | (uint)offset);
- }
- else
- {
- bb.Write(offset);
- }
- offset += 16 + entries.Count * 8;
- }
-
- private static void WriteNameOrOrdinal(ByteBuffer bb, OrdinalOrName id, Dictionary<string, int> strings, ref int stringTableOffset, ByteBuffer stringTable)
- {
- if (id.Name == null)
- {
- bb.Write((int)id.Ordinal);
- }
- else
- {
- int stringOffset;
- if (!strings.TryGetValue(id.Name, out stringOffset))
- {
- stringOffset = stringTableOffset;
- strings.Add(id.Name, stringOffset);
- stringTableOffset += id.Name.Length * 2 + 2;
- stringTable.Write((ushort)id.Name.Length);
- foreach (char c in id.Name)
- {
- stringTable.Write((short)c);
- }
- }
- bb.Write(0x80000000U | (uint)stringOffset);
- }
- }
- }
-
- struct OrdinalOrName
- {
- internal readonly ushort Ordinal;
- internal readonly string Name;
-
- internal OrdinalOrName(ushort value)
- {
- Ordinal = value;
- Name = null;
- }
-
- internal OrdinalOrName(string value)
- {
- Ordinal = 0xFFFF;
- Name = value;
- }
-
- internal bool IsGreaterThan(OrdinalOrName other)
- {
- return this.Name == null
- ? this.Ordinal > other.Ordinal
- : String.Compare(this.Name, other.Name, StringComparison.OrdinalIgnoreCase) > 0;
- }
-
- internal bool IsEqual(OrdinalOrName other)
- {
- return this.Name == null
- ? this.Ordinal == other.Ordinal
- : String.Compare(this.Name, other.Name, StringComparison.OrdinalIgnoreCase) == 0;
- }
- }
-
- struct RESOURCEHEADER
- {
- internal int DataSize;
- internal int HeaderSize;
- internal OrdinalOrName TYPE;
- internal OrdinalOrName NAME;
- internal int DataVersion;
- internal ushort MemoryFlags;
- internal ushort LanguageId;
- internal int Version;
- internal int Characteristics;
-
- internal RESOURCEHEADER(ByteReader br)
- {
- DataSize = br.ReadInt32();
- HeaderSize = br.ReadInt32();
- TYPE = ReadOrdinalOrName(br);
- NAME = ReadOrdinalOrName(br);
- br.Align(4);
- DataVersion = br.ReadInt32();
- MemoryFlags = br.ReadUInt16();
- LanguageId = br.ReadUInt16();
- Version = br.ReadInt32();
- Characteristics = br.ReadInt32();
- }
-
- private static OrdinalOrName ReadOrdinalOrName(ByteReader br)
- {
- char c = br.ReadChar();
- if (c == 0xFFFF)
- {
- return new OrdinalOrName(br.ReadUInt16());
- }
- else
- {
- StringBuilder sb = new StringBuilder();
- while (c != 0)
- {
- sb.Append(c);
- c = br.ReadChar();
- }
- return new OrdinalOrName(sb.ToString());
- }
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2008-2011 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Diagnostics;
-using System.IO;
-using System.Collections.Generic;
-using System.Text;
-using IKVM.Reflection.Emit;
-using IKVM.Reflection.Impl;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection.Writer
-{
- sealed class TextSection
- {
- private readonly PEWriter peWriter;
- private readonly CliHeader cliHeader;
- private readonly ModuleBuilder moduleBuilder;
- private readonly uint strongNameSignatureLength;
- private readonly ExportTables exportTables;
-
- internal TextSection(PEWriter peWriter, CliHeader cliHeader, ModuleBuilder moduleBuilder, int strongNameSignatureLength)
- {
- this.peWriter = peWriter;
- this.cliHeader = cliHeader;
- this.moduleBuilder = moduleBuilder;
- this.strongNameSignatureLength = (uint)strongNameSignatureLength;
- if (moduleBuilder.unmanagedExports.Count != 0)
- {
- this.exportTables = new ExportTables(this);
- }
- }
-
- internal uint PointerToRawData
- {
- get { return peWriter.ToFileAlignment(peWriter.HeaderSize); }
- }
-
- internal uint BaseRVA
- {
- get { return 0x2000; }
- }
-
- internal uint ImportAddressTableRVA
- {
- get { return BaseRVA; }
- }
-
- internal uint ImportAddressTableLength
- {
- get
- {
- switch (peWriter.Headers.FileHeader.Machine)
- {
- case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_I386:
- return 8;
- case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_ARM:
- return 0;
- default:
- return 16;
- }
- }
- }
-
- internal uint ComDescriptorRVA
- {
- get { return ImportAddressTableRVA + ImportAddressTableLength; }
- }
-
- internal uint ComDescriptorLength
- {
- get { return cliHeader.Cb; }
- }
-
- internal uint MethodBodiesRVA
- {
- get { return (ComDescriptorRVA + ComDescriptorLength + 7) & ~7U; }
- }
-
- private uint MethodBodiesLength
- {
- get { return (uint)moduleBuilder.methodBodies.Length; }
- }
-
- private uint ResourcesRVA
- {
- get
- {
- switch (peWriter.Headers.FileHeader.Machine)
- {
- case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_I386:
- case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_ARM:
- return (MethodBodiesRVA + MethodBodiesLength + 3) & ~3U;
- default:
- return (MethodBodiesRVA + MethodBodiesLength + 15) & ~15U;
- }
- }
- }
-
- private uint ResourcesLength
- {
- get { return (uint)moduleBuilder.manifestResources.Length; }
- }
-
- internal uint StrongNameSignatureRVA
- {
- get
- {
- return (ResourcesRVA + ResourcesLength + 3) & ~3U;
- }
- }
-
- internal uint StrongNameSignatureLength
- {
- get
- {
- return strongNameSignatureLength;
- }
- }
-
- private uint MetadataRVA
- {
- get
- {
- return (StrongNameSignatureRVA + StrongNameSignatureLength + 3) & ~3U;
- }
- }
-
- private uint MetadataLength
- {
- get { return (uint)moduleBuilder.MetadataLength; }
- }
-
- private uint VTableFixupsRVA
- {
- get { return (MetadataRVA + MetadataLength + 7) & ~7U; }
- }
-
- private uint VTableFixupsLength
- {
- get { return (uint)moduleBuilder.vtablefixups.Count * 8; }
- }
-
- internal uint DebugDirectoryRVA
- {
- get { return VTableFixupsRVA + VTableFixupsLength; }
- }
-
- internal uint DebugDirectoryLength
- {
- get
- {
- if (DebugDirectoryContentsLength != 0)
- {
- return 28;
- }
- return 0;
- }
- }
-
- private uint DebugDirectoryContentsLength
- {
- get
- {
- if (moduleBuilder.symbolWriter != null)
- {
- IMAGE_DEBUG_DIRECTORY idd = new IMAGE_DEBUG_DIRECTORY();
- return (uint)SymbolSupport.GetDebugInfo(moduleBuilder.symbolWriter, ref idd).Length;
- }
- return 0;
- }
- }
-
- internal uint ExportDirectoryRVA
- {
- get { return (DebugDirectoryRVA + DebugDirectoryLength + DebugDirectoryContentsLength + 15) & ~15U; }
- }
-
- internal uint ExportDirectoryLength
- {
- get { return moduleBuilder.unmanagedExports.Count == 0 ? 0U : 40U; }
- }
-
- private uint ExportTablesRVA
- {
- get { return ExportDirectoryRVA + ExportDirectoryLength; }
- }
-
- private uint ExportTablesLength
- {
- get { return exportTables == null ? 0U : exportTables.Length; }
- }
-
- internal uint ImportDirectoryRVA
- {
- // on AMD64 (and probably IA64) the import directory needs to be 16 byte aligned (on I386 4 byte alignment is sufficient)
- get { return (ExportTablesRVA + ExportTablesLength + 15) & ~15U; }
- }
-
- internal uint ImportDirectoryLength
- {
- get
- {
- switch (peWriter.Headers.FileHeader.Machine)
- {
- case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_ARM:
- return 0;
- default:
- return (ImportHintNameTableRVA - ImportDirectoryRVA) + 27;
- }
- }
- }
-
- private uint ImportHintNameTableRVA
- {
- get
- {
- if (peWriter.Headers.FileHeader.Machine == IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_I386)
- {
- return (ImportDirectoryRVA + 48 + 15) & ~15U;
- }
- else
- {
- return (ImportDirectoryRVA + 48 + 4 + 15) & ~15U;
- }
- }
- }
-
- internal uint StartupStubRVA
- {
- get
- {
- if (peWriter.Headers.FileHeader.Machine == IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_IA64)
- {
- // note that the alignment is driven by the requirement that the two relocation fixups are in a single page
- return (ImportDirectoryRVA + ImportDirectoryLength + 15U) & ~15U;
- }
- else
- {
- // the additional 2 bytes padding are to align the address in the jump (which is a relocation fixup)
- return 2 + ((ImportDirectoryRVA + ImportDirectoryLength + 3U) & ~3U);
- }
- }
- }
-
- internal uint StartupStubLength
- {
- get
- {
- switch (peWriter.Headers.FileHeader.Machine)
- {
- case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_I386:
- return 6;
- case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_AMD64:
- return 12;
- case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_IA64:
- return 48;
- default:
- return 0;
- }
- }
- }
-
- private void WriteRVA(MetadataWriter mw, uint rva)
- {
- switch (peWriter.Headers.FileHeader.Machine)
- {
- case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_I386:
- case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_ARM:
- mw.Write(rva);
- break;
- default:
- mw.Write((ulong)rva);
- break;
- }
- }
-
- internal void Write(MetadataWriter mw, uint sdataRVA)
- {
- // Now that we're ready to start writing, we need to do some fix ups
- moduleBuilder.TypeRef.Fixup(moduleBuilder);
- moduleBuilder.MethodDef.Fixup(this);
- moduleBuilder.MethodImpl.Fixup(moduleBuilder);
- moduleBuilder.MethodSemantics.Fixup(moduleBuilder);
- moduleBuilder.InterfaceImpl.Fixup();
- moduleBuilder.ResolveInterfaceImplPseudoTokens();
- moduleBuilder.MemberRef.Fixup(moduleBuilder);
- moduleBuilder.Constant.Fixup(moduleBuilder);
- moduleBuilder.FieldMarshal.Fixup(moduleBuilder);
- moduleBuilder.DeclSecurity.Fixup(moduleBuilder);
- moduleBuilder.GenericParam.Fixup(moduleBuilder);
- moduleBuilder.CustomAttribute.Fixup(moduleBuilder);
- moduleBuilder.FieldLayout.Fixup(moduleBuilder);
- moduleBuilder.FieldRVA.Fixup(moduleBuilder, (int)sdataRVA, (int)this.MethodBodiesRVA);
- moduleBuilder.ImplMap.Fixup(moduleBuilder);
- moduleBuilder.ExportedType.Fixup(moduleBuilder);
- moduleBuilder.ManifestResource.Fixup(moduleBuilder);
- moduleBuilder.MethodSpec.Fixup(moduleBuilder);
- moduleBuilder.GenericParamConstraint.Fixup(moduleBuilder);
-
- // Import Address Table
- AssertRVA(mw, ImportAddressTableRVA);
- if (ImportAddressTableLength != 0)
- {
- WriteRVA(mw, ImportHintNameTableRVA);
- WriteRVA(mw, 0);
- }
-
- // CLI Header
- AssertRVA(mw, ComDescriptorRVA);
- cliHeader.MetaData.VirtualAddress = MetadataRVA;
- cliHeader.MetaData.Size = MetadataLength;
- if (ResourcesLength != 0)
- {
- cliHeader.Resources.VirtualAddress = ResourcesRVA;
- cliHeader.Resources.Size = ResourcesLength;
- }
- if (StrongNameSignatureLength != 0)
- {
- cliHeader.StrongNameSignature.VirtualAddress = StrongNameSignatureRVA;
- cliHeader.StrongNameSignature.Size = StrongNameSignatureLength;
- }
- if (VTableFixupsLength != 0)
- {
- cliHeader.VTableFixups.VirtualAddress = VTableFixupsRVA;
- cliHeader.VTableFixups.Size = VTableFixupsLength;
- }
- cliHeader.Write(mw);
-
- // alignment padding
- for (int i = (int)(MethodBodiesRVA - (ComDescriptorRVA + ComDescriptorLength)); i > 0; i--)
- {
- mw.Write((byte)0);
- }
-
- // Method Bodies
- mw.Write(moduleBuilder.methodBodies);
-
- // alignment padding
- for (int i = (int)(ResourcesRVA - (MethodBodiesRVA + MethodBodiesLength)); i > 0; i--)
- {
- mw.Write((byte)0);
- }
-
- // Resources
- mw.Write(moduleBuilder.manifestResources);
-
- // The strong name signature live here (if it exists), but it will written later
- // and the following alignment padding will take care of reserving the space.
-
- // alignment padding
- for (int i = (int)(MetadataRVA - (ResourcesRVA + ResourcesLength)); i > 0; i--)
- {
- mw.Write((byte)0);
- }
-
- // Metadata
- AssertRVA(mw, MetadataRVA);
- moduleBuilder.WriteMetadata(mw);
-
- // alignment padding
- for (int i = (int)(VTableFixupsRVA - (MetadataRVA + MetadataLength)); i > 0; i--)
- {
- mw.Write((byte)0);
- }
-
- // VTableFixups
- AssertRVA(mw, VTableFixupsRVA);
- WriteVTableFixups(mw, sdataRVA);
-
- // Debug Directory
- AssertRVA(mw, DebugDirectoryRVA);
- WriteDebugDirectory(mw);
-
- // alignment padding
- for (int i = (int)(ExportDirectoryRVA - (DebugDirectoryRVA + DebugDirectoryLength + DebugDirectoryContentsLength)); i > 0; i--)
- {
- mw.Write((byte)0);
- }
-
- // Export Directory
- AssertRVA(mw, ExportDirectoryRVA);
- WriteExportDirectory(mw);
-
- // Export Tables
- AssertRVA(mw, ExportTablesRVA);
- WriteExportTables(mw, sdataRVA);
-
- // alignment padding
- for (int i = (int)(ImportDirectoryRVA - (ExportTablesRVA + ExportTablesLength)); i > 0; i--)
- {
- mw.Write((byte)0);
- }
-
- // Import Directory
- AssertRVA(mw, ImportDirectoryRVA);
- if (ImportDirectoryLength != 0)
- {
- WriteImportDirectory(mw);
- }
-
- // alignment padding
- for (int i = (int)(StartupStubRVA - (ImportDirectoryRVA + ImportDirectoryLength)); i > 0; i--)
- {
- mw.Write((byte)0);
- }
-
- // Startup Stub
- AssertRVA(mw, StartupStubRVA);
- if (peWriter.Headers.FileHeader.Machine == IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_AMD64)
- {
- /*
- * 48 A1 00 20 40 00 00 00 00 00 mov rax,qword ptr [0000000000402000h]
- * FF E0 jmp rax
- */
- mw.Write((ushort)0xA148);
- mw.Write(peWriter.Headers.OptionalHeader.ImageBase + ImportAddressTableRVA);
- mw.Write((ushort)0xE0FF);
- }
- else if (peWriter.Headers.FileHeader.Machine == IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_IA64)
- {
- mw.Write(new byte[] {
- 0x0B, 0x48, 0x00, 0x02, 0x18, 0x10, 0xA0, 0x40, 0x24, 0x30, 0x28, 0x00, 0x00, 0x00, 0x04, 0x00,
- 0x10, 0x08, 0x00, 0x12, 0x18, 0x10, 0x60, 0x50, 0x04, 0x80, 0x03, 0x00, 0x60, 0x00, 0x80, 0x00
- });
- mw.Write(peWriter.Headers.OptionalHeader.ImageBase + StartupStubRVA);
- mw.Write(peWriter.Headers.OptionalHeader.ImageBase + BaseRVA);
- }
- else if (peWriter.Headers.FileHeader.Machine == IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_I386)
- {
- mw.Write((ushort)0x25FF);
- mw.Write((uint)peWriter.Headers.OptionalHeader.ImageBase + ImportAddressTableRVA);
- }
- }
-
- [Conditional("DEBUG")]
- private void AssertRVA(MetadataWriter mw, uint rva)
- {
- Debug.Assert(mw.Position - PointerToRawData + BaseRVA == rva);
- }
-
- private void WriteVTableFixups(MetadataWriter mw, uint sdataRVA)
- {
- foreach (ModuleBuilder.VTableFixups fixups in moduleBuilder.vtablefixups)
- {
- mw.Write(fixups.initializedDataOffset + sdataRVA);
- mw.Write(fixups.count);
- mw.Write(fixups.type);
- }
- }
-
- private void WriteDebugDirectory(MetadataWriter mw)
- {
- if (DebugDirectoryLength != 0)
- {
- IMAGE_DEBUG_DIRECTORY idd = new IMAGE_DEBUG_DIRECTORY();
- idd.Characteristics = 0;
- idd.TimeDateStamp = peWriter.Headers.FileHeader.TimeDateStamp;
- byte[] buf = SymbolSupport.GetDebugInfo(moduleBuilder.symbolWriter, ref idd);
- idd.PointerToRawData = (DebugDirectoryRVA - BaseRVA) + DebugDirectoryLength + PointerToRawData;
- idd.AddressOfRawData = DebugDirectoryRVA + DebugDirectoryLength;
- mw.Write(idd.Characteristics);
- mw.Write(idd.TimeDateStamp);
- mw.Write(idd.MajorVersion);
- mw.Write(idd.MinorVersion);
- mw.Write(idd.Type);
- mw.Write(idd.SizeOfData);
- mw.Write(idd.AddressOfRawData);
- mw.Write(idd.PointerToRawData);
- mw.Write(buf);
- }
- }
-
- private sealed class ExportTables
- {
- private readonly TextSection text;
- internal readonly uint entries;
- internal readonly uint ordinalBase;
- internal readonly uint nameCount;
- internal readonly uint namesLength;
- internal readonly uint exportAddressTableRVA;
- internal readonly uint exportNamePointerTableRVA;
- internal readonly uint exportOrdinalTableRVA;
- internal readonly uint namesRVA;
- internal readonly uint stubsRVA;
- private readonly uint stubLength;
-
- internal ExportTables(TextSection text)
- {
- this.text = text;
- ordinalBase = GetOrdinalBase(out entries);
- namesLength = GetExportNamesLength(out nameCount);
- exportAddressTableRVA = text.ExportTablesRVA;
- exportNamePointerTableRVA = exportAddressTableRVA + 4 * entries;
- exportOrdinalTableRVA = exportNamePointerTableRVA + 4 * nameCount;
- namesRVA = exportOrdinalTableRVA + 2 * nameCount;
- stubsRVA = (namesRVA + namesLength + 15) & ~15U;
- // note that we align the stubs to avoid having to deal with the relocation crossing a page boundary
- switch (text.peWriter.Headers.FileHeader.Machine)
- {
- case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_I386:
- stubLength = 8;
- break;
- case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_AMD64:
- stubLength = 16;
- break;
- default:
- throw new NotImplementedException();
- }
- }
-
- internal uint Length
- {
- get { return (stubsRVA + stubLength * (uint)text.moduleBuilder.unmanagedExports.Count) - text.ExportTablesRVA; }
- }
-
- private uint GetOrdinalBase(out uint entries)
- {
- uint min = uint.MaxValue;
- uint max = uint.MinValue;
- foreach (UnmanagedExport exp in text.moduleBuilder.unmanagedExports)
- {
- uint ordinal = (uint)exp.ordinal;
- min = Math.Min(min, ordinal);
- max = Math.Max(max, ordinal);
- }
- entries = 1 + (max - min);
- return min;
- }
-
- private uint GetExportNamesLength(out uint nameCount)
- {
- nameCount = 0;
- // the first name in the names list is the module name (the Export Directory contains a name of the current module)
- uint length = (uint)text.moduleBuilder.fileName.Length + 1;
- foreach (UnmanagedExport exp in text.moduleBuilder.unmanagedExports)
- {
- if (exp.name != null)
- {
- nameCount++;
- length += (uint)exp.name.Length + 1;
- }
- }
- return length;
- }
-
- internal void Write(MetadataWriter mw, uint sdataRVA)
- {
- // sort the exports by ordinal
- text.moduleBuilder.unmanagedExports.Sort(CompareUnmanagedExportOrdinals);
-
- // Now write the Export Address Table
- text.AssertRVA(mw, exportAddressTableRVA);
- for (int i = 0, pos = 0; i < entries; i++)
- {
- if (text.moduleBuilder.unmanagedExports[pos].ordinal == i + ordinalBase)
- {
- mw.Write(stubsRVA + (uint)pos * stubLength);
- pos++;
- }
- else
- {
- mw.Write(0);
- }
- }
-
- // sort the exports by name
- text.moduleBuilder.unmanagedExports.Sort(CompareUnmanagedExportNames);
-
- // Now write the Export Name Pointer Table
- text.AssertRVA(mw, exportNamePointerTableRVA);
- uint nameOffset = (uint)text.moduleBuilder.fileName.Length + 1;
- foreach (UnmanagedExport exp in text.moduleBuilder.unmanagedExports)
- {
- if (exp.name != null)
- {
- mw.Write(namesRVA + nameOffset);
- nameOffset += (uint)exp.name.Length + 1;
- }
- }
-
- // Now write the Export Ordinal Table
- text.AssertRVA(mw, exportOrdinalTableRVA);
- foreach (UnmanagedExport exp in text.moduleBuilder.unmanagedExports)
- {
- if (exp.name != null)
- {
- mw.Write((ushort)(exp.ordinal - ordinalBase));
- }
- }
-
- // Now write the actual names
- text.AssertRVA(mw, namesRVA);
- mw.Write(Encoding.ASCII.GetBytes(text.moduleBuilder.fileName));
- mw.Write((byte)0);
- foreach (UnmanagedExport exp in text.moduleBuilder.unmanagedExports)
- {
- if (exp.name != null)
- {
- mw.Write(Encoding.ASCII.GetBytes(exp.name));
- mw.Write((byte)0);
- }
- }
- text.AssertRVA(mw, namesRVA + namesLength);
-
- // alignment padding
- for (int i = (int)(stubsRVA - (namesRVA + namesLength)); i > 0; i--)
- {
- mw.Write((byte)0);
- }
-
- // sort the exports by ordinal
- text.moduleBuilder.unmanagedExports.Sort(CompareUnmanagedExportOrdinals);
-
- // Now write the stubs
- text.AssertRVA(mw, stubsRVA);
-
- for (int i = 0, pos = 0; i < entries; i++)
- {
- if (text.moduleBuilder.unmanagedExports[pos].ordinal == i + ordinalBase)
- {
- switch (text.peWriter.Headers.FileHeader.Machine)
- {
- case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_I386:
- mw.Write((byte)0xFF);
- mw.Write((byte)0x25);
- mw.Write((uint)text.peWriter.Headers.OptionalHeader.ImageBase + text.moduleBuilder.unmanagedExports[pos].rva.initializedDataOffset + sdataRVA);
- mw.Write((short)0); // alignment
- break;
- case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_AMD64:
- mw.Write((byte)0x48);
- mw.Write((byte)0xA1);
- mw.Write(text.peWriter.Headers.OptionalHeader.ImageBase + text.moduleBuilder.unmanagedExports[pos].rva.initializedDataOffset + sdataRVA);
- mw.Write((byte)0xFF);
- mw.Write((byte)0xE0);
- mw.Write(0); // alignment
- break;
- default:
- throw new NotImplementedException();
- }
- pos++;
- }
- }
- }
-
- private static int CompareUnmanagedExportNames(UnmanagedExport x, UnmanagedExport y)
- {
- if (x.name == null)
- {
- return y.name == null ? 0 : 1;
- }
- if (y.name == null)
- {
- return -1;
- }
- return x.name.CompareTo(y.name);
- }
-
- private static int CompareUnmanagedExportOrdinals(UnmanagedExport x, UnmanagedExport y)
- {
- return x.ordinal.CompareTo(y.ordinal);
- }
-
- internal void WriteRelocations(MetadataWriter mw)
- {
- // we assume that unmanagedExports is still sorted by ordinal
- for (int i = 0, pos = 0; i < entries; i++)
- {
- if (text.moduleBuilder.unmanagedExports[pos].ordinal == i + ordinalBase)
- {
- // both I386 and AMD64 have the address at offset 2
- text.WriteRelocationBlock(mw, stubsRVA + 2 + (uint)pos * stubLength);
- pos++;
- }
- }
- }
- }
-
- private uint GetOrdinalBase(out uint entries)
- {
- uint min = uint.MaxValue;
- uint max = uint.MinValue;
- foreach (UnmanagedExport exp in moduleBuilder.unmanagedExports)
- {
- uint ordinal = (uint)exp.ordinal;
- min = Math.Min(min, ordinal);
- max = Math.Max(max, ordinal);
- }
- entries = 1 + (max - min);
- return min;
- }
-
- private uint GetExportNamesLength(out uint nameCount)
- {
- nameCount = 0;
- uint length = 0;
- foreach (UnmanagedExport exp in moduleBuilder.unmanagedExports)
- {
- if (exp.name != null)
- {
- nameCount++;
- length += (uint)exp.name.Length + 1;
- }
- }
- return length;
- }
-
- private void WriteExportDirectory(MetadataWriter mw)
- {
- if (ExportDirectoryLength != 0)
- {
- // Flags
- mw.Write(0);
- // Date/Time Stamp
- mw.Write(peWriter.Headers.FileHeader.TimeDateStamp);
- // Major Version
- mw.Write((short)0);
- // Minor Version
- mw.Write((short)0);
- // Name RVA
- mw.Write(exportTables.namesRVA);
- // Ordinal Base
- mw.Write(exportTables.ordinalBase);
- // Address Table Entries
- mw.Write(exportTables.entries);
- // Number of Name Pointers
- mw.Write(exportTables.nameCount);
- // Export Address Table RVA
- mw.Write(exportTables.exportAddressTableRVA);
- // Name Pointer RVA
- mw.Write(exportTables.exportNamePointerTableRVA);
- // Ordinal Table RVA
- mw.Write(exportTables.exportOrdinalTableRVA);
- }
- }
-
- private void WriteExportTables(MetadataWriter mw, uint sdataRVA)
- {
- if (exportTables != null)
- {
- exportTables.Write(mw, sdataRVA);
- }
- }
-
- private void WriteImportDirectory(MetadataWriter mw)
- {
- mw.Write(ImportDirectoryRVA + 40); // ImportLookupTable
- mw.Write(0); // DateTimeStamp
- mw.Write(0); // ForwarderChain
- mw.Write(ImportHintNameTableRVA + 14); // Name
- mw.Write(ImportAddressTableRVA);
- mw.Write(new byte[20]);
- // Import Lookup Table
- mw.Write(ImportHintNameTableRVA); // Hint/Name Table RVA
- int size = 48;
- if (peWriter.Headers.FileHeader.Machine != IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_I386)
- {
- size += 4;
- mw.Write(0);
- }
- mw.Write(0);
-
- // alignment padding
- for (int i = (int)(ImportHintNameTableRVA - (ImportDirectoryRVA + size)); i > 0; i--)
- {
- mw.Write((byte)0);
- }
-
- // Hint/Name Table
- AssertRVA(mw, ImportHintNameTableRVA);
- mw.Write((ushort)0); // Hint
- if ((peWriter.Headers.FileHeader.Characteristics & IMAGE_FILE_HEADER.IMAGE_FILE_DLL) != 0)
- {
- mw.Write(System.Text.Encoding.ASCII.GetBytes("_CorDllMain"));
- }
- else
- {
- mw.Write(System.Text.Encoding.ASCII.GetBytes("_CorExeMain"));
- }
- mw.Write((byte)0);
- // Name
- mw.Write(System.Text.Encoding.ASCII.GetBytes("mscoree.dll"));
- mw.Write((ushort)0);
- }
-
- internal int Length
- {
- get { return (int)(StartupStubRVA - BaseRVA + StartupStubLength); }
- }
-
- internal void WriteRelocations(MetadataWriter mw)
- {
- uint relocAddress = this.StartupStubRVA;
- switch (peWriter.Headers.FileHeader.Machine)
- {
- case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_I386:
- case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_AMD64:
- relocAddress += 2;
- break;
- case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_IA64:
- relocAddress += 0x20;
- break;
- }
- WriteRelocationBlock(mw, relocAddress);
- if (exportTables != null)
- {
- exportTables.WriteRelocations(mw);
- }
- }
-
- // note that we're lazy and write a new relocation block for every relocation
- // even if they are in the same page (since there is typically only one anyway)
- private void WriteRelocationBlock(MetadataWriter mw, uint relocAddress)
- {
- uint pageRVA = relocAddress & ~0xFFFU;
- mw.Write(pageRVA); // PageRVA
- mw.Write(0x000C); // Block Size
- switch (peWriter.Headers.FileHeader.Machine)
- {
- case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_I386:
- mw.Write(0x3000 + relocAddress - pageRVA); // Type / Offset
- break;
- case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_AMD64:
- mw.Write(0xA000 + relocAddress - pageRVA); // Type / Offset
- break;
- case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_IA64:
- // on IA64 the StartupStubRVA is 16 byte aligned, so these two addresses won't cross a page boundary
- mw.Write((short)(0xA000 + relocAddress - pageRVA)); // Type / Offset
- mw.Write((short)(0xA000 + relocAddress - pageRVA + 8)); // Type / Offset
- break;
- }
- }
- }
-}
+++ /dev/null
-/*
- Copyright (C) 2008 Jeroen Frijters
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jeroen Frijters
- jeroen@frijters.net
-
-*/
-using System;
-using System.Globalization;
-using IKVM.Reflection.Emit;
-
-namespace IKVM.Reflection.Writer
-{
- sealed class VersionInfo
- {
- private AssemblyName name;
- private string fileName;
- internal string copyright;
- internal string trademark;
- internal string product;
- internal string company;
- private string description;
- private string title;
- internal string informationalVersion;
- private string fileVersion;
-
- internal void SetName(AssemblyName name)
- {
- this.name = name;
- }
-
- internal void SetFileName(string assemblyFileName)
- {
- this.fileName = assemblyFileName;
- }
-
- internal void SetAttribute(CustomAttributeBuilder cab)
- {
- Universe u = cab.Constructor.Module.universe;
- Type type = cab.Constructor.DeclaringType;
- if (copyright == null && type == u.System_Reflection_AssemblyCopyrightAttribute)
- {
- copyright = (string)cab.GetConstructorArgument(0);
- }
- else if (trademark == null && type == u.System_Reflection_AssemblyTrademarkAttribute)
- {
- trademark = (string)cab.GetConstructorArgument(0);
- }
- else if (product == null && type == u.System_Reflection_AssemblyProductAttribute)
- {
- product = (string)cab.GetConstructorArgument(0);
- }
- else if (company == null && type == u.System_Reflection_AssemblyCompanyAttribute)
- {
- company = (string)cab.GetConstructorArgument(0);
- }
- else if (description == null && type == u.System_Reflection_AssemblyDescriptionAttribute)
- {
- description = (string)cab.GetConstructorArgument(0);
- }
- else if (title == null && type == u.System_Reflection_AssemblyTitleAttribute)
- {
- title = (string)cab.GetConstructorArgument(0);
- }
- else if (informationalVersion == null && type == u.System_Reflection_AssemblyInformationalVersionAttribute)
- {
- informationalVersion = (string)cab.GetConstructorArgument(0);
- }
- else if (fileVersion == null && type == u.System_Reflection_AssemblyFileVersionAttribute)
- {
- fileVersion = (string)cab.GetConstructorArgument(0);
- }
- }
-
- internal void Write(ByteBuffer bb)
- {
- if (fileVersion == null)
- {
- if (name.Version != null)
- {
- fileVersion = name.Version.ToString();
- }
- else
- {
- fileVersion = "0.0.0.0";
- }
- }
-
- int codepage = 1200; // Unicode codepage
- int lcid = 0x7f;
- try
- {
- if (name.CultureInfo != null)
- {
- lcid = name.CultureInfo.LCID;
- }
- }
- catch (ArgumentException)
- {
- // AssemblyName.CultureInfo throws an ArgumentException if AssemblyBuilder.__SetAssemblyCulture() was used to specify a non-existing culture
- }
-
- Version filever = ParseVersionRobust(fileVersion);
- int fileVersionMajor = filever.Major;
- int fileVersionMinor = filever.Minor;
- int fileVersionBuild = filever.Build;
- int fileVersionRevision = filever.Revision;
-
- int productVersionMajor = fileVersionMajor;
- int productVersionMinor = fileVersionMinor;
- int productVersionBuild = fileVersionBuild;
- int productVersionRevision = fileVersionRevision;
- if (informationalVersion != null)
- {
- Version productver = ParseVersionRobust(informationalVersion);
- productVersionMajor = productver.Major;
- productVersionMinor = productver.Minor;
- productVersionBuild = productver.Build;
- productVersionRevision = productver.Revision;
- }
-
- ByteBuffer stringTable = new ByteBuffer(512);
- stringTable.Write((short)0); // wLength (placeholder)
- stringTable.Write((short)0); // wValueLength
- stringTable.Write((short)1); // wType
- WriteUTF16Z(stringTable, string.Format("{0:x4}{1:x4}", lcid, codepage));
- stringTable.Align(4);
-
- WriteString(stringTable, "Comments", description);
- WriteString(stringTable, "CompanyName", company);
- WriteString(stringTable, "FileDescription", title);
- WriteString(stringTable, "FileVersion", fileVersion);
- WriteString(stringTable, "InternalName", name.Name);
- WriteString(stringTable, "LegalCopyright", copyright);
- WriteString(stringTable, "LegalTrademarks", trademark);
- WriteString(stringTable, "OriginalFilename", fileName);
- WriteString(stringTable, "ProductName", product);
- WriteString(stringTable, "ProductVersion", informationalVersion);
-
- stringTable.Position = 0;
- stringTable.Write((short)stringTable.Length);
-
- ByteBuffer stringFileInfo = new ByteBuffer(512);
- stringFileInfo.Write((short)0); // wLength (placeholder)
- stringFileInfo.Write((short)0); // wValueLength
- stringFileInfo.Write((short)1); // wType
- WriteUTF16Z(stringFileInfo, "StringFileInfo");
- stringFileInfo.Align(4);
- stringFileInfo.Write(stringTable);
- stringFileInfo.Position = 0;
- stringFileInfo.Write((short)stringFileInfo.Length);
-
- byte[] preamble1 = new byte[] {
- // VS_VERSIONINFO (platform SDK)
- 0x34, 0x00, // wValueLength
- 0x00, 0x00, // wType
- 0x56, 0x00, 0x53, 0x00, 0x5F, 0x00, 0x56, 0x00, 0x45, 0x00, 0x52, 0x00, 0x53, 0x00, 0x49, 0x00, 0x4F, 0x00, 0x4E, 0x00, 0x5F, 0x00, 0x49, 0x00, 0x4E, 0x00, 0x46, 0x00, 0x4F, 0x00, 0x00, 0x00, // "VS_VERSION_INFO\0"
- 0x00, 0x00, // Padding1 (32 bit alignment)
- // VS_FIXEDFILEINFO starts
- 0xBD, 0x04, 0xEF, 0xFE, // dwSignature (0xFEEF04BD)
- 0x00, 0x00, 0x01, 0x00, // dwStrucVersion
- };
- byte[] preamble2 = new byte[] {
- 0x3F, 0x00, 0x00, 0x00, // dwFileFlagsMask (??)
- 0x00, 0x00, 0x00, 0x00, // dwFileFlags (??)
- 0x04, 0x00, 0x00, 0x00, // dwFileOS
- 0x02, 0x00, 0x00, 0x00, // dwFileType
- 0x00, 0x00, 0x00, 0x00, // dwFileSubtype
- 0x00, 0x00, 0x00, 0x00, // dwFileDateMS
- 0x00, 0x00, 0x00, 0x00, // dwFileDateLS
- // Padding2 (32 bit alignment)
- // VarFileInfo
- 0x44, 0x00, // wLength
- 0x00, 0x00, // wValueLength
- 0x01, 0x00, // wType
- 0x56, 0x00, 0x61, 0x00, 0x72, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x49, 0x00, 0x6E, 0x00, 0x66, 0x00, 0x6F, 0x00, 0x00, 0x00, // "VarFileInfo\0"
- 0x00, 0x00, // Padding
- // Var
- 0x24, 0x00, // wLength
- 0x04, 0x00, // wValueLength
- 0x00, 0x00, // wType
- 0x54, 0x00, 0x72, 0x00, 0x61, 0x00, 0x6E, 0x00, 0x73, 0x00, 0x6C, 0x00, 0x61, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x00, 0x00, // "Translation\0"
- 0x00, 0x00, // Padding (32 bit alignment)
- };
- bb.Write((short)(2 + preamble1.Length + 8 + 8 + preamble2.Length + 4 + stringFileInfo.Length));
- bb.Write(preamble1);
- bb.Write((short)fileVersionMinor);
- bb.Write((short)fileVersionMajor);
- bb.Write((short)fileVersionRevision);
- bb.Write((short)fileVersionBuild);
- bb.Write((short)productVersionMinor);
- bb.Write((short)productVersionMajor);
- bb.Write((short)productVersionRevision);
- bb.Write((short)productVersionBuild);
- bb.Write(preamble2);
- bb.Write((short)lcid);
- bb.Write((short)codepage);
- bb.Write(stringFileInfo);
- }
-
- private static void WriteUTF16Z(ByteBuffer bb, string str)
- {
- foreach (char c in str)
- {
- bb.Write((short)c);
- }
- bb.Write((short)0);
- }
-
- private static void WriteString(ByteBuffer bb, string name, string value)
- {
- value = value ?? " ";
- int pos = bb.Position;
- bb.Write((short)0); // wLength (placeholder)
- bb.Write((short)(value.Length + 1));// wValueLength
- bb.Write((short)1); // wType
- WriteUTF16Z(bb, name);
- bb.Align(4);
- WriteUTF16Z(bb, value);
- bb.Align(4);
- int savedPos = bb.Position;
- bb.Position = pos;
- bb.Write((short)(savedPos - pos));
- bb.Position = savedPos;
- }
-
- private static Version ParseVersionRobust(string ver)
- {
- int index = 0;
- ushort major = ParseVersionPart(ver, ref index);
- ushort minor = ParseVersionPart(ver, ref index);
- ushort build = ParseVersionPart(ver, ref index);
- ushort revision = ParseVersionPart(ver, ref index);
- return new Version(major, minor, build, revision);
- }
-
- private static ushort ParseVersionPart(string str, ref int pos)
- {
- ushort value = 0;
- while (pos < str.Length)
- {
- char c = str[pos];
- if (c == '.')
- {
- pos++;
- break;
- }
- else if (c >= '0' && c <= '9')
- {
- value *= 10;
- value += (ushort)(c - '0');
- pos++;
- }
- else
- {
- break;
- }
- }
- return value;
- }
- }
-}
+++ /dev/null
-<?xml version="1.0"?>
-<project name="reflect" default="IKVM.Reflection">
- <target name="IKVM.Reflection">
- <property name="defs" value="TRACE" />
- <if test="${framework::exists('mono-2.0')}">
- <property name="defs" value="${defs};MONO" />
- </if>
- <if test="${property::exists('signed')}">
- <property name="defs" value="${defs};${signed}" />
- </if>
- <if test="${version::get-major(framework::get-version(framework::get-target-framework() )) == 4}">
- <property name="defs" value="${defs};NET_4_0" />
- </if>
- <!-- workaround for the fact that <include if="${framework::exists('mono-2.0')} ...> still insists on evaluating the name attribute -->
- <property name="MonoSymbolWriter" value="dummy.dll" />
- <if test="${framework::exists('mono-2.0')}">
- <property name="MonoSymbolWriter" value="${path::combine(framework::get-assembly-directory('mono-2.0'), 'Mono.CompilerServices.SymbolWriter.dll')}" />
- </if>
- <csc target="library" output="../bin/IKVM.Reflection.dll" optimize="true" define="${defs}">
- <sources>
- <include name="../CommonAssemblyInfo.cs" />
- <include name="AmbiguousMatchException.cs" />
- <include name="Assembly.cs" />
- <include name="AssemblyName.cs" />
- <include name="BadImageFormatException.cs" />
- <include name="Binder.cs" />
- <include name="ConstructorInfo.cs" />
- <include name="CustomAttributeData.cs" />
- <include name="CustomAttributeNamedArgument.cs" />
- <include name="CustomAttributeTypedArgument.cs" />
- <include name="CustomModifiers.cs" />
- <include name="Enums.cs" />
- <include name="EventInfo.cs" />
- <include name="ExceptionHandlingClause.cs" />
- <include name="FieldInfo.cs" />
- <include name="FieldSignature.cs" />
- <include name="Fusion.cs" />
- <include name="GenericWrappers.cs" />
- <include name="InterfaceMapping.cs" />
- <include name="LocalVariableInfo.cs" />
- <include name="ManifestResourceInfo.cs" />
- <include name="MarshalSpec.cs" />
- <include name="MemberInfo.cs" />
- <include name="MethodBase.cs" />
- <include name="MethodBody.cs" />
- <include name="MethodImplMap.cs" />
- <include name="MethodInfo.cs" />
- <include name="MethodSignature.cs" />
- <include name="Missing.cs" />
- <include name="Module.cs" />
- <include name="ParameterInfo.cs" />
- <include name="ParameterModifier.cs" />
- <include name="PropertyInfo.cs" />
- <include name="PropertySignature.cs" />
- <include name="Signature.cs" />
- <include name="StandAloneMethodSig.cs" />
- <include name="StrongNameKeyPair.cs" />
- <include name="Type.cs" />
- <include name="TypeNameParser.cs" />
- <include name="Universe.cs" />
- <include name="Util.cs" />
- <include name="Emit\AssemblyBuilder.cs" />
- <include name="Emit\ConstructorBuilder.cs" />
- <include name="Emit\CustomAttributeBuilder.cs" />
- <include name="Emit\CustomModifiersBuilder.cs" />
- <include name="Emit\EnumBuilder.cs" />
- <include name="Emit\Enums.cs" />
- <include name="Emit\EventBuilder.cs" />
- <include name="Emit\FieldBuilder.cs" />
- <include name="Emit\ILGenerator.cs" />
- <include name="Emit\MethodBuilder.cs" />
- <include name="Emit\ModuleBuilder.cs" />
- <include name="Emit\OpCode.cs" />
- <include name="Emit\OpCodes.cs" />
- <include name="Emit\ParameterBuilder.cs" />
- <include name="Emit\PropertyBuilder.cs" />
- <include name="Emit\SignatureHelper.cs" />
- <include name="Emit\Tokens.cs" />
- <include name="Emit\TypeBuilder.cs" />
- <include name="Impl\ITypeOwner.cs" />
- <include name="Impl\MdbWriter.cs" />
- <include name="Impl\PdbWriter.cs" />
- <include name="Impl\SymbolSupport.cs" />
- <include name="Metadata\CliHeader.cs" />
- <include name="Metadata\MetadataRW.cs" />
- <include name="Metadata\Tables.cs" />
- <include name="Properties\AssemblyInfo.cs" />
- <include name="Reader\AssemblyReader.cs" />
- <include name="Reader\ByteReader.cs" />
- <include name="Reader\EventInfoImpl.cs" />
- <include name="Reader\Field.cs" />
- <include name="Reader\GenericTypeParameter.cs" />
- <include name="Reader\MetadataReader.cs" />
- <include name="Reader\Method.cs" />
- <include name="Reader\ModuleReader.cs" />
- <include name="Reader\PEReader.cs" />
- <include name="Reader\PropertyInfoImpl.cs" />
- <include name="Reader\ResourceModule.cs" />
- <include name="Reader\TypeDefImpl.cs" />
- <include name="Writer\ByteBuffer.cs" />
- <include name="Writer\Heaps.cs" />
- <include name="Writer\MetadataWriter.cs" />
- <include name="Writer\ModuleWriter.cs" />
- <include name="Writer\PEWriter.cs" />
- <include name="Writer\ResourceSection.cs" />
- <include name="Writer\TextSection.cs" />
- <include name="Writer\VersionInfo.cs" />
- </sources>
- <references>
- <include if="${framework::exists('mono-2.0')}" name="${MonoSymbolWriter}" />
- </references>
- </csc>
- </target>
-</project>
System.Dynamic \
Mono.CSharp \
Moonlight.Build.Tasks \
- System.Net
+ System.Net \
+ System.Json
net_2_0_only_dirs := \
System.Web.Extensions_1.0 \
Mono.Cairo \
Mono.Data.Sqlite \
System.Numerics \
- System.Data.Services.Client
+ System.Data.Services.Client \
+ System.Reactive.Interfaces \
+ System.Reactive.Core \
+ System.Reactive.Linq \
+ System.Reactive.PlatformServices \
+ System.Reactive.Experimental \
+ System.Reactive.Debugger
monodroid_dirs := \
Mono.CompilerServices.SymbolWriter \
Mono.CSharp \
- Microsoft.CSharp
+ Microsoft.CSharp \
+ System.Reactive.Providers
monotouch_runtime_dirs := \
corlib \
System.Windows.Forms.DataVisualization \
System.Xaml \
WindowsBase \
+ System.Reactive.Interfaces \
+ System.Reactive.Core \
+ System.Reactive.Linq \
+ System.Reactive.PlatformServices \
+ System.Reactive.Providers \
+ System.Reactive.Runtime.Remoting \
+ System.Reactive.Windows.Forms \
+ System.Reactive.Windows.Threading \
+ System.Reactive.Experimental \
+ System.Reactive.Debugger \
System.ServiceModel.Routing \
System.ServiceModel.Discovery \
System.Runtime.Caching \
Microsoft.Web.Infrastructure \
WebMatrix.Data \
System.Data.Services.Client \
- System.Data.Services \
- System.Json
+ System.Data.Services \
+ System.Json.Microsoft
net_4_0_only_dirs := \
System.ComponentModel.Composition
SUBDIRS = $(common_dirs) $(net_2_0_dirs) $(net_2_0_only_dirs) $(net_3_5_only_dirs) $(moonlight_raw_dirs) $(mobile_dirs) $(net_4_0_dirs) $(net_4_0_only_dirs) $(net_4_5_dirs)
-DIST_ONLY_SUBDIRS = dlr IKVM.Reflection aot-compiler
+DIST_ONLY_SUBDIRS = dlr aot-compiler
# No new makefiles for: System.Messaging, System.Web.Mobile,
# System.ServiceProcess
mono.pub \
msfinal.pub \
silverlight.pub \
+ reactive.pub \
mono.snk \
LICENSE \
README \
</AssemblyInfo>
<Attributes>
<Attribute>
- <AttributeName>System.ComponentModel.DefaultValue(�)</AttributeName>
+ <AttributeName>System.ComponentModel.DefaultValue('\0')</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.RefreshProperties(System.ComponentModel.RefreshProperties.Repaint)</AttributeName>
<AttributeName>System.ComponentModel.RefreshProperties(System.ComponentModel.RefreshProperties.Repaint)</AttributeName>
</Attribute>
<Attribute>
- <AttributeName>System.ComponentModel.DefaultValue(�)</AttributeName>
+ <AttributeName>System.ComponentModel.DefaultValue('\0')</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.Localizable(true)</AttributeName>
protected override void CreateHandle ()
{
- throw new NotImplementedException("COM/ActiveX support is not implemented");
+ if(!base.IsHandleCreated)
+ base.CreateHandle();
}
protected virtual object CreateInstanceCore (Guid clsid)
protected override void DestroyHandle ()
{
- throw new NotImplementedException("COM/ActiveX support is not implemented");
+ base.DestroyHandle();
}
[EditorBrowsable (EditorBrowsableState.Advanced)]
protected override void Dispose (bool disposing)
{
- throw new NotImplementedException("COM/ActiveX support is not implemented");
+ base.Dispose(disposing);
}
[EditorBrowsable (EditorBrowsableState.Never)]
protected override void WndProc (ref Message m)
{
- throw new NotImplementedException("COM/ActiveX support is not implemented");
+ this.DefWndProc(ref m);
}
#endregion // Protected Instance Methods
String.Join (";", defines));
}
- commandLine.AppendSwitchIfNotNull ("/nowarn:", DisabledWarnings);
+ if (!String.IsNullOrEmpty (DisabledWarnings)) {
+ string [] defines = DisabledWarnings.Split (new char [] {';', ' ', ','},
+ StringSplitOptions.RemoveEmptyEntries);
+ if (defines.Length > 0)
+ commandLine.AppendSwitchIfNotNull ("/nowarn:", defines, ";");
+ }
commandLine.AppendSwitchIfNotNull ("/doc:", DocumentationFile);
Assert.AreEqual ("/nowarn:A", clbe.ToString (), "A1");
}
+ [Test]
+ public void TestDisabledWarningsComma ()
+ {
+ CscExtended csc = new CscExtended ();
+ CommandLineBuilderExtension clbe = new CommandLineBuilderExtension ();
+
+ csc.DisabledWarnings = "A, B";
+ csc.ARFC (clbe);
+
+ Assert.AreEqual ("/nowarn:A;B", clbe.ToString (), "A1");
+ }
+
[Test]
public void TestDocumentationFile ()
{
Assert.IsTrue (big [0].Include.EndsWith (".dll"), "A3");
}
- [Test]
+ [Test, Category("NotWorking")]
public void ResolveBinary_FancyStuff ()
{
engine = new Engine (Consts.BinPath);
Assert.IsTrue (big.Cast<BuildItem> ().Any (item => item.Include.EndsWith ("SimpleWrite.dll")), "A5");
}
- [Test]
+ [Test, Category("NotWorking")]
public void ResolveBinary_SimpleWrite ()
{
engine = new Engine (Consts.BinPath);
Assert.AreEqual (0, big.Count, "A4");
}
- [Test]
+ [Test, Category("NotWorking")]
public void ResolveBinary_Testing ()
{
engine = new Engine (Consts.BinPath);
Assert.AreEqual (0, big.Count, "A4");
}
- [Test]
+ [Test, Category("NotWorking")]
public void ResolveBinary_XbuildReferenceBugTest ()
{
engine = new Engine (Consts.BinPath);
Assert.IsTrue (big.Cast<BuildItem> ().Any (item => item.Include.EndsWith ("Testing.dll")), "A7");
}
- [Test]
+ [Test, Category("NotWorking")]
public void ResolveBinary_FancyStuffAndXbuild ()
{
engine = new Engine (Consts.BinPath);
Assert.IsTrue (big.Cast<BuildItem> ().Any (item => item.Include.EndsWith ("Testing.dll")), "A6");
}
- [Test]
+ [Test, Category("NotWorking")]
public void ResolveBinary_SameAssemblyTwice ()
{
engine = new Engine (Consts.BinPath);
{\r
if (bDisposing)\r
Close();\r
-#if MONOTOUCH\r
- if (gch.IsAllocated)\r
- gch.Free ();\r
-#endif\r
}\r
\r
// It isn't necessary to cleanup any functions we've registered. If the connection\r
}\r
\r
_sql = null;\r
+#if MONOTOUCH\r
+ if (gch.IsAllocated)\r
+ gch.Free ();\r
+#endif\r
}\r
\r
internal override void Cancel()\r
{\r
base.Dispose(disposing);\r
\r
+ if (_sql != null)\r
+ _sql.Dispose ();\r
+\r
if (disposing)\r
Close();\r
}\r
unhandled_exception ();
return 0;
}
+ if (args.Length >0 && args [0] == "unhandled-exception-user") {
+ unhandled_exception_user ();
+ return 0;
+ }
breakpoints ();
single_stepping ();
arguments ();
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static void objects () {
- Tests t = new Tests () { field_i = 42, field_bool1 = true, field_bool2 = false, field_char = 'A', field_byte = 129, field_sbyte = -33, field_short = Int16.MaxValue - 5, field_ushort = UInt16.MaxValue - 5, field_long = Int64.MaxValue - 5, field_ulong = UInt64.MaxValue - 5, field_float = 3.14f, field_double = 3.14f, field_s = "S", base_field_i = 43, base_field_s = "T", field_enum = AnEnum.B, field_class = null, field_intptr = new IntPtr (Int32.MaxValue - 5) };
+ Tests t = new Tests () { field_i = 42, field_bool1 = true, field_bool2 = false, field_char = 'A', field_byte = 129, field_sbyte = -33, field_short = Int16.MaxValue - 5, field_ushort = UInt16.MaxValue - 5, field_long = Int64.MaxValue - 5, field_ulong = UInt64.MaxValue - 5, field_float = 3.14f, field_double = 3.14f, field_s = "S", base_field_i = 43, base_field_s = "T", field_enum = AnEnum.B, field_class = null, field_intptr = new IntPtr (Int32.MaxValue - 5), field_nullable = null };
t.o1 (new Tests2 () { field_j = 43 }, new GClass <int> { field = 42 }, new GClass <string> { field = "FOO" });
o2 (new string [] { "BAR", "BAZ" }, new int[] { 42, 43 }, new int [,] { { 1, 2 }, { 3, 4 }}, (int[,])Array.CreateInstance (typeof (int), new int [] { 2, 2}, new int [] { 1, 3}), new int[] { 0 });
}
Thread.Sleep (10000);
}
+ [MethodImplAttribute (MethodImplOptions.NoInlining)]
+ public static void unhandled_exception_user () {
+#if NET_4_5
+ System.Threading.Tasks.Task.Factory.StartNew (() => {
+ Throw ();
+ });
+ Thread.Sleep (10000);
+#endif
+ }
+
+ [MethodImplAttribute (MethodImplOptions.NoInlining)]
+ public static void Throw () {
+ throw new Exception ();
+ }
+
internal static Delegate create_filter_delegate (Delegate dlg, MethodInfo filter_method)
{
if (dlg == null)
void invoke_multiple_cb (IAsyncResult ar) {
ObjectMirror this_obj = (ObjectMirror)ar.AsyncState;
- Console.WriteLine ("CB!");
-
var res = this_obj.EndInvokeMethod (ar);
lock (invoke_results)
invoke_results.Add (res);
vm.Exit (0);
vm = null;
}
+
+#if NET_4_5
+ [Test]
+ public void UnhandledExceptionUserCode () {
+ vm.Detach ();
+
+ // Exceptions caught in non-user code are treated as unhandled
+ Start (new string [] { "dtest-app.exe", "unhandled-exception-user" });
+
+ var req = vm.CreateExceptionRequest (null, false, true);
+ req.AssemblyFilter = new List<AssemblyMirror> () { entry_point.DeclaringType.Assembly };
+ req.Enable ();
+
+ var e = run_until ("unhandled_exception_user");
+ vm.Resume ();
+
+ var e2 = GetNextEvent ();
+ Assert.IsTrue (e2 is ExceptionEvent);
+
+ vm.Exit (0);
+ vm = null;
+ }
+#endif
}
}
\ No newline at end of file
</para>
<para>
This is equivalent to calling the
- <see cref="C:Mono.Options.Option(System.String,System.String,System.Int32)" />
+ <see cref="C:Mono.Options.Option(System.String,System.String,System.Int32,System.Boolean)" />
constructor as with <c>Option(<paramref name="prototype" />,
- <paramref name="description" />, 1)</c>.
+ <paramref name="description" />, 1,false)</c>.
</para>
</remarks>
<exception cref="T:System.ArgumentException">
new instance using <paramref name="prototype" />, the
<see cref="P:Mono.Options.Option.Description" /> property of the
new instance using <paramref name="description" />. and
+ initializes the <see cref="P:Mono.Options.Option.MaxValueCount" />
+ property of the new instance to <c>1</c>.
+ </para>
+ <para>
+ This is equivalent to calling the
+ <see cref="C:Mono.Options.Option(System.String,System.String,System.Int32,System.Boolean)" />
+ constructor as with <c>Option(<paramref name="prototype" />,
+ <paramref name="description" />, <paramref name="maxValueCount" />, false)</c>.
+ </para>
+ </remarks>
+ <exception cref="T:System.ArgumentException">
+ <para>
+ <paramref name="prototype" /> is the empty string <c>""</c>.
+ </para>
+ <para>-or-</para>
+ <para>
+ <paramref name="prototype" /> contains an empty alias, such as
+ <c>a||b</c>.
+ </para>
+ <para>-or-</para>
+ <para>
+ Conflicting <see cref="T:Mono.Options.OptionValueType" /> values
+ were found within <paramref name="prototype" />.
+ </para>
+ <para>-or-</para>
+ <para>
+ <paramref name="maxValueCount" /> is <c>0</c> and
+ <paramref name="prototype" /> specified an
+ <see cref="T:Mono.Options.OptionValueType" /> value of
+ <see cref="F:Mono.Options.OptionValueType.Optional" /> or
+ <see cref="F:Mono.Options.OptionValueType.Required" />.
+ </para>
+ <para>-or-</para>
+ <para>
+ <paramref name="maxValueCount" /> is greater than <c>1</c> and
+ <paramref name="prototype" /> specified an
+ <see cref="T:Mono.Options.OptionValueType" /> value of
+ <see cref="F:Mono.Options.OptionValueType.None" />.
+ </para>
+ <para>-or-</para>
+ <para>
+ <paramref name="prototype" /> contains a separator list and
+ <paramref name="maxValueCount" /> is <c>0</c> or <c>1</c>.
+ </para>
+ <para>-or-</para>
+ <para>
+ <paramref name="prototype" /> contains a badly formatted
+ separator list, such as <c>{{</c>, <c>}}</c>, <c>{{}</c>, etc.
+ </para>
+ <para>-or-</para>
+ <para>
+ <paramref name="prototype" /> only includes the default handler
+ <c><></c> and <paramref name="prototype" /> did not specify an
+ <see cref="T:Mono.Options.OptionValueType" /> value of
+ <see cref="F:Mono.Options.OptionValueType.None" />.
+ </para>
+ <para>-or-</para>
+ <para>
+ <paramref name="prototype" /> includes the default handler
+ <c><></c>, and <paramref name="MaxValueCount" /> is greater
+ than <c>1</c>.
+ </para>
+ </exception>
+ <exception cref="T:System.ArgumentNullException">
+ <paramref name="prototype" /> is <see langword="null" />.
+ </exception>
+ </Docs>
+ </Member>
+ <Member MemberName=".ctor">
+ <MemberSignature Language="C#" Value="protected Option (string prototype, string description, int maxValueCount, bool hidden);" />
+ <MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor(string prototype, string description, int32 maxValueCount, bool hidden) cil managed" />
+ <MemberType>Constructor</MemberType>
+ <AssemblyInfo>
+ <AssemblyVersion>0.2.3.0</AssemblyVersion>
+ </AssemblyInfo>
+ <Parameters>
+ <Parameter Name="prototype" Type="System.String" />
+ <Parameter Name="description" Type="System.String" />
+ <Parameter Name="maxValueCount" Type="System.Int32" />
+ <Parameter Name="hidden" Type="System.Boolean" />
+ </Parameters>
+ <Docs>
+ <param name="prototype">
+ A <see cref="T:System.String" /> containing a <c>|</c>-separated
+ list of option names (aliases) and an optional value-type specifier.
+ </param>
+ <param name="description">
+ A <see cref="T:System.String" /> containing documentation for the
+ option.
+ </param>
+ <param name="maxValueCount">
+ A <see cref="T:System.Int32" /> containing the number of values this
+ option accepts.
+ </param>
+ <param name="hidden">
+ A <see cref="T:System.Boolean" /> specifying whether or not the
+ Option should be displayed in
+ <see cref="M:Mono.Options.OptionSet.WriteOptionDescriptions" />.
+ </param>
+ <summary>
+ Creates and initializes a new instance of the
+ <see cref="T:Mono.Options.Option" /> class.
+ </summary>
+ <remarks>
+ <para>
+ This constructor initializes the
+ <see cref="P:Mono.Options.Option.Prototype" /> property of the
+ new instance using <paramref name="prototype" />, the
+ <see cref="P:Mono.Options.Option.Description" /> property of the
+ new instance using <paramref name="description" />,
initializes the <see cref="P:Mono.Options.Option.MaxValueCount" />
- property of the new instance using <paramref name="maxValueCount" />.
+ property of the new instance using <paramref name="maxValueCount" />,
+ and initializes the <see cref="P:Mono.Options.Option.Hidden" />
+ property of the new instance using <paramref name="hidden" />.
</para>
<para>
<paramref name="prototype" /> is a <c>|</c>-separated list of
</remarks>
</Docs>
</Member>
+ <Member MemberName="Hidden">
+ <MemberSignature Language="C#" Value="public bool Hidden { get; }" />
+ <MemberSignature Language="ILAsm" Value=".property instance bool Hidden" />
+ <MemberType>Property</MemberType>
+ <AssemblyInfo>
+ <AssemblyVersion>0.2.3.0</AssemblyVersion>
+ </AssemblyInfo>
+ <ReturnValue>
+ <ReturnType>System.Boolean</ReturnType>
+ </ReturnValue>
+ <Docs>
+ <summary>
+ Whether
+ <see cref="M:Mono.Options.OptionSet.WriteOptionDescriptions" />
+ should write this option.
+ </summary>
+ <value>
+ If <see langword="true" />, then
+ <see cref="M:Mono.Options.OptionSet.WriteOptionDescriptions" />
+ will not print this option; otherwise,
+ <see cref="M:Mono.Options.OptionSet.WriteOptionDescriptions" />
+ will write this option.
+ </value>
+ <remarks>
+ </remarks>
+ </Docs>
+ </Member>
<Member MemberName="Invoke">
<MemberSignature Language="C#" Value="public void Invoke (Mono.Options.OptionContext c);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void Invoke(class Mono.Options.OptionContext c) cil managed" />
</exception>
</Docs>
</Member>
+ <Member MemberName="Add">
+ <MemberSignature Language="C#" Value="public Mono.Options.OptionSet Add (string prototype, string description, Mono.Options.OptionAction<string,string> action, bool hidden);" />
+ <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.OptionSet Add(string prototype, string description, class Mono.Options.OptionAction`2<string, string> action, bool hidden) cil managed" />
+ <MemberType>Method</MemberType>
+ <AssemblyInfo>
+ <AssemblyVersion>0.2.3.0</AssemblyVersion>
+ </AssemblyInfo>
+ <ReturnValue>
+ <ReturnType>Mono.Options.OptionSet</ReturnType>
+ </ReturnValue>
+ <Parameters>
+ <Parameter Name="prototype" Type="System.String" />
+ <Parameter Name="description" Type="System.String" />
+ <Parameter Name="action" Type="Mono.Options.OptionAction<System.String,System.String>" />
+ <Parameter Name="hidden" Type="System.Boolean" />
+ </Parameters>
+ <Docs>
+ <param name="prototype">
+ A <see cref="T:System.String" /> containing all option aliases to
+ register, an (optional) type specifier, and an (optional) value
+ separator list; see
+ <see cref="C:Mono.Options.Option(System.String,System.String,System.Int32)" />
+ for details.
+ </param>
+ <param name="description">
+ A <see cref="T:System.String" /> containing to used to initialize
+ the <see cref="P:Mono.Options.Option.Description" /> property.
+ </param>
+ <param name="action">
+ A <see cref="T:Mono.Options.OptionAction{System.String,System.String}" />
+ to invoke when an option is parsed.
+ </param>
+ <param name="hidden">
+ A <see cref="T:System.Boolean" /> specifying whether or not the
+ Option should be displayed in
+ <see cref="M:Mono.Options.OptionSet.WriteOptionDescriptions" />.
+ </param>
+ <summary>
+ Registers each alias within <paramref name="prototype" /> so that any
+ options matching the aliases in <paramref name="prototype" /> will be
+ handled by <paramref name="action" /> during any subsequent
+ <see cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" />
+ calls.
+ </summary>
+ <returns>
+ The current <see cref="T:Mono.Options.OptionSet" /> instance.
+ This is to permit method chaining.
+ </returns>
+ <remarks>
+ </remarks>
+ <altmember cref="M:Mono.Options.OptionSet.Add(Mono.Options.Option)" />
+ <exception cref="T:System.ArgumentException">
+ <paramref name="option" /> has an alias (as returned from
+ <see cref="M:Mono.Options.Option.GetNames" />) that conflicts with
+ a previously registered <see cref="T:Mono.Options.Option" />.
+ </exception>
+ <exception cref="T:System.ArgumentNullException">
+ <para>
+ <paramref name="prototype" /> is <see langword="null" /></para>
+ <para>-or-</para>
+ <para>
+ <paramref name="action" /> is <see langword="null" /></para>
+ </exception>
+ </Docs>
+ </Member>
+ <Member MemberName="Add">
+ <MemberSignature Language="C#" Value="public Mono.Options.OptionSet Add (string prototype, string description, Action<string> action, bool hidden);" />
+ <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.OptionSet Add(string prototype, string description, class System.Action`1<string> action, bool hidden) cil managed" />
+ <MemberType>Method</MemberType>
+ <AssemblyInfo>
+ <AssemblyVersion>0.2.3.0</AssemblyVersion>
+ </AssemblyInfo>
+ <ReturnValue>
+ <ReturnType>Mono.Options.OptionSet</ReturnType>
+ </ReturnValue>
+ <Parameters>
+ <Parameter Name="prototype" Type="System.String" />
+ <Parameter Name="description" Type="System.String" />
+ <Parameter Name="action" Type="System.Action<System.String>" />
+ <Parameter Name="hidden" Type="System.Boolean" />
+ </Parameters>
+ <Docs>
+ <param name="prototype">
+ A <see cref="T:System.String" /> containing all option aliases to
+ register, an (optional) type specifier, and an (optional) value
+ separator list; see
+ <see cref="C:Mono.Options.Option(System.String,System.String,System.Int32)" />
+ for details.
+ </param>
+ <param name="description">
+ A <see cref="T:System.String" /> containing to used to initialize
+ the <see cref="P:Mono.Options.Option.Description" /> property.
+ </param>
+ <param name="action">
+ A <see cref="T:System.Action{System.String}" />
+ to invoke when an option is parsed.
+ </param>
+ <param name="hidden">
+ A <see cref="T:System.Boolean" /> specifying whether or not the
+ Option should be displayed in
+ <see cref="M:Mono.Options.OptionSet.WriteOptionDescriptions" />.
+ </param>
+ <summary>
+ Registers each alias within <paramref name="prototype" /> so that any
+ options matching the aliases in <paramref name="prototype" /> will be
+ handled by <paramref name="action" /> during any subsequent
+ <see cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" />
+ calls.
+ </summary>
+ <returns>
+ The current <see cref="T:Mono.Options.OptionSet" /> instance.
+ This is to permit method chaining.
+ </returns>
+ <remarks>
+ </remarks>
+ <altmember cref="M:Mono.Options.OptionSet.Add(Mono.Options.Option)" />
+ <exception cref="T:System.ArgumentException">
+ <paramref name="option" /> has an alias (as returned from
+ <see cref="M:Mono.Options.Option.GetNames" />) that conflicts with
+ a previously registered <see cref="T:Mono.Options.Option" />.
+ </exception>
+ <exception cref="T:System.ArgumentNullException">
+ <para>
+ <paramref name="prototype" /> is <see langword="null" /></para>
+ <para>-or-</para>
+ <para>
+ <paramref name="action" /> is <see langword="null" /></para>
+ </exception>
+ </Docs>
+ </Member>
<Member MemberName="Add<T>">
<MemberSignature Language="C#" Value="public Mono.Options.OptionSet Add<T> (string prototype, Action<T> action);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.OptionSet Add<T>(string prototype, class System.Action`1<!!T> action) cil managed" />
<paramref name="o" />.
</summary>
<remarks>
+ <para>
+ Writes <see cref="T:Mono.Options.Option" /> documentation to
+ <paramref name="o" />.
+ </para>
+ <para>
+ If <see cref="P:Mono.Options.Option.Hidden" /> is
+ <see langword="true" />, then the Option will not be written to
+ <paramref name="o" />.
+ </para>
<para>
For each <see cref="T:Mono.Options.Option" /> previously added to
the current instance, this method writes out a comma-separated
// Authors:
// Jonathan Pryor <jpryor@novell.com>
// Federico Di Gregorio <fog@initd.org>
+// Rolf Bjarne Kvinge <rolf@xamarin.com>
//
// Copyright (C) 2008 Novell (http://www.novell.com)
// Copyright (C) 2009 Federico Di Gregorio.
+// Copyright (C) 2012 Xamarin Inc (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
OptionValueType type;
int count;
string[] separators;
+ bool hidden;
protected Option (string prototype, string description)
- : this (prototype, description, 1)
+ : this (prototype, description, 1, false)
{
}
protected Option (string prototype, string description, int maxValueCount)
+ : this (prototype, description, maxValueCount, false)
+ {
+ }
+
+ protected Option (string prototype, string description, int maxValueCount, bool hidden)
{
if (prototype == null)
throw new ArgumentNullException ("prototype");
return;
this.type = ParsePrototype ();
+ this.hidden = hidden;
if (this.count == 0 && type != OptionValueType.None)
throw new ArgumentException (
public string Description {get {return description;}}
public OptionValueType OptionValueType {get {return type;}}
public int MaxValueCount {get {return count;}}
+ public bool Hidden {get {return hidden;}}
public string[] GetNames ()
{
Action<OptionValueCollection> action;
public ActionOption (string prototype, string description, int count, Action<OptionValueCollection> action)
- : base (prototype, description, count)
+ : this (prototype, description, count, action, false)
+ {
+ }
+
+ public ActionOption (string prototype, string description, int count, Action<OptionValueCollection> action, bool hidden)
+ : base (prototype, description, count, hidden)
{
if (action == null)
throw new ArgumentNullException ("action");
}
public OptionSet Add (string prototype, string description, Action<string> action)
+ {
+ return Add (prototype, description, action, false);
+ }
+
+ public OptionSet Add (string prototype, string description, Action<string> action, bool hidden)
{
if (action == null)
throw new ArgumentNullException ("action");
Option p = new ActionOption (prototype, description, 1,
- delegate (OptionValueCollection v) { action (v [0]); });
+ delegate (OptionValueCollection v) { action (v [0]); }, hidden);
base.Add (p);
return this;
}
public OptionSet Add (string prototype, string description, OptionAction<string, string> action)
{
+ return Add (prototype, description, action, false);
+ }
+
+ public OptionSet Add (string prototype, string description, OptionAction<string, string> action, bool hidden) {
if (action == null)
throw new ArgumentNullException ("action");
Option p = new ActionOption (prototype, description, 2,
- delegate (OptionValueCollection v) {action (v [0], v [1]);});
+ delegate (OptionValueCollection v) {action (v [0], v [1]);}, hidden);
base.Add (p);
return this;
}
foreach (Option p in this) {
int written = 0;
+ if (p.Hidden)
+ continue;
+
Category c = p as Category;
if (c != null) {
WriteDescription (o, p.Description, "", 80, 80);
{
var p = new OptionSet () {
"\n:Category 1:",
+ { "hidden", "hidden option, invisible in help", v => {}, true },
+ { "hidden2=", "hidden option, invisible in help", (k, v) => {}, true },
{ "p|indicator-style=", "append / indicator to directories", v => {} },
{ "color:", "controls color info", v => {} },
{ "color2:", "set {color}", v => {} },
<remarks>
<para>This member is obsolete. Please use
<see cref="P:Mono.Unix.UnixEnvironment.MachineName" /> instead.</para>
- <para>See also GetHostName()</para>
- </remarks>
- <altmember cref="P:Mono.Unix.UnixEnvironment.MachineName" />
- <altmember cref="M:Mono.Unix.Native.Syscall.gethostname" />
- </Docs>
- </Member>
- <Member MemberName="GetHostName">
- <MemberSignature Language="C#" Value="public static string GetHostName ();" />
- <MemberSignature Language="ILAsm" Value=".method public static hidebysig string GetHostName() cil managed" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>1.0.5000.0</AssemblyVersion>
- <AssemblyVersion>2.0.0.0</AssemblyVersion>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Parameters />
- <Docs>
- <summary>Retrieves the hostname.</summary>
- <returns>a <see cref="T:System.String" /></returns>
- <remarks>
- <para>This member is obsolete. Please use
- <see cref="P:Mono.Unix.UnixEnvironment.MachineName" /> instead.</para>
- <para>Either GetHostName() should be removed, since gethostname() also exists, or the entire library should be CamelCased per .NET standard.</para>
</remarks>
<altmember cref="P:Mono.Unix.UnixEnvironment.MachineName" />
<altmember cref="M:Mono.Unix.Native.Syscall.gethostname" />
--- /dev/null
+thisdir = class/Mono.Reactive.Testing
+SUBDIRS =
+include ../../build/rules.make
+
+LIBRARY = Mono.Reactive.Testing.dll
+LIB_MCS_FLAGS = \
+ @more_build_args \
+ -r:System.dll \
+ -r:System.Core.dll \
+ -r:System.Reactive.Interfaces.dll \
+ -r:System.Reactive.Core.dll \
+ -r:System.Reactive.Linq.dll \
+ -r:System.Reactive.PlatformServices.dll \
+ -r:System.Reactive.Providers.dll \
+ -r:System.Reactive.Runtime.Remoting.dll \
+ -r:System.Reactive.Experimental.dll \
+ -r:System.Reactive.Windows.Forms.dll \
+ -r:System.Reactive.Windows.Threading.dll \
+ -r:System.Windows.Forms.dll \
+ -r:WindowsBase.dll \
+ -r:nunit.framework.dll \
+ -d:NUNIT -d:MONO -d:DESKTOPCLR
+ # NO_PERF is required to disable ObservableMultipleTest.Catch_TailRecursive2 which blocked test execution.
+ # disabled -d:HAS_WINFORMS
+
+ifeq (2.1, $(FRAMEWORK_VERSION))
+LIB_MCS_FLAGS += -d:NO_TASK_DELAY
+endif
+
+NET_4_5 := $(filter 4.5, $(FRAMEWORK_VERSION))
+ifdef NET_4_5
+LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC
+endif
+
+TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:0618
+
+EXTRA_DISTFILES = more_build_args
+
+VALID_PROFILE := $(filter 2 4, $(FRAMEWORK_VERSION_MAJOR))
+ifndef VALID_PROFILE
+LIBRARY_NAME = dummy-System.Mono.Reactive.Testing.dll
+NO_INSTALL = yes
+NO_TEST = yes
+endif
+
+NO_SIGN_ASSEMBLY = yes
+
+include ../../build/library.make
--- /dev/null
+../../../external/rx/Rx.NET/Microsoft.Reactive.Testing/ColdObservable.cs
+../../../external/rx/Rx.NET/Microsoft.Reactive.Testing/GlobalSuppressions.cs
+../../../external/rx/Rx.NET/Microsoft.Reactive.Testing/HotObservable.cs
+../../../external/rx/Rx.NET/Microsoft.Reactive.Testing/ITestObservable.cs
+../../../external/rx/Rx.NET/Microsoft.Reactive.Testing/ITestObserver.cs
+../../../external/rx/Rx.NET/Microsoft.Reactive.Testing/MockObserver.cs
+../../../external/rx/Rx.NET/Microsoft.Reactive.Testing/NamespaceDoc.cs
+../../../external/rx/Rx.NET/Microsoft.Reactive.Testing/Properties/AssemblyInfo.cs
+../../../external/rx/Rx.NET/Microsoft.Reactive.Testing/ReactiveAssert.cs
+../../../external/rx/Rx.NET/Microsoft.Reactive.Testing/ReactiveTest.cs
+../../../external/rx/Rx.NET/Microsoft.Reactive.Testing/Recorded.cs
+../../../external/rx/Rx.NET/Microsoft.Reactive.Testing/Subscription.cs
+../../../external/rx/Rx.NET/Microsoft.Reactive.Testing/TestScheduler.cs
--- /dev/null
+../../../../external/rx/Rx.NET/Tests.System.Reactive/App.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/DispatcherHelpers.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Semaphore.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Stress/Core/Disposables/Composite.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Stress/Core/Disposables/Serial.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Stress/Core/Disposables/SingleAssignment.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Stress/Core/Disposables/RefCount.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Stress/Linq/Delay.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Stress/Linq/FromEvent.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Stress/Helpers.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Stress/Linq/Replay.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/TestBase.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/TestLongRunningScheduler.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/AnonymousTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/AsyncLockTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ConcurrencyTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ConnectableObservable.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ConnectableObservableTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ControlSchedulerTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObservableSafetyTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/QbservableExTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/RogueEnumerable.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ScheduledItemTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/StopwatchTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/SystemClockTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/DefaultConcurrencyAbstractionLayerTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/EventPatternSourceBaseTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/SynchronizationTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/DefaultSchedulerTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/CurrentThreadSchedulerTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/DisposableTests.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/EventLoopSchedulerTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/HistoricalSchedulerTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ImmediateSchedulerTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/MySubject.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/NewThreadSchedulerTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/NotificationTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObservableEventsTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObservableImperativeTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/SchedulerTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/SynchronizationContextSchedulerTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/TaskObservableExtensionsTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/TaskPoolSchedulerTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ThreadPoolSchedulerTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/TimeTests.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/UnitTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/VirtualSchedulerTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Dummies/DummyDisposable.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Dummies/DummyEnumerable.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Dummies/DummyFunc.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Dummies/DummyObservable.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Dummies/DummyObserver.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Dummies/DummyScheduler.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Extensions.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/MockDisposable.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/MockEnumerable.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/NullErrorObservable.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Properties/AssemblyInfo.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/AsyncSubjectTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/BehaviorSubjectTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/SubjectTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ListObservableTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObservableAggregateTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObservableAsyncTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObservableAwaiterTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObservableBindingTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObservableBlockingTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObservableConversionTests.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObservableCreationTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObservableExtensionsTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObservableJoinsTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObservableMultipleTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObservableRemotingTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObservableSingleTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObservableStandardQueryOperatorTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObservableTimeTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObserverTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/PrivateTypesTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/QbservableTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/RegressionTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ReplaySubjectTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/TestTaskScheduler.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Utils.cs
--- /dev/null
+-d:SIGNED
+-delaysign
+-keyfile:../reactive.pub
+++ /dev/null
-<Type Name="MD2" FullName="Mono.Security.Cryptography.MD2">
- <TypeSignature Language="C#" Maintainer="auto" Value="public abstract class MD2 : System.Security.Cryptography.HashAlgorithm" />
- <AssemblyInfo>
- <AssemblyName>Mono.Security.Win32</AssemblyName>
- <AssemblyPublicKey>[00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 79 15 99 77 D2 D0 3A 8E 6B EA 7A 2E 74 E8 D1 AF CC 93 E8 85 19 74 95 2B B4 80 A1 2C 91 34 47 4D 04 06 24 47 C3 7E 0E 68 C0 80 53 6F CF 3C 3F BE 2F F9 C9 79 CE 99 84 75 E5 06 E8 CE 82 DD 5B 0F 35 0D C1 0E 93 BF 2E EE CF 87 4B 24 77 0C 50 81 DB EA 74 47 FD DA FA 27 7B 22 DE 47 D6 FF EA 44 96 74 A4 F9 FC CF 84 D1 50 69 08 93 80 28 4D BD D3 5F 46 CD FF 12 A1 BD 78 E4 EF 00 65 D0 16 DF]</AssemblyPublicKey>
- <AssemblyVersion>1.0.5000.0</AssemblyVersion>
- <AssemblyVersion>2.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ThreadSafetyStatement>Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details.</ThreadSafetyStatement>
- <Base>
- <BaseTypeName>System.Security.Cryptography.HashAlgorithm</BaseTypeName>
- </Base>
- <Interfaces>
- </Interfaces>
- <Docs>
- <summary>Common base class for all derived MD2 implementations.</summary>
- <remarks>This class isn't CryptoAPI related. It is included here so that Mono.Security.dll doesn't have any dependencies on assemblies other than mscorlib.dll.</remarks>
- </Docs>
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="protected MD2 ();" />
- <MemberType>Constructor</MemberType>
- <ReturnValue />
- <Parameters />
- <Docs>
- <summary>To be added</summary>
- <remarks>To be added</remarks>
- </Docs>
- <AssemblyInfo>
- <AssemblyVersion>1.0.5000.0</AssemblyVersion>
- <AssemblyVersion>2.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- </Member>
- <Member MemberName="Create">
- <MemberSignature Language="C#" Value="public static Mono.Security.Cryptography.MD2 Create ();" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>Mono.Security.Cryptography.MD2</ReturnType>
- </ReturnValue>
- <Parameters />
- <Docs>
- <summary>Creates the default derived class.</summary>
- <returns>a <see cref="T:Mono.Security.Cryptography.MD2" /></returns>
- <remarks>To be added</remarks>
- </Docs>
- <AssemblyInfo>
- <AssemblyVersion>1.0.5000.0</AssemblyVersion>
- <AssemblyVersion>2.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- </Member>
- <Member MemberName="Create">
- <MemberSignature Language="C#" Value="public static Mono.Security.Cryptography.MD2 Create (string hashName);" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>Mono.Security.Cryptography.MD2</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="hashName" Type="System.String" />
- </Parameters>
- <Docs>
- <param name="hashName">Specifies which derived class to create.</param>
- <summary>Creates a new derived class.</summary>
- <returns>a <see cref="T:Mono.Security.Cryptography.MD2" /></returns>
- <remarks>To be added</remarks>
- </Docs>
- <AssemblyInfo>
- <AssemblyVersion>1.0.5000.0</AssemblyVersion>
- <AssemblyVersion>2.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- </Member>
- </Members>
-</Type>
+++ /dev/null
-<Type Name="MD4" FullName="Mono.Security.Cryptography.MD4">
- <TypeSignature Language="C#" Maintainer="auto" Value="public abstract class MD4 : System.Security.Cryptography.HashAlgorithm" />
- <AssemblyInfo>
- <AssemblyName>Mono.Security.Win32</AssemblyName>
- <AssemblyPublicKey>[00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 79 15 99 77 D2 D0 3A 8E 6B EA 7A 2E 74 E8 D1 AF CC 93 E8 85 19 74 95 2B B4 80 A1 2C 91 34 47 4D 04 06 24 47 C3 7E 0E 68 C0 80 53 6F CF 3C 3F BE 2F F9 C9 79 CE 99 84 75 E5 06 E8 CE 82 DD 5B 0F 35 0D C1 0E 93 BF 2E EE CF 87 4B 24 77 0C 50 81 DB EA 74 47 FD DA FA 27 7B 22 DE 47 D6 FF EA 44 96 74 A4 F9 FC CF 84 D1 50 69 08 93 80 28 4D BD D3 5F 46 CD FF 12 A1 BD 78 E4 EF 00 65 D0 16 DF]</AssemblyPublicKey>
- <AssemblyVersion>1.0.5000.0</AssemblyVersion>
- <AssemblyVersion>2.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ThreadSafetyStatement>Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details.</ThreadSafetyStatement>
- <Base>
- <BaseTypeName>System.Security.Cryptography.HashAlgorithm</BaseTypeName>
- </Base>
- <Interfaces>
- </Interfaces>
- <Docs>
- <summary>Common base class for all derived MD4 implementations. </summary>
- <remarks>This class isn't CryptoAPI related. It is included here so that Mono.Security.dll doesn't have any dependencies on assemblies other than mscorlib.dll.</remarks>
- </Docs>
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="protected MD4 ();" />
- <MemberType>Constructor</MemberType>
- <ReturnValue />
- <Parameters />
- <Docs>
- <summary>To be added</summary>
- <remarks>To be added</remarks>
- </Docs>
- <AssemblyInfo>
- <AssemblyVersion>1.0.5000.0</AssemblyVersion>
- <AssemblyVersion>2.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- </Member>
- <Member MemberName="Create">
- <MemberSignature Language="C#" Value="public static Mono.Security.Cryptography.MD4 Create ();" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>Mono.Security.Cryptography.MD4</ReturnType>
- </ReturnValue>
- <Parameters />
- <Docs>
- <summary>Creates the default derived class.</summary>
- <returns>a <see cref="T:Mono.Security.Cryptography.MD4" /></returns>
- <remarks>To be added</remarks>
- </Docs>
- <AssemblyInfo>
- <AssemblyVersion>1.0.5000.0</AssemblyVersion>
- <AssemblyVersion>2.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- </Member>
- <Member MemberName="Create">
- <MemberSignature Language="C#" Value="public static Mono.Security.Cryptography.MD4 Create (string hashName);" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>Mono.Security.Cryptography.MD4</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="hashName" Type="System.String" />
- </Parameters>
- <Docs>
- <param name="hashName">Specifies which derived class to create.</param>
- <summary>Creates a new derived class.</summary>
- <returns>a <see cref="T:Mono.Security.Cryptography.MD4" /></returns>
- <remarks>To be added</remarks>
- </Docs>
- <AssemblyInfo>
- <AssemblyVersion>1.0.5000.0</AssemblyVersion>
- <AssemblyVersion>2.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- </Member>
- </Members>
-</Type>
namespace Mono.Security.Protocol.Ntlm {
+ [Obsolete (Type3Message.LegacyAPIWarning)]
public class ChallengeResponse : IDisposable {
static private byte[] magic = { 0x4B, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25 };
--- /dev/null
+//
+// Mono.Security.Protocol.Ntlm.ChallengeResponse
+// Implements Challenge Response for NTLM v1 and NTLM v2 Session
+//
+// Authors:
+// Sebastien Pouliot <sebastien@ximian.com>
+// Martin Baulig <martin.baulig@xamarin.com>
+//
+// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
+// (C) 2004 Novell (http://www.novell.com)
+// (C) 2012 Xamarin, Inc. (http://www.xamarin.com)
+//
+// References
+// a. NTLM Authentication Scheme for HTTP, Ronald Tschalär
+// http://www.innovation.ch/java/ntlm.html
+// b. The NTLM Authentication Protocol, Copyright © 2003 Eric Glass
+// http://davenport.sourceforge.net/ntlm.html
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.IO;
+using System.Net;
+using System.Globalization;
+using System.Security.Cryptography;
+using System.Text;
+
+using Mono.Security.Cryptography;
+
+namespace Mono.Security.Protocol.Ntlm {
+
+ public static class ChallengeResponse2 {
+
+ static private byte[] magic = { 0x4B, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25 };
+
+ // This is the pre-encrypted magic value with a null DES key (0xAAD3B435B51404EE)
+ // Ref: http://packetstormsecurity.nl/Crackers/NT/l0phtcrack/l0phtcrack2.5-readme.html
+ static private byte[] nullEncMagic = { 0xAA, 0xD3, 0xB4, 0x35, 0xB5, 0x14, 0x04, 0xEE };
+
+ static byte[] Compute_LM (string password, byte[] challenge)
+ {
+ var buffer = new byte [21];
+
+ // create Lan Manager password
+#if MOONLIGHT
+ DESCryptoServiceProvider des = new DESCryptoServiceProvider ();
+#else
+ DES des = DES.Create ();
+#endif
+ des.Mode = CipherMode.ECB;
+ ICryptoTransform ct = null;
+
+ // Note: In .NET DES cannot accept a weak key
+ // this can happen for a null password
+ if ((password == null) || (password.Length < 1)) {
+ Buffer.BlockCopy (nullEncMagic, 0, buffer, 0, 8);
+ } else {
+ des.Key = PasswordToKey (password, 0);
+ ct = des.CreateEncryptor ();
+ ct.TransformBlock (magic, 0, 8, buffer, 0);
+ }
+
+ // and if a password has less than 8 characters
+ if ((password == null) || (password.Length < 8)) {
+ Buffer.BlockCopy (nullEncMagic, 0, buffer, 8, 8);
+ } else {
+ des.Key = PasswordToKey (password, 7);
+ ct = des.CreateEncryptor ();
+ ct.TransformBlock (magic, 0, 8, buffer, 8);
+ }
+
+ des.Clear ();
+
+ return GetResponse (challenge, buffer);
+ }
+
+ static byte[] Compute_NTLM_Password (string password)
+ {
+ var buffer = new byte [21];
+
+ // create NT password
+#if MOONLIGHT
+ MD4Managed md4 = new MD4Managed ();
+#else
+ MD4 md4 = MD4.Create ();
+#endif
+ byte[] data = ((password == null) ? (new byte [0]) : (Encoding.Unicode.GetBytes (password)));
+ byte[] hash = md4.ComputeHash (data);
+ Buffer.BlockCopy (hash, 0, buffer, 0, 16);
+
+ // clean up
+ Array.Clear (data, 0, data.Length);
+ Array.Clear (hash, 0, hash.Length);
+
+ return buffer;
+ }
+
+ static byte[] Compute_NTLM (string password, byte[] challenge)
+ {
+ var buffer = Compute_NTLM_Password (password);
+ return GetResponse (challenge, buffer);
+ }
+
+ static void Compute_NTLMv2_Session (string password, byte[] challenge,
+ out byte[] lm, out byte[] ntlm)
+ {
+ var nonce = new byte [8];
+ var rng = RandomNumberGenerator.Create ();
+ rng.GetBytes (nonce);
+
+ var sessionNonce = new byte [challenge.Length + 8];
+ challenge.CopyTo (sessionNonce, 0);
+ nonce.CopyTo (sessionNonce, challenge.Length);
+
+ lm = new byte [24];
+ nonce.CopyTo (lm, 0);
+
+#if MOONLIGHT
+ MD5Managed md5 = new MD5Managed ();
+#else
+ MD5 md5 = MD5.Create ();
+#endif
+
+ var hash = md5.ComputeHash (sessionNonce);
+ var newChallenge = new byte [8];
+ Array.Copy (hash, newChallenge, 8);
+
+ ntlm = Compute_NTLM (password, newChallenge);
+
+ // clean up
+ Array.Clear (nonce, 0, nonce.Length);
+ Array.Clear (sessionNonce, 0, sessionNonce.Length);
+ Array.Clear (newChallenge, 0, newChallenge.Length);
+ Array.Clear (hash, 0, hash.Length);
+ }
+
+ static byte[] Compute_NTLMv2 (Type2Message type2, string username, string password)
+ {
+ var ntlm_hash = Compute_NTLM_Password (password);
+
+ var ubytes = Encoding.Unicode.GetBytes (username.ToUpperInvariant ());
+ var tbytes = Encoding.Unicode.GetBytes (type2.TargetName.ToUpperInvariant ());
+
+ var bytes = new byte [ubytes.Length + tbytes.Length];
+ ubytes.CopyTo (bytes, 0);
+ Array.Copy (tbytes, 0, bytes, ubytes.Length, tbytes.Length);
+
+ var md5 = new HMACMD5 (ntlm_hash);
+ var ntlm_v2_hash = md5.ComputeHash (bytes);
+
+ Array.Clear (ntlm_hash, 0, ntlm_hash.Length);
+ md5.Clear ();
+
+ var ntlm_v2_md5 = new HMACMD5 (ntlm_v2_hash);
+
+ var now = DateTime.Now;
+ var timestamp = now.Ticks - 504911232000000000;
+
+ var nonce = new byte [8];
+ var rng = RandomNumberGenerator.Create ();
+ rng.GetBytes (nonce);
+
+ byte[] blob = new byte [28 + type2.TargetInfo.Length];
+ blob[0] = 0x01;
+ blob[1] = 0x01;
+
+ Buffer.BlockCopy (BitConverterLE.GetBytes (timestamp), 0, blob, 8, 8);
+
+ Buffer.BlockCopy (nonce, 0, blob, 16, 8);
+ Buffer.BlockCopy (type2.TargetInfo, 0, blob, 28, type2.TargetInfo.Length);
+
+ var challenge = type2.Nonce;
+
+ var hashInput = new byte [challenge.Length + blob.Length];
+ challenge.CopyTo (hashInput, 0);
+ blob.CopyTo (hashInput, challenge.Length);
+
+ var blobHash = ntlm_v2_md5.ComputeHash (hashInput);
+
+ var response = new byte [blob.Length + blobHash.Length];
+ blobHash.CopyTo (response, 0);
+ blob.CopyTo (response, blobHash.Length);
+
+ Array.Clear (ntlm_v2_hash, 0, ntlm_v2_hash.Length);
+ ntlm_v2_md5.Clear ();
+ Array.Clear (nonce, 0, nonce.Length);
+ Array.Clear (blob, 0, blob.Length);
+ Array.Clear (hashInput, 0, hashInput.Length);
+ Array.Clear (blobHash, 0, blobHash.Length);
+
+ return response;
+ }
+
+ public static void Compute (Type2Message type2, NtlmAuthLevel level,
+ string username, string password,
+ out byte[] lm, out byte[] ntlm)
+ {
+ lm = null;
+
+ switch (level) {
+ case NtlmAuthLevel.LM_and_NTLM:
+ lm = Compute_LM (password, type2.Nonce);
+ ntlm = Compute_NTLM (password, type2.Nonce);
+ break;
+
+ case NtlmAuthLevel.LM_and_NTLM_and_try_NTLMv2_Session:
+ if ((type2.Flags & NtlmFlags.NegotiateNtlm2Key) == 0)
+ goto case NtlmAuthLevel.LM_and_NTLM;
+ Compute_NTLMv2_Session (password, type2.Nonce, out lm, out ntlm);
+ break;
+
+ case NtlmAuthLevel.NTLM_only:
+ if ((type2.Flags & NtlmFlags.NegotiateNtlm2Key) != 0)
+ Compute_NTLMv2_Session (password, type2.Nonce, out lm, out ntlm);
+ else
+ ntlm = Compute_NTLM (password, type2.Nonce);
+ break;
+
+ case NtlmAuthLevel.NTLMv2_only:
+ ntlm = Compute_NTLMv2 (type2, username, password);
+ break;
+
+ default:
+ throw new InvalidOperationException ();
+ }
+ }
+
+ static byte[] GetResponse (byte[] challenge, byte[] pwd)
+ {
+ byte[] response = new byte [24];
+#if MOONLIGHT
+ DESCryptoServiceProvider des = new DESCryptoServiceProvider ();
+#else
+ DES des = DES.Create ();
+#endif
+ des.Mode = CipherMode.ECB;
+ des.Key = PrepareDESKey (pwd, 0);
+ ICryptoTransform ct = des.CreateEncryptor ();
+ ct.TransformBlock (challenge, 0, 8, response, 0);
+ des.Key = PrepareDESKey (pwd, 7);
+ ct = des.CreateEncryptor ();
+ ct.TransformBlock (challenge, 0, 8, response, 8);
+ des.Key = PrepareDESKey (pwd, 14);
+ ct = des.CreateEncryptor ();
+ ct.TransformBlock (challenge, 0, 8, response, 16);
+ return response;
+ }
+
+ static byte[] PrepareDESKey (byte[] key56bits, int position)
+ {
+ // convert to 8 bytes
+ byte[] key = new byte [8];
+ key [0] = key56bits [position];
+ key [1] = (byte) ((key56bits [position] << 7) | (key56bits [position + 1] >> 1));
+ key [2] = (byte) ((key56bits [position + 1] << 6) | (key56bits [position + 2] >> 2));
+ key [3] = (byte) ((key56bits [position + 2] << 5) | (key56bits [position + 3] >> 3));
+ key [4] = (byte) ((key56bits [position + 3] << 4) | (key56bits [position + 4] >> 4));
+ key [5] = (byte) ((key56bits [position + 4] << 3) | (key56bits [position + 5] >> 5));
+ key [6] = (byte) ((key56bits [position + 5] << 2) | (key56bits [position + 6] >> 6));
+ key [7] = (byte) (key56bits [position + 6] << 1);
+ return key;
+ }
+
+ static byte[] PasswordToKey (string password, int position)
+ {
+ byte[] key7 = new byte [7];
+ int len = System.Math.Min (password.Length - position, 7);
+ Encoding.ASCII.GetBytes (password.ToUpper (CultureInfo.CurrentCulture), position, len, key7, 0);
+ byte[] key8 = PrepareDESKey (key7, 0);
+ // cleanup intermediate key material
+ Array.Clear (key7, 0, key7.Length);
+ return key8;
+ }
+ }
+}
--- /dev/null
+//
+// NtlmAuthLevel.cs
+//
+// Author:
+// Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+
+namespace Mono.Security.Protocol.Ntlm {
+
+ /*
+ * On Windows, this is controlled by a registry setting
+ * (http://msdn.microsoft.com/en-us/library/ms814176.aspx)
+ *
+ * This can be configured by setting the static
+ * Type3Message.DefaultAuthLevel property, the default value
+ * is LM_and_NTLM_and_try_NTLMv2_Session.
+ */
+
+ public enum NtlmAuthLevel {
+ /* Use LM and NTLM, never use NTLMv2 session security. */
+ LM_and_NTLM,
+
+ /* Use NTLMv2 session security if the server supports it,
+ * otherwise fall back to LM and NTLM. */
+ LM_and_NTLM_and_try_NTLMv2_Session,
+
+ /* Use NTLMv2 session security if the server supports it,
+ * otherwise fall back to NTLM. Never use LM. */
+ NTLM_only,
+
+ /* Use NTLMv2 only. */
+ NTLMv2_only,
+ }
+}
+
//
using System;
+using System.Text;
using System.Security.Cryptography;
namespace Mono.Security.Protocol.Ntlm {
public class Type2Message : MessageBase {
private byte[] _nonce;
+ private string _targetName;
+ private byte[] _targetInfo;
public Type2Message () : base (2)
{
}
}
+ public string TargetName {
+ get { return _targetName; }
+ }
+
+ public byte[] TargetInfo {
+ get { return (byte[])_targetInfo.Clone (); }
+ }
+
// methods
- protected override void Decode (byte[] message)
+ protected override void Decode (byte[] message)
{
base.Decode (message);
- Flags = (NtlmFlags) BitConverterLE.ToUInt32 (message, 20);
+ Flags = (NtlmFlags)BitConverterLE.ToUInt32 (message, 20);
Buffer.BlockCopy (message, 24, _nonce, 0, 8);
+
+ var tname_len = BitConverterLE.ToUInt16 (message, 12);
+ var tname_off = BitConverterLE.ToUInt16 (message, 16);
+ if (tname_len > 0) {
+ if ((Flags & NtlmFlags.NegotiateOem) != 0)
+ _targetName = Encoding.ASCII.GetString (message, tname_off, tname_len);
+ else
+ _targetName = Encoding.Unicode.GetString (message, tname_off, tname_len);
+ }
+
+ // The Target Info block is optional.
+ if (message.Length >= 48) {
+ var tinfo_len = BitConverterLE.ToUInt16 (message, 40);
+ var tinfo_off = BitConverterLE.ToUInt16 (message, 44);
+ if (tinfo_len > 0) {
+ _targetInfo = new byte [tinfo_len];
+ Buffer.BlockCopy (message, tinfo_off, _targetInfo, 0, tinfo_len);
+ }
+ }
}
public override byte[] GetBytes ()
public class Type3Message : MessageBase {
+ private NtlmAuthLevel _level;
private byte[] _challenge;
private string _host;
private string _domain;
private string _username;
private string _password;
+ private Type2Message _type2;
private byte[] _lm;
private byte[] _nt;
-
+
+ internal const string LegacyAPIWarning =
+ "Use of this API is highly discouraged, " +
+ "it selects legacy-mode LM/NTLM authentication, which sends " +
+ "your password in very weak encryption over the wire even if " +
+ "the server supports the more secure NTLMv2 / NTLMv2 Session. " +
+ "You need to use the new `Type3Message (Type2Message)' constructor " +
+ "to use the more secure NTLMv2 / NTLMv2 Session authentication modes. " +
+ "These require the Type 2 message from the server to compute the response.";
+
+ [Obsolete (LegacyAPIWarning)]
public Type3Message () : base (3)
{
+ if (DefaultAuthLevel != NtlmAuthLevel.LM_and_NTLM)
+ throw new InvalidOperationException (
+ "Refusing to use legacy-mode LM/NTLM authentication " +
+ "unless explicitly enabled using DefaultAuthLevel.");
+
// default values
_domain = Environment.UserDomainName;
_host = Environment.MachineName;
_username = Environment.UserName;
+ _level = NtlmAuthLevel.LM_and_NTLM;
Flags = (NtlmFlags) 0x8201;
}
Decode (message);
}
+ public Type3Message (Type2Message type2) : base (3)
+ {
+ _type2 = type2;
+ _level = DefaultAuthLevel;
+ _challenge = (byte[]) type2.Nonce.Clone ();
+
+ _domain = type2.TargetName;
+ _host = Environment.MachineName;
+ _username = Environment.UserName;
+
+ Flags = (NtlmFlags) 0x8200;
+ if ((type2.Flags & NtlmFlags.NegotiateUnicode) != 0)
+ Flags |= NtlmFlags.NegotiateUnicode;
+ else
+ Flags |= NtlmFlags.NegotiateOem;
+
+ if ((type2.Flags & NtlmFlags.NegotiateNtlm2Key) != 0)
+ Flags |= NtlmFlags.NegotiateNtlm2Key;
+ }
+
~Type3Message ()
{
if (_challenge != null)
Array.Clear (_nt, 0, _nt.Length);
}
+ // Default auth level
+
+ static NtlmAuthLevel _default = NtlmAuthLevel.LM_and_NTLM_and_try_NTLMv2_Session;
+
+ public static NtlmAuthLevel DefaultAuthLevel {
+ get { return _default; }
+ set { _default = value; }
+ }
+
+ public NtlmAuthLevel Level {
+ get { return _level; }
+ set { _level = value; }
+ }
+
// properties
+ [Obsolete (LegacyAPIWarning)]
public byte[] Challenge {
get {
if (_challenge == null)
return null;
return (byte[]) _challenge.Clone (); }
set {
+ if ((_type2 != null) || (_level != NtlmAuthLevel.LM_and_NTLM))
+ throw new InvalidOperationException (
+ "Refusing to use legacy-mode LM/NTLM authentication " +
+ "unless explicitly enabled using DefaultAuthLevel.");
+
if (value == null)
throw new ArgumentNullException ("Challenge");
if (value.Length != 8) {
public string Domain {
get { return _domain; }
set {
+ if (_type2 != null)
+ throw new InvalidOperationException (
+ "Domain is set automatically from Type2Message.TargetName");
if (value == null)
value = "";
if (value == "")
public byte[] NT {
get { return _nt; }
+ set { _nt = value; }
}
// methods
- protected override void Decode (byte[] message)
+ protected override void Decode (byte[] message)
{
base.Decode (message);
_password = null;
- int dom_len = BitConverterLE.ToUInt16 (message, 28);
- int dom_off = 64;
- _domain = Encoding.Unicode.GetString (message, dom_off, dom_len);
+ if (message.Length >= 64)
+ Flags = (NtlmFlags)BitConverterLE.ToUInt32 (message, 60);
+ else
+ Flags = (NtlmFlags)0x8201;
+
+ int lm_len = BitConverterLE.ToUInt16 (message, 12);
+ int lm_off = BitConverterLE.ToUInt16 (message, 16);
+ _lm = new byte [lm_len];
+ Buffer.BlockCopy (message, lm_off, _lm, 0, lm_len);
- int host_len = BitConverterLE.ToUInt16 (message, 44);
- int host_off = BitConverterLE.ToUInt16 (message, 48);
- _host = Encoding.Unicode.GetString (message, host_off, host_len);
+ int nt_len = BitConverterLE.ToUInt16 (message, 20);
+ int nt_off = BitConverterLE.ToUInt16 (message, 24);
+ _nt = new byte [nt_len];
+ Buffer.BlockCopy (message, nt_off, _nt, 0, nt_len);
+
+ int dom_len = BitConverterLE.ToUInt16 (message, 28);
+ int dom_off = BitConverterLE.ToUInt16 (message, 32);
+ _domain = DecodeString (message, dom_off, dom_len);
int user_len = BitConverterLE.ToUInt16 (message, 36);
int user_off = BitConverterLE.ToUInt16 (message, 40);
- _username = Encoding.Unicode.GetString (message, user_off, user_len);
-
- _lm = new byte [24];
- int lm_off = BitConverterLE.ToUInt16 (message, 16);
- Buffer.BlockCopy (message, lm_off, _lm, 0, 24);
+ _username = DecodeString (message, user_off, user_len);
- _nt = new byte [24];
- int nt_off = BitConverterLE.ToUInt16 (message, 24);
- Buffer.BlockCopy (message, nt_off, _nt, 0, 24);
+ int host_len = BitConverterLE.ToUInt16 (message, 44);
+ int host_off = BitConverterLE.ToUInt16 (message, 48);
+ _host = DecodeString (message, host_off, host_len);
+
+ // Session key. We don't use it yet.
+ // int skey_len = BitConverterLE.ToUInt16 (message, 52);
+ // int skey_off = BitConverterLE.ToUInt16 (message, 56);
+ }
- if (message.Length >= 64)
- Flags = (NtlmFlags) BitConverterLE.ToUInt32 (message, 60);
+ string DecodeString (byte[] buffer, int offset, int len)
+ {
+ if ((Flags & NtlmFlags.NegotiateUnicode) != 0)
+ return Encoding.Unicode.GetString (buffer, offset, len);
+ else
+ return Encoding.ASCII.GetString (buffer, offset, len);
+ }
+
+ byte[] EncodeString (string text)
+ {
+ if (text == null)
+ return new byte [0];
+ if ((Flags & NtlmFlags.NegotiateUnicode) != 0)
+ return Encoding.Unicode.GetBytes (text);
+ else
+ return Encoding.ASCII.GetBytes (text);
}
- public override byte[] GetBytes ()
+ public override byte[] GetBytes ()
{
- byte[] domain = Encoding.Unicode.GetBytes (_domain.ToUpper (CultureInfo.InvariantCulture));
- byte[] user = Encoding.Unicode.GetBytes (_username);
- byte[] host = Encoding.Unicode.GetBytes (_host.ToUpper (CultureInfo.InvariantCulture));
+ byte[] target = EncodeString (_domain);
+ byte[] user = EncodeString (_username);
+ byte[] host = EncodeString (_host);
+
+ byte[] lm, ntlm;
+ if (_type2 == null) {
+ if (_level != NtlmAuthLevel.LM_and_NTLM)
+ throw new InvalidOperationException (
+ "Refusing to use legacy-mode LM/NTLM authentication " +
+ "unless explicitly enabled using DefaultAuthLevel.");
+
+ using (var legacy = new ChallengeResponse (_password, _challenge)) {
+ lm = legacy.LM;
+ ntlm = legacy.NT;
+ }
+ } else {
+ ChallengeResponse2.Compute (_type2, _level, _username, _password, out lm, out ntlm);
+ }
+
+ var lmresp_len = lm != null ? lm.Length : 0;
+ var ntresp_len = ntlm != null ? ntlm.Length : 0;
- byte[] data = PrepareMessage (64 + domain.Length + user.Length + host.Length + 24 + 24);
+ byte[] data = PrepareMessage (64 + target.Length + user.Length + host.Length + lmresp_len + ntresp_len);
// LM response
- short lmresp_off = (short)(64 + domain.Length + user.Length + host.Length);
- data [12] = (byte) 0x18;
- data [13] = (byte) 0x00;
- data [14] = (byte) 0x18;
- data [15] = (byte) 0x00;
- data [16] = (byte) lmresp_off;
+ short lmresp_off = (short)(64 + target.Length + user.Length + host.Length);
+ data [12] = (byte)lmresp_len;
+ data [13] = (byte)0x00;
+ data [14] = (byte)lmresp_len;
+ data [15] = (byte)0x00;
+ data [16] = (byte)lmresp_off;
data [17] = (byte)(lmresp_off >> 8);
// NT response
- short ntresp_off = (short)(lmresp_off + 24);
- data [20] = (byte) 0x18;
- data [21] = (byte) 0x00;
- data [22] = (byte) 0x18;
- data [23] = (byte) 0x00;
- data [24] = (byte) ntresp_off;
+ short ntresp_off = (short)(lmresp_off + lmresp_len);
+ data [20] = (byte)ntresp_len;
+ data [21] = (byte)(ntresp_len >> 8);
+ data [22] = (byte)ntresp_len;
+ data [23] = (byte)(ntresp_len >> 8);
+ data [24] = (byte)ntresp_off;
data [25] = (byte)(ntresp_off >> 8);
- // domain
- short dom_len = (short)domain.Length;
+ // target
+ short dom_len = (short)target.Length;
short dom_off = 64;
- data [28] = (byte) dom_len;
+ data [28] = (byte)dom_len;
data [29] = (byte)(dom_len >> 8);
data [30] = data [28];
data [31] = data [29];
- data [32] = (byte) dom_off;
+ data [32] = (byte)dom_off;
data [33] = (byte)(dom_off >> 8);
// username
short uname_len = (short)user.Length;
short uname_off = (short)(dom_off + dom_len);
- data [36] = (byte) uname_len;
+ data [36] = (byte)uname_len;
data [37] = (byte)(uname_len >> 8);
data [38] = data [36];
data [39] = data [37];
- data [40] = (byte) uname_off;
+ data [40] = (byte)uname_off;
data [41] = (byte)(uname_off >> 8);
// host
short host_len = (short)host.Length;
short host_off = (short)(uname_off + uname_len);
- data [44] = (byte) host_len;
+ data [44] = (byte)host_len;
data [45] = (byte)(host_len >> 8);
data [46] = data [44];
data [47] = data [45];
- data [48] = (byte) host_off;
+ data [48] = (byte)host_off;
data [49] = (byte)(host_off >> 8);
// message length
short msg_len = (short)data.Length;
- data [56] = (byte) msg_len;
+ data [56] = (byte)msg_len;
data [57] = (byte)(msg_len >> 8);
+ int flags = (int)Flags;
+
// options flags
- data [60] = (byte) Flags;
- data [61] = (byte)((uint)Flags >> 8);
- data [62] = (byte)((uint)Flags >> 16);
- data [63] = (byte)((uint)Flags >> 24);
+ data [60] = (byte)flags;
+ data [61] = (byte)((uint)flags >> 8);
+ data [62] = (byte)((uint)flags >> 16);
+ data [63] = (byte)((uint)flags >> 24);
- Buffer.BlockCopy (domain, 0, data, dom_off, domain.Length);
+ Buffer.BlockCopy (target, 0, data, dom_off, target.Length);
Buffer.BlockCopy (user, 0, data, uname_off, user.Length);
Buffer.BlockCopy (host, 0, data, host_off, host.Length);
- using (ChallengeResponse ntlm = new ChallengeResponse (_password, _challenge)) {
- Buffer.BlockCopy (ntlm.LM, 0, data, lmresp_off, 24);
- Buffer.BlockCopy (ntlm.NT, 0, data, ntresp_off, 24);
+ if (lm != null) {
+ Buffer.BlockCopy (lm, 0, data, lmresp_off, lm.Length);
+ Array.Clear (lm, 0, lm.Length);
}
+ Buffer.BlockCopy (ntlm, 0, data, ntresp_off, ntlm.Length);
+ Array.Clear (ntlm, 0, ntlm.Length);
+
return data;
}
}
//
using System;
+using System.Net;
using System.Security.Cryptography;
namespace Mono.Security.Protocol.Tls.Handshake.Client
#region Protected Methods
protected override void ProcessAsSsl3()
- {
- this.ProcessAsTls1();
- }
-
- protected override void ProcessAsTls1()
{
// Client Version
this.Write(this.Context.Protocol);
-
+
// Random bytes - Unix time + Radom bytes [28]
TlsStream clientRandom = new TlsStream();
clientRandom.Write(this.Context.GetUnixTime());
// Compression methods ( 0 = none )
this.Write((byte)this.Context.CompressionMethod);
+ }
+ protected override void ProcessAsTls1()
+ {
+ ProcessAsSsl3 ();
+
+ // If applicable add the "server_name" extension to the hello message
// http://www.ietf.org/rfc/rfc3546.txt
+ string host = Context.ClientSettings.TargetHost;
+ // Our TargetHost might be an address (not a host *name*) - see bug #8553
+ // RFC3546 -> Literal IPv4 and IPv6 addresses are not permitted in "HostName".
+ IPAddress addr;
+ if (IPAddress.TryParse (host, out addr))
+ return;
+
TlsStream extensions = new TlsStream ();
- byte[] server_name = System.Text.Encoding.UTF8.GetBytes (Context.ClientSettings.TargetHost);
+ byte[] server_name = System.Text.Encoding.UTF8.GetBytes (host);
extensions.Write ((short) 0x0000); // ExtensionType: server_name (0)
extensions.Write ((short) (server_name.Length + 5)); // ServerNameList (length)
extensions.Write ((short) (server_name.Length + 3)); // ServerName (length)
}
}
- private void SafeReceiveRecord (Stream s)
+ private void SafeReceiveRecord (Stream s, bool ignoreEmpty = false)
{
byte[] record = this.protocol.ReceiveRecord (s);
- if ((record == null) || (record.Length == 0)) {
+ if (!ignoreEmpty && ((record == null) || (record.Length == 0))) {
throw new TlsException (
AlertDescription.HandshakeFailiure,
"The server stopped the handshake.");
// Read server response
while (this.context.LastHandshakeMsg != HandshakeType.ServerHelloDone)
{
- // Read next record
- SafeReceiveRecord (this.innerStream);
+ // Read next record (skip empty, e.g. warnings alerts)
+ SafeReceiveRecord (this.innerStream, true);
// special case for abbreviated handshake where no ServerHelloDone is sent from the server
if (this.context.AbbreviatedHandshake && (this.context.LastHandshakeMsg == HandshakeType.ServerHello))
./Mono.Security.Cryptography/TlsHMAC.cs
./Mono.Security.Cryptography/MD5SHA1.cs
./Mono.Security.Protocol.Ntlm/ChallengeResponse.cs
+./Mono.Security.Protocol.Ntlm/ChallengeResponse2.cs
./Mono.Security.Protocol.Ntlm/MessageBase.cs
+./Mono.Security.Protocol.Ntlm/NtlmAuthLevel.cs
./Mono.Security.Protocol.Ntlm/NtlmFlags.cs
./Mono.Security.Protocol.Ntlm/Type1Message.cs
./Mono.Security.Protocol.Ntlm/Type2Message.cs
[ExpectedException (typeof (ArgumentNullException))]
public void Decode_Null ()
{
- Type3Message msg = new Type3Message (null);
+ Type3Message msg = new Type3Message ((byte[])null);
}
[Test]
static byte[] data1 = { 0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x18, 0x00, 0x72, 0x00, 0x00, 0x00, 0x18, 0x00, 0x18, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x14, 0x00, 0x14, 0x00, 0x40, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x54, 0x00, 0x00, 0x00, 0x12, 0x00, 0x12, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa2, 0x00, 0x00, 0x00, 0x01, 0x82, 0x00, 0x00, 0x55, 0x00, 0x52, 0x00, 0x53, 0x00, 0x41, 0x00, 0x2d, 0x00, 0x4d, 0x00, 0x49, 0x00, 0x4e, 0x00, 0x4f, 0x00, 0x52, 0x00, 0x5a, 0x00, 0x61, 0x00, 0x70, 0x00, 0x68, 0x00, 0x6f, 0x00, 0x64, 0x00, 0x4c, 0x00, 0x49, 0x00, 0x47, 0x00, 0x48, 0x00, 0x54, 0x00, 0x43, 0x00, 0x49, 0x00, 0x54, 0x00, 0x59, 0x00, 0xad, 0x87, 0xca, 0x6d, 0xef, 0xe3, 0x46, 0x85, 0xb9, 0xc4, 0x3c, 0x47, 0x7a, 0x8c, 0x42, 0xd6, 0x00, 0x66, 0x7d, 0x68, 0x92, 0xe7, 0xe8, 0x97, 0xe0, 0xe0, 0x0d, 0xe3, 0x10, 0x4a, 0x1b, 0xf2, 0x05, 0x3f, 0x07, 0xc7, 0xdd, 0xa8, 0x2d, 0x3c, 0x48, 0x9a, 0xe9, 0x89, 0xe1, 0xb0, 0x00, 0xd3 };
static byte[] data2 = { 0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x18, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x18, 0x00, 0x18, 0x00, 0x82, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x40, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x16, 0x00, 0x16, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9a, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0x44, 0x00, 0x4f, 0x00, 0x4d, 0x00, 0x41, 0x00, 0x49, 0x00, 0x4e, 0x00, 0x75, 0x00, 0x73, 0x00, 0x65, 0x00, 0x72, 0x00, 0x57, 0x00, 0x4f, 0x00, 0x52, 0x00, 0x4b, 0x00, 0x53, 0x00, 0x54, 0x00, 0x41, 0x00, 0x54, 0x00, 0x49, 0x00, 0x4f, 0x00, 0x4e, 0x00, 0xc3, 0x37, 0xcd, 0x5c, 0xbd, 0x44, 0xfc, 0x97, 0x82, 0xa6, 0x67, 0xaf, 0x6d, 0x42, 0x7c, 0x6d, 0xe6, 0x7c, 0x20, 0xc2, 0xd3, 0xe7, 0x7c, 0x56, 0x25, 0xa9, 0x8c, 0x1c, 0x31, 0xe8, 0x18, 0x47, 0x46, 0x6b, 0x29, 0xb2, 0xdf, 0x46, 0x80, 0xf3, 0x99, 0x58, 0xfb, 0x8c, 0x21, 0x3a, 0x9c, 0xc6 };
+
+ static Type3MessageTest ()
+ {
+ // Explicitly select legacy-mode.
+ Type3Message.DefaultAuthLevel = NtlmAuthLevel.LM_and_NTLM;
+ }
[Test]
// Example for a password smaller than 8 characters - which implies a weak DES key
{
Type3Message msg = new Type3Message ();
msg.Challenge = nonce;
- msg.Domain = "Ursa-Minor";
- msg.Host = "LightCity";
+ // Type3Message now encodes domain and host case-sensitive.
+ msg.Domain = "URSA-MINOR";
+ msg.Host = "LIGHTCITY";
msg.Password = "Beeblebrox";
msg.Username = "Zaphod";
AssertEquals ("Type", 3, msg.Type);
// utf8Bytes = new System.String(ca).getBytes("UTF-8");
// copy utf8 encoded character into octets
- Array.Copy((System.Array) SupportClass.ToByteArray(utf8Bytes), 0, (System.Array)SupportClass.ToByteArray( octets), iOctets, utf8Bytes.Length);
+ Array.Copy((System.Array) (utf8Bytes), 0, (System.Array) octets, iOctets, utf8Bytes.Length);
iOctets = iOctets + utf8Bytes.Length;
}
escape = false;
PublicSealed = 0x101, SpecialName = 0x400, RTSpecialName = 0x800,
Import = 0x1000, Serializable = 0x2000, UnicodeClass = 0x10000,
AutoClass = 0x20000, HasSecurity = 0x40000, BeforeFieldInit = 0x100000,
+ Forwarder = 0x200000,
VisibilityMask = 0x07 }
/// <summary>
ExternClass externClass;
internal ExternClassRef(TypeAttr attrs, string nsName, string name,
- FileRef declFile, MetaData md) : base(nsName,name,md)
+ MetaDataElement declRef, MetaData md) : base(nsName,name,md)
{
- externClass = new ExternClass(attrs,nameSpaceIx,nameIx,declFile);
+ externClass = new ExternClass(attrs,nameSpaceIx,nameIx,declRef);
metaData.AddToTable(MDTable.ExportedType,externClass);
}
return modRef;
}
+ public ClassRef AddExternClass(string name, TypeAttr attrs, MetaDataElement declRef)
+ {
+ return new ExternClassRef (attrs, null, name, declRef, metaData);
+ }
+
/// <summary>
/// Add a "global" method to this module
/// </summary>
section.ConfigHost = system.Host;
group.AddChild (section);
elementData [section] = sec;
+ sec.Configuration = this;
}
internal void CreateSectionGroup (SectionGroupInfo parentGroup, string name, ConfigurationSectionGroup sec)
}
}
- [MonoTODO]
protected ContextInformation EvaluationContext {
get {
if (Configuration != null)
return Configuration.EvaluationContext;
- throw new NotImplementedException ();
+ throw new ConfigurationErrorsException (
+ "This element is not currently associated with any context.");
}
}
{
ConfigurationElement elem = (ConfigurationElement) Activator.CreateInstance (t);
elem.Init ();
+ elem.Configuration = Configuration;
if (IsReadOnly ())
elem.SetReadOnly ();
return elem;
public virtual Stream OpenStreamForWrite (string streamName, string templateStreamName, ref object writeContext)
{
string dir = Path.GetDirectoryName (streamName);
- if (!Directory.Exists (dir))
+ if (!String.IsNullOrEmpty (dir) && !Directory.Exists (dir))
Directory.CreateDirectory (dir);
return new FileStream (streamName, FileMode.Create, FileAccess.Write);
}
if (Directory.Exists (tempFolder))
Directory.Delete (tempFolder, true);
}
+
+ static string DotNetVersion {
+ get {
+#if NET_4_5
+ return "net_4_5";
+#elif NET_4_0
+ return "net_4_0";
+#else
+ return "net_2_0";
+#endif
+ }
+ }
[Test] // OpenExeConfiguration (ConfigurationUserLevel)
[Category ("NotWorking")] // bug #323622
FileInfo fi = new FileInfo (config.FilePath);
#if TARGET_JVM
Assert.AreEqual ("nunit-console.jar.config", fi.Name);
-#elif NET_4_5
- Assert.AreEqual ("System.Configuration_test_net_4_5.dll.config", fi.Name);
-#elif NET_4_0
- Assert.AreEqual ("System.Configuration_test_net_4_0.dll.config", fi.Name);
#else
- Assert.AreEqual ("System.Configuration_test_net_2_0.dll.config", fi.Name);
+ Assert.AreEqual ("System.Configuration_test_" + DotNetVersion + ".dll.config", fi.Name);
#endif
}
public void exePath_UserLevelNone ()
{
string basedir = AppDomain.CurrentDomain.BaseDirectory;
- SysConfig config = ConfigurationManager.OpenExeConfiguration("System.Configuration_test_net_2_0.dll.mdb");
- Assert.AreEqual (Path.Combine (basedir, "System.Configuration_test_net_2_0.dll.mdb.config"), config.FilePath);
+ string name = "System.Configuration_test_" + DotNetVersion + ".dll";
+ SysConfig config = ConfigurationManager.OpenExeConfiguration (name);
+ Assert.AreEqual (Path.Combine (basedir, name + ".config"), config.FilePath);
}
[Test]
Console.WriteLine("null exe application config path: {0}", config.FilePath);
FileInfo fi = new FileInfo (config.FilePath);
- Assert.AreEqual ("System.Configuration_test_net_2_0.dll.config", fi.Name);
+ Assert.AreEqual ("System.Configuration_test_" + DotNetVersion + ".dll.config", fi.Name);
#endif
}
#if TARGET_JVM
Assert.AreEqual("System.Configuration.Test20.jar.config", fi.Name);
#else
- Assert.AreEqual ("System.Configuration_test_net_2_0.dll.config", fi.Name);
+ Assert.AreEqual ("System.Configuration_test_" + DotNetVersion + ".dll.config", fi.Name);
#endif
}
Assert.IsNotNull(section as TestSection);
config.Sections.Remove(name);
}
+
+ [Test]
+ public void TestFileMap ()
+ {
+ var name = Path.GetRandomFileName () + ".config";
+ Assert.IsFalse (File.Exists (name));
+
+ try {
+ var map = new ExeConfigurationFileMap ();
+ map.ExeConfigFilename = name;
+
+ var config = ConfigurationManager.OpenMappedExeConfiguration (
+ map, ConfigurationUserLevel.None);
+
+ config.Sections.Add ("testsection", new TestSection ());
+
+ config.Save ();
+
+ Assert.IsTrue (File.Exists (name), "#1");
+ Assert.IsTrue (File.Exists (Path.GetFullPath (name)), "#2");
+ } finally {
+ File.Delete (name);
+ }
+ }
+
+ [Test]
+ public void TestContext ()
+ {
+ var config = ConfigurationManager.OpenExeConfiguration (ConfigurationUserLevel.None);
+ const string name = "testsection";
+
+ // ensure not present
+ if (config.GetSection (name) != null)
+ config.Sections.Remove (name);
+
+ var section = new TestContextSection ();
+
+ // Can't access EvaluationContext ....
+ try {
+ section.TestContext (null);
+ Assert.Fail ("#1");
+ } catch (ConfigurationException) {
+ ;
+ }
+
+ // ... until it's been added to a section.
+ config.Sections.Add (name, section);
+ section.TestContext ("#2");
+
+ // Remove ...
+ config.Sections.Remove (name);
+
+ // ... and it doesn't lose its context
+ section.TestContext (null);
+ }
+
+ [Test]
+ public void TestContext2 ()
+ {
+ var name = Path.GetRandomFileName () + ".config";
+ Assert.IsFalse (File.Exists (name));
+
+ try {
+ var map = new ExeConfigurationFileMap ();
+ map.ExeConfigFilename = name;
+
+ var config = ConfigurationManager.OpenMappedExeConfiguration (
+ map, ConfigurationUserLevel.None);
+
+ config.Sections.Add ("testsection", new TestSection ());
+ config.Sections.Add ("testcontext", new TestContextSection ());
+
+ config.Save ();
+
+ Assert.IsTrue (File.Exists (name), "#1");
+ } finally {
+ File.Delete (name);
+ }
+ }
+
class TestSection : ConfigurationSection {}
return ConfigurationManager.AppSettings [key];
}
}
+
+ class TestContextSection : ConfigurationSection {
+ public void TestContext (string label)
+ {
+ Assert.That (EvaluationContext != null, label);
+ }
+ }
}
}
}
- [DllImport("kernel32.dll", SetLastError = true)]
+ [DllImport("kernel32", SetLastError = true)]
static extern bool SetHandleInformation (IntPtr hObject, int dwMask, int dwFlags);
static void ConfigureWindowsFD (IntPtr handle, HandleInheritability h)
{
this.is_lifted = is_lifted;
}
+#if !FULL_AOT_RUNTIME
void EmitArrayAccess (EmitContext ec)
{
left.Emit (ec);
throw new NotSupportedException (this.NodeType.ToString ());
}
}
+#endif
}
}
this.if_false = if_false;
}
+#if !FULL_AOT_RUNTIME
internal override void Emit (EmitContext ec)
{
var ig = ec.ig;
ig.MarkLabel (end_target);
}
+#endif
}
}
this.value = value;
}
+#if !FULL_AOT_RUNTIME
internal override void Emit (EmitContext ec)
{
if (Type.IsNullable ()) {
emit (ec);
}
+#endif
}
}
return ExpressionPrinter.ToString (this);
}
+#if !FULL_AOT_RUNTIME
void EmitPopIfNeeded (EmitContext ec)
{
if (add_method.ReturnType == typeof (void))
ec.EmitCall (local, arguments, add_method);
EmitPopIfNeeded (ec);
}
+#endif
}
}
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System;
using System.Collections.ObjectModel;
using System.Collections.Generic;
}
}
}
+#endif
// This method must be overwritten by derived classes to
// compile the expression
//
+#if !FULL_AOT_RUNTIME
internal virtual void Emit (EmitContext ec)
{
throw new NotImplementedException (String.Format ("Emit method is not implemented in expression type {0}", GetType ()));
}
+#endif
}
}
this.arguments = arguments;
}
+#if !FULL_AOT_RUNTIME
internal override void Emit (EmitContext ec)
{
ec.EmitCall (expression, arguments, expression.Type.GetInvokeMethod ());
}
+#endif
}
}
this.parameters = parameters;
}
+#if !FULL_AOT_RUNTIME
void EmitPopIfNeeded (EmitContext ec)
{
if (GetReturnType () == typeof (void) && body.Type != typeof (void))
EmitPopIfNeeded (ec);
ec.ig.Emit (OpCodes.Ret);
}
+#endif
internal Type GetReturnType ()
{
this.initializers = initializers;
}
+#if !FULL_AOT_RUNTIME
internal override void Emit (EmitContext ec)
{
var local = ec.EmitStored (new_expression);
ec.EmitCollection (initializers, local);
ec.EmitLoad (local);
}
+#endif
}
}
this.expression = expression;
}
+#if !FULL_AOT_RUNTIME
internal override void Emit (EmitContext ec, LocalBuilder local)
{
this.Member.OnFieldOrProperty (
expression.Emit (ec);
ec.EmitCall (setter);
}
+#endif
}
}
return ExpressionPrinter.ToString (this);
}
+#if !FULL_AOT_RUNTIME
internal abstract void Emit (EmitContext ec, LocalBuilder local);
internal LocalBuilder EmitLoadMember (EmitContext ec, LocalBuilder local)
ec.ig.Emit (OpCodes.Stloc, store);
return store;
}
+#endif
}
}
this.member = member;
}
+#if !FULL_AOT_RUNTIME
internal override void Emit (EmitContext ec)
{
member.OnFieldOrProperty (
} else
ec.ig.Emit (OpCodes.Ldsfld, field);
}
+#endif
}
}
this.bindings = bindings;
}
+#if !FULL_AOT_RUNTIME
internal override void Emit (EmitContext ec)
{
var local = ec.EmitStored (new_expression);
ec.EmitCollection (bindings, local);
ec.EmitLoad (local);
}
+#endif
}
}
this.initializers = initializers;
}
+#if !FULL_AOT_RUNTIME
internal override void Emit (EmitContext ec, LocalBuilder local)
{
var member = EmitLoadMember (ec, local);
foreach (var initializer in initializers)
initializer.Emit (ec, member);
}
+#endif
}
}
this.bindings = bindings;
}
+#if !FULL_AOT_RUNTIME
internal override void Emit (EmitContext ec, LocalBuilder local)
{
var member = EmitLoadMember (ec, local);
foreach (var binding in bindings)
binding.Emit (ec, member);
}
+#endif
}
}
this.arguments = arguments;
}
+#if !FULL_AOT_RUNTIME
internal override void Emit (EmitContext ec)
{
ec.EmitCall (obj, arguments, method);
}
+#endif
}
}
this.expressions = expressions;
}
+#if !FULL_AOT_RUNTIME
void EmitNewArrayInit (EmitContext ec, Type type)
{
var size = expressions.Count;
throw new NotSupportedException ();
}
}
+#endif
}
}
this.members = members;
}
+#if !FULL_AOT_RUNTIME
internal override void Emit (EmitContext ec)
{
var ig = ec.ig;
} else
ig.Emit (OpCodes.Newobj, constructor ?? GetDefaultConstructor (type));
}
+#endif
static ConstructorInfo GetDefaultConstructor (Type type)
{
this.name = name;
}
+#if !FULL_AOT_RUNTIME
void EmitLocalParameter (EmitContext ec, int position)
{
ec.ig.Emit (OpCodes.Ldarg, position);
throw new InvalidOperationException ("Parameter out of scope");
}
+#endif
}
}
this.type_operand = type_operand;
}
+#if !FULL_AOT_RUNTIME
internal override void Emit (EmitContext ec)
{
if (expression.Type == typeof (void)) {
ec.ig.Emit (OpCodes.Ldnull);
ec.ig.Emit (OpCodes.Cgt_Un);
}
+#endif
}
}
this.is_lifted = is_lifted;
}
+#if !FULL_AOT_RUNTIME
void EmitArrayLength (EmitContext ec)
{
operand.Emit (ec);
throw new NotImplementedException (this.NodeType.ToString ());
}
}
+#endif
}
}
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
using System.Threading.Tasks;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
using System.Threading.Tasks;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
namespace System.Linq.Parallel.QueryNodes
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
using System.Collections;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
using System.Collections;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
using System.Collections;
internal IEnumerable<IGrouping<TKey, TElement>> GetGroupedElements ()
{
- return GetStore ().Select (e => (IGrouping<TKey,TElement>)new ConcurrentGrouping<TKey, TElement> (e.Key, e.Value));
+ return (IEnumerable<System.Linq.IGrouping<TKey,TElement>>)GetStore ().Select (e => (IGrouping<TKey,TElement>)new ConcurrentGrouping<TKey, TElement> (e.Key, e.Value));
}
internal ConcurrentDictionary<TKey, ConcurrentQueue<TElement>> GetStore ()
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
using System.Collections;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
using System.Collections;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Linq;
using System.Collections.Generic;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
using System.Collections.Generic;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
using System.Collections;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Collections.Generic;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
namespace System.Linq.Parallel.QueryNodes
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Linq;
using System.Threading;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
using System.Collections;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Linq;
using System.Collections.Generic;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Linq;
using System.Collections.Generic;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Collections;
using System.Collections.Generic;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
using System.Threading.Tasks;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Linq;
using System.Threading;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
using System.Linq;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Linq;
using System.Collections.Generic;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Linq;
using System.Collections;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Collections;
using System.Collections.Generic;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
using System.Collections;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
using System.Collections;
IEnumerator<IGrouping<TKey, TElement>> GetEnumeratorInternal ()
{
- return dictionary.Select ((pair) => new ConcurrentGrouping<TKey, TElement> (pair.Key, pair.Value)).GetEnumerator ();
+ return (IEnumerator<System.Linq.IGrouping<TKey,TElement>>) dictionary.Select ((pair) => new ConcurrentGrouping<TKey, TElement> (pair.Key, pair.Value)).GetEnumerator ();
}
}
}
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Linq.Parallel.QueryNodes;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
namespace System.Linq.Parallel
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
using System.Collections;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
using System.Threading.Tasks;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Collections.Generic;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
using System.Collections;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Linq;
using System.Collections;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
using System.Linq.Parallel.QueryNodes;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
using System.Linq.Parallel.QueryNodes;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Collections;
using System.Collections.Generic;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Collections;
using System.Collections.Generic;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System.Linq;
using System.Threading;
using System.Collections;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
using System.Collections.Generic;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
using System.Collections;
Throw
}
+#if !FULL_AOT_RUNTIME
static class PredicateOf<T> {
public static readonly Func<T, bool> Always = (t) => true;
}
+#endif
static class Function<T> {
public static readonly Func<T, T> Identity = (t) => t;
// if zero elements and treat the first element differently
using (var enumerator = source.GetEnumerator ()) {
if (!enumerator.MoveNext ())
- throw new InvalidOperationException ("No elements in source list");
+ throw EmptySequence ();
TSource folded = enumerator.Current;
while (enumerator.MoveNext ())
count++;
}
if (count == 0)
- throw new InvalidOperationException ();
+ throw EmptySequence ();
return total / (double) count;
}
count++;
}
if (count == 0)
- throw new InvalidOperationException ();
+ throw EmptySequence ();
return total / (double) count;
}
count++;
}
if (count == 0)
- throw new InvalidOperationException ();
+ throw EmptySequence ();
return total / count;
}
count++;
}
if (count == 0)
- throw new InvalidOperationException ();
+ throw EmptySequence ();
return total / count;
}
count++;
}
if (count == 0)
- throw new InvalidOperationException ();
+ throw EmptySequence ();
return total / count;
}
count++;
}
if (count == 0)
- throw new InvalidOperationException ();
+ throw EmptySequence ();
return total / (double) count;
}
count++;
}
if (count == 0)
- throw new InvalidOperationException ();
+ throw EmptySequence ();
return total / (double) count;
}
count++;
}
if (count == 0)
- throw new InvalidOperationException ();
+ throw EmptySequence ();
return total / count;
}
count++;
}
if (count == 0)
- throw new InvalidOperationException ();
+ throw EmptySequence ();
return total / count;
}
count++;
}
if (count == 0)
- throw new InvalidOperationException ();
+ throw EmptySequence ();
return total / count;
}
return element;
if (fallback == Fallback.Throw)
- throw new InvalidOperationException ();
+ throw NoMatchingElement ();
return default (TSource);
}
}
}
- throw new InvalidOperationException ("The source sequence is empty");
+ throw EmptySequence ();
}
public static TSource First<TSource> (this IEnumerable<TSource> source, Func<TSource, bool> predicate)
{
Check.Source (source);
+#if !FULL_AOT_RUNTIME
return source.First (PredicateOf<TSource>.Always, Fallback.Default);
+#else
+ // inline the code to reduce dependency o generic causing AOT errors on device (e.g. bug #3285)
+ foreach (var element in source)
+ return element;
+
+ return default (TSource);
+#endif
}
public static TSource FirstOrDefault<TSource> (this IEnumerable<TSource> source, Func<TSource, bool> predicate)
return item;
if (fallback == Fallback.Throw)
- throw new InvalidOperationException ();
+ throw NoMatchingElement ();
return item;
}
var collection = source as ICollection<TSource>;
if (collection != null && collection.Count == 0)
- throw new InvalidOperationException ();
+ throw EmptySequence ();
var list = source as IList<TSource>;
if (list != null)
return list [list.Count - 1];
+#if !FULL_AOT_RUNTIME
return source.Last (PredicateOf<TSource>.Always, Fallback.Throw);
- }
+#else
+ var empty = true;
+ var item = default (TSource);
+
+ foreach (var element in source) {
+ item = element;
+ empty = false;
+ }
+
+ if (!empty)
+ return item;
+
+ throw EmptySequence ();
+#endif
+ }
public static TSource Last<TSource> (this IEnumerable<TSource> source, Func<TSource, bool> predicate)
{
if (list != null)
return list.Count > 0 ? list [list.Count - 1] : default (TSource);
+#if !FULL_AOT_RUNTIME
return source.Last (PredicateOf<TSource>.Always, Fallback.Default);
+#else
+ var empty = true;
+ var item = default (TSource);
+
+ foreach (var element in source) {
+ item = element;
+ empty = false;
+ }
+
+ if (!empty)
+ return item;
+
+ return item;
+#endif
}
public static TSource LastOrDefault<TSource> (this IEnumerable<TSource> source, Func<TSource, bool> predicate)
empty = false;
}
if (empty)
- throw new InvalidOperationException ();
+ throw EmptySequence();
return max;
}
empty = false;
}
if (empty)
- throw new InvalidOperationException ();
+ throw EmptySequence ();
return max;
}
empty = false;
}
if (empty)
- throw new InvalidOperationException ();
+ throw EmptySequence ();
return max;
}
empty = false;
}
if (empty)
- throw new InvalidOperationException ();
+ throw EmptySequence ();
return max;
}
empty = false;
}
if (empty)
- throw new InvalidOperationException ();
+ throw EmptySequence ();
return max;
}
max = element;
}
if (empty)
- throw new InvalidOperationException ();
+ throw EmptySequence ();
}
return max;
}
empty = false;
}
if (empty)
- throw new InvalidOperationException ();
+ throw NoMatchingElement ();
return max;
}
empty = false;
}
if (empty)
- throw new InvalidOperationException ();
+ throw NoMatchingElement ();
return max;
}
empty = false;
}
if (empty)
- throw new InvalidOperationException ();
+ throw NoMatchingElement ();
return max;
}
empty = false;
}
if (empty)
- throw new InvalidOperationException ();
+ throw NoMatchingElement ();
return max;
}
empty = false;
}
if (empty)
- throw new InvalidOperationException ();
+ throw NoMatchingElement ();
return max;
}
}
if (empty)
- throw new InvalidOperationException ();
+ throw NoMatchingElement ();
return initValue;
}
empty = false;
}
if (empty)
- throw new InvalidOperationException ();
+ throw EmptySequence ();
return min;
}
empty = false;
}
if (empty)
- throw new InvalidOperationException ();
+ throw EmptySequence ();
return min;
}
empty = false;
}
if (empty)
- throw new InvalidOperationException ();
+ throw EmptySequence ();
return min;
}
empty = false;
}
if (empty)
- throw new InvalidOperationException ();
+ throw EmptySequence ();
return min;
}
empty = false;
}
if (empty)
- throw new InvalidOperationException ();
+ throw EmptySequence ();
return min;
}
min = element;
}
if (empty)
- throw new InvalidOperationException ();
+ throw EmptySequence ();
}
return min;
}
empty = false;
}
if (empty)
- throw new InvalidOperationException ();
+ throw NoMatchingElement ();
return min;
}
empty = false;
}
if (empty)
- throw new InvalidOperationException ();
+ throw NoMatchingElement ();
return min;
}
empty = false;
}
if (empty)
- throw new InvalidOperationException ();
+ throw NoMatchingElement ();
return min;
}
empty = false;
}
if (empty)
- throw new InvalidOperationException ();
+ throw NoMatchingElement ();
return min;
}
empty = false;
}
if (empty)
- throw new InvalidOperationException ();
+ throw NoMatchingElement ();
return min;
}
continue;
if (found)
- throw new InvalidOperationException ();
+ throw MoreThanOneMatchingElement ();
found = true;
item = element;
}
if (!found && fallback == Fallback.Throw)
- throw new InvalidOperationException ();
+ throw NoMatchingElement ();
return item;
}
{
Check.Source (source);
+#if !FULL_AOT_RUNTIME
return source.Single (PredicateOf<TSource>.Always, Fallback.Throw);
- }
+#else
+ var found = false;
+ var item = default (TSource);
+
+ foreach (var element in source) {
+ if (found)
+ throw MoreThanOneElement ();
+
+ found = true;
+ item = element;
+ }
+
+ if (!found)
+ throw NoMatchingElement ();
+
+ return item;
+#endif
+ }
public static TSource Single<TSource> (this IEnumerable<TSource> source, Func<TSource, bool> predicate)
{
{
Check.Source (source);
+#if !FULL_AOT_RUNTIME
return source.Single (PredicateOf<TSource>.Always, Fallback.Default);
- }
+#else
+ var found = false;
+ var item = default (TSource);
+
+ foreach (var element in source) {
+ if (found)
+ throw MoreThanOneMatchingElement ();
+
+ found = true;
+ item = element;
+ }
+
+ return item;
+#endif
+ }
public static TSource SingleOrDefault<TSource> (this IEnumerable<TSource> source, Func<TSource, bool> predicate)
{
{
Check.SourceAndKeySelector (source, keySelector);
+#if FULL_AOT_RUNTIME
+ var oe = source as OrderedEnumerable <TSource>;
+ if (oe != null)
+ return oe.CreateOrderedEnumerable (keySelector, comparer, false);
+#endif
+
return source.CreateOrderedEnumerable (keySelector, comparer, false);
}
{
Check.SourceAndKeySelector (source, keySelector);
+#if FULL_AOT_RUNTIME
+ var oe = source as OrderedEnumerable <TSource>;
+ if (oe != null)
+ return oe.CreateOrderedEnumerable (keySelector, comparer, true);
+#endif
return source.CreateOrderedEnumerable (keySelector, comparer, true);
}
public static ILookup<TKey, TSource> ToLookup<TSource, TKey> (this IEnumerable<TSource> source,
Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
{
- return ToLookup<TSource, TKey, TSource> (source, keySelector, element => element, comparer);
+ return ToLookup<TSource, TKey, TSource> (source, keySelector, Function<TSource>.Identity, comparer);
}
public static ILookup<TKey, TElement> ToLookup<TSource, TKey, TElement> (this IEnumerable<TSource> source,
return new ReadOnlyCollection<TSource> (source.ToArray<TSource> ());
}
+
+ #region Exception helpers
+
+ static Exception EmptySequence ()
+ {
+ return new InvalidOperationException (Locale.GetText ("Sequence contains no elements"));
+ }
+ static Exception NoMatchingElement ()
+ {
+ return new InvalidOperationException (Locale.GetText ("Sequence contains no matching element"));
+ }
+ static Exception MoreThanOneElement ()
+ {
+ return new InvalidOperationException (Locale.GetText ("Sequence contains more than one element"));
+ }
+ static Exception MoreThanOneMatchingElement ()
+ {
+ return new InvalidOperationException (Locale.GetText ("Sequence contains more than one matching element"));
+ }
+
+ #endregion
}
}
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
using System.Collections;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
using System.Collections;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
namespace System.Linq
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
namespace System.Linq
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
#endregion
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
#region Zip
public static IQueryable<TResult> Zip<TFirst, TSecond, TResult> (this IQueryable<TFirst> source1, IEnumerable<TSecond> source2, Expression<Func<TFirst, TSecond, TResult>> resultSelector)
// Then sorts the elements according to the collected
// key values and the selected ordering
- Array.Sort<int, TElement> (indexes, elements, context);
+ Array.Sort<int> (indexes, context);
}
public static IEnumerable<TElement> Sort (IEnumerable<TElement> source, SortContext<TElement> context)
sorter.PerformSort ();
for (int i = 0; i < sorter.elements.Length; i++)
- yield return sorter.elements [i];
+ yield return sorter.elements [sorter.indexes [i]];
}
}
}
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System;
using System.Linq.Expressions;
}
}
}
+#endif
public static new Aes Create () \r
{\r
+#if FULL_AOT_RUNTIME\r
+ // The Aes base class was moved from System.Core to mscorlib - so we can't just return a new AesCryptoServiceProvider instance\r
+ // note: the linker is aware of this condition\r
+ return (Aes) Activator.CreateInstance (Type.GetType ("System.Security.Cryptography.AesCryptoServiceProvider, " + Consts.AssemblySystem_Core));\r
+#elif MOBILE\r
+ // there was a mixup in the MOBILE profile, to be compatible with Silverlight it's\r
+ // AesManaged that should have been provided, not AesCryptoServiceProvider\r
+ return Create ("System.Security.Cryptography.AesCryptoServiceProvider, " + Consts.AssemblySystem_Core);\r
+#else\r
return Create ("System.Security.Cryptography.AesManaged, " + Consts.AssemblySystem_Core);\r
+#endif\r
}\r
\r
public static new Aes Create (string algorithmName) \r
{\r
KeySizeValue = 256;\r
BlockSizeValue = 128;
-#if !NET_2_1
+#if !MOONLIGHT
// Silverlight 2.0 only supports CBC mode (i.e. no feedback)\r
FeedbackSizeValue = 128;
#endif\r
}
#endif
#if MONODROID
- return ZoneInfoDB.GetTimeZone (id);
+ var timeZoneInfo = ZoneInfoDB.GetTimeZone (id);
+ if (timeZoneInfo == null)
+ throw new TimeZoneNotFoundException ();
+ return timeZoneInfo;
#else
// Local requires special logic that already exists in the Local property (bug #326)
if (id == "Local")
../../build/common/MonoTODOAttribute.cs
../corlib/Mono.Security.Cryptography/CryptoTools.cs
../corlib/Mono.Security.Cryptography/SymmetricTransform.cs
+../corlib/System.Collections.Concurrent.Partitioners/EnumerablePartitioner.cs
Assembly/AssemblyInfo.cs
System/Actions.cs
System/Funcs.cs
System.Linq.Parallel/RepeatList.cs
System.Linq.Parallel/ReverseList.cs
System.Linq.Parallel/StripPartitioner.cs
+System.Linq.Parallel/TemporaryArea.cs
System.Linq/EnumerableExecutor.cs
System.Linq/EnumerableExecutor_T.cs
System.Linq/EnumerableQuery.cs
-#include System.Data.Services.Client.dll.sources
-./Client/AssemblyAttributes.cs
+#include net_4_5_System.Data.Services.Client.dll.sources
--- /dev/null
+//
+// AssemblyInfo.cs
+//
+// Authors:
+// Marek Safar (marek.safar@gmail.com)
+//
+// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Reflection;
+using System.Resources;
+using System.Security;
+using System.Security.Permissions;
+using System.Diagnostics;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about the System.Json assembly
+
+[assembly: AssemblyDefaultAlias ("System.Json.Microsoft.dll")]
+
+[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
--- /dev/null
+2010-03-10 Atsushi Enomoto <atsushi@ximian.com>
+
+ * AssemblyInfo.cs : use the same pub key in 2.0 (dummy), to ease
+ testing locally.
+
+2008-05-07 Sebastien Pouliot <sebastien@ximian.com>
+
+ * AssemblyInfo.cs: Remove AssemblyDelaySign(true) since it's
+ not always needed and can be controlled from the Makefile.
+ Adjust public key for System.Windows (InternalsVisibleTo)
+
+2008-04-13 Jb Evain <jbevain@novell.com>
+
+ * AssemblyInfo.cs: agmono is renamed to Mono.Moonlight.
+ Merged from the Moonlight 2 branch.
+
--- /dev/null
+2010-04-01 Miguel de Icaza <miguel@novell.com>
+
+ * JsonValue.cs: We need to use Convert.ToXXXX for numbers as we
+ always end up reporting the value JsonType.Number regardless of
+ the underlying storage (int, long or decimal). The parser
+ picks the best storage suitable for the data, and can end up using
+ "ints" for values that sometimes use longs.
+
+ This causes problems when derefercing the data for example, if you
+ have an int and try to get it out as a long you end up with an
+ invalid cast exception.
+
+2010-03-10 Atsushi Enomoto <atsushi@ximian.com>
+
+ * System.Json.dll.sources : remove JsonReader.cs.
+
+2010-03-10 Atsushi Enomoto <atsushi@ximian.com>
+
+ * Makefile : reference System.Xml and System.ServiceModel.Web (for
+ moonlight compatibility).
+
+2009-08-13 Atsushi Enomoto <atsushi@ximian.com>
+
+ * Makefile : update profile check.
+
+2008-06-10 Atsushi Enomoto <atsushi@ximian.com>
+
+ * System.Json.dll.sources, Makefile : initial checkin.
+
--- /dev/null
+thisdir = class/System.Json.Microsoft
+SUBDIRS =
+include ../../build/rules.make
+
+System.Json.Properties.Resources.resources: System.Json/Properties/Resources.resx
+ $(RESGEN) "$<" "$@"
+
+LIBRARY = System.Json.Microsoft.dll
+LIB_MCS_FLAGS = /d:ASPNETMVC -keyfile:../winfx.pub -delaysign \
+ /r:System.dll \
+ /r:System.Xml.dll \
+ /r:System.Core.dll \
+ /r:System.Runtime.Serialization.dll \
+ /resource:System.Json.Properties.Resources.resources
+
+EXTRA_DISTFILES = System.Json/Properties/Resources.resx
+
+ifeq (4, $(FRAMEWORK_VERSION_MAJOR))
+LIB_MCS_FLAGS += /r:Microsoft.CSharp.dll -d:FEATURE_DYNAMIC
+endif
+
+ifeq (monodroid, $(PROFILE))
+LIB_MCS_FLAGS += -d:FEATURE_DYNAMIC
+endif
+
+TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
+
+include ../../build/library.make
+
+$(the_lib): System.Json.Properties.Resources.resources
--- /dev/null
+../../build/common/Consts.cs
+Assembly/AssemblyInfo.cs
+
+../../../external/aspnetwebstack/src/RS.cs
+../../../external/aspnetwebstack/src/CommonAssemblyInfo.cs
+../../../external/aspnetwebstack/src/TransparentCommonAssemblyInfo.cs
+
+System.Json/Properties/AssemblyInfo.cs
+System.Json/Extensions/JsonValueExtensions.cs
+System.Json/GlobalSuppressions.cs
+System.Json/JXmlToJsonValueConverter.cs
+System.Json/JsonArray.cs
+System.Json/JsonObject.cs
+System.Json/JsonPrimitive.cs
+System.Json/JsonType.cs
+System.Json/JsonValue.cs
+System.Json/JsonValueChange.cs
+System.Json/JsonValueChangeEventArgs.cs
+System.Json/JsonValueDynamicMetaObject.cs
+System.Json/JsonValueLinqExtensions.cs
+System.Json/NGenWrapper.cs
+System.Json/Properties/Resources.Designer.cs
--- /dev/null
+System.Json/JsonValueTest.cs
\ No newline at end of file
--- /dev/null
+// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
+#if FEATURE_DYNAMIC
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics.CodeAnalysis;
+using System.Dynamic;
+using System.IO;
+using System.Json;
+using System.Linq.Expressions;
+
+namespace System.Runtime.Serialization.Json
+{
+ /// <summary>
+ /// This class extends the functionality of the <see cref="JsonValue"/> type.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static class JsonValueExtensions
+ {
+ /// <summary>
+ /// Creates a <see cref="System.Json.JsonValue"/> object based on an arbitrary CLR object.
+ /// </summary>
+ /// <param name="value">The object to be converted to <see cref="System.Json.JsonValue"/>.</param>
+ /// <returns>The <see cref="System.Json.JsonValue"/> which represents the given object.</returns>
+ /// <remarks>The conversion is done through the <see cref="System.Runtime.Serialization.Json.DataContractJsonSerializer"/>;
+ /// the object is first serialized into JSON using the serializer, then parsed into a <see cref="System.Json.JsonValue"/>
+ /// object.</remarks>
+ public static JsonValue CreateFrom(object value)
+ {
+ JsonValue jsonValue = null;
+
+ if (value != null)
+ {
+ jsonValue = value as JsonValue;
+
+ if (jsonValue == null)
+ {
+ jsonValue = JsonValueExtensions.CreatePrimitive(value);
+
+ if (jsonValue == null)
+ {
+ jsonValue = JsonValueExtensions.CreateFromDynamic(value);
+
+ if (jsonValue == null)
+ {
+ jsonValue = JsonValueExtensions.CreateFromComplex(value);
+ }
+ }
+ }
+ }
+
+ return jsonValue;
+ }
+
+ /// <summary>
+ /// Attempts to convert this <see cref="System.Json.JsonValue"/> instance into the type T.
+ /// </summary>
+ /// <typeparam name="T">The type to which the conversion is being performed.</typeparam>
+ /// <param name="jsonValue">The <see cref="JsonValue"/> instance this method extension is to be applied to.</param>
+ /// <param name="valueOfT">An instance of T initialized with this instance, or the default
+ /// value of T, if the conversion cannot be performed.</param>
+ /// <returns>true if this <see cref="System.Json.JsonValue"/> instance can be read as type T; otherwise, false.</returns>
+ public static bool TryReadAsType<T>(this JsonValue jsonValue, out T valueOfT)
+ {
+ if (jsonValue == null)
+ {
+ throw new ArgumentNullException("jsonValue");
+ }
+
+ object value;
+ if (JsonValueExtensions.TryReadAsType(jsonValue, typeof(T), out value))
+ {
+ valueOfT = (T)value;
+ return true;
+ }
+
+ valueOfT = default(T);
+ return false;
+ }
+
+ /// <summary>
+ /// Attempts to convert this <see cref="System.Json.JsonValue"/> instance into the type T.
+ /// </summary>
+ /// <typeparam name="T">The type to which the conversion is being performed.</typeparam>
+ /// <param name="jsonValue">The <see cref="JsonValue"/> instance this method extension is to be applied to.</param>
+ /// <returns>An instance of T initialized with the <see cref="System.Json.JsonValue"/> value
+ /// specified if the conversion.</returns>
+ /// <exception cref="System.NotSupportedException">If this <see cref="System.Json.JsonValue"/> value cannot be
+ /// converted into the type T.</exception>
+ [SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter",
+ Justification = "The generic parameter is used to specify the output type")]
+ public static T ReadAsType<T>(this JsonValue jsonValue)
+ {
+ if (jsonValue == null)
+ {
+ throw new ArgumentNullException("jsonValue");
+ }
+
+ return (T)JsonValueExtensions.ReadAsType(jsonValue, typeof(T));
+ }
+
+ /// <summary>
+ /// Attempts to convert this <see cref="System.Json.JsonValue"/> instance into the type T, returning a fallback value
+ /// if the conversion fails.
+ /// </summary>
+ /// <typeparam name="T">The type to which the conversion is being performed.</typeparam>
+ /// <param name="jsonValue">The <see cref="JsonValue"/> instance this method extension is to be applied to.</param>
+ /// <param name="fallback">A fallback value to be retuned in case the conversion cannot be performed.</param>
+ /// <returns>An instance of T initialized with the <see cref="System.Json.JsonValue"/> value
+ /// specified if the conversion succeeds or the specified fallback value if it fails.</returns>
+ public static T ReadAsType<T>(this JsonValue jsonValue, T fallback)
+ {
+ if (jsonValue == null)
+ {
+ throw new ArgumentNullException("jsonValue");
+ }
+
+ T outVal;
+ if (JsonValueExtensions.TryReadAsType<T>(jsonValue, out outVal))
+ {
+ return outVal;
+ }
+
+ return fallback;
+ }
+
+ /// <summary>
+ /// Attempts to convert this <see cref="System.Json.JsonValue"/> instance into an instance of the specified type.
+ /// </summary>
+ /// <param name="jsonValue">The <see cref="JsonValue"/> instance this method extension is to be applied to.</param>
+ /// <param name="type">The type to which the conversion is being performed.</param>
+ /// <returns>An object instance initialized with the <see cref="System.Json.JsonValue"/> value
+ /// specified if the conversion.</returns>
+ /// <exception cref="System.NotSupportedException">If this <see cref="System.Json.JsonValue"/> value cannot be
+ /// converted into the type T.</exception>
+ public static object ReadAsType(this JsonValue jsonValue, Type type)
+ {
+ if (jsonValue == null)
+ {
+ throw new ArgumentNullException("jsonValue");
+ }
+
+ if (type == null)
+ {
+ throw new ArgumentNullException("type");
+ }
+
+ object result;
+ if (JsonValueExtensions.TryReadAsType(jsonValue, type, out result))
+ {
+ return result;
+ }
+
+ throw new NotSupportedException(RS.Format(System.Json.Properties.Resources.CannotReadAsType, jsonValue.GetType().FullName, type.FullName));
+ }
+
+ /// <summary>
+ /// Attempts to convert this <see cref="System.Json.JsonValue"/> instance into an instance of the specified type.
+ /// </summary>
+ /// <param name="jsonValue">The <see cref="JsonValue"/> instance this method extension is to be applied to.</param>
+ /// <param name="type">The type to which the conversion is being performed.</param>
+ /// <param name="value">An object to be initialized with this instance or null if the conversion cannot be performed.</param>
+ /// <returns>true if this <see cref="System.Json.JsonValue"/> instance can be read as the specified type; otherwise, false.</returns>
+ [SuppressMessage("Microsoft.Design", "CA1007:UseGenericsWhereAppropriate",
+ Justification = "This is the non-generic version of the method.")]
+ [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Exception translates to fail.")]
+ public static bool TryReadAsType(this JsonValue jsonValue, Type type, out object value)
+ {
+ if (jsonValue == null)
+ {
+ throw new ArgumentNullException("jsonValue");
+ }
+
+ if (type == null)
+ {
+ throw new ArgumentNullException("type");
+ }
+
+ if (type == typeof(JsonValue) || type == typeof(object))
+ {
+ value = jsonValue;
+ return true;
+ }
+
+ if (type == typeof(object[]) || type == typeof(Dictionary<string, object>))
+ {
+ if (!JsonValueExtensions.CanConvertToClrCollection(jsonValue, type))
+ {
+ value = null;
+ return false;
+ }
+ }
+
+ if (jsonValue.TryReadAs(type, out value))
+ {
+ return true;
+ }
+
+ try
+ {
+ using (MemoryStream ms = new MemoryStream())
+ {
+ jsonValue.Save(ms);
+ ms.Position = 0;
+ DataContractJsonSerializer dcjs = new DataContractJsonSerializer(type);
+ value = dcjs.ReadObject(ms);
+ }
+
+ return true;
+ }
+ catch (Exception)
+ {
+ value = null;
+ return false;
+ }
+ }
+
+ /// <summary>
+ /// Determines whether the specified <see cref="JsonValue"/> instance can be converted to the specified collection <see cref="Type"/>.
+ /// </summary>
+ /// <param name="jsonValue">The instance to be converted.</param>
+ /// <param name="collectionType">The collection type to convert the instance to.</param>
+ /// <returns>true if the instance can be converted, false otherwise</returns>
+ private static bool CanConvertToClrCollection(JsonValue jsonValue, Type collectionType)
+ {
+ if (jsonValue != null)
+ {
+ return (jsonValue.JsonType == JsonType.Object && collectionType == typeof(Dictionary<string, object>)) ||
+ (jsonValue.JsonType == JsonType.Array && collectionType == typeof(object[]));
+ }
+
+ return false;
+ }
+
+ private static JsonValue CreatePrimitive(object value)
+ {
+ JsonPrimitive jsonPrimitive;
+
+ if (JsonPrimitive.TryCreate(value, out jsonPrimitive))
+ {
+ return jsonPrimitive;
+ }
+
+ return null;
+ }
+
+ private static JsonValue CreateFromComplex(object value)
+ {
+ DataContractJsonSerializer dcjs = new DataContractJsonSerializer(value.GetType());
+ using (MemoryStream ms = new MemoryStream())
+ {
+ dcjs.WriteObject(ms, value);
+ ms.Position = 0;
+ return JsonValue.Load(ms);
+ }
+ }
+
+ [SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily", Justification = "value is not the same")]
+ private static JsonValue CreateFromDynamic(object value)
+ {
+ JsonObject parent = null;
+ DynamicObject dynObj = value as DynamicObject;
+
+ if (dynObj != null)
+ {
+ parent = new JsonObject();
+ Stack<CreateFromTypeStackInfo> infoStack = new Stack<CreateFromTypeStackInfo>();
+ IEnumerator<string> keys = null;
+
+ do
+ {
+ if (keys == null)
+ {
+ keys = dynObj.GetDynamicMemberNames().GetEnumerator();
+ }
+
+ while (keys.MoveNext())
+ {
+ JsonValue child = null;
+ string key = keys.Current;
+ SimpleGetMemberBinder binder = new SimpleGetMemberBinder(key);
+
+ if (dynObj.TryGetMember(binder, out value))
+ {
+ DynamicObject childDynObj = value as DynamicObject;
+
+ if (childDynObj != null)
+ {
+ child = new JsonObject();
+ parent.Add(key, child);
+
+ infoStack.Push(new CreateFromTypeStackInfo(parent, dynObj, keys));
+
+ parent = child as JsonObject;
+ dynObj = childDynObj;
+ keys = null;
+
+ break;
+ }
+ else
+ {
+ if (value != null)
+ {
+ child = value as JsonValue;
+
+ if (child == null)
+ {
+ child = JsonValueExtensions.CreatePrimitive(value);
+
+ if (child == null)
+ {
+ child = JsonValueExtensions.CreateFromComplex(value);
+ }
+ }
+ }
+
+ parent.Add(key, child);
+ }
+ }
+ }
+
+ if (infoStack.Count > 0 && keys != null)
+ {
+ CreateFromTypeStackInfo info = infoStack.Pop();
+
+ parent = info.JsonObject;
+ dynObj = info.DynamicObject;
+ keys = info.Keys;
+ }
+ }
+ while (infoStack.Count > 0);
+ }
+
+ return parent;
+ }
+
+ private class CreateFromTypeStackInfo
+ {
+ public CreateFromTypeStackInfo(JsonObject jsonObject, DynamicObject dynamicObject, IEnumerator<string> keyEnumerator)
+ {
+ JsonObject = jsonObject;
+ DynamicObject = dynamicObject;
+ Keys = keyEnumerator;
+ }
+
+ /// <summary>
+ /// Gets of sets
+ /// </summary>
+ public JsonObject JsonObject { get; set; }
+
+ /// <summary>
+ /// Gets of sets
+ /// </summary>
+ public DynamicObject DynamicObject { get; set; }
+
+ /// <summary>
+ /// Gets of sets
+ /// </summary>
+ public IEnumerator<string> Keys { get; set; }
+ }
+
+ private class SimpleGetMemberBinder : GetMemberBinder
+ {
+ public SimpleGetMemberBinder(string name)
+ : base(name, false)
+ {
+ }
+
+ public override DynamicMetaObject FallbackGetMember(DynamicMetaObject target, DynamicMetaObject errorSuggestion)
+ {
+ if (target != null && errorSuggestion == null)
+ {
+ string exceptionMessage = RS.Format(System.Json.Properties.Resources.DynamicPropertyNotDefined, target.LimitType, Name);
+ Expression throwExpression = Expression.Throw(Expression.Constant(new InvalidOperationException(exceptionMessage)), typeof(object));
+
+ errorSuggestion = new DynamicMetaObject(throwExpression, target.Restrictions);
+ }
+
+ return errorSuggestion;
+ }
+ }
+ }
+}
+#endif
--- /dev/null
+// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
+
+using System.Diagnostics.CodeAnalysis;
+
+[assembly: SuppressMessage("Microsoft.Design", "CA2210:AssembliesShouldHaveValidStrongNames", Justification = "These assemblies are delay-signed.")]
+[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Justification = "Classes are grouped logically for user clarity.", Scope = "namespace", Target = "System.Runtime.Serialization.Json")]
--- /dev/null
+// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
+
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Runtime.Serialization.Json;
+using System.Text;
+using System.Xml;
+
+namespace System.Json
+{
+ internal static class JXmlToJsonValueConverter
+ {
+ internal const string RootElementName = "root";
+ internal const string ItemElementName = "item";
+ internal const string TypeAttributeName = "type";
+ internal const string ArrayAttributeValue = "array";
+ internal const string BooleanAttributeValue = "boolean";
+ internal const string NullAttributeValue = "null";
+ internal const string NumberAttributeValue = "number";
+ internal const string ObjectAttributeValue = "object";
+ internal const string StringAttributeValue = "string";
+ private const string TypeHintAttributeName = "__type";
+
+ private static readonly char[] _floatingPointChars = new char[] { '.', 'e', 'E' };
+
+ public static JsonValue JXMLToJsonValue(Stream jsonStream)
+ {
+ if (jsonStream == null)
+ {
+ throw new ArgumentNullException("jsonStream");
+ }
+
+ return JXMLToJsonValue(jsonStream, null);
+ }
+
+ public static JsonValue JXMLToJsonValue(string jsonString)
+ {
+ if (jsonString == null)
+ {
+ throw new ArgumentNullException("jsonString");
+ }
+
+ if (jsonString.Length == 0)
+ {
+ throw new ArgumentException(Properties.Resources.JsonStringCannotBeEmpty, "jsonString");
+ }
+
+ byte[] jsonBytes = Encoding.UTF8.GetBytes(jsonString);
+
+ return JXMLToJsonValue(null, jsonBytes);
+ }
+
+ public static JsonValue JXMLToJsonValue(XmlDictionaryReader jsonReader)
+ {
+ if (jsonReader == null)
+ {
+ throw new ArgumentNullException("jsonReader");
+ }
+
+ const string RootObjectName = "RootObject";
+ Stack<JsonValue> jsonStack = new Stack<JsonValue>();
+ string nodeType = null;
+ bool isEmptyElement = false;
+
+ JsonValue parent = new JsonObject();
+ jsonStack.Push(parent);
+ string currentName = RootObjectName;
+
+ try
+ {
+ MoveToRootNode(jsonReader);
+
+ while (jsonStack.Count > 0 && jsonReader.NodeType != XmlNodeType.None)
+ {
+ if (parent is JsonObject && currentName == null)
+ {
+ currentName = GetMemberName(jsonReader);
+ }
+
+ nodeType = jsonReader.GetAttribute(TypeAttributeName) ?? StringAttributeValue;
+
+ if (parent is JsonArray)
+ {
+ // For arrays, the element name has to be "item"
+ if (jsonReader.Name != ItemElementName)
+ {
+ throw new FormatException(Properties.Resources.IncorrectJsonFormat);
+ }
+ }
+
+ switch (nodeType)
+ {
+ case NullAttributeValue:
+ case BooleanAttributeValue:
+ case StringAttributeValue:
+ case NumberAttributeValue:
+ JsonPrimitive jsonPrimitive = ReadPrimitive(nodeType, jsonReader);
+ InsertJsonValue(jsonStack, ref parent, ref currentName, jsonPrimitive, true);
+ break;
+ case ArrayAttributeValue:
+ JsonArray jsonArray = CreateJsonArray(jsonReader, ref isEmptyElement);
+ InsertJsonValue(jsonStack, ref parent, ref currentName, jsonArray, isEmptyElement);
+ break;
+ case ObjectAttributeValue:
+ JsonObject jsonObject = CreateObjectWithTypeHint(jsonReader, ref isEmptyElement);
+ InsertJsonValue(jsonStack, ref parent, ref currentName, jsonObject, isEmptyElement);
+ break;
+ default:
+ throw new FormatException(Properties.Resources.IncorrectJsonFormat);
+ }
+
+ while (jsonReader.NodeType == XmlNodeType.EndElement && jsonStack.Count > 0)
+ {
+ jsonReader.Read();
+ SkipWhitespace(jsonReader);
+ jsonStack.Pop();
+ if (jsonStack.Count > 0)
+ {
+ parent = jsonStack.Peek();
+ }
+ }
+ }
+ }
+ catch (XmlException xmlException)
+ {
+ throw new FormatException(Properties.Resources.IncorrectJsonFormat, xmlException);
+ }
+
+ if (jsonStack.Count != 1)
+ {
+ throw new FormatException(Properties.Resources.IncorrectJsonFormat);
+ }
+
+ return parent[RootObjectName];
+ }
+
+ private static JsonValue JXMLToJsonValue(Stream jsonStream, byte[] jsonBytes)
+ {
+ try
+ {
+ using (XmlDictionaryReader jsonReader =
+ jsonStream != null
+ ? JsonReaderWriterFactory.CreateJsonReader(jsonStream, XmlDictionaryReaderQuotas.Max)
+ : JsonReaderWriterFactory.CreateJsonReader(jsonBytes, XmlDictionaryReaderQuotas.Max))
+ {
+ return JXMLToJsonValue(jsonReader);
+ }
+ }
+ catch (XmlException)
+ {
+ throw new FormatException(Properties.Resources.IncorrectJsonFormat);
+ }
+ }
+
+ private static void InsertJsonValue(Stack<JsonValue> jsonStack, ref JsonValue parent, ref string currentName, JsonValue jsonValue, bool isEmptyElement)
+ {
+ if (parent is JsonArray)
+ {
+ ((JsonArray)parent).Add(jsonValue);
+ }
+ else
+ {
+ if (currentName != null)
+ {
+ ((JsonObject)parent)[currentName] = jsonValue;
+ currentName = null;
+ }
+ }
+
+ if (!isEmptyElement)
+ {
+ jsonStack.Push(jsonValue);
+ parent = jsonValue;
+ }
+ }
+
+ private static string GetMemberName(XmlDictionaryReader jsonReader)
+ {
+ string name;
+ if (jsonReader.NamespaceURI == ItemElementName && jsonReader.LocalName == ItemElementName)
+ {
+ // JXML special case for names which aren't valid XML names
+ name = jsonReader.GetAttribute(ItemElementName);
+
+ if (name == null)
+ {
+ throw new FormatException(Properties.Resources.IncorrectJsonFormat);
+ }
+ }
+ else
+ {
+ name = jsonReader.Name;
+ }
+
+ return name;
+ }
+
+ private static JsonObject CreateObjectWithTypeHint(XmlDictionaryReader jsonReader, ref bool isEmptyElement)
+ {
+ JsonObject jsonObject = new JsonObject();
+ string typeHintAttribute = jsonReader.GetAttribute(TypeHintAttributeName);
+ isEmptyElement = jsonReader.IsEmptyElement;
+ jsonReader.ReadStartElement();
+ SkipWhitespace(jsonReader);
+
+ if (typeHintAttribute != null)
+ {
+ jsonObject.Add(TypeHintAttributeName, typeHintAttribute);
+ }
+
+ return jsonObject;
+ }
+
+ private static JsonArray CreateJsonArray(XmlDictionaryReader jsonReader, ref bool isEmptyElement)
+ {
+ JsonArray jsonArray = new JsonArray();
+ isEmptyElement = jsonReader.IsEmptyElement;
+ jsonReader.ReadStartElement();
+ SkipWhitespace(jsonReader);
+ return jsonArray;
+ }
+
+ private static void MoveToRootNode(XmlDictionaryReader jsonReader)
+ {
+ while (!jsonReader.EOF && (jsonReader.NodeType == XmlNodeType.None || jsonReader.NodeType == XmlNodeType.XmlDeclaration))
+ {
+ // read into <root> node
+ jsonReader.Read();
+ SkipWhitespace(jsonReader);
+ }
+
+ if (jsonReader.NodeType != XmlNodeType.Element || !String.IsNullOrEmpty(jsonReader.NamespaceURI) || jsonReader.Name != RootElementName)
+ {
+ throw new FormatException(Properties.Resources.IncorrectJsonFormat);
+ }
+ }
+
+ private static JsonPrimitive ReadPrimitive(string type, XmlDictionaryReader jsonReader)
+ {
+ JsonValue result = null;
+ switch (type)
+ {
+ case NullAttributeValue:
+ jsonReader.Skip();
+ result = null;
+ break;
+ case BooleanAttributeValue:
+ result = jsonReader.ReadElementContentAsBoolean();
+ break;
+ case StringAttributeValue:
+ result = jsonReader.ReadElementContentAsString();
+ break;
+ case NumberAttributeValue:
+ string temp = jsonReader.ReadElementContentAsString();
+ result = ConvertStringToJsonNumber(temp);
+ break;
+ }
+
+ SkipWhitespace(jsonReader);
+ return (JsonPrimitive)result;
+ }
+
+ private static void SkipWhitespace(XmlDictionaryReader reader)
+ {
+ while (!reader.EOF && (reader.NodeType == XmlNodeType.Whitespace || reader.NodeType == XmlNodeType.SignificantWhitespace))
+ {
+ reader.Read();
+ }
+ }
+
+ private static JsonValue ConvertStringToJsonNumber(string value)
+ {
+ if (value.IndexOfAny(_floatingPointChars) < 0)
+ {
+ int intVal;
+ if (Int32.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out intVal))
+ {
+ return intVal;
+ }
+
+ long longVal;
+ if (Int64.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out longVal))
+ {
+ return longVal;
+ }
+ }
+
+ decimal decValue;
+ if (Decimal.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out decValue) && decValue != 0)
+ {
+ return decValue;
+ }
+
+ double dblValue;
+ if (Double.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out dblValue))
+ {
+ return dblValue;
+ }
+
+ throw new ArgumentException(RS.Format(Properties.Resources.InvalidJsonPrimitive, value.ToString()), "value");
+ }
+ }
+}
--- /dev/null
+// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
+
+using System.Collections;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Globalization;
+using System.Runtime.Serialization;
+using System.Xml;
+
+namespace System.Json
+{
+ /// <summary>
+ /// A JsonArray is an ordered sequence of zero or more <see cref="System.Json.JsonValue"/> objects.
+ /// </summary>
+ [SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix",
+ Justification = "Array already conveys the meaning of collection")]
+ [DataContract]
+ public sealed class JsonArray : JsonValue, IList<JsonValue>
+ {
+ [DataMember]
+ private List<JsonValue> values = new List<JsonValue>();
+
+ /// <summary>
+ /// Creates an instance of the <see cref="System.Json.JsonArray"/> class initialized by
+ /// an <see cref="System.Collections.Generic.IEnumerable{T}"/> enumeration of
+ /// objects of type <see cref="System.Json.JsonValue"/>.
+ /// </summary>
+ /// <param name="items">The <see cref="System.Collections.Generic.IEnumerable{T}"/> enumeration
+ /// of objects of type <see cref="System.Json.JsonValue"/> used to initialize the JavaScript Object Notation (JSON)
+ /// array.</param>
+ /// <exception cref="System.ArgumentNullException">If items is null.</exception>
+ /// <exception cref="System.ArgumentException">If any of the items in the collection
+ /// is a <see cref="System.Json.JsonValue"/> with <see cref="System.Json.JsonValue.JsonType"/> property of
+ /// value <see cref="F:System.Json.JsonType.Default"/>.</exception>
+ public JsonArray(IEnumerable<JsonValue> items)
+ {
+ AddRange(items);
+ }
+
+ /// <summary>
+ /// Creates an instance of the <see cref="System.Json.JsonArray"/> class, initialized by an array of type <see cref="System.Json.JsonValue"/>.
+ /// </summary>
+ /// <param name="items">The array of type <see cref="System.Json.JsonValue"/> used to initialize the
+ /// JavaScript Object Notation (JSON) array.</param>
+ /// <exception cref="System.ArgumentException">If any of the items in the collection
+ /// is a <see cref="System.Json.JsonValue"/> with <see cref="System.Json.JsonValue.JsonType"/> property of
+ /// value <see cref="F:System.Json.JsonType.Default"/>.</exception>
+ public JsonArray(params JsonValue[] items)
+ {
+ if (items != null)
+ {
+ AddRange(items);
+ }
+ }
+
+ /// <summary>
+ /// Gets the JSON type of this <see cref="System.Json.JsonArray"/>. The return value
+ /// is always <see cref="F:System.Json.JsonType.Array"/>.
+ /// </summary>
+ public override JsonType JsonType
+ {
+ get { return JsonType.Array; }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether the <see cref="System.Json.JsonArray"/> is read-only.
+ /// </summary>
+ public bool IsReadOnly
+ {
+ get { return ((IList)values).IsReadOnly; }
+ }
+
+ /// <summary>
+ /// Returns the number of <see cref="System.Json.JsonValue"/> elements in the array.
+ /// </summary>
+ public override int Count
+ {
+ get { return values.Count; }
+ }
+
+ /// <summary>
+ /// Gets or sets the JSON value at a specified index.
+ /// </summary>
+ /// <param name="index">The zero-based index of the element to get or set.</param>
+ /// <returns>The <see cref="System.Json.JsonValue"/> element at the specified index.</returns>
+ /// <exception cref="System.ArgumentOutOfRangeException">If index is not a valid index for this array.</exception>
+ /// <exception cref="System.ArgumentException">The property is set and the value is a
+ /// <see cref="System.Json.JsonValue"/> with <see cref="System.Json.JsonValue.JsonType"/>
+ /// property of value <see cref="F:System.Json.JsonType.Default"/>.</exception>
+ public override JsonValue this[int index]
+ {
+ get { return values[index]; }
+
+ set
+ {
+ if (value != null && value.JsonType == JsonType.Default)
+ {
+ throw new ArgumentNullException("value", Properties.Resources.UseOfDefaultNotAllowed);
+ }
+
+ JsonValue oldValue = values[index];
+ RaiseItemChanging(value, JsonValueChange.Replace, index);
+ values[index] = value;
+ RaiseItemChanged(oldValue, JsonValueChange.Replace, index);
+ }
+ }
+
+ /// <summary>
+ /// Adds the elements from a collection of type <see cref="System.Json.JsonValue"/> to this instance.
+ /// </summary>
+ /// <param name="items">Collection of items to add.</param>
+ /// <exception cref="System.ArgumentNullException">If items is null.</exception>
+ /// <exception cref="System.ArgumentException">If any of the items in the collection
+ /// is a <see cref="System.Json.JsonValue"/> with <see cref="System.Json.JsonValue.JsonType"/> property of
+ /// value <see cref="F:System.Json.JsonType.Default"/>.</exception>
+ public void AddRange(IEnumerable<JsonValue> items)
+ {
+ if (items == null)
+ {
+ throw new ArgumentNullException("items");
+ }
+
+ if (ChangingListenersCount > 0)
+ {
+ int index = Count;
+ foreach (JsonValue toBeAdded in items)
+ {
+ RaiseItemChanging(toBeAdded, JsonValueChange.Add, index++);
+ }
+ }
+
+ foreach (JsonValue item in items)
+ {
+ if (item != null && item.JsonType == JsonType.Default)
+ {
+ throw new ArgumentNullException("items", Properties.Resources.UseOfDefaultNotAllowed);
+ }
+
+ values.Add(item);
+ RaiseItemChanged(item, JsonValueChange.Add, values.Count - 1);
+ }
+ }
+
+ /// <summary>
+ /// Adds the elements from an array of type <see cref="System.Json.JsonValue"/> to this instance.
+ /// </summary>
+ /// <param name="items">The array of type JsonValue to be added to this instance.</param>
+ /// <exception cref="System.ArgumentNullException">If items is null.</exception>
+ /// <exception cref="System.ArgumentException">If any of the items in the array
+ /// is a <see cref="System.Json.JsonValue"/> with <see cref="System.Json.JsonValue.JsonType"/> property of
+ /// value <see cref="F:System.Json.JsonType.Default"/>.</exception>
+ public void AddRange(params JsonValue[] items)
+ {
+ AddRange(items as IEnumerable<JsonValue>);
+ }
+
+ /// <summary>
+ /// Searches for a specified object and returns the zero-based index of its first
+ /// occurrence within this <see cref="System.Json.JsonArray"/>.
+ /// </summary>
+ /// <param name="item">The <see cref="System.Json.JsonValue"/> object to look up.</param>
+ /// <returns>The zero-based index of the first occurrence of item within the
+ /// <see cref="System.Json.JsonArray"/>, if found; otherwise, -1.</returns>
+ public int IndexOf(JsonValue item)
+ {
+ return values.IndexOf(item);
+ }
+
+ /// <summary>
+ /// Insert a JSON CLR type into the array at a specified index.
+ /// </summary>
+ /// <param name="index">The zero-based index at which the item should be inserted.</param>
+ /// <param name="item">The <see cref="System.Json.JsonValue"/> object to insert.</param>
+ /// <exception cref="System.ArgumentOutOfRangeException">If index is less than zero or larger than
+ /// the size of the array.</exception>
+ /// <exception cref="System.ArgumentException">If the object to insert has a
+ /// <see cref="System.Json.JsonValue.JsonType"/> property of value
+ /// <see cref="F:System.Json.JsonType.Default"/>.</exception>
+ public void Insert(int index, JsonValue item)
+ {
+ if (item != null && item.JsonType == JsonType.Default)
+ {
+ throw new ArgumentNullException("item", Properties.Resources.UseOfDefaultNotAllowed);
+ }
+
+ RaiseItemChanging(item, JsonValueChange.Add, index);
+ values.Insert(index, item);
+ RaiseItemChanged(item, JsonValueChange.Add, index);
+ }
+
+ /// <summary>
+ /// Remove the JSON value at a specified index of <see cref="System.Json.JsonArray"/>.
+ /// </summary>
+ /// <param name="index">The zero-based index at which to remove the <see cref="System.Json.JsonValue"/>.</param>
+ /// <exception cref="System.ArgumentOutOfRangeException">If index is less than zero or index
+ /// is equal or larger than the size of the array.</exception>
+ public void RemoveAt(int index)
+ {
+ JsonValue item = values[index];
+ RaiseItemChanging(item, JsonValueChange.Remove, index);
+ values.RemoveAt(index);
+ RaiseItemChanged(item, JsonValueChange.Remove, index);
+ }
+
+ /// <summary>
+ /// Adds a <see cref="System.Json.JsonValue"/> object to the end of the array.
+ /// </summary>
+ /// <param name="item">The <see cref="System.Json.JsonValue"/> object to add.</param>
+ /// <exception cref="System.ArgumentException">If the object to add has a
+ /// <see cref="System.Json.JsonValue.JsonType"/> property of value
+ /// <see cref="F:System.Json.JsonType.Default"/>.</exception>
+ public void Add(JsonValue item)
+ {
+ if (item != null && item.JsonType == JsonType.Default)
+ {
+ throw new ArgumentNullException("item", Properties.Resources.UseOfDefaultNotAllowed);
+ }
+
+ int index = Count;
+ RaiseItemChanging(item, JsonValueChange.Add, index);
+ values.Add(item);
+ RaiseItemChanged(item, JsonValueChange.Add, index);
+ }
+
+ /// <summary>
+ /// Removes all JSON CLR types from the <see cref="System.Json.JsonArray"/>.
+ /// </summary>
+ public void Clear()
+ {
+ RaiseItemChanging(null, JsonValueChange.Clear, 0);
+ values.Clear();
+ RaiseItemChanged(null, JsonValueChange.Clear, 0);
+ }
+
+ /// <summary>
+ /// Checks whether a specified JSON CLR type is in the <see cref="System.Json.JsonArray"/>.
+ /// </summary>
+ /// <param name="item">The <see cref="System.Json.JsonValue"/> to check for in the array.</param>
+ /// <returns>true if item is found in the <see cref="System.Json.JsonArray"/>; otherwise, false.</returns>
+ public bool Contains(JsonValue item)
+ {
+ return values.Contains(item);
+ }
+
+ /// <summary>
+ /// Copies the contents of the current JSON CLR array instance into a specified
+ /// destination array beginning at the specified index.
+ /// </summary>
+ /// <param name="array">The destination array to which the elements of the current
+ /// <see cref="System.Json.JsonArray"/> object are copied.</param>
+ /// <param name="arrayIndex">The zero-based index in the destination array at which the
+ /// copying of the elements of the JSON CLR array begins.</param>
+ public void CopyTo(JsonValue[] array, int arrayIndex)
+ {
+ values.CopyTo(array, arrayIndex);
+ }
+
+ /// <summary>
+ /// Removes the first occurrence of the specified JSON value from the array.
+ /// </summary>
+ /// <param name="item">The <see cref="System.Json.JsonValue"/> to remove from the <see cref="System.Json.JsonArray"/>.</param>
+ /// <returns>true if item is successfully removed; otherwise, false. This method
+ /// also returns false if item was not found in the <see cref="System.Json.JsonArray"/>.</returns>
+ public bool Remove(JsonValue item)
+ {
+ int index = -1;
+ if (ChangingListenersCount > 0 || ChangedListenersCount > 0)
+ {
+ index = IndexOf(item);
+ }
+
+ if (index >= 0)
+ {
+ RaiseItemChanging(item, JsonValueChange.Remove, index);
+ }
+
+ bool result = values.Remove(item);
+ if (index >= 0)
+ {
+ RaiseItemChanged(item, JsonValueChange.Remove, index);
+ }
+
+ return result;
+ }
+
+ /// <summary>
+ /// Returns an enumerator that iterates through the <see cref="System.Json.JsonValue"/> objects in the array.
+ /// </summary>
+ /// <returns>Returns an <see cref="System.Collections.IEnumerator"/> object that
+ /// iterates through the <see cref="System.Json.JsonValue"/> elements in this <see cref="System.Json.JsonArray"/>.</returns>
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return values.GetEnumerator();
+ }
+
+ /// <summary>
+ /// Safe indexer for the <see cref="System.Json.JsonValue"/> type.
+ /// </summary>
+ /// <param name="index">The zero-based index of the element to get.</param>
+ /// <returns>If the index is within the array bounds and the value corresponding to the
+ /// index is not null, then it will return that value. Otherwise it will return a
+ /// <see cref="System.Json.JsonValue"/> instance with <see cref="System.Json.JsonValue.JsonType"/>
+ /// equals to <see cref="F:System.Json.JsonType.Default"/>.</returns>
+ public override JsonValue ValueOrDefault(int index)
+ {
+ if (index >= 0 && index < Count && this[index] != null)
+ {
+ return this[index];
+ }
+
+ return base.ValueOrDefault(index);
+ }
+
+ /// <summary>
+ /// Returns an enumerator that iterates through the <see cref="System.Json.JsonValue"/> objects in the array.
+ /// </summary>
+ /// <returns>Returns an <see cref="System.Collections.Generic.IEnumerator{T}"/> object that
+ /// iterates through the <see cref="System.Json.JsonValue"/> elements in this <see cref="System.Json.JsonArray"/>.</returns>
+ public new IEnumerator<JsonValue> GetEnumerator()
+ {
+ return values.GetEnumerator();
+ }
+
+ /// <summary>
+ /// Returns an enumerator which iterates through the values in this object.
+ /// </summary>
+ /// <returns>An <see cref="System.Collections.Generic.IEnumerator{T}"/> which iterates through the values in this object.</returns>
+ /// <remarks>The enumerator returned by this class contains one pair for each element
+ /// in this array, whose key is the element index (as a string), and the value is the
+ /// element itself.</remarks>
+ protected override IEnumerator<KeyValuePair<string, JsonValue>> GetKeyValuePairEnumerator()
+ {
+ for (int i = 0; i < values.Count; i++)
+ {
+ yield return new KeyValuePair<string, JsonValue>(i.ToString(CultureInfo.InvariantCulture), values[i]);
+ }
+ }
+
+ /// <summary>
+ /// Callback method called to let an instance write the proper JXML attribute when saving this
+ /// instance.
+ /// </summary>
+ /// <param name="jsonWriter">The JXML writer used to write JSON.</param>
+ internal override void WriteAttributeString(XmlDictionaryWriter jsonWriter)
+ {
+ if (jsonWriter == null)
+ {
+ throw new ArgumentNullException("jsonWriter");
+ }
+
+ jsonWriter.WriteAttributeString(JXmlToJsonValueConverter.TypeAttributeName, JXmlToJsonValueConverter.ArrayAttributeValue);
+ }
+
+ /// <summary>
+ /// Callback method called during Save operations to let the instance write the start element
+ /// and return the next element in the collection.
+ /// </summary>
+ /// <param name="jsonWriter">The JXML writer used to write JSON.</param>
+ /// <param name="currentIndex">The index within this collection.</param>
+ /// <returns>The next item in the collection, or null of there are no more items.</returns>
+ internal override JsonValue WriteStartElementAndGetNext(XmlDictionaryWriter jsonWriter, int currentIndex)
+ {
+ if (jsonWriter == null)
+ {
+ throw new ArgumentNullException("jsonWriter");
+ }
+
+ jsonWriter.WriteStartElement(JXmlToJsonValueConverter.ItemElementName);
+ JsonValue nextValue = this[currentIndex];
+ return nextValue;
+ }
+
+ private void RaiseItemChanging(JsonValue child, JsonValueChange change, int index)
+ {
+ if (ChangingListenersCount > 0)
+ {
+ RaiseChangingEvent(this, new JsonValueChangeEventArgs(child, change, index));
+ }
+ }
+
+ private void RaiseItemChanged(JsonValue child, JsonValueChange change, int index)
+ {
+ if (ChangedListenersCount > 0)
+ {
+ RaiseChangedEvent(this, new JsonValueChangeEventArgs(child, change, index));
+ }
+ }
+ }
+}
--- /dev/null
+// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
+
+using System.Collections;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Runtime.Serialization;
+using System.Xml;
+using WrappedPair = System.Json.NGenWrapper<System.Collections.Generic.KeyValuePair<string, System.Json.JsonValue>>;
+
+namespace System.Json
+{
+ /// <summary>
+ /// A JsonObject is an unordered collection of zero or more key/value pairs.
+ /// </summary>
+ /// <remarks>A JsonObject is an unordered collection of zero or more key/value pairs,
+ /// where each key is a String and each value is a <see cref="System.Json.JsonValue"/>, which can be a
+ /// <see cref="System.Json.JsonPrimitive"/>, a <see cref="System.Json.JsonArray"/>, or a JsonObject.</remarks>
+ [SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix",
+ Justification = "Object in the context of JSON already conveys the meaning of dictionary")]
+ [DataContract]
+ public sealed class JsonObject : JsonValue, IDictionary<string, JsonValue>
+ {
+ [DataMember]
+ private Dictionary<string, JsonValue> values = new Dictionary<string, JsonValue>(StringComparer.Ordinal);
+
+ private List<WrappedPair> indexedPairs;
+ private int instanceSaveCount;
+ private object saveLock = new object();
+
+ /// <summary>
+ /// Creates an instance of the <see cref="System.Json.JsonObject"/> class initialized with an
+ /// <see cref="System.Collections.Generic.IEnumerable{T}"/> collection of key/value pairs.
+ /// </summary>
+ /// <param name="items">The <see cref="System.Collections.Generic.IEnumerable{T}"/> collection of
+ /// <see cref="System.Collections.Generic.KeyValuePair{K, V}"/> used to initialize the
+ /// key/value pairs</param>
+ /// <exception cref="System.ArgumentNullException">If items is null.</exception>
+ /// <exception cref="System.ArgumentException">If any of the values in the collection
+ /// is a <see cref="System.Json.JsonValue"/> with <see cref="System.Json.JsonValue.JsonType"/> property of
+ /// value <see cref="F:System.Json.JsonType.Default"/>.</exception>
+ [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures",
+ Justification = "There's no complexity using this design because nested generic type is atomic type not another collection")]
+ public JsonObject(IEnumerable<KeyValuePair<string, JsonValue>> items)
+ {
+ AddRange(items);
+ }
+
+ /// <summary>
+ /// Creates an instance of the <see cref="System.Json.JsonObject"/> class initialized with a collection of key/value pairs.
+ /// </summary>
+ /// <param name="items">The <see cref="System.Collections.Generic.KeyValuePair{K, V}"/> objects used to initialize the key/value pairs.</param>
+ /// <exception cref="System.ArgumentException">If any of the values in the collection
+ /// is a <see cref="System.Json.JsonValue"/> with <see cref="System.Json.JsonValue.JsonType"/> property of
+ /// value <see cref="F:System.Json.JsonType.Default"/>.</exception>
+ public JsonObject(params KeyValuePair<string, JsonValue>[] items)
+ {
+ if (items != null)
+ {
+ AddRange(items);
+ }
+ }
+
+ /// <summary>
+ /// Gets the JSON type of this <see cref="System.Json.JsonObject"/>. The return value
+ /// is always <see cref="F:System.Json.JsonType.Object"/>.
+ /// </summary>
+ public override JsonType JsonType
+ {
+ get { return JsonType.Object; }
+ }
+
+ /// <summary>
+ /// Gets a collection that contains the keys in this <see cref="System.Json.JsonObject"/>.
+ /// </summary>
+ public ICollection<string> Keys
+ {
+ get { return values.Keys; }
+ }
+
+ /// <summary>
+ /// Gets a collection that contains the values in this <see cref="System.Json.JsonObject"/>.
+ /// </summary>
+ public ICollection<JsonValue> Values
+ {
+ get { return values.Values; }
+ }
+
+ /// <summary>
+ /// Returns the number of key/value pairs in this <see cref="System.Json.JsonObject"/>.
+ /// </summary>
+ public override int Count
+ {
+ get { return values.Count; }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether this JSON CLR object is read-only.
+ /// </summary>
+ bool ICollection<KeyValuePair<string, JsonValue>>.IsReadOnly
+ {
+ get { return ((ICollection<KeyValuePair<string, JsonValue>>)values).IsReadOnly; }
+ }
+
+ /// <summary>
+ /// Gets or sets the value associated with the specified key.
+ /// </summary>
+ /// <param name="key">The key of the value to get or set.</param>
+ /// <returns>The <see cref="System.Json.JsonValue"/> associated to the specified key.</returns>
+ /// <exception cref="System.ArgumentNullException">If key is null.</exception>
+ /// <exception cref="System.ArgumentException">The property is set and the value is a
+ /// <see cref="System.Json.JsonValue"/> with <see cref="System.Json.JsonValue.JsonType"/>
+ /// property of value <see cref="F:System.Json.JsonType.Default"/>.</exception>
+ public override JsonValue this[string key]
+ {
+ get
+ {
+ if (key == null)
+ {
+ throw new ArgumentNullException("key");
+ }
+
+ return values[key];
+ }
+
+ set
+ {
+ if (value != null && value.JsonType == JsonType.Default)
+ {
+ throw new ArgumentNullException("value", Properties.Resources.UseOfDefaultNotAllowed);
+ }
+
+ if (key == null)
+ {
+ throw new ArgumentNullException("key");
+ }
+
+ bool replacement = values.ContainsKey(key);
+ JsonValue oldValue = null;
+ if (replacement)
+ {
+ oldValue = values[key];
+ RaiseItemChanging(value, JsonValueChange.Replace, key);
+ }
+ else
+ {
+ RaiseItemChanging(value, JsonValueChange.Add, key);
+ }
+
+ values[key] = value;
+ if (replacement)
+ {
+ RaiseItemChanged(oldValue, JsonValueChange.Replace, key);
+ }
+ else
+ {
+ RaiseItemChanged(value, JsonValueChange.Add, key);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Safe string indexer for the <see cref="System.Json.JsonValue"/> type.
+ /// </summary>
+ /// <param name="key">The key of the element to get.</param>
+ /// <returns>If this instance contains the given key and the value corresponding to
+ /// the key is not null, then it will return that value. Otherwise it will return a
+ /// <see cref="System.Json.JsonValue"/> instance with <see cref="System.Json.JsonValue.JsonType"/>
+ /// equals to <see cref="F:System.Json.JsonType.Default"/>.</returns>
+ public override JsonValue ValueOrDefault(string key)
+ {
+ if (key != null && ContainsKey(key) && this[key] != null)
+ {
+ return this[key];
+ }
+
+ return base.ValueOrDefault(key);
+ }
+
+ /// <summary>
+ /// Adds a specified collection of key/value pairs to this instance.
+ /// </summary>
+ /// <param name="items">The collection of key/value pairs to add.</param>
+ /// <exception cref="System.ArgumentNullException">If items is null.</exception>
+ /// <exception cref="System.ArgumentException">If the value of any of the items in the collection
+ /// is a <see cref="System.Json.JsonValue"/> with <see cref="System.Json.JsonValue.JsonType"/> property of
+ /// value <see cref="F:System.Json.JsonType.Default"/>.</exception>
+ [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures",
+ Justification = "There's no complexity using this design because nested generic type is atomic type not another collection")]
+ public void AddRange(IEnumerable<KeyValuePair<string, JsonValue>> items)
+ {
+ if (items == null)
+ {
+ throw new ArgumentNullException("items");
+ }
+
+ if (ChangingListenersCount > 0)
+ {
+ foreach (KeyValuePair<string, JsonValue> item in items)
+ {
+ RaiseItemChanging(item.Value, JsonValueChange.Add, item.Key);
+ }
+ }
+
+ foreach (KeyValuePair<string, JsonValue> item in items)
+ {
+ if (item.Value != null && item.Value.JsonType == JsonType.Default)
+ {
+ throw new ArgumentNullException("items", Properties.Resources.UseOfDefaultNotAllowed);
+ }
+
+ values.Add(item.Key, item.Value);
+ RaiseItemChanged(item.Value, JsonValueChange.Add, item.Key);
+ }
+ }
+
+ /// <summary>
+ /// Adds the elements from an array of type <see cref="System.Json.JsonValue"/> to this instance.
+ /// </summary>
+ /// <param name="items">The array of key/value paris to be added to this instance.</param>
+ /// <exception cref="System.ArgumentException">If the value of any of the items in the array
+ /// is a <see cref="System.Json.JsonValue"/> with <see cref="System.Json.JsonValue.JsonType"/> property of
+ /// value <see cref="F:System.Json.JsonType.Default"/>.</exception>
+ public void AddRange(params KeyValuePair<string, JsonValue>[] items)
+ {
+ AddRange(items as IEnumerable<KeyValuePair<string, JsonValue>>);
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <returns></returns>
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return ((IEnumerable)values).GetEnumerator();
+ }
+
+ /// <summary>
+ /// Adds a key/value pair to this <see cref="System.Json.JsonObject"/> instance.
+ /// </summary>
+ /// <param name="key">The key for the element added.</param>
+ /// <param name="value">The <see cref="System.Json.JsonValue"/> for the element added.</param>
+ /// <exception cref="System.ArgumentException">If the value is a <see cref="System.Json.JsonValue"/>
+ /// with <see cref="System.Json.JsonValue.JsonType"/> property of
+ /// value <see cref="F:System.Json.JsonType.Default"/>.</exception>
+ public void Add(string key, JsonValue value)
+ {
+ if (value != null && value.JsonType == JsonType.Default)
+ {
+ throw new ArgumentNullException("value", Properties.Resources.UseOfDefaultNotAllowed);
+ }
+
+ RaiseItemChanging(value, JsonValueChange.Add, key);
+ values.Add(key, value);
+ RaiseItemChanged(value, JsonValueChange.Add, key);
+ }
+
+ /// <summary>
+ /// Adds a key/value pair to this <see cref="System.Json.JsonObject"/> instance.
+ /// </summary>
+ /// <param name="item">The key/value pair to be added.</param>
+ /// <exception cref="System.ArgumentException">If the value of the pair is a
+ /// <see cref="System.Json.JsonValue"/> with <see cref="System.Json.JsonValue.JsonType"/>
+ /// property of value <see cref="F:System.Json.JsonType.Default"/>.</exception>
+ public void Add(KeyValuePair<string, JsonValue> item)
+ {
+ Add(item.Key, item.Value);
+ }
+
+ /// <summary>
+ /// Checks whether a key/value pair with a specified key exists in this <see cref="System.Json.JsonObject"/> instance.
+ /// </summary>
+ /// <param name="key">The key to check for.</param>
+ /// <returns>true if this instance contains the key; otherwise, false.</returns>
+ public override bool ContainsKey(string key)
+ {
+ return values.ContainsKey(key);
+ }
+
+ /// <summary>
+ /// Removes the key/value pair with a specified key from this <see cref="System.Json.JsonObject"/> instance.
+ /// </summary>
+ /// <param name="key">The key of the item to remove.</param>
+ /// <returns>true if the element is successfully found and removed; otherwise, false.
+ /// This method returns false if key is not found in this <see cref="System.Json.JsonObject"/> instance.</returns>
+ public bool Remove(string key)
+ {
+ JsonValue original = null;
+ bool containsKey = false;
+ if (ChangingListenersCount > 0 || ChangedListenersCount > 0)
+ {
+ containsKey = TryGetValue(key, out original);
+ }
+
+ if (containsKey && ChangingListenersCount > 0)
+ {
+ RaiseItemChanging(original, JsonValueChange.Remove, key);
+ }
+
+ bool result = values.Remove(key);
+
+ if (containsKey && ChangedListenersCount > 0)
+ {
+ RaiseItemChanged(original, JsonValueChange.Remove, key);
+ }
+
+ return result;
+ }
+
+ /// <summary>
+ /// Attempts to get the value that corresponds to the specified key.
+ /// </summary>
+ /// <param name="key">The key of the value to retrieve.</param>
+ /// <param name="value">The primitive or structured <see cref="System.Json.JsonValue"/> object that has the key
+ /// specified. If this object does not contain a key/value pair with the given key,
+ /// this parameter is set to null.</param>
+ /// <returns>true if the instance of the <see cref="System.Json.JsonObject"/> contains an element with the
+ /// specified key; otherwise, false.</returns>
+ public bool TryGetValue(string key, out JsonValue value)
+ {
+ return values.TryGetValue(key, out value);
+ }
+
+ /// <summary>
+ /// Removes all key/value pairs from this <see cref="System.Json.JsonObject"/> instance.
+ /// </summary>
+ public void Clear()
+ {
+ RaiseItemChanging(null, JsonValueChange.Clear, null);
+ values.Clear();
+ RaiseItemChanged(null, JsonValueChange.Clear, null);
+ }
+
+ bool ICollection<KeyValuePair<string, JsonValue>>.Contains(KeyValuePair<string, JsonValue> item)
+ {
+ return ((ICollection<KeyValuePair<string, JsonValue>>)values).Contains(item);
+ }
+
+ /// <summary>
+ /// Copies the contents of this <see cref="System.Json.JsonObject"/> instance into a specified
+ /// key/value destination array beginning at a specified index.
+ /// </summary>
+ /// <param name="array">The destination array of type <see cref="System.Collections.Generic.KeyValuePair{K, V}"/>
+ /// to which the elements of this <see cref="System.Json.JsonObject"/> are copied.</param>
+ /// <param name="arrayIndex">The zero-based index at which to begin the insertion of the
+ /// contents from this <see cref="System.Json.JsonObject"/> instance.</param>
+ public void CopyTo(KeyValuePair<string, JsonValue>[] array, int arrayIndex)
+ {
+ ((ICollection<KeyValuePair<string, JsonValue>>)values).CopyTo(array, arrayIndex);
+ }
+
+ bool ICollection<KeyValuePair<string, JsonValue>>.Remove(KeyValuePair<string, JsonValue> item)
+ {
+ if (ChangingListenersCount > 0)
+ {
+ if (ContainsKey(item.Key) && EqualityComparer<JsonValue>.Default.Equals(item.Value, values[item.Key]))
+ {
+ RaiseItemChanging(item.Value, JsonValueChange.Remove, item.Key);
+ }
+ }
+
+ bool result = ((ICollection<KeyValuePair<string, JsonValue>>)values).Remove(item);
+ if (result)
+ {
+ RaiseItemChanged(item.Value, JsonValueChange.Remove, item.Key);
+ }
+
+ return result;
+ }
+
+ /// <summary>
+ /// Returns an enumerator over the key/value pairs contained in this <see cref="System.Json.JsonObject"/> instance.
+ /// </summary>
+ /// <returns>An <see cref="System.Collections.Generic.IEnumerator{T}"/> which iterates
+ /// through the members of this instance.</returns>
+ protected override IEnumerator<KeyValuePair<string, JsonValue>> GetKeyValuePairEnumerator()
+ {
+ return values.GetEnumerator();
+ }
+
+ /// <summary>
+ /// Callback method called when a Save operation is starting for this instance.
+ /// </summary>
+ protected override void OnSaveStarted()
+ {
+ lock (saveLock)
+ {
+ instanceSaveCount++;
+ if (indexedPairs == null)
+ {
+ indexedPairs = new List<WrappedPair>();
+
+ foreach (KeyValuePair<string, JsonValue> item in values)
+ {
+ indexedPairs.Add(new WrappedPair(item));
+ }
+ }
+ }
+ }
+
+ /// <summary>
+ /// Callback method called when a Save operation is finished for this instance.
+ /// </summary>
+ protected override void OnSaveEnded()
+ {
+ lock (saveLock)
+ {
+ instanceSaveCount--;
+ if (instanceSaveCount == 0)
+ {
+ indexedPairs = null;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Callback method called to let an instance write the proper JXML attribute when saving this
+ /// instance.
+ /// </summary>
+ /// <param name="jsonWriter">The JXML writer used to write JSON.</param>
+ internal override void WriteAttributeString(XmlDictionaryWriter jsonWriter)
+ {
+ jsonWriter.WriteAttributeString(JXmlToJsonValueConverter.TypeAttributeName, JXmlToJsonValueConverter.ObjectAttributeValue);
+ }
+
+ /// <summary>
+ /// Callback method called during Save operations to let the instance write the start element
+ /// and return the next element in the collection.
+ /// </summary>
+ /// <param name="jsonWriter">The JXML writer used to write JSON.</param>
+ /// <param name="currentIndex">The index within this collection.</param>
+ /// <returns>The next item in the collection, or null of there are no more items.</returns>
+ internal override JsonValue WriteStartElementAndGetNext(XmlDictionaryWriter jsonWriter, int currentIndex)
+ {
+ KeyValuePair<string, JsonValue> currentPair = indexedPairs[currentIndex];
+ string currentKey = currentPair.Key;
+
+ if (currentKey.Length == 0)
+ {
+ // special case in JXML world
+ jsonWriter.WriteStartElement(JXmlToJsonValueConverter.ItemElementName, JXmlToJsonValueConverter.ItemElementName);
+ jsonWriter.WriteAttributeString(JXmlToJsonValueConverter.ItemElementName, String.Empty);
+ }
+ else
+ {
+ jsonWriter.WriteStartElement(currentKey);
+ }
+
+ return currentPair.Value;
+ }
+
+ [SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", Justification = "Context is required by CLR for this to work.")]
+ [OnDeserialized]
+ private void OnDeserialized(StreamingContext context)
+ {
+ saveLock = new object();
+ }
+
+ private void RaiseItemChanging(JsonValue child, JsonValueChange change, string key)
+ {
+ if (ChangingListenersCount > 0)
+ {
+ RaiseChangingEvent(this, new JsonValueChangeEventArgs(child, change, key));
+ }
+ }
+
+ private void RaiseItemChanged(JsonValue child, JsonValueChange change, string key)
+ {
+ if (ChangedListenersCount > 0)
+ {
+ RaiseChangedEvent(this, new JsonValueChangeEventArgs(child, change, key));
+ }
+ }
+ }
+}
--- /dev/null
+// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
+
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Diagnostics.Contracts;
+using System.Globalization;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Xml;
+
+namespace System.Json
+{
+ /// <summary>
+ /// Represents a JavaScript Object Notation (JSON) primitive type in the common language runtime (CLR).
+ /// </summary>
+ [SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix",
+ Justification = "JsonPrimitive does not represent a collection.")]
+ [DataContract]
+ public sealed class JsonPrimitive : JsonValue
+ {
+ internal const string DateTimeIsoFormat = "yyyy-MM-ddTHH:mm:ss.fffK";
+ private const string UtcString = "UTC";
+ private const string GmtString = "GMT";
+ private static readonly long UnixEpochTicks = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).Ticks;
+ private static readonly char[] FloatingPointChars = new char[] { '.', 'e', 'E' };
+ private static readonly Type jsonPrimitiveType = typeof(JsonPrimitive);
+ private static readonly Type uriType = typeof(Uri);
+
+ private static readonly Dictionary<Type, Func<string, ConvertResult>> stringConverters = new Dictionary<Type, Func<string, ConvertResult>>
+ {
+ { typeof(bool), new Func<string, ConvertResult>(StringToBool) },
+ { typeof(byte), new Func<string, ConvertResult>(StringToByte) },
+ { typeof(char), new Func<string, ConvertResult>(StringToChar) },
+ { typeof(sbyte), new Func<string, ConvertResult>(StringToSByte) },
+ { typeof(short), new Func<string, ConvertResult>(StringToShort) },
+ { typeof(int), new Func<string, ConvertResult>(StringToInt) },
+ { typeof(long), new Func<string, ConvertResult>(StringToLong) },
+ { typeof(ushort), new Func<string, ConvertResult>(StringToUShort) },
+ { typeof(uint), new Func<string, ConvertResult>(StringToUInt) },
+ { typeof(ulong), new Func<string, ConvertResult>(StringToULong) },
+ { typeof(float), new Func<string, ConvertResult>(StringToFloat) },
+ { typeof(double), new Func<string, ConvertResult>(StringToDouble) },
+ { typeof(decimal), new Func<string, ConvertResult>(StringToDecimal) },
+ { typeof(DateTime), new Func<string, ConvertResult>(StringToDateTime) },
+ { typeof(DateTimeOffset), new Func<string, ConvertResult>(StringToDateTimeOffset) },
+ { typeof(Guid), new Func<string, ConvertResult>(StringToGuid) },
+ { typeof(Uri), new Func<string, ConvertResult>(StringToUri) },
+ };
+
+ [DataMember]
+ private object value;
+
+ [DataMember]
+ private JsonType jsonType;
+
+ /// <summary>
+ /// Initializes a new instance of a <see cref="System.Json.JsonPrimitive"/> type with a <see cref="System.Boolean"/> type.
+ /// </summary>
+ /// <param name="value">The <see cref="System.Boolean"/> object that initializes the new instance.</param>
+ /// <remarks>A <see cref="System.Json.JsonPrimitive"/> object stores a <see cref="System.Json.JsonType"/> and the value used to initialize it.
+ /// When initialized with a <see cref="System.Boolean"/> object, the <see cref="System.Json.JsonType"/> is a <see cref="F:System.Json.JsonType.Boolean"/>, which can be
+ /// recovered using the <see cref="System.Json.JsonPrimitive.JsonType"/> property. The value used to initialize the <see cref="System.Json.JsonPrimitive"/>
+ /// object can be recovered by casting the <see cref="System.Json.JsonPrimitive"/> to <see cref="System.Boolean"/>.</remarks>
+ public JsonPrimitive(bool value)
+ {
+ jsonType = JsonType.Boolean;
+ this.value = value;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of a <see cref="System.Json.JsonPrimitive"/> type with a <see cref="System.Byte"/> type.
+ /// </summary>
+ /// <param name="value">The <see cref="System.Byte"/> object that initializes the new instance.</param>
+ /// <remarks>A <see cref="System.Json.JsonPrimitive"/> object stores a <see cref="System.Json.JsonType"/> and the value used to initialize it.
+ /// When initialized with a <see cref="System.Byte"/> object, the <see cref="System.Json.JsonType"/> is a <see cref="F:System.Json.JsonType.Number"/>, which can be
+ /// recovered using the <see cref="System.Json.JsonPrimitive.JsonType"/> property. The value used to initialize the <see cref="System.Json.JsonPrimitive"/>
+ /// object can be recovered by casting the <see cref="System.Json.JsonPrimitive"/> to <see cref="System.Byte"/>.</remarks>
+ public JsonPrimitive(byte value)
+ {
+ jsonType = JsonType.Number;
+ this.value = value;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of a <see cref="System.Json.JsonPrimitive"/> type with a <see cref="System.SByte"/> type.
+ /// </summary>
+ /// <param name="value">The <see cref="System.SByte"/> object that initializes the new instance.</param>
+ /// <remarks>A <see cref="System.Json.JsonPrimitive"/> object stores a <see cref="System.Json.JsonType"/> and the value used to initialize it.
+ /// When initialized with a <see cref="System.SByte"/> object, the <see cref="System.Json.JsonType"/> is a <see cref="F:System.Json.JsonType.Number"/>, which can be
+ /// recovered using the <see cref="System.Json.JsonPrimitive.JsonType"/> property. The value used to initialize the <see cref="System.Json.JsonPrimitive"/>
+ /// object can be recovered by casting the <see cref="System.Json.JsonPrimitive"/> to <see cref="System.SByte"/>.</remarks>
+ [CLSCompliant(false)]
+ public JsonPrimitive(sbyte value)
+ {
+ jsonType = JsonType.Number;
+ this.value = value;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of a <see cref="System.Json.JsonPrimitive"/> type with a <see cref="System.Decimal"/> type.
+ /// </summary>
+ /// <param name="value">The <see cref="System.Decimal"/> object that initializes the new instance.</param>
+ /// <remarks>A <see cref="System.Json.JsonPrimitive"/> object stores a <see cref="System.Json.JsonType"/> and the value used to initialize it.
+ /// When initialized with a <see cref="System.Decimal"/> object, the <see cref="System.Json.JsonType"/> is a <see cref="F:System.Json.JsonType.Number"/>, which can be
+ /// recovered using the <see cref="System.Json.JsonPrimitive.JsonType"/> property. The value used to initialize the <see cref="System.Json.JsonPrimitive"/>
+ /// object can be recovered by casting the <see cref="System.Json.JsonPrimitive"/> to <see cref="System.Decimal"/>.</remarks>
+ public JsonPrimitive(decimal value)
+ {
+ jsonType = JsonType.Number;
+ this.value = value;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of a <see cref="System.Json.JsonPrimitive"/> type with a <see cref="System.Int16"/> type.
+ /// </summary>
+ /// <param name="value">The <see cref="System.Int16"/> object that initializes the new instance.</param>
+ /// <remarks>A <see cref="System.Json.JsonPrimitive"/> object stores a <see cref="System.Json.JsonType"/> and the value used to initialize it.
+ /// When initialized with a <see cref="System.Int16"/> object, the <see cref="System.Json.JsonType"/> is a <see cref="F:System.Json.JsonType.Number"/>, which can be
+ /// recovered using the <see cref="System.Json.JsonPrimitive.JsonType"/> property. The value used to initialize the <see cref="System.Json.JsonPrimitive"/>
+ /// object can be recovered by casting the <see cref="System.Json.JsonPrimitive"/> to <see cref="System.Int16"/>.</remarks>
+ public JsonPrimitive(short value)
+ {
+ jsonType = JsonType.Number;
+ this.value = value;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of a <see cref="System.Json.JsonPrimitive"/> type with a <see cref="System.UInt16"/> type.
+ /// </summary>
+ /// <param name="value">The <see cref="System.UInt16"/> object that initializes the new instance.</param>
+ /// <remarks>A <see cref="System.Json.JsonPrimitive"/> object stores a <see cref="System.Json.JsonType"/> and the value used to initialize it.
+ /// When initialized with a <see cref="System.UInt16"/> object, the <see cref="System.Json.JsonType"/> is a <see cref="F:System.Json.JsonType.Number"/>, which can be
+ /// recovered using the <see cref="System.Json.JsonPrimitive.JsonType"/> property. The value used to initialize the <see cref="System.Json.JsonPrimitive"/>
+ /// object can be recovered by casting the <see cref="System.Json.JsonPrimitive"/> to <see cref="System.UInt16"/>.</remarks>
+ [CLSCompliant(false)]
+ public JsonPrimitive(ushort value)
+ {
+ jsonType = JsonType.Number;
+ this.value = value;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of a <see cref="System.Json.JsonPrimitive"/> type with a <see cref="System.Int32"/> type.
+ /// </summary>
+ /// <param name="value">The <see cref="System.Int32"/> object that initializes the new instance.</param>
+ /// <remarks>A <see cref="System.Json.JsonPrimitive"/> object stores a <see cref="System.Json.JsonType"/> and the value used to initialize it.
+ /// When initialized with a <see cref="System.Int32"/> object, the <see cref="System.Json.JsonType"/> is a <see cref="F:System.Json.JsonType.Number"/>, which can be
+ /// recovered using the <see cref="System.Json.JsonPrimitive.JsonType"/> property. The value used to initialize the <see cref="System.Json.JsonPrimitive"/>
+ /// object can be recovered by casting the <see cref="System.Json.JsonPrimitive"/> to <see cref="System.Int32"/>.</remarks>
+ public JsonPrimitive(int value)
+ {
+ jsonType = JsonType.Number;
+ this.value = value;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of a <see cref="System.Json.JsonPrimitive"/> type with a <see cref="System.UInt32"/> type.
+ /// </summary>
+ /// <param name="value">The <see cref="System.UInt32"/> object that initializes the new instance.</param>
+ /// <remarks>A <see cref="System.Json.JsonPrimitive"/> object stores a <see cref="System.Json.JsonType"/> and the value used to initialize it.
+ /// When initialized with a <see cref="System.UInt32"/> object, the <see cref="System.Json.JsonType"/> is a <see cref="F:System.Json.JsonType.Number"/>, which can be
+ /// recovered using the <see cref="System.Json.JsonPrimitive.JsonType"/> property. The value used to initialize the <see cref="System.Json.JsonPrimitive"/>
+ /// object can be recovered by casting the <see cref="System.Json.JsonPrimitive"/> to <see cref="System.UInt32"/>.</remarks>
+ [CLSCompliant(false)]
+ public JsonPrimitive(uint value)
+ {
+ jsonType = JsonType.Number;
+ this.value = value;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of a <see cref="System.Json.JsonPrimitive"/> type with a <see cref="System.Int64"/> type.
+ /// </summary>
+ /// <param name="value">The <see cref="System.Int64"/> object that initializes the new instance.</param>
+ /// <remarks>A <see cref="System.Json.JsonPrimitive"/> object stores a <see cref="System.Json.JsonType"/> and the value used to initialize it.
+ /// When initialized with a <see cref="System.Int64"/> object, the <see cref="System.Json.JsonType"/> is a <see cref="F:System.Json.JsonType.Number"/>, which can be
+ /// recovered using the <see cref="System.Json.JsonPrimitive.JsonType"/> property. The value used to initialize the <see cref="System.Json.JsonPrimitive"/>
+ /// object can be recovered by casting the <see cref="System.Json.JsonPrimitive"/> to <see cref="System.Int64"/>.</remarks>
+ public JsonPrimitive(long value)
+ {
+ jsonType = JsonType.Number;
+ this.value = value;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of a <see cref="System.Json.JsonPrimitive"/> type with a <see cref="System.UInt64"/> type.
+ /// </summary>
+ /// <param name="value">The <see cref="System.UInt64"/> object that initializes the new instance.</param>
+ /// <remarks>A <see cref="System.Json.JsonPrimitive"/> object stores a <see cref="System.Json.JsonType"/> and the value used to initialize it.
+ /// When initialized with a <see cref="System.UInt64"/> object, the <see cref="System.Json.JsonType"/> is a <see cref="F:System.Json.JsonType.Number"/>, which can be
+ /// recovered using the <see cref="System.Json.JsonPrimitive.JsonType"/> property. The value used to initialize the <see cref="System.Json.JsonPrimitive"/>
+ /// object can be recovered by casting the <see cref="System.Json.JsonPrimitive"/> to <see cref="System.UInt64"/>.</remarks>
+ [CLSCompliant(false)]
+ public JsonPrimitive(ulong value)
+ {
+ jsonType = JsonType.Number;
+ this.value = value;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of a <see cref="System.Json.JsonPrimitive"/> type with a <see cref="System.Single"/> type.
+ /// </summary>
+ /// <param name="value">The <see cref="System.Single"/> object that initializes the new instance.</param>
+ /// <remarks>A <see cref="System.Json.JsonPrimitive"/> object stores a <see cref="System.Json.JsonType"/> and the value used to initialize it.
+ /// When initialized with a <see cref="System.Single"/> object, the <see cref="System.Json.JsonType"/> is a <see cref="F:System.Json.JsonType.Number"/>, which can be
+ /// recovered using the <see cref="System.Json.JsonPrimitive.JsonType"/> property. The value used to initialize the <see cref="System.Json.JsonPrimitive"/>
+ /// object can be recovered by casting the <see cref="System.Json.JsonPrimitive"/> to <see cref="System.Single"/>.</remarks>
+ public JsonPrimitive(float value)
+ {
+ jsonType = JsonType.Number;
+ this.value = value;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of a <see cref="System.Json.JsonPrimitive"/> type with a <see cref="System.Double"/> type.
+ /// </summary>
+ /// <param name="value">The <see cref="System.Double"/> object that initializes the new instance.</param>
+ /// <remarks>A <see cref="System.Json.JsonPrimitive"/> object stores a <see cref="System.Json.JsonType"/> and the value used to initialize it.
+ /// When initialized with a <see cref="System.Double"/> object, the <see cref="System.Json.JsonType"/> is a <see cref="F:System.Json.JsonType.Number"/>, which can be
+ /// recovered using the <see cref="System.Json.JsonPrimitive.JsonType"/> property. The value used to initialize the <see cref="System.Json.JsonPrimitive"/>
+ /// object can be recovered by casting the <see cref="System.Json.JsonPrimitive"/> to <see cref="System.Double"/>.</remarks>
+ public JsonPrimitive(double value)
+ {
+ jsonType = JsonType.Number;
+ this.value = value;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of a <see cref="System.Json.JsonPrimitive"/> type with a <see cref="System.String"/> type.
+ /// </summary>
+ /// <param name="value">The <see cref="System.String"/> object that initializes the new instance.</param>
+ /// <remarks>A <see cref="System.Json.JsonPrimitive"/> object stores a <see cref="System.Json.JsonType"/> and the value used to initialize it.
+ /// When initialized with a <see cref="System.String"/> object, the <see cref="System.Json.JsonType"/> is a <see cref="F:System.Json.JsonType.String"/>, which can be
+ /// recovered using the <see cref="System.Json.JsonPrimitive.JsonType"/> property. The value used to initialize the <see cref="System.Json.JsonPrimitive"/>
+ /// object can be recovered by casting the <see cref="System.Json.JsonPrimitive"/> to <see cref="System.String"/>.</remarks>
+ /// <exception cref="System.ArgumentNullException">value is null.</exception>
+ [SuppressMessage("Microsoft.Design", "CA1057:StringUriOverloadsCallSystemUriOverloads",
+ Justification = "This operator does not intend to represent a Uri overload.")]
+ public JsonPrimitive(string value)
+ {
+ if (value == null)
+ {
+ throw new ArgumentNullException("value");
+ }
+
+ jsonType = JsonType.String;
+ this.value = value;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of a <see cref="System.Json.JsonPrimitive"/> type with a <see cref="System.Char"/> type.
+ /// </summary>
+ /// <param name="value">The <see cref="System.Char"/> object that initializes the new instance.</param>
+ /// <remarks>A <see cref="System.Json.JsonPrimitive"/> object stores a <see cref="System.Json.JsonType"/> and the value used to initialize it.
+ /// When initialized with a <see cref="System.Char"/> object, the <see cref="System.Json.JsonType"/> is a <see cref="F:System.Json.JsonType.String"/>, which can be
+ /// recovered using the <see cref="System.Json.JsonPrimitive.JsonType"/> property. The value used to initialize the <see cref="System.Json.JsonPrimitive"/>
+ /// object can be recovered by casting the <see cref="System.Json.JsonPrimitive"/> to <see cref="System.Char"/>.</remarks>
+ public JsonPrimitive(char value)
+ {
+ jsonType = JsonType.String;
+ this.value = value;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of a <see cref="System.Json.JsonPrimitive"/> type with a <see cref="System.DateTime"/> type.
+ /// </summary>
+ /// <param name="value">The <see cref="System.DateTime"/> object that initializes the new instance.</param>
+ /// <remarks>A <see cref="System.Json.JsonPrimitive"/> object stores a <see cref="System.Json.JsonType"/> and the value used to initialize it.
+ /// When initialized with a <see cref="System.DateTime"/> object, the <see cref="System.Json.JsonType"/> is a <see cref="F:System.Json.JsonType.String"/>, which can be
+ /// recovered using the <see cref="System.Json.JsonPrimitive.JsonType"/> property. The value used to initialize the <see cref="System.Json.JsonPrimitive"/>
+ /// object can be recovered by casting the <see cref="System.Json.JsonPrimitive"/> to <see cref="System.DateTime"/>.</remarks>
+ public JsonPrimitive(DateTime value)
+ {
+ jsonType = JsonType.String;
+ this.value = value;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of a <see cref="System.Json.JsonPrimitive"/> type with a <see cref="System.DateTimeOffset"/> type.
+ /// </summary>
+ /// <param name="value">The <see cref="System.DateTimeOffset"/> object that initializes the new instance.</param>
+ /// <remarks>A <see cref="System.Json.JsonPrimitive"/> object stores a <see cref="System.Json.JsonType"/> and the value used to initialize it.
+ /// When initialized with a <see cref="System.DateTimeOffset"/> object, the <see cref="System.Json.JsonType"/> is a <see cref="F:System.Json.JsonType.String"/>, which can be
+ /// recovered using the <see cref="System.Json.JsonPrimitive.JsonType"/> property. The value used to initialize the <see cref="System.Json.JsonPrimitive"/>
+ /// object can be recovered by casting the <see cref="System.Json.JsonPrimitive"/> to <see cref="System.DateTimeOffset"/>.</remarks>
+ public JsonPrimitive(DateTimeOffset value)
+ {
+ jsonType = JsonType.String;
+ this.value = value;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of a <see cref="System.Json.JsonPrimitive"/> type with a <see cref="System.Uri"/> type.
+ /// </summary>
+ /// <param name="value">The <see cref="System.Uri"/> object that initializes the new instance.</param>
+ /// <remarks>A <see cref="System.Json.JsonPrimitive"/> object stores a <see cref="System.Json.JsonType"/> and the value used to initialize it.
+ /// When initialized with a <see cref="System.Uri"/> object, the <see cref="System.Json.JsonType"/> is a <see cref="F:System.Json.JsonType.String"/>, which can be
+ /// recovered using the <see cref="System.Json.JsonPrimitive.JsonType"/> property. The value used to initialize the <see cref="System.Json.JsonPrimitive"/>
+ /// object can be recovered by casting the <see cref="System.Json.JsonPrimitive"/> to <see cref="System.Uri"/>.</remarks>
+ /// <exception cref="System.ArgumentNullException">value is null.</exception>
+ public JsonPrimitive(Uri value)
+ {
+ if (value == null)
+ {
+ throw new ArgumentNullException("value");
+ }
+
+ jsonType = JsonType.String;
+ this.value = value;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of a <see cref="System.Json.JsonPrimitive"/> type with a <see cref="System.Guid"/> type.
+ /// </summary>
+ /// <param name="value">The <see cref="System.Guid"/> object that initializes the new instance.</param>
+ /// <remarks>A <see cref="System.Json.JsonPrimitive"/> object stores a <see cref="System.Json.JsonType"/> and the value used to initialize it.
+ /// When initialized with a <see cref="System.Guid"/> object, the <see cref="System.Json.JsonType"/> is a <see cref="F:System.Json.JsonType.String"/>, which can be
+ /// recovered using the <see cref="System.Json.JsonPrimitive.JsonType"/> property. The value used to initialize the <see cref="System.Json.JsonPrimitive"/>
+ /// object can be recovered by casting the <see cref="System.Json.JsonPrimitive"/> to <see cref="System.Guid"/>.</remarks>
+ public JsonPrimitive(Guid value)
+ {
+ jsonType = JsonType.String;
+ this.value = value;
+ }
+
+ private JsonPrimitive(object value, JsonType type)
+ {
+ jsonType = type;
+ this.value = value;
+ }
+
+ private enum ReadAsFailureKind
+ {
+ NoFailure,
+ InvalidCast,
+ InvalidDateFormat,
+ InvalidFormat,
+ InvalidUriFormat,
+ Overflow,
+ }
+
+ /// <summary>
+ /// Gets the JsonType that is associated with this <see cref="System.Json.JsonPrimitive"/> object.
+ /// </summary>
+ public override JsonType JsonType
+ {
+ get { return jsonType; }
+ }
+
+ /// <summary>
+ /// Gets the value represented by this instance.
+ /// </summary>
+ [SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods",
+ Justification = "Value in this context clearly refers to the underlying CLR value")]
+ public object Value
+ {
+ get { return value; }
+ }
+
+ /// <summary>
+ /// Attempts to create a <see cref="JsonPrimitive"/> instance from the specified <see cref="object"/> value.
+ /// </summary>
+ /// <param name="value">The <see cref="object"/> value to create the <see cref="JsonPrimitive"/> instance.</param>
+ /// <param name="result">The resulting <see cref="JsonPrimitive"/> instance on success, null otherwise.</param>
+ /// <returns>true if the operation is successful, false otherwise.</returns>
+ public static bool TryCreate(object value, out JsonPrimitive result)
+ {
+ bool allowedType = true;
+ JsonType jsonType = default(JsonType);
+
+ if (value != null)
+ {
+ Type type = value.GetType();
+ switch (Type.GetTypeCode(type))
+ {
+ case TypeCode.Boolean:
+ jsonType = JsonType.Boolean;
+ break;
+ case TypeCode.Byte:
+ case TypeCode.SByte:
+ case TypeCode.Decimal:
+ case TypeCode.Double:
+ case TypeCode.Int16:
+ case TypeCode.Int32:
+ case TypeCode.Int64:
+ case TypeCode.UInt16:
+ case TypeCode.UInt32:
+ case TypeCode.UInt64:
+ case TypeCode.Single:
+ jsonType = JsonType.Number;
+ break;
+ case TypeCode.String:
+ case TypeCode.Char:
+ case TypeCode.DateTime:
+ jsonType = JsonType.String;
+ break;
+ default:
+ if (type == typeof(Uri) || type == typeof(Guid) || type == typeof(DateTimeOffset))
+ {
+ jsonType = JsonType.String;
+ }
+ else
+ {
+ allowedType = false;
+ }
+
+ break;
+ }
+ }
+ else
+ {
+ allowedType = false;
+ }
+
+ if (allowedType)
+ {
+ result = new JsonPrimitive(value, jsonType);
+ return true;
+ }
+ else
+ {
+ result = null;
+ return false;
+ }
+ }
+
+ /// <summary>
+ /// Attempts to convert this <see cref="System.Json.JsonPrimitive"/> instance into an instance of the specified type.
+ /// </summary>
+ /// <param name="type">The type to which the conversion is being performed.</param>
+ /// <returns>An object instance initialized with the <see cref="System.Json.JsonValue"/> value
+ /// specified if the conversion.</returns>
+ /// <exception cref="System.UriFormatException">If T is <see cref="System.Uri"/> and this value does
+ /// not represent a valid Uri.</exception>
+ /// <exception cref="OverflowException">If T is a numeric type, and a narrowing conversion would result
+ /// in a loss of data. For example, if this instance holds an <see cref="System.Int32"/> value of 10000,
+ /// and T is <see cref="System.Byte"/>, this operation would throw an <see cref="System.OverflowException"/>
+ /// because 10000 is outside the range of the <see cref="System.Byte"/> data type.</exception>
+ /// <exception cref="System.FormatException">If the conversion from the string representation of this
+ /// value into another fails because the string is not in the proper format.</exception>
+ /// <exception cref="System.InvalidCastException">If this instance cannot be read as type T.</exception>
+ public override object ReadAs(Type type)
+ {
+ if (type == null)
+ {
+ throw new ArgumentNullException("type");
+ }
+
+ object result;
+ ReadAsFailureKind failure = TryReadAsInternal(type, out result);
+ if (failure == ReadAsFailureKind.NoFailure)
+ {
+ return result;
+ }
+ else
+ {
+ string valueStr = value.ToString();
+ string typeOfTName = type.Name;
+ switch (failure)
+ {
+ case ReadAsFailureKind.InvalidFormat:
+ throw new FormatException(RS.Format(Properties.Resources.CannotReadPrimitiveAsType, valueStr, typeOfTName));
+ case ReadAsFailureKind.InvalidDateFormat:
+ throw new FormatException(RS.Format(Properties.Resources.InvalidDateFormat, valueStr, typeOfTName));
+ case ReadAsFailureKind.InvalidUriFormat:
+ throw new UriFormatException(RS.Format(Properties.Resources.InvalidUriFormat, jsonPrimitiveType.Name, valueStr, typeOfTName, uriType.Name));
+ case ReadAsFailureKind.Overflow:
+ throw new OverflowException(RS.Format(Properties.Resources.OverflowReadAs, valueStr, typeOfTName));
+ case ReadAsFailureKind.InvalidCast:
+ default:
+ throw new InvalidCastException(RS.Format(Properties.Resources.CannotReadPrimitiveAsType, valueStr, typeOfTName));
+ }
+ }
+ }
+
+ /// <summary>
+ /// Attempts to convert this <see cref="System.Json.JsonPrimitive"/> instance into an instance of the specified type.
+ /// </summary>
+ /// <param name="type">The type to which the conversion is being performed.</param>
+ /// <param name="value">An object instance to be initialized with this instance or null if the conversion cannot be performed.</param>
+ /// <returns>true if this <see cref="System.Json.JsonPrimitive"/> instance can be read as the specified type; otherwise, false.</returns>
+ [SuppressMessage("Microsoft.Maintainability", "CA1500:VariableNamesShouldNotMatchFieldNames", MessageId = "value",
+ Justification = "field is used with 'this' and arg is out param which makes it harder to be misused.")]
+ public override bool TryReadAs(Type type, out object value)
+ {
+ return TryReadAsInternal(type, out value) == ReadAsFailureKind.NoFailure;
+ }
+
+ /// <summary>
+ /// Returns the value this object wraps (if any).
+ /// </summary>
+ /// <returns>The value wrapped by this instance or null if none.</returns>
+ internal override object Read()
+ {
+ return value;
+ }
+
+ internal override void Save(XmlDictionaryWriter jsonWriter)
+ {
+ if (value == null)
+ {
+ throw new ArgumentNullException("jsonWriter");
+ }
+
+ switch (jsonType)
+ {
+ case JsonType.Boolean:
+ jsonWriter.WriteAttributeString(JXmlToJsonValueConverter.TypeAttributeName, JXmlToJsonValueConverter.BooleanAttributeValue);
+ break;
+ case JsonType.Number:
+ jsonWriter.WriteAttributeString(JXmlToJsonValueConverter.TypeAttributeName, JXmlToJsonValueConverter.NumberAttributeValue);
+ break;
+ default:
+ jsonWriter.WriteAttributeString(JXmlToJsonValueConverter.TypeAttributeName, JXmlToJsonValueConverter.StringAttributeValue);
+ break;
+ }
+
+ WriteValue(jsonWriter);
+ }
+
+ private static ConvertResult StringToBool(string valueString)
+ {
+ ConvertResult result = new ConvertResult();
+ bool tempBool;
+ result.ReadAsFailureKind = Boolean.TryParse(valueString, out tempBool) ? ReadAsFailureKind.NoFailure : ReadAsFailureKind.InvalidFormat;
+ result.Value = tempBool;
+ return result;
+ }
+
+ private static ConvertResult StringToByte(string valueString)
+ {
+ ConvertResult result = new ConvertResult();
+ byte tempByte;
+ result.ReadAsFailureKind = Byte.TryParse(valueString, out tempByte) ? ReadAsFailureKind.NoFailure : ReadAsFailureKind.InvalidCast;
+ if (result.ReadAsFailureKind != ReadAsFailureKind.NoFailure)
+ {
+ result.ReadAsFailureKind = StringToNumberConverter<byte>(valueString, out tempByte);
+ }
+
+ result.Value = tempByte;
+ return result;
+ }
+
+ private static ConvertResult StringToChar(string valueString)
+ {
+ ConvertResult result = new ConvertResult();
+ char tempChar;
+ result.ReadAsFailureKind = Char.TryParse(valueString, out tempChar) ? ReadAsFailureKind.NoFailure : ReadAsFailureKind.InvalidFormat;
+ result.Value = tempChar;
+ return result;
+ }
+
+ private static ConvertResult StringToDecimal(string valueString)
+ {
+ ConvertResult result = new ConvertResult();
+ decimal tempDecimal;
+ result.ReadAsFailureKind = Decimal.TryParse(valueString, NumberStyles.Float, NumberFormatInfo.InvariantInfo, out tempDecimal) ? ReadAsFailureKind.NoFailure : ReadAsFailureKind.InvalidCast;
+ if (result.ReadAsFailureKind != ReadAsFailureKind.NoFailure)
+ {
+ result.ReadAsFailureKind = StringToNumberConverter<decimal>(valueString, out tempDecimal);
+ }
+
+ result.Value = tempDecimal;
+ return result;
+ }
+
+ private static ConvertResult StringToDateTime(string valueString)
+ {
+ ConvertResult result = new ConvertResult();
+ DateTime tempDateTime;
+ result.ReadAsFailureKind = TryParseDateTime(valueString, out tempDateTime) ? ReadAsFailureKind.NoFailure : ReadAsFailureKind.InvalidDateFormat;
+ result.Value = tempDateTime;
+ return result;
+ }
+
+ private static ConvertResult StringToDateTimeOffset(string valueString)
+ {
+ ConvertResult result = new ConvertResult();
+ DateTimeOffset tempDateTimeOffset;
+ result.ReadAsFailureKind = TryParseDateTimeOffset(valueString, out tempDateTimeOffset) ? ReadAsFailureKind.NoFailure : ReadAsFailureKind.InvalidDateFormat;
+ result.Value = tempDateTimeOffset;
+ return result;
+ }
+
+ private static ConvertResult StringToDouble(string valueString)
+ {
+ ConvertResult result = new ConvertResult();
+ double tempDouble;
+ result.ReadAsFailureKind = Double.TryParse(valueString, NumberStyles.Float, NumberFormatInfo.InvariantInfo, out tempDouble) ? ReadAsFailureKind.NoFailure : ReadAsFailureKind.InvalidCast;
+ if (result.ReadAsFailureKind != ReadAsFailureKind.NoFailure)
+ {
+ result.ReadAsFailureKind = StringToNumberConverter<double>(valueString, out tempDouble);
+ }
+
+ result.Value = tempDouble;
+ return result;
+ }
+
+ private static bool TryGuidParse (string value, out Guid guid)
+ {
+#if NET_4_0
+ return Guid.TryParse (value, out guid);
+#else
+ try {
+ guid = new Guid (value);
+ return true;
+ } catch (Exception) {
+ guid = Guid.Empty;
+ return false;
+ }
+#endif
+ }
+
+ private static ConvertResult StringToGuid(string valueString)
+ {
+ ConvertResult result = new ConvertResult();
+ Guid tempGuid;
+ result.ReadAsFailureKind = TryGuidParse(valueString, out tempGuid) ? ReadAsFailureKind.NoFailure : ReadAsFailureKind.InvalidFormat;
+ result.Value = tempGuid;
+ return result;
+ }
+
+ private static ConvertResult StringToShort(string valueString)
+ {
+ ConvertResult result = new ConvertResult();
+ short tempShort;
+ result.ReadAsFailureKind = Int16.TryParse(valueString, NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out tempShort) ? ReadAsFailureKind.NoFailure : ReadAsFailureKind.InvalidCast;
+ if (result.ReadAsFailureKind != ReadAsFailureKind.NoFailure)
+ {
+ result.ReadAsFailureKind = StringToNumberConverter<short>(valueString, out tempShort);
+ }
+
+ result.Value = tempShort;
+ return result;
+ }
+
+ private static ConvertResult StringToInt(string valueString)
+ {
+ ConvertResult result = new ConvertResult();
+ int tempInt;
+ result.ReadAsFailureKind = Int32.TryParse(valueString, NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out tempInt) ? ReadAsFailureKind.NoFailure : ReadAsFailureKind.InvalidCast;
+ if (result.ReadAsFailureKind != ReadAsFailureKind.NoFailure)
+ {
+ result.ReadAsFailureKind = StringToNumberConverter<int>(valueString, out tempInt);
+ }
+
+ result.Value = tempInt;
+ return result;
+ }
+
+ private static ConvertResult StringToLong(string valueString)
+ {
+ ConvertResult result = new ConvertResult();
+ long tempLong;
+ result.ReadAsFailureKind = Int64.TryParse(valueString, NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out tempLong) ? ReadAsFailureKind.NoFailure : ReadAsFailureKind.InvalidCast;
+ if (result.ReadAsFailureKind != ReadAsFailureKind.NoFailure)
+ {
+ result.ReadAsFailureKind = StringToNumberConverter<long>(valueString, out tempLong);
+ }
+
+ result.Value = tempLong;
+ return result;
+ }
+
+ private static ConvertResult StringToSByte(string valueString)
+ {
+ ConvertResult result = new ConvertResult();
+ sbyte tempSByte;
+ result.ReadAsFailureKind = SByte.TryParse(valueString, NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out tempSByte) ? ReadAsFailureKind.NoFailure : ReadAsFailureKind.InvalidCast;
+ if (result.ReadAsFailureKind != ReadAsFailureKind.NoFailure)
+ {
+ result.ReadAsFailureKind = StringToNumberConverter<sbyte>(valueString, out tempSByte);
+ }
+
+ result.Value = tempSByte;
+ return result;
+ }
+
+ private static ConvertResult StringToFloat(string valueString)
+ {
+ ConvertResult result = new ConvertResult();
+ float tempFloat;
+ result.ReadAsFailureKind = Single.TryParse(valueString, NumberStyles.Float, NumberFormatInfo.InvariantInfo, out tempFloat) ? ReadAsFailureKind.NoFailure : ReadAsFailureKind.InvalidCast;
+ if (result.ReadAsFailureKind != ReadAsFailureKind.NoFailure)
+ {
+ result.ReadAsFailureKind = StringToNumberConverter<float>(valueString, out tempFloat);
+ }
+
+ result.Value = tempFloat;
+ return result;
+ }
+
+ private static ConvertResult StringToUShort(string valueString)
+ {
+ ConvertResult result = new ConvertResult();
+ ushort tempUShort;
+ result.ReadAsFailureKind = UInt16.TryParse(valueString, NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out tempUShort) ? ReadAsFailureKind.NoFailure : ReadAsFailureKind.InvalidCast;
+ if (result.ReadAsFailureKind != ReadAsFailureKind.NoFailure)
+ {
+ result.ReadAsFailureKind = StringToNumberConverter<ushort>(valueString, out tempUShort);
+ }
+
+ result.Value = tempUShort;
+ return result;
+ }
+
+ private static ConvertResult StringToUInt(string valueString)
+ {
+ ConvertResult result = new ConvertResult();
+ uint tempUInt;
+ result.ReadAsFailureKind = UInt32.TryParse(valueString, NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out tempUInt) ? ReadAsFailureKind.NoFailure : ReadAsFailureKind.InvalidCast;
+ if (result.ReadAsFailureKind != ReadAsFailureKind.NoFailure)
+ {
+ result.ReadAsFailureKind = StringToNumberConverter<uint>(valueString, out tempUInt);
+ }
+
+ result.Value = tempUInt;
+ return result;
+ }
+
+ private static ConvertResult StringToULong(string valueString)
+ {
+ ConvertResult result = new ConvertResult();
+ ulong tempULong;
+ result.ReadAsFailureKind = UInt64.TryParse(valueString, NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out tempULong) ? ReadAsFailureKind.NoFailure : ReadAsFailureKind.InvalidCast;
+ if (result.ReadAsFailureKind != ReadAsFailureKind.NoFailure)
+ {
+ result.ReadAsFailureKind = StringToNumberConverter<ulong>(valueString, out tempULong);
+ }
+
+ result.Value = tempULong;
+ return result;
+ }
+
+ private static ConvertResult StringToUri(string valueString)
+ {
+ ConvertResult result = new ConvertResult();
+ Uri tempUri;
+ result.ReadAsFailureKind = Uri.TryCreate(valueString, UriKind.RelativeOrAbsolute, out tempUri) ? ReadAsFailureKind.NoFailure : ReadAsFailureKind.InvalidUriFormat;
+ result.Value = tempUri;
+ return result;
+ }
+
+ private static ReadAsFailureKind StringToNumberConverter<T>(string valueString, out T valueNumber)
+ {
+ string str = valueString.Trim();
+
+ if (str.IndexOfAny(FloatingPointChars) < 0)
+ {
+ long longVal;
+ if (Int64.TryParse(str, NumberStyles.Float, CultureInfo.InvariantCulture, out longVal))
+ {
+ return NumberToNumberConverter<T>(longVal, out valueNumber);
+ }
+ }
+
+ decimal decValue;
+ if (Decimal.TryParse(str, NumberStyles.Float, CultureInfo.InvariantCulture, out decValue) && decValue != 0)
+ {
+ return NumberToNumberConverter<T>(decValue, out valueNumber);
+ }
+
+ double dblValue;
+ if (Double.TryParse(str, NumberStyles.Float, CultureInfo.InvariantCulture, out dblValue))
+ {
+ return NumberToNumberConverter<T>(dblValue, out valueNumber);
+ }
+
+ valueNumber = default(T);
+ return ReadAsFailureKind.InvalidFormat;
+ }
+
+ private static ReadAsFailureKind NumberToNumberConverter<T>(object valueObject, out T valueNumber)
+ {
+ object value;
+ ReadAsFailureKind failureKind = NumberToNumberConverter(typeof(T), valueObject, out value);
+ if (failureKind == ReadAsFailureKind.NoFailure)
+ {
+ valueNumber = (T)value;
+ }
+ else
+ {
+ valueNumber = default(T);
+ }
+
+ return failureKind;
+ }
+
+ private static ReadAsFailureKind NumberToNumberConverter(Type type, object valueObject, out object valueNumber)
+ {
+ try
+ {
+ valueNumber = System.Convert.ChangeType(valueObject, type, CultureInfo.InvariantCulture);
+ return ReadAsFailureKind.NoFailure;
+ }
+ catch (OverflowException)
+ {
+ valueNumber = null;
+ return ReadAsFailureKind.Overflow;
+ }
+ }
+
+ private static bool TryParseDateTime(string valueString, out DateTime dateTime)
+ {
+ string filteredValue = valueString.EndsWith(UtcString, StringComparison.Ordinal) ? valueString.Replace(UtcString, GmtString) : valueString;
+
+ if (DateTime.TryParse(filteredValue, CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind, out dateTime))
+ {
+ return true;
+ }
+
+ if (TryParseAspNetDateTimeFormat(valueString, out dateTime))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ private static bool TryParseDateTimeOffset(string valueString, out DateTimeOffset dateTimeOffset)
+ {
+ string filteredValue = valueString.EndsWith(UtcString, StringComparison.Ordinal) ? valueString.Replace(UtcString, GmtString) : valueString;
+
+ if (DateTimeOffset.TryParse(filteredValue, CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind, out dateTimeOffset))
+ {
+ return true;
+ }
+
+ if (TryParseAspNetDateTimeFormat(valueString, out dateTimeOffset))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ private static bool TryParseAspNetDateTimeFormat(string valueString, out DateTime dateTime)
+ {
+ // Reference to the format is available at these sources:
+ // http://msdn.microsoft.com/en-us/library/bb299886.aspx#intro_to_json_sidebarb
+ // http://msdn.microsoft.com/en-us/library/bb412170.aspx
+
+ // The format for the value is given by the following regex:
+ // \/Date\((?<milliseconds>\-?\d+)(?<offset>[\+\-]?\d{4})\)\/
+ // where milliseconds is the number of milliseconds since 1970/01/01:00:00:00.000 UTC (the "unix baseline")
+ // and offset is an optional which indicates whether the value is local or UTC.
+ // The actual value of the offset is ignored, since the ticks represent the UTC offset. The value is converted to local time based on that info.
+ const string DateTimePrefix = "/Date(";
+ const int DateTimePrefixLength = 6;
+ const string DateTimeSuffix = ")/";
+ const int DateTimeSuffixLength = 2;
+
+ if (valueString.StartsWith(DateTimePrefix, StringComparison.Ordinal) && valueString.EndsWith(DateTimeSuffix, StringComparison.Ordinal))
+ {
+ string ticksValue = valueString.Substring(DateTimePrefixLength, valueString.Length - DateTimePrefixLength - DateTimeSuffixLength);
+ DateTimeKind dateTimeKind = DateTimeKind.Utc;
+
+ int indexOfTimeZoneOffset = ticksValue.IndexOf('+', 1);
+
+ if (indexOfTimeZoneOffset < 0)
+ {
+ indexOfTimeZoneOffset = ticksValue.IndexOf('-', 1);
+ }
+
+ // If an offset is present, verify it is properly formatted. Actual value is ignored (see spec).
+ if (indexOfTimeZoneOffset != -1)
+ {
+ if (indexOfTimeZoneOffset + 5 == ticksValue.Length
+ && IsLatinDigit(ticksValue[indexOfTimeZoneOffset + 1])
+ && IsLatinDigit(ticksValue[indexOfTimeZoneOffset + 2])
+ && IsLatinDigit(ticksValue[indexOfTimeZoneOffset + 3])
+ && IsLatinDigit(ticksValue[indexOfTimeZoneOffset + 4]))
+ {
+ ticksValue = ticksValue.Substring(0, indexOfTimeZoneOffset);
+ dateTimeKind = DateTimeKind.Local;
+ }
+ else
+ {
+ dateTime = new DateTime();
+ return false;
+ }
+ }
+
+ long millisecondsSinceUnixEpoch;
+ if (Int64.TryParse(ticksValue, NumberStyles.Integer, CultureInfo.InvariantCulture, out millisecondsSinceUnixEpoch))
+ {
+ long ticks = (millisecondsSinceUnixEpoch * 10000) + UnixEpochTicks;
+ if (ticks < DateTime.MaxValue.Ticks)
+ {
+ dateTime = new DateTime(ticks, DateTimeKind.Utc);
+ if (dateTimeKind == DateTimeKind.Local)
+ {
+ dateTime = dateTime.ToLocalTime();
+ }
+
+ return true;
+ }
+ }
+ }
+
+ dateTime = new DateTime();
+ return false;
+ }
+
+ private static bool TryParseAspNetDateTimeFormat(string valueString, out DateTimeOffset dateTimeOffset)
+ {
+ DateTime dateTime;
+ if (TryParseAspNetDateTimeFormat(valueString, out dateTime))
+ {
+ dateTimeOffset = new DateTimeOffset(dateTime);
+ return true;
+ }
+
+ dateTimeOffset = new DateTimeOffset();
+ return false;
+ }
+
+ private static bool IsLatinDigit(char c)
+ {
+ return (c >= '0') && (c <= '9');
+ }
+
+ private static string UnescapeJsonString(string val)
+ {
+ if (val == null)
+ {
+ return null;
+ }
+
+ StringBuilder sb = null;
+ int startIndex = 0, count = 0;
+ for (int i = 0; i < val.Length; i++)
+ {
+ if (val[i] == '\\')
+ {
+ i++;
+ if (sb == null)
+ {
+ sb = new StringBuilder();
+ }
+
+ sb.Append(val, startIndex, count);
+#if NET_4_0
+ Contract.Assert(i < val.Length, "Found that a '\' was the last character in a string, which is invalid JSON. Verify the calling method uses a valid JSON string as the input parameter of this method.");
+#endif
+ switch (val[i])
+ {
+ case '"':
+ case '\'':
+ case '/':
+ case '\\':
+ sb.Append(val[i]);
+ break;
+ case 'b':
+ sb.Append('\b');
+ break;
+ case 'f':
+ sb.Append('\f');
+ break;
+ case 'n':
+ sb.Append('\n');
+ break;
+ case 'r':
+ sb.Append('\r');
+ break;
+ case 't':
+ sb.Append('\t');
+ break;
+ case 'u':
+#if NET_4_0
+ Contract.Assert((i + 3) < val.Length, String.Format(CultureInfo.CurrentCulture, "Unexpected char {0} at position {1}. The unicode escape sequence should be followed by 4 digits.", val[i], i));
+#endif
+ sb.Append(ParseChar(val.Substring(i + 1, 4), NumberStyles.HexNumber));
+ i += 4;
+ break;
+ }
+
+ startIndex = i + 1;
+ count = 0;
+ }
+ else
+ {
+ count++;
+ }
+ }
+
+ if (sb == null)
+ {
+ return val;
+ }
+
+ if (count > 0)
+ {
+ sb.Append(val, startIndex, count);
+ }
+
+ return sb.ToString();
+ }
+
+ private static char ParseChar(string value, NumberStyles style)
+ {
+ try
+ {
+ int intValue = Int32.Parse(value, style, NumberFormatInfo.InvariantInfo);
+ return System.Convert.ToChar(intValue);
+ }
+ catch (ArgumentException exception)
+ {
+ throw new InvalidCastException(exception.Message, exception);
+ }
+ catch (FormatException exception)
+ {
+ throw new InvalidCastException(exception.Message, exception);
+ }
+ catch (OverflowException exception)
+ {
+ throw new InvalidCastException(exception.Message, exception);
+ }
+ }
+
+ [SuppressMessage("Microsoft.Maintainability", "CA1500:VariableNamesShouldNotMatchFieldNames", MessageId = "value",
+ Justification = "field is used with 'this' and arg is out param which makes it harder to be misused.")]
+ private ReadAsFailureKind TryReadAsInternal(Type type, out object value)
+ {
+ if (base.TryReadAs(type, out value))
+ {
+ return ReadAsFailureKind.NoFailure;
+ }
+
+ if (type == this.value.GetType())
+ {
+ value = this.value;
+ return ReadAsFailureKind.NoFailure;
+ }
+
+ if (jsonType == JsonType.Number)
+ {
+ switch (Type.GetTypeCode(type))
+ {
+ case TypeCode.Byte:
+ case TypeCode.SByte:
+ case TypeCode.Int16:
+ case TypeCode.Int32:
+ case TypeCode.Int64:
+ case TypeCode.UInt16:
+ case TypeCode.UInt32:
+ case TypeCode.UInt64:
+ case TypeCode.Single:
+ case TypeCode.Double:
+ case TypeCode.Decimal:
+ return NumberToNumberConverter(type, this.value, out value);
+ case TypeCode.String:
+ value = ToString();
+ return ReadAsFailureKind.NoFailure;
+ }
+ }
+
+ if (jsonType == JsonType.Boolean)
+ {
+ if (type == typeof(string))
+ {
+ value = ToString();
+ return ReadAsFailureKind.NoFailure;
+ }
+ }
+
+ if (jsonType == JsonType.String)
+ {
+ string str = UnescapeJsonString(ToString());
+#if NET_4_0
+ Contract.Assert(str.Length >= 2 && str.StartsWith("\"", StringComparison.Ordinal) && str.EndsWith("\"", StringComparison.Ordinal), "The unescaped string must begin and end with quotes.");
+#endif
+ str = str.Substring(1, str.Length - 2);
+
+ if (stringConverters.ContainsKey(type))
+ {
+ ConvertResult result = stringConverters[type].Invoke(str);
+ value = result.Value;
+ return result.ReadAsFailureKind;
+ }
+
+ if (type == typeof(string))
+ {
+ value = str;
+ return ReadAsFailureKind.NoFailure;
+ }
+ }
+
+ value = null;
+ return ReadAsFailureKind.InvalidCast;
+ }
+
+ private void WriteValue(XmlDictionaryWriter jsonWriter)
+ {
+ Type valueType = value.GetType();
+ switch (Type.GetTypeCode(valueType))
+ {
+ case TypeCode.Boolean:
+ jsonWriter.WriteValue((bool)value);
+ break;
+ case TypeCode.Byte:
+ case TypeCode.Int16:
+ case TypeCode.Int32:
+ case TypeCode.Int64:
+ case TypeCode.SByte:
+ case TypeCode.UInt16:
+ case TypeCode.UInt32:
+ case TypeCode.UInt64:
+ case TypeCode.Decimal:
+ jsonWriter.WriteValue(String.Format(CultureInfo.InvariantCulture, "{0}", value));
+ break;
+ case TypeCode.Single:
+ case TypeCode.Double:
+ jsonWriter.WriteValue(String.Format(CultureInfo.InvariantCulture, "{0:R}", value));
+ break;
+ case TypeCode.Char:
+ jsonWriter.WriteValue(new string((char)value, 1));
+ break;
+ case TypeCode.String:
+ jsonWriter.WriteValue((string)value);
+ break;
+ case TypeCode.DateTime:
+ jsonWriter.WriteValue(((DateTime)value).ToString(DateTimeIsoFormat, CultureInfo.InvariantCulture));
+ break;
+ default:
+ if (valueType == typeof(Uri))
+ {
+ Uri uri = (Uri)value;
+ jsonWriter.WriteValue(uri.GetComponents(UriComponents.SerializationInfoString, UriFormat.UriEscaped));
+ }
+ else if (valueType == typeof(DateTimeOffset))
+ {
+ jsonWriter.WriteValue(((DateTimeOffset)value).ToString(DateTimeIsoFormat, CultureInfo.InvariantCulture));
+ }
+ else
+ {
+ jsonWriter.WriteValue(value);
+ }
+
+ break;
+ }
+ }
+
+ private class ConvertResult
+ {
+ public ReadAsFailureKind ReadAsFailureKind { get; set; }
+
+ public object Value { get; set; }
+ }
+ }
+}
--- /dev/null
+// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
+
+namespace System.Json
+{
+ /// <summary>
+ /// An enumeration that specifies primitive and structured JavaScript Object
+ /// Notation (JSON) common language runtime (CLR) types.
+ /// </summary>
+ public enum JsonType
+ {
+ /// <summary>
+ /// Specifies the JSON string CLR type.
+ /// </summary>
+ String,
+
+ /// <summary>
+ /// Specifies the JSON number CLR type.
+ /// </summary>
+ Number,
+
+ /// <summary>
+ /// Specifies the JSON object CLR type that consists of an unordered collection
+ /// of key/value pairs, where the key is of type String and the value is of
+ /// type <see cref="System.Json.JsonValue"/>, which can, in turn, be either a
+ /// primitive or a structured JSON type.
+ /// </summary>
+ Object,
+
+ /// <summary>
+ /// Specifies the JSON array CLR type that consists of an ordered collection of
+ /// <see cref="System.Json.JsonValue"/>types, which can, in turn, be either
+ /// primitive or structured JSON types.
+ /// </summary>
+ Array,
+
+ /// <summary>
+ /// Specifies the JSON Boolean CLR type.
+ /// </summary>
+ Boolean,
+
+ /// <summary>
+ /// Specifies the type returned by calls to <see cref="System.Json.JsonValue.ValueOrDefault(string)"/>
+ /// or <see cref="System.Json.JsonValue.ValueOrDefault(int)"/>
+ /// when the element searches doesn't exist in the JSON collection. This is a special
+ /// value which does not represent any JSON element, and cannot be added to any
+ /// JSON collections.
+ /// </summary>
+ Default
+ }
+}
--- /dev/null
+// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
+
+using System.Collections;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics.CodeAnalysis;
+#if FEATURE_DYNAMIC
+using System.Dynamic;
+#endif
+using System.Globalization;
+using System.IO;
+using System.Linq.Expressions;
+using System.Runtime.Serialization;
+using System.Runtime.Serialization.Json;
+using System.Text;
+using System.Xml;
+
+namespace System.Json
+{
+ /// <summary>
+ /// This is the base class for JavaScript Object Notation (JSON) common language runtime (CLR) types.
+ /// </summary>
+ [SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix",
+ Justification = "JsonValue is by definition either a collection or a single object.")]
+ [DataContract]
+#if FEATURE_DYNAMIC
+ public class JsonValue : IEnumerable<KeyValuePair<string, JsonValue>>, IDynamicMetaObjectProvider
+#else
+ public class JsonValue : IEnumerable<KeyValuePair<string, JsonValue>>
+#endif
+ {
+ private static JsonValue defaultInstance = new JsonValue();
+ private int changingListenersCount;
+ private int changedListenersCount;
+
+ internal JsonValue()
+ {
+ }
+
+ /// <summary>
+ /// Raised when this <see cref="System.Json.JsonValue"/> or any of its members have changed.
+ /// </summary>
+ /// <remarks><p>Events are raised when elements are added or removed to <see cref="System.Json.JsonValue"/>
+ /// instances. It applies to both complex descendants of <see cref="System.Json.JsonValue"/>: <see cref="System.Json.JsonArray"/>
+ /// and <see cref="System.Json.JsonObject"/>.</p>
+ /// <p>You should be careful when modifying a <see cref="System.Json.JsonValue"/> tree within one of these events,
+ /// because doing this might lead to unexpected results. For example, if you receive a Changing event, and while
+ /// the event is being processed you remove the node from the tree, you might not receive the Changed event. When
+ /// an event is being processed, it is valid to modify a tree other than the one that contains the node that is
+ /// receiving the event; it is even valid to modify the same tree provided the modifications do not affect the
+ /// specific nodes on which the event was raised. However, if you modify the area of the tree that contains the
+ /// node receiving the event, the events that you receive and the impact to the tree are undefined.</p></remarks>
+ public event EventHandler<JsonValueChangeEventArgs> Changed
+ {
+ add
+ {
+ changedListenersCount++;
+ OnChanged += value;
+ }
+
+ remove
+ {
+ changedListenersCount--;
+ OnChanged -= value;
+ }
+ }
+
+ /// <summary>
+ /// Raised when this <see cref="System.Json.JsonValue"/> or any of its members are about to be changed.
+ /// </summary>
+ /// <remarks><p>Events are raised when elements are added or removed to <see cref="System.Json.JsonValue"/>
+ /// instances. It applies to both complex descendants of <see cref="System.Json.JsonValue"/>: <see cref="System.Json.JsonArray"/>
+ /// and <see cref="System.Json.JsonObject"/>.</p>
+ /// <p>You should be careful when modifying a <see cref="System.Json.JsonValue"/> tree within one of these events,
+ /// because doing this might lead to unexpected results. For example, if you receive a Changing event, and while
+ /// the event is being processed you remove the node from the tree, you might not receive the Changed event. When
+ /// an event is being processed, it is valid to modify a tree other than the one that contains the node that is
+ /// receiving the event; it is even valid to modify the same tree provided the modifications do not affect the
+ /// specific nodes on which the event was raised. However, if you modify the area of the tree that contains the
+ /// node receiving the event, the events that you receive and the impact to the tree are undefined.</p></remarks>
+ public event EventHandler<JsonValueChangeEventArgs> Changing
+ {
+ add
+ {
+ changingListenersCount++;
+ OnChanging += value;
+ }
+
+ remove
+ {
+ changingListenersCount--;
+ OnChanging -= value;
+ }
+ }
+
+ private event EventHandler<JsonValueChangeEventArgs> OnChanged;
+ private event EventHandler<JsonValueChangeEventArgs> OnChanging;
+
+ /// <summary>
+ /// Gets the JSON CLR type represented by this instance.
+ /// </summary>
+ public virtual JsonType JsonType
+ {
+ get { return JsonType.Default; }
+ }
+
+ /// <summary>
+ /// Gets the number of items in this object.
+ /// </summary>
+ public virtual int Count
+ {
+ get { return 0; }
+ }
+
+ /// <summary>
+ /// Gets the number of listeners to the <see cref="Changing"/> event for this instance.
+ /// </summary>
+ protected int ChangingListenersCount
+ {
+ get { return changingListenersCount; }
+ }
+
+ /// <summary>
+ /// Gets the number of listeners to the <see cref="Changed"/> event for this instance.
+ /// </summary>
+ protected int ChangedListenersCount
+ {
+ get { return changedListenersCount; }
+ }
+
+ /// <summary>
+ /// Gets the default JsonValue instance.
+ /// This instance enables safe-chaining of JsonValue operations and resolves to 'null'
+ /// when this instance is used as dynamic, mapping to the JavaScript 'null' value.
+ /// </summary>
+ private static JsonValue DefaultInstance
+ {
+ get { return defaultInstance; }
+ }
+
+ /// <summary>
+ /// This indexer is not supported for this base class and throws an exception.
+ /// </summary>
+ /// <param name="key">The key of the element to get or set.</param>
+ /// <returns><see cref="System.Json.JsonValue"/>.</returns>
+ /// <remarks>The exception thrown is the <see cref="System.InvalidOperationException"/>.
+ /// This method is overloaded in the implementation of the <see cref="System.Json.JsonObject"/>
+ /// class, which inherits from this class.</remarks>
+ public virtual JsonValue this[string key]
+ {
+ get { throw new InvalidOperationException(RS.Format(Properties.Resources.IndexerNotSupportedOnJsonType, typeof(string), JsonType)); }
+
+ set { throw new InvalidOperationException(RS.Format(Properties.Resources.IndexerNotSupportedOnJsonType, typeof(string), JsonType)); }
+ }
+
+ /// <summary>
+ /// This indexer is not supported for this base class and throws an exception.
+ /// </summary>
+ /// <param name="index">The zero-based index of the element to get or set.</param>
+ /// <returns><see cref="System.Json.JsonValue"/>.</returns>
+ /// <remarks>The exception thrown is the <see cref="System.InvalidOperationException"/>.
+ /// This method is overloaded in the implementation of the <see cref="System.Json.JsonArray"/>
+ /// class, which inherits from this class.</remarks>
+ public virtual JsonValue this[int index]
+ {
+ get { throw new InvalidOperationException(RS.Format(Properties.Resources.IndexerNotSupportedOnJsonType, typeof(int), JsonType)); }
+
+ set { throw new InvalidOperationException(RS.Format(Properties.Resources.IndexerNotSupportedOnJsonType, typeof(int), JsonType)); }
+ }
+
+ /// <summary>
+ /// Deserializes text-based JSON into a JSON CLR type.
+ /// </summary>
+ /// <param name="json">The text-based JSON to be parsed into a JSON CLR type.</param>
+ /// <returns>The <see cref="System.Json.JsonValue"/> object that represents the parsed
+ /// text-based JSON as a CLR type.</returns>
+ /// <exception cref="System.ArgumentException">The length of jsonString is zero.</exception>
+ /// <exception cref="System.ArgumentNullException">jsonString is null.</exception>
+ /// <remarks>The result will be an instance of either <see cref="System.Json.JsonArray"/>,
+ /// <see cref="System.Json.JsonObject"/> or <see cref="System.Json.JsonPrimitive"/>,
+ /// depending on the text-based JSON supplied to the method.</remarks>
+ public static JsonValue Parse(string json)
+ {
+ return JXmlToJsonValueConverter.JXMLToJsonValue(json);
+ }
+
+ /// <summary>
+ /// Deserializes text-based JSON from a text reader into a JSON CLR type.
+ /// </summary>
+ /// <param name="textReader">A <see cref="System.IO.TextReader"/> over text-based JSON content.</param>
+ /// <returns>The <see cref="System.Json.JsonValue"/> object that represents the parsed
+ /// text-based JSON as a CLR type.</returns>
+ /// <exception cref="System.ArgumentNullException">textReader is null.</exception>
+ /// <remarks>The result will be an instance of either <see cref="System.Json.JsonArray"/>,
+ /// <see cref="System.Json.JsonObject"/> or <see cref="System.Json.JsonPrimitive"/>,
+ /// depending on the text-based JSON supplied to the method.</remarks>
+ public static JsonValue Load(TextReader textReader)
+ {
+ if (textReader == null)
+ {
+ throw new ArgumentNullException("textReader");
+ }
+
+ return JsonValue.Parse(textReader.ReadToEnd());
+ }
+
+ /// <summary>
+ /// Deserializes text-based JSON from a stream into a JSON CLR type.
+ /// </summary>
+ /// <param name="stream">A <see cref="System.IO.Stream"/> that contains text-based JSON content.</param>
+ /// <returns>The <see cref="System.Json.JsonValue"/> object that represents the parsed
+ /// text-based JSON as a CLR type.</returns>
+ /// <exception cref="System.ArgumentNullException">stream is null.</exception>
+ /// <remarks>The result will be an instance of either <see cref="System.Json.JsonArray"/>,
+ /// <see cref="System.Json.JsonObject"/> or <see cref="System.Json.JsonPrimitive"/>,
+ /// depending on the text-based JSON supplied to the method.</remarks>
+ public static JsonValue Load(Stream stream)
+ {
+ return JXmlToJsonValueConverter.JXMLToJsonValue(stream);
+ }
+
+ /// <summary>
+ /// Performs a cast operation from a <see cref="JsonValue"/> instance into the specified type parameter./>
+ /// </summary>
+ /// <typeparam name="T">The type to cast the instance to.</typeparam>
+ /// <param name="value">The <see cref="System.Json.JsonValue"/> instance.</param>
+ /// <returns>An object of type T initialized with the <see cref="System.Json.JsonValue"/> value specified.</returns>
+ /// <remarks>This method is to support the framework and is not intended to be used externally, use explicit type cast instead.</remarks>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter",
+ Justification = "The generic parameter is used to specify the output type")]
+ public static T CastValue<T>(JsonValue value)
+ {
+ Type typeofT = typeof(T);
+
+ if ((value != null && typeofT.IsAssignableFrom(value.GetType())) || typeofT == typeof(object))
+ {
+ return (T)(object)value;
+ }
+
+ if (value == null || value.JsonType == JsonType.Default)
+ {
+ if (typeofT.IsValueType)
+ {
+ throw new InvalidCastException(RS.Format(Properties.Resources.InvalidCastNonNullable, typeofT.FullName));
+ }
+ else
+ {
+ return default(T);
+ }
+ }
+
+ try
+ {
+ return value.ReadAs<T>();
+ }
+ catch (Exception ex)
+ {
+ if (ex is FormatException || ex is NotSupportedException || ex is InvalidCastException)
+ {
+ throw new InvalidCastException(RS.Format(Properties.Resources.CannotCastJsonValue, value.GetType().FullName, typeofT.FullName), ex);
+ }
+
+ throw;
+ }
+ }
+
+ /// <summary>
+ /// Returns an enumerator which iterates through the values in this object.
+ /// </summary>
+ /// <returns>An enumerator which which iterates through the values in this object.</returns>
+ /// <remarks>The enumerator returned by this class is empty; subclasses will override this method to return appropriate enumerators for themselves.</remarks>
+ public IEnumerator<KeyValuePair<string, JsonValue>> GetEnumerator()
+ {
+ return GetKeyValuePairEnumerator();
+ }
+
+ /// <summary>
+ /// Returns an enumerator which iterates through the values in this object.
+ /// </summary>
+ /// <returns>An <see cref="System.Collections.IEnumerator"/> which iterates through the values in this object.</returns>
+ /// <remarks>The enumerator returned by this class is empty; subclasses will override this method to return appropriate enumerators for themselves.</remarks>
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetKeyValuePairEnumerator();
+ }
+
+#if FEATURE_DYNAMIC
+ /// <summary>
+ /// Gets this instance as a <code>dynamic</code> object.
+ /// </summary>
+ /// <returns>This instance as <code>dynamic</code>.</returns>
+ public dynamic AsDynamic()
+ {
+ return this;
+ }
+#endif
+
+ /// <summary>
+ /// Attempts to convert this <see cref="System.Json.JsonValue"/> instance into the type T.
+ /// </summary>
+ /// <typeparam name="T">The type to which the conversion is being performed.</typeparam>
+ /// <param name="valueOfT">An instance of T initialized with this instance, or the default value of T if the conversion cannot be performed.</param>
+ /// <returns>true if this <see cref="System.Json.JsonValue"/> instance can be read as type T; otherwise, false.</returns>
+ public bool TryReadAs<T>(out T valueOfT)
+ {
+ object value;
+ if (TryReadAs(typeof(T), out value))
+ {
+ valueOfT = (T)value;
+ return true;
+ }
+
+ valueOfT = default(T);
+ return false;
+ }
+
+ /// <summary>
+ /// Attempts to convert this <see cref="System.Json.JsonValue"/> instance into the type T.
+ /// </summary>
+ /// <typeparam name="T">The type to which the conversion is being performed.</typeparam>
+ /// <returns>An instance of T initialized with the value from the conversion of this instance.</returns>
+ /// <exception cref="System.NotSupportedException">If this <see cref="System.Json.JsonValue"/> value cannot be converted into the type T.</exception>
+ [SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter",
+ Justification = "The generic parameter is used to specify the output type")]
+ public T ReadAs<T>()
+ {
+ return (T)ReadAs(typeof(T));
+ }
+
+ /// <summary>
+ /// Attempts to convert this <see cref="System.Json.JsonValue"/> instance into the type T.
+ /// </summary>
+ /// <typeparam name="T">The type to which the conversion is being performed.</typeparam>
+ /// <param name="fallback">The fallback value to be returned if the conversion cannot be made.</param>
+ /// <returns>An instance of T initialized with the value from the conversion of this instance, or the specified fallback value if the conversion cannot be made.</returns>
+ public T ReadAs<T>(T fallback)
+ {
+ return (T)ReadAs(typeof(T), fallback);
+ }
+
+ /// <summary>
+ /// Attempts to convert this <see cref="System.Json.JsonValue"/> instance to an instance of the specified type.
+ /// </summary>
+ /// <param name="type">The type to which the conversion is being performed.</param>
+ /// <param name="fallback">The fallback value to be returned if the conversion cannot be made.</param>
+ /// <returns>An instance of the specified type initialized with the value from the conversion of this instance, or the specified fallback value if the conversion cannot be made.</returns>
+ public object ReadAs(Type type, object fallback)
+ {
+ if (type == null)
+ {
+ throw new ArgumentNullException("type");
+ }
+
+ object result;
+ if (JsonType != JsonType.Default && TryReadAs(type, out result))
+ {
+ return result;
+ }
+ else
+ {
+ return fallback;
+ }
+ }
+
+ /// <summary>
+ /// Attempts to convert this <see cref="System.Json.JsonValue"/> instance into an instance of the specified type.
+ /// </summary>
+ /// <param name="type">The type to which the conversion is being performed.</param>
+ /// <returns>An instance of the specified type initialized with the value from the conversion of this instance.</returns>
+ /// <exception cref="System.NotSupportedException">If this <see cref="System.Json.JsonValue"/> value cannot be converted into the type T.</exception>
+ public virtual object ReadAs(Type type)
+ {
+ if (type == null)
+ {
+ throw new ArgumentNullException("type");
+ }
+
+ object result;
+ if (TryReadAs(type, out result))
+ {
+ return result;
+ }
+
+ throw new NotSupportedException(RS.Format(Properties.Resources.CannotReadAsType, GetType().FullName, type.FullName));
+ }
+
+ /// <summary>
+ /// Attempts to convert this <see cref="System.Json.JsonValue"/> instance into an instance of the specified type.
+ /// </summary>
+ /// <param name="type">The type to which the conversion is being performed.</param>
+ /// <param name="value">An object to be initialized with this instance or null if the conversion cannot be performed.</param>
+ /// <returns>true if this <see cref="System.Json.JsonValue"/> instance can be read as the specified type; otherwise, false.</returns>
+ [SuppressMessage("Microsoft.Design", "CA1007:UseGenericsWhereAppropriate",
+ Justification = "This is the non-generic version of the method.")]
+ public virtual bool TryReadAs(Type type, out object value)
+ {
+ if (type == null)
+ {
+ throw new ArgumentNullException("type");
+ }
+
+ if (type.IsAssignableFrom(GetType()) || type == typeof(object))
+ {
+ value = this;
+ return true;
+ }
+
+ value = null;
+ return false;
+ }
+
+ /// <summary>
+ /// Writes this <see cref="System.Json.JsonValue"/> instance to a <see cref="System.IO.Stream"/>.
+ /// </summary>
+ /// <param name="stream">Stream to which to write text-based JSON.</param>
+ public void Save(Stream stream)
+ {
+ if (JsonType == JsonType.Default)
+ {
+ throw new InvalidOperationException(Properties.Resources.UseOfDefaultNotAllowed);
+ }
+
+ if (stream == null)
+ {
+ throw new ArgumentNullException("stream");
+ }
+
+ using (XmlDictionaryWriter jsonWriter = JsonReaderWriterFactory.CreateJsonWriter(stream, Encoding.UTF8, false))
+ {
+ jsonWriter.WriteStartElement(JXmlToJsonValueConverter.RootElementName);
+ Save(jsonWriter);
+ jsonWriter.WriteEndElement();
+ }
+ }
+
+ /// <summary>
+ /// Writes <see cref="System.Json.JsonValue"/> instance to a <see cref="TextWriter"/>.
+ /// </summary>
+ /// <param name="textWriter">The <see cref="System.IO.TextWriter"/> used to write text-based JSON.</param>
+ public void Save(TextWriter textWriter)
+ {
+ if (JsonType == JsonType.Default)
+ {
+ throw new InvalidOperationException(Properties.Resources.UseOfDefaultNotAllowed);
+ }
+
+ if (textWriter == null)
+ {
+ throw new ArgumentNullException("textWriter");
+ }
+
+ using (MemoryStream ms = new MemoryStream())
+ {
+ Save(ms);
+ ms.Position = 0;
+ textWriter.Write(new StreamReader(ms).ReadToEnd());
+ }
+ }
+
+ /// <summary>
+ /// Provides a textual representation of this <see cref="System.Json.JsonValue"/> instance.
+ /// </summary>
+ /// <returns>A <see cref="System.String"/> containing text-based JSON.</returns>
+ public override string ToString()
+ {
+ if (JsonType == JsonType.Default)
+ {
+ return "Default";
+ }
+
+ using (MemoryStream ms = new MemoryStream())
+ {
+ Save(ms);
+ ms.Position = 0;
+ return new StreamReader(ms).ReadToEnd();
+ }
+ }
+
+ /// <summary>
+ /// Checks whether a key/value pair with a specified key exists in the JSON CLR object type.
+ /// </summary>
+ /// <param name="key">The key to check for.</param>
+ /// <returns>false in this class; subclasses may override this method to return other values.</returns>
+ /// <remarks>This method is overloaded in the implementation of the <see cref="System.Json.JsonObject"/>
+ /// class, which inherits from this class.</remarks>
+ public virtual bool ContainsKey(string key)
+ {
+ return false;
+ }
+
+ /// <summary>
+ /// Returns the value returned by the safe string indexer for this instance.
+ /// </summary>
+ /// <param name="key">The key of the element to get.</param>
+ /// <returns>If this is an instance of <see cref="System.Json.JsonObject"/>, it contains
+ /// the given key and the value corresponding to the key is not null, then it will return that value.
+ /// Otherwise it will return a <see cref="System.Json.JsonValue"/> instance with <see cref="System.Json.JsonValue.JsonType"/>
+ /// equals to <see cref="F:System.Json.JsonType.Default"/>.</returns>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual JsonValue GetValue(string key)
+ {
+ return ValueOrDefault(key);
+ }
+
+ /// <summary>
+ /// Returns the value returned by the safe int indexer for this instance.
+ /// </summary>
+ /// <param name="index">The zero-based index of the element to get.</param>
+ /// <returns>If this is an instance of <see cref="System.Json.JsonArray"/>, the index is within the array
+ /// bounds, and the value corresponding to the index is not null, then it will return that value.
+ /// Otherwise it will return a <see cref="System.Json.JsonValue"/> instance with <see cref="System.Json.JsonValue.JsonType"/>
+ /// equals to <see cref="F:System.Json.JsonType.Default"/>.</returns>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual JsonValue GetValue(int index)
+ {
+ return ValueOrDefault(index);
+ }
+
+ /// <summary>
+ /// Sets the value and returns it.
+ /// </summary>
+ /// <param name="key">The key of the element to set.</param>
+ /// <param name="value">The value to be set.</param>
+ /// <returns>The value, converted into a JsonValue, set in this collection.</returns>
+ /// <exception cref="System.ArgumentException">If the value cannot be converted into a JsonValue.</exception>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual JsonValue SetValue(string key, object value)
+ {
+ this[key] = ResolveObject(value);
+ return this[key];
+ }
+
+ /// <summary>
+ /// Sets the value and returns it.
+ /// </summary>
+ /// <param name="index">The zero-based index of the element to set.</param>
+ /// <param name="value">The value to be set.</param>
+ /// <returns>The value, converted into a JsonValue, set in this collection.</returns>
+ /// <exception cref="System.ArgumentException">If the value cannot be converted into a JsonValue.</exception>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual JsonValue SetValue(int index, object value)
+ {
+ this[index] = ResolveObject(value);
+ return this[index];
+ }
+
+ /// <summary>
+ /// Safe string indexer for the <see cref="System.Json.JsonValue"/> type.
+ /// </summary>
+ /// <param name="key">The key of the element to get.</param>
+ /// <returns>If this is an instance of <see cref="System.Json.JsonObject"/>, it contains
+ /// the given key and the value corresponding to the key is not null, then it will return that value.
+ /// Otherwise it will return a <see cref="System.Json.JsonValue"/> instance with <see cref="System.Json.JsonValue.JsonType"/>
+ /// equals to <see cref="F:System.Json.JsonType.Default"/>.</returns>
+ public virtual JsonValue ValueOrDefault(string key)
+ {
+ return JsonValue.DefaultInstance;
+ }
+
+ /// <summary>
+ /// Safe indexer for the <see cref="System.Json.JsonValue"/> type.
+ /// </summary>
+ /// <param name="index">The zero-based index of the element to get.</param>
+ /// <returns>If this is an instance of <see cref="System.Json.JsonArray"/>, the index is within the array
+ /// bounds, and the value corresponding to the index is not null, then it will return that value.
+ /// Otherwise it will return a <see cref="System.Json.JsonValue"/> instance with <see cref="System.Json.JsonValue.JsonType"/>
+ /// equals to <see cref="F:System.Json.JsonType.Default"/>.</returns>
+ public virtual JsonValue ValueOrDefault(int index)
+ {
+ return JsonValue.DefaultInstance;
+ }
+
+ /// <summary>
+ /// Safe deep indexer for the <see cref="JsonValue"/> type.
+ /// </summary>
+ /// <param name="indexes">The indices to index this type. The indices can be
+ /// of type <see cref="System.Int32"/> or <see cref="System.String"/>.</param>
+ /// <returns>A <see cref="JsonValue"/> which is equivalent to calling<see cref="ValueOrDefault(int)"/> or
+ /// <see cref="ValueOrDefault(string)"/> on the first index, then calling it again on the result
+ /// for the second index and so on.</returns>
+ /// <exception cref="System.ArgumentException">If any of the indices is not of type
+ /// <see cref="System.Int32"/> or <see cref="System.String"/>.</exception>
+ public JsonValue ValueOrDefault(params object[] indexes)
+ {
+ if (indexes == null)
+ {
+ return JsonValue.DefaultInstance;
+ }
+
+ if (indexes.Length == 0)
+ {
+ return this;
+ }
+
+ JsonValue result = this;
+ for (int i = 0; i < indexes.Length; i++)
+ {
+ object index = indexes[i];
+ if (index == null)
+ {
+ result = JsonValue.DefaultInstance;
+ continue;
+ }
+
+ Type indexType = index.GetType();
+
+ switch (Type.GetTypeCode(indexType))
+ {
+ case TypeCode.Char:
+ case TypeCode.Int16:
+ case TypeCode.UInt16:
+ case TypeCode.Byte:
+ case TypeCode.SByte:
+ index = System.Convert.ChangeType(index, typeof(int), CultureInfo.InvariantCulture);
+ goto case TypeCode.Int32;
+
+ case TypeCode.Int32:
+ result = result.ValueOrDefault((int)index);
+ break;
+
+ case TypeCode.String:
+ result = result.ValueOrDefault((string)index);
+ break;
+
+ default:
+ throw new ArgumentException(RS.Format(Properties.Resources.InvalidIndexType, index.GetType()), "indexes");
+ }
+ }
+
+ return result;
+ }
+
+#if FEATURE_DYNAMIC
+ [SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes",
+ Justification = "Cannot make this class sealed, it needs to have subclasses. But its subclasses are sealed themselves.")]
+ DynamicMetaObject IDynamicMetaObjectProvider.GetMetaObject(Expression parameter)
+ {
+ if (parameter == null)
+ {
+ throw new ArgumentNullException("parameter");
+ }
+
+ return new JsonValueDynamicMetaObject(parameter, this);
+ }
+#endif
+
+ /// <summary>
+ /// Resolves the specified object to an appropriate JsonValue instance.
+ /// </summary>
+ /// <param name="value">The object to resolve.</param>
+ /// <returns>A <see cref="JsonValue"/> instance resolved from the specified object.</returns>
+ internal static JsonValue ResolveObject(object value)
+ {
+ JsonPrimitive primitive;
+
+ if (value == null)
+ {
+ return null;
+ }
+
+ JsonValue jsonValue = value as JsonValue;
+
+ if (jsonValue != null)
+ {
+ return jsonValue;
+ }
+
+ if (JsonPrimitive.TryCreate(value, out primitive))
+ {
+ return primitive;
+ }
+
+ throw new ArgumentException(Properties.Resources.TypeNotSupported, "value");
+ }
+
+ /// <summary>
+ /// Determines whether an explicit cast to JsonValue is provided from the specified type.
+ /// </summary>
+ /// <param name="type">The type to check.</param>
+ /// <returns>true if an explicit cast exists for the specified type, false otherwise.</returns>
+ internal static bool IsSupportedExplicitCastType(Type type)
+ {
+ TypeCode typeCode = Type.GetTypeCode(type);
+
+ switch (typeCode)
+ {
+ case TypeCode.Boolean:
+ case TypeCode.Byte:
+ case TypeCode.Char:
+ case TypeCode.DateTime:
+ case TypeCode.Decimal:
+ case TypeCode.Double:
+ case TypeCode.Int16:
+ case TypeCode.Int32:
+ case TypeCode.Int64:
+ case TypeCode.SByte:
+ case TypeCode.Single:
+ case TypeCode.String:
+ case TypeCode.UInt16:
+ case TypeCode.UInt32:
+ case TypeCode.UInt64:
+ return true;
+
+ default:
+ return type == typeof(DateTimeOffset) || type == typeof(Guid) || type == typeof(Uri) ||
+ type == typeof(List<object>) || type == typeof(Array) || type == typeof(object[]) ||
+ type == typeof(Dictionary<string, object>);
+ }
+ }
+
+ /// <summary>
+ /// Returns the value this object wraps (if any).
+ /// </summary>
+ /// <returns>The value wrapped by this instance or null if none.</returns>
+ internal virtual object Read()
+ {
+ return null;
+ }
+
+ /// <summary>
+ /// Serializes this object into the specified <see cref="XmlDictionaryWriter"/> instance.
+ /// </summary>
+ /// <param name="jsonWriter">An <see cref="XmlDictionaryWriter"/> instance to serialize this instance into.</param>
+ internal virtual void Save(XmlDictionaryWriter jsonWriter)
+ {
+ if (jsonWriter == null)
+ {
+ throw new ArgumentNullException("jsonWriter");
+ }
+
+ Stack<JsonValue> objectStack = new Stack<JsonValue>();
+ Stack<int> indexStack = new Stack<int>();
+ int currentIndex = 0;
+ JsonValue currentValue = this;
+
+ OnSaveStarted();
+
+ WriteAttributeString(jsonWriter);
+
+ while (currentIndex < currentValue.Count || objectStack.Count > 0)
+ {
+ if (currentValue.Count > currentIndex)
+ {
+ JsonValue nextValue = currentValue.WriteStartElementAndGetNext(jsonWriter, currentIndex);
+
+ if (JsonValue.IsJsonCollection(nextValue))
+ {
+ nextValue.OnSaveStarted();
+ nextValue.WriteAttributeString(jsonWriter);
+
+ objectStack.Push(currentValue);
+ indexStack.Push(currentIndex);
+ currentValue = nextValue;
+ currentIndex = 0;
+ }
+ else
+ {
+ if (nextValue == null)
+ {
+ jsonWriter.WriteAttributeString(JXmlToJsonValueConverter.TypeAttributeName, JXmlToJsonValueConverter.NullAttributeValue);
+ }
+ else
+ {
+ nextValue.Save(jsonWriter);
+ }
+
+ currentIndex++;
+ jsonWriter.WriteEndElement();
+ }
+ }
+ else
+ {
+ if (objectStack.Count > 0)
+ {
+ currentValue.OnSaveEnded();
+ jsonWriter.WriteEndElement();
+
+ currentValue = objectStack.Pop();
+ currentIndex = indexStack.Pop() + 1;
+ }
+ }
+ }
+
+ OnSaveEnded();
+ }
+
+ /// <summary>
+ /// Returns an enumerator which iterates through the values in this object.
+ /// </summary>
+ /// <returns>An <see cref="System.Collections.IEnumerator"/> which iterates through the values in this object.</returns>
+ /// <remarks>This method is the virtual version of the IEnumerator.GetEnumerator method and is provided to allow derived classes to implement the
+ /// appropriate version of the generic interface (enumerator of values or key/value pairs).</remarks>
+ [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate",
+ Justification = "This method is a virtual version of the IEnumerable.GetEnumerator method.")]
+ [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures",
+ Justification = "This class is a collection that is properly represented by the nested generic type.")]
+ protected virtual IEnumerator<KeyValuePair<string, JsonValue>> GetKeyValuePairEnumerator()
+ {
+ yield break;
+ }
+
+ /// <summary>
+ /// Callback method called during Save operations to let the instance write the start element
+ /// and return the next element in the collection.
+ /// </summary>
+ /// <param name="jsonWriter">The JXML writer used to write JSON.</param>
+ /// <param name="index">The index within this collection.</param>
+ /// <returns>The next item in the collection, or null of there are no more items.</returns>
+ internal virtual JsonValue WriteStartElementAndGetNext(XmlDictionaryWriter jsonWriter, int index)
+ {
+ return null;
+ }
+
+ /// <summary>
+ /// Callback method called to let an instance write the proper JXML attribute when saving this
+ /// instance.
+ /// </summary>
+ /// <param name="jsonWriter">The JXML writer used to write JSON.</param>
+ internal virtual void WriteAttributeString(XmlDictionaryWriter jsonWriter)
+ {
+ }
+
+ /// <summary>
+ /// Callback method called when a Save operation is starting for this instance.
+ /// </summary>
+ protected virtual void OnSaveStarted()
+ {
+ }
+
+ /// <summary>
+ /// Callback method called when a Save operation is finished for this instance.
+ /// </summary>
+ protected virtual void OnSaveEnded()
+ {
+ }
+
+ /// <summary>
+ /// Called internally to raise the <see cref="Changing"/> event.
+ /// </summary>
+ /// <param name="sender">The object which caused the event to be raised.</param>
+ /// <param name="eventArgs">The arguments to the event.</param>
+ [SuppressMessage("Microsoft.Design", "CA1030:UseEventsWhereAppropriate",
+ Justification = "This is a helper function used to raise the event.")]
+ [SuppressMessage("Microsoft.Security", "CA2109:ReviewVisibleEventHandlers",
+ Justification = "This is not externally visible, since the constructor for this class is internal (cannot be directly derived) and all its subclasses are sealed.")]
+ protected void RaiseChangingEvent(object sender, JsonValueChangeEventArgs eventArgs)
+ {
+ EventHandler<JsonValueChangeEventArgs> changing = OnChanging;
+ if (changing != null)
+ {
+ changing(sender, eventArgs);
+ }
+ }
+
+ /// <summary>
+ /// Called internally to raise the <see cref="Changed"/> event.
+ /// </summary>
+ /// <param name="sender">The object which caused the event to be raised.</param>
+ /// <param name="eventArgs">The arguments to the event.</param>
+ [SuppressMessage("Microsoft.Design", "CA1030:UseEventsWhereAppropriate",
+ Justification = "This is a helper function used to raise the event.")]
+ [SuppressMessage("Microsoft.Security", "CA2109:ReviewVisibleEventHandlers",
+ Justification = "This is not externally visible, since the constructor for this class is internal (cannot be directly derived) and all its subclasses are sealed.")]
+ protected void RaiseChangedEvent(object sender, JsonValueChangeEventArgs eventArgs)
+ {
+ EventHandler<JsonValueChangeEventArgs> changed = OnChanged;
+ if (changed != null)
+ {
+ changed(sender, eventArgs);
+ }
+ }
+
+ private static bool IsJsonCollection(JsonValue value)
+ {
+ return value != null && (value.JsonType == JsonType.Array || value.JsonType == JsonType.Object);
+ }
+
+ /// <summary>
+ /// Enables explicit casts from an instance of type <see cref="System.Json.JsonValue"/> to a <see cref="System.String"/> object.
+ /// </summary>
+ /// <param name="value">The instance of <see cref="System.Json.JsonValue"/> used to initialize the <see cref="System.String"/> object.</param>
+ /// <returns>The <see cref="System.String"/> initialized with the <see cref="System.Json.JsonValue"/> value specified or null if value is null.</returns>
+ public static explicit operator string(JsonValue value)
+ {
+ return CastValue<string>(value);
+ }
+
+ /// <summary>
+ /// Enables explicit casts from an instance of type <see cref="System.Json.JsonValue"/> to a <see cref="System.Double"/> object.
+ /// </summary>
+ /// <param name="value">The instance of <see cref="System.Json.JsonValue"/> used to initialize the <see cref="System.Double"/> object.</param>
+ /// <returns>The <see cref="System.Double"/> initialized with the <see cref="System.Json.JsonValue"/> value specified.</returns>
+ public static explicit operator double(JsonValue value)
+ {
+ return CastValue<double>(value);
+ }
+
+ /// <summary>
+ /// Enables explicit casts from an instance of type <see cref="System.Json.JsonValue"/> to a <see cref="System.Single"/> object.
+ /// </summary>
+ /// <param name="value">The instance of <see cref="System.Json.JsonValue"/> used to initialize the <see cref="System.Single"/> object.</param>
+ /// <returns>The <see cref="System.Single"/> initialized with the <see cref="System.Json.JsonValue"/> value specified.</returns>
+ public static explicit operator float(JsonValue value)
+ {
+ return CastValue<float>(value);
+ }
+
+ /// <summary>
+ /// Enables explicit casts from an instance of type <see cref="System.Json.JsonValue"/> to a <see cref="System.Decimal"/> object.
+ /// </summary>
+ /// <param name="value">The instance of <see cref="System.Json.JsonValue"/> used to initialize the <see cref="System.Decimal"/> object.</param>
+ /// <returns>The <see cref="System.Decimal"/> initialized with the <see cref="System.Json.JsonValue"/> value specified.</returns>
+ public static explicit operator decimal(JsonValue value)
+ {
+ return CastValue<decimal>(value);
+ }
+
+ /// <summary>
+ /// Enables explicit casts from an instance of type <see cref="System.Json.JsonValue"/> to a <see cref="System.Int64"/> object.
+ /// </summary>
+ /// <param name="value">The instance of <see cref="System.Json.JsonValue"/> used to initialize the <see cref="System.Int64"/> object.</param>
+ /// <returns>The <see cref="System.Int64"/> initialized with the <see cref="System.Json.JsonValue"/> value specified.</returns>
+ public static explicit operator long(JsonValue value)
+ {
+ return CastValue<long>(value);
+ }
+
+ /// <summary>
+ /// Enables explicit casts from an instance of type <see cref="System.Json.JsonValue"/> to a <see cref="System.UInt64"/> object.
+ /// </summary>
+ /// <param name="value">The instance of <see cref="System.Json.JsonValue"/> used to initialize the <see cref="System.UInt64"/> object.</param>
+ /// <returns>The <see cref="System.UInt64"/> initialized with the <see cref="System.Json.JsonValue"/> value specified.</returns>
+ [CLSCompliant(false)]
+ public static explicit operator ulong(JsonValue value)
+ {
+ return CastValue<ulong>(value);
+ }
+
+ /// <summary>
+ /// Enables explicit casts from an instance of type <see cref="System.Json.JsonValue"/> to a <see cref="System.Int32"/> object.
+ /// </summary>
+ /// <param name="value">The instance of <see cref="System.Json.JsonValue"/> used to initialize the <see cref="System.Int32"/> object.</param>
+ /// <returns>The <see cref="System.Int32"/> initialized with the <see cref="System.Json.JsonValue"/> value specified.</returns>
+ public static explicit operator int(JsonValue value)
+ {
+ return CastValue<int>(value);
+ }
+
+ /// <summary>
+ /// Enables explicit casts from an instance of type <see cref="System.Json.JsonValue"/> to a <see cref="System.UInt32"/> object.
+ /// </summary>
+ /// <param name="value">The instance of <see cref="System.Json.JsonValue"/> used to initialize the <see cref="System.UInt32"/> object.</param>
+ /// <returns>The <see cref="System.UInt32"/> initialized with the <see cref="System.Json.JsonValue"/> value specified.</returns>
+ [CLSCompliant(false)]
+ public static explicit operator uint(JsonValue value)
+ {
+ return CastValue<uint>(value);
+ }
+
+ /// <summary>
+ /// Enables explicit casts from an instance of type <see cref="System.Json.JsonValue"/> to a <see cref="System.Int16"/> object.
+ /// </summary>
+ /// <param name="value">The instance of <see cref="System.Json.JsonValue"/> used to initialize the <see cref="System.Int16"/> object.</param>
+ /// <returns>The <see cref="System.Int16"/> initialized with the <see cref="System.Json.JsonValue"/> value specified.</returns>
+ public static explicit operator short(JsonValue value)
+ {
+ return CastValue<short>(value);
+ }
+
+ /// <summary>
+ /// Enables explicit casts from an instance of type <see cref="System.Json.JsonValue"/> to a <see cref="System.UInt16"/> object.
+ /// </summary>
+ /// <param name="value">The instance of <see cref="System.Json.JsonValue"/> used to initialize the <see cref="System.UInt16"/> object.</param>
+ /// <returns>The <see cref="System.UInt16"/> initialized with the <see cref="System.Json.JsonValue"/> value specified.</returns>
+ [CLSCompliant(false)]
+ public static explicit operator ushort(JsonValue value)
+ {
+ return CastValue<ushort>(value);
+ }
+
+ /// <summary>
+ /// Enables explicit casts from an instance of type <see cref="System.Json.JsonValue"/> to a <see cref="System.SByte"/> object.
+ /// </summary>
+ /// <param name="value">The instance of <see cref="System.Json.JsonValue"/> used to initialize the <see cref="System.SByte"/> object.</param>
+ /// <returns>The <see cref="System.SByte"/> initialized with the <see cref="System.Json.JsonValue"/> value specified.</returns>
+ [CLSCompliant(false)]
+ public static explicit operator sbyte(JsonValue value)
+ {
+ return CastValue<sbyte>(value);
+ }
+
+ /// <summary>
+ /// Enables explicit casts from an instance of type <see cref="System.Json.JsonValue"/> to a <see cref="System.Byte"/> object.
+ /// </summary>
+ /// <param name="value">The instance of <see cref="System.Json.JsonValue"/> used to initialize the <see cref="System.Byte"/> object.</param>
+ /// <returns>The <see cref="System.Byte"/> initialized with the <see cref="System.Json.JsonValue"/> value specified.</returns>
+ public static explicit operator byte(JsonValue value)
+ {
+ return CastValue<byte>(value);
+ }
+
+ /// <summary>
+ /// Enables explicit casts from an instance of type <see cref="System.Json.JsonValue"/> to a <see cref="System.Uri"/> object.
+ /// </summary>
+ /// <param name="value">The instance of <see cref="System.Json.JsonValue"/> used to initialize the <see cref="System.Uri"/> object.</param>
+ /// <returns>The <see cref="System.Uri"/> initialized with the <see cref="System.Json.JsonValue"/> value specified or null if value is null.</returns>
+ public static explicit operator Uri(JsonValue value)
+ {
+ return CastValue<Uri>(value);
+ }
+
+ /// <summary>
+ /// Enables explicit casts from an instance of type <see cref="System.Json.JsonValue"/> to a <see cref="System.Guid"/> object.
+ /// </summary>
+ /// <param name="value">The instance of <see cref="System.Json.JsonValue"/> used to initialize the <see cref="System.Guid"/> object.</param>
+ /// <returns>The <see cref="System.Guid"/> initialized with the <see cref="System.Json.JsonValue"/> value specified.</returns>
+ public static explicit operator Guid(JsonValue value)
+ {
+ return CastValue<Guid>(value);
+ }
+
+ /// <summary>
+ /// Enables explicit casts from an instance of type <see cref="System.Json.JsonValue"/> to a <see cref="System.DateTime"/> object.
+ /// </summary>
+ /// <param name="value">The instance of <see cref="System.Json.JsonValue"/> used to initialize the <see cref="System.DateTime"/> object.</param>
+ /// <returns>The <see cref="System.DateTime"/> initialized with the <see cref="System.Json.JsonValue"/> value specified.</returns>
+ public static explicit operator DateTime(JsonValue value)
+ {
+ return CastValue<DateTime>(value);
+ }
+
+ /// <summary>
+ /// Enables explicit casts from an instance of type <see cref="System.Json.JsonValue"/> to a <see cref="System.Char"/> object.
+ /// </summary>
+ /// <param name="value">The instance of <see cref="System.Json.JsonValue"/> used to initialize the <see cref="System.Char"/> object.</param>
+ /// <returns>The <see cref="System.Char"/> initialized with the <see cref="System.Json.JsonValue"/> value specified.</returns>
+ public static explicit operator char(JsonValue value)
+ {
+ return CastValue<char>(value);
+ }
+
+ /// <summary>
+ /// Enables explicit casts from an instance of type <see cref="System.Json.JsonValue"/> to a <see cref="System.Boolean"/> object.
+ /// </summary>
+ /// <param name="value">The instance of <see cref="System.Json.JsonValue"/> used to initialize the <see cref="System.Boolean"/> object.</param>
+ /// <returns>The <see cref="System.Boolean"/> initialized with the <see cref="System.Json.JsonValue"/> value specified.</returns>
+ public static explicit operator bool(JsonValue value)
+ {
+ return CastValue<bool>(value);
+ }
+
+ /// <summary>
+ /// Enables explicit casts from an instance of type <see cref="System.Json.JsonValue"/> to a <see cref="System.DateTimeOffset"/> object.
+ /// </summary>
+ /// <param name="value">The instance of <see cref="System.Json.JsonValue"/> used to initialize the <see cref="System.DateTimeOffset"/> object.</param>
+ /// <returns>The <see cref="System.DateTimeOffset"/> initialized with the <see cref="System.Json.JsonValue"/> value specified.</returns>
+ public static explicit operator DateTimeOffset(JsonValue value)
+ {
+ return CastValue<DateTimeOffset>(value);
+ }
+
+ /// <summary>
+ /// Enables implicit casts from type <see cref="System.Boolean"/> to a <see cref="System.Json.JsonPrimitive"/>.
+ /// </summary>
+ /// <param name="value">The <see cref="System.Boolean"/> instance used to initialize the <see cref="System.Json.JsonPrimitive"/>.</param>
+ /// <returns>The <see cref="System.Json.JsonValue"/> initialized with the <see cref="System.Boolean"/> specified.</returns>
+ public static implicit operator JsonValue(bool value)
+ {
+ return new JsonPrimitive(value);
+ }
+
+ /// <summary>
+ /// Enables implicit casts from type <see cref="System.Byte"/> to a <see cref="System.Json.JsonPrimitive"/>.
+ /// </summary>
+ /// <param name="value">The <see cref="System.Byte"/> instance used to initialize the <see cref="System.Json.JsonPrimitive"/>.</param>
+ /// <returns>The <see cref="System.Json.JsonValue"/> initialized with the <see cref="System.Byte"/> specified.</returns>
+ public static implicit operator JsonValue(byte value)
+ {
+ return new JsonPrimitive(value);
+ }
+
+ /// <summary>
+ /// Enables implicit casts from type <see cref="System.Decimal"/> to a <see cref="System.Json.JsonPrimitive"/>.
+ /// </summary>
+ /// <param name="value">The <see cref="System.Decimal"/> instance used to initialize the <see cref="System.Json.JsonPrimitive"/>.</param>
+ /// <returns>The <see cref="System.Json.JsonValue"/> initialized with the <see cref="System.Decimal"/> specified.</returns>
+ public static implicit operator JsonValue(decimal value)
+ {
+ return new JsonPrimitive(value);
+ }
+
+ /// <summary>
+ /// Enables implicit casts from type <see cref="System.Double"/> to a <see cref="System.Json.JsonPrimitive"/>.
+ /// </summary>
+ /// <param name="value">The <see cref="System.Double"/> instance used to initialize the <see cref="System.Json.JsonPrimitive"/>.</param>
+ /// <returns>The <see cref="System.Json.JsonValue"/> initialized with the <see cref="System.Double"/> specified.</returns>
+ public static implicit operator JsonValue(double value)
+ {
+ return new JsonPrimitive(value);
+ }
+
+ /// <summary>
+ /// Enables implicit casts from type <see cref="System.Int16"/> to a <see cref="System.Json.JsonPrimitive"/>.
+ /// </summary>
+ /// <param name="value">The <see cref="System.Int16"/> instance used to initialize the <see cref="System.Json.JsonPrimitive"/>.</param>
+ /// <returns>The <see cref="System.Json.JsonValue"/> initialized with the <see cref="System.Int16"/> specified.</returns>
+ public static implicit operator JsonValue(short value)
+ {
+ return new JsonPrimitive(value);
+ }
+
+ /// <summary>
+ /// Enables implicit casts from type <see cref="System.Int32"/> to a <see cref="System.Json.JsonPrimitive"/>.
+ /// </summary>
+ /// <param name="value">The <see cref="System.Int32"/> instance used to initialize the <see cref="System.Json.JsonPrimitive"/>.</param>
+ /// <returns>The <see cref="System.Json.JsonValue"/> initialized with the <see cref="System.Int32"/> specified.</returns>
+ public static implicit operator JsonValue(int value)
+ {
+ return new JsonPrimitive(value);
+ }
+
+ /// <summary>
+ /// Enables implicit casts from type <see cref="System.Int64"/> to a <see cref="System.Json.JsonPrimitive"/>.
+ /// </summary>
+ /// <param name="value">The <see cref="System.Int64"/> instance used to initialize the <see cref="System.Json.JsonPrimitive"/>.</param>
+ /// <returns>The <see cref="System.Json.JsonValue"/> initialized with the <see cref="System.Int64"/> specified.</returns>
+ public static implicit operator JsonValue(long value)
+ {
+ return new JsonPrimitive(value);
+ }
+
+ /// <summary>
+ /// Enables implicit casts from type <see cref="System.Single"/> to a <see cref="System.Json.JsonPrimitive"/>.
+ /// </summary>
+ /// <param name="value">The <see cref="System.Single"/> instance used to initialize the <see cref="System.Json.JsonPrimitive"/>.</param>
+ /// <returns>The <see cref="System.Json.JsonValue"/> initialized with the <see cref="System.Single"/> specified.</returns>
+ public static implicit operator JsonValue(float value)
+ {
+ return new JsonPrimitive(value);
+ }
+
+ /// <summary>
+ /// Enables implicit casts from type <see cref="System.String"/> to a <see cref="System.Json.JsonPrimitive"/>.
+ /// </summary>
+ /// <param name="value">The <see cref="System.String"/> instance used to initialize the <see cref="System.Json.JsonPrimitive"/>.</param>
+ /// <returns>The <see cref="System.Json.JsonValue"/> initialized with the <see cref="System.String"/> specified, or null if the value is null.</returns>
+ [SuppressMessage("Microsoft.Design", "CA1057:StringUriOverloadsCallSystemUriOverloads",
+ Justification = "This operator does not intend to represent a Uri overload.")]
+ public static implicit operator JsonValue(string value)
+ {
+ return value == null ? null : new JsonPrimitive(value);
+ }
+
+ /// <summary>
+ /// Enables implicit casts from type <see cref="System.Char"/> to a <see cref="System.Json.JsonPrimitive"/>.
+ /// </summary>
+ /// <param name="value">The <see cref="System.Char"/> instance used to initialize the <see cref="System.Json.JsonPrimitive"/>.</param>
+ /// <returns>The <see cref="System.Json.JsonValue"/> initialized with the <see cref="System.Char"/> specified.</returns>
+ public static implicit operator JsonValue(char value)
+ {
+ return new JsonPrimitive(value);
+ }
+
+ /// <summary>
+ /// Enables implicit casts from type <see cref="System.DateTime"/> to a <see cref="System.Json.JsonPrimitive"/>.
+ /// </summary>
+ /// <param name="value">The <see cref="System.DateTime"/> instance used to initialize the <see cref="System.Json.JsonPrimitive"/>.</param>
+ /// <returns>The <see cref="System.Json.JsonValue"/> initialized with the <see cref="System.DateTime"/> specified.</returns>
+ public static implicit operator JsonValue(DateTime value)
+ {
+ return new JsonPrimitive(value);
+ }
+
+ /// <summary>
+ /// Enables implicit casts from type <see cref="System.Guid"/> to a <see cref="System.Json.JsonPrimitive"/>.
+ /// </summary>
+ /// <param name="value">The <see cref="System.Guid"/> instance used to initialize the <see cref="System.Json.JsonPrimitive"/>.</param>
+ /// <returns>The <see cref="System.Json.JsonValue"/> initialized with the <see cref="System.Guid"/> specified.</returns>
+ public static implicit operator JsonValue(Guid value)
+ {
+ return new JsonPrimitive(value);
+ }
+
+ /// <summary>
+ /// Enables implicit casts from type <see cref="System.Uri"/> to a <see cref="System.Json.JsonPrimitive"/>.
+ /// </summary>
+ /// <param name="value">The <see cref="System.Uri"/> instance used to initialize the <see cref="System.Json.JsonPrimitive"/>.</param>
+ /// <returns>The <see cref="System.Json.JsonValue"/> initialized with the <see cref="System.Uri"/> specified, or null if the value is null.</returns>
+ public static implicit operator JsonValue(Uri value)
+ {
+ return value == null ? null : new JsonPrimitive(value);
+ }
+
+ /// <summary>
+ /// Enables implicit casts from type <see cref="System.SByte"/> to a <see cref="System.Json.JsonPrimitive"/>.
+ /// </summary>
+ /// <param name="value">The <see cref="System.SByte"/> instance used to initialize the <see cref="System.Json.JsonPrimitive"/>.</param>
+ /// <returns>The <see cref="System.Json.JsonValue"/> initialized with the <see cref="System.SByte"/> specified.</returns>
+ [CLSCompliant(false)]
+ public static implicit operator JsonValue(sbyte value)
+ {
+ return new JsonPrimitive(value);
+ }
+
+ /// <summary>
+ /// Enables implicit casts from type <see cref="System.UInt16"/> to a <see cref="System.Json.JsonPrimitive"/>.
+ /// </summary>
+ /// <param name="value">The <see cref="System.UInt16"/> instance used to initialize the <see cref="System.Json.JsonPrimitive"/>.</param>
+ /// <returns>The <see cref="System.Json.JsonValue"/> initialized with the <see cref="System.UInt16"/> specified.</returns>
+ [CLSCompliant(false)]
+ public static implicit operator JsonValue(ushort value)
+ {
+ return new JsonPrimitive(value);
+ }
+
+ /// <summary>
+ /// Enables implicit casts from type <see cref="System.UInt32"/> to a <see cref="System.Json.JsonPrimitive"/>.
+ /// </summary>
+ /// <param name="value">The <see cref="System.UInt32"/> instance used to initialize the <see cref="System.Json.JsonPrimitive"/>.</param>
+ /// <returns>The <see cref="System.Json.JsonValue"/> initialized with the <see cref="System.UInt32"/> specified.</returns>
+ [CLSCompliant(false)]
+ public static implicit operator JsonValue(uint value)
+ {
+ return new JsonPrimitive(value);
+ }
+
+ /// <summary>
+ /// Enables implicit casts from type <see cref="System.UInt64"/> to a <see cref="System.Json.JsonPrimitive"/>.
+ /// </summary>
+ /// <param name="value">The <see cref="System.UInt64"/> instance used to initialize the <see cref="System.Json.JsonPrimitive"/>.</param>
+ /// <returns>The <see cref="System.Json.JsonValue"/> initialized with the <see cref="System.UInt64"/> specified.</returns>
+ [CLSCompliant(false)]
+ public static implicit operator JsonValue(ulong value)
+ {
+ return new JsonPrimitive(value);
+ }
+
+ /// <summary>
+ /// Enables implicit casts from type <see cref="System.DateTimeOffset"/> to a <see cref="System.Json.JsonPrimitive"/>.
+ /// </summary>
+ /// <param name="value">The <see cref="System.DateTimeOffset"/> instance used to initialize the <see cref="System.Json.JsonPrimitive"/>.</param>
+ /// <returns>The <see cref="System.Json.JsonValue"/> initialized with the <see cref="System.DateTimeOffset"/> specified.</returns>
+ public static implicit operator JsonValue(DateTimeOffset value)
+ {
+ return new JsonPrimitive(value);
+ }
+ }
+}
--- /dev/null
+// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
+
+namespace System.Json
+{
+ /// <summary>
+ /// Specifies the event type when an event is raised for a <see cref="System.Json.JsonValue"/>.
+ /// </summary>
+ public enum JsonValueChange
+ {
+ /// <summary>
+ /// An element has been or will be added to the collection.
+ /// </summary>
+ Add,
+
+ /// <summary>
+ /// An element has been or will be removed from the collection.
+ /// </summary>
+ Remove,
+
+ /// <summary>
+ /// An element has been or will be replaced in the collection. Used on indexers.
+ /// </summary>
+ Replace,
+
+ /// <summary>
+ /// All elements of the collection have been or will be removed.
+ /// </summary>
+ Clear,
+ }
+}
--- /dev/null
+// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
+
+namespace System.Json
+{
+ /// <summary>
+ /// Provide data for the <see cref="System.Json.JsonValue.Changing"/> and <see cref="System.Json.JsonValue.Changed"/> events.
+ /// </summary>
+ public class JsonValueChangeEventArgs : EventArgs
+ {
+ private JsonValue child;
+ private JsonValueChange change;
+ private int index;
+ private string key;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="System.Json.JsonValueChangeEventArgs"/> class for
+ /// changes in a <see cref="System.Json.JsonArray"/>.
+ /// </summary>
+ /// <param name="child">The <see cref="System.Json.JsonValue"/> instance which will be or has been modified.</param>
+ /// <param name="change">The type of change of the <see cref="System.Json.JsonValue"/> event.</param>
+ /// <param name="index">The index of the element being changed in a <see cref="System.Json.JsonArray"/>.</param>
+ public JsonValueChangeEventArgs(JsonValue child, JsonValueChange change, int index)
+ {
+ if (index < 0)
+ {
+ throw new ArgumentOutOfRangeException("index", RS.Format(Properties.Resources.ArgumentMustBeGreaterThanOrEqualTo, index, 0));
+ }
+
+ this.child = child;
+ this.change = change;
+ this.index = index;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="System.Json.JsonValueChangeEventArgs"/> class for
+ /// changes in a <see cref="System.Json.JsonObject"/>.
+ /// </summary>
+ /// <param name="child">The <see cref="System.Json.JsonValue"/> instance which will be or has been modified.</param>
+ /// <param name="change">The type of change of the <see cref="System.Json.JsonValue"/> event.</param>
+ /// <param name="key">The key of the element being changed in a <see cref="System.Json.JsonObject"/>.</param>
+ public JsonValueChangeEventArgs(JsonValue child, JsonValueChange change, string key)
+ {
+ if (change != JsonValueChange.Clear)
+ {
+ if (key == null)
+ {
+ throw new ArgumentNullException("key");
+ }
+ }
+
+ this.child = child;
+ this.change = change;
+ index = -1;
+ this.key = key;
+ }
+
+ /// <summary>
+ /// Gets the child which will be or has been modified.
+ /// </summary>
+ /// <remarks><p>This property is <code>null</code> for <see cref="System.Json.JsonValueChange.Clear"/> event types
+ /// raised by <see cref="System.Json.JsonValue"/> instances.</p>
+ /// <p>For <see cref="System.Json.JsonValueChange">Replace</see> events, this property contains the new value in
+ /// the <see cref="System.Json.JsonValue.Changing"/> event, and the old value (the one being replaced) in the
+ /// <see cref="System.Json.JsonValue.Changed"/> event.</p></remarks>
+ public JsonValue Child
+ {
+ get { return child; }
+ }
+
+ /// <summary>
+ /// Gets the type of change.
+ /// </summary>
+ public JsonValueChange Change
+ {
+ get { return change; }
+ }
+
+ /// <summary>
+ /// Gets the index in the <see cref="System.Json.JsonArray"/> where the change happened, or
+ /// <code>-1</code> if the change happened in a <see cref="System.Json.JsonValue"/> of a different type.
+ /// </summary>
+ public int Index
+ {
+ get { return index; }
+ }
+
+ /// <summary>
+ /// Gets the key in the <see cref="System.Json.JsonObject"/> where the change happened, or
+ /// <code>null</code> if the change happened in a <see cref="System.Json.JsonValue"/> of a different type.
+ /// </summary>
+ /// <remarks>This property can also be <code>null</code> if the event type is
+ /// <see cref="System.Json.JsonValueChange">Clear</see>.</remarks>
+ public string Key
+ {
+ get { return key; }
+ }
+ }
+}
--- /dev/null
+// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
+#if FEATURE_DYNAMIC
+using System.Collections.Generic;
+using System.Dynamic;
+using System.Linq.Expressions;
+using System.Reflection;
+using System.Runtime.Serialization.Json;
+
+namespace System.Json
+{
+ /// <summary>
+ /// This class provides dynamic behavior support for the JsonValue types.
+ /// </summary>
+ internal class JsonValueDynamicMetaObject : DynamicMetaObject
+ {
+ private static readonly MethodInfo _getValueByIndexMethodInfo = typeof(JsonValue).GetMethod("GetValue", new Type[] { typeof(int) });
+ private static readonly MethodInfo _getValueByKeyMethodInfo = typeof(JsonValue).GetMethod("GetValue", new Type[] { typeof(string) });
+ private static readonly MethodInfo _setValueByIndexMethodInfo = typeof(JsonValue).GetMethod("SetValue", new Type[] { typeof(int), typeof(object) });
+ private static readonly MethodInfo _setValueByKeyMethodInfo = typeof(JsonValue).GetMethod("SetValue", new Type[] { typeof(string), typeof(object) });
+ private static readonly MethodInfo _castValueMethodInfo = typeof(JsonValue).GetMethod("CastValue", new Type[] { typeof(JsonValue) });
+ private static readonly MethodInfo _changeTypeMethodInfo = typeof(Convert).GetMethod("ChangeType", new Type[] { typeof(object), typeof(Type) });
+
+ /// <summary>
+ /// Class constructor.
+ /// </summary>
+ /// <param name="parameter">The expression representing this <see cref="DynamicMetaObject"/> during the dynamic binding process.</param>
+ /// <param name="value">The runtime value represented by the <see cref="DynamicMetaObject"/>.</param>
+ internal JsonValueDynamicMetaObject(Expression parameter, JsonValue value)
+ : base(parameter, BindingRestrictions.Empty, value)
+ {
+ }
+
+ /// <summary>
+ /// Gets the default binding restrictions for this type.
+ /// </summary>
+ private BindingRestrictions DefaultRestrictions
+ {
+ get { return BindingRestrictions.GetTypeRestriction(Expression, LimitType); }
+ }
+
+ /// <summary>
+ /// Implements dynamic cast for JsonValue types.
+ /// </summary>
+ /// <param name="binder">An instance of the <see cref="ConvertBinder"/> that represents the details of the dynamic operation.</param>
+ /// <returns>The new <see cref="DynamicMetaObject"/> representing the result of the binding.</returns>
+ public override DynamicMetaObject BindConvert(ConvertBinder binder)
+ {
+ if (binder == null)
+ {
+ throw new ArgumentNullException("binder");
+ }
+
+ Expression expression = Expression;
+
+ bool implicitCastSupported =
+ binder.Type.IsAssignableFrom(LimitType) ||
+ binder.Type == typeof(IEnumerable<KeyValuePair<string, JsonValue>>) ||
+ binder.Type == typeof(IDynamicMetaObjectProvider) ||
+ binder.Type == typeof(object);
+
+ if (!implicitCastSupported)
+ {
+ if (JsonValue.IsSupportedExplicitCastType(binder.Type))
+ {
+ Expression instance = Expression.Convert(Expression, LimitType);
+ expression = Expression.Call(_castValueMethodInfo.MakeGenericMethod(binder.Type), new Expression[] { instance });
+ }
+ else
+ {
+ string exceptionMessage = RS.Format(Properties.Resources.CannotCastJsonValue, LimitType.FullName, binder.Type.FullName);
+ expression = Expression.Throw(Expression.Constant(new InvalidCastException(exceptionMessage)), typeof(object));
+ }
+ }
+
+ expression = Expression.Convert(expression, binder.Type);
+
+ return new DynamicMetaObject(expression, DefaultRestrictions);
+ }
+
+ /// <summary>
+ /// Implements setter for dynamic indexer by index (JsonArray)
+ /// </summary>
+ /// <param name="binder">An instance of the <see cref="GetIndexBinder"/> that represents the details of the dynamic operation.</param>
+ /// <param name="indexes">An array of <see cref="DynamicMetaObject"/> instances - indexes for the get index operation.</param>
+ /// <returns>The new <see cref="DynamicMetaObject"/> representing the result of the binding.</returns>
+ public override DynamicMetaObject BindGetIndex(GetIndexBinder binder, DynamicMetaObject[] indexes)
+ {
+ if (binder == null)
+ {
+ throw new ArgumentNullException("binder");
+ }
+
+ if (indexes == null)
+ {
+ throw new ArgumentNullException("indexes");
+ }
+
+ Expression indexExpression;
+ if (!JsonValueDynamicMetaObject.TryGetIndexExpression(indexes, out indexExpression))
+ {
+ return new DynamicMetaObject(indexExpression, DefaultRestrictions);
+ }
+
+ MethodInfo methodInfo = indexExpression.Type == typeof(string) ? _getValueByKeyMethodInfo : _getValueByIndexMethodInfo;
+ Expression[] args = new Expression[] { indexExpression };
+
+ return GetMethodMetaObject(methodInfo, args);
+ }
+
+ /// <summary>
+ /// Implements getter for dynamic indexer by index (JsonArray).
+ /// </summary>
+ /// <param name="binder">An instance of the <see cref="SetIndexBinder"/> that represents the details of the dynamic operation.</param>
+ /// <param name="indexes">An array of <see cref="DynamicMetaObject"/> instances - indexes for the set index operation.</param>
+ /// <param name="value">The <see cref="DynamicMetaObject"/> representing the value for the set index operation.</param>
+ /// <returns>The new <see cref="DynamicMetaObject"/> representing the result of the binding.</returns>
+ public override DynamicMetaObject BindSetIndex(SetIndexBinder binder, DynamicMetaObject[] indexes, DynamicMetaObject value)
+ {
+ if (binder == null)
+ {
+ throw new ArgumentNullException("binder");
+ }
+
+ if (indexes == null)
+ {
+ throw new ArgumentNullException("indexes");
+ }
+
+ if (value == null)
+ {
+ throw new ArgumentNullException("value");
+ }
+
+ Expression indexExpression;
+ if (!JsonValueDynamicMetaObject.TryGetIndexExpression(indexes, out indexExpression))
+ {
+ return new DynamicMetaObject(indexExpression, DefaultRestrictions);
+ }
+
+ MethodInfo methodInfo = indexExpression.Type == typeof(string) ? _setValueByKeyMethodInfo : _setValueByIndexMethodInfo;
+ Expression[] args = new Expression[] { indexExpression, Expression.Convert(value.Expression, typeof(object)) };
+
+ return GetMethodMetaObject(methodInfo, args);
+ }
+
+ /// <summary>
+ /// Implements getter for dynamic indexer by key (JsonObject).
+ /// </summary>
+ /// <param name="binder">An instance of the <see cref="GetMemberBinder"/> that represents the details of the dynamic operation.</param>
+ /// <returns>The new <see cref="DynamicMetaObject"/> representing the result of the binding.</returns>
+ public override DynamicMetaObject BindGetMember(GetMemberBinder binder)
+ {
+ if (binder == null)
+ {
+ throw new ArgumentNullException("binder");
+ }
+
+ PropertyInfo propInfo = LimitType.GetProperty(binder.Name, BindingFlags.Instance | BindingFlags.Public);
+
+ if (propInfo != null)
+ {
+ return base.BindGetMember(binder);
+ }
+
+ Expression[] args = new Expression[] { Expression.Constant(binder.Name) };
+
+ return GetMethodMetaObject(_getValueByKeyMethodInfo, args);
+ }
+
+ /// <summary>
+ /// Implements setter for dynamic indexer by key (JsonObject).
+ /// </summary>
+ /// <param name="binder">An instance of the <see cref="SetMemberBinder"/> that represents the details of the dynamic operation.</param>
+ /// <param name="value">The <see cref="DynamicMetaObject"/> representing the value for the set member operation.</param>
+ /// <returns>The new <see cref="DynamicMetaObject"/> representing the result of the binding.</returns>
+ public override DynamicMetaObject BindSetMember(SetMemberBinder binder, DynamicMetaObject value)
+ {
+ if (binder == null)
+ {
+ throw new ArgumentNullException("binder");
+ }
+
+ if (value == null)
+ {
+ throw new ArgumentNullException("value");
+ }
+
+ Expression[] args = new Expression[] { Expression.Constant(binder.Name), Expression.Convert(value.Expression, typeof(object)) };
+
+ return GetMethodMetaObject(_setValueByKeyMethodInfo, args);
+ }
+
+ /// <summary>
+ /// Performs the binding of the dynamic invoke member operation.
+ /// Implemented to support extension methods defined in <see cref="JsonValueExtensions"/> type.
+ /// </summary>
+ /// <param name="binder">An instance of the InvokeMemberBinder that represents the details of the dynamic operation.</param>
+ /// <param name="args">An array of DynamicMetaObject instances - arguments to the invoke member operation.</param>
+ /// <returns>The new DynamicMetaObject representing the result of the binding.</returns>
+ public override DynamicMetaObject BindInvokeMember(InvokeMemberBinder binder, DynamicMetaObject[] args)
+ {
+ if (binder == null)
+ {
+ throw new ArgumentNullException("binder");
+ }
+
+ if (args == null)
+ {
+ throw new ArgumentNullException("args");
+ }
+
+ List<Type> argTypeList = new List<Type>();
+
+ for (int idx = 0; idx < args.Length; idx++)
+ {
+ argTypeList.Add(args[idx].LimitType);
+ }
+
+ MethodInfo methodInfo = Value.GetType().GetMethod(binder.Name, argTypeList.ToArray());
+
+ if (methodInfo == null)
+ {
+ argTypeList.Insert(0, typeof(JsonValue));
+
+ Type[] argTypes = argTypeList.ToArray();
+
+ methodInfo = JsonValueDynamicMetaObject.GetExtensionMethod(typeof(JsonValueExtensions), binder.Name, argTypes);
+
+ if (methodInfo != null)
+ {
+ Expression thisInstance = Expression.Convert(Expression, LimitType);
+ Expression[] argsExpression = new Expression[argTypes.Length];
+
+ argsExpression[0] = thisInstance;
+ for (int i = 0; i < args.Length; i++)
+ {
+ argsExpression[i + 1] = args[i].Expression;
+ }
+
+ Expression callExpression = Expression.Call(methodInfo, argsExpression);
+
+ if (methodInfo.ReturnType == typeof(void))
+ {
+ callExpression = Expression.Block(callExpression, Expression.Default(binder.ReturnType));
+ }
+ else
+ {
+ callExpression = Expression.Convert(Expression.Call(methodInfo, argsExpression), binder.ReturnType);
+ }
+
+ return new DynamicMetaObject(callExpression, DefaultRestrictions);
+ }
+ }
+
+ return base.BindInvokeMember(binder, args);
+ }
+
+ /// <summary>
+ /// Returns the enumeration of all dynamic member names.
+ /// </summary>
+ /// <returns>An <see cref="IEnumerable{T}"/> of string reprenseting the dynamic member names.</returns>
+ public override IEnumerable<string> GetDynamicMemberNames()
+ {
+ JsonValue jsonValue = Value as JsonValue;
+
+ if (jsonValue != null)
+ {
+ List<string> names = new List<string>();
+
+ foreach (KeyValuePair<string, JsonValue> pair in jsonValue)
+ {
+ names.Add(pair.Key);
+ }
+
+ return names;
+ }
+
+ return base.GetDynamicMemberNames();
+ }
+
+ /// <summary>
+ /// Gets a <see cref="MethodInfo"/> instance for the specified method name in the specified type.
+ /// </summary>
+ /// <param name="extensionProviderType">The extension provider type.</param>
+ /// <param name="methodName">The name of the method to get the info for.</param>
+ /// <param name="argTypes">The types of the method arguments.</param>
+ /// <returns>A <see cref="MethodInfo"/>instance or null if the method cannot be resolved.</returns>
+ private static MethodInfo GetExtensionMethod(Type extensionProviderType, string methodName, Type[] argTypes)
+ {
+ MethodInfo methodInfo = null;
+ MethodInfo[] methods = extensionProviderType.GetMethods();
+
+ foreach (MethodInfo info in methods)
+ {
+ if (info.Name == methodName)
+ {
+ methodInfo = info;
+
+ if (!info.IsGenericMethodDefinition)
+ {
+ bool paramsMatch = true;
+ ParameterInfo[] args = methodInfo.GetParameters();
+
+ if (args.Length == argTypes.Length)
+ {
+ for (int idx = 0; idx < args.Length; idx++)
+ {
+ if (!args[idx].ParameterType.IsAssignableFrom(argTypes[idx]))
+ {
+ paramsMatch = false;
+ break;
+ }
+ }
+
+ if (paramsMatch)
+ {
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ return methodInfo;
+ }
+
+ /// <summary>
+ /// Attempts to get an expression for an index parameter.
+ /// </summary>
+ /// <param name="indexes">The operation indexes parameter.</param>
+ /// <param name="expression">A <see cref="Expression"/> to be initialized to the index expression if the operation is successful, otherwise an error expression.</param>
+ /// <returns>true the operation is successful, false otherwise.</returns>
+ private static bool TryGetIndexExpression(DynamicMetaObject[] indexes, out Expression expression)
+ {
+ if (indexes.Length == 1 && indexes[0] != null && indexes[0].Value != null)
+ {
+ DynamicMetaObject index = indexes[0];
+ Type indexType = indexes[0].Value.GetType();
+
+ switch (Type.GetTypeCode(indexType))
+ {
+ case TypeCode.Char:
+ case TypeCode.Int16:
+ case TypeCode.UInt16:
+ case TypeCode.Byte:
+ case TypeCode.SByte:
+ Expression argExp = Expression.Convert(index.Expression, typeof(object));
+ Expression typeExp = Expression.Constant(typeof(int));
+ expression = Expression.Convert(Expression.Call(_changeTypeMethodInfo, new Expression[] { argExp, typeExp }), typeof(int));
+ return true;
+
+ case TypeCode.Int32:
+ case TypeCode.String:
+ expression = index.Expression;
+ return true;
+ }
+
+ expression = Expression.Throw(Expression.Constant(new ArgumentException(RS.Format(Properties.Resources.InvalidIndexType, indexType))), typeof(object));
+ return false;
+ }
+
+ expression = Expression.Throw(Expression.Constant(new ArgumentException(Properties.Resources.NonSingleNonNullIndexNotSupported)), typeof(object));
+ return false;
+ }
+
+ /// <summary>
+ /// Gets a <see cref="DynamicMetaObject"/> for a method call.
+ /// </summary>
+ /// <param name="methodInfo">Info for the method to be performed.</param>
+ /// <param name="args">expression array representing the method arguments</param>
+ /// <returns>A meta object for the method call.</returns>
+ private DynamicMetaObject GetMethodMetaObject(MethodInfo methodInfo, Expression[] args)
+ {
+ Expression instance = Expression.Convert(Expression, LimitType);
+ Expression methodCall = Expression.Call(instance, methodInfo, args);
+ BindingRestrictions restrictions = DefaultRestrictions;
+
+ DynamicMetaObject metaObj = new DynamicMetaObject(methodCall, restrictions);
+
+ return metaObj;
+ }
+ }
+}
+#endif
--- /dev/null
+// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
+
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics.CodeAnalysis;
+
+namespace System.Json
+{
+ /// <summary>
+ /// This class extends the funcionality of the <see cref="JsonValue"/> type for better Linq support .
+ /// </summary>
+ [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Justification = "Linq is a technical name.")]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static class JsonValueLinqExtensions
+ {
+ /// <summary>
+ /// Extension method for creating a <see cref="JsonValue"/> from an <see cref="IEnumerable{T}"/> collection of <see cref="JsonValue"/> types.
+ /// </summary>
+ /// <param name="items">The enumerable instance.</param>
+ /// <returns>A <see cref="JsonArray"/> created from the specified items.</returns>
+ public static JsonArray ToJsonArray(this IEnumerable<JsonValue> items)
+ {
+ return new JsonArray(items);
+ }
+
+ /// <summary>
+ /// Extension method for creating a <see cref="JsonValue"/> from an <see cref="IEnumerable{T}"/> collection of <see cref="KeyValuePair{K,V}"/> of <see cref="String"/> and <see cref="JsonValue"/> types.
+ /// </summary>
+ /// <param name="items">The enumerable instance.</param>
+ /// <returns>A <see cref="JsonValue"/> created from the specified items.</returns>
+ [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Justification = "JsonValue implements the nested type in param.")]
+ public static JsonObject ToJsonObject(this IEnumerable<KeyValuePair<string, JsonValue>> items)
+ {
+ return new JsonObject(items);
+ }
+ }
+}
--- /dev/null
+// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
+
+namespace System.Json
+{
+ /// <summary>
+ /// Struct that wraps values which cause JIT compilation at runtime.
+ /// This Struct is added to solve the FxCop warning CA908 in JsonObject.cs.
+ /// </summary>
+ /// <typeparam name="T">Wrapped type.</typeparam>
+ internal struct NGenWrapper<T>
+ {
+ /// <summary>
+ /// Value of type T which represents the actual data which is currently in hold.
+ /// </summary>
+ public T Value;
+
+ /// <summary>
+ /// Creates an instance of the <see cref="System.Json.NGenWrapper{T}"/> class
+ /// </summary>
+ /// <param name="value">The wrapped object of T</param>
+ public NGenWrapper(T value)
+ {
+ Value = value;
+ }
+
+ /// <summary>
+ /// Cast operator from <see cref="System.Json.NGenWrapper{T}"/> to <typeparamref name="T"/>
+ /// </summary>
+ /// <param name="value">Object in type <see cref="System.Json.NGenWrapper{T}"/></param>
+ /// <returns>Object in type <typeparamref name="T">The wrapped element type</typeparamref></returns>
+ /// <typeparamref name="T">The wrapped element type</typeparamref>
+ public static implicit operator T(NGenWrapper<T> value)
+ {
+ return value.Value;
+ }
+
+ /// <summary>
+ /// Cast operator from <typeparamref name="T"/> to <see cref="System.Json.NGenWrapper{T}"/>
+ /// </summary>
+ /// <param name="value">Object in type <typeparamref name="T"/></param>
+ /// <returns>Object in type <see cref="System.Json.NGenWrapper{T}"/></returns>
+ /// <typeparamref name="T">The wrapped element type</typeparamref>
+ public static implicit operator NGenWrapper<T>(T value)
+ {
+ return new NGenWrapper<T>(value);
+ }
+ }
+}
--- /dev/null
+// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
+
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+
+[assembly: AssemblyTitle("System.Json")]
+[assembly: AssemblyDescription("")]
+[assembly: Guid("6fd72360-ebfc-4097-96fa-2ee418c04f7b")]
--- /dev/null
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.239
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace System.Json.Properties {
+ using System;
+
+
+ /// <summary>
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ /// </summary>
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ /// <summary>
+ /// Returns the cached ResourceManager instance used by this class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("System.Json.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ /// <summary>
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The argument '{0}' must be greater than or equal to {1}..
+ /// </summary>
+ internal static string ArgumentMustBeGreaterThanOrEqualTo {
+ get {
+ return ResourceManager.GetString("ArgumentMustBeGreaterThanOrEqualTo", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Unable to cast object of type '{0}' to type '{1}'..
+ /// </summary>
+ internal static string CannotCastJsonValue {
+ get {
+ return ResourceManager.GetString("CannotCastJsonValue", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to CannotReadAsType=Cannot read '{0}' as '{1}' type..
+ /// </summary>
+ internal static string CannotReadAsType {
+ get {
+ return ResourceManager.GetString("CannotReadAsType", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Cannot read JsonPrimitive value '{0}' as '{1}'..
+ /// </summary>
+ internal static string CannotReadPrimitiveAsType {
+ get {
+ return ResourceManager.GetString("CannotReadPrimitiveAsType", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to '{0}' does not contain a definition for property '{1}'..
+ /// </summary>
+ internal static string DynamicPropertyNotDefined {
+ get {
+ return ResourceManager.GetString("DynamicPropertyNotDefined", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The input source is not correctly formatted..
+ /// </summary>
+ internal static string IncorrectJsonFormat {
+ get {
+ return ResourceManager.GetString("IncorrectJsonFormat", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to '{0}' type indexer is not supported on JsonValue of 'JsonType.{1}' type..
+ /// </summary>
+ internal static string IndexerNotSupportedOnJsonType {
+ get {
+ return ResourceManager.GetString("IndexerNotSupportedOnJsonType", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Cannot convert null to '{0}' because it is a non-nullable value type..
+ /// </summary>
+ internal static string InvalidCastNonNullable {
+ get {
+ return ResourceManager.GetString("InvalidCastNonNullable", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Cannot cast JsonPrimitive value '{0}' as '{1}'. It is not in a valid date format..
+ /// </summary>
+ internal static string InvalidDateFormat {
+ get {
+ return ResourceManager.GetString("InvalidDateFormat", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Invalid '{0}' index type; only 'System.String' and non-negative 'System.Int32' types are supported..
+ /// </summary>
+ internal static string InvalidIndexType {
+ get {
+ return ResourceManager.GetString("InvalidIndexType", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Invalid JSON primitive: {0}..
+ /// </summary>
+ internal static string InvalidJsonPrimitive {
+ get {
+ return ResourceManager.GetString("InvalidJsonPrimitive", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Cannot cast '{0}' value '{1}.{2}' as a type of '{3}'. The provided string is not a valid relative or absolute '{3}'..
+ /// </summary>
+ internal static string InvalidUriFormat {
+ get {
+ return ResourceManager.GetString("InvalidUriFormat", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to An empty string cannot be parsed as JSON..
+ /// </summary>
+ internal static string JsonStringCannotBeEmpty {
+ get {
+ return ResourceManager.GetString("JsonStringCannotBeEmpty", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Null index or multidimensional indexing is not supported by this indexer; use 'System.Int32' or 'System.String' for array and object indexing respectively..
+ /// </summary>
+ internal static string NonSingleNonNullIndexNotSupported {
+ get {
+ return ResourceManager.GetString("NonSingleNonNullIndexNotSupported", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Cannot cast JsonPrimitive value '{0}' as '{1}'. The value is either too large or too small for the specified CLR type..
+ /// </summary>
+ internal static string OverflowReadAs {
+ get {
+ return ResourceManager.GetString("OverflowReadAs", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Object type not supported..
+ /// </summary>
+ internal static string TypeNotSupported {
+ get {
+ return ResourceManager.GetString("TypeNotSupported", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Operation not supported on JsonValue instances of 'JsonType.Default' type..
+ /// </summary>
+ internal static string UseOfDefaultNotAllowed {
+ get {
+ return ResourceManager.GetString("UseOfDefaultNotAllowed", resourceCulture);
+ }
+ }
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="ArgumentMustBeGreaterThanOrEqualTo" xml:space="preserve">
+ <value>The argument '{0}' must be greater than or equal to {1}.</value>
+ </data>
+ <data name="CannotCastJsonValue" xml:space="preserve">
+ <value>Unable to cast object of type '{0}' to type '{1}'.</value>
+ </data>
+ <data name="CannotReadAsType" xml:space="preserve">
+ <value>CannotReadAsType=Cannot read '{0}' as '{1}' type.</value>
+ </data>
+ <data name="CannotReadPrimitiveAsType" xml:space="preserve">
+ <value>Cannot read JsonPrimitive value '{0}' as '{1}'.</value>
+ </data>
+ <data name="DynamicPropertyNotDefined" xml:space="preserve">
+ <value>'{0}' does not contain a definition for property '{1}'.</value>
+ </data>
+ <data name="IncorrectJsonFormat" xml:space="preserve">
+ <value>The input source is not correctly formatted.</value>
+ </data>
+ <data name="IndexerNotSupportedOnJsonType" xml:space="preserve">
+ <value>'{0}' type indexer is not supported on JsonValue of 'JsonType.{1}' type.</value>
+ </data>
+ <data name="InvalidCastNonNullable" xml:space="preserve">
+ <value>Cannot convert null to '{0}' because it is a non-nullable value type.</value>
+ </data>
+ <data name="InvalidDateFormat" xml:space="preserve">
+ <value>Cannot cast JsonPrimitive value '{0}' as '{1}'. It is not in a valid date format.</value>
+ </data>
+ <data name="InvalidIndexType" xml:space="preserve">
+ <value>Invalid '{0}' index type; only 'System.String' and non-negative 'System.Int32' types are supported.</value>
+ </data>
+ <data name="InvalidJsonPrimitive" xml:space="preserve">
+ <value>Invalid JSON primitive: {0}.</value>
+ </data>
+ <data name="InvalidUriFormat" xml:space="preserve">
+ <value>Cannot cast '{0}' value '{1}.{2}' as a type of '{3}'. The provided string is not a valid relative or absolute '{3}'.</value>
+ </data>
+ <data name="JsonStringCannotBeEmpty" xml:space="preserve">
+ <value>An empty string cannot be parsed as JSON.</value>
+ </data>
+ <data name="NonSingleNonNullIndexNotSupported" xml:space="preserve">
+ <value>Null index or multidimensional indexing is not supported by this indexer; use 'System.Int32' or 'System.String' for array and object indexing respectively.</value>
+ </data>
+ <data name="OverflowReadAs" xml:space="preserve">
+ <value>Cannot cast JsonPrimitive value '{0}' as '{1}'. The value is either too large or too small for the specified CLR type.</value>
+ </data>
+ <data name="TypeNotSupported" xml:space="preserve">
+ <value>Object type not supported.</value>
+ </data>
+ <data name="UseOfDefaultNotAllowed" xml:space="preserve">
+ <value>Operation not supported on JsonValue instances of 'JsonType.Default' type.</value>
+ </data>
+</root>
\ No newline at end of file
--- /dev/null
+//
+// JsonValueTest.cs: Tests for JSonValue
+//
+// Copyright 2011 Xamarin, Inc.
+//
+// Authors:
+// Miguel de Icaza
+//
+using NUnit.Framework;
+using System;
+using System.IO;
+using System.Text;
+using System.Json;
+
+namespace MonoTests.System
+{
+ [TestFixture]
+ public class JsonValueTests {
+ // Tests that a trailing comma is allowed in dictionary definitions
+ // Test that we correctly serialize JsonArray with null elements.
+ [Test]
+ public void ToStringOnJsonArrayWithNulls () {
+ var j = JsonValue.Load (new StringReader ("[1,2,3,null]"));
+ Assert.AreEqual (4, j.Count, "itemcount");
+ Assert.AreEqual (JsonType.Array, j.JsonType, "type");
+ var str = j.ToString ();
+ Assert.AreEqual ("[1,2,3,null]", str);
+ }
+ }
+}
// General Information about the System.Json assembly
+[assembly: AssemblyTitle ("System.Json.dll")]
+[assembly: AssemblyDescription ("System.Json.dll")]
[assembly: AssemblyDefaultAlias ("System.Json.dll")]
+[assembly: AssemblyCompany (Consts.MonoCompany)]
+[assembly: AssemblyProduct (Consts.MonoProduct)]
+[assembly: AssemblyCopyright (Consts.MonoCopyright)]
+[assembly: AssemblyVersion (Consts.FxVersion)]
+[assembly: SatelliteContractVersion (Consts.FxVersion)]
[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
+[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+
+[assembly: NeutralResourcesLanguage ("en-US")]
+[assembly: AssemblyDelaySign (true)]
+[assembly: AssemblyKeyFile ("../winfx.pub")]
+
+[assembly: ComVisible (false)]
+
+[assembly: SecurityCritical]
SUBDIRS =
include ../../build/rules.make
-System.Json.Properties.Resources.resources: ../../../external/aspnetwebstack/src/System.Json/Properties/Resources.resx
- $(RESGEN) "$<" "$@"
-
LIBRARY = System.Json.dll
-LIB_MCS_FLAGS = /d:ASPNETMVC -keyfile:../winfx.pub -delaysign \
+LIB_MCS_FLAGS = \
/r:System.dll \
/r:System.Xml.dll \
/r:System.Core.dll \
- /r:System.Runtime.Serialization.dll \
- /r:System.ServiceModel.Web.dll \
- /resource:System.Json.Properties.Resources.resources
-
-ifeq (4, $(FRAMEWORK_VERSION_MAJOR))
-LIB_MCS_FLAGS += /r:Microsoft.CSharp.dll
-endif
+ /r:System.ServiceModel.Web.dll
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
-include ../../build/library.make
+EXTRA_DISTFILES =
-$(the_lib): System.Json.Properties.Resources.resources
+VALID_PROFILE := $(filter 2 4, $(FRAMEWORK_VERSION_MAJOR))
+
+ifndef VALID_PROFILE
+LIBRARY_NAME = dummy-System.Json.dll
+NO_INSTALL = yes
+NO_SIGN_ASSEMBLY = yes
+NO_TEST = yes
+endif
+
+include ../../build/library.make
<AssemblyName>System.Json</AssemblyName>\r
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- <!-- Filter out System.Core added by: Microsoft.NETFramework.props -->\r
- <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
- <PlatformTarget>AnyCPU</PlatformTarget>\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<NoWarn>1699</NoWarn>\r
<Optimize>false</Optimize>\r
- <DefineConstants>DEBUG;TRACE;NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;ASPNETMVC</DefineConstants>\r
+ <DefineConstants>DEBUG;TRACE;NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
<AdditionalLibPaths>./../../class/lib/net_4_0</AdditionalLibPaths>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
- <PlatformTarget>AnyCPU</PlatformTarget> \r
<DebugType>pdbonly</DebugType>\r
<NoWarn>1699</NoWarn>\r
<Optimize>true</Optimize>\r
- <DefineConstants>NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;ASPNETMVC</DefineConstants>\r
+ <DefineConstants>NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
<AdditionalLibPaths>./../../class/lib/net_4_0</AdditionalLibPaths>\r
<ItemGroup>\r
<Compile Include="..\..\build\common\Consts.cs" />
<Compile Include="Assembly\AssemblyInfo.cs" />
- <Compile Include="..\..\..\external\aspnetwebstack\src\RS.cs" />
- <Compile Include="..\..\..\external\aspnetwebstack\src\CommonAssemblyInfo.cs" />
- <Compile Include="..\..\..\external\aspnetwebstack\src\TransparentCommonAssemblyInfo.cs" />
- <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\Properties\AssemblyInfo.cs" />
- <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\Extensions\JsonValueExtensions.cs" />
- <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\GlobalSuppressions.cs" />
- <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JXmlToJsonValueConverter.cs" />
- <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JsonArray.cs" />
- <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JsonObject.cs" />
- <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JsonPrimitive.cs" />
- <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JsonType.cs" />
- <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JsonValue.cs" />
- <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JsonValueChange.cs" />
- <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JsonValueChangeEventArgs.cs" />
- <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JsonValueDynamicMetaObject.cs" />
- <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JsonValueLinqExtensions.cs" />
- <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\NGenWrapper.cs" />
- <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\Properties\Resources.Designer.cs" />
+ <Compile Include="System.Json\JsonArray.cs" />
+ <Compile Include="System.Json\JsonObject.cs" />
+ <Compile Include="System.Json\JsonPrimitive.cs" />
+ <Compile Include="System.Json\JsonType.cs" />
+ <Compile Include="System.Json\JsonValue.cs" />
+ <Compile Include="..\System.ServiceModel.Web\System.Runtime.Serialization.Json\JavaScriptReader.cs" />
\r
</ItemGroup>\r
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
<PreBuildEvent></PreBuildEvent>\r
</PropertyGroup>\r
<ItemGroup>\r
- <Reference Include="mscorlib.dll">
+ <Reference Include="mscorlib.dll">
<SpecificVersion>False</SpecificVersion>
<HintPath>mscorlib.dll</HintPath>
</Reference>
<SpecificVersion>False</SpecificVersion>
<HintPath>System.Core.dll</HintPath>
</Reference>
- <Reference Include="System.Runtime.Serialization.dll">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>System.Runtime.Serialization.dll</HintPath>
- </Reference>
<Reference Include="System.ServiceModel.Web.dll">
<SpecificVersion>False</SpecificVersion>
<HintPath>System.ServiceModel.Web.dll</HintPath>
</Reference>
- <Reference Include="Microsoft.CSharp.dll">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>Microsoft.CSharp.dll</HintPath>
- </Reference>
\r
</ItemGroup>\r
<ItemGroup>\r
<Folder Include="Properties\" />\r
</ItemGroup>\r
- <ItemGroup>
- <EmbeddedResource Include="System.Json.Properties.Resources.resources">
- <LogicalName>System.Json.Properties.Resources.resources</LogicalName>
- </EmbeddedResource>
- </ItemGroup>
-\r
+ \r
</Project>\r
<AssemblyName>System.Json</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- <!-- Filter out System.Core added by: Microsoft.NETFramework.props -->\r
- <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
- <PlatformTarget>AnyCPU</PlatformTarget>\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<NoWarn>1699</NoWarn>\r
<Optimize>false</Optimize>\r
- <DefineConstants>DEBUG;TRACE;NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;NET_4_5;ASPNETMVC</DefineConstants>\r
+ <DefineConstants>DEBUG;TRACE;NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;NET_4_5</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
<AdditionalLibPaths>./../../class/lib/net_4_5</AdditionalLibPaths>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
- <PlatformTarget>AnyCPU</PlatformTarget> \r
<DebugType>pdbonly</DebugType>\r
<NoWarn>1699</NoWarn>\r
<Optimize>true</Optimize>\r
- <DefineConstants>NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;NET_4_5;ASPNETMVC</DefineConstants>\r
+ <DefineConstants>NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;NET_4_5</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
<AdditionalLibPaths>./../../class/lib/net_4_5</AdditionalLibPaths>\r
<ItemGroup>\r
<Compile Include="..\..\build\common\Consts.cs" />
<Compile Include="Assembly\AssemblyInfo.cs" />
- <Compile Include="..\..\..\external\aspnetwebstack\src\RS.cs" />
- <Compile Include="..\..\..\external\aspnetwebstack\src\CommonAssemblyInfo.cs" />
- <Compile Include="..\..\..\external\aspnetwebstack\src\TransparentCommonAssemblyInfo.cs" />
- <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\Properties\AssemblyInfo.cs" />
- <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\Extensions\JsonValueExtensions.cs" />
- <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\GlobalSuppressions.cs" />
- <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JXmlToJsonValueConverter.cs" />
- <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JsonArray.cs" />
- <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JsonObject.cs" />
- <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JsonPrimitive.cs" />
- <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JsonType.cs" />
- <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JsonValue.cs" />
- <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JsonValueChange.cs" />
- <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JsonValueChangeEventArgs.cs" />
- <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JsonValueDynamicMetaObject.cs" />
- <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JsonValueLinqExtensions.cs" />
- <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\NGenWrapper.cs" />
- <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\Properties\Resources.Designer.cs" />
+ <Compile Include="System.Json\JsonArray.cs" />
+ <Compile Include="System.Json\JsonObject.cs" />
+ <Compile Include="System.Json\JsonPrimitive.cs" />
+ <Compile Include="System.Json\JsonType.cs" />
+ <Compile Include="System.Json\JsonValue.cs" />
+ <Compile Include="..\System.ServiceModel.Web\System.Runtime.Serialization.Json\JavaScriptReader.cs" />
\r
</ItemGroup>\r
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
<PreBuildEvent></PreBuildEvent>\r
</PropertyGroup>\r
<ItemGroup>\r
- <Reference Include="mscorlib.dll">
+ <Reference Include="mscorlib.dll">
<SpecificVersion>False</SpecificVersion>
<HintPath>mscorlib.dll</HintPath>
</Reference>
<SpecificVersion>False</SpecificVersion>
<HintPath>System.Core.dll</HintPath>
</Reference>
- <Reference Include="System.Runtime.Serialization.dll">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>System.Runtime.Serialization.dll</HintPath>
- </Reference>
<Reference Include="System.ServiceModel.Web.dll">
<SpecificVersion>False</SpecificVersion>
<HintPath>System.ServiceModel.Web.dll</HintPath>
</Reference>
- <Reference Include="Microsoft.CSharp.dll">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>Microsoft.CSharp.dll</HintPath>
- </Reference>
\r
</ItemGroup>\r
<ItemGroup>\r
<Folder Include="Properties\" />\r
</ItemGroup>\r
- <ItemGroup>
- <EmbeddedResource Include="System.Json.Properties.Resources.resources">
- <LogicalName>System.Json.Properties.Resources.resources</LogicalName>
- </EmbeddedResource>
- </ItemGroup>
-\r
+ \r
</Project>\r
<AssemblyName>System.Json_test_net_4_0</AssemblyName>\r
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- <!-- Filter out System.Core added by: Microsoft.NETFramework.props -->\r
- <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
- <PlatformTarget>AnyCPU</PlatformTarget>\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<NoWarn>1699</NoWarn>\r
<Optimize>false</Optimize>\r
- <DefineConstants>DEBUG;TRACE;NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;ASPNETMVC</DefineConstants>\r
+ <DefineConstants>DEBUG;TRACE;NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
<AdditionalLibPaths>./../../class/lib/net_4_0</AdditionalLibPaths>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
- <PlatformTarget>AnyCPU</PlatformTarget> \r
<DebugType>pdbonly</DebugType>\r
<NoWarn>1699</NoWarn>\r
<Optimize>true</Optimize>\r
- <DefineConstants>NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;ASPNETMVC</DefineConstants>\r
+ <DefineConstants>NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
<AdditionalLibPaths>./../../class/lib/net_4_0</AdditionalLibPaths>\r
<PreBuildEvent></PreBuildEvent>\r
</PropertyGroup>\r
<ItemGroup>\r
- <Reference Include="mscorlib.dll">
+ <Reference Include="mscorlib.dll">
<SpecificVersion>False</SpecificVersion>
<HintPath>mscorlib.dll</HintPath>
</Reference>
<SpecificVersion>False</SpecificVersion>
<HintPath>System.Core.dll</HintPath>
</Reference>
- <Reference Include="System.Runtime.Serialization.dll">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>System.Runtime.Serialization.dll</HintPath>
- </Reference>
<Reference Include="System.ServiceModel.Web.dll">
<SpecificVersion>False</SpecificVersion>
<HintPath>System.ServiceModel.Web.dll</HintPath>
</Reference>
- <Reference Include="Microsoft.CSharp.dll">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>Microsoft.CSharp.dll</HintPath>
- </Reference>
<Reference Include="nunit.framework" />
\r
</ItemGroup>\r
<ItemGroup>\r
<Folder Include="Properties\" />\r
</ItemGroup>\r
- <ItemGroup>
- <EmbeddedResource Include="System.Json.Properties.Resources.resources">
- <LogicalName>System.Json.Properties.Resources.resources</LogicalName>
- </EmbeddedResource>
- </ItemGroup>
-\r
+ \r
</Project>\r
<AssemblyName>System.Json_test_net_4_5</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- <!-- Filter out System.Core added by: Microsoft.NETFramework.props -->\r
- <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
- <PlatformTarget>AnyCPU</PlatformTarget>\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<NoWarn>1699</NoWarn>\r
<Optimize>false</Optimize>\r
- <DefineConstants>DEBUG;TRACE;NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;NET_4_5;ASPNETMVC</DefineConstants>\r
+ <DefineConstants>DEBUG;TRACE;NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;NET_4_5</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
<AdditionalLibPaths>./../../class/lib/net_4_5</AdditionalLibPaths>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
- <PlatformTarget>AnyCPU</PlatformTarget> \r
<DebugType>pdbonly</DebugType>\r
<NoWarn>1699</NoWarn>\r
<Optimize>true</Optimize>\r
- <DefineConstants>NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;NET_4_5;ASPNETMVC</DefineConstants>\r
+ <DefineConstants>NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;NET_4_5</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
<AdditionalLibPaths>./../../class/lib/net_4_5</AdditionalLibPaths>\r
<PreBuildEvent></PreBuildEvent>\r
</PropertyGroup>\r
<ItemGroup>\r
- <Reference Include="mscorlib.dll">
+ <Reference Include="mscorlib.dll">
<SpecificVersion>False</SpecificVersion>
<HintPath>mscorlib.dll</HintPath>
</Reference>
<SpecificVersion>False</SpecificVersion>
<HintPath>System.Core.dll</HintPath>
</Reference>
- <Reference Include="System.Runtime.Serialization.dll">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>System.Runtime.Serialization.dll</HintPath>
- </Reference>
<Reference Include="System.ServiceModel.Web.dll">
<SpecificVersion>False</SpecificVersion>
<HintPath>System.ServiceModel.Web.dll</HintPath>
</Reference>
- <Reference Include="Microsoft.CSharp.dll">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>Microsoft.CSharp.dll</HintPath>
- </Reference>
<Reference Include="nunit.framework" />
\r
</ItemGroup>\r
<ItemGroup>\r
<Folder Include="Properties\" />\r
</ItemGroup>\r
- <ItemGroup>
- <EmbeddedResource Include="System.Json.Properties.Resources.resources">
- <LogicalName>System.Json.Properties.Resources.resources</LogicalName>
- </EmbeddedResource>
- </ItemGroup>
-\r
+ \r
</Project>\r
../../build/common/Consts.cs
Assembly/AssemblyInfo.cs
-
-../../../external/aspnetwebstack/src/RS.cs
-../../../external/aspnetwebstack/src/CommonAssemblyInfo.cs
-../../../external/aspnetwebstack/src/TransparentCommonAssemblyInfo.cs
-
-../../../external/aspnetwebstack/src/System.Json/Properties/AssemblyInfo.cs
-../../../external/aspnetwebstack/src/System.Json/Extensions/JsonValueExtensions.cs
-../../../external/aspnetwebstack/src/System.Json/GlobalSuppressions.cs
-../../../external/aspnetwebstack/src/System.Json/JXmlToJsonValueConverter.cs
-../../../external/aspnetwebstack/src/System.Json/JsonArray.cs
-../../../external/aspnetwebstack/src/System.Json/JsonObject.cs
-../../../external/aspnetwebstack/src/System.Json/JsonPrimitive.cs
-../../../external/aspnetwebstack/src/System.Json/JsonType.cs
-../../../external/aspnetwebstack/src/System.Json/JsonValue.cs
-../../../external/aspnetwebstack/src/System.Json/JsonValueChange.cs
-../../../external/aspnetwebstack/src/System.Json/JsonValueChangeEventArgs.cs
-../../../external/aspnetwebstack/src/System.Json/JsonValueDynamicMetaObject.cs
-../../../external/aspnetwebstack/src/System.Json/JsonValueLinqExtensions.cs
-../../../external/aspnetwebstack/src/System.Json/NGenWrapper.cs
-../../../external/aspnetwebstack/src/System.Json/Properties/Resources.Designer.cs
-
+System.Json/JsonArray.cs
+System.Json/JsonObject.cs
+System.Json/JsonPrimitive.cs
+System.Json/JsonType.cs
+System.Json/JsonValue.cs
+../System.ServiceModel.Web/System.Runtime.Serialization.Json/JavaScriptReader.cs
\ No newline at end of file
--- /dev/null
+2010-03-10 Atsushi Enomoto <atsushi@ximian.com>
+
+ * JsonReader.cs : moved to Sys.SM.Web/Sys.R.S.Json.
+
+2010-03-10 Atsushi Enomoto <atsushi@ximian.com>
+
+ * JsonValue.cs : use Sys.SM.Web.dll's JavaScriptObjectDeserializer
+ for silverlight sdk / moonlight compatibility.
+ * JsonReader.cs : renamed to JavaScriptReader (for disambiguation in
+ Sys.SM.Web.dll). Now it is native-type based and used by the above
+ deserializer.
+
+2010-02-18 Atsushi Enomoto <atsushi@ximian.com>
+
+ * JsonValue.cs : fix string escaping, it was giving wrong output
+ after \" and \\.
+
+2010-02-18 Atsushi Enomoto <atsushi@ximian.com>
+
+ * JsonReader.cs : line endings after a value should not result in
+ a parse error.
+ * JsonObject.cs : duplicate object key "SHOULD" not be used, but
+ they are not rejected. So, make it a bit sloppy.
+
+2010-01-27 Atsushi Enomoto <atsushi@ximian.com>
+
+ * JsonReader.cs : oops, added previous change to wrong position.
+
+2010-01-27 Atsushi Enomoto <atsushi@ximian.com>
+
+ * JsonReader.cs : It seems it can either return int, long or decimal
+ depending on the value. Users cannot really predict what type of
+ the primitive value can be returned and casts to specific types
+ very likely fail. doh.
+
+2010-01-27 Atsushi Enomoto <atsushi@ximian.com>
+
+ * JsonReader.cs : use decimal instead of int to parse decimal part
+ of numeric value. It can parse bigger value than int now (like
+ tweet id).
+
+2009-10-05 Atsushi Enomoto <atsushi@ximian.com>
+
+ * JsonReader.cs : \uXXXX parser was totally wrong, giving wrong #.
+
+2009-09-22 Atsushi Enomoto <atsushi@ximian.com>
+
+ * JsonValue.cs, JsonReader.cs, JsonPrimitive.cs :
+ Handle "null" values, as string, so far (haven't tried what .NET
+ actually does).
+ Fix array ToString() that missed commas (while Save() worked fine -
+ it has different serialization logic).
+
+2009-01-15 Atsushi Enomoto <atsushi@ximian.com>
+
+ * JsonReader.cs : consume ',' between items in an array.
+
+2008-09-15 Atsushi Enomoto <atsushi@ximian.com>
+
+ * JsonObject.cs, JsonValue.cs : SL2b2 updates.
+
+2008-08-28 Atsushi Enomoto <atsushi@ximian.com>
+
+ * JsonReader.cs : a ReadChar() is missing in number parsing.
+
+2008-06-10 Atsushi Enomoto <atsushi@ximian.com>
+
+ * JsonArray.cs, JsonObject.cs, JsonPrimitive.cs, JsonReader.cs,
+ JsonType.cs, JsonValue.cs, MergedEnumerator.cs : initial checkin.
+
--- /dev/null
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Text;
+
+namespace System.Json
+{
+ public class JsonArray : JsonValue, IList<JsonValue>
+ {
+ List<JsonValue> list;
+
+ public JsonArray (params JsonValue [] items)
+ {
+ list = new List<JsonValue> ();
+ AddRange (items);
+ }
+
+ public JsonArray (IEnumerable<JsonValue> items)
+ {
+ if (items == null)
+ throw new ArgumentNullException ("items");
+
+ list = new List<JsonValue> (items);
+ }
+
+ public override int Count {
+ get { return list.Count; }
+ }
+
+ public bool IsReadOnly {
+ get { return false; }
+ }
+
+ public override sealed JsonValue this [int index] {
+ get { return list [index]; }
+ set { list [index] = value; }
+ }
+
+ public override JsonType JsonType {
+ get { return JsonType.Array; }
+ }
+
+ public void Add (JsonValue item)
+ {
+ if (item == null)
+ throw new ArgumentNullException ("item");
+
+ list.Add (item);
+ }
+
+ public void AddRange (IEnumerable<JsonValue> items)
+ {
+ if (items == null)
+ throw new ArgumentNullException ("items");
+
+ list.AddRange (items);
+ }
+
+ public void AddRange (params JsonValue [] items)
+ {
+ if (items == null)
+ return;
+
+ list.AddRange (items);
+ }
+
+ public void Clear ()
+ {
+ list.Clear ();
+ }
+
+ public bool Contains (JsonValue item)
+ {
+ return list.Contains (item);
+ }
+
+ public void CopyTo (JsonValue [] array, int arrayIndex)
+ {
+ list.CopyTo (array, arrayIndex);
+ }
+
+ public int IndexOf (JsonValue item)
+ {
+ return list.IndexOf (item);
+ }
+
+ public void Insert (int index, JsonValue item)
+ {
+ list.Insert (index, item);
+ }
+
+ public bool Remove (JsonValue item)
+ {
+ return list.Remove (item);
+ }
+
+ public void RemoveAt (int index)
+ {
+ list.RemoveAt (index);
+ }
+
+ public override void Save (Stream stream)
+ {
+ if (stream == null)
+ throw new ArgumentNullException ("stream");
+ stream.WriteByte ((byte) '[');
+ for (int i = 0; i < list.Count; i++) {
+ JsonValue v = list [i];
+ if (v != null)
+ v.Save (stream);
+ else {
+ stream.WriteByte ((byte) 'n');
+ stream.WriteByte ((byte) 'u');
+ stream.WriteByte ((byte) 'l');
+ stream.WriteByte ((byte) 'l');
+ }
+
+ if (i < Count - 1) {
+ stream.WriteByte ((byte) ',');
+ stream.WriteByte ((byte) ' ');
+ }
+ }
+ stream.WriteByte ((byte) ']');
+ }
+
+ IEnumerator<JsonValue> IEnumerable<JsonValue>.GetEnumerator ()
+ {
+ return list.GetEnumerator ();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return list.GetEnumerator ();
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Text;
+
+using JsonPair = System.Collections.Generic.KeyValuePair<string, System.Json.JsonValue>;
+using JsonPairEnumerable = System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, System.Json.JsonValue>>;
+
+namespace System.Json
+{
+ public class JsonObject : JsonValue, IDictionary<string, JsonValue>, ICollection<JsonPair>
+ {
+ Dictionary<string, JsonValue> map;
+
+ public JsonObject (params JsonPair [] items)
+ {
+ map = new Dictionary<string, JsonValue> ();
+
+ if (items != null)
+ AddRange (items);
+ }
+
+ public JsonObject (JsonPairEnumerable items)
+ {
+ if (items == null)
+ throw new ArgumentNullException ("items");
+
+ map = new Dictionary<string, JsonValue> ();
+ AddRange (items);
+ }
+
+ public override int Count {
+ get { return map.Count; }
+ }
+
+ public IEnumerator<JsonPair> GetEnumerator ()
+ {
+ return map.GetEnumerator ();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return map.GetEnumerator ();
+ }
+
+ public override sealed JsonValue this [string key] {
+ get { return map [key]; }
+ set { map [key] = value; }
+ }
+
+ public override JsonType JsonType {
+ get { return JsonType.Object; }
+ }
+
+ public ICollection<string> Keys {
+ get { return map.Keys; }
+ }
+
+ public ICollection<JsonValue> Values {
+ get { return map.Values; }
+ }
+
+ public void Add (string key, JsonValue value)
+ {
+ if (key == null)
+ throw new ArgumentNullException ("key");
+
+ map.Add (key, value);
+ }
+
+ public void Add (JsonPair pair)
+ {
+ Add (pair.Key, pair.Value);
+ }
+
+ public void AddRange (JsonPairEnumerable items)
+ {
+ if (items == null)
+ throw new ArgumentNullException ("items");
+
+ foreach (var pair in items)
+ map.Add (pair.Key, pair.Value);
+ }
+
+ public void AddRange (params JsonPair [] items)
+ {
+ AddRange ((JsonPairEnumerable) items);
+ }
+
+ public void Clear ()
+ {
+ map.Clear ();
+ }
+
+ bool ICollection<JsonPair>.Contains (JsonPair item)
+ {
+ return (map as ICollection<JsonPair>).Contains (item);
+ }
+
+ bool ICollection<JsonPair>.Remove (JsonPair item)
+ {
+ return (map as ICollection<JsonPair>).Remove (item);
+ }
+
+ public override bool ContainsKey (string key)
+ {
+ if (key == null)
+ throw new ArgumentNullException ("key");
+
+ return map.ContainsKey (key);
+ }
+
+ public void CopyTo (JsonPair [] array, int arrayIndex)
+ {
+ (map as ICollection<JsonPair>).CopyTo (array, arrayIndex);
+ }
+
+ public bool Remove (string key)
+ {
+ if (key == null)
+ throw new ArgumentNullException ("key");
+
+ return map.Remove (key);
+ }
+
+ bool ICollection<JsonPair>.IsReadOnly {
+ get { return false; }
+ }
+
+ public override void Save (Stream stream)
+ {
+ if (stream == null)
+ throw new ArgumentNullException ("stream");
+ stream.WriteByte ((byte) '{');
+ foreach (JsonPair pair in map) {
+ stream.WriteByte ((byte) '"');
+ byte [] bytes = Encoding.UTF8.GetBytes (EscapeString (pair.Key));
+ stream.Write (bytes, 0, bytes.Length);
+ stream.WriteByte ((byte) '"');
+ stream.WriteByte ((byte) ',');
+ stream.WriteByte ((byte) ' ');
+ if (pair.Value == null) {
+ stream.WriteByte ((byte) 'n');
+ stream.WriteByte ((byte) 'u');
+ stream.WriteByte ((byte) 'l');
+ stream.WriteByte ((byte) 'l');
+ } else
+ pair.Value.Save (stream);
+ }
+ stream.WriteByte ((byte) '}');
+ }
+
+ public bool TryGetValue (string key, out JsonValue value)
+ {
+ return map.TryGetValue (key, out value);
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Text;
+
+namespace System.Json
+{
+ public class JsonPrimitive : JsonValue
+ {
+ object value;
+
+ public JsonPrimitive (bool value)
+ {
+ this.value = value;
+ }
+
+ public JsonPrimitive (byte value)
+ {
+ this.value = value;
+ }
+
+ public JsonPrimitive (char value)
+ {
+ this.value = value;
+ }
+
+ public JsonPrimitive (decimal value)
+ {
+ this.value = value;
+ }
+
+ public JsonPrimitive (double value)
+ {
+ this.value = value;
+ }
+
+ public JsonPrimitive (float value)
+ {
+ this.value = value;
+ }
+
+ public JsonPrimitive (int value)
+ {
+ this.value = value;
+ }
+
+ public JsonPrimitive (long value)
+ {
+ this.value = value;
+ }
+
+ public JsonPrimitive (sbyte value)
+ {
+ this.value = value;
+ }
+
+ public JsonPrimitive (short value)
+ {
+ this.value = value;
+ }
+
+ public JsonPrimitive (string value)
+ {
+ this.value = value;
+ }
+
+ public JsonPrimitive (DateTime value)
+ {
+ this.value = value;
+ }
+
+ public JsonPrimitive (uint value)
+ {
+ this.value = value;
+ }
+
+ public JsonPrimitive (ulong value)
+ {
+ this.value = value;
+ }
+
+ public JsonPrimitive (ushort value)
+ {
+ this.value = value;
+ }
+
+ public JsonPrimitive (DateTimeOffset value)
+ {
+ this.value = value;
+ }
+
+ public JsonPrimitive (Guid value)
+ {
+ this.value = value;
+ }
+
+ public JsonPrimitive (TimeSpan value)
+ {
+ this.value = value;
+ }
+
+ public JsonPrimitive (Uri value)
+ {
+ this.value = value;
+ }
+
+ internal object Value {
+ get { return value; }
+ }
+
+ public override JsonType JsonType {
+ get {
+ // FIXME: what should we do for null? Handle it as null so far.
+ if (value == null)
+ return JsonType.String;
+
+ switch (Type.GetTypeCode (value.GetType ())) {
+ case TypeCode.Boolean:
+ return JsonType.Boolean;
+ case TypeCode.Char:
+ case TypeCode.String:
+ case TypeCode.DateTime:
+ case TypeCode.Object: // DateTimeOffset || Guid || TimeSpan || Uri
+ return JsonType.String;
+ default:
+ return JsonType.Number;
+ }
+ }
+ }
+
+ static readonly byte [] true_bytes = Encoding.UTF8.GetBytes ("true");
+ static readonly byte [] false_bytes = Encoding.UTF8.GetBytes ("false");
+
+ public override void Save (Stream stream)
+ {
+ switch (JsonType) {
+ case JsonType.Boolean:
+ if ((bool) value)
+ stream.Write (true_bytes, 0, 4);
+ else
+ stream.Write (false_bytes, 0, 5);
+ break;
+ case JsonType.String:
+ stream.WriteByte ((byte) '\"');
+ byte [] bytes = Encoding.UTF8.GetBytes (EscapeString (value.ToString ()));
+ stream.Write (bytes, 0, bytes.Length);
+ stream.WriteByte ((byte) '\"');
+ break;
+ default:
+ bytes = Encoding.UTF8.GetBytes (GetFormattedString ());
+ stream.Write (bytes, 0, bytes.Length);
+ break;
+ }
+ }
+
+ internal string GetFormattedString ()
+ {
+ switch (JsonType) {
+ case JsonType.String:
+ if (value is string || value == null)
+ return (string) value;
+ throw new NotImplementedException ("GetFormattedString from value type " + value.GetType ());
+ case JsonType.Number:
+ return ((IFormattable) value).ToString ("G", NumberFormatInfo.InvariantInfo);
+ default:
+ throw new InvalidOperationException ();
+ }
+ }
+ }
+}
--- /dev/null
+namespace System.Json
+{
+ public enum JsonType
+ {
+ String,
+ Number,
+ Object,
+ Array,
+ Boolean,
+ }
+}
--- /dev/null
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.Serialization.Json;
+using System.Text;
+
+using JsonPair = System.Collections.Generic.KeyValuePair<string, System.Json.JsonValue>;
+
+
+namespace System.Json
+{
+ public abstract class JsonValue : IEnumerable
+ {
+ public static JsonValue Load (Stream stream)
+ {
+ if (stream == null)
+ throw new ArgumentNullException ("stream");
+ return Load (new StreamReader (stream, true));
+ }
+
+ public static JsonValue Load (TextReader textReader)
+ {
+ if (textReader == null)
+ throw new ArgumentNullException ("textReader");
+
+ var ret = new JavaScriptReader (textReader, true).Read ();
+
+ return ToJsonValue (ret);
+ }
+
+ static IEnumerable<KeyValuePair<string,JsonValue>> ToJsonPairEnumerable (IEnumerable<KeyValuePair<string,object>> kvpc)
+ {
+ foreach (var kvp in kvpc)
+ yield return new KeyValuePair<string,JsonValue> (kvp.Key, ToJsonValue (kvp.Value));
+ }
+
+ static IEnumerable<JsonValue> ToJsonValueEnumerable (IEnumerable<object> arr)
+ {
+ foreach (var obj in arr)
+ yield return ToJsonValue (obj);
+ }
+
+ static JsonValue ToJsonValue (object ret)
+ {
+ if (ret == null)
+ return null;
+ var kvpc = ret as IEnumerable<KeyValuePair<string,object>>;
+ if (kvpc != null)
+ return new JsonObject (ToJsonPairEnumerable (kvpc));
+ var arr = ret as IEnumerable<object>;
+ if (arr != null)
+ return new JsonArray (ToJsonValueEnumerable (arr));
+
+ if (ret is bool)
+ return new JsonPrimitive ((bool) ret);
+ if (ret is byte)
+ return new JsonPrimitive ((byte) ret);
+ if (ret is char)
+ return new JsonPrimitive ((char) ret);
+ if (ret is decimal)
+ return new JsonPrimitive ((decimal) ret);
+ if (ret is double)
+ return new JsonPrimitive ((double) ret);
+ if (ret is float)
+ return new JsonPrimitive ((float) ret);
+ if (ret is int)
+ return new JsonPrimitive ((int) ret);
+ if (ret is long)
+ return new JsonPrimitive ((long) ret);
+ if (ret is sbyte)
+ return new JsonPrimitive ((sbyte) ret);
+ if (ret is short)
+ return new JsonPrimitive ((short) ret);
+ if (ret is string)
+ return new JsonPrimitive ((string) ret);
+ if (ret is uint)
+ return new JsonPrimitive ((uint) ret);
+ if (ret is ulong)
+ return new JsonPrimitive ((ulong) ret);
+ if (ret is ushort)
+ return new JsonPrimitive ((ushort) ret);
+ if (ret is DateTime)
+ return new JsonPrimitive ((DateTime) ret);
+ if (ret is DateTimeOffset)
+ return new JsonPrimitive ((DateTimeOffset) ret);
+ if (ret is Guid)
+ return new JsonPrimitive ((Guid) ret);
+ if (ret is TimeSpan)
+ return new JsonPrimitive ((TimeSpan) ret);
+ if (ret is Uri)
+ return new JsonPrimitive ((Uri) ret);
+ throw new NotSupportedException (String.Format ("Unexpected parser return type: {0}", ret.GetType ()));
+ }
+
+ public static JsonValue Parse (string jsonString)
+ {
+ if (jsonString == null)
+ throw new ArgumentNullException ("jsonString");
+ return Load (new StringReader (jsonString));
+ }
+
+ public virtual int Count {
+ get { throw new InvalidOperationException (); }
+ }
+
+ public abstract JsonType JsonType { get; }
+
+ public virtual JsonValue this [int index] {
+ get { throw new InvalidOperationException (); }
+ set { throw new InvalidOperationException (); }
+ }
+
+ public virtual JsonValue this [string key] {
+ get { throw new InvalidOperationException (); }
+ set { throw new InvalidOperationException (); }
+ }
+
+ public virtual bool ContainsKey (string key)
+ {
+ throw new InvalidOperationException ();
+ }
+
+ public virtual void Save (Stream stream)
+ {
+ if (stream == null)
+ throw new ArgumentNullException ("stream");
+ Save (new StreamWriter (stream));
+ }
+
+ public virtual void Save (TextWriter textWriter)
+ {
+ if (textWriter == null)
+ throw new ArgumentNullException ("textWriter");
+ SaveInternal (textWriter);
+ }
+
+ void SaveInternal (TextWriter w)
+ {
+ switch (JsonType) {
+ case JsonType.Object:
+ w.Write ('{');
+ bool following = false;
+ foreach (JsonPair pair in ((JsonObject) this)) {
+ if (following)
+ w.Write (", ");
+ w.Write ('\"');
+ w.Write (EscapeString (pair.Key));
+ w.Write ("\": ");
+ if (pair.Value == null)
+ w.Write ("null");
+ else
+ pair.Value.SaveInternal (w);
+ following = true;
+ }
+ w.Write ('}');
+ break;
+ case JsonType.Array:
+ w.Write ('[');
+ following = false;
+ foreach (JsonValue v in ((JsonArray) this)) {
+ if (following)
+ w.Write (", ");
+ if (v != null)
+ v.SaveInternal (w);
+ else
+ w.Write ("null");
+ following = true;
+ }
+ w.Write (']');
+ break;
+ case JsonType.Boolean:
+ w.Write ((bool) this ? "true" : "false");
+ break;
+ case JsonType.String:
+ w.Write ('"');
+ w.Write (EscapeString (((JsonPrimitive) this).GetFormattedString ()));
+ w.Write ('"');
+ break;
+ default:
+ w.Write (((JsonPrimitive) this).GetFormattedString ());
+ break;
+ }
+ }
+
+ public override string ToString ()
+ {
+ StringWriter sw = new StringWriter ();
+ Save (sw);
+ return sw.ToString ();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ throw new InvalidOperationException ();
+ }
+
+ internal string EscapeString (string src)
+ {
+ if (src == null)
+ return null;
+
+ for (int i = 0; i < src.Length; i++)
+ if (src [i] == '"' || src [i] == '\\') {
+ var sb = new StringBuilder ();
+ if (i > 0)
+ sb.Append (src, 0, i);
+ return DoEscapeString (sb, src, i);
+ }
+ return src;
+ }
+
+ string DoEscapeString (StringBuilder sb, string src, int cur)
+ {
+ int start = cur;
+ for (int i = cur; i < src.Length; i++)
+ if (src [i] == '"' || src [i] == '\\') {
+ sb.Append (src, start, i - start);
+ sb.Append ('\\');
+ sb.Append (src [i++]);
+ start = i;
+ }
+ sb.Append (src, start, src.Length - start);
+ return sb.ToString ();
+ }
+
+ // CLI -> JsonValue
+
+ public static implicit operator JsonValue (bool value)
+ {
+ return new JsonPrimitive (value);
+ }
+
+ public static implicit operator JsonValue (byte value)
+ {
+ return new JsonPrimitive (value);
+ }
+
+ public static implicit operator JsonValue (char value)
+ {
+ return new JsonPrimitive (value);
+ }
+
+ public static implicit operator JsonValue (decimal value)
+ {
+ return new JsonPrimitive (value);
+ }
+
+ public static implicit operator JsonValue (double value)
+ {
+ return new JsonPrimitive (value);
+ }
+
+ public static implicit operator JsonValue (float value)
+ {
+ return new JsonPrimitive (value);
+ }
+
+ public static implicit operator JsonValue (int value)
+ {
+ return new JsonPrimitive (value);
+ }
+
+ public static implicit operator JsonValue (long value)
+ {
+ return new JsonPrimitive (value);
+ }
+
+ public static implicit operator JsonValue (sbyte value)
+ {
+ return new JsonPrimitive (value);
+ }
+
+ public static implicit operator JsonValue (short value)
+ {
+ return new JsonPrimitive (value);
+ }
+
+ public static implicit operator JsonValue (string value)
+ {
+ return new JsonPrimitive (value);
+ }
+
+ public static implicit operator JsonValue (uint value)
+ {
+ return new JsonPrimitive (value);
+ }
+
+ public static implicit operator JsonValue (ulong value)
+ {
+ return new JsonPrimitive (value);
+ }
+
+ public static implicit operator JsonValue (ushort value)
+ {
+ return new JsonPrimitive (value);
+ }
+
+ public static implicit operator JsonValue (DateTime value)
+ {
+ return new JsonPrimitive (value);
+ }
+
+ public static implicit operator JsonValue (DateTimeOffset value)
+ {
+ return new JsonPrimitive (value);
+ }
+
+ public static implicit operator JsonValue (Guid value)
+ {
+ return new JsonPrimitive (value);
+ }
+
+ public static implicit operator JsonValue (TimeSpan value)
+ {
+ return new JsonPrimitive (value);
+ }
+
+ public static implicit operator JsonValue (Uri value)
+ {
+ return new JsonPrimitive (value);
+ }
+
+ // JsonValue -> CLI
+
+ public static implicit operator bool (JsonValue value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+ return Convert.ToBoolean (((JsonPrimitive) value).Value);
+ }
+
+ public static implicit operator byte (JsonValue value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+ return Convert.ToByte (((JsonPrimitive) value).Value);
+ }
+
+ public static implicit operator char (JsonValue value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+ return Convert.ToChar (((JsonPrimitive) value).Value);
+ }
+
+ public static implicit operator decimal (JsonValue value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+ return Convert.ToDecimal (((JsonPrimitive) value).Value);
+ }
+
+ public static implicit operator double (JsonValue value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+ return Convert.ToDouble (((JsonPrimitive) value).Value);
+ }
+
+ public static implicit operator float (JsonValue value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+ return Convert.ToSingle (((JsonPrimitive) value).Value);
+ }
+
+ public static implicit operator int (JsonValue value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+ return Convert.ToInt32 (((JsonPrimitive) value).Value);
+ }
+
+ public static implicit operator long (JsonValue value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+ return Convert.ToInt64 (((JsonPrimitive) value).Value);
+ }
+
+ public static implicit operator sbyte (JsonValue value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+ return Convert.ToSByte (((JsonPrimitive) value).Value);
+ }
+
+ public static implicit operator short (JsonValue value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+ return Convert.ToInt16 (((JsonPrimitive) value).Value);
+ }
+
+ public static implicit operator string (JsonValue value)
+ {
+ if (value == null)
+ return null;
+ return (string) ((JsonPrimitive) value).Value;
+ }
+
+ public static implicit operator uint (JsonValue value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+ return Convert.ToUInt16 (((JsonPrimitive) value).Value);
+ }
+
+ public static implicit operator ulong (JsonValue value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+ return Convert.ToUInt64(((JsonPrimitive) value).Value);
+ }
+
+ public static implicit operator ushort (JsonValue value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+ return Convert.ToUInt16 (((JsonPrimitive) value).Value);
+ }
+
+ public static implicit operator DateTime (JsonValue value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+ return (DateTime) ((JsonPrimitive) value).Value;
+ }
+
+ public static implicit operator DateTimeOffset (JsonValue value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+ return (DateTimeOffset) ((JsonPrimitive) value).Value;
+ }
+
+ public static implicit operator TimeSpan (JsonValue value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+ return (TimeSpan) ((JsonPrimitive) value).Value;
+ }
+
+ public static implicit operator Guid (JsonValue value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+ return (Guid) ((JsonPrimitive) value).Value;
+ }
+
+ public static implicit operator Uri (JsonValue value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+ return (Uri) ((JsonPrimitive) value).Value;
+ }
+ }
+}
[TestFixture]
public class JsonValueTests {
// Tests that a trailing comma is allowed in dictionary definitions
+ [Test]
+ public void LoadWithTrailingComma ()
+ {
+ var j = JsonValue.Load (new StringReader ("{ \"a\": \"b\",}"));
+ Assert.AreEqual (1, j.Count, "itemcount");
+ Assert.AreEqual (JsonType.String, j ["a"].JsonType, "type");
+ Assert.AreEqual ("b", (string) j ["a"], "value");
+ }
+
// Test that we correctly serialize JsonArray with null elements.
[Test]
public void ToStringOnJsonArrayWithNulls () {
Assert.AreEqual (4, j.Count, "itemcount");
Assert.AreEqual (JsonType.Array, j.JsonType, "type");
var str = j.ToString ();
- Assert.AreEqual ("[1,2,3,null]", str);
+ Assert.AreEqual (str, "[1, 2, 3, null]");
}
}
}
--- /dev/null
+thisdir = class/System.Reactive.Core
+SUBDIRS =
+include ../../build/rules.make
+
+LIBRARY = System.Reactive.Core.dll
+LIB_MCS_FLAGS = \
+ @more_build_args \
+ -r:System.dll \
+ -r:System.Core.dll \
+ -r:System.Reactive.Interfaces.dll
+
+ifeq (true, $(GENERATE_RESOURCES))
+LIB_MCS_FLAGS += /define:GENERATING_RESOURCES
+endif
+
+RESX_RESOURCES = \
+ Strings_Core.resources
+
+CLEAN_FILES += $(RESX_RESOURCES)
+
+RESOURCES = $(RESX_RESOURCES)
+
+PREBUILT = $(RESX_RESOURCES:=.prebuilt)
+
+ifeq (2.1, $(FRAMEWORK_VERSION))
+LIB_MCS_FLAGS += -d:NO_TASK_DELAY
+endif
+
+NET_4_5 := $(filter 4.5, $(FRAMEWORK_VERSION))
+ifdef NET_4_5
+LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC
+endif
+
+TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
+
+EXTRA_DISTFILES = more_build_args $(RESX_RESOURCES:.resources=.resx) $(PREBUILT)
+
+VALID_PROFILE := $(filter 2 4, $(FRAMEWORK_VERSION_MAJOR))
+ifndef VALID_PROFILE
+LIBRARY_NAME = dummy-System.System.Reactive.Core.dll
+NO_SIGN_ASSEMBLY = yes
+endif
+
+NO_INSTALL = yes
+NO_TEST = yes
+
+include ../../build/library.make
+
+$(the_lib): $(RESOURCES)
+
+$(RESX_RESOURCES): %.resources: %.resx
+ $(RESGEN) $< || cp $@.prebuilt $@
+
+$(PREBUILT): %.prebuilt: %
+ cp $* $@
+
+dist-default: $(PREBUILT)
+
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="CANT_OBTAIN_SCHEDULER" xml:space="preserve">
+ <value>Using the Scheduler.{0} property is no longer supported due to refactoring of the API surface and elimination of platform-specific dependencies. Please include System.Reactive.PlatformServices for your target platform and use the {0}Scheduler type instead. If you're building a Windows Store app, notice some schedulers are no longer supported. Consider using Scheduler.Default instead.</value>
+ </data>
+ <data name="COMPLETED_NO_VALUE" xml:space="preserve">
+ <value>OnCompleted notification doesn't have a value.</value>
+ </data>
+ <data name="DISPOSABLE_ALREADY_ASSIGNED" xml:space="preserve">
+ <value>Disposable has already been assigned.</value>
+ </data>
+ <data name="FAILED_CLOCK_MONITORING" xml:space="preserve">
+ <value>Failed to start monitoring system clock changes.</value>
+ </data>
+ <data name="HEAP_EMPTY" xml:space="preserve">
+ <value>Heap is empty.</value>
+ </data>
+ <data name="OBSERVER_TERMINATED" xml:space="preserve">
+ <value>Observer has already terminated.</value>
+ </data>
+ <data name="REENTRANCY_DETECTED" xml:space="preserve">
+ <value>Reentrancy has been detected.</value>
+ </data>
+ <data name="SCHEDULER_OPERATION_ALREADY_AWAITED" xml:space="preserve">
+ <value>This scheduler operation has already been awaited.</value>
+ <comment>Only on .NET 4.5 and above.</comment>
+ </data>
+</root>
\ No newline at end of file
--- /dev/null
+../../../external/rx/Rx.NET/System.Reactive.Core/GlobalSuppressions.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/InternalsVisibleTo.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/NamespaceDocs.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Observable.Extensions.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Observer.Extensions.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Properties/AssemblyInfo.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/AnonymousObservable.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/AnonymousObserver.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/AnonymousSafeObserver.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/AsyncLock.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/CatchScheduler.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/ConcurrencyAbstractionLayer.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/ConcurrencyAbstractionLayer.Default.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.Wrappers.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/DisableOptimizationsScheduler.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.Services.Emulation.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/LocalScheduler.TimerQueue.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.Services.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/CurrentThreadScheduler.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/ImmediateScheduler.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/LocalScheduler.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/ScheduledItem.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.Async.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.Recursive.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.Simple.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/SchedulerDefaults.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/SchedulerOperation.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/SchedulerQueue.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/SchedulerWrapper.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Stopwatch.Default.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Synchronization.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Synchronization.ObserveOn.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Synchronization.Synchronize.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/SynchronizationContextScheduler.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/DefaultScheduler.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/AsyncLockObserver.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/CheckedObserver.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/ConcurrentDictionary.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/ConcurrentQueue.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/Constants.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Disposables/AnonymousDisposable.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Disposables/BooleanDisposable.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Disposables/CancellationDisposable.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Disposables/CompositeDisposable.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Disposables/ContextDisposable.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Disposables/DefaultDisposable.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Disposables/Disposable.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Disposables/MultipleAssignmentDisposable.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Disposables/RefCountDisposable.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Disposables/ScheduledDisposable.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Disposables/SerialDisposable.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Disposables/SingleAssignmentDisposable.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/AutoDetachObserver.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/ExceptionServices.Default.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/ExceptionServices.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/HostLifecycleService.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/ImmutableList.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/Lazy.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/Observers.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/PlatformEnlightenmentProvider.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/PriorityQueue.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/Producer.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/SafeObserver.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/ScheduledObserver.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/Semaphore.Silverlight.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/Semaphore.Xna.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/Sink.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/Stubs.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/SynchronizationContextExtensions.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/SynchronizedObserver.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/SystemClock.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/SystemClock.Default.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Notification.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/ObservableBase.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/ObserverBase.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Unit.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Strings_Core.Generated.cs
--- /dev/null
+-d:SIGNED
+-delaysign
+-keyfile:../reactive.pub
+-resource:Strings_Core.resources,System.Reactive.Strings_Core.resources
--- /dev/null
+thisdir = class/System.Reactive.Debugger
+SUBDIRS =
+include ../../build/rules.make
+
+LIBRARY = System.Reactive.Debugger.dll
+LIB_MCS_FLAGS = \
+ @more_build_args \
+ -r:System.dll \
+ -r:System.Core.dll \
+ -r:System.Reactive.Interfaces.dll \
+ -r:System.Reactive.Core.dll \
+ -r:System.Reactive.Linq.dll
+
+ifeq (2.1, $(FRAMEWORK_VERSION))
+LIB_MCS_FLAGS += -d:NO_TASK_DELAY
+endif
+
+NET_4_5 := $(filter 4.5, $(FRAMEWORK_VERSION))
+ifdef NET_4_5
+LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC
+endif
+
+TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
+
+EXTRA_DISTFILES = more_build_args
+
+VALID_PROFILE := $(filter 2 4, $(FRAMEWORK_VERSION_MAJOR))
+ifndef VALID_PROFILE
+LIBRARY_NAME = dummy-System.System.Reactive.Debugger.dll
+NO_SIGN_ASSEMBLY = yes
+endif
+
+NO_INSTALL = yes
+NO_TEST = yes
+
+include ../../build/library.make
--- /dev/null
+../../../external/rx/Rx.NET/System.Reactive.Debugger/Properties/AssemblyInfo.cs
+../../../external/rx/Rx.NET/System.Reactive.Debugger/Reactive/Linq/QueryDebugger.cs
--- /dev/null
+-d:SIGNED
+-delaysign
+-keyfile:../reactive.pub
--- /dev/null
+thisdir = class/System.Reactive.Experimental
+SUBDIRS =
+include ../../build/rules.make
+
+LIBRARY = System.Reactive.Experimental.dll
+LIB_MCS_FLAGS = \
+ @more_build_args \
+ -r:System.dll \
+ -r:System.Core.dll \
+ -r:System.Reactive.Interfaces.dll \
+ -r:System.Reactive.Core.dll \
+ -r:System.Reactive.Linq.dll
+
+ifeq (2.1, $(FRAMEWORK_VERSION))
+LIB_MCS_FLAGS += -d:NO_TASK_DELAY
+endif
+
+NET_4_5 := $(filter 4.5, $(FRAMEWORK_VERSION))
+ifdef NET_4_5
+LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC
+endif
+
+TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
+
+EXTRA_DISTFILES = more_build_args
+
+VALID_PROFILE := $(filter 2 4, $(FRAMEWORK_VERSION_MAJOR))
+ifndef VALID_PROFILE
+LIBRARY_NAME = dummy-System.System.Reactive.Experimental.dll
+NO_SIGN_ASSEMBLY = yes
+endif
+
+NO_INSTALL = yes
+NO_TEST = yes
+
+include ../../build/library.make
--- /dev/null
+../../../external/rx/Rx.NET/System.Reactive.Experimental/ExperimentalAttribute.cs
+../../../external/rx/Rx.NET/System.Reactive.Experimental/InternalsVisibleTo.cs
+../../../external/rx/Rx.NET/System.Reactive.Experimental/Properties/AssemblyInfo.cs
+../../../external/rx/Rx.NET/System.Reactive.Experimental/Reactive/Internal/BinaryObserver.cs
+../../../external/rx/Rx.NET/System.Reactive.Experimental/Reactive/Linq/QbservableEx.cs
+../../../external/rx/Rx.NET/System.Reactive.Experimental/Reactive/Linq/IQueryLanguageEx.cs
+../../../external/rx/Rx.NET/System.Reactive.Experimental/Reactive/Linq/ObservableEx.cs
+../../../external/rx/Rx.NET/System.Reactive.Experimental/Reactive/Linq/QbservableEx.Generated.cs
+../../../external/rx/Rx.NET/System.Reactive.Experimental/Reactive/Linq/QueryLanguageEx.cs
+../../../external/rx/Rx.NET/System.Reactive.Experimental/Reactive/ListObservable.cs
--- /dev/null
+-d:SIGNED
+-delaysign
+-keyfile:../reactive.pub
--- /dev/null
+thisdir = class/System.Reactive.Interfaces
+SUBDIRS =
+include ../../build/rules.make
+
+LIBRARY = System.Reactive.Interfaces.dll
+LIB_MCS_FLAGS = \
+ @more_build_args \
+ -r:System.dll \
+ -r:System.Core.dll
+
+ifeq (2.1, $(FRAMEWORK_VERSION))
+LIB_MCS_FLAGS += -d:NO_TASK_DELAY
+endif
+
+NET_4_5 := $(filter 4.5, $(FRAMEWORK_VERSION))
+ifdef NET_4_5
+LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC
+endif
+
+TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
+
+EXTRA_DISTFILES = more_build_args
+
+VALID_PROFILE := $(filter 2 4, $(FRAMEWORK_VERSION_MAJOR))
+ifndef VALID_PROFILE
+LIBRARY_NAME = dummy-System.System.Reactive.Interfaces.dll
+NO_SIGN_ASSEMBLY = yes
+endif
+
+NO_INSTALL = yes
+NO_TEST = yes
+
+include ../../build/library.make
--- /dev/null
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/AssemblyFileVersionAttribute.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/DateTimeOffset.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/GlobalSuppressions.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/IObservable.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/IObserver.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/NamespaceDocs.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/Properties/AssemblyInfo.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/Reactive/Concurrency/ISchedulerPeriodic.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/Reactive/Concurrency/IStopwatchProvider.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/Reactive/Concurrency/IScheduledItem.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/Reactive/Concurrency/IScheduler.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/Reactive/Concurrency/ISchedulerLongRunning.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/Reactive/Concurrency/IStopwatch.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/Reactive/Disposables/ICancelable.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/Reactive/IEventPattern.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/Reactive/IEventPatternSource.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/Reactive/IEventSource.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/Reactive/IObserver.Result.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/Reactive/Linq/IGroupedObservable.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/Reactive/Linq/IQbservable.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/Reactive/Linq/IQbservableProvider.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/Reactive/Subjects/IConnectableObservable.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/Reactive/Subjects/ISubject.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/Reactive/Subjects/ISubject.Multi.cs
--- /dev/null
+-d:SIGNED
+-delaysign
+-keyfile:../reactive.pub
--- /dev/null
+thisdir = class/System.Reactive.Linq
+SUBDIRS =
+include ../../build/rules.make
+
+LIBRARY = System.Reactive.Linq.dll
+LIB_MCS_FLAGS = \
+ @more_build_args \
+ -r:System.dll \
+ -r:System.Core.dll \
+ -r:System.Reactive.Interfaces.dll \
+ -r:System.Reactive.Core.dll
+
+ifeq (true, $(GENERATE_RESOURCES))
+LIB_MCS_FLAGS += /define:GENERATING_RESOURCES
+endif
+
+RESX_RESOURCES = \
+ Strings_Linq.resources
+
+CLEAN_FILES += $(RESX_RESOURCES)
+
+RESOURCES = $(RESX_RESOURCES)
+
+PREBUILT = $(RESX_RESOURCES:=.prebuilt)
+
+ifeq (2.1, $(FRAMEWORK_VERSION))
+LIB_MCS_FLAGS += -d:NO_TASK_DELAY
+endif
+
+NET_4_5 := $(filter 4.5, $(FRAMEWORK_VERSION))
+ifdef NET_4_5
+LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC
+endif
+
+TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
+
+EXTRA_DISTFILES = more_build_args $(RESX_RESOURCES:.resources=.resx) $(PREBUILT)
+
+VALID_PROFILE := $(filter 2 4, $(FRAMEWORK_VERSION_MAJOR))
+ifndef VALID_PROFILE
+LIBRARY_NAME = dummy-System.System.Reactive.Linq.dll
+NO_SIGN_ASSEMBLY = yes
+endif
+
+NO_INSTALL = yes
+NO_TEST = yes
+
+include ../../build/library.make
+
+$(the_lib): $(RESOURCES)
+
+$(RESX_RESOURCES): %.resources: %.resx
+ $(RESGEN) $< || cp $@.prebuilt $@
+
+$(PREBUILT): %.prebuilt: %
+ cp $* $@
+
+dist-default: $(PREBUILT)
+
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="CANT_ADVANCE_WHILE_RUNNING" xml:space="preserve">
+ <value>{0} cannot be called when the scheduler is already running. Try using Sleep instead.</value>
+ </data>
+ <data name="COULD_NOT_FIND_INSTANCE_EVENT" xml:space="preserve">
+ <value>Could not find event '{0}' on object of type '{1}'.</value>
+ </data>
+ <data name="COULD_NOT_FIND_STATIC_EVENT" xml:space="preserve">
+ <value>Could not find event '{0}' on type '{1}'.</value>
+ </data>
+ <data name="EVENT_ADD_METHOD_SHOULD_TAKE_ONE_PARAMETER" xml:space="preserve">
+ <value>Add method should take 1 parameter.</value>
+ </data>
+ <data name="EVENT_ARGS_NOT_ASSIGNABLE" xml:space="preserve">
+ <value>The second parameter of the event delegate must be assignable to '{0}'.</value>
+ </data>
+ <data name="EVENT_MISSING_ADD_METHOD" xml:space="preserve">
+ <value>Event is missing the add method.</value>
+ </data>
+ <data name="EVENT_MISSING_REMOVE_METHOD" xml:space="preserve">
+ <value>Event is missing the remove method.</value>
+ </data>
+ <data name="EVENT_MUST_RETURN_VOID" xml:space="preserve">
+ <value>The event delegate must have a void return type.</value>
+ </data>
+ <data name="EVENT_PATTERN_REQUIRES_TWO_PARAMETERS" xml:space="preserve">
+ <value>The event delegate must have exactly two parameters.</value>
+ </data>
+ <data name="EVENT_REMOVE_METHOD_SHOULD_TAKE_ONE_PARAMETER" xml:space="preserve">
+ <value>Remove method should take 1 parameter.</value>
+ </data>
+ <data name="EVENT_SENDER_NOT_ASSIGNABLE" xml:space="preserve">
+ <value>The first parameter of the event delegate must be assignable to '{0}'.</value>
+ </data>
+ <data name="EVENT_WINRT_REMOVE_METHOD_SHOULD_TAKE_ERT" xml:space="preserve">
+ <value>Remove method of a WinRT event should take an EventRegistrationToken.</value>
+ <comment>Only onn platforms supporting WinRT.</comment>
+ </data>
+ <data name="MORE_THAN_ONE_ELEMENT" xml:space="preserve">
+ <value>Sequence contains more than one element.</value>
+ </data>
+ <data name="MORE_THAN_ONE_MATCHING_ELEMENT" xml:space="preserve">
+ <value>Sequence contains more than one matching element.</value>
+ </data>
+ <data name="NO_ELEMENTS" xml:space="preserve">
+ <value>Sequence contains no elements.</value>
+ </data>
+ <data name="NO_MATCHING_ELEMENTS" xml:space="preserve">
+ <value>Sequence contains no matching element.</value>
+ </data>
+</root>
\ No newline at end of file
--- /dev/null
+../../../external/rx/Rx.NET/System.Reactive.Linq/GlobalSuppressions.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/NamespaceDocs.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Concurrency/VirtualTimeScheduler.Extensions.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Internal/ConcatSink.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Internal/Constants.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Internal/Helpers.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Internal/IConcatenatable.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Internal/IEvaluatableObservable.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Internal/QueryServices.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Internal/ReflectionUtils.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Internal/HashSet.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Internal/Lookup.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/LocalQueryMethodImplementationTypeAttribute.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Case.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Collect.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/If.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/For.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/DoWhile.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/While.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/TakeLastBuffer.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Next.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/MostRecent.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Latest.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/PushToPullAdapter.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/RefCount.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Multicast.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/GroupBy.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable_.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage_.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Joins.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Multiple.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Single.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.StandardSequenceOperators.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Time.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Async.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Awaiter.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Binding.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Blocking.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Concurrency.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Conversions.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Creation.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Events.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Aggregates.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Imperative.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/IQueryLanguage.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Imperative.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/EventPatternSourceBase.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/EventPattern.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/EventPatternSource.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/EventSource.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/InternalsVisibleTo.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Async.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Events.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Properties/AssemblyInfo.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Concurrency/HistoricalScheduler.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Concurrency/VirtualTimeScheduler.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Internal/AnonymousEnumerable.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Internal/BinaryObserver.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/AddRef.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Aggregate.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/All.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Amb.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Any.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/AsObservable.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Average.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Buffer.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Catch.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Concat.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Contains.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Cast.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/CombineLatest.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/GetEnumerator.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/GroupJoin.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Join.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/SelectMany.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Zip.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/OfType.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Count.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/DefaultIfEmpty.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Defer.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Delay.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/DelaySubscription.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Dematerialize.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Distinct.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/DistinctUntilChanged.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Do.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ElementAt.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Empty.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Finally.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/FirstAsync.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ForEach.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/FromEvent.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/FromEventPattern.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Generate.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/GroupByUntil.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/IgnoreElements.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/IsEmpty.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/LastAsync.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/LongCount.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Materialize.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Max.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/MaxBy.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Merge.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Min.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/MinBy.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Never.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/OnErrorResumeNext.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Range.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Repeat.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Return.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Sample.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Scan.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Select.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/SequenceEqual.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/SingleAsync.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Skip.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/SkipLast.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/SkipUntil.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/SkipWhile.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Sum.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Switch.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Internal/TailRecursiveSink.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Take.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/TakeLast.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/TakeUntil.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/TakeWhile.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Throttle.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Throw.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/TimeInterval.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Timeout.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Timer.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Timestamp.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ToArray.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ToDictionary.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ToList.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ToLookup.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ToObservable.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Using.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Where.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Window.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/_.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Subjects/ConnectableObservable.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Subjects/Subject.Extensions.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Internal/Either.Generic.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Subjects/AsyncSubject.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Subjects/BehaviorSubject.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Subjects/Subject.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/GroupedObservable.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Joins/ActivePlan.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Joins/JoinObserver.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Joins/Pattern.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Joins/Plan.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Aggregates.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Awaiter.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Binding.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Blocking.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Concurrency.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Conversions.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Creation.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Joins.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Multiple.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Single.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.StandardSequenceOperators.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Time.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Internal/PushPullAdapter.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Subjects/ReplaySubject.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Threading/Tasks/NamespaceDoc.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Threading/Tasks/TaskObservableExtensions.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/TimeInterval.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Timestamped.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Strings_Linq.Generated.cs
--- /dev/null
+-d:SIGNED
+-delaysign
+-keyfile:../reactive.pub
+-resource:Strings_Linq.resources,System.Reactive.Strings_Linq.resources
--- /dev/null
+thisdir = class/System.Reactive.PlatformServices
+SUBDIRS =
+include ../../build/rules.make
+
+LIBRARY = System.Reactive.PlatformServices.dll
+LIB_MCS_FLAGS = \
+ @more_build_args \
+ -r:System.dll \
+ -r:System.Core.dll \
+ -r:System.Reactive.Interfaces.dll \
+ -r:System.Reactive.Core.dll \
+ -r:System.Reactive.Linq.dll
+
+ifeq (true, $(GENERATE_RESOURCES))
+LIB_MCS_FLAGS += /define:GENERATING_RESOURCES
+endif
+
+RESX_RESOURCES = \
+ Strings_PlatformServices.resources
+
+CLEAN_FILES += $(RESX_RESOURCES)
+
+RESOURCES = $(RESX_RESOURCES)
+
+PREBUILT = $(RESX_RESOURCES:=.prebuilt)
+
+ifeq (2.1, $(FRAMEWORK_VERSION))
+LIB_MCS_FLAGS += -d:NO_TASK_DELAY
+endif
+
+NET_4_5 := $(filter 4.5, $(FRAMEWORK_VERSION))
+ifdef NET_4_5
+LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC
+endif
+
+NO_TASK_DELAY := $(filter 4.5 2.1, $(FRAMEWORK_VERSION))
+ifndef NO_TASK_DELAY
+LIB_MCS_FLAGS += -d:NO_TASK_DELAY
+endif
+
+TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -r:Mono.Reactive.Tests.dll
+
+EXTRA_DISTFILES = more_build_args $(RESX_RESOURCES:.resources=.resx) $(PREBUILT)
+
+VALID_PROFILE := $(filter 2 4, $(FRAMEWORK_VERSION_MAJOR))
+ifndef VALID_PROFILE
+LIBRARY_NAME = dummy-System.System.Reactive.PlatformServices.dll
+NO_SIGN_ASSEMBLY = yes
+endif
+
+NO_INSTALL = yes
+NO_TEST = yes
+
+include ../../build/library.make
+
+$(the_lib): $(RESOURCES)
+
+$(RESX_RESOURCES): %.resources: %.resx
+ $(RESGEN) $< || cp $@.prebuilt $@
+
+$(PREBUILT): %.prebuilt: %
+ cp $* $@
+
+dist-default: $(PREBUILT)
+
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="WINRT_NO_SUB1MS_TIMERS" xml:space="preserve">
+ <value>The WinRT thread pool doesn't support creating periodic timers with a period below 1 millisecond.</value>
+ </data>
+</root>
\ No newline at end of file
--- /dev/null
+../../../external/rx/Rx.NET/System.Reactive.PlatformServices/GlobalSuppressions.cs
+../../../external/rx/Rx.NET/System.Reactive.PlatformServices/Properties/AssemblyInfo.cs
+../../../external/rx/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/ConcurrencyAbstractionLayerImpl.Windows.cs
+../../../external/rx/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/EventLoopScheduler.cs
+../../../external/rx/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/NewThreadScheduler.cs
+../../../external/rx/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/ConcurrencyAbstractionLayerImpl.cs
+../../../external/rx/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/Thread.Stub.cs
+../../../external/rx/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/ThreadPoolScheduler.Windows.cs
+../../../external/rx/Rx.NET/System.Reactive.PlatformServices/Reactive/EnlightenmentProvider.cs
+../../../external/rx/Rx.NET/System.Reactive.PlatformServices/Reactive/Internal/HostLifecycleNotifications.WindowsPhone.cs
+../../../external/rx/Rx.NET/System.Reactive.PlatformServices/Reactive/Internal/HostLifecycleNotifications.Windows.cs
+../../../external/rx/Rx.NET/System.Reactive.PlatformServices/Reactive/Internal/PhoneShellThunks.cs
+../../../external/rx/Rx.NET/System.Reactive.PlatformServices/Reactive/Internal/StopwatchImpl.cs
+../../../external/rx/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/TaskPoolScheduler.cs
+../../../external/rx/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/ThreadPoolScheduler.cs
+../../../external/rx/Rx.NET/System.Reactive.PlatformServices/Reactive/Internal/ExceptionServicesImpl.cs
+../../../external/rx/Rx.NET/System.Reactive.PlatformServices/Reactive/Internal/PlatformEnlightenmentProvider.cs
+../../../external/rx/Rx.NET/System.Reactive.PlatformServices/Strings_PlatformServices.Generated.cs
--- /dev/null
+-d:SIGNED
+-delaysign
+-keyfile:../reactive.pub
+-resource:Strings_PlatformServices.resources,System.Reactive.Strings_PlatformServices.resources
--- /dev/null
+thisdir = class/System.Reactive.Providers
+SUBDIRS =
+include ../../build/rules.make
+
+LIBRARY = System.Reactive.Providers.dll
+LIB_MCS_FLAGS = \
+ @more_build_args \
+ -r:System.dll \
+ -r:System.Core.dll \
+ -r:System.Reactive.Interfaces.dll \
+ -r:System.Reactive.Core.dll \
+ -r:System.Reactive.Linq.dll
+
+ifeq (true, $(GENERATE_RESOURCES))
+LIB_MCS_FLAGS += /define:GENERATING_RESOURCES
+endif
+
+RESX_RESOURCES = \
+ Strings_Providers.resources
+
+CLEAN_FILES += $(RESX_RESOURCES)
+
+RESOURCES = $(RESX_RESOURCES)
+
+PREBUILT = $(RESX_RESOURCES:=.prebuilt)
+
+ifeq (2.1, $(FRAMEWORK_VERSION))
+LIB_MCS_FLAGS += -d:NO_TASK_DELAY
+endif
+
+NET_4_5 := $(filter 4.5, $(FRAMEWORK_VERSION))
+ifdef NET_4_5
+LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC
+endif
+
+TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
+
+EXTRA_DISTFILES = more_build_args $(RESX_RESOURCES:.resources=.resx) $(PREBUILT)
+
+VALID_PROFILE := $(filter 2 4, $(FRAMEWORK_VERSION_MAJOR))
+ifndef VALID_PROFILE
+LIBRARY_NAME = dummy-System.System.Reactive.Providers.dll
+NO_SIGN_ASSEMBLY = yes
+endif
+
+NO_INSTALL = yes
+NO_TEST = yes
+
+include ../../build/library.make
+
+$(the_lib): $(RESOURCES)
+
+$(RESX_RESOURCES): %.resources: %.resx
+ $(RESGEN) $< || cp $@.prebuilt $@
+
+$(PREBUILT): %.prebuilt: %
+ cp $* $@
+
+dist-default: $(PREBUILT)
+
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="EXPECTED_TOQUERYABLE_METHODCALL" xml:space="preserve">
+ <value>Expected Qbservable.ToQueryable.</value>
+ </data>
+ <data name="INVALID_TREE_TYPE" xml:space="preserve">
+ <value>Invalid expression tree type.</value>
+ </data>
+ <data name="NO_MATCHING_METHOD_FOUND" xml:space="preserve">
+ <value>There is no method '{0}' on type '{1}' that matches the specified arguments.</value>
+ </data>
+</root>
\ No newline at end of file
--- /dev/null
+../../../external/rx/Rx.NET/System.Reactive.Providers/GlobalSuppressions.cs
+../../../external/rx/Rx.NET/System.Reactive.Providers/Properties/AssemblyInfo.cs
+../../../external/rx/Rx.NET/System.Reactive.Providers/Reactive/Internal/Constants.cs
+../../../external/rx/Rx.NET/System.Reactive.Providers/Reactive/Joins/QueryablePattern.cs
+../../../external/rx/Rx.NET/System.Reactive.Providers/Reactive/Joins/QueryablePlan.cs
+../../../external/rx/Rx.NET/System.Reactive.Providers/Reactive/Linq/ExpressionVisitor.cs
+../../../external/rx/Rx.NET/System.Reactive.Providers/Reactive/Linq/Observable.Queryable.cs
+../../../external/rx/Rx.NET/System.Reactive.Providers/Reactive/Linq/Qbservable.cs
+../../../external/rx/Rx.NET/System.Reactive.Providers/Reactive/Linq/Qbservable.Generated.cs
+../../../external/rx/Rx.NET/System.Reactive.Providers/Reactive/Linq/Qbservable.Joins.cs
+../../../external/rx/Rx.NET/System.Reactive.Providers/Reactive/ObservableQuery.cs
+../../../external/rx/Rx.NET/System.Reactive.Providers/Strings_Providers.Generated.cs
--- /dev/null
+-d:SIGNED
+-delaysign
+-keyfile:../reactive.pub
+-resource:Strings_Providers.resources,System.Reactive.Strings_Providers.resources
--- /dev/null
+thisdir = class/System.Reactive.Runtime.Remoting
+SUBDIRS =
+include ../../build/rules.make
+
+LIBRARY = System.Reactive.Runtime.Remoting.dll
+LIB_MCS_FLAGS = \
+ @more_build_args \
+ -r:System.dll \
+ -r:System.Core.dll \
+ -r:System.Reactive.Interfaces.dll \
+ -r:System.Reactive.Core.dll \
+ -r:System.Reactive.Linq.dll
+
+ifeq (2.1, $(FRAMEWORK_VERSION))
+LIB_MCS_FLAGS += -d:NO_TASK_DELAY
+endif
+
+NET_4_5 := $(filter 4.5, $(FRAMEWORK_VERSION))
+ifdef NET_4_5
+LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC
+endif
+
+TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
+
+EXTRA_DISTFILES = more_build_args
+
+VALID_PROFILE := $(filter 2 4, $(FRAMEWORK_VERSION_MAJOR))
+ifndef VALID_PROFILE
+LIBRARY_NAME = dummy-System.System.Reactive.Runtime.Remoting.dll
+NO_SIGN_ASSEMBLY = yes
+endif
+
+NO_INSTALL = yes
+NO_TEST = yes
+
+include ../../build/library.make
--- /dev/null
+../../../external/rx/Rx.NET/System.Reactive.Runtime.Remoting/GlobalSuppressions.cs
+../../../external/rx/Rx.NET/System.Reactive.Runtime.Remoting/Properties/AssemblyInfo.cs
+../../../external/rx/Rx.NET/System.Reactive.Runtime.Remoting/Reactive/Linq/Observable.Remoting.cs
+../../../external/rx/Rx.NET/System.Reactive.Runtime.Remoting/Reactive/Linq/QueryLanguage.Remoting.cs
--- /dev/null
+-d:SIGNED
+-delaysign
+-keyfile:../reactive.pub
--- /dev/null
+thisdir = class/System.Reactive.Windows.Forms
+SUBDIRS =
+include ../../build/rules.make
+
+LIBRARY = System.Reactive.Windows.Forms.dll
+LIB_MCS_FLAGS = \
+ @more_build_args \
+ -r:System.dll \
+ -r:System.Core.dll \
+ -r:System.Reactive.Interfaces.dll \
+ -r:System.Reactive.Core.dll \
+ -r:System.Reactive.Linq.dll \
+ -r:System.Windows.Forms.dll
+
+ifeq (2.1, $(FRAMEWORK_VERSION))
+LIB_MCS_FLAGS += -d:NO_TASK_DELAY
+endif
+
+NET_4_5 := $(filter 4.5, $(FRAMEWORK_VERSION))
+ifdef NET_4_5
+LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC
+endif
+
+TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
+
+EXTRA_DISTFILES = more_build_args
+
+VALID_PROFILE := $(filter 2 4, $(FRAMEWORK_VERSION_MAJOR))
+ifndef VALID_PROFILE
+LIBRARY_NAME = dummy-System.System.Reactive.Windows.Forms.dll
+NO_SIGN_ASSEMBLY = yes
+endif
+
+NO_INSTALL = yes
+NO_TEST = yes
+
+include ../../build/library.make
--- /dev/null
+../../../external/rx/Rx.NET/System.Reactive.Windows.Forms/GlobalSuppressions.cs
+../../../external/rx/Rx.NET/System.Reactive.Windows.Forms/Reactive/Linq/ControlObservable.cs
+../../../external/rx/Rx.NET/System.Reactive.Windows.Forms/Reactive/Concurrency/ControlScheduler.cs
+../../../external/rx/Rx.NET/System.Reactive.Windows.Forms/Properties/AssemblyInfo.cs
--- /dev/null
+-d:SIGNED
+-delaysign
+-keyfile:../reactive.pub
--- /dev/null
+thisdir = class/System.Reactive.Windows.Threading
+SUBDIRS =
+include ../../build/rules.make
+
+LIBRARY = System.Reactive.Windows.Threading.dll
+LIB_MCS_FLAGS = \
+ @more_build_args \
+ -r:System.dll \
+ -r:System.Core.dll \
+ -r:System.Reactive.Interfaces.dll \
+ -r:System.Reactive.Core.dll \
+ -r:System.Reactive.Linq.dll \
+ -r:WindowsBase.dll
+
+ifeq (true, $(GENERATE_RESOURCES))
+LIB_MCS_FLAGS += /define:GENERATING_RESOURCES
+endif
+
+RESX_RESOURCES = \
+ Strings_WindowsThreading.resources
+
+CLEAN_FILES += $(RESX_RESOURCES)
+
+RESOURCES = $(RESX_RESOURCES)
+
+PREBUILT = $(RESX_RESOURCES:=.prebuilt)
+
+ifeq (2.1, $(FRAMEWORK_VERSION))
+LIB_MCS_FLAGS += -d:NO_TASK_DELAY
+endif
+
+NET_4_5 := $(filter 4.5, $(FRAMEWORK_VERSION))
+ifdef NET_4_5
+LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC
+endif
+
+TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
+
+EXTRA_DISTFILES = more_build_args $(RESX_RESOURCES:.resources=.resx) $(PREBUILT)
+
+VALID_PROFILE := $(filter 2 4, $(FRAMEWORK_VERSION_MAJOR))
+ifndef VALID_PROFILE
+LIBRARY_NAME = dummy-System.System.Reactive.Windows.Threading.dll
+NO_SIGN_ASSEMBLY = yes
+endif
+
+NO_INSTALL = yes
+NO_TEST = yes
+
+include ../../build/library.make
+
+$(the_lib): $(RESOURCES)
+
+$(RESX_RESOURCES): %.resources: %.resx
+ $(RESGEN) $< || cp $@.prebuilt $@
+
+$(PREBUILT): %.prebuilt: %
+ cp $* $@
+
+dist-default: $(PREBUILT)
+
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="NO_DISPATCHER_CURRENT_THREAD" xml:space="preserve">
+ <value>The current thread has no Dispatcher associated with it.</value>
+ <comment>Only on WPF/SL.</comment>
+ </data>
+ <data name="NO_WINDOW_CURRENT" xml:space="preserve">
+ <value>No current Window object found to obtain a CoreDispatcher from.</value>
+ <comment>Only on Jupiter.</comment>
+ </data>
+</root>
\ No newline at end of file
--- /dev/null
+../../../external/rx/Rx.NET/System.Reactive.Windows.Threading/GlobalSuppressions.cs
+../../../external/rx/Rx.NET/System.Reactive.Windows.Threading/Reactive/Concurrency/CoreDispatcherScheduler.cs
+../../../external/rx/Rx.NET/System.Reactive.Windows.Threading/Reactive/Internal/Constants.cs
+../../../external/rx/Rx.NET/System.Reactive.Windows.Threading/Reactive/Linq/CoreDispatcherObservable.cs
+../../../external/rx/Rx.NET/System.Reactive.Windows.Threading/Reactive/Linq/DispatcherObservable.cs
+../../../external/rx/Rx.NET/System.Reactive.Windows.Threading/Reactive/Concurrency/DispatcherScheduler.cs
+../../../external/rx/Rx.NET/System.Reactive.Windows.Threading/Properties/AssemblyInfo.cs
+../../../external/rx/Rx.NET/System.Reactive.Windows.Threading/Strings_WindowsThreading.Generated.cs
--- /dev/null
+-d:SIGNED
+-delaysign
+-keyfile:../reactive.pub
+-resource:Strings_WindowsThreading.resources,System.Reactive.Strings_WindowsThreading.resources
exists (and raises InvalidOperationException if required).
*/
+
internal static class TypeExtensions
{
+#if !NET_4_5
public static T GetCustomAttribute<T> (this MemberInfo type, bool inherit)
{
var arr = type.GetCustomAttributes (typeof (T), inherit);
return arr != null && arr.Length == 1 ? (T) arr [0] : default (T);
}
-
+#endif
public static IEnumerable<Type> GetInterfacesOrSelfInterface (this Type type)
{
if (type.IsInterface)
OnDeserializing = mi;
else if (mi.GetCustomAttributes (typeof (OnDeserializedAttribute), false).Length > 0)
OnDeserialized = mi;
+ else if (mi.GetCustomAttributes (typeof (OnSerializingAttribute), false).Length > 0)
+ OnSerializing = mi;
+ else if (mi.GetCustomAttributes (typeof (OnSerializedAttribute), false).Length > 0)
+ OnSerialized = mi;
}
}
public MethodInfo OnDeserializing { get; set; }
public MethodInfo OnDeserialized { get; set; }
+ public MethodInfo OnSerializing { get; set; }
+ public MethodInfo OnSerialized { get; set; }
public virtual void Serialize (JsonSerializationWriter outputter, object graph, string type)
{
+ if (OnSerializing != null)
+ OnSerializing.Invoke (graph, new object [] {new StreamingContext (StreamingContextStates.All)});
+
outputter.Writer.WriteAttributeString ("type", type);
foreach (TypeMapMember member in members) {
object memberObj = member.GetMemberOf (graph);
outputter.WriteObjectContent (memberObj, false, false);
outputter.Writer.WriteEndElement ();
}
+
+ if (OnSerialized != null)
+ OnSerialized.Invoke (graph, new object [] {new StreamingContext (StreamingContextStates.All)});
}
internal static object CreateInstance (Type type)
// do nothing
}
-#if NET_4_0
+#if NET_4_0 && !MOBILE
static readonly XmlWriterSettings settings = new XmlWriterSettings () { OmitXmlDeclaration = true, Indent = false };
XmlSerializer document_serializer, feed_serializer, item_serializer;
Assert.AreEqual ("vv", m.QueryParameters ["p1"], "#5");
}
+ [Test]
+ public void Match3 ()
+ {
+ var template = new UriTemplate ("test");
+ var match1 = template.Match (new Uri ("http://something"), new Uri ("http://something/test"));
+ var match2 = template.Match (new Uri ("http://something/something2"), new Uri ("http://something/something2/test"));
+ Assert.IsNotNull (match1, "#1");
+ Assert.IsNotNull (match2, "#2");
+ }
+
[Test]
public void MatchWildcard ()
{
Test/XmlFiles/* \
Test/System.ServiceModel.Channels/soap-fault*.xml \
Test/System.ServiceModel.Channels/binary-message.raw \
- Test/System.ServiceModel.Description/dump.xml
+ Test/System.ServiceModel.Description/dump.xml \
+ Test/MetadataTests/Resources/*
EXTRA_DISTFILES = $(RESOURCE_FILES) $(TEST_EXTRA_FILES)
<Compile Include="System.ServiceModel\AddressAccessDeniedException.cs" />
<Compile Include="System.ServiceModel\AddressAlreadyInUseException.cs" />
<Compile Include="System.ServiceModel\AllEnums.cs" />
- <Compile Include="System.ServiceModel\BasicHttpBinding.cs" />
+ <Compile Include="System.ServiceModel\HttpBindingBase.cs" />
+ <Compile Include="System.ServiceModel\BasicHttpBinding_4_5.cs" />
<Compile Include="System.ServiceModel\BasicHttpMessageSecurity.cs" />
<Compile Include="System.ServiceModel\BasicHttpSecurity.cs" />
<Compile Include="System.ServiceModel\CallbackBehaviorAttribute.cs" />
throw new NotImplementedException ();
}
- [MonoTODO]
void IWsdlExportExtension.ExportEndpoint (WsdlExporter exporter,
WsdlEndpointConversionContext context)
{
- throw new NotImplementedException ();
}
- [MonoTODO]
void IPolicyExportExtension.ExportPolicy (MetadataExporter exporter,
PolicyConversionContext context)
{
- throw new NotImplementedException ();
+ PolicyAssertionCollection assertions = context.GetBindingAssertions ();
+ XmlDocument doc = new XmlDocument ();
+
+ assertions.Add (doc.CreateElement ("msb", "BinaryEncoding", "http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1"));
}
#endif
}
//
// ConnectionOrientedTransportBindingElement.cs
//
-// Author:
+// Authors:
// Atsushi Enomoto <atsushi@ximian.com>
+// Martin Baulig <martin.baulig@xamarin.com>
//
// Copyright (C) 2005 Novell, Inc. http://www.novell.com
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
using System.Xml;
+using WS = System.Web.Services.Description;
namespace System.ServiceModel.Channels
{
[MonoTODO]
public abstract class ConnectionOrientedTransportBindingElement
- : TransportBindingElement, IPolicyExportExtension
+ : TransportBindingElement, IPolicyExportExtension, IWsdlExportExtension
{
int connection_buf_size = 0x2000, max_buf_size = 0x10000,
max_pending_conn = 10, max_pending_accepts = 1;
return base.GetProperty<T> (context);
}
+ void IWsdlExportExtension.ExportContract (WsdlExporter exporter,
+ WsdlContractConversionContext context)
+ {
+ ;
+ }
+
+ void IWsdlExportExtension.ExportEndpoint (WsdlExporter exporter,
+ WsdlEndpointConversionContext context)
+ {
+ var soap_binding = new WS.Soap12Binding ();
+ soap_binding.Transport = "http://schemas.microsoft.com/soap/tcp";
+ soap_binding.Style = WS.SoapBindingStyle.Document;
+ context.WsdlBinding.Extensions.Add (soap_binding);
+
+ var address = context.Endpoint.Address;
+ var uri = address.Uri.AbsoluteUri;
+
+ var soap_address = new WS.Soap12AddressBinding ();
+ soap_address.Location = uri;
+ context.WsdlPort.Extensions.Add (soap_address);
+
+ var doc = new XmlDocument ();
+ var endpoint_ref = doc.CreateElement (
+ "EndpointReference", AddressingVersion.WSAddressing10.Namespace);
+ var endpoint_addr = doc.CreateElement (
+ "Address", AddressingVersion.WSAddressing10.Namespace);
+ endpoint_addr.InnerText = uri;
+ endpoint_ref.AppendChild (endpoint_addr);
+ context.WsdlPort.Extensions.Add (endpoint_ref);
+ }
+
void IPolicyExportExtension.ExportPolicy (MetadataExporter exporter, PolicyConversionContext context)
{
if (exporter == null)
PolicyAssertionCollection assertions = context.GetBindingAssertions ();
XmlDocument doc = new XmlDocument ();
- assertions.Add (doc.CreateElement ("wsaw", "UsingAddressing", "http://www.w3.org/2006/05/addressing/wsdl"));
- assertions.Add (doc.CreateElement ("msb", "BinaryEncoding", "http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1"));
+ var messageEncodingElement = ExportAddressingPolicy (context);
+ if (messageEncodingElement == null)
+ assertions.Add (doc.CreateElement (
+ "msb", "BinaryEncoding",
+ "http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1"));
if (transfer_mode == TransferMode.Streamed || transfer_mode == TransferMode.StreamedRequest ||
transfer_mode == TransferMode.StreamedResponse)
using System.ServiceModel.Channels.Http;
#endif
using System.ServiceModel.Description;
+#if !MOBILE
+using WS = System.Web.Services.Description;
+#endif
using System.Xml;
namespace System.ServiceModel.Channels
PolicyAssertionCollection assertions = context.GetBindingAssertions ();
XmlDocument doc = new XmlDocument ();
- assertions.Add (doc.CreateElement ("wsaw", "UsingAddressing", "http://www.w3.org/2006/05/addressing/wsdl"));
+ ExportAddressingPolicy (context);
switch (auth_scheme) {
- case AuthenticationSchemes.Basic:
- case AuthenticationSchemes.Digest:
- case AuthenticationSchemes.Negotiate:
- case AuthenticationSchemes.Ntlm:
- assertions.Add (doc.CreateElement ("http",
+ case AuthenticationSchemes.Basic:
+ case AuthenticationSchemes.Digest:
+ case AuthenticationSchemes.Negotiate:
+ case AuthenticationSchemes.Ntlm:
+ assertions.Add (doc.CreateElement ("http",
auth_scheme.ToString () + "Authentication",
"http://schemas.microsoft.com/ws/06/2004/policy/http"));
- break;
+ break;
+ }
+
+ var transportProvider = this as ITransportTokenAssertionProvider;
+ if (transportProvider != null) {
+ var token = transportProvider.GetTransportTokenAssertion ();
+ assertions.Add (CreateTransportBinding (token));
}
}
+ XmlElement CreateTransportBinding (XmlElement transportToken)
+ {
+ var doc = new XmlDocument ();
+ var transportBinding = doc.CreateElement (
+ "sp", "TransportBinding", PolicyImportHelper.SecurityPolicyNS);
+
+ var token = doc.CreateElement (
+ "sp", "TransportToken", PolicyImportHelper.SecurityPolicyNS);
+ PolicyImportHelper.AddWrappedPolicyElement (token, transportToken);
+
+ var algorithmSuite = doc.CreateElement (
+ "sp", "AlgorithmSuite", PolicyImportHelper.SecurityPolicyNS);
+ var basic256 = doc.CreateElement (
+ "sp", "Basic256", PolicyImportHelper.SecurityPolicyNS);
+ PolicyImportHelper.AddWrappedPolicyElement (algorithmSuite, basic256);
+
+ var layout = doc.CreateElement (
+ "sp", "Layout", PolicyImportHelper.SecurityPolicyNS);
+ var strict = doc.CreateElement (
+ "sp", "Strict", PolicyImportHelper.SecurityPolicyNS);
+ PolicyImportHelper.AddWrappedPolicyElement (layout, strict);
+
+ PolicyImportHelper.AddWrappedPolicyElements (
+ transportBinding, token, algorithmSuite, layout);
+
+ return transportBinding;
+ }
+
[MonoTODO]
void IWsdlExportExtension.ExportContract (WsdlExporter exporter,
WsdlContractConversionContext context)
void IWsdlExportExtension.ExportEndpoint (WsdlExporter exporter,
WsdlEndpointConversionContext context)
{
- throw new NotImplementedException ();
+ var soap_binding = new WS.SoapBinding ();
+ soap_binding.Transport = WS.SoapBinding.HttpTransport;
+ soap_binding.Style = WS.SoapBindingStyle.Document;
+ context.WsdlBinding.Extensions.Add (soap_binding);
+
+ var soap_address = new WS.SoapAddressBinding ();
+ soap_address.Location = context.Endpoint.Address.Uri.AbsoluteUri;
+
+ context.WsdlPort.Extensions.Add (soap_address);
}
#endif
}
}
#if !NET_2_1
- [MonoTODO]
public XmlElement GetTransportTokenAssertion ()
{
- throw new NotImplementedException ();
+ var doc = new XmlDocument ();
+ var token = doc.CreateElement ("sp", "HttpsToken", PolicyImportHelper.SecurityPolicyNS);
+ token.SetAttribute ("RequireClientCertificate", req_cli_cert ? "true" : "false");
+ return token;
}
// overriden only in full profile
//
// MessageEncodingBindingElementImporter.cs
//
-// Author: Atsushi Enomoto (atsushi@ximian.com)
+// Author:
+// Martin Baulig <martin.baulig@xamarin.com>
//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
public class MessageEncodingBindingElementImporter
: IWsdlImportExtension, IPolicyImportExtension
{
- [MonoTODO]
void IWsdlImportExtension.BeforeImport (
ServiceDescriptionCollection wsdlDocuments,
XmlSchemaSet xmlSchemas,
{
}
- [MonoTODO]
void IWsdlImportExtension.ImportContract (WsdlImporter importer,
WsdlContractConversionContext context)
{
}
- [MonoTODO]
void IWsdlImportExtension.ImportEndpoint (WsdlImporter importer,
WsdlEndpointConversionContext context)
{
}
- [MonoTODO]
void IPolicyImportExtension.ImportPolicy (MetadataImporter importer,
PolicyConversionContext context)
{
+ var assertions = context.GetBindingAssertions ();
+
+ var mtom = PolicyImportHelper.GetMtomMessageEncodingPolicy (assertions);
+ if (mtom != null) {
+ // http://www.w3.org/Submission/WS-MTOMPolicy/
+ context.BindingElements.Add (new MtomMessageEncodingBindingElement ());
+ return;
+ }
+
+ var binary = PolicyImportHelper.GetBinaryMessageEncodingPolicy (assertions);
+ if (binary != null) {
+ context.BindingElements.Add (new BinaryMessageEncodingBindingElement ());
+ return;
+ }
+
+ context.BindingElements.Add (new TextMessageEncodingBindingElement ());
}
}
}
throw new NotImplementedException ();
}
- [MonoTODO]
void IWsdlExportExtension.ExportEndpoint (WsdlExporter exporter,
WsdlEndpointConversionContext context)
{
- throw new NotImplementedException ();
}
- [MonoTODO]
public void ExportPolicy (MetadataExporter exporter,
PolicyConversionContext context)
{
- throw new NotImplementedException ();
+ PolicyAssertionCollection assertions = context.GetBindingAssertions ();
+ XmlDocument doc = new XmlDocument ();
+
+ assertions.Add (doc.CreateElement ("wsoma", "OptimizedMimeSerialization", "http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization"));
}
}
}
--- /dev/null
+//
+// PolicyImportHelper.cs
+//
+// Author:
+// Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using System.Xml;
+using System.Collections.Generic;
+using System.ServiceModel.Description;
+
+using QName = System.Xml.XmlQualifiedName;
+
+namespace System.ServiceModel.Channels {
+
+ internal static class PolicyImportHelper {
+
+ internal const string SecurityPolicyNS = "http://schemas.xmlsoap.org/ws/2005/07/securitypolicy";
+ internal const string PolicyNS = "http://schemas.xmlsoap.org/ws/2004/09/policy";
+ internal const string MimeSerializationNS = "http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization";
+ internal const string HttpAuthNS = "http://schemas.microsoft.com/ws/06/2004/policy/http";
+
+ internal const string FramingPolicyNS = "http://schemas.microsoft.com/ws/2006/05/framing/policy";
+ internal const string NetBinaryEncodingNS = "http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1";
+
+ internal const string WSSecurityNS = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
+
+ internal static XmlElement GetTransportBindingPolicy (PolicyAssertionCollection collection)
+ {
+ return FindAndRemove (collection, "TransportBinding", SecurityPolicyNS);
+ }
+
+ internal static XmlElement GetStreamedMessageFramingPolicy (PolicyAssertionCollection collection)
+ {
+ return FindAndRemove (collection, "Streamed", FramingPolicyNS);
+ }
+
+ internal static XmlElement GetBinaryMessageEncodingPolicy (PolicyAssertionCollection collection)
+ {
+ return FindAndRemove (collection, "BinaryEncoding", NetBinaryEncodingNS);
+ }
+
+ internal static XmlElement GetMtomMessageEncodingPolicy (PolicyAssertionCollection collection)
+ {
+ return FindAndRemove (collection, "OptimizedMimeSerialization", MimeSerializationNS);
+ }
+
+ static XmlElement FindAndRemove (PolicyAssertionCollection collection, string name, string ns)
+ {
+ var element = collection.Find (name, ns);
+ if (element != null)
+ collection.Remove (element);
+ return element;
+ }
+
+ internal static List<XmlElement> FindAssertionByNS (
+ PolicyAssertionCollection collection, string ns)
+ {
+ var list = new List<XmlElement> ();
+ foreach (var assertion in collection) {
+ if (assertion.NamespaceURI.Equals (ns))
+ list.Add (assertion);
+ }
+ return list;
+ }
+
+ internal static List<XmlElement> GetPolicyElements (XmlElement root, out bool error)
+ {
+ XmlElement policy = null;
+ var list = new List<XmlElement> ();
+
+ foreach (var node in root.ChildNodes) {
+ var e = node as XmlElement;
+ if (e == null)
+ continue;
+ if (!PolicyNS.Equals (e.NamespaceURI) || !e.LocalName.Equals ("Policy")) {
+ error = true;
+ return list;
+ }
+ if (policy != null) {
+ error = true;
+ return list;
+ }
+ policy = e;
+ }
+
+ if (policy == null) {
+ error = true;
+ return list;
+ }
+
+ foreach (var node in policy.ChildNodes) {
+ var e = node as XmlElement;
+ if (e != null)
+ list.Add (e);
+ }
+
+ error = false;
+ return list;
+ }
+
+ internal static bool FindPolicyElement (MetadataImporter importer, XmlElement root,
+ QName name, bool required, bool removeWhenFound,
+ out XmlElement element)
+ {
+ if (!FindPolicyElement (root, name, removeWhenFound, out element)) {
+ importer.AddWarning ("Invalid policy element: {0}", root.OuterXml);
+ return false;
+ }
+ if (required && (element == null)) {
+ importer.AddWarning ("Did not find policy element `{0}'.", name);
+ return false;
+ }
+ return true;
+ }
+
+ internal static bool FindPolicyElement (XmlElement root, QName name,
+ bool removeWhenFound, out XmlElement element)
+ {
+ XmlElement policy = null;
+ foreach (var node in root.ChildNodes) {
+ var e = node as XmlElement;
+ if (e == null)
+ continue;
+ if (!PolicyNS.Equals (e.NamespaceURI) || !e.LocalName.Equals ("Policy")) {
+ element = null;
+ return false;
+ }
+ if (policy != null) {
+ element = null;
+ return false;
+ }
+ policy = e;
+ }
+
+ if (policy == null) {
+ element = null;
+ return true;
+ }
+
+ element = null;
+ foreach (var node in policy.ChildNodes) {
+ var e = node as XmlElement;
+ if (e == null)
+ continue;
+ if (!name.Namespace.Equals (e.NamespaceURI) || !name.Name.Equals (e.LocalName))
+ continue;
+
+ element = e;
+ break;
+ }
+
+ if (!removeWhenFound || (element == null))
+ return true;
+
+ policy.RemoveChild (element);
+
+ bool foundAnother = false;
+ foreach (var node in policy.ChildNodes) {
+ var e = node as XmlElement;
+ if (e != null) {
+ foundAnother = true;
+ break;
+ }
+ }
+
+ if (!foundAnother)
+ root.RemoveChild (policy);
+ return true;
+ }
+
+ internal static XmlElement GetElement (MetadataImporter importer,
+ XmlElement root, string name, string ns)
+ {
+ return GetElement (importer, root, name, ns, false);
+ }
+
+ internal static XmlElement GetElement (MetadataImporter importer,
+ XmlElement root, string name, string ns,
+ bool required)
+ {
+ return GetElement (importer, root, new QName (name, ns), required);
+ }
+
+ internal static XmlElement GetElement (MetadataImporter importer,
+ XmlElement root, QName name, bool required)
+ {
+ var list = root.GetElementsByTagName (name.Name, name.Namespace);
+ if (list.Count < 1) {
+ if (required)
+ importer.AddWarning ("Did not find required policy element `{0}'", name);
+ return null;
+ }
+
+ if (list.Count > 1) {
+ importer.AddWarning ("Found duplicate policy element `{0}'", name);
+ return null;
+ }
+
+ var element = list [0] as XmlElement;
+ if (required && (element == null))
+ importer.AddWarning ("Did not find required policy element `{0}'", name);
+ return element;
+ }
+
+ internal static XmlElement WrapPolicy (XmlElement element)
+ {
+ var policy = element.OwnerDocument.CreateElement ("wsp", "Policy", PolicyNS);
+ policy.AppendChild (element);
+ return policy;
+ }
+
+ //
+ // Add a single element, wrapping it inside <wsp:Policy>
+ //
+ internal static void AddWrappedPolicyElement (XmlElement root, XmlElement element)
+ {
+ if (root.OwnerDocument != element.OwnerDocument)
+ element = (XmlElement)root.OwnerDocument.ImportNode (element, true);
+ if (!element.NamespaceURI.Equals (PolicyNS) || !element.LocalName.Equals ("Policy"))
+ element = WrapPolicy (element);
+ root.AppendChild (element);
+ }
+
+ //
+ // Add multiple elements, wrapping them inside a single <wsp:Policy>
+ //
+ internal static void AddWrappedPolicyElements (XmlElement root, params XmlElement[] elements)
+ {
+ var policy = root.OwnerDocument.CreateElement ("wsp", "Policy", PolicyNS);
+ root.AppendChild (policy);
+
+ foreach (var element in elements) {
+ XmlElement imported;
+ if (root.OwnerDocument != element.OwnerDocument)
+ imported = (XmlElement)root.OwnerDocument.ImportNode (element, true);
+ else
+ imported = element;
+ policy.AppendChild (element);
+ }
+ }
+ }
+}
+
[MonoTODO]
public XmlElement GetTransportTokenAssertion ()
{
- throw new NotImplementedException ();
+ var doc = new XmlDocument ();
+ var element = doc.CreateElement (
+ "msf", "SslTransportSecurity", PolicyImportHelper.FramingPolicyNS);
+ return element;
}
[MonoTODO]
[MonoTODO]
void IPolicyExportExtension.ExportPolicy (
MetadataExporter exporter,
- PolicyConversionContext policyContext)
+ PolicyConversionContext context)
{
- throw new NotImplementedException ();
+ var token = GetTransportTokenAssertion ();
+ var transportBinding = TransportBindingElement.CreateTransportBinding (token);
+ context.GetBindingAssertions ().Add (transportBinding);
}
#endregion
}
// StandardBindingImporter.cs
//
// Author:
-// Atsushi Enomoto <atsushi@ximian.com>
+// Martin Baulig <martin.baulig@xamarin.com>
//
-// Copyright (C) 2005 Novell, Inc. http://www.novell.com
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
using System;
-using System.Collections.Generic;
-using System.ServiceModel.Description;
-using System.Web.Services.Description;
+using System.Net;
using System.Xml;
using System.Xml.Schema;
+using System.Collections.Generic;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+
+using WS = System.Web.Services.Description;
+using QName = System.Xml.XmlQualifiedName;
+
+namespace System.ServiceModel.Channels {
+
+ public class StandardBindingImporter : IWsdlImportExtension {
+ #region IWsdlImportExtension implementation
+
+ public void BeforeImport (WS.ServiceDescriptionCollection wsdlDocuments, XmlSchemaSet xmlSchemas,
+ ICollection<XmlElement> policy)
+ {
+ }
+
+ public void ImportContract (WsdlImporter importer, WsdlContractConversionContext contractContext)
+ {
+ }
+
+ WS.Port LookupPort (WsdlImporter importer, QName name)
+ {
+ foreach (WS.ServiceDescription doc in importer.WsdlDocuments) {
+ foreach (WS.Service service in doc.Services) {
+ foreach (WS.Port port in service.Ports) {
+ if (!name.Namespace.Equals (port.Binding.Namespace))
+ continue;
+ if (!name.Name.Equals (port.Binding.Name))
+ continue;
+ return port;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ public void ImportEndpoint (WsdlImporter importer, WsdlEndpointConversionContext context)
+ {
+ var custom = context.Endpoint.Binding as CustomBinding;
+ if (custom == null)
+ return;
+
+ var soapHttp = GetHttpSoapBinding (context.WsdlBinding);
+ if (soapHttp != null) {
+ ImportBasicHttpBinding (importer, context, custom, soapHttp);
+ return;
+ }
+
+ var soapTcp = GetTcpSoapBinding (context.WsdlBinding);
+ if (soapTcp != null) {
+ ImportNetTcpBinding (importer, context, custom, soapTcp);
+ return;
+ }
+ }
-namespace System.ServiceModel.Channels
-{
- [MonoTODO]
- public class StandardBindingImporter : IWsdlImportExtension
- {
- [MonoTODO]
- void IWsdlImportExtension.BeforeImport (
- ServiceDescriptionCollection wsdlDocuments,
- XmlSchemaSet xmlSchemas,
- ICollection<XmlElement> policy)
+ internal static WS.SoapBinding GetHttpSoapBinding (WS.Binding binding)
{
+ WS.SoapBinding soap = null;
+ foreach (var extension in binding.Extensions) {
+ var check = extension as WS.SoapBinding;
+ if (check != null) {
+ soap = check;
+ break;
+ }
+ }
+
+ if (soap == null)
+ return null;
+ if (soap.Transport != WS.SoapBinding.HttpTransport)
+ return null;
+ if (soap.Style != WS.SoapBindingStyle.Document)
+ return null;
+ return soap;
}
- [MonoTODO]
- void IWsdlImportExtension.ImportContract (WsdlImporter importer,
- WsdlContractConversionContext context)
+ const string TcpTransport = "http://schemas.microsoft.com/soap/tcp";
+
+ internal static WS.Soap12Binding GetTcpSoapBinding (WS.Binding binding)
{
+ WS.Soap12Binding soap = null;
+ foreach (var extension in binding.Extensions) {
+ var check = extension as WS.Soap12Binding;
+ if (check != null) {
+ soap = check;
+ break;
+ }
+ }
+
+ if (soap == null)
+ return null;
+ if (soap.Transport != TcpTransport)
+ return null;
+ if (soap.Style != WS.SoapBindingStyle.Document)
+ return null;
+ return soap;
}
- [MonoTODO]
- void IWsdlImportExtension.ImportEndpoint (WsdlImporter importer,
- WsdlEndpointConversionContext context)
+ bool ImportBasicHttpBinding (
+ WsdlImporter importer, WsdlEndpointConversionContext context,
+ CustomBinding custom, WS.SoapBinding soap)
{
+ TransportBindingElement transportElement = null;
+ MtomMessageEncodingBindingElement mtomElement = null;
+ TextMessageEncodingBindingElement textElement = null;
+ bool foundUnknownElement = false;
+
+ foreach (var element in custom.Elements) {
+ if (element is TransportBindingElement)
+ transportElement = (TransportBindingElement)element;
+ else if (element is MtomMessageEncodingBindingElement)
+ mtomElement = (MtomMessageEncodingBindingElement)element;
+ else if (element is TextMessageEncodingBindingElement)
+ textElement = (TextMessageEncodingBindingElement)element;
+ else {
+ importer.AddWarning (
+ "Found unknown binding element `{0}' while attempting " +
+ "to import binding `{0}'.", element.GetType (),
+ custom.Name);
+ foundUnknownElement = true;
+ }
+ }
+
+ if (foundUnknownElement)
+ return false;
+
+ if ((mtomElement != null) && (textElement != null)) {
+ // FIXME: Should never happen
+ importer.AddWarning (
+ "Found both MtomMessageEncodingBindingElement and " +
+ "TextMessageEncodingBindingElement while attempting to " +
+ "import binding `{0}'.", custom.Name);
+ return false;
+ }
+
+ BasicHttpBinding httpBinding;
+ AuthenticationSchemes authScheme;
+
+ /*
+ * FIXME: Maybe make the BasicHttpBinding use the transport element
+ * that we created with the TransportBindingElementImporter ?
+ *
+ * There seems to be no public API to do that, so maybe add a private .ctor ?
+ *
+ */
+
+ var httpsTransport = transportElement as HttpsTransportBindingElement;
+ var httpTransport = transportElement as HttpTransportBindingElement;
+
+ if (httpsTransport != null) {
+ httpBinding = new BasicHttpBinding (BasicHttpSecurityMode.Transport);
+ authScheme = httpsTransport.AuthenticationScheme;
+ } else if (httpTransport != null) {
+ authScheme = httpTransport.AuthenticationScheme;
+ if ((authScheme != AuthenticationSchemes.None) &&
+ (authScheme != AuthenticationSchemes.Anonymous))
+ httpBinding = new BasicHttpBinding (
+ BasicHttpSecurityMode.TransportCredentialOnly);
+ else
+ httpBinding = new BasicHttpBinding ();
+ } else {
+ httpBinding = new BasicHttpBinding ();
+ authScheme = AuthenticationSchemes.Anonymous;
+ }
+
+ if (mtomElement != null)
+ httpBinding.MessageEncoding = WSMessageEncoding.Mtom;
+ else if (textElement != null)
+ httpBinding.MessageEncoding = WSMessageEncoding.Text;
+ else {
+ importer.AddWarning (
+ "Found neither MtomMessageEncodingBindingElement nor " +
+ "TextMessageEncodingBindingElement while attempting to " +
+ "import binding `{0}'.", custom.Name);
+ return false;
+ }
+
+ httpBinding.Name = context.Endpoint.Binding.Name;
+ httpBinding.Namespace = context.Endpoint.Binding.Namespace;
+
+ switch (authScheme) {
+ case AuthenticationSchemes.None:
+ case AuthenticationSchemes.Anonymous:
+ httpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
+ break;
+ case AuthenticationSchemes.Basic:
+ httpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
+ break;
+ case AuthenticationSchemes.Digest:
+ httpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Digest;
+ break;
+ case AuthenticationSchemes.Ntlm:
+ httpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm;
+ break;
+ case AuthenticationSchemes.Negotiate:
+ httpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;
+ break;
+ default:
+ importer.AddWarning ("Invalid auth scheme: {0}", authScheme);
+ return false;
+ }
+
+ if ((httpsTransport != null) && httpsTransport.RequireClientCertificate) {
+ if (httpBinding.Security.Transport.ClientCredentialType != HttpClientCredentialType.None) {
+ importer.AddWarning ("Cannot use both client certificate and explicit auth type.");
+ return false;
+ }
+ httpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;
+ }
+
+ context.Endpoint.Binding = httpBinding;
+ return true;
}
+
+ bool ImportNetTcpBinding (
+ WsdlImporter importer, WsdlEndpointConversionContext context,
+ CustomBinding custom, WS.Soap12Binding soap)
+ {
+ TcpTransportBindingElement transportElement = null;
+ BinaryMessageEncodingBindingElement binaryElement = null;
+ TransactionFlowBindingElement transactionFlowElement = null;
+ WindowsStreamSecurityBindingElement windowsStreamElement = null;
+ SslStreamSecurityBindingElement sslStreamElement = null;
+ bool foundUnknownElement = false;
+
+ foreach (var element in custom.Elements) {
+ if (element is TcpTransportBindingElement)
+ transportElement = (TcpTransportBindingElement)element;
+ else if (element is BinaryMessageEncodingBindingElement)
+ binaryElement = (BinaryMessageEncodingBindingElement)element;
+ else if (element is TransactionFlowBindingElement)
+ transactionFlowElement = (TransactionFlowBindingElement)element;
+ else if (element is WindowsStreamSecurityBindingElement)
+ windowsStreamElement = (WindowsStreamSecurityBindingElement)element;
+ else if (element is SslStreamSecurityBindingElement)
+ sslStreamElement = (SslStreamSecurityBindingElement)element;
+ else {
+ importer.AddWarning (
+ "Found unknown binding element `{0}' while importing " +
+ "binding `{1}'.", element.GetType (), custom.Name);
+ foundUnknownElement = true;
+ }
+ }
+
+ if (foundUnknownElement)
+ return false;
+
+ if (transportElement == null) {
+ importer.AddWarning (
+ "Missing TcpTransportBindingElement while importing " +
+ "binding `{0}'.", custom.Name);
+ return false;
+ }
+ if (binaryElement == null) {
+ importer.AddWarning (
+ "Missing BinaryMessageEncodingBindingElement while importing " +
+ "binding `{0}'.", custom.Name);
+ return false;
+ }
+
+ if ((windowsStreamElement != null) && (sslStreamElement != null)) {
+ importer.AddWarning (
+ "Found both WindowsStreamSecurityBindingElement and " +
+ "SslStreamSecurityBindingElement while importing binding `{0}.",
+ custom.Name);
+ return false;
+ }
+
+ NetTcpSecurity security;
+ if (windowsStreamElement != null) {
+ security = new NetTcpSecurity (SecurityMode.Transport);
+ security.Transport.ProtectionLevel = windowsStreamElement.ProtectionLevel;
+ } else if (sslStreamElement != null) {
+ security = new NetTcpSecurity (SecurityMode.TransportWithMessageCredential);
+ } else {
+ security = new NetTcpSecurity (SecurityMode.None);
+ }
+
+ var netTcp = new NetTcpBinding (transportElement, security, false);
+
+ netTcp.Name = context.Endpoint.Binding.Name;
+ netTcp.Namespace = context.Endpoint.Binding.Namespace;
+
+ context.Endpoint.Binding = netTcp;
+ return true;
+ }
+
+ #endregion
}
}
+
throw new NotImplementedException ();
}
- [MonoTODO]
void IWsdlExportExtension.ExportEndpoint (WsdlExporter exporter,
WsdlEndpointConversionContext context)
{
- throw new NotImplementedException ();
}
- [MonoTODO]
void IPolicyExportExtension.ExportPolicy (MetadataExporter exporter,
PolicyConversionContext context)
{
- throw new NotImplementedException ();
}
#endif
}
//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
+// Martin Baulig <martin.baulig@xamarin.com>
//
// Copyright (C) 2005, 2007 Novell, Inc. http://www.novell.com
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
return (T) (object) MessageVersion.Soap12WSAddressing10;
return context.GetInnerProperty<T> ();
}
+
+#if !NET_2_1
+ internal static XmlElement CreateTransportBinding (XmlElement transportToken)
+ {
+ var doc = new XmlDocument ();
+ var transportBinding = doc.CreateElement (
+ "sp", "TransportBinding", PolicyImportHelper.SecurityPolicyNS);
+
+ var token = doc.CreateElement (
+ "sp", "TransportToken", PolicyImportHelper.SecurityPolicyNS);
+ PolicyImportHelper.AddWrappedPolicyElement (token, transportToken);
+
+ var algorithmSuite = doc.CreateElement (
+ "sp", "AlgorithmSuite", PolicyImportHelper.SecurityPolicyNS);
+ var basic256 = doc.CreateElement (
+ "sp", "Basic256", PolicyImportHelper.SecurityPolicyNS);
+ PolicyImportHelper.AddWrappedPolicyElement (algorithmSuite, basic256);
+
+ var layout = doc.CreateElement (
+ "sp", "Layout", PolicyImportHelper.SecurityPolicyNS);
+ var strict = doc.CreateElement (
+ "sp", "Strict", PolicyImportHelper.SecurityPolicyNS);
+ PolicyImportHelper.AddWrappedPolicyElement (layout, strict);
+
+ PolicyImportHelper.AddWrappedPolicyElements (
+ transportBinding, token, algorithmSuite, layout);
+
+ return transportBinding;
+ }
+
+ internal static MessageEncodingBindingElement ExportAddressingPolicy (
+ PolicyConversionContext context)
+ {
+ MessageEncodingBindingElement messageEncodingElement = null;
+ foreach (var element in context.BindingElements) {
+ var check = element as MessageEncodingBindingElement;
+ if (check == null)
+ continue;
+ messageEncodingElement = check;
+ break;
+ }
+
+ var doc = new XmlDocument ();
+ var assertions = context.GetBindingAssertions ();
+
+ if (messageEncodingElement == null) {
+ assertions.Add (doc.CreateElement (
+ "wsaw", "UsingAddressing",
+ "http://www.w3.org/2006/05/addressing/wsdl"));
+ return null;
+ }
+
+ var addressing = messageEncodingElement.MessageVersion.Addressing;
+ if (addressing == AddressingVersion.WSAddressingAugust2004)
+ assertions.Add (doc.CreateElement (
+ "wsaw", "UsingAddressing",
+ "http://schemas.xmlsoap.org/ws/2004/08/addressing/policy"));
+ else if (addressing != AddressingVersion.None)
+ assertions.Add (doc.CreateElement (
+ "wsaw", "UsingAddressing",
+ "http://www.w3.org/2006/05/addressing/wsdl"));
+
+ return messageEncodingElement;
+ }
+#endif
}
}
// TransportBindingElementImporter.cs
//
// Author:
-// Atsushi Enomoto <atsushi@ximian.com>
+// Martin Baulig <martin.baulig@xamarin.com>
//
-// Copyright (C) 2005 Novell, Inc. http://www.novell.com
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
using System;
+using System.Net;
+using System.Net.Security;
+using System.Xml;
+using System.Xml.Schema;
using System.Collections.Generic;
-using System.Runtime.Serialization;
using System.ServiceModel;
-using System.ServiceModel.Configuration;
+using System.ServiceModel.Channels;
using System.ServiceModel.Description;
-using System.Web.Services.Description;
-using System.Xml;
-using System.Xml.Schema;
-namespace System.ServiceModel.Channels
-{
- [MonoTODO]
- public class TransportBindingElementImporter
- : IWsdlImportExtension, IPolicyImportExtension
- {
- public TransportBindingElementImporter ()
+using WS = System.Web.Services.Description;
+using QName = System.Xml.XmlQualifiedName;
+
+namespace System.ServiceModel.Channels {
+
+ public class TransportBindingElementImporter : IWsdlImportExtension, IPolicyImportExtension {
+ #region IWsdlImportExtension implementation
+
+ public void BeforeImport (WS.ServiceDescriptionCollection wsdlDocuments, XmlSchemaSet xmlSchemas,
+ ICollection<XmlElement> policy)
+ {
+ }
+
+ public void ImportContract (WsdlImporter importer, WsdlContractConversionContext contractContext)
+ {
+ }
+
+ public void ImportEndpoint (WsdlImporter importer, WsdlEndpointConversionContext context)
{
+ // Only import the binding, not the endpoint.
+ if (context.WsdlPort == null)
+ return;
+
+ DoImportEndpoint (context);
}
- void IWsdlImportExtension.BeforeImport (ServiceDescriptionCollection wsdlDocuments,
- XmlSchemaSet xmlSchemas, ICollection<XmlElement> policy)
+ bool DoImportEndpoint (WsdlEndpointConversionContext context)
{
+ if (ImportBasicHttpEndpoint (context))
+ return true;
+ if (ImportNetTcpEndpoint (context))
+ return true;
+ return false;
}
- void IWsdlImportExtension.ImportContract (WsdlImporter importer,
- WsdlContractConversionContext context)
+ bool ImportBasicHttpEndpoint (WsdlEndpointConversionContext context)
{
+ var http = context.Endpoint.Binding as BasicHttpBinding;
+ if (http == null)
+ return false;
+
+ WS.SoapAddressBinding address = null;
+ foreach (var extension in context.WsdlPort.Extensions) {
+ var check = extension as WS.SoapAddressBinding;
+ if (check != null) {
+ address = check;
+ break;
+ }
+ }
+
+ if (address == null)
+ return false;
+
+ context.Endpoint.Address = new EndpointAddress (address.Location);
+ context.Endpoint.ListenUri = new Uri (address.Location);
+ context.Endpoint.ListenUriMode = ListenUriMode.Explicit;
+ return true;
+ }
+
+ bool ImportNetTcpEndpoint (WsdlEndpointConversionContext context)
+ {
+ var tcp = context.Endpoint.Binding as NetTcpBinding;
+ if (tcp == null)
+ return false;
+
+ WS.Soap12AddressBinding address = null;
+ foreach (var extension in context.WsdlPort.Extensions) {
+ var check = extension as WS.Soap12AddressBinding;
+ if (check != null) {
+ address = check;
+ break;
+ }
+ }
+
+ if (address == null)
+ return false;
+
+ context.Endpoint.Address = new EndpointAddress (address.Location);
+ context.Endpoint.ListenUri = new Uri (address.Location);
+ context.Endpoint.ListenUriMode = ListenUriMode.Explicit;
+ return true;
}
- void IWsdlImportExtension.ImportEndpoint(WsdlImporter importer,
- WsdlEndpointConversionContext context)
+ #endregion
+
+ #region IPolicyImportExtension implementation
+
+ public void ImportPolicy (MetadataImporter importer, PolicyConversionContext context)
{
- for (int i = 0; i < context.WsdlBinding.Extensions.Count; i ++) {
- if (context.WsdlBinding.Extensions [i] is SoapBinding) {
- SoapBinding transport = context.WsdlBinding.Extensions [i] as SoapBinding;
- if (transport.Transport != SoapBinding.HttpTransport)
- //FIXME: not http
- return;
+ var customCtx = context as CustomPolicyConversionContext;
+ var customBinding = context.Endpoint.Binding as CustomBinding;
+ if ((customCtx == null) || (customBinding == null))
+ // FIXME: Should we allow this ?
+ throw new InvalidOperationException ();
+
+ var soapHttp = StandardBindingImporter.GetHttpSoapBinding (customCtx.WsdlBinding);
+ if (soapHttp != null) {
+ if (!ImportHttpPolicy (importer, customCtx, soapHttp))
+ context.BindingElements.Add (new HttpTransportBindingElement ());
+ return;
+ }
+
+ var soapTcp = StandardBindingImporter.GetTcpSoapBinding (customCtx.WsdlBinding);
+ if (soapTcp != null) {
+ if (!ImportTcpPolicy (importer, customCtx, soapTcp))
+ context.BindingElements.Add (new TcpTransportBindingElement ());
+ return;
+ }
+ }
+
+ #endregion
- if (! (context.Endpoint.Binding is CustomBinding))
- //FIXME:
- throw new Exception ();
+ bool ImportHttpAuthScheme (MetadataImporter importer,
+ HttpTransportBindingElement bindingElement,
+ PolicyConversionContext context)
+ {
+ var assertions = context.GetBindingAssertions ();
+ var authSchemes = AuthenticationSchemes.None;
- ((CustomBinding) context.Endpoint.Binding).Elements.Add (new HttpTransportBindingElement ());
- //((CustomBinding) context.Endpoint.Binding).Scheme = "http";
+ var httpsTransport = bindingElement as HttpsTransportBindingElement;
+ bool certificate = httpsTransport != null ?
+ httpsTransport.RequireClientCertificate : false;
- for (int j = 0; j < context.WsdlPort.Extensions.Count; j ++) {
- SoapAddressBinding address = context.WsdlPort.Extensions [j] as SoapAddressBinding;
- if (address == null)
- continue;
+ var authElements = PolicyImportHelper.FindAssertionByNS (
+ assertions, PolicyImportHelper.HttpAuthNS);
+ foreach (XmlElement authElement in authElements) {
+ assertions.Remove (authElement);
- context.Endpoint.Address = new EndpointAddress (address.Location);
- context.Endpoint.ListenUri = new Uri (address.Location);
- }
+ if (certificate) {
+ importer.AddWarning (
+ "Invalid authentication assertion while " +
+ "using client certificate: {0}", authElement.OuterXml);
+ return false;
+ }
+ switch (authElement.LocalName) {
+ case "BasicAuthentication":
+ authSchemes |= AuthenticationSchemes.Basic;
+ break;
+ case "NtlmAuthentication":
+ authSchemes |= AuthenticationSchemes.Ntlm;
break;
+ case "DigestAuthentication":
+ authSchemes |= AuthenticationSchemes.Digest;
+ break;
+ case "NegotiateAuthentication":
+ authSchemes |= AuthenticationSchemes.Negotiate;
+ break;
+ default:
+ importer.AddWarning (
+ "Invalid policy assertion: {0}", authElement.OuterXml);
+ return false;
}
}
+
+ bindingElement.AuthenticationScheme = authSchemes;
+ return true;
+ }
+
+ bool ImportWindowsTransportSecurity (MetadataImporter importer,
+ PolicyConversionContext context,
+ XmlElement policyElement)
+ {
+ var protectionLevel = PolicyImportHelper.GetElement (
+ importer, policyElement, "ProtectionLevel",
+ PolicyImportHelper.FramingPolicyNS, true);
+ if (protectionLevel == null) {
+ importer.AddWarning (
+ "Invalid policy assertion: {0}", policyElement.OuterXml);
+ return false;
+ }
+
+ var element = new WindowsStreamSecurityBindingElement ();
+
+ switch (protectionLevel.InnerText.ToLowerInvariant ()) {
+ case "none":
+ element.ProtectionLevel = ProtectionLevel.None;
+ break;
+ case "sign":
+ element.ProtectionLevel = ProtectionLevel.Sign;
+ break;
+ case "encryptandsign":
+ element.ProtectionLevel = ProtectionLevel.EncryptAndSign;
+ break;
+ default:
+ importer.AddWarning (
+ "Invalid policy assertion: {0}", protectionLevel.OuterXml);
+ return false;
+ }
+
+ context.BindingElements.Add (element);
+ return true;
+ }
+
+ bool ImportTransport (MetadataImporter importer, TransportBindingElement bindingElement,
+ XmlElement transportPolicy)
+ {
+ XmlElement algorithmSuite, layout;
+ if (!PolicyImportHelper.FindPolicyElement (
+ importer, transportPolicy,
+ new QName ("AlgorithmSuite", PolicyImportHelper.SecurityPolicyNS),
+ false, true, out algorithmSuite) ||
+ !PolicyImportHelper.FindPolicyElement (
+ importer, transportPolicy,
+ new QName ("Layout", PolicyImportHelper.SecurityPolicyNS),
+ false, true, out layout))
+ return false;
+
+ bool foundUnknown = false;
+ foreach (var node in transportPolicy.ChildNodes) {
+ var e = node as XmlElement;
+ if (e == null)
+ continue;
+ importer.AddWarning ("Unknown policy assertion: {0}", e.OuterXml);
+ foundUnknown = true;
+ }
+
+ return !foundUnknown;
+ }
+
+ bool GetTransportToken (MetadataImporter importer, XmlElement transportPolicy,
+ out XmlElement transportToken)
+ {
+ return PolicyImportHelper.FindPolicyElement (
+ importer, transportPolicy,
+ new QName ("TransportToken", PolicyImportHelper.SecurityPolicyNS),
+ false, true, out transportToken);
+ }
+
+ bool ImportHttpTransport (MetadataImporter importer, PolicyConversionContext context,
+ XmlElement transportPolicy,
+ out HttpTransportBindingElement bindingElement)
+ {
+ XmlElement transportToken;
+ if (!GetTransportToken (importer, transportPolicy, out transportToken)) {
+ bindingElement = null;
+ return false;
+ }
+
+ if (transportToken == null) {
+ bindingElement = new HttpTransportBindingElement ();
+ return true;
+ }
+
+ bool error;
+ var tokenElementList = PolicyImportHelper.GetPolicyElements (transportToken, out error);
+ if (error || (tokenElementList.Count != 1)) {
+ importer.AddWarning ("Invalid policy assertion: {0}", transportToken.OuterXml);
+ bindingElement = null;
+ return false;
+ }
+
+ var tokenElement = tokenElementList [0];
+ if (!PolicyImportHelper.SecurityPolicyNS.Equals (tokenElement.NamespaceURI) ||
+ !tokenElement.LocalName.Equals ("HttpsToken")) {
+ importer.AddWarning ("Invalid policy assertion: {0}", tokenElement.OuterXml);
+ bindingElement = null;
+ return false;
+ }
+
+ var httpsTransport = new HttpsTransportBindingElement ();
+ bindingElement = httpsTransport;
+
+ var certAttr = tokenElement.GetAttribute ("RequireClientCertificate");
+ if (!String.IsNullOrEmpty (certAttr))
+ httpsTransport.RequireClientCertificate = Boolean.Parse (certAttr);
+ return true;
+ }
+
+ bool ImportTcpTransport (MetadataImporter importer, PolicyConversionContext context,
+ XmlElement transportPolicy)
+ {
+ XmlElement transportToken;
+ if (!GetTransportToken (importer, transportPolicy, out transportToken))
+ return false;
+
+ if (transportToken == null)
+ return true;
+
+ bool error;
+ var tokenElementList = PolicyImportHelper.GetPolicyElements (transportToken, out error);
+ if (error || (tokenElementList.Count != 1)) {
+ importer.AddWarning ("Invalid policy assertion: {0}", transportToken.OuterXml);
+ return false;
+ }
+
+ var tokenElement = tokenElementList [0];
+ if (!PolicyImportHelper.FramingPolicyNS.Equals (tokenElement.NamespaceURI)) {
+ importer.AddWarning ("Invalid policy assertion: {0}", tokenElement.OuterXml);
+ return false;
+ }
+
+ if (tokenElement.LocalName.Equals ("WindowsTransportSecurity")) {
+ if (!ImportWindowsTransportSecurity (importer, context, tokenElement))
+ return false;
+ } else if (tokenElement.LocalName.Equals ("SslTransportSecurity")) {
+ context.BindingElements.Add (new SslStreamSecurityBindingElement ());
+ }
+
+ return true;
}
- void IPolicyImportExtension.ImportPolicy (MetadataImporter importer,
- PolicyConversionContext context)
+ bool ImportHttpPolicy (MetadataImporter importer, PolicyConversionContext context,
+ WS.SoapBinding soap)
{
- throw new NotImplementedException ();
+ HttpTransportBindingElement httpTransport;
+ var assertions = context.GetBindingAssertions ();
+ var transportPolicy = PolicyImportHelper.GetTransportBindingPolicy (assertions);
+ if (transportPolicy != null) {
+ if (!ImportHttpTransport (importer, context, transportPolicy, out httpTransport))
+ return false;
+ if (!ImportTransport (importer, httpTransport, transportPolicy))
+ return false;
+ } else {
+ httpTransport = new HttpTransportBindingElement ();
+ }
+
+ if (!ImportHttpAuthScheme (importer, httpTransport, context))
+ return false;
+
+ context.BindingElements.Add (httpTransport);
+ return true;
+ }
+
+ bool ImportTcpPolicy (MetadataImporter importer, PolicyConversionContext context,
+ WS.Soap12Binding soap)
+ {
+ var assertions = context.GetBindingAssertions ();
+
+ var tcpTransport = new TcpTransportBindingElement ();
+
+ var transportPolicy = PolicyImportHelper.GetTransportBindingPolicy (assertions);
+ if (transportPolicy != null) {
+ if (!ImportTcpTransport (importer, context, transportPolicy))
+ return false;
+ if (!ImportTransport (importer, tcpTransport, transportPolicy))
+ return false;
+ }
+
+ var streamed = PolicyImportHelper.GetStreamedMessageFramingPolicy (assertions);
+ if (streamed != null)
+ tcpTransport.TransferMode = TransferMode.Streamed;
+
+ context.BindingElements.Add (tcpTransport);
+ return true;
}
}
}
using System.ServiceModel.Description;
using System.ServiceModel.Security;
using System.ServiceModel.Security.Tokens;
+using System.Xml;
namespace System.ServiceModel.Channels
{
[MonoTODO]
public class WindowsStreamSecurityBindingElement
- : BindingElement, ISecurityCapabilities, IPolicyExportExtension
+ : BindingElement, ISecurityCapabilities, IPolicyExportExtension,
+ ITransportTokenAssertionProvider
{
public WindowsStreamSecurityBindingElement ()
{
[MonoTODO]
void IPolicyExportExtension.ExportPolicy (
MetadataExporter exporter,
- PolicyConversionContext policyContext)
+ PolicyConversionContext context)
{
- throw new NotImplementedException ();
+ var token = GetTransportTokenAssertion ();
+ var transportBinding = TransportBindingElement.CreateTransportBinding (token);
+ context.GetBindingAssertions ().Add (transportBinding);
+ }
+
+ public XmlElement GetTransportTokenAssertion ()
+ {
+ var doc = new XmlDocument ();
+ var element = doc.CreateElement (
+ "msf", "WindowsTransportSecurity", PolicyImportHelper.FramingPolicyNS);
+ var protectionLevel = doc.CreateElement (
+ "msf", "ProtectionLevel", PolicyImportHelper.FramingPolicyNS);
+ protectionLevel.InnerText = ProtectionLevel.ToString ();
+ element.AppendChild (protectionLevel);
+ return element;
}
#endregion
}
//
// BasicHttpBindingElement.cs
//
+// See BasicHttpBindingElement_4_5.cs and HttpBindingBaseElement.cs
+// for the .NET 4.5 version of this class, where most of the code has
+// been moved into the new abstract HttpBindingBaseElement class.
+//
+//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
//
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !NET_4_5
using System;
using System.Collections;
using System.Collections.Generic;
}
}
+#endif
--- /dev/null
+//
+// BasicHttpBindingElement_4_5.cs
+//
+// Authors:
+// Atsushi Enomoto <atsushi@ximian.com>
+// Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (C) 2006 Novell, Inc. http://www.novell.com
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Configuration;
+using System.Net;
+using System.Net.Security;
+using System.Reflection;
+using System.Security.Cryptography.X509Certificates;
+using System.Security.Principal;
+using System.IdentityModel.Claims;
+using System.IdentityModel.Policy;
+using System.IdentityModel.Tokens;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+using System.ServiceModel.Diagnostics;
+using System.ServiceModel.Dispatcher;
+using System.ServiceModel.MsmqIntegration;
+using System.ServiceModel.PeerResolvers;
+using System.ServiceModel.Security;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Xml;
+
+namespace System.ServiceModel.Configuration
+{
+ public class BasicHttpBindingElement
+ : HttpBindingBaseElement, IBindingConfigurationElement
+ {
+ ConfigurationPropertyCollection _properties;
+
+ public BasicHttpBindingElement ()
+ {
+ }
+
+ public BasicHttpBindingElement (string name) : base (name) { }
+
+ protected override Type BindingElementType {
+ get { return typeof (BasicHttpBinding); }
+ }
+
+ // Properties
+
+ [ConfigurationProperty ("messageEncoding",
+ DefaultValue = "Text",
+ Options = ConfigurationPropertyOptions.None)]
+ public WSMessageEncoding MessageEncoding {
+ get { return (WSMessageEncoding) this ["messageEncoding"]; }
+ set { this ["messageEncoding"] = value; }
+ }
+
+ protected override ConfigurationPropertyCollection Properties {
+ get {
+ if (_properties == null) {
+ _properties = base.Properties;
+ _properties.Add (new ConfigurationProperty ("messageEncoding", typeof (WSMessageEncoding), "Text", null, null, ConfigurationPropertyOptions.None));
+ _properties.Add (new ConfigurationProperty ("security", typeof (BasicHttpSecurityElement), null, null, null, ConfigurationPropertyOptions.None));
+ }
+ return _properties;
+ }
+ }
+
+ [ConfigurationProperty ("security",
+ Options = ConfigurationPropertyOptions.None)]
+ public BasicHttpSecurityElement Security {
+ get { return (BasicHttpSecurityElement) this ["security"]; }
+ }
+
+ protected override void OnApplyConfiguration (Binding binding)
+ {
+ base.OnApplyConfiguration (binding);
+ BasicHttpBinding basicHttpBinding = (BasicHttpBinding) binding;
+
+ basicHttpBinding.MessageEncoding = MessageEncoding;
+
+ basicHttpBinding.Security.Mode = Security.Mode;
+ Security.Transport.ApplyConfiguration (basicHttpBinding.Security.Transport);
+ }
+
+ protected internal override void InitializeFrom (Binding binding)
+ {
+ BasicHttpBinding b = (BasicHttpBinding) binding;
+ base.InitializeFrom (binding);
+
+ MessageEncoding = b.MessageEncoding;
+
+ Security.Mode = b.Security.Mode;
+ Security.Transport.ApplyConfiguration (b.Security.Transport);
+ }
+ }
+}
--- /dev/null
+//
+// BasicHttpsBindingCollectionElement.cs
+//
+// Author:
+// Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Configuration;
+using System.Net;
+using System.Net.Security;
+using System.Reflection;
+using System.Security.Cryptography.X509Certificates;
+using System.Security.Principal;
+using System.IdentityModel.Claims;
+using System.IdentityModel.Policy;
+using System.IdentityModel.Tokens;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+using System.ServiceModel.Diagnostics;
+using System.ServiceModel.Dispatcher;
+using System.ServiceModel.MsmqIntegration;
+using System.ServiceModel.PeerResolvers;
+using System.ServiceModel.Security;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Xml;
+
+namespace System.ServiceModel.Configuration
+{
+ public partial class BasicHttpsBindingCollectionElement
+ : StandardBindingCollectionElement<BasicHttpsBinding, BasicHttpsBindingElement>
+ {
+ }
+
+}
--- /dev/null
+//
+// BasicHttpsBindingElement.cs
+//
+// Authors:
+// Atsushi Enomoto <atsushi@ximian.com>
+// Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (C) 2006 Novell, Inc. http://www.novell.com
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Configuration;
+using System.Net;
+using System.Net.Security;
+using System.Reflection;
+using System.Security.Cryptography.X509Certificates;
+using System.Security.Principal;
+using System.IdentityModel.Claims;
+using System.IdentityModel.Policy;
+using System.IdentityModel.Tokens;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+using System.ServiceModel.Diagnostics;
+using System.ServiceModel.Dispatcher;
+using System.ServiceModel.MsmqIntegration;
+using System.ServiceModel.PeerResolvers;
+using System.ServiceModel.Security;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Xml;
+
+namespace System.ServiceModel.Configuration
+{
+ public class BasicHttpsBindingElement
+ : HttpBindingBaseElement, IBindingConfigurationElement
+ {
+ ConfigurationPropertyCollection _properties;
+
+ public BasicHttpsBindingElement ()
+ {
+ }
+
+ public BasicHttpsBindingElement (string name) : base (name) { }
+
+ protected override Type BindingElementType {
+ get { return typeof (BasicHttpsBinding); }
+ }
+
+ // Properties
+
+ [ConfigurationProperty ("messageEncoding",
+ DefaultValue = "Text",
+ Options = ConfigurationPropertyOptions.None)]
+ public WSMessageEncoding MessageEncoding {
+ get { return (WSMessageEncoding) this ["messageEncoding"]; }
+ set { this ["messageEncoding"] = value; }
+ }
+
+ protected override ConfigurationPropertyCollection Properties {
+ get {
+ if (_properties == null) {
+ _properties = base.Properties;
+ _properties.Add (new ConfigurationProperty ("messageEncoding", typeof (WSMessageEncoding), "Text", null, null, ConfigurationPropertyOptions.None));
+ _properties.Add (new ConfigurationProperty ("security", typeof (BasicHttpsSecurityElement), null, null, null, ConfigurationPropertyOptions.None));
+ }
+ return _properties;
+ }
+ }
+
+ [ConfigurationProperty ("security",
+ Options = ConfigurationPropertyOptions.None)]
+ public BasicHttpsSecurityElement Security {
+ get { return (BasicHttpsSecurityElement) this ["security"]; }
+ }
+
+ protected override void OnApplyConfiguration (Binding binding)
+ {
+ base.OnApplyConfiguration (binding);
+ BasicHttpsBinding basicHttpsBinding = (BasicHttpsBinding) binding;
+
+ basicHttpsBinding.MessageEncoding = MessageEncoding;
+
+ basicHttpsBinding.Security.Mode = Security.Mode;
+ Security.Transport.ApplyConfiguration (basicHttpsBinding.Security.Transport);
+ }
+
+ protected internal override void InitializeFrom (Binding binding)
+ {
+ BasicHttpsBinding b = (BasicHttpsBinding) binding;
+ base.InitializeFrom (binding);
+
+ MessageEncoding = b.MessageEncoding;
+
+ Security.Mode = b.Security.Mode;
+ Security.Transport.ApplyConfiguration (b.Security.Transport);
+ }
+ }
+}
--- /dev/null
+//
+// BasicHttpsSecurityElement.cs
+//
+// Authors:
+// Atsushi Enomoto <atsushi@ximian.com>
+// Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (C) 2006 Novell, Inc. http://www.novell.com
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Configuration;
+using System.Net;
+using System.Net.Security;
+using System.Reflection;
+using System.Security.Cryptography.X509Certificates;
+using System.Security.Principal;
+using System.IdentityModel.Claims;
+using System.IdentityModel.Policy;
+using System.IdentityModel.Tokens;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+using System.ServiceModel.Diagnostics;
+using System.ServiceModel.Dispatcher;
+using System.ServiceModel.MsmqIntegration;
+using System.ServiceModel.PeerResolvers;
+using System.ServiceModel.Security;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Xml;
+
+namespace System.ServiceModel.Configuration
+{
+ public sealed class BasicHttpsSecurityElement
+ : ConfigurationElement
+ {
+ // Properties
+
+ [ConfigurationProperty ("message",
+ Options = ConfigurationPropertyOptions.None)]
+ public BasicHttpMessageSecurityElement Message {
+ get { return (BasicHttpMessageSecurityElement) base ["message"]; }
+ }
+
+ [ConfigurationProperty ("mode",
+ DefaultValue = "None",
+ Options = ConfigurationPropertyOptions.None)]
+ public BasicHttpsSecurityMode Mode {
+ get { return (BasicHttpsSecurityMode) base ["mode"]; }
+ set { base ["mode"] = value; }
+ }
+
+ protected override ConfigurationPropertyCollection Properties {
+ get { return base.Properties; }
+ }
+
+ [ConfigurationProperty ("transport",
+ Options = ConfigurationPropertyOptions.None)]
+ public HttpTransportSecurityElement Transport {
+ get { return (HttpTransportSecurityElement) base ["transport"]; }
+ }
+
+
+ }
+
+}
get { return (BasicHttpBindingCollectionElement) this ["basicHttpBinding"]; }
}
+#if NET_4_5
+ [ConfigurationProperty ("basicHttpsBinding",
+ Options = ConfigurationPropertyOptions.None)]
+ public BasicHttpsBindingCollectionElement BasicHttpsBinding {
+ get { return (BasicHttpsBindingCollectionElement) this ["basicHttpsBinding"]; }
+ }
+#endif
+
[MonoTODO ("Not Implemented")]
public List<BindingCollectionElement> BindingCollections {
get { throw new NotImplementedException (); }
--- /dev/null
+//
+// HttpBindingBaseElement.cs
+//
+// This is a .NET 4.5 addition and contains most of the code from
+// BasicHttpBindingElement.
+//
+//
+// Authors:
+// Atsushi Enomoto <atsushi@ximian.com>
+// Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (C) 2006 Novell, Inc. http://www.novell.com
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Configuration;
+using System.Net;
+using System.Net.Security;
+using System.Reflection;
+using System.Security.Cryptography.X509Certificates;
+using System.Security.Principal;
+using System.IdentityModel.Claims;
+using System.IdentityModel.Policy;
+using System.IdentityModel.Tokens;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+using System.ServiceModel.Diagnostics;
+using System.ServiceModel.Dispatcher;
+using System.ServiceModel.MsmqIntegration;
+using System.ServiceModel.PeerResolvers;
+using System.ServiceModel.Security;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Xml;
+
+namespace System.ServiceModel.Configuration
+{
+ public abstract class HttpBindingBaseElement
+ : StandardBindingElement, IBindingConfigurationElement
+ {
+ ConfigurationPropertyCollection _properties;
+
+ public HttpBindingBaseElement ()
+ {
+ }
+
+ public HttpBindingBaseElement (string name) : base (name) { }
+
+ // Properties
+
+ [ConfigurationProperty ("allowCookies",
+ DefaultValue = false,
+ Options = ConfigurationPropertyOptions.None)]
+ public bool AllowCookies {
+ get { return (bool) this ["allowCookies"]; }
+ set { this ["allowCookies"] = value; }
+ }
+
+ [ConfigurationProperty ("bypassProxyOnLocal",
+ DefaultValue = false,
+ Options = ConfigurationPropertyOptions.None)]
+ public bool BypassProxyOnLocal {
+ get { return (bool) this ["bypassProxyOnLocal"]; }
+ set { this ["bypassProxyOnLocal"] = value; }
+ }
+
+ [ConfigurationProperty ("hostNameComparisonMode",
+ DefaultValue = "StrongWildcard",
+ Options = ConfigurationPropertyOptions.None)]
+ public HostNameComparisonMode HostNameComparisonMode {
+ get { return (HostNameComparisonMode) this ["hostNameComparisonMode"]; }
+ set { this ["hostNameComparisonMode"] = value; }
+ }
+
+ [LongValidator ( MinValue = 0,
+ MaxValue = 9223372036854775807,
+ ExcludeRange = false)]
+ [ConfigurationProperty ("maxBufferPoolSize",
+ DefaultValue = "524288",
+ Options = ConfigurationPropertyOptions.None)]
+ public long MaxBufferPoolSize {
+ get { return (long) this ["maxBufferPoolSize"]; }
+ set { this ["maxBufferPoolSize"] = value; }
+ }
+
+ [IntegerValidator ( MinValue = 1,
+ MaxValue = int.MaxValue,
+ ExcludeRange = false)]
+ [ConfigurationProperty ("maxBufferSize",
+ DefaultValue = "65536",
+ Options = ConfigurationPropertyOptions.None)]
+ public int MaxBufferSize {
+ get { return (int) this ["maxBufferSize"]; }
+ set { this ["maxBufferSize"] = value; }
+ }
+
+ [LongValidator ( MinValue = 1,
+ MaxValue = 9223372036854775807,
+ ExcludeRange = false)]
+ [ConfigurationProperty ("maxReceivedMessageSize",
+ DefaultValue = "65536",
+ Options = ConfigurationPropertyOptions.None)]
+ public long MaxReceivedMessageSize {
+ get { return (long) this ["maxReceivedMessageSize"]; }
+ set { this ["maxReceivedMessageSize"] = value; }
+ }
+
+ protected override ConfigurationPropertyCollection Properties {
+ get {
+ if (_properties == null) {
+ _properties = base.Properties;
+ _properties.Add (new ConfigurationProperty ("allowCookies", typeof (bool), "false", null, null, ConfigurationPropertyOptions.None));
+ _properties.Add (new ConfigurationProperty ("bypassProxyOnLocal", typeof (bool), "false", null, null, ConfigurationPropertyOptions.None));
+ _properties.Add (new ConfigurationProperty ("hostNameComparisonMode", typeof (HostNameComparisonMode), "StrongWildcard", null, null, ConfigurationPropertyOptions.None));
+ _properties.Add (new ConfigurationProperty ("maxBufferPoolSize", typeof (long), "524288", null, new LongValidator (0, 9223372036854775807, false), ConfigurationPropertyOptions.None));
+ _properties.Add (new ConfigurationProperty ("maxBufferSize", typeof (int), "65536", null, new IntegerValidator (1, int.MaxValue, false), ConfigurationPropertyOptions.None));
+ _properties.Add (new ConfigurationProperty ("maxReceivedMessageSize", typeof (long), "65536", null, new LongValidator (1, 9223372036854775807, false), ConfigurationPropertyOptions.None));
+ _properties.Add (new ConfigurationProperty ("proxyAddress", typeof (Uri), null, new UriTypeConverter (), null, ConfigurationPropertyOptions.None));
+ _properties.Add (new ConfigurationProperty ("readerQuotas", typeof (XmlDictionaryReaderQuotasElement), null, null, null, ConfigurationPropertyOptions.None));
+ _properties.Add (new ConfigurationProperty ("textEncoding", typeof (Encoding), "utf-8", EncodingConverter.Instance, null, ConfigurationPropertyOptions.None));
+ _properties.Add (new ConfigurationProperty ("transferMode", typeof (TransferMode), "Buffered", null, null, ConfigurationPropertyOptions.None));
+ _properties.Add (new ConfigurationProperty ("useDefaultWebProxy", typeof (bool), "true", new BooleanConverter (), null, ConfigurationPropertyOptions.None));
+ }
+ return _properties;
+ }
+ }
+
+ [ConfigurationProperty ("proxyAddress",
+ DefaultValue = null,
+ Options = ConfigurationPropertyOptions.None)]
+ public Uri ProxyAddress {
+ get { return (Uri) this ["proxyAddress"]; }
+ set { this ["proxyAddress"] = value; }
+ }
+
+ [ConfigurationProperty ("readerQuotas",
+ Options = ConfigurationPropertyOptions.None)]
+ public XmlDictionaryReaderQuotasElement ReaderQuotas {
+ get { return (XmlDictionaryReaderQuotasElement) this ["readerQuotas"]; }
+ }
+
+ [TypeConverter (typeof (EncodingConverter))]
+ [ConfigurationProperty ("textEncoding",
+ DefaultValue = "utf-8",
+ Options = ConfigurationPropertyOptions.None)]
+ public Encoding TextEncoding {
+ get { return (Encoding) this ["textEncoding"]; }
+ set { this ["textEncoding"] = value; }
+ }
+
+ [ConfigurationProperty ("transferMode",
+ DefaultValue = "Buffered",
+ Options = ConfigurationPropertyOptions.None)]
+ public TransferMode TransferMode {
+ get { return (TransferMode) this ["transferMode"]; }
+ set { this ["transferMode"] = value; }
+ }
+
+ [ConfigurationProperty ("useDefaultWebProxy",
+ DefaultValue = true,
+ Options = ConfigurationPropertyOptions.None)]
+ public bool UseDefaultWebProxy {
+ get { return (bool) this ["useDefaultWebProxy"]; }
+ set { this ["useDefaultWebProxy"] = value; }
+ }
+
+ protected override void OnApplyConfiguration (Binding binding)
+ {
+ HttpBindingBase basicHttpBinding = (HttpBindingBase) binding;
+
+ basicHttpBinding.AllowCookies = AllowCookies;
+ basicHttpBinding.BypassProxyOnLocal = BypassProxyOnLocal;
+ basicHttpBinding.HostNameComparisonMode = HostNameComparisonMode;
+ basicHttpBinding.MaxBufferPoolSize = MaxBufferPoolSize;
+ basicHttpBinding.MaxBufferSize = MaxBufferSize;
+ basicHttpBinding.MaxReceivedMessageSize = MaxReceivedMessageSize;
+ basicHttpBinding.ProxyAddress = ProxyAddress;
+
+ ReaderQuotas.ApplyConfiguration (basicHttpBinding.ReaderQuotas);
+
+ basicHttpBinding.TextEncoding = TextEncoding;
+ basicHttpBinding.TransferMode = TransferMode;
+ basicHttpBinding.UseDefaultWebProxy = UseDefaultWebProxy;
+ }
+
+ protected internal override void InitializeFrom (Binding binding)
+ {
+ HttpBindingBase b = (HttpBindingBase) binding;
+
+ base.InitializeFrom (binding);
+ AllowCookies = b.AllowCookies;
+ BypassProxyOnLocal = b.BypassProxyOnLocal;
+ HostNameComparisonMode = b.HostNameComparisonMode;
+ MaxBufferPoolSize = b.MaxBufferPoolSize;
+ MaxBufferSize = b.MaxBufferSize;
+ MaxReceivedMessageSize = b.MaxReceivedMessageSize;
+ ProxyAddress = b.ProxyAddress;
+
+ ReaderQuotas.ApplyConfiguration (b.ReaderQuotas);
+
+ TextEncoding = b.TextEncoding;
+ TransferMode = b.TransferMode;
+ UseDefaultWebProxy = b.UseDefaultWebProxy;
+ }
+ }
+
+}
--- /dev/null
+//
+// CustomPolicyConversionContext.cs
+//
+// Author:
+// Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Xml;
+using System.ServiceModel.Channels;
+using WS = System.Web.Services.Description;
+
+namespace System.ServiceModel.Description {
+
+ internal class CustomPolicyConversionContext : PolicyConversionContext {
+ WS.Binding binding;
+ PolicyAssertionCollection assertions;
+ BindingElementCollection binding_elements;
+
+ internal WS.Binding WsdlBinding {
+ get { return binding; }
+ }
+
+ #region implemented abstract members of PolicyConversionContext
+
+ public override PolicyAssertionCollection GetBindingAssertions ()
+ {
+ return assertions;
+ }
+
+ public override PolicyAssertionCollection GetFaultBindingAssertions (FaultDescription fault)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override PolicyAssertionCollection GetMessageBindingAssertions (MessageDescription message)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override PolicyAssertionCollection GetOperationBindingAssertions (OperationDescription operation)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override BindingElementCollection BindingElements {
+ get { return binding_elements; }
+ }
+
+ #endregion
+
+ public CustomPolicyConversionContext (WS.Binding binding, ServiceEndpoint endpoint)
+ : base (endpoint)
+ {
+ this.binding = binding;
+ assertions = new PolicyAssertionCollection ();
+ binding_elements = ((CustomBinding)endpoint.Binding).Elements;
+ }
+
+ public CustomPolicyConversionContext (ServiceEndpoint endpoint)
+ : base (endpoint)
+ {
+ assertions = new PolicyAssertionCollection ();
+ binding_elements = endpoint.Binding.CreateBindingElements ();
+ }
+
+ public void AddPolicyAssertion (XmlElement element)
+ {
+ /*
+ * http://www.w3.org/Submission/WS-Policy/#Policy_Assertion:
+ *
+ * <wsp:Policy … >
+ * <wsp:ExactlyOne>
+ * ( <wsp:All> ( <Assertion …> … </Assertion> )* </wsp:All> )*
+ * </wsp:ExactlyOne>
+ * </wsp:Policy>
+ *
+ */
+
+ var exactlyOne = element.FirstChild as XmlElement;
+ if (exactlyOne == null) {
+ // OOPS
+ return;
+ }
+
+ if (!exactlyOne.NamespaceURI.Equals (Constants.WspNamespace) ||
+ !exactlyOne.LocalName.Equals ("ExactlyOne")) {
+ // FIXME: What to do with this ... ?
+ return;
+ }
+
+ foreach (var node in exactlyOne.ChildNodes) {
+ var child = node as XmlElement;
+ if (child == null)
+ continue;
+
+ if (!child.NamespaceURI.Equals (Constants.WspNamespace) ||
+ !child.LocalName.Equals ("All")) {
+ // FIXME: Can assertions go here ... ?
+ continue;
+ }
+
+ foreach (var node2 in child.ChildNodes) {
+ var assertion = node2 as XmlElement;
+ if (assertion == null)
+ continue;
+
+ assertions.Add (assertion);
+ }
+ }
+ }
+ }
+}
+
[MonoTODO]
public abstract class MetadataExporter
{
+ Collection<MetadataConversionError> errors = new Collection<MetadataConversionError> ();
+
internal MetadataExporter ()
{
}
public Collection<MetadataConversionError> Errors {
- get { throw new NotImplementedException (); }
+ get { return errors; }
}
public Dictionary<Object,Object> State {
{
throw new NotImplementedException ();
}
+
+ internal MetadataConversionError AddError (string message, params object[] args)
+ {
+ var error = new MetadataConversionError (string.Format (message, args));
+ Errors.Add (error);
+ return error;
+ }
+
+ internal MetadataConversionError AddWarning (string message, params object[] args)
+ {
+ var error = new MetadataConversionError (string.Format (message, args), true);
+ Errors.Add (error);
+ return error;
+ }
+
+ internal class MetadataExportException : Exception
+ {
+ public MetadataConversionError Error {
+ get;
+ private set;
+ }
+
+ public MetadataExportException (MetadataConversionError error)
+ : base (error.Message)
+ {
+ this.Error = error;
+ }
+
+ public MetadataExportException (MetadataConversionError error, Exception inner)
+ : base (error.Message, inner)
+ {
+ this.Error = error;
+ }
+ }
}
}
policy_extensions.Add (new MessageEncodingBindingElementImporter ());
}
- [MonoTODO ("Not in use yet")]
public Collection<MetadataConversionError> Errors {
get { return errors; }
}
}
return (T) value;
}
+
+ internal MetadataConversionError AddError (string message, params object[] args)
+ {
+ var error = new MetadataConversionError (string.Format (message, args));
+ Errors.Add (error);
+ return error;
+ }
+
+ internal MetadataConversionError AddWarning (string message, params object[] args)
+ {
+ var error = new MetadataConversionError (string.Format (message, args), true);
+ Errors.Add (error);
+ return error;
+ }
+
+ internal class MetadataImportException : Exception
+ {
+ public MetadataConversionError Error {
+ get;
+ private set;
+ }
+
+ public MetadataImportException (MetadataConversionError error)
+ : base (error.Message)
+ {
+ this.Error = error;
+ }
+
+ public MetadataImportException (MetadataConversionError error, Exception inner)
+ : base (error.Message, inner)
+ {
+ this.Error = error;
+ }
+ }
+
}
}
{
public abstract class PolicyConversionContext
{
+ ServiceEndpoint endpoint;
+
protected PolicyConversionContext (ServiceEndpoint endpoint)
{
+ this.endpoint = endpoint;
+ }
+
+ internal ServiceEndpoint Endpoint {
+ get { return endpoint; }
}
public abstract BindingElementCollection BindingElements { get; }
public ContractDescription Contract {
- get { throw new NotImplementedException (); }
+ get { return endpoint.Contract; }
}
public abstract PolicyAssertionCollection GetBindingAssertions ();
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
// Ankit Jain <JAnkit@novell.com>
+// Martin Baulig <martin.baulig@xamarin.com>
//
// Copyright (C) 2005 Novell, Inc. http://www.novell.com
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
public List<IWsdlExportExtension> Results { get; private set; }
}
- private MetadataSet metadata;
- private ServiceDescriptionCollection wsdl_colln;
- private XsdDataContractExporter xsd_exporter;
- private List<ContractExportMap> exported_contracts;
+ class EndpointExportMap
+ {
+ public EndpointExportMap (string name, ServiceEndpoint endpoint)
+ {
+ Name = name;
+ Endpoint = endpoint;
+ }
+
+ public string Name { get; private set; }
+ public ServiceEndpoint Endpoint { get; private set; }
+ }
+
+ MetadataSet metadata;
+ ServiceDescriptionCollection wsdl_colln;
+ XsdDataContractExporter xsd_exporter;
+ Dictionary<ContractDescription, ContractExportMap> exported_contracts;
+ List<EndpointExportMap> exported_endpoints;
public override MetadataSet GetGeneratedMetadata ()
{
public override void ExportContract (ContractDescription contract)
{
- ExportContractInternal (contract, true);
+ ExportContractInternal (contract);
}
- List<IWsdlExportExtension> ExportContractInternal (ContractDescription contract, bool rejectDuplicate)
+ ContractExportMap ExportContractInternal (ContractDescription contract)
{
+ if (ExportedContracts.ContainsKey (contract))
+ return ExportedContracts [contract];
+
QName qname = new QName (contract.Name, contract.Namespace);
- var map = ExportedContracts.FirstOrDefault (m => m.QName == qname);
- if (map != null) {
- if (map.Results != null && !rejectDuplicate)
- return null; // already exported.
+ if (ExportedContracts.Any (m => m.Value.QName == qname))
throw new ArgumentException (String.Format (
- "A ContractDescription with Namespace : {0} and Name : {1} has already been exported.",
+ "A ContractDescription with Namespace : {0} and Name : {1} has already been exported.",
contract.Namespace, contract.Name));
- }
WSServiceDescription sd = GetServiceDescription (contract.Namespace);
sd.Types.Schemas.Add (xs_import);
sd.PortTypes.Add (ws_port);
- ExportedContracts.Add (new ContractExportMap (qname, contract, extensions));
+ var map = new ContractExportMap (qname, contract, extensions);
+ ExportedContracts.Add (contract, map);
WsdlContractConversionContext context = new WsdlContractConversionContext (contract, ws_port);
foreach (IWsdlExportExtension extn in extensions)
extn.ExportContract (this, context);
- return extensions;
+ return map;
}
public override void ExportEndpoint (ServiceEndpoint endpoint)
{
- ExportEndpoint (endpoint, true);
+ ExportEndpoint_Internal (endpoint);
}
- void ExportEndpoint (ServiceEndpoint endpoint, bool rejectDuplicate)
+ EndpointExportMap ExportEndpoint_Internal (ServiceEndpoint endpoint)
{
- List<IWsdlExportExtension> extensions = ExportContractInternal (endpoint.Contract, rejectDuplicate);
-
+ var map = ExportedEndpoints.FirstOrDefault (m => m.Endpoint == endpoint);
+ if (map != null)
+ return map;
+
+ int index = 0;
+ var baseName = String.Concat (endpoint.Binding.Name, "_", endpoint.Contract.Name);
+ var name = baseName;
+ while (ExportedEndpoints.Exists (m => m.Name == name))
+ name = String.Concat (baseName, (++index).ToString ());
+
+ map = new EndpointExportMap (name, endpoint);
+ ExportedEndpoints.Add (map);
+
+ var contract = ExportContractInternal (endpoint.Contract);
+
//FIXME: Namespace
WSServiceDescription sd = GetServiceDescription ("http://tempuri.org/");
if (sd.TargetNamespace != endpoint.Contract.Namespace) {
"Binding for ServiceEndpoint named '{0}' is null",
endpoint.Name));
- bool msg_version_none =
- endpoint.Binding.MessageVersion != null &&
- endpoint.Binding.MessageVersion.Equals (MessageVersion.None);
+ var extensions = new List<IWsdlExportExtension> ();
+ var extensionTypes = new Dictionary<Type, IWsdlExportExtension> ();
+ if (contract.Results != null) {
+ foreach (var extension in contract.Results) {
+ var type = extension.GetType ();
+ if (extensionTypes.ContainsKey (type))
+ continue;
+ extensionTypes.Add (type, extension);
+ extensions.Add (extension);
+ }
+ }
+
+ var bindingElements = endpoint.Binding.CreateBindingElements ();
+ foreach (var element in bindingElements) {
+ var extension = element as IWsdlExportExtension;
+ if (extension == null)
+ continue;
+ var type = extension.GetType ();
+ if (extensionTypes.ContainsKey (type))
+ continue;
+ extensionTypes.Add (type, extension);
+ extensions.Add (extension);
+ }
+
//ExportBinding
WSBinding ws_binding = new WSBinding ();
//<binding name = ..
- ws_binding.Name = String.Concat (endpoint.Binding.Name, "_", endpoint.Contract.Name);
+ ws_binding.Name = name;
//<binding type = ..
ws_binding.Type = new QName (endpoint.Contract.Name, endpoint.Contract.Namespace);
sd.Bindings.Add (ws_binding);
- if (!msg_version_none) {
- SoapBinding soap_binding = new SoapBinding ();
- soap_binding.Transport = SoapBinding.HttpTransport;
- soap_binding.Style = SoapBindingStyle.Document;
- ws_binding.Extensions.Add (soap_binding);
- }
-
// <operation
- foreach (OperationDescription sm_op in endpoint.Contract.Operations){
- OperationBinding op_binding = new OperationBinding ();
- op_binding.Name = sm_op.Name;
-
- //FIXME: Move to IWsdlExportExtension .. ?
- foreach (MessageDescription sm_md in sm_op.Messages) {
- if (sm_md.Direction == MessageDirection.Input) {
- //<input
- InputBinding in_binding = new InputBinding ();
-
- if (!msg_version_none) {
- SoapBodyBinding soap_body_binding = new SoapBodyBinding ();
- soap_body_binding.Use = SoapBindingUse.Literal;
- in_binding.Extensions.Add (soap_body_binding);
-
- //Set Action
- //<operation > <soap:operation soapAction .. >
- SoapOperationBinding soap_operation_binding = new SoapOperationBinding ();
- soap_operation_binding.SoapAction = sm_md.Action;
- soap_operation_binding.Style = SoapBindingStyle.Document;
- op_binding.Extensions.Add (soap_operation_binding);
- }
-
- op_binding.Input = in_binding;
- } else {
- //<output
- OutputBinding out_binding = new OutputBinding ();
-
- if (!msg_version_none) {
- SoapBodyBinding soap_body_binding = new SoapBodyBinding ();
- soap_body_binding.Use = SoapBindingUse.Literal;
- out_binding.Extensions.Add (soap_body_binding);
- }
-
- op_binding.Output = out_binding;
- }
- }
-
+ foreach (OperationDescription sm_op in endpoint.Contract.Operations) {
+ var op_binding = CreateOperationBinding (endpoint, sm_op);
ws_binding.Operations.Add (op_binding);
}
//Add <service
- Port ws_port = ExportService (sd, ws_binding, endpoint.Address, msg_version_none);
+ Port ws_port = ExportService (sd, ws_binding, endpoint.Address);
//Call IWsdlExportExtension.ExportEndpoint
WsdlContractConversionContext contract_context = new WsdlContractConversionContext (
WsdlEndpointConversionContext endpoint_context = new WsdlEndpointConversionContext (
contract_context, endpoint, ws_port, ws_binding);
- if (extensions != null)
- foreach (IWsdlExportExtension extn in extensions)
- extn.ExportEndpoint (this, endpoint_context);
+ foreach (var extension in extensions) {
+ try {
+ extension.ExportEndpoint (this, endpoint_context);
+ } catch (Exception ex) {
+ var error = AddError (
+ "Failed to export endpoint '{0}': wsdl exporter '{1}' " +
+ "threw an exception: {2}", endpoint.Name, extension.GetType (), ex);
+ throw new MetadataExportException (error, ex);
+ }
+ }
+
+ try {
+ ExportPolicy (endpoint, ws_binding);
+ } catch (MetadataExportException) {
+ throw;
+ } catch (Exception ex) {
+ var error = AddError (
+ "Failed to export endpoint '{0}': unhandled exception " +
+ "while exporting policy: {1}", endpoint.Name, ex);
+ throw new MetadataExportException (error, ex);
+ }
+
+ return map;
+ }
+
+ OperationBinding CreateOperationBinding (ServiceEndpoint endpoint, OperationDescription sm_op)
+ {
+ OperationBinding op_binding = new OperationBinding ();
+ op_binding.Name = sm_op.Name;
+
+ foreach (MessageDescription sm_md in sm_op.Messages) {
+ if (sm_md.Direction == MessageDirection.Input) {
+ //<input
+ CreateInputBinding (endpoint, op_binding, sm_md);
+ } else {
+ //<output
+ CreateOutputBinding (endpoint, op_binding, sm_md);
+ }
+ }
+
+ return op_binding;
+ }
+
+ void CreateInputBinding (ServiceEndpoint endpoint, OperationBinding op_binding,
+ MessageDescription sm_md)
+ {
+ var in_binding = new InputBinding ();
+ op_binding.Input = in_binding;
+
+ var message_version = endpoint.Binding.MessageVersion ?? MessageVersion.None;
+ if (message_version == MessageVersion.None)
+ return;
+ SoapBodyBinding soap_body_binding;
+ SoapOperationBinding soap_operation_binding;
+ if (message_version.Envelope == EnvelopeVersion.Soap11) {
+ soap_body_binding = new SoapBodyBinding ();
+ soap_operation_binding = new SoapOperationBinding ();
+ } else if (message_version.Envelope == EnvelopeVersion.Soap12) {
+ soap_body_binding = new Soap12BodyBinding ();
+ soap_operation_binding = new Soap12OperationBinding ();
+ } else {
+ throw new InvalidOperationException ();
+ }
+
+ soap_body_binding.Use = SoapBindingUse.Literal;
+ in_binding.Extensions.Add (soap_body_binding);
+ //Set Action
+ //<operation > <soap:operation soapAction .. >
+ soap_operation_binding.SoapAction = sm_md.Action;
+ soap_operation_binding.Style = SoapBindingStyle.Document;
+ op_binding.Extensions.Add (soap_operation_binding);
}
- Port ExportService (WSServiceDescription sd, WSBinding ws_binding, EndpointAddress address, bool msg_version_none)
+ void CreateOutputBinding (ServiceEndpoint endpoint, OperationBinding op_binding,
+ MessageDescription sm_md)
+ {
+ var out_binding = new OutputBinding ();
+ op_binding.Output = out_binding;
+
+ var message_version = endpoint.Binding.MessageVersion ?? MessageVersion.None;
+ if (message_version == MessageVersion.None)
+ return;
+
+ SoapBodyBinding soap_body_binding;
+ if (message_version.Envelope == EnvelopeVersion.Soap11) {
+ soap_body_binding = new SoapBodyBinding ();
+ } else if (message_version.Envelope == EnvelopeVersion.Soap12) {
+ soap_body_binding = new Soap12BodyBinding ();
+ } else {
+ throw new InvalidOperationException ();
+ }
+
+ soap_body_binding.Use = SoapBindingUse.Literal;
+ out_binding.Extensions.Add (soap_body_binding);
+ }
+
+ Port ExportService (WSServiceDescription sd, WSBinding ws_binding, EndpointAddress address)
{
if (address == null)
return null;
Service ws_svc = GetService (sd, "service");
sd.Name = "service";
- Port ws_port = new Port ();
- ws_port.Name = ws_binding.Name;
- ws_port.Binding = new QName (ws_binding.Name, sd.TargetNamespace);
-
- if (!msg_version_none) {
- SoapAddressBinding soap_addr = new SoapAddressBinding ();
- soap_addr.Location = address.Uri.AbsoluteUri;
-
- ws_port.Extensions.Add (soap_addr);
- }
+ Port ws_port = new Port ();
+ ws_port.Name = ws_binding.Name;
+ ws_port.Binding = new QName (ws_binding.Name, sd.TargetNamespace);
ws_svc.Ports.Add (ws_port);
if (ep.Contract.Name == ServiceMetadataBehavior.MexContractName)
continue;
- ExportEndpoint (ep, false);
+ ExportEndpoint (ep);
}
}
}
}
- List<ContractExportMap> ExportedContracts {
+ Dictionary<ContractDescription, ContractExportMap> ExportedContracts {
get {
if (exported_contracts == null)
- exported_contracts = new List<ContractExportMap> ();
+ exported_contracts = new Dictionary<ContractDescription, ContractExportMap> ();
return exported_contracts;
}
}
+ List<EndpointExportMap> ExportedEndpoints {
+ get {
+ if (exported_endpoints == null)
+ exported_endpoints = new List<EndpointExportMap> ();
+ return exported_endpoints;
+ }
+ }
+
XmlSerializerNamespaces GetNamespaces (string target_namespace)
{
XmlSerializerNamespaces namespaces = new XmlSerializerNamespaces ();
return schema;
}
+ PolicyConversionContext ExportPolicy (ServiceEndpoint endpoint, WSBinding binding)
+ {
+ var context = new CustomPolicyConversionContext (endpoint);
+
+ var elements = endpoint.Binding.CreateBindingElements ();
+ foreach (var element in elements) {
+ var exporter = element as IPolicyExportExtension;
+ if (exporter == null)
+ continue;
+
+ try {
+ exporter.ExportPolicy (this, context);
+ } catch (Exception ex) {
+ var error = AddError (
+ "Failed to export endpoint '{0}': policy exporter " +
+ "'{1}' threw an exception: {2}", endpoint.Name,
+ element.GetType (), ex);
+ throw new MetadataExportException (error, ex);
+ }
+ }
+
+ var assertions = context.GetBindingAssertions ();
+ if (assertions.Count == 0)
+ return context;
+
+ var doc = new XmlDocument ();
+ var policy = doc.CreateElement ("wsp", "Policy", PolicyImportHelper.PolicyNS);
+ doc.AppendChild (policy);
+
+ var exactlyOne = doc.CreateElement ("wsp", "ExactlyOne", PolicyImportHelper.PolicyNS);
+ var all = doc.CreateElement ("wsp", "All", PolicyImportHelper.PolicyNS);
+
+ policy.AppendChild (exactlyOne);
+ exactlyOne.AppendChild (all);
+
+ foreach (var assertion in assertions) {
+ var imported = doc.ImportNode (assertion, true);
+ all.AppendChild (imported);
+ }
+
+ binding.Extensions.Add (policy);
+ return context;
+ }
+
}
}
//
// WsdlImporter.cs
//
-// Author:
+// Authors:
// Atsushi Enomoto <atsushi@ximian.com>
// Ankit Jain <jankit@novell.com>
+// Martin Baulig <martin.baulig@xamarin.com>
//
// Copyright (C) 2005 Novell, Inc. http://www.novell.com
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
using System.Xml.Schema;
using SMBinding = System.ServiceModel.Channels.Binding;
+using WS = System.Web.Services.Description;
using WSServiceDescription = System.Web.Services.Description.ServiceDescription;
using WSBinding = System.Web.Services.Description.Binding;
using WSMessage = System.Web.Services.Description.Message;
XmlSchemaSet xmlschemas;
List<XmlElement> policies; /* ?? */
MetadataSet metadata;
+ bool beforeImportCalled;
KeyedByTypeCollection<IWsdlImportExtension> wsdl_extensions;
Collection<ContractDescription> contracts = null;
ServiceEndpointCollection endpoint_colln = null;
+ // Contract by PortType
+ Dictionary<PortType, ContractDescription> contractHash = null;
+ // ServiceEndpoint by WSBinding
+ Dictionary<WSBinding, ServiceEndpoint> bindingHash = null;
+ // ServiceEndpoint by Port
+ Dictionary<Port, ServiceEndpoint> endpointHash = null;
+
public WsdlImporter (
MetadataSet metadata,
IEnumerable<IPolicyImportExtension> policyImportExtensions,
wsdl_extensions.Add (new DataContractSerializerMessageContractImporter ());
wsdl_extensions.Add (new XmlSerializerMessageContractImporter ());
- //wsdl_extensions.Add (new MessageEncodingBindingElementImporter ());
+ wsdl_extensions.Add (new MessageEncodingBindingElementImporter ());
wsdl_extensions.Add (new TransportBindingElementImporter ());
wsdl_extensions.Add (new StandardBindingImporter ());
} else {
this.wsdl_documents = new ServiceDescriptionCollection ();
this.xmlschemas = new XmlSchemaSet ();
this.policies = new List<XmlElement> ();
+ this.contractHash = new Dictionary<PortType, ContractDescription> ();
+ this.bindingHash = new Dictionary<WSBinding, ServiceEndpoint> ();
+ this.endpointHash = new Dictionary<Port, ServiceEndpoint> ();
foreach (MetadataSection ms in metadata.MetadataSections) {
if (ms.Dialect == MetadataSection.ServiceDescriptionDialect &&
{
Collection<SMBinding> bindings = new Collection<SMBinding> ();
- foreach (WSServiceDescription sd in wsdl_documents)
- foreach (WSBinding binding in sd.Bindings)
- bindings.Add (ImportBinding (binding));
+ foreach (WSServiceDescription sd in wsdl_documents) {
+ foreach (WSBinding binding in sd.Bindings) {
+ var endpoint = ImportBinding (binding, false);
+ if (endpoint != null)
+ bindings.Add (endpoint.Binding);
+ }
+ }
return bindings;
}
- public SMBinding ImportBinding (WSBinding binding)
+ void BeforeImport ()
{
- /* Default, CustomBinding.. */
- CustomBinding smbinding = new CustomBinding ();
+ if (beforeImportCalled)
+ return;
foreach (IWsdlImportExtension extension in wsdl_extensions)
extension.BeforeImport (wsdl_documents, xmlschemas, policies);
+
+ beforeImportCalled = true;
+ }
- smbinding.Name = binding.Name;
- smbinding.Namespace = binding.ServiceDescription.TargetNamespace;
+ public SMBinding ImportBinding (WSBinding binding)
+ {
+ return ImportBinding (binding, true).Binding;
+ }
- //FIXME: Added by MessageEncodingBindingElementConverter.ImportPolicy
- smbinding.Elements.Add (new TextMessageEncodingBindingElement ());
+ ServiceEndpoint ImportBinding (WSBinding binding, bool throwOnError)
+ {
+ if (bindingHash.ContainsKey (binding)) {
+ var sep = bindingHash [binding];
+ if (sep != null)
+ return sep;
+
+ if (!throwOnError)
+ return null;
+
+ throw new InvalidOperationException (String.Format (
+ "Failed to import binding {0}, an error has " +
+ "already been reported before.", binding.Name));
+ }
- /*ImportContract
- PortType portType = null;
- foreach (WSServiceDescription sd in wsdl_documents) {
- portType = sd.PortTypes [binding.Type.Name];
- if (portType != null)
- break;
+ try {
+ var port_type = GetPortTypeFromBinding (binding);
+ var contract = ImportContract (port_type);
+ var contract_context = new WsdlContractConversionContext (contract, port_type);
+
+ var sep = ImportBinding (binding, contract_context);
+ bindingHash.Add (binding, sep);
+ return sep;
+ } catch (MetadataImportException) {
+ bindingHash.Add (binding, null);
+ if (throwOnError)
+ throw;
+ return null;
+ } catch (Exception ex) {
+ bindingHash.Add (binding, null);
+ var error = AddError (
+ "Failed to import binding `{0}': {1}", binding.Name, ex.Message);
+ if (throwOnError)
+ throw new MetadataImportException (error, ex);
+ return null;
}
+ }
+
+ ServiceEndpoint ImportBinding (WSBinding binding,
+ WsdlContractConversionContext contract_context)
+ {
+ BeforeImport ();
- //FIXME: if portType == null
- */
+ var sep = new ServiceEndpoint (contract_context.Contract);
+
+ var custom = new CustomBinding ();
+ custom.Name = binding.Name;
+ custom.Namespace = binding.ServiceDescription.TargetNamespace;
+
+ sep.Binding = custom;
+
+ try {
+ ImportPolicy (binding, sep);
+ } catch (Exception ex) {
+ // FIXME: Policy import is still experimental.
+ AddWarning ("Exception while trying to import policy for " +
+ "binding `{0}': {1}", binding.Name, ex.Message);
+ }
+
+ var endpoint_context = new WsdlEndpointConversionContext (
+ contract_context, sep, null, binding);
+
+ foreach (IWsdlImportExtension extension in wsdl_extensions)
+ extension.ImportEndpoint (this, endpoint_context);
- // FIXME: ImportContract here..
+ return sep;
+ }
+
+ void ImportPolicy (WSBinding binding, ServiceEndpoint endpoint)
+ {
+ var context = new Description.CustomPolicyConversionContext (binding, endpoint);
+ var assertions = context.GetBindingAssertions ();
+
+ foreach (var ext in binding.Extensions) {
+ var xml = ext as XmlElement;
+ if (xml == null)
+ continue;
+ if (!xml.NamespaceURI.Equals (Constants.WspNamespace))
+ continue;
+ if (xml.LocalName.Equals ("Policy")) {
+ context.AddPolicyAssertion (xml);
+ continue;
+ }
+ if (!xml.LocalName.Equals ("PolicyReference"))
+ continue;
+ var uri = xml.GetAttribute ("URI");
+
+ if (!uri.StartsWith ("#")) {
+ // FIXME
+ AddWarning (
+ "Failed to resolve unknown policy reference `{0}' for " +
+ "binding `{1}'.", uri, binding.Name);
+ continue;
+ }
+
+ foreach (var sext in binding.ServiceDescription.Extensions) {
+ var sxml = sext as XmlElement;
+ if (sxml == null)
+ continue;
+ if (!sxml.NamespaceURI.Equals (Constants.WspNamespace))
+ continue;
+ if (!sxml.LocalName.Equals ("Policy"))
+ continue;
+ var id = sxml.GetAttribute ("Id", Constants.WsuNamespace);
+ if (!uri.Substring (1).Equals (id))
+ continue;
+ context.AddPolicyAssertion (sxml);
+ }
+ }
- return smbinding;
+ foreach (IPolicyImportExtension extension in PolicyImportExtensions) {
+ try {
+ extension.ImportPolicy (this, context);
+ } catch (Exception ex) {
+ AddWarning (
+ "PolicyImportException `{0}' threw an exception while " +
+ "trying to import policy references for endpoint `{1}': {2}",
+ extension.GetType ().Name, endpoint.Name, ex.Message);
+ }
+ }
}
+ PortType GetPortTypeFromBinding (WSBinding binding)
+ {
+ foreach (WSServiceDescription sd in wsdl_documents) {
+ var port_type = sd.PortTypes [binding.Type.Name];
+ if (port_type != null)
+ return port_type;
+ }
+
+ throw new MetadataImportException (AddError (
+ "PortType named {0} not found in namespace {1}.",
+ binding.Type.Name, binding.Type.Namespace));
+ }
+
public override Collection<ContractDescription> ImportAllContracts ()
{
if (contracts != null)
contracts = new Collection<ContractDescription> ();
foreach (WSServiceDescription sd in wsdl_documents) {
- foreach (PortType pt in sd.PortTypes)
- contracts.Add (ImportContract (pt));
+ foreach (PortType pt in sd.PortTypes) {
+ var cd = ImportContract (pt, false);
+ if (cd != null)
+ contracts.Add (cd);
+ }
}
return contracts;
endpoint_colln = new ServiceEndpointCollection ();
- foreach (IWsdlImportExtension extension in wsdl_extensions) {
- extension.BeforeImport (wsdl_documents, xmlschemas, policies);
+ foreach (WSServiceDescription wsd in wsdl_documents) {
+ foreach (Service service in wsd.Services) {
+ foreach (Port port in service.Ports) {
+ var sep = ImportEndpoint (port, false);
+ if (sep != null)
+ endpoint_colln.Add (sep);
+ }
+ }
}
- foreach (WSServiceDescription wsd in wsdl_documents)
- foreach (Service service in wsd.Services)
- foreach (Port port in service.Ports)
- endpoint_colln.Add (ImportEndpoint (port));
-
return endpoint_colln;
}
public ContractDescription ImportContract (PortType wsdlPortType)
{
- foreach (IWsdlImportExtension extension in wsdl_extensions) {
- extension.BeforeImport (wsdl_documents, xmlschemas, policies);
+ return ImportContract (wsdlPortType, true);
+ }
+
+ ContractDescription ImportContract (PortType portType, bool throwOnError)
+ {
+ if (contractHash.ContainsKey (portType)) {
+ var cd = contractHash [portType];
+ if (cd != null)
+ return cd;
+
+ if (!throwOnError)
+ return null;
+
+ throw new InvalidOperationException (String.Format (
+ "Failed to import contract for port type `{0}', " +
+ "an error has already been reported.", portType.Name));
+ }
+
+ try {
+ var cd = DoImportContract (portType);
+ contractHash.Add (portType, cd);
+ return cd;
+ } catch (MetadataImportException) {
+ contractHash.Add (portType, null);
+ if (throwOnError)
+ throw;
+ return null;
+ } catch (Exception ex) {
+ contractHash.Add (portType, null);
+ var error = AddError (
+ "Failed to import contract for port type `{0}': {1}",
+ portType.Name, ex.Message);
+ if (throwOnError)
+ throw new MetadataImportException (error, ex);
+ return null;
}
+ }
+
+ ContractDescription DoImportContract (PortType wsdlPortType)
+ {
+ BeforeImport ();
ContractDescription cd = new ContractDescription (wsdlPortType.Name, wsdlPortType.ServiceDescription.TargetNamespace);
public ServiceEndpoint ImportEndpoint (Port wsdlPort)
{
- foreach (IWsdlImportExtension extension in wsdl_extensions) {
- extension.BeforeImport (wsdl_documents, xmlschemas, policies);
+ return ImportEndpoint (wsdlPort, true);
+ }
+
+ ServiceEndpoint ImportEndpoint (Port port, bool throwOnError)
+ {
+ ServiceEndpoint endpoint;
+ if (endpointHash.ContainsKey (port)) {
+ endpoint = endpointHash [port];
+ if (endpoint != null)
+ return endpoint;
+
+ if (!throwOnError)
+ return null;
+
+ throw new InvalidOperationException (String.Format (
+ "Failed to import port `{0}', an error has " +
+ "already been reported before.", port.Name));
}
- //Get the corresponding contract
- //via the PortType
- WSBinding wsb = wsdlPort.Service.ServiceDescription.Bindings [wsdlPort.Binding.Name];
- if (wsb == null)
- //FIXME
- throw new Exception (String.Format ("Binding named {0} not found.", wsdlPort.Binding.Name));
+ var binding = port.Service.ServiceDescription.Bindings [port.Binding.Name];
+ if (binding == null) {
+ endpointHash.Add (port, null);
+ var error = AddError (
+ "Failed to import port `{0}': cannot find binding `{1}' that " +
+ "this port depends on.", port.Name, port.Binding.Name);
+ if (throwOnError)
+ throw new MetadataImportException (error);
+ return null;
+ }
- SMBinding binding = ImportBinding (wsb);
+ try {
+ endpoint = ImportBinding (binding, throwOnError);
+ } catch (Exception ex) {
+ endpointHash.Add (port, null);
+ var error = AddError (
+ "Failed to import port `{0}': error while trying to import " +
+ "binding `{1}' that this port depends on: {2}",
+ port.Name, port.Binding.Name, ex.Message);
+ if (throwOnError)
+ throw new MetadataImportException (error, ex);
+ return null;
+ }
- PortType port_type = null;
- foreach (WSServiceDescription sd in wsdl_documents) {
- port_type = sd.PortTypes [wsb.Type.Name];
- if (port_type != null)
- break;
+ if (endpoint == null) {
+ endpointHash.Add (port, null);
+ AddError (
+ "Failed to import port `{0}': error while trying to import " +
+ "binding `{1}' that this port depends on.",
+ port.Name, port.Binding.Name);
+ return null;
}
- if (port_type == null)
- //FIXME
- throw new Exception (String.Format ("PortType named {0} not found.", wsb.Type.Name));
+ try {
+ ImportEndpoint (port, binding, endpoint, throwOnError);
+ endpointHash.Add (port, endpoint);
+ return endpoint;
+ } catch (MetadataImportException) {
+ endpointHash.Add (port, null);
+ if (throwOnError)
+ throw;
+ return null;
+ } catch (Exception ex) {
+ endpointHash.Add (port, null);
+ var error = AddError (
+ "Failed to import port `{0}': {1}", port.Name, ex.Message);
+ if (throwOnError)
+ throw new MetadataImportException (error, ex);
+ return null;
+ }
+ }
- ContractDescription contract = ImportContract (port_type);
- ServiceEndpoint sep = new ServiceEndpoint (contract);
+ void ImportEndpoint (Port port, WSBinding wsb, ServiceEndpoint sep, bool throwOnError)
+ {
+ BeforeImport ();
- sep.Binding = binding;
+ var port_type = GetPortTypeFromBinding (wsb);
- WsdlContractConversionContext contract_context = new WsdlContractConversionContext (contract, port_type);
+ var contract_context = new WsdlContractConversionContext (sep.Contract, port_type);
WsdlEndpointConversionContext endpoint_context = new WsdlEndpointConversionContext (
- contract_context, sep, wsdlPort, wsb);
+ contract_context, sep, port, wsb);
foreach (IWsdlImportExtension extension in wsdl_extensions)
extension.ImportEndpoint (this, endpoint_context);
+ }
- return sep;
+ void ImportEndpoints (ServiceEndpointCollection coll, WSBinding binding)
+ {
+ foreach (WSServiceDescription wsd in wsdl_documents) {
+ foreach (WS.Service service in wsd.Services) {
+ foreach (WS.Port port in service.Ports) {
+ if (!binding.Name.Equals (port.Binding.Name))
+ continue;
+ var sep = ImportEndpoint (port, false);
+ if (sep != null)
+ coll.Add (sep);
+ }
+ }
+ }
}
- public ServiceEndpointCollection ImportEndpoints (
- WSBinding binding)
+ public ServiceEndpointCollection ImportEndpoints (WSBinding binding)
{
- throw new NotImplementedException ();
+ var coll = new ServiceEndpointCollection ();
+ ImportEndpoints (coll, binding);
+ return coll;
}
- public ServiceEndpointCollection ImportEndpoints (
- PortType portType)
+ public ServiceEndpointCollection ImportEndpoints (PortType portType)
{
- throw new NotImplementedException ();
+ var coll = new ServiceEndpointCollection ();
+
+ foreach (WSServiceDescription wsd in wsdl_documents) {
+ foreach (WS.Binding binding in wsd.Bindings) {
+ if (!binding.Type.Name.Equals (portType.Name))
+ continue;
+
+ ImportEndpoints (coll, binding);
+ }
+ }
+
+ return coll;
}
- public ServiceEndpointCollection ImportEndpoints (
- Service service)
+ public ServiceEndpointCollection ImportEndpoints (Service service)
{
- throw new NotImplementedException ();
+ var coll = new ServiceEndpointCollection ();
+
+ foreach (Port port in service.Ports) {
+ var sep = ImportEndpoint (port, false);
+ if (sep != null)
+ coll.Add (sep);
+ }
+
+ return coll;
}
}
}
System.ServiceModel.Channels/PeerOutputChannel.cs
System.ServiceModel.Channels/PeerTransportBindingElement.cs
System.ServiceModel.Channels/PnrpPeerResolverBindingElement.cs
+System.ServiceModel.Channels/PolicyImportHelper.cs
System.ServiceModel.Channels/PrivacyNoticeBindingElement.cs
System.ServiceModel.Channels/ReliableSessionBindingElement.cs
System.ServiceModel.Channels/ReliableSessionBindingElementImporter.cs
System.ServiceModel.Description/ClientViaBehavior.cs
System.ServiceModel.Description/ContractDescription.cs
System.ServiceModel.Description/ContractDescriptionGenerator.cs
+System.ServiceModel.Description/CustomPolicyConversionContext.cs
System.ServiceModel.Description/DataContractSerializerMessageContractImporter.cs
System.ServiceModel.Description/DataContractSerializerOperationBehavior.cs
System.ServiceModel.Description/FaultDescription.cs
TransportCredentialOnly,
}
+#if NET_4_5
+ public enum BasicHttpsSecurityMode
+ {
+ Transport,
+ TransportWithMessageCredential
+ }
+#endif
+
public enum CommunicationState
{
Created,
//
// BasicHttpBinding.cs
//
+// See BasicHttpBinding_4_5.cs and HttpBindingBase.cs for the .NET 4.5
+// version of this class.
+//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
//
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !NET_4_5 || MOBILE
using System;
using System.Collections.Generic;
using System.Net;
}
}
}
+#endif
--- /dev/null
+//
+// BasicHttpBinding_4_5.cs
+//
+// Authors:
+// Atsushi Enomoto <atsushi@ximian.com>
+// Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (C) 2005-2006 Novell, Inc. http://www.novell.com
+// Copyright 2011-2012 Xamarin Inc (http://www.xamarin.com).
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+using System.Collections.Generic;
+using System.Net;
+using System.Net.Security;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+using System.Text;
+using System.Xml;
+using System.ServiceModel.Configuration;
+
+namespace System.ServiceModel
+{
+ public class BasicHttpBinding : HttpBindingBase,
+ IBindingRuntimePreferences
+ {
+ WSMessageEncoding message_encoding = WSMessageEncoding.Text;
+ BasicHttpSecurity security;
+
+ public BasicHttpBinding ()
+ : this (BasicHttpSecurityMode.None)
+ {
+ }
+
+ public BasicHttpBinding (string configurationName)
+ : this ()
+ {
+ BindingsSection bindingsSection = ConfigUtil.BindingsSection;
+ BasicHttpBindingElement el =
+ bindingsSection.BasicHttpBinding.Bindings [configurationName];
+
+ el.ApplyConfiguration (this);
+ }
+
+ public BasicHttpBinding (
+ BasicHttpSecurityMode securityMode)
+ {
+ security = new BasicHttpSecurity (securityMode);
+ }
+
+ public WSMessageEncoding MessageEncoding {
+ get { return message_encoding; }
+ set { message_encoding = value; }
+ }
+
+ public override string Scheme {
+ get {
+ switch (Security.Mode) {
+ case BasicHttpSecurityMode.Transport:
+ case BasicHttpSecurityMode.TransportWithMessageCredential:
+ return Uri.UriSchemeHttps;
+ default:
+ return Uri.UriSchemeHttp;
+ }
+ }
+ }
+
+ public BasicHttpSecurity Security {
+ get { return security; }
+ }
+
+ public override BindingElementCollection
+ CreateBindingElements ()
+ {
+ var list = new List<BindingElement> ();
+
+ var security = CreateSecurityBindingElement ();
+ if (security != null)
+ list.Add (security);
+
+ list.Add (BuildMessageEncodingBindingElement ());
+ list.Add (GetTransport ());
+
+ return new BindingElementCollection (list.ToArray ());
+ }
+
+ SecurityBindingElement CreateSecurityBindingElement ()
+ {
+ SecurityBindingElement element;
+ switch (Security.Mode) {
+ case BasicHttpSecurityMode.Message:
+ if (Security.Message.ClientCredentialType != BasicHttpMessageCredentialType.Certificate)
+ throw new InvalidOperationException ("When Message security is enabled in a BasicHttpBinding, the message security credential type must be BasicHttpMessageCredentialType.Certificate.");
+ element = SecurityBindingElement.CreateMutualCertificateBindingElement (
+ MessageSecurityVersion.WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10);
+ break;
+
+ case BasicHttpSecurityMode.TransportWithMessageCredential:
+ if (Security.Message.ClientCredentialType != BasicHttpMessageCredentialType.Certificate)
+ // FIXME: pass proper security token parameters.
+ element = SecurityBindingElement.CreateCertificateOverTransportBindingElement ();
+ else
+ element = new AsymmetricSecurityBindingElement ();
+ break;
+ default:
+ return null;
+ }
+
+ element.SetKeyDerivation (false);
+ element.SecurityHeaderLayout = SecurityHeaderLayout.Lax;
+ return element;
+ }
+
+ MessageEncodingBindingElement BuildMessageEncodingBindingElement ()
+ {
+ if (MessageEncoding == WSMessageEncoding.Text) {
+ TextMessageEncodingBindingElement tm = new TextMessageEncodingBindingElement (
+ MessageVersion.CreateVersion (EnvelopeVersion, AddressingVersion.None), TextEncoding);
+ ReaderQuotas.CopyTo (tm.ReaderQuotas);
+ return tm;
+ } else {
+ return new MtomMessageEncodingBindingElement (
+ MessageVersion.CreateVersion (EnvelopeVersion, AddressingVersion.None), TextEncoding);
+ }
+ }
+
+ TransportBindingElement GetTransport ()
+ {
+ HttpTransportBindingElement h;
+ switch (Security.Mode) {
+ case BasicHttpSecurityMode.Transport:
+ case BasicHttpSecurityMode.TransportWithMessageCredential:
+ h = new HttpsTransportBindingElement ();
+ break;
+ default:
+ h = new HttpTransportBindingElement ();
+ break;
+ }
+
+ h.AllowCookies = AllowCookies;
+ h.BypassProxyOnLocal = BypassProxyOnLocal;
+ h.HostNameComparisonMode = HostNameComparisonMode;
+ h.MaxBufferPoolSize = MaxBufferPoolSize;
+ h.MaxBufferSize = MaxBufferSize;
+ h.MaxReceivedMessageSize = MaxReceivedMessageSize;
+ h.ProxyAddress = ProxyAddress;
+ h.UseDefaultWebProxy = UseDefaultWebProxy;
+ h.TransferMode = TransferMode;
+ h.ExtendedProtectionPolicy = Security.Transport.ExtendedProtectionPolicy;
+
+ switch (Security.Transport.ClientCredentialType) {
+ case HttpClientCredentialType.Basic:
+ h.AuthenticationScheme = AuthenticationSchemes.Basic;
+ break;
+ case HttpClientCredentialType.Ntlm:
+ h.AuthenticationScheme = AuthenticationSchemes.Ntlm;
+ break;
+ case HttpClientCredentialType.Windows:
+ h.AuthenticationScheme = AuthenticationSchemes.Negotiate;
+ break;
+ case HttpClientCredentialType.Digest:
+ h.AuthenticationScheme = AuthenticationSchemes.Digest;
+ break;
+ case HttpClientCredentialType.Certificate:
+ switch (Security.Mode) {
+ case BasicHttpSecurityMode.Transport:
+ (h as HttpsTransportBindingElement).RequireClientCertificate = true;
+ break;
+ case BasicHttpSecurityMode.TransportCredentialOnly:
+ throw new InvalidOperationException ("Certificate-based client authentication is not supported by 'TransportCredentialOnly' mode.");
+ }
+ break;
+ }
+
+ return h;
+ }
+ }
+}
--- /dev/null
+//
+// BasicHttpsBinding.cs
+//
+// Authors:
+// Atsushi Enomoto <atsushi@ximian.com>
+// Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (C) 2005-2006 Novell, Inc. http://www.novell.com
+// Copyright 2011-2012 Xamarin Inc (http://www.xamarin.com).
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+using System.Collections.Generic;
+using System.Net;
+using System.Net.Security;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+using System.Text;
+using System.Xml;
+using System.ServiceModel.Configuration;
+
+namespace System.ServiceModel
+{
+ public class BasicHttpsBinding : HttpBindingBase,
+ IBindingRuntimePreferences
+ {
+ WSMessageEncoding message_encoding = WSMessageEncoding.Text;
+ BasicHttpsSecurity security;
+
+ public BasicHttpsBinding ()
+ : this (BasicHttpsSecurityMode.Transport)
+ {
+ }
+
+ public BasicHttpsBinding (string configurationName)
+ : this ()
+ {
+ BindingsSection bindingsSection = ConfigUtil.BindingsSection;
+ BasicHttpsBindingElement el =
+ bindingsSection.BasicHttpsBinding.Bindings [configurationName];
+
+ el.ApplyConfiguration (this);
+ }
+
+ public BasicHttpsBinding (
+ BasicHttpsSecurityMode securityMode)
+ {
+ security = new BasicHttpsSecurity (securityMode);
+ }
+
+ public WSMessageEncoding MessageEncoding {
+ get { return message_encoding; }
+ set { message_encoding = value; }
+ }
+
+ public override string Scheme {
+ get { return Uri.UriSchemeHttps; }
+ }
+
+ public BasicHttpsSecurity Security {
+ get { return security; }
+ }
+
+ public override BindingElementCollection
+ CreateBindingElements ()
+ {
+ var list = new List<BindingElement> ();
+
+ var security = CreateSecurityBindingElement ();
+ if (security != null)
+ list.Add (security);
+
+ list.Add (BuildMessageEncodingBindingElement ());
+ list.Add (GetTransport ());
+
+ return new BindingElementCollection (list.ToArray ());
+ }
+
+ SecurityBindingElement CreateSecurityBindingElement ()
+ {
+ SecurityBindingElement element;
+ switch (Security.Mode) {
+ case BasicHttpsSecurityMode.TransportWithMessageCredential:
+ if (Security.Message.ClientCredentialType != BasicHttpMessageCredentialType.Certificate)
+ // FIXME: pass proper security token parameters.
+ element = SecurityBindingElement.CreateCertificateOverTransportBindingElement ();
+ else
+ element = new AsymmetricSecurityBindingElement ();
+ break;
+ default:
+ return null;
+ }
+
+ element.SetKeyDerivation (false);
+ element.SecurityHeaderLayout = SecurityHeaderLayout.Lax;
+ return element;
+ }
+
+ MessageEncodingBindingElement BuildMessageEncodingBindingElement ()
+ {
+ if (MessageEncoding == WSMessageEncoding.Text) {
+ TextMessageEncodingBindingElement tm = new TextMessageEncodingBindingElement (
+ MessageVersion.CreateVersion (EnvelopeVersion, AddressingVersion.None), TextEncoding);
+ ReaderQuotas.CopyTo (tm.ReaderQuotas);
+ return tm;
+ } else {
+ return new MtomMessageEncodingBindingElement (
+ MessageVersion.CreateVersion (EnvelopeVersion, AddressingVersion.None), TextEncoding);
+ }
+ }
+
+ TransportBindingElement GetTransport ()
+ {
+ HttpsTransportBindingElement h = new HttpsTransportBindingElement ();
+
+ h.AllowCookies = AllowCookies;
+ h.BypassProxyOnLocal = BypassProxyOnLocal;
+ h.HostNameComparisonMode = HostNameComparisonMode;
+ h.MaxBufferPoolSize = MaxBufferPoolSize;
+ h.MaxBufferSize = MaxBufferSize;
+ h.MaxReceivedMessageSize = MaxReceivedMessageSize;
+ h.ProxyAddress = ProxyAddress;
+ h.UseDefaultWebProxy = UseDefaultWebProxy;
+ h.TransferMode = TransferMode;
+ h.ExtendedProtectionPolicy = Security.Transport.ExtendedProtectionPolicy;
+
+ switch (Security.Transport.ClientCredentialType) {
+ case HttpClientCredentialType.Basic:
+ h.AuthenticationScheme = AuthenticationSchemes.Basic;
+ break;
+ case HttpClientCredentialType.Ntlm:
+ h.AuthenticationScheme = AuthenticationSchemes.Ntlm;
+ break;
+ case HttpClientCredentialType.Windows:
+ h.AuthenticationScheme = AuthenticationSchemes.Negotiate;
+ break;
+ case HttpClientCredentialType.Digest:
+ h.AuthenticationScheme = AuthenticationSchemes.Digest;
+ break;
+ case HttpClientCredentialType.Certificate:
+ h.RequireClientCertificate = true;
+ break;
+ }
+
+ return h;
+ }
+ }
+}
--- /dev/null
+//
+// BasicHttpsSecurity.cs
+//
+// Authors:
+// Atsushi Enomoto <atsushi@ximian.com>
+// Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (C) 2006 Novell, Inc. http://www.novell.com
+// Copyright 2012 Xamarin Inc (http://www.xamarin.com).
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+using System.Net.Security;
+using System.ServiceModel.Channels;
+
+namespace System.ServiceModel
+{
+ public sealed class BasicHttpsSecurity
+ {
+ internal BasicHttpsSecurity (BasicHttpsSecurityMode mode)
+ {
+ this.mode = mode;
+ this.message = new BasicHttpMessageSecurity ();
+ this.transport = new HttpTransportSecurity ();
+ }
+
+ BasicHttpMessageSecurity message;
+ BasicHttpsSecurityMode mode;
+ HttpTransportSecurity transport;
+
+ public BasicHttpMessageSecurity Message {
+ get { return message; }
+ }
+
+ public BasicHttpsSecurityMode Mode {
+ get { return mode; }
+ set { mode = value; }
+ }
+
+ public HttpTransportSecurity Transport {
+ get { return transport; }
+ }
+ }
+}
public object [] Results { get; private set; }
}
-#if NET_2_1
+#if NET_2_1 || NET_4_0
protected internal
#else
internal
--- /dev/null
+//
+// HttpBindingBase.cs
+//
+// Authors:
+// Atsushi Enomoto <atsushi@ximian.com>
+// Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (C) 2005-2006 Novell, Inc. http://www.novell.com
+// Copyright 2011-2012 Xamarin Inc (http://www.xamarin.com).
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+using System.Collections.Generic;
+using System.Net;
+using System.Net.Security;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+using System.Text;
+using System.Xml;
+using System.ServiceModel.Configuration;
+
+namespace System.ServiceModel
+{
+ public abstract class HttpBindingBase : Binding,
+ IBindingRuntimePreferences
+ {
+ bool allow_cookies, bypass_proxy_on_local;
+ HostNameComparisonMode host_name_comparison_mode
+ = HostNameComparisonMode.StrongWildcard;
+ long max_buffer_pool_size = 0x80000;
+ int max_buffer_size = 0x10000;
+ long max_recv_message_size = 0x10000;
+ Uri proxy_address;
+ XmlDictionaryReaderQuotas reader_quotas
+ = new XmlDictionaryReaderQuotas ();
+ EnvelopeVersion env_version = EnvelopeVersion.Soap11;
+ Encoding text_encoding = new UTF8Encoding ();
+ TransferMode transfer_mode
+ = TransferMode.Buffered;
+ bool use_default_web_proxy = true;
+
+ public bool AllowCookies {
+ get { return allow_cookies; }
+ set { allow_cookies = value; }
+ }
+
+ public bool BypassProxyOnLocal {
+ get { return bypass_proxy_on_local; }
+ set { bypass_proxy_on_local = value; }
+ }
+
+ public HostNameComparisonMode HostNameComparisonMode {
+ get { return host_name_comparison_mode; }
+ set { host_name_comparison_mode = value; }
+ }
+
+ public long MaxBufferPoolSize {
+ get { return max_buffer_pool_size; }
+ set {
+ if (value <= 0)
+ throw new ArgumentOutOfRangeException ();
+ max_buffer_pool_size = value;
+ }
+ }
+
+ public int MaxBufferSize {
+ get { return max_buffer_size; }
+ set {
+ if (value <= 0)
+ throw new ArgumentOutOfRangeException ();
+ max_buffer_size = value;
+ }
+ }
+
+ public long MaxReceivedMessageSize {
+ get { return max_recv_message_size; }
+ set {
+ if (value <= 0)
+ throw new ArgumentOutOfRangeException ();
+ max_recv_message_size = value;
+ }
+ }
+
+ public Uri ProxyAddress {
+ get { return proxy_address; }
+ set { proxy_address = value; }
+ }
+
+ public XmlDictionaryReaderQuotas ReaderQuotas {
+ get { return reader_quotas; }
+ set { reader_quotas = value; }
+ }
+
+ public override abstract string Scheme {
+ get;
+ }
+
+ public EnvelopeVersion EnvelopeVersion {
+ get { return env_version; }
+ }
+
+ public Encoding TextEncoding {
+ get { return text_encoding; }
+ set { text_encoding = value; }
+ }
+
+ public TransferMode TransferMode {
+ get { return transfer_mode; }
+ set { transfer_mode = value; }
+ }
+
+ public bool UseDefaultWebProxy {
+ get { return use_default_web_proxy; }
+ set { use_default_web_proxy = value; }
+ }
+
+ public override abstract BindingElementCollection CreateBindingElements ();
+
+ // explicit interface implementations
+
+ bool IBindingRuntimePreferences.ReceiveSynchronously {
+ get { return false; }
+ }
+ }
+}
XmlDictionaryReaderQuotas reader_quotas;
bool transaction_flow;
TransactionProtocol transaction_protocol;
- TcpTransportBindingElement transport = new TcpTransportBindingElement ();
+ TcpTransportBindingElement transport;
public NetTcpBinding ()
: this (SecurityMode.Transport)
bool reliableSessionEnabled)
{
security = new NetTcpSecurity (securityMode);
+ transport = new TcpTransportBindingElement ();
+ }
+
+ internal NetTcpBinding (TcpTransportBindingElement transport,
+ NetTcpSecurity security,
+ bool reliableSessionEnabled)
+ {
+ this.transport = transport;
+ this.security = security;
}
public HostNameComparisonMode HostNameComparisonMode {
BindingElement CreateTransportSecurity ()
{
switch (Security.Mode) {
- case SecurityMode.None:
- case SecurityMode.Message:
+ case SecurityMode.Transport:
+ return new WindowsStreamSecurityBindingElement () {
+ ProtectionLevel = Security.Transport.ProtectionLevel };
+
+ case SecurityMode.TransportWithMessageCredential:
+ return new SslStreamSecurityBindingElement ();
+
+ default:
return null;
}
System.ServiceModel/UriSchemeKeyedCollectionTest.cs
System.ServiceModel/WSFederationHttpBindingTest.cs
System.ServiceModel/WSHttpBindingTest.cs
+MetadataTests/BindingTestAssertions.cs
+MetadataTests/MiscImportTests.cs
+MetadataTests/ImportTests.cs
+MetadataTests/ImportTests_CreateMetadata.cs
+MetadataTests/ImportTests_LoadMetadata.cs
+MetadataTests/ImportTests_RoundTrip.cs
+MetadataTests/MetadataSamples.cs
+MetadataTests/TestContext.cs
+MetadataTests/TestLabel.cs
+MetadataTests/ExportTests.cs
--- /dev/null
+//
+// AssemblyInfo.cs
+//
+// Author:
+// Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following attributes.
+// Change them to the values specific to your project.
+
+[assembly: AssemblyTitle("MetadataTests")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Xamarin")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("Xamarin Inc. (http://www.xamarin.com)")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
+// The form "{Major}.{Minor}.*" will automatically update the build and revision,
+// and "{Major}.{Minor}.{Build}.*" will update just the revision.
+
+[assembly: AssemblyVersion("1.0.*")]
+
+// The following attributes are used to specify the signing key for the assembly,
+// if desired. See the Mono documentation for more information about signing.
+
+//[assembly: AssemblyDelaySign(false)]
+//[assembly: AssemblyKeyFile("")]
+
--- /dev/null
+//
+// BindingTestAssertions.cs
+//
+// Author:
+// Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Net;
+using System.Net.Security;
+using System.Xml;
+using System.Text;
+using System.Collections.Generic;
+using System.ServiceModel;
+using System.ServiceModel.Security;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+using NUnit.Framework;
+using NUnit.Framework.Constraints;
+using NUnit.Framework.SyntaxHelpers;
+
+using QName = System.Xml.XmlQualifiedName;
+using WS = System.Web.Services.Description;
+
+namespace MonoTests.System.ServiceModel.MetadataTests {
+
+ public static class BindingTestAssertions {
+
+ const string WspNamespace = "http://schemas.xmlsoap.org/ws/2004/09/policy";
+ const string WsuNamespace = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
+ const string MsbNamespace = "http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1";
+ const string WsawNamespace = "http://www.w3.org/2006/05/addressing/wsdl";
+ const string MsfNamespace = "http://schemas.microsoft.com/ws/2006/05/framing/policy";
+ const string SpNamespace = "http://schemas.xmlsoap.org/ws/2005/07/securitypolicy";
+ const string WsrmNamespace = "http://schemas.xmlsoap.org/ws/2005/02/rm/policy";
+ const string HttpNamespace = "http://schemas.microsoft.com/ws/06/2004/policy/http";
+ const string WsomaNamespace = "http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization";
+ const string Wsa10Namespace = "http://www.w3.org/2005/08/addressing";
+
+ static readonly QName BinaryEncodingQName = new QName ("BinaryEncoding", MsbNamespace);
+ static readonly QName UsingAddressingQName = new QName ("UsingAddressing", WsawNamespace);
+ static readonly QName StreamedTransferQName = new QName ("Streamed", MsfNamespace);
+ static readonly QName ReliableSessionQName = new QName ("RMAssertion", WsrmNamespace);
+ static readonly QName TransportBindingQName = new QName ("TransportBinding", SpNamespace);
+ static readonly QName AsymmetricBindingQName = new QName ("AsymmetricBinding", SpNamespace);
+ static readonly QName SymmetricBindingQName = new QName ("SymmetricBinding", SpNamespace);
+ static readonly QName EndorsingSupportingQName = new QName ("EndorsingSupportingTokens", SpNamespace);
+ static readonly QName SignedSupportingQName = new QName ("SignedSupportingTokens", SpNamespace);
+ static readonly QName Wss10QName = new QName ("Wss10", SpNamespace);
+ static readonly QName Wss11QName = new QName ("Wss11", SpNamespace);
+ static readonly QName Trust10QName = new QName ("Trust10", SpNamespace);
+ static readonly QName NtlmAuthenticationQName = new QName ("NtlmAuthentication", HttpNamespace);
+ static readonly QName MtomEncodingQName = new QName ("OptimizedMimeSerialization", WsomaNamespace);
+
+ public static void CheckImportErrors (WsdlImporter importer, TestLabel label)
+ {
+ bool foundErrors = false;
+ foreach (var error in importer.Errors) {
+ if (error.IsWarning)
+ Console.WriteLine ("WARNING ({0}): {1}", label, error.Message);
+ else {
+ Console.WriteLine ("ERROR ({0}): {1}", label, error.Message);
+ foundErrors = true;
+ }
+ }
+
+ if (foundErrors)
+ Assert.Fail ("Found import errors", label);
+ }
+
+ static void CheckSoapBinding (object extension, string transport, TestLabel label)
+ {
+ label.EnterScope ("soap");
+ Assert.That (extension, Is.InstanceOfType (typeof (WS.SoapBinding)), label.Get ());
+ var soap = (WS.SoapBinding)extension;
+ Assert.That (soap.Style, Is.EqualTo (WS.SoapBindingStyle.Document), label.Get ());
+ Assert.That (soap.Transport, Is.EqualTo (transport), label.Get ());
+ Assert.That (soap.Required, Is.False, label.Get ());
+ label.LeaveScope ();
+ }
+
+ public static void CheckBasicHttpBinding (
+ Binding binding, string scheme, BasicHttpSecurityMode security,
+ WSMessageEncoding encoding, HttpClientCredentialType clientCred,
+ AuthenticationSchemes authScheme, TestLabel label)
+ {
+ label.EnterScope ("http");
+
+ if (security == BasicHttpSecurityMode.Message) {
+ Assert.That (binding, Is.InstanceOfType (typeof(CustomBinding)), label.Get ());
+ } else {
+ Assert.That (binding, Is.InstanceOfType (typeof(BasicHttpBinding)), label.Get ());
+ var basicHttp = (BasicHttpBinding)binding;
+ Assert.That (basicHttp.EnvelopeVersion, Is.EqualTo (EnvelopeVersion.Soap11), label.Get ());
+ Assert.That (basicHttp.MessageVersion, Is.EqualTo (MessageVersion.Soap11), label.Get ());
+ Assert.That (basicHttp.Scheme, Is.EqualTo (scheme), label.Get ());
+ Assert.That (basicHttp.TransferMode, Is.EqualTo (TransferMode.Buffered), label.Get ());
+ Assert.That (basicHttp.MessageEncoding, Is.EqualTo (encoding), label.Get ());
+ Assert.That (basicHttp.Security, Is.Not.Null, label.Get ());
+ Assert.That (basicHttp.Security.Mode, Is.EqualTo (security), label.Get ());
+ Assert.That (basicHttp.Security.Transport.ClientCredentialType, Is.EqualTo (clientCred), label.Get ());
+ Assert.That (basicHttp.Security.Message.AlgorithmSuite, Is.EqualTo (SecurityAlgorithmSuite.Basic256), label.Get ());
+ }
+
+ label.EnterScope ("elements");
+
+ var elements = binding.CreateBindingElements ();
+ Assert.That (elements, Is.Not.Null, label.Get ());
+ if ((security == BasicHttpSecurityMode.Message) ||
+ (security == BasicHttpSecurityMode.TransportWithMessageCredential))
+ Assert.That (elements.Count, Is.EqualTo (3), label.Get ());
+ else
+ Assert.That (elements.Count, Is.EqualTo (2), label.Get ());
+
+ TextMessageEncodingBindingElement textElement = null;
+ TransportSecurityBindingElement securityElement = null;
+ HttpTransportBindingElement transportElement = null;
+ AsymmetricSecurityBindingElement asymmSecurityElement = null;
+ MtomMessageEncodingBindingElement mtomElement = null;
+
+ foreach (var element in elements) {
+ if (element is TextMessageEncodingBindingElement)
+ textElement = (TextMessageEncodingBindingElement)element;
+ else if (element is HttpTransportBindingElement)
+ transportElement = (HttpTransportBindingElement)element;
+ else if (element is TransportSecurityBindingElement)
+ securityElement = (TransportSecurityBindingElement)element;
+ else if (element is AsymmetricSecurityBindingElement)
+ asymmSecurityElement = (AsymmetricSecurityBindingElement)element;
+ else if (element is MtomMessageEncodingBindingElement)
+ mtomElement = (MtomMessageEncodingBindingElement)element;
+ else
+ Assert.Fail (string.Format (
+ "Unknown element: {0}", element.GetType ()), label.Get ());
+ }
+
+ label.EnterScope ("text");
+ if (encoding == WSMessageEncoding.Text) {
+ Assert.That (textElement, Is.Not.Null, label.Get ());
+ Assert.That (textElement.WriteEncoding, Is.InstanceOfType (typeof(UTF8Encoding)), label.Get ());
+ } else {
+ Assert.That (textElement, Is.Null, label.Get ());
+ }
+ label.LeaveScope ();
+
+ label.EnterScope ("mtom");
+ if (encoding == WSMessageEncoding.Mtom) {
+ Assert.That (mtomElement, Is.Not.Null, label.Get ());
+ } else {
+ Assert.That (mtomElement, Is.Null, label.Get ());
+ }
+ label.LeaveScope ();
+
+ label.EnterScope ("security");
+ if (security == BasicHttpSecurityMode.TransportWithMessageCredential) {
+ Assert.That (securityElement, Is.Not.Null, label.Get ());
+ Assert.That (securityElement.SecurityHeaderLayout,
+ Is.EqualTo (SecurityHeaderLayout.Lax), label.Get ());
+ } else {
+ Assert.That (securityElement, Is.Null, label.Get ());
+ }
+ label.LeaveScope ();
+
+ label.EnterScope ("asymmetric");
+ if (security == BasicHttpSecurityMode.Message) {
+ Assert.That (asymmSecurityElement, Is.Not.Null, label.Get ());
+ } else {
+ Assert.That (asymmSecurityElement, Is.Null, label.Get ());
+ }
+ label.LeaveScope ();
+
+ label.EnterScope ("transport");
+ Assert.That (transportElement, Is.Not.Null, label.Get ());
+
+ Assert.That (transportElement.Realm, Is.Empty, label.Get ());
+ Assert.That (transportElement.Scheme, Is.EqualTo (scheme), label.Get ());
+ Assert.That (transportElement.TransferMode, Is.EqualTo (TransferMode.Buffered), label.Get ());
+
+ label.EnterScope ("auth");
+ Assert.That (transportElement.AuthenticationScheme, Is.EqualTo (authScheme), label.Get ());
+ label.LeaveScope (); // auth
+ label.LeaveScope (); // transport
+ label.LeaveScope (); // elements
+ label.LeaveScope (); // http
+ }
+
+ static void CheckEndpoint (ServiceEndpoint endpoint, string uri, TestLabel label)
+ {
+ label.EnterScope ("endpoint");
+ Assert.That (endpoint.ListenUri, Is.EqualTo (new Uri (uri)), label.Get ());
+ Assert.That (endpoint.ListenUriMode, Is.EqualTo (ListenUriMode.Explicit), label.Get ());
+ Assert.That (endpoint.Contract, Is.Not.Null, label.Get ());
+ Assert.That (endpoint.Contract.Name, Is.EqualTo ("MyContract"), label.Get ());
+ Assert.That (endpoint.Address, Is.Not.Null, label.Get ());
+ Assert.That (endpoint.Address.Uri, Is.EqualTo (new Uri (uri)), label.Get ());
+ Assert.That (endpoint.Address.Identity, Is.Null, label.Get ());
+ Assert.That (endpoint.Address.Headers, Is.Not.Null, label.Get ());
+ Assert.That (endpoint.Address.Headers.Count, Is.EqualTo (0), label.Get ());
+ label.LeaveScope ();
+ }
+
+ public static void BasicHttpBinding (
+ TestContext context, MetadataSet doc, WSMessageEncoding encoding, TestLabel label)
+ {
+ BasicHttpBinding (
+ context, doc, BasicHttpSecurityMode.None, encoding,
+ HttpClientCredentialType.None, AuthenticationSchemes.Anonymous,
+ label);
+ }
+
+ public static void BasicHttpBinding (
+ TestContext context, MetadataSet doc, BasicHttpSecurityMode security, TestLabel label)
+ {
+ BasicHttpBinding (
+ context, doc, security, WSMessageEncoding.Text,
+ HttpClientCredentialType.None, AuthenticationSchemes.Anonymous,
+ label);
+ }
+
+ public static void BasicHttpBinding (
+ TestContext context, MetadataSet doc, BasicHttpSecurityMode security,
+ WSMessageEncoding encoding, HttpClientCredentialType clientCred,
+ AuthenticationSchemes authScheme, TestLabel label)
+ {
+ label.EnterScope ("basicHttpBinding");
+ BasicHttpBinding_inner (
+ context, doc, security, encoding, clientCred,
+ authScheme, false, label);
+ label.LeaveScope ();
+ }
+
+ public static void BasicHttpsBinding (
+ TestContext context, MetadataSet doc, BasicHttpSecurityMode security,
+ WSMessageEncoding encoding, HttpClientCredentialType clientCred,
+ AuthenticationSchemes authScheme, TestLabel label)
+ {
+ label.EnterScope ("basicHttpsBinding");
+ BasicHttpBinding_inner (
+ context, doc, security, encoding, clientCred,
+ authScheme, true, label);
+ label.LeaveScope ();
+ }
+
+ static void BasicHttpBinding_inner (
+ TestContext context, MetadataSet doc, BasicHttpSecurityMode security,
+ WSMessageEncoding encoding, HttpClientCredentialType clientCred,
+ AuthenticationSchemes authScheme, bool isHttps, TestLabel label)
+ {
+ var sd = (WS.ServiceDescription)doc.MetadataSections [0].Metadata;
+
+ label.EnterScope ("wsdl");
+ label.EnterScope ("bindings");
+ Assert.That (sd.Bindings.Count, Is.EqualTo (1), label.Get ());
+
+ var binding = sd.Bindings [0];
+ Assert.That (binding.ExtensibleAttributes, Is.Null, label.Get ());
+ Assert.That (binding.Extensions, Is.Not.Null, label.Get ());
+
+ bool hasPolicyXml;
+
+ switch (security) {
+ case BasicHttpSecurityMode.None:
+ if (isHttps)
+ throw new InvalidOperationException ();
+ hasPolicyXml = encoding == WSMessageEncoding.Mtom;
+ break;
+ case BasicHttpSecurityMode.Message:
+ case BasicHttpSecurityMode.Transport:
+ case BasicHttpSecurityMode.TransportWithMessageCredential:
+ if (encoding == WSMessageEncoding.Mtom)
+ throw new InvalidOperationException ();
+ hasPolicyXml = true;
+ break;
+ case BasicHttpSecurityMode.TransportCredentialOnly:
+ if (isHttps)
+ throw new InvalidOperationException ();
+ hasPolicyXml = true;
+ break;
+ default:
+ throw new InvalidOperationException ();
+ }
+ label.LeaveScope ();
+
+ WS.SoapBinding soap = null;
+ XmlElement xml = null;
+
+ foreach (var ext in binding.Extensions) {
+ if (ext is WS.SoapBinding)
+ soap = (WS.SoapBinding)ext;
+ else if (ext is XmlElement)
+ xml = (XmlElement)ext;
+ }
+
+ CheckSoapBinding (soap, WS.SoapBinding.HttpTransport, label);
+ label.LeaveScope ();
+
+ label.EnterScope ("policy-xml");
+ if (!hasPolicyXml)
+ Assert.That (xml, Is.Null, label.Get ());
+ else {
+ Assert.That (xml, Is.Not.Null, label.Get ());
+ var assertions = AssertPolicy (sd, xml, label);
+ Assert.That (assertions, Is.Not.Null, label.Get ());
+ if (clientCred == HttpClientCredentialType.Ntlm)
+ AssertPolicy (assertions, NtlmAuthenticationQName, label);
+ if (encoding == WSMessageEncoding.Mtom)
+ AssertPolicy (assertions, MtomEncodingQName, label);
+ switch (security) {
+ case BasicHttpSecurityMode.Message:
+ AssertPolicy (assertions, AsymmetricBindingQName, label);
+ AssertPolicy (assertions, Wss10QName, label);
+ break;
+ case BasicHttpSecurityMode.Transport:
+ AssertPolicy (assertions, TransportBindingQName, label);
+ break;
+ case BasicHttpSecurityMode.TransportWithMessageCredential:
+ AssertPolicy (assertions, SignedSupportingQName, label);
+ AssertPolicy (assertions, TransportBindingQName, label);
+ AssertPolicy (assertions, Wss10QName, label);
+ break;
+ default:
+ break;
+ }
+ Assert.That (assertions.Count, Is.EqualTo (0), label.Get ());
+ }
+ label.LeaveScope ();
+
+ label.EnterScope ("services");
+ Assert.That (sd.Services, Is.Not.Null, label.Get ());
+ Assert.That (sd.Services.Count, Is.EqualTo (1), label.Get ());
+ var service = sd.Services [0];
+ Assert.That (service.Ports, Is.Not.Null, label.Get ());
+ Assert.That (service.Ports.Count, Is.EqualTo (1), label.Get ());
+ var port = service.Ports [0];
+
+ label.EnterScope ("port");
+ Assert.That (port.Extensions, Is.Not.Null, label.Get ());
+ Assert.That (port.Extensions.Count, Is.EqualTo (1), label.Get ());
+
+ WS.SoapAddressBinding soap_addr_binding = null;
+ foreach (var extension in port.Extensions) {
+ if (extension is WS.SoapAddressBinding)
+ soap_addr_binding = (WS.SoapAddressBinding)extension;
+ else
+ Assert.Fail (label.Get ());
+ }
+ Assert.That (soap_addr_binding, Is.Not.Null, label.Get ());
+ label.LeaveScope ();
+
+ label.LeaveScope (); // wsdl
+
+ var importer = new WsdlImporter (doc);
+
+ label.EnterScope ("bindings");
+ var bindings = importer.ImportAllBindings ();
+ CheckImportErrors (importer, label);
+
+ Assert.That (bindings, Is.Not.Null, label.Get ());
+ Assert.That (bindings.Count, Is.EqualTo (1), label.Get ());
+
+ string scheme;
+ if ((security == BasicHttpSecurityMode.Transport) ||
+ (security == BasicHttpSecurityMode.TransportWithMessageCredential))
+ scheme = "https";
+ else
+ scheme = "http";
+
+ CheckBasicHttpBinding (
+ bindings [0], scheme, security, encoding, clientCred,
+ authScheme, label);
+ label.LeaveScope ();
+
+ label.EnterScope ("endpoints");
+ var endpoints = importer.ImportAllEndpoints ();
+ CheckImportErrors (importer, label);
+
+ Assert.That (endpoints, Is.Not.Null, label.Get ());
+ Assert.That (endpoints.Count, Is.EqualTo (1), label.Get ());
+
+ var uri = isHttps ? MetadataSamples.HttpsUri : MetadataSamples.HttpUri;
+
+ CheckEndpoint (endpoints [0], uri, label);
+ label.LeaveScope ();
+ }
+
+ public static void CheckNetTcpBinding (
+ Binding binding, SecurityMode security, bool reliableSession,
+ TransferMode transferMode, TestLabel label)
+ {
+ label.EnterScope ("net-tcp");
+ if (security == SecurityMode.Message) {
+ Assert.That (binding, Is.InstanceOfType (typeof(CustomBinding)), label.Get ());
+ } else {
+ Assert.That (binding, Is.InstanceOfType (typeof(NetTcpBinding)), label.Get ());
+ var netTcp = (NetTcpBinding)binding;
+ Assert.That (netTcp.EnvelopeVersion, Is.EqualTo (EnvelopeVersion.Soap12), label.Get ());
+ Assert.That (netTcp.MessageVersion, Is.EqualTo (MessageVersion.Soap12WSAddressing10), label.Get ());
+ Assert.That (netTcp.Scheme, Is.EqualTo ("net.tcp"), label.Get ());
+ Assert.That (netTcp.TransferMode, Is.EqualTo (transferMode), label.Get ());
+
+ label.EnterScope ("security");
+ Assert.That (netTcp.Security, Is.Not.Null, label.Get ());
+ Assert.That (netTcp.Security.Mode, Is.EqualTo (security), label.Get ());
+
+ Assert.That (netTcp.Security.Transport, Is.Not.Null, label.Get ());
+ Assert.That (netTcp.Security.Transport.ProtectionLevel, Is.EqualTo (ProtectionLevel.EncryptAndSign), label.Get ());
+ Assert.That (netTcp.Security.Transport.ClientCredentialType, Is.EqualTo (TcpClientCredentialType.Windows), label.Get ());
+ label.LeaveScope ();
+ }
+
+ label.EnterScope ("elements");
+
+ var elements = binding.CreateBindingElements ();
+ Assert.That (elements, Is.Not.Null, label.Get ());
+
+ TcpTransportBindingElement transportElement = null;
+ TransactionFlowBindingElement transactionFlowElement = null;
+ BinaryMessageEncodingBindingElement encodingElement = null;
+ WindowsStreamSecurityBindingElement windowsStreamElement = null;
+ ReliableSessionBindingElement reliableSessionElement = null;
+ TransportSecurityBindingElement transportSecurityElement = null;
+ SslStreamSecurityBindingElement sslStreamElement = null;
+ SymmetricSecurityBindingElement symmSecurityElement = null;
+
+ foreach (var element in elements) {
+ if (element is TcpTransportBindingElement)
+ transportElement = (TcpTransportBindingElement)element;
+ else if (element is TransactionFlowBindingElement)
+ transactionFlowElement = (TransactionFlowBindingElement)element;
+ else if (element is BinaryMessageEncodingBindingElement)
+ encodingElement = (BinaryMessageEncodingBindingElement)element;
+ else if (element is WindowsStreamSecurityBindingElement)
+ windowsStreamElement = (WindowsStreamSecurityBindingElement)element;
+ else if (element is ReliableSessionBindingElement)
+ reliableSessionElement = (ReliableSessionBindingElement)element;
+ else if (element is TransportSecurityBindingElement)
+ transportSecurityElement = (TransportSecurityBindingElement)element;
+ else if (element is SslStreamSecurityBindingElement)
+ sslStreamElement = (SslStreamSecurityBindingElement)element;
+ else if (element is SymmetricSecurityBindingElement)
+ symmSecurityElement = (SymmetricSecurityBindingElement)element;
+ else
+ Assert.Fail (string.Format (
+ "Unknown element `{0}'.", element.GetType ()), label.Get ());
+ }
+
+ label.EnterScope ("windows-stream");
+ if (security == SecurityMode.Transport) {
+ Assert.That (windowsStreamElement, Is.Not.Null, label.Get ());
+ Assert.That (windowsStreamElement.ProtectionLevel, Is.EqualTo (ProtectionLevel.EncryptAndSign), label.Get ());
+ } else {
+ Assert.That (windowsStreamElement, Is.Null, label.Get ());
+ }
+ label.LeaveScope ();
+
+ label.EnterScope ("reliable-session");
+ if (reliableSession) {
+ Assert.That (reliableSessionElement, Is.Not.Null, label.Get ());
+ } else {
+ Assert.That (reliableSessionElement, Is.Null, label.Get ());
+ }
+ label.LeaveScope ();
+
+ label.EnterScope ("encoding");
+ Assert.That (encodingElement, Is.Not.Null, label.Get ());
+ label.LeaveScope ();
+
+ label.EnterScope ("transaction");
+ if (security == SecurityMode.Message) {
+ Assert.That (transactionFlowElement, Is.Null, label.Get ());
+ } else {
+ Assert.That (transactionFlowElement, Is.Not.Null, label.Get ());
+ }
+ label.LeaveScope ();
+
+ label.EnterScope ("transport");
+ Assert.That (transportElement, Is.Not.Null, label.Get ());
+
+ Assert.That (transportElement.Scheme, Is.EqualTo ("net.tcp"), label.Get ());
+ Assert.That (transportElement.TransferMode, Is.EqualTo (transferMode), label.Get ());
+ label.LeaveScope (); // transport
+
+ label.EnterScope ("security");
+ switch (security) {
+ case SecurityMode.None:
+ case SecurityMode.Transport:
+ Assert.That (transportSecurityElement, Is.Null, label.Get ());
+ Assert.That (sslStreamElement, Is.Null, label.Get ());
+ Assert.That (symmSecurityElement, Is.Null, label.Get ());
+ break;
+ case SecurityMode.TransportWithMessageCredential:
+ Assert.That (transportSecurityElement, Is.Not.Null, label.Get ());
+ Assert.That (sslStreamElement, Is.Not.Null, label.Get ());
+ Assert.That (symmSecurityElement, Is.Null, label.Get ());
+ break;
+ case SecurityMode.Message:
+ Assert.That (transportSecurityElement, Is.Null, label.Get ());
+ Assert.That (sslStreamElement, Is.Null, label.Get ());
+ Assert.That (symmSecurityElement, Is.Not.Null, label.Get ());
+ break;
+ default:
+ throw new InvalidOperationException ();
+ }
+ label.LeaveScope ();
+
+ label.LeaveScope (); // elements
+ label.LeaveScope (); // net-tcp
+ }
+
+ public static void NetTcpBinding (
+ TestContext context, MetadataSet doc, SecurityMode security,
+ bool reliableSession, TransferMode transferMode, TestLabel label)
+ {
+ label.EnterScope ("netTcpBinding");
+
+ var sd = (WS.ServiceDescription)doc.MetadataSections [0].Metadata;
+
+ label.EnterScope ("wsdl");
+
+ label.EnterScope ("bindings");
+ Assert.That (sd.Bindings.Count, Is.EqualTo (1), label.Get ());
+ var binding = sd.Bindings [0];
+ Assert.That (binding.ExtensibleAttributes, Is.Null, label.Get ());
+ Assert.That (binding.Extensions, Is.Not.Null, label.Get ());
+
+ WS.Soap12Binding soap = null;
+ XmlElement xml = null;
+
+ foreach (var ext in binding.Extensions) {
+ if (ext is WS.Soap12Binding)
+ soap = (WS.Soap12Binding)ext;
+ else if (ext is XmlElement)
+ xml = (XmlElement)ext;
+ }
+
+ CheckSoapBinding (soap, "http://schemas.microsoft.com/soap/tcp", label);
+
+ label.EnterScope ("policy-xml");
+ Assert.That (xml, Is.Not.Null, label.Get ());
+ var assertions = AssertPolicy (sd, xml, label);
+ Assert.That (assertions, Is.Not.Null, label.Get ());
+ AssertPolicy (assertions, BinaryEncodingQName, label);
+ AssertPolicy (assertions, UsingAddressingQName, label);
+ if (transferMode == TransferMode.Streamed)
+ AssertPolicy (assertions, StreamedTransferQName, label);
+ switch (security) {
+ case SecurityMode.Message:
+ AssertPolicy (assertions, SymmetricBindingQName, label);
+ AssertPolicy (assertions, Wss11QName, label);
+ AssertPolicy (assertions, Trust10QName, label);
+ break;
+ case SecurityMode.Transport:
+ AssertPolicy (assertions, TransportBindingQName, label);
+ break;
+ case SecurityMode.TransportWithMessageCredential:
+ AssertPolicy (assertions, TransportBindingQName, label);
+ AssertPolicy (assertions, EndorsingSupportingQName, label);
+ AssertPolicy (assertions, Wss11QName, label);
+ AssertPolicy (assertions, Trust10QName, label);
+ break;
+ default:
+ break;
+ }
+ if (reliableSession)
+ AssertPolicy (assertions, ReliableSessionQName, label);
+ Assert.That (assertions.Count, Is.EqualTo (0), label.Get ());
+ label.LeaveScope ();
+
+ label.EnterScope ("services");
+ Assert.That (sd.Services, Is.Not.Null, label.Get ());
+ Assert.That (sd.Services.Count, Is.EqualTo (1), label.Get ());
+ var service = sd.Services [0];
+ Assert.That (service.Ports, Is.Not.Null, label.Get ());
+ Assert.That (service.Ports.Count, Is.EqualTo (1), label.Get ());
+ var port = service.Ports [0];
+
+ label.EnterScope ("port");
+ Assert.That (port.Extensions, Is.Not.Null, label.Get ());
+ Assert.That (port.Extensions.Count, Is.EqualTo (2), label.Get ());
+
+ WS.Soap12AddressBinding soap_addr_binding = null;
+ XmlElement port_xml = null;
+ foreach (var extension in port.Extensions) {
+ if (extension is WS.Soap12AddressBinding)
+ soap_addr_binding = (WS.Soap12AddressBinding)extension;
+ else if (extension is XmlElement)
+ port_xml = (XmlElement)extension;
+ else
+ Assert.Fail (label.Get ());
+ }
+ Assert.That (soap_addr_binding, Is.Not.Null, label.Get ());
+ Assert.That (port_xml, Is.Not.Null, label.Get ());
+ Assert.That (port_xml.NamespaceURI, Is.EqualTo (Wsa10Namespace), label.Get ());
+ Assert.That (port_xml.LocalName, Is.EqualTo ("EndpointReference"), label.Get ());
+ label.LeaveScope ();
+ label.LeaveScope ();
+
+ label.LeaveScope (); // wsdl
+
+ var importer = new WsdlImporter (doc);
+
+ label.EnterScope ("bindings");
+ var bindings = importer.ImportAllBindings ();
+ CheckImportErrors (importer, label);
+ Assert.That (bindings, Is.Not.Null, label.Get ());
+ Assert.That (bindings.Count, Is.EqualTo (1), label.Get ());
+
+ CheckNetTcpBinding (
+ bindings [0], security, reliableSession,
+ transferMode, label);
+ label.LeaveScope ();
+
+ label.EnterScope ("endpoints");
+ var endpoints = importer.ImportAllEndpoints ();
+ CheckImportErrors (importer, label);
+ Assert.That (endpoints, Is.Not.Null, label.Get ());
+ Assert.That (endpoints.Count, Is.EqualTo (1), label.Get ());
+
+ CheckEndpoint (endpoints [0], MetadataSamples.NetTcpUri, label);
+ label.LeaveScope ();
+
+ label.LeaveScope ();
+ }
+
+ public static void Dump (PolicyAssertionCollection assertions)
+ {
+ foreach (var assertion in assertions)
+ Console.WriteLine ("ASSERTION: {0}", assertion.OuterXml);
+ }
+
+ public static void AssertPolicy (
+ PolicyAssertionCollection assertions, QName qname, TestLabel label)
+ {
+ var assertion = assertions.Find (qname.Name, qname.Namespace);
+ label.EnterScope (qname.Name);
+ Assert.That (assertion, Is.Not.Null, label.ToString ());
+ assertions.Remove (assertion);
+ label.LeaveScope ();
+ }
+
+ static XmlElement ResolvePolicy (WS.ServiceDescription sd, XmlElement policy)
+ {
+ if (policy.LocalName.Equals ("Policy"))
+ return policy;
+
+ var uri = policy.GetAttribute ("URI");
+ if (!uri.StartsWith ("#"))
+ return null;
+
+ foreach (var sext in sd.Extensions) {
+ var sxml = sext as XmlElement;
+ if (sxml == null)
+ continue;
+ if (!sxml.NamespaceURI.Equals (WspNamespace))
+ continue;
+ if (!sxml.LocalName.Equals ("Policy"))
+ continue;
+ var id = sxml.GetAttribute ("Id", WsuNamespace);
+ if (uri.Substring (1).Equals (id))
+ return sxml;
+ }
+
+ return null;
+ }
+
+ public static PolicyAssertionCollection AssertPolicy (
+ WS.Binding binding, TestLabel label)
+ {
+ label.EnterScope ("FindPolicy");
+ XmlElement policy = null;
+
+ foreach (var extension in binding.Extensions) {
+ var xml = extension as XmlElement;
+ if (xml == null)
+ continue;
+ Assert.That (policy, Is.Null, label.Get ());
+ policy = xml;
+ }
+ Assert.That (policy, Is.Not.Null, label.Get ());
+ try {
+ return AssertPolicy (binding.ServiceDescription, policy, label);
+ } finally {
+ label.LeaveScope ();
+ }
+ }
+
+ static XmlElement AssertExactlyOneChildElement (XmlElement element)
+ {
+ XmlElement found = null;
+ foreach (var node in element.ChildNodes) {
+ if (node is XmlWhitespace)
+ continue;
+ var e = node as XmlElement;
+ if (e == null)
+ return null;
+ if (found != null)
+ return null;
+ found = e;
+ }
+
+ return found;
+ }
+
+ public static PolicyAssertionCollection AssertPolicy (
+ WS.ServiceDescription sd, XmlElement element, TestLabel label)
+ {
+ label.EnterScope ("wsp:Policy");
+ Assert.That (element.NamespaceURI, Is.EqualTo (WspNamespace), label.Get ());
+ Assert.That (element.LocalName, Is.EqualTo ("Policy") | Is.EqualTo ("PolicyReference"), label.Get ());
+
+ var policy = ResolvePolicy (sd, element);
+ Assert.That (policy, Is.Not.Null, label.Get ());
+
+ label.EnterScope ("wsp:ExactlyOne");
+ var exactlyOne = AssertExactlyOneChildElement (policy);
+ Assert.That (exactlyOne, Is.Not.Null, label.Get ());
+ Assert.That (exactlyOne.NamespaceURI, Is.EqualTo (WspNamespace), label.Get ());
+ Assert.That (exactlyOne.LocalName, Is.EqualTo ("ExactlyOne"), label.Get ());
+ label.LeaveScope ();
+
+ label.EnterScope ("wsp:Any");
+ var all = AssertExactlyOneChildElement (exactlyOne);
+ Assert.That (all, Is.Not.Null, label.Get ());
+ Assert.That (all.NamespaceURI, Is.EqualTo (WspNamespace), label.Get ());
+ Assert.That (all.LocalName, Is.EqualTo ("All"), label.Get ());
+ label.LeaveScope ();
+
+ var collection = new PolicyAssertionCollection ();
+
+ label.EnterScope ("assertions");
+ foreach (var node in all.ChildNodes) {
+ if (node is XmlWhitespace)
+ continue;
+ Assert.That (node, Is.InstanceOfType (typeof (XmlElement)), label.ToString ());
+ collection.Add ((XmlElement)node);
+ }
+ label.LeaveScope ();
+
+ label.LeaveScope ();
+
+ return collection;
+ }
+
+ public static void TestOperation (MetadataSet metadata, bool soap12, TestLabel label)
+ {
+ label.EnterScope ("TestOperation");
+
+ label.EnterScope ("metadata");
+ WS.ServiceDescription sd = null;
+ foreach (var ms in metadata.MetadataSections) {
+ if (!ms.Dialect.Equals ("http://schemas.xmlsoap.org/wsdl/"))
+ continue;
+ sd = ms.Metadata as WS.ServiceDescription;
+ }
+ Assert.That (sd, Is.Not.Null, label.Get ());
+ Assert.That (sd.Bindings, Is.Not.Null, label.Get ());
+ Assert.That (sd.Bindings.Count, Is.EqualTo (1), label.Get ());
+ var binding = sd.Bindings [0];
+ label.LeaveScope ();
+
+ label.EnterScope ("operation");
+ Assert.That (binding.Operations, Is.Not.Null, label.Get ());
+ Assert.That (binding.Operations.Count, Is.EqualTo (1), label.Get ());
+ var op = binding.Operations [0];
+
+ Assert.That (op.Name, Is.EqualTo ("Hello"), label.Get ());
+ Assert.That (op.ExtensibleAttributes, Is.Null, label.Get ());
+
+ label.EnterScope ("extensions");
+ Assert.That (op.Extensions, Is.Not.Null, label.Get ());
+ Assert.That (op.Extensions.Count, Is.EqualTo (1), label.Get ());
+ Assert.That (op.Extensions [0], Is.InstanceOfType (typeof (WS.SoapOperationBinding)), label.Get ());
+ var soap = (WS.SoapOperationBinding)op.Extensions [0];
+ TestSoap (soap, soap12, label);
+ label.LeaveScope ();
+
+ TestSoapMessage (op.Input, soap12, label);
+ TestSoapMessage (op.Output, soap12, label);
+ label.LeaveScope (); // operation
+
+ label.LeaveScope ();
+ }
+
+ static void TestSoap (WS.SoapOperationBinding soap, bool soap12, TestLabel label)
+ {
+ label.EnterScope ("soap");
+ var type = soap12 ? typeof (WS.Soap12OperationBinding) : typeof (WS.SoapOperationBinding);
+ Assert.That (soap.GetType (), Is.EqualTo (type), label.Get ());
+ Assert.That (soap.Style, Is.EqualTo (WS.SoapBindingStyle.Document), label.Get ());
+ Assert.That (soap.SoapAction, Is.EqualTo ("http://tempuri.org/IMyContract/Hello"), label.Get ());
+ Assert.That (soap.Required, Is.False, label.Get ());
+ label.LeaveScope ();
+ }
+
+ static void TestSoapMessage (WS.MessageBinding binding, bool soap12, TestLabel label)
+ {
+ label.EnterScope (binding is WS.InputBinding ? "input" : "output");
+
+ Assert.That (binding, Is.Not.Null, label.Get ());
+ Assert.That (binding.Name, Is.Null, label.Get ());
+ Assert.That (binding.ExtensibleAttributes, Is.Null, label.Get ());
+ Assert.That (binding.Extensions, Is.Not.Null, label.Get ());
+ Assert.That (binding.Extensions.Count, Is.EqualTo (1), label.Get ());
+ Assert.That (binding.Extensions [0], Is.InstanceOfType (typeof (WS.SoapBodyBinding)), label.Get ());
+ var body = (WS.SoapBodyBinding)binding.Extensions [0];
+ TestSoapBody (body, soap12, label);
+ label.LeaveScope ();
+ }
+
+ static void TestSoapBody (WS.SoapBodyBinding soap, bool soap12, TestLabel label)
+ {
+ label.EnterScope ("soap-body");
+ var type = soap12 ? typeof (WS.Soap12BodyBinding) : typeof (WS.SoapBodyBinding);
+ Assert.That (soap.GetType (), Is.EqualTo (type), label.Get ());
+ Assert.That (soap.Encoding, Is.Empty, label.Get ());
+ Assert.That (soap.Namespace, Is.Empty, label.Get ());
+ Assert.That (soap.Parts, Is.Null, label.Get ());
+ Assert.That (soap.Use, Is.EqualTo (WS.SoapBindingUse.Literal), label.Get ());
+ label.LeaveScope ();
+ }
+ }
+}
--- /dev/null
+//
+// TestExport.cs
+//
+// Author:
+// Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using System.Net;
+using System.Xml;
+using System.Collections.Generic;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+
+using QName = System.Xml.XmlQualifiedName;
+using WS = System.Web.Services.Description;
+
+using NUnit.Framework;
+using NUnit.Framework.Constraints;
+using NUnit.Framework.SyntaxHelpers;
+
+namespace MonoTests.System.ServiceModel.MetadataTests {
+
+ [TestFixture]
+ public class TestExport {
+ internal const string HttpUri = "http://tempuri.org/TestHttp/";
+
+ [Test]
+ public void SimpleExport ()
+ {
+ var label = new TestLabel ("DuplicateContract");
+
+ var cd = new ContractDescription ("MyContract");
+ var endpoint = new ServiceEndpoint (
+ cd, new BasicHttpBinding (), new EndpointAddress (HttpUri));
+
+ var exporter = new WsdlExporter ();
+ exporter.ExportContract (cd);
+ exporter.ExportEndpoint (endpoint);
+
+ CheckExport (
+ exporter, new QName ("MyContract", "http://tempuri.org/"),
+ "BasicHttpBinding", 1, label);
+ }
+
+ [Test]
+ public void DuplicateContract ()
+ {
+ var label = new TestLabel ("DuplicateContract");
+
+ var cd = new ContractDescription ("MyContract");
+ var endpoint = new ServiceEndpoint (
+ cd, new BasicHttpBinding (), new EndpointAddress (HttpUri));
+
+ var exporter = new WsdlExporter ();
+ exporter.ExportContract (cd);
+ exporter.ExportContract (cd);
+ exporter.ExportEndpoint (endpoint);
+
+ CheckExport (
+ exporter, new QName ("MyContract", "http://tempuri.org/"),
+ "BasicHttpBinding", 1, label);
+ }
+
+ [Test]
+ public void DuplicateEndpoint ()
+ {
+ var label = new TestLabel ("DuplicateEndpoint");
+
+ var cd = new ContractDescription ("MyContract");
+ var endpoint = new ServiceEndpoint (
+ cd, new BasicHttpBinding (), new EndpointAddress (HttpUri));
+
+ var exporter = new WsdlExporter ();
+ exporter.ExportEndpoint (endpoint);
+ exporter.ExportEndpoint (endpoint);
+
+ CheckExport (
+ exporter, new QName ("MyContract", "http://tempuri.org/"),
+ "BasicHttpBinding", 1, label);
+ }
+
+ [Test]
+ public void DuplicateEndpoint2 ()
+ {
+ var label = new TestLabel ("DuplicateEndpoint2");
+
+ var cd = new ContractDescription ("MyContract");
+ var endpoint = new ServiceEndpoint (
+ cd, new BasicHttpBinding (), new EndpointAddress (HttpUri));
+ var endpoint2 = new ServiceEndpoint (
+ cd, new BasicHttpBinding (), new EndpointAddress (HttpUri));
+
+ var exporter = new WsdlExporter ();
+ exporter.ExportEndpoint (endpoint);
+ exporter.ExportEndpoint (endpoint);
+ exporter.ExportEndpoint (endpoint2);
+
+ CheckExport (
+ exporter, new QName ("MyContract", "http://tempuri.org/"),
+ "BasicHttpBinding", 2, label);
+ }
+
+ public static void CheckExport (
+ WsdlExporter exporter, QName contractName, string bindingName,
+ int countEndpoints, TestLabel label)
+ {
+ Assert.That (exporter.GeneratedWsdlDocuments, Is.Not.Null, label.Get ());
+ Assert.That (exporter.GeneratedWsdlDocuments.Count, Is.EqualTo (1), label.Get ());
+
+ var wsdl = exporter.GeneratedWsdlDocuments [0];
+ CheckExport (wsdl, contractName, bindingName, countEndpoints, label);
+ }
+
+ public static void CheckExport (
+ WS.ServiceDescription wsdl, QName contractName, string bindingName,
+ int countEndpoints, TestLabel label)
+ {
+ label.EnterScope ("ServiceDescription");
+ Assert.That (wsdl.TargetNamespace, Is.EqualTo (contractName.Namespace), label.Get ());
+ Assert.That (wsdl.Name, Is.EqualTo ("service"), label.Get ());
+ label.LeaveScope ();
+
+ label.EnterScope ("Bindings");
+ Assert.That (wsdl.Bindings, Is.Not.Null, label.Get ());
+ Assert.That (wsdl.Bindings.Count, Is.EqualTo (countEndpoints), label.Get ());
+
+ for (int i = 0; i < countEndpoints; i++) {
+ label.EnterScope (string.Format ("#{0}", i+1));
+ var binding = wsdl.Bindings [i];
+ var expectedName = string.Format (
+ "{0}_{1}{2}", bindingName, contractName.Name,
+ i > 0 ? i.ToString () : "");
+ Assert.That (binding.Name, Is.EqualTo (expectedName), label.Get ());
+ Assert.That (binding.Type, Is.EqualTo (contractName), label.Get ());
+ label.LeaveScope ();
+ }
+ label.LeaveScope ();
+
+ label.EnterScope ("PortTypes");
+ Assert.That (wsdl.PortTypes, Is.Not.Null, label.Get ());
+ Assert.That (wsdl.PortTypes.Count, Is.EqualTo (1), label.Get ());
+ var portType = wsdl.PortTypes [0];
+ Assert.That (portType.Name, Is.EqualTo (contractName.Name), label.Get ());
+ label.LeaveScope ();
+
+ label.EnterScope ("Services");
+ Assert.That (wsdl.Services, Is.Not.Null, label.Get ());
+ Assert.That (wsdl.Services.Count, Is.EqualTo (1), label.Get ());
+ var service = wsdl.Services [0];
+ Assert.That (service.Name, Is.EqualTo ("service"), label.Get ());
+ label.LeaveScope ();
+
+ label.EnterScope ("Ports");
+ Assert.That (service.Ports, Is.Not.Null, label.Get ());
+ Assert.That (service.Ports.Count, Is.EqualTo (countEndpoints), label.Get ());
+ for (int i = 0; i < countEndpoints; i++) {
+ label.EnterScope (string.Format ("#{0}", i+1));
+ var port = service.Ports [i];
+ var expectedName = string.Format (
+ "{0}_{1}{2}", bindingName, contractName.Name,
+ i > 0 ? i.ToString () : "");
+ var qname = new QName (expectedName, contractName.Namespace);
+ Assert.That (port.Name, Is.EqualTo (qname.Name), label.Get ());
+ Assert.That (port.Binding, Is.EqualTo (qname), label.Get ());
+ label.LeaveScope ();
+ }
+ label.LeaveScope ();
+ }
+
+ [Test]
+ public void Mtom_Policy ()
+ {
+ var label = new TestLabel ("Mtom_Policy");
+ var contract = new ContractDescription ("MyContract");
+ var binding = new BasicHttpBinding ();
+ binding.MessageEncoding = WSMessageEncoding.Mtom;
+
+ var endpoint = new ServiceEndpoint (
+ contract, binding, new EndpointAddress (HttpUri));
+
+ var exporter = new WsdlExporter ();
+ exporter.ExportEndpoint (endpoint);
+
+ Assert.That (exporter.GeneratedWsdlDocuments, Is.Not.Null, label.Get ());
+ Assert.That (exporter.GeneratedWsdlDocuments.Count, Is.EqualTo (1), label.Get ());
+ var wsdl = exporter.GeneratedWsdlDocuments [0];
+
+ Assert.That (wsdl.Bindings, Is.Not.Null, label.Get ());
+ Assert.That (wsdl.Bindings.Count, Is.EqualTo (1), label.Get ());
+
+ var wsb = wsdl.Bindings [0];
+ label.EnterScope ("Binding");
+ Assert.That (wsb.Extensions, Is.Not.Null, label.Get ());
+ Assert.That (wsb.Extensions.Count, Is.EqualTo (2), label.Get ());
+ label.LeaveScope ();
+
+ label.EnterScope ("Extensions");
+ WS.SoapBinding soap = null;
+ XmlElement xml = null;
+ foreach (var extension in wsb.Extensions) {
+ if (extension is WS.SoapBinding)
+ soap = (WS.SoapBinding)extension;
+ else if (extension is XmlElement)
+ xml = (XmlElement)extension;
+ else
+ Assert.Fail ("Unknown extension.", label);
+ }
+
+ Assert.That (soap, Is.Not.Null, label.Get ());
+ Assert.That (xml, Is.Not.Null, label.Get ());
+ label.LeaveScope ();
+
+ label.EnterScope ("Policy");
+ var assertions = BindingTestAssertions.AssertPolicy (wsdl, xml, label);
+ Assert.That (assertions.Count, Is.EqualTo (1), label.Get ());
+ var assertion = assertions [0];
+ Assert.That (assertion.NamespaceURI, Is.EqualTo ("http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization"), label.Get ());
+ Assert.That (assertion.LocalName, Is.EqualTo ("OptimizedMimeSerialization"), label.Get ());
+ label.LeaveScope ();
+ }
+ }
+}
+
--- /dev/null
+//
+// Main.cs
+//
+// Author:
+// Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+
+namespace MonoTests.System.ServiceModel.MetadataTests {
+
+ public static class ExportUtil {
+ public static void Main (string[] args)
+ {
+ MetadataSamples.Export ();
+ }
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>10.0.0</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{D4C1B0BD-3488-441C-92B9-7E017041E137}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <RootNamespace>ExportUtil</RootNamespace>
+ <AssemblyName>ExportUtil</AssemblyName>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>True</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>False</Optimize>
+ <OutputPath>bin\Debug</OutputPath>
+ <DefineConstants>DEBUG;</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <Externalconsole>True</Externalconsole>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>none</DebugType>
+ <Optimize>True</Optimize>
+ <OutputPath>bin\Release</OutputPath>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <Externalconsole>True</Externalconsole>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.ServiceModel" />
+ <Reference Include="System.Xml" />
+ <Reference Include="System.Runtime.Serialization" />
+ <Reference Include="System.Web.Services" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="AssemblyInfo.cs" />
+ <Compile Include="ExportUtil.cs" />
+ <Compile Include="MetadataSamples.cs" />
+ <Compile Include="TestContext.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+</Project>
\ No newline at end of file
--- /dev/null
+//
+// Testcases.cs
+//
+// Author:
+// Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Net;
+using System.Xml;
+using System.Text;
+using System.Collections.Generic;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+using NUnit.Framework;
+using NUnit.Framework.Constraints;
+using NUnit.Framework.SyntaxHelpers;
+
+using WS = System.Web.Services.Description;
+
+namespace MonoTests.System.ServiceModel.MetadataTests {
+
+ /*
+ * This class is abstract to allow it to be run multiple times with
+ * different TestContexts.
+ */
+ [Category ("MetadataTests")]
+ public abstract class ImportTests {
+
+ public abstract TestContext Context {
+ get;
+ }
+
+ protected MetadataSet GetMetadata (string name, out TestLabel label)
+ {
+ label = new TestLabel (name);
+ return Context.GetMetadata (name);
+ }
+
+ [Test]
+ public virtual void BasicHttp ()
+ {
+ TestLabel label;
+ var doc = GetMetadata ("BasicHttp", out label);
+
+ BindingTestAssertions.BasicHttpBinding (
+ Context, doc, BasicHttpSecurityMode.None, label);
+ }
+
+ [Test]
+ public virtual void BasicHttp_TransportSecurity ()
+ {
+ TestLabel label;
+ var doc = GetMetadata ("BasicHttp_TransportSecurity", out label);
+
+ BindingTestAssertions.BasicHttpBinding (
+ Context, doc, BasicHttpSecurityMode.Transport, label);
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public virtual void BasicHttp_MessageSecurity ()
+ {
+ TestLabel label;
+ var doc = GetMetadata ("BasicHttp_MessageSecurity", out label);
+
+ BindingTestAssertions.BasicHttpBinding (
+ Context, doc, BasicHttpSecurityMode.Message, label);
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public virtual void BasicHttp_TransportWithMessageCredential ()
+ {
+ TestLabel label;
+ var doc = GetMetadata ("BasicHttp_TransportWithMessageCredential", out label);
+
+ BindingTestAssertions.BasicHttpBinding (
+ Context, doc, BasicHttpSecurityMode.TransportWithMessageCredential, label);
+ }
+
+ [Test]
+ public virtual void BasicHttp_Mtom ()
+ {
+ TestLabel label;
+ var doc = GetMetadata ("BasicHttp_Mtom", out label);
+
+ BindingTestAssertions.BasicHttpBinding (
+ Context, doc, WSMessageEncoding.Mtom, label);
+ }
+
+ [Test]
+ public virtual void BasicHttp_NtlmAuth ()
+ {
+ TestLabel label;
+ var doc = GetMetadata ("BasicHttp_NtlmAuth", out label);
+
+ BindingTestAssertions.BasicHttpBinding (
+ Context, doc, BasicHttpSecurityMode.TransportCredentialOnly,
+ WSMessageEncoding.Text, HttpClientCredentialType.Ntlm,
+ AuthenticationSchemes.Ntlm, label);
+ }
+
+#if NET_4_5
+ [Test]
+ public virtual void BasicHttps ()
+ {
+ TestLabel label;
+ var doc = GetMetadata ("BasicHttps", out label);
+
+ BindingTestAssertions.BasicHttpsBinding (
+ Context, doc, BasicHttpSecurityMode.Transport, WSMessageEncoding.Text,
+ HttpClientCredentialType.None, AuthenticationSchemes.Anonymous,
+ label);
+ }
+
+ [Test]
+ public virtual void BasicHttps_NtlmAuth ()
+ {
+ TestLabel label;
+ var doc = GetMetadata ("BasicHttps_NtlmAuth", out label);
+
+ BindingTestAssertions.BasicHttpsBinding (
+ Context, doc, BasicHttpSecurityMode.Transport, WSMessageEncoding.Text,
+ HttpClientCredentialType.Ntlm, AuthenticationSchemes.Ntlm,
+ label);
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public virtual void BasicHttps_Certificate ()
+ {
+ TestLabel label;
+ var doc = GetMetadata ("BasicHttps_Certificate", out label);
+
+ BindingTestAssertions.BasicHttpsBinding (
+ Context, doc, BasicHttpSecurityMode.Transport, WSMessageEncoding.Text,
+ HttpClientCredentialType.Certificate, AuthenticationSchemes.Anonymous,
+ label);
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public virtual void BasicHttps_TransportWithMessageCredential ()
+ {
+ TestLabel label;
+ var doc = GetMetadata ("BasicHttps_TransportWithMessageCredential", out label);
+
+ BindingTestAssertions.BasicHttpsBinding (
+ Context, doc, BasicHttpSecurityMode.TransportWithMessageCredential,
+ WSMessageEncoding.Text, HttpClientCredentialType.None,
+ AuthenticationSchemes.Anonymous, label);
+ }
+#endif
+
+ [Test]
+ public virtual void NetTcp ()
+ {
+ TestLabel label;
+ var doc = GetMetadata ("NetTcp", out label);
+
+ BindingTestAssertions.NetTcpBinding (
+ Context, doc, SecurityMode.None, false, TransferMode.Buffered, label);
+ }
+
+ [Test]
+ public virtual void NetTcp_TransferMode ()
+ {
+ TestLabel label;
+ var doc = GetMetadata ("NetTcp_TransferMode", out label);
+
+ BindingTestAssertions.NetTcpBinding (
+ Context, doc, SecurityMode.None, false,
+ TransferMode.Streamed, label);
+ }
+
+ [Test]
+ public virtual void NetTcp_TransportSecurity ()
+ {
+ TestLabel label;
+ var doc = GetMetadata ("NetTcp_TransportSecurity", out label);
+
+ BindingTestAssertions.NetTcpBinding (
+ Context, doc, SecurityMode.Transport, false,
+ TransferMode.Buffered, label);
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public virtual void NetTcp_MessageSecurity ()
+ {
+ TestLabel label;
+ var doc = GetMetadata ("NetTcp_MessageSecurity", out label);
+
+ BindingTestAssertions.NetTcpBinding (
+ Context, doc, SecurityMode.Message, false,
+ TransferMode.Buffered, label);
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public virtual void NetTcp_TransportWithMessageCredential ()
+ {
+ TestLabel label;
+ var doc = GetMetadata ("NetTcp_TransportWithMessageCredential", out label);
+
+ BindingTestAssertions.NetTcpBinding (
+ Context, doc, SecurityMode.TransportWithMessageCredential, false,
+ TransferMode.Buffered, label);
+ }
+
+ [Test]
+ public virtual void NetTcp_Binding ()
+ {
+ var label = new TestLabel ("NetTcp_Binding");
+
+ label.EnterScope ("None");
+ BindingTestAssertions.CheckNetTcpBinding (
+ new NetTcpBinding (SecurityMode.None), SecurityMode.None,
+ false, TransferMode.Buffered, label);
+ label.LeaveScope ();
+
+ label.EnterScope ("Transport");
+ BindingTestAssertions.CheckNetTcpBinding (
+ new NetTcpBinding (SecurityMode.Transport), SecurityMode.Transport,
+ false, TransferMode.Buffered, label);
+ label.LeaveScope ();
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public virtual void NetTcp_Binding2 ()
+ {
+ var label = new TestLabel ("NetTcp_Binding2");
+
+ label.EnterScope ("TransportWithMessageCredential");
+ BindingTestAssertions.CheckNetTcpBinding (
+ new NetTcpBinding (SecurityMode.TransportWithMessageCredential),
+ SecurityMode.TransportWithMessageCredential, false,
+ TransferMode.Buffered, label);
+ label.LeaveScope ();
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public virtual void NetTcp_ReliableSession ()
+ {
+ TestLabel label;
+ var doc = GetMetadata ("NetTcp_ReliableSession", out label);
+
+ BindingTestAssertions.NetTcpBinding (
+ Context, doc, SecurityMode.None, true,
+ TransferMode.Buffered, label);
+ }
+
+ [Test]
+ public virtual void BasicHttp_Operation ()
+ {
+ TestLabel label;
+ var doc = GetMetadata ("BasicHttp_Operation", out label);
+
+ BindingTestAssertions.TestOperation (doc, false, label);
+ }
+
+ [Test]
+ public virtual void NetTcp_Operation ()
+ {
+ TestLabel label;
+ var doc = GetMetadata ("NetTcp_Operation", out label);
+
+ BindingTestAssertions.TestOperation (doc, true, label);
+ }
+ }
+
+}
+
--- /dev/null
+//
+// ImportTests_CreateMetadata.cs
+//
+// Author:
+// Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System.ServiceModel.MetadataTests {
+
+ /*
+ * Create the metadata programmatically.
+ *
+ */
+ [TestFixture]
+ public class ImportTests_CreateMetadata : ImportTests {
+
+ public override TestContext Context {
+ get { return TestContext.CreateMetadataContext; }
+ }
+
+ }
+}
--- /dev/null
+//
+// ImportTests_LoadMetadata.cs
+//
+// Author:
+// Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Net;
+using System.Xml;
+using System.Text;
+using System.Collections.Generic;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+using NUnit.Framework;
+using NUnit.Framework.Constraints;
+using NUnit.Framework.SyntaxHelpers;
+
+namespace MonoTests.System.ServiceModel.MetadataTests {
+
+ /*
+ * Load the metadata from a file / embedded resource.
+ *
+ */
+ [TestFixture]
+ public class ImportTests_LoadMetadata : ImportTests {
+
+ public override TestContext Context {
+ get { return TestContext.LoadMetadataContext; }
+ }
+
+ [Test]
+ public virtual void BasicHttp_Mtom_EmbeddedPolicy ()
+ {
+ TestLabel label;
+ var doc = GetMetadata ("BasicHttp_Mtom_EmbeddedPolicy", out label);
+
+ BindingTestAssertions.BasicHttpBinding (
+ Context, doc, WSMessageEncoding.Mtom, label);
+ }
+ }
+}
--- /dev/null
+//
+// ImportTests_RoundTrip.cs
+//
+// Author:
+// Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System.ServiceModel.MetadataTests {
+
+ /*
+ * Export the metadata into a string, then import it back.
+ *
+ * This tests both the WsdlExporter and the WsdlImporter.
+ *
+ */
+ [TestFixture]
+ public class ImportTests_RoundTrip : ImportTests {
+
+ public override TestContext Context {
+ get { return TestContext.RoundTripContext; }
+ }
+
+ }
+}
--- /dev/null
+//
+// MetadataProvider.cs
+//
+// Author:
+// Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using System.IO;
+using System.Reflection;
+using System.ServiceModel;
+using System.ServiceModel.Security;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+using System.ServiceModel.Configuration;
+using WS = System.Web.Services.Description;
+
+namespace MonoTests.System.ServiceModel.MetadataTests {
+
+ public static class MetadataSamples {
+
+ internal const string HttpUri = "http://tempuri.org/TestHttp/";
+ internal const string HttpsUri = "https://tempuri.org/TestHttps/";
+ internal const string NetTcpUri = "net-tcp://tempuri.org:8000/TestNetTcp/";
+ internal const string CustomUri = "custom://tempuri.org:8000/Test/";
+
+ [MetadataSample]
+ public static MetadataSet BasicHttp ()
+ {
+ var exporter = new WsdlExporter ();
+
+ var cd = new ContractDescription ("MyContract");
+
+ exporter.ExportEndpoint (new ServiceEndpoint (
+ cd, new BasicHttpBinding (), new EndpointAddress (HttpUri)));
+
+ return exporter.GetGeneratedMetadata ();
+ }
+
+ [MetadataSample]
+ public static MetadataSet BasicHttp_TransportSecurity ()
+ {
+ var exporter = new WsdlExporter ();
+
+ var cd = new ContractDescription ("MyContract");
+
+ var binding = new BasicHttpBinding ();
+ binding.Security.Mode = BasicHttpSecurityMode.Transport;
+
+ exporter.ExportEndpoint (new ServiceEndpoint (
+ cd, binding, new EndpointAddress (HttpUri)));
+
+ return exporter.GetGeneratedMetadata ();
+ }
+
+ [MetadataSample]
+ public static MetadataSet BasicHttp_MessageSecurity ()
+ {
+ var exporter = new WsdlExporter ();
+
+ var cd = new ContractDescription ("MyContract");
+
+ var binding = new BasicHttpBinding ();
+ binding.Security.Mode = BasicHttpSecurityMode.Message;
+ binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.Certificate;
+
+ exporter.ExportEndpoint (new ServiceEndpoint (
+ cd, binding, new EndpointAddress (HttpUri)));
+
+ return exporter.GetGeneratedMetadata ();
+ }
+
+ [MetadataSample]
+ public static MetadataSet BasicHttp_TransportWithMessageCredential ()
+ {
+ var exporter = new WsdlExporter ();
+
+ var cd = new ContractDescription ("MyContract");
+
+ var binding = new BasicHttpBinding ();
+ binding.Security.Mode = BasicHttpSecurityMode.TransportWithMessageCredential;
+
+ exporter.ExportEndpoint (new ServiceEndpoint (
+ cd, binding, new EndpointAddress (HttpUri)));
+
+ return exporter.GetGeneratedMetadata ();
+ }
+
+ [MetadataSample]
+ public static MetadataSet BasicHttp_Mtom ()
+ {
+ var exporter = new WsdlExporter ();
+
+ var cd = new ContractDescription ("MyContract");
+
+ var binding = new BasicHttpBinding ();
+ binding.MessageEncoding = WSMessageEncoding.Mtom;
+
+ exporter.ExportEndpoint (new ServiceEndpoint (
+ cd, binding, new EndpointAddress (HttpUri)));
+
+ return exporter.GetGeneratedMetadata ();
+ }
+
+ [MetadataSample]
+ public static MetadataSet BasicHttp_NtlmAuth ()
+ {
+ var exporter = new WsdlExporter ();
+
+ var cd = new ContractDescription ("MyContract");
+
+ var binding = new BasicHttpBinding (BasicHttpSecurityMode.TransportCredentialOnly);
+ binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm;
+
+ exporter.ExportEndpoint (new ServiceEndpoint (
+ cd, binding, new EndpointAddress (HttpUri)));
+
+ return exporter.GetGeneratedMetadata ();
+ }
+
+#if NET_4_5
+ [MetadataSample]
+ public static MetadataSet BasicHttps ()
+ {
+ var exporter = new WsdlExporter ();
+
+ var cd = new ContractDescription ("MyContract");
+
+ exporter.ExportEndpoint (new ServiceEndpoint (
+ cd, new BasicHttpsBinding (), new EndpointAddress (HttpsUri)));
+
+ return exporter.GetGeneratedMetadata ();
+ }
+
+ [MetadataSample]
+ public static MetadataSet BasicHttps_NtlmAuth ()
+ {
+ var exporter = new WsdlExporter ();
+
+ var cd = new ContractDescription ("MyContract");
+
+ var binding = new BasicHttpsBinding ();
+
+ binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm;
+
+ exporter.ExportEndpoint (new ServiceEndpoint (
+ cd, binding, new EndpointAddress (HttpsUri)));
+
+ return exporter.GetGeneratedMetadata ();
+ }
+
+ [MetadataSample]
+ public static MetadataSet BasicHttps_Certificate ()
+ {
+ var exporter = new WsdlExporter ();
+
+ var cd = new ContractDescription ("MyContract");
+
+ var binding = new BasicHttpsBinding ();
+ binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;
+
+ exporter.ExportEndpoint (new ServiceEndpoint (
+ cd, binding, new EndpointAddress (HttpsUri)));
+
+ return exporter.GetGeneratedMetadata ();
+ }
+
+ [MetadataSample]
+ public static MetadataSet BasicHttps_TransportWithMessageCredential ()
+ {
+ var exporter = new WsdlExporter ();
+
+ var cd = new ContractDescription ("MyContract");
+
+ var binding = new BasicHttpsBinding (BasicHttpsSecurityMode.TransportWithMessageCredential);
+
+ exporter.ExportEndpoint (new ServiceEndpoint (
+ cd, binding, new EndpointAddress (HttpsUri)));
+
+ return exporter.GetGeneratedMetadata ();
+ }
+#endif
+
+ [MetadataSample]
+ public static MetadataSet NetTcp ()
+ {
+ var exporter = new WsdlExporter ();
+
+ var cd = new ContractDescription ("MyContract");
+
+ exporter.ExportEndpoint (new ServiceEndpoint (
+ cd, new NetTcpBinding (SecurityMode.None, false),
+ new EndpointAddress (NetTcpUri)));
+
+ return exporter.GetGeneratedMetadata ();
+ }
+
+ [MetadataSample]
+ public static MetadataSet NetTcp_TransportSecurity ()
+ {
+ var exporter = new WsdlExporter ();
+
+ var cd = new ContractDescription ("MyContract");
+
+ exporter.ExportEndpoint (new ServiceEndpoint (
+ cd, new NetTcpBinding (SecurityMode.Transport, false),
+ new EndpointAddress (NetTcpUri)));
+
+ return exporter.GetGeneratedMetadata ();
+ }
+
+ [MetadataSample]
+ public static MetadataSet NetTcp_MessageSecurity ()
+ {
+ var exporter = new WsdlExporter ();
+
+ var cd = new ContractDescription ("MyContract");
+
+ exporter.ExportEndpoint (new ServiceEndpoint (
+ cd, new NetTcpBinding (SecurityMode.Message, false),
+ new EndpointAddress (NetTcpUri)));
+
+ return exporter.GetGeneratedMetadata ();
+ }
+
+ [MetadataSample]
+ public static MetadataSet NetTcp_TransportWithMessageCredential ()
+ {
+ var exporter = new WsdlExporter ();
+
+ var cd = new ContractDescription ("MyContract");
+
+ exporter.ExportEndpoint (new ServiceEndpoint (
+ cd, new NetTcpBinding (SecurityMode.TransportWithMessageCredential, false),
+ new EndpointAddress (NetTcpUri)));
+
+ return exporter.GetGeneratedMetadata ();
+ }
+
+ [MetadataSample]
+ public static MetadataSet NetTcp_ReliableSession ()
+ {
+ var exporter = new WsdlExporter ();
+
+ var cd = new ContractDescription ("MyContract");
+
+ var binding = new NetTcpBinding (SecurityMode.None, true);
+
+ exporter.ExportEndpoint (new ServiceEndpoint (
+ cd, binding, new EndpointAddress (NetTcpUri)));
+
+ return exporter.GetGeneratedMetadata ();
+ }
+
+ [MetadataSample]
+ public static MetadataSet NetTcp_TransferMode ()
+ {
+ var exporter = new WsdlExporter ();
+
+ var cd = new ContractDescription ("MyContract");
+
+ var binding = new NetTcpBinding (SecurityMode.None, false);
+ binding.TransferMode = TransferMode.Streamed;
+
+ exporter.ExportEndpoint (new ServiceEndpoint (
+ cd, binding, new EndpointAddress (NetTcpUri)));
+
+ return exporter.GetGeneratedMetadata ();
+ }
+
+ [ServiceContract]
+ public interface IMyContract {
+ [OperationContract]
+ void Hello ();
+ }
+
+ [MetadataSample]
+ public static MetadataSet BasicHttp_Operation ()
+ {
+ var exporter = new WsdlExporter ();
+
+ var cd = ContractDescription.GetContract (typeof (IMyContract));
+
+ var binding = new BasicHttpBinding ();
+
+ exporter.ExportEndpoint (new ServiceEndpoint (
+ cd, binding, new EndpointAddress (HttpUri)));
+
+ return exporter.GetGeneratedMetadata ();
+ }
+
+ [MetadataSample]
+ public static MetadataSet NetTcp_Operation ()
+ {
+ var exporter = new WsdlExporter ();
+
+ var cd = ContractDescription.GetContract (typeof (IMyContract));
+
+ exporter.ExportEndpoint (new ServiceEndpoint (
+ cd, new NetTcpBinding (SecurityMode.None, false),
+ new EndpointAddress (NetTcpUri)));
+
+ return exporter.GetGeneratedMetadata ();
+ }
+
+ #region Helper API
+
+ public static void Export ()
+ {
+ var bf = BindingFlags.Public | BindingFlags.Static;
+ foreach (var method in typeof (MetadataSamples).GetMethods (bf)) {
+ MetadataSampleAttribute sampleAttr = null;
+ foreach (var obj in method.GetCustomAttributes (false)) {
+ var cattr = obj as MetadataSampleAttribute;
+ if (cattr != null) {
+ sampleAttr = cattr;
+ break;
+ }
+ }
+
+ if (sampleAttr == null)
+ continue;
+
+ var name = sampleAttr.Name ?? method.Name;
+ var doc = (MetadataSet)method.Invoke (null, null);
+ TestContext.SaveMetadata (name, doc);
+ }
+ }
+
+ public static MetadataSet GetMetadataByName (string name)
+ {
+ if (name.EndsWith (".xml"))
+ name = name.Substring (name.Length - 4);
+
+ var bf = BindingFlags.Public | BindingFlags.Static;
+ foreach (var method in typeof (MetadataSamples).GetMethods (bf)) {
+ MetadataSampleAttribute sampleAttr = null;
+ foreach (var obj in method.GetCustomAttributes (false)) {
+ var cattr = obj as MetadataSampleAttribute;
+ if (cattr != null) {
+ sampleAttr = cattr;
+ break;
+ }
+ }
+
+ if (sampleAttr == null)
+ continue;
+
+ if (!name.Equals (sampleAttr.Name ?? method.Name))
+ continue;
+
+ return (MetadataSet)method.Invoke (null, null);
+ }
+
+ throw new InvalidOperationException ();
+ }
+
+ public class MetadataSampleAttribute : Attribute {
+
+ public MetadataSampleAttribute ()
+ {
+ }
+
+ public MetadataSampleAttribute (string name)
+ {
+ Name = name;
+ }
+
+ public string Name {
+ get; set;
+ }
+
+ }
+
+ #endregion
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>10.0.0</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{7731D464-5152-4A1B-AACB-6B5A7CA9ACAA}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <RootNamespace>MetadataTests</RootNamespace>
+ <AssemblyName>MetadataTests</AssemblyName>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>True</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>False</Optimize>
+ <OutputPath>bin\Debug</OutputPath>
+ <DefineConstants>DEBUG;USE_EMBEDDED_METADATA;NET_4_5</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <ConsolePause>False</ConsolePause>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>none</DebugType>
+ <Optimize>True</Optimize>
+ <OutputPath>bin\Release</OutputPath>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <ConsolePause>False</ConsolePause>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="nunit.framework" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Runtime.Serialization" />
+ <Reference Include="System.ServiceModel" />
+ <Reference Include="System.Web.Services" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="AssemblyInfo.cs" />
+ <Compile Include="BindingTestAssertions.cs" />
+ <Compile Include="MetadataSamples.cs" />
+ <Compile Include="TestContext.cs" />
+ <Compile Include="TestLabel.cs" />
+ <Compile Include="MiscImportTests.cs" />
+ <Compile Include="ImportTests.cs" />
+ <Compile Include="ImportTests_LoadMetadata.cs" />
+ <Compile Include="ImportTests_CreateMetadata.cs" />
+ <Compile Include="ImportTests_RoundTrip.cs" />
+ <Compile Include="ExportTests.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <ItemGroup>
+ <None Include="README.txt" />
+ <None Include="Resources\BasicHttp_Operation.xml" />
+ <None Include="Resources\NetTcp_Operation.xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Folder Include="Resources\" />
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="Resources\BasicHttp.xml" />
+ <EmbeddedResource Include="Resources\BasicHttp_MessageSecurity.xml" />
+ <EmbeddedResource Include="Resources\BasicHttp_Mtom.xml" />
+ <EmbeddedResource Include="Resources\BasicHttp_NtlmAuth.xml" />
+ <EmbeddedResource Include="Resources\BasicHttp_TransportSecurity.xml" />
+ <EmbeddedResource Include="Resources\BasicHttp_TransportWithMessageCredential.xml" />
+ <EmbeddedResource Include="Resources\BasicHttps.xml" />
+ <EmbeddedResource Include="Resources\BasicHttps_Certificate.xml" />
+ <EmbeddedResource Include="Resources\BasicHttps_NtlmAuth.xml" />
+ <EmbeddedResource Include="Resources\BasicHttps_TransportWithMessageCredential.xml" />
+ <EmbeddedResource Include="Resources\NetTcp.xml" />
+ <EmbeddedResource Include="Resources\NetTcp_MessageSecurity.xml" />
+ <EmbeddedResource Include="Resources\NetTcp_ReliableSession.xml" />
+ <EmbeddedResource Include="Resources\NetTcp_TransferMode.xml" />
+ <EmbeddedResource Include="Resources\NetTcp_TransportSecurity.xml" />
+ <EmbeddedResource Include="Resources\NetTcp_TransportWithMessageCredential.xml" />
+ <EmbeddedResource Include="Resources\http-error.xml" />
+ <EmbeddedResource Include="Resources\BasicHttp_Mtom_EmbeddedPolicy.xml" />
+ </ItemGroup>
+</Project>
\ No newline at end of file
--- /dev/null
+\r
+Microsoft Visual Studio Solution File, Format Version 11.00\r
+# Visual Studio 2010\r
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MetadataTests", "MetadataTests.csproj", "{7731D464-5152-4A1B-AACB-6B5A7CA9ACAA}"\r
+EndProject\r
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExportUtil", "ExportUtil.csproj", "{D4C1B0BD-3488-441C-92B9-7E017041E137}"\r
+EndProject\r
+Global\r
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
+ Debug|Any CPU = Debug|Any CPU\r
+ Release|Any CPU = Release|Any CPU\r
+ EndGlobalSection\r
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
+ {7731D464-5152-4A1B-AACB-6B5A7CA9ACAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {7731D464-5152-4A1B-AACB-6B5A7CA9ACAA}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {7731D464-5152-4A1B-AACB-6B5A7CA9ACAA}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {7731D464-5152-4A1B-AACB-6B5A7CA9ACAA}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {D4C1B0BD-3488-441C-92B9-7E017041E137}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {D4C1B0BD-3488-441C-92B9-7E017041E137}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {D4C1B0BD-3488-441C-92B9-7E017041E137}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {D4C1B0BD-3488-441C-92B9-7E017041E137}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ EndGlobalSection\r
+ GlobalSection(MonoDevelopProperties) = preSolution\r
+ StartupItem = MetadataTests.csproj\r
+ EndGlobalSection\r
+EndGlobal\r
--- /dev/null
+//
+// Test_Misc.cs
+//
+// Author:
+// Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Net;
+using System.Xml;
+using System.Text;
+using System.Collections.Generic;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+using NUnit.Framework;
+using NUnit.Framework.Constraints;
+using NUnit.Framework.SyntaxHelpers;
+
+using WS = System.Web.Services.Description;
+
+namespace MonoTests.System.ServiceModel.MetadataTests {
+
+ public class MiscImportTests {
+
+ [Test]
+ public void BasicHttpBinding_ImportBinding ()
+ {
+ var label = new TestLabel ("BasicHttpBinding_ImportBinding");
+
+ var doc = TestContext.LoadMetadata ("BasicHttp");
+ var sd = (WS.ServiceDescription)doc.MetadataSections [0].Metadata;
+ var wsdlBinding = sd.Bindings [0];
+
+ var importer = new WsdlImporter (doc);
+
+ Assert.That (sd.Bindings, Is.Not.Null, label.Get ());
+ Assert.That (sd.Bindings.Count, Is.EqualTo (1), label.Get ());
+
+ var binding = importer.ImportBinding (wsdlBinding);
+ BindingTestAssertions.CheckImportErrors (importer, label);
+ Assert.That (binding, Is.Not.Null, label.Get ());
+ }
+
+ [Test]
+ public void BasicHttpBinding_ImportEndpoint ()
+ {
+ var label = new TestLabel ("BasicHttpBinding_ImportEndpoint");
+
+ var doc = TestContext.LoadMetadata ("BasicHttp");
+ var sd = (WS.ServiceDescription)doc.MetadataSections [0].Metadata;
+
+ label.EnterScope ("wsdl");
+ Assert.That (sd.Services, Is.Not.Null, label.Get ());
+ Assert.That (sd.Services.Count, Is.EqualTo (1), label.Get ());
+
+ var service = sd.Services [0];
+ Assert.That (service.Ports, Is.Not.Null, label.Get ());
+ Assert.That (service.Ports.Count, Is.EqualTo (1), label.Get ());
+ label.LeaveScope ();
+
+ var importer = new WsdlImporter (doc);
+
+ var port = importer.ImportEndpoint (service.Ports [0]);
+ BindingTestAssertions.CheckImportErrors (importer, label);
+ Assert.That (port, Is.Not.Null, label.Get ());
+ }
+
+ [Test]
+ public void BasicHttpBinding_Error ()
+ {
+ var label = new TestLabel ("BasicHttpBinding_Error");
+
+ var doc = TestContext.LoadMetadata ("http-error.xml");
+ var sd = (WS.ServiceDescription)doc.MetadataSections [0].Metadata;
+ var wsdlBinding = sd.Bindings [0];
+
+ var importer = new WsdlImporter (doc);
+
+ label.EnterScope ("all");
+
+ var bindings = importer.ImportAllBindings ();
+ Assert.That (bindings, Is.Not.Null, label.Get ());
+ Assert.That (bindings.Count, Is.EqualTo (0), label.Get ());
+
+ label.EnterScope ("errors");
+ Assert.That (importer.Errors, Is.Not.Null, label.Get ());
+ Assert.That (importer.Errors.Count, Is.EqualTo (1), label.Get ());
+
+ var error = importer.Errors [0];
+ Assert.That (error.IsWarning, Is.False, label.Get ());
+ label.LeaveScope ();
+ label.LeaveScope ();
+
+ label.EnterScope ("single");
+
+ try {
+ importer.ImportBinding (wsdlBinding);
+ Assert.Fail (label.Get ());
+ } catch {
+ ;
+ }
+
+ Assert.That (importer.Errors.Count, Is.EqualTo (1), label.Get ());
+
+ label.LeaveScope ();
+
+ label.EnterScope ("single-first");
+
+ var importer2 = new WsdlImporter (doc);
+
+ try {
+ importer2.ImportBinding (wsdlBinding);
+ Assert.Fail (label.Get ());
+ } catch {
+ ;
+ }
+
+ Assert.That (importer2.Errors.Count, Is.EqualTo (1), label.Get ());
+
+ try {
+ importer2.ImportBinding (wsdlBinding);
+ Assert.Fail (label.Get ());
+ } catch {
+ ;
+ }
+
+ var bindings2 = importer.ImportAllBindings ();
+ Assert.That (bindings2, Is.Not.Null, label.Get ());
+ Assert.That (bindings2.Count, Is.EqualTo (0), label.Get ());
+
+ label.LeaveScope ();
+ }
+
+ [Test]
+ public void BasicHttpBinding_Error2 ()
+ {
+ var label = new TestLabel ("BasicHttpBinding_Error2");
+
+ var doc = TestContext.LoadMetadata ("http-error.xml");
+ var sd = (WS.ServiceDescription)doc.MetadataSections [0].Metadata;
+
+ label.EnterScope ("wsdl");
+ Assert.That (sd.Services, Is.Not.Null, label.Get ());
+ Assert.That (sd.Services.Count, Is.EqualTo (1), label.Get ());
+
+ var service = sd.Services [0];
+ Assert.That (service.Ports, Is.Not.Null, label.Get ());
+ Assert.That (service.Ports.Count, Is.EqualTo (1), label.Get ());
+ label.LeaveScope ();
+
+ var importer = new WsdlImporter (doc);
+
+ label.EnterScope ("all");
+
+ var endpoints = importer.ImportAllEndpoints ();
+ Assert.That (endpoints, Is.Not.Null, label.Get ());
+ Assert.That (endpoints.Count, Is.EqualTo (0), label.Get ());
+
+ label.EnterScope ("errors");
+ Assert.That (importer.Errors, Is.Not.Null, label.Get ());
+ Assert.That (importer.Errors.Count, Is.EqualTo (2), label.Get ());
+
+ Assert.That (importer.Errors [0].IsWarning, Is.False, label.Get ());
+ Assert.That (importer.Errors [1].IsWarning, Is.False, label.Get ());
+ label.LeaveScope ();
+ label.LeaveScope ();
+
+ label.EnterScope ("single");
+
+ try {
+ importer.ImportEndpoint (service.Ports [0]);
+ Assert.Fail (label.Get ());
+ } catch {
+ ;
+ }
+
+ Assert.That (importer.Errors.Count, Is.EqualTo (2), label.Get ());
+
+ label.LeaveScope ();
+
+ label.EnterScope ("single-first");
+
+ var importer2 = new WsdlImporter (doc);
+
+ try {
+ importer2.ImportEndpoint (service.Ports [0]);
+ Assert.Fail (label.Get ());
+ } catch {
+ ;
+ }
+
+ Assert.That (importer2.Errors.Count, Is.EqualTo (2), label.Get ());
+
+ try {
+ importer2.ImportEndpoint (service.Ports [0]);
+ Assert.Fail (label.Get ());
+ } catch {
+ ;
+ }
+
+ var endpoints2 = importer.ImportAllEndpoints ();
+ Assert.That (endpoints2, Is.Not.Null, label.Get ());
+ Assert.That (endpoints2.Count, Is.EqualTo (0), label.Get ());
+
+ label.LeaveScope ();
+ }
+
+ [Test]
+ public void BasicHttpBinding_ImportEndpoints ()
+ {
+ var label = new TestLabel ("BasicHttpBinding_ImportEndpoints");
+
+ var doc = TestContext.LoadMetadata ("BasicHttp");
+ var sd = (WS.ServiceDescription)doc.MetadataSections [0].Metadata;
+
+ label.EnterScope ("wsdl");
+ Assert.That (sd.Bindings, Is.Not.Null, label.Get ());
+ Assert.That (sd.Bindings.Count, Is.EqualTo (1), label.Get ());
+ var binding = sd.Bindings [0];
+
+ Assert.That (sd.Services, Is.Not.Null, label.Get ());
+ Assert.That (sd.Services.Count, Is.EqualTo (1), label.Get ());
+ var service = sd.Services [0];
+
+ Assert.That (service.Ports, Is.Not.Null, label.Get ());
+ Assert.That (service.Ports.Count, Is.EqualTo (1), label.Get ());
+ var port = service.Ports [0];
+
+ Assert.That (sd.PortTypes, Is.Not.Null, label.Get ());
+ Assert.That (sd.PortTypes.Count, Is.EqualTo (1), label.Get ());
+ var portType = sd.PortTypes [0];
+
+ label.LeaveScope ();
+
+ var importer = new WsdlImporter (doc);
+
+ label.EnterScope ("by-service");
+ var byService = importer.ImportEndpoints (service);
+ BindingTestAssertions.CheckImportErrors (importer, label);
+ Assert.That (byService, Is.Not.Null, label.Get ());
+ Assert.That (byService.Count, Is.EqualTo (1), label.Get ());
+ label.LeaveScope ();
+
+ label.EnterScope ("by-binding");
+ var byBinding = importer.ImportEndpoints (binding);
+ BindingTestAssertions.CheckImportErrors (importer, label);
+ Assert.That (byBinding, Is.Not.Null, label.Get ());
+ Assert.That (byBinding.Count, Is.EqualTo (1), label.Get ());
+ label.LeaveScope ();
+
+ label.EnterScope ("by-port-type");
+ var byPortType = importer.ImportEndpoints (portType);
+ BindingTestAssertions.CheckImportErrors (importer, label);
+ Assert.That (byPortType, Is.Not.Null, label.Get ());
+ Assert.That (byPortType.Count, Is.EqualTo (1), label.Get ());
+ label.LeaveScope ();
+ }
+
+ }
+}
+
--- /dev/null
+Metadata Tests
+==============
+
+These tests can be run either as part of System.ServiceModel_test_<profile>.dll
+or as the stand-alone MetadataTests.dll, which bundles all the XML files as
+embedded resources.
+
+Generating and updating the XML Samples:
+========================================
+
+Mono's WsdlExporter is not yet capable of generating the wsdl files that
+are used as test input here.
+
+To generate the XML files, compile the ExportUtil.exe tool either by using the
+ExportUtil.csproj or compiling it manually:
+
+ mcs -r:System.ServiceModel -r:System.Web.Services ExportUtil.cs MetadataSamples.cs TestContext.cs
+
+Then copy the binary to a Windows machine and run it there. This will generate a bunch of
+.xml files. Run dos2unix on them and copy them into the Resources/ subdirectory.
+
+Adding new Tests:
+=================
+
+To add a new test, add a method with the [MetadataaSample] attribute to
+MetadataSamples.cs, like this:
+
+ [MetadataSample]
+ public static MetadataSet MyXML ()
+ {
+ ....
+ }
+
+You may also specify a name:
+
+ [MetadataSample ("MyXML")]
+ public static MetadataSet RandomMethodName ()
+ {
+ }
+
+Re-compile ExportUtil.exe and it will produce a new 'MyXML.xml' file.
+
+Then write a new test case:
+
+ [Test]
+ public void MyXML ()
+ {
+ var doc = TestContext.GetMetadata ("MyXML");
+ ... test it here
+ }
+
+The idea behind the 'TestContext' class is to allow "self-hosting" at a
+later time, ie. use Mono's WsdlExporter to generate the metadata instead
+of loading the on-disk file without having to modify a bunch of tests.
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+ <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+ <wsdl:definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:types />
+ <wsdl:portType name="MyContract" />
+ <wsdl:binding name="BasicHttpBinding_MyContract" type="tns:MyContract">
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
+ </wsdl:binding>
+ <wsdl:service name="service">
+ <wsdl:port name="BasicHttpBinding_MyContract" binding="tns:BasicHttpBinding_MyContract">
+ <soap:address location="http://tempuri.org/TestHttp/" />
+ </wsdl:port>
+ </wsdl:service>
+ </wsdl:definitions>
+ </wsx:MetadataSection>
+</Metadata>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+ <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+ <wsdl:definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsp:Policy wsu:Id="BasicHttpBinding_MyContract_policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:InitiatorToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:WssX509V3Token10 />
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:InitiatorToken>
+ <sp:RecipientToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:WssX509V3Token10 />
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:RecipientToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256 />
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Lax />
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp />
+ <sp:OnlySignEntireHeadersAndBody />
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier />
+ <sp:MustSupportRefIssuerSerial />
+ </wsp:Policy>
+ </sp:Wss10>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ <wsdl:types />
+ <wsdl:portType name="MyContract" />
+ <wsdl:binding name="BasicHttpBinding_MyContract" type="tns:MyContract">
+ <wsp:PolicyReference URI="#BasicHttpBinding_MyContract_policy" />
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
+ </wsdl:binding>
+ <wsdl:service name="service">
+ <wsdl:port name="BasicHttpBinding_MyContract" binding="tns:BasicHttpBinding_MyContract">
+ <soap:address location="http://tempuri.org/TestHttp/" />
+ </wsdl:port>
+ </wsdl:service>
+ </wsdl:definitions>
+ </wsx:MetadataSection>
+</Metadata>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+ <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+ <wsdl:definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsp:Policy wsu:Id="BasicHttpBinding_MyContract_policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <wsoma:OptimizedMimeSerialization xmlns:wsoma="http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ <wsdl:types />
+ <wsdl:portType name="MyContract" />
+ <wsdl:binding name="BasicHttpBinding_MyContract" type="tns:MyContract">
+ <wsp:PolicyReference URI="#BasicHttpBinding_MyContract_policy" />
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
+ </wsdl:binding>
+ <wsdl:service name="service">
+ <wsdl:port name="BasicHttpBinding_MyContract" binding="tns:BasicHttpBinding_MyContract">
+ <soap:address location="http://tempuri.org/TestHttp/" />
+ </wsdl:port>
+ </wsdl:service>
+ </wsdl:definitions>
+ </wsx:MetadataSection>
+</Metadata>
\ No newline at end of file
--- /dev/null
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+ <MetadataSection Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+ <definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="service" targetNamespace="http://tempuri.org/" xmlns="http://schemas.xmlsoap.org/wsdl/">
+ <types>
+ <xs:schema xmlns:tns="http://tempuri.org/Imports" targetNamespace="http://tempuri.org/Imports" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:import namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
+ </xs:schema>
+ </types>
+ <portType name="MyContract" />
+ <binding name="BasicHttpBinding_MyContract" type="tns:MyContract">
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsp:Policy wsu:Id="BasicHttpBinding_MyContract_policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <wsoma:OptimizedMimeSerialization xmlns:wsoma="http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ </binding>
+ <service name="service">
+ <port name="BasicHttpBinding_MyContract" binding="tns:BasicHttpBinding_MyContract">
+ <soap:address location="http://tempuri.org/TestHttp/" />
+ </port>
+ </service>
+ </definitions>
+ </MetadataSection>
+ <MetadataSection Dialect="http://www.w3.org/2001/XMLSchema" Identifier="http://schemas.microsoft.com/2003/10/Serialization/">
+ <xs:schema xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="anyType" nillable="true" type="xs:anyType" />
+ <xs:element name="anyURI" nillable="true" type="xs:anyURI" />
+ <xs:element name="base64Binary" nillable="true" type="xs:base64Binary" />
+ <xs:element name="boolean" nillable="true" type="xs:boolean" />
+ <xs:element name="byte" nillable="true" type="xs:byte" />
+ <xs:element name="dateTime" nillable="true" type="xs:dateTime" />
+ <xs:element name="decimal" nillable="true" type="xs:decimal" />
+ <xs:element name="double" nillable="true" type="xs:double" />
+ <xs:element name="float" nillable="true" type="xs:float" />
+ <xs:element name="int" nillable="true" type="xs:int" />
+ <xs:element name="long" nillable="true" type="xs:long" />
+ <xs:element name="QName" nillable="true" type="xs:QName" />
+ <xs:element name="short" nillable="true" type="xs:short" />
+ <xs:element name="string" nillable="true" type="xs:string" />
+ <xs:element name="unsignedByte" nillable="true" type="xs:unsignedByte" />
+ <xs:element name="unsignedInt" nillable="true" type="xs:unsignedInt" />
+ <xs:element name="unsignedLong" nillable="true" type="xs:unsignedLong" />
+ <xs:element name="unsignedShort" nillable="true" type="xs:unsignedShort" />
+ <xs:element name="char" nillable="true" type="tns:char" />
+ <xs:simpleType name="char">
+ <xs:restriction base="xs:int" />
+ </xs:simpleType>
+ <xs:element name="duration" nillable="true" type="tns:duration" />
+ <xs:simpleType name="duration">
+ <xs:restriction base="xs:duration">
+ <xs:pattern value="\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?" />
+ <xs:minInclusive value="-P10675199DT2H48M5.4775808S" />
+ <xs:maxInclusive value="P10675199DT2H48M5.4775807S" />
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:element name="guid" nillable="true" type="tns:guid" />
+ <xs:simpleType name="guid">
+ <xs:restriction base="xs:string">
+ <xs:pattern value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}" />
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:attribute name="FactoryType" type="xs:QName" />
+ </xs:schema>
+ </MetadataSection>
+</Metadata>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+ <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+ <wsdl:definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsp:Policy wsu:Id="BasicHttpBinding_MyContract_policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <http:NtlmAuthentication xmlns:http="http://schemas.microsoft.com/ws/06/2004/policy/http" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ <wsdl:types />
+ <wsdl:portType name="MyContract" />
+ <wsdl:binding name="BasicHttpBinding_MyContract" type="tns:MyContract">
+ <wsp:PolicyReference URI="#BasicHttpBinding_MyContract_policy" />
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
+ </wsdl:binding>
+ <wsdl:service name="service">
+ <wsdl:port name="BasicHttpBinding_MyContract" binding="tns:BasicHttpBinding_MyContract">
+ <soap:address location="http://tempuri.org/TestHttp/" />
+ </wsdl:port>
+ </wsdl:service>
+ </wsdl:definitions>
+ </wsx:MetadataSection>
+</Metadata>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+ <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+ <wsdl:definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://tempuri.org/Imports">
+ <xsd:import namespace="http://tempuri.org/" />
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="IMyContract_Hello_InputMessage">
+ <wsdl:part name="parameters" element="tns:Hello" />
+ </wsdl:message>
+ <wsdl:message name="IMyContract_Hello_OutputMessage">
+ <wsdl:part name="parameters" element="tns:HelloResponse" />
+ </wsdl:message>
+ <wsdl:portType name="IMyContract">
+ <wsdl:operation name="Hello">
+ <wsdl:input wsaw:Action="http://tempuri.org/IMyContract/Hello" message="tns:IMyContract_Hello_InputMessage" />
+ <wsdl:output wsaw:Action="http://tempuri.org/IMyContract/HelloResponse" message="tns:IMyContract_Hello_OutputMessage" />
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="BasicHttpBinding_IMyContract" type="tns:IMyContract">
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="Hello">
+ <soap:operation soapAction="http://tempuri.org/IMyContract/Hello" style="document" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="service">
+ <wsdl:port name="BasicHttpBinding_IMyContract" binding="tns:BasicHttpBinding_IMyContract">
+ <soap:address location="http://tempuri.org/TestHttp/" />
+ </wsdl:port>
+ </wsdl:service>
+ </wsdl:definitions>
+ </wsx:MetadataSection>
+ <wsx:MetadataSection xmlns="" Dialect="http://www.w3.org/2001/XMLSchema" Identifier="http://tempuri.org/">
+ <xs:schema xmlns:tns="http://tempuri.org/" elementFormDefault="qualified" targetNamespace="http://tempuri.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="Hello">
+ <xs:complexType>
+ <xs:sequence />
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="HelloResponse">
+ <xs:complexType>
+ <xs:sequence />
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>
+ </wsx:MetadataSection>
+</Metadata>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+ <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+ <wsdl:definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsp:Policy wsu:Id="BasicHttpBinding_MyContract_policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:TransportToken>
+ <wsp:Policy>
+ <sp:HttpsToken RequireClientCertificate="false" />
+ </wsp:Policy>
+ </sp:TransportToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256 />
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict />
+ </wsp:Policy>
+ </sp:Layout>
+ </wsp:Policy>
+ </sp:TransportBinding>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ <wsdl:types />
+ <wsdl:portType name="MyContract" />
+ <wsdl:binding name="BasicHttpBinding_MyContract" type="tns:MyContract">
+ <wsp:PolicyReference URI="#BasicHttpBinding_MyContract_policy" />
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
+ </wsdl:binding>
+ <wsdl:service name="service">
+ <wsdl:port name="BasicHttpBinding_MyContract" binding="tns:BasicHttpBinding_MyContract">
+ <soap:address location="http://tempuri.org/TestHttp/" />
+ </wsdl:port>
+ </wsdl:service>
+ </wsdl:definitions>
+ </wsx:MetadataSection>
+</Metadata>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+ <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+ <wsdl:definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsp:Policy wsu:Id="BasicHttpBinding_MyContract_policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:TransportToken>
+ <wsp:Policy>
+ <sp:HttpsToken RequireClientCertificate="false" />
+ </wsp:Policy>
+ </sp:TransportToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256 />
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Lax />
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp />
+ </wsp:Policy>
+ </sp:TransportBinding>
+ <sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:WssUsernameToken10 />
+ </wsp:Policy>
+ </sp:UsernameToken>
+ </wsp:Policy>
+ </sp:SignedSupportingTokens>
+ <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy />
+ </sp:Wss10>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ <wsdl:types />
+ <wsdl:portType name="MyContract" />
+ <wsdl:binding name="BasicHttpBinding_MyContract" type="tns:MyContract">
+ <wsp:PolicyReference URI="#BasicHttpBinding_MyContract_policy" />
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
+ </wsdl:binding>
+ <wsdl:service name="service">
+ <wsdl:port name="BasicHttpBinding_MyContract" binding="tns:BasicHttpBinding_MyContract">
+ <soap:address location="http://tempuri.org/TestHttp/" />
+ </wsdl:port>
+ </wsdl:service>
+ </wsdl:definitions>
+ </wsx:MetadataSection>
+</Metadata>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+ <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+ <wsdl:definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsp:Policy wsu:Id="BasicHttpsBinding_MyContract_policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:TransportToken>
+ <wsp:Policy>
+ <sp:HttpsToken RequireClientCertificate="false" />
+ </wsp:Policy>
+ </sp:TransportToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256 />
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict />
+ </wsp:Policy>
+ </sp:Layout>
+ </wsp:Policy>
+ </sp:TransportBinding>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ <wsdl:types />
+ <wsdl:portType name="MyContract" />
+ <wsdl:binding name="BasicHttpsBinding_MyContract" type="tns:MyContract">
+ <wsp:PolicyReference URI="#BasicHttpsBinding_MyContract_policy" />
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
+ </wsdl:binding>
+ <wsdl:service name="service">
+ <wsdl:port name="BasicHttpsBinding_MyContract" binding="tns:BasicHttpsBinding_MyContract">
+ <soap:address location="https://tempuri.org/TestHttps/" />
+ </wsdl:port>
+ </wsdl:service>
+ </wsdl:definitions>
+ </wsx:MetadataSection>
+</Metadata>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+ <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+ <wsdl:definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsp:Policy wsu:Id="BasicHttpsBinding_MyContract_policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:TransportToken>
+ <wsp:Policy>
+ <sp:HttpsToken RequireClientCertificate="true" />
+ </wsp:Policy>
+ </sp:TransportToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256 />
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict />
+ </wsp:Policy>
+ </sp:Layout>
+ </wsp:Policy>
+ </sp:TransportBinding>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ <wsdl:types />
+ <wsdl:portType name="MyContract" />
+ <wsdl:binding name="BasicHttpsBinding_MyContract" type="tns:MyContract">
+ <wsp:PolicyReference URI="#BasicHttpsBinding_MyContract_policy" />
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
+ </wsdl:binding>
+ <wsdl:service name="service">
+ <wsdl:port name="BasicHttpsBinding_MyContract" binding="tns:BasicHttpsBinding_MyContract">
+ <soap:address location="https://tempuri.org/TestHttps/" />
+ </wsdl:port>
+ </wsdl:service>
+ </wsdl:definitions>
+ </wsx:MetadataSection>
+</Metadata>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+ <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+ <wsdl:definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsp:Policy wsu:Id="BasicHttpsBinding_MyContract_policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <http:NtlmAuthentication xmlns:http="http://schemas.microsoft.com/ws/06/2004/policy/http" />
+ <sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:TransportToken>
+ <wsp:Policy>
+ <sp:HttpsToken RequireClientCertificate="false" />
+ </wsp:Policy>
+ </sp:TransportToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256 />
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict />
+ </wsp:Policy>
+ </sp:Layout>
+ </wsp:Policy>
+ </sp:TransportBinding>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ <wsdl:types />
+ <wsdl:portType name="MyContract" />
+ <wsdl:binding name="BasicHttpsBinding_MyContract" type="tns:MyContract">
+ <wsp:PolicyReference URI="#BasicHttpsBinding_MyContract_policy" />
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
+ </wsdl:binding>
+ <wsdl:service name="service">
+ <wsdl:port name="BasicHttpsBinding_MyContract" binding="tns:BasicHttpsBinding_MyContract">
+ <soap:address location="https://tempuri.org/TestHttps/" />
+ </wsdl:port>
+ </wsdl:service>
+ </wsdl:definitions>
+ </wsx:MetadataSection>
+</Metadata>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+ <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+ <wsdl:definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsp:Policy wsu:Id="BasicHttpsBinding_MyContract_policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:TransportToken>
+ <wsp:Policy>
+ <sp:HttpsToken RequireClientCertificate="false" />
+ </wsp:Policy>
+ </sp:TransportToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256 />
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Lax />
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp />
+ </wsp:Policy>
+ </sp:TransportBinding>
+ <sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:WssUsernameToken10 />
+ </wsp:Policy>
+ </sp:UsernameToken>
+ </wsp:Policy>
+ </sp:SignedSupportingTokens>
+ <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy />
+ </sp:Wss10>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ <wsdl:types />
+ <wsdl:portType name="MyContract" />
+ <wsdl:binding name="BasicHttpsBinding_MyContract" type="tns:MyContract">
+ <wsp:PolicyReference URI="#BasicHttpsBinding_MyContract_policy" />
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
+ </wsdl:binding>
+ <wsdl:service name="service">
+ <wsdl:port name="BasicHttpsBinding_MyContract" binding="tns:BasicHttpsBinding_MyContract">
+ <soap:address location="https://tempuri.org/TestHttps/" />
+ </wsdl:port>
+ </wsdl:service>
+ </wsdl:definitions>
+ </wsx:MetadataSection>
+</Metadata>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+ <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+ <wsdl:definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsp:Policy wsu:Id="NetTcpBinding_MyContract_policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <msb:BinaryEncoding xmlns:msb="http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1" />
+ <wsaw:UsingAddressing />
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ <wsdl:types />
+ <wsdl:portType name="MyContract" />
+ <wsdl:binding name="NetTcpBinding_MyContract" type="tns:MyContract">
+ <wsp:PolicyReference URI="#NetTcpBinding_MyContract_policy" />
+ <soap12:binding transport="http://schemas.microsoft.com/soap/tcp" />
+ </wsdl:binding>
+ <wsdl:service name="service">
+ <wsdl:port name="NetTcpBinding_MyContract" binding="tns:NetTcpBinding_MyContract">
+ <soap12:address location="net-tcp://tempuri.org:8000/TestNetTcp/" />
+ <wsa10:EndpointReference>
+ <wsa10:Address>net-tcp://tempuri.org:8000/TestNetTcp/</wsa10:Address>
+ </wsa10:EndpointReference>
+ </wsdl:port>
+ </wsdl:service>
+ </wsdl:definitions>
+ </wsx:MetadataSection>
+</Metadata>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+ <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+ <wsdl:definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsp:Policy wsu:Id="NetTcpBinding_MyContract_policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:SymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:ProtectionToken>
+ <wsp:Policy>
+ <sp:SecureConversationToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:RequireDerivedKeys />
+ <sp:BootstrapPolicy>
+ <wsp:Policy>
+ <sp:SignedParts>
+ <sp:Body />
+ <sp:Header Name="To" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="From" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="FaultTo" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="ReplyTo" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="MessageID" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="RelatesTo" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="Action" Namespace="http://www.w3.org/2005/08/addressing" />
+ </sp:SignedParts>
+ <sp:EncryptedParts>
+ <sp:Body />
+ </sp:EncryptedParts>
+ <sp:SymmetricBinding>
+ <wsp:Policy>
+ <sp:ProtectionToken>
+ <wsp:Policy>
+ <sp:SpnegoContextToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:RequireDerivedKeys />
+ </wsp:Policy>
+ </sp:SpnegoContextToken>
+ </wsp:Policy>
+ </sp:ProtectionToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256 />
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict />
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp />
+ <sp:EncryptSignature />
+ <sp:OnlySignEntireHeadersAndBody />
+ </wsp:Policy>
+ </sp:SymmetricBinding>
+ <sp:Wss11>
+ <wsp:Policy />
+ </sp:Wss11>
+ <sp:Trust10>
+ <wsp:Policy>
+ <sp:MustSupportIssuedTokens />
+ <sp:RequireClientEntropy />
+ <sp:RequireServerEntropy />
+ </wsp:Policy>
+ </sp:Trust10>
+ </wsp:Policy>
+ </sp:BootstrapPolicy>
+ </wsp:Policy>
+ </sp:SecureConversationToken>
+ </wsp:Policy>
+ </sp:ProtectionToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256 />
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict />
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp />
+ <sp:OnlySignEntireHeadersAndBody />
+ </wsp:Policy>
+ </sp:SymmetricBinding>
+ <sp:Wss11 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy />
+ </sp:Wss11>
+ <sp:Trust10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportIssuedTokens />
+ <sp:RequireClientEntropy />
+ <sp:RequireServerEntropy />
+ </wsp:Policy>
+ </sp:Trust10>
+ <msb:BinaryEncoding xmlns:msb="http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1" />
+ <wsaw:UsingAddressing />
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ <wsdl:types />
+ <wsdl:portType name="MyContract" />
+ <wsdl:binding name="NetTcpBinding_MyContract" type="tns:MyContract">
+ <wsp:PolicyReference URI="#NetTcpBinding_MyContract_policy" />
+ <soap12:binding transport="http://schemas.microsoft.com/soap/tcp" />
+ </wsdl:binding>
+ <wsdl:service name="service">
+ <wsdl:port name="NetTcpBinding_MyContract" binding="tns:NetTcpBinding_MyContract">
+ <soap12:address location="net-tcp://tempuri.org:8000/TestNetTcp/" />
+ <wsa10:EndpointReference>
+ <wsa10:Address>net-tcp://tempuri.org:8000/TestNetTcp/</wsa10:Address>
+ </wsa10:EndpointReference>
+ </wsdl:port>
+ </wsdl:service>
+ </wsdl:definitions>
+ </wsx:MetadataSection>
+</Metadata>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+ <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+ <wsdl:definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsp:Policy wsu:Id="NetTcpBinding_IMyContract_policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <msb:BinaryEncoding xmlns:msb="http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1" />
+ <wsaw:UsingAddressing />
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://tempuri.org/Imports">
+ <xsd:import namespace="http://tempuri.org/" />
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="IMyContract_Hello_InputMessage">
+ <wsdl:part name="parameters" element="tns:Hello" />
+ </wsdl:message>
+ <wsdl:message name="IMyContract_Hello_OutputMessage">
+ <wsdl:part name="parameters" element="tns:HelloResponse" />
+ </wsdl:message>
+ <wsdl:portType name="IMyContract">
+ <wsdl:operation name="Hello">
+ <wsdl:input wsaw:Action="http://tempuri.org/IMyContract/Hello" message="tns:IMyContract_Hello_InputMessage" />
+ <wsdl:output wsaw:Action="http://tempuri.org/IMyContract/HelloResponse" message="tns:IMyContract_Hello_OutputMessage" />
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="NetTcpBinding_IMyContract" type="tns:IMyContract">
+ <wsp:PolicyReference URI="#NetTcpBinding_IMyContract_policy" />
+ <soap12:binding transport="http://schemas.microsoft.com/soap/tcp" />
+ <wsdl:operation name="Hello">
+ <soap12:operation soapAction="http://tempuri.org/IMyContract/Hello" style="document" />
+ <wsdl:input>
+ <soap12:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="service">
+ <wsdl:port name="NetTcpBinding_IMyContract" binding="tns:NetTcpBinding_IMyContract">
+ <soap12:address location="net-tcp://tempuri.org:8000/TestNetTcp/" />
+ <wsa10:EndpointReference>
+ <wsa10:Address>net-tcp://tempuri.org:8000/TestNetTcp/</wsa10:Address>
+ </wsa10:EndpointReference>
+ </wsdl:port>
+ </wsdl:service>
+ </wsdl:definitions>
+ </wsx:MetadataSection>
+ <wsx:MetadataSection xmlns="" Dialect="http://www.w3.org/2001/XMLSchema" Identifier="http://tempuri.org/">
+ <xs:schema xmlns:tns="http://tempuri.org/" elementFormDefault="qualified" targetNamespace="http://tempuri.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="Hello">
+ <xs:complexType>
+ <xs:sequence />
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="HelloResponse">
+ <xs:complexType>
+ <xs:sequence />
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>
+ </wsx:MetadataSection>
+</Metadata>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+ <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+ <wsdl:definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsp:Policy wsu:Id="NetTcpBinding_MyContract_policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <wsrm:RMAssertion xmlns:wsrm="http://schemas.xmlsoap.org/ws/2005/02/rm/policy">
+ <wsrm:InactivityTimeout Milliseconds="600000" />
+ <wsrm:AcknowledgementInterval Milliseconds="200" />
+ </wsrm:RMAssertion>
+ <msb:BinaryEncoding xmlns:msb="http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1" />
+ <wsaw:UsingAddressing />
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ <wsdl:types />
+ <wsdl:portType name="MyContract" />
+ <wsdl:binding name="NetTcpBinding_MyContract" type="tns:MyContract">
+ <wsp:PolicyReference URI="#NetTcpBinding_MyContract_policy" />
+ <soap12:binding transport="http://schemas.microsoft.com/soap/tcp" />
+ </wsdl:binding>
+ <wsdl:service name="service">
+ <wsdl:port name="NetTcpBinding_MyContract" binding="tns:NetTcpBinding_MyContract">
+ <soap12:address location="net-tcp://tempuri.org:8000/TestNetTcp/" />
+ <wsa10:EndpointReference>
+ <wsa10:Address>net-tcp://tempuri.org:8000/TestNetTcp/</wsa10:Address>
+ </wsa10:EndpointReference>
+ </wsdl:port>
+ </wsdl:service>
+ </wsdl:definitions>
+ </wsx:MetadataSection>
+</Metadata>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+ <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+ <wsdl:definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsp:Policy wsu:Id="NetTcpBinding_MyContract_policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <msb:BinaryEncoding xmlns:msb="http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1" />
+ <msf:Streamed xmlns:msf="http://schemas.microsoft.com/ws/2006/05/framing/policy" />
+ <wsaw:UsingAddressing />
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ <wsdl:types />
+ <wsdl:portType name="MyContract" />
+ <wsdl:binding name="NetTcpBinding_MyContract" type="tns:MyContract">
+ <wsp:PolicyReference URI="#NetTcpBinding_MyContract_policy" />
+ <soap12:binding transport="http://schemas.microsoft.com/soap/tcp" />
+ </wsdl:binding>
+ <wsdl:service name="service">
+ <wsdl:port name="NetTcpBinding_MyContract" binding="tns:NetTcpBinding_MyContract">
+ <soap12:address location="net-tcp://tempuri.org:8000/TestNetTcp/" />
+ <wsa10:EndpointReference>
+ <wsa10:Address>net-tcp://tempuri.org:8000/TestNetTcp/</wsa10:Address>
+ </wsa10:EndpointReference>
+ </wsdl:port>
+ </wsdl:service>
+ </wsdl:definitions>
+ </wsx:MetadataSection>
+</Metadata>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+ <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+ <wsdl:definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsp:Policy wsu:Id="NetTcpBinding_MyContract_policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <msb:BinaryEncoding xmlns:msb="http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1" />
+ <sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:TransportToken>
+ <wsp:Policy>
+ <msf:WindowsTransportSecurity xmlns:msf="http://schemas.microsoft.com/ws/2006/05/framing/policy">
+ <msf:ProtectionLevel>EncryptAndSign</msf:ProtectionLevel>
+ </msf:WindowsTransportSecurity>
+ </wsp:Policy>
+ </sp:TransportToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256 />
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict />
+ </wsp:Policy>
+ </sp:Layout>
+ </wsp:Policy>
+ </sp:TransportBinding>
+ <wsaw:UsingAddressing />
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ <wsdl:types />
+ <wsdl:portType name="MyContract" />
+ <wsdl:binding name="NetTcpBinding_MyContract" type="tns:MyContract">
+ <wsp:PolicyReference URI="#NetTcpBinding_MyContract_policy" />
+ <soap12:binding transport="http://schemas.microsoft.com/soap/tcp" />
+ </wsdl:binding>
+ <wsdl:service name="service">
+ <wsdl:port name="NetTcpBinding_MyContract" binding="tns:NetTcpBinding_MyContract">
+ <soap12:address location="net-tcp://tempuri.org:8000/TestNetTcp/" />
+ <wsa10:EndpointReference>
+ <wsa10:Address>net-tcp://tempuri.org:8000/TestNetTcp/</wsa10:Address>
+ </wsa10:EndpointReference>
+ </wsdl:port>
+ </wsdl:service>
+ </wsdl:definitions>
+ </wsx:MetadataSection>
+</Metadata>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+ <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+ <wsdl:definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsp:Policy wsu:Id="NetTcpBinding_MyContract_policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <msb:BinaryEncoding xmlns:msb="http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1" />
+ <sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:TransportToken>
+ <wsp:Policy>
+ <msf:SslTransportSecurity xmlns:msf="http://schemas.microsoft.com/ws/2006/05/framing/policy" />
+ </wsp:Policy>
+ </sp:TransportToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256 />
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict />
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp />
+ </wsp:Policy>
+ </sp:TransportBinding>
+ <sp:EndorsingSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:SecureConversationToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:BootstrapPolicy>
+ <wsp:Policy>
+ <sp:SignedParts>
+ <sp:Body />
+ <sp:Header Name="To" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="From" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="FaultTo" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="ReplyTo" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="MessageID" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="RelatesTo" Namespace="http://www.w3.org/2005/08/addressing" />
+ <sp:Header Name="Action" Namespace="http://www.w3.org/2005/08/addressing" />
+ </sp:SignedParts>
+ <sp:EncryptedParts>
+ <sp:Body />
+ </sp:EncryptedParts>
+ <sp:TransportBinding>
+ <wsp:Policy>
+ <sp:TransportToken>
+ <wsp:Policy>
+ <msf:SslTransportSecurity xmlns:msf="http://schemas.microsoft.com/ws/2006/05/framing/policy" />
+ </wsp:Policy>
+ </sp:TransportToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256 />
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict />
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp />
+ </wsp:Policy>
+ </sp:TransportBinding>
+ <sp:EndorsingSupportingTokens>
+ <wsp:Policy>
+ <sp:SpnegoContextToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy />
+ </sp:SpnegoContextToken>
+ </wsp:Policy>
+ </sp:EndorsingSupportingTokens>
+ <sp:Wss11>
+ <wsp:Policy />
+ </sp:Wss11>
+ <sp:Trust10>
+ <wsp:Policy>
+ <sp:MustSupportIssuedTokens />
+ <sp:RequireClientEntropy />
+ <sp:RequireServerEntropy />
+ </wsp:Policy>
+ </sp:Trust10>
+ </wsp:Policy>
+ </sp:BootstrapPolicy>
+ </wsp:Policy>
+ </sp:SecureConversationToken>
+ </wsp:Policy>
+ </sp:EndorsingSupportingTokens>
+ <sp:Wss11 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy />
+ </sp:Wss11>
+ <sp:Trust10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportIssuedTokens />
+ <sp:RequireClientEntropy />
+ <sp:RequireServerEntropy />
+ </wsp:Policy>
+ </sp:Trust10>
+ <wsaw:UsingAddressing />
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ <wsdl:types />
+ <wsdl:portType name="MyContract" />
+ <wsdl:binding name="NetTcpBinding_MyContract" type="tns:MyContract">
+ <wsp:PolicyReference URI="#NetTcpBinding_MyContract_policy" />
+ <soap12:binding transport="http://schemas.microsoft.com/soap/tcp" />
+ </wsdl:binding>
+ <wsdl:service name="service">
+ <wsdl:port name="NetTcpBinding_MyContract" binding="tns:NetTcpBinding_MyContract">
+ <soap12:address location="net-tcp://tempuri.org:8000/TestNetTcp/" />
+ <wsa10:EndpointReference>
+ <wsa10:Address>net-tcp://tempuri.org:8000/TestNetTcp/</wsa10:Address>
+ </wsa10:EndpointReference>
+ </wsdl:port>
+ </wsdl:service>
+ </wsdl:definitions>
+ </wsx:MetadataSection>
+</Metadata>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+ <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+ <wsdl:definitions xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:types />
+ <wsdl:portType name="MyContract" />
+ <wsdl:binding name="BasicHttpBinding_MyContract" type="tns:NonExisting">
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
+ </wsdl:binding>
+ <wsdl:service name="service">
+ <wsdl:port name="BasicHttpBinding_MyContract" binding="tns:BasicHttpBinding_MyContract">
+ <soap:address location="http://tempuri.org/TestHttp/" />
+ </wsdl:port>
+ </wsdl:service>
+ </wsdl:definitions>
+ </wsx:MetadataSection>
+</Metadata>
--- /dev/null
+//
+// ITestContext.cs
+//
+// Author:
+// Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.IO;
+using System.Xml;
+using System.Text;
+using System.Reflection;
+using System.ServiceModel.Description;
+
+namespace MonoTests.System.ServiceModel.MetadataTests {
+
+ public abstract class TestContext {
+
+ #region Abstract API
+
+ public abstract MetadataSet GetMetadata (string name);
+
+ #endregion
+
+ #region Default Context
+
+ public static TestContext LoadMetadataContext = new _LoadMetadataContext ();
+
+ public static TestContext CreateMetadataContext = new _CreateMetadataContext ();
+
+ public static TestContext RoundTripContext = new _RoundTripContext ();
+
+ #endregion
+
+ #region Implementations
+
+ class _LoadMetadataContext : TestContext {
+ public override MetadataSet GetMetadata (string name)
+ {
+ return LoadMetadata (name);
+ }
+ }
+
+ class _CreateMetadataContext : TestContext {
+ public override MetadataSet GetMetadata (string name)
+ {
+ return MetadataSamples.GetMetadataByName (name);
+ }
+ }
+
+ class _RoundTripContext : TestContext {
+ public override MetadataSet GetMetadata (string name)
+ {
+ return RoundTrip (name);
+ }
+ }
+
+ #endregion
+
+ #region Public Static API
+
+ public static MetadataSet LoadMetadata (string name)
+ {
+#if USE_EMBEDDED_METADATA
+ return LoadMetadataFromResource (name);
+#else
+ return LoadMetadataFromFile (name);
+#endif
+ }
+
+ public static void SaveMetadata (string name, MetadataSet metadata)
+ {
+ SaveMetadataToFile (name, metadata);
+ }
+
+ public static MetadataSet LoadMetadataFromFile (string name)
+ {
+ var asm = Assembly.GetExecutingAssembly ();
+ if (!name.EndsWith (".xml"))
+ name = name + ".xml";
+ var uri = new Uri (asm.CodeBase);
+ var path = Path.GetDirectoryName (uri.AbsolutePath);
+ path = Path.Combine (path, "Test");
+ path = Path.Combine (path, "MetadataTests");
+ path = Path.Combine (path, "Resources");
+ var filename = Path.Combine (path, name);
+ using (var stream = new StreamReader (filename)) {
+ var reader = new XmlTextReader (stream);
+ return MetadataSet.ReadFrom (reader);
+ }
+ }
+
+ public static MetadataSet LoadMetadataFromResource (string name)
+ {
+ var asm = Assembly.GetExecutingAssembly ();
+ if (!name.EndsWith (".xml"))
+ name = name + ".xml";
+
+ var resname = "MetadataTests.Resources." + name;
+ using (var stream = asm.GetManifestResourceStream (resname)) {
+ if (stream == null)
+ throw new InvalidOperationException (
+ "No such resource: " + name);
+ var reader = new XmlTextReader (stream);
+ return MetadataSet.ReadFrom (reader);
+ }
+ }
+
+ public static void SaveMetadataToFile (string name, MetadataSet metadata)
+ {
+ var filename = name + ".xml";
+ if (File.Exists (filename))
+ return;
+
+ using (var file = new StreamWriter (filename, false)) {
+ var writer = new XmlTextWriter (file);
+ writer.Formatting = Formatting.Indented;
+ metadata.WriteTo (writer);
+ }
+
+ Console.WriteLine ("Exported {0}.", filename);
+ }
+
+ internal static string SaveMetadataToString (MetadataSet metadata)
+ {
+ using (var ms = new MemoryStream ()) {
+ var writer = new XmlTextWriter (new StreamWriter (ms));
+ writer.Formatting = Formatting.Indented;
+ metadata.WriteTo (writer);
+ writer.Flush ();
+
+ return Encoding.UTF8.GetString (ms.GetBuffer (), 0, (int)ms.Position);
+ }
+ }
+
+ internal static MetadataSet LoadMetadataFromString (string doc)
+ {
+ var buffer = Encoding.UTF8.GetBytes (doc);
+ using (var ms = new MemoryStream (buffer)) {
+ var reader = new XmlTextReader (ms);
+ return MetadataSet.ReadFrom (reader);
+ }
+ }
+
+ public static MetadataSet RoundTrip (string name)
+ {
+ var metadata = MetadataSamples.GetMetadataByName (name);
+
+ var doc = SaveMetadataToString (metadata);
+ return LoadMetadataFromString (doc);
+ }
+
+ #endregion
+ }
+}
+
--- /dev/null
+//
+// TestLabel.cs
+//
+// Author:
+// Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using System.Text;
+using System.Collections.Generic;
+
+namespace MonoTests.System.ServiceModel.MetadataTests {
+
+ public class TestLabel {
+
+ List<Scope> scopes;
+ string delimiter;
+ Style defaultStyle;
+
+ public enum Style {
+ Letter,
+ Number,
+ HexNumer
+ }
+
+ public TestLabel (string prefix)
+ : this (prefix, ".", Style.Letter)
+ {
+ }
+
+ public TestLabel (string prefix, string delimiter, Style style)
+ {
+ if ((prefix == null) || (prefix.Equals (string.Empty)))
+ throw new ArgumentException ("Cannot be null or empty.", "prefix");
+ if (delimiter == null)
+ throw new ArgumentNullException ("delimiter");
+
+ scopes = new List<Scope> ();
+ scopes.Add (new Scope (prefix, style));
+
+ this.delimiter = delimiter;
+ this.defaultStyle = style;
+ }
+
+ class Scope {
+ public readonly string Text;
+ public readonly Style Style;
+ int id;
+
+ public Scope (string text, Style style)
+ {
+ this.Text = text;
+ this.Style = style;
+ this.id = 0;
+ }
+
+ public int GetID ()
+ {
+ return ++id;
+ }
+ }
+
+ public void EnterScope (string scope)
+ {
+ scopes.Add (new Scope (scope, defaultStyle));
+ }
+
+ public void LeaveScope ()
+ {
+ if (scopes.Count <= 1)
+ throw new InvalidOperationException ();
+ scopes.RemoveAt (scopes.Count - 1);
+ }
+
+ public string Get ()
+ {
+ var sb = new StringBuilder ();
+ for (int i = 0; i < scopes.Count; i++) {
+ sb.Append (scopes [i].Text);
+ sb.Append (delimiter);
+ }
+
+ var scope = scopes [scopes.Count - 1];
+ var id = scope.GetID ();
+
+ switch (scope.Style) {
+ case Style.Letter:
+ if (id <= 26)
+ sb.Append ((char)('a' + id - 1));
+ else
+ goto case Style.Number;
+ break;
+
+ case Style.Number:
+ sb.Append (id);
+ break;
+
+ case Style.HexNumer:
+ sb.AppendFormat ("{0:x2}", id);
+ break;
+ }
+
+ return sb.ToString ();
+ }
+
+ public override string ToString ()
+ {
+ var sb = new StringBuilder ();
+ sb.Append ("[");
+ for (int i = 0; i < scopes.Count; i++) {
+ if (i > 0)
+ sb.Append (delimiter);
+ sb.Append (scopes [i].Text);
+ }
+ sb.Append ("]");
+ return sb.ToString ();
+ }
+ }
+}
+
return null;
}
+
+ XmlNode FindAssertionByLocalName (PolicyAssertionCollection assertionCollection, string name)
+ {
+ foreach (XmlNode node in assertionCollection)
+ if (node.LocalName == name)
+ return node;
+
+ return null;
+ }
+
+ class MyMessageEncodingElement : MessageEncodingBindingElement {
+ MessageVersion version;
+
+ public MyMessageEncodingElement (MessageVersion version)
+ {
+ this.version = version;
+ }
+
+ public override BindingElement Clone ()
+ {
+ return new MyMessageEncodingElement (version);
+ }
+ public override MessageEncoderFactory CreateMessageEncoderFactory ()
+ {
+ throw new NotImplementedException ();
+ }
+ public override MessageVersion MessageVersion {
+ get {
+ return version;
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ }
+
+ [Test]
+ public void ExportPolicy_CustomEncoding_Soap12 ()
+ {
+ ConnectionOrientedTransportBindingElement binding_element = new NamedPipeTransportBindingElement ();
+ IPolicyExportExtension export_extension = binding_element as IPolicyExportExtension;
+ PolicyConversionContext conversion_context = new CustomPolicyConversionContext ();
+ conversion_context.BindingElements.Add (new MyMessageEncodingElement (MessageVersion.Soap12));
+ export_extension.ExportPolicy (new WsdlExporter (), conversion_context);
+
+ PolicyAssertionCollection binding_assertions = conversion_context.GetBindingAssertions ();
+ BindingElementCollection binding_elements = conversion_context.BindingElements;
+ Assert.AreEqual (0, binding_assertions.Count, "#A0");
+ Assert.AreEqual (1, binding_elements.Count, "#A1");
+ }
+
+ [Test]
+ public void ExportPolicy_CustomEncoding_Soap12August2004 ()
+ {
+ ConnectionOrientedTransportBindingElement binding_element = new NamedPipeTransportBindingElement ();
+ IPolicyExportExtension export_extension = binding_element as IPolicyExportExtension;
+ PolicyConversionContext conversion_context = new CustomPolicyConversionContext ();
+ conversion_context.BindingElements.Add (new MyMessageEncodingElement (MessageVersion.Soap12WSAddressingAugust2004));
+ export_extension.ExportPolicy (new WsdlExporter (), conversion_context);
+
+ PolicyAssertionCollection binding_assertions = conversion_context.GetBindingAssertions ();
+ BindingElementCollection binding_elements = conversion_context.BindingElements;
+ Assert.AreEqual (1, binding_assertions.Count, "#A0");
+ Assert.AreEqual (1, binding_elements.Count, "#A1");
+
+ // UsingAddressing
+ XmlNode using_addressing_node = FindAssertionByLocalName (binding_assertions, "UsingAddressing");
+ Assert.AreEqual (true, using_addressing_node != null, "#B0");
+ Assert.AreEqual ("UsingAddressing", using_addressing_node.LocalName, "#B1");
+ Assert.AreEqual ("http://schemas.xmlsoap.org/ws/2004/08/addressing/policy", using_addressing_node.NamespaceURI, "#B2");
+ Assert.AreEqual (String.Empty, using_addressing_node.InnerText, "#B3");
+ Assert.AreEqual (0, using_addressing_node.Attributes.Count, "#B4");
+ Assert.AreEqual (0, using_addressing_node.ChildNodes.Count, "#B5");
+ }
}
}
Assert.AreEqual (4, cb.CreateBindingElements ().Count, "#9");
}
+ class MessageVersionBindingElement : BindingElement {
+ public MessageVersion Version {
+ get;
+ private set;
+ }
+
+ public MessageVersionBindingElement (MessageVersion version)
+ {
+ this.Version = version;
+ }
+
+ public override BindingElement Clone ()
+ {
+ return new MessageVersionBindingElement (Version);
+ }
+
+ public override T GetProperty<T> (BindingContext context)
+ {
+ if (typeof (T) == typeof (MessageVersion))
+ return (T)(object) Version;
+ return null;
+ }
+ }
+
[Test]
public void MessageVersionProperty ()
{
Assert.IsNull (new CustomBinding ().MessageVersion, "#1");
Assert.AreEqual (MessageVersion.Soap12WSAddressing10, new CustomBinding (new HttpTransportBindingElement ()).MessageVersion, "#2");
Assert.AreEqual (MessageVersion.Soap12WSAddressing10, new CustomBinding (new TextMessageEncodingBindingElement ()).MessageVersion, "#3");
+
+ var versions = new[] {
+ MessageVersion.Soap11, MessageVersion.Soap11WSAddressing10,
+ MessageVersion.Soap11WSAddressingAugust2004,
+ MessageVersion.Soap12, MessageVersion.Soap12WSAddressing10,
+ MessageVersion.Soap12WSAddressingAugust2004
+ };
+
+ foreach (var version in versions) {
+ var binding = new CustomBinding ();
+ binding.Elements.Add (new MessageVersionBindingElement (version));
+ Assert.AreEqual (version, binding.MessageVersion, "#4:" + version);
+ }
}
[Test]
return null;
}
+ XmlNode FindAssertionByLocalName (PolicyAssertionCollection assertionCollection, string name)
+ {
+ foreach (XmlNode node in assertionCollection)
+ if (node.LocalName == name)
+ return node;
+
+ return null;
+ }
+
+ class MyMessageEncodingElement : MessageEncodingBindingElement {
+ MessageVersion version;
+
+ public MyMessageEncodingElement (MessageVersion version)
+ {
+ this.version = version;
+ }
+
+ public override BindingElement Clone ()
+ {
+ return new MyMessageEncodingElement (version);
+ }
+ public override MessageEncoderFactory CreateMessageEncoderFactory ()
+ {
+ throw new NotImplementedException ();
+ }
+ public override MessageVersion MessageVersion {
+ get {
+ return version;
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ }
+
+ [Test]
+ public void ExportPolicy_CustomEncoding_Soap12 ()
+ {
+ HttpTransportBindingElement binding_element = new HttpTransportBindingElement ();
+ IPolicyExportExtension export_extension = binding_element as IPolicyExportExtension;
+ PolicyConversionContext conversion_context = new CustomPolicyConversionContext ();
+ conversion_context.BindingElements.Add (new MyMessageEncodingElement (MessageVersion.Soap12));
+ export_extension.ExportPolicy (new WsdlExporter (), conversion_context);
+
+ PolicyAssertionCollection binding_assertions = conversion_context.GetBindingAssertions ();
+ BindingElementCollection binding_elements = conversion_context.BindingElements;
+ Assert.AreEqual (0, binding_assertions.Count, "#A0");
+ Assert.AreEqual (1, binding_elements.Count, "#A1");
+ }
+
+ [Test]
+ public void ExportPolicy_CustomEncoding_Soap12August2004 ()
+ {
+ HttpTransportBindingElement binding_element = new HttpTransportBindingElement ();
+ IPolicyExportExtension export_extension = binding_element as IPolicyExportExtension;
+ PolicyConversionContext conversion_context = new CustomPolicyConversionContext ();
+ conversion_context.BindingElements.Add (new MyMessageEncodingElement (MessageVersion.Soap12WSAddressingAugust2004));
+ export_extension.ExportPolicy (new WsdlExporter (), conversion_context);
+
+ PolicyAssertionCollection binding_assertions = conversion_context.GetBindingAssertions ();
+ BindingElementCollection binding_elements = conversion_context.BindingElements;
+ Assert.AreEqual (1, binding_assertions.Count, "#A0");
+ Assert.AreEqual (1, binding_elements.Count, "#A1");
+
+ // UsingAddressing
+ XmlNode using_addressing_node = FindAssertionByLocalName (binding_assertions, "UsingAddressing");
+ Assert.AreEqual (true, using_addressing_node != null, "#B0");
+ Assert.AreEqual ("UsingAddressing", using_addressing_node.LocalName, "#B1");
+ Assert.AreEqual ("http://schemas.xmlsoap.org/ws/2004/08/addressing/policy", using_addressing_node.NamespaceURI, "#B2");
+ Assert.AreEqual (String.Empty, using_addressing_node.InnerText, "#B3");
+ Assert.AreEqual (0, using_addressing_node.Attributes.Count, "#B4");
+ Assert.AreEqual (0, using_addressing_node.ChildNodes.Count, "#B5");
+ }
+
#endregion
}
}
Assert.AreEqual (name, ((XmlElement) o).Name);
}
- [Test]
- public void BindingsTest ()
- {
- NoExtensionsSetup ();
- IEnumerable<SMBinding> bindings = wi.ImportAllBindings ();
-
- int count = 0;
- foreach (SMBinding b in bindings) {
- Assert.AreEqual (typeof (CustomBinding), b.GetType (), "#B1");
- Assert.AreEqual ("BasicHttpBinding_IEchoService", b.Name, "#B2");
- Assert.AreEqual ("http://tempuri.org/", b.Namespace, "#B3");
- Assert.AreEqual ("", b.Scheme, "#B4");
-
- //FIXME: Test BindingElements
-
- count++;
- }
- Assert.AreEqual (1, count);
- }
-
[Test]
[Category ("NotWorking")]
public void ContractsTest ()
var mset = new MetadataSet ();
WSServiceDescription sd = null;
- sd = WSServiceDescription.Read (XmlReader.Create ("670945.wsdl"));
+ sd = WSServiceDescription.Read (XmlReader.Create ("Test/XmlFiles/670945.wsdl"));
mset.MetadataSections.Add (new MetadataSection () {
Dialect = MetadataSection.ServiceDescriptionDialect,
Metadata = sd });
#include net_4_0_System.ServiceModel.dll.sources
+System.ServiceModel/HttpBindingBase.cs
+System.ServiceModel/BasicHttpBinding_4_5.cs
+System.ServiceModel/BasicHttpsBinding.cs
+System.ServiceModel/BasicHttpsSecurity.cs
+System.ServiceModel.Configuration/BasicHttpBindingElement_4_5.cs
+System.ServiceModel.Configuration/HttpBindingBaseElement.cs
+System.ServiceModel.Configuration/BasicHttpsBindingElement.cs
+System.ServiceModel.Configuration/BasicHttpsSecurityElement.cs
+System.ServiceModel.Configuration/BasicHttpsBindingCollectionElement.cs
}
public override HttpSessionStateBase Session {
- get { return new HttpSessionStateWrapper (w.Session); }
+ get { return w.Session == null ? null : new HttpSessionStateWrapper (w.Session); }
}
public override bool SkipAuthorization {
// JsonDeserializer.cs
//
// Author:
-// Marek Habersack <mhabersack@novell.com>
+// Marek Habersack <grendel@twistedcode.net>
//
// (C) 2008 Novell, Inc. http://novell.com/
+// Copyright 2011, Xamarin, Inc (http://xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Code is based on JSON_checker (http://www.json.org/JSON_checker/) and JSON_parser
-// (http://fara.cs.uni-potsdam.de/~jsg/json_parser/) C sources. License for the original code
-// follows:
-
-#region Original License
-/*
-Copyright (c) 2005 JSON.org
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-The Software shall be used for Good, not Evil.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-*/
-#endregion
+// (http://fara.cs.uni-potsdam.de/~jsg/json_parser/) C sources.
using System;
using System.Collections;
if (values == null)
throw new ArgumentNullException ("values");
- foreach (string allowed in AllowedMethods)
+ switch (routeDirection) {
+ case RouteDirection.IncomingRequest:
// LAMESPEC: .NET allows case-insensitive comparison, which violates RFC 2616
- if (httpContext.Request.HttpMethod == allowed)
+ return AllowedMethods.Contains (httpContext.Request.HttpMethod);
+
+ case RouteDirection.UrlGeneration:
+ // See: aspnetwebstack's WebAPI equivalent for details.
+ object method;
+
+ if (!values.TryGetValue (parameterName, out method))
return true;
- return false;
+ // LAMESPEC: .NET allows case-insensitive comparison, which violates RFC 2616
+ return AllowedMethods.Contains (Convert.ToString (method));
+
+ default:
+ throw new ArgumentException ("Invalid routeDirection: " + routeDirection);
+ }
}
}
}
if (tokens.Count != 1)
return null;
+ // if token is catch-all, we're done.
+ if (tokens [0].Type == PatternTokenType.CatchAll)
+ break;
+
if (!defaults.ContainsKey (tokens [0].Name))
return null;
}
return AddDefaults (ret, defaults);
}
- public bool BuildUrl (Route route, RequestContext requestContext, RouteValueDictionary userValues, out string value)
+ public string BuildUrl (Route route, RequestContext requestContext, RouteValueDictionary userValues, RouteValueDictionary constraints, out RouteValueDictionary usedValues)
{
- value = null;
+ usedValues = null;
+
if (requestContext == null)
- return false;
+ return null;
RouteData routeData = requestContext.RouteData;
RouteValueDictionary defaultValues = route != null ? route.Defaults : null;
// Has the user provided value for it?
if (userValues == null || !userValues.ContainsKey (parameterName)) {
if (allMustBeInUserValues)
- return false; // partial override => no match
+ return null; // partial override => no match
if (!canTakeFromAmbient || ambientValues == null || !ambientValues.ContainsKey (parameterName))
- return false; // no value provided => no match
+ return null; // no value provided => no match
} else if (canTakeFromAmbient)
allMustBeInUserValues = true;
}
object defaultValue = de.Value;
if (defaultValue is string && parameterValue is string) {
if (String.Compare ((string)defaultValue, (string)parameterValue, StringComparison.Ordinal) != 0)
- return false; // different value => no match
+ return null; // different value => no match
} else if (defaultValue != parameterValue)
- return false; // different value => no match
+ return null; // different value => no match
}
}
}
- // Check the constraints
- RouteValueDictionary constraints = route != null ? route.Constraints : null;
- if (constraints != null && constraints.Count > 0) {
- HttpContextBase context = requestContext.HttpContext;
- bool invalidConstraint;
-
- foreach (var de in constraints) {
- if (!Route.ProcessConstraintInternal (context, route, de.Value, de.Key, userValues, RouteDirection.UrlGeneration, requestContext, out invalidConstraint) ||
- invalidConstraint)
- return false; // constraint not met => no match
- }
- }
-
// We're a match, generate the URL
var ret = new StringBuilder ();
+ usedValues = new RouteValueDictionary ();
bool canTrim = true;
// Going in reverse order, so that we can trim without much ado
#if SYSTEMCORE_DEP
if (userValues.GetValue (parameterName, out tokenValue)) {
+ if (tokenValue != null)
+ usedValues.Add (parameterName, tokenValue.ToString ());
+
if (!defaultValues.Has (parameterName, tokenValue)) {
canTrim = false;
if (tokenValue != null)
if (!canTrim && tokenValue != null)
ret.Insert (0, tokenValue.ToString ());
+
continue;
}
object ambientTokenValue;
if (ambientValues.GetValue (parameterName, out ambientTokenValue))
tokenValue = ambientTokenValue;
-
+
if (!canTrim && tokenValue != null)
ret.Insert (0, tokenValue.ToString ());
+
+ usedValues.Add (parameterName, tokenValue.ToString ());
continue;
}
canTrim = false;
if (ambientValues.GetValue (parameterName, out tokenValue)) {
if (tokenValue != null)
+ {
ret.Insert (0, tokenValue.ToString ());
+ usedValues.Add (parameterName, tokenValue.ToString ());
+ }
continue;
}
#endif
ret.Append ('=');
if (parameterValue != null)
ret.Append (Uri.EscapeDataString (de.Value.ToString ()));
+
+ usedValues.Add (parameterName, de.Value.ToString ());
}
}
- value = ret.ToString ();
- return true;
+ return ret.ToString ();
}
}
}
if (values == null)
return null;
- RouteValueDictionary constraints = Constraints;
- if (constraints != null)
- foreach (var p in constraints)
- if (!ProcessConstraint (httpContext, p.Value, p.Key, values, RouteDirection.IncomingRequest))
- return null;
+ if (!ProcessConstraints (httpContext, values, RouteDirection.IncomingRequest))
+ return null;
var rd = new RouteData (this, RouteHandler);
RouteValueDictionary rdValues = rd.Values;
// if (values == null)
// values = requestContext.RouteData.Values;
- string s;
- if (!url.BuildUrl (this, requestContext, values, out s))
+ RouteValueDictionary usedValues;
+ string resultUrl = url.BuildUrl (this, requestContext, values, Constraints, out usedValues);
+
+ if (resultUrl == null)
+ return null;
+
+ if (!ProcessConstraints (requestContext.HttpContext, usedValues, RouteDirection.UrlGeneration))
return null;
- return new VirtualPathData (this, s);
+ var result = new VirtualPathData (this, resultUrl);
+
+ RouteValueDictionary dataTokens = DataTokens;
+ if (dataTokens != null) {
+ foreach (var item in dataTokens)
+ result.DataTokens[item.Key] = item.Value;
+ }
+
+ return result;
}
- internal static bool ProcessConstraintInternal (HttpContextBase httpContext, Route route, object constraint, string parameterName,
+ private bool ProcessConstraintInternal (HttpContextBase httpContext, Route route, object constraint, string parameterName,
RouteValueDictionary values, RouteDirection routeDirection, RequestContext reqContext,
out bool invalidConstraint)
{
constraint += "$";
}
- return Regex.Match (value, constraint).Success;
+ return Regex.IsMatch (value, constraint, RegexOptions.CultureInvariant | RegexOptions.IgnoreCase | RegexOptions.Compiled);
}
protected virtual bool ProcessConstraint (HttpContextBase httpContext, object constraint, string parameterName, RouteValueDictionary values, RouteDirection routeDirection)
return ret;
}
+
+ private bool ProcessConstraints (HttpContextBase httpContext, RouteValueDictionary values, RouteDirection routeDirection)
+ {
+ var constraints = Constraints;
+
+ if (Constraints != null) {
+ foreach (var p in constraints)
+ if (!ProcessConstraint (httpContext, p.Value, p.Key, values, routeDirection))
+ return false;
+ }
+
+ return true;
+ }
+
#if NET_4_0
RequestContext SafeGetContext (HttpRequestBase req)
{
public void Match ()
{
var c = new MyHttpMethodConstraint (new string [0]);
- Assert.IsFalse (c.CallMatch (new HttpContextStub (), new Route (null, null), "foo", new RouteValueDictionary (), RouteDirection.IncomingRequest));
+ Assert.IsFalse (c.CallMatch (new HttpContextStub (""), new Route (null, null), "foo", new RouteValueDictionary (), RouteDirection.IncomingRequest));
}
[Test]
// LAMESPEC: .NET allows case-insensitive comparison, which violates RFC 2616
// Assert.IsFalse (c.CallMatch (new HttpContextStub ("", "", "get"), new Route (null, null), "", new RouteValueDictionary (), RouteDirection.IncomingRequest), "#4");
}
+
+ [Test]
+ public void UrlGeneration ()
+ {
+ var c = new HttpMethodConstraint (new string[] { "GET" }) as IRouteConstraint;
+ var req = new HttpContextStub ("", "", "HEAD");
+
+ var values = new RouteValueDictionary () { { "httpMethod", "GET" } };
+ Assert.IsTrue (c.Match (req, new Route (null, null), "httpMethod", values, RouteDirection.UrlGeneration), "#1");
+
+ values = new RouteValueDictionary() { { "httpMethod", "POST" } };
+ Assert.IsFalse (c.Match (req, new Route (null, null), "httpMethod", values, RouteDirection.UrlGeneration), "#2");
+ }
}
}
Assert.IsNull (vp, "#C1");
}
+ [Test]
+ public void GetVirtualPath8 ()
+ {
+ var routes = new RouteCollection();
+
+ routes.Add (new MyRoute ("login", new MyRouteHandler ()) {
+ Defaults = new RouteValueDictionary (new { controller = "Home", action = "LogOn" })
+ });
+
+ routes.Add (new MyRoute ("{site}/{controller}/{action}", new MyRouteHandler ()) {
+ Defaults = new RouteValueDictionary (new { site = "_", controller = "Home", action = "Index" }),
+ Constraints = new RouteValueDictionary ( new { site = "_?[0-9A-Za-z-]*" })
+ });
+
+ routes.Add (new MyRoute ("{*path}", new MyRouteHandler ()) {
+ Defaults = new RouteValueDictionary (new { controller = "Error", action = "NotFound" }),
+ });
+
+ var hc = new HttpContextStub2 ("~/login", String.Empty, String.Empty);
+ hc.SetResponse (new HttpResponseStub (3));
+ var rd = routes.GetRouteData (hc);
+ var rvs = new RouteValueDictionary () {
+ { "controller", "Home" },
+ { "action" , "Index" }
+ };
+ var vpd = routes.GetVirtualPath (new RequestContext (hc, rd), rvs);
+ Assert.IsNotNull (vpd, "#A1");
+ Assert.AreEqual ("/", vpd.VirtualPath, "#A2");
+ Assert.AreEqual (0, vpd.DataTokens.Count, "#A3");
+
+ hc = new HttpContextStub2 ("~/login", String.Empty, String.Empty);
+ hc.SetResponse (new HttpResponseStub (3));
+ rd = routes.GetRouteData (hc);
+ rvs = new RouteValueDictionary () {
+ { "controller", "Home" }
+ };
+ vpd = routes.GetVirtualPath (new RequestContext (hc, rd), rvs);
+ Assert.IsNotNull (vpd, "#B1");
+ Assert.AreEqual ("/login", vpd.VirtualPath, "#B2");
+ Assert.AreEqual (0, vpd.DataTokens.Count, "#B3");
+
+ hc = new HttpContextStub2 ("~/login", String.Empty, String.Empty);
+ hc.SetResponse (new HttpResponseStub (3));
+ rd = routes.GetRouteData (hc);
+ rvs = new RouteValueDictionary () {
+ { "action" , "Index" }
+ };
+ vpd = routes.GetVirtualPath (new RequestContext (hc, rd), rvs);
+ Assert.IsNotNull (vpd, "#C1");
+ Assert.AreEqual ("/", vpd.VirtualPath, "#C2");
+ Assert.AreEqual (0, vpd.DataTokens.Count, "#C3");
+
+ hc = new HttpContextStub2 ("~/", String.Empty, String.Empty);
+ rd = routes.GetRouteData (hc);
+ Assert.IsNotNull (rd, "#D1");
+ }
+
[Test]
[Ignore ("looks like RouteExistingFiles ( = false) does not affect... so this test needs more investigation")]
public void GetVirtualPathToExistingFile ()
})
};
- var hc = new HttpContextStub ("/Foo/x123", String.Empty);
+ var hc = new HttpContextStub ("~/Foo/x123", String.Empty);
var rd = r.GetRouteData (hc);
Assert.IsNull (rd, "#1");
}
-
+
+ [Test]
+ public void GetRouteDataWithCatchAll ()
+ {
+ var r = new Route ("{*path}", new StopRoutingHandler ()) {
+ Defaults = new RouteValueDictionary (new {
+ controller = "Error",
+ action = "NotFound"
+ })
+ };
+
+ var hc = new HttpContextStub ("~/", String.Empty);
+ var rd = r.GetRouteData (hc);
+
+ Assert.IsNotNull (rd, "#1");
+
+ hc = new HttpContextStub ("~/Foo/x123", String.Empty);
+ rd = r.GetRouteData (hc);
+
+ Assert.IsNotNull (rd, "#2");
+ }
+
+ [Test]
+ public void GetRouteDataWithCatchAll2 ()
+ {
+ var r = new Route ("something/{*path}", new StopRoutingHandler ()) {
+ Defaults = new RouteValueDictionary (new {
+ controller = "Error",
+ action = "NotFound"
+ })
+ };
+
+ var hc = new HttpContextStub ("~/", String.Empty);
+ var rd = r.GetRouteData (hc);
+
+ Assert.IsNull (rd, "#1");
+
+ hc = new HttpContextStub ("~/something", String.Empty);
+ rd = r.GetRouteData (hc);
+
+ Assert.IsNotNull (rd, "#2");
+ Assert.IsNull (rd.Values["path"], "#2.1");
+
+ hc = new HttpContextStub ("~/something/", String.Empty);
+ rd = r.GetRouteData (hc);
+
+ Assert.IsNotNull (rd, "#3");
+ Assert.IsNull (rd.Values["path"], "#3.1");
+
+ hc = new HttpContextStub ("~/something/algo", String.Empty);
+ rd = r.GetRouteData (hc);
+
+ Assert.IsNotNull (rd, "#4");
+ Assert.AreEqual ("algo", rd.Values["path"], "#4.1");
+
+ }
+
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void GetVirtualPathNullContext ()
using System.Configuration;
using System.IO;
using System.Text;
-#if NET_4_0
+#if NET_4_0 && !MOBILE
using System.Web.Configuration;
#endif
static HttpEncoder GetCustomEncoderFromConfig ()
{
+#if MOBILE
+ return defaultEncoder.Value;
+#else
var cfg = HttpRuntime.Section;
string typeName = cfg.EncoderType;
);
return Activator.CreateInstance (t, false) as HttpEncoder;
+#endif
}
#endif
#if NET_4_0
if (value == null)
return null;
+#if !MOBILE
IHtmlString htmlString = value as IHtmlString;
if (htmlString != null)
return htmlString.ToHtmlString ();
-
+#endif
+
return HtmlEncode (value.ToString ());
}
XmlTypeMapping CreateTypeMapping (TypeData typeData, XmlRootAttribute root, string defaultXmlType, string defaultNamespace)
{
- string rootNamespace = defaultNamespace;
+ bool hasTypeNamespace = !string.IsNullOrEmpty (defaultNamespace);
+ string rootNamespace = null;
string typeNamespace = null;
string elementName;
bool includeInSchema = true;
if (atts.XmlType != null)
{
- if (atts.XmlType.Namespace != null)
+ if (atts.XmlType.Namespace != null) {
typeNamespace = atts.XmlType.Namespace;
+ hasTypeNamespace = true;
+ }
if (atts.XmlType.TypeName != null && atts.XmlType.TypeName != string.Empty)
defaultXmlType = XmlConvert.EncodeLocalName (atts.XmlType.TypeName);
{
if (root.ElementName.Length != 0)
elementName = XmlConvert.EncodeLocalName(root.ElementName);
- if (root.Namespace != null)
+ if (root.Namespace != null) {
rootNamespace = root.Namespace;
+ hasTypeNamespace = true;
+ }
nullable = root.IsNullable;
}
- if (rootNamespace == null) rootNamespace = "";
- if (typeNamespace == null) typeNamespace = rootNamespace;
+ rootNamespace = rootNamespace ?? defaultNamespace ?? string.Empty;
+ typeNamespace = typeNamespace ?? rootNamespace;
XmlTypeMapping map;
switch (typeData.SchemaType) {
typeData, defaultXmlType, typeNamespace);
break;
default:
- map = new XmlTypeMapping (elementName, rootNamespace, typeData, defaultXmlType, typeNamespace);
+ map = new XmlTypeMapping (elementName, rootNamespace, typeData, defaultXmlType, hasTypeNamespace ? typeNamespace : null);
break;
}
if (rmember.XmlAttributes.XmlIgnore) continue;
if (rmember.DeclaringType != null && rmember.DeclaringType != type) {
XmlTypeMapping bmap = ImportClassMapping (rmember.DeclaringType, root, defaultNamespace);
- ns = bmap.XmlTypeNamespace;
+ if (bmap.HasXmlTypeNamespace)
+ ns = bmap.XmlTypeNamespace;
}
try {
internal string XmlTypeNamespace
{
- get { return xmlTypeNamespace; }
+ get { return xmlTypeNamespace ?? string.Empty; }
set { xmlTypeNamespace = value; }
}
+ internal bool HasXmlTypeNamespace
+ {
+ get { return xmlTypeNamespace != null; }
+ }
+
internal ArrayList DerivedTypes
{
get { return _derivedTypes; }
internal XmlTypeMapping GetRealElementMap (string name, string ens)
{
- if (xmlType == name && xmlTypeNamespace == ens) return this;
+ if (xmlType == name && XmlTypeNamespace == ens) return this;
foreach (XmlTypeMapping map in _derivedTypes)
- if (map.xmlType == name && map.xmlTypeNamespace == ens) return map;
+ if (map.xmlType == name && map.XmlTypeNamespace == ens) return map;
return null;
}
Assert.IsNull(foobar.Baz);
}
}
+
+ [Test] // bug #8468
+ public void TestUseSubclassDefaultNamespace ()
+ {
+ XmlSerializer xs = new XmlSerializer (typeof (Bug8468Subclass));
+ string msg = "<Test xmlns=\"http://test-namespace\"><Base>BaseValue</Base><Mid>MidValue</Mid></Test>";
+ var res1 = (Bug8468Subclass)xs.Deserialize (new StringReader (msg));
+ Assert.IsNotNull (res1);
+ Assert.AreEqual ("BaseValue", res1.Base);
+ Assert.AreEqual ("MidValue", res1.Mid);
+
+ xs = new XmlSerializer (typeof (Bug8468SubclassNoNamespace), "http://test-namespace");
+ var res2 = (Bug8468SubclassNoNamespace)xs.Deserialize (new StringReader (msg));
+ Assert.IsNotNull (res2);
+ Assert.AreEqual ("BaseValue", res2.Base);
+ Assert.AreEqual ("MidValue", res2.Mid);
+
+ xs = new XmlSerializer (typeof (Bug8468SubclassV2));
+ var res3 = (Bug8468SubclassV2)xs.Deserialize (new StringReader (msg));
+ Assert.IsNotNull (res3);
+ Assert.IsNull (res3.Base);
+ Assert.AreEqual ("MidValue", res3.Mid);
+
+ xs = new XmlSerializer (typeof (Bug8468SubclassNoNamespaceV2), "http://test-namespace");
+ var res4 = (Bug8468SubclassNoNamespaceV2)xs.Deserialize (new StringReader (msg));
+ Assert.IsNotNull (res4);
+ Assert.IsNull (res4.Base);
+ Assert.AreEqual ("MidValue", res4.Mid);
+
+ msg = "<Test xmlns=\"http://test-namespace\"><Base xmlns=\"\">BaseValue</Base><Mid>MidValue</Mid></Test>";
+
+ xs = new XmlSerializer (typeof (Bug8468SubclassV2));
+ var res5 = (Bug8468SubclassV2)xs.Deserialize (new StringReader (msg));
+ Assert.IsNotNull (res5);
+ Assert.AreEqual ("BaseValue", res5.Base);
+ Assert.AreEqual ("MidValue", res5.Mid);
+
+ xs = new XmlSerializer (typeof (Bug8468SubclassNoNamespaceV2), "http://test-namespace");
+ var res6 = (Bug8468SubclassNoNamespaceV2)xs.Deserialize (new StringReader (msg));
+ Assert.IsNotNull (res6);
+ Assert.AreEqual ("BaseValue", res6.Base);
+ Assert.AreEqual ("MidValue", res6.Mid);
+ }
}
}
[XmlElementAttribute (DataType = "date")]
public DateTime SomeDate;
}
+
+ public class Bug8468BaseClass
+ {
+ public string Base;
+ }
+
+ public class Bug8468MidClass: Bug8468BaseClass
+ {
+ public string Mid;
+ }
+
+ [XmlRoot("Test", Namespace="http://test-namespace")]
+ public class Bug8468Subclass: Bug8468MidClass
+ {
+ }
+
+ [XmlRoot("Test")]
+ public class Bug8468SubclassNoNamespace: Bug8468MidClass
+ {
+ }
+
+ [XmlRoot("Test", Namespace="")]
+ public class Bug8468BaseClassV2
+ {
+ public string Base;
+ }
+
+ public class Bug8468MidClassV2: Bug8468BaseClassV2
+ {
+ public string Mid;
+ }
+
+ [XmlRoot("Test", Namespace="http://test-namespace")]
+ public class Bug8468SubclassV2: Bug8468MidClassV2
+ {
+ }
+
+ [XmlRoot("Test")]
+ public class Bug8468SubclassNoNamespaceV2: Bug8468MidClassV2
+ {
+ }
}
+++ /dev/null
-<Type Name="SemaphoreFullException" FullName="System.Threading.SemaphoreFullException">
- <TypeSignature Language="C#" Value="public class SemaphoreFullException : SystemException" />
- <AssemblyInfo>
- <AssemblyName>System</AssemblyName>
- <AssemblyVersion>2.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.SystemException</BaseTypeName>
- </Base>
- <Interfaces />
- <Attributes>
- <Attribute>
- <AttributeName>System.Runtime.InteropServices.ComVisible(false)</AttributeName>
- </Attribute>
- </Attributes>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- <since version=".NET 2.0" />
- </Docs>
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public SemaphoreFullException ();" />
- <MemberType>Constructor</MemberType>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- <since version=".NET 2.0" />
- </Docs>
- <AssemblyInfo>
- <AssemblyVersion>2.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- </Member>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public SemaphoreFullException (string message);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="message" Type="System.String" />
- </Parameters>
- <Docs>
- <param name="message">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- <since version=".NET 2.0" />
- </Docs>
- <AssemblyInfo>
- <AssemblyVersion>2.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- </Member>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="protected SemaphoreFullException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="info" Type="System.Runtime.Serialization.SerializationInfo" />
- <Parameter Name="context" Type="System.Runtime.Serialization.StreamingContext" />
- </Parameters>
- <Docs>
- <param name="info">To be added.</param>
- <param name="context">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- <since version=".NET 2.0" />
- </Docs>
- <AssemblyInfo>
- <AssemblyVersion>2.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- </Member>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public SemaphoreFullException (string message, Exception innerException);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="message" Type="System.String" />
- <Parameter Name="innerException" Type="System.Exception" />
- </Parameters>
- <Docs>
- <param name="message">To be added.</param>
- <param name="innerException">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- <since version=".NET 2.0" />
- </Docs>
- <AssemblyInfo>
- <AssemblyVersion>2.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- </Member>
- </Members>
-</Type>
break;
}
}
-
-#if NET_4_0
+
+#if NET_4_5
+ args.Append("/sdk:4.5");
+#elif NET_4_0
args.Append("/sdk:4");
#else
args.Append("/sdk:2");
Type1Message type1 = new Type1Message ();
type1.Domain = domain;
type1.Host = ""; // MS does not send it
+ type1.Flags |= NtlmFlags.NegotiateNtlm2Key;
message = type1;
} else if (message.Type == 1) {
// Should I check the credentials?
if (password == null)
password = "";
- Type3Message type3 = new Type3Message ();
- type3.Domain = domain;
- // type3.Host = ""; MS sends the machine name for type 3 packets
+ Type3Message type3 = new Type3Message (type2);
type3.Username = userName;
- type3.Challenge = type2.Nonce;
type3.Password = password;
message = type3;
completed = true;
//
//
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Collections;
using System.Collections.Generic;
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_1 || NET_4_0
+#if NET_2_1 || MOBILE || NET_4_0
namespace System.Collections.Generic {
public interface ISet<T> : ICollection<T>
#if (CONFIGURATION_DEP)
foreach (SettingsProvider provider in Providers) {
IApplicationSettingsProvider iasp = provider as IApplicationSettingsProvider;
- if (iasp != null)
- iasp.Reset (Context);
+ CacheValuesByProvider(provider);
}
#endif
}
public void Reset()
{
#if (CONFIGURATION_DEP)
- // Code bellow is identical to code in Reload().
- // foreach (SettingsProvider provider in Providers) {
- // IApplicationSettingsProvider iasp = provider as IApplicationSettingsProvider;
- // if (iasp != null)
- // iasp.Reset (Context);
- // }
-
Reload ();
+ foreach (SettingsPropertyValue pv in PropertyValues)
+ pv.PropertyValue = pv.Reset();
#endif
}
if (col.Count > 0) {
SettingsPropertyValueCollection vals = provider.GetPropertyValues (Context, col);
- PropertyValues.Add (vals);
+ foreach (SettingsPropertyValue prop in vals) {
+ if (PropertyValues [prop.Name] != null)
+ PropertyValues [prop.Name].PropertyValue = prop.PropertyValue;
+ else
+ PropertyValues.Add (prop);
+ }
}
OnSettingsLoaded (this, new SettingsLoadedEventArgs (provider));
if (userGroup == null) {
userGroup = new UserSettingsGroup ();
config.SectionGroups.Add ("userSettings", userGroup);
- ApplicationSettingsBase asb = context.CurrentSettings;
- ClientSettingsSection cs = new ClientSettingsSection ();
- string class_name = NormalizeInvalidXmlChars ((asb != null ? asb.GetType () : typeof (ApplicationSettingsBase)).FullName);
- userGroup.Sections.Add (class_name, cs);
+ }
+ ApplicationSettingsBase asb = context.CurrentSettings;
+ string class_name = NormalizeInvalidXmlChars ((asb != null ? asb.GetType () : typeof (ApplicationSettingsBase)).FullName);
+ ClientSettingsSection userSection = null;
+ ConfigurationSection cnf = userGroup.Sections.Get (class_name);
+ userSection = cnf as ClientSettingsSection;
+ if (userSection == null) {
+ userSection = new ClientSettingsSection ();
+ userGroup.Sections.Add (class_name, userSection);
}
bool hasChanges = false;
- foreach (ConfigurationSection section in userGroup.Sections) {
- ClientSettingsSection userSection = section as ClientSettingsSection;
- if (userSection == null)
- continue;
+ if (userSection == null)
+ return;
- foreach (SettingsPropertyValue value in collection) {
- if (checkUserLevel && value.Property.Attributes.Contains (typeof (SettingsManageabilityAttribute)) != isRoaming)
- continue;
- // The default impl does not save the ApplicationScopedSetting properties
- if (value.Property.Attributes.Contains (typeof (ApplicationScopedSettingAttribute)))
- continue;
+ foreach (SettingsPropertyValue value in collection) {
+ if (checkUserLevel && value.Property.Attributes.Contains (typeof (SettingsManageabilityAttribute)) != isRoaming)
+ continue;
+ // The default impl does not save the ApplicationScopedSetting properties
+ if (value.Property.Attributes.Contains (typeof (ApplicationScopedSettingAttribute)))
+ continue;
- hasChanges = true;
- SettingElement element = userSection.Settings.Get (value.Name);
- if (element == null) {
- element = new SettingElement (value.Name, value.Property.SerializeAs);
- userSection.Settings.Add (element);
- }
- if (element.Value.ValueXml == null)
- element.Value.ValueXml = new XmlDocument ().CreateElement ("value");
- switch (value.Property.SerializeAs) {
- case SettingsSerializeAs.Xml:
- element.Value.ValueXml.InnerXml = (value.SerializedValue as string) ?? string.Empty;
- break;
- case SettingsSerializeAs.String:
- element.Value.ValueXml.InnerText = value.SerializedValue as string;
- break;
- case SettingsSerializeAs.Binary:
- element.Value.ValueXml.InnerText = value.SerializedValue != null ? Convert.ToBase64String (value.SerializedValue as byte []) : string.Empty;
- break;
- default:
- throw new NotImplementedException ();
- }
+ hasChanges = true;
+ SettingElement element = userSection.Settings.Get (value.Name);
+ if (element == null) {
+ element = new SettingElement (value.Name, value.Property.SerializeAs);
+ userSection.Settings.Add (element);
+ }
+ if (element.Value.ValueXml == null)
+ element.Value.ValueXml = new XmlDocument ().CreateElement ("value");
+ switch (value.Property.SerializeAs) {
+ case SettingsSerializeAs.Xml:
+ element.Value.ValueXml.InnerXml = (value.SerializedValue as string) ?? string.Empty;
+ break;
+ case SettingsSerializeAs.String:
+ element.Value.ValueXml.InnerText = value.SerializedValue as string;
+ break;
+ case SettingsSerializeAs.Binary:
+ element.Value.ValueXml.InnerText = value.SerializedValue != null ? Convert.ToBase64String (value.SerializedValue as byte []) : string.Empty;
+ break;
+ default:
+ throw new NotImplementedException ();
}
}
if (hasChanges)
{
CreateExeMap ();
- if (values == null) {
- values = new SettingsPropertyValueCollection ();
- string groupName = context ["GroupName"] as string;
- groupName = NormalizeInvalidXmlChars (groupName); // we likely saved the element removing the non valid xml chars.
- LoadProperties (exeMapCurrent, collection, ConfigurationUserLevel.None, "applicationSettings", false, groupName);
- LoadProperties (exeMapCurrent, collection, ConfigurationUserLevel.None, "userSettings", false, groupName);
+ values = new SettingsPropertyValueCollection ();
+ string groupName = context ["GroupName"] as string;
+ groupName = NormalizeInvalidXmlChars (groupName); // we likely saved the element removing the non valid xml chars.
+ LoadProperties (exeMapCurrent, collection, ConfigurationUserLevel.None, "applicationSettings", false, groupName);
+ LoadProperties (exeMapCurrent, collection, ConfigurationUserLevel.None, "userSettings", false, groupName);
- LoadProperties (exeMapCurrent, collection, ConfigurationUserLevel.PerUserRoaming, "userSettings", true, groupName);
- LoadProperties (exeMapCurrent, collection, ConfigurationUserLevel.PerUserRoamingAndLocal, "userSettings", true, groupName);
+ LoadProperties (exeMapCurrent, collection, ConfigurationUserLevel.PerUserRoaming, "userSettings", true, groupName);
+ LoadProperties (exeMapCurrent, collection, ConfigurationUserLevel.PerUserRoamingAndLocal, "userSettings", true, groupName);
- // create default values if not exist
- foreach (SettingsProperty p in collection)
- if (values [p.Name] == null)
- values.Add (new SettingsPropertyValue (p));
- }
+ // create default values if not exist
+ foreach (SettingsProperty p in collection)
+ if (values [p.Name] == null)
+ values.Add (new SettingsPropertyValue (p));
return values;
}
public void Reset (SettingsContext context)
{
SettingsPropertyCollection coll = new SettingsPropertyCollection ();
- GetPropertyValues (context, coll);
- foreach (SettingsPropertyValue propertyValue in values) {
- // Can't use propertyValue.Property.DefaultValue
- // as it may cause InvalidCastException (see bug# 532180)
- propertyValue.PropertyValue = propertyValue.Reset ();
+ // GetPropertyValues (context, coll);
+ if (values != null) {
+ foreach (SettingsPropertyValue propertyValue in values) {
+ // Can't use propertyValue.Property.DefaultValue
+ // as it may cause InvalidCastException (see bug# 532180)
+ values[propertyValue.Name].PropertyValue = propertyValue.Reset ();
+ }
}
- SetPropertyValues (context, values);
}
// FIXME: implement
private object GetDeserializedDefaultValue ()
{
if (property.DefaultValue == null)
- if (property.PropertyType.IsValueType)
+ if (property.PropertyType != null && property.PropertyType.IsValueType)
return Activator.CreateInstance (property.PropertyType);
else
return null;
[DllImport ("advapi32.dll", SetLastError=true)]
public static extern int DeregisterEventSource (IntPtr hEventLog);
- [DllImport ("kernel32.dll", CharSet=CharSet.Auto, SetLastError=true)]
+ [DllImport ("kernel32", CharSet=CharSet.Auto, SetLastError=true)]
public static extern int FormatMessage (FormatMessageFlags dwFlags, IntPtr lpSource, uint dwMessageId, int dwLanguageId, ref IntPtr lpBuffer, int nSize, IntPtr [] arguments);
- [DllImport ("kernel32.dll", SetLastError=true)]
+ [DllImport ("kernel32", SetLastError=true)]
public static extern bool FreeLibrary (IntPtr hModule);
[DllImport ("advapi32.dll", SetLastError=true)]
[DllImport ("advapi32.dll", SetLastError=true)]
public static extern int GetOldestEventLogRecord (IntPtr hEventLog, ref int OldestRecord);
- [DllImport ("kernel32.dll", SetLastError=true)]
+ [DllImport ("kernel32", SetLastError=true)]
public static extern IntPtr LoadLibraryEx (string lpFileName, IntPtr hFile, LoadFlags dwFlags);
- [DllImport ("kernel32.dll", SetLastError=true)]
+ [DllImport ("kernel32", SetLastError=true)]
public static extern IntPtr LocalFree (IntPtr hMem);
[DllImport ("advapi32.dll", SetLastError=true)]
ref uint cchReferencedDomainName,
out SidNameUse peUse);
- [DllImport ("Advapi32.dll", SetLastError = true)]
+ [DllImport ("advapi32.dll", SetLastError = true)]
public static extern int NotifyChangeEventLog (IntPtr hEventLog, IntPtr hEvent);
[DllImport ("advapi32.dll", SetLastError=true)]
[DllImport ("advapi32.dll", SetLastError=true)]
public static extern IntPtr RegisterEventSource (string machineName, string sourceName);
- [DllImport ("Advapi32.dll", SetLastError=true)]
+ [DllImport ("advapi32.dll", SetLastError=true)]
public static extern int ReportEvent (IntPtr hHandle, ushort wType,
ushort wCategory, uint dwEventID, IntPtr sid, ushort wNumStrings,
uint dwDataSize, string [] lpStrings, byte [] lpRawData);
const uint GenericWrite = 0x40000000;
const uint OpenExisting = 3;
const uint FileFlagOverlapped = 0x40000000;
- const uint PurgeRxClear = 0x0004;
- const uint PurgeTxClear = 0x0008;
+ const uint PurgeRxClear = 0x0008;
+ const uint PurgeTxClear = 0x0004;
const uint WinInfiniteTimeout = 0xFFFFFFFF;
const uint FileIOPending = 997;
public void DiscardOutBuffer ()
{
- if (!PurgeComm (handle, PurgeRxClear))
+ if (!PurgeComm (handle, PurgeTxClear))
ReportIOError (null);
}
#endif
abstract class AudioData {
protected const int buffer_size = 4096;
- bool stopped = false;
+ bool stopped;
public abstract int Channels {
get;
short channels;
ushort frame_divider;
int sample_rate;
- int data_len = 0;
- long data_offset = 0;
+ int data_len;
+ long data_offset;
AudioFormat format;
public WavData (Stream data) {
byte_rate |= buffer [idx++] << 8;
byte_rate |= buffer [idx++] << 16;
byte_rate |= buffer [idx++] << 24;
- int block_align = buffer [idx++] | (buffer [idx++] << 8);
+// int block_align = buffer [idx++] | (buffer [idx++] << 8);
int sign_bits = buffer [idx++] | (buffer [idx++] << 8);
switch (sign_bits) {
short channels;
ushort frame_divider;
int sample_rate;
- int data_len = 0;
- int data_offset = 0;
+ int data_len ;
+// int data_offset;
AudioFormat format;
public AuData (Stream data) {
byte[] chunk_to_play = new byte [chunk_size];
// Read only Au data, don't care about file header here !
- stream.Position = (long)data_offset;
+ stream.Position = 0; //(long)data_offset;
stream.Read (buffer, 0, data_len);
while (!IsStopped && count >= 0){
// PInvokes
- [DllImport ("Iphlpapi.dll")]
+ [DllImport ("iphlpapi.dll")]
static extern int GetTcpTable (byte [] pTcpTable, ref int pdwSize, bool bOrder);
- [DllImport ("Iphlpapi.dll")]
+ [DllImport ("iphlpapi.dll")]
static extern int GetTcp6Table (byte [] TcpTable, ref int SizePointer, bool Order);
- [DllImport ("Iphlpapi.dll")]
+ [DllImport ("iphlpapi.dll")]
static extern int GetUdpTable (byte [] pUdpTable, ref int pdwSize, bool bOrder);
- [DllImport ("Iphlpapi.dll")]
+ [DllImport ("iphlpapi.dll")]
static extern int GetUdp6Table (byte [] Udp6Table, ref int SizePointer, bool Order);
- [DllImport ("Iphlpapi.dll")]
+ [DllImport ("iphlpapi.dll")]
static extern int GetTcpStatisticsEx (out Win32_MIB_TCPSTATS pStats, int dwFamily);
- [DllImport ("Iphlpapi.dll")]
+ [DllImport ("iphlpapi.dll")]
static extern int GetUdpStatisticsEx (out Win32_MIB_UDPSTATS pStats, int dwFamily);
- [DllImport ("Iphlpapi.dll")]
+ [DllImport ("iphlpapi.dll")]
static extern int GetIcmpStatistics (out Win32_MIBICMPINFO pStats, int dwFamily);
- [DllImport ("Iphlpapi.dll")]
+ [DllImport ("iphlpapi.dll")]
static extern int GetIcmpStatisticsEx (out Win32_MIB_ICMP_EX pStats, int dwFamily);
- [DllImport ("Iphlpapi.dll")]
+ [DllImport ("iphlpapi.dll")]
static extern int GetIpStatisticsEx (out Win32_MIB_IPSTATS pStats, int dwFamily);
// Win32 structures
using System.IO;
using System.Runtime.InteropServices;
-#if !NET_2_1
+#if !NET_2_1 || MOBILE
using System.Timers;
using System.Threading;
#endif
}
}
-#if !NET_2_1
+#if !NET_2_1 || MOBILE
#if TARGET_JVM
[MonoNotSupported ("Not supported since Socket.ReceiveTimeout is not supported")]
#endif
}
}
-#if !NET_2_1
+#if !NET_2_1 || MOBILE
#if TARGET_JVM
[MonoNotSupported ("Not supported since Socket.SendTimeout is not supported")]
#endif
}
-#if !NET_2_1
+#if !NET_2_1 || MOBILE
public void Close (int timeout)
{
if (timeout < -1) {
}
class CFWebProxy : IWebProxy {
+ ICredentials credentials;
+ bool userSpecified;
+
public CFWebProxy ()
{
-
}
public ICredentials Credentials {
- get; set;
+ get { return credentials; }
+ set {
+ userSpecified = true;
+ credentials = value;
+ }
}
- static Uri GetProxyUri (CFProxy proxy)
+ static Uri GetProxyUri (CFProxy proxy, out NetworkCredential credentials)
{
string protocol;
protocol = "http://";
break;
default:
+ credentials = null;
return null;
}
string password = proxy.Password;
string hostname = proxy.HostName;
int port = proxy.Port;
- string userinfo;
string uri;
- if (username != null) {
- if (password != null)
- userinfo = Uri.EscapeDataString (username) + ':' + Uri.EscapeDataString (password) + '@';
- else
- userinfo = Uri.EscapeDataString (username) + '@';
- } else {
- userinfo = string.Empty;
- }
+ if (username != null)
+ credentials = new NetworkCredential (username, password);
+ else
+ credentials = null;
- uri = protocol + userinfo + hostname + (port != 0 ? ':' + port.ToString () : string.Empty);
+ uri = protocol + hostname + (port != 0 ? ':' + port.ToString () : string.Empty);
return new Uri (uri, UriKind.Absolute);
}
- static Uri GetProxyUriFromScript (IntPtr script, Uri targetUri)
+ static Uri GetProxyUriFromScript (IntPtr script, Uri targetUri, out NetworkCredential credentials)
{
CFProxy[] proxies = CFNetwork.GetProxiesForAutoConfigurationScript (script, targetUri);
- if (proxies == null)
+ if (proxies == null) {
+ credentials = null;
return targetUri;
+ }
for (int i = 0; i < proxies.Length; i++) {
switch (proxies[i].ProxyType) {
case CFProxyType.HTTP:
case CFProxyType.FTP:
// create a Uri based on the hostname/port/etc info
- return GetProxyUri (proxies[i]);
+ return GetProxyUri (proxies[i], out credentials);
case CFProxyType.SOCKS:
default:
// unsupported proxy type, try the next one
break;
case CFProxyType.None:
// no proxy should be used
+ credentials = null;
return targetUri;
}
}
+ credentials = null;
+
return null;
}
public Uri GetProxy (Uri targetUri)
{
+ NetworkCredential credentials = null;
+ Uri proxy = null;
+
if (targetUri == null)
throw new ArgumentNullException ("targetUri");
try {
CFProxySettings settings = CFNetwork.GetSystemProxySettings ();
CFProxy[] proxies = CFNetwork.GetProxiesForUri (targetUri, settings);
- Uri uri;
- if (proxies == null)
- return targetUri;
-
- for (int i = 0; i < proxies.Length; i++) {
- switch (proxies[i].ProxyType) {
- case CFProxyType.AutoConfigurationJavaScript:
- if ((uri = GetProxyUriFromScript (proxies[i].AutoConfigurationJavaScript, targetUri)) != null)
- return uri;
- break;
- case CFProxyType.AutoConfigurationUrl:
- // unsupported proxy type (requires fetching script from remote url)
- break;
- case CFProxyType.HTTPS:
- case CFProxyType.HTTP:
- case CFProxyType.FTP:
- // create a Uri based on the hostname/port/etc info
- return GetProxyUri (proxies[i]);
- case CFProxyType.SOCKS:
- // unsupported proxy type, try the next one
- break;
- case CFProxyType.None:
- // no proxy should be used
- return targetUri;
+ if (proxies != null) {
+ for (int i = 0; i < proxies.Length && proxy == null; i++) {
+ switch (proxies[i].ProxyType) {
+ case CFProxyType.AutoConfigurationJavaScript:
+ proxy = GetProxyUriFromScript (proxies[i].AutoConfigurationJavaScript, targetUri, out credentials);
+ break;
+ case CFProxyType.AutoConfigurationUrl:
+ // unsupported proxy type (requires fetching script from remote url)
+ break;
+ case CFProxyType.HTTPS:
+ case CFProxyType.HTTP:
+ case CFProxyType.FTP:
+ // create a Uri based on the hostname/port/etc info
+ proxy = GetProxyUri (proxies[i], out credentials);
+ break;
+ case CFProxyType.SOCKS:
+ // unsupported proxy type, try the next one
+ break;
+ case CFProxyType.None:
+ // no proxy should be used
+ proxy = targetUri;
+ break;
+ }
+ }
+
+ if (proxy == null) {
+ // no supported proxies for this Uri, fall back to trying to connect to targetUri directly
+ proxy = targetUri;
}
+ } else {
+ proxy = targetUri;
}
} catch {
// ignore errors while retrieving proxy data
+ proxy = targetUri;
}
- // no supported proxies for this Uri, fall back to trying to connect to targetUri directly.
- return targetUri;
+
+ if (!userSpecified)
+ this.credentials = credentials;
+
+ return proxy;
}
public bool IsBypassed (Uri targetUri)
}
}
- static CFWebProxy defaultWebProxy;
public static IWebProxy GetDefaultProxy ()
{
- if (defaultWebProxy == null)
- defaultWebProxy = new CFWebProxy ();
-
- return defaultWebProxy;
+ return new CFWebProxy ();
}
}
}
request.SetWriteStream (new WebConnectionStream (this, request));
}
-
+
+#if MONOTOUCH
+ static bool warned_about_queue = false;
+#endif
+
internal EventHandler SendRequest (HttpWebRequest request)
{
if (request.Aborted)
ThreadPool.QueueUserWorkItem (initConn, request);
} else {
lock (queue) {
+#if MONOTOUCH
+ if (!warned_about_queue) {
+ warned_about_queue = true;
+ Console.WriteLine ("WARNING: An HttpWebRequest was added to the ConnectionGroup queue because the connection limit was reached.");
+ }
+#endif
queue.Enqueue (request);
}
}
public WebConnectionStream (WebConnection cnc)
{
+ if (cnc.Data == null)
+ throw new InvalidOperationException ("cnc.Data was not initialized");
+ if (cnc.Data.Headers == null)
+ throw new InvalidOperationException ("cnc.Data.Headers was not initialized");
+ if (cnc.Data.request == null)
+ throw new InvalidOperationException ("cnc.Data.request was not initialized");
isRead = true;
cb_wrapper = new AsyncCallback (ReadCallbackWrapper);
pending = new ManualResetEvent (true);
raw_data = value [0].GetBytes ();
X509Extension newt = null;
-#if MOONLIGHT
+#if MOONLIGHT || FULL_AOT_RUNTIME
// non-extensible
switch (oid) {
case "2.5.29.14":
[Serializable]
public partial class Regex : ISerializable {
-#if !TARGET_JVM
+#if !TARGET_JVM && !FULL_AOT_RUNTIME
[MonoTODO]
public static void CompileToAssembly (RegexCompilationInfo [] regexes, AssemblyName aname)
{
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Diagnostics;
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Runtime.Serialization;
System.Collections.Generic/SortedList.cs
System.Collections.Generic/SortedSet.cs
System.Collections.Generic/Stack.cs
+System.Collections.Concurrent/BlockingCollection.cs
+System.Collections.Concurrent/ConcurrentBag.cs
System.Collections.ObjectModel/ObservableCollection.cs
System.Collections.ObjectModel/ReadOnlyObservableCollection.cs
System.Collections.Specialized/BitVector32.cs
System.Runtime.InteropServices.ComTypes/TYMED.cs
System/IUriData.cs
System/UriData.cs
-System.Collections.Concurrent/BlockingCollection.cs
-System.Collections.Concurrent/ConcurrentBag.cs
../corlib/System.Threading.Tasks/CyclicDeque.cs
../corlib/System.Threading.Tasks/PopResult.cs
if (segments [k] != segments2 [k])
break;
- for (int i = k + 1; i < segments.Length; i++)
+ for (int i = k; i < segments.Length && segments [i].EndsWith ("/"); i++)
result += "../";
for (int i = k; i < segments2.Length; i++)
result += segments2 [i];
- // if there is more than 1 segment and if the last segment of segments
- // ends with separator char, assume its a directory and prepend "../"
- if (segments.Length > 1) {
- var lastSegment = segments [segments.Length - 1];
- if (lastSegment.EndsWith ("/"))
- result = "../" + result;
- }
+ if (result == string.Empty)
+ result = "./";
}
uri.AppendQueryAndFragment (ref result);
Assert.AreEqual (0, list_changed_index, "4");
Assert.AreEqual (1, poker.Count, "5");
}
+
+ private class Item : INotifyPropertyChanged {
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ string _name;
+
+ public string Name {
+ get { return _name; }
+ set {
+ if (_name != value) {
+ _name = value;
+ OnPropertyChanged ("Name");
+ }
+ }
+ }
+
+ void OnPropertyChanged (string name)
+ {
+ var fn = PropertyChanged;
+ if (fn != null)
+ fn (this, new PropertyChangedEventArgs (name));
+ }
+ }
+
+ [Test] // https://bugzilla.xamarin.com/show_bug.cgi?id=8366
+ public void Bug8366 ()
+ {
+ bool added = false;
+ bool changed = false;
+ var list = new BindingList<Item> ();
+ list.ListChanged += (object sender, ListChangedEventArgs e) => {
+ added |= e.ListChangedType == ListChangedType.ItemAdded;
+ changed |= e.ListChangedType == ListChangedType.ItemChanged;
+ };
+
+ var item = new Item () { Name = "1" };
+ list.Add (item);
+
+ item.Name = "2";
+
+ Assert.IsTrue (added, "ItemAdded");
+ Assert.IsTrue (changed, "ItemChanged");
+ }
}
}
}
[Test] // bug #532180
- public void DefaultSettingValueAsWithReload() {
+ public void DefaultSettingValueAsWithReload()
+ {
Bug532180 settings = new Bug532180();
- Assert.AreEqual(10, settings.IntSetting, "A1");
+ Assert.AreEqual (10, settings.IntSetting, "A1");
settings.IntSetting = 1;
- Assert.AreEqual(1, settings.IntSetting, "A2");
- settings.Reload();
- Assert.AreEqual(10, settings.IntSetting, "A3");
+ Assert.AreEqual (1, settings.IntSetting, "A2");
+ settings.Reload ();
+ Assert.AreEqual (10, settings.IntSetting, "A3");
}
+
+ class Bug8592ConfHolder : ApplicationSettingsBase {
+ [UserScopedSetting]
+ public string TestKey1OnHolder {
+ get { return (string) this ["TestKey1OnHolder"] ?? ""; }
+ set { this ["TestKey1OnHolder"] = value; }
+ }
+ }
+
+ [Test]
+ public void TestBug8592BasicOperations ()
+ {
+ var holder = new Bug8592ConfHolder ();
+ holder.Reset ();
+ holder.Save ();
+ Assert.AreEqual ("", holder.TestKey1OnHolder);
+ holder.TestKey1OnHolder = "candy";
+ Assert.AreEqual ("candy", holder.TestKey1OnHolder);
+ holder.Reload ();
+ Assert.AreEqual ("", holder.TestKey1OnHolder);
+ holder.TestKey1OnHolder = "candy";
+ Assert.AreEqual ("candy", holder.TestKey1OnHolder);
+ holder.Save ();
+ Assert.AreEqual ("candy", holder.TestKey1OnHolder);
+ holder.Reload ();
+ Assert.AreEqual ("candy", holder.TestKey1OnHolder);
+ holder.Reset ();
+ Assert.AreEqual ("", holder.TestKey1OnHolder);
+ }
+
+ class Bug8533ConfHolder1 : ApplicationSettingsBase {
+ [UserScopedSetting]
+ public string TestKey1OnHolder1 {
+ get { return (string) this ["TestKey1OnHolder1"] ?? ""; }
+ set { this ["TestKey1OnHolder1"] = value; }
+ }
+
+ [UserScopedSetting]
+ public string TestKey1OnHolder2 {
+ get { return (string) this ["TestKey1OnHolder2"] ?? ""; }
+ set { this ["TestKey1OnHolder2"] = value; }
+ }
+
+ [UserScopedSetting]
+ public string TestKey {
+ get { return (string) this ["TestKey"] ?? ""; }
+ set { this ["TestKey"] = value; }
+ }
+ }
+
+ class Bug8533ConfHolder2 : ApplicationSettingsBase {
+ [UserScopedSetting]
+ public string TestKey1OnHolder2 {
+ get { return (string) this ["TestKey1OnHolder2"] ?? ""; }
+ set { this ["TestKey1OnHolder2"] = value; }
+ }
+
+ [UserScopedSetting]
+ public string TestKey {
+ get { return (string) this ["TestKey"] ?? ""; }
+ set { this ["TestKey"] = value; }
+ }
+ }
+
+ [Test]
+ public void TestBug8533ConfHandlerWronglyMixedUp ()
+ {
+ var holder1 = new Bug8533ConfHolder1 ();
+ var holder2 = new Bug8533ConfHolder2 ();
+ holder1.TestKey1OnHolder1 = "candy";
+ holder2.TestKey1OnHolder2 = "donut";
+ holder1.TestKey = "eclair";
+ holder1.Save ();
+ holder2.Save ();
+ holder1.Reload ();
+ holder2.Reload();
+ Assert.AreEqual ("", holder1.TestKey1OnHolder2);
+ Assert.AreEqual ("candy", holder1.TestKey1OnHolder1);
+ Assert.AreEqual ("donut", holder2.TestKey1OnHolder2);
+ Assert.AreEqual ("eclair", holder1.TestKey);
+ Assert.AreEqual ("", holder2.TestKey);
+ }
}
}
Uri uri13 = new Uri ("mailto:xxx@xxx.com/foo/bar");
Uri uri14 = new Uri ("http://www.contoso.com/test1/");
Uri uri15 = new Uri ("http://www.contoso.com/");
+ Uri uri16 = new Uri ("http://www.contoso.com/test");
AssertRelativeUri ("foo/bar/index.htm#fragment", uri1, uri2, "#A");
AssertRelativeUri ("../../index.htm?x=2", uri2, uri1, "#B");
Assert.AreEqual (uri5.OriginalString, relativeUri.OriginalString, "#N3");
AssertRelativeUri ("../", uri14, uri15, "#O");
+ AssertRelativeUri ("./", uri16, uri15, "#P");
+
+ Uri a1 = new Uri ("http://something/something2/test/");
+ Uri a2 = new Uri ("http://something/something2/");
+ Uri a3 = new Uri ("http://something/something2/test");
+ Uri a4 = new Uri ("http://something/something2");
+
+ AssertRelativeUri ("../", a1, a2, "Q1");
+ AssertRelativeUri ("../../something2", a1, a4, "Q2");
+ AssertRelativeUri ("./", a3, a2, "Q3");
+ AssertRelativeUri ("../something2", a3, a4, "Q4");
+
+ Uri b1 = new Uri ("http://something/test/");
+ Uri b2 = new Uri ("http://something/");
+ Uri b3 = new Uri ("http://something/test");
+ Uri b4 = new Uri ("http://something");
+
+ AssertRelativeUri ("../", b1, b2, "R1");
+ AssertRelativeUri ("../", b1, b4, "R2");
+ AssertRelativeUri ("./", b3, b2, "R3");
+ AssertRelativeUri ("./", b3, b4, "R4");
+
+ Uri c1 = new Uri ("C:\\something\\something2\\test\\");
+ Uri c2 = new Uri ("C:\\something\\something2\\");
+ Uri c3 = new Uri ("C:\\something\\something2\\test");
+ Uri c4 = new Uri ("C:\\something\\something2");
+
+ AssertRelativeUri ("../", c1, c2, "S1");
+ AssertRelativeUri ("../../something2", c1, c4, "S2");
+ AssertRelativeUri ("./", c3, c2, "S3");
+ AssertRelativeUri ("../something2", c3, c4, "S4");
+
+ Uri d1 = new Uri ("C:\\something\\test\\");
+ Uri d2 = new Uri ("C:\\something\\");
+ Uri d3 = new Uri ("C:\\something\\test");
+ Uri d4 = new Uri ("C:\\something");
+
+ AssertRelativeUri ("../", d1, d2, "T1");
+ AssertRelativeUri ("../../something", d1, d4, "T2");
+ AssertRelativeUri ("./", d3, d2, "T3");
+ AssertRelativeUri ("../something", d3, d4, "T4");
+
+ Uri e1 = new Uri ("C:\\something\\");
+ Uri e2 = new Uri ("C:\\");
+ Uri e3 = new Uri ("C:\\something");
+
+ AssertRelativeUri ("../", e1, e2, "U1");
+ AssertRelativeUri ("./", e3, e2, "U2");
+ AssertRelativeUri ("", e1, e1, "U3");
+ AssertRelativeUri ("", e3, e3, "U4");
+ AssertRelativeUri ("../something", e1, e3, "U5");
+ AssertRelativeUri ("something/", e3, e1, "U6");
+ AssertRelativeUri ("something", e2, e3, "U7");
}
[Test]
../corlib/System.Collections.Generic/CollectionDebuggerView.cs
../corlib/System.Collections/CollectionDebuggerView.cs
../corlib/Mono/DataConverter.cs
+../corlib/System.Threading.Tasks/CyclicDeque.cs
+../corlib/System.Threading.Tasks/IConcurrentDeque.cs
+../corlib/System.Threading.Tasks/PopResult.cs
+../corlib/System.Threading/AtomicBoolean.cs
Assembly/AssemblyInfo.cs
Mono.Http/NtlmClient.cs
System.Collections.Generic/ISet.cs
System.Collections.Generic/LinkedList.cs
System.Collections.Generic/LinkedListNode.cs
-System.Collections.Generic/Queue.cs
System.Collections.Generic/RBTree.cs
+System.Collections.Generic/Queue.cs
System.Collections.Generic/SortedDictionary.cs
System.Collections.Generic/SortedList.cs
System.Collections.Generic/SortedSet.cs
System.Collections.Generic/Stack.cs
+System.Collections.Concurrent/BlockingCollection.cs
+System.Collections.Concurrent/ConcurrentBag.cs
System.Collections.ObjectModel/ObservableCollection.cs
System.Collections.ObjectModel/ReadOnlyObservableCollection.cs
System.Collections.Specialized/BitVector32.cs
System.ComponentModel.Design/ServiceCreatorCallback.cs
System.ComponentModel.Design/StandardCommands.cs
System.ComponentModel.Design/ViewTechnology.cs
+System.ComponentModel/AddingNewEventArgs.cs
+System.ComponentModel/AddingNewEventHandler.cs
System.ComponentModel/ArrayConverter.cs
System.ComponentModel/AsyncCompletedEventArgs.cs
System.ComponentModel/AsyncCompletedEventHandler.cs
System.ComponentModel/BackgroundWorker.cs
System.ComponentModel/BaseNumberConverter.cs
System.ComponentModel/BindableSupport.cs
+System.ComponentModel/BindingList.cs
System.ComponentModel/BooleanConverter.cs
System.ComponentModel/BrowsableAttribute.cs
System.ComponentModel/ByteConverter.cs
System.ComponentModel/GuidConverter.cs
System.ComponentModel/IBindingList.cs
System.ComponentModel/IBindingListView.cs
+System.ComponentModel/ICancelAddNew.cs
System.ComponentModel/IChangeTracking.cs
System.ComponentModel/IComNativeDescriptorHandler.cs
System.ComponentModel/IComponent.cs
System.ComponentModel/IDataErrorInfo.cs
System.ComponentModel/IDataErrorInfo.cs
System.ComponentModel/IEditableObject.cs
+System.ComponentModel/IExtenderProvider.cs
System.ComponentModel/IListSource.cs
System.ComponentModel/INotifyPropertyChanged.cs
System.ComponentModel/INotifyPropertyChanging.cs
+System.ComponentModel/IRaiseItemChangedEvents.cs
System.ComponentModel/IRevertibleChangeTracking.cs
System.ComponentModel/ISite.cs
System.ComponentModel/ISupportInitialize.cs
System.Net.Sockets/TcpListener.cs
System.Net.Sockets/TransmitFileOptions.cs
System.Net.Sockets/UdpClient.cs
+System.Net.Sockets/UdpReceiveResult.cs
System.Net/AuthenticationManager.cs
System.Net/AuthenticationSchemeSelector.cs
System.Net/AuthenticationSchemes.cs
System.Net/DefaultCertificatePolicy.cs
System.Net/DigestClient.cs
System.Net/Dns.cs
+System.Net/DnsEndPoint.cs
System.Net/DownloadDataCompletedEventArgs.cs
System.Net/DownloadDataCompletedEventHandler.cs
System.Net/DownloadProgressChangedEventArgs.cs
System.Net/ServicePoint.cs
System.Net/ServicePointManager.cs
System.Net/SocketAddress.cs
+System.Net/TransportContext.cs
System.Net/TransportType.cs
System.Net/UploadDataCompletedEventArgs.cs
System.Net/UploadDataCompletedEventHandler.cs
System.Net/WebRequest.cs
System.Net/WebRequestMethods.cs
System.Net/WebResponse.cs
+System.Runtime.InteropServices/DefaultParameterValueAttribute.cs
System.Security.AccessControl/SemaphoreAccessRule.cs
System.Security.AccessControl/SemaphoreAuditRule.cs
System.Security.AccessControl/SemaphoreRights.cs
System.Security.Authentication/CipherAlgorithmType.cs
System.Security.Authentication/ExchangeAlgorithmType.cs
System.Security.Authentication/HashAlgorithmType.cs
-System.Security.Authentication/InvalidCredentialException.cs
System.Security.Authentication/SslProtocols.cs
+System.Security.Authentication/InvalidCredentialException.cs
+System.Security.Authentication.ExtendedProtection/ChannelBinding.cs
+System.Security.Authentication.ExtendedProtection/ChannelBindingKind.cs
+System.Security.Authentication.ExtendedProtection/ExtendedProtectionPolicy.cs
+System.Security.Authentication.ExtendedProtection/ExtendedProtectionPolicyTypeConverter.cs
+System.Security.Authentication.ExtendedProtection/PolicyEnforcement.cs
+System.Security.Authentication.ExtendedProtection/ProtectionScenario.cs
+System.Security.Authentication.ExtendedProtection/ServiceNameCollection.cs
+System.Security.Authentication.ExtendedProtection.Configuration/ConfigUtil.cs
+System.Security.Authentication.ExtendedProtection.Configuration/ExtendedProtectionPolicyElement.cs
+System.Security.Authentication.ExtendedProtection.Configuration/ServiceNameElement.cs
+System.Security.Authentication.ExtendedProtection.Configuration/ServiceNameElementCollection.cs
System.Security.Cryptography.X509Certificates/OSX509Certificates.cs
System.Security.Cryptography.X509Certificates/OpenFlags.cs
System.Security.Cryptography.X509Certificates/PublicKey.cs
System.Text.RegularExpressions/quicksearch.cs
System.Text.RegularExpressions/replace.cs
System.Text.RegularExpressions/syntax.cs
+System.Threading/Barrier.cs
+System.Threading/BarrierPostPhaseException.cs
System.Threading/Semaphore.cs
System.Threading/SemaphoreFullException.cs
System.Threading/ThreadExceptionEventArgs.cs
System/UriTypeConverter.cs
System/UriElements.cs
System/UriParseComponents.cs
-System.Windows.Input/ICommand.cs
\ No newline at end of file
+System.Windows.Input/ICommand.cs
#else
using System;
-using System.Windows;
namespace System.Collections.Specialized {
{
protected GroupDescription ()
{
- throw new NotImplementedException ();
}
public ObservableCollection<object> GroupNames {
protected virtual void OnPropertyChanged (PropertyChangedEventArgs e)
{
- throw new NotImplementedException ();
+ if (PropertyChanged != null)
+ PropertyChanged (this, e);
}
[EditorBrowsable (EditorBrowsableState.Never)]
--- /dev/null
+//
+// IEditableCollectionViewAddNewItem.cs
+//
+// Author:
+// Antonius Riha <antoniusriha@gmail.com>
+//
+// Copyright (c) 2012 Antonius Riha
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if NET_4_0
+
+namespace System.ComponentModel
+{
+ public interface IEditableCollectionViewAddNewItem : IEditableCollectionView
+ {
+ bool CanAddNewItem { get; }
+ object AddNewItem (object newItem);
+ }
+}
+
+#endif
<Compile Include="System.ComponentModel\ICollectionView.cs" />
<Compile Include="System.ComponentModel\ICollectionViewFactory.cs" />
<Compile Include="System.ComponentModel\IEditableCollectionView.cs" />
+ <Compile Include="System.ComponentModel\IEditableCollectionViewAddNewItem.cs" />
<Compile Include="System.ComponentModel\IItemProperties.cs" />
<Compile Include="System.ComponentModel\ItemPropertyInfo.cs" />
<Compile Include="System.ComponentModel\NewItemPlaceholderPosition.cs" />
<Compile Include="System.ComponentModel\ICollectionView.cs" />
<Compile Include="System.ComponentModel\ICollectionViewFactory.cs" />
<Compile Include="System.ComponentModel\IEditableCollectionView.cs" />
+ <Compile Include="System.ComponentModel\IEditableCollectionViewAddNewItem.cs" />
<Compile Include="System.ComponentModel\IItemProperties.cs" />
<Compile Include="System.ComponentModel\ItemPropertyInfo.cs" />
<Compile Include="System.ComponentModel\NewItemPlaceholderPosition.cs" />
System.ComponentModel/ICollectionView.cs
System.ComponentModel/ICollectionViewFactory.cs
System.ComponentModel/IEditableCollectionView.cs
+System.ComponentModel/IEditableCollectionViewAddNewItem.cs
System.ComponentModel/IItemProperties.cs
System.ComponentModel/ItemPropertyInfo.cs
System.ComponentModel/NewItemPlaceholderPosition.cs
--- /dev/null
+
+// useful grep
+// grep -h "#if" /svn/mono/external/rx/Rx.NET/System.Reactive.*/*.cs /svn/mono/external/rx/Rx.NET/System.Reactive.*/*/*.cs /svn/mono/external/rx/Rx.NET/System.Reactive.*/*/*/*.cs | sort | uniq
+
+using System.Diagnostics;
+using System.IO;
+using System.Xml.Linq;
+using System.Xml.XPath;
+
+var asses = new string [] {
+ "System.Reactive.Interfaces",
+ "System.Reactive.Core",
+ "System.Reactive.PlatformServices",
+ "System.Reactive.Linq",
+ "System.Reactive.Debugger", // maybe needed for testing assembly.
+ "System.Reactive.Experimental", // needed for testing assembly.
+ "System.Reactive.Providers",
+ "System.Reactive.Runtime.Remoting",
+ "System.Reactive.Windows.Forms",
+ "System.Reactive.Windows.Threading",
+ "Microsoft.Reactive.Testing",
+ "Tests.System.Reactive",
+ };
+
+var blacklist = new string [] {
+ // FIXME: this is the only source that we cannot build.
+ //Test/../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObservableExTest.cs(1478,27): error CS0411: The type arguments for method `System.Reactive.Linq.ObservableEx.ManySelect<TSource,TResult>(this System.IObservable<TSource>, System.Func<System.IObservable<TSource>,TResult>)' cannot be inferred from the usage. Try specifying the type arguments explicitly
+ "ObservableExTest.cs",
+
+ // WPF Dispatcher.Invoke() is not implemented.
+ "DispatcherSchedulerTest.cs",
+ // This is not limited to Dispatcher, but many of them are relevant to it, or Winforms (we filter it out by not defining HAS_WINFORMS)
+ "ObservableConcurrencyTest.cs",
+ };
+
+foreach (var ass in asses) {
+
+ var monoass = ass == "Microsoft.Reactive.Testing" ?
+ "Mono.Reactive.Testing" : ass;
+ var basePath = "../../external/rx/Rx.NET";
+ var csproj = Path.Combine (basePath, ass, ass + ".csproj");
+ var pathPrefix = ass == "Tests.System.Reactive" ? "../../" : "../";
+
+ // tests are built under Mono.Reactive.Testing directory.
+ var sources =
+ monoass == "Tests.System.Reactive" ?
+ Path.Combine ("Mono.Reactive.Testing", "Mono.Reactive.Testing_test.dll.sources") :
+ Path.Combine (monoass, monoass + ".dll.sources");
+
+ var doc = XDocument.Load (csproj);
+ var rootNS = doc.XPathSelectElement ("//*[local-name()='RootNamespace']").Value;
+ using (var tw = File.CreateText (sources)) {
+ foreach (var path in doc.XPathSelectElements ("//*[local-name()='Compile']")
+ .Select (el => el.Attribute ("Include").Value)
+ .Select (s => s.Replace ("\\", "/")))
+ if (!blacklist.Any (b => path.Contains (b)))
+ tw.WriteLine (Path.Combine (pathPrefix, basePath, ass, path));
+ }
+
+ var argsPath = Path.Combine (Path.GetDirectoryName (sources), "more_build_args");
+ using (var tw = File.CreateText (argsPath)) {
+ tw.WriteLine ("-d:SIGNED");
+ tw.WriteLine ("-delaysign");
+ tw.WriteLine ("-keyfile:../reactive.pub");
+
+ foreach (var path in doc.XPathSelectElements ("//*[local-name()='EmbeddedResource']")) {
+ var res = path.Attribute ("Include").Value;
+ var resx = Path.Combine (basePath, ass, res);
+ var resFileName = res.Replace ("resx", "resources");
+ var resxDest = Path.Combine (monoass, res);
+ var resPath = Path.Combine (monoass, resFileName);
+ if (File.Exists (resxDest))
+ File.Delete (resxDest);
+ File.Copy (resx, resxDest);
+ //Process.Start ("resgen", String.Format ("{0} {1}", resx, resPath));
+ tw.WriteLine ("-resource:{0},{1}.{2}", resFileName, rootNS, resFileName);
+ }
+ }
+}
+
+++ /dev/null
-<Type Name="Action" FullName="System.Action">
- <TypeSignature Language="C#" Value="public delegate void Action();" />
- <AssemblyInfo>
- <AssemblyName>mscorlib</AssemblyName>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Delegate</BaseTypeName>
- </Base>
- <Attributes>
- <Attribute>
- <AttributeName>System.Runtime.CompilerServices.TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")</AttributeName>
- </Attribute>
- </Attributes>
- <Parameters />
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
+++ /dev/null
-<Type Name="Action<T>" FullName="System.Action<T>">
- <TypeSignature Language="C#" Value="public delegate void Action<in T>(T obj);" />
- <AssemblyInfo>
- <AssemblyName>mscorlib</AssemblyName>
- <AssemblyVersion>2.0.0.0</AssemblyVersion>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <TypeParameters>
- <TypeParameter Name="T">
- <Constraints>
- <ParameterAttribute>Contravariant</ParameterAttribute>
- </Constraints>
- </TypeParameter>
- </TypeParameters>
- <Base>
- <BaseTypeName>System.Delegate</BaseTypeName>
- </Base>
- <Parameters>
- <Parameter Name="obj" Type="T" />
- </Parameters>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Docs>
- <typeparam name="T">The type. </typeparam>
- <param name="obj">The object on which to perform an action.</param>
- <summary>A delegate to a method that returns no values, and takes one parameter.</summary>
- <remarks>Since the compiler can infer the types, you do not need to provide the type, this is typically used with the <see cref="T:System.Array.Foreach" /> method or the <see cref="T:System.Collections.Generic.List" />'s ForEach method.
-
-<example><code lang="C#">
-//
-// Simple "echo" implementation
-//
-using System;
-
-class X {
-
- static void Main (string [] args)
- {
- Array.ForEach (args, print);
- Console.WriteLine ();
- }
-
- static void print (string a)
- {
- Console.Write (a);
- Console.Write (" ");
- }
-}
- </code></example></remarks>
- <since version=".NET 2.0" />
- </Docs>
-</Type>
+++ /dev/null
-<Type Name="Action<T1,T2>" FullName="System.Action<T1,T2>">
- <TypeSignature Language="C#" Value="public delegate void Action<in T1,in T2>(T1 arg1, T2 arg2);" />
- <AssemblyInfo>
- <AssemblyName>mscorlib</AssemblyName>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <TypeParameters>
- <TypeParameter Name="T1">
- <Constraints>
- <ParameterAttribute>Contravariant</ParameterAttribute>
- </Constraints>
- </TypeParameter>
- <TypeParameter Name="T2">
- <Constraints>
- <ParameterAttribute>Contravariant</ParameterAttribute>
- </Constraints>
- </TypeParameter>
- </TypeParameters>
- <Base>
- <BaseTypeName>System.Delegate</BaseTypeName>
- </Base>
- <Attributes>
- <Attribute>
- <AttributeName>System.Runtime.CompilerServices.TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")</AttributeName>
- </Attribute>
- </Attributes>
- <Parameters>
- <Parameter Name="arg1" Type="T1" />
- <Parameter Name="arg2" Type="T2" />
- </Parameters>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Docs>
- <typeparam name="T1">To be added.</typeparam>
- <typeparam name="T2">To be added.</typeparam>
- <param name="arg1">To be added.</param>
- <param name="arg2">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
+++ /dev/null
-<Type Name="Action<T1,T2,T3>" FullName="System.Action<T1,T2,T3>">
- <TypeSignature Language="C#" Value="public delegate void Action<in T1,in T2,in T3>(T1 arg1, T2 arg2, T3 arg3);" />
- <AssemblyInfo>
- <AssemblyName>mscorlib</AssemblyName>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <TypeParameters>
- <TypeParameter Name="T1">
- <Constraints>
- <ParameterAttribute>Contravariant</ParameterAttribute>
- </Constraints>
- </TypeParameter>
- <TypeParameter Name="T2">
- <Constraints>
- <ParameterAttribute>Contravariant</ParameterAttribute>
- </Constraints>
- </TypeParameter>
- <TypeParameter Name="T3">
- <Constraints>
- <ParameterAttribute>Contravariant</ParameterAttribute>
- </Constraints>
- </TypeParameter>
- </TypeParameters>
- <Base>
- <BaseTypeName>System.Delegate</BaseTypeName>
- </Base>
- <Attributes>
- <Attribute>
- <AttributeName>System.Runtime.CompilerServices.TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")</AttributeName>
- </Attribute>
- </Attributes>
- <Parameters>
- <Parameter Name="arg1" Type="T1" />
- <Parameter Name="arg2" Type="T2" />
- <Parameter Name="arg3" Type="T3" />
- </Parameters>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Docs>
- <typeparam name="T1">To be added.</typeparam>
- <typeparam name="T2">To be added.</typeparam>
- <typeparam name="T3">To be added.</typeparam>
- <param name="arg1">To be added.</param>
- <param name="arg2">To be added.</param>
- <param name="arg3">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
+++ /dev/null
-<Type Name="Action<T1,T2,T3,T4>" FullName="System.Action<T1,T2,T3,T4>">
- <TypeSignature Language="C#" Value="public delegate void Action<in T1,in T2,in T3,in T4>(T1 arg1, T2 arg2, T3 arg3, T4 arg4);" />
- <AssemblyInfo>
- <AssemblyName>mscorlib</AssemblyName>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <TypeParameters>
- <TypeParameter Name="T1">
- <Constraints>
- <ParameterAttribute>Contravariant</ParameterAttribute>
- </Constraints>
- </TypeParameter>
- <TypeParameter Name="T2">
- <Constraints>
- <ParameterAttribute>Contravariant</ParameterAttribute>
- </Constraints>
- </TypeParameter>
- <TypeParameter Name="T3">
- <Constraints>
- <ParameterAttribute>Contravariant</ParameterAttribute>
- </Constraints>
- </TypeParameter>
- <TypeParameter Name="T4">
- <Constraints>
- <ParameterAttribute>Contravariant</ParameterAttribute>
- </Constraints>
- </TypeParameter>
- </TypeParameters>
- <Base>
- <BaseTypeName>System.Delegate</BaseTypeName>
- </Base>
- <Attributes>
- <Attribute>
- <AttributeName>System.Runtime.CompilerServices.TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")</AttributeName>
- </Attribute>
- </Attributes>
- <Parameters>
- <Parameter Name="arg1" Type="T1" />
- <Parameter Name="arg2" Type="T2" />
- <Parameter Name="arg3" Type="T3" />
- <Parameter Name="arg4" Type="T4" />
- </Parameters>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Docs>
- <typeparam name="T1">To be added.</typeparam>
- <typeparam name="T2">To be added.</typeparam>
- <typeparam name="T3">To be added.</typeparam>
- <typeparam name="T4">To be added.</typeparam>
- <param name="arg1">To be added.</param>
- <param name="arg2">To be added.</param>
- <param name="arg3">To be added.</param>
- <param name="arg4">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
+++ /dev/null
-<Type Name="Func<TResult>" FullName="System.Func<TResult>">
- <TypeSignature Language="C#" Value="public delegate TResult Func<out TResult>();" />
- <AssemblyInfo>
- <AssemblyName>mscorlib</AssemblyName>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <TypeParameters>
- <TypeParameter Name="TResult">
- <Constraints>
- <ParameterAttribute>Covariant</ParameterAttribute>
- </Constraints>
- </TypeParameter>
- </TypeParameters>
- <Base>
- <BaseTypeName>System.Delegate</BaseTypeName>
- </Base>
- <Attributes>
- <Attribute>
- <AttributeName>System.Runtime.CompilerServices.TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")</AttributeName>
- </Attribute>
- </Attributes>
- <Parameters />
- <ReturnValue>
- <ReturnType>TResult</ReturnType>
- </ReturnValue>
- <Docs>
- <typeparam name="TResult">To be added.</typeparam>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
+++ /dev/null
-<Type Name="Func<T,TResult>" FullName="System.Func<T,TResult>">
- <TypeSignature Language="C#" Value="public delegate TResult Func<in T,out TResult>(T arg1);" />
- <AssemblyInfo>
- <AssemblyName>mscorlib</AssemblyName>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <TypeParameters>
- <TypeParameter Name="T">
- <Constraints>
- <ParameterAttribute>Contravariant</ParameterAttribute>
- </Constraints>
- </TypeParameter>
- <TypeParameter Name="TResult">
- <Constraints>
- <ParameterAttribute>Covariant</ParameterAttribute>
- </Constraints>
- </TypeParameter>
- </TypeParameters>
- <Base>
- <BaseTypeName>System.Delegate</BaseTypeName>
- </Base>
- <Attributes>
- <Attribute>
- <AttributeName>System.Runtime.CompilerServices.TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")</AttributeName>
- </Attribute>
- </Attributes>
- <Parameters>
- <Parameter Name="arg1" Type="T" />
- </Parameters>
- <ReturnValue>
- <ReturnType>TResult</ReturnType>
- </ReturnValue>
- <Docs>
- <typeparam name="T">To be added.</typeparam>
- <typeparam name="TResult">To be added.</typeparam>
- <param name="arg1">To be added.</param>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
+++ /dev/null
-<Type Name="Func<T1,T2,TResult>" FullName="System.Func<T1,T2,TResult>">
- <TypeSignature Language="C#" Value="public delegate TResult Func<in T1,in T2,out TResult>(T1 arg1, T2 arg2);" />
- <AssemblyInfo>
- <AssemblyName>mscorlib</AssemblyName>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <TypeParameters>
- <TypeParameter Name="T1">
- <Constraints>
- <ParameterAttribute>Contravariant</ParameterAttribute>
- </Constraints>
- </TypeParameter>
- <TypeParameter Name="T2">
- <Constraints>
- <ParameterAttribute>Contravariant</ParameterAttribute>
- </Constraints>
- </TypeParameter>
- <TypeParameter Name="TResult">
- <Constraints>
- <ParameterAttribute>Covariant</ParameterAttribute>
- </Constraints>
- </TypeParameter>
- </TypeParameters>
- <Base>
- <BaseTypeName>System.Delegate</BaseTypeName>
- </Base>
- <Attributes>
- <Attribute>
- <AttributeName>System.Runtime.CompilerServices.TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")</AttributeName>
- </Attribute>
- </Attributes>
- <Parameters>
- <Parameter Name="arg1" Type="T1" />
- <Parameter Name="arg2" Type="T2" />
- </Parameters>
- <ReturnValue>
- <ReturnType>TResult</ReturnType>
- </ReturnValue>
- <Docs>
- <typeparam name="T1">To be added.</typeparam>
- <typeparam name="T2">To be added.</typeparam>
- <typeparam name="TResult">To be added.</typeparam>
- <param name="arg1">To be added.</param>
- <param name="arg2">To be added.</param>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
+++ /dev/null
-<Type Name="Func<T1,T2,T3,TResult>" FullName="System.Func<T1,T2,T3,TResult>">
- <TypeSignature Language="C#" Value="public delegate TResult Func<in T1,in T2,in T3,out TResult>(T1 arg1, T2 arg2, T3 arg3);" />
- <AssemblyInfo>
- <AssemblyName>mscorlib</AssemblyName>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <TypeParameters>
- <TypeParameter Name="T1">
- <Constraints>
- <ParameterAttribute>Contravariant</ParameterAttribute>
- </Constraints>
- </TypeParameter>
- <TypeParameter Name="T2">
- <Constraints>
- <ParameterAttribute>Contravariant</ParameterAttribute>
- </Constraints>
- </TypeParameter>
- <TypeParameter Name="T3">
- <Constraints>
- <ParameterAttribute>Contravariant</ParameterAttribute>
- </Constraints>
- </TypeParameter>
- <TypeParameter Name="TResult">
- <Constraints>
- <ParameterAttribute>Covariant</ParameterAttribute>
- </Constraints>
- </TypeParameter>
- </TypeParameters>
- <Base>
- <BaseTypeName>System.Delegate</BaseTypeName>
- </Base>
- <Attributes>
- <Attribute>
- <AttributeName>System.Runtime.CompilerServices.TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")</AttributeName>
- </Attribute>
- </Attributes>
- <Parameters>
- <Parameter Name="arg1" Type="T1" />
- <Parameter Name="arg2" Type="T2" />
- <Parameter Name="arg3" Type="T3" />
- </Parameters>
- <ReturnValue>
- <ReturnType>TResult</ReturnType>
- </ReturnValue>
- <Docs>
- <typeparam name="T1">To be added.</typeparam>
- <typeparam name="T2">To be added.</typeparam>
- <typeparam name="T3">To be added.</typeparam>
- <typeparam name="TResult">To be added.</typeparam>
- <param name="arg1">To be added.</param>
- <param name="arg2">To be added.</param>
- <param name="arg3">To be added.</param>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
+++ /dev/null
-<Type Name="Func<T1,T2,T3,T4,TResult>" FullName="System.Func<T1,T2,T3,T4,TResult>">
- <TypeSignature Language="C#" Value="public delegate TResult Func<in T1,in T2,in T3,in T4,out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4);" />
- <AssemblyInfo>
- <AssemblyName>mscorlib</AssemblyName>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <TypeParameters>
- <TypeParameter Name="T1">
- <Constraints>
- <ParameterAttribute>Contravariant</ParameterAttribute>
- </Constraints>
- </TypeParameter>
- <TypeParameter Name="T2">
- <Constraints>
- <ParameterAttribute>Contravariant</ParameterAttribute>
- </Constraints>
- </TypeParameter>
- <TypeParameter Name="T3">
- <Constraints>
- <ParameterAttribute>Contravariant</ParameterAttribute>
- </Constraints>
- </TypeParameter>
- <TypeParameter Name="T4">
- <Constraints>
- <ParameterAttribute>Contravariant</ParameterAttribute>
- </Constraints>
- </TypeParameter>
- <TypeParameter Name="TResult">
- <Constraints>
- <ParameterAttribute>Covariant</ParameterAttribute>
- </Constraints>
- </TypeParameter>
- </TypeParameters>
- <Base>
- <BaseTypeName>System.Delegate</BaseTypeName>
- </Base>
- <Attributes>
- <Attribute>
- <AttributeName>System.Runtime.CompilerServices.TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")</AttributeName>
- </Attribute>
- </Attributes>
- <Parameters>
- <Parameter Name="arg1" Type="T1" />
- <Parameter Name="arg2" Type="T2" />
- <Parameter Name="arg3" Type="T3" />
- <Parameter Name="arg4" Type="T4" />
- </Parameters>
- <ReturnValue>
- <ReturnType>TResult</ReturnType>
- </ReturnValue>
- <Docs>
- <typeparam name="T1">To be added.</typeparam>
- <typeparam name="T2">To be added.</typeparam>
- <typeparam name="T3">To be added.</typeparam>
- <typeparam name="T4">To be added.</typeparam>
- <typeparam name="TResult">To be added.</typeparam>
- <param name="arg1">To be added.</param>
- <param name="arg2">To be added.</param>
- <param name="arg3">To be added.</param>
- <param name="arg4">To be added.</param>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
+++ /dev/null
-<Type Name="InvalidTimeZoneException" FullName="System.InvalidTimeZoneException">
- <TypeSignature Language="C#" Value="public class InvalidTimeZoneException : Exception" />
- <AssemblyInfo>
- <AssemblyName>mscorlib</AssemblyName>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Exception</BaseTypeName>
- </Base>
- <Interfaces />
- <Attributes>
- <Attribute>
- <AttributeName>System.Runtime.CompilerServices.TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")</AttributeName>
- </Attribute>
- </Attributes>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public InvalidTimeZoneException ();" />
- <MemberType>Constructor</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public InvalidTimeZoneException (string message);" />
- <MemberType>Constructor</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Parameters>
- <Parameter Name="message" Type="System.String" />
- </Parameters>
- <Docs>
- <param name="message">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="protected InvalidTimeZoneException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext sc);" />
- <MemberType>Constructor</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Parameters>
- <Parameter Name="info" Type="System.Runtime.Serialization.SerializationInfo" />
- <Parameter Name="sc" Type="System.Runtime.Serialization.StreamingContext" />
- </Parameters>
- <Docs>
- <param name="info">To be added.</param>
- <param name="sc">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public InvalidTimeZoneException (string message, Exception e);" />
- <MemberType>Constructor</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Parameters>
- <Parameter Name="message" Type="System.String" />
- <Parameter Name="e" Type="System.Exception" />
- </Parameters>
- <Docs>
- <param name="message">To be added.</param>
- <param name="e">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
-</Type>
+++ /dev/null
-<Type Name="TimeZoneInfo+AdjustmentRule" FullName="System.TimeZoneInfo+AdjustmentRule">
- <TypeSignature Language="C#" Value="public sealed class TimeZoneInfo.AdjustmentRule : IEquatable<TimeZoneInfo.AdjustmentRule>, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable" />
- <AssemblyInfo>
- <AssemblyName>mscorlib</AssemblyName>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Object</BaseTypeName>
- </Base>
- <Interfaces>
- <Interface>
- <InterfaceName>System.IEquatable<System.TimeZoneInfo+AdjustmentRule></InterfaceName>
- </Interface>
- <Interface>
- <InterfaceName>System.Runtime.Serialization.IDeserializationCallback</InterfaceName>
- </Interface>
- <Interface>
- <InterfaceName>System.Runtime.Serialization.ISerializable</InterfaceName>
- </Interface>
- </Interfaces>
- <Attributes>
- <Attribute>
- <AttributeName>System.Runtime.CompilerServices.TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")</AttributeName>
- </Attribute>
- </Attributes>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- <Members>
- <Member MemberName="CreateAdjustmentRule">
- <MemberSignature Language="C#" Value="public static TimeZoneInfo.AdjustmentRule CreateAdjustmentRule (DateTime dateStart, DateTime dateEnd, TimeSpan daylightDelta, TimeZoneInfo.TransitionTime daylightTransitionStart, TimeZoneInfo.TransitionTime daylightTransitionEnd);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.TimeZoneInfo+AdjustmentRule</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="dateStart" Type="System.DateTime" />
- <Parameter Name="dateEnd" Type="System.DateTime" />
- <Parameter Name="daylightDelta" Type="System.TimeSpan" />
- <Parameter Name="daylightTransitionStart" Type="System.TimeZoneInfo+TransitionTime" />
- <Parameter Name="daylightTransitionEnd" Type="System.TimeZoneInfo+TransitionTime" />
- </Parameters>
- <Docs>
- <param name="dateStart">To be added.</param>
- <param name="dateEnd">To be added.</param>
- <param name="daylightDelta">To be added.</param>
- <param name="daylightTransitionStart">To be added.</param>
- <param name="daylightTransitionEnd">To be added.</param>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="DateEnd">
- <MemberSignature Language="C#" Value="public DateTime DateEnd { get; }" />
- <MemberType>Property</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.DateTime</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="DateStart">
- <MemberSignature Language="C#" Value="public DateTime DateStart { get; }" />
- <MemberType>Property</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.DateTime</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="DaylightDelta">
- <MemberSignature Language="C#" Value="public TimeSpan DaylightDelta { get; }" />
- <MemberType>Property</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.TimeSpan</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="DaylightTransitionEnd">
- <MemberSignature Language="C#" Value="public TimeZoneInfo.TransitionTime DaylightTransitionEnd { get; }" />
- <MemberType>Property</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.TimeZoneInfo+TransitionTime</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="DaylightTransitionStart">
- <MemberSignature Language="C#" Value="public TimeZoneInfo.TransitionTime DaylightTransitionStart { get; }" />
- <MemberType>Property</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.TimeZoneInfo+TransitionTime</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Equals">
- <MemberSignature Language="C#" Value="public bool Equals (TimeZoneInfo.AdjustmentRule other);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.Boolean</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="other" Type="System.TimeZoneInfo+AdjustmentRule" />
- </Parameters>
- <Docs>
- <param name="other">To be added.</param>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="GetHashCode">
- <MemberSignature Language="C#" Value="public override int GetHashCode ();" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.Int32</ReturnType>
- </ReturnValue>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="System.Runtime.Serialization.IDeserializationCallback.OnDeserialization">
- <MemberSignature Language="C#" Value="void IDeserializationCallback.OnDeserialization (object sender);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="sender" Type="System.Object" />
- </Parameters>
- <Docs>
- <param name="sender">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="System.Runtime.Serialization.ISerializable.GetObjectData">
- <MemberSignature Language="C#" Value="void ISerializable.GetObjectData (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="info" Type="System.Runtime.Serialization.SerializationInfo" />
- <Parameter Name="context" Type="System.Runtime.Serialization.StreamingContext" />
- </Parameters>
- <Docs>
- <param name="info">To be added.</param>
- <param name="context">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
-</Type>
+++ /dev/null
-<Type Name="TimeZoneInfo+TransitionTime" FullName="System.TimeZoneInfo+TransitionTime">
- <TypeSignature Language="C#" Value="public struct TimeZoneInfo.TransitionTime : IEquatable<TimeZoneInfo.TransitionTime>, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable" />
- <AssemblyInfo>
- <AssemblyName>mscorlib</AssemblyName>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.ValueType</BaseTypeName>
- </Base>
- <Interfaces>
- <Interface>
- <InterfaceName>System.IEquatable<System.TimeZoneInfo+TransitionTime></InterfaceName>
- </Interface>
- <Interface>
- <InterfaceName>System.Runtime.Serialization.IDeserializationCallback</InterfaceName>
- </Interface>
- <Interface>
- <InterfaceName>System.Runtime.Serialization.ISerializable</InterfaceName>
- </Interface>
- </Interfaces>
- <Attributes>
- <Attribute>
- <AttributeName>System.Runtime.CompilerServices.TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")</AttributeName>
- </Attribute>
- </Attributes>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- <Members>
- <Member MemberName="CreateFixedDateRule">
- <MemberSignature Language="C#" Value="public static TimeZoneInfo.TransitionTime CreateFixedDateRule (DateTime timeOfDay, int month, int day);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.TimeZoneInfo+TransitionTime</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="timeOfDay" Type="System.DateTime" />
- <Parameter Name="month" Type="System.Int32" />
- <Parameter Name="day" Type="System.Int32" />
- </Parameters>
- <Docs>
- <param name="timeOfDay">To be added.</param>
- <param name="month">To be added.</param>
- <param name="day">To be added.</param>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="CreateFloatingDateRule">
- <MemberSignature Language="C#" Value="public static TimeZoneInfo.TransitionTime CreateFloatingDateRule (DateTime timeOfDay, int month, int week, DayOfWeek dayOfWeek);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.TimeZoneInfo+TransitionTime</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="timeOfDay" Type="System.DateTime" />
- <Parameter Name="month" Type="System.Int32" />
- <Parameter Name="week" Type="System.Int32" />
- <Parameter Name="dayOfWeek" Type="System.DayOfWeek" />
- </Parameters>
- <Docs>
- <param name="timeOfDay">To be added.</param>
- <param name="month">To be added.</param>
- <param name="week">To be added.</param>
- <param name="dayOfWeek">To be added.</param>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Day">
- <MemberSignature Language="C#" Value="public int Day { get; }" />
- <MemberType>Property</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.Int32</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="DayOfWeek">
- <MemberSignature Language="C#" Value="public DayOfWeek DayOfWeek { get; }" />
- <MemberType>Property</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.DayOfWeek</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Equals">
- <MemberSignature Language="C#" Value="public override bool Equals (object other);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.Boolean</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="other" Type="System.Object" />
- </Parameters>
- <Docs>
- <param name="other">To be added.</param>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Equals">
- <MemberSignature Language="C#" Value="public bool Equals (TimeZoneInfo.TransitionTime other);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.Boolean</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="other" Type="System.TimeZoneInfo+TransitionTime" />
- </Parameters>
- <Docs>
- <param name="other">To be added.</param>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="GetHashCode">
- <MemberSignature Language="C#" Value="public override int GetHashCode ();" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.Int32</ReturnType>
- </ReturnValue>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="IsFixedDateRule">
- <MemberSignature Language="C#" Value="public bool IsFixedDateRule { get; }" />
- <MemberType>Property</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.Boolean</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Month">
- <MemberSignature Language="C#" Value="public int Month { get; }" />
- <MemberType>Property</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.Int32</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="op_Equality">
- <MemberSignature Language="C#" Value="public static bool op_Equality (TimeZoneInfo.TransitionTime t1, TimeZoneInfo.TransitionTime t2);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.Boolean</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="t1" Type="System.TimeZoneInfo+TransitionTime" />
- <Parameter Name="t2" Type="System.TimeZoneInfo+TransitionTime" />
- </Parameters>
- <Docs>
- <param name="t1">To be added.</param>
- <param name="t2">To be added.</param>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="op_Inequality">
- <MemberSignature Language="C#" Value="public static bool op_Inequality (TimeZoneInfo.TransitionTime t1, TimeZoneInfo.TransitionTime t2);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.Boolean</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="t1" Type="System.TimeZoneInfo+TransitionTime" />
- <Parameter Name="t2" Type="System.TimeZoneInfo+TransitionTime" />
- </Parameters>
- <Docs>
- <param name="t1">To be added.</param>
- <param name="t2">To be added.</param>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="System.Runtime.Serialization.IDeserializationCallback.OnDeserialization">
- <MemberSignature Language="C#" Value="void IDeserializationCallback.OnDeserialization (object sender);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="sender" Type="System.Object" />
- </Parameters>
- <Docs>
- <param name="sender">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="System.Runtime.Serialization.ISerializable.GetObjectData">
- <MemberSignature Language="C#" Value="void ISerializable.GetObjectData (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="info" Type="System.Runtime.Serialization.SerializationInfo" />
- <Parameter Name="context" Type="System.Runtime.Serialization.StreamingContext" />
- </Parameters>
- <Docs>
- <param name="info">To be added.</param>
- <param name="context">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="TimeOfDay">
- <MemberSignature Language="C#" Value="public DateTime TimeOfDay { get; }" />
- <MemberType>Property</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.DateTime</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Week">
- <MemberSignature Language="C#" Value="public int Week { get; }" />
- <MemberType>Property</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.Int32</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
-</Type>
+++ /dev/null
-<Type Name="TimeZoneInfo" FullName="System.TimeZoneInfo">
- <TypeSignature Language="C#" Value="public sealed class TimeZoneInfo : IEquatable<TimeZoneInfo>, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable" />
- <AssemblyInfo>
- <AssemblyName>mscorlib</AssemblyName>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Object</BaseTypeName>
- </Base>
- <Interfaces>
- <Interface>
- <InterfaceName>System.IEquatable<System.TimeZoneInfo></InterfaceName>
- </Interface>
- <Interface>
- <InterfaceName>System.Runtime.Serialization.IDeserializationCallback</InterfaceName>
- </Interface>
- <Interface>
- <InterfaceName>System.Runtime.Serialization.ISerializable</InterfaceName>
- </Interface>
- </Interfaces>
- <Attributes>
- <Attribute>
- <AttributeName>System.Runtime.CompilerServices.TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")</AttributeName>
- </Attribute>
- </Attributes>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- <Members>
- <Member MemberName="BaseUtcOffset">
- <MemberSignature Language="C#" Value="public TimeSpan BaseUtcOffset { get; }" />
- <MemberType>Property</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.TimeSpan</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="ClearCachedData">
- <MemberSignature Language="C#" Value="public static void ClearCachedData ();" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="ConvertTime">
- <MemberSignature Language="C#" Value="public static DateTime ConvertTime (DateTime dateTime, TimeZoneInfo destinationTimeZone);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.DateTime</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="dateTime" Type="System.DateTime" />
- <Parameter Name="destinationTimeZone" Type="System.TimeZoneInfo" />
- </Parameters>
- <Docs>
- <param name="dateTime">To be added.</param>
- <param name="destinationTimeZone">To be added.</param>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="ConvertTime">
- <MemberSignature Language="C#" Value="public static DateTimeOffset ConvertTime (DateTimeOffset dateTimeOffset, TimeZoneInfo destinationTimeZone);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.DateTimeOffset</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="dateTimeOffset" Type="System.DateTimeOffset" />
- <Parameter Name="destinationTimeZone" Type="System.TimeZoneInfo" />
- </Parameters>
- <Docs>
- <param name="dateTimeOffset">To be added.</param>
- <param name="destinationTimeZone">To be added.</param>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="ConvertTime">
- <MemberSignature Language="C#" Value="public static DateTime ConvertTime (DateTime dateTime, TimeZoneInfo sourceTimeZone, TimeZoneInfo destinationTimeZone);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.DateTime</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="dateTime" Type="System.DateTime" />
- <Parameter Name="sourceTimeZone" Type="System.TimeZoneInfo" />
- <Parameter Name="destinationTimeZone" Type="System.TimeZoneInfo" />
- </Parameters>
- <Docs>
- <param name="dateTime">To be added.</param>
- <param name="sourceTimeZone">To be added.</param>
- <param name="destinationTimeZone">To be added.</param>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="ConvertTimeBySystemTimeZoneId">
- <MemberSignature Language="C#" Value="public static DateTime ConvertTimeBySystemTimeZoneId (DateTime dateTime, string destinationTimeZoneId);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.DateTime</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="dateTime" Type="System.DateTime" />
- <Parameter Name="destinationTimeZoneId" Type="System.String" />
- </Parameters>
- <Docs>
- <param name="dateTime">To be added.</param>
- <param name="destinationTimeZoneId">To be added.</param>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="ConvertTimeBySystemTimeZoneId">
- <MemberSignature Language="C#" Value="public static DateTimeOffset ConvertTimeBySystemTimeZoneId (DateTimeOffset dateTimeOffset, string destinationTimeZoneId);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.DateTimeOffset</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="dateTimeOffset" Type="System.DateTimeOffset" />
- <Parameter Name="destinationTimeZoneId" Type="System.String" />
- </Parameters>
- <Docs>
- <param name="dateTimeOffset">To be added.</param>
- <param name="destinationTimeZoneId">To be added.</param>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="ConvertTimeBySystemTimeZoneId">
- <MemberSignature Language="C#" Value="public static DateTime ConvertTimeBySystemTimeZoneId (DateTime dateTime, string sourceTimeZoneId, string destinationTimeZoneId);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.DateTime</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="dateTime" Type="System.DateTime" />
- <Parameter Name="sourceTimeZoneId" Type="System.String" />
- <Parameter Name="destinationTimeZoneId" Type="System.String" />
- </Parameters>
- <Docs>
- <param name="dateTime">To be added.</param>
- <param name="sourceTimeZoneId">To be added.</param>
- <param name="destinationTimeZoneId">To be added.</param>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="ConvertTimeFromUtc">
- <MemberSignature Language="C#" Value="public static DateTime ConvertTimeFromUtc (DateTime dateTime, TimeZoneInfo destinationTimeZone);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.DateTime</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="dateTime" Type="System.DateTime" />
- <Parameter Name="destinationTimeZone" Type="System.TimeZoneInfo" />
- </Parameters>
- <Docs>
- <param name="dateTime">To be added.</param>
- <param name="destinationTimeZone">To be added.</param>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="ConvertTimeToUtc">
- <MemberSignature Language="C#" Value="public static DateTime ConvertTimeToUtc (DateTime dateTime);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.DateTime</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="dateTime" Type="System.DateTime" />
- </Parameters>
- <Docs>
- <param name="dateTime">To be added.</param>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="ConvertTimeToUtc">
- <MemberSignature Language="C#" Value="public static DateTime ConvertTimeToUtc (DateTime dateTime, TimeZoneInfo sourceTimeZone);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.DateTime</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="dateTime" Type="System.DateTime" />
- <Parameter Name="sourceTimeZone" Type="System.TimeZoneInfo" />
- </Parameters>
- <Docs>
- <param name="dateTime">To be added.</param>
- <param name="sourceTimeZone">To be added.</param>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="CreateCustomTimeZone">
- <MemberSignature Language="C#" Value="public static TimeZoneInfo CreateCustomTimeZone (string id, TimeSpan baseUtcOffset, string displayName, string standardDisplayName);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.TimeZoneInfo</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="id" Type="System.String" />
- <Parameter Name="baseUtcOffset" Type="System.TimeSpan" />
- <Parameter Name="displayName" Type="System.String" />
- <Parameter Name="standardDisplayName" Type="System.String" />
- </Parameters>
- <Docs>
- <param name="id">To be added.</param>
- <param name="baseUtcOffset">To be added.</param>
- <param name="displayName">To be added.</param>
- <param name="standardDisplayName">To be added.</param>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="CreateCustomTimeZone">
- <MemberSignature Language="C#" Value="public static TimeZoneInfo CreateCustomTimeZone (string id, TimeSpan baseUtcOffset, string displayName, string standardDisplayName, string daylightDisplayName, TimeZoneInfo.AdjustmentRule[] adjustmentRules);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.TimeZoneInfo</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="id" Type="System.String" />
- <Parameter Name="baseUtcOffset" Type="System.TimeSpan" />
- <Parameter Name="displayName" Type="System.String" />
- <Parameter Name="standardDisplayName" Type="System.String" />
- <Parameter Name="daylightDisplayName" Type="System.String" />
- <Parameter Name="adjustmentRules" Type="System.TimeZoneInfo+AdjustmentRule[]" />
- </Parameters>
- <Docs>
- <param name="id">To be added.</param>
- <param name="baseUtcOffset">To be added.</param>
- <param name="displayName">To be added.</param>
- <param name="standardDisplayName">To be added.</param>
- <param name="daylightDisplayName">To be added.</param>
- <param name="adjustmentRules">To be added.</param>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="CreateCustomTimeZone">
- <MemberSignature Language="C#" Value="public static TimeZoneInfo CreateCustomTimeZone (string id, TimeSpan baseUtcOffset, string displayName, string standardDisplayName, string daylightDisplayName, TimeZoneInfo.AdjustmentRule[] adjustmentRules, bool disableDaylightSavingTime);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.TimeZoneInfo</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="id" Type="System.String" />
- <Parameter Name="baseUtcOffset" Type="System.TimeSpan" />
- <Parameter Name="displayName" Type="System.String" />
- <Parameter Name="standardDisplayName" Type="System.String" />
- <Parameter Name="daylightDisplayName" Type="System.String" />
- <Parameter Name="adjustmentRules" Type="System.TimeZoneInfo+AdjustmentRule[]" />
- <Parameter Name="disableDaylightSavingTime" Type="System.Boolean" />
- </Parameters>
- <Docs>
- <param name="id">To be added.</param>
- <param name="baseUtcOffset">To be added.</param>
- <param name="displayName">To be added.</param>
- <param name="standardDisplayName">To be added.</param>
- <param name="daylightDisplayName">To be added.</param>
- <param name="adjustmentRules">To be added.</param>
- <param name="disableDaylightSavingTime">To be added.</param>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="DaylightName">
- <MemberSignature Language="C#" Value="public string DaylightName { get; }" />
- <MemberType>Property</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="DisplayName">
- <MemberSignature Language="C#" Value="public string DisplayName { get; }" />
- <MemberType>Property</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Equals">
- <MemberSignature Language="C#" Value="public bool Equals (TimeZoneInfo other);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.Boolean</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="other" Type="System.TimeZoneInfo" />
- </Parameters>
- <Docs>
- <param name="other">To be added.</param>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="FindSystemTimeZoneById">
- <MemberSignature Language="C#" Value="public static TimeZoneInfo FindSystemTimeZoneById (string id);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.TimeZoneInfo</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="id" Type="System.String" />
- </Parameters>
- <Docs>
- <param name="id">To be added.</param>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="FromSerializedString">
- <MemberSignature Language="C#" Value="public static TimeZoneInfo FromSerializedString (string source);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.TimeZoneInfo</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="source" Type="System.String" />
- </Parameters>
- <Docs>
- <param name="source">To be added.</param>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="GetAdjustmentRules">
- <MemberSignature Language="C#" Value="public TimeZoneInfo.AdjustmentRule[] GetAdjustmentRules ();" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.TimeZoneInfo+AdjustmentRule[]</ReturnType>
- </ReturnValue>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="GetAmbiguousTimeOffsets">
- <MemberSignature Language="C#" Value="public TimeSpan[] GetAmbiguousTimeOffsets (DateTime dateTime);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.TimeSpan[]</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="dateTime" Type="System.DateTime" />
- </Parameters>
- <Docs>
- <param name="dateTime">To be added.</param>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="GetAmbiguousTimeOffsets">
- <MemberSignature Language="C#" Value="public TimeSpan[] GetAmbiguousTimeOffsets (DateTimeOffset dateTimeOffset);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.TimeSpan[]</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="dateTimeOffset" Type="System.DateTimeOffset" />
- </Parameters>
- <Docs>
- <param name="dateTimeOffset">To be added.</param>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="GetHashCode">
- <MemberSignature Language="C#" Value="public override int GetHashCode ();" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.Int32</ReturnType>
- </ReturnValue>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="GetSystemTimeZones">
- <MemberSignature Language="C#" Value="public static System.Collections.ObjectModel.ReadOnlyCollection<TimeZoneInfo> GetSystemTimeZones ();" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.Collections.ObjectModel.ReadOnlyCollection<System.TimeZoneInfo></ReturnType>
- </ReturnValue>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="GetUtcOffset">
- <MemberSignature Language="C#" Value="public TimeSpan GetUtcOffset (DateTime dateTime);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.TimeSpan</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="dateTime" Type="System.DateTime" />
- </Parameters>
- <Docs>
- <param name="dateTime">To be added.</param>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="GetUtcOffset">
- <MemberSignature Language="C#" Value="public TimeSpan GetUtcOffset (DateTimeOffset dateTimeOffset);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.TimeSpan</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="dateTimeOffset" Type="System.DateTimeOffset" />
- </Parameters>
- <Docs>
- <param name="dateTimeOffset">To be added.</param>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="HasSameRules">
- <MemberSignature Language="C#" Value="public bool HasSameRules (TimeZoneInfo other);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.Boolean</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="other" Type="System.TimeZoneInfo" />
- </Parameters>
- <Docs>
- <param name="other">To be added.</param>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Id">
- <MemberSignature Language="C#" Value="public string Id { get; }" />
- <MemberType>Property</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="IsAmbiguousTime">
- <MemberSignature Language="C#" Value="public bool IsAmbiguousTime (DateTime dateTime);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.Boolean</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="dateTime" Type="System.DateTime" />
- </Parameters>
- <Docs>
- <param name="dateTime">To be added.</param>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="IsAmbiguousTime">
- <MemberSignature Language="C#" Value="public bool IsAmbiguousTime (DateTimeOffset dateTimeOffset);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.Boolean</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="dateTimeOffset" Type="System.DateTimeOffset" />
- </Parameters>
- <Docs>
- <param name="dateTimeOffset">To be added.</param>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="IsDaylightSavingTime">
- <MemberSignature Language="C#" Value="public bool IsDaylightSavingTime (DateTime dateTime);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.Boolean</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="dateTime" Type="System.DateTime" />
- </Parameters>
- <Docs>
- <param name="dateTime">To be added.</param>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="IsDaylightSavingTime">
- <MemberSignature Language="C#" Value="public bool IsDaylightSavingTime (DateTimeOffset dateTimeOffset);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.Boolean</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="dateTimeOffset" Type="System.DateTimeOffset" />
- </Parameters>
- <Docs>
- <param name="dateTimeOffset">To be added.</param>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="IsInvalidTime">
- <MemberSignature Language="C#" Value="public bool IsInvalidTime (DateTime dateTime);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.Boolean</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="dateTime" Type="System.DateTime" />
- </Parameters>
- <Docs>
- <param name="dateTime">To be added.</param>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Local">
- <MemberSignature Language="C#" Value="public static TimeZoneInfo Local { get; }" />
- <MemberType>Property</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.TimeZoneInfo</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="StandardName">
- <MemberSignature Language="C#" Value="public string StandardName { get; }" />
- <MemberType>Property</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="SupportsDaylightSavingTime">
- <MemberSignature Language="C#" Value="public bool SupportsDaylightSavingTime { get; }" />
- <MemberType>Property</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.Boolean</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="System.Runtime.Serialization.IDeserializationCallback.OnDeserialization">
- <MemberSignature Language="C#" Value="void IDeserializationCallback.OnDeserialization (object sender);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="sender" Type="System.Object" />
- </Parameters>
- <Docs>
- <param name="sender">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="System.Runtime.Serialization.ISerializable.GetObjectData">
- <MemberSignature Language="C#" Value="void ISerializable.GetObjectData (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="info" Type="System.Runtime.Serialization.SerializationInfo" />
- <Parameter Name="context" Type="System.Runtime.Serialization.StreamingContext" />
- </Parameters>
- <Docs>
- <param name="info">To be added.</param>
- <param name="context">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="ToSerializedString">
- <MemberSignature Language="C#" Value="public string ToSerializedString ();" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="ToString">
- <MemberSignature Language="C#" Value="public override string ToString ();" />
- <MemberType>Method</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Utc">
- <MemberSignature Language="C#" Value="public static TimeZoneInfo Utc { get; }" />
- <MemberType>Property</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <ReturnValue>
- <ReturnType>System.TimeZoneInfo</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
-</Type>
+++ /dev/null
-<Type Name="TimeZoneNotFoundException" FullName="System.TimeZoneNotFoundException">
- <TypeSignature Language="C#" Value="public class TimeZoneNotFoundException : Exception" />
- <AssemblyInfo>
- <AssemblyName>mscorlib</AssemblyName>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Exception</BaseTypeName>
- </Base>
- <Interfaces />
- <Attributes>
- <Attribute>
- <AttributeName>System.Runtime.CompilerServices.TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")</AttributeName>
- </Attribute>
- </Attributes>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public TimeZoneNotFoundException ();" />
- <MemberType>Constructor</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public TimeZoneNotFoundException (string message);" />
- <MemberType>Constructor</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Parameters>
- <Parameter Name="message" Type="System.String" />
- </Parameters>
- <Docs>
- <param name="message">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="protected TimeZoneNotFoundException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext sc);" />
- <MemberType>Constructor</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Parameters>
- <Parameter Name="info" Type="System.Runtime.Serialization.SerializationInfo" />
- <Parameter Name="sc" Type="System.Runtime.Serialization.StreamingContext" />
- </Parameters>
- <Docs>
- <param name="info">To be added.</param>
- <param name="sc">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public TimeZoneNotFoundException (string message, Exception e);" />
- <MemberType>Constructor</MemberType>
- <AssemblyInfo>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Parameters>
- <Parameter Name="message" Type="System.String" />
- <Parameter Name="e" Type="System.Exception" />
- </Parameters>
- <Docs>
- <param name="message">To be added.</param>
- <param name="e">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
-</Type>
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-
+#if !FULL_AOT_RUNTIME
using System;
using System.Collections;
using System.Reflection;
}
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System;
using System.Runtime.InteropServices;
{
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System;
using System.Runtime.InteropServices;
{
}
}
+#endif
namespace Mono {
#if MONO_DATACONVERTER_PUBLIC
- unsafe public abstract class DataConverter {
-#else
- unsafe internal abstract class DataConverter {
+ public
+#endif
+ unsafe abstract class DataConverter {
// Disables the warning: CLS compliance checking will not be performed on
// `XXXX' because it is not visible from outside this assembly
#pragma warning disable 3019
-#endif
- static DataConverter SwapConv = new SwapConverter ();
- static DataConverter CopyConv = new CopyConverter ();
+ static readonly DataConverter SwapConv = new SwapConverter ();
+ static readonly DataConverter CopyConv = new CopyConverter ();
public static readonly bool IsLittleEndian = BitConverter.IsLittleEndian;
public Debugger()
{
}
+
+#if MONODROID
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ private extern static void Mono_UnhandledException_internal (Exception ex);
+
+ internal static void Mono_UnhandledException (Exception ex)
+ {
+ Mono_UnhandledException_internal (ex);
+ }
+#endif
}
}
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System;
using System.Reflection;
using System.Resources;
#endif
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Runtime.InteropServices;
namespace System.Reflection.Emit
#endif
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System;
using System.Reflection;
using System.Reflection.Emit;
}
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System;
using System.Globalization;
using System.Reflection;
}
}
+#endif
// (C) 2001 Ximian, Inc. http://www.ximian.com
//
+#if !FULL_AOT_RUNTIME
using System;
using System.Reflection;
using System.Reflection.Emit;
}
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Reflection;
using System.Reflection.Emit;
using System.Collections;
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System;
using System.Reflection;
using System.Runtime.InteropServices;
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System;
using System.Reflection;
}
}
+#endif
// (C) 2001 Ximian, Inc. http://www.ximian.com
//
+#if !FULL_AOT_RUNTIME
using System;
using System.Reflection;
using System.Reflection.Emit;
}
}
}
+#endif
// (C) 2001 Ximian, Inc. http://www.ximian.com
//
+#if !FULL_AOT_RUNTIME
using System;
using System.Reflection;
using System.Reflection.Emit;
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System;
using System.Collections;
using System.Globalization;
}
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Runtime.InteropServices;
namespace System.Reflection.Emit {
}
+#endif
// (C) 2001-2002 Ximian, Inc. http://www.ximian.com
//
+#if !FULL_AOT_RUNTIME
using System;
using System.Reflection;
using System.Reflection.Emit;
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System;
using System.Globalization;
using System.Reflection;
}
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Runtime.InteropServices;
namespace System.Reflection.Emit {
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Runtime.InteropServices;
namespace System.Reflection.Emit {
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Reflection;
using System.Reflection.Emit;
using System.Collections;
}
}
}
+#endif
// (C) 2001 Ximian, Inc. http://www.ximian.com
//
+#if !FULL_AOT_RUNTIME
using System;
using System.Collections;
using System.Diagnostics.SymbolStore;
public int EndCol;
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Runtime.InteropServices;
namespace System.Reflection.Emit {
}
}
}
+#endif
// (C) 2001, 2002 Ximian, Inc. http://www.ximian.com
//
+#if !FULL_AOT_RUNTIME
using System;
using System.Reflection;
using System.Reflection.Emit;
}
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System;
using System.Reflection;
using System.Reflection.Emit;
#endif
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System;
using System.Globalization;
using System.Reflection;
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Security.Permissions;
using System.Runtime.InteropServices;
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Runtime.InteropServices;
namespace System.Reflection.Emit {
}
+#endif
// (C) 2001 Ximian, Inc. http://www.ximian.com
//
+#if !FULL_AOT_RUNTIME
using System;
using System.Reflection;
using System.Collections;
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System;
using System.Globalization;
using System.Runtime.CompilerServices;
}
}
}
+#endif
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
+#if !FULL_AOT_RUNTIME
using System;
using System.Reflection;
using System.Reflection.Emit;
}
}
}
+#endif
+#if !FULL_AOT_RUNTIME
namespace System.Reflection.Emit {
static class OpCodeNames {
internal static readonly string [] names = {
};
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Runtime.InteropServices;
namespace System.Reflection.Emit {
}
}
+#endif
+#if !FULL_AOT_RUNTIME
using System.Runtime.InteropServices;
namespace System.Reflection.Emit {
}
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Runtime.InteropServices;
namespace System.Reflection.Emit {
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Runtime.InteropServices;
namespace System.Reflection.Emit {
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Runtime.InteropServices;
namespace System.Reflection.Emit {
}
+#endif
// (C) 2001 Ximian, Inc. http://www.ximian.com
//
+#if !FULL_AOT_RUNTIME
using System;
using System.Reflection;
using System.Reflection.Emit;
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Runtime.InteropServices;
namespace System.Reflection.Emit {
}
+#endif
// (C) 2001 Ximian, Inc. http://www.ximian.com
//
+#if !FULL_AOT_RUNTIME
using System;
using System.Reflection;
using System.Reflection.Emit;
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System;
using System.Globalization;
using System.Reflection;
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Runtime.InteropServices;
namespace System.Reflection.Emit {
}
+#endif
// (C) 2001 Ximian, Inc. http://www.ximian.com
//
+#if !FULL_AOT_RUNTIME
using System;
using System.Reflection;
using System.Reflection.Emit;
}
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Runtime.InteropServices;
namespace System.Reflection.Emit {
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Runtime.InteropServices;
namespace System.Reflection.Emit {
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Runtime.InteropServices;
namespace System.Reflection.Emit {
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System;
using System.Text;
using System.Reflection;
}
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Runtime.InteropServices;
namespace System.Reflection.Emit {
}
+#endif
// (C) 2001-2002 Ximian, Inc. http://www.ximian.com
//
+#if !FULL_AOT_RUNTIME
using System.Reflection.Emit;
using System.Runtime.InteropServices;
using System;
}
}
}
+#endif
}
}
}
-#endif
#if NET_4_0
public virtual PermissionSet PermissionSet {
}
#endif
+#endif
+
#if NET_4_0 || MOONLIGHT || MOBILE
static Exception CreateNIE ()
{
private bool IsPublicKeyValid {
get {
+#if FULL_AOT_RUNTIME
+ return true;
+#else
// check for ECMA key
if (publicKey.Length == 16) {
int i = 0;
}
return false;
+#endif
}
}
private byte [] ComputePublicKeyToken ()
{
+#if FULL_AOT_RUNTIME
+ return new byte [0];
+#else
HashAlgorithm ha = SHA1.Create ();
byte [] hash = ha.ComputeHash (publicKey);
// we need the last 8 bytes in reverse order
Array.Copy (hash, (hash.Length - 8), token, 0, 8);
Array.Reverse (token, 0, 8);
return token;
+#endif
}
[MonoTODO]
var requiredType = methodArgs [j].ParameterType;
if (types [j] == requiredType)
continue;
+#if !MOBILE
if (types [j] == typeof (__ComObject) && requiredType.IsInterface) {
var iface = Marshal.GetComInterfaceForObject (parameters [j], requiredType);
if (iface != IntPtr.Zero) {
continue;
}
}
+#endif
break;
}
#endif
void AddEventHandler (object target, Delegate handler)
{
+// this optimization cause problems with full AOT
+// see bug https://bugzilla.xamarin.com/show_bug.cgi?id=3682
+#if FULL_AOT_RUNTIME
+ MethodInfo add = GetAddMethod ();
+ if (add == null)
+ throw new InvalidOperationException ("Cannot add a handler to an event that doesn't have a visible add method");
+ if (target == null && !add.IsStatic)
+ throw new TargetException ("Cannot add a handler to a non static event with a null target");
+ add.Invoke (target, new object [] {handler});
+#else
if (cached_add_event == null) {
MethodInfo add = GetAddMethod ();
if (add == null)
//if (target == null && is_instance)
// throw new TargetException ("Cannot add a handler to a non static event with a null target");
cached_add_event (target, handler);
+#endif
}
public MethodInfo GetAddMethod() {
{
throw new NotImplementedException ();
}
+
delegate void AddEventAdapter (object _this, Delegate dele);
+
+// this optimization cause problems with full AOT
+// see bug https://bugzilla.xamarin.com/show_bug.cgi?id=3682
+// do not revove the above delegate or it's field since it's required by the runtime!
+#if !FULL_AOT_RUNTIME
delegate void AddEvent<T, D> (T _this, D dele);
delegate void StaticAddEvent<D> (D dele);
adapterFrame = adapterFrame.MakeGenericMethod (typeVector);
return (AddEventAdapter)Delegate.CreateDelegate (typeof (AddEventAdapter), addHandlerDelegate, adapterFrame, true);
}
+#endif
}
}
using System.Diagnostics;
using System.Globalization;
+#if !FULL_AOT_RUNTIME
using System.Reflection.Emit;
+#endif
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
}
internal virtual int get_next_table_index (object obj, int table, bool inc) {
+#if !FULL_AOT_RUNTIME
if (this is MethodBuilder) {
MethodBuilder mb = (MethodBuilder)this;
return mb.get_next_table_index (obj, table, inc);
ConstructorBuilder mb = (ConstructorBuilder)this;
return mb.get_next_table_index (obj, table, inc);
}
+#endif
throw new Exception ("Method is not a builder method");
}
using System.Collections;
using System.Globalization;
using System.Runtime.InteropServices;
+#if !FULL_AOT_RUNTIME
using System.Reflection.Emit;
+#endif
using System.Collections.Generic;
namespace System.Reflection {
throw new ArgumentException ("name", "Name cannot be empty");
res = InternalGetType (null, name, throwOnError, ignoreCase);
-#if !(NET_4_0 || MOONLIGHT || MOBILE)
+#if !(NET_4_0 || MOONLIGHT || MOBILE) && !FULL_AOT_RUNTIME
if (res is TypeBuilder) {
if (throwOnError)
throw new TypeLoadException (string.Format ("Could not load type '{0}' from assembly '{1}'", name, this));
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Reflection;
using System.Reflection.Emit;
using System.Collections;
}
}
+#endif
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
+#if !FULL_AOT_RUNTIME
using System.Reflection.Emit;
+#endif
using System.Security;
using System.Threading;
using System.Text;
hasUserType = true;
}
+#if !FULL_AOT_RUNTIME
if (hasUserType)
return new MethodOnTypeBuilderInst (this, methodInstantiation);
+#endif
MethodInfo ret = MakeGenericMethod_impl (methodInstantiation);
if (ret == null)
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Reflection.Emit;
+#endif
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Collections.Generic;
protected ParameterInfo () {
}
+#if !FULL_AOT_RUNTIME
internal ParameterInfo (ParameterBuilder pb, Type type, MemberInfo member, int position) {
this.ClassImpl = type;
this.MemberImpl = member;
this.AttrsImpl = ParameterAttributes.None;
}
}
+#endif
/*FIXME this constructor looks very broken in the position parameter*/
internal ParameterInfo (ParameterInfo pinfo, Type type, MemberInfo member, int position) {
// (C) 2002 Ximian, Inc.
using System;
+#if !FULL_AOT_RUNTIME
namespace System.Runtime.InteropServices.ComTypes
{
[StructLayout (LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public int scode;
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System;
namespace System.Runtime.InteropServices
}
}
}
+#endif
using System;
+#if !FULL_AOT_RUNTIME
namespace System.Runtime.InteropServices
{
[Obsolete]
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System;
namespace System.Runtime.InteropServices
}
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Reflection;
using System.Reflection.Emit;
bool GetPrimaryInteropAssembly (Guid g, int major, int minor, int lcid, out string asmName, out string asmCodeBase);
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
namespace System.Runtime.InteropServices {
[ComVisible (true)]
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Reflection;
namespace System.Runtime.InteropServices {
object ResolveRef (Assembly assembly);
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Reflection;
namespace System.Runtime.InteropServices {
Assembly ResolveRef([MarshalAs(UnmanagedType.Interface)] object typeLib);
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System;
namespace System.Runtime.InteropServices {
}
}
}
+#endif
using System.Runtime.ConstrainedExecution;
#if !MOONLIGHT
+#if !FULL_AOT_RUNTIME
using System.Runtime.InteropServices.ComTypes;
-#endif
-
-#if !MOONLIGHT
using Mono.Interop;
#endif
+#endif
namespace System.Runtime.InteropServices
{
public static readonly int SystemMaxDBCSCharSize = 2; // don't know what this is
public static readonly int SystemDefaultCharSize = Environment.OSVersion.Platform == PlatformID.Win32NT ? 2 : 1;
+#if !MOBILE
[MethodImplAttribute (MethodImplOptions.InternalCall)]
private extern static int AddRefInternal (IntPtr pUnk);
+#endif
public static int AddRef (IntPtr pUnk)
{
+#if !MOBILE
if (pUnk == IntPtr.Zero)
throw new ArgumentException ("Value cannot be null.", "pUnk");
return AddRefInternal (pUnk);
+#else
+ throw new NotImplementedException ();
+#endif
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
throw new NotImplementedException ();
}
-#if !MOONLIGHT
+#if !FULL_AOT_RUNTIME && !MOONLIGHT
public static object CreateWrapperOfType (object o, Type t)
{
__ComObject co = o as __ComObject;
FreeHGlobal (s);
}
-#if !MOONLIGHT
+#if !FULL_AOT_RUNTIME && !MOONLIGHT
public static Guid GenerateGuidForType (Type type)
{
return type.GUID;
throw new NotImplementedException ();
}
+#if !MOBILE
[MethodImplAttribute (MethodImplOptions.InternalCall)]
private extern static IntPtr GetCCW (object o, Type T);
else
return GetCCW (o, T);
}
+#endif
public static IntPtr GetComInterfaceForObject (object o, Type T)
{
+#if !MOBILE
IntPtr pItf = GetComInterfaceForObjectInternal (o, T);
AddRef (pItf);
return pItf;
+#else
+ throw new NotImplementedException ();
+#endif
}
[MonoTODO]
throw new NotSupportedException ("MSDN states user code should never need to call this method.");
}
+#if !MOBILE
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern static int GetComSlotForMethodInfoInternal (MemberInfo m);
+#endif
public static int GetComSlotForMethodInfo (MemberInfo m)
{
+#if !MOBILE
if (m == null)
throw new ArgumentNullException ("m");
if (!(m is MethodInfo))
if (!m.DeclaringType.IsInterface)
throw new ArgumentException ("The MemberInfo must be an interface method.", "m");
return GetComSlotForMethodInfoInternal (m);
+#else
+ throw new NotImplementedException ();
+#endif
}
[MonoTODO]
return m.GetHINSTANCE ();
}
-#endif // !NET_2_1
+#endif // !MOONLIGHT
+#if !FULL_AOT_RUNTIME
[MonoTODO ("SetErrorInfo")]
public static int GetHRForException (Exception e)
{
Marshal.StructureToPtr(vt, pDstNativeVariant, false);
}
+#if !MOBILE
[MethodImplAttribute (MethodImplOptions.InternalCall)]
private static extern object GetObjectForCCW (IntPtr pUnk);
+#endif
public static object GetObjectForIUnknown (IntPtr pUnk)
{
+#if !MOBILE
object obj = GetObjectForCCW (pUnk);
// was not a CCW
if (obj == null) {
obj = proxy.GetTransparentProxy ();
}
return obj;
+#else
+ throw new NotImplementedException ();
+#endif
}
public static object GetObjectForNativeVariant (IntPtr pSrcNativeVariant)
throw new NotImplementedException ();
}
+#if !FULL_AOT_RUNTIME
[Obsolete]
[MonoTODO]
public static string GetTypeInfoName (UCOMITypeInfo pTI)
{
throw new NotImplementedException ();
}
+#endif
[MonoTODO]
[Obsolete ("This method has been deprecated")]
throw new NotImplementedException ();
}
+#if !MOBILE
[MethodImplAttribute (MethodImplOptions.InternalCall)]
public extern static bool IsComObject (object o);
+#else
+ public static bool IsComObject (object o)
+ {
+ throw new NotImplementedException ();
+ }
+#endif
[MonoTODO]
public static bool IsTypeVisibleFromCom (Type t)
throw new NotImplementedException ();
}
#endif // !NET_2_1
+#endif
[MethodImplAttribute(MethodImplOptions.InternalCall)]
[ReliabilityContractAttribute (Consistency.WillNotCorruptState, Cer.Success)]
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public extern static string PtrToStringUni (IntPtr ptr, int len);
+#if !MOBILE
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public extern static string PtrToStringBSTR (IntPtr ptr);
+#else
+ public static string PtrToStringBSTR (IntPtr ptr)
+ {
+ throw new NotImplementedException ();
+ }
+#endif
[MethodImplAttribute(MethodImplOptions.InternalCall)]
[ComVisible (true)]
[ComVisible (true)]
public extern static object PtrToStructure (IntPtr ptr, Type structureType);
+#if !MOBILE
[MethodImplAttribute (MethodImplOptions.InternalCall)]
private extern static int QueryInterfaceInternal (IntPtr pUnk, ref Guid iid, out IntPtr ppv);
+#endif
public static int QueryInterface (IntPtr pUnk, ref Guid iid, out IntPtr ppv)
{
+#if !MOBILE
if (pUnk == IntPtr.Zero)
throw new ArgumentException ("Value cannot be null.", "pUnk");
return QueryInterfaceInternal (pUnk, ref iid, out ppv);
+#else
+ throw new NotImplementedException ();
+#endif
}
public static byte ReadByte (IntPtr ptr)
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public extern static IntPtr ReAllocHGlobal (IntPtr pv, IntPtr cb);
+#if !MOBILE
[ReliabilityContractAttribute (Consistency.WillNotCorruptState, Cer.Success)]
[MethodImplAttribute (MethodImplOptions.InternalCall)]
private extern static int ReleaseInternal (IntPtr pUnk);
+#endif
[ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
public static int Release (IntPtr pUnk)
{
+#if !MOBILE
if (pUnk == IntPtr.Zero)
throw new ArgumentException ("Value cannot be null.", "pUnk");
+
return ReleaseInternal (pUnk);
+#else
+ throw new NotImplementedException ();
+#endif
}
+#if !FULL_AOT_RUNTIME
#if !MOONLIGHT
[MethodImplAttribute (MethodImplOptions.InternalCall)]
private extern static int ReleaseComObjectInternal (object co);
throw new NotSupportedException ("MSDN states user code should never need to call this method.");
}
#endif // !NET_2_1
+#endif
[ComVisible (true)]
public static int SizeOf (object structure)
return null;
}
+#if !FULL_AOT_RUNTIME
#if !MOONLIGHT
public static int FinalReleaseComObject (object o)
{
while (ReleaseComObject (o) != 0);
return 0;
}
+#endif
#endif
[MethodImplAttribute(MethodImplOptions.InternalCall)]
namespace System.Runtime.InteropServices
{
+#if !MOBILE
[ComVisible(true)]
[Guid ("475e398f-8afa-43a7-a3be-f4ef8d6787c9")]
[ClassInterface (ClassInterfaceType.None)]
return guidManagedCategory;
}
- [MonoTODO ("implement")]
public virtual string GetProgIdForType (Type type)
{
- throw new NotImplementedException ();
+ return Marshal.GenerateProgIdForType(type);
}
[MonoTODO ("implement")]
}
}
+#endif
}
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System;
using System.Reflection;
using System.Reflection.Emit;
}
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
namespace System.Runtime.InteropServices
{
[ComVisible(true)]
ExportAs64Bit = 32
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System;
namespace System.Runtime.InteropServices {
}
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
namespace System.Runtime.InteropServices {
[ComVisible(true)]
FImmediateBind = 4096,
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System;
namespace System.Runtime.InteropServices {
}
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System;
namespace System.Runtime.InteropServices
#endif
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System;
namespace System.Runtime.InteropServices {
}
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
namespace System.Runtime.InteropServices {
[ComVisible(true)]
[Flags] [Serializable]
FReverseBind = 8192,
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System;
namespace System.Runtime.InteropServices {
}
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
namespace System.Runtime.InteropServices {
[ComVisible(true)]
FImmediateBind = 4096,
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
namespace System.Runtime.InteropServices
{
[Obsolete]
void RevokeObjectParam ([MarshalAs(UnmanagedType.LPWStr)] string pszKey);
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
namespace System.Runtime.InteropServices
{
[Obsolete]
void EnumConnections (out UCOMIEnumConnections ppEnum);
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
namespace System.Runtime.InteropServices
{
[Obsolete]
void FindConnectionPoint (ref Guid riid, out UCOMIConnectionPoint ppCP);
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
namespace System.Runtime.InteropServices
{
[Obsolete]
void Clone (out UCOMIEnumConnectionPoints ppenum);
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
namespace System.Runtime.InteropServices
{
[Obsolete]
void Clone (out UCOMIEnumConnections ppenum);
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
namespace System.Runtime.InteropServices
{
[Obsolete]
void Clone (out UCOMIEnumMoniker ppenum);
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
namespace System.Runtime.InteropServices
{
[Obsolete]
void Clone (out UCOMIEnumString ppenum);
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
namespace System.Runtime.InteropServices
{
[Obsolete]
void Clone (int ppenum);
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
namespace System.Runtime.InteropServices
{
[Obsolete]
void IsSystemMoniker (out int pdwMksys);
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
namespace System.Runtime.InteropServices
{
[Obsolete]
void GetCurFile ([MarshalAs(UnmanagedType.LPWStr)] out string ppszFileName);
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
namespace System.Runtime.InteropServices
{
[Obsolete]
void EnumRunning (out UCOMIEnumMoniker ppenumMoniker);
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
namespace System.Runtime.InteropServices
{
[Obsolete]
void Clone (out UCOMIStream ppstm);
}
}
+#endif
//
// (C) 2002 Ximian, Inc.
+#if !FULL_AOT_RUNTIME
namespace System.Runtime.InteropServices
{
[Obsolete]
void BindType([MarshalAs(UnmanagedType.LPWStr)] string szName, int lHashVal, out UCOMITypeInfo ppTInfo, out UCOMITypeComp ppTComp);
}
}
+#endif
//
// (C) 2002 Ximian, Inc.
+#if !FULL_AOT_RUNTIME
namespace System.Runtime.InteropServices
{
[Obsolete]
}
}
+#endif
//
// (C) 2002 Ximian, Inc.
+#if !FULL_AOT_RUNTIME
namespace System.Runtime.InteropServices
{
[Obsolete]
}
}
+#endif
[CLSCompliant (false)]
[InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
[Guid ("03973551-57A1-3900-A2B5-9083E3FF2943")]
+#if !FULL_AOT_RUNTIME
[TypeLibImportClass (typeof (Activator))]
+#endif
public interface _Activator {
void GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
[CLSCompliant (false)]
[InterfaceType (ComInterfaceType.InterfaceIsDual)]
[Guid ("17156360-2F1A-384A-BC52-FDE93C215C5B")]
+#if !FULL_AOT_RUNTIME
[TypeLibImportClass (typeof(Assembly))]
+#endif
public interface _Assembly
{
string ToString ();
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Reflection.Emit;
namespace System.Runtime.InteropServices {
IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
}
}
+#endif
[CLSCompliant (false)]
[InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
[Guid ("B42B6AAC-317E-34D5-9FA9-093BB4160C50")]
+#if !FULL_AOT_RUNTIME
[TypeLibImportClass (typeof (AssemblyName))]
+#endif
public interface _AssemblyName {
void GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
[CLSCompliant (false)]
[InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
[Guid ("917B14D0-2D9E-38B8-92A9-381ACF52F7C0")]
+#if !FULL_AOT_RUNTIME
[TypeLibImportClass (typeof (Attribute))]
+#endif
public interface _Attribute {
void GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Reflection.Emit;
namespace System.Runtime.InteropServices {
IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
}
}
+#endif
[CLSCompliant (false)]
[InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
[Guid ("E9A19478-9646-3679-9B10-8411AE1FD57D")]
+#if !FULL_AOT_RUNTIME
[TypeLibImportClass (typeof (ConstructorInfo))]
+#endif
[ComVisible (true)]
public interface _ConstructorInfo
{
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Reflection.Emit;
namespace System.Runtime.InteropServices {
IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Reflection.Emit;
namespace System.Runtime.InteropServices {
IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Reflection.Emit;
namespace System.Runtime.InteropServices {
}
}
+#endif
[CLSCompliant (false)]
[InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
[Guid ("9DE59C64-D889-35A1-B897-587D74469E5B")]
+#if !FULL_AOT_RUNTIME
[TypeLibImportClass (typeof (EventInfo))]
+#endif
[ComVisible (true)]
public interface _EventInfo
{
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Reflection.Emit;
namespace System.Runtime.InteropServices {
}
}
+#endif
[CLSCompliant (false)]
[InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
[Guid ("8A7C1442-A9FB-366B-80D8-4939FFA6DBE0")]
+#if !FULL_AOT_RUNTIME
[TypeLibImportClass (typeof (FieldInfo))]
+#endif
[ComVisible (true)]
public interface _FieldInfo
{
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Reflection.Emit;
namespace System.Runtime.InteropServices {
IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Reflection.Emit;
namespace System.Runtime.InteropServices {
IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
}
}
+#endif
[CLSCompliant (false)]
[InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
[Guid ("f7102fa9-cabb-3a74-a6da-b4567ef1b079")]
+#if !FULL_AOT_RUNTIME
[TypeLibImportClass (typeof (MemberInfo))]
+#endif
[ComVisible (true)]
public interface _MemberInfo
{
[CLSCompliant (false)]
[InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
[Guid ("6240837A-707F-3181-8E98-A36AE086766B")]
+#if !FULL_AOT_RUNTIME
[TypeLibImportClass (typeof (MethodBase))]
+#endif
[ComVisible (true)]
public interface _MethodBase
{
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Reflection.Emit;
namespace System.Runtime.InteropServices {
IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
}
}
+#endif
[CLSCompliant (false)]
[InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
[Guid ("FFCC1B5D-ECB8-38DD-9B01-3DC8ABC2AA5F")]
+#if !FULL_AOT_RUNTIME
[TypeLibImportClass (typeof (MethodInfo))]
+#endif
[ComVisible (true)]
public interface _MethodInfo
{
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Reflection.Emit;
+#endif
namespace System.Runtime.InteropServices {
[ComVisible (true)]
[CLSCompliant (false)]
[InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
[Guid ("C2323C25-F57F-3880-8A4D-12EBEA7A5852")]
+#if !FULL_AOT_RUNTIME
[TypeLibImportClass (typeof (MethodRental))]
+#endif
public interface _MethodRental {
void GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
[CLSCompliant (false)]
[InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
[Guid ("D002E9BA-D9E3-3749-B1D3-D565A08B13E7")]
+#if !FULL_AOT_RUNTIME
[TypeLibImportClass (typeof (Module))]
+#endif
public interface _Module {
void GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Reflection.Emit;
namespace System.Runtime.InteropServices {
}
}
+#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Reflection.Emit;
namespace System.Runtime.InteropServices {
IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
}
}
+#endif
[CLSCompliant (false)]
[InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
[Guid ("993634C4-E47A-32CC-BE08-85F567DC27D6")]
+#if !FULL_AOT_RUNTIME
[TypeLibImportClass (typeof (ParameterInfo))]
+#endif
public interface _ParameterInfo {
void GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Reflection.Emit;
namespace System.Runtime.InteropServices {
IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
}
}
+#endif
[CLSCompliant (false)]
[InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
[Guid ("F59ED4E4-E68F-3218-BD77-061AA82824BF")]
+#if !FULL_AOT_RUNTIME
[TypeLibImportClass (typeof (PropertyInfo))]
+#endif
[ComVisible (true)]
public interface _PropertyInfo
{
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Reflection.Emit;
+#endif
namespace System.Runtime.InteropServices {
[ComVisible (true)]
[CLSCompliant (false)]
[InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
[Guid ("7D13DD37-5A04-393C-BBCA-A5FEA802893D")]
+#if !FULL_AOT_RUNTIME
[TypeLibImportClass (typeof (SignatureHelper))]
+#endif
public interface _SignatureHelper {
void GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
[CLSCompliant (false)]
[InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
[Guid ("C281C7F1-4AA9-3517-961A-463CFED57E75")]
+#if !FULL_AOT_RUNTIME
[TypeLibImportClass (typeof (Thread))]
+#endif
public interface _Thread {
void GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
[CLSCompliant (false)]
[InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
[Guid ("BCA8B44D-AAD6-3A86-8AB7-03349F4F2DA2")]
+#if !FULL_AOT_RUNTIME
[TypeLibImportClass (typeof (Type))]
+#endif
[ComVisible (true)]
public interface _Type
{
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System.Reflection.Emit;
namespace System.Runtime.InteropServices {
}
}
+#endif
namespace System.Runtime.Serialization.Formatters.Binary {
[ComVisible (true)]
- public sealed class BinaryFormatter : IRemotingFormatter, IFormatter
+ public sealed class BinaryFormatter :
+#if !FULL_AOT_RUNTIME
+ IRemotingFormatter,
+#endif
+ IFormatter
{
private FormatterAssemblyStyle assembly_format = FormatterAssemblyStyle.Simple;
private SerializationBinder binder;
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using System;
using System.IO;
using System.Collections;
}
}
+#endif
TypeMetadata CreateMemberTypeMetadata (Type type)
{
+#if !FULL_AOT_RUNTIME
if (!BinaryCommon.UseReflectionSerialization) {
Type metaType = CodeGenerator.GenerateMetadataType (type, _context);
return (TypeMetadata) Activator.CreateInstance (metaType);
}
else
+#endif
return new MemberTypeMetadata (type, _context);
}
public static AsymmetricAlgorithm Create ()
{
+#if FULL_AOT_RUNTIME
+ return new RSACryptoServiceProvider ();
+#else
return Create ("System.Security.Cryptography.AsymmetricAlgorithm");
+#endif
}
public static AsymmetricAlgorithm Create (string algName)
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if !MOONLIGHT
+#if !MOONLIGHT && !FULL_AOT_RUNTIME
using System.Collections;
using System.Collections.Generic;
--- /dev/null
+//
+// CryptoConfig.cs: Handles cryptographic implementations and OIDs mappings.
+//
+// Authors:
+// Sebastien Pouliot (sebastien@xamarin.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
+// Copyright (C) Tim Coleman, 2004
+// Copyright (C) 2004-2007,2011 Novell, Inc (http://www.novell.com)
+// Copyright 2011 Xamarin, Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if FULL_AOT_RUNTIME
+
+// This is a special version of CryptoConfig that is not configurable and
+// every "choice" is statiscally compiled. As long as CreateFromName is not
+// used the linker will be able to eliminate the crypto code from the applications
+
+using System.Runtime.InteropServices;
+using System.Security.Permissions;
+
+namespace System.Security.Cryptography {
+
+ [ComVisible (true)]
+ public partial class CryptoConfig {
+
+ // try to avoid hitting the CreateFromName overloads to help the linker
+
+ public static object CreateFromName (string name)
+ {
+ return CreateFromName (name, null);
+ }
+
+ [PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]
+ public static object CreateFromName (string name, params object[] args)
+ {
+ if (name == null)
+ throw new ArgumentNullException ("name");
+
+ switch (name.ToLowerInvariant ()) {
+ case "system.security.cryptography.dsacryptoserviceprovider":
+ case "system.security.cryptography.dsa":
+ case "dsa":
+ return new DSACryptoServiceProvider ();
+ case "system.security.cryptography.dsasignaturedeformatter":
+ return new DSASignatureDeformatter ();
+ case "system.security.cryptography.dsasignatureformatter":
+ return new DSASignatureFormatter ();
+ case "system.security.cryptography.dsasignaturedescription":
+ case "http://www.w3.org/2000/09/xmldsig#dsa-sha1":
+ return new DSASignatureDescription ();
+ case "system.security.cryptography.descryptoserviceprovider":
+ case "system.security.cryptography.des":
+ case "des":
+ return new DESCryptoServiceProvider ();
+ case "system.security.cryptography.hmacmd5":
+ case "hmacmd5":
+ return new HMACMD5 ();
+ case "system.security.cryptography.hmacripemd160":
+ case "hmacripemd160":
+ case "http://www.w3.org/2001/04/xmldsig-more#hmac-ripemd160":
+ return new HMACRIPEMD160 ();
+ case "system.security.cryptography.keyedhashalgorithm":
+ case "system.security.cryptography.hmac":
+ case "system.security.cryptography.hmacsha1":
+ case "hmacsha1":
+ return new HMACSHA1 ();
+ case "system.security.cryptography.hmacsha256":
+ case "hmacsha256":
+ case "http://www.w3.org/2001/04/xmldsig-more#hmac-sha256":
+ return new HMACSHA256 ();
+ case "system.security.cryptography.hmacsha384":
+ case "hmacsha384":
+ case "http://www.w3.org/2001/04/xmldsig-more#hmac-sha384":
+ return new HMACSHA384 ();
+ case "system.security.cryptography.hmacsha512":
+ case "hmacsha512":
+ case "http://www.w3.org/2001/04/xmldsig-more#hmac-sha512":
+ return new HMACSHA512 ();
+ case "system.security.cryptography.mactripledes":
+ case "mactripledes":
+ return new MACTripleDES ();
+ case "system.security.cryptography.md5cryptoserviceprovider":
+ case "system.security.cryptography.md5":
+ case "md5":
+ return new MD5CryptoServiceProvider ();
+ case "system.security.cryptography.rc2cryptoserviceprovider":
+ case "system.security.cryptography.rc2":
+ case "rc2":
+ return new RC2CryptoServiceProvider ();
+ case "system.security.cryptography.symmetricalgorithm":
+ case "system.security.cryptography.rijndaelmanaged":
+ case "system.security.cryptography.rijndael":
+ case "rijndael":
+ return new RijndaelManaged ();
+ case "system.security.cryptography.ripemd160managed":
+ case "system.security.cryptography.ripemd160":
+ case "ripemd-160":
+ case "ripemd160":
+ return new RIPEMD160Managed ();
+ case "system.security.cryptography.rngcryptoserviceprovider":
+ case "system.security.cryptography.randomnumbergenerator":
+ case "randomnumbergenerator":
+ return new RNGCryptoServiceProvider ();
+ case "system.security.cryptography.asymmetricalgorithm":
+ case "system.security.cryptography.rsa":
+ case "rsa":
+ return new RSACryptoServiceProvider ();
+ case "system.security.cryptography.rsapkcs1signaturedeformatter":
+ return new RSAPKCS1SignatureDeformatter ();
+ case "system.security.cryptography.rsapkcs1signatureformatter":
+ return new RSAPKCS1SignatureFormatter ();
+ case "system.security.cryptography.rsapkcs1sha1signaturedescription":
+ case "http://www.w3.org/2000/09/xmldsig#rsa-sha1":
+ return new RSAPKCS1SHA1SignatureDescription ();
+ case "system.security.cryptography.hashalgorithm":
+ case "system.security.cryptography.sha1":
+ case "system.security.cryptography.sha1cryptoserviceprovider":
+ case "sha1":
+ case "sha":
+ case "http://www.w3.org/2000/09/xmldsig#sha1":
+ return new SHA1CryptoServiceProvider ();
+ case "system.security.cryptography.sha1managed":
+ return new SHA1Managed ();
+ case "system.security.cryptography.sha256managed":
+ case "system.security.cryptography.sha256":
+ case "sha256":
+ case "sha-256":
+ case "http://www.w3.org/2001/04/xmlenc#sha256":
+ return new SHA256Managed ();
+ case "system.security.cryptography.sha384managed":
+ case "system.security.cryptography.sha384":
+ case "sha384":
+ case "sha-384":
+ return new SHA384Managed ();
+ case "system.security.cryptography.sha512managed":
+ case "system.security.cryptography.sha512":
+ case "sha512":
+ case "sha-512":
+ case "http://www.w3.org/2001/04/xmlenc#sha512":
+ return new SHA512Managed ();
+ case "system.security.cryptography.tripledescryptoserviceprovider":
+ case "system.security.cryptography.tripledes":
+ case "triple des":
+ case "tripledes":
+ case "3des":
+ return new TripleDESCryptoServiceProvider ();
+ default:
+ // method doesn't throw any exception
+ return null;
+ }
+ }
+
+ public static string MapNameToOID (string name)
+ {
+ if (name == null)
+ throw new ArgumentNullException ("name");
+
+ switch (name.ToLowerInvariant ()) {
+ case "system.security.cryptography.sha1cryptoserviceprovider":
+ case "system.security.cryptography.sha1managed":
+ case "system.security.cryptography.sha1":
+ case "sha1":
+ return "1.3.14.3.2.26";
+ case "system.security.cryptography.md5cryptoserviceprovider":
+ case "system.security.cryptography.md5":
+ case "md5":
+ return "1.2.840.113549.2.5";
+ case "system.security.cryptography.sha256managed":
+ case "system.security.cryptography.sha256":
+ case "sha256":
+ return "2.16.840.1.101.3.4.2.1";
+ case "system.security.cryptography.sha384managed":
+ case "system.security.cryptography.sha384":
+ case "sha384":
+ return "2.16.840.1.101.3.4.2.2";
+ case "system.security.cryptography.sha512managed":
+ case "system.security.cryptography.sha512":
+ case "sha512":
+ return "2.16.840.1.101.3.4.2.3";
+ case "system.security.cryptography.ripemd160managed":
+ case "system.security.cryptography.ripemd160":
+ case "ripemd160":
+ return "1.3.36.3.2.1";
+ case "tripledeskeywrap":
+ return "1.2.840.113549.1.9.16.3.6";
+ case "des":
+ return "1.3.14.3.2.7";
+ case "tripledes":
+ return "1.2.840.113549.3.7";
+ case "rc2":
+ return "1.2.840.113549.3.2";
+ default:
+ return null;
+ }
+ }
+ }
+}
+
+#endif
public static new DES Create ()
{
+#if FULL_AOT_RUNTIME
+ return new System.Security.Cryptography.DESCryptoServiceProvider ();
+#else
return Create ("System.Security.Cryptography.DES");
+#endif
}
public static new DES Create (string algName)
public static new DSA Create ()
{
+#if FULL_AOT_RUNTIME
+ return new System.Security.Cryptography.DSACryptoServiceProvider ();
+#else
return Create ("System.Security.Cryptography.DSA");
+#endif
}
public static new DSA Create (string algName)
public static new HMAC Create ()
{
+#if FULL_AOT_RUNTIME
+ return new System.Security.Cryptography.HMACSHA1 ();
+#else
return Create ("System.Security.Cryptography.HMAC");
+#endif
}
public static new HMAC Create (string algorithmName)
public static HashAlgorithm Create ()
{
+#if FULL_AOT_RUNTIME
+ return new System.Security.Cryptography.SHA1CryptoServiceProvider ();
+#else
return Create ("System.Security.Cryptography.HashAlgorithm");
+#endif
}
public static HashAlgorithm Create (string hashName)
public static new KeyedHashAlgorithm Create ()
{
+#if FULL_AOT_RUNTIME
+ return new System.Security.Cryptography.HMACSHA1 ();
+#else
return Create ("System.Security.Cryptography.KeyedHashAlgorithm");
+#endif
}
public static new KeyedHashAlgorithm Create (string algName)
\r
public static new MD5 Create () \r
{\r
+#if FULL_AOT_RUNTIME
+ return new System.Security.Cryptography.MD5CryptoServiceProvider ();
+#else
return Create ("System.Security.Cryptography.MD5");\r
+#endif
}\r
\r
public static new MD5 Create (string algName) \r
public static new RC2 Create ()
{
+#if FULL_AOT_RUNTIME
+ return new System.Security.Cryptography.RC2CryptoServiceProvider ();
+#else
return Create ("System.Security.Cryptography.RC2");
+#endif
}
public static new RC2 Create (string AlgName)
/// <returns>A new instance of the RIPEMD160 hash algorithm.</returns>
public static new RIPEMD160 Create ()
{
+#if FULL_AOT_RUNTIME
+ return new System.Security.Cryptography.RIPEMD160Managed ();
+#else
return Create ("System.Security.Cryptography.RIPEMD160");
+#endif
}
/// <summary>
public static new RSA Create ()
{
+#if FULL_AOT_RUNTIME
+ return new System.Security.Cryptography.RSACryptoServiceProvider ();
+#else
return Create ("System.Security.Cryptography.RSA");
+#endif
}
public static new RSA Create (string algName)
public static RandomNumberGenerator Create ()
{
+#if FULL_AOT_RUNTIME
+ return new System.Security.Cryptography.RNGCryptoServiceProvider ();
+#else
// create the default random number generator
return Create ("System.Security.Cryptography.RandomNumberGenerator");
+#endif
}
public static RandomNumberGenerator Create (string rngName)
\r
public static new Rijndael Create () \r
{\r
+#if FULL_AOT_RUNTIME
+ return new System.Security.Cryptography.RijndaelManaged ();
+#else
return Create ("System.Security.Cryptography.Rijndael");\r
+#endif
}\r
\r
public static new Rijndael Create (string algName) \r
\r
public static new SHA1 Create () \r
{\r
+#if FULL_AOT_RUNTIME
+ return new System.Security.Cryptography.SHA1CryptoServiceProvider ();
+#else
return Create ("System.Security.Cryptography.SHA1");\r
+#endif
}\r
\r
public static new SHA1 Create (string hashName) \r
\r
public static new SHA256 Create () \r
{\r
+#if FULL_AOT_RUNTIME
+ return new System.Security.Cryptography.SHA256Managed ();
+#else
return Create ("System.Security.Cryptography.SHA256");\r
+#endif
}\r
\r
public static new SHA256 Create (string hashName) \r
\r
public static new SHA384 Create () \r
{\r
+#if FULL_AOT_RUNTIME
+ return new System.Security.Cryptography.SHA384Managed ();
+#else
return Create ("System.Security.Cryptography.SHA384");\r
+#endif
}\r
\r
public static new SHA384 Create (string hashName) \r
\r
public static new SHA512 Create () \r
{\r
+#if FULL_AOT_RUNTIME
+ return new System.Security.Cryptography.SHA512Managed ();
+#else
return Create ("System.Security.Cryptography.SHA512");\r
+#endif
}\r
\r
public static new SHA512 Create (string hashName) \r
// LAMESPEC: Default is Rijndael - not TripleDES
public static SymmetricAlgorithm Create ()
{
+#if FULL_AOT_RUNTIME
+ return new System.Security.Cryptography.RijndaelManaged ();
+#else
return Create ("System.Security.Cryptography.SymmetricAlgorithm");
+#endif
}
public static SymmetricAlgorithm Create (string algName)
public static new TripleDES Create ()
{
+#if FULL_AOT_RUNTIME
+ return new System.Security.Cryptography.TripleDESCryptoServiceProvider ();
+#else
return Create ("System.Security.Cryptography.TripleDES");
+#endif
}
public static new TripleDES Create (string str)
namespace System.Security.Permissions {
-#if NET_2_1
+#if NET_2_1 && !MONOTOUCH
[Obsolete ("CAS support is not available with Silverlight applications.")]
#endif
[ComVisible (true)]
namespace System.Security.Permissions {
-#if NET_2_1
+#if NET_2_1 && !MONOTOUCH
[Obsolete ("CAS support is not available with Silverlight applications.")]
#endif
[ComVisible (true)]
namespace System.Security.Permissions {
-#if NET_2_1
+#if NET_2_1 && !MONOTOUCH
[Obsolete ("CAS support is not available with Silverlight applications.")]
#endif
[ComVisible (true)]
namespace System.Security.Permissions {
-#if NET_2_1
+#if NET_2_1 && !MONOTOUCH
[Obsolete ("CAS support is not available with Silverlight applications.")]
#endif
[ComVisible (true)]
namespace System.Security.Permissions {
-#if NET_2_1
+#if NET_2_1 && !MONOTOUCH
[Obsolete ("CAS support is not available with Silverlight applications.")]
#endif
[ComVisible (true)]
[Obsolete]
#endif
public static bool CheckExecutionRights {
- get { return true; }
+ get { return false; }
set { ; }
}
[Obsolete ("The security manager cannot be turned off on MS runtime")]
public static bool SecurityEnabled {
- get { return true; }
+ get { return false; }
set { ; }
}
internal static int GetBestWorkerNumber (TaskScheduler scheduler)
{
- return scheduler.MaximumConcurrencyLevel;
+ return Math.Min (Environment.ProcessorCount, (scheduler ?? TaskScheduler.Current).MaximumConcurrencyLevel);
}
static int GetBestWorkerNumber (int from, int to, ParallelOptions options, out int step)
{
int num = GetBestWorkerNumber(options.TaskScheduler);
if (options != null && options.MaxDegreeOfParallelism != -1)
- num = options.MaxDegreeOfParallelism;
+ num = Math.Min (options.MaxDegreeOfParallelism, num);
// Integer range that each task process
if ((step = (to - from) / num) < 5) {
step = 5;
if (destruct == null)
throw new ArgumentNullException ("destruct");
- int num = Math.Min (GetBestWorkerNumber (),
+ int num = Math.Min (GetBestWorkerNumber (options.TaskScheduler),
options != null && options.MaxDegreeOfParallelism != -1 ? options.MaxDegreeOfParallelism : int.MaxValue);
Task[] tasks = new Task[num];
return true;
}
+ internal bool TrySetExceptionObserved ()
+ {
+ if (exSlot != null) {
+ exSlot.Observed = true;
+ return true;
+ }
+ return false;
+ }
+
internal void Execute ()
{
ThreadStart ();
public override void Invoke (Task owner, object state, Task context)
{
+ owner.TrySetExceptionObserved ();
action (tasks);
}
}
public override void Invoke (Task owner, object state, Task context)
{
+ owner.TrySetExceptionObserved ();
((Task<TResult>) context).Result = action (tasks);
}
}
return new FuncTaskObjectInvoke<TResult, TNewResult> (action);
}
+ #region Used by ContinueWhenAll
+
public static TaskActionInvoker Create (Action<Task[]> action, Task[] tasks)
{
return new ActionTasksInvoke (action, tasks);
return new FuncTasksInvoke<TResult> (action, tasks);
}
- #region Used by WhenAny
+ #endregion
+
+ #region Used by ContinueWhenAny
public static TaskActionInvoker CreateSelected (Action<Task> action)
{
throw new ArgumentOutOfRangeException ("creationOptions");
var tcs = new TaskCompletionSource<TResult> (state, creationOptions);
- var alreadyInvoked = false;
+ var alreadyInvoked = new AtomicBoolean ();
var iar = beginMethod (l => {
- alreadyInvoked = true;
- InnerInvoke (tcs, endMethod, l);
+ if (alreadyInvoked.TryRelaxedSet ())
+ InnerInvoke (tcs, endMethod, l);
}, state);
- if (iar != null && !alreadyInvoked && iar.CompletedSynchronously) {
+ if (iar != null && iar.CompletedSynchronously && alreadyInvoked.TryRelaxedSet ())
InnerInvoke (tcs, endMethod, iar);
- }
return tcs.Task;
}
throw new ArgumentOutOfRangeException ("creationOptions");
var tcs = new TaskCompletionSource<TResult> (state, creationOptions);
- var alreadyInvoked = false;
+ var alreadyInvoked = new AtomicBoolean ();
var iar = beginMethod (arg1, l => {
- alreadyInvoked = true;
- InnerInvoke (tcs, endMethod, l);
+ if (alreadyInvoked.TryRelaxedSet ())
+ InnerInvoke (tcs, endMethod, l);
}, state);
- if (iar != null && !alreadyInvoked && iar.CompletedSynchronously) {
+ if (iar != null && iar.CompletedSynchronously && alreadyInvoked.TryRelaxedSet ())
InnerInvoke (tcs, endMethod, iar);
- }
return tcs.Task;
}
throw new ArgumentOutOfRangeException ("creationOptions");
var tcs = new TaskCompletionSource<TResult> (state, creationOptions);
- var alreadyInvoked = false;
+ var alreadyInvoked = new AtomicBoolean ();
var iar = beginMethod (arg1, arg2, l => {
- alreadyInvoked = true;
- InnerInvoke (tcs, endMethod, l);
+ if (alreadyInvoked.TryRelaxedSet ())
+ InnerInvoke (tcs, endMethod, l);
}, state);
- if (iar != null && !alreadyInvoked && iar.CompletedSynchronously) {
+ if (iar != null && iar.CompletedSynchronously && alreadyInvoked.TryRelaxedSet ())
InnerInvoke (tcs, endMethod, iar);
- }
return tcs.Task;
}
throw new ArgumentOutOfRangeException ("creationOptions");
var tcs = new TaskCompletionSource<TResult> (state, creationOptions);
- bool alreadyInvoked = false;
+ var alreadyInvoked = new AtomicBoolean ();
var iar = beginMethod (arg1, arg2, arg3, l => {
- alreadyInvoked = true;
- InnerInvoke (tcs, endMethod, l);
+ if (alreadyInvoked.TryRelaxedSet ())
+ InnerInvoke (tcs, endMethod, l);
}, state);
- if (iar != null && !alreadyInvoked && iar.CompletedSynchronously) {
+ if (iar != null && iar.CompletedSynchronously && alreadyInvoked.TryRelaxedSet ())
InnerInvoke (tcs, endMethod, iar);
- }
return tcs.Task;
}
public virtual int MaximumConcurrencyLevel {
get {
- return Environment.ProcessorCount;
+ return int.MaxValue;
}
}
//
// System.Threading.NativeOverlapped.cs
//
-// Author:
+// Authors:
// Dick Porter (dick@ximian.com)
+// Marek Safar (marek.safar@gmail.com)
//
// (C) Ximian, Inc. http://www.ximian.com
-//
-
-//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright 2012 Xamarin Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
namespace System.Threading
{
[ComVisible (true)]
- public struct NativeOverlapped {
- public IntPtr EventHandle;
- public IntPtr InternalHigh;
+ public struct NativeOverlapped
+ {
public IntPtr InternalLow;
- public int OffsetHigh;
+ public IntPtr InternalHigh;
public int OffsetLow;
-
- // (fields disappeared beta2 -> 1.0)
- // public GCHandle ReservedClassLib;
- // public int ReservedCOR1;
- // public GCHandle ReservedCOR2;
-
- // P.S. (Gonzalo): try this:
- // Console.WriteLine (Marshal.SizeOf (typeof (NativeOverlapped)));
- //
- // And you'll get a nice 36. So probably those fields are out there but are not public.
- // So I'm adding some internal fields that are used in the runtime
-#pragma warning disable 649
- internal int Handle1;
- internal int Handle2;
-#pragma warning restore 649
+ public int OffsetHigh;
+ public IntPtr EventHandle;
}
}
using System.Globalization;
using System.IO;
using System.Reflection;
+#if !FULL_AOT_RUNTIME
using System.Reflection.Emit;
+#endif
using System.Threading;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
{
return Activator.CreateComInstanceFrom (assemblyFile, typeName, hashValue ,hashAlgorithm);
}
+#endif
#endif
public ObjectHandle CreateInstance (string assemblyName, string typeName)
return (oh != null) ? oh.Unwrap () : null;
}
-#endif // !NET_2_1
-
+#if !FULL_AOT_RUNTIME
public AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access)
{
return DefineDynamicAssembly (name, access, null, null, null, null, null, false);
{
return new AssemblyBuilder (name, null, access, true);
}
+#endif
//
// AppDomain.DoCallBack works because AppDomain is a MarshalByRefObject
string name;
+#if !FULL_AOT_RUNTIME
if (name_or_tb is TypeBuilder)
name = ((TypeBuilder) name_or_tb).FullName;
else
+#endif
name = (string) name_or_tb;
/* Prevent infinite recursion */
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.ConstrainedExecution;
+#if !FULL_AOT_RUNTIME
using System.Reflection.Emit;
+#endif
namespace System
{
throw new NotSupportedException ("Array type can not be void");
if (elementType.ContainsGenericParameters)
throw new NotSupportedException ("Array type can not be an open generic type");
+#if !FULL_AOT_RUNTIME
if ((elementType is TypeBuilder) && !(elementType as TypeBuilder).IsCreated ())
throw new NotSupportedException ("Can't create an array of the unfinished type '" + elementType + "'.");
+#endif
return CreateInstanceImpl (elementType, lengths, bounds);
}
if (index + length > array.Length)
throw new ArgumentException ();
- SortImpl<T, T> (array, null, index, length, comparer);
+ SortImpl<T> (array, index, length, comparer);
}
[ReliabilityContractAttribute (Consistency.MayCorruptInstance, Cer.MayFail)]
// Check for value types which can be sorted without Compare () method
//
if (comparer == null) {
+ /* Avoid this when using full-aot to prevent the generation of many unused qsort<K,T> instantiations */
+#if FULL_AOT_RUNTIME
#if !BOOTSTRAP_BASIC
switch (Type.GetTypeCode (typeof (TKey))) {
case TypeCode.Int32:
qsort (keys as UInt64[], items, low, high);
return;
}
+#endif
#endif
// Using Comparer<TKey> adds a small overload, but with value types it
// helps us to not box them.
}
}
+ [MethodImpl ((MethodImplOptions)256)]
private static void swap<K, V> (K [] keys, V [] items, int i, int j)
{
K tmp;
}
}
+ [MethodImpl ((MethodImplOptions)256)]
private static void swap<T> (T [] array, int i, int j)
{
T tmp = array [i];
stdin = new CStreamReader (OpenStandardInput (0), inputEncoding);
} else {
#endif
+#if FULL_AOT_RUNTIME
+ Type nslogwriter = Type.GetType ("MonoTouch.Foundation.NSLogWriter, monotouch, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null");
+ stdout = (TextWriter) Activator.CreateInstance (nslogwriter);
+#else
stdout = new UnexceptionalStreamWriter (OpenStandardOutput (0), outputEncoding);
((StreamWriter)stdout).AutoFlush = true;
+#endif
stdout = TextWriter.Synchronized (stdout, true);
+#if FULL_AOT_RUNTIME
+ stderr = (TextWriter) Activator.CreateInstance (nslogwriter);
+#else
stderr = new UnexceptionalStreamWriter (OpenStandardError (0), outputEncoding);
((StreamWriter)stderr).AutoFlush = true;
+#endif
stderr = TextWriter.Synchronized (stderr, true);
stdin = new UnexceptionalStreamReader (OpenStandardInput (0), inputEncoding);
}
}
-#if NET_4_5
- public static bool IsErrorRedirected {
- get {
- return stderr != console_stderr || ConsoleDriver.IsErrorRedirected;
- }
- }
-
- public static bool IsOutputRedirected {
- get {
- return stdout != console_stdout || ConsoleDriver.IsOutputRedirected;
- }
- }
-
- public static bool IsInputRedirected {
- get {
- return stdin != console_stdin || ConsoleDriver.IsInputRedirected;
- }
- }
-#endif
-
private static Stream Open (IntPtr handle, FileAccess access, int bufferSize)
{
#if MOONLIGHT
set { ConsoleDriver.WindowWidth = value; }
}
+#if NET_4_5
+ public static bool IsErrorRedirected {
+ get {
+ return stderr != console_stderr || ConsoleDriver.IsErrorRedirected;
+ }
+ }
+
+ public static bool IsOutputRedirected {
+ get {
+ return stdout != console_stdout || ConsoleDriver.IsOutputRedirected;
+ }
+ }
+
+ public static bool IsInputRedirected {
+ get {
+ return stdin != console_stdin || ConsoleDriver.IsInputRedirected;
+ }
+ }
+#endif
+
public static void Beep ()
{
Beep (1000, 500);
internal bool IsTransparentProxy ()
{
+#if MONOTOUCH
+ return false;
+#else
return RemotingServices.IsTransparentProxy (m_target);
+#endif
}
}
}
}
private static object _rngAccess = new object ();
+#if !FULL_AOT_RUNTIME
private static RandomNumberGenerator _rng;
private static RandomNumberGenerator _fastRng;
+#else
+ private static object _fastRng;
+#endif
// generated as per section 3.4 of the specification
public static Guid NewGuid ()
{
+#if !FULL_AOT_RUNTIME
byte[] b = new byte [16];
// thread-safe access to the prng
_rng = RandomNumberGenerator.Create ();
_rng.GetBytes (b);
}
+#else
+ byte[] b = FastNewGuidArray ();
+#endif
+
Guid res = new Guid (b);
// Mask in Variant 1-0 in Bit[7..6]
// thread-safe access to the prng
lock (_rngAccess) {
// if known, use preferred RNG
+#if FULL_AOT_RUNTIME
+ if (_fastRng == null)
+ _fastRng = new RNGCryptoServiceProvider ();
+ (_fastRng as RNGCryptoServiceProvider).GetBytes (guid);
+#else
if (_rng != null)
_fastRng = _rng;
// else use hardcoded default RNG (bypassing CryptoConfig)
if (_fastRng == null)
_fastRng = new RNGCryptoServiceProvider ();
_fastRng.GetBytes (guid);
+#endif
}
// Mask in Variant 1-0 in Bit[7..6]
using System.Reflection;
using System.Collections;
using System.Runtime.CompilerServices;
+#if !FULL_AOT_RUNTIME
using System.Reflection.Emit;
+#endif
+
using System.Collections.Generic;
namespace System
static bool IsUserCattrProvider (object obj)
{
Type type = obj as Type;
+#if !FULL_AOT_RUNTIME
if ((type is MonoType) || (type is TypeBuilder))
+#else
+ if (type is MonoType)
+#endif
return false;
if ((obj is Type))
return true;
public static int CompareOrdinal (String strA, int indexA, String strB, int indexB, int length)
{
- if ((indexA > strA.Length) || (indexB > strB.Length) || (indexA < 0) || (indexB < 0) || (length < 0))
- throw new ArgumentOutOfRangeException ();
+ if (strA != null && strB != null)
+ {
+ if (indexA > strA.Length || indexA < 0)
+ throw new ArgumentOutOfRangeException ("indexA");
+ if (indexB > strB.Length || indexB < 0)
+ throw new ArgumentOutOfRangeException ("indexB");
+ if (length < 0)
+ throw new ArgumentOutOfRangeException ("length");
+ }
return CompareOrdinalUnchecked (strA, indexA, length, strB, indexB, length);
}
internal static int CompareOrdinalCaseInsensitive (String strA, int indexA, String strB, int indexB, int length)
{
- if ((indexA > strA.Length) || (indexB > strB.Length) || (indexA < 0) || (indexB < 0) || (length < 0))
- throw new ArgumentOutOfRangeException ();
+ if (strA != null && strB != null)
+ {
+ if (indexA > strA.Length || indexA < 0)
+ throw new ArgumentOutOfRangeException ("indexA");
+ if (indexB > strB.Length || indexB < 0)
+ throw new ArgumentOutOfRangeException ("indexB");
+ if (length < 0)
+ throw new ArgumentOutOfRangeException ("length");
+ }
return CompareOrdinalCaseInsensitiveUnchecked (strA, indexA, length, strB, indexB, length);
}
{
// Same as above, but checks versus uppercase characters
if (strA == null) {
- if (strB == null)
- return 0;
- else
- return -1;
- } else if (strB == null) {
+ return strB == null ? 0 : -1;
+ }
+ if (strB == null) {
return 1;
}
int lengthA = Math.Min (lenA, strA.Length - indexA);
using System.Diagnostics;
using System.Reflection;
+#if !FULL_AOT_RUNTIME
using System.Reflection.Emit;
+#endif
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
Type type = this;
if (type is MonoType)
return GetTypeCodeInternal (type);
+#if !FULL_AOT_RUNTIME
if (type is TypeBuilder)
return ((TypeBuilder)type).GetTypeCodeInternal ();
+#endif
type = type.UnderlyingSystemType;
if (Equals (c))
return true;
+#if !FULL_AOT_RUNTIME
if (c is TypeBuilder)
return ((TypeBuilder)c).IsAssignableTo (this);
+#endif
/* Handle user defined type classes */
if (!IsSystemType) {
systemTypes [i] = t;
}
+#if !FULL_AOT_RUNTIME
if (hasUserType) {
return new MonoGenericClass (this, typeArguments);
}
+#endif
Type res = MakeGenericType (this, systemTypes);
if (res == null)
vt = (short)VarEnum.VT_BSTR;
bstrVal = Marshal.StringToBSTR(((BStrWrapper)obj).WrappedObject);
}
+#if !FULL_AOT_RUNTIME
else if (t == typeof (UnknownWrapper))
{
vt = (short)VarEnum.VT_UNKNOWN;
vt = (short)VarEnum.VT_DISPATCH;
pdispVal = Marshal.GetIDispatchForObject(((DispatchWrapper)obj).WrappedObject);
}
+#endif
else
{
+#if FULL_AOT_RUNTIME
+ throw new NotImplementedException(string.Format("Variant couldn't handle object of type {0}", obj.GetType()));
+#else
try
{
pdispVal = Marshal.GetIDispatchForObject(obj);
{
throw new NotImplementedException(string.Format("Variant couldn't handle object of type {0}", obj.GetType()), ex);
}
+#endif
}
}
case VarEnum.VT_BSTR:
obj = Marshal.PtrToStringBSTR(bstrVal);
break;
+#if !FULL_AOT_RUNTIME
case VarEnum.VT_UNKNOWN:
case VarEnum.VT_DISPATCH:
if (pdispVal != IntPtr.Zero)
obj = Marshal.GetObjectForIUnknown(pdispVal);
break;
+#endif
}
return obj;
}
using System.Security.Policy;
using System.Security.Principal;
using System.Reflection;
+#if !FULL_AOT_RUNTIME
using System.Reflection.Emit;
+#endif
using System.Globalization;
using System.Runtime.Remoting;
using System.Runtime.InteropServices;
BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture,
object[] activationAttributes, Evidence securityAttributes);
#endif
+
+#if !FULL_AOT_RUNTIME
AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access);
AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, Evidence evidence);
AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, string dir);
AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, string dir,
Evidence evidence, PermissionSet requiredPermissions, PermissionSet optionalPermissions,
PermissionSet refusedPermissions, bool isSynchronized);
+#endif
void DoCallBack (CrossAppDomainDelegate theDelegate);
bool Equals (object other);
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !FULL_AOT_RUNTIME
using Mono.Interop;
using System.Collections;
using System.Runtime.InteropServices;
out IntPtr pUnk);
}
}
+#endif
}
}
+ [Test]
+ public void ContinueWhenAll_WithExceptions ()
+ {
+ var t1 = Task.Factory.StartNew (() => { throw new ApplicationException ("Foo"); });
+ var t2 = Task.Factory.StartNew (() => { throw new ApplicationException ("Bar"); });
+
+ var cont = Task.Factory.ContinueWhenAll (new[] { t1, t2 }, delegate {});
+ cont.Wait (200);
+
+ Assert.IsTrue (t1.IsFaulted);
+ Assert.IsTrue (t2.IsFaulted);
+ Assert.AreEqual (TaskStatus.RanToCompletion, cont.Status);
+ }
+
[Test]
public void ContinueWhenAny_Simple ()
{
WaitHandle.WaitAny (new WaitHandle [0]);
}
+ [Test]
+ public void InterrupedWaitAny ()
+ {
+ using (var m1 = new Mutex (true)) {
+ using (var m2 = new Mutex (true)) {
+ using (var done = new ManualResetEvent (false)) {
+ var thread = new Thread (() =>
+ {
+ try {
+ WaitHandle.WaitAny (new WaitHandle [] { m1, m2 });
+ } catch (ThreadInterruptedException) {
+ done.Set ();
+ }
+ });
+ thread.Start ();
+ Thread.Sleep (100); // wait a bit so the thread can enter its wait
+ thread.Interrupt ();
+
+ Assert.IsTrue (thread.Join (1000), "Join");
+ Assert.IsTrue (done.WaitOne (1000), "done");
+
+ m1.ReleaseMutex ();
+ m2.ReleaseMutex ();
+ }
+ }
+ }
+ }
+
+ [Test]
+ public void InterrupedWaitAll ()
+ {
+ using (var m1 = new Mutex (true)) {
+ using (var m2 = new Mutex (true)) {
+ using (var done = new ManualResetEvent (false)) {
+ var thread = new Thread (() =>
+ {
+ try {
+ WaitHandle.WaitAll (new WaitHandle [] { m1, m2 });
+ } catch (ThreadInterruptedException) {
+ done.Set ();
+ }
+ });
+ thread.Start ();
+ Thread.Sleep (100); // wait a bit so the thread can enter its wait
+ thread.Interrupt ();
+
+ Assert.IsTrue (thread.Join (1000), "Join");
+ Assert.IsTrue (done.WaitOne (1000), "done");
+
+ m1.ReleaseMutex ();
+ m2.ReleaseMutex ();
+ }
+ }
+ }
+ }
+
+ [Test]
+ public void InterrupedWaitOne ()
+ {
+ using (var m1 = new Mutex (true)) {
+ using (var done = new ManualResetEvent (false)) {
+ var thread = new Thread (() =>
+ {
+ try {
+ m1.WaitOne ();
+ } catch (ThreadInterruptedException) {
+ done.Set ();
+ }
+ });
+ thread.Start ();
+ Thread.Sleep (100); // wait a bit so the thread can enter its wait
+ thread.Interrupt ();
+
+ Assert.IsTrue (thread.Join (1000), "Join");
+ Assert.IsTrue (done.WaitOne (1000), "done");
+
+ m1.ReleaseMutex ();
+ }
+ }
+ }
+
}
}
Assert.IsTrue (string.CompareOrdinal (ab2, 0, ab1, 1, 1) < 0, "#2");
}
+ [Test]
+ public void CompareOrdinalSubstringWithNull ()
+ {
+ string lesser = "abc";
+ string greater = "xyz";
+
+ Assert.AreEqual (0, string.CompareOrdinal (null, 0, null, 0, 0), "substring both null");
+ Assert.AreEqual (-1, string.CompareOrdinal (null, 0, greater, 0, 0), "substring strA null");
+ Assert.AreEqual (-1, string.CompareOrdinal (null, 4, greater, 0, 0), "substring strA null; indexA greater than strA.Length");
+ Assert.AreEqual (-1, string.CompareOrdinal (null, 0, greater, 4, 0), "substring strA null; indexB greater than strB.Length");
+ Assert.AreEqual (-1, string.CompareOrdinal (null, -1, greater, -1, -1), "substring strA null; indexA, indexB, length negative");
+ Assert.AreEqual (1, string.CompareOrdinal (lesser, 0, null, 0, 0), "substring strB null");
+ Assert.AreEqual (1, string.CompareOrdinal (lesser, 4, null, 0, 0), "substring strB null; indexA greater than strA.Length");
+ Assert.AreEqual (1, string.CompareOrdinal (lesser, 0, null, 4, 0), "substring strB null; indexB greater than strB.Length");
+ Assert.AreEqual (1, string.CompareOrdinal (lesser, -1, null, -1, -1), "substring strB null; indexA, indexB, length negative");
+ }
+
[Test]
public void CompareTo ()
{
System.Security.Cryptography/CryptoAPITransform.cs
System.Security.Cryptography/CryptoConfig.cs
System.Security.Cryptography/CryptoConfig_2_1.cs
+System.Security.Cryptography/CryptoConfig.fullaot.cs
System.Security.Cryptography/CryptographicException.cs
System.Security.Cryptography/CryptographicUnexpectedOperationExcpetion.cs
System.Security.Cryptography/CryptoStream.cs
netdocs.zip : netdocs.tree
netdocs.tree: Makefile
- $(MDOC) assemble -o netdocs $(NETDOCS_DIRS)
+ $(MDOC) --debug assemble -o netdocs $(NETDOCS_DIRS)
Mono.zip : Mono.tree
Mono.tree: Makefile
- $(MDOC) assemble -o Mono $(MONO_DIRS)
+ $(MDOC) --debug assemble -o Mono $(MONO_DIRS)
Novell.zip : Novell.tree
Novell.tree: Makefile
- $(MDOC) assemble -o Novell $(NOVELL_DIRS)
+ $(MDOC) --debug assemble -o Novell $(NOVELL_DIRS)
cs-errors.zip : cs-errors.tree
cs-errors.tree: cs-errors.config Makefile
- $(MDOC) assemble -o cs-errors -f error $<
+ $(MDOC) --debug assemble -o cs-errors -f error $<
ecma334.zip : ecma334.tree
ecma334.tree: Makefile
- $(MDOC) assemble -o ecma334 -f ecmaspec ecma334
+ $(MDOC) --debug assemble -o ecma334 -f ecmaspec ecma334
--- /dev/null
+.assembly extern mscorlib
+{
+}
+
+.assembly extern 'CS0012-lib-missing'
+{
+}
+
+.assembly 'CS0012-17-lib'
+{
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+
+.module 'CS0012-17-lib.dll'
+
+.class public auto ansi beforefieldinit B
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig static void Foo<(class ['CS0012-lib-missing']AA`1<!!T>) T>() cil managed
+ {
+ ret
+ }
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ ret
+ }
+
+}
--- /dev/null
+.assembly extern mscorlib
+{
+}
+
+.assembly extern 'CS0012-lib-missing'
+{
+}
+
+.assembly 'CS0012-18-lib'
+{
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+
+.module 'CS0012-18-lib.dll'
+
+
+.class public auto ansi beforefieldinit B
+ extends [mscorlib]System.Object
+{
+ .field public static literal valuetype ['CS0012-lib-missing']E e = int32(0x00000001)
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ ret
+ }
+
+}
+
--- /dev/null
+.assembly extern mscorlib
+{
+}
+
+.assembly extern 'CS1070-lib-missing'
+{
+}
+
+.assembly 'CS1070-lib'
+{
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+
+.module 'CS1070-lib.dll'
+
+.class extern forwarder E
+{
+ .assembly extern 'CS1070-lib-missing'
+}
+
+.class extern forwarder C
+{
+ .assembly extern 'CS1070-lib-missing'
+}
+
$(wildcard dlls/second/*.cs)
TEST_SUPPORT_FILES = \
- CS0012-lib.dll CS0012-2-lib.dll CS0012-3-lib.dll CS0012-4-lib.dll CS0012-5-lib.dll CS0012-6-lib.dll CS0012-9-lib.dll CS0012-10-lib.dll CS0012-11-lib.dll CS0012-12-lib.dll CS0012-13-lib.dll CS0012-14-lib.dll CS0012-15-lib.dll CS0012-16-lib.dll CS0029-26-lib.dll \
+ CS0012-lib.dll CS0012-2-lib.dll CS0012-3-lib.dll CS0012-4-lib.dll CS0012-5-lib.dll CS0012-6-lib.dll CS0012-9-lib.dll CS0012-10-lib.dll CS0012-11-lib.dll CS0012-12-lib.dll CS0012-13-lib.dll CS0012-14-lib.dll CS0012-15-lib.dll CS0012-16-lib.dll CS0012-17-lib.dll CS0012-18-lib.dll CS0029-26-lib.dll \
CS0103-2-lib.dll CS0118-2-lib.dll CS0122-8-lib.dll CS0122-10-lib.dll CS0122-14-lib.dll CS0122-15-lib.dll CS0122-19-lib.dll CS0122-35-lib.dll CS0122-36-lib.dll CS0143-lib.dll CS0144-3-lib.dll CS0165-19-lib.dll \
CS0205-3-lib.dll CS0229-3-lib.dll CS0229-4-lib.dll CS0266-25-lib.dll \
CS0315-2-lib.dll \
CS0612-2-lib.dll CS0618-2-lib.dll CS0619-8-lib.dll CS0619-17-lib.dll CS0619-32-lib.dll CS0619-33-lib.dll CS0619-36-lib.dll CS0619-42-lib.dll \
CS0619-43-lib.dll CS1546-lib.dll CS0619-51-lib.dll CS1509-module.dll CS1681-2-lib.dll \
CS0730-lib.dll \
+ CS1070-lib.dll \
CS1540-15-lib.dll CS1540-17-lib.dll CS1542-lib.dll CS1577-lib.dll \
CS1607-3-lib.dll CS1683-lib.dll CS1684-lib.dll CS1685-2-lib.dll \
dlls/first/CS1701-lib.dll dlls/second/CS1701-lib.dll CS1701-lib.dll dlls/first/CS1702-lib.dll dlls/second/CS1702-lib.dll CS1702-lib.dll dlls/first/CS1705-lib.dll dlls/second/CS1705-lib.dll CS1705-lib.dll \
--- /dev/null
+// CS0012: The type `AA`1<T>' is defined in an assembly that is not referenced. Consider adding a reference to assembly `CS0012-lib-missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
+// Line: 9
+// Compiler options: -r:CS0012-17-lib.dll
+
+class Test
+{
+ public static void Main ()
+ {
+ B.Foo<long> ();
+ }
+}
--- /dev/null
+// CS0012: The type `E' is defined in an assembly that is not referenced. Consider adding a reference to assembly `CS0012-lib-missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
+// Line: 9
+// Compiler options: -r:CS0012-18-lib.dll
+
+class Test
+{
+ public static void Main ()
+ {
+ var c = B.e;
+ }
+}
--- /dev/null
+// CS0135: `x' conflicts with a declaration in a child block
+// Line: 18
+
+public class Test
+{
+ Test x;
+
+ void Foo ()
+ {
+ {
+ string x = "dd";
+ }
+
+ {
+ x = null;
+ }
+
+ x = new Test ();
+ }
+
+ public static void Main () { }
+}
\ No newline at end of file
--- /dev/null
+// CS0214: Pointers and fixed size buffers may only be used in an unsafe context
+// Line: 8
+
+public class G<T> {}
+
+abstract class A
+{
+ public abstract G<int*[]> Foo1 ();
+}
--- /dev/null
+// CS0411: The type arguments for method `System.Linq.Enumerable.OrderBy<TSource,TKey>(this System.Collections.Generic.IEnumerable<TSource>, System.Func<TSource,TKey>)' cannot be inferred from the usage. Try specifying the type arguments explicitly
+// Line: 20
+
+using System.Collections.Generic;
+using System.Linq;
+
+public class C
+{
+ public string Name ()
+ {
+ return "aa";
+ }
+}
+
+class Z
+{
+ void Test ()
+ {
+ List<C> l = null;
+ var r = l.OrderBy (f => f.Name).ToList ();
+ }
+}
\ No newline at end of file
-// CS0572: `meth': cannot reference a type through an expression; try `test.meth' instead
+// CS0572: `meth': cannot reference a type through an expression. Consider using `test.meth' instead
// Line: 8
class test2 : test {
--- /dev/null
+// CS0572: `Inner': cannot reference a type through an expression. Consider using `Outer.Inner' instead
+// Line: 18
+
+public class Outer
+{
+ public enum Inner
+ {
+ ONE,
+ TWO
+ }
+}
+
+public class C
+{
+ public static bool Test ()
+ {
+ Outer outer = null;
+ return 0 == outer.Inner.ONE;
+ }
+}
\ No newline at end of file
-// CS0572: `Foo': cannot reference a type through an expression; try `Y.Foo' instead
+// CS0572: `Foo': cannot reference a type through an expression. Consider using `Y.Foo' instead
// Line: 13
using System;
--- /dev/null
+// CS1070: The type `C' has been forwarded to an assembly that is not referenced. Consider adding a reference to assembly `CS1070-lib-missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
+// Line: 5
+// Compiler options: -r:CS1070-lib.dll
+
+public class D : C
+{
+}
\ No newline at end of file
// CS2002: Source file `cs2002.cs' specified multiple times
// Line: 0
-// Compiler options: cs2002.cs /warnaserror
+// Compiler options: /warnaserror cs2002.cs
using System;
using System.Collections;
+using System.Collections.Generic;
using System.Reflection;
using System.Security;
using System.Globalization;
+using PEAPI;
namespace Mono.ILASM {
}
+ public class ExternClass
+ {
+ string name;
+ TypeAttr ta;
+ string assemblyReference;
+
+ public ExternClass (string name, TypeAttr ta, string assemblyReference)
+ {
+ this.name = name;
+ this.ta = ta;
+ this.assemblyReference = assemblyReference;
+ }
+
+ public void Resolve (CodeGen code_gen, ExternTable table)
+ {
+ var ar = table.GetAssemblyRef (assemblyReference);
+ if (ar != null)
+ code_gen.PEFile.AddExternClass (name, ta, ar.AssemblyRef);
+ }
+ }
+
public class ExternTable {
Hashtable assembly_table;
Hashtable module_table;
+ List<ExternClass> class_table;
+
bool is_resolved;
public void AddCorlib ()
return em;
}
+ public void AddClass (string name, TypeAttr ta, string assemblyReference)
+ {
+ if (class_table == null)
+ class_table = new List<ExternClass> ();
+
+ class_table.Add (new ExternClass (name, ta, assemblyReference));
+ }
+
public void Resolve (CodeGen code_gen)
{
if (is_resolved)
if (assembly_table != null)
foreach (ExternAssembly ext in assembly_table.Values)
ext.Resolve (code_gen);
- if (module_table == null)
- return;
- foreach (ExternModule ext in module_table.Values)
- ext.Resolve (code_gen);
- is_resolved = true;
+ if (module_table != null)
+ foreach (ExternModule ext in module_table.Values)
+ ext.Resolve (code_gen);
+
+ if (class_table != null)
+ foreach (var entry in class_table)
+ entry.Resolve (code_gen, this);
+
+ is_resolved = true;
}
public ExternTypeRef GetTypeRef (string asmb_name, string full_name, bool is_valuetype)
return mod.GetTypeRef (full_name, is_valuetype);
}
+ public ExternAssembly GetAssemblyRef (string assembly_name)
+ {
+ ExternAssembly ass = null;
+ if (assembly_table != null)
+ ass = assembly_table [assembly_name] as ExternAssembly;
+
+ if (ass == null)
+ Report.Error ("Assembly " + assembly_name + " is not defined.");
+
+ return ass;
+ }
+
public static void GetNameAndNamespace (string full_name,
out string name_space, out string name) {
using System;\r
using System.IO;\r
using System.Collections;\r
+using System.Collections.Generic;\r
using System.Globalization;\r
using System.Reflection;\r
using System.Security;\r
private PEAPI.PInvokeAttr pinvoke_attr;\r
private ILTokenizer tokenizer;\r
static int yacc_verbose_flag;\r
+ KeyValuePair<string, TypeAttr> current_extern;\r
\r
class NameValuePair {\r
public string Name;\r
%token K_IS\r
%token K_ON\r
%token K_OFF\r
+%token K_FORWARDER\r
%token K_CHARMAPERROR\r
\r
/* end generated */\r
;\r
\r
exptype_head : D_CLASS K_EXTERN expt_attr comp_name\r
+ {\r
+ current_extern = new KeyValuePair<string, TypeAttr> ((string) $4, (TypeAttr) $3);\r
+ }\r
;\r
\r
expt_attr : /* EMPTY */\r
- | expt_attr K_PRIVATE\r
- | expt_attr K_PUBLIC \r
- | expt_attr K_NESTED K_PUBLIC\r
- | expt_attr K_NESTED K_PRIVATE\r
- | expt_attr K_NESTED K_FAMILY\r
- | expt_attr K_NESTED K_ASSEMBLY\r
- | expt_attr K_NESTED K_FAMANDASSEM\r
- | expt_attr K_NESTED K_FAMORASSEM\r
+ | expt_attr K_PRIVATE { $$ = (TypeAttr)$1 | TypeAttr.Private; }\r
+ | expt_attr K_PUBLIC { $$ = (TypeAttr)$1 | TypeAttr.Public; }\r
+ | expt_attr K_NESTED K_PUBLIC { $$ = (TypeAttr)$1 | TypeAttr.NestedPublic; }\r
+ | expt_attr K_NESTED K_PRIVATE { $$ = (TypeAttr)$1 | TypeAttr.NestedPrivate; }\r
+ | expt_attr K_NESTED K_FAMILY { $$ = (TypeAttr)$1 | TypeAttr.NestedFamily; }\r
+ | expt_attr K_NESTED K_ASSEMBLY { $$ = (TypeAttr)$1 | TypeAttr.NestedAssembly;}\r
+ | expt_attr K_NESTED K_FAMANDASSEM { $$ = (TypeAttr)$1 | TypeAttr.NestedFamAndAssem; }\r
+ | expt_attr K_NESTED K_FAMORASSEM { $$ = (TypeAttr)$1 | TypeAttr.NestedFamOrAssem; }\r
+ | K_FORWARDER { $$ = TypeAttr.Forwarder; }\r
;\r
\r
exptype_decls : /* EMPTY */\r
\r
exptype_decl : D_FILE comp_name\r
| D_CLASS K_EXTERN comp_name\r
- | D_CLASS int32\r
| customattr_decl\r
+ | D_ASSEMBLY K_EXTERN comp_name\r
+ {\r
+ codegen.ExternTable.AddClass (current_extern.Key, current_extern.Value, (string) $3);\r
+ }\r
;\r
\r
manifestres_all : manifestres_head OPEN_BRACE manifestres_decls CLOSE_BRACE\r
keywords ["on"] = new ILToken (Token.K_ON, "on");\r
keywords ["off"] = new ILToken (Token.K_OFF, "off");\r
keywords ["strict"] = new ILToken (Token.K_STRICT, "strict");\r
+ keywords ["forwarder"] = new ILToken (Token.K_FORWARDER, "forwarder");\r
\r
return keywords;\r
}\r
LOCAL_MCS_FLAGS += -lib:$(topdir)/class/lib/build -debug
endif
-LOCAL_MCS_FLAGS += -d:STATIC,NO_SYMBOL_WRITER
+LOCAL_MCS_FLAGS += -d:STATIC,NO_SYMBOL_WRITER,NO_AUTHENTICODE
PROGRAM_INSTALL_DIR = $(mono_libdir)/mono/4.5
public interface IAssemblyDefinition
{
string FullName { get; }
- bool HasExtensionMethod { get; }
bool IsCLSCompliant { get; }
bool IsMissing { get; }
string Name { get; }
}
}
- public bool HasExtensionMethod {
- get {
- return module.HasExtensionMethod;
- }
- }
-
public bool HasCLSCompliantAttribute {
get {
return cls_attribute != null;
}
}
+ bool ITypeDefinition.IsTypeForwarder {
+ get {
+ return false;
+ }
+ }
+
//
// Returns true for secondary partial containers
//
case Token.OPEN_BRACKET:
case Token.OP_GENERICS_GT:
case Token.INTERR:
+ case Token.OP_COALESCING:
next_token = Token.INTERR_NULLABLE;
break;
this.definition = definition;
this.modifiers = modifiers;
- state = StateFlags.Obsolete_Undetected | StateFlags.CLSCompliant_Undetected | StateFlags.MissingDependency_Undetected;
+ if (kind == MemberKind.MissingType)
+ state = StateFlags.MissingDependency;
+ else
+ state = StateFlags.Obsolete_Undetected | StateFlags.CLSCompliant_Undetected | StateFlags.MissingDependency_Undetected;
}
#region Properties
}
}
+ //
+ // Implements identical simple name and type-name resolution
+ //
+ public Expression ProbeIdenticalTypeName (ResolveContext rc, Expression left, SimpleName name)
+ {
+ var t = left.Type;
+ if (t.Kind == MemberKind.InternalCompilerType || t is ElementTypeSpec || t.Arity > 0)
+ return left;
+
+ // In a member access of the form E.I, if E is a single identifier, and if the meaning of E as a simple-name is
+ // a constant, field, property, local variable, or parameter with the same type as the meaning of E as a type-name
+
+ if (left is MemberExpr || left is VariableReference) {
+ var identical_type = rc.LookupNamespaceOrType (name.Name, 0, LookupMode.Probing, loc) as TypeExpr;
+ if (identical_type != null && identical_type.Type == left.Type)
+ return identical_type;
+ }
+
+ return left;
+ }
+
public virtual string GetSignatureForError ()
{
return type.GetDefinition ().GetSignatureForError ();
//
TypeSpec[] targs = null;
if (method.DeclaringType != InstanceExpression.Type) {
- var base_override = MemberCache.FindMember (InstanceExpression.Type, new MemberFilter (method), BindingRestriction.InstanceOnly) as MethodSpec;
+ var base_override = MemberCache.FindMember (InstanceExpression.Type, new MemberFilter (method), BindingRestriction.InstanceOnly | BindingRestriction.OverrideOnly) as MethodSpec;
if (base_override != null && base_override.DeclaringType != method.DeclaringType) {
if (base_override.IsGeneric)
targs = method.TypeArguments;
member.GetSignatureForError (), qualifier.GetSignatureForError (), rc.CurrentType.GetSignatureForError ());
}
- //
- // Implements identicial simple name and type-name
- //
- public Expression ProbeIdenticalTypeName (ResolveContext rc, Expression left, SimpleName name)
- {
- var t = left.Type;
- if (t.Kind == MemberKind.InternalCompilerType || t is ElementTypeSpec || t.Arity > 0)
- return left;
-
- // In a member access of the form E.I, if E is a single identifier, and if the meaning of E as a simple-name is
- // a constant, field, property, local variable, or parameter with the same type as the meaning of E as a type-name
-
- if (left is MemberExpr || left is VariableReference) {
- var identical_type = rc.LookupNamespaceOrType (name.Name, 0, LookupMode.Probing, loc) as TypeExpr;
- if (identical_type != null && identical_type.Type == left.Type)
- return identical_type;
- }
-
- return left;
- }
-
public bool ResolveInstanceExpression (ResolveContext rc, Expression rhs)
{
if (!ResolveInstanceExpressionCore (rc, rhs))
// better conversion is performed between underlying types Y1 and Y2
//
if (p.IsGenericTask || q.IsGenericTask) {
- if (am.Block.IsAsync) {
- if (p.IsGenericTask != q.IsGenericTask) {
- return 0;
- }
-
+ if (am.Block.IsAsync && p.IsGenericTask && q.IsGenericTask) {
q = q.TypeArguments[0];
p = p.TypeArguments[0];
}
} else if (arg_count > param_count) {
int args_gap = System.Math.Abs (arg_count - param_count);
return int.MaxValue - 10000 + args_gap;
+ } else if (arg_count < param_count - optional_count) {
+ int args_gap = System.Math.Abs (param_count - optional_count - arg_count);
+ return int.MaxValue - 10000 + args_gap;
}
} else if (arg_count != param_count) {
int args_gap = System.Math.Abs (arg_count - param_count);
// if the type matches
//
Expression e = fp.DefaultValue;
- if (!(e is Constant) || e.Type != ptypes [i]) {
- //
- // LAMESPEC: No idea what the exact rules are for System.Reflection.Missing.Value instead of null
- //
- var ptype = ptypes [i];
- if (e == EmptyExpression.MissingValue && ptype.BuiltinType == BuiltinTypeSpec.Type.Object || ptype.BuiltinType == BuiltinTypeSpec.Type.Dynamic) {
- e = new MemberAccess (new MemberAccess (new MemberAccess (
- new QualifiedAliasMember (QualifiedAliasMember.GlobalAlias, "System", loc), "Reflection", loc), "Missing", loc), "Value", loc);
- } else if (e is Constant) {
- //
- // Handles int to int? conversions
- //
- e = Convert.ImplicitConversionStandard (ec, e, ptype, loc);
-
- //
- // When constant type paramter contains type argument
- //
- // Foo (T[] arg = null)
- //
- if (e == null) {
- e = new DefaultValueExpression (new TypeExpression (ptype, loc), loc);
- }
- } else {
- e = new DefaultValueExpression (new TypeExpression (ptype, loc), loc);
- }
-
-
- e = e.Resolve (ec);
+ if (e != null) {
+ e = ResolveDefaultValueArgument (ec, ptypes[i], e, loc);
}
if ((fp.ModFlags & Parameter.Modifier.CallerMask) != 0) {
return 0;
}
+ public static Expression ResolveDefaultValueArgument (ResolveContext ec, TypeSpec ptype, Expression e, Location loc)
+ {
+ if (e is Constant && e.Type == ptype)
+ return e;
+
+ //
+ // LAMESPEC: No idea what the exact rules are for System.Reflection.Missing.Value instead of null
+ //
+ if (e == EmptyExpression.MissingValue && ptype.BuiltinType == BuiltinTypeSpec.Type.Object || ptype.BuiltinType == BuiltinTypeSpec.Type.Dynamic) {
+ e = new MemberAccess (new MemberAccess (new MemberAccess (
+ new QualifiedAliasMember (QualifiedAliasMember.GlobalAlias, "System", loc), "Reflection", loc), "Missing", loc), "Value", loc);
+ } else if (e is Constant) {
+ //
+ // Handles int to int? conversions
+ //
+ e = Convert.ImplicitConversionStandard (ec, e, ptype, loc);
+
+ //
+ // When constant type paramter contains type argument
+ //
+ // Foo (T[] arg = null)
+ //
+ if (e == null) {
+ e = new DefaultValueExpression (new TypeExpression (ptype, loc), loc);
+ }
+ } else {
+ e = new DefaultValueExpression (new TypeExpression (ptype, loc), loc);
+ }
+
+
+ return e.Resolve (ec);
+ }
+
//
// Tests argument compatibility with the parameter
// The possible return values are
//
sealed class PropertyExpr : PropertyOrIndexerExpr<PropertySpec>
{
+ Arguments arguments;
+
public PropertyExpr (PropertySpec spec, Location l)
: base (l)
{
protected override Arguments Arguments {
get {
- return null;
+ return arguments;
}
set {
+ arguments = value;
}
}
}
}
} else {
- args = new Arguments (1);
+ args = arguments == null ? new Arguments (1) : arguments;
if (leave_copy) {
source.Emit (ec);
}
DoBestMemberChecks (rc, best_candidate);
+
+ // Handling of com-imported properties with any number of default property parameters
+ if (best_candidate.HasGet && !best_candidate.Get.Parameters.IsEmpty) {
+ var p = best_candidate.Get.Parameters;
+ arguments = new Arguments (p.Count);
+ for (int i = 0; i < p.Count; ++i) {
+ arguments.Add (new Argument (OverloadResolver.ResolveDefaultValueArgument (rc, p.Types [i], p.FixedParameters [i].DefaultValue, loc)));
+ }
+ } else if (best_candidate.HasSet && best_candidate.Set.Parameters.Count > 1) {
+ var p = best_candidate.Set.Parameters;
+ arguments = new Arguments (p.Count - 1);
+ for (int i = 0; i < p.Count - 1; ++i) {
+ arguments.Add (new Argument (OverloadResolver.ResolveDefaultValueArgument (rc, p.Types [i], p.FixedParameters [i].DefaultValue, loc)));
+ }
+ }
+
return this;
}
// ambiguous because 1 literal can be converted to short.
//
if (conv_false_expr != null) {
- if (conv_false_expr is IntConstant && conv is Constant) {
+ if (conv_false_expr.Type.BuiltinType == BuiltinTypeSpec.Type.Int && conv is Constant) {
type = true_type;
conv_false_expr = null;
} else if (type.BuiltinType == BuiltinTypeSpec.Type.Int && conv_false_expr is Constant) {
TypeExpr texpr = member_lookup as TypeExpr;
if (texpr != null) {
- if (!(expr is TypeExpr)) {
- me = expr as MemberExpr;
- if (me == null || me.ProbeIdenticalTypeName (rc, expr, sn) == expr) {
- rc.Report.Error (572, loc, "`{0}': cannot reference a type through an expression; try `{1}' instead",
- Name, member_lookup.GetSignatureForError ());
- return null;
- }
+ if (!(expr is TypeExpr) && (sn == null || expr.ProbeIdenticalTypeName (rc, expr, sn) == expr)) {
+ rc.Report.Error (572, loc, "`{0}': cannot reference a type through an expression. Consider using `{1}' instead",
+ Name, texpr.GetSignatureForError ());
}
if (!texpr.Type.IsAccessible (rc)) {
}
}
+ bool ITypeDefinition.IsComImport {
+ get {
+ return false;
+ }
+ }
+
bool ITypeDefinition.IsPartial {
get {
return false;
}
}
+ bool ITypeDefinition.IsTypeForwarder {
+ get {
+ return false;
+ }
+ }
+
public string Name {
get {
return MemberName.Name;
return false;
}
+ public bool HasDependencyOn (TypeSpec type)
+ {
+ if (TypeArguments != null) {
+ foreach (var targ in TypeArguments) {
+ if (TypeSpecComparer.Override.IsEqual (targ, type))
+ return true;
+
+ var tps = targ as TypeParameterSpec;
+ if (tps != null && tps.HasDependencyOn (type))
+ return true;
+ }
+ }
+
+ return false;
+ }
+
public override TypeSpec Mutate (TypeParameterMutator mutator)
{
return mutator.Mutate (this);
if (atype.IsGenericParameter) {
var tps = (TypeParameterSpec) atype;
- if (tps.TypeArguments != null) {
- foreach (var targ in tps.TypeArguments) {
- if (TypeSpecComparer.Override.IsEqual (targ, ttype))
- return true;
- }
- }
+ if (tps.HasDependencyOn (ttype))
+ return true;
if (Convert.ImplicitTypeParameterConversion (null, tps, ttype) != null)
return true;
{
// It can be used more than once when importing same assembly
// into 2 or more global aliases
- var definition = GetAssemblyDefinition (assembly);
+ // TODO: Should be just Add
+ GetAssemblyDefinition (assembly);
var all_types = assembly.GetTypes ();
- ImportTypes (all_types, targetNamespace, definition.HasExtensionMethod);
+ ImportTypes (all_types, targetNamespace, true);
+
+ all_types = assembly.ManifestModule.__GetExportedTypes ();
+ if (all_types.Length != 0)
+ ImportForwardedTypes (all_types, targetNamespace);
}
public ImportedModuleDefinition ImportModule (Module module, RootNamespace targetNamespace)
return module_definition;
}
+ void ImportForwardedTypes (MetaType[] types, Namespace targetNamespace)
+ {
+ Namespace ns = targetNamespace;
+ string prev_namespace = null;
+ foreach (var t in types) {
+ // IsMissing tells us the type has been forwarded and target assembly is missing
+ if (!t.__IsMissing)
+ continue;
+
+ if (t.Name[0] == '<')
+ continue;
+
+ var it = CreateType (t, null, new DynamicTypeReader (t), true);
+ if (it == null)
+ continue;
+
+ if (prev_namespace != t.Namespace) {
+ ns = t.Namespace == null ? targetNamespace : targetNamespace.GetNamespace (t.Namespace, true);
+ prev_namespace = t.Namespace;
+ }
+
+ ns.AddType (module, it);
+ }
+ }
+
public void InitializeBuiltinTypes (BuiltinTypes builtin, Assembly corlib)
{
//
: base (compiler)
{
this.importer = importer;
- domain = new Universe ();
+ domain = new Universe (UniverseOptions.MetadataOnly);
domain.EnableMissingMemberResolution ();
domain.AssemblyResolve += AssemblyReferenceResolver;
loaded_names = new List<Tuple<AssemblyName, string, Assembly>> ();
}
try {
- using (RawModule module = domain.OpenRawModule (file)) {
- if (!module.IsManifestModule) {
- Error_AssemblyIsModule (fileName);
- return null;
- }
-
- //
- // check whether the assembly can be actually imported without
- // collision
- //
- var an = module.GetAssemblyName ();
- foreach (var entry in loaded_names) {
- var loaded_name = entry.Item1;
- if (an.Name != loaded_name.Name)
- continue;
-
- if (module.ModuleVersionId == entry.Item3.ManifestModule.ModuleVersionId)
- return entry.Item3;
-
- if (((an.Flags | loaded_name.Flags) & AssemblyNameFlags.PublicKey) == 0) {
- compiler.Report.SymbolRelatedToPreviousError (entry.Item2);
- compiler.Report.SymbolRelatedToPreviousError (fileName);
- compiler.Report.Error (1704,
- "An assembly with the same name `{0}' has already been imported. Consider removing one of the references or sign the assembly",
- an.Name);
+ using (var stream = new FileStream (file, FileMode.Open, FileAccess.Read, FileShare.Read)) {
+ using (RawModule module = domain.OpenRawModule (stream, file)) {
+ if (!module.IsManifestModule) {
+ Error_AssemblyIsModule (fileName);
return null;
}
- if ((an.Flags & AssemblyNameFlags.PublicKey) == (loaded_name.Flags & AssemblyNameFlags.PublicKey) && an.Version.Equals (loaded_name.Version)) {
- compiler.Report.SymbolRelatedToPreviousError (entry.Item2);
- compiler.Report.SymbolRelatedToPreviousError (fileName);
- compiler.Report.Error (1703,
- "An assembly with the same identity `{0}' has already been imported. Consider removing one of the references",
- an.FullName);
- return null;
+ //
+ // check whether the assembly can be actually imported without
+ // collision
+ //
+ var an = module.GetAssemblyName ();
+ foreach (var entry in loaded_names) {
+ var loaded_name = entry.Item1;
+ if (an.Name != loaded_name.Name)
+ continue;
+
+ if (module.ModuleVersionId == entry.Item3.ManifestModule.ModuleVersionId)
+ return entry.Item3;
+
+ if (((an.Flags | loaded_name.Flags) & AssemblyNameFlags.PublicKey) == 0) {
+ compiler.Report.SymbolRelatedToPreviousError (entry.Item2);
+ compiler.Report.SymbolRelatedToPreviousError (fileName);
+ compiler.Report.Error (1704,
+ "An assembly with the same name `{0}' has already been imported. Consider removing one of the references or sign the assembly",
+ an.Name);
+ return null;
+ }
+
+ if ((an.Flags & AssemblyNameFlags.PublicKey) == (loaded_name.Flags & AssemblyNameFlags.PublicKey) && an.Version.Equals (loaded_name.Version)) {
+ compiler.Report.SymbolRelatedToPreviousError (entry.Item2);
+ compiler.Report.SymbolRelatedToPreviousError (fileName);
+ compiler.Report.Error (1703,
+ "An assembly with the same identity `{0}' has already been imported. Consider removing one of the references",
+ an.FullName);
+ return null;
+ }
}
- }
- if (compiler.Settings.DebugFlags > 0)
- Console.WriteLine ("Loading assembly `{0}'", fileName);
+ if (compiler.Settings.DebugFlags > 0)
+ Console.WriteLine ("Loading assembly `{0}'", fileName);
- var assembly = domain.LoadAssembly (module);
- if (assembly != null)
- loaded_names.Add (Tuple.Create (an, fileName, assembly));
+ var assembly = domain.LoadAssembly (module);
+ if (assembly != null)
+ loaded_names.Add (Tuple.Create (an, fileName, assembly));
- return assembly;
+ return assembly;
+ }
}
- } catch {
+ } catch (Exception e) {
+ if (compiler.Settings.DebugFlags > 0)
+ Console.WriteLine ("Exception during loading: {0}'", e.ToString ());
+
if (!isImplicitReference)
Error_FileCorrupted (file);
public override void SetFlags (uint flags, Location loc)
{
- builder.__SetAssemblyFlags ((AssemblyNameFlags) flags);
+ builder.__AssemblyFlags = (AssemblyNameFlags) flags;
}
public override void SetVersion (Version version, Location loc)
builder.__SetAssemblyVersion (version);
}
}
-}
\ No newline at end of file
+}
// Dual licensed under the terms of the MIT X11 or GNU GPL
//
// Copyright 2009-2011 Novell, Inc
-// Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
+// Copyright 2011-2012 Xamarin, Inc (http://www.xamarin.com)
//
using System;
// Dynamic types reader with additional logic to reconstruct a dynamic
// type using DynamicAttribute values
//
- struct DynamicTypeReader
+ protected struct DynamicTypeReader
{
static readonly bool[] single_attribute = { true };
protected readonly Dictionary<MetaType, TypeSpec> import_cache;
protected readonly Dictionary<MetaType, TypeSpec> compiled_types;
protected readonly Dictionary<Assembly, IAssemblyDefinition> assembly_2_definition;
- readonly ModuleContainer module;
+ protected readonly ModuleContainer module;
public static readonly string CompilerServicesNamespace = "System.Runtime.CompilerServices";
var definition = new ImportedMemberDefinition (fi, field_type, this);
if ((fa & FieldAttributes.Literal) != 0) {
- var c = Constant.CreateConstantFromValue (field_type, fi.GetRawConstantValue (), Location.Null);
+ Constant c = field_type.Kind == MemberKind.MissingType ?
+ new NullConstant (InternalType.ErrorType, Location.Null) :
+ Constant.CreateConstantFromValue (field_type, fi.GetRawConstantValue (), Location.Null);
return new ConstSpec (declaringType, definition, field_type, fi, mod, c);
}
//
var el = p.ParameterType.GetElementType ();
types[i] = ImportType (el, new DynamicTypeReader (p)); // TODO: 1-based positio to be csc compatible
- } else if (i == 0 && method.IsStatic && parent.IsStatic && parent.MemberDefinition.DeclaringAssembly.HasExtensionMethod &&
+ } else if (i == 0 && method.IsStatic && (parent.Modifiers & Modifiers.METHOD_EXTENSION) != 0 &&
HasAttribute (CustomAttributeData.GetCustomAttributes (method), "ExtensionAttribute", CompilerServicesNamespace)) {
mod = Parameter.Modifier.This;
types[i] = ImportType (p.ParameterType);
PropertySpec spec = null;
if (!param.IsEmpty) {
- var index_name = declaringType.MemberDefinition.GetAttributeDefaultMember ();
- if (index_name == null) {
- is_valid_property = false;
- } else {
- if (get != null) {
- if (get.IsStatic)
- is_valid_property = false;
- if (get.Name.IndexOf (index_name, StringComparison.Ordinal) != 4)
- is_valid_property = false;
+ if (is_valid_property) {
+ var index_name = declaringType.MemberDefinition.GetAttributeDefaultMember ();
+ if (index_name == null) {
+ is_valid_property = false;
+ } else {
+ if (get != null) {
+ if (get.IsStatic)
+ is_valid_property = false;
+ if (get.Name.IndexOf (index_name, StringComparison.Ordinal) != 4)
+ is_valid_property = false;
+ }
+ if (set != null) {
+ if (set.IsStatic)
+ is_valid_property = false;
+ if (set.Name.IndexOf (index_name, StringComparison.Ordinal) != 4)
+ is_valid_property = false;
+ }
}
- if (set != null) {
- if (set.IsStatic)
- is_valid_property = false;
- if (set.Name.IndexOf (index_name, StringComparison.Ordinal) != 4)
- is_valid_property = false;
+
+ if (is_valid_property) {
+ spec = new IndexerSpec (declaringType, new ImportedParameterMemberDefinition (pi, type, param, this), type, param, pi, mod);
+ } else if (declaringType.MemberDefinition.IsComImport && param.FixedParameters[0].HasDefaultValue) {
+ //
+ // Enables support for properties with parameters (must have default value) of COM-imported types
+ //
+ is_valid_property = true;
+
+ for (int i = 0; i < param.FixedParameters.Length; ++i) {
+ if (!param.FixedParameters[i].HasDefaultValue) {
+ is_valid_property = false;
+ break;
+ }
+ }
}
}
-
- if (is_valid_property)
- spec = new IndexerSpec (declaringType, new ImportedParameterMemberDefinition (pi, type, param, this), type, param, pi, mod);
}
if (spec == null)
return CreateType (type, declaring_type, dtype, canImportBaseType);
}
- TypeSpec CreateType (MetaType type, TypeSpec declaringType, DynamicTypeReader dtype, bool canImportBaseType)
+ protected TypeSpec CreateType (MetaType type, TypeSpec declaringType, DynamicTypeReader dtype, bool canImportBaseType)
{
TypeSpec spec;
if (import_cache.TryGetValue (type, out spec)) {
}
}
- protected void ImportTypes (MetaType[] types, Namespace targetNamespace, bool hasExtensionTypes)
+ protected void ImportTypes (MetaType[] types, Namespace targetNamespace, bool importExtensionTypes)
{
Namespace ns = targetNamespace;
string prev_namespace = null;
prev_namespace = t.Namespace;
}
- ns.AddType (module, it);
-
- if (it.IsStatic && hasExtensionTypes &&
+ // Cannot rely on assembly level Extension attribute or static modifier because they
+ // are not followed by other compilers (e.g. F#).
+ if (it.IsClass && it.Arity == 0 && importExtensionTypes &&
HasAttribute (CustomAttributeData.GetCustomAttributes (t), "ExtensionAttribute", CompilerServicesNamespace)) {
it.SetExtensionMethodContainer ();
}
+
+ ns.AddType (module, it);
}
}
continue;
}
- if (!IsMissingType (ct) && ct.IsClass) {
- spec.BaseType = CreateType (ct);
+ var constraint_type = CreateType (ct);
+ if (constraint_type.IsClass) {
+ spec.BaseType = constraint_type;
continue;
}
- spec.AddInterface (CreateType (ct));
+ spec.AddInterface (constraint_type);
}
if (spec.BaseType == null)
readonly Assembly assembly;
readonly AssemblyName aname;
bool cls_compliant;
- bool contains_extension_methods;
List<AssemblyName> internals_visible_to;
Dictionary<IAssemblyDefinition, AssemblyName> internals_visible_to_cache;
}
}
- public bool HasExtensionMethod {
- get {
- return contains_extension_methods;
- }
- }
-
public bool HasStrongName {
get {
return aname.GetPublicKey ().Length != 0;
internals_visible_to.Add (an);
continue;
}
-
- if (name == "ExtensionAttribute") {
- if (dt.Namespace == MetadataImporter.CompilerServicesNamespace)
- contains_extension_methods = true;
-
- continue;
- }
}
}
}
}
+ bool ITypeDefinition.IsComImport {
+ get {
+ return ((MetaType) provider).IsImport;
+ }
+ }
+
+
bool ITypeDefinition.IsPartial {
get {
return false;
}
}
+ bool ITypeDefinition.IsTypeForwarder {
+ get {
+#if STATIC
+ return ((MetaType) provider).__IsTypeForwarder;
+#else
+ return false;
+#endif
+ }
+ }
+
public override string Name {
get {
if (name == null) {
"Reference to type `{0}' claims it is defined in this assembly, but it is not defined in source or any added modules",
name);
} else if (t.MemberDefinition.DeclaringAssembly.IsMissing) {
- ctx.Module.Compiler.Report.Error (12, loc,
- "The type `{0}' is defined in an assembly that is not referenced. Consider adding a reference to assembly `{1}'",
- name, t.MemberDefinition.DeclaringAssembly.FullName);
+ if (t.MemberDefinition.IsTypeForwarder) {
+ ctx.Module.Compiler.Report.Error (1070, loc,
+ "The type `{0}' has been forwarded to an assembly that is not referenced. Consider adding a reference to assembly `{1}'",
+ name, t.MemberDefinition.DeclaringAssembly.FullName);
+ } else {
+ ctx.Module.Compiler.Report.Error (12, loc,
+ "The type `{0}' is defined in an assembly that is not referenced. Consider adding a reference to assembly `{1}'",
+ name, t.MemberDefinition.DeclaringAssembly.FullName);
+ }
} else {
ctx.Module.Compiler.Report.Error (1684, loc,
"Reference to type `{0}' claims it is defined assembly `{1}', but it could not be found",
}
}
+ bool ITypeDefinition.IsComImport {
+ get {
+ return false;
+ }
+ }
+
bool ITypeDefinition.IsPartial {
get {
return false;
}
}
+ bool ITypeDefinition.IsTypeForwarder {
+ get {
+ return false;
+ }
+ }
+
public string Namespace {
get {
return null;
<DebugType>full</DebugType>\r
<Optimize>False</Optimize>\r
<OutputPath>.</OutputPath>\r
- <DefineConstants>TRACE;DEBUG;NET_4_0;STATIC;NO_SYMBOL_WRITER</DefineConstants>\r
+ <DefineConstants>TRACE;DEBUG;NET_4_0;STATIC;NO_SYMBOL_WRITER;NO_AUTHENTICODE</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
<UseVSHostingProcess>false</UseVSHostingProcess>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
<DebugType>pdbonly</DebugType>\r
<Optimize>True</Optimize>\r
- <DefineConstants>TRACE;NET_4_0;STATIC;NO_SYMBOL_WRITER</DefineConstants>\r
+ <DefineConstants>TRACE;NET_4_0;STATIC;NO_SYMBOL_WRITER;NO_AUTHENTICODE</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug - AST|AnyCPU'">\r
<DebugSymbols>True</DebugSymbols>\r
<OutputPath>.</OutputPath>\r
- <DefineConstants>TRACE;DEBUG;NET_4_0;STATIC;NO_SYMBOL_WRITER;FULL_AST</DefineConstants>\r
+ <DefineConstants>TRACE;DEBUG;NET_4_0;STATIC;NO_SYMBOL_WRITER;NO_AUTHENTICODE;FULL_AST</DefineConstants>\r
<DebugType>full</DebugType>\r
<CodeAnalysisLogFile>mcs.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile>\r
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>\r
<Compile Include="visit.cs" />\r
</ItemGroup>\r
<ItemGroup Label="IKVM.Reflection">\r
- <Compile Include="..\class\IKVM.Reflection\*.cs">\r
+ <Compile Include="..\..\external\ikvm\reflect\*.cs">\r
<Visible>False</Visible>\r
</Compile>\r
- <Compile Include="..\class\IKVM.Reflection\Emit\*.cs">\r
+ <Compile Include="..\..\external\ikvm\reflect\Emit\*.cs">\r
<Visible>False</Visible>\r
</Compile>\r
- <Compile Include="..\class\IKVM.Reflection\Metadata\*.cs">\r
+ <Compile Include="..\..\external\ikvm\reflect\Metadata\*.cs">\r
<Visible>False</Visible>\r
</Compile>\r
- <Compile Include="..\class\IKVM.Reflection\Reader\*.cs">\r
+ <Compile Include="..\..\external\ikvm\reflect\Reader\*.cs">\r
<Visible>False</Visible>\r
</Compile>\r
- <Compile Include="..\class\IKVM.Reflection\Writer\*.cs">\r
+ <Compile Include="..\..\external\ikvm\reflect\Writer\*.cs">\r
<Visible>False</Visible>\r
</Compile>\r
- <Compile Include="..\class\IKVM.Reflection\Impl\ITypeOwner.cs">\r
+ <Compile Include="..\..\external\ikvm\reflect\Impl\ITypeOwner.cs">\r
<Visible>False</Visible>\r
</Compile>\r
- <Compile Include="..\class\IKVM.Reflection\Impl\SymbolSupport.cs">\r
+ <Compile Include="..\..\external\ikvm\reflect\Impl\SymbolSupport.cs">\r
<Visible>False</Visible>\r
</Compile>\r
</ItemGroup>\r
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
+ Other similar extension points exist, see Microsoft.Common.targets.\r
+ <Target Name="BeforeBuild">\r
+ </Target>\r
+ <Target Name="AfterBuild">\r
+ </Target>\r
-->\r
</Project>
\ No newline at end of file
../build/common/Consts.cs
../tools/monop/outline.cs
-../class/IKVM.Reflection/*.cs
-../class/IKVM.Reflection/Emit/*.cs
-../class/IKVM.Reflection/Metadata/*.cs
-../class/IKVM.Reflection/Reader/*.cs
-../class/IKVM.Reflection/Writer/*.cs
-../class/IKVM.Reflection/Impl/ITypeOwner.cs
-../class/IKVM.Reflection/Impl/SymbolSupport.cs
+../../external/ikvm/reflect/*.cs
+../../external/ikvm/reflect/Emit/*.cs
+../../external/ikvm/reflect/Metadata/*.cs
+../../external/ikvm/reflect/Reader/*.cs
+../../external/ikvm/reflect/Writer/*.cs
+../../external/ikvm/reflect/Impl/ITypeOwner.cs
+../../external/ikvm/reflect/Impl/SymbolSupport.cs
// rules (e.g. binary operators) by not setting the flag we hide them for
// user conversions
//
- if (!BuiltinTypeSpec.IsPrimitiveType (dt)) {
+ if (!BuiltinTypeSpec.IsPrimitiveType (dt) || dt.BuiltinType == BuiltinTypeSpec.Type.Char) {
switch (dt.BuiltinType) {
case BuiltinTypeSpec.Type.String:
case BuiltinTypeSpec.Type.Delegate:
var token = ConstructorBuilder.GetToken ();
int t = token.Token;
#if STATIC
- if (token.IsPseudoToken)
+ if (ModuleBuilder.IsPseudoToken (t))
t = Module.Builder.ResolvePseudoToken (t);
#endif
var token = builder.GetToken ();
int t = token.Token;
#if STATIC
- if (token.IsPseudoToken)
+ if (ModuleBuilder.IsPseudoToken (t))
t = member.Module.Builder.ResolvePseudoToken (t);
#endif
types = new Dictionary<string, IList<TypeSpec>> (64);
}
- if ((ts.IsStatic || ts.MemberDefinition.IsPartial) && ts.Arity == 0 &&
- (ts.MemberDefinition.DeclaringAssembly == null || ts.MemberDefinition.DeclaringAssembly.HasExtensionMethod)) {
- if (extension_method_types == null)
- extension_method_types = new List<TypeSpec> ();
+ if (ts.IsClass && ts.Arity == 0) {
+ var extension_method_allowed = ts.MemberDefinition.IsImported ? (ts.Modifiers & Modifiers.METHOD_EXTENSION) != 0 : (ts.IsStatic || ts.MemberDefinition.IsPartial);
+ if (extension_method_allowed) {
+ if (extension_method_types == null)
+ extension_method_types = new List<TypeSpec> ();
- extension_method_types.Add (ts);
+ extension_method_types.Add (ts);
+ }
}
var name = ts.Name;
"Identifier `{0}' differing only in case is not CLS-compliant", compiled.GetSignatureForError ());
}
}
+
+ public override string ToString ()
+ {
+ return Name;
+ }
}
public class CompilationSourceFile : NamespaceContainer
}
}
}
+
+ public override string ToString()
+ {
+ return resolved.ToString();
+ }
}
public class UsingExternAlias : UsingAliasNamespace
continue;
var candidate_param = ((MethodSpec) candidate).Parameters;
- if (!TypeSpecComparer.Override.IsSame (parameters.Types, candidate_param.Types))
+ if (!TypeSpecComparer.Override.IsEqual (parameters.Types, candidate_param.Types))
continue;
bool modifiers_match = true;
continue;
//
- // From this point on the candidate is used for detailed error reporting
+ // From this point the candidate is used for detailed error reporting
// because it's very close match to what we are looking for
//
base_method = (MethodSpec) candidate;
{
// It can be used more than once when importing same assembly
// into 2 or more global aliases
- var definition = GetAssemblyDefinition (assembly);
+ GetAssemblyDefinition (assembly);
//
// This part tries to simulate loading of top-level
all_types = e.Types;
}
- ImportTypes (all_types, targetNamespace, definition.HasExtensionMethod);
+ ImportTypes (all_types, targetNamespace, true);
}
public ImportedModuleDefinition ImportModule (Module module, RootNamespace targetNamespace)
}
}
}
-}
\ No newline at end of file
+}
static bool IsExternAliasValid (string identifier)
{
- if (identifier.Length == 0)
- return false;
- if (identifier[0] != '_' && !char.IsLetter (identifier[0]))
- return false;
-
- for (int i = 1; i < identifier.Length; i++) {
- char c = identifier[i];
- if (char.IsLetter (c) || char.IsDigit (c))
- continue;
-
- UnicodeCategory category = char.GetUnicodeCategory (c);
- if (category != UnicodeCategory.Format || category != UnicodeCategory.NonSpacingMark ||
- category != UnicodeCategory.SpacingCombiningMark ||
- category != UnicodeCategory.ConnectorPunctuation)
- return false;
- }
-
- return true;
+ return Tokenizer.IsValidIdentifier (identifier);
}
static string[] LoadArgs (string file)
return true;
}
+ public static bool IsEqual (TypeSpec[] a, TypeSpec[] b)
+ {
+ if (a == b)
+ return true;
+
+ if (a.Length != b.Length)
+ return false;
+
+ for (int i = 0; i < a.Length; ++i) {
+ if (!IsEqual (a[i], b[i]))
+ return false;
+ }
+
+ return true;
+ }
+
+
//
// Compares unordered arrays
//
IAssemblyDefinition DeclaringAssembly { get; }
string Namespace { get; }
bool IsPartial { get; }
+ bool IsComImport { get; }
+ bool IsTypeForwarder { get; }
int TypeParametersCount { get; }
TypeParameterSpec[] TypeParameters { get; }
}
}
+ bool ITypeDefinition.IsComImport {
+ get {
+ return false;
+ }
+ }
+
bool IMemberDefinition.IsImported {
get {
return false;
}
}
+ bool ITypeDefinition.IsTypeForwarder {
+ get {
+ return false;
+ }
+ }
+
public override string Name {
get {
return name;
public TypeSpec Element { get; private set; }
+ bool ITypeDefinition.IsComImport {
+ get {
+ return false;
+ }
+ }
+
bool ITypeDefinition.IsPartial {
get {
return false;
}
}
+ bool ITypeDefinition.IsTypeForwarder {
+ get {
+ return false;
+ }
+ }
+
public override string Name {
get {
throw new NotSupportedException ();
qcheck2:
$(TESTER) -mode:pos -files:$(TEST_PATTERN) -compiler:$(COMPILER) -issues:known-issues-$(PROFILE) -log:$(PROFILE).log -il:ver-il-$(PROFILE).xml $(DEFINES) $(TOPTIONS)
+gen-mt-tests:
+ $(TESTER) -mode:nunit -files:'v2' -compiler:$(COMPILER) -issues:known-issues-mt -compiler-options:"-lib:$(topdir)/class/lib/monotouch projects/MonoTouch/ivt.cs"
+
test-local:
@:
$(ILASM) /dll /out:$@ $<
setup:
- $(ILASM) /dll property-il.il
- $(CSCOMPILE) /r:property-il.dll property-main.cs /out:property-main.exe
- $(TEST_RUNTIME) property-main.exe
-
$(CSCOMPILE) -t:library dlls/test-679-2/test-679-lib-2.cs
$(CSCOMPILE) -t:library dlls/test-679-1/test-679-lib.cs -r:dlls/test-679-2/test-679-lib-2.dll
foo_static (d);
}
- static int Main ()
+ public static int Main ()
{
new C ().test ();
class Program
{
- static int Main ()
+ public static int Main ()
{
dynamic d = new Program ();
var p = d as int?;
c.Method_B (d);
}
- static int Main ()
+ public static int Main ()
{
object o;
DynOut (out o);
{
}
- static int Main ()
+ public static int Main ()
{
dynamic d1 = null;
dynamic d2 = null;
{
public dynamic X = new XValue ();
- static int Main()
+ public static int Main()
{
var v = new A { X = { Y = 467 } };
if (v.X.Y != 467)
return 2;
}
- static int Main ()
+ public static int Main ()
{
dynamic d = 1;
if (Test (1, d) != 1)
class Test
{
- static int Main ()
+ public static int Main ()
{
dynamic index = (uint) int.MaxValue + 1;
dynamic array = new int[] { 1, 2 };
return 2;
}
- static int Main()
+ public static int Main()
{
if (Test (() => (dynamic) 1) != 1)
return 1;
}
}
- static int Main ()
+ public static int Main ()
{
var a = new Wrap () {
Numbers = { 3, 9 }
yield break;
}
- static void Main ()
+ public static void Main ()
{
}
}
\ No newline at end of file
static void generate_main ()
{
- wl ("\tstatic void Main ()\n\t{");
+ wl ("\tpublic static void Main ()\n\t{");
foreach (string t in types){
w ("\t\tprobe_" + t + " ();\n");
wl ("\t}");
}
- static void Main (string [] args)
+ public static void Main (string [] args)
{
foreach (string arg in args){
if (arg == "-h" || arg == "--help"){
static void generate_main ()
{
- wl ("\tstatic void Main ()\n\t{");
+ wl ("\tpublic static void Main ()\n\t{");
foreach (string t in types){
w ("\t\tprobe_" + t + " ();\n");
wl ("\t}");
}
- static void Main (string [] args)
+ public static void Main (string [] args)
{
wl ("using System;\nclass Test {\n");
}
class Boot {
- static void Main ()
+ public static void Main ()
{
}
}
}
class D {
- static void Main ()
+ public static void Main ()
{
}
}
class T {
Stack<Test> a;
- static void Main()
+ public static void Main()
{
}
}
public void Foo (Stack<Test> a)
{ }
- static void Main()
+ public static void Main()
{
}
}
}
class T {
- static void Main()
+ public static void Main()
{
Stack<Test> a;
}
class Test
{
- static void Main ()
+ public static void Main ()
{
}
}
class X
{
- static void Main()
+ public static void Main()
{
}
}
class X
{
- static void Main()
+ public static void Main()
{
}
}
class X
{
- static void Main()
+ public static void Main()
{
}
}
class X
{
- static void Main()
+ public static void Main()
{
}
}
stack.Hello (3);
}
- static void Main ()
+ public static void Main ()
{ }
}
test.Hello (3);
}
- static void Main ()
+ public static void Main ()
{ }
}
stack.Hello (3);
}
- static void Main ()
+ public static void Main ()
{ }
}
public class X
{
- static void Main ()
+ public static void Main ()
{
Stack<int> s1 = new Stack<int> (3);
s1.Push (4);
class X
{
- static void Main ()
+ public static void Main ()
{
}
}
{
Stack<int> stack;
- static void Main ()
+ public static void Main ()
{
}
}
stack.Hello<string> ("Hello World");
}
- static void Main ()
+ public static void Main ()
{
Stack stack = new Stack ();
Foo (stack);
stack.Hello<string> ("Hello World");
}
- static void Main ()
+ public static void Main ()
{
Stack stack = new Stack ();
Foo (stack);
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
stack.Hello (3);
}
- static void Main ()
+ public static void Main ()
{ }
}
Console.WriteLine ("OBJECT: {0} {1}", obj, obj.GetType ());
}
- static void Main ()
+ public static void Main ()
{
Foo<string> a = new Foo<string> (4);
a.Test ();
class X
{
- static void Main ()
+ public static void Main ()
{
Bar bar = new Bar ();
bar.Test ();
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
foo.Hello (4);
}
- static void Main ()
+ public static void Main ()
{
Foo<int> foo = new Foo<int> ();
Test (foo);
foo.Hello<int> (531);
}
- static void Main ()
+ public static void Main ()
{
Foo foo = new Foo ();
Test (foo);
class X
{
- static void Main ()
+ public static void Main ()
{
Foo<int> foo = new Foo<int> ();
foo.Hello = 9;
test.BaseFunc ();
}
- static void Main ()
+ public static void Main ()
{ }
}
return stack.Test ();
}
- static void Main ()
+ public static void Main ()
{
Stack<int> stack = new Stack<int> (9);
System.Console.WriteLine (Test (stack));
class X
{
- static void Main ()
+ public static void Main ()
{
Stack<int> stack = new Stack<int> (5);
System.Console.WriteLine (stack.Test ());
bar.Test (7, "Hello");
}
- static void Main ()
+ public static void Main ()
{
Bar<int,string> bar = new Bar<int,string> ();
Test (bar);
bar.Test (7, "Hello");
}
- static void Main ()
+ public static void Main ()
{ }
}
bar.Test (7, "Hello");
}
- static void Main ()
+ public static void Main ()
{ }
}
bar.Test (512, 7, "Hello");
}
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{
}
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{
Queue<int> queue = new Queue<int> (5, 9);
queue.Test ();
class X
{
- static void Main ()
+ public static void Main ()
{
Zoo<string> zoo = new Zoo<string> ("Boston");
IMonkey<float> monkey = zoo.GetTheMonkey<float> (3.14F);
class X
{
- static int Main ()
+ public static int Main ()
{
Stack<int> stack = new Stack<int> (1);
INode<int> node = stack.GetNode ();
class X
{
- static void Main ()
+ public static void Main ()
{
Stack<string> stack = new Stack<string> ();
stack.Hello (1, "Hello", "World");
class Test
{
- static void Main ()
+ public static void Main ()
{ }
}
return 0;
}
- static int Main ()
+ public static int Main ()
{
int result = DoTheTest<int> ();
if (result != 0)
class Test
{
- static void Main ()
+ public static void Main ()
{
X<long> x = new X<long> (5);
Console.WriteLine (x.Count);
class X
{
- static void Main ()
+ public static void Main ()
{
Test<float,int> test = new Test<float,int> ();
test.Foo ("Hello World");
Console.WriteLine ("Hello: {0}", hello);
}
- static void Main ()
+ public static void Main ()
{
Foo<string> foo = new Foo<string> ();
foo.MyEvent += new Test<string> (do_hello);
class X
{
- static void Main ()
+ public static void Main ()
{
List<int> list = new List<int> ();
}
class X
{
- static void Main ()
+ public static void Main ()
{
Foo foo = new Foo ();
Stack<Foo> stack = new Stack<Foo> ();
class Foo
{
- static void Main ()
+ public static void Main ()
{ }
}
throw new ArgumentException ();
}
- static void Main ()
+ public static void Main ()
{
D d1 = new D (F<int>);
D d2 = new D (F);
class X
{
- static void Main ()
+ public static void Main ()
{
Foo<B> foo = new Foo<B> ();
foo.Test (new B ());
Console.WriteLine ("Hello World");
}
- static void Main ()
+ public static void Main ()
{
Foo<X> foo = new Foo<X> ();
foo.Create ().Hello ();
public class X
{
- static void Main ()
+ public static void Main ()
{
Test<V.SimpleCounter>.Foo (new V.SimpleCounter ());
Test<V.PrintingCounter>.Foo (new V.PrintingCounter ());
t = (T []) a;
}
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{
Y y = new Y ();
Y.B b = new Y.B ();
}
class TestLog {
- class MyTest {
public static void Main(String[] args) {
Log<String> log1 = new Log<String>();
log1.Add("Reboot");
foreach (DateTime dt in dts)
Console.Write("{0} ", dt);
Console.WriteLine();
- }
}
}
class X
{
- static void Main ()
+ public static void Main ()
{
Hello<int> hello = new Hello<int> ();
hello.Print (5);
class Foo {
- static void Main () {}
+ public static void Main () {}
}
class Foo <T> {
class X <T> : N.A <T> {
}
class Foo {
- static void Main () {}
+ public static void Main () {}
}
class X
{
- static void Main ()
+ public static void Main ()
{
Foo foo = new Foo ();
MyList<int> list = foo.Map<int> ();
class X
{
- static void Main ()
+ public static void Main ()
{
Test<double,int> test = new Test<double,int> (Math.Sign);
}
}
- static int Main ()
+ public static int Main ()
{
X x = new X ();
int sum = 0;
class X
{
- static int Main ()
+ public static int Main ()
{
Test test = new Test ();
string[] array = new string [] { "Hello" };
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{
Console.WriteLine (typeof (Foo<>));
Console.WriteLine (typeof (Foo<>.Bar<>));
return a + b;
}
- static void Main ()
+ public static void Main ()
{
Test test = new Test ();
test.Hello<int> (new Test.Foo<int> (Add), 5);
class X
{
- static void Main ()
+ public static void Main ()
{
M.Foo<int> foo;
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{
}
}
class X
{
- static void Main ()
+ public static void Main ()
{
Foo<X> foo = new Foo<X> ();
}
class TestLog {
- class MyTest {
public static void Main(String[] args) {
Log<String> log1 = new Log<String>();
log1.Add("Reboot");
foreach (Pair<DateTime,String> p in allMsgs)
Console.WriteLine("At {0}: {1}", p.Fst, p.Snd);
}
- }
}
public struct Pair<T,U> {
class X
{
- static void Main ()
+ public static void Main ()
{
MyList<Foo<int>> list = new MyList <Foo<int>> ();
foreach (Foo<int> foo in list)
class X
{
- static int Main ()
+ public static int Main ()
{
Foo<long> foo = new Foo<long> (3, 5);
if (foo.Data != 3)
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static int Main ()
+ public static int Main ()
{
Test<long> test = new Test<long> ();
Foo<long> foo = test.GetFoo (0x800);
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static int Main ()
+ public static int Main ()
{
ArrayList<int> list = new ArrayList<int> ();
return list.AddAll (null);
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{
new KeyValuePair<int,long> ();
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
Hello<U> (arr, 1);
}
- static void Main ()
+ public static void Main ()
{
Foo<int>[] foo = new Foo<int> [1];
foo [0] = new Foo<int> ();
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{
C5.ArrayList<int> array = new C5.ArrayList<int> ();
}
public class Test
{
- static void Main ()
+ public static void Main ()
{
SimpleStruct <string> s = new SimpleStruct <string> ();
}
class X
{
- static void Main ()
+ public static void Main ()
{
}
}
{
}
- static void Main ()
+ public static void Main ()
{
object o = new Der ();
Gen<int> b = (Gen<int>) o;
class X
{
- static void Main ()
+ public static void Main ()
{
A.X.Test ();
B.X.Test ();
tree.Map (new Mapper<int,string> (themap));
}
- static void Main ()
+ public static void Main ()
{
X x = new X ();
x.Test ();
class X
{
- static void Main ()
+ public static void Main ()
{
Test<int> test = new Test<int> (3);
foreach (int a in test)
using System;
class X {
- static void Main ()
+ public static void Main ()
{
int [] foo = null;
Array.Resize (ref foo, 10);
class X
{
- static int Main ()
+ public static int Main ()
{
IList<int> list = new List<int> ();
int result = list.Map ("Hello");
class X
{
- static int Main ()
+ public static int Main ()
{
KeyValuePair<int,long> p = new KeyValuePair<int,long> (3);
KeyValuePair<int,long> q = new KeyValuePair<int,long> (5, 9);
class X
{
- static void Main ()
+ public static void Main ()
{
List<Foo<int>> list = new List<Foo<int>> ();
Foo<int> foo = new Foo<int> (3);
class X
{
- static void Main ()
+ public static void Main ()
{
List<int> list = new List<int> ();
list.Map (new Mapper<int,double> (delegate (int i) { return i/10.0; }));
}
}
- static void Main ()
+ public static void Main ()
{
IComparer<Test> cmp = new NaturalComparer<Test> ();
Test a = new Test ();
class Program
{
- static void Main(string[] args)
+ public static void Main(string[] args)
{
const int iterations = 10000;
return e is T;
}
- static int Main ()
+ public static int Main ()
{
if (Foo<int>.Test (3))
return 1;
public class Tests {
- public unsafe static void Main () {
+ unsafe public static void Main () {
Console.WriteLine (typeof (void).Name);
Console.WriteLine (typeof (void*).Name);
Console.WriteLine (typeof (void**).Name);
class X
{
- static void Main ()
+ public static void Main ()
{
Sequenced<int> s = new Sequenced<int> ();
SequencedHasher<Sequenced<int>,int> hasher = new SequencedHasher<Sequenced<int>,int> ();
class Test
{
- static void Main(string[] args)
+ public static void Main(string[] args)
{
A<int> a = new A<int>(new A<int>.B(D), 3);
a.Run();
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{
IFoo<int> foo = new FooCollection<int> ();
int a = foo [3];
return result;
}
- static void Main () {
+ public static void Main () {
MyFilter m = new MyFilter ();
System.Console.WriteLine (foo1 <K> (m).Count);
MyBFilter mb = new MyBFilter ();
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{
int? a = null;
int b = 3;
class X
{
- static void Main ()
+ public static void Main ()
{
B? b = new B (5);
A? a = b;
class X
{
- static void Main ()
+ public static void Main ()
{
int? a = 4;
long b = 5;
class X
{
- static void Main ()
+ public static void Main ()
{
int?[] bvals = new int?[] { null, 3, 4 };
foreach (long? x in bvals)
class X
{
- static void Main ()
+ public static void Main ()
{
int?[] bvals = new int? [] { null, 3, 4 };
foreach (int? x in bvals)
class X
{
- static int Main ()
+ public static int Main ()
{
bool? a = null, b = false, c = true;
bool? d = null, e = false, f = true;
return 0;
}
- static int Main ()
+ public static int Main ()
{
int result = Test ();
if (result != 0)
}
class X {
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static int Main ()
+ public static int Main ()
{
new Test<bool> ();
return 0;
class X
{
- static void Main ()
+ public static void Main ()
{
}
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{
Moo<Test> moo = new Moo<Test> ();
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static int Main ()
+ public static int Main ()
{
Type t = typeof (Generic<bool>);
MemberInfo[] mi = t.FindMembers (MemberTypes.NestedType,
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
}
class M {
- static void Main () {
+ public static void Main () {
C.Rev (new list<object>.Cons <string> ());
C.Rev (new list<object>.Nil <string> ());
}
// Compiler options: /r:gtest-172-lib.dll
class M {
- static void Main () {
+ public static void Main () {
A <int> x = A<int>.Nil._N_constant_object;
}
}
class M {
- static void Main () {
+ public static void Main () {
List <D> x = new List<D> ();
x.foo <C> (x);
List <string> y = new List<string> ();
}
class M {
- static void Main () {
+ public static void Main () {
A<int> x = A<int>._N_constant_object;
B<int> y = B<int>._N_constant_object;
}
{
static int[] x = new int[] {100, 200};
- static int Main ()
+ public static int Main ()
{
IEnumerator<int> enumerator = X<int>.Y (x);
int sum = 0;
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
}
}
public class Y {
- static int Main ()
+ public static int Main ()
{
return X<Y>.myMain ();
}
[DllImport ("bah")]
public static extern void test ();
- static int Main ()
+ public static int Main ()
{
DllImportAttribute dia = Attribute.GetCustomAttribute (typeof (Program).GetMethod ("test"), typeof (DllImportAttribute)) as DllImportAttribute;
if (dia == null)
}
}
- static int Main ()
+ public static int Main ()
{
IEnumerator e = GetIt;
int total = 0;
class X {
- static void Main ()
+ public static void Main ()
{
string [] s = { "a", "b", "a" };
System.Array.FindAll (s, delegate (string str) { return str == "a"; });
class X
{
- static void Main ()
+ public static void Main ()
{
Foo<int> foo = new Foo<int> ();
Foo<int>.Node root = foo.GetRoot ();
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
}
class xX {
- static void Main () {}
+ public static void Main () {}
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
}
class X
{
- static int Main ()
+ public static int Main ()
{
HashSet<int> hb = new HashSet<int> (12345678);
}
class M {
- static void Main () {
+ public static void Main () {
LocalContext x = new LocalContext ();
x.Fold ("a" );
}
mi.Invoke (null, new object[] { arg });
}
- static void Main ()
+ public static void Main ()
{
Test (typeof (Test<Foo<int>>), new Foo<int> ());
Test (typeof (Test<Bar<int>>), new Bar<int> ());
System.Console.WriteLine (x);
}
- static void Main () {
+ public static void Main () {
string[] arr = new string[] { "a", "b", "c" };
System.Array.ForEach (arr, p);
}
}
class Driver {
- static void Main ()
+ public static void Main ()
{
Foo<SomeClass> f = new Foo<SomeClass> ();
f.Do ("something");
public class Test
{
- static void Main ()
+ public static void Main ()
{
Dictionary1<Guid, String> _D = new Dictionary1<Guid, string>();
_D.Add(Guid.NewGuid(), "foo");
bool a = t.Valid;
}
- static void Main()
+ public static void Main()
{
Fun(new SomeStruct());
}
throw new System.Exception ("didn't update 't'");
}
- static void Main()
+ public static void Main()
{
Fun (new SomeStruct ());
}
using System.Runtime.CompilerServices;
class X {
- static int Main ()
+ public static int Main ()
{
object [] attrs = typeof (X).Assembly.GetCustomAttributes (true);
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class PopQuiz
{
- static int Main()
+ public static int Main()
{
A<int>.B<char>.C<bool> o = new A<int>.B<char>.C<bool>();
string s = o.a.GetType().FullName;
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
static class SetTest
{
- static void Main ()
+ public static void Main ()
{
}
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
public class Tester
{
- static int Main ()
+ public static int Main ()
{
B b = new B ();
public void Add (object x) { }
- static void Main () {
+ public static void Main () {
int A = 4;
int goo1 = 3;
foo (goo <A, A, A, A, A> (1));
class X {
static int stored_offset, stored_len, opt_len;
- static void Main ()
+ public static void Main ()
{
if (stored_offset >= 0 && (stored_len+4) < (opt_len >> 3)) {}
class Program
{
- static void Main (string[] args)
+ public static void Main (string[] args)
{
MyClass<int> list = new MyClass<int>();
public IFoo<T> GetFooGeneric<T> () { return default (IFoo<T>); }
- static void Main ()
+ public static void Main ()
{
Test test = new Test ();
test.GetFoo ();
class X
{
- static int Main ()
+ public static int Main ()
{
Foo<long> foo = new Foo<long> ();
Foo<int> bar = new Foo<int> ();
class X
{
- static int Main ()
+ public static int Main ()
{
Foo<long> foo = new Foo<long> ();
Foo<int> bar = new Foo<int> ();
// Dependencies: gtest-238-lib.cs
class X
{
- static int Main ()
+ public static int Main ()
{
Foo<long> foo = new Foo<long> ();
if (foo.Test (3) != 1)
class X
{
- static int Main ()
+ public static int Main ()
{
Foo<long,float> a = new Foo<long,float> ();
if (a.Test (3L, 3.14F) != 3)
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
}
}
class main {
- static void Main () {}
+ public static void Main () {}
}
class X
{
- static void Main ()
+ public static void Main ()
{
}
}
class CTest : ITest
{
- static void Main()
+ public static void Main()
{
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
return o is Foo<int> ? true : false;
}
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{
EqualityComparer<int>.Test ();
}
class X
{
- static void Main ()
+ public static void Main ()
{
Extensible<int> ext = new Extensible<int> ();
ExtensibleTester<Extensible<int>> tester = new ExtensibleTester<Extensible<int>> (ext);
class X
{
- static void Main ()
+ public static void Main ()
{
HashedLinkedList<int>.Test (5);
HashedLinkedList<long> list = new HashedLinkedList<long> ();
public class C : B
{
- static void Main ()
+ public static void Main ()
{ }
}
yield return "TEST2";
}
- static void Main ()
+ public static void Main ()
{
new Test ().Run ();
}
class X
{
- static void Main ()
+ public static void Main ()
{
Foo<A> foo = new Foo<A> ();
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class B<T> : A<T> where T : class {}
class Test {
internal static A<Test> x = new B<Test> ();
- static void Main () { }
+ public static void Main () { }
}
public void f5 ([System.Runtime.InteropServices.DefaultParameterValue ((short) 1)] short x) {}
public void f6 ([DefaultParameterValue (ParamEnum.Foo)] ParamEnum n) {}
- static void Main ()
+ public static void Main ()
{
string problems = "";
Type t = typeof (Test);
yield return (T) s;
}
- static void Main ()
+ public static void Main ()
{ }
}
}
}
-class Test { static void Main () { } }
+class Test { public static void Main () { } }
void Response <T> (Handler <T> handler) {}
- static void Main ()
+ public static void Main ()
{ }
}
public static G<T> Instance;
}
- static void Main ()
+ public static void Main ()
{ }
}
}
}
- static int Main ()
+ public static int Main ()
{
IrishPub pub = new IrishPub (IrishBeer.Guinness);
if (PubToLong (pub) != 0x1001)
}
}
- static int Main ()
+ public static int Main ()
{
if (Test (null) != -1)
return 1;
class X
{
- static void Main ()
+ public static void Main ()
{
Foo<X,Test<X>> foo = new Foo<X,Test<X>> ();
foreach (Test<X> test in foo)
static void Test<T> (T t)
{ }
- static void Main ()
+ public static void Main ()
{
Foo<long> (Test);
}
public class Test
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{
int a = 3;
int? b = a;
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class BugReport
{
- static void Main(string[] args)
+ public static void Main(string[] args)
{
Foo f = new Foo();
f.Bar();
class Test {
static Foo f = new Foo ();
- static void Main () { System.Console.WriteLine (f.GetType ().BaseType); }
+ public static void Main () { System.Console.WriteLine (f.GetType ().BaseType); }
}
return 0;
}
- static int Main ()
+ public static int Main ()
{
int result = Test ();
if (result == 0)
class X : I
{
- static void Main ()
+ public static void Main ()
{
List<object> l = new List<object> ();
List<I> i = new List<I> ();
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class Test
{
- static int Main ()
+ public static int Main ()
{
ConstructorInfo mi = typeof(C).GetConstructors ()[0];
MethodBody mb = mi.GetMethodBody();
using System;
class Global {
- static void Main() {
+ public static void Main() {
Console.Write(Test2((int?)2));
}
static string Test2(decimal? value) {
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
return b ?? a;
}
- static int Main ()
+ public static int Main ()
{
A a = new A ();
B b = new B ();
Cache<T> _cache; // CS0452
}
- class Foo { static void Main () { object foo = new MyType<Base> (); } }
+ class Foo { public static void Main () { object foo = new MyType<Base> (); } }
}
public class Test
{
- static void Main ()
+ public static void Main ()
{
try {
} catch (Exception) {
static int i = 1;
static readonly A a = new A(delegate(int a) { i = a; });
- static int Main ()
+ public static int Main ()
{
return i;
}
class B<T> { }
class Test {
static public B<X::A> q;
- static void Main ()
+ public static void Main ()
{
q = new B<N.A> ();
if (typeof (B<X::A>) != typeof (B<X.A>))
}
class M {
- static void Main ()
+ public static void Main ()
{
ITest foo = new Test ();
foreach (int i in foo)
class Bar {
static int g () { return 0; }
- static int Main ()
+ public static int Main ()
{
Foo<int>.F f = g;
return f ();
if (i != 0)
throw new Exception (""+i);
}
- static void Main ()
+ public static void Main ()
{
Comparison<int> ci = Test.WrapComparison<int> (compare);
Comparison<string> cs = Test.WrapComparison<string> (compare);
class X
{
- static void Main ()
+ public static void Main ()
{
Test<float,int> test = new Test<float,int> ();
test.Foo (test, test);
[DllImport ("Dingus")]
extern static void Do2<T> ();
- static void Main ()
+ public static void Main ()
{
}
class X
{
- static void Main ()
+ public static void Main ()
{
Foo<int>.TestEnum e = Foo<int>.TestEnum.One;
Console.WriteLine (e);
class X
{
- static void Main ()
+ public static void Main ()
{
A<int> a = new A<int> ();
a.Test = new A<int>.B ();
class X
{
- static int Main ()
+ public static int Main ()
{
new Derived ().Method<Foo> ();
return 0;
class X
{
- static void Main ()
+ public static void Main ()
{
Bar<int> bar = new Bar<int> ();
System.Console.WriteLine (bar);
class X
{
- static void Main ()
+ public static void Main ()
{
Bar<int> bar = new Bar<int> ();
System.Console.WriteLine (bar);
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
: base (cb)
{ }
- static void Main ()
+ public static void Main ()
{ }
}
Hello (cb);
}
- static void Main ()
+ public static void Main ()
{ }
}
{
}
- static void Main ()
+ public static void Main ()
{
}
}
}
class Foo {
- static void Main ()
+ public static void Main ()
{
SomeClass<object> x = new SomeClass<object> ();
x.Foo ();
class X
{
- static void Main ()
+ public static void Main ()
{
A x = new A ();
foreach (int i in x) {
class C
{
- static void Main ()
+ public static void Main ()
{
new Tester<Reference> ().Do ();
new Tester<Value> ().Do ();
class X
{
- static void Main ()
+ public static void Main ()
{
Foo<double> a = new Foo<double> ();
a.Map<string> ("Hello World");
public static class Program
{
- private static void Main ()
+ public static void Main ()
{
Exception ex1 = null ?? new Exception ();
Exception ex2 = new Exception() ?? null;
{
}
- static void Main ()
+ public static void Main ()
{
object o = null;
double [] d = null;
class Test {
- static void Main ()
+ public static void Main ()
{
FooList<string> l = new FooList<string> ();
Foo<string> (l);
class Program
{
- static void Main ()
+ public static void Main ()
{
SerializeDictionary (new SerializerLazyDictionary ());
}
throw new NotImplementedException();
}
- static void Main ()
+ public static void Main ()
{
}
}
\ No newline at end of file
{
public delegate R Function<T1, T2, R>(T1 arg1, T2 arg2);
- static int Main ()
+ public static int Main ()
{
Delegate [] e = new Delegate [] {
new Function<IList,IList,int> (f2),
class T
{
- static int Main ()
+ public static int Main ()
{
ConstructorInfo mi = typeof(D).GetConstructors (BindingFlags.Instance | BindingFlags.Public)[0];
MethodBody mb = mi.GetMethodBody();
public class Program
{
- static void Main ()
+ public static void Main ()
{
new C ().Foo<string> ();
}
class X
{
- static void Main ()
+ public static void Main ()
{
}
}
class Program
{
- static void Main ()
+ public static void Main ()
{
new Concrete_B.InnerDerived ("abc");
new Concrete_A.InnerDerived (11);
{
class Program
{
- static int Main()
+ public static int Main()
{
A a = new A();
a.Counter++;
{
class Program
{
- static int Main()
+ public static int Main()
{
int? i = 0;
bool b = i == (int?)null;
{
}
- static void Main ()
+ public static void Main ()
{
Assert (10, new MyType (10));
}
class Repro {
- static void Main ()
+ public static void Main ()
{
}
class X
{
- static void Main ()
+ public static void Main ()
{
Test<float,int> test = new Test<float,int> ();
test.Foo ("Hello World");
public class X
{
- static int Main ()
+ public static int Main ()
{
new TestClass<object> ().Check (null, null);
new TestClass2<C> ().Check (null, null);
return x != null;
}
- static int Main ()
+ public static int Main ()
{
if (Compute (1) != false)
return 1;
{
static int x = 2;
- static void Main(string[] args)
+ public static void Main(string[] args)
{
foreach (bool b in test())
;
class C
{
- static int Main ()
+ public static int Main ()
{
MyTypeA? mt = null;
mt = null + mt;
throw new Exception ();
}
- static void Main ()
+ public static void Main ()
{
Data d;
f (d = new Data () { Value = 5 });
class Program
{
- static int Main ()
+ public static int Main ()
{
Error error = Error.FILE_NOT_FOUND;
return (error == null) ? 1 : 0;
class X
{
- static int Main ()
+ public static int Main ()
{
DieSubrangeType subrange = new DieSubrangeType ();
Console.WriteLine (subrange.UpperBound != null);
}
public class T {
- static void Main ()
+ public static void Main ()
{
}
}
return null;
}
- static void Main()
+ public static void Main()
{
Invoke(Method, "one", 1);
}
return -b;
}
- static int Main ()
+ public static int Main ()
{
if (NegateFooNullable (null).Value != 42)
return 1;
class Program
{
- static int Main ()
+ public static int Main ()
{
try {
IEnumerable<Derived> e1 = (IEnumerable<Derived>) (new Base [] { });
return o is T;
}
- static int Main ()
+ public static int Main ()
{
if (Foo<bool> ())
return 1;
class X {
- static void Main ()
+ public static void Main ()
{
int h = 1, o = 2;
public class Test
{
- static public int Main ()
+ public static int Main ()
{
object [] o = typeof (IFoo).GetMethod ("get_Item").GetParameters () [0].GetCustomAttributes (false);
if (o.Length != 1)
return 1;
}
+ void Test_13 (object param)
+ {
+ if (param as bool? ?? false) {} else {}
+ }
+
public static void Main ()
{
}
class Program
{
- static void Main()
+ public static void Main()
{
unsafe {
int* a = (int*)null;
class Program
{
- static int Main ()
+ public static int Main ()
{
Type type = typeof (Foo<>);
Type [] gargs = type.GetGenericArguments ();
class Test
{
- static int Main ()
+ public static int Main ()
{
int? n = 1;
S f = new S ();
class Foo
{
- static int Main ()
+ public static int Main ()
{
if (Bar (1))
return 1;
{
public static GlobalMonitoredCharacterCollection MonitoredCharacters;
- static int Main ()
+ public static int Main ()
{
MonitoredCharacters = new GlobalMonitoredCharacterCollection();
foreach (var character in MonitoredCharacters)
class Program
{
- static int Main ()
+ public static int Main ()
{
int? i = ((int?) -4);
int? i2 = (int?) +4;
return 1;
}
- static int Main ()
+ public static int Main ()
{
C c = new C ();
Test (c, c, new object [0]);
class Program
{
- static void Main ()
+ public static void Main ()
{
}
}
get { return tmp != null ? tmp.stuff : (int?)null; }
}
- static int Main ()
+ public static int Main ()
{
int? r = new Driver().Prop;
Console.WriteLine (r);
class Program {
- static void Main ()
+ public static void Main ()
{
var foo = new Foo ();
foo.Bar ();
public class M
{
- static void Main()
+ public static void Main()
{
// access an internal type
C1 a = new C1();
public class Program
{
- private static int Main ()
+ public static int Main ()
{
var t = typeof (Init);
var m = t.GetMethod ("testcase.IInitializationExpression.AddRegistry", BindingFlags.NonPublic | BindingFlags.Instance);
{
public class Program
{
- static int Main ()
+ public static int Main ()
{
DateTime? a = default (DateTime?);
DateTime? b = default (DateTime?);
public class EntryPoint
{
- static void Main () { }
+ public static void Main () { }
}
class Test
{
- static void Main () { }
+ public static void Main () { }
static void Foo<T> (ref T t) { }
static void Foo<T> (T[] t) { }
class Program {
- static int Main ()
+ public static int Main ()
{
PortableExecutableKinds pekind;
ImageFileMachine machine;
class Program {
- static int Main ()
+ public static int Main ()
{
PortableExecutableKinds pekind;
ImageFileMachine machine;
{
class Program
{
- static void Main ()
+ public static void Main ()
{
object o = new object ();
Inner<object>.Compare (o, o);
{
}
- static int Main ()
+ public static int Main ()
{
return 0;
}
class Program
{
- static int Main ()
+ public static int Main ()
{
string typeNames = OuterGeneric<int>.InnerGeneric<long>.GetTypeNames ();
Console.WriteLine (typeNames);
class Program
{
- static int Main ()
+ public static int Main ()
{
Tester<int> t = new Tester<int> ();
int r = t.Get (333);
return t == this;
}
- static int Main ()
+ public static int Main ()
{
var p = new Program ();
class Bar : I<I<string>>
{
- static int Main ()
+ public static int Main ()
{
var foo = new Foo<string, Bar> (new Bar ());
return 0;
class Program
{
- static int Main ()
+ public static int Main ()
{
Int32Collection src = new Int32Collection ();
Int32Collection dest = new Int32Collection ();
}
class Program {
- static void Main ()
+ public static void Main ()
{
}
}
public static T[] Values;
}
}
- static void Main ()
+ public static void Main ()
{
Outer.Inner<string>.Values = new string[0];
}
class a
{
- static int Main ()
+ public static int Main ()
{
Derived.EndExecute<Derived> (null, "something");
return 0;
class a
{
- static void Main ()
+ public static void Main ()
{
var ic = new ItemCollection<Item> ();
ic.Bind (ic);
class Program
{
- static int Main ()
+ public static int Main ()
{
int? a = 5;
int? b = 5;
{
}
- static void Main ()
+ public static void Main ()
{
new Test<MainClass, MainClass, MainClass> ().Method ();
}
{
}
- class C
+ public class C
{
Func<int> MA;
int F;
return null;
}
- static int Main ()
+ public static int Main ()
{
Provide<Service> ().Foo ();
return 0;
class M
{
- static int Main ()
+ public static int Main ()
{
new ATop<short>().Test ();
return 0;
}
}
- static void Main ()
+ public static void Main ()
{
Expression.Test ();
}
class C
{
- static int Main ()
+ public static int Main ()
{
var r = new A<short>.B ();
if (r.getT () != r)
return f (t1, t2);
}
- static void Main ()
+ public static void Main ()
{
var r = Test ("a", "b", Factory.Create);
}
{
class Program
{
- static int Main ()
+ public static int Main ()
{
Type t = typeof (B);
InterfaceMapping map = t.GetInterfaceMap (typeof (ITest));
class Test
{
- static int Main ()
+ public static int Main ()
{
A2.N<short> b1 = A2.N<short>.Method ();
A.N<byte> b2 = A.N<byte>.Method ();
t = default (T);
}
- static int Main ()
+ public static int Main ()
{
foreach (var e in Foo<string, object> (new string[] { "as" })) {
}
class X
{
- static int Main ()
+ public static int Main ()
{
object o = 10;
int? x = 3;
--- /dev/null
+using System;
+
+public abstract class A<T>
+{
+ public abstract A<MM> For<MM> () where MM : T;
+}
+
+public class B<U, X, V> : A<V>
+ where V : X
+ where X : U
+{
+ readonly A<U> _inner;
+
+ public B (A<U> inner)
+ {
+ _inner = inner;
+ }
+
+ public override A<PP> For<PP> () // base constraint is copied as PP : V
+ {
+ return _inner.For<PP> ();
+ }
+}
+
+public class Test : A<Test>
+{
+ public static void Main ()
+ {
+ var t = new Test ();
+ new B<Test, Test, Test> (t).For<Test> ();
+ }
+
+ public override A<QQ> For<QQ> ()
+ {
+ return null;
+ }
+}
public class Test
{
- static int Main ()
+ public static int Main ()
{
var v = new { Foo = "Bar", Baz = 42 };
return new { s };
}
- static int Main ()
+ public static int Main ()
{
string Foo = "Bar";
int Baz = 42;
public class Test
{
- static int Main ()
+ public static int Main ()
{
MyClass mc = new MyClass();
var v = new { mc.Foo, mc.Baz };
public class Test
{
- static int Main ()
+ public static int Main ()
{
string Hello = "World";
MyClass mc = new MyClass();
return null;
}
- static int Main ()
+ public static int Main ()
{
var v1 = new { Name = "Scott", Age = 21 };
var v2 = new { Age = 20, Name = "Sam" };
class CastByExample
{
- static void Main()
+ public static void Main()
{
object o = new { Foo = "Data" };
// Cast object to anonymous type
public class Test
{
- static int Main ()
+ public static int Main ()
{
var v1 = new { };
var v2 = new { };
internal static class Program
{
- private static int Main ()
+ public static int Main ()
{
var a = new { First = new Alpha ("joe bob"), Second = new Beta ("main street") };
Console.WriteLine ("hash = {0}", a.GetHashCode ());
}
}
- static void Main ()
+ public static void Main ()
{
Type type = typeof (int);
IEnumerable<string> properties = new[] { "x" };
Answer = 42;
}
- static int Main ()
+ public static int Main ()
{
Test t = new Test ();
t.Foo = "Bar";
public static string Foo { get; set; }
public static int Answer { get; private set; }
- static int Main ()
+ public static int Main ()
{
Foo = "Bar";
if (Foo != "Bar")
{
public string Foo { get; set; }
- static int Main ()
+ public static int Main ()
{
FieldInfo [] fields = typeof (Test).GetFields(BindingFlags.NonPublic | BindingFlags.Instance);
if (!(fields.Length > 0))
class Program
{
- static void Main (string[] args)
+ public static void Main (string[] args)
{
C c = new C ();
}
Console.WriteLine (i);
}
- static int Main ()
+ public static int Main ()
{
ArrayList collection = new ArrayList { "Foo", null, 1 };
if (collection.Count != 3)
class X
{
- static int Main ()
+ public static int Main ()
{
object x = null;
R (ref x);
class C
{
- static int Main()
+ public static int Main()
{
return S<int>.Test ();
}
class C
{
- static int Main()
+ public static int Main()
{
Foo f;
Expression<Func<bool>> e = () => f > null;
}
}
- static int Main()
+ public static int Main()
{
// It also tests constant boxing
Expression<Func<ArrayList>> e1 = () => new ArrayList { null, "Hello", "World", 5 };
class Program
{
- static int Main ()
+ public static int Main ()
{
var x = new Foo<int> ();
return x.ContainsAll (new [] { 4, 6, 78 }) ? 0 : 1;
class C
{
- static void Main ()
+ public static void Main ()
{
new Test ().Invalid (4);
}
class Program
{
- static int Main ()
+ public static int Main ()
{
foreach (int o in Test<bool> (1)) {
}
class Repro
{
- static int Main ()
+ public static int Main ()
{
var persons = GetPersons (new [] { new Person { Age = 25 }, new Person { Age = 21 } }, 25);
return persons.Count () - 1;
public class Program
{
- static int Main ()
+ public static int Main ()
{
Expression<Action<IHelper>> e = (helper => helper.DoIt (null));
var mce = e.Body as MethodCallExpression;
public class Program
{
- static int Main ()
+ public static int Main ()
{
Expression<Action<IHelper>> e = (helper => helper.DoIt (new Foo ()));
var mce = e.Body as MethodCallExpression;
action (null);
}
- static int Main ()
+ public static int Main ()
{
var foo = new Foo ();
class Program
{
- static int Main ()
+ public static int Main ()
{
A<int>.B<ulong>.foo ();
return 0;
class Program
{
- static void Main(string[] args)
+ public static void Main(string[] args)
{
var chat = new ChatClient();
var lines = new StringCollection() { "a", "b", "c" };
get { return "a"; }
}
- static void Main (string [] args)
+ public static void Main (string [] args)
{
Program p = new Program ();
p [0].Extension ();
class Repro {
- static void Main ()
+ public static void Main ()
{
var f = new Foo ();
Console.WriteLine (f.IsBar ());
{
delegate string D ();
- static int Main ()
+ public static int Main ()
{
string s = "jaj";
list.AddRange(new Test[0]);
}
- static void Main()
+ public static void Main()
{
}
}
list.AddRange();
}
- static void Main()
+ public static void Main()
{
}
}
class Program
{
- static void Main ()
+ public static void Main ()
{
Console.WriteLine (Pan (new byte[0]));
}
class Program
{
- static void Main ()
+ public static void Main ()
{
}
}
Console.Write (a.FirstOrDefault ());
}
- static void Main ()
+ public static void Main ()
{
}
}
--- /dev/null
+.assembly extern mscorlib
+{
+}
+
+.assembly 'gtest-exmethod-45-lib'
+{
+ .hash algorithm 0x00008004
+}
+
+.module 'gtest-exmethod-45-lib.dll'
+
+.class public abstract auto F
+{
+ .custom instance void class [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::'.ctor'() = (01 00 00 00 )
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ ldarg.0
+ call instance void [mscorlib]System.Object::.ctor()
+ ret
+ }
+
+ .method public hidebysig static void TestExt(string s) cil managed
+ {
+ .custom instance void class [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::'.ctor'() = (01 00 00 00 )
+
+ ret
+ }
+}
--- /dev/null
+// Compiler options: -r:gtest-exmethod-45-lib.dll
+
+public class C
+{
+ public static void Main ()
+ {
+ string s = null;
+ s.TestExt ();
+ }
+}
\ No newline at end of file
public class Test
{
- static void Main ()
+ public static void Main ()
{
FriendClass fc = new FriendClass ();
public class Test
{
- static void Main ()
+ public static void Main ()
{
FriendClass fc = new FriendClass ();
public class Test
{
- static void Main ()
+ public static void Main ()
{
FriendClass fc = new FriendClass ();
public class Test
{
- static void Main ()
+ public static void Main ()
{
// We should be able to access them
new InternalFriendClass ();
public class Test
{
- static void Main ()
+ public static void Main ()
{
FriendClass fc = new FriendClass ();
public class Test
{
- static void Main ()
+ public static void Main ()
{
FriendClass fc = new FriendClass ();
public class Test
{
- static void Main ()
+ public static void Main ()
{
FriendClass fc = new FriendClass ();
public class Test
{
- static void Main ()
+ public static void Main ()
{
// We should be able to access them
new InternalFriendClass ();
public class Test
{
- static void Main ()
+ public static void Main ()
{
FriendClass fc = new FriendClass ();
public class Test
{
- static void Main ()
+ public static void Main ()
{
FriendClass fc = new FriendClass ();
public class Test
{
- static void Main ()
+ public static void Main ()
{
FriendClass fc = new FriendClass ();
public class Test
{
- static void Main ()
+ public static void Main ()
{
// We should be able to access them
new InternalFriendClass ();
public class Test
{
- static void Main ()
+ public static void Main ()
{
var b = new B ();
b.Test_2 ();
public class Test
{
- static int Main ()
+ public static int Main ()
{
string[] array = new [] { "Foo", "Bar", "Baz" };
foreach (string s in array)
public class Test
{
- static int Main ()
+ public static int Main ()
{
var v = new [] { new MyString (), "a" };
if (v [0] != "ggtt")
public class Test
{
- static int Main ()
+ public static int Main ()
{
MyClass mc = new MyClass() { Foo = "Baz", Answer = 42 };
if (mc.Foo != "Baz")
public Thing Thing1;
public Thing Thing2;
}
- static int Main ()
+ public static int Main ()
{
Thing thing1 = new Thing() { Number = 1, Name = "Bob" };
return new Data () { Value = 3 };
}
- static void Main ()
+ public static void Main ()
{
Prop = new Data () { Value = 3 };
Data data = new Data () { Value = 6 };
class Y
{
- static int Main ()
+ public static int Main ()
{
Foo foo = new Foo ();
foo.P = 1;
yield return o;
}
- static void Main ()
+ public static void Main ()
{
var test = new Test ();
test.Annotations<Test> ();
while (from <= to) yield return from++;
}
- static int Main ()
+ public static int Main ()
{
IEnumerable<int> e = FromTo (1, 10);
class Program {
- static int Main ()
+ public static int Main ()
{
var collection = new BarCollection () {
new Bar { Name = "a" },
yield return base.BaseM++;
}
- static int Main ()
+ public static int Main ()
{
foreach (var v in new X ().GetIt ())
Console.WriteLine (v);
yield break;
}
- static void Main ()
+ public static void Main ()
{
}
}
class X
{
- static int Main ()
+ public static int Main ()
{
foreach (var i in GetAll ()) {
}
public class CompilerBug
{
- static void Main ()
+ public static void Main ()
{
foreach (string message in Foo ())
Console.WriteLine (message);
static IntFunc func, increment;
static VoidFunc nothing;
- static int Main ()
+ public static int Main ()
{
int y = 0;
int r;
Console.WriteLine (res);
}
- static void Main ()
+ public static void Main ()
{
Foo (x => x + "dingus");
}
{
return f1 (value);
}
- static int Main ()
+ public static int Main ()
{
object o = F (1, "1:15:30", s => TimeSpan.Parse (s));
Console.WriteLine (o);
{
return f2 (f1(value));
}
- static int Main ()
+ public static int Main ()
{
double d = F("1:15:30", s => TimeSpan.Parse(s), t => t.TotalSeconds);
if (d < 4529 || d > 4531)
static void StopTrue (T t) { }
- static int Main ()
+ public static int Main ()
{
// Test that we encode (!v3) & ((!v1) & ((v1 | v2) & (v2 | v3)))
P (v1 => P (v2 => P (v3 => StopTrue (
Console.WriteLine (values [0]);
}
- static int Main ()
+ public static int Main ()
{
int[] a = new int [] { 10 };
F (a, 5, i => a [0] = i);
return Foo (str => str.ToLower ());
}
- static void Main ()
+ public static void Main ()
{
var str = Foo (s => s);
Console.WriteLine (str);
class Repro
{
- static int Main ()
+ public static int Main ()
{
var sum = new [] { "1", "2", "3", "4", "5", "6", "7" }.Sum ((s) => int.Parse (s));
if (sum != 28)
}, 42);
}
- static void Main ()
+ public static void Main ()
{
}
}
return Foo (str => str.ToLower ());
}
- static int Main ()
+ public static int Main ()
{
var str = Foo (s => s);
Console.WriteLine (str);
class C
{
- static void Main ()
+ public static void Main ()
{
Execute (() => {
int a, b;
public class CustomQueryExpressionPattern
{
- static int Main ()
+ public static int Main ()
{
var v = new TestA ("Oh yes");
string foo = from a in v select a;
class Program {
- static void Main ()
+ public static void Main ()
{
}
public class Program {
- static void Main ()
+ public static void Main ()
{
}
return false;
}
- static int Main ()
+ public static int Main ()
{
var x = new int [] { 'a', 'b', 'c' };
static class Program
{
- static int Main()
+ public static int Main()
{
int i = 0;
var input = new int[] { 1 };
class Program
{
- static void Main ()
+ public static void Main ()
{
var value = new S<int> ();
var e = from item in value
{
}
- static int Main ()
+ public static int Main ()
{
V = "";
m (f (1), b: f (2), c: f (3));
return 1;
}
- static int Main ()
+ public static int Main ()
{
if (Test_1 (5) != 0)
return 1;
public class Program
{
- static void Main()
+ public static void Main()
{
new Program<object>();
}
{
}
- static int Main ()
+ public static int Main ()
{
var t = typeof (Program).GetMethod ("Test");
var p = t.GetParameters ()[0];
public class Test
{
- static int Main ()
+ public static int Main ()
{
string[] strings = new string[] { "Foo", "Bar", "Baz" };
public class Test
{
- static int Main ()
+ public static int Main ()
{
string bar = "Who is John Galt?";
IFoo<string> foo = new Foo(bar);
public static class Program
{
- static int Main ()
+ public static int Main ()
{
var col = new Test();
public class Test
{
- static int Main ()
+ public static int Main ()
{
S s = new S ();
IFoo<object> o = s;
IEnumerable<U> itu = ita;
}
- static void Main ()
+ public static void Main ()
{
Bla<string, object> ();
}
public class Test
{
- static int Main ()
+ public static int Main ()
{
IFoo<object> foo = new Foo ();
IFoo<string> foo2 = foo;
public class Test
{
- static int Main ()
+ public static int Main ()
{
string message = "Hello World!";
Foo<string> foo = () => message;
public class Test
{
- static int Main ()
+ public static int Main ()
{
string message = "Hello World!";
Foo<object> foo = (o) => o.GetHashCode ();
public class Test
{
- static int Main ()
+ public static int Main ()
{
var b = new B ();
var c = new C ();
class Program
{
- static void Main ()
+ public static void Main ()
{
}
}
--- /dev/null
+# This file contains test files which cause any type of error.
+
+# This file supports extended syntax
+# csXXXX.cs : test case causes error
+# csXXXX.cs IGNORE : adds test to ignore list
+
+gtest-230.cs
+
+# exluded (tricky to build, extra dependency or hitting MT restrictions)
+gtest-444.cs SKIP
+gtest-exmethod-23.cs SKIP
+test-74.cs SKIP
+test-468.cs SKIP
+test-513.cs SKIP
+test-616.cs SKIP
+test-695.cs SKIP
+test-707.cs SKIP
+test-814.cs SKIP
+test-com-01.cs SKIP
+
+#reflection
+test-295.cs SKIP
+test-555.cs SKIP
+
+
+# MT bugs
+
+# Modules loading
+test-416.cs SKIP
+test-418.cs SKIP
+test-715.cs SKIP
+
+# Aggressive references loading
+test-760.cs SKIP
+test-792.cs SKIP
+
+# __arglist support
+test-269.cs SKIP
+test-270.cs SKIP
+test-399.cs SKIP
+test-482.cs SKIP
+test-562.cs SKIP
+test-704.cs SKIP
+test-811.cs SKIP
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+using MonoTouch.Foundation;
+using MonoTouch.UIKit;
+using MonoTouch.NUnit.UI;
+
+namespace TestMcs
+{
+ // The UIApplicationDelegate for the application. This class is responsible for launching the
+ // User Interface of the application, as well as listening (and optionally responding) to
+ // application events from iOS.
+ [Register ("AppDelegate")]
+ public partial class AppDelegate : UIApplicationDelegate
+ {
+ // class-level declarations
+ UIWindow window;
+ TouchRunner runner;
+
+ //
+ // This method is invoked when the application has loaded and is ready to run. In this
+ // method you should instantiate the window, load the UI into it and then make the window
+ // visible.
+ //
+ // You have 17 seconds to return from this method, or iOS will terminate your application.
+ //
+ public override bool FinishedLaunching (UIApplication app, NSDictionary options)
+ {
+ // create a new window instance based on the screen size
+ window = new UIWindow (UIScreen.MainScreen.Bounds);
+ runner = new TouchRunner (window);
+
+ // register every tests included in the main application/assembly
+ runner.Add (System.Reflection.Assembly.GetExecutingAssembly ());
+
+ window.RootViewController = new UINavigationController (runner.GetViewController ());
+
+ // make the window visible
+ window.MakeKeyAndVisible ();
+
+ return true;
+ }
+ }
+}
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>UIDeviceFamily</key>
+ <array>
+ <integer>1</integer>
+ <integer>2</integer>
+ </array>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+ <key>UISupportedInterfaceOrientations~ipad</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationPortraitUpsideDown</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+ <key>MinimumOSVersion</key>
+ <string>3.2</string>
+</dict>
+</plist>
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+using MonoTouch.Foundation;
+using MonoTouch.UIKit;
+
+namespace TestMcs
+{
+ public class Application
+ {
+ // This is the main entry point of the application.
+ static void Main (string[] args)
+ {
+ // if you want to use a different Application Delegate class from "AppDelegate"
+ // you can specify it here.
+ UIApplication.Main (args, null, "AppDelegate");
+ }
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
+ <ProductVersion>10.0.0</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{00C88FC7-0FAA-4E5F-A9E6-C4343F1F30D8}</ProjectGuid>
+ <ProjectTypeGuids>{6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <OutputType>Exe</OutputType>
+ <RootNamespace>TestMcs</RootNamespace>
+ <IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
+ <AssemblyName>TestMcs</AssemblyName>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
+ <DebugSymbols>True</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>False</Optimize>
+ <OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
+ <DefineConstants>DEBUG;</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <ConsolePause>False</ConsolePause>
+ <MtouchLink>None</MtouchLink>
+ <MtouchDebug>True</MtouchDebug>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
+ <DebugType>none</DebugType>
+ <Optimize>True</Optimize>
+ <OutputPath>bin\iPhoneSimulator\Release</OutputPath>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <ConsolePause>False</ConsolePause>
+ <MtouchLink>None</MtouchLink>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
+ <DebugSymbols>True</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>False</Optimize>
+ <OutputPath>bin\iPhone\Debug</OutputPath>
+ <DefineConstants>DEBUG;</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <ConsolePause>False</ConsolePause>
+ <MtouchDebug>True</MtouchDebug>
+ <CodesignKey>iPhone Developer</CodesignKey>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
+ <DebugType>none</DebugType>
+ <Optimize>True</Optimize>
+ <OutputPath>bin\iPhone\Release</OutputPath>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <ConsolePause>False</ConsolePause>
+ <CodesignKey>iPhone Developer</CodesignKey>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Ad-Hoc|iPhone' ">
+ <DebugType>none</DebugType>
+ <Optimize>True</Optimize>
+ <OutputPath>bin\iPhone\Ad-Hoc</OutputPath>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <BuildIpa>True</BuildIpa>
+ <ConsolePause>False</ConsolePause>
+ <CodesignProvision>Automatic:AdHoc</CodesignProvision>
+ <CodesignKey>iPhone Distribution</CodesignKey>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|iPhone' ">
+ <DebugType>none</DebugType>
+ <Optimize>True</Optimize>
+ <OutputPath>bin\iPhone\AppStore</OutputPath>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <ConsolePause>False</ConsolePause>
+ <CodesignKey>iPhone Distribution</CodesignKey>
+ <CodesignProvision>Automatic:AppStore</CodesignProvision>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Xml" />
+ <Reference Include="System.Core" />
+ <Reference Include="monotouch" />
+ <Reference Include="MonoTouch.NUnitLite" />
+@GENERATED_REFERENCES
+ </ItemGroup>
+ <ItemGroup>
+ <Folder Include="Resources\" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="Info.plist" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Main.cs" />
+ <Compile Include="AppDelegate.cs" />
+ <Compile Include="@TEST_SOURCEFILE" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+</Project>
\ No newline at end of file
--- /dev/null
+\r
+Microsoft Visual Studio Solution File, Format Version 11.00\r
+# Visual Studio 2010\r
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoTouch", "MonoTouch.csproj", "{00C88FC7-0FAA-4E5F-A9E6-C4343F1F30D8}"\r
+EndProject\r
+Global\r
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
+ Debug|iPhoneSimulator = Debug|iPhoneSimulator\r
+ Release|iPhoneSimulator = Release|iPhoneSimulator\r
+ Debug|iPhone = Debug|iPhone\r
+ Release|iPhone = Release|iPhone\r
+ Ad-Hoc|iPhone = Ad-Hoc|iPhone\r
+ AppStore|iPhone = AppStore|iPhone\r
+ EndGlobalSection\r
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
+ {00C88FC7-0FAA-4E5F-A9E6-C4343F1F30D8}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone\r
+ {00C88FC7-0FAA-4E5F-A9E6-C4343F1F30D8}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone\r
+ {00C88FC7-0FAA-4E5F-A9E6-C4343F1F30D8}.AppStore|iPhone.ActiveCfg = AppStore|iPhone\r
+ {00C88FC7-0FAA-4E5F-A9E6-C4343F1F30D8}.AppStore|iPhone.Build.0 = AppStore|iPhone\r
+ {00C88FC7-0FAA-4E5F-A9E6-C4343F1F30D8}.Debug|iPhone.ActiveCfg = Debug|iPhone\r
+ {00C88FC7-0FAA-4E5F-A9E6-C4343F1F30D8}.Debug|iPhone.Build.0 = Debug|iPhone\r
+ {00C88FC7-0FAA-4E5F-A9E6-C4343F1F30D8}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator\r
+ {00C88FC7-0FAA-4E5F-A9E6-C4343F1F30D8}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator\r
+ {00C88FC7-0FAA-4E5F-A9E6-C4343F1F30D8}.Release|iPhone.ActiveCfg = Release|iPhone\r
+ {00C88FC7-0FAA-4E5F-A9E6-C4343F1F30D8}.Release|iPhone.Build.0 = Release|iPhone\r
+ {00C88FC7-0FAA-4E5F-A9E6-C4343F1F30D8}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator\r
+ {00C88FC7-0FAA-4E5F-A9E6-C4343F1F30D8}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator\r
+ EndGlobalSection\r
+ GlobalSection(MonoDevelopProperties) = preSolution\r
+ StartupItem = MonoTouch.csproj\r
+ EndGlobalSection\r
+EndGlobal\r
--- /dev/null
+using System.Runtime.CompilerServices;
+
+[assembly: InternalsVisibleTo ("TestMcs")]
+++ /dev/null
-.assembly extern mscorlib
-{
- .ver 1:0:5000:0
-}
-.assembly 'property-il'
-{
- .hash algorithm 0x00008004
- .ver 0:0:0:0
-}
-.module 'property-il.dll' // GUID = {CACC88BA-6ED4-45E0-8E59-C3ABEBA9753A}
-
-
- .class public auto ansi beforefieldinit 'Foo'
- extends [mscorlib]System.Object
- {
-
- // method line 1
- .method public hidebysig specialname rtspecialname
- instance default void .ctor () cil managed
- {
- // Method begins at RVA 0x20ec
- // Code size 7 (0x7)
- .maxstack 8
- IL_0000: ldarg.0
- IL_0001: call instance void valuetype [mscorlib]'System.Object'::.ctor()
- IL_0006: ret
- } // end of method Foo::instance default void .ctor ()
-
- // method line 2
- .method public virtual hidebysig newslot specialname
- instance default string 'Monkey_Jump' () cil managed
- {
- // Method begins at RVA 0x20f4
- // Code size 6 (0x6)
- .maxstack 8
- IL_0000: ldstr "foo"
- IL_0005: ret
- } // end of method Foo::instance default string 'Monkey_Jump' ()
-
- .property specialname rtspecialname string Message ()
- {
- .get instance default string 'Foo'::'Monkey_Jump' ()
- }
- } // end of type Foo
-
- .class public auto ansi beforefieldinit 'Bar'
- extends Foo
- {
-
- // method line 3
- .method public hidebysig specialname rtspecialname
- instance default void .ctor () cil managed
- {
- // Method begins at RVA 0x20fb
- // Code size 7 (0x7)
- .maxstack 8
- IL_0000: ldarg.0
- IL_0001: call instance void class 'Foo'::.ctor()
- IL_0006: ret
- } // end of method Bar::instance default void .ctor ()
-
- // method line 4
- .method public virtual hidebysig specialname
- instance default string 'Boston' () cil managed
- {
- // Method begins at RVA 0x2103
- // Code size 6 (0x6)
- .maxstack 8
- IL_0000: ldstr "bar"
- IL_0005: ret
- } // end of method Bar::instance default string 'Boston' ()
-
- .property specialname rtspecialname string Message ()
- {
- .get instance default string 'Bar'::'Boston' ()
- }
- } // end of type Bar
-
-.class public auto ansi beforefieldinit C
- extends [mscorlib]System.Object
-{
- .method public hidebysig specialname instance int32
- get_Value() cil managed
- {
- .maxstack 1
- .locals init (int32 V_0)
- IL_0000: ldc.i4.3
- IL_0001: stloc.0
- IL_0002: br.s IL_0004
-
- IL_0004: ldloc.0
- IL_0005: ret
- }
-
- .method public hidebysig specialname instance void
- add_Arg(bool arg) cil managed
- {
- .maxstack 0
- IL_0000: ret
- }
-
- .method public hidebysig specialname rtspecialname
- instance void .ctor() cil managed
- {
- .maxstack 1
- IL_0000: ldarg.0
- IL_0001: call instance void [mscorlib]System.Object::.ctor()
- IL_0006: ret
- }
-
-}
-
+++ /dev/null
-using System;
-
-class X
-{
- static int Main ()
- {
- Bar bar = new Bar ();
- if (bar.Message != "bar")
- return 1;
-
- Foo foo = new Foo ();
- if (foo.Message != "foo")
- return 2;
-
- C c = new C ();
- c.get_Value ();
- c.add_Arg (false);
-
- Console.WriteLine ("Test ok");
- return 0;
- }
-}
using System;
class X {
- static int Main (string [] args)
+ public static int Main (string [] args)
{
Console.WriteLine ("Hello, World!");
return 0;
decimal dec2 = (decimal)dec;
}
- static void Main ()
+ public static void Main ()
{
}
g_object_get (Raw);
}
- static int Main ()
+ public static int Main ()
{
return 0;
}
[My("testclass")]
[My2("testclass", 22)]
public class Test {
- static public int Main() {
+ public static int Main() {
System.Reflection.MemberInfo info = typeof (Test);
object[] attributes = info.GetCustomAttributes (false);
for (int i = 0; i < attributes.Length; i ++) {
Console.WriteLine ("Async Callback " + ar.AsyncState);
}
- static int Main () {
+ public static int Main () {
SimpleDelegate d = new SimpleDelegate (F);
AsyncCallback ac = new AsyncCallback (async_callback);
string state1 = "STATE1";
//throw new NotImplementedException ();
}
- static int Main () {
+ public static int Main () {
SimpleDelegate d = new SimpleDelegate (F);
AsyncCallback ac = new AsyncCallback (async_callback);
class X {
- static int Main ()
+ public static int Main ()
{
int i = 0;
using System;
class T {
- static int Main ()
+ public static int Main ()
{
//
// Just a test to compile the following:
static object get_obj() {
return new object ();
}
- static int Main() {
+ public static int Main() {
object o = get_obj ();
if (o == "string")
return 1;
return x;
}
- static int Main ()
+ public static int Main ()
{
if (g () [1] == 10)
return 0;
//
class X {
- static int Main ()
+ public static int Main ()
{
double d = 1.4e-4;
// add more ;-)
// and LoaderOptimization is also the abbreviation for
// LoaderOptimizationAttribute
[LoaderOptimization (LoaderOptimization.SingleDomain)]
- static int Main (string[] args) {
+ public static int Main (string[] args) {
return 0;
}
}
}
class Test {
- static int Main ()
+ public static int Main ()
{
Value v = new Value ();
using System;
class X {
- static int Main (string [] args)
+ public static int Main (string [] args)
{
string a = "hello";
string b = "1";
class test
{
- static int Main ()
+ public static int Main ()
{
int errors = 0;
Type t = typeof (MyUnicode);
}
- static int Main ()
+ public static int Main ()
{
int [] a = new int [10];
int i = 0;
return null;
}
- static int Main ()
+ public static int Main ()
{
int a = 5;
object o;
void Iface.Method () {}
- static int Main ()
+ public static int Main ()
{
X x = new X ();
Iface f = x;
class X {
- static int Main ()
+ public static int Main ()
{
Test test = Test.A;
class X {
- static int Main ()
+ public static int Main ()
{
short a = -32768;
int b = -2147483648;
public const short s2 = (short) c;
public IntPtr p = (IntPtr) null;
- static int Main ()
+ public static int Main ()
{
return 0;
}
class T {
protected internal string s;
- static int Main() {
+ public static int Main() {
FieldInfo f = typeof(T).GetField ("s", BindingFlags.NonPublic|BindingFlags.Instance);
if (f == null)
return 2;
ss.b = 2;
s = ss;
}
- static int Main() {
+ public static int Main() {
OpCode op;
OpFlags flags;
S s;
public void A () {}
public void B () {}
- static int Main() {
+ public static int Main() {
BB bb = new BB ();
bb.A ();
public A Prop {
get { return new A(); }
}
- static int Main() {
+ public static int Main() {
PropertyInfo[] p = typeof (T).GetProperties (BindingFlags.Public| BindingFlags.NonPublic|BindingFlags.Instance);
if (p == null || p.Length != 2)
return 1;
}
class TestConflict {
- static int Main ()
+ public static int Main ()
{
MyCar car1 = new MyCar();
car1.Stop(); // calls the IAutomobile.Stop implementation
var++;
}
- static int Main ()
+ public static int Main ()
{
C c = new C ();
// ensure the argument to newarr is converted to int32 or native int
class T {
- static int Main() {
+ public static int Main() {
char[] a;
long len = 10;
a = new char [len];
return val.GetHashCode();
}
- static int Main()
+ public static int Main()
{
T t = new T ();
public new int H () {return 11;}
}
class Test {
- static public int Main () {
+ public static int Main () {
int result = 0;
B b = new B ();
A a = b;
return info.val;
}
- static int Main()
+ public static int Main()
{
MonoEnumInfo m;
}
class Run {
- static int Main ()
+ public static int Main ()
{
Iface iface;
Implementor i = new Implementor ();
Test2 (message, args);
}
- static int Main ()
+ public static int Main ()
{
Test ("TEST");
Test ("Foo", 8);
private class NestedPrivate { }
- static void Main () { }
+ public static void Main () { }
}
public class A : Public { }
[My("testclass")]
public class Test {
- static public int Main () {
+ public static int Main () {
System.Reflection.MemberInfo info = typeof (Test);
object[] attributes = info.GetCustomAttributes (false);
for (int i = 0; i < attributes.Length; i ++) {
[My(TypeCode.Empty)]
public class Test {
- static public int Main() {
+ public static int Main() {
System.Reflection.MemberInfo info = typeof (Test);
object[] attributes = info.GetCustomAttributes (false);
for (int i = 0; i < attributes.Length; i ++) {
return look.s.a;
}
- static int Main() {
+ public static int Main() {
// Compilation only test;
return 0;
}
}
}
- static int Main () {
+ public static int Main () {
// Compilation only test.
return 0;
}
return foo ();
}
- static void Main ()
+ public static void Main ()
{
Y y = new Y ();
int result = y.Hello ();
return inferior.TargetIntegerSize;
}
- static int Main ()
+ public static int Main ()
{
D d = new D ();
A, B
}
- static int Main ()
+ public static int Main ()
{
int v = Test (Foo.A);
if (v != 0)
class Test {
- static public int Main ()
+ public static int Main ()
{
X x = new X ();
Console.WriteLine (x);
class D {
- static int Main ()
+ public static int Main ()
{
//
// These tests just are compilation tests, the new property code
}
- static int Main ()
+ public static int Main ()
{
Y y = new Y ();
class Class1 {
- static int Main(string[] args)
+ public static int Main(string[] args)
{
IntPtr p = IntPtr.Zero;
return 0;
}
- static int Main ()
+ public static int Main ()
{
int v;
object o = null;
return 0;
}
- static int Main ()
+ public static int Main ()
{
int result = Test ();
Console.WriteLine ("RESULT: {0}", result);
comparer = null;
}
- static int Main ()
+ public static int Main ()
{
TestAccessToProtectedOnChildInstanceFromParent t = new TestAccessToProtectedOnChildInstanceFromParent ();
class X
{
- static int Main ()
+ public static int Main ()
{
RVA a = 10;
RVA b = 20;
class X {
const byte b = 0x0f;
- static int Main ()
+ public static int Main ()
{
int x = ~b;
byte bb = 0xf;
}
}
- static int Main ()
+ public static int Main ()
{
m ();
if (i != 1)
{
}
- static public int Main ()
+ public static int Main ()
{
MethodImplAttributes iflags = typeof (Test).GetMethod ("test").GetMethodImplementationFlags ();
return ((iflags & MethodImplAttributes.Synchronized) != 0 ? 0 : 1);
}
class T {
- static int Main () {
+ public static int Main () {
DT t = new DT ();
if (t.Ticks != 1)
return 1;
return ++x;
}
- static int Main ()
+ public static int Main ()
{
int x = 1;
int y = 0;
//
User t2=new User(new Struct(251));
- static int Main ()
+ public static int Main ()
{
Test tt = new Test ();
return 0;
}
- static int Main ()
+ public static int Main ()
{
if (Test (1) != 0)
return 1;
public class Test
{
- static int Main ()
+ public static int Main ()
{
return 0;
}
}
- static int Main ()
+ public static int Main ()
{
return 0;
}
}
}
- static void Main ()
+ public static void Main ()
{ }
}
}
class R {
- static void Main ()
+ public static void Main ()
{
}
}
// Tests that we validate the unchecked state during constatn resolution
//
class X {
- static void Main ()
+ public static void Main ()
{
unchecked {
const int val = (int)0x800B0109;
return 1;
}
- static int Main ()
+ public static int Main ()
{
return Test (1);
}
X (int a) {
}
- static void Main ()
+ public static void Main ()
{
X x = new X ();
}
long ll = (b & (l << r));
}
- static int Main ()
+ public static int Main ()
{
const byte b = 255;
const int i = b << int.MaxValue;
class X
{
- static int Main ()
+ public static int Main ()
{
// Compilation-only test.
return 0;
class X {
- static int Main (string [] args)
+ public static int Main (string [] args)
{
System.Console.WriteLine ("Hello, World");
return 0;
}
}
class Test {
- static int Main ()
+ public static int Main ()
{
B b = new B ();
{
class Test : T1
{
- static int Main()
+ public static int Main()
{
// Compilation-only test.
Foo ();
class MonoEmbed
{
- static void Main()
+ public static void Main()
{
cls c = new cls();
c.OnWhatever += new OnWhateverDelegate( Whatever );
using System;
public class Test {
- static int Main () {
+ public static int Main () {
object val1 = compare_gte(0, 0);
object val2 = compare_gte(1, 0);
object val3 = compare_gte(0, 1);
class T
{
- static void Main()
+ public static void Main()
{}
delegate void foo (object o);
}
class M {
- static int Main ()
+ public static int Main ()
{
S s = new S ();
}
class Driver {
- static int Main ()
+ public static int Main ()
{
if (! B.Test ()) return 1;
if (! E.Test ()) return 2;
enum Foo { Bar }
class T {
- static int Main ()
+ public static int Main ()
{
System.Enum e = Foo.Bar;
System.ValueType vt1 = Foo.Bar, vt2 = 1;
return 1;
}
- static void Main ()
+ public static void Main ()
{
B b = new B ();
Console.WriteLine (b.foo ());
}
}
- static int Main ()
+ public static int Main ()
{
if (Value != 10)
return 1;
[module: DebuggableAttribute (false, false)]
class TestClass {
- static int Main()
+ public static int Main()
{
Module[] moduleArray;
moduleArray = Assembly.GetExecutingAssembly().GetModules(false);
class T {
static int ret_code = 0;
- static int Main ()
+ public static int Main ()
{
try {
T t = null;
class Tests {
- static int Main () {
+ public static int Main () {
return TestDriver.RunTests (typeof (Tests));
}
e30 = 1 << 30,
e31 = 1 << 31,
}
- static void Main ()
+ public static void Main ()
{
E e = E.e1;
string s;
Environment.Exit (1);
}
- static int Main()
+ public static int Main()
{
ConditionalMethod ();
Console.WriteLine ("Succeeded");
class MainClass
{
- static int Main()
+ public static int Main()
{
TestClass ts = new TestClass ();
ts.ConditionalMethod ();
static string x, b;
- static int Main ()
+ public static int Main ()
{
x = S = b = "hlo";
return_code = 0;
}
- static int Main()
+ public static int Main()
{
ConditionalMethod ();
return return_code;
return Address;
}
- static void Main ()
+ public static void Main ()
{
Resolve (Address);
}
class Foo {
static int t_count = 0, f_count = 0;
- static int Main ()
+ public static int Main ()
{
Console.WriteLine (t && f);
if (t_count != 1)
}
}
- static void Main ()
+ public static void Main ()
{ }
}
}
class B {
- static void Main () {
+ public static void Main () {
using (Blah b = new Blah ()) {
Console.WriteLine ("...");
}
}
class B {
- static void Main () {
+ public static void Main () {
foreach (object o in new Blah ())
;
}
class T {
static Foo GetFoo () { return new Foo (); }
- static void Main ()
+ public static void Main ()
{
string s = GetFoo ().i.ToString ();
Console.WriteLine (s);
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X {
- static int Main ()
+ public static int Main ()
{
int i, j, t, k;
volatile IntPtr ip;
volatile UIntPtr uip;
- static void Main () {}
+ public static void Main () {}
}
class X {
- static void Main ()
+ public static void Main ()
{
int a;
{
}
- static void Main ()
+ public static void Main ()
{ }
}
}
return 0;
}
- static int Main ()
+ public static int Main ()
{
T t = new T ();
int result = Test (t);
{
Attribute ();
}
- static void Main () {
+ public static void Main () {
new A ().X ();
}
}
{
}
- static void Main ()
+ public static void Main ()
{ }
}
}
}
- static int Main () {
+ public static int Main () {
Nested n = new Nested ();
return n.D() == MyEnum.V ? 0 : 1;
}
return new Result (result);
}
- static int Main (string[] args)
+ public static int Main (string[] args)
{
int result = AddABunchOfInts (__arglist ( 2, 3, 4 ));
Console.WriteLine ("Answer: {0}", result);
return 2;
}
- static int Main ()
+ public static int Main ()
{
if (Test ("Hello", 1, 2, "World") != 1)
return 1;
return new C ();
}
- static void Main ()
+ public static void Main ()
{
foreach (object o in X ())
;
[Baz ((Foo) 1)] void f1() {}
[Baz (foo2 = (Foo) 2)] void f2() {}
[Baz (foo3 = (Foo) 3)] void f3() {}
- static void Main() { }
+ public static void Main() { }
}
// test for bug #56774
class T {
- static int Main () {
+ public static int Main () {
return X (1);
}
}
class X {
- static int Main ()
+ public static int Main ()
{
Rect rect = new Rect ();
rect.X += 20;
Blue = 4
};
- static int Main( )
+ public static int Main( )
{
string s = ((MultiHue)7).ToString ();
}
}
- static int Main ()
+ public static int Main ()
{
X x = new X ();
return false;
}
- static void Main () {}
+ public static void Main () {}
}
}
class X
{
- static int Main ()
+ public static int Main ()
{
if (Test.Test1.World () != 8)
return 1;
throw new InvalidOperationException ();
}
- static int Main ()
+ public static int Main ()
{
integer i = new integer (3);
double d = 4.0;
return 0;
}
- static int Main ()
+ public static int Main ()
{
if (new Y ().GetIt () () == 1 && new Y ().GetIt2 () () == 1) {
System.Console.WriteLine ("good");
class T {
- static int Main ()
+ public static int Main ()
{
switch (1) {
case 1:
class Demo {
- static int Main ()
+ public static int Main ()
{
Derived d = new Derived ();
delegate void EventHandler (object sender);
static event EventHandler FooEvent;
static void bar_f (object sender) {}
- static void Main () {
+ public static void Main () {
if (FooEvent != null)
FooEvent (null);
object bar = new EventHandler (bar_f);
unsafe class X {
static int x = 0;
- static void Main () {
+ public static void Main () {
fixed (void* p = &x) {}
fixed (void* p = &x) {}
}
using System;
public class GetElementTypeTest {
- static int Main (string[] args) {
+ public static int Main (string[] args) {
GetElementTypeTest me = new GetElementTypeTest ();
Type t = me.GetType ();
Type elementt = t.GetElementType ();
[My(TypeCode.Empty)]
[My(typeof(System.Enum))]
class T {
- static int Main() {
+ public static int Main() {
object[] a = Attribute.GetCustomAttributes (typeof (T), false);
if (a.Length != 3)
return 1;
class test {
- static int Main ()
+ public static int Main ()
{
X x = new X ();
}
class Test {
- static int Main ()
+ public static int Main ()
{
Derived d = new Derived ();
[SecurityPermission (SecurityAction.Demand, Flags = SecurityPermissionFlag.ControlEvidence, UnmanagedCode=true)]
[SecurityPermission (SecurityAction.Demand, Flags = SecurityPermissionFlag.AllFlags, UnmanagedCode=true)]
- static public int Main (string[] args)
+ public static int Main (string[] args)
{
// TODO: this will not be working for .NET 2.0 as attributes are decoded back
Type program = typeof (Program);
return 0;
}
- static int Main ()
+ public static int Main ()
{
int t = T ();
if (t != 0)
{
}
- static int Main ()
+ public static int Main ()
{
MethodInfo [] mi = typeof (D).GetMethods (BindingFlags.Instance | BindingFlags.NonPublic);
MethodInfo m = null;
X () {}
X (int x) {}
- static int Main () {
+ public static int Main () {
if (new X ().b != "static stringstring")
return 1;
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
ie.Dispose ();
}
- static int Main()
+ public static int Main()
{
D d = new D();
E e = new E();
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
static decimal DecimalValue = -90;
const decimal SmallConstValue = .02M;
- static int Main ()
+ public static int Main ()
{
Type t = typeof (ConstFields);
DecimalConstantAttribute a = (DecimalConstantAttribute) t.GetField ("ConstDecimal3").GetCustomAttributes (typeof (DecimalConstantAttribute), false)[0];
unsafe public X (sbyte *value, int startIndex, int length) {
}
- static void Main ()
+ public static void Main ()
{
new X ((sbyte*)null, 0, 10);
}
{
}
- static void Main ()
+ public static void Main ()
{
X x = new X ();
using (x)
}
class X {
- static void Main ()
+ public static void Main ()
{
Y y = new Y (1);
}
const A foo = A.x | A.y;
- static void Main () {}
+ public static void Main () {}
}
class X
{
- static int Main ()
+ public static int Main ()
{
Mapper mapper = new Mapper (delegate (int i){
return i * 12; });
class Tester {
internal static Y1 y1 = Y1.x1;
internal static Y2 y2 = Y2.x2;
- static void Main() { }
+ public static void Main() { }
}
}
using Y;
class Tester {
internal static Z z = Z.x;
- static void Main() { }
+ public static void Main() { }
}
}
}
ID = 55;
}
- static int Main () {
+ public static int Main () {
object[] attrs = typeof(X).GetCustomAttributes(typeof (X),false);
if (attrs.Length != 1)
return 2;
class Application
{
- static int Main(string[] args)
+ public static int Main(string[] args)
{
FirstOuter.FirstInner.First V1 = new FirstOuter.FirstInner.First();
FirstOuter.Second V2 = new FirstOuter.Second();
class X {
- static void Main ()
+ public static void Main ()
{
System.IFormattable foo = -1;
}
namespace Foo {
namespace Index {
public class CompoundFileReader : Bar {
- static void Main () { }
+ public static void Main () { }
}
}
}
delegate void D (out int a);
static void C (out int a) { a = 5; }
- static void Main()
+ public static void Main()
{
(new B (A)) (1, 2);
static void Test ()
{ }
- static void Main ()
+ public static void Main ()
{
X x = new X (Test);
}
{
public static int[] field = new int [] { 66 };
- static int Main()
+ public static int Main()
{
unsafe {
SS* ss = stackalloc SS [10];
static void Concat (params string [] ss) {
throw new Exception ("Overload resolution failed");
}
- static void Main () { Concat ("a", "b", "c"); }
+ public static void Main () { Concat ("a", "b", "c"); }
}
class X {
public event Y y;
- static void Main (string [] args)
+ public static void Main (string [] args)
{
X x = new X ();
x.Foo ();
{
class Class1
{
- static int Main()
+ public static int Main()
{
int test_int = 1;
TestClass testClass = new TestClass();
static int a = b = 5;
static int b = 0;
- static int Main ()
+ public static int Main ()
{
if (a != 5 || b != 0)
return 1;
System.Console.WriteLine (" " + x);
}
- static int Main ()
+ public static int Main ()
{
int ok = 0, error = 0;
[A.B()]
public class C
{
- static void Main () {}
+ public static void Main () {}
}
delegate void Foo (string x, params object [] args);
class Testee {
static void Bar (string x, params object [] args) {}
- static void Main () {
+ public static void Main () {
Foo bar = new Foo (Bar);
bar ("Hello");
bar ("Hello", "world");
[MYAttr]
partial class A {
- static void Main () {
+ public static void Main () {
}
}
public class MainClass {
- static void Main () {
+ public static void Main () {
const int size = sizeof(int);
}
}
partial class Bar
{
public Bar () {}
- static void Main ()
+ public static void Main ()
{
if (new Bar ().f == null)
throw new System.Exception ("Didn't resolve Sd.F?");
class Y {
static X x;
- static int Main ()
+ public static int Main ()
{
int total = 0;
x = new X ();
[X]
class Test {
- static void Main () { }
+ public static void Main () { }
}
class C
{
- static void Main()
+ public static void Main()
{
try {
Test ();
delegate int Foo ();
- static int Main ()
+ public static int Main ()
{
int x = t1 (1);
if (x != 1)
// This is just here to check that it compiles, but the logic is the
// same as the ones before
- static void Main2 (string[] argv)
+ public static void Main2 (string[] argv)
{
Console.WriteLine ("Test");
LiteralType.Void
};
- static void Main () {}
+ public static void Main () {}
}
class C
{
- static int Main ()
+ public static int Main ()
{
foo2 f = new foo2 ();
}
class X {
- static int Main ()
+ public static int Main ()
{
return typeof (ITest).GetFields (BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance).Length;
}
class X {
- static void Main ()
+ public static void Main ()
{
int n = 0;
public override int GetHashCode () { return 0; }
- static void Main ()
+ public static void Main ()
{
Test y = new Test ();
if (y == null)
// return 0;
// }
- static int Main ()
+ public static int Main ()
{
int v;
hello = true;
}
- static void Main ()
+ public static void Main ()
{ }
}
{
protected const int foo = Test.foo;
- static void Main () {}
+ public static void Main () {}
}
b d_var;
}
- static void Main () {}
+ public static void Main () {}
}
class Test {
- static int Main ()
+ public static int Main ()
{
X x = new X ();
Y y = new Y ();
// Compiler options: -unsafe
class T {
- static unsafe int Main () {
+ static unsafe public int Main () {
int *a = null;
int **b = &a;
if (*b == null)
class Dec {
public const decimal MinValue = -79228162514264337593543950335m;
- static void Main ()
+ public static void Main ()
{
System.Console.WriteLine ("Compiler said value is {0}", MinValue);
FieldInfo fi = typeof (Dec).GetField ("MinValue");
Foo = 20;
}
- static int Main ()
+ public static int Main ()
{
Test ();
if (Foo != 20)
class Test {
- static int Main ()
+ public static int Main ()
{
int i = 5;
switch (i) {
return new ObjectID (l);
}
- static void Main ()
+ public static void Main ()
{
ObjectID x = new ObjectID (0);
decimal y = x;
return new C (name);
}
- static void Main ()
+ public static void Main ()
{
MethodHandler a = MethodSampleA;
MethodHandler b = MethodSampleB;
return value.Name + " " + value.Value;
}
- static void Main ()
+ public static void Main ()
{
MethodHandler da = MethodSampleA;
MethodHandler db = MethodSampleB;
Console.WriteLine ("c = {0}, {1}", c.Name, c.Value);
}
- static void Main ()
+ public static void Main ()
{
MethodHandler mh = MethodSample;
public class Tester {
- static void Main ()
+ public static void Main ()
{
A a = new A (8);
B b = new B (9);
F (__arglist);
}
- static int Main ()
+ public static int Main ()
{
int result = Vararg.AddABunchOfInts (__arglist ( 2, 3, 4 ));
Console.WriteLine ("Answer: {0}", result);
int_selected = true;
}
- static int Main ()
+ public static int Main ()
{
X x = new X ();
return 0;
}
- static int Main ()
+ public static int Main ()
{
int v;
//
using System;
unsafe class X {
- static int Main ()
+ public static int Main ()
{
char *ptr = stackalloc char [10];
char *cptr = ptr;
using System;
unsafe class X {
- static int Main () {
+ public static int Main () {
int y = 20;
byte* x = (byte*)0;
x += (long)y;
}
}
- static int Main ()
+ public static int Main ()
{
if ((*get_v ())++ != 0)
return 1;
}
class TestApp{
- static void Main(string[] args){
+ public static void Main(string[] args){
LibTestAPI myapi = new LibTestAPI();
myapi.Create();
}
using System;
namespace TestCase {
public unsafe class Test {
- static int Main(string[] args) {
+ public static int Main(string[] args) {
uint[] uArr = {0, 200};
uint[] uArr2 = {0, 200};
// Compiler options: -unsafe
unsafe class T {
- static int Main () {
+ public static int Main () {
int len = 10;
int* x = stackalloc int [len];
for (int i = 0; i < len; i++)
unsafe struct X {
int x, y, z;
- static int Main ()
+ public static int Main ()
{
X* foo = null;
k = 2.0;
}
- static int Main ()
+ public static int Main ()
{
int a = 1;
uint b = 1;
// Compiler options: -r:test-419-2-lib.dll -r:test-419-3-lib.dll
class Test {
- static void Main () {
+ public static void Main () {
Provider p = new Provider ();
}
}
return 0;
}
- static int Main ()
+ public static int Main ()
{
X x = new X ();
int c;
// Compiler options: -r:test-419-3-lib.dll -r:test-419-2-lib.dll
class Test {
- static void Main () {
+ public static void Main () {
Provider p = new Provider ();
}
}
lowLevelCall (pi);
}
- static void Main ()
+ public static void Main ()
{
int i = 0;
Func (out i);
using foo = System;
class X {
- static void Main ()
+ public static void Main ()
{
foo::Console.WriteLine ("hello");
}
class X {
- static void Main ()
+ public static void Main ()
{
global::System.Console.WriteLine ("hello");
}
class X {
class A { }
- static void Main ()
+ public static void Main ()
{
globalA a = new global::A ();
System.Console.WriteLine (a.GetType ());
class A { }
class X {
- static void Main ()
+ public static void Main ()
{
A a = new global::A ();
System.Console.WriteLine (a.GetType ());
return (total == 46);
}
- static int Main ()
+ public static int Main ()
{
int [] a = new int [10];
int [] b = new int [2];
class X {
class A { }
- static void Main ()
+ public static void Main ()
{
global::A a = new globalA ();
System.Console.WriteLine (a.GetType ());
}
class X {
- static void Main ()
+ public static void Main ()
{
foo::A a = new Foo.A ();
System.Console.WriteLine (a.GetType ());
}
class X {
- static void Main ()
+ public static void Main ()
{
Foo.A a = new foo::A ();
System.Console.WriteLine (a.GetType ());
class X {
static foo::A a = new Foo.A ();
- static void Main ()
+ public static void Main ()
{
System.Console.WriteLine (a.GetType ());
}
class X {
static Foo.A a = new foo::A ();
- static void Main ()
+ public static void Main ()
{
System.Console.WriteLine (a.GetType ());
}
class X : foo::IEnumerable {
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator () { return null; }
- static void Main ()
+ public static void Main ()
{
System.Collections.IEnumerable x = new X ();
}
class X : foo::IEnumerable {
foo::IEnumerator foo::IEnumerable.GetEnumerator () { return null; }
- static void Main ()
+ public static void Main ()
{
System.Collections.IEnumerable x = new X ();
}
return total;
}
- static int Main ()
+ public static int Main ()
{
int [,] b = new int [10,10];
namespace ConsoleApplication1 {
class Program {
- static unsafe void Main(string[] args) {
+ unsafe public static void Main(string[] args) {
int[] i = new int[] { 10 };
fixed (int* p = i) {
int*[] q = new int*[] { p };
}
}
-class Test { static void Main () { } }
+class Test { public static void Main () { } }
class X {
- static void Main ()
+ public static void Main ()
{
}
public class Test
{
- static void Main ()
+ public static void Main ()
{
ValueType vt = (ValueType) 1;
IComparable ic = (IComparable) 1;
class Test
{
- static void Main ()
+ public static void Main ()
{
Foo Foo;
Foo = Foo.x;
}
class Test {
- static void Main ()
+ public static void Main ()
{
Foo foo = new Foo ();
System.Console.WriteLine (foo.GetHashCode ());
}
class Test {
- static void Main ()
+ public static void Main ()
{
Foo x = new Foo ();
x.foo ();
System.Console.WriteLine ("IInteger.Add (int d)");
}
- static int Main ()
+ public static int Main ()
{
INumber n = new Number ();
n.Add(1);
static double cast_double (object o) { return (double) o; }
static bool cast_bool (object o) { return (bool) o; }
- static int Main ()
+ public static int Main ()
{
if (cast_int ((object) -1) != -1)
return 1;
ok = true;
}
- static int Main ()
+ public static int Main ()
{
X x = new X ();
}
class X {
- static void Main () {}
+ public static void Main () {}
}
+++ /dev/null
-using System;
-using System.Runtime.InteropServices;
-
- [ComImport, GuidAttribute("E5CB7A31-7512-11D2-89CE-0080C792E5D8")]
- public class CorMetaDataDispenserExClass { }
-
- [ComImport, GuidAttribute("31BCFCE2-DAFB-11D2-9F81-00C04F79A0A3"),
- CoClass(typeof(CorMetaDataDispenserExClass))]
- public interface IMetaDataDispenserEx { }
-
-
-public class Test
-{
- public static void XXX ()
- {
- IMetaDataDispenserEx o = new IMetaDataDispenserEx();
- }
-
- public static void Main()
- {
- /* It doesn't work on Mono runtime
- IMetaDataDispenserEx o = new IMetaDataDispenserEx();
- if (o.GetType () != typeof (CorMetaDataDispenserExClass))
- return 1;
- Console.WriteLine ("OK");
- return 0;
- */
- }
-}
};
}
- static int Main () {
+ public static int Main () {
Del[] d = Make2(10);
d[0](10);
if (v != 20)
return true;
}
- static int Main ()
+ public static int Main ()
{
if (t () && t ()){
f_count--;
}
class Demo {
- static void Main ()
+ public static void Main ()
{
}
}
int prop = 0;
- static int Main()
+ public static int Main()
{
MethodInfo mi = typeof (Test).GetMethod ("set_Prop");
if (mi.GetParameters ().Length != 1)
// on captured params.
class Z {
- static void Main ()
+ public static void Main ()
{
TestPreinc (1);
TestPostinc (1);
public override int GetHashCode(){
return 1;
}
- static void Main () {}
+ public static void Main () {}
}
}
public void M4(int arg) { }
public void M4(int arg, __arglist) { }
- static void Main ()
+ public static void Main ()
{
}
}
pass = (n == 2);
}
- static int Main ()
+ public static int Main ()
{
new X (null);
return pass ? 0 : 1;
class Test {
static IEnumerable foo () { return null; }
- static void Main ()
+ public static void Main ()
{
IEnumerable f = foo ();
if (f != null)
public class test
{
- static void Main () { }
+ public static void Main () { }
}
}
}
- static int Main ()
+ public static int Main ()
{
byte b;
class T {
static int[] a = {1,2},
b = {3, 4};
- static void Main () {}
+ public static void Main () {}
}
[My1(null)]
[My2(new string[0])]
public class Test {
- static public int Main() {
+ public static int Main() {
System.Reflection.MemberInfo info = typeof (Test);
object[] attributes = info.GetCustomAttributes (false);
}
class C : B {
- static void Main () {}
+ public static void Main () {}
}
namespace Agresso.Foundation {
public class Function
{
- static void Main () {}
+ public static void Main () {}
}
public delegate void Translate(Function callback,
public class fromClass
{
- static void Main () {}
+ public static void Main () {}
}
}
\ No newline at end of file
child.Callback += new EventHandler (callback);
}
- static int Main ()
+ public static int Main ()
{
PlotMenuItem pmi = new PlotMenuItem (new EventHandler (MenuItem_Click));
pmi.Callback (null, null);
struct C
{
- static int Main ()
+ public static int Main ()
{
MethodImplAttributes iflags = typeof (A).GetConstructors()[0].GetMethodImplementationFlags ();
if ((iflags & MethodImplAttributes.InternalCall) == 0)
class X {
- static int Main ()
+ public static int Main ()
{
Console.WriteLine ("From 0 to 9");
class Base
{
public int Property { get { return 42; } }
- static void Main () {}
+ public static void Main () {}
}
// TC #1
// Compiler options: -warnaserror
class Foo {
- static int Main ()
+ public static int Main ()
{
for (;;) {
try {
throw new System.Exception ("...");
}
}
- static void Main ()
+ public static void Main ()
{
try {
i = f ();
}
}
- static void Main () {}
+ public static void Main () {}
}
}
\ No newline at end of file
}
class boot {
- static int Main ()
+ public static int Main ()
{
Derived d = new Derived ();
return d.Test ();
public class Test
{
- static int Main ()
+ public static int Main ()
{
Assembly a = Assembly.GetExecutingAssembly ();
string[] resourceNames = a.GetManifestResourceNames ();
throw new Exception ();
}
- static int Main ()
+ public static int Main ()
{
int ret = 1;
try { HandleConflict (1); }
class X {
- static void Main ()
+ public static void Main ()
{
int i = 0;
goto a;
// Same as test-515, but we're checking that there's no "unreachable code" warning either
class X {
- static void Main ()
+ public static void Main ()
{
int i = 0;
goto a;
class Foo {
- static int Main ()
+ public static int Main ()
{
int ret = 1;
try {
class Foo {
- static int Main ()
+ public static int Main ()
{
try {
f ();
return new Y ();
}
- static int Main ()
+ public static int Main ()
{
//
// String test
}
void stuff_finally () {
}
- static void Main() {
+ public static void Main() {
}
}
class Test
{
- static void Main ()
+ public static void Main ()
{
}
public int fc;
private int sp;
- static int Main()
+ public static int Main()
{
Repro r = new Repro();
r.foo();
}
class X {
- static int Main ()
+ public static int Main ()
{
MyDispose copy_a, copy_b, copy_c;
class X {
static void e(params object[] args\u03c4) {
}
- static void Main () {
+ public static void Main () {
}
}
static void True (bool b) { False (!b); }
static void False (bool b) { if (b) throw new System.Exception (); }
- static void Main ()
+ public static void Main ()
{
True (false == false);
False (false == true);
[assembly: System.Reflection.AssemblyCulture("this-culture-does-not-exist")]
class X {
- static void Main ()
+ public static void Main ()
{
}
}
using System;
class X {
- static void Main ()
+ public static void Main ()
{
UIntPtr a = (UIntPtr) 1;
class Test
{
- static void Main()
+ public static void Main()
{
}
}
\ No newline at end of file
class Test
{
- static int Main ()
+ public static int Main ()
{
//switching to a constant fixes the problem
double thisIsCausingTheProblem = 5.0;
return true;
}
- static int Main ()
+ public static int Main ()
{
return 0;
}
}
class X {
-static void Main () {
+public static void Main () {
}
}
}
}
- static void Main(string[] args)
+ public static void Main(string[] args)
{
MainClass t = new MainClass();
t [2, "foo", "doo"] = 2;
}
class X {
- static void Main ()
+ public static void Main ()
{
ByteEnum b = ByteEnum.One;
}
class X {
- static void Main () {}
+ public static void Main () {}
}
public class C
#endif
{
- static void Main () {}
+ public static void Main () {}
}
\ No newline at end of file
}
public class User {
- static void Main ()
+ public static void Main ()
{
}
}
const decimal dec = c;
}
- static int Main ()
+ public static int Main ()
{
long i = 1;
int i2 = 0xA0;
{
delegate void OneDelegate (int i);
- static void Main()
+ public static void Main()
{
OneDelegate d = new OneDelegate (TestMethod);
d.Invoke (1);
class M {
- static int Main ()
+ public static int Main ()
{
B b = new B ();
[DllImport("foo.dll")]
public static extern void printf(string format, __arglist);
- static int Main()
+ public static int Main()
{
if (typeof (Program).GetMethod ("printf").CallingConvention != CallingConventions.VarArgs)
return 1;
{
class Class1
{
- static int Main(string[] args)
+ public static int Main(string[] args)
{
MethodInfo dofoo = typeof(TestClass).GetMethod("DoFoo");
if ((dofoo.GetMethodImplementationFlags() & MethodImplAttributes.PreserveSig) == 0)
class X {
- static int Main () {
+ public static int Main () {
try {
switch (0) {
default:
class Program
{
- static void Main (string [] args)
+ public static void Main (string [] args)
{
using (StringWriter stringWriter = new StringWriter ()) {
}
class Foo {
- static void Main ()
+ public static void Main ()
{
int a = 0;
int b = 5;
public class TestCase
{
- static int Main ()
+ public static int Main ()
{
int i = 0;
{
class Program
{
- static int Main ()
+ public static int Main ()
{
IExtContainer e = null;
ObjectContainerBase b = null;
class Program
{
- static void Main ()
+ public static void Main ()
{
IA a = null;
IB b = null;
class Program
{
- static int Main ()
+ public static int Main ()
{
MyColor [] c = new MyColor [1];
c [0] += new MyColor (1.3F);
class Program
{
- static int Main ()
+ public static int Main ()
{
int ctc_f = 0;
return 0;
}
- static int Main ()
+ public static int Main ()
{
int v;
v = test_explicit ();
class X
{
- static int Main ()
+ public static int Main ()
{
X x = new X ();
return x.Do ("a", "b", "c");
;
}
- static void Main() {}
+ public static void Main() {}
}
public class Test
{
- static int Main ()
+ public static int Main ()
{
var v = typeof (Test).Assembly.GetName ().Version;
if (v.Major != 2)
return dict [name] = value;
}
- static void Main ()
+ public static void Main ()
{
SetDictionaryValue (null, new SymbolId (), 1);
}
class X {
- static int Main ()
+ public static int Main ()
{
Console.WriteLine ("From 0 to 9");
int i;
#endif
#else
class X {
- static int Main ()
+ public static int Main ()
{
#if (TEST)
ns5.Y y = new ns5.Y ();
{
static Strct* ptr = null;
- static int Main ()
+ public static int Main ()
{
Strct* values = ptr;
values++;
}
}
- static int Main ()
+ public static int Main ()
{
object[] o = typeof (ImplementingExplicitInterfacesMembers).GetMethods (BindingFlags.NonPublic | BindingFlags.Instance);
foreach (MethodInfo mi in o) {
class Program
{
- static int Main ()
+ public static int Main ()
{
BindingFlags flags = BindingFlags.NonPublic | BindingFlags.Instance |
BindingFlags.DeclaredOnly;
class Program
{
- static int Main ()
+ public static int Main ()
{
Assembly a = Assembly.GetExecutingAssembly ();
var an = a.GetName ();
remove { int remove = 1; }
}
- static int Main ()
+ public static int Main ()
{
return 0;
}
public class Z
{
- static void Main ()
+ public static void Main ()
{
}
}
return false;
}
- static void Main ()
+ public static void Main ()
{
}
return;
}
- static int Main ()
+ public static int Main ()
{
value = 0;
And ();
class X
{
- static void Main ()
+ public static void Main ()
{
while (true) {
if (true)
return (int [,,]) null;
}
- static int Main ()
+ public static int Main ()
{
return 0;
}
A (ref a);
}
- static int Main ()
+ public static int Main ()
{
int a = 10;
}
class X {
- static void Main ()
+ public static void Main ()
{
A a = new A ();
value = new B (1);
}
- static int Main ()
+ public static int Main ()
{
A o;
Foo (out o);
return;
}
- static void Main () {
+ public static void Main () {
Y y = new Y ();
((I) y ).a ();
}
}
- static void Main ()
+ public static void Main ()
{
Type t = (Type) null;
}
int a = Location.Null;
}
- static void Main () {}
+ public static void Main () {}
}
{
}
- static void Main ()
+ public static void Main ()
{
int loop = 0;
object x = (N.B) N;
}
- static void Main ()
+ public static void Main ()
{
}
}
const EX myconst = EX.a;
- static void Main ()
+ public static void Main ()
{
}
}
using System;
class X {
- static int Main ()
+ public static int Main ()
{
bool one = false, two = false;
TestOr (var);
}
- static void Main ()
+ public static void Main ()
{
Test (false);
Test (true);
static void a (bool e, bool v) { if (e != v) throw new Exception ("unexpected value"); }
static void c (int e) { if (e != calls) throw new Exception ("call count mismatch: expected " + e + " but got " + calls); }
static bool f () { throw new Exception ("not short circuited out"); }
- static void Main ()
+ public static void Main ()
{
// short circuit out f ()
a (false, false && f ());
throw new Exception ();
}
- static void Main ()
+ public static void Main ()
{
test_while (100);
test_do_while (100);
using System.Threading;
class Fail {
- static void Main () {
+ public static void Main () {
string a = "";
a += 0 + "A" + 1 + "B" + 2;
EventHandler t = delegate {
set { if (!got || value != "A1B2") throw new System.Exception (); }
}
- static void Main ()
+ public static void Main ()
{
(new Foo ()).s += "A" + 1 + "B" + 2;
}
}
class T {
- static int Main ()
+ public static int Main ()
{
Blah b = new Blah (Blah.Operator.A);
return -1;
}
- static int Main ()
+ public static int Main ()
{
Identifier a = null;
string b = "a";
class PointerArithmeticTest
{
- unsafe static int Main()
+ unsafe public static int Main()
{
try {
return CheckAdd((byte*)(-1), -1);
return d == _value;
}
- static int Main ()
+ public static int Main ()
{
Program p = new Program ();
if (p.Test_2 ())
return (uint) ptr;
}
- static int Main ()
+ public static int Main ()
{
if (IntPtr.Size < 8) {
if (CastUIntPtrToInt64 (new UIntPtr (uint.MaxValue)) != uint.MaxValue)
return new S ();
}
- static int Main ()
+ public static int Main ()
{
object a = new S ();
receiver (new S ());
class App
{
- static void Main ()
+ public static void Main ()
{
}
}
\ No newline at end of file
class Program
{
- static unsafe int Main ()
+ static unsafe public int Main ()
{
return Test ((sbyte*) (-1));
}
}
}
- static int Main ()
+ public static int Main ()
{
D d = new D ();
byte b = 1;
class Goo
{
- static void Main ()
+ public static void Main ()
{
string s = new Foo () ["foo"];
}
throw new ApplicationException ("1");
}
- static int Main ()
+ public static int Main ()
{
C.Method (); // Only checks that DEBUG is defined in second file
public class MySubClass : Iface
{
- static int Main ()
+ public static int Main ()
{
MySubClass m = new MySubClass ();
m [1] = true;
return 0;
}
- static int Main ()
+ public static int Main ()
{
FillSingle ();
FillDouble ();
public class Test
{
- static void Main ()
+ public static void Main ()
{
}
#endif
class Test {
- static void Main ()
+ public static void Main ()
{
new Bar ();
}
class Test
{
- static void Main ()
+ public static void Main ()
{
E e = 1 - 2 + 1;
}
class C
{
- static int Main ()
+ public static int Main ()
{
return Bar (null) ? 1 : 0;
}
get { return null; }
}
- static void Main ()
+ public static void Main ()
{
}
}
throw new ArgumentException ("fails 4");
}
- static int Main ()
+ public static int Main ()
{
if (Double.NaN < 0 || Double.NaN < 0)
throw new ArgumentException ("passes");
class X {
- static int Main ()
+ public static int Main ()
{
if ("Hello" != A.Hello.ToString ())
return 1;
{
class Program
{
- static void Main ()
+ public static void Main ()
{
// initialise so no null errors
class Test
{
- static void Main ()
+ public static void Main ()
{
string s = "test me";
foreach (char c in s)
{
class Test
{
- static void Main () { }
+ public static void Main () { }
}
}
#endregion
static int* the_ptr = (int*) 0xdeadbeaf;
static int** the_pptr = (int**) 0xdeadbeaf;
- static void Main ()
+ public static void Main ()
{
Console.WriteLine ("TEST: {0:x}", new IntPtr (the_pptr).ToInt64 ());
class Program
{
- static int Main ()
+ public static int Main ()
{
string basedir = BaseDirectory;
}
class C {
- static void Main () { S.f (null); }
+ public static void Main () { S.f (null); }
}
}
class Z {
- static int Main ()
+ public static int Main ()
{
Y y = new Y ();
X x = new X ();
class Program
{
- static void Main ()
+ public static void Main ()
{
}
}
return ushort.MaxValue;
}
- static void Main ()
+ public static void Main ()
{
}
}
this.b = 2;
}
- static void Main ()
+ public static void Main ()
{
S s = new S (1);
}
Console.WriteLine (TypedReference.ToObject (iter.GetNextArg ()));
}
- static unsafe void Main (string[] args)
+ unsafe public static void Main (string[] args)
{
ArglistMethod (__arglist (1, 2, 3));
}
class X {
- static void Main ()
+ public static void Main ()
{
MethodSignature ms = new MethodSignature ("hello", null, null);
class Hello : IFoo
{
- static void Main ()
+ public static void Main ()
{
IFoo f = new Hello ();
int i = f.GetHashCode ();
{
}
- static void Main ()
+ public static void Main ()
{
}
}
class X
{
- static int Main ()
+ public static int Main ()
{
Type t = typeof (S);
if ((t.Attributes & TypeAttributes.BeforeFieldInit) == 0)
}
}
- static int Main ()
+ public static int Main ()
{
// We only test that this compiles.
{
class Program
{
- static void Main ()
+ public static void Main ()
{
Parent pr = new Child();
((Child)pr).OnExample();
class Program
{
- static int Main ()
+ public static int Main ()
{
Type t = typeof (Control);
MethodInfo m = t.GetMethod ("set_Foo");
((IF)ia).Prop = 3;
}
- static void Main ()
+ public static void Main ()
{
S s = new S ();
object o = s;
class Test {
- static int Main ()
+ public static int Main ()
{
Concrete c = new Concrete ();
return d (55);
}
- static int Main ()
+ public static int Main ()
{
int r = new Demo ().GetPhones ();
if (r != 55)
class X {
#if Blah
#else
- static int Main ()
+ public static int Main ()
{
#endif
string s = @"Hola\";
}
}
- public static unsafe int Main ()
+ unsafe public static int Main ()
{
TValue[] values = new TValue[10];
values[0] = new TValue (0L);
}
public class Driver
{
- static int Main ()
+ public static int Main ()
{
var v = Test.Set (new C ());
Console.WriteLine (v.Foo);
class driver {
- static int Main ()
+ public static int Main ()
{
Z a = new Z ();
Z b = new Z ();
class Program
{
- static void Main ()
+ public static void Main ()
{
}
}
\ No newline at end of file
public Foo foo;
}
- public unsafe static void Main ()
+ unsafe public static void Main ()
{
Console.WriteLine (sizeof (Foo));
}
[Derived ()]
class T {
- static void Main () {}
+ public static void Main () {}
}
i *= 3;
}
- static int Main ()
+ public static int Main ()
{
new StaticDelegateWithSameNameAsInstance ().StaticCallback ();
A = 1
}
- static int Main ()
+ public static int Main ()
{
int one = 1;
int two = 2;
public class Test
{
- static void Main ()
+ public static void Main ()
{
Foo fu = new Foo (null);
}
class Test
{
- static int Main ()
+ public static int Main ()
{
if (typeof (Foo).GetProperty ("Bar") != null)
return 1;
class a
{
- static int Main (string[] args)
+ public static int Main (string[] args)
{
First t = (First)new Third ();
if (t ["test"] != "Second")
return true;
}
- static int Main ()
+ public static int Main ()
{
if (!IntCasting ())
return 1;
class Program
{
- static int Main ()
+ public static int Main ()
{
B b = new B ();
if (b.Message != "OK")
class Program
{
- static void Main ()
+ public static void Main ()
{
Action action = () => Console.WriteLine (1);
action += null;
//
class X {
- static int Main ()
+ public static int Main ()
{
object o = null;
ret
}
+ .method public hidebysig static void Test(object o, class ['missing-lib']XX o2, [opt] object o3) cil managed
+ {
+ .param [2] = nullref
+ ret
+ }
+
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
var t = typeof (IMemberDelayed);
}
- static void Main ()
+ public static void Main ()
{
}
}
class Program
{
- static int Main ()
+ public static int Main ()
{
unsafe {
MyStructure structure = new MyStructure ();
{
}
}
- static int Main ()
+ public static int Main ()
{
new Bar (new Foo ());
return 0;
class X {
- static public int Main (string [] args)
+ public static int Main (string [] args)
{
int a, b, c, d;
class Y : X, A {
- static int Main ()
+ public static int Main ()
{
Y y = new Y ();
unsafe class Program
{
- unsafe static int Main ()
+ unsafe public static int Main ()
{
float* to = stackalloc float[2];
to[0] = to[1] = float.MaxValue;
static class X
{
- static int Main ()
+ public static int Main ()
{
IS a = new D ();
int r = a[1];
class Program
{
- static int Main ()
+ public static int Main ()
{
System.AppDomain.CurrentDomain.TypeResolve += new ResolveEventHandler (CurrentDomain_TypeResolve);
System.Type intType = System.Type.GetType ("System.Int32");
class Program
{
- static void Main ()
+ public static void Main ()
{
Int32 a = new Int32 ();
a.Value = 6;
[C]
class Foo
{
- static void Main ()
+ public static void Main ()
{
}
}
class Test : IAAA, IBBB
{
- static void Main ()
+ public static void Main ()
{
Test cmd = new Test ();
IZZZ context = new Context ();
class Program
{
- static void Main ()
+ public static void Main ()
{
S s;
s.Test ();
public class Test
{
- static void Main ()
+ public static void Main ()
{
S s;
s.s2.v = 9;
}
class DelegateTest {
- static int Main () {
+ public static int Main () {
return 0;
}
}
{
}
- static void Main ()
+ public static void Main ()
{
}
}
\ No newline at end of file
public class A
{
- static int Main ()
+ public static int Main ()
{
var a = new A ();
a.Test ();
class Ghost {
- static int Main ()
+ public static int Main ()
{
int Ghost = 0;
{
}
- static void Main ()
+ public static void Main ()
{
A<string> pp = null;
Foo (pp, (object s, string e) => { });
class ConditionalPromotions
{
+ public static int Test (bool condition, short value)
+ {
+ return condition ? -1 : value;
+ }
+
public static int Main(string[] args)
{
var r1 = args.Length > 0 ? 1 : (short)1;
class X {
static UnmanagedType UnmanagedType;
- static int Main ()
+ public static int Main ()
{
UnmanagedType = (UnmanagedType) 0;
\r
class Program\r
{\r
- static int Main ()\r
+ public static int Main ()\r
{\r
string s = @"a\r
\r
--- /dev/null
+namespace Test
+{
+ public interface IInterface
+ {
+ string Get (string key, string v);
+ int Get (string key, int v);
+ }
+
+ public class BaseClass
+ {
+ public string Get (string key, string v)
+ {
+ return v;
+ }
+
+ public int Get (string key, int v)
+ {
+ return 0;
+ }
+ }
+
+ public class Subclass : BaseClass, IInterface
+ {
+ public static void Main ()
+ {
+ new Subclass ();
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+public abstract class A : IDisposable
+{
+ public int i;
+
+ public virtual void Dispose ()
+ {
+ ++i;
+ }
+}
+
+public abstract class B : A
+{
+ private new void Dispose ()
+ {
+ throw new ApplicationException ("B");
+ }
+}
+
+public class C : B
+{
+ public static int Main ()
+ {
+ var c = new C ();
+ c.Dispose ();
+ if (c.i != 1)
+ return 1;
+
+ return 0;
+ }
+
+ public override void Dispose ()
+ {
+ base.Dispose ();
+ }
+}
+
--- /dev/null
+using System;
+
+public class Outer
+{
+ public enum Inner
+ {
+ ONE,
+ TWO
+ }
+}
+
+public class TypeHiding
+{
+
+ public static bool Test1 (Outer Outer)
+ {
+ return 0 == Outer.Inner.ONE;
+ }
+
+ public static bool Test2 ()
+ {
+ Outer Outer = null;
+ return 0 == Outer.Inner.ONE;
+ }
+
+ public static void Main ()
+ {
+ }
+}
\ No newline at end of file
--- /dev/null
+.assembly extern mscorlib
+{
+}
+
+.assembly 'test-858-lib'
+{
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+
+.module 'test-858-lib.dll'
+
+.class public auto ansi beforefieldinit 'Foo'
+ extends [mscorlib]System.Object
+ {
+
+ .method public hidebysig specialname rtspecialname
+ instance default void .ctor () cil managed
+ {
+ ldarg.0
+ call instance void valuetype [mscorlib]'System.Object'::.ctor()
+ ret
+ }
+
+ .method public virtual hidebysig newslot specialname
+ instance default string 'Monkey_Jump' () cil managed
+ {
+ ldstr "foo"
+ ret
+ }
+
+ .property specialname rtspecialname string Message ()
+ {
+ .get instance default string 'Foo'::'Monkey_Jump' ()
+ }
+}
+
+.class public auto ansi beforefieldinit 'Bar'
+ extends Foo
+ {
+ .method public hidebysig specialname rtspecialname
+ instance default void .ctor () cil managed
+ {
+ ldarg.0
+ call instance void class 'Foo'::.ctor()
+ ret
+ }
+
+ .method public virtual hidebysig specialname
+ instance default string 'Boston' () cil managed
+ {
+ ldstr "bar"
+ ret
+ }
+
+ .property specialname rtspecialname string Message ()
+ {
+ .get instance default string 'Bar'::'Boston' ()
+ }
+}
+
+.class public auto ansi beforefieldinit C
+ extends [mscorlib]System.Object
+{
+ .method public hidebysig specialname instance int32
+ get_Value() cil managed
+ {
+ .locals init (int32 V_0)
+ IL_0000: ldc.i4.3
+ IL_0001: stloc.0
+ IL_0002: br.s IL_0004
+
+ IL_0004: ldloc.0
+ IL_0005: ret
+ }
+
+ .method public hidebysig specialname instance void
+ add_Arg(bool arg) cil managed
+ {
+ ret
+ }
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ ldarg.0
+ call instance void [mscorlib]System.Object::.ctor()
+ ret
+ }
+}
+
+
+
--- /dev/null
+// Compiler options: -r:test-858-lib.dll
+
+using System;
+
+class X
+{
+ public static int Main ()
+ {
+ Bar bar = new Bar ();
+ if (bar.Message != "bar")
+ return 1;
+
+ Foo foo = new Foo ();
+ if (foo.Message != "foo")
+ return 2;
+
+ C c = new C ();
+ c.get_Value ();
+ c.add_Arg (false);
+
+ Console.WriteLine ("Test ok");
+ return 0;
+ }
+}
--- /dev/null
+.assembly extern mscorlib
+{
+}
+
+.assembly 'test-859-lib'
+{
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+
+.module 'test-859-lib.dll'
+
+// Import flag enables more magic
+
+.class interface public auto ansi import C
+{
+ .method public hidebysig newslot specialname virtual abstract
+ instance object
+ get_Value([opt] object a) runtime managed preservesig internalcall
+ {
+ }
+
+ .property object Value(object)
+ {
+ .get instance object C::get_Value(object)
+ }
+
+ .method public hidebysig newslot specialname virtual abstract
+ instance void
+ set_Value2([opt] object a, [opt] object b) runtime managed preservesig internalcall
+ {
+ }
+
+ .property object Value2(object)
+ {
+ .set instance void C::set_Value2(object, object)
+ }
+
+}
--- /dev/null
+// Compiler options: -r:test-859-lib.dll
+
+using System;
+
+class X
+{
+ void Test_PropertyOptionalParameters (C c)
+ {
+ // need to just run verifier on the method
+ if (c == null)
+ return;
+
+ Console.WriteLine (c.Value);
+ c.Value2 = 1;
+ }
+
+ public static int Main ()
+ {
+ var x = new X ();
+ x.Test_PropertyOptionalParameters (null);
+
+ return 0;
+ }
+}
public int get_two () { return 2; }
}
- static int Main ()
+ public static int Main ()
{
XA x = new XA ();
s. Split ('a');
}
- static int Main ()
+ public static int Main ()
{
string s = "";
return new X (a);
}
- static int Main ()
+ public static int Main ()
{
X [] x = { new X (40), F (10) };
class X {
- static public int Main (string [] args)
+ public static int Main (string [] args)
{
decimal a, b, c, d;
}
public class Blah {
- static int Main ()
+ public static int Main ()
{
return 0;
}
static public void MyPublic () { }
static void MyPrivate () {}
- static int Main ()
+ public static int Main ()
{
Type myself = typeof (Test);
BindingFlags bf = BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public;
public class Test {
- static int Main () {
+ public static int Main () {
Derived1 d1 = new Derived1 ();
Derived2 d2 = new Derived2 ();
Base b1 = d1;
{
}
- static int Main ()
+ public static int Main ()
{
X x = new X ();
{
public class A
{
- static int Main ()
+ public static int Main ()
{
return 0;
}
class X {
- static int Main ()
+ public static int Main ()
{
return 0;
}
B
}
- static int Main ()
+ public static int Main ()
{
int v = 1;
object foo = (v + A.a);
//
// DO NOT ADD ANYTHING ELSE TO THIS TEST
//
- static int Main ()
+ public static int Main ()
{
int a;
delegate void S ();
class X {
- static int Main ()
+ public static int Main ()
{
int a = 1;
Console.WriteLine ("A is = " + a);
delegate void S ();
class X {
- static void Main ()
+ public static void Main ()
{
int a = 1;
S b = delegate {
delegate void S ();
class X {
- static void Main ()
+ public static void Main ()
{
int a = 1;
S b = delegate {
delegate void S ();
class X {
- static int Main ()
+ public static int Main ()
{
int i;
S b = null;
delegate void S ();
class X {
- static int Main ()
+ public static int Main ()
{
int a = 1;
if (a != 1)
delegate void D ();
class X {
- static int Main ()
+ public static int Main ()
{
int a = 0;
D d1 = delegate {
//
// DO NOT ADD ANYTHING ELSE TO THIS TEST
//
- static int Main ()
+ public static int Main ()
{
int a = 2;
int b = 1;
static int gt, gj;
- static int Main ()
+ public static int Main ()
{
int times = 0;
}
}
- static int Main ()
+ public static int Main ()
{
S s = new S ();
s.Test ();
Hello (u);
}
- static void Main ()
+ public static void Main ()
{
X x = new X ();
x.Test (3);
Hello (u);
}
- static void Main ()
+ public static void Main ()
{
X x = new X ();
x.Test (3);
foo (t);
}
- static void Main ()
+ public static void Main ()
{
X x = new X ();
x.Test (3);
class X
{
- static void Main ()
+ public static void Main ()
{
Foo foo = new Foo (3);
foreach (Foo bar in foo.Test (new Foo (8)))
};
}
- static void Main ()
+ public static void Main ()
{
X x = new X ();
x.Test (3, Math.PI, 1 << 8);
}
}
- static void Main ()
+ public static void Main ()
{
foreach (int a in Test (5))
Console.WriteLine (a);
class X
{
- static void Main ()
+ public static void Main ()
{
Test ("Hello World", 8);
}
}
}
- static void Main ()
+ public static void Main ()
{
Test test = new Test ();
Foo foo = test;
delegate void F (params int[] x);
class X {
- static int Main ()
+ public static int Main ()
{
// This should create an AnonymousMethod with the implicit argument
D d1 = delegate {};
yield return a;
}
- static int Main ()
+ public static int Main ()
{
X x = new X ();
long sum = 0;
class X
{
- static void Main ()
+ public static void Main ()
{
World<X> world = new World<X> ();
world.Test (new X ());
};
}
- static void Main ()
+ public static void Main ()
{ }
}
SomeMethod (delegate (Int32 a) { return a; });
}
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static void Main ()
+ public static void Main ()
{
Test<string>.Hello ("World", 3.1415F);
}
{
public A(TestFunc<int> func) { }
- static void Main ()
+ public static void Main ()
{ }
}
class X {
- static int Main ()
+ public static int Main ()
{
ArrayList a = new ArrayList ();
for (int i = 0; i < 10; i++)
delegate void D ();
class X {
- static void Main ()
+ public static void Main ()
{
X x = new X (1);
X y = new X (100);
}
}
- static void Main ()
+ public static void Main ()
{
}
}
{
delegate void D ();
- static int Main ()
+ public static int Main ()
{
MyClass mc = null;
class Program {
- static int Main ()
+ public static int Main ()
{
var x = new Foo<int> ();
x.Handler += null;
class Program
{
- static int Main ()
+ public static int Main ()
{
var x = new Foo<int> ();
return x.ContainsAll (new [] { 4, 6, 78 }) ? 0 : 1;
{
}
- static void Main ()
+ public static void Main ()
{
T t;
class Test
{
- static int Main ()
+ public static int Main ()
{
Action<int, int, int> test = (x, y, z) => {
int i = x + y + z;
class Test
{
- static void Main ()
+ public static void Main ()
{
}
public class Driver
{
- static int Main ()
+ public static int Main ()
{
new Driver().Repro ();
return 0;
}
}
- static void Main (string[] args)
+ public static void Main (string[] args)
{
}
}
df = delegate { foo (g.def ()); };
}
- static int Main ()
+ public static int Main ()
{
cf<int> ();
df ();
class M
{
- static void Main ()
+ public static void Main ()
{
IFoo<int> x = new X<int> ();
x.Test ();
delegate void D ();
class X {
- static void Main ()
+ public static void Main ()
{
X x = new X (1);
X y = new X (100);
public class TestCase
{
- static void Main ()
+ public static void Main ()
{
Test (new IList<int> [] { new int[] { 1, 2, 3 } });
}
static class Test
{
- static int Main ()
+ public static int Main ()
{
var fs = new List<Func<int>> ();
class X {
static bool called = false;
- static int Main ()
+ public static int Main ()
{
Button b = new Button ();
delegate void A ();
class DelegateTest {
- static void Main (string[] argv)
+ public static void Main (string[] argv)
{
Console.WriteLine ("Test");
delegate void S ();
class X {
- static int Main ()
+ public static int Main ()
{
int i;
int a = 0;
class X {
static D GlobalStoreDelegate;
- static void Main ()
+ public static void Main ()
{
D d = MainHost ();
class X {
- static int Main ()
+ public static int Main ()
{
X x = new X();
x.M ();
class X {
static D r;
- static void Main ()
+ public static void Main ()
{
D d = T ();
class X {
- static int Main ()
+ public static int Main ()
{
X x = new X();
x.M ();
class X {
- static void Main ()
+ public static void Main ()
{
D x = T (1);
class X {
- static int Main ()
+ public static int Main ()
{
D x = T (1);
class X {
- static int Main ()
+ public static int Main ()
{
X x = new X();
x.M (10);
}
class DelegateTest {
- static void Main (string[] argv)
+ public static void Main (string[] argv)
{
Console.WriteLine ("Test");
delegate void D (X o);
static event D E;
- static void Main()
+ public static void Main()
{
bool running = true;
class X {
delegate object test (MethodInfo x);
- static void Main ()
+ public static void Main ()
{
DoCall (delegate(MethodInfo from) {
return from.Invoke (null, new object[] { from });
static void doit (int v) {
Console.WriteLine (v);
}
- static void Main () {
+ public static void Main () {
Do[] arr = new Do [5];
for (int i = 0; i < 5; ++i) {
arr [i] = delegate {doit (i);};
Console.WriteLine(s.Value);
}
- static void Main(string[] args)
+ public static void Main(string[] args)
{ SpaceLeak();
}
}
simple ();
}
- static void Main ()
+ public static void Main ()
{
X x = new X ();
x.Test (3);
simple ();
}
- static void Main ()
+ public static void Main ()
{
X x = new X ();
x.Test (3);
simple ();
}
- static void Main ()
+ public static void Main ()
{
X x = new X ();
x.Test (3);
simple ();
}
- static void Main ()
+ public static void Main ()
{
X x = new X ();
x.Test (3);
simple ();
}
- static void Main ()
+ public static void Main ()
{
X x = new X ();
X.Test (3);
};
}
- static void Main ()
+ public static void Main ()
{
X x = new X ();
x.Test (3);
simple ();
}
- static void Main ()
+ public static void Main ()
{
X x = new X ();
x.Test (3);
static int i = 1;
static readonly A a = new A(delegate(int a) { i = a; });
- static int Main ()
+ public static int Main ()
{
return i;
}
class X
{
- static void Main ()
+ public static void Main ()
{
World world = new World ();
world.Test (5);
class X
{
- static void Main ()
+ public static void Main ()
{
World world = new World ();
world.Test (5);
class X
{
- static void Main ()
+ public static void Main ()
{
World world = new World ();
world.Test (5);
class X
{
- static int Main ()
+ public static int Main ()
{
Test test = new Test ();
}
}
- static int Main ()
+ public static int Main ()
{
IEnumerator enumerator = GetIt (new int [] { 1, 2, 3});
enumerator.MoveNext ();
class X
{
- static void Main ()
+ public static void Main ()
{
Test test = new Test (9);
Console.WriteLine (test);
class X
{
- static void Main ()
+ public static void Main ()
{
Foo foo = new Foo (3);
foo.Test (new Foo (8));
class X
{
- static void Main ()
+ public static void Main ()
{
Foo foo = new Foo ();
foo.Test ();
class Observable {
static QueueHandler Queue;
- static void Main (string[] args) {
+ public static void Main (string[] args) {
Queue += (QueueHandler) delegate { System.Console.WriteLine ("OK"); };
}
}
\ No newline at end of file
this.a = a;
}
- static void Main()
+ public static void Main()
{
}
}
}
}
- static int Main ()
+ public static int Main ()
{
IEnumerator enumerator = GetIt (new int [] { 4, 8, 9});
enumerator.MoveNext ();
};
}
- static void Main () {}
+ public static void Main () {}
}
{
}
- static int Main (string[] args)
+ public static int Main (string[] args)
{
TestClass c = new TestClass (1);
return 0;
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
\ No newline at end of file
delegate void D (object o);
class T {
- static void Main ()
+ public static void Main ()
{
D d = delegate (object state) {
try {
};
}
- static int Main ()
+ public static int Main ()
{
C o = new C ();
o.X ();
}
}
- static int Main ()
+ public static int Main ()
{
EventHandlers handlers = new EventHandlers ();
handlers.Handler = handlers.DoSomethingEventHandler;
{
delegate void D ();
- static int Main ()
+ public static int Main ()
{
byte* a = null;
D d = delegate () {
return Get (i) ();
}
- static int Main ()
+ public static int Main ()
{
if (Run (0) != 42)
return 1;
class Program
{
- static void Main(string[] args)
+ public static void Main(string[] args)
{
}
}
a ();
}
- static int Main ()
+ public static int Main ()
{
new C ().Test ();
return 0;
static int pos;
- static int Main ()
+ public static int Main ()
{
pos = 0;
TestAsync ();
class Program
{
- static int Main ()
+ public static int Main ()
{
var mre = new ManualResetEvent (false);
var mre_l = new ManualResetEvent (false);
class Program
{
- static int Main ()
+ public static int Main ()
{
var mre_l = new ManualResetEvent (false);
var mre = new ManualResetEvent (false);
return 2;
}
- static int Main ()
+ public static int Main ()
{
if (Foo (async (string str) => (short) 1) != 2)
return 1;
class C
{
- static int Main ()
+ public static int Main ()
{
Struct s = new Struct ("1");
var t = s.AsyncMethod ();
var t2 = Task.Run (() => { return t; });
}
- static void Main ()
+ public static void Main ()
{
}
}
return await task.Result;
}
- static int Main ()
+ public static int Main ()
{
var t2 = Run (() => Task<int>.Factory.StartNew (() => 5));
throw new ApplicationException();
}
- static int Main()
+ public static int Main()
{
bool canceled = false;
var t = TestCanceled().ContinueWith(l =>
class Program
{
- static int Main()
+ public static int Main()
{
var b = new B ();
if (b.Foo (3).Result != 4)
return 0;
}
- static int Main ()
+ public static int Main ()
{
var m = typeof (C).GetMethod ("AsyncMethod");
var attr = m.GetCustomAttribute<AsyncStateMachineAttribute> ();
public class CompilerBug
{
- static void Main ()
+ public static void Main ()
{
var res = Foo ().Result;
Console.WriteLine (res);
--- /dev/null
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+
+public class AmbiguousGeneric
+{
+ public async void NestedVoidTestSuccess ()
+ {
+ await Run2 (async () => await ReturnOne ());
+ }
+
+ static Task<int> ReturnOne ()
+ {
+ return Task.Run (() => 1);
+ }
+
+ Task Run2 (Func<Task> arg)
+ {
+ return null;
+ }
+
+ Task Run2<T> (Func<T> arg)
+ {
+ return null;
+ }
+
+ public static void Main ()
+ {
+ }
+}
\ No newline at end of file
return null;
}
- static void Main() {}
+ public static void Main() {}
}
--- /dev/null
+using System;
+using System.Runtime.InteropServices;
+
+ [ComImport, GuidAttribute("E5CB7A31-7512-11D2-89CE-0080C792E5D8")]
+ public class CorMetaDataDispenserExClass { }
+
+ [ComImport, GuidAttribute("31BCFCE2-DAFB-11D2-9F81-00C04F79A0A3"),
+ CoClass(typeof(CorMetaDataDispenserExClass))]
+ public interface IMetaDataDispenserEx { }
+
+
+public class Test
+{
+ public static void XXX ()
+ {
+ IMetaDataDispenserEx o = new IMetaDataDispenserEx();
+ }
+
+ public static void Main()
+ {
+ /* It doesn't work on Mono runtime
+ IMetaDataDispenserEx o = new IMetaDataDispenserEx();
+ if (o.GetType () != typeof (CorMetaDataDispenserExClass))
+ return 1;
+ Console.WriteLine ("OK");
+ return 0;
+ */
+ }
+}
<?xml version="1.0" encoding="utf-8"?>
<symbols>
<files>
- <file id="1" name="support-test-debug-04.cs" checksum="b9b719e8fba5bec23da52975bc38e6ce" />
- <file id="2" name="test-debug-04.cs" checksum="a57ebe1403fe320f2a98377745f7f0d1" />
+ <file id="1" name="test-debug-04.cs" checksum="a57ebe1403fe320f2a98377745f7f0d1" />
+ <file id="2" name="support-test-debug-04.cs" checksum="b9b719e8fba5bec23da52975bc38e6ce" />
</files>
<methods>
<method token="0x6000001">
</method>
<method token="0x6000002">
<sequencepoints>
- <entry il="0x0" row="7" col="2" file_ref="1" hidden="false" />
- <entry il="0x8" row="9" col="2" file_ref="2" hidden="false" />
+ <entry il="0x0" row="9" col="2" file_ref="1" hidden="false" />
+ <entry il="0x8" row="7" col="2" file_ref="2" hidden="false" />
</sequencepoints>
<locals />
<scopes />
</method>
<method token="0x6000003">
<sequencepoints>
- <entry il="0x0" row="12" col="2" file_ref="1" hidden="false" />
- <entry il="0x8" row="14" col="2" file_ref="2" hidden="false" />
- <entry il="0x10" row="14" col="2" file_ref="1" hidden="false" />
- <entry il="0x16" row="15" col="2" file_ref="1" hidden="false" />
- <entry il="0x17" row="16" col="2" file_ref="1" hidden="false" />
+ <entry il="0x0" row="14" col="2" file_ref="1" hidden="false" />
+ <entry il="0x8" row="12" col="2" file_ref="2" hidden="false" />
+ <entry il="0x10" row="14" col="2" file_ref="2" hidden="false" />
+ <entry il="0x16" row="15" col="2" file_ref="2" hidden="false" />
+ <entry il="0x17" row="16" col="2" file_ref="2" hidden="false" />
</sequencepoints>
<locals />
<scopes />
</method>
<method token="0x6000004">
<sequencepoints>
- <entry il="0x0" row="22" col="2" file_ref="1" hidden="false" />
- <entry il="0x1" row="23" col="2" file_ref="1" hidden="false" />
+ <entry il="0x0" row="22" col="2" file_ref="2" hidden="false" />
+ <entry il="0x1" row="23" col="2" file_ref="2" hidden="false" />
</sequencepoints>
<locals />
<scopes />
<?xml version="1.0" encoding="utf-8"?>
<symbols>
<files>
- <file id="1" name="test-debug-23.cs" checksum="50c2e83a7c3a471eb8f9993800d16ac8" />
+ <file id="1" name="test-debug-23.cs" checksum="11dd652c953a502005ebdc9b6cc6f94d" />
</files>
<methods>
<method token="0x6000001">
}
}
- static void Main ()
+ public static void Main ()
{
}
}
\ No newline at end of file
class TestClass
{
- static void Main()
+ public static void Main()
{
}
}
\ No newline at end of file
public class Test
{
- static int Main ()
+ public static int Main ()
{
if (MyAssembly01::GlobalClass.StaticMethod () != 1)
return 1;
public class Test
{
- static int Main ()
+ public static int Main ()
{
if (MyAssembly01::Namespace1.MyClass1.StaticMethod () != 1)
return 1;
public class Test
{
- static int Main ()
+ public static int Main ()
{
if (MyAssembly01::Namespace1.MyClass1.MyNestedClass1.StaticMethod () != 1)
return 1;
public class Test
{
- static int Main ()
+ public static int Main ()
{
if (MyAssembly01::Namespace1.Namespace2.MyClass2.StaticMethod () != 1)
return 1;
public class Test
{
- static void Main ()
+ public static void Main ()
{
MyAssembly01::GlobalClass.JustForFirst ();
MyAssembly02::GlobalClass.JustForSecond ();
public class Test
{
- static void Main ()
+ public static void Main ()
{
}
}
public class Test
{
- static int Main ()
+ public static int Main ()
{
if (NS.MyClass.GetInt () != 1)
return 1;
public class Test
{
- static int Main ()
+ public static int Main ()
{
// This shouldn't produce a clash
if (MyClass1.StaticMethod () != 2)
-// Compiler options: -r:MyAssembly01=test-externalias-00-lib.dll
+// Compiler options: -r:MyAssembly_01=test-externalias-00-lib.dll
-extern alias MyAssembly01;
+extern alias MyAssembly_01;
using System;
-using SameNamespace = MyAssembly01;
+using SameNamespace = MyAssembly_01;
public class Test
{
- static int Main ()
+ public static int Main ()
{
SameNamespace.GlobalClass.StaticMethod ();
return 0;
yield return 3;
}
- static int Main ()
+ public static int Main ()
{
IEnumerator e = GetIt ();
int total = 0;
yield return 100;
}
- static int Main ()
+ public static int Main ()
{
start = 10;
end = 30;
yield return a;
}
- static int Main ()
+ public static int Main ()
{
int total = 0;
foreach (int i in GetIt (new int [] { 1, 2, 3})){
yield return i;
}
- static void Main ()
+ public static void Main ()
{
Console.WriteLine ("GetRange 10..20");
yield return i;
}
- static int Main ()
+ public static int Main ()
{
int total = 0;
foreach (int i in GetIt ()) {
yield return 1;
}
- static int Main ()
+ public static int Main ()
{
X y = new X ();
class X
{
- static int Main ()
+ public static int Main ()
{
Test test = new Test ();
yield return foo4.disposed;
}
- static int Main ()
+ public static int Main ()
{
ArrayList list = new ArrayList ();
foreach (object data in Test (3, 5))
}
}
- static int Main ()
+ public static int Main ()
{
IEnumerator e = GetIt;
int total = 0;
Console.WriteLine ("Hook invoked");
}
- static void Main ()
+ public static void Main ()
{
X x = new X ();
x.Hook += M;
}
}
- static void Main () {}
+ public static void Main () {}
}
yield return 0;
}
- static void Main ()
+ public static void Main ()
{
foreach (int a in X ()){
}
yield return "TEST2";
}
- static void Main ()
+ public static void Main ()
{
new Test ().Run ();
}
{
try { yield break; } catch { } finally { }
}
- static int Main ()
+ public static int Main ()
{
int i = 0;
foreach (object o in foo ())
}
}
- static void Main()
+ public static void Main()
{
IEnumerator enumerator = Empty.GetEnumerator();
if (enumerator.Current == null)
}
}
- static int Main ()
+ public static int Main ()
{
int total = 0;
foreach (int i in GetIt (new int [] { 1, 2, 3})){
return 1;
}
- static int Main ()
+ public static int Main ()
{
var e = GetIt2 ().GetEnumerator ();
ThreadPool.QueueUserWorkItem (l => {
yield break;
}
- static void Main ()
+ public static void Main ()
{
foreach (object bar in TagsError ()) {
Console.WriteLine ("No op {0}", bar);
class Y
{
- static int Main ()
+ public static int Main ()
{
if (X.Test.FooWorld () != 8)
return 1;
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
class X
{
- static int Main ()
+ public static int Main ()
{
Test test = new Test ();
if (test.TestFoo () != 1)
class X
{
- static void Main ()
+ public static void Main ()
{ }
}
partial class A2 {
}
-class D { static void Main () {} }
+class D { public static void Main () {} }
partial class Foo
{ }
-class B { static void Main () {} }
+class B { public static void Main () {} }
class X
{
- static int Main ()
+ public static int Main ()
{
if (Attribute.GetCustomAttributes (typeof (Test)).Length != 1)
return 1;
class X
{
- static int Main ()
+ public static int Main ()
{
if (Test2.Foo.f != 10)
return 1;
class X
{
- static int Main ()
+ public static int Main ()
{
foreach (string s in Test1.Foo.E())
{
public override int GetHashCode(){
return 1;
}
- static void Main () {}
+ public static void Main () {}
}
}
class Program
{
- static int Main ()
+ public static int Main ()
{
var x = typeof (X).GetMethod ("Foo", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetCustomAttributes (true);
Console.WriteLine (x.Length);
public class TestCase : A
{
- static void Main ()
+ public static void Main ()
{
}
}
[Obsolete]
static partial void Foo_2 (string s);
- static void Main()
+ public static void Main()
{
}
}
public class Test
{
- static int Main ()
+ public static int Main ()
{
var i = 5;
var b = true;
}
public int Property = 42;
}
- static int Main ()
+ public static int Main ()
{
var class1 = new Class1 ();
public class Test
{
- static int Main ()
+ public static int Main ()
{
string [] strings = new string [] { "Foo", "Bar", "Baz" };
foreach (var item in strings)
public class Test
{
- static int Main ()
+ public static int Main ()
{
using (var v = new MyClass("foo"))
if (v.GetType() != typeof (MyClass))
public class Test
{
- static int Main ()
+ public static int Main ()
{
for (var i = 0; i < 1; ++i)
if (i.GetType() != typeof (int))
var = i;
}
- static void Main ()
+ public static void Main ()
{
}
}
<method name="Void test()" attrs="129">\r
<size>197</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>39</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="dtest-015.cs">\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>67</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void TestErrorVersions()" attrs="129">\r
<size>198</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>996</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Foo(IA`1)" attrs="145">\r
<size>2</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>175</size>\r
</method>\r
<method name="System.Object <Main>m__0(System.Object)" attrs="145">\r
</method>\r
</type>\r
<type name="A">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>374</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 Test_2[T](IList`1, T)" attrs="150">\r
<size>10</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>868</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="dtest-045.cs">\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>249</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 Test(System.Func`1[System.String])" attrs="150">\r
<size>17</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>57</size>\r
</method>\r
<method name="System.Object <Main>m__0()" attrs="145">\r
</test>\r
<test name="dtest-collectioninit-01.cs">\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>488</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="IEnumerable`1 D2()" attrs="150">\r
<size>23</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
</type>\r
</method>\r
</type>\r
<type name="Boot">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="D">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="T">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Foo(Stack`1[Test])" attrs="134">\r
<size>2</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="T">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Test()" attrs="129">\r
<size>14</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Test()" attrs="129">\r
<size>26</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Test()" attrs="129">\r
<size>14</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>38</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Foo(Stack)" attrs="150">\r
<size>13</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>14</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Foo(Stack)" attrs="150">\r
<size>13</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>14</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-019.cs">\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Test()" attrs="129">\r
<size>14</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Print(System.Object)" attrs="150">\r
<size>40</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>39</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>14</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Test(Foo`1[System.Int32])" attrs="145">\r
<size>9</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>14</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Test(Foo)" attrs="145">\r
<size>13</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>14</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>16</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Test()" attrs="129">\r
<size>37</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="System.Object Test(Stack`1[System.Int32])" attrs="150">\r
<size>15</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>21</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>20</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Test(Bar`2[System.Int32,System.String])" attrs="145">\r
<size>25</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>14</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Test(Bar`2[System.Int32,System.String])" attrs="150">\r
<size>25</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Test(Bar`2)" attrs="145">\r
<size>25</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Test(Bar`3)" attrs="145">\r
<size>36</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>17</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>32</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>49</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>37</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 DoTheTest[T]()" attrs="145">\r
<size>145</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>177</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>38</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>87</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void do_hello(System.String)" attrs="145">\r
<size>13</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>37</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-047.cs">\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>8</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>23</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Foo">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="T G[T]()" attrs="150">\r
<size>7</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>41</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>19</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Hello()" attrs="129">\r
<size>12</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>19</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test.X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>98</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Array[T](T[])" attrs="145">\r
<size>22</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="N2.X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>20</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
- </type>\r
- <type name="TestLog+MyTest">\r
<method name="Void Main(System.String[])" attrs="150">\r
<size>207</size>\r
</method>\r
- <method name="Void .ctor()" attrs="6278">\r
- <size>7</size>\r
- </method>\r
</type>\r
</test>\r
<test name="gtest-057.cs">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>49</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-058.cs">\r
<type name="Foo">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Foo">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>23</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>84</size>\r
</method>\r
<method name="System.String <Main>m__0(Double)" attrs="145">\r
<method name="IEnumerable`1 Test(Int32, Int64)" attrs="134">\r
<size>51</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>95</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>85</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>62</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 Add(Int32, Int32)" attrs="145">\r
<size>12</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>27</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Baulig.X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>22</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
</type>\r
- <type name="TestLog+MyTest">\r
+ <type name="Pair`2[T,U]">\r
+ <method name="Void .ctor(T, U)" attrs="6278">\r
+ <size>16</size>\r
+ </method>\r
+ </type>\r
+ <type name="TestLog">\r
<method name="Void Main(System.String[])" attrs="150">\r
<size>212</size>\r
</method>\r
<method name="Void TestPairLog()" attrs="150">\r
<size>186</size>\r
</method>\r
- <method name="Void .ctor()" attrs="6278">\r
- <size>7</size>\r
- </method>\r
- </type>\r
- <type name="Pair`2[T,U]">\r
- <method name="Void .ctor(T, U)" attrs="6278">\r
- <size>16</size>\r
- </method>\r
</type>\r
</test>\r
<test name="gtest-073.cs">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>57</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>113</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>54</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>22</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>10</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Quicksort[U](Foo`1[U][])" attrs="150">\r
<size>9</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>23</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>8</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-101.cs">\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>10</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-104.cs">\r
<type name="MainClass">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>21</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>12</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Test()" attrs="129">\r
<size>27</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>14</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>58</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-109.cs">\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>13</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>76</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>86</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>28</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>43</size>\r
</method>\r
<method name="Double <Main>m__0(Int32)" attrs="145">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>29</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Slow.Program">\r
- <method name="Void Main(System.String[])" attrs="145">\r
+ <method name="Void Main(System.String[])" attrs="150">\r
<size>202</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Boolean Check2[T](E)" attrs="145">\r
<size>23</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>213</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>23</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-122.cs">\r
<type name="Test">\r
- <method name="Void Main(System.String[])" attrs="145">\r
+ <method name="Void Main(System.String[])" attrs="150">\r
<size>27</size>\r
</method>\r
<method name="Void D(Int32)" attrs="150">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>22</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="System.Collections.Generic.List`1[T] foo1[T](Filter`1)" attrs="145">\r
<size>46</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>46</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-135.cs">\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>117</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Martin.X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>149</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-138.cs">\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>62</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-140.cs">\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>134</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-141.cs">\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>92</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>2253</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 Test()" attrs="145">\r
<size>1157</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>38</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>16</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>8</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>41</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="M">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>22</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-172.cs">\r
<type name="M">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>8</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="M">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>28</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="M">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>14</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-177.cs">\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>119</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-178.cs">\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Y">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>14</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>289</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void set_Item(Int32, IEnumerable)" attrs="2177">\r
<size>2</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>211</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-184.cs">\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>69</size>\r
</method>\r
<method name="Boolean <Main>m__0(System.String)" attrs="145">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>22</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-192.cs">\r
<type name="xX">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Martin.Collections.Generic.X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>92</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="M">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>20</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Test(System.Type, System.Object)" attrs="145">\r
<size>32</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>145</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void p(System.String)" attrs="145">\r
<size>8</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>51</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Driver">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>20</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="ClassLibrary3.Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>24</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Fun[T](T)" attrs="150">\r
<size>16</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>16</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Fun[T](T)" attrs="150">\r
<size>79</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>16</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-214.cs">\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>104</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="PopQuiz">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>171</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="SetTest">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
</type>\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Tester">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>34</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-231.cs">\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>34</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-233.cs">\r
<type name="Program">\r
- <method name="Void Main(System.String[])" attrs="145">\r
+ <method name="Void Main(System.String[])" attrs="150">\r
<size>26</size>\r
</method>\r
<method name="Void list_ListChanged(System.Object, System.ComponentModel.ListChangedEventArgs)" attrs="145">\r
<method name="IFoo`1 GetFooGeneric[T]()" attrs="134">\r
<size>10</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>15</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>82</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>83</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-238.cs">\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>57</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>297</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="main">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-246.cs">\r
<type name="TestCase.CTest">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void Bar()" attrs="134">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Boolean Test(System.Object)" attrs="145">\r
<size>27</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>7</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>21</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>21</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="C">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="IEnumerator`1 GetEnumerator()" attrs="134">\r
<size>22</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>12</size>\r
</method>\r
<method name="Void Run()" attrs="129">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>8</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void f6(ParamEnum)" attrs="134">\r
<size>2</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>167</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="IEnumerator`1 Test[S,T](S)" attrs="150">\r
<size>29</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
</type>\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Response[T](Handler`1[T])" attrs="129">\r
<size>2</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Bar()" attrs="129">\r
<size>8</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 Test(Boolean)" attrs="145">\r
<size>71</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>247</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 Test(Nullable`1)" attrs="145">\r
<size>63</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>60</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>57</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Test[T](T)" attrs="145">\r
<size>2</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>19</size>\r
</method>\r
</type>\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>448</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-277.cs">\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="BugReport">\r
- <method name="Void Main(System.String[])" attrs="145">\r
+ <method name="Void Main(System.String[])" attrs="150">\r
<size>21</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>22</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 Test()" attrs="145">\r
<size>54</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>53</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-287.cs">\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>37</size>\r
</method>\r
<method name="Void D()" attrs="486">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>74</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-291.cs">\r
<type name="Global">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>23</size>\r
</method>\r
<method name="System.String Test2(Nullable`1)" attrs="145">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="A Test(A, B)" attrs="150">\r
<size>18</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>101</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test.Foo">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>8</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-297.cs">\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>25</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="TestClass">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>14</size>\r
</method>\r
<method name="Void <a>m__0(Int32)" attrs="145">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>53</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="M">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>63</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 g()" attrs="145">\r
<size>10</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>28</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void test(Int32)" attrs="145">\r
<size>30</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>142</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>16</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>29</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>19</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-316.cs">\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>20</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>14</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>14</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor(Callback)" attrs="6278">\r
<method name="Void Test(MyBase`2+Callback[System.String,System.Int32])" attrs="134">\r
<size>9</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor(Callback)" attrs="6278">\r
<method name="Void F(Int64)" attrs="134">\r
<size>2</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Foo">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>14</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>59</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="C">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>22</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>19</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-333.cs">\r
<type name="Program">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>14</size>\r
</method>\r
</type>\r
<method name="Void SetValue[T](System.Object, T)" attrs="145">\r
<size>2</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>13</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-338.cs">\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>14</size>\r
</method>\r
<method name="Void Foo[T](IList`1)" attrs="145">\r
</test>\r
<test name="gtest-339.cs">\r
<type name="Program">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>12</size>\r
</method>\r
<method name="Void SerializeDictionary(IDictionary)" attrs="145">\r
<method name="IEnumerable Enumerable(System.String)" attrs="134">\r
<size>7</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-349.cs">\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>121</size>\r
</method>\r
<method name="Int32 f2(IList, IList)" attrs="145">\r
</method>\r
</type>\r
<type name="T">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>125</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Program">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>12</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Program">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>41</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-364.cs">\r
<type name="BugReport.Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>380</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-365.cs">\r
<type name="B.Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>69</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Assert[T](T, T)" attrs="145">\r
<size>2</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>21</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Repro">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void Bar[TFoo](TFoo)" attrs="145">\r
</test>\r
<test name="gtest-371.cs">\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>87</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>36</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Boolean Compute2(Int32)" attrs="150">\r
<size>10</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>46</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-381.cs">\r
<type name="TestGoto">\r
- <method name="Void Main(System.String[])" attrs="145">\r
+ <method name="Void Main(System.String[])" attrs="150">\r
<size>71</size>\r
</method>\r
<method name="IEnumerable`1 setX()" attrs="145">\r
</method>\r
</type>\r
<type name="C">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>279</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void f(Data)" attrs="145">\r
<size>20</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>23</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-390.cs">\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>12</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>71</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="T">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="System.Func`1[System.Int32] Method(System.String)" attrs="145">\r
<size>10</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>25</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Nullable`1 NegateBar(Bar)" attrs="145">\r
<size>20</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>168</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="TestIssue.Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>32</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Boolean Foo[T]()" attrs="145">\r
<size>25</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>94</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-402.cs">\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>19</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 <Test_12>m__0()" attrs="145">\r
<size>10</size>\r
</method>\r
+ <method name="Void Test_13(System.Object)" attrs="129">\r
+ <size>53</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="gtest-410.cs">\r
<type name="Program">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>10</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-412.cs">\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>261</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>103</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-415.cs">\r
<type name="Foo">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>50</size>\r
</method>\r
<method name="Boolean Bar[T](T)" attrs="145">\r
</method>\r
</type>\r
<type name="TestCase">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>141</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-419.cs">\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>64</size>\r
</method>\r
<method name="System.Object Test(System.String)" attrs="145">\r
<method name="Int32 Test(System.Object, System.Object[])" attrs="145">\r
<size>10</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>51</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="MonoTest.Program">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Nullable`1 get_Prop()" attrs="2182">\r
<size>50</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>50</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-431.cs">\r
<type name="Program">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>14</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-433.cs">\r
<type name="M">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>38</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="testcase.Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>88</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-435.cs">\r
<type name="testcase.Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>293</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="EntryPoint">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-445.cs">\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void Foo[T](T ByRef)" attrs="145">\r
</test>\r
<test name="gtest-449.cs">\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>82</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-450.cs">\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>82</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-455.cs">\r
<type name="ConsoleApplication1.Program">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>15</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Foo[T]()" attrs="129">\r
<size>2</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>10</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="GenericTest.Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>22</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-462.cs">\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>97</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Boolean Test[T](T)" attrs="129">\r
<size>18</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>58</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Bar">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>21</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-483.cs">\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>109</size>\r
</method>\r
<method name="Void ReplaceContentsWith[T](T, T)" attrs="145">\r
</method>\r
</type>\r
<type name="Program">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-495.cs">\r
<type name="Repro">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>13</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="a">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>22</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="a">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>15</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-500.cs">\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>101</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Dispose()" attrs="486">\r
<size>2</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>12</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="T FindExisting[T]()" attrs="145">\r
<size>15</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>20</size>\r
</method>\r
</type>\r
</method>\r
</type>\r
<type name="M">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>20</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-536.cs">\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>7</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="C">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>35</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="TR Test[T1,T2,TR](T1, T2, System.Func`3[T1,T2,TR])" attrs="145">\r
<size>17</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>30</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-554.cs">\r
<type name="Mono.Test.Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>159</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>22</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void PassByRef[T](T ByRef)" attrs="145">\r
<size>17</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>62</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-568.cs">\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>111</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
</test>\r
+ <test name="gtest-571.cs">\r
+ <type name="A`1[T]">\r
+ <method name="A`1[MM] For[MM]()" attrs="1478">\r
+ <size>0</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6276">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ <type name="B`3[U,X,V]">\r
+ <method name="A`1[PP] For[PP]()" attrs="198">\r
+ <size>20</size>\r
+ </method>\r
+ <method name="Void .ctor(A`1)" attrs="6278">\r
+ <size>15</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test">\r
+ <method name="Void Main()" attrs="150">\r
+ <size>20</size>\r
+ </method>\r
+ <method name="A`1[QQ] For[QQ]()" attrs="198">\r
+ <size>10</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ </test>\r
<test name="gtest-anontype-01.cs">\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>71</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="System.Object TestA(System.String)" attrs="145">\r
<size>15</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>122</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>82</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>139</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="System.String Null()" attrs="145">\r
<size>10</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>357</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-anontype-06.cs">\r
<type name="CastByExample">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>30</size>\r
</method>\r
<method name="T Cast[T](System.Object, T)" attrs="145">\r
</test>\r
<test name="gtest-anontype-07.cs">\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>82</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>57</size>\r
</method>\r
</type>\r
<method name="IEnumerable`1 Select[T](System.Array, System.Func`2[System.Object,T])" attrs="150">\r
<size>51</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>182</size>\r
</method>\r
<method name="Boolean <Main>m__1(<>__AnonType0`2[System.String,System.Reflection.PropertyInfo])" attrs="145">\r
<method name="Void set_Answer(Int32)" attrs="2177">\r
<size>8</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>120</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void set_Answer(Int32)" attrs="2193">\r
<size>7</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>142</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void set_Foo(System.String)" attrs="2182">\r
<size>8</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>301</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Program">\r
- <method name="Void Main(System.String[])" attrs="145">\r
+ <method name="Void Main(System.String[])" attrs="150">\r
<size>8</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void TestList(System.Collections.Generic.List`1[System.Int32], Int32)" attrs="145">\r
<size>91</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>562</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-collectioninit-03.cs">\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>42</size>\r
</method>\r
<method name="Void R(System.Object ByRef)" attrs="145">\r
</method>\r
</type>\r
<type name="C">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>14</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="C">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>394</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Assert[T](T, T)" attrs="145">\r
<size>48</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>358</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>50</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-etree-11.cs">\r
<type name="C">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>13</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-etree-13.cs">\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>66</size>\r
</method>\r
<method name="IEnumerable`1 Test[T](Int32)" attrs="145">\r
</method>\r
</type>\r
<type name="Repro">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>67</size>\r
</method>\r
<method name="IEnumerable`1 GetPersons[T](IEnumerable`1, Int32)" attrs="145">\r
</test>\r
<test name="gtest-etree-16.cs">\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>152</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>156</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void RunOnBaz(System.Action`1[IBaz])" attrs="486">\r
<size>9</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>222</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>15</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-exmethod-12.cs">\r
<type name="Program">\r
- <method name="Void Main(System.String[])" attrs="145">\r
+ <method name="Void Main(System.String[])" attrs="150">\r
<size>64</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="System.String get_Property()" attrs="2182">\r
<size>14</size>\r
</method>\r
- <method name="Void Main(System.String[])" attrs="145">\r
+ <method name="Void Main(System.String[])" attrs="150">\r
<size>45</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Repro">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>19</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>173</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void M(I)" attrs="145">\r
<size>14</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void M(I)" attrs="145">\r
<size>8</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Bar.Program">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>18</size>\r
</method>\r
<method name="System.String Pan(System.Byte[])" attrs="147">\r
</method>\r
</type>\r
<type name="Program">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Foo()" attrs="129">\r
<size>18</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
</test>\r
+ <test name="gtest-exmethod-45.cs">\r
+ <type name="C">\r
+ <method name="Void Main()" attrs="150">\r
+ <size>10</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ </test>\r
<test name="gtest-fixedbuffer-01.cs">\r
<type name="TestNew">\r
<method name="Void SetTest()" attrs="134">\r
</test>\r
<test name="gtest-friend-01.cs">\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>21</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-friend-02.cs">\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>21</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-friend-03.cs">\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>21</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-friend-04.cs">\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>20</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-friend-05.cs">\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>21</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-friend-06.cs">\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>21</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-friend-07.cs">\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>21</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-friend-08.cs">\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>20</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-friend-09.cs">\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>21</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-friend-10.cs">\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>21</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-friend-11.cs">\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>21</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-friend-12.cs">\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>20</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>14</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-implicitarray-01.cs">\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>329</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>63</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>85</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-initialize-02.cs">\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>1280</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="System.Object Foo()" attrs="134">\r
<size>23</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>53</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Y">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>51</size>\r
</method>\r
<method name="Boolean Do(Foo)" attrs="145">\r
<method name="IEnumerable`1 Annotations(System.Type)" attrs="134">\r
<size>44</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>15</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="IEnumerable`1 FromTo(Int32, Int32)" attrs="145">\r
<size>51</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>185</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>157</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="IEnumerable`1 GetIt()" attrs="129">\r
<size>30</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>145</size>\r
</method>\r
<method name="Int32 <get_BaseM>__BaseCallProxy0()" attrs="129">\r
<method name="IEnumerable`1 TestMethod()" attrs="134">\r
<size>23</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-iter-20.cs">\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>72</size>\r
</method>\r
<method name="IEnumerable GetAll()" attrs="145">\r
</test>\r
<test name="gtest-iter-27.cs">\r
<type name="CompilerBug">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>61</size>\r
</method>\r
<method name="IEnumerable`1 Foo()" attrs="145">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>328</size>\r
</method>\r
<method name="Int32 <Main>m__0(Int32)" attrs="145">\r
<method name="Void Foo(funcs)" attrs="145">\r
<size>20</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>36</size>\r
</method>\r
<method name="System.String <Main>m__0(System.String)" attrs="145">\r
<method name="Y F[X,Y](Int32, X, Func`2[X,Y])" attrs="145">\r
<size>16</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>62</size>\r
</method>\r
<method name="TimeSpan <Main>m__0(System.String)" attrs="145">\r
<method name="Z F[X,Y,Z](X, Func`2[X,Y], Func`2[Y,Z])" attrs="145">\r
<size>22</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>116</size>\r
</method>\r
<method name="TimeSpan <Main>m__0(System.String)" attrs="145">\r
<method name="Void StopTrue(T)" attrs="145">\r
<size>2</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>44</size>\r
</method>\r
<method name="Void <Main>m__0(F)" attrs="145">\r
<method name="Void F[T](T[], T, Func`1[T])" attrs="145">\r
<size>43</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>78</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="System.String Bar()" attrs="145">\r
<size>43</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>77</size>\r
</method>\r
<method name="System.String <Bar>m__1(System.String)" attrs="145">\r
</method>\r
</type>\r
<type name="Repro">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>128</size>\r
</method>\r
<method name="Int32 <Main>m__1(System.String)" attrs="145">\r
<method name="Void AssertFoo[T](IList`1)" attrs="145">\r
<size>35</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="System.String Bar()" attrs="145">\r
<size>43</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>108</size>\r
</method>\r
<method name="System.String <Bar>m__0(System.String)" attrs="145">\r
</test>\r
<test name="gtest-lambda-26.cs">\r
<type name="C">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>36</size>\r
</method>\r
<method name="Void Execute(System.Action)" attrs="150">\r
</method>\r
</type>\r
<type name="CustomQueryExpressionPattern">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>171</size>\r
</method>\r
<method name="TestA <Main>m__0(TestA)" attrs="145">\r
</test>\r
<test name="gtest-linq-13.cs">\r
<type name="Program">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void Foo(TypeDefinition)" attrs="145">\r
</method>\r
</type>\r
<type name="Program">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void Assert(System.Action)" attrs="150">\r
<method name="Boolean Test2(System.Func`2[System.Int32,System.Int32])" attrs="145">\r
<size>10</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>658</size>\r
</method>\r
<method name="<>__AnonType0`2[System.Int32,System.Boolean] <Main>m__0(Int32)" attrs="145">\r
</test>\r
<test name="gtest-linq-21.cs">\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>98</size>\r
</method>\r
</type>\r
</method>\r
</type>\r
<type name="Test.Program">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>80</size>\r
</method>\r
<method name="System.String <Main>m__0(Test.C)" attrs="145">\r
<method name="Void m(Int32, Int32, Int32, Int32)" attrs="145">\r
<size>2</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>336</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 Test_7(Boolean, Int32, System.Object[])" attrs="145">\r
<size>10</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>161</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="gtest-optional-10.cs">\r
<type name="Program">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>9</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Test(S)" attrs="150">\r
<size>2</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>81</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
</test>\r
+ <test name="gtest-partial-04.cs">\r
+ <type name="C">\r
+ <method name="Void Main()" attrs="150">\r
+ <size>2</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ </test>\r
<test name="gtest-var-04.cs">\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>246</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>75</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>42</size>\r
</method>\r
</type>\r
</test>\r
<test name="gtest-variance-18.cs">\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>25</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Bla[T,U]()" attrs="145">\r
<size>13</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>7</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>110</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>69</size>\r
</method>\r
<method name="Int32 Bar(Foo`1[System.Object])" attrs="145">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>71</size>\r
</method>\r
<method name="Int32 Bar(Foo`1[System.String], System.String)" attrs="145">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>136</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Program">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-1.cs">\r
<type name="X">\r
- <method name="Int32 Main(System.String[])" attrs="145">\r
+ <method name="Int32 Main(System.String[])" attrs="150">\r
<size>20</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void TestDecimal(Decimal)" attrs="129">\r
<size>16</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void GetProperty()" attrs="134">\r
<size>13</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>10</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void async_callback(IAsyncResult)" attrs="145">\r
<size>23</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>427</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void async_callback(IAsyncResult)" attrs="145">\r
<size>101</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>97</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-108.cs">\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>107</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-109.cs">\r
<type name="T">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>31</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="System.Object get_obj()" attrs="145">\r
<size>14</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>34</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="System.Int32[] g()" attrs="145">\r
<size>22</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>31</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-116.cs">\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>20</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-118.cs">\r
<type name="Container">\r
- <method name="Int32 Main(System.String[])" attrs="145">\r
+ <method name="Int32 Main(System.String[])" attrs="150">\r
<size>10</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>45</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-12.cs">\r
<type name="X">\r
- <method name="Int32 Main(System.String[])" attrs="145">\r
+ <method name="Int32 Main(System.String[])" attrs="150">\r
<size>322</size>\r
</method>\r
<method name="System.String s(System.String, Int32)" attrs="145">\r
</test>\r
<test name="test-120.cs">\r
<type name="test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>154</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 g()" attrs="145">\r
<size>22</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>104</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="System.Object get_null()" attrs="145">\r
<size>10</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>125</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Iface.Method()" attrs="481">\r
<size>2</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>46</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-127.cs">\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>45</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-129.cs">\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>156</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-130.cs">\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>10</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-132.cs">\r
<type name="T">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>75</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void get_struct(S ByRef)" attrs="145">\r
<size>25</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>103</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void B()" attrs="486">\r
<size>2</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>94</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="A get_Prop()" attrs="2182">\r
<size>14</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>50</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="TestConflict">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>92</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void X()" attrs="486">\r
<size>16</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>123</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-138.cs">\r
<type name="T">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>22</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 GetHashCode()" attrs="198">\r
<size>26</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>39</size>\r
</method>\r
</type>\r
<method name="Int32 GetInfo(MonoEnumInfo ByRef)" attrs="145">\r
<size>28</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>50</size>\r
</method>\r
</type>\r
</method>\r
</type>\r
<type name="Run">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>73</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Test(System.String, System.Object[])" attrs="150">\r
<size>9</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>94</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 blah(System.Object)" attrs="145">\r
<size>70</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>10</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="DateTime get_DateTime()" attrs="2182">\r
<size>15</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>10</size>\r
</method>\r
<method name="Void .ctor(String)" attrs="6278">\r
<method name="Int32 Hello()" attrs="129">\r
<size>20</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>47</size>\r
</method>\r
<method name="Void .ctor()" attrs="6276">\r
<method name="Int32 Hello(IInferior)" attrs="129">\r
<size>15</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>84</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 Test(X+Foo[])" attrs="145">\r
<size>41</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>62</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="D">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>120</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 A()" attrs="129">\r
<size>56</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>21</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-171.cs">\r
<type name="IntPtr_Conv.Class1">\r
- <method name="Int32 Main(System.String[])" attrs="145">\r
+ <method name="Int32 Main(System.String[])" attrs="150">\r
<size>25</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 test_inline()" attrs="145">\r
<size>42</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>132</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 Test()" attrs="145">\r
<size>297</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>32</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-174.cs">\r
<type name="ProtectedAccessToPropertyOnChild">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>34</size>\r
</method>\r
<method name="Void .ctor()" attrs="6273">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>77</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-176.cs">\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>48</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 ret(Int32)" attrs="145">\r
<size>33</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>90</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="T">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>39</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 M(Int32, Int32 ByRef)" attrs="145">\r
<size>20</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>89</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>16</size>\r
</method>\r
<method name="Void .ctor()" attrs="6273">\r
<method name="Int32 Test(Int32)" attrs="150">\r
<size>50</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>47</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="TestBUG.Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>10</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void A(System.Collections.Specialized.NameValueCollection, MyClass, System.Object)" attrs="145">\r
<size>66</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>10</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-190.cs">\r
<type name="A">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="R">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-192.cs">\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>4</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 Test(Int32)" attrs="145">\r
<size>94</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>15</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>8</size>\r
</method>\r
<method name="Void .ctor()" attrs="6273">\r
<method name="Void Bug2()" attrs="129">\r
<size>16</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>28</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>10</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-2.cs">\r
<type name="X">\r
- <method name="Int32 Main(System.String[])" attrs="145">\r
+ <method name="Int32 Main(System.String[])" attrs="150">\r
<size>20</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>123</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-214.cs">\r
<type name="N2.Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>15</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="MonoEmbed">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>37</size>\r
</method>\r
<method name="Void Whatever(System.String)" attrs="145">\r
</test>\r
<test name="test-217.cs">\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>226</size>\r
</method>\r
<method name="System.Object compare_gte(Int32, Int32)" attrs="145">\r
</test>\r
<test name="test-218.cs">\r
<type name="T">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void compareQueryQuery1(System.Object)" attrs="145">\r
</method>\r
</type>\r
<type name="M">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>81</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Driver">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>61</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-223.cs">\r
<type name="T">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>89</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 foo()" attrs="134">\r
<size>10</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>19</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void set_Value(Int32)" attrs="2198">\r
<size>8</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>213</size>\r
</method>\r
<method name="Void .cctor()" attrs="6289">\r
</test>\r
<test name="test-230.cs">\r
<type name="TestClass">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>70</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-231.cs">\r
<type name="T">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>48</size>\r
</method>\r
<method name="Void Foo()" attrs="129">\r
</test>\r
<test name="test-233.cs">\r
<type name="Tests">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>24</size>\r
</method>\r
<method name="Int32 test_0_beq()" attrs="145">\r
</test>\r
<test name="test-234.cs">\r
<type name="T">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>701</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void ConditionalMethod()" attrs="145">\r
<size>8</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>20</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="MainClass">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>26</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void set_S(System.String)" attrs="2193">\r
<size>8</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>115</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void ConditionalMethod()" attrs="150">\r
<size>18</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>19</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="System.String Test()" attrs="145">\r
<size>10</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>9</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-244.cs">\r
<type name="Foo">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>164</size>\r
</method>\r
<method name="MyBool get_t()" attrs="2193">\r
<method name="System.String get_def_kind()" attrs="2182">\r
<size>20</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="B">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>41</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="B">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>73</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Foo GetFoo()" attrs="145">\r
<size>18</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>33</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-249.cs">\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-25.cs">\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>264</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-251.cs">\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-257.cs">\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>9</size>\r
</method>\r
<method name="Void call(Int32 ByRef)" attrs="145">\r
<method name="Void MyTest.Test.Inner.Foo()" attrs="481">\r
<size>2</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 Test(T)" attrs="145">\r
<size>134</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>39</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void X()" attrs="129">\r
<size>8</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>12</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-265.cs">\r
<type name="ClassFormatError">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor(String, Object[])" attrs="6275">\r
</test>\r
<test name="test-268.cs">\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>34</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Result InstVtAddASecondBunchOfInts(Int32, ...)" attrs="129">\r
<size>80</size>\r
</method>\r
- <method name="Int32 Main(System.String[])" attrs="145">\r
+ <method name="Int32 Main(System.String[])" attrs="150">\r
<size>415</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 Test(System.String, ...)" attrs="145">\r
<size>10</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>93</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="C X()" attrs="145">\r
<size>18</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>65</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void f3()" attrs="129">\r
<size>2</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-277.cs">\r
<type name="T">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>15</size>\r
</method>\r
<method name="Int32 X(Byte)" attrs="145">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>81</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-279.cs">\r
<type name="FlagsAttributeDemo">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>51</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void set_Item(Int32, Int32)" attrs="2177">\r
<size>27</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>152</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Boolean EnumInSet(System.Enum, System.Enum[])" attrs="150">\r
<size>54</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>47</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="System.Object Add(integer, System.Object)" attrs="150">\r
<size>83</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>86</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 Foo()" attrs="198">\r
<size>10</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>70</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-285.cs">\r
<type name="T">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>11</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Demo">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>69</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void bar_f(System.Object)" attrs="145">\r
<size>2</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>36</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-292.cs">\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>24</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-296.cs">\r
<type name="GetElementTypeTest">\r
- <method name="Int32 Main(System.String[])" attrs="145">\r
+ <method name="Int32 Main(System.String[])" attrs="150">\r
<size>49</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-297.cs">\r
<type name="T">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>378</size>\r
</method>\r
<method name="Void Login(System.String)" attrs="134">\r
</method>\r
</type>\r
<type name="test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>220</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>51</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 T()" attrs="145">\r
<size>82</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>53</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void A.B.METHOD()" attrs="481">\r
<size>2</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>167</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-314.cs">\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>75</size>\r
</method>\r
<method name="Void .ctor()" attrs="6273">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Test2(IE)" attrs="145">\r
<size>21</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>40</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-317.cs">\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-319.cs">\r
<type name="ConstFields">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>352</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-320.cs">\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>13</size>\r
</method>\r
<method name="Void .ctor(SByte*, Int32, Int32)" attrs="6278">\r
<method name="Void Dispose()" attrs="486">\r
<size>2</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>31</size>\r
</method>\r
</type>\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>52</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-323.cs">\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>68</size>\r
</method>\r
<method name="Double <Main>m__0(Int32)" attrs="145">\r
</method>\r
</type>\r
<type name="A.B.Tester">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-328.cs">\r
<type name="A.B.Tester">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-329.cs">\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>92</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Application">\r
- <method name="Int32 Main(System.String[])" attrs="145">\r
+ <method name="Int32 Main(System.String[])" attrs="150">\r
<size>149</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-330.cs">\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>9</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-334.cs">\r
<type name="Test.Foo.Index.CompoundFileReader">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void C(Int32 ByRef)" attrs="145">\r
<size>5</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>71</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Test()" attrs="145">\r
<size>2</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>20</size>\r
</method>\r
<method name="Void .ctor(Foo)" attrs="6278">\r
</test>\r
<test name="test-339.cs">\r
<type name="C">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>98</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Concat(System.String[])" attrs="145">\r
<size>12</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>22</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void remove_y(Y)" attrs="2182">\r
<size>42</size>\r
</method>\r
- <method name="Void Main(System.String[])" attrs="145">\r
+ <method name="Void Main(System.String[])" attrs="150">\r
<size>14</size>\r
</method>\r
<method name="Void Foo()" attrs="129">\r
</test>\r
<test name="test-346.cs">\r
<type name="TestMethods.Class1">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>101</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>63</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void w(Int32)" attrs="145">\r
<size>23</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>310</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="C">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Bar(System.String, System.Object[])" attrs="145">\r
<size>2</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>243</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="A">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-356.cs">\r
<type name="MainClass">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Foo.Bar">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>28</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Y">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>311</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-362.cs">\r
<type name="C">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>22</size>\r
</method>\r
<method name="Void Test()" attrs="145">\r
</test>\r
<test name="test-364.cs">\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>52</size>\r
</method>\r
<method name="Int32 t1(Int32)" attrs="145">\r
<method name="Int32 t2(Int32)" attrs="145">\r
<size>55</size>\r
</method>\r
- <method name="Void Main2(System.String[])" attrs="145">\r
+ <method name="Void Main2(System.String[])" attrs="150">\r
<size>75</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void set_LiteralType(LiteralType)" attrs="2182">\r
<size>2</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-366.cs">\r
<type name="C">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>28</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-367.cs">\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>28</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-368.cs">\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>26</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 GetHashCode()" attrs="198">\r
<size>10</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>48</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 simple_test_double_dim()" attrs="145">\r
<size>96</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>20</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-371.cs">\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor(Boolean&)" attrs="6278">\r
</method>\r
</type>\r
<type name="Rest">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="c">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>320</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-380.cs">\r
<type name="T">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>30</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-382.cs">\r
<type name="Dec">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>109</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Test()" attrs="145">\r
<size>43</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>34</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-385.cs">\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>57</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="ObjectID op_Implicit(Int64)" attrs="2198">\r
<size>15</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>23</size>\r
</method>\r
<method name="Void .ctor(Int64)" attrs="6278">\r
<method name="C MethodSampleC(System.String)" attrs="145">\r
<size>15</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>114</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="System.String MethodSampleC(C)" attrs="145">\r
<size>31</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>129</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void MethodSample(B, A, C)" attrs="145">\r
<size>56</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>72</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-398.cs">\r
<type name="Tester">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>119</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void G(...)" attrs="145">\r
<size>23</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>394</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void test(Int32)" attrs="129">\r
<size>9</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>126</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 TestMultiple()" attrs="145">\r
<size>111</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>115</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-401.cs">\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>207</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-402.cs">\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>26</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32* get_v()" attrs="145">\r
<size>29</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>71</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="testapp.TestApp">\r
- <method name="Void Main(System.String[])" attrs="145">\r
+ <method name="Void Main(System.String[])" attrs="150">\r
<size>14</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-406.cs">\r
<type name="TestCase.Test">\r
- <method name="Int32 Main(System.String[])" attrs="145">\r
+ <method name="Int32 Main(System.String[])" attrs="150">\r
<size>228</size>\r
</method>\r
<method name="UInt32 DoOp(UInt32*)" attrs="145">\r
</test>\r
<test name="test-408.cs">\r
<type name="T">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>59</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-409.cs">\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>40</size>\r
</method>\r
</type>\r
<method name="Void A(Int32 ByRef, UInt32 ByRef, SByte ByRef, Byte ByRef, Int64 ByRef, UInt64 ByRef, Int16 ByRef, UInt16 ByRef, Char ByRef, X ByRef, Single ByRef, Double ByRef)" attrs="145">\r
<size>189</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>310</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-419.cs">\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>8</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 arrays()" attrs="145">\r
<size>265</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>214</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-420.cs">\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>8</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Func(Int32 ByRef)" attrs="145">\r
<size>13</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>11</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-426.cs">\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>12</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-427.cs">\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>12</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>19</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>19</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Boolean test_multi(System.Int32[,])" attrs="145">\r
<size>100</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>332</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>19</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>19</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>19</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>17</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>17</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>10</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>8</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>10</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>8</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 count(System.Object)" attrs="145">\r
<size>50</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>154</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-442.cs">\r
<type name="ConsoleApplication1.Program">\r
- <method name="Void Main(System.String[])" attrs="145">\r
+ <method name="Void Main(System.String[])" attrs="150">\r
<size>73</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-449.cs">\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void Z()" attrs="129">\r
</test>\r
<test name="test-451.cs">\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>23</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>8</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>28</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>17</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void IInteger.Add(Int32)" attrs="481">\r
<size>12</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>60</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Boolean cast_bool(System.Object)" attrs="145">\r
<size>15</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>1364</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Method(System.String)" attrs="129">\r
<size>9</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>41</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
</test>\r
- <test name="test-468.cs">\r
- <type name="CorMetaDataDispenserExClass">\r
- <method name="Void .ctor()" attrs="6278">\r
- <size>0</size>\r
- </method>\r
- </type>\r
- <type name="Test">\r
- <method name="Void XXX()" attrs="150">\r
- <size>13</size>\r
- </method>\r
- <method name="Void Main()" attrs="150">\r
- <size>2</size>\r
- </method>\r
- <method name="Void .ctor()" attrs="6278">\r
- <size>7</size>\r
- </method>\r
- </type>\r
- </test>\r
<test name="test-469.cs">\r
<type name="Del">\r
<method name="Void Invoke(Int32)" attrs="454">\r
<method name="Del[] Make2(Int32)" attrs="145">\r
<size>58</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>86</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Boolean t()" attrs="145">\r
<size>32</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>511</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Demo">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void set_Prop(Int32)" attrs="2182">\r
<size>9</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>97</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-474.cs">\r
<type name="Z">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>14</size>\r
</method>\r
<method name="Void TestPreinc(Int32)" attrs="145">\r
<method name="Int32 GetHashCode()" attrs="198">\r
<size>10</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void M4(Int32, ...)" attrs="134">\r
<size>2</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-487.cs">\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>33</size>\r
</method>\r
<method name="Void .ctor(Object)" attrs="6273">\r
<method name="IEnumerable foo()" attrs="145">\r
<size>10</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>169</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-489.cs">\r
<type name="test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void test_1597()" attrs="145">\r
<size>9</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>1390</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-490.cs">\r
<type name="T">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="C">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-494.cs">\r
<type name="Agresso.Foundation.Function">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="plj.fromClass">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-497.cs">\r
<type name="PlotMenuItem">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>63</size>\r
</method>\r
<method name="Void MenuItem_Click(System.Object, System.EventArgs)" attrs="145">\r
</method>\r
</type>\r
<type name="C">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>99</size>\r
</method>\r
</type>\r
</test>\r
<test name="test-5.cs">\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>45</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 get_Property()" attrs="2182">\r
<size>11</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-503.cs">\r
<type name="Foo">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>34</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 f()" attrs="145">\r
<size>20</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>37</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void set_Name(System.String)" attrs="2243">\r
<size>2</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="boot">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>21</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-513.cs">\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>322</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void HandleConflict(Int32)" attrs="150">\r
<size>37</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>56</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-515.cs">\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>41</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-516.cs">\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>41</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-518.cs">\r
<type name="Foo">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>23</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-519.cs">\r
<type name="Foo">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>25</size>\r
</method>\r
<method name="Void f()" attrs="145">\r
<method name="Y GetEnumerator()" attrs="134">\r
<size>14</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>548</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void stuff_finally()" attrs="129">\r
<size>2</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-526.cs">\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void Foo(IListCounter)" attrs="145">\r
</test>\r
<test name="test-527.cs">\r
<type name="Repro">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>56</size>\r
</method>\r
<method name="Void foo()" attrs="134">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>288</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void e(System.Object[])" attrs="145">\r
<size>2</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void False(Boolean)" attrs="145">\r
<size>14</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>62</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-535.cs">\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>77</size>\r
</method>\r
<method name="Void Compile()" attrs="145">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-539.cs">\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>84</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Boolean v()" attrs="129">\r
<size>19</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>10</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void set_Item(Int32, Boolean, System.Object[], Boolean)" attrs="2182">\r
<size>41</size>\r
</method>\r
- <method name="Void Main(System.String[])" attrs="145">\r
+ <method name="Void Main(System.String[])" attrs="150">\r
<size>259</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-544.cs">\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>34</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-547.cs">\r
<type name="C">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="User">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void CharToX()" attrs="134">\r
<size>2</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>48</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-558.cs">\r
<type name="TestClass">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>22</size>\r
</method>\r
<method name="Void TestMethod(Int32)" attrs="150">\r
</method>\r
</type>\r
<type name="M">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>279</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-562.cs">\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>58</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-567.cs">\r
<type name="preservesig_test.Class1">\r
- <method name="Int32 Main(System.String[])" attrs="145">\r
+ <method name="Int32 Main(System.String[])" attrs="150">\r
<size>166</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-574.cs">\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>25</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-575.cs">\r
<type name="Program">\r
- <method name="Void Main(System.String[])" attrs="145">\r
+ <method name="Void Main(System.String[])" attrs="150">\r
<size>28</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-576.cs">\r
<type name="Foo">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>25</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-579.cs">\r
<type name="TestCase">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>49</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-583.cs">\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>27</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Program">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>53</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-586.cs">\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>112</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-587.cs">\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>32</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 test_implicit()" attrs="145">\r
<size>136</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>75</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-590.cs">\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>36</size>\r
</method>\r
<method name="System.String Foo()" attrs="129">\r
<method name="Void XXXA()" attrs="145">\r
<size>7</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-594.cs">\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>112</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="System.Object SetDictionaryValue(System.Object, SymbolId, System.Object)" attrs="150">\r
<size>26</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>24</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-6.cs">\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>45</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>22</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-603.cs">\r
<type name="ConsoleApplication1.Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>65</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-604.cs">\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>102</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-606.cs">\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>194</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-607.cs">\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>143</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void remove_XX(X+MyEvent)" attrs="2182">\r
<size>4</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>10</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Z">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Boolean IsAltered()" attrs="134">\r
<size>872</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Or()" attrs="147">\r
<size>142</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>88</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-619.cs">\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>14</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="System.Int32[,,] getMoreInt()" attrs="129">\r
<size>10</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>10</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void B(Int32 ByRef)" attrs="145">\r
<size>8</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>35</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-621.cs">\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>130</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Foo(System.Object ByRef)" attrs="145">\r
<size>10</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>24</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void a()" attrs="198">\r
<size>17</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>14</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 get_Type()" attrs="2177">\r
<size>10</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>4</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6273">\r
<method name="Void A()" attrs="129">\r
<size>2</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>44</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void N(System.Object)" attrs="145">\r
<size>9</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Y">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-63.cs">\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>98</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Test(Boolean)" attrs="145">\r
<size>14</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>14</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Boolean f()" attrs="145">\r
<size>12</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>168</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void test_for_empty()" attrs="145">\r
<size>36</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>31</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-638.cs">\r
<type name="Fail">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>111</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void set_s(System.String)" attrs="2177">\r
<size>35</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>68</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="T">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>17</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Decimal op_Implicit(Identifier)" attrs="2198">\r
<size>15</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>73</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-643.cs">\r
<type name="PointerArithmeticTest">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>137</size>\r
</method>\r
<method name="Int32* Conversions(Int64)" attrs="145">\r
<method name="Boolean Test_4(Program+D)" attrs="134">\r
<size>21</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>98</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="UInt32 CastIntPtrToUInt32(IntPtr)" attrs="145">\r
<size>15</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>145</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="S Plain()" attrs="145">\r
<size>24</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>132</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-650.cs">\r
<type name="App">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-654.cs">\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>16</size>\r
</method>\r
<method name="Int32 Test(SByte*)" attrs="145">\r
<method name="Void set_Item(Int32, Byte)" attrs="2177">\r
<size>9</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>76</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-656.cs">\r
<type name="Goo">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>27</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Excluded()" attrs="150">\r
<size>12</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>15</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-659.cs">\r
<type name="MySubClass">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>38</size>\r
</method>\r
<method name="Void set_BB(Int32, Boolean)" attrs="2534">\r
<method name="Int32 TestObjectDouble()" attrs="145">\r
<size>87</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>108</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-661.cs">\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void TestMethod()" attrs="134">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>8</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-669.cs">\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>4</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-671.cs">\r
<type name="C">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>27</size>\r
</method>\r
<method name="Boolean Bar(System.Object)" attrs="145">\r
<method name="S* get_Foo2()" attrs="2177">\r
<size>11</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-678.cs">\r
<type name="NaNTest">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>34</size>\r
</method>\r
<method name="Void .ctor(Double, Double)" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>197</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-684.cs">\r
<type name="mono_bug.Program">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>78</size>\r
</method>\r
<method name="System.Double[][,] ReturnArray()" attrs="145">\r
</test>\r
<test name="test-686.cs">\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>53</size>\r
</method>\r
<method name="Void Foo()" attrs="145">\r
</test>\r
<test name="test-690.cs">\r
<type name="Test.Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-691.cs">\r
<type name="ConsoleApplication6.Program">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>133</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-695.cs">\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>766</size>\r
</method>\r
<method name="System.String get_BaseDirectory()" attrs="2193">\r
</method>\r
</type>\r
<type name="C">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>13</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Z">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>98</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Program">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="UInt16 ToUint16()" attrs="131">\r
<size>14</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-702.cs">\r
<type name="S">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>10</size>\r
</method>\r
<method name="Void .ctor(Int32)" attrs="6278">\r
<method name="Void ArglistMethod(...)" attrs="145">\r
<size>52</size>\r
</method>\r
- <method name="Void Main(System.String[])" attrs="145">\r
+ <method name="Void Main(System.String[])" attrs="150">\r
<size>10</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-71.cs">\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>38</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-712.cs">\r
<type name="Hello">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>23</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void IBar.Test()" attrs="481">\r
<size>2</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>230</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-72.cs">\r
<type name="outer">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>10</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-720.cs">\r
<type name="N.Program">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>19</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-721.cs">\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>68</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void M[T](T)" attrs="129">\r
<size>19</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>61</size>\r
</method>\r
<method name="Void .ctor(Int32)" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>35</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 GetPhones()" attrs="129">\r
<size>30</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>36</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-74.cs">\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>198</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Driver">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>54</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="driver">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>47</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Program">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="T">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void StaticCallback(System.String)" attrs="150">\r
<size>36</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>49</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-77.cs">\r
<type name="XX">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>258</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-772.cs">\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>15</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>86</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="a">\r
- <method name="Int32 Main(System.String[])" attrs="145">\r
+ <method name="Int32 Main(System.String[])" attrs="150">\r
<size>44</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Boolean IntCasting()" attrs="145">\r
<size>31</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>44</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-788.cs">\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>44</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-789.cs">\r
<type name="Program">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>77</size>\r
</method>\r
<method name="Void <Main>m__0()" attrs="145">\r
</test>\r
<test name="test-79.cs">\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>48</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Test2(IMemberDelayed)" attrs="129">\r
<size>20</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-793.cs">\r
<type name="MonoPointerBugTest.Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>60</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-799.cs">\r
<type name="Test2">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>21</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Y">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>47</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-808.cs">\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>70</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>38</size>\r
</method>\r
</type>\r
</method>\r
</type>\r
<type name="System.Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>71</size>\r
</method>\r
<method name="System.Reflection.Assembly CurrentDomain_TypeResolve(System.Object, System.ResolveEventArgs)" attrs="145">\r
</test>\r
<test name="test-817.cs">\r
<type name="System.Program">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>18</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Foo.Foo">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>21</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-827.cs">\r
<type name="Program">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>9</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>16</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="DelegateTest">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>10</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Test()" attrs="145">\r
<size>2</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-832.cs">\r
<type name="A">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>54</size>\r
</method>\r
<method name="Void Test()" attrs="129">\r
</test>\r
<test name="test-84.cs">\r
<type name="Ghost">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>16</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Foo[TEventArgs,TEventHandler](A`1[TEventHandler], System.Action`2[System.Object,TEventArgs])" attrs="150">\r
<size>2</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>39</size>\r
</method>\r
<method name="Void <Main>m__0(System.Object, System.String)" attrs="145">\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="Int32 Test(Boolean, Int16)" attrs="150">\r
+ <size>22</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="test-85.cs">\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>33</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-853.cs">\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>35</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
</test>\r
+ <test name="test-855.cs">\r
+ <type name="Test.BaseClass">\r
+ <method name="System.String Get(System.String, System.String)" attrs="486">\r
+ <size>10</size>\r
+ </method>\r
+ <method name="Int32 Get(System.String, Int32)" attrs="486">\r
+ <size>10</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test.Subclass">\r
+ <method name="Void Main()" attrs="150">\r
+ <size>8</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ </test>\r
+ <test name="test-856.cs">\r
+ <type name="A">\r
+ <method name="Void Dispose()" attrs="454">\r
+ <size>16</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6276">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ <type name="B">\r
+ <method name="Void Dispose()" attrs="129">\r
+ <size>12</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6276">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ <type name="C">\r
+ <method name="Int32 Main()" attrs="150">\r
+ <size>41</size>\r
+ </method>\r
+ <method name="Void Dispose()" attrs="198">\r
+ <size>8</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ </test>\r
+ <test name="test-857.cs">\r
+ <type name="Outer">\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ <type name="TypeHiding">\r
+ <method name="Boolean Test1(Outer)" attrs="150">\r
+ <size>10</size>\r
+ </method>\r
+ <method name="Boolean Test2()" attrs="150">\r
+ <size>12</size>\r
+ </method>\r
+ <method name="Void Main()" attrs="150">\r
+ <size>2</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ </test>\r
+ <test name="test-858.cs">\r
+ <type name="X">\r
+ <method name="Int32 Main()" attrs="150">\r
+ <size>108</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ </test>\r
+ <test name="test-859.cs">\r
+ <type name="X">\r
+ <method name="Void Test_PropertyOptionalParameters(C)" attrs="129">\r
+ <size>46</size>\r
+ </method>\r
+ <method name="Int32 Main()" attrs="150">\r
+ <size>23</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ </test>\r
<test name="test-86.cs">\r
<type name="T.T">\r
<method name="Int32 method1(System.Type, Int32)" attrs="145">\r
</test>\r
<test name="test-87.cs">\r
<type name="Top">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>81</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void f(System.String)" attrs="145">\r
<size>20</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>71</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="X F(Int32)" attrs="145">\r
<size>15</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>117</size>\r
</method>\r
<method name="Void .ctor(Int32)" attrs="6273">\r
</test>\r
<test name="test-90.cs">\r
<type name="N1.Blah">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>10</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void MyPrivate()" attrs="145">\r
<size>2</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>288</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>128</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-95.cs">\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>43</size>\r
</method>\r
<method name="Void .ctor()" attrs="6273">\r
</test>\r
<test name="test-96.cs">\r
<type name="N1.A">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>10</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-97.cs">\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>10</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-99.cs">\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>126</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>29</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>175</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>60</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>60</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>227</size>\r
</method>\r
<method name="Boolean t(Int32, Int32)" attrs="145">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>135</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>143</size>\r
</method>\r
<method name="Boolean t(Int32, Int32)" attrs="145">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>43</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-anon-09.cs">\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>77</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Test()" attrs="134">\r
<size>101</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>79</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Test[T](T)" attrs="134">\r
<size>65</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>15</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Test[T](T)" attrs="134">\r
<size>72</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>15</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Test[T](T)" attrs="134">\r
<size>29</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>15</size>\r
</method>\r
<method name="Void <Test`1>m__0[T](T)" attrs="129">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>82</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Test[A,B,C](A, B, C)" attrs="134">\r
<size>50</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>29</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="IEnumerable`1 Test(Int32)" attrs="150">\r
<size>37</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>62</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>13</size>\r
</method>\r
<method name="Void Test[R](R, Int32)" attrs="150">\r
<method name="Void set_Foo(IEnumerable`1)" attrs="2182">\r
<size>12</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>82</size>\r
</method>\r
<method name="Void <op_Implicit>m__0()" attrs="145">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>132</size>\r
</method>\r
<method name="Void <Main>m__0(Int32)" attrs="145">\r
<method name="IEnumerable`1 Test[T](T, T)" attrs="134">\r
<size>51</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>110</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>19</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="X+ModuleBinder`1[TDelegate] CreateMethodUnscoped[TDelegate]()" attrs="134">\r
<size>21</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="TDelegate <CreateMethodUnscoped`1>m__0[TDelegate](System.Object)" attrs="145">\r
<method name="Void SomeCaller()" attrs="129">\r
<size>37</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Int32 <SomeCaller>m__0(Int32)" attrs="145">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>17</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="A">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor(TestFunc`1)" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>283</size>\r
</method>\r
<method name="System.Collections.ArrayList Find(predicate, System.Collections.ArrayList)" attrs="145">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>43</size>\r
</method>\r
<method name="D T()" attrs="129">\r
<method name="Void Test[T](T)" attrs="134">\r
<size>49</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>100</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>23</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>50</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Method()" attrs="145">\r
<size>2</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>32</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>67</size>\r
</method>\r
<method name="Void <Main>m__3(Int32, Int32, Int32)" attrs="145">\r
</test>\r
<test name="test-anon-149.cs">\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void DetermineLinkedCells()" attrs="129">\r
</method>\r
</type>\r
<type name="Driver">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>20</size>\r
</method>\r
<method name="Void P(Int32, Int32)" attrs="129">\r
</test>\r
<test name="test-anon-153.cs">\r
<type name="TestComp.Program">\r
- <method name="Void Main(System.String[])" attrs="145">\r
+ <method name="Void Main(System.String[])" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void cf[T]()" attrs="145">\r
<size>36</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>25</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="M">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>14</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>43</size>\r
</method>\r
<method name="D T()" attrs="129">\r
</test>\r
<test name="test-anon-161.cs">\r
<type name="TestCase">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>33</size>\r
</method>\r
<method name="Void Test[T](IList`1)" attrs="150">\r
</test>\r
<test name="test-anon-169.cs">\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>521</size>\r
</method>\r
</type>\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>74</size>\r
</method>\r
<method name="Void <Main>m__0()" attrs="145">\r
</method>\r
</type>\r
<type name="DelegateTest">\r
- <method name="Void Main(System.String[])" attrs="145">\r
+ <method name="Void Main(System.String[])" attrs="150">\r
<size>87</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>248</size>\r
</method>\r
<method name="Boolean t(Int32, Int32)" attrs="145">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>34</size>\r
</method>\r
<method name="D MainHost()" attrs="145">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>81</size>\r
</method>\r
<method name="Void M()" attrs="129">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>34</size>\r
</method>\r
<method name="D T()" attrs="145">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>81</size>\r
</method>\r
<method name="Void M()" attrs="129">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>30</size>\r
</method>\r
<method name="D T(Int32)" attrs="145">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>56</size>\r
</method>\r
<method name="D T(Int32)" attrs="145">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>151</size>\r
</method>\r
<method name="Void M(Int32)" attrs="129">\r
</method>\r
</type>\r
<type name="DelegateTest">\r
- <method name="Void Main(System.String[])" attrs="145">\r
+ <method name="Void Main(System.String[])" attrs="150">\r
<size>59</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void remove_E(Program+D)" attrs="2193">\r
<size>40</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>39</size>\r
</method>\r
</type>\r
</test>\r
<test name="test-anon-31.cs">\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>36</size>\r
</method>\r
<method name="Void DoCall(X+test)" attrs="145">\r
<method name="Void doit(Int32)" attrs="145">\r
<size>8</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>171</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void SpaceLeak()" attrs="145">\r
<size>38</size>\r
</method>\r
- <method name="Void Main(System.String[])" attrs="145">\r
+ <method name="Void Main(System.String[])" attrs="150">\r
<size>7</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Test(Int32)" attrs="134">\r
<size>68</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>15</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Test(Int32)" attrs="134">\r
<size>66</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>15</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Test(Int32)" attrs="134">\r
<size>66</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>15</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Test(Int32)" attrs="134">\r
<size>66</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>15</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Test(Int32)" attrs="150">\r
<size>52</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>14</size>\r
</method>\r
<method name="Simple <Test>m__0()" attrs="145">\r
<method name="Void Test(Int32)" attrs="134">\r
<size>55</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>15</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Test(Int32)" attrs="134">\r
<size>69</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>15</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="TestClass">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>14</size>\r
</method>\r
<method name="Void <a>m__0(Int32)" attrs="145">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>15</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>15</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>15</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>252</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="IEnumerator GetIt(System.Int32[])" attrs="145">\r
<size>29</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>40</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>16</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>23</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>14</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Observable">\r
- <method name="Void Main(System.String[])" attrs="145">\r
+ <method name="Void Main(System.String[])" attrs="150">\r
<size>51</size>\r
</method>\r
<method name="Void <Main>m__0(Observable)" attrs="145">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor(String)" attrs="6278">\r
<method name="IEnumerator GetIt(System.Int32[])" attrs="145">\r
<size>29</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>40</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void AddSource(Source, Int32, System.Object)" attrs="129">\r
<size>106</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void <AddSource>m__1(System.Object, System.EventArgs)" attrs="145">\r
</method>\r
</type>\r
<type name="TestClass">\r
- <method name="Int32 Main(System.String[])" attrs="145">\r
+ <method name="Int32 Main(System.String[])" attrs="150">\r
<size>17</size>\r
</method>\r
<method name="Void .ctor(Int32)" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="T">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>32</size>\r
</method>\r
<method name="Void Test_1()" attrs="145">\r
<method name="Void X()" attrs="134">\r
<size>25</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>83</size>\r
</method>\r
<method name="System.Object <X>m__0()" attrs="129">\r
</test>\r
<test name="test-anon-80.cs">\r
<type name="MonoBug.MyTest">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>190</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-anon-85.cs">\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>37</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 Run(Int32)" attrs="145">\r
<size>20</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>110</size>\r
</method>\r
</type>\r
</method>\r
</type>\r
<type name="Program">\r
- <method name="Void Main(System.String[])" attrs="145">\r
+ <method name="Void Main(System.String[])" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void Test()" attrs="129">\r
<size>38</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>20</size>\r
</method>\r
<method name="Void <Test>m__0()" attrs="145">\r
</test>\r
<test name="test-async-01.cs">\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>131</size>\r
</method>\r
<method name="Void TestAsync()" attrs="145">\r
</test>\r
<test name="test-async-06.cs">\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>482</size>\r
</method>\r
<method name="System.Threading.Tasks.Task`1[System.Decimal] <Main>m__4(Decimal)" attrs="145">\r
</test>\r
<test name="test-async-07.cs">\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>358</size>\r
</method>\r
<method name="System.Threading.Tasks.Task`1[System.Int16] <Main>m__2(Int16)" attrs="145">\r
<method name="Int32 Foo[T](System.Func`2[T,System.Threading.Tasks.Task`1[System.Int16]])" attrs="145">\r
<size>10</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>57</size>\r
</method>\r
<method name="System.Threading.Tasks.Task`1[System.Int16] <Main>m__0(System.String)" attrs="145">\r
</method>\r
</type>\r
<type name="C">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>80</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void CompilationTestOnly()" attrs="145">\r
<size>66</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Int32 <CompilationTestOnly>m__0()" attrs="145">\r
<method name="System.Threading.Tasks.Task`1[TResult] GetTaskResult[TResult](System.Threading.Tasks.Task`1[System.Threading.Tasks.Task`1[TResult]])" attrs="145">\r
<size>41</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>95</size>\r
</method>\r
<method name="System.Threading.Tasks.Task`1[System.Int32] <Main>m__0()" attrs="145">\r
<method name="System.Threading.Tasks.Task`1[System.Int32] TestException()" attrs="145">\r
<size>33</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>274</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>76</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="System.Threading.Tasks.Task`1[System.Int32] AsyncMethod()" attrs="150">\r
<size>33</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>178</size>\r
</method>\r
<method name="System.Threading.Tasks.Task`1[System.Int32] <Main>m__0()" attrs="145">\r
</test>\r
<test name="test-async-39.cs">\r
<type name="CompilerBug">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>24</size>\r
</method>\r
<method name="System.Threading.Tasks.Task`1[System.String] Foo()" attrs="145">\r
</method>\r
</type>\r
</test>\r
+ <test name="test-async-41.cs">\r
+ <type name="AmbiguousGeneric">\r
+ <method name="Void NestedVoidTestSuccess()" attrs="134">\r
+ <size>35</size>\r
+ </method>\r
+ <method name="System.Threading.Tasks.Task`1[System.Int32] ReturnOne()" attrs="145">\r
+ <size>43</size>\r
+ </method>\r
+ <method name="System.Threading.Tasks.Task Run2(System.Func`1[System.Threading.Tasks.Task])" attrs="129">\r
+ <size>10</size>\r
+ </method>\r
+ <method name="System.Threading.Tasks.Task Run2[T](System.Func`1[T])" attrs="129">\r
+ <size>10</size>\r
+ </method>\r
+ <method name="Void Main()" attrs="150">\r
+ <size>2</size>\r
+ </method>\r
+ <method name="Int32 <ReturnOne>m__0()" attrs="145">\r
+ <size>9</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ <type name="AmbiguousGeneric+<NestedVoidTestSuccess>c__async0">\r
+ <method name="Void MoveNext()" attrs="486">\r
+ <size>191</size>\r
+ </method>\r
+ <method name="Void SetStateMachine(IAsyncStateMachine)" attrs="486">\r
+ <size>13</size>\r
+ </method>\r
+ <method name="System.Threading.Tasks.Task`1[System.Int32] <>m__1()" attrs="145">\r
+ <size>33</size>\r
+ </method>\r
+ </type>\r
+ <type name="AmbiguousGeneric+<NestedVoidTestSuccess>c__async0+<NestedVoidTestSuccess>c__async4">\r
+ <method name="Void MoveNext()" attrs="486">\r
+ <size>162</size>\r
+ </method>\r
+ <method name="Void SetStateMachine(IAsyncStateMachine)" attrs="486">\r
+ <size>13</size>\r
+ </method>\r
+ </type>\r
+ </test>\r
<test name="test-cls-00.cs">\r
<type name="CLSCLass_6">\r
<method name="Void add_Disposed(Delegate)" attrs="2182">\r
<method name="I1 Foo()" attrs="133">\r
<size>10</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
</test>\r
+ <test name="test-com-01.cs">\r
+ <type name="CorMetaDataDispenserExClass">\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>0</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test">\r
+ <method name="Void XXX()" attrs="150">\r
+ <size>13</size>\r
+ </method>\r
+ <method name="Void Main()" attrs="150">\r
+ <size>2</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ </test>\r
<test name="test-debug-01.cs">\r
<type name="C">\r
<method name="Void Main()" attrs="150">\r
<method name="Program get_Prop()" attrs="2182">\r
<size>10</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Program <Test_4>m__0()" attrs="145">\r
</test>\r
<test name="test-debug-25.cs">\r
<type name="TestClass">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-externalias-01.cs">\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>92</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-externalias-02.cs">\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>92</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-externalias-03.cs">\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>92</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-externalias-04.cs">\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>92</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-externalias-05.cs">\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>22</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>28</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-externalias-08.cs">\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>82</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-externalias-09.cs">\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>16</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="IEnumerable GetIt2()" attrs="145">\r
<size>23</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>199</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="IEnumerator GetRange()" attrs="145">\r
<size>15</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>103</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="IEnumerable GetMulti(System.Int32[,])" attrs="145">\r
<size>37</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>275</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="IEnumerable GetRange(Int32, Int32)" attrs="145">\r
<size>51</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>104</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="IEnumerable GetIt()" attrs="145">\r
<size>23</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>119</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="IEnumerable GetS(Int32)" attrs="145">\r
<size>37</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>449</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>464</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="IEnumerable Test(Int32, Int32)" attrs="150">\r
<size>51</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>210</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void set_Item(Int32, IEnumerable)" attrs="2177">\r
<size>2</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>211</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Void M(System.Object, System.EventArgs)" attrs="145">\r
<size>12</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>40</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="IEnumerable a()" attrs="129">\r
<size>30</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="IEnumerable X()" attrs="145">\r
<size>23</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>69</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="IEnumerator GetEnumerator()" attrs="134">\r
<size>22</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>12</size>\r
</method>\r
<method name="Void Run()" attrs="129">\r
<method name="IEnumerable foo()" attrs="150">\r
<size>23</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>78</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="IEnumerable get_Empty()" attrs="2198">\r
<size>23</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>62</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="IEnumerable GetIt(System.Int32[])" attrs="145">\r
<size>37</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>138</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 Delay()" attrs="145">\r
<size>28</size>\r
</method>\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>141</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="IEnumerable`1 TagsError()" attrs="150">\r
<size>23</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>68</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Y">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>47</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>60</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="D">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="B">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>80</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>96</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>112</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<method name="Int32 GetHashCode()" attrs="198">\r
<size>10</size>\r
</method>\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="ConsoleApplication1.Program">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>116</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="TestCase">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-partial-29.cs">\r
<type name="C">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
</type>\r
</test>\r
<test name="test-var-01.cs">\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>70</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>164</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-var-03.cs">\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>201</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>72</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-var-06.cs">\r
<type name="Test">\r
- <method name="Int32 Main()" attrs="145">\r
+ <method name="Int32 Main()" attrs="150">\r
<size>68</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</test>\r
<test name="test-var-08.cs">\r
<type name="X">\r
- <method name="Void Main()" attrs="145">\r
+ <method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor(Int32, Int32)" attrs="6278">\r
--- /dev/null
+<?xml version="1.0" encoding="utf-8" ?>\r
+<configuration>\r
+ <runtime>\r
+ <loadFromRemoteSources enabled="true"/>\r
+ </runtime>\r
+</configuration>
\ No newline at end of file
<Compile Include="compiler-tester.cs" />\r
<Compile Include="xmldocdiff.cs" />\r
</ItemGroup>\r
+ <ItemGroup>\r
+ <None Include="App.config" />\r
+ </ItemGroup>\r
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />\r
</Project>
\ No newline at end of file
}
}
+ class NUnitChecker : PositiveChecker
+ {
+ class TestCaseEntry
+ {
+ string name;
+ string referenceFile;
+ string executedMethod;
+ bool has_return;
+
+ public TestCaseEntry (string name, string referenceFile, MethodInfo executedMethod)
+ {
+ this.name = name.Replace ('-', '_');
+ this.referenceFile = referenceFile;
+ this.executedMethod = ConvertMethodInfoToText (executedMethod, out has_return);
+ }
+
+ public string Name
+ {
+ get
+ {
+ return name;
+ }
+ }
+
+ public string ReferenceFile {
+ get {
+ return referenceFile;
+ }
+ }
+
+ static string ConvertMethodInfoToText (MethodInfo mi, out bool hasReturn)
+ {
+ hasReturn = mi.ReturnType != typeof (void);
+ string declaring = mi.DeclaringType.FullName.Replace ('+', '.');
+ var param = mi.GetParameters ();
+ if (param.Length == 0)
+ return declaring + "." + mi.Name + " ()";
+
+ return declaring + "." + mi.Name + " (new string[0])";
+ }
+
+ public string GetTestFixture ()
+ {
+ var call = name + "::" + executedMethod;
+ if (!has_return)
+ return call;
+
+ return string.Format ("Assert.AreEqual (0, {0})", call);
+ }
+ }
+
+ List<TestCaseEntry> entries = new List<TestCaseEntry> ();
+
+ public NUnitChecker (ITester tester)
+ : base (tester, null)
+ {
+ }
+
+ public override void CleanUp ()
+ {
+ base.CleanUp ();
+
+ StringBuilder aliases = new StringBuilder ();
+ var src_dir = Path.Combine ("projects", "MonoTouch");
+ string src_file = Path.Combine (src_dir, "tests.cs");
+
+ using (var file = new StreamWriter (src_file, false)) {
+ foreach (var e in entries) {
+ file.WriteLine ("extern alias {0};", e.Name);
+ aliases.AppendFormat (" <Reference Include=\"{0}\">", Path.GetFileNameWithoutExtension (e.ReferenceFile));
+ aliases.Append (Environment.NewLine);
+ aliases.AppendFormat (" <Aliases>{0}</Aliases>", e.Name);
+ aliases.Append (Environment.NewLine);
+ aliases.AppendFormat (" <HintPath>..\\..\\{0}</HintPath>", Path.GetFileName (e.ReferenceFile));
+ aliases.Append (Environment.NewLine);
+ aliases.AppendLine (" </Reference>");
+ }
+
+ file.WriteLine ();
+ file.WriteLine ("using NUnit.Framework;");
+ file.WriteLine ();
+ file.WriteLine ("[TestFixture]");
+ file.WriteLine ("public class Tests {");
+
+ foreach (var e in entries) {
+ file.WriteLine ("\t[Test]");
+ file.WriteLine ("\tpublic void TestFile_{0} ()", e.Name);
+ file.WriteLine ("\t{");
+ file.WriteLine ("\t\t{0};", e.GetTestFixture ());
+ file.WriteLine ("\t}");
+ file.WriteLine ();
+ }
+
+ file.WriteLine ("}");
+ }
+
+ var input = File.ReadAllText (Path.Combine (src_dir, "MonoTouch.csproj.template"));
+ input = input.Replace ("@GENERATED_REFERENCES", aliases.ToString ());
+ input = input.Replace ("@TEST_SOURCEFILE", Path.GetFileName (src_file));
+
+ File.WriteAllText (Path.Combine (src_dir, "MonoTouch.csproj"), input);
+ return;
+ }
+
+ protected override bool ExecuteTestFile (TestCase test, string binaryFileName)
+ {
+ Assembly assembly = Assembly.LoadFile (binaryFileName);
+ var ep = assembly.EntryPoint;
+ if (!ep.IsPublic) {
+ HandleFailure (test.FileName, TestResult.LoadError, "Entry method is private");
+ return false;
+ }
+
+ if (ep.DeclaringType.IsNestedPrivate || ep.DeclaringType.IsNestedFamily) {
+ HandleFailure (test.FileName, TestResult.LoadError, "Entry method in hidden nested type");
+ return false;
+ }
+
+ entries.Add (new TestCaseEntry (Path.GetFileNameWithoutExtension (test.FileName), binaryFileName, ep));
+ HandleFailure (test.FileName, TestResult.Success, null);
+ return true;
+ }
+ }
+
class PositiveTestCase : TestCase
{
public class VerificationData : MarshalByRefObject
protected ArrayList know_issues = new ArrayList ();
protected ArrayList ignore_list = new ArrayList ();
protected ArrayList no_error_list = new ArrayList ();
+ ArrayList skip = new ArrayList ();
protected bool verbose;
protected bool safe_execution;
if (verbose)
Log (filename + "...\t");
+ if (skip.Contains (filename)) {
+ return false;
+ }
+
if (ignore_list.Contains (filename)) {
++ignored;
LogFileLine (filename, "NOT TESTED");
string[] test_args;
if (test.CompilerOptions != null) {
- test_args = new string [2 + test.CompilerOptions.Length];
+ test_args = new string[2 + test.CompilerOptions.Length];
test.CompilerOptions.CopyTo (test_args, 0);
} else {
- test_args = new string [2];
+ test_args = new string[2];
}
- test_args [test_args.Length - 2] = test.FileName;
- test_args [test_args.Length - 1] = "-debug";
+ test_args[test_args.Length - 2] = test_args[0];
+ test_args[test_args.Length - 1] = "-debug";
+ test_args[0] = test.FileName;
return tester.Invoke (test_args);
}
{
const string ignored = "IGNORE";
const string no_error = "NO ERROR";
+ const string skip_tag = "SKIP";
using (StreamReader sr = new StreamReader (file)) {
string line;
active_cont = ignore_list;
else if (line.IndexOf (no_error) > 0)
active_cont = no_error_list;
+ else if (line.Contains (skip_tag))
+ active_cont = skip;
string file_name = line.Split (' ')[0];
if (file_name.Length == 0)
return true;
}
+ return ExecuteTestFile (test, file);
+ }
+
+ protected virtual bool ExecuteTestFile (TestCase test, string binaryFileName)
+ {
+ string filename = test.FileName;
+
AppDomain domain = null;
#if !NET_2_1
if (safe_execution) {
AppDomainSetup setupInfo = new AppDomainSetup ();
setupInfo.ApplicationBase = AppDomain.CurrentDomain.BaseDirectory;
setupInfo.LoaderOptimization = LoaderOptimization.SingleDomain;
- domain = AppDomain.CreateDomain (Path.GetFileNameWithoutExtension (file), null, setupInfo);
+ domain = AppDomain.CreateDomain (Path.GetFileNameWithoutExtension (binaryFileName), null, setupInfo);
}
#endif
try {
#endif
tester = new DomainTester ();
- if (!tester.Test (file))
+ if (!tester.Test (binaryFileName))
return false;
} catch (ApplicationException e) {
PositiveTestCase pt = (PositiveTestCase) test;
pt.VerificationProvider = (PositiveTestCase.VerificationData) verif_data[filename];
- if (!tester.CheckILSize (pt, this, file))
+ if (!tester.CheckILSize (pt, this, binaryFileName))
return false;
}
if (filename.StartsWith ("test-debug", StringComparison.OrdinalIgnoreCase)) {
- var mdb_file_name = file + ".mdb";
+ var mdb_file_name = binaryFileName + ".mdb";
MonoSymbolFile mdb_file = MonoSymbolFile.ReadSymbolFile (mdb_file_name);
var mdb_xml_file = mdb_file_name + ".xml";
ConvertSymbolFileToXml (mdb_file, mdb_xml_file);
break;
case TestResult.LoadError:
- LogFileLine (file, "REGRESSION (SUCCESS -> LOAD ERROR)");
+ if (extra != null)
+ extra = ": " + extra;
+
+ LogFileLine (file, "REGRESSION (SUCCESS -> LOAD ERROR)" + extra);
+ extra = null;
break;
case TestResult.MethodAttributesError:
((PositiveChecker) checker).UpdateVerificationDataFile = true;
}
+ break;
+ case "nunit":
+ positive = true;
+ checker = new NUnitChecker (tester);
break;
default:
Console.Error.WriteLine ("Invalid -mode argument");
return result;
}
+
+ public void SaveHistory ()
+ {
+ if (history != null) {
+ history.Close ();
+ }
+ }
public bool TabAtStartCompletes { get; set; }
expr = expr == null ? input : expr + "\n" + input;
expr = Evaluate (expr);
- }
+ }
}
public int ReadEvalPrintLoop ()
LoadStartupFiles ();
- if (startup_files != null && startup_files.Length != 0)
+ if (startup_files != null && startup_files.Length != 0) {
ExecuteSources (startup_files, false);
- else if (Driver.StartupEvalExpression != null){
- ReadEvalPrintLoopWith (p => {
- var ret = Driver.StartupEvalExpression;
- Driver.StartupEvalExpression = null;
- return ret;
- });
- } else
- ReadEvalPrintLoopWith (GetLine);
+ } else {
+ if (Driver.StartupEvalExpression != null){
+ ReadEvalPrintLoopWith (p => {
+ var ret = Driver.StartupEvalExpression;
+ Driver.StartupEvalExpression = null;
+ return ret;
+ });
+ } else {
+ ReadEvalPrintLoopWith (GetLine);
+ }
+
+ editor.SaveHistory ();
+ }
+ Console.CancelKeyPress -= ConsoleInterrupt;
+
return 0;
}
public AssemblyDefinition Resolve (IMetadataScope scope)
{
AssemblyNameReference reference = GetReference (scope);
+ try {
+ AssemblyDefinition assembly = _resolver.Resolve (reference, _readerParameters);
- AssemblyDefinition assembly = _resolver.Resolve (reference, _readerParameters);
+ if (SeenFirstTime (assembly)) {
+ SafeReadSymbols (assembly);
+ SetAction (assembly);
+ }
- if (SeenFirstTime (assembly)) {
- SafeReadSymbols (assembly);
- SetAction (assembly);
+ return assembly;
+ }
+ catch {
+ throw new AssemblyResolutionException (reference);
}
-
- return assembly;
}
bool SeenFirstTime (AssemblyDefinition assembly)
return CreateDefaultDocument ();
var settings = new XmlReaderSettings {
- ProhibitDtd = false,
+ DtdProcessing = DtdProcessing.Parse
};
using (var reader = XmlReader.Create (file, settings))
return XDocument.Load (reader);
MyXmlNodeList extensionMethods = new MyXmlNodeList ();
+ HashSet<string> forwardedTypes = new HashSet<string> ();
+
public override void Run (IEnumerable<string> args)
{
show_exceptions = DebugOutput;
this.assemblies = assemblies.Select (a => LoadAssembly (a)).ToList ();
+ // Store types that have been forwarded to avoid duplicate generation
+ GatherForwardedTypes ();
+
docEnum = docEnum ?? new DocumentationEnumerator ();
// PERFORM THE UPDATES
}
}
+ void GatherForwardedTypes ()
+ {
+ foreach (var asm in assemblies)
+ foreach (var type in asm.MainModule.ExportedTypes.Where (t => t.IsForwarder).Select (t => t.FullName))
+ forwardedTypes.Add (type);
+ }
+
static ExceptionLocations ParseExceptionLocations (string s)
{
ExceptionLocations loc = ExceptionLocations.Member;
{
foreach (TypeDefinition type in docEnum.GetDocumentationTypes (assembly, null)) {
string typename = GetTypeFileName(type);
- if (!IsPublic (type) || typename.IndexOfAny (InvalidFilenameChars) >= 0)
+ if (!IsPublic (type) || typename.IndexOfAny (InvalidFilenameChars) >= 0 || forwardedTypes.Contains (type.FullName))
continue;
string reltypepath = DoUpdateType (type, source, dest);
--- /dev/null
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+[assembly:AssemblyVersion("1.0.0.0")]
+[assembly:AssemblyDelaySign(false)]
+[assembly:AssemblyKeyFile("../../class/mono.snk")]
--- /dev/null
+thisdir = tools/monkeydoc
+SUBDIRS =
+include ../../build/rules.make
+
+LIBRARY = monkeydoc.dll
+LIBRARY_PACKAGE = monkeydoc
+# Remove a bunch of "obsolete"-type warning for Lucene.NET
+LOCAL_MCS_FLAGS = /nowarn:618,612,672,809
+
+JAY_FLAGS = -ct
+
+IMAGES = \
+ Resources/images/bc_bg.png \
+ Resources/images/bc_separator.png \
+ Resources/images/error.png \
+ Resources/images/hatch.png \
+ Resources/images/headerbg.png \
+ Resources/images/help.png \
+ Resources/images/house.png \
+ Resources/images/members.png \
+ Resources/images/namespace.png \
+ Resources/images/privclass.png \
+ Resources/images/privdelegate.png \
+ Resources/images/privenumeration.png \
+ Resources/images/privevent.png \
+ Resources/images/privextension.png \
+ Resources/images/privfield.png \
+ Resources/images/privinterface.png \
+ Resources/images/privmethod.png \
+ Resources/images/privproperty.png \
+ Resources/images/privstructure.png \
+ Resources/images/protclass.png \
+ Resources/images/protdelegate.png \
+ Resources/images/protenumeration.png \
+ Resources/images/protevent.png \
+ Resources/images/protextension.png \
+ Resources/images/protfield.png \
+ Resources/images/protinterface.png \
+ Resources/images/protmethod.png \
+ Resources/images/protproperty.png \
+ Resources/images/protstructure.png \
+ Resources/images/pubclass.png \
+ Resources/images/pubdelegate.png \
+ Resources/images/pubenumeration.png \
+ Resources/images/pubevent.png \
+ Resources/images/pubextension.png \
+ Resources/images/pubfield.png \
+ Resources/images/pubinterface.png \
+ Resources/images/pubmethod.png \
+ Resources/images/pubproperty.png \
+ Resources/images/pubstructure.png \
+ Resources/images/reference.png \
+ Resources/images/treebg.png
+
+IMAGE_RESOURCE_COMMAND = $(foreach file,$(IMAGES),/resource:$(file),$(notdir $(file)))
+
+RESOURCE_FILES = \
+ ../../docs/monodoc.xml \
+ Resources/base.css \
+ Resources/ecmaspec-html-css.xsl \
+ Resources/ecmaspec-html.xsl \
+ Resources/ecmaspec.css \
+ Resources/helper.js \
+ Resources/home.html \
+ Resources/Lminus.gif \
+ Resources/Lplus.gif \
+ Resources/mdoc-html-format.xsl \
+ Resources/mdoc-html-utils.xsl \
+ Resources/mdoc-sections-css.xsl \
+ Resources/mdoc-sections.xsl \
+ Resources/mono-ecma-css.xsl \
+ Resources/mono-ecma-impl.xsl \
+ Resources/mono-ecma.css \
+ Resources/mono-ecma.xsl \
+ Resources/toc-html.xsl \
+ $(IMAGES)
+
+EXTRA_DISTFILES = \
+ monkeydoc.dll.config.in \
+ $(RESOURCE_FILES)
+
+LIB_MCS_FLAGS = \
+ /unsafe \
+ /codepage:utf8 \
+ /nowarn:169,164,162,168,219,618,612 \
+ /r:Commons.Xml.Relaxng \
+ /resource:../../docs/monodoc.xml,monodoc.xml \
+ /resource:Resources/base.css,base.css \
+ /resource:Resources/ecmaspec-html-css.xsl,ecmaspec-html-css.xsl \
+ /resource:Resources/ecmaspec-html.xsl,ecmaspec-html.xsl \
+ /resource:Resources/ecmaspec.css,ecmaspec.css \
+ /resource:Resources/helper.js,helper.js \
+ /resource:Resources/home.html,home.html \
+ /resource:Resources/Lminus.gif,Lminus.gif \
+ /resource:Resources/Lplus.gif,Lplus.gif \
+ /resource:Resources/mdoc-html-format.xsl,mdoc-html-format.xsl \
+ /resource:Resources/mdoc-html-utils.xsl,mdoc-html-utils.xsl \
+ /resource:Resources/mdoc-sections-css.xsl,mdoc-sections-css.xsl \
+ /resource:Resources/mdoc-sections.xsl,mdoc-sections.xsl \
+ /resource:Resources/mono-ecma-css.xsl,mono-ecma-css.xsl \
+ /resource:Resources/mono-ecma-impl.xsl,mono-ecma-impl.xsl \
+ /resource:Resources/mono-ecma.css,mono-ecma.css \
+ /resource:Resources/mono-ecma.xsl,mono-ecma.xsl \
+ /resource:Resources/toc-html.xsl,toc-html.xsl \
+ $(IMAGE_RESOURCE_COMMAND) \
+ /r:ICSharpCode.SharpZipLib \
+ /r:$(corlib) \
+ /r:System.dll \
+ /r:System.Core.dll \
+ /r:System.Xml.dll \
+ /r:System.Xml.Linq.dll \
+ /r:System.Configuration.dll
+
+TEST_MCS_FLAGS = /r:System.Core.dll
+
+DOC_SOURCE_DIRS = \
+ ../../docs \
+ ../../../docs
+
+DOC_SOURCES = $(foreach dir,$(DOC_SOURCE_DIRS),$(wildcard $(dir)/*.source $(dir)/*.tree $(dir)/*.zip))
+
+include ../../build/library.make
+
+$(the_lib): Makefile $(RESOURCE_FILES)
+
+all-local: $(the_lib).config Monkeydoc.Ecma/EcmaUrlParser.cs
+
+test-local: setup-doc-sources
+
+$(the_lib).config: Makefile
+ sed 's,@monodoc_refdir@,$(mono_libdir)/monodoc,g' monkeydoc.dll.config.in > $@
+
+Monkeydoc.Ecma/EcmaUrlParser.cs: Monkeydoc.Ecma/EcmaUrlParser.jay $(topdir)/jay/skeleton.cs
+ $(topdir)/jay/jay $(JAY_FLAGS) < $(topdir)/jay/skeleton.cs $< > jay-tmp.out && mv jay-tmp.out $@
+
+parser.exe: Monkeydoc.Ecma/EcmaUrlParser.cs Monkeydoc.Ecma/EcmaUrlTokenizer.cs Monkeydoc.Ecma/EcmaUrlParserDriver.cs Monkeydoc.Ecma/EcmaDesc.cs
+ mcs /out:$@ /debug $^
+
+setup-doc-sources: $(DOC_SOURCES)
+ mkdir -p ./Test/monodoc/sources/
+ cp $(DOC_SOURCES) ./Test/monodoc/sources/
--- /dev/null
+using System;
+using System.Linq;
+using System.Text;
+using System.Collections.Generic;
+
+namespace Monkeydoc.Ecma
+{
+ /* Some properties might not be filled/meaningful depending on kind
+ * like a namespace EcmaUrl won't have a valid TypeName
+ */
+ public class EcmaDesc : IEquatable<EcmaDesc>
+ {
+ public enum Kind
+ {
+ Type,
+ Constructor,
+ Method,
+ Namespace,
+ Field,
+ Property,
+ Event,
+ Operator
+ }
+
+ public enum Mod
+ {
+ Normal,
+ Pointer,
+ Ref,
+ Out
+ }
+
+ public enum Format
+ {
+ WithArgs,
+ WithoutArgs
+ }
+
+ public Kind DescKind {
+ get;
+ set;
+ }
+
+ public Mod DescModifier {
+ get;
+ set;
+ }
+
+ public string Namespace {
+ get;
+ set;
+ }
+
+ public string TypeName {
+ get;
+ set;
+ }
+
+ public string MemberName {
+ get;
+ set;
+ }
+
+ public EcmaDesc NestedType {
+ get;
+ set;
+ }
+
+ /* A list of the array dimensions attached to this type.
+ * The list count corresponds to the number of recursive
+ * array definition (jagged arrays) the value of the
+ * corresponding list item is the number of dimension
+ * attached to that array definition instance
+ */
+ public IList<int> ArrayDimensions {
+ get;
+ set;
+ }
+
+ /* Depending on the form of the url, we might not have the type
+ * of the argument but only how many the type/member has i.e.
+ * when such number is specified with a backtick
+ */
+ public IList<EcmaDesc> GenericTypeArguments {
+ get;
+ set;
+ }
+
+ public IList<EcmaDesc> GenericMemberArguments {
+ get;
+ set;
+ }
+
+ public IList<EcmaDesc> MemberArguments {
+ get;
+ set;
+ }
+
+ /* This indicates that we actually want an inner part of the ecmadesc
+ * i.e. in case of T: we could want the members (*), ctor (C), methods (M), ...
+ */
+ public char Etc {
+ get;
+ set;
+ }
+
+ public bool IsEtc {
+ get {
+ return Etc != (char)0;
+ }
+ }
+
+ /* EtcFilter is only valid in some case of IsEtc when the inner part needs
+ * to be further filtered e.g. in case we want a listing of the type overloads
+ * Equals
+ */
+ public string EtcFilter {
+ get;
+ set;
+ }
+
+ /* When a member is an explicit implementation of an interface member, we register
+ * the member EcmaDesc with its interface parent here
+ */
+ public EcmaDesc ExplicitImplMember {
+ get;
+ set;
+ }
+
+ // Returns the TypeName and the generic/inner type information if existing
+ public string ToCompleteTypeName (char innerTypeSeparator = '.')
+ {
+ var result = TypeName;
+ if (GenericTypeArguments != null)
+ result += FormatGenericArgs (GenericTypeArguments);
+ if (NestedType != null)
+ result += innerTypeSeparator + NestedType.ToCompleteTypeName ();
+ if (ArrayDimensions != null && ArrayDimensions.Count > 0)
+ result += ArrayDimensions.Select (dim => "[" + new string (',', dim - 1) + "]").Aggregate (string.Concat);
+
+ return result;
+ }
+
+ // Returns the member name with its generic types if existing
+ public string ToCompleteMemberName (Format format)
+ {
+ /* We special process two cases:
+ * - Explicit member implementation which append a full type specification
+ * - Conversion operator which are exposed as normal method but have specific captioning in the end
+ */
+ if (ExplicitImplMember != null) {
+ var impl = ExplicitImplMember;
+ return impl.FormattedNamespace + impl.ToCompleteTypeName () + "." + impl.ToCompleteMemberName (format);
+ } else if (format == Format.WithArgs && DescKind == Kind.Operator && MemberName.EndsWith ("Conversion")) {
+ var type1 = MemberArguments[0].FormattedNamespace + MemberArguments[0].ToCompleteTypeName () + ModToString (MemberArguments[0]);
+ var type2 = MemberArguments[1].FormattedNamespace + MemberArguments[1].ToCompleteTypeName () + ModToString (MemberArguments[1]);
+ return type1 + " to " + type2;
+ }
+
+ var result = IsEtc && !string.IsNullOrEmpty (EtcFilter) ? EtcFilter : MemberName;
+
+ // Temporary hack for monodoc produced inner type ctor
+ //if (DescKind == Kind.Constructor && NestedType != null)
+ //result = ToCompleteTypeName ();
+
+ if (GenericMemberArguments != null)
+ result += FormatGenericArgs (GenericMemberArguments);
+
+ if (format == Format.WithArgs) {
+ result += '(';
+ if (MemberArguments != null && MemberArguments.Count > 0) {
+ var args = MemberArguments.Select (a => FormatNamespace (a) + a.ToCompleteTypeName ('+') + ModToString (a));
+ result += string.Join (",", args);
+ }
+ result += ')';
+ }
+
+ return result;
+ }
+
+ public string ToEcmaCref ()
+ {
+ var sb = new StringBuilder ();
+ // Cref type
+ sb.Append (DescKind.ToString ()[0]);
+ // Create the rest
+ ConstructCRef (sb);
+
+ return sb.ToString ();
+ }
+
+ void ConstructCRef (StringBuilder sb)
+ {
+ sb.Append (Namespace);
+ if (DescKind == Kind.Namespace)
+ return;
+
+ sb.Append ('.');
+ sb.Append (TypeName);
+ if (GenericTypeArguments != null) {
+ sb.Append ('<');
+ foreach (var t in GenericTypeArguments)
+ t.ConstructCRef (sb);
+ sb.Append ('>');
+ }
+ if (NestedType != null) {
+ sb.Append ('+');
+ NestedType.ConstructCRef (sb);
+ }
+ if (ArrayDimensions != null && ArrayDimensions.Count > 0) {
+ for (int i = 0; i < ArrayDimensions.Count; i++) {
+ sb.Append ('[');
+ sb.Append (new string (',', ArrayDimensions[i] - 1));
+ sb.Append (']');
+ }
+ }
+ if (DescKind == Kind.Type)
+ return;
+
+ if (MemberArguments != null) {
+
+ }
+ }
+
+ public override string ToString ()
+ {
+ return string.Format ("({8}) {0}::{1}{2}{3}{7} {4}{5}{6} {9} {10}",
+ Namespace,
+ TypeName,
+ FormatGenericArgsFull (GenericTypeArguments),
+ NestedType != null ? "+" + NestedType.ToString () : string.Empty,
+ MemberName ?? string.Empty,
+ FormatGenericArgsFull (GenericMemberArguments),
+ MemberArguments != null ? "(" + string.Join (",", MemberArguments.Select (m => m.ToString ())) + ")" : string.Empty,
+ ArrayDimensions != null && ArrayDimensions.Count > 0 ? ArrayDimensions.Select (dim => "[" + new string (',', dim - 1) + "]").Aggregate (string.Concat) : string.Empty,
+ DescKind.ToString ()[0],
+ Etc != 0 ? '(' + Etc.ToString () + ')' : string.Empty,
+ ExplicitImplMember != null ? "$" + ExplicitImplMember.ToString () : string.Empty);
+
+ }
+
+ public override bool Equals (object other)
+ {
+ var otherDesc = other as EcmaDesc;
+ return otherDesc != null && Equals (otherDesc);
+ }
+
+ public bool Equals (EcmaDesc other)
+ {
+ if (other == null)
+ return false;
+
+ if (NestedType == null ^ other.NestedType == null
+ || ArrayDimensions == null ^ other.ArrayDimensions == null
+ || GenericTypeArguments == null ^ other.GenericTypeArguments == null
+ || GenericMemberArguments == null ^ other.GenericMemberArguments == null
+ || MemberArguments == null ^ other.MemberArguments == null
+ || ExplicitImplMember == null ^ other.ExplicitImplMember == null)
+ return false;
+
+ return other != null
+ && DescKind == other.DescKind
+ && TypeName == other.TypeName
+ && Namespace == other.Namespace
+ && MemberName == other.MemberName
+ && (NestedType == null || NestedType.Equals (other.NestedType))
+ && (ArrayDimensions == null || ArrayDimensions.SequenceEqual (other.ArrayDimensions))
+ && (GenericTypeArguments == null || GenericTypeArguments.SequenceEqual (other.GenericTypeArguments))
+ && (GenericMemberArguments == null || GenericMemberArguments.SequenceEqual (other.GenericMemberArguments))
+ && (MemberArguments == null || MemberArguments.SequenceEqual (other.MemberArguments))
+ && Etc == other.Etc
+ && EtcFilter == other.EtcFilter
+ && (ExplicitImplMember == null || ExplicitImplMember.Equals (other.ExplicitImplMember));
+ }
+
+ public override int GetHashCode ()
+ {
+ return DescKind.GetHashCode ()
+ ^ TypeName.GetHashCode ()
+ ^ Namespace.GetHashCode ()
+ ^ MemberName.GetHashCode ();
+ }
+
+ bool What (bool input)
+ {
+ if (!input)
+ throw new Exception ("Not equal");
+ return input;
+ }
+
+ bool WhatT (bool input)
+ {
+ if (input)
+ throw new Exception ("Not equal");
+ return input;
+ }
+
+ string FormatNamespace (EcmaDesc desc)
+ {
+ return string.IsNullOrEmpty (desc.Namespace) ? string.Empty : desc.Namespace + ".";
+ }
+
+ string FormatGenericArgs (IEnumerable<EcmaDesc> genericArgs)
+ {
+ return genericArgs != null ? "<" + string.Join (",", genericArgs.Select (t => FormatNamespace (t) + t.ToCompleteTypeName ())) + ">" : string.Empty;
+ }
+
+ string FormatGenericArgsFull (IEnumerable<EcmaDesc> genericArgs)
+ {
+ return genericArgs != null ? "<" + string.Join (",", genericArgs.Select (t => t.ToString ())) + ">" : string.Empty;
+ }
+
+ string ModToString (EcmaDesc desc)
+ {
+ switch (desc.DescModifier) {
+ case Mod.Pointer:
+ return "*";
+ case Mod.Ref:
+ return "&";
+ case Mod.Out:
+ return "@";
+ default:
+ return string.Empty;
+ }
+ }
+
+ string FormattedNamespace {
+ get {
+ return !string.IsNullOrEmpty (Namespace) ? Namespace + "." : string.Empty;
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+%{
+using System.Text;
+using System.IO;
+using System;
+using System.Linq;
+using System.Collections.Generic;
+
+namespace Monkeydoc.Ecma
+{
+ public class EcmaUrlParser
+ {
+ int yacc_verbose_flag = 0;
+
+ public void IsValid (string input)
+ {
+ var lexer = new EcmaUrlTokenizer (input);
+ this.yyparse (lexer);
+ }
+
+ public EcmaDesc Parse (string input)
+ {
+ var lexer = new EcmaUrlTokenizer (input);
+ return (EcmaDesc)this.yyparse (lexer);
+ }
+
+ public bool TryParse (string input, out EcmaDesc desc)
+ {
+ desc = null;
+ try {
+ desc = Parse (input);
+ } catch {
+ return false;
+ }
+ return true;
+ }
+
+ EcmaDesc SetEcmaDescType (object result, EcmaDesc.Kind kind)
+ {
+ var desc = result as EcmaDesc;
+ desc.DescKind = kind;
+ return desc;
+ }
+
+ List<T> SafeReverse<T> (List<T> input)
+ {
+ if (input == null)
+ return null;
+ input.Reverse ();
+ return input;
+ }
+%}
+
+%token ERROR
+%token IDENTIFIER
+%token DIGIT
+%token DOT
+%token COMMA
+%token COLON
+%token INNER_TYPE_SEPARATOR
+%token OP_GENERICS_LT
+%token OP_GENERICS_GT
+%token OP_GENERICS_BACKTICK
+%token OP_OPEN_PAREN
+%token OP_CLOSE_PAREN
+%token OP_ARRAY_OPEN
+%token OP_ARRAY_CLOSE
+%token SLASH_SEPARATOR
+%token STAR
+%token REF_ARG
+%token OUT_ARG
+%token EXPLICIT_IMPL_SEP
+
+%start expression
+
+%%
+
+expression
+ : 'T' COLON type_expression { $$ = SetEcmaDescType ($3, EcmaDesc.Kind.Type); }
+ | 'N' COLON namespace_expression { $$ = SetEcmaDescType ($3, EcmaDesc.Kind.Namespace); }
+ | 'M' COLON method_expression { $$ = SetEcmaDescType ($3, EcmaDesc.Kind.Method); }
+ | 'F' COLON simple_member_expression { $$ = SetEcmaDescType ($3, EcmaDesc.Kind.Field); }
+ | 'C' COLON constructor_expression { $$ = SetEcmaDescType ($3, EcmaDesc.Kind.Constructor); }
+ | 'P' COLON property_expression { $$ = SetEcmaDescType ($3, EcmaDesc.Kind.Property); }
+ | 'E' COLON simple_member_expression { $$ = SetEcmaDescType ($3, EcmaDesc.Kind.Event); }
+ | 'O' COLON operator_expression { $$ = SetEcmaDescType ($3, EcmaDesc.Kind.Operator); }
+
+/* i.e. id.id.id or id */
+dot_expression
+ : IDENTIFIER { $$ = new List<string> { (string)$1 }; }
+ | IDENTIFIER DOT dot_expression { ((ICollection<string>)$3).Add ((string)$1); $$ = $3; }
+
+namespace_expression
+ : dot_expression { $$ = new EcmaDesc { Namespace = string.Join (".", ((IEnumerable<string>)$1).Reverse ()) }; }
+
+type_expression
+ : dot_expression type_expression_suffix {
+ var dotExpr = ((List<string>)$1);
+ dotExpr.Reverse ();
+ var desc = $2 as EcmaDesc;
+ desc.DescKind = EcmaDesc.Kind.Type;
+ desc.Namespace = string.Join (".", dotExpr.Take (dotExpr.Count - 1));
+ desc.TypeName = dotExpr.Last ();
+ $$ = desc;
+ }
+
+/* To be used in types with no namespaces attached to them like an inner type*/
+reduced_type_expression
+ : IDENTIFIER type_expression_suffix {
+ var desc = $2 as EcmaDesc;
+ desc.DescKind = EcmaDesc.Kind.Type;
+ desc.TypeName = $1 as string;
+ $$ = desc;
+ }
+
+type_expression_suffix
+ : opt_generic_type_suffix opt_inner_type_description opt_array_definition opt_etc {
+ bool nestedDescHasEtc = $2 != null && ((EcmaDesc)$2).IsEtc;
+ EcmaDesc nestedType = (EcmaDesc)$2;
+ $$ = new EcmaDesc {
+ GenericTypeArguments = $1 as List<EcmaDesc>,
+ NestedType = nestedType,
+ ArrayDimensions = SafeReverse ($3 as List<int>),
+ Etc = $4 != null ? ((Tuple<char, string>)$4).Item1 : nestedDescHasEtc ? nestedType.Etc : (char)0,
+ EtcFilter = $4 != null ? ((Tuple<char, string>)$4).Item2 : nestedDescHasEtc ? nestedType.EtcFilter : null
+ };
+ if (nestedDescHasEtc) {
+ nestedType.Etc = (char)0;
+ nestedType.EtcFilter = null;
+ }
+ }
+
+opt_inner_type_description
+ : /* empty */ { $$ = null; }
+ | INNER_TYPE_SEPARATOR reduced_type_expression { $$ = $2; }
+
+opt_generic_type_suffix
+ : /* empty */ { $$ = null; }
+ | OP_GENERICS_BACKTICK DIGIT { $$ = Enumerable.Repeat<string> (null, (int)$2).ToList (); }
+ | OP_GENERICS_LT generic_type_arg_list OP_GENERICS_GT { $$ = $2; }
+
+generic_type_arg_list
+ : type_expression { $$ = new List<EcmaDesc> () { (EcmaDesc)$1 }; }
+ | generic_type_arg_list COMMA type_expression { ((List<EcmaDesc>)$1).Add ((EcmaDesc)$3); $$ = $1; }
+
+opt_array_definition
+ : /* empty */ { $$ = null; }
+ | OP_ARRAY_OPEN opt_array_definition_list OP_ARRAY_CLOSE opt_array_definition {
+ var dims = ((IList<int>)$4) ?? new List<int> (2);
+ dims.Add ((int)$2);
+ $$ = dims;
+ }
+
+opt_array_definition_list
+ : /* empty */ { $$ = 1; }
+ | COMMA opt_array_definition_list { $$ = ((int)$2) + 1; }
+
+opt_etc
+ : /* empty */ { $$ = null; }
+ | SLASH_SEPARATOR etc_identifier { $$ = Tuple.Create<char, string> (((string)$2)[0], null); }
+ | SLASH_SEPARATOR etc_identifier SLASH_SEPARATOR reduced_member_expression { $$ = Tuple.Create<char, string> (((string)$2)[0], (string)$4); }
+/* | SLASH_SEPARATOR etc_identifier SLASH_SEPARATOR IDENTIFIER opt_generic_type_suffix { $$ = Tuple.Create<char, string> (((string)$2)[0], (string)$4 + ($5 == null ? string.Empty : "<" + string.Join (",", ((IEnumerable<EcmaDesc>)$5).Select (t => t.ToCompleteTypeName ())) + ">")); } */
+
+etc_identifier
+ : STAR { $$ = "*"; }
+ | IDENTIFIER { $$ = $1; }
+
+method_expression
+ : type_expression DOT IDENTIFIER opt_generic_type_suffix opt_arg_list_suffix {
+ var desc = $1 as EcmaDesc;
+ desc.MemberName = $3 as string;
+ desc.GenericMemberArguments = $4 as List<EcmaDesc>;
+ desc.MemberArguments = SafeReverse ($5 as List<EcmaDesc>);
+ $$ = desc;
+ }
+ | dot_expression opt_generic_type_suffix opt_arg_list_suffix {
+ var dotExpr = ((List<string>)$1);
+ $$ = new EcmaDesc {
+ Namespace = string.Join (".", dotExpr.Skip (2).DefaultIfEmpty (string.Empty).Reverse ()),
+ TypeName = dotExpr.Skip (1).First (),
+ MemberName = dotExpr.First (),
+ GenericMemberArguments = $2 as List<EcmaDesc>,
+ MemberArguments = SafeReverse ($3 as List<EcmaDesc>)
+ };
+ }
+ | type_expression EXPLICIT_IMPL_SEP method_expression {
+ var desc = $1 as EcmaDesc;
+ desc.ExplicitImplMember = $3 as EcmaDesc;
+ $$ = desc;
+ }
+
+/* To be used with members that may have no type/namespace attached */
+reduced_member_expression
+ : IDENTIFIER opt_generic_type_suffix { $$ = (string)$1 + ($2 == null ? string.Empty : "<" + string.Join (",", ((IEnumerable<EcmaDesc>)$2).Select (t => t.ToCompleteTypeName ())) + ">"); }
+ | IDENTIFIER opt_generic_type_suffix DOT reduced_member_expression {
+ var existing = $4 as string;
+ var expr = (string)$1 + ($2 == null ? string.Empty : "<" + string.Join (",", ((IEnumerable<EcmaDesc>)$2).Select (t => t.ToCompleteTypeName ())) + ">");
+ $$ = expr + "." + existing;
+ }
+
+arg_type_expression
+ : type_expression opt_arg_type_suffix { var desc = (EcmaDesc)$1; desc.DescModifier = (EcmaDesc.Mod)$2; $$ = desc; }
+
+opt_arg_type_suffix
+ : /* empty */ { $$ = EcmaDesc.Mod.Normal; }
+ | STAR { $$ = EcmaDesc.Mod.Pointer; }
+ | REF_ARG { $$ = EcmaDesc.Mod.Ref; }
+ | OUT_ARG { $$ = EcmaDesc.Mod.Out; }
+
+type_expression_list
+ : /* empty */ { $$ = null; }
+ | arg_type_expression { $$ = new List<EcmaDesc> () { (EcmaDesc)$1 }; }
+ | arg_type_expression COMMA type_expression_list { ((List<EcmaDesc>)$3).Add ((EcmaDesc)$1); $$ = $3; }
+
+simple_member_expression
+ : dot_expression {
+ var dotExpr = ((List<string>)$1);
+ dotExpr.Reverse ();
+
+ $$ = new EcmaDesc {
+ Namespace = dotExpr.Count > 2 ? string.Join (".", dotExpr.Take (dotExpr.Count - 2)) : string.Empty,
+ TypeName = dotExpr.Count > 1 ? dotExpr[dotExpr.Count - 2] : string.Empty,
+ MemberName = dotExpr[dotExpr.Count - 1]
+ };
+ }
+ | type_expression DOT IDENTIFIER {
+ var desc = $1 as EcmaDesc;
+ desc.MemberName = $3 as string;
+ $$ = desc;
+ }
+ | type_expression EXPLICIT_IMPL_SEP simple_member_expression {
+ var desc = $1 as EcmaDesc;
+ desc.ExplicitImplMember = $3 as EcmaDesc;
+ $$ = desc;
+ }
+
+constructor_expression
+ : method_expression { $$ = $1; }
+
+operator_expression
+ : method_expression { $$ = $1; }
+
+property_expression
+ : simple_member_expression opt_property_indexer {
+ var desc = $1 as EcmaDesc;
+ (desc.ExplicitImplMember ?? desc).MemberArguments = SafeReverse ($2 as List<EcmaDesc>);
+ $$ = desc;
+ }
+
+opt_property_indexer
+ : opt_arg_list_suffix { $$ = $1; }
+
+/*simple_member_expression opt_arg_list_suffix { $$ = CopyFromEcmaDesc (new EcmaDesc {
+ MemberArguments = SafeReverse ($2 as List<EcmaDesc>)
+ }, (EcmaDesc)$1);
+ }*/
+
+opt_arg_list_suffix
+ : /* empty */ { $$ = null; }
+ | OP_OPEN_PAREN type_expression_list OP_CLOSE_PAREN { $$ = $2; }
+
+%%
+
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.IO;
+
+namespace Monkeydoc.Ecma
+{
+ public class EcmaUrlParserDriver
+ {
+ public static void Main (string[] args)
+ {
+ var input = new StringReader (args[0]);
+ var lexer = new EcmaUrlTokenizer (input);
+ var parser = new EcmaUrlParser ();
+
+ Console.WriteLine (parser.yyparse (lexer));
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Text;
+using System.Globalization;
+
+namespace Monkeydoc.Ecma
+{
+ public class EcmaUrlTokenizer : yyParser.yyInput
+ {
+ const char EndOfStream = (char)0;
+ string input;
+ object val;
+ int current_token;
+ int current_pos;
+ int real_current_pos;
+ int identCount = 0;
+
+ public EcmaUrlTokenizer (string input)
+ {
+ this.input = input;
+ }
+
+ static bool is_identifier_start_character (char c)
+ {
+ return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_' || Char.IsLetter (c);
+ }
+
+ static bool is_identifier_part_character (char c)
+ {
+ if (c >= 'a' && c <= 'z')
+ return true;
+
+ if (c >= 'A' && c <= 'Z')
+ return true;
+
+ if (c == '_' || (c >= '0' && c <= '9'))
+ return true;
+
+ if (c < 0x80)
+ return false;
+
+ return Char.IsLetter (c) || Char.GetUnicodeCategory (c) == UnicodeCategory.ConnectorPunctuation;
+ }
+
+ public bool advance ()
+ {
+ return Peek () != EndOfStream;
+ }
+
+ public Object Value {
+ get {
+ return val;
+ }
+ }
+
+ public Object value ()
+ {
+ return val;
+ }
+
+ public int token ()
+ {
+ int token = xtoken ();
+ //Console.WriteLine ("Current token {0} with value {1}", token, val == null ? "(none)" : val.ToString ());
+ if (token == Token.ERROR)
+ Console.WriteLine ("Problem at pos {0} after token {1}", current_pos, current_token);
+ current_token = token;
+ return token;
+ }
+
+ int xtoken ()
+ {
+ char next = Read ();
+ while (char.IsWhiteSpace (next))
+ next = Read ();
+ current_pos++;
+ val = null;
+
+ switch (next) {
+ case ',':
+ return Token.COMMA;
+ case '.':
+ return Token.DOT;
+ case '<':
+ return Token.OP_GENERICS_LT;
+ case '>':
+ return Token.OP_GENERICS_GT;
+ case '`':
+ return Token.OP_GENERICS_BACKTICK;
+ case '(':
+ return Token.OP_OPEN_PAREN;
+ case ')':
+ return Token.OP_CLOSE_PAREN;
+ case '+':
+ return Token.INNER_TYPE_SEPARATOR;
+ case ':':
+ return Token.COLON;
+ case '/':
+ return Token.SLASH_SEPARATOR;
+ case '[':
+ return Token.OP_ARRAY_OPEN;
+ case ']':
+ return Token.OP_ARRAY_CLOSE;
+ case '*':
+ return Token.STAR;
+ case '&':
+ return Token.REF_ARG;
+ case '@':
+ return Token.OUT_ARG;
+ case '$':
+ return Token.EXPLICIT_IMPL_SEP;
+ default:
+ return TokenizeIdentifierOrNumber (next);
+ }
+ }
+
+ int TokenizeIdentifierOrNumber (char current)
+ {
+ // We must first return the expression type which is a uppercase letter and a colon
+ if (current_pos < 2) {
+ val = null;
+ return (int)current;
+ }
+
+ if (is_identifier_start_character (current) || current == '*') {
+ unsafe {
+ // identifier length is artificially limited to 1024 bytes by implementations
+ char* pIdent = stackalloc char[512];
+ *pIdent = current;
+ identCount = 1;
+
+ char peek;
+ while ((peek = Peek ()) != EndOfStream && is_identifier_part_character (peek)) {
+ *(pIdent + identCount) = Read ();
+ ++current_pos;
+ ++identCount;
+ }
+
+ val = new string ((char*)pIdent, 0, identCount);
+ return Token.IDENTIFIER;
+ }
+ } else if (char.IsDigit (current)) {
+ val = current - '0';
+ return Token.DIGIT;
+ } else {
+ val = null;
+ return Token.ERROR;
+ }
+ }
+
+ char Read ()
+ {
+ try {
+ return input[real_current_pos++];
+ } catch {
+ return EndOfStream;
+ }
+ }
+
+ char Peek ()
+ {
+ try {
+ return input[real_current_pos];
+ } catch {
+ return EndOfStream;
+ }
+ }
+ }
+}
--- /dev/null
+using System;
+using System.IO;
+using System.Linq;
+using System.Xml;
+using System.Diagnostics;
+using System.Collections.Generic;
+
+using Mono.Utilities;
+using Lucene.Net.Index;
+
+namespace MonkeyDoc
+{
+ //
+ // The HelpSource class keeps track of the archived data, and its
+ // tree
+ //
+ public class HelpSource
+ {
+ static int id;
+
+ //
+ // The unique ID for this HelpSource.
+ //
+ int source_id;
+
+ // The name of the HelpSource, used by all the file (.tree, .zip, ...) used by it
+ string name;
+ // The full directory path where the HelpSource files are located
+ string basePath;
+
+ // The tree of this help source
+ Tree tree;
+ string treeFilePath;
+ RootTree rootTree;
+
+ IDocCache cache = new MonkeyDoc.Caches.FileCache (Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "monkeydoc", "cache"));
+ IDocStorage storage;
+
+ public HelpSource (string base_filename, bool create)
+ {
+ this.name = Path.GetFileName (base_filename);
+ this.basePath = Path.GetDirectoryName (base_filename);
+ this.treeFilePath = base_filename + ".tree";
+ this.storage = new MonkeyDoc.Storage.ZipStorage (base_filename + ".zip");
+
+ tree = create ? new Tree (this, string.Empty, string.Empty) : new Tree (this, treeFilePath);
+
+ source_id = id++;
+ }
+
+ public HelpSource ()
+ {
+ tree = new Tree (this, "Blah", "Blah");
+ source_id = id++;
+ }
+
+ public int SourceID {
+ get {
+ return source_id;
+ }
+ }
+
+ public string Name {
+ get {
+ return name;
+ }
+ }
+
+ /* This gives the full path of the source/ directory */
+ public string BaseFilePath {
+ get {
+ return basePath;
+ }
+ }
+
+ public TraceLevel TraceLevel {
+ get;
+ set;
+ }
+
+ public string BaseDir {
+ get {
+ return basePath;
+ }
+ }
+
+ public Tree Tree {
+ get {
+ return tree;
+ }
+ }
+
+ public RootTree RootTree {
+ get {
+ return rootTree;
+ }
+ set {
+ rootTree = value;
+ }
+ }
+
+ public IDocCache Cache {
+ get {
+ return cache;
+ }
+ }
+
+ public IDocStorage Storage {
+ get {
+ return storage;
+ }
+ }
+
+ // A HelpSource may have a common prefix to its URL, give it here
+ protected virtual string UriPrefix {
+ get {
+ return "dummy:";
+ }
+ }
+
+ /// <summary>
+ /// Returns a stream from the packaged help source archive
+ /// </summary>
+ public virtual Stream GetHelpStream (string id)
+ {
+ return storage.Retrieve (id);
+ }
+
+ public virtual Stream GetCachedHelpStream (string id)
+ {
+ if (string.IsNullOrEmpty (id))
+ throw new ArgumentNullException ("id");
+ if (!cache.CanCache (DocEntity.Text))
+ return GetHelpStream (id);
+ if (!cache.IsCached (id))
+ cache.CacheText (id, GetHelpStream (id));
+ return cache.GetCachedStream (id);
+ }
+
+ public XmlReader GetHelpXml (string id)
+ {
+ var url = "monodoc:///" + SourceID + "@" + Uri.EscapeDataString (id) + "@";
+ var stream = cache.IsCached (id) ? cache.GetCachedStream (id) : storage.Retrieve (id);
+
+ return stream == null ? null : new XmlTextReader (url, stream);
+ }
+
+ public virtual XmlDocument GetHelpXmlWithChanges (string id)
+ {
+ XmlDocument doc = new XmlDocument ();
+ if (!storage.SupportRevision) {
+ doc.Load (GetHelpXml (id));
+ } else {
+ var revManager = storage.RevisionManager;
+ doc.Load (revManager.RetrieveLatestRevision (id));
+ }
+ return doc;
+ }
+
+ public virtual string GetCachedText (string id)
+ {
+ if (!cache.CanCache (DocEntity.Text))
+ return GetText (id);
+ if (!cache.IsCached (id))
+ cache.CacheText (id, GetText (id));
+ return cache.GetCachedString (id);
+ }
+
+ public virtual string GetText (string id)
+ {
+ return new StreamReader (GetHelpStream (id)).ReadToEnd ();
+ }
+
+ // Tells if the result for the provided id is generated dynamically
+ // by the help source
+ public virtual bool IsGeneratedContent (string id)
+ {
+ return false;
+ }
+
+ // Tells if the content of the provided id is meant to be returned raw
+ public virtual bool IsRawContent (string id)
+ {
+ return false;
+ }
+
+ // Tells if provided id refers to a multi-content-type document if it's case
+ // tells the ids it's formed of
+ public virtual bool IsMultiPart (string id, out IEnumerable<string> parts)
+ {
+ parts = null;
+ return false;
+ }
+
+ /// <summary>
+ /// Saves the tree and the archive
+ /// </summary>
+ public void Save ()
+ {
+ tree.Save (treeFilePath);
+ storage.Dispose ();
+ }
+
+ public virtual void RenderPreviewDocs (XmlNode newNode, XmlWriter writer)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public virtual string GetPublicUrl (Node node)
+ {
+ return node.GetInternalUrl ();
+ }
+
+ public virtual bool CanHandleUrl (string url)
+ {
+ return url.StartsWith (UriPrefix, StringComparison.OrdinalIgnoreCase);
+ }
+
+ public virtual string GetInternalIdForUrl (string url, out Node node)
+ {
+ node = MatchNode (url);
+ return node == null ? null : url.Substring (UriPrefix.Length);
+ }
+
+ public virtual Node MatchNode (string url)
+ {
+ Node current = null;
+
+ var matchCache = LRUCache<string, Node>.Default;
+ if ((current = matchCache.Get (url)) != null)
+ return current;
+
+ current = Tree.RootNode;
+ var strippedUrl = url.StartsWith (UriPrefix, StringComparison.OrdinalIgnoreCase) ? url.Substring (UriPrefix.Length) : url;
+ var searchNode = new Node () { Element = strippedUrl };
+
+ do {
+ int index = current.Nodes.BinarySearch (searchNode, NodeElementComparer.Instance);
+ if (index >= 0) {
+ Node n = current.Nodes[index];
+ //Console.WriteLine ("Binarysearch success for {0} which fell on {1}", strippedUrl, n.Element);
+ matchCache.Put (url, n);
+ return n;
+ }
+ index = ~index;
+ if (index == current.Nodes.Count) {
+ //Console.WriteLine ("Match fail for {0}", strippedUrl);
+ //Console.WriteLine (current.Nodes.Select (n => n.Element).Aggregate ((e1, e2) => e1 + ", " + e2));
+ return SlowMatchNode (Tree.RootNode, matchCache, strippedUrl);
+ }
+ current = current.Nodes [index - 1];
+ //Console.WriteLine ("Binarysearch failed for {0}, next node check is {1}", strippedUrl, current.Element);
+ } while (true);
+
+ return null;
+ }
+
+ /* That slow path is mainly here to handle ecmaspec type of url which are composed of hard to sort numbers
+ * because they don't have the same amount of digit. We could use a regex to harmonise the various number
+ * parts but then it would be quite specific. Since in the case of ecmaspec the tree is well-formed enough
+ * the "Slow" match should still be fast enough
+ */
+ Node SlowMatchNode (Node current, LRUCache<string, Node> matchCache, string url)
+ {
+ //Console.WriteLine ("Entering slow path for {0} starting from {1}", url, current.Element);
+ while (current != null) {
+ bool stop = true;
+ foreach (Node n in current.Nodes) {
+ var element = n.Element.StartsWith (UriPrefix, StringComparison.OrdinalIgnoreCase) ? n.Element.Substring (UriPrefix.Length) : n.Element;
+ if (url == element) {
+ matchCache.Put (url, n);
+ return n;
+ } else if (url.StartsWith (element + ".", StringComparison.OrdinalIgnoreCase) && !n.IsLeaf) {
+ current = n;
+ stop = false;
+ break;
+ }
+ }
+ if (stop)
+ current = null;
+ }
+
+ return null;
+ }
+
+ class NodeElementComparer : IComparer<Node>
+ {
+ public static NodeElementComparer Instance = new NodeElementComparer ();
+
+ public int Compare (Node n1, Node n2)
+ {
+ return string.Compare (Cleanup (n1), Cleanup (n2), StringComparison.Ordinal);
+ }
+
+ string Cleanup (Node n)
+ {
+ var prefix = n.Tree != null && n.Tree.HelpSource != null ? n.Tree.HelpSource.UriPrefix : string.Empty;
+ var element = n.Element.StartsWith (prefix, StringComparison.OrdinalIgnoreCase) ? n.Element.Substring (prefix.Length) : n.Element;
+ if (char.IsDigit (element, 0)) {
+ var count = element.TakeWhile (char.IsDigit).Count ();
+ element = element.PadLeft (Math.Max (0, 3 - count) + element.Length, '0');
+ }
+ //Console.WriteLine ("Cleaned up {0} to {1}", n.Element, element);
+ return element;
+ }
+ }
+
+ public virtual DocumentType GetDocumentTypeForId (string id, out Dictionary<string, string> extraParams)
+ {
+ extraParams = null;
+ return DocumentType.PlainText;
+ }
+
+ public virtual Stream GetImage (string url)
+ {
+ return null;
+ }
+
+ //
+ // Populates the index.
+ //
+ public virtual void PopulateIndex (IndexMaker index_maker)
+ {
+ }
+
+ //
+ // Create different Documents for adding to Lucene search index
+ // The default action is do nothing. Subclasses should add the docs
+ //
+ public virtual void PopulateSearchableIndex (IndexWriter writer)
+ {
+
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.IO;
+using System.Text;
+using System.Linq;
+using System.Xml;
+using System.Collections.Generic;
+
+namespace MonkeyDoc
+{
+ public class Node : IComparable<Node>, IComparable
+ {
+ readonly Tree tree;
+ string caption, element, pubUrl;
+ public bool Documented;
+ bool loaded;
+ Node parent;
+ List<Node> nodes;
+ Dictionary<string, Node> childrenLookup;
+ /* Address has three types of value,
+ * _ 0 is for no on-disk representation
+ * _ >0 is a valid address that is loaded immediately
+ * _ <0 is a valid negated address to indicate lazy loading
+ */
+ int address;
+
+ public Node (Node parent, string caption, string element) : this (parent.Tree, caption, element)
+ {
+ this.parent = parent;
+ }
+
+ internal Node (Tree tree, string caption, string element)
+ {
+ this.tree = tree;
+ this.caption = caption;
+ this.element = element;
+ }
+
+ /// <summary>
+ /// Creates a node from an on-disk representation
+ /// </summary>
+ internal Node (Node parent, int address) : this (parent.tree, address)
+ {
+ this.parent = parent;
+ }
+
+ internal Node (Tree tree, int address)
+ {
+ this.address = address;
+ this.tree = tree;
+ if (address > 0)
+ LoadNode ();
+ }
+
+ /* This is solely used for MatchNode to check for equality */
+ internal Node ()
+ {
+ }
+
+ void LoadNode ()
+ {
+ tree.InflateNode (this);
+ if (parent != null)
+ parent.RegisterFullNode (this);
+ }
+
+ public void AddNode (Node n)
+ {
+ nodes.Add (n);
+ n.parent = this;
+ n.Documented = true;
+ RegisterFullNode (n);
+ }
+
+ public void DeleteNode (Node n)
+ {
+ nodes.Remove (n);
+ if (!string.IsNullOrEmpty (n.element))
+ childrenLookup.Remove (n.element);
+ }
+
+ // When a child node is inflated, it calls this method
+ // so that we can add it to our lookup for quick search
+ void RegisterFullNode (Node child)
+ {
+ if (childrenLookup == null)
+ childrenLookup = new Dictionary<string, Node> ();
+ if (!string.IsNullOrEmpty (child.element))
+ childrenLookup[child.element] = child;
+ }
+
+ public List<Node> Nodes {
+ get {
+ EnsureLoaded ();
+ return nodes != null ? nodes : new List<Node> ();
+ }
+ }
+
+ public string Element {
+ get {
+ EnsureLoaded ();
+ return element;
+ }
+ set {
+ element = value;
+ }
+ }
+
+ public string Caption {
+ get {
+ EnsureLoaded ();
+ return caption;
+ }
+ internal set {
+ caption = value;
+ }
+ }
+
+ public Node Parent {
+ get {
+ return parent;
+ }
+ }
+
+ public Tree Tree {
+ get {
+ return tree;
+ }
+ }
+
+ internal int Address {
+ get {
+ return address;
+ }
+ }
+
+ /// <summary>
+ /// Creates a new node, in the locator entry point, and with
+ /// a user visible caption of @caption
+ /// </summary>
+ public Node CreateNode (string c_caption, string c_element)
+ {
+ EnsureNodes ();
+ if (string.IsNullOrEmpty (c_caption))
+ throw new ArgumentNullException ("c_caption");
+ if (string.IsNullOrEmpty (c_element))
+ throw new ArgumentNullException ("c_element");
+
+ Node t = new Node (this, c_caption, c_element);
+ nodes.Add (t);
+ childrenLookup[c_element] = t;
+
+ return t;
+ }
+
+ public Node GetOrCreateNode (string c_caption, string c_element)
+ {
+ if (nodes == null)
+ return CreateNode (c_caption, c_element);
+ if (childrenLookup.Count != nodes.Count || (nodes.Count == 0 && childrenLookup.Count != nodes.Capacity))
+ UpdateLookup ();
+
+ Node result;
+ if (!childrenLookup.TryGetValue (c_element, out result))
+ result = CreateNode (c_caption, c_element);
+ return result;
+ }
+
+ public void EnsureNodes ()
+ {
+ if (nodes == null) {
+ nodes = new List<Node> ();
+ childrenLookup = new Dictionary<string, Node> ();
+ }
+ }
+
+ public void EnsureLoaded ()
+ {
+ if (address < 0 && !loaded) {
+ LoadNode ();
+ loaded = true;
+ }
+ }
+
+ void UpdateLookup ()
+ {
+ foreach (var node in nodes)
+ childrenLookup[node.Element] = node;
+ }
+
+ public bool IsLeaf {
+ get {
+ return nodes == null || nodes.Count == 0;
+ }
+ }
+
+ void EncodeInt (BinaryWriter writer, int value)
+ {
+ do {
+ int high = (value >> 7) & 0x01ffffff;
+ byte b = (byte)(value & 0x7f);
+
+ if (high != 0) {
+ b = (byte)(b | 0x80);
+ }
+
+ writer.Write(b);
+ value = high;
+ } while(value != 0);
+ }
+
+ int DecodeInt (BinaryReader reader)
+ {
+ int ret = 0;
+ int shift = 0;
+ byte b;
+
+ do {
+ b = reader.ReadByte();
+
+ ret = ret | ((b & 0x7f) << shift);
+ shift += 7;
+ } while ((b & 0x80) == 0x80);
+
+ return ret;
+ }
+
+ internal void Deserialize (BinaryReader reader)
+ {
+ int count = DecodeInt (reader);
+ element = reader.ReadString ();
+ caption = reader.ReadString ();
+
+ if (count == 0)
+ return;
+
+ nodes = new List<Node> (count);
+ for (int i = 0; i < count; i++) {
+ int child_address = DecodeInt (reader);
+
+ Node t = new Node (this, -child_address);
+ nodes.Add (t);
+ }
+ }
+
+ internal void Serialize (FileStream output, BinaryWriter writer)
+ {
+ if (nodes != null)
+ foreach (Node child in nodes)
+ child.Serialize (output, writer);
+
+ address = (int) output.Position;
+ EncodeInt (writer, nodes == null ? 0 : (int) nodes.Count);
+ writer.Write (element);
+ writer.Write (caption);
+
+ if (nodes != null)
+ foreach (Node child in nodes)
+ EncodeInt (writer, child.address);
+ }
+
+ public void Sort ()
+ {
+ if (nodes != null)
+ nodes.Sort ();
+ }
+
+ internal string GetInternalUrl ()
+ {
+ EnsureLoaded ();
+ if (element.IndexOf (":") != -1 || parent == null)
+ return element;
+
+ var parentUrl = parent.GetInternalUrl ();
+ return parentUrl.EndsWith ("/") ? parentUrl + element : parentUrl + "/" + element;
+ }
+
+ public string PublicUrl {
+ get {
+ if (pubUrl != null)
+ return pubUrl;
+ return pubUrl = tree.HelpSource != null ? tree.HelpSource.GetPublicUrl (this) : GetInternalUrl ();
+ }
+ }
+
+ int IComparable.CompareTo (object obj)
+ {
+ Node other = obj as Node;
+ if (other == null)
+ return -1;
+ return CompareToInternal (other);
+ }
+
+ int IComparable<Node>.CompareTo (Node obj)
+ {
+ return CompareToInternal (obj);
+ }
+
+ int CompareToInternal (Node other)
+ {
+ EnsureLoaded ();
+ other.EnsureLoaded ();
+
+ var cap1 = caption;
+ var cap2 = other.caption;
+
+ /* Some node (notably from ecmaspec) have number prepended to them
+ * which we need to sort better by padding them to the same number
+ * of digits
+ */
+ if (char.IsDigit (cap1[0]) && char.IsDigit (cap2[0])) {
+ int c1 = cap1.TakeWhile (char.IsDigit).Count ();
+ int c2 = cap2.TakeWhile (char.IsDigit).Count ();
+
+ if (c1 != c2) {
+ cap1 = cap1.PadLeft (cap1.Length + Math.Max (0, c2 - c1), '0');
+ cap2 = cap2.PadLeft (cap2.Length + Math.Max (0, c1 - c2), '0');
+ }
+ }
+
+ return string.Compare (cap1, cap2, StringComparison.Ordinal);
+ }
+ }
+}
--- /dev/null
+using System;
+
+namespace MonkeyDoc
+{
+ public abstract class Provider
+ {
+ //
+ // This code is used to "tag" all the different sources
+ //
+ static short serial;
+
+ public int Code { get; set; }
+
+ public Provider ()
+ {
+ Code = serial++;
+ }
+
+ public abstract void PopulateTree (Tree tree);
+
+ //
+ // Called at shutdown time after the tree has been populated to perform
+ // any fixups or final tasks.
+ //
+ public abstract void CloseTree (HelpSource hs, Tree tree);
+ }
+}
--- /dev/null
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Configuration;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Xml;
+
+using MonkeyDoc.Providers;
+using Lucene.Net.Analysis.Standard;
+using Lucene.Net.Index;
+
+namespace MonkeyDoc
+{
+ public class RootTree : Tree
+ {
+ public const int MonodocVersion = 2;
+ const string RootNamespace = "root:/";
+ string basedir;
+ List<string> uncompiledHelpSourcePaths = new List<string>();
+ HashSet<string> loadedSourceFiles = new HashSet<string>();
+ List<HelpSource> helpSources = new List<HelpSource>();
+ Dictionary<string, Node> nameToNode = new Dictionary<string, Node>();
+ Dictionary<string, HelpSource> nameToHelpSource = new Dictionary<string, HelpSource>();
+
+ public IList<HelpSource> HelpSources {
+ get {
+ return this.helpSources.AsReadOnly();
+ }
+ }
+
+ public DateTime LastHelpSourceTime {
+ get;
+ set;
+ }
+
+ static bool IsUnix {
+ get {
+ int platform = (int)Environment.OSVersion.Platform;
+ return platform == 4 || platform == 128 || platform == 6;
+ }
+ }
+
+ RootTree () : base (null, "Mono Documentation", "root:")
+ {
+ base.RootNode.EnsureNodes();
+ this.LastHelpSourceTime = DateTime.Now;
+ }
+
+ public static RootTree LoadTree ()
+ {
+ return RootTree.LoadTree (RootTree.ProbeBaseDirectories ());
+ }
+
+ static string ProbeBaseDirectories ()
+ {
+ string result;
+ try {
+ NameValueCollection appSettings = ConfigurationManager.AppSettings;
+ result = appSettings["docPath"];
+ } catch {
+ result = ".";
+ }
+ return result;
+ }
+
+ public static RootTree LoadTree (string basedir, bool includeExternal = true)
+ {
+ if (string.IsNullOrEmpty (basedir))
+ throw new ArgumentNullException ("basedir");
+ if (!Directory.Exists (basedir))
+ throw new ArgumentException ("basedir", string.Format ("Base documentation directory at '{0}' doesn't exist", basedir));
+
+ XmlDocument xmlDocument = new XmlDocument ();
+ string filename = Path.Combine (basedir, "monodoc.xml");
+ xmlDocument.Load (filename);
+ IEnumerable<string> sourceFiles = Directory.EnumerateFiles (Path.Combine (basedir, "sources"), "*.source");
+ if (includeExternal)
+ sourceFiles = sourceFiles.Concat (RootTree.ProbeExternalDirectorySources ());
+ return RootTree.LoadTree (basedir, xmlDocument, sourceFiles);
+ }
+
+ static IEnumerable<string> ProbeExternalDirectorySources ()
+ {
+ IEnumerable<string> enumerable = Enumerable.Empty<string> ();
+ try {
+ string path = ConfigurationManager.AppSettings["docExternalPath"];
+ enumerable = enumerable.Concat (System.IO.Directory.EnumerateFiles (path, "*.source"));
+ }
+ catch {}
+
+ if (Directory.Exists ("/Library/Frameworks/Mono.framework/External/monodoc"))
+ enumerable = enumerable.Concat (Directory.EnumerateFiles ("/Library/Frameworks/Mono.framework/External/monodoc", "*.source"));
+ return enumerable;
+ }
+
+ public static RootTree LoadTree (string indexDir, XmlDocument docTree, IEnumerable<string> sourceFiles)
+ {
+ if (docTree == null) {
+ docTree = new XmlDocument ();
+ using (Stream manifestResourceStream = typeof (RootTree).Assembly.GetManifestResourceStream ("monodoc.xml")) {
+ docTree.Load (manifestResourceStream);
+ }
+ }
+
+ sourceFiles = (sourceFiles ?? new string[0]);
+ RootTree rootTree = new RootTree ();
+ rootTree.basedir = indexDir;
+ XmlNodeList xml_node_list = docTree.SelectNodes ("/node/node");
+ rootTree.nameToNode["root"] = rootTree.RootNode;
+ rootTree.nameToNode["libraries"] = rootTree.RootNode;
+ rootTree.Populate (rootTree.RootNode, xml_node_list);
+
+ if (rootTree.LookupEntryPoint ("various") == null) {
+ Console.Error.WriteLine ("No 'various' doc node! Check monodoc.xml!");
+ Node rootNode = rootTree.RootNode;
+ }
+
+ foreach (string current in sourceFiles)
+ rootTree.AddSourceFile (current);
+
+ RootTree.PurgeNode (rootTree.RootNode);
+ rootTree.RootNode.Sort ();
+ return rootTree;
+ }
+
+ public void AddSource (string sourcesDir)
+ {
+ IEnumerable<string> enumerable = Directory.EnumerateFiles (sourcesDir, "*.source");
+ foreach (string current in enumerable)
+ if (!this.AddSourceFile (current))
+ Console.Error.WriteLine ("Error: Could not load source file {0}", current);
+ }
+
+ public bool AddSourceFile (string sourceFile)
+ {
+ if (this.loadedSourceFiles.Contains (sourceFile))
+ return false;
+
+ Node node = this.LookupEntryPoint ("various") ?? base.RootNode;
+ XmlDocument xmlDocument = new XmlDocument ();
+ try {
+ xmlDocument.Load (sourceFile);
+ } catch {
+ bool result = false;
+ return result;
+ }
+
+ XmlNodeList extra_nodes = xmlDocument.SelectNodes ("/monodoc/node");
+ if (extra_nodes.Count > 0)
+ this.Populate (node, extra_nodes);
+
+ XmlNodeList sources = xmlDocument.SelectNodes ("/monodoc/source");
+ if (sources == null) {
+ Console.Error.WriteLine ("Error: No <source> section found in the {0} file", sourceFile);
+ return false;
+ }
+
+ loadedSourceFiles.Add (sourceFile);
+ foreach (XmlNode xmlNode in sources) {
+ XmlAttribute a = xmlNode.Attributes["provider"];
+ if (a == null) {
+ Console.Error.WriteLine ("Error: no provider in <source>");
+ continue;
+ }
+ string provider = a.InnerText;
+ a = xmlNode.Attributes["basefile"];
+ if (a == null) {
+ Console.Error.WriteLine ("Error: no basefile in <source>");
+ continue;
+ }
+ string basefile = a.InnerText;
+ a = xmlNode.Attributes["path"];
+ if (a == null) {
+ Console.Error.WriteLine ("Error: no path in <source>");
+ continue;
+ }
+ string path = a.InnerText;
+ string basefilepath = Path.Combine (Path.GetDirectoryName (sourceFile), basefile);
+ HelpSource helpSource = RootTree.GetHelpSource (provider, basefilepath);
+ if (helpSource != null) {
+ helpSource.RootTree = this;
+ this.helpSources.Add (helpSource);
+ this.nameToHelpSource[path] = helpSource;
+ Node node2 = this.LookupEntryPoint (path);
+ if (node2 == null) {
+ Console.Error.WriteLine ("node `{0}' is not defined on the documentation map", path);
+ node2 = node;
+ }
+ foreach (Node current in helpSource.Tree.RootNode.Nodes) {
+ node2.AddNode (current);
+ }
+ node2.Sort ();
+ }
+ }
+ return true;
+ }
+
+ static bool PurgeNode (Node node)
+ {
+ bool result = false;
+ if (!node.Documented)
+ {
+ List<Node> list = new List<Node> ();
+ foreach (Node current in node.Nodes)
+ {
+ bool flag = RootTree.PurgeNode (current);
+ if (flag)
+ {
+ list.Add (current);
+ }
+ }
+ result = (node.Nodes.Count == list.Count);
+ foreach (Node current2 in list)
+ {
+ node.DeleteNode (current2);
+ }
+ }
+ return result;
+ }
+
+ public static string[] GetSupportedFormats ()
+ {
+ return new string[]
+ {
+ "ecma",
+ "ecmaspec",
+ "error",
+ "man",
+ "xhtml"
+ };
+ }
+
+ public static HelpSource GetHelpSource (string provider, string basefilepath)
+ {
+ HelpSource result;
+ try {
+ switch (provider) {
+ case "xhtml":
+ case "hb":
+ result = new XhtmlHelpSource (basefilepath, false);
+ break;
+ case "man":
+ result = new ManHelpSource (basefilepath, false);
+ break;
+ case "error":
+ result = new ErrorHelpSource (basefilepath, false);
+ break;
+ case "ecmaspec":
+ result = new EcmaSpecHelpSource (basefilepath, false);
+ break;
+ case "ecma":
+ result = new EcmaHelpSource (basefilepath, false);
+ break;
+ default:
+ Console.Error.WriteLine ("Error: Unknown provider specified: {0}", provider);
+ result = null;
+ break;
+ }
+ } catch (FileNotFoundException) {
+ Console.Error.WriteLine ("Error: did not find one of the files in sources/" + basefilepath);
+ result = null;
+ }
+ return result;
+ }
+
+ public static Provider GetProvider (string provider, params string[] basefilepaths)
+ {
+ switch (provider) {
+ case "ecma":
+ return new EcmaProvider (basefilepaths[0]);
+ case "ecmaspec":
+ return new EcmaSpecProvider (basefilepaths[0]);
+ case "error":
+ return new ErrorProvider (basefilepaths[0]);
+ case "man":
+ return new ManProvider (basefilepaths);
+ case "xhml":
+ case "hb":
+ return new XhtmlProvider (basefilepaths[0]);
+ }
+
+ throw new NotSupportedException (provider);
+ }
+
+ void Populate (Node parent, XmlNodeList xml_node_list)
+ {
+ foreach (XmlNode xmlNode in xml_node_list) {
+ XmlAttribute e = xmlNode.Attributes["parent"];
+ Node parent2 = null;
+ if (e != null && this.nameToNode.TryGetValue (e.InnerText, out parent2)) {
+ xmlNode.Attributes.Remove (e);
+ Populate (parent2, xmlNode.SelectNodes ("."));
+ continue;
+ }
+ e = xmlNode.Attributes["label"];
+ if (e == null) {
+ Console.Error.WriteLine ("`label' attribute missing in <node>");
+ continue;
+ }
+ string label = e.InnerText;
+ e = xmlNode.Attributes["name"];
+ if (e == null) {
+ Console.Error.WriteLine ("`name' attribute missing in <node>");
+ continue;
+ }
+ string name = e.InnerText;
+ Node orCreateNode = parent.GetOrCreateNode (label, "root:/" + name);
+ orCreateNode.EnsureNodes ();
+ this.nameToNode[name] = orCreateNode;
+ XmlNodeList xmlNodeList = xmlNode.SelectNodes ("./node");
+ if (xmlNodeList != null) {
+ this.Populate (orCreateNode, xmlNodeList);
+ }
+ }
+ }
+
+ public Node LookupEntryPoint (string name)
+ {
+ Node result = null;
+ if (!this.nameToNode.TryGetValue (name, out result)) {
+ result = null;
+ }
+ return result;
+ }
+
+ public TOutput RenderUrl<TOutput> (string url, IDocGenerator<TOutput> generator, out Node node)
+ {
+ node = null;
+ string internalId = null;
+ HelpSource hs = GetHelpSourceAndIdForUrl (url, out internalId, out node);
+ return generator.Generate (hs, internalId);
+ }
+
+ public HelpSource GetHelpSourceAndIdForUrl (string url, out string internalId, out Node node)
+ {
+ node = null;
+ internalId = null;
+
+ if (url.StartsWith ("root:/", StringComparison.OrdinalIgnoreCase))
+ return this.GetHelpSourceAndIdFromName (url.Substring ("root:/".Length), out internalId, out node);
+
+ HelpSource helpSource = null;
+ foreach (var hs in helpSources.Where (h => h.CanHandleUrl (url))) {
+ if (!string.IsNullOrEmpty (internalId = hs.GetInternalIdForUrl (url, out node))) {
+ helpSource = hs;
+ break;
+ }
+ }
+
+ return helpSource;
+ }
+
+ public HelpSource GetHelpSourceAndIdFromName (string name, out string internalId, out Node node)
+ {
+ internalId = "root:";
+ node = this.LookupEntryPoint (name);
+
+ return node == null ? null : node.Nodes.Select (n => n.Tree.HelpSource).Where (hs => hs != null).Distinct ().FirstOrDefault ();
+ }
+
+ public HelpSource GetHelpSourceFromId (int id)
+ {
+ return (id < 0 || id >= this.helpSources.Count) ? null : this.helpSources[id];
+ }
+
+ public Stream GetImage (string url)
+ {
+ if (url.StartsWith ("source-id:", StringComparison.OrdinalIgnoreCase)) {
+ string text = url.Substring (10);
+ int num = text.IndexOf (":");
+ string text2 = text.Substring (0, num);
+ int id = 0;
+ try {
+ id = int.Parse (text2);
+ } catch {
+ Console.Error.WriteLine ("Failed to parse source-id url: {0} `{1}'", url, text2);
+ return null;
+ }
+ HelpSource helpSourceFromId = this.GetHelpSourceFromId (id);
+ return helpSourceFromId.GetImage (text.Substring (num + 1));
+ }
+ Assembly assembly = Assembly.GetAssembly (typeof (RootTree));
+ return assembly.GetManifestResourceStream (url);
+ }
+
+ public IndexReader GetIndex ()
+ {
+ string text = Path.Combine (this.basedir, "monodoc.index");
+ if (File.Exists (text))
+ {
+ return IndexReader.Load (text);
+ }
+ text = Path.Combine (ConfigurationManager.AppSettings["monodocIndexDirectory"], "monodoc.index");
+ return IndexReader.Load (text);
+ }
+
+ public static void MakeIndex ()
+ {
+ RootTree rootTree = RootTree.LoadTree ();
+ rootTree.GenerateIndex ();
+ }
+
+ public void GenerateIndex ()
+ {
+ IndexMaker indexMaker = new IndexMaker ();
+ foreach (HelpSource current in this.helpSources)
+ current.PopulateIndex (indexMaker);
+ string text = Path.Combine (this.basedir, "monodoc.index");
+ try {
+ indexMaker.Save (text);
+ } catch (UnauthorizedAccessException) {
+ text = Path.Combine (ConfigurationManager.AppSettings["docDir"], "monodoc.index");
+ try {
+ indexMaker.Save (text);
+ } catch (UnauthorizedAccessException) {
+ Console.WriteLine ("Unable to write index file in {0}", Path.Combine (ConfigurationManager.AppSettings["docDir"], "monodoc.index"));
+ return;
+ }
+ }
+ if (RootTree.IsUnix)
+ RootTree.chmod (text, 420);
+
+ Console.WriteLine ("Documentation index at {0} updated", text);
+ }
+
+ public SearchableIndex GetSearchIndex ()
+ {
+ string text = Path.Combine (this.basedir, "search_index");
+ if (System.IO.Directory.Exists (text)) {
+ return SearchableIndex.Load (text);
+ }
+ text = Path.Combine (ConfigurationManager.AppSettings["docDir"], "search_index");
+ return SearchableIndex.Load (text);
+ }
+
+ public static void MakeSearchIndex ()
+ {
+ RootTree rootTree = RootTree.LoadTree ();
+ rootTree.GenerateSearchIndex ();
+ }
+
+ public void GenerateSearchIndex ()
+ {
+ Console.WriteLine ("Loading the monodoc tree...");
+ string text = Path.Combine (this.basedir, "search_index");
+ IndexWriter indexWriter;
+ var analyzer = new StandardAnalyzer (Lucene.Net.Util.Version.LUCENE_CURRENT);
+ var directory = Lucene.Net.Store.FSDirectory.Open (text);
+
+ try {
+ if (!Directory.Exists (text))
+ Directory.CreateDirectory (text);
+ indexWriter = new IndexWriter (directory, analyzer, true, IndexWriter.MaxFieldLength.LIMITED);
+ } catch (UnauthorizedAccessException) {
+ try {
+ text = Path.Combine (ConfigurationManager.AppSettings["docDir"], "search_index");
+ if (!Directory.Exists (text))
+ Directory.CreateDirectory (text);
+ indexWriter = new IndexWriter (directory, analyzer, true, IndexWriter.MaxFieldLength.LIMITED);
+ } catch (UnauthorizedAccessException) {
+ Console.WriteLine ("You don't have permissions to write on " + text);
+ return;
+ }
+ }
+ Console.WriteLine ("Collecting and adding documents...");
+ foreach (HelpSource current in this.helpSources) {
+ current.PopulateSearchableIndex (indexWriter);
+ }
+ Console.WriteLine ("Closing...");
+ indexWriter.Optimize ();
+ indexWriter.Close ();
+ }
+
+ [DllImport ("libc")]
+ static extern int chmod (string filename, int mode);
+ }
+}
--- /dev/null
+//
+//
+// SearchableDocument.cs: Abstracts our model of document from the Lucene Document
+//
+// Author: Mario Sopena
+//
+using Lucene.Net.Documents;
+
+namespace MonkeyDoc
+{
+ struct SearchableDocument
+ {
+ public string title;
+ public string url;
+ public string fulltitle;
+ public string hottext;
+ public string text;
+ public string examples;
+
+ public Document LuceneDoc {
+ get {
+ Document doc = new Document ();
+ doc.Add (UnIndexed ("title", title));
+ doc.Add (UnIndexed ("url", url));
+ doc.Add (UnIndexed ("fulltitle", fulltitle ?? string.Empty));
+ doc.Add (UnStored ("hottext", hottext));
+ doc.Add (UnStored ("text", text));
+ doc.Add (UnStored ("examples", examples));
+ return doc;
+ }
+ }
+
+ static Field UnIndexed(System.String name, System.String value_Renamed)
+ {
+ return new Field(name, value_Renamed, Field.Store.YES, Field.Index.NO);
+ }
+
+ static Field UnStored(System.String name, System.String value_Renamed)
+ {
+ return new Field(name, value_Renamed, Field.Store.NO, Field.Index.ANALYZED);
+ }
+ }
+}
--- /dev/null
+//
+//
+// SearchableIndex.cs: Index that uses Lucene to search through the docs
+//
+// Author: Mario Sopena
+//
+
+using System;
+using System.IO;
+using System.Collections;
+// Lucene imports
+using Lucene.Net.Index;
+using Lucene.Net.Documents;
+using Lucene.Net.Analysis;
+using Lucene.Net.Analysis.Standard;
+using Lucene.Net.Search;
+using Lucene.Net.QueryParsers;
+using Lucene.Net.Store;
+
+namespace MonkeyDoc
+{
+ public class SearchableIndex
+ {
+ const int maxSearchCount = 30;
+
+ IndexSearcher searcher;
+ string dir;
+ public string Dir {
+ get {
+ if (dir == null) dir = "search_index";
+ return dir;
+ }
+ set { dir = value; }
+ }
+ public ArrayList Results;
+
+ public static SearchableIndex Load (string dir) {
+ SearchableIndex s = new SearchableIndex ();
+ s.dir = dir;
+ s.Results = new ArrayList (20);
+ try {
+ //s.searcher = new IndexSearcher (dir);
+ // TODO: parametrize that depending if we run on the desktop (low footprint) or the server (use RAMDirectory for instance)
+ s.searcher = new IndexSearcher (FSDirectory.Open (dir));
+ } catch (IOException) {
+ Console.WriteLine ("Index nonexistent or in bad format");
+ return null;
+ }
+ return s;
+ }
+
+ //
+ // Search the index with term
+ //
+
+ public Result Search (string term)
+ {
+ return Search (term, maxSearchCount);
+ }
+
+ public Result Search (string term, int count)
+ {
+ return Search (term, count, 0);
+ }
+
+ public Result Search (string term, int count, int start) {
+ try {
+ term = term.ToLower ();
+ Term htTerm = new Term ("hottext", term);
+ Query qq1 = new FuzzyQuery (htTerm);
+ Query qq2 = new TermQuery (htTerm);
+ qq2.Boost = 10f;
+ Query qq3 = new PrefixQuery (htTerm);
+ qq3.Boost = 10f;
+ DisjunctionMaxQuery q1 = new DisjunctionMaxQuery (0f);
+ q1.Add (qq1);
+ q1.Add (qq2);
+ q1.Add (qq3);
+ Query q2 = new TermQuery (new Term ("text", term));
+ q2.Boost = 3f;
+ Query q3 = new TermQuery (new Term ("examples", term));
+ q3.Boost = 3f;
+ DisjunctionMaxQuery q = new DisjunctionMaxQuery (0f);
+
+ q.Add (q1);
+ q.Add (q2);
+ q.Add (q3);
+
+ TopDocs top = SearchInternal (q, count, start);
+ Result r = new Result (term, searcher, top.ScoreDocs);
+ Results.Add (r);
+ return r;
+ } catch (IOException) {
+ Console.WriteLine ("No index in {0}", dir);
+ return null;
+ }
+ }
+
+ TopDocs SearchInternal (Query q, int count, int start)
+ {
+ // Easy path that doesn't involve creating a Collector ourselves
+ // watch for Lucene.NET improvement on that (like searcher.SearchAfter)
+ if (start == 0)
+ return searcher.Search (q, count);
+
+ var weight = searcher.CreateWeight (q); // TODO: reuse weight instead of query
+ var collector = TopScoreDocCollector.Create (start + count + 1, false);
+ searcher.Search (q, collector);
+
+ return collector.TopDocs (start, count);
+ }
+
+ public Result FastSearch (string term, int number)
+ {
+ try {
+ term = term.ToLower ();
+ Query q1 = new TermQuery (new Term ("hottext", term));
+ Query q2 = new PrefixQuery (new Term ("hottext", term));
+ q2.Boost = 0.5f;
+ DisjunctionMaxQuery q = new DisjunctionMaxQuery (0f);
+ q.Add (q1);
+ q.Add (q2);
+ TopDocs top = searcher.Search (q, number);
+ return new Result (term, searcher, top.ScoreDocs);
+ } catch (IOException) {
+ Console.WriteLine ("No index in {0}", dir);
+ return null;
+ }
+ }
+
+ Query Parse (string term, string field, bool fuzzy)
+ {
+ QueryParser parser = new QueryParser (Lucene.Net.Util.Version.LUCENE_CURRENT,
+ field,
+ new StandardAnalyzer (Lucene.Net.Util.Version.LUCENE_CURRENT));
+ return parser.Parse (term);
+ }
+ }
+ //
+ // An object representing the search term with the results
+ //
+ public class Result {
+ string term;
+ Searcher searcher;
+ ScoreDoc[] docs;
+
+ public string Term {
+ get { return term;}
+ }
+
+ public int Count {
+ get { return docs.Length; }
+ }
+
+ public Document this [int i] {
+ get { return searcher.Doc (docs[i].Doc); }
+ }
+
+ public string GetTitle (int i)
+ {
+ Document d = this[i];
+ return d == null ? string.Empty : d.Get ("title");
+ }
+
+ public string GetUrl (int i)
+ {
+ Document d = this[i];
+ return d == null ? string.Empty : d.Get ("url");
+ }
+
+ public string GetFullTitle (int i)
+ {
+ Document d = this[i];
+ return d == null ? string.Empty : d.Get ("fulltitle");
+ }
+
+ public float Score (int i)
+ {
+ return docs[i].Score;
+ }
+
+ public Result (string Term, Searcher searcher, ScoreDoc[] docs)
+ {
+ this.term = Term;
+ this.searcher = searcher;
+ this.docs = docs;
+ }
+ }
+}
+
--- /dev/null
+using System;
+using System.IO;
+using System.Text;
+using System.Linq;
+using System.Xml;
+using System.Collections.Generic;
+
+namespace MonkeyDoc
+{
+ /// <summary>
+ /// This tree is populated by the documentation providers, or populated
+ /// from a binary encoding of the tree. The format of the tree is designed
+ /// to minimize the need to load it in full.
+ /// </summary>
+
+ /* Ideally this class should also be abstracted to let user have something
+ * else than a file as a backing store, a database for instance
+ */
+ public class Tree
+ {
+ public readonly HelpSource HelpSource;
+
+ FileStream InputStream;
+ BinaryReader InputReader;
+
+ // This is the node which contains all the other node of the tree
+ Node rootNode;
+
+ /// <summary>
+ /// Load from file constructor
+ /// </summary>
+ public Tree (HelpSource hs, string filename)
+ {
+ Encoding utf8 = new UTF8Encoding (false, true);
+
+ if (!File.Exists (filename)){
+ throw new FileNotFoundException ();
+ }
+
+ InputStream = File.OpenRead (filename);
+ InputReader = new BinaryReader (InputStream, utf8);
+ byte [] sig = InputReader.ReadBytes (4);
+
+ if (!GoodSig (sig))
+ throw new Exception ("Invalid file format");
+
+ InputStream.Position = 4;
+ var position = InputReader.ReadInt32 ();
+ rootNode = new Node (this, position);
+ InflateNode (rootNode);
+
+ HelpSource = hs;
+ }
+
+ /// <summary>
+ /// Tree creation and merged tree constructor
+ /// </summary>
+ public Tree (HelpSource hs, string caption, string url) : this (hs, null, caption, url)
+ {
+ }
+
+ public Tree (HelpSource hs, Node parent, string caption, string element)
+ {
+ HelpSource = hs;
+ rootNode = parent == null ? new Node (this, caption, element) : new Node (parent, caption, element);
+ }
+
+ /// <summary>
+ /// Saves the tree into the specified file using the help file format.
+ /// </summary>
+ public void Save (string file)
+ {
+ Encoding utf8 = new UTF8Encoding (false, true);
+ using (FileStream output = File.OpenWrite (file)){
+ // Skip over the pointer to the first node.
+ output.Position = 8;
+
+ using (BinaryWriter writer = new BinaryWriter (output, utf8)) {
+ // Recursively dump
+ rootNode.Serialize (output, writer);
+
+ output.Position = 0;
+ writer.Write (new byte [] { (byte) 'M', (byte) 'o', (byte) 'H', (byte) 'P' });
+ writer.Write (rootNode.Address);
+ }
+ }
+ }
+
+ public Node RootNode {
+ get {
+ return rootNode;
+ }
+ }
+
+ static bool GoodSig (byte [] sig)
+ {
+ if (sig.Length != 4)
+ return false;
+ return sig [0] == (byte) 'M'
+ && sig [1] == (byte) 'o'
+ && sig [2] == (byte) 'H'
+ && sig [3] == (byte) 'P';
+ }
+
+ public void InflateNode (Node baseNode)
+ {
+ var address = baseNode.Address;
+ if (address < 0)
+ address = -address;
+
+ InputStream.Position = address;
+ baseNode.Deserialize (InputReader);
+ }
+ }
+
+ public static class TreeDumper
+ {
+ static int indent;
+
+ static void Indent ()
+ {
+ for (int i = 0; i < indent; i++)
+ Console.Write (" ");
+ }
+
+ public static void PrintTree (Node node)
+ {
+ Indent ();
+ Console.WriteLine ("{0},{1}\t[PublicUrl: {2}]", node.Element, node.Caption, node.PublicUrl);
+ if (node.Nodes.Count == 0)
+ return;
+
+ indent++;
+ foreach (Node n in node.Nodes)
+ PrintTree (n);
+ indent--;
+ }
+
+ public static string ExportToTocXml (Node root, string title, string desc)
+ {
+ if (root == null)
+ throw new ArgumentNullException ("root");
+ // Return a toc index of sub-nodes
+ StringBuilder buf = new StringBuilder ();
+ var writer = XmlWriter.Create (buf);
+ writer.WriteStartElement ("toc");
+ writer.WriteAttributeString ("title", title ?? string.Empty);
+ writer.WriteElementString ("description", desc ?? string.Empty);
+ writer.WriteStartElement ("list");
+ foreach (Node n in root.Nodes) {
+ writer.WriteStartElement ("item");
+ writer.WriteAttributeString ("url", n.Element);
+ writer.WriteValue (n.Caption);
+ writer.WriteEndElement ();
+ }
+ writer.WriteEndElement ();
+ writer.WriteEndElement ();
+ writer.Flush ();
+ writer.Close ();
+
+ return buf.ToString ();
+ }
+ }
+}
--- /dev/null
+using System;
+
+namespace MonkeyDoc
+{
+ public static class TypeUtils
+ {
+ public static bool GetNamespaceAndType (string url, out string ns, out string type)
+ {
+ int nsidx = -1;
+ int numLt = 0;
+ for (int i = 0; i < url.Length; ++i) {
+ char c = url [i];
+ switch (c) {
+ case '<':
+ case '{':
+ ++numLt;
+ break;
+ case '>':
+ case '}':
+ --numLt;
+ break;
+ case '.':
+ if (numLt == 0)
+ nsidx = i;
+ break;
+ }
+ }
+
+ if (nsidx == -1) {
+ ns = null;
+ type = null;
+ return false;
+ }
+ ns = url.Substring (0, nsidx);
+ type = url.Substring (nsidx + 1);
+
+ return true;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.IO;
+
+namespace MonkeyDoc
+{
+ public enum DocEntity
+ {
+ Text,
+ Blob
+ }
+
+ public interface IDocCache : IDisposable
+ {
+ bool IsCached (string id);
+ bool CanCache (DocEntity entity);
+
+ Stream GetCachedStream (string id);
+ string GetCachedString (string id);
+
+ void CacheText (string id, string content);
+ void CacheText (string id, Stream stream);
+
+ void CacheBlob (string id, byte[] data);
+ void CacheBlob (string id, Stream stream);
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.IO;
+
+namespace MonkeyDoc.Caches
+{
+ public class FileCache : IDocCache
+ {
+ string baseCacheDir;
+
+ public FileCache (string baseCacheDir)
+ {
+ this.baseCacheDir = baseCacheDir;
+ if (!Directory.Exists (baseCacheDir))
+ Directory.CreateDirectory (baseCacheDir);
+ }
+
+ public bool IsCached (string id)
+ {
+ return File.Exists (MakePath (id));
+ }
+
+ public bool CanCache (DocEntity entity)
+ {
+ return true;
+ }
+
+ public Stream GetCachedStream (string id)
+ {
+ return File.OpenRead (MakePath (id));
+ }
+
+ public string GetCachedString (string id)
+ {
+ return File.ReadAllText (MakePath (id));
+ }
+
+ public void CacheText (string id, string content)
+ {
+ File.WriteAllText (MakePath (id), content);
+ }
+
+ public void CacheText (string id, Stream stream)
+ {
+ using (var file = File.OpenWrite (MakePath (id)))
+ stream.CopyTo (file);
+ }
+
+ public void CacheBlob (string id, byte[] data)
+ {
+ File.WriteAllBytes (MakePath (id), data);
+ }
+
+ public void CacheBlob (string id, Stream stream)
+ {
+ using (var file = File.OpenWrite (MakePath (id)))
+ stream.CopyTo (file);
+ }
+
+ string MakePath (string id)
+ {
+ id = id.Replace (Path.DirectorySeparatorChar, '_');
+ return Path.Combine (baseCacheDir, id);
+ }
+
+ public void Dispose ()
+ {
+ if (!Directory.Exists (baseCacheDir))
+ return;
+
+ try {
+ Directory.Delete (baseCacheDir, true);
+ } catch {}
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.IO;
+
+namespace MonkeyDoc.Caches
+{
+ // This is basically a no-cache implementation
+ public class NullCache : IDocCache
+ {
+ public bool IsCached (string id)
+ {
+ return false;
+ }
+
+ public bool CanCache (DocEntity entity)
+ {
+ return false;
+ }
+
+ public Stream GetCachedStream (string id)
+ {
+ return null;
+ }
+
+ public string GetCachedString (string id)
+ {
+ return null;
+ }
+
+ public void CacheText (string id, string content)
+ {
+
+ }
+
+ public void CacheText (string id, Stream stream)
+ {
+
+ }
+
+ public void CacheBlob (string id, byte[] data)
+ {
+
+ }
+
+ public void CacheBlob (string id, Stream stream)
+ {
+
+ }
+
+ public void Dispose ()
+ {
+
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+namespace MonkeyDoc
+{
+ // All type of documents that a generator may find as input
+ public enum DocumentType {
+ EcmaXml, // Our main monodoc format
+ EcmaSpecXml,
+ Man,
+ AddinXml,
+ MonoBook, // This is mostly XHTML already, just need a tiny bit of processing
+ Html,
+ TocXml, // Used by help source displaying some kind of toc of the content they host
+ PlainText,
+ ErrorXml
+ }
+
+ /* This interface defines a set of transformation engine
+ * that convert multiple documentation source to a single output format
+ */
+ public interface IDocGenerator<TOutput>
+ {
+ // This method is responsible for finding out the documentation type
+ // for the given ID and use the right engine internally
+ TOutput Generate (HelpSource hs, string internalId);
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.IO;
+using System.Text;
+using System.Linq;
+using System.Collections.Generic;
+
+using MonkeyDoc;
+
+namespace MonkeyDoc.Generators
+{
+ using Html;
+
+ interface IHtmlExporter
+ {
+ string CssCode { get; }
+ string Export (Stream input, Dictionary<string, string> extras);
+ string Export (string input, Dictionary<string, string> extras);
+ }
+
+ public class HtmlGenerator : IDocGenerator<string>
+ {
+ const string cachePrefix = "htmlcached#";
+
+ static string css_code;
+
+ IDocCache defaultCache;
+ static Dictionary<DocumentType, IHtmlExporter> converters;
+
+ static HtmlGenerator ()
+ {
+ converters = new Dictionary<DocumentType, IHtmlExporter> {
+ { DocumentType.EcmaXml, new Ecma2Html () },
+ { DocumentType.Man, new Man2Html () },
+ { DocumentType.TocXml, new Toc2Html () },
+ { DocumentType.EcmaSpecXml, new Ecmaspec2Html () },
+ { DocumentType.ErrorXml, new Error2Html () },
+ { DocumentType.Html, new Idem () },
+ { DocumentType.MonoBook, new MonoBook2Html () },
+ { DocumentType.AddinXml, new Addin2Html () },
+ { DocumentType.PlainText, new Idem () },
+ };
+ }
+
+ public HtmlGenerator (IDocCache defaultCache)
+ {
+ this.defaultCache = defaultCache;
+ }
+
+ public string Generate (HelpSource hs, string id)
+ {
+ if (hs == null || string.IsNullOrEmpty (id))
+ return MakeHtmlError ("Your request has found no candidate provider");
+ var cache = defaultCache ?? hs.Cache;
+ if (cache != null && cache.IsCached (MakeCacheKey (hs, id, null)))
+ return cache.GetCachedString (MakeCacheKey (hs, id, null));
+
+ IEnumerable<string> parts;
+ if (hs.IsMultiPart (id, out parts))
+ return GenerateMultiPart (hs, parts, id);
+
+ if (hs.IsRawContent (id))
+ return hs.GetText (id) ?? string.Empty;
+
+ Dictionary<string, string> extraParams = null;
+ DocumentType type = hs.GetDocumentTypeForId (id, out extraParams);
+ if (cache != null && extraParams != null && cache.IsCached (MakeCacheKey (hs, id, extraParams)))
+ return cache.GetCachedString (MakeCacheKey (hs, id, extraParams));
+
+ IHtmlExporter exporter;
+ if (!converters.TryGetValue (type, out exporter))
+ return MakeHtmlError (string.Format ("Input type '{0}' not supported",
+ type.ToString ()));
+ var result = hs.IsGeneratedContent (id) ?
+ exporter.Export (hs.GetCachedText (id), extraParams) :
+ exporter.Export (hs.GetCachedHelpStream (id), extraParams);
+
+ if (cache != null)
+ cache.CacheText (MakeCacheKey (hs, id, extraParams), result);
+ return result;
+ }
+
+ string GenerateMultiPart (HelpSource hs, IEnumerable<string> ids, string originalId)
+ {
+ var sb = new StringBuilder ();
+ foreach (var id in ids)
+ sb.AppendLine (Generate (hs, id));
+
+ var cache = defaultCache ?? hs.Cache;
+ if (cache != null)
+ cache.CacheText (MakeCacheKey (hs, originalId, null), sb.ToString ());
+ return sb.ToString ();
+ }
+
+ public static string InlineCss {
+ get {
+ if (css_code != null)
+ return css_code;
+
+ System.Reflection.Assembly assembly = System.Reflection.Assembly.GetAssembly (typeof (HtmlGenerator));
+ Stream str_css = assembly.GetManifestResourceStream ("base.css");
+ StringBuilder sb = new StringBuilder ((new StreamReader (str_css)).ReadToEnd());
+ sb.Replace ("@@FONT_FAMILY@@", "Sans Serif");
+ sb.Replace ("@@FONT_SIZE@@", "100%");
+ css_code = sb.ToString () + converters.Values
+ .Select (c => c.CssCode)
+ .Where (css => !string.IsNullOrEmpty (css))
+ .DefaultIfEmpty (string.Empty)
+ .Aggregate (string.Concat);
+ return css_code;
+ }
+ set {
+ css_code = value;
+ }
+ }
+
+ string MakeHtmlError (string error)
+ {
+ return string.Format ("<html><head></head><body><p>{0}</p></body></html>", error);
+ }
+
+ string MakeCacheKey (HelpSource hs, string page, IDictionary<string,string> extraParams)
+ {
+ var key = cachePrefix + hs.SourceID + page;
+ if (extraParams != null && extraParams.Count > 0) {
+ var paramPart = string.Join ("-", extraParams.Select (kvp => kvp.Key + kvp.Value));
+ key += '_' + paramPart;
+ }
+ return key;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.IO;
+using System.Text;
+using System.Xml;
+using System.Xml.Xsl;
+using System.Xml.XPath;
+using System.Collections.Generic;
+
+namespace MonkeyDoc.Generators.Html
+{
+ public class Addin2Html : IHtmlExporter
+ {
+ public string CssCode {
+ get {
+ return string.Empty;
+ }
+ }
+
+ public string Export (Stream stream, Dictionary<string, string> extraArgs)
+ {
+ using (var reader = new StreamReader (stream))
+ return Htmlize (GetAddin (reader, extraArgs["AddinID"]),
+ extraArgs["show"],
+ extraArgs["AddinID"],
+ extraArgs["FileID"],
+ extraArgs["NodeID"]);
+ }
+
+ public string Export (string input, Dictionary<string, string> extraArgs)
+ {
+ return Htmlize (GetAddin (new StringReader (input), extraArgs["AddinID"]),
+ extraArgs["show"],
+ extraArgs["AddinID"],
+ extraArgs["FileID"],
+ extraArgs["NodeID"]);
+ }
+
+ XmlElement GetAddin (TextReader reader, string addinId)
+ {
+ XmlDocument doc = new XmlDocument ();
+ doc.Load (reader);
+ XmlElement addin = (XmlElement) doc.SelectSingleNode ("Addins/Addin[@fullId='" + addinId + "']");
+ return addin != null ? addin : null;
+ }
+
+ public string Htmlize (XmlElement addin, string urlType, string addinId, string fileId, string path)
+ {
+ if (urlType == MonkeyDoc.Providers.AddinsHelpSource.AddinPrefix)
+ return GetAddinTextFromUrl (addin, addinId, fileId);
+ else if (urlType == MonkeyDoc.Providers.AddinsHelpSource.ExtensionPrefix)
+ return GetExtensionTextFromUrl (addin, addinId, fileId, path);
+ else if (urlType == MonkeyDoc.Providers.AddinsHelpSource.ExtensionNodePrefix)
+ return GetExtensionNodeTextFromUrl (addin, addinId, fileId, path);
+
+ return null;
+ }
+
+ protected string GetAddinTextFromUrl (XmlElement addin, string addinId, string fileId)
+ {
+ if (addin == null)
+ return "<html>Add-in not found: " + addinId + "</html>";
+
+ StringBuilder sb = new StringBuilder ("<html>");
+ sb.Append ("<h1>").Append (addin.GetAttribute ("name")).Append ("</h1>");
+ XmlElement docs = (XmlElement) addin.SelectSingleNode ("Description");
+ if (docs != null)
+ sb.Append (docs.InnerText);
+
+ sb.Append ("<p><table border=\"1\" cellpadding=\"4\" cellspacing=\"0\">");
+ sb.AppendFormat ("<tr><td><b>Id</b></td><td>{0}</td></tr>", addin.GetAttribute ("addinId"));
+ sb.AppendFormat ("<tr><td><b>Namespace</b></td><td>{0}</td></tr>", addin.GetAttribute ("namespace"));
+ sb.AppendFormat ("<tr><td><b>Version</b></td><td>{0}</td></tr>", addin.GetAttribute ("version"));
+ sb.Append ("</table></p>");
+ sb.Append ("<p><b>Extension Points</b>:</p>");
+ sb.Append ("<ul>");
+
+ foreach (XmlElement ep in addin.SelectNodes ("ExtensionPoint")) {
+ sb.AppendFormat ("<li><a href=\"extension-point:{0}#{1}#{2}\">{3}</li>", fileId, addinId, ep.GetAttribute ("path"), ep.GetAttribute ("name"));
+ }
+ sb.Append ("</ul>");
+
+ sb.Append ("</html>");
+ return sb.ToString ();
+ }
+
+ protected string GetExtensionTextFromUrl (XmlElement addin, string addinId, string fileId, string path)
+ {
+ if (addin == null)
+ return "<html>Add-in not found: " + addinId + "</html>";
+
+ XmlElement ext = (XmlElement) addin.SelectSingleNode ("ExtensionPoint[@path='" + path + "']");
+ if (ext == null)
+ return "<html>Extension point not found: " + path + "</html>";
+
+ StringBuilder sb = new StringBuilder ("<html>");
+ sb.Append ("<h1>").Append (ext.GetAttribute ("name")).Append ("</h1>");
+
+ path = path.Replace ("/", " <b>/</b> ");
+ sb.Append ("<p><b>Path</b>: ").Append (path).Append ("</p>");
+ XmlElement desc = (XmlElement) ext.SelectSingleNode ("Description");
+ if (desc != null)
+ sb.Append (desc.InnerText);
+
+ sb.Append ("<p><b>Extension Nodes</b>:</p>");
+ sb.Append ("<table border=\"1\" cellpadding=\"4\" cellspacing=\"0\">");
+
+ foreach (XmlElement en in ext.SelectNodes ("ExtensionNode")) {
+ string nid = en.GetAttribute ("id");
+ string nname = en.GetAttribute ("name");
+ string sdesc = "";
+ desc = (XmlElement) en.SelectSingleNode ("Description");
+ if (desc != null)
+ sdesc = desc.InnerText;
+
+ sb.AppendFormat ("<tr><td><a href=\"extension-node:{0}#{1}#{2}\">{3}</td><td>{4}</td></tr>", fileId, addinId, nid, nname, sdesc);
+ }
+ sb.Append ("</table>");
+
+ sb.Append ("</html>");
+ return sb.ToString ();
+ }
+
+ protected string GetExtensionNodeTextFromUrl (XmlElement addin, string addinId, string fileId, string nodeId)
+ {
+ if (addin == null)
+ return "<html>Add-in not found: " + addinId + "</html>";
+
+ XmlElement node = (XmlElement) addin.SelectSingleNode ("ExtensionNodeType[@id='" + nodeId + "']");
+ if (node == null)
+ return "<html>Extension point not found: " + nodeId + "</html>";
+
+ StringBuilder sb = new StringBuilder ("<html>");
+ sb.Append ("<h1>").Append (node.GetAttribute ("name")).Append ("</h1>");
+ XmlElement desc = (XmlElement) node.SelectSingleNode ("Description");
+ if (desc != null)
+ sb.Append (desc.InnerText);
+
+ sb.Append ("<p><b>Attributes</b>:</p>");
+ sb.Append ("<table border=\"1\" cellpadding=\"4\" cellspacing=\"0\"><tr>");
+ sb.Append ("<td><b>Name</b></td>");
+ sb.Append ("<td><b>Type</b></td>");
+ sb.Append ("<td><b>Required</b></td>");
+ sb.Append ("<td><b>Localizable</b></td>");
+ sb.Append ("<td><b>Description</b></td>");
+ sb.Append ("<tr>");
+ sb.Append ("<td>id</td>");
+ sb.Append ("<td>System.String</td>");
+ sb.Append ("<td></td>");
+ sb.Append ("<td></td>");
+ sb.Append ("<td>Identifier of the node.</td>");
+ sb.Append ("</tr>");
+
+ foreach (XmlElement at in node.SelectNodes ("Attributes/Attribute")) {
+ sb.Append ("<tr>");
+ sb.AppendFormat ("<td>{0}</td>", at.GetAttribute ("name"));
+ sb.AppendFormat ("<td>{0}</td>", at.GetAttribute ("type"));
+ if (at.GetAttribute ("required") == "True")
+ sb.Append ("<td>Yes</td>");
+ else
+ sb.Append ("<td></td>");
+ if (at.GetAttribute ("localizable") == "True")
+ sb.Append ("<td>Yes</td>");
+ else
+ sb.Append ("<td></td>");
+ string sdesc = "";
+ desc = (XmlElement) at.SelectSingleNode ("Description");
+ if (desc != null)
+ sdesc = desc.InnerText;
+
+ sb.AppendFormat ("<td>{0}</td>", sdesc);
+ sb.Append ("</tr>");
+ }
+ sb.Append ("</table>");
+
+ XmlNodeList children = node.SelectNodes ("ChildNodes/ExtensionNode");
+ if (children.Count > 0) {
+ sb.Append ("<p><b>Child Nodes</b>:</p>");
+ sb.Append ("<table border=\"1\" cellpadding=\"4\" cellspacing=\"0\">");
+
+ foreach (XmlElement en in children) {
+ string nid = en.GetAttribute ("id");
+ string nname = en.GetAttribute ("name");
+ string sdesc = "";
+ desc = (XmlElement) en.SelectSingleNode ("Description");
+ if (desc != null)
+ sdesc = desc.InnerText;
+
+ sb.AppendFormat ("<tr><td><a href=\"extension-node:{0}#{1}#{2}\">{3}</td><td>{4}</td></tr>", fileId, addinId, nid, nname, sdesc);
+ }
+ sb.Append ("</table>");
+ }
+
+ sb.Append ("</html>");
+ return sb.ToString ();
+ }
+ }
+}
--- /dev/null
+using System;
+using System.IO;
+using System.Text;
+using System.Linq;
+using System.Xml;
+using System.Xml.Xsl;
+using System.Xml.XPath;
+using System.Collections.Generic;
+
+using Mono.Documentation;
+using BF = System.Reflection.BindingFlags;
+
+namespace MonkeyDoc.Generators.Html
+{
+ public class Ecma2Html : IHtmlExporter
+ {
+ static string css_ecma;
+ static string js;
+ static XslCompiledTransform ecma_transform;
+ readonly ExtensionObject ExtObject = new ExtensionObject ();
+
+ public Ecma2Html ()
+ {
+ }
+
+ public string CssCode {
+ get {
+ if (css_ecma != null)
+ return css_ecma;
+ var assembly = typeof(Ecma2Html).Assembly;
+ Stream str_css = assembly.GetManifestResourceStream ("mono-ecma.css");
+ css_ecma = (new StreamReader (str_css)).ReadToEnd();
+ return css_ecma;
+ }
+ }
+
+ public string JsCode {
+ get {
+ if (js != null)
+ return js;
+ var assembly = typeof(Ecma2Html).Assembly;
+ Stream str_js = assembly.GetManifestResourceStream ("helper.js");
+ js = (new StreamReader (str_js)).ReadToEnd();
+ return js;
+ }
+ }
+
+ public string Htmlize (XmlReader ecma_xml, Dictionary<string, string> extraArgs)
+ {
+ var args = new XsltArgumentList ();
+ args.AddExtensionObject("monodoc:///extensions", ExtObject);
+ foreach (var kvp in extraArgs)
+ args.AddParam (kvp.Key, string.Empty, kvp.Value);
+
+ return Htmlize(ecma_xml, args);
+ }
+
+ public string Htmlize (XmlReader ecma_xml, XsltArgumentList args)
+ {
+ EnsureTransform ();
+
+ var output = new StringBuilder ();
+ ecma_transform.Transform (ecma_xml,
+ args,
+ XmlWriter.Create (output, ecma_transform.OutputSettings),
+ CreateDocumentResolver ());
+ return output.ToString ();
+ }
+
+ protected virtual XmlResolver CreateDocumentResolver ()
+ {
+ // results in using XmlUrlResolver
+ return null;
+ }
+
+ public string Export (Stream stream, Dictionary<string, string> extraArgs)
+ {
+ return Htmlize (XmlReader.Create (stream), extraArgs);
+ }
+
+ public string Export (string input, Dictionary<string, string> extraArgs)
+ {
+ return Htmlize (XmlReader.Create (new StringReader (input)), extraArgs);
+ }
+
+ static void EnsureTransform ()
+ {
+ if (ecma_transform == null) {
+ ecma_transform = new XslCompiledTransform ();
+ var assembly = System.Reflection.Assembly.GetCallingAssembly ();
+
+ Stream stream = assembly.GetManifestResourceStream ("mono-ecma-css.xsl");
+ XmlReader xml_reader = new XmlTextReader (stream);
+ XmlResolver r = new ManifestResourceResolver (".");
+ ecma_transform.Load (xml_reader, XsltSettings.TrustedXslt, r);
+ }
+ }
+
+ public class ExtensionObject
+ {
+ bool quiet = true;
+
+ public string Colorize(string code, string lang)
+ {
+ return Mono.Utilities.Colorizer.Colorize(code,lang);
+ }
+
+ // Used by stylesheet to nicely reformat the <see cref=> tags.
+ public string MakeNiceSignature(string sig, string contexttype)
+ {
+ if (sig.Length < 3)
+ return sig;
+ if (sig[1] != ':')
+ return sig;
+
+ char s = sig[0];
+ sig = sig.Substring(2);
+
+ switch (s) {
+ case 'N': return sig;
+ case 'T': return ShortTypeName (sig, contexttype);
+
+ case 'C': case 'M': case 'P': case 'F': case 'E':
+ string type, mem, arg;
+
+ // Get arguments
+ int paren;
+ if (s == 'C' || s == 'M')
+ paren = sig.IndexOf("(");
+ else if (s == 'P')
+ paren = sig.IndexOf("[");
+ else
+ paren = 0;
+
+ if (paren > 0 && paren < sig.Length-1) {
+ string[] args = sig.Substring(paren+1, sig.Length-paren-2).Split(',');
+ for (int i = 0; i < args.Length; i++)
+ args[i] = ShortTypeName(args[i], contexttype);
+ arg = "(" + String.Join(", ", args) + ")";
+ sig = sig.Substring(0, paren);
+ } else {
+ arg = string.Empty;
+ }
+
+ // Get type and member names
+ int dot = sig.LastIndexOf(".");
+ if (s == 'C' || dot <= 0 || dot == sig.Length-1) {
+ mem = string.Empty;
+ type = sig;
+ } else {
+ type = sig.Substring(0, dot);
+ mem = sig.Substring(dot);
+ }
+
+ type = ShortTypeName(type, contexttype);
+
+ return type + mem + arg;
+
+ default:
+ return sig;
+ }
+ }
+
+ static string ShortTypeName(string name, string contexttype)
+ {
+ int dot = contexttype.LastIndexOf(".");
+ if (dot < 0) return name;
+ string contextns = contexttype.Substring(0, dot+1);
+
+ if (name == contexttype)
+ return name.Substring(dot+1);
+
+ if (name.StartsWith(contextns))
+ return name.Substring(contextns.Length);
+
+ return name.Replace("+", ".");
+ }
+
+ string MonoImpInfo(string assemblyname, string typename, string membername, string arglist, bool strlong)
+ {
+ if (quiet)
+ return string.Empty;
+
+ var a = new List<string> ();
+ if (!string.IsNullOrEmpty (arglist)) a.Add (arglist);
+ return MonoImpInfo(assemblyname, typename, membername, a, strlong);
+ }
+
+ string MonoImpInfo(string assemblyname, string typename, string membername, XPathNodeIterator itr, bool strlong)
+ {
+ if (quiet)
+ return string.Empty;
+
+ var rgs = itr.Cast<XPathNavigator> ().Select (nav => nav.Value).ToList ();
+
+ return MonoImpInfo (assemblyname, typename, membername, rgs, strlong);
+ }
+
+ string MonoImpInfo(string assemblyname, string typename, string membername, List<string> arglist, bool strlong)
+ {
+ try {
+ System.Reflection.Assembly assembly = null;
+
+ try {
+ assembly = System.Reflection.Assembly.LoadWithPartialName(assemblyname);
+ } catch (Exception) {
+ // nothing.
+ }
+
+ if (assembly == null) {
+ /*if (strlong) return "The assembly " + assemblyname + " is not available to MonoDoc.";
+ else return string.Empty;*/
+ return string.Empty; // silently ignore
+ }
+
+ Type t = assembly.GetType(typename, false);
+ if (t == null) {
+ if (strlong)
+ return typename + " has not been implemented.";
+ else
+ return "Not implemented.";
+ }
+
+ // The following code is flakey and fails to find existing members
+ return string.Empty;
+ } catch (Exception) {
+ return string.Empty;
+ }
+ }
+
+ string MonoImpInfo(System.Reflection.MemberInfo mi, string itemtype, bool strlong)
+ {
+ if (quiet)
+ return string.Empty;
+
+ string s = string.Empty;
+
+ object[] atts = mi.GetCustomAttributes(true);
+ int todoctr = 0;
+ foreach (object att in atts) if (att.GetType().Name == "MonoTODOAttribute") todoctr++;
+
+ if (todoctr > 0) {
+ if (strlong)
+ s = "This " + itemtype + " is marked as being unfinished.<BR/>\n";
+ else
+ s = "Unfinished.";
+ }
+
+ return s;
+ }
+
+ public string MonoImpInfo(string assemblyname, string typename, bool strlong)
+ {
+ if (quiet)
+ return string.Empty;
+
+ try {
+ if (assemblyname == string.Empty)
+ return string.Empty;
+
+ var assembly = System.Reflection.Assembly.LoadWithPartialName(assemblyname);
+ if (assembly == null)
+ return string.Empty;
+
+ Type t = assembly.GetType(typename, false);
+ if (t == null) {
+ if (strlong)
+ return typename + " has not been implemented.";
+ else
+ return "Not implemented.";
+ }
+
+ string s = MonoImpInfo(t, "type", strlong);
+
+ if (strlong) {
+ var mis = t.GetMembers (BF.Static | BF.Instance | BF.Public | BF.NonPublic);
+
+ // Scan members for MonoTODO attributes
+ int mctr = 0;
+ foreach (var mi in mis) {
+ string mii = MonoImpInfo(mi, null, false);
+ if (mii != string.Empty) mctr++;
+ }
+ if (mctr > 0) {
+ s += "This type has " + mctr + " members that are marked as unfinished.<BR/>";
+ }
+ }
+
+ return s;
+
+ } catch (Exception) {
+ return string.Empty;
+ }
+ }
+
+ public bool MonoEditing ()
+ {
+ return false;
+ }
+
+ public bool IsToBeAdded(string text)
+ {
+ return text.StartsWith ("To be added");
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.IO;
+using System.Xml;
+using System.Xml.Xsl;
+using System.Xml.XPath;
+using System.Collections.Generic;
+
+namespace MonkeyDoc.Generators.Html
+{
+ public class Ecmaspec2Html : IHtmlExporter
+ {
+ static string css_ecmaspec;
+ static XslTransform ecma_transform;
+ static XsltArgumentList args = new XsltArgumentList();
+
+ public string CssCode {
+ get {
+ if (css_ecmaspec != null)
+ return css_ecmaspec;
+ System.Reflection.Assembly assembly = System.Reflection.Assembly.GetCallingAssembly ();
+ Stream str_css = assembly.GetManifestResourceStream ("ecmaspec.css");
+ css_ecmaspec = (new StreamReader (str_css)).ReadToEnd ();
+ return css_ecmaspec;
+ }
+ }
+
+ class ExtObj
+ {
+ public string Colorize (string code, string lang)
+ {
+ return Mono.Utilities.Colorizer.Colorize (code, lang);
+ }
+ }
+
+ public string Export (Stream stream, Dictionary<string, string> extraArgs)
+ {
+ return Htmlize (new XPathDocument (stream));
+ }
+
+ public string Export (string input, Dictionary<string, string> extraArgs)
+ {
+ return Htmlize (new XPathDocument (new StringReader (input)));
+ }
+
+ static string Htmlize (XPathDocument ecma_xml)
+ {
+ if (ecma_transform == null){
+ ecma_transform = new XslTransform ();
+ System.Reflection.Assembly assembly = System.Reflection.Assembly.GetCallingAssembly ();
+ Stream stream;
+ stream = assembly.GetManifestResourceStream ("ecmaspec-html-css.xsl");
+
+ XmlReader xml_reader = new XmlTextReader (stream);
+ ecma_transform.Load (xml_reader, null, null);
+ args.AddExtensionObject ("monodoc:///extensions", new ExtObj ());
+ }
+
+ if (ecma_xml == null) return "";
+
+ StringWriter output = new StringWriter ();
+ ecma_transform.Transform (ecma_xml, args, output, null);
+
+ return output.ToString ();
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.IO;
+using System.Linq;
+using System.Xml;
+using System.Xml.XPath;
+using System.Collections.Generic;
+
+namespace MonkeyDoc.Generators.Html
+{
+ public class Error2Html : IHtmlExporter
+ {
+ public string Export (string input, Dictionary<string, string> extraArgs)
+ {
+ return Htmlize (new XPathDocument (new StringReader (input)));
+ }
+
+ public string Export (Stream input, Dictionary<string, string> extraArgs)
+ {
+ return Htmlize (new XPathDocument (input));
+ }
+
+ public string CssCode {
+ get {
+ return @"
+ #error_ref {
+ background: #debcb0;
+ border: 2px solid #782609;
+ }
+ div.summary {
+ font-size: 110%;
+ font-weight: bolder;
+ }
+ div.details {
+ font-size: 110%;
+ font-weight: bolder;
+ }
+ div.code_example {
+ background: #f5f5dd;
+ border: 1px solid black;
+ padding-left: 1em;
+ padding-bottom: 1em;
+ margin-top: 1em;
+ white-space: pre;
+ margin-bottom: 1em;
+ }
+ div.code_ex_title {
+ position: relative;
+ top: -1em;
+ left: 30%;
+ background: #cdcd82;
+ border: 1px solid black;
+ color: black;
+ font-size: 65%;
+ text-transform: uppercase;
+ width: 40%;
+ padding: 0.3em;
+ text-align: center;
+ }";
+ }
+ }
+
+ public string Htmlize (IXPathNavigable doc)
+ {
+ var navigator = doc.CreateNavigator ();
+ var errorName = navigator.SelectSingleNode ("//ErrorDocumentation/ErrorName");
+ var details = navigator.SelectSingleNode ("//ErrorDocumentation/Details");
+
+ StringWriter sw = new StringWriter ();
+ XmlWriter w = new XmlTextWriter (sw);
+
+ WriteElementWithClass (w, "div", "header");
+ w.WriteAttributeString ("id", "error_ref");
+ WriteElementWithClass (w, "div", "subtitle", "Compiler Error Reference");
+ WriteElementWithClass (w, "div", "title", "Error " + (errorName == null ? string.Empty : errorName.Value));
+ w.WriteEndElement ();
+
+ if (details != null) {
+ WriteElementWithClass (w, "div", "summary", "Summary");
+
+ var summary = details.SelectSingleNode ("/Summary");
+ w.WriteValue (summary == null ? string.Empty : summary.Value);
+
+ WriteElementWithClass (w, "div", "details", "Details");
+ var de = details.SelectSingleNode ("/Details");
+ w.WriteValue (de == null ? string.Empty : de.Value);
+ }
+
+ foreach (XPathNavigator xmp in navigator.Select ("//ErrorDocumentation/Examples/string")) {
+ WriteElementWithClass (w, "div", "code_example");
+ WriteElementWithClass (w, "div", "code_ex_title", "Example");
+ w.WriteRaw (Mono.Utilities.Colorizer.Colorize (xmp.Value, "c#"));;
+ w.WriteEndElement ();
+ }
+
+ w.Close ();
+
+ return sw.ToString ();
+ }
+
+ void WriteElementWithClass (XmlWriter w, string element, string cls, string content = null)
+ {
+ w.WriteStartElement (element);
+ w.WriteAttributeString ("class", cls);
+ if (!string.IsNullOrEmpty (content)) {
+ w.WriteValue (content);
+ w.WriteEndElement ();
+ }
+ }
+ }
+}
--- /dev/null
+using System;
+using System.IO;
+using System.Text;
+using System.Collections.Generic;
+
+using MonkeyDoc;
+using MonkeyDoc.Generators;
+
+namespace MonkeyDoc.Generators.Html
+{
+ // Input is expected to be already HTML so just return it
+ public class Idem : IHtmlExporter
+ {
+ public string CssCode {
+ get {
+ return string.Empty;
+ }
+ }
+
+ public string Export (Stream input, Dictionary<string, string> extraArgs)
+ {
+ if (input == null)
+ return null;
+ return new StreamReader (input).ReadToEnd ();
+ }
+
+ public string Export (string input, Dictionary<string, string> extraArgs)
+ {
+ if (string.IsNullOrEmpty (input))
+ return null;
+ return input;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.IO;
+using System.Text;
+using System.Collections.Generic;
+
+using MonkeyDoc;
+using MonkeyDoc.Generators;
+
+namespace MonkeyDoc.Generators.Html
+{
+ public class Man2Html : IHtmlExporter
+ {
+ public string CssCode {
+ get {
+ return string.Empty;
+ }
+ }
+
+ public string Export (Stream input, Dictionary<string, string> extraArgs)
+ {
+ if (input == null)
+ return null;
+ return GetTextFromReader (new StreamReader (input));
+ }
+
+ public string Export (string input, Dictionary<string, string> extraArgs)
+ {
+ if (string.IsNullOrEmpty (input))
+ return null;
+ return GetTextFromReader (new StringReader (input));
+ }
+
+ public static string GetTextFromReader (TextReader file)
+ {
+ string line;
+ StateInfo s = new StateInfo ();
+
+ while ((line = file.ReadLine ()) != null)
+ ProcessLine (line, s);
+
+ return s.output.ToString ();
+ }
+
+ enum ListState {
+ None,
+ Start,
+ Title,
+ }
+
+ class StateInfo {
+ public ListState ls;
+ public Stack<string> tags = new Stack<string> ();
+ public StringBuilder output = new StringBuilder ();
+ }
+
+ static void ProcessLine (string line, StateInfo s)
+ {
+ string[] parts = SplitLine (line);
+ switch (parts [0]) {
+ case ".\\\"": // comments
+ case ".de": // define macro
+ case ".if": // if
+ case ".ne": // ???
+ case "..": // end macro
+ // ignore
+ break;
+ case ".I":
+ s.output.Append ("<i>");
+ Translate (parts, 1, s.output);
+ s.output.Append ("</i>");
+ break;
+ case ".B":
+ s.output.Append ("<b>");
+ Translate (parts, 1, s.output);
+ s.output.Append ("</b>");
+ break;
+ case ".br":
+ Translate (parts, 1, s.output);
+ s.output.Append ("<br />");
+ break;
+ case ".nf":
+ Expect (s, "</p>");
+ s.output.Append ("<pre>\n");
+ s.tags.Push ("</pre>");
+ break;
+ case ".fi":
+ Expect (s, "</pre>");
+ break;
+ case ".PP":
+ Expect (s, "</p>", "</dd>", "</dl>");
+ goto case ".Sp";
+ case ".Sp":
+ Expect (s, "</p>");
+ s.output.Append ("<p>");
+ Translate (parts, 1, s.output);
+ s.tags.Push ("</p>");
+ break;
+ case ".RS":
+ Expect (s, "</p>");
+ s.output.Append ("<blockquote>");
+ s.tags.Push ("</blockquote>");
+ break;
+ case ".RE":
+ ClearUntil (s, "</blockquote>");
+ break;
+ case ".SH":
+ ClearAll (s);
+ s.output.Append ("<h2>");
+ Translate (parts, 1, s.output);
+ s.output.Append ("</h2>")
+ .Append ("<blockquote>");
+ s.tags.Push ("</blockquote>");
+ break;
+ case ".SS":
+ s.output.Append ("<h3>");
+ Translate (parts, 1, s.output);
+ s.output.Append ("</h3>");
+ break;
+ case ".TH": {
+ ClearAll (s);
+ string name = "", extra = "";
+ if (parts.Length >= 4 && parts [2].Trim ().Length == 0) {
+ name = parts [1] + "(" + parts [3] + ")";
+ if (parts.Length > 4) {
+ int start = 4;
+ if (parts [start].Trim ().Length == 0)
+ ++start;
+ extra = string.Join ("", parts, start, parts.Length-start);
+ }
+ }
+ else
+ name = string.Join ("", parts, 1, parts.Length-1);
+ s.output.Append ("<table width=\"100%\" bgcolor=\"#b0c4da\">" +
+ "<tr colspan=\"2\"><td>Manual Pages</td></tr>\n" +
+ "<tr><td><h3>");
+ Translate (name, s.output);
+ s.output.Append ("</h3></td><td align=\"right\">");
+ Translate (extra, s.output);
+ s.output.Append ("</td></tr></table>");
+ break;
+ }
+ case ".TP":
+ Expect (s, "</p>");
+ if (s.tags.Count > 0 && s.tags.Peek ().ToString () != "</dd>") {
+ s.output.Append ("<dl>");
+ s.tags.Push ("</dl>");
+ }
+ else
+ Expect (s, "</dd>");
+ s.output.Append ("<dt>");
+ s.tags.Push ("</dt>");
+ s.ls = ListState.Start;
+ break;
+ default:
+ Translate (line, s.output);
+ break;
+ }
+ if (s.ls == ListState.Start)
+ s.ls = ListState.Title;
+ else if (s.ls == ListState.Title) {
+ Expect (s, "</dt>");
+ s.output.Append ("<dd>");
+ s.tags.Push ("</dd>");
+ s.ls = ListState.None;
+ }
+ s.output.Append ("\n");
+ }
+
+ static string[] SplitLine (string line)
+ {
+ if (line.Length > 1 && line [0] != '.')
+ return new string[]{null, line};
+
+ int i;
+ for (i = 0; i < line.Length; ++i) {
+ if (char.IsWhiteSpace (line, i))
+ break;
+ }
+
+ if (i == line.Length)
+ return new string[]{line};
+
+ var pieces = new List<string> ();
+ pieces.Add (line.Substring (0, i));
+ bool inQuotes = false;
+ bool prevWs = true;
+ ++i;
+ int start = i;
+ for ( ; i < line.Length; ++i) {
+ char c = line [i];
+ if (inQuotes) {
+ if (c == '"') {
+ Add (pieces, line, start, i);
+ start = i+1;
+ inQuotes = false;
+ }
+ }
+ else {
+ if (prevWs && c == '"') {
+ Add (pieces, line, start, i);
+ start = i+1;
+ inQuotes = true;
+ }
+ else if (char.IsWhiteSpace (c)) {
+ if (!prevWs) {
+ Add (pieces, line, start, i);
+ start = i;
+ }
+ prevWs = true;
+ }
+ else {
+ if (prevWs) {
+ Add (pieces, line, start, i);
+ start = i;
+ }
+ prevWs = false;
+ }
+ }
+ }
+ if (start > 0 && start != line.Length)
+ pieces.Add (line.Substring (start, line.Length-start));
+ return pieces.ToArray ();
+ }
+
+ static void Add (List<string> pieces, string line, int start, int end)
+ {
+ if (start == end)
+ return;
+ pieces.Add (line.Substring (start, end-start));
+ }
+
+ static void Expect (StateInfo s, params string[] expected)
+ {
+ string e;
+ while (s.tags.Count > 0 &&
+ Array.IndexOf (expected, (e = s.tags.Peek ().ToString ())) >= 0) {
+ s.output.Append (s.tags.Pop ().ToString ());
+ }
+ }
+
+ static void ClearUntil (StateInfo s, string required)
+ {
+ string e;
+ while (s.tags.Count > 0 &&
+ (e = s.tags.Peek ().ToString ()) != required) {
+ s.output.Append (s.tags.Pop ().ToString ());
+ }
+ if (e == required)
+ s.output.Append (s.tags.Pop ().ToString ());
+ }
+
+ static void ClearAll (StateInfo s)
+ {
+ while (s.tags.Count > 0)
+ s.output.Append (s.tags.Pop ().ToString ());
+ }
+
+ static void Translate (string[] lines, int startIndex, StringBuilder output)
+ {
+ if (lines.Length <= startIndex)
+ return;
+ do {
+ Translate (lines [startIndex++], output);
+ if (startIndex == lines.Length)
+ break;
+ } while (startIndex < lines.Length);
+ }
+
+ static void Translate (string line, StringBuilder output)
+ {
+ string span = null;
+ int start = output.Length;
+ for (int i = 0; i < line.Length; ++i) {
+ switch (line [i]) {
+ case '\\': {
+ if ((i+2) < line.Length && line [i+1] == 'f') {
+ if (line [i+2] == 'I') {
+ output.Append ("<i>");
+ span = "</i>";
+ }
+ else if (line [i+2] == 'B') {
+ output.Append ("<b>");
+ span = "</b>";
+ }
+ else if (line [i+2] == 'R' || line [i+2] == 'P') {
+ output.Append (span);
+ }
+ else
+ goto default;
+ i += 2;
+ }
+ else if ((i+1) < line.Length) {
+ output.Append (line [i+1]);
+ ++i;
+ }
+ else
+ goto default;
+ break;
+ }
+ case '<':
+ output.Append ("<");
+ break;
+ case '>':
+ output.Append (">");
+ break;
+ case '&':
+ output.Append ("&");
+ break;
+ default:
+ output.Append (line [i]);
+ break;
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.IO;
+using System.Text;
+using System.Xml;
+using System.Collections.Generic;
+
+using MonkeyDoc;
+using MonkeyDoc.Generators;
+
+namespace MonkeyDoc.Generators.Html
+{
+ // Input is expected to be already HTML so just return it
+ public class MonoBook2Html : IHtmlExporter
+ {
+ public string CssCode {
+ get {
+ return @" h3 {
+ font-size: 18px;
+ padding-bottom: 4pt;
+ border-bottom: 2px solid #dddddd;
+ }
+
+ .api {
+ border: 1px solid;
+ padding: 10pt;
+ margin: 10pt;
+ }
+
+ .api-entry {
+ border-bottom: none;
+ font-size: 18px;
+ }
+
+ .prototype {
+ border: 1px solid;
+ background-color: #f2f2f2;
+ padding: 5pt;
+ margin-top: 5pt;
+ margin-bottom: 5pt;
+ }
+
+ .header {
+ border: 1px solid !important;
+ padding: 0 0 5pt 5pt !important;
+ margin: 10pt !important;
+ white-space: pre !important;
+ font-family: monospace !important;
+ font-weight: normal !important;
+ font-size: 1em !important;
+ }
+
+ .code {
+ border: 1px solid;
+ padding: 0 0 5pt 5pt;
+ margin: 10pt;
+ white-space: pre;
+ font-family: monospace;
+ }
+";
+ }
+ }
+
+ public string Export (Stream input, Dictionary<string, string> extraArgs)
+ {
+ if (input == null)
+ return null;
+ return FromXmlReader (XmlReader.Create (input));
+ }
+
+ public string Export (string input, Dictionary<string, string> extraArgs)
+ {
+ if (string.IsNullOrEmpty (input))
+ return null;
+ return FromXmlReader (XmlReader.Create (new StringReader (input)));
+ }
+
+ public string FromXmlReader (XmlReader reader)
+ {
+ if (!reader.ReadToDescendant ("head"))
+ return null;
+ if (!reader.ReadToNextSibling ("body"))
+ return null;
+
+ return reader.ReadInnerXml ();
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.IO;
+using System.Xml;
+using System.Xml.Xsl;
+using System.Xml.XPath;
+using System.Reflection;
+using System.Collections.Generic;
+
+namespace MonkeyDoc.Generators.Html
+{
+ public class Toc2Html : IHtmlExporter
+ {
+ XslTransform transform;
+
+ public Toc2Html ()
+ {
+ transform = new XslTransform ();
+ var assembly = Assembly.GetCallingAssembly ();
+ var stream = assembly.GetManifestResourceStream ("toc-html.xsl");
+ XmlReader xml_reader = new XmlTextReader (stream);
+ transform.Load (xml_reader, null, null);
+ }
+
+ public string Export (Stream input, Dictionary<string, string> extraArgs)
+ {
+ var output = new StringWriter ();
+ transform.Transform (new XPathDocument (input), null, output, null);
+ return output.ToString ();
+ }
+
+ public string Export (string input, Dictionary<string, string> extraArgs)
+ {
+ var output = new StringWriter ();
+ transform.Transform (new XPathDocument (new StringReader (input)), null, output, null);
+ return output.ToString ();
+ }
+
+ public string CssCode {
+ get {
+ return string.Empty;
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+//
+// index.cs: Handling of the index files
+//
+// Author:
+// Miguel de Icaza (miguel@xamarin.com)
+//
+// (C) 2003 Ximian, Inc.
+// Copyright 2003-2011 Novell Inc
+// Copyright 2011 Xamarin Inc.
+//
+// Possible file format optimizations:
+// * Do not use 4 bytes for each index entry, use 3 bytes
+// * Find a way of compressing strings, there are plenty of duplicates
+// Find common roots, and use an encoding that uses a root to compress data.
+// "System", "System.Data", "System.Data class"
+// 0: PLAIN: "System"
+// 1: PLAIN: " class"
+// 2: LINK0 PLAIN ".DATA"
+// 3: LINK0 LINK1
+//
+// Maybe split everything at spaces and dots, and encode that:
+// string-1-idx "System."
+// string-1-idx "Data"
+// 2-items [ string-1-idx string-2-idx]
+//
+// Other variations are possible; Like Archive "System", "System." when we
+// see "System.Data".
+//
+//
+
+using System;
+using System.IO;
+using System.Text;
+using System.Collections;
+
+namespace MonkeyDoc
+{
+
+ public class Topic {
+ public readonly string Caption;
+ public readonly string SortKey;
+ public readonly string Url;
+
+ public Topic (string caption, string sort_key, string url)
+ {
+ Caption = caption;
+ SortKey = sort_key;
+ Url = url;
+ }
+ }
+
+ public class IndexEntry {
+ public int Position;
+ public object topics;
+ public int Count;
+
+ public void Add (Topic t)
+ {
+ Count++;
+ if (topics == null)
+ topics = t;
+ else {
+ if (!(topics is ArrayList)){
+ Topic temp = (Topic) topics;
+
+ topics = new ArrayList ();
+ ((ArrayList)topics).Add (temp);
+ }
+ ((ArrayList)topics).Add (t);
+ }
+ }
+
+ public Topic this [int idx] {
+ get {
+ if (topics is Topic){
+ if (idx == 0)
+ return (Topic) topics;
+ else
+ throw new Exception ("Out of range index");
+ } else {
+ return (Topic) (((ArrayList)topics) [idx]);
+ }
+ }
+ }
+
+ //
+ // Constructor from a stream
+ //
+ public IndexEntry (FileStream fs, BinaryReader reader, int position)
+ {
+ Count = reader.ReadInt32 ();
+ int caption_offset = reader.ReadInt32 ();
+ string caption;
+
+ if (Count == 1){
+ int url_offset = reader.ReadInt32 ();
+ fs.Position = caption_offset;
+ caption = reader.ReadString ();
+ fs.Position = url_offset;
+ string url = reader.ReadString ();
+ topics = new Topic (caption, "", url);
+ } else {
+ ArrayList l = new ArrayList (Count);
+ topics = l;
+ int [] offsets = new int [Count];
+ for (int i = 0; i < Count; i++){
+ offsets [i] = reader.ReadInt32 ();
+ }
+ fs.Position = caption_offset;
+ caption = reader.ReadString ();
+ for (int i = 0; i < Count; i++){
+ fs.Position = offsets [i];
+ string url = reader.ReadString ();
+ l.Add (new Topic (caption, "", url));
+ }
+ }
+ }
+
+ // Topic ReadTopic (FileStream fs, BinaryReader reader, ref string caption)
+ // {
+ // int caption_offset = -1;
+ // if (caption == null)
+ // caption_offset = reader.ReadInt32 ();
+ // int url_offset = reader.ReadInt32 ();
+ //
+ // if (caption == null){
+ // fs.Position = caption_offset;
+ // caption = reader.ReadString ();
+ // }
+ // fs.Position = url_offset;
+ // string url = reader.ReadString ();
+ //
+ // return new Topic (caption, "", url);
+ // }
+
+ //
+ // Regular constructor
+
+ public IndexEntry ()
+ {
+ }
+
+ public void WriteTopics (IndexMaker maker, Stream stream, BinaryWriter writer)
+ {
+ //
+ // Convention: entries with the same SortKey should have the same Caption
+ //
+ Position = (int) stream.Position;
+ writer.Write (Count);
+
+ if (topics is ArrayList){
+ bool first = true;
+ foreach (Topic t in (ArrayList) topics){
+ if (first){
+ writer.Write (maker.GetCode (t.Caption));
+ first = false;
+ }
+ writer.Write (maker.GetCode (t.Url));
+ }
+ } else {
+ Topic t = (Topic) topics;
+
+ writer.Write (maker.GetCode (t.Caption));
+ writer.Write (maker.GetCode (t.Url));
+ }
+ }
+ }
+
+ public class IndexMaker {
+ Hashtable entries = new Hashtable ();
+ Hashtable all_strings = new Hashtable ();
+
+ void add_string (string s)
+ {
+ if (all_strings.Contains (s))
+ return;
+ all_strings [s] = 0;
+ }
+
+ public void AddTopic (Topic topic)
+ {
+ IndexEntry entry = (IndexEntry) entries [topic.SortKey];
+ if (entry == null){
+ entry = new IndexEntry ();
+ entries [topic.SortKey] = entry;
+ }
+
+ add_string (topic.SortKey);
+ add_string (topic.Caption);
+ add_string (topic.Url);
+ entry.Add (topic);
+ }
+
+ public void Add (string caption, string sort_key, string url)
+ {
+ Topic t = new Topic (caption, sort_key, url);
+ AddTopic (t);
+ }
+
+ void SaveStringTable (Stream stream, BinaryWriter writer)
+ {
+ ICollection k = all_strings.Keys;
+ string [] ks = new string [k.Count];
+ k.CopyTo (ks, 0);
+
+ foreach (string s in ks){
+ int pos = (int) stream.Position;
+ writer.Write (s);
+ all_strings [s] = pos;
+ }
+ }
+
+ public int GetCode (string s)
+ {
+ return (int) all_strings [s];
+ }
+
+ int index_position;
+
+ void SaveTopics (Stream stream, BinaryWriter writer)
+ {
+ //
+ // Convention: entries with the same SortKey should have the same Caption
+ //
+ foreach (IndexEntry e in entries.Values)
+ e.WriteTopics (this, stream, writer);
+ }
+
+ void SaveIndexEntries (Stream stream, BinaryWriter writer)
+ {
+ index_position = (int) stream.Position;
+ writer.Write (entries.Count);
+ ICollection keys = entries.Keys;
+ string [] keys_name = new string [keys.Count];
+ keys.CopyTo (keys_name, 0);
+ Array.Sort (keys_name, new NameSort ());
+
+ foreach (string s in keys_name){
+ IndexEntry e = (IndexEntry) entries [s];
+ writer.Write (e.Position);
+ }
+ }
+
+ class NameSort : IComparer {
+ public int Compare (object a, object b)
+ {
+ string sa = (string) a;
+ string sb = (string) b;
+
+ return String.Compare (sa, sb, StringComparison.OrdinalIgnoreCase);
+ }
+ }
+
+ public void Save (string filename)
+ {
+ Encoding utf8 = new UTF8Encoding (false, true);
+
+ using (FileStream fs = File.OpenWrite (filename)){
+ BinaryWriter writer =
+ new BinaryWriter (fs, utf8);
+ writer.Write (new byte [] { (byte) 'M',
+ (byte) 'o', (byte) 'i',
+ (byte) 'x'});
+
+ // Leave room for pointer
+ fs.Position = 8;
+
+ SaveStringTable (fs, writer);
+ SaveTopics (fs, writer);
+
+ // index_position is set here
+
+ SaveIndexEntries (fs, writer);
+
+ fs.Position = 4;
+ writer.Write (index_position);
+ }
+ }
+ }
+
+ public interface IListModel {
+ int Rows {get; }
+ string GetValue (int row);
+ string GetDescription (int row);
+ }
+
+ public class IndexReader : IListModel {
+ Encoding utf8 = new UTF8Encoding (false, true);
+ FileStream fs;
+ BinaryReader reader;
+
+ // The offset of the table of entries
+ int table_offset;
+ int entries;
+
+ static public IndexReader Load (string filename)
+ {
+ if (!File.Exists (filename))
+ return null;
+
+ try {
+ return new IndexReader (filename);
+ } catch {
+ return null;
+ }
+ }
+
+ IndexReader (string filename)
+ {
+ fs = File.OpenRead (filename);
+ reader = new BinaryReader (fs, utf8);
+
+ if (fs.ReadByte () != 'M' ||
+ fs.ReadByte () != 'o' ||
+ fs.ReadByte () != 'i' ||
+ fs.ReadByte () != 'x'){
+ throw new Exception ("Corrupt index");
+ }
+
+ // Seek to index_entries
+ fs.Position = reader.ReadInt32 ();
+
+ entries = reader.ReadInt32 ();
+
+ table_offset = (int) fs.Position;
+ }
+
+ public int Rows {
+ get {
+ return entries;
+ }
+ }
+
+ public string GetValue (int row)
+ {
+ fs.Position = row * 4 + table_offset;
+ fs.Position = reader.ReadInt32 () + 4;
+ int code = reader.ReadInt32 ();
+ fs.Position = code;
+ string caption = reader.ReadString ();
+
+ return caption;
+ }
+
+ public string GetDescription (int row)
+ {
+ return GetValue (row);
+ }
+
+ public IndexEntry GetIndexEntry (int row)
+ {
+ fs.Position = row * 4 + table_offset;
+ int entry_offset = reader.ReadInt32 ();
+ fs.Position = entry_offset;
+
+ return new IndexEntry (fs, reader, entry_offset);
+ }
+ }
+}
+
--- /dev/null
+// addins-provider.cs
+//
+// A provider to display Mono.Addins extension models
+//
+// Author:
+// Lluis Sanchez Gual <lluis@novell.com>
+//
+// Copyright (c) 2007 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+using System;
+using System.Linq;
+using System.Diagnostics;
+using System.Text;
+using System.IO;
+using System.Xml;
+using System.Collections.Generic;
+
+namespace MonkeyDoc.Providers
+{
+ public class AddinsProvider : Provider
+ {
+ string file;
+
+ public AddinsProvider (string xmlModelFile)
+ {
+ file = xmlModelFile;
+
+ if (!File.Exists (file))
+ throw new FileNotFoundException (String.Format ("The file `{0}' does not exist", file));
+ }
+
+ public override void PopulateTree (Tree tree)
+ {
+ string fileId = Path.GetFileNameWithoutExtension (file);
+ using (var f = File.OpenRead (file))
+ tree.HelpSource.Storage.Store (fileId, f);
+
+ XmlDocument doc = new XmlDocument ();
+ doc.Load (file);
+
+ foreach (XmlElement addin in doc.SelectNodes ("Addins/Addin")) {
+
+ string addinId = addin.GetAttribute ("fullId");
+ Node newNode = tree.RootNode.CreateNode (addin.GetAttribute ("name"), "addin:" + fileId + "#" + addinId);
+
+ foreach (XmlElement node in addin.SelectNodes ("ExtensionPoint")) {
+ string target = "extension-point:" + fileId + "#" + addinId + "#" + node.GetAttribute ("path");
+ Node newExt = newNode.CreateNode (node.GetAttribute ("name"), target);
+
+ foreach (XmlElement en in node.SelectNodes ("ExtensionNode")) {
+ string nid = en.GetAttribute ("id");
+ string nname = en.GetAttribute ("name");
+ newExt.CreateNode (nname, "extension-node:" + fileId + "#" + addinId + "#" + nid);
+ }
+ }
+ }
+ }
+
+ public override void CloseTree (HelpSource hs, Tree tree)
+ {
+ }
+ }
+
+ public class AddinsHelpSource : HelpSource
+ {
+ public AddinsHelpSource (string base_file, bool create) : base (base_file, create)
+ {
+ }
+
+ internal protected const string AddinPrefix = "addin:";
+ internal protected const string ExtensionPrefix = "extension-point:";
+ internal protected const string ExtensionNodePrefix = "extension-node:";
+
+ public override bool CanHandleUrl (string url)
+ {
+ return url.StartsWith (AddinPrefix, StringComparison.OrdinalIgnoreCase)
+ || url.StartsWith (ExtensionPrefix, StringComparison.OrdinalIgnoreCase)
+ || url.StartsWith (ExtensionNodePrefix, StringComparison.OrdinalIgnoreCase);
+ }
+
+ protected override string UriPrefix {
+ get {
+ return AddinPrefix;
+ }
+ }
+
+ public override DocumentType GetDocumentTypeForId (string id, out Dictionary<string, string> extraArgs)
+ {
+ extraArgs = new Dictionary<string, string> ();
+ var idParts = id.Split ('#');
+ extraArgs["FileID"] = idParts[0];
+ extraArgs["AddinID"] = idParts[1];
+ extraArgs["NodeID"] = idParts[2];
+
+ return DocumentType.AddinXml;
+ }
+
+ public override Node MatchNode (string url)
+ {
+ var prefix = new[] { AddinPrefix, ExtensionPrefix, ExtensionNodePrefix }.First (p => url.StartsWith (p, StringComparison.OrdinalIgnoreCase));
+ return base.MatchNode (prefix != null ? url.Substring (prefix.Length) : url);
+ }
+
+ public override Stream GetHelpStream (string id)
+ {
+ var idParts = id.Split ('#');
+ return base.GetHelpStream (idParts[0]);
+ }
+
+ public override Stream GetCachedHelpStream (string id)
+ {
+ var idParts = id.Split ('#');
+ return base.GetHelpStream (idParts[0]);
+ }
+ }
+}
--- /dev/null
+//
+// The ecmaspec provider is for ECMA specifications
+//
+// Authors:
+// John Luke (jluke@cfl.rr.com)
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// Use like this:
+// mono assembler.exe --ecmaspec DIRECTORY --out name
+//
+
+using System;
+using System.Linq;
+using System.IO;
+using System.Text;
+using System.Xml;
+using System.Xml.Linq;
+using System.Collections.Generic;
+
+using Lucene.Net.Index;
+using Lucene.Net.Documents;
+
+using Monkeydoc.Ecma;
+using Mono.Utilities;
+
+namespace MonkeyDoc.Providers
+{
+ public enum EcmaNodeType {
+ Invalid,
+ Namespace,
+ Type,
+ Member,
+ Meta, // A node that's here to serve as a header for other node
+ }
+
+ public class EcmaProvider : Provider
+ {
+ HashSet<string> directories = new HashSet<string> ();
+
+ public EcmaProvider ()
+ {
+ }
+
+ public EcmaProvider (string baseDir)
+ {
+ AddDirectory (baseDir);
+ }
+
+ public void AddDirectory (string directory)
+ {
+ if (string.IsNullOrEmpty (directory))
+ throw new ArgumentNullException ("directory");
+
+ directories.Add (directory);
+ }
+
+ public override void PopulateTree (Tree tree)
+ {
+ var root = tree.RootNode;
+ var storage = tree.HelpSource.Storage;
+ int resID = 0;
+ var nsSummaries = new Dictionary<string, XElement> ();
+
+ foreach (var asm in directories) {
+ var indexFilePath = Path.Combine (asm, "index.xml");
+ if (!File.Exists (indexFilePath)) {
+ Console.Error.WriteLine ("Warning: couldn't process directory `{0}' as it has no index.xml file", asm);
+ continue;
+ }
+ using (var reader = XmlReader.Create (File.OpenRead (indexFilePath))) {
+ reader.ReadToFollowing ("Types");
+ var types = XElement.Load (reader.ReadSubtree ());
+
+ foreach (var ns in types.Elements ("Namespace")) {
+ var nsName = (string)ns.Attribute ("Name");
+ nsName = !string.IsNullOrEmpty (nsName) ? nsName : "global";
+ var nsNode = root.GetOrCreateNode (nsName, "N:" + nsName);
+
+ XElement nsElements;
+ if (!nsSummaries.TryGetValue (nsName, out nsElements))
+ nsSummaries[nsName] = nsElements = new XElement ("elements",
+ new XElement ("summary"),
+ new XElement ("remarks"));
+
+ foreach (var type in ns.Elements ("Type")) {
+ // Add the XML file corresponding to the type to our storage
+ var id = resID++;
+ var typeFilePath = Path.Combine (asm, nsName, Path.ChangeExtension (type.Attribute ("Name").Value, ".xml"));
+ if (!File.Exists (typeFilePath)) {
+ Console.Error.WriteLine ("Warning: couldn't process type file `{0}' as it doesn't exist", typeFilePath);
+ continue;
+ }
+ using (var file = File.OpenRead (typeFilePath))
+ storage.Store (id.ToString (), file);
+ nsElements.Add (ExtractClassSummary (typeFilePath));
+
+ var typeCaption = ((string)(type.Attribute ("DisplayName") ?? type.Attribute ("Name"))).Replace ('+', '.');
+ var url = "ecma:" + id + '#' + typeCaption + '/';
+ var typeNode = nsNode.CreateNode (typeCaption, url);
+
+ // Add meta "Members" node
+ typeNode.CreateNode ("Members", "*");
+ var typeDocument = XDocument.Load (typeFilePath);
+ var membersNode = typeDocument.Root.Element ("Members");
+ if (membersNode == null || !membersNode.Elements ().Any ())
+ continue;
+ var members = membersNode
+ .Elements ("Member")
+ .ToLookup (m => m.Attribute ("MemberName").Value.StartsWith ("op_") ? "Operator" : m.Element ("MemberType").Value);
+
+ foreach (var memberType in members) {
+ // We pluralize the member type to get the caption and take the first letter as URL
+ var node = typeNode.CreateNode (PluralizeMemberType (memberType.Key), memberType.Key[0].ToString ());
+ var memberIndex = 0;
+
+ var isCtors = memberType.Key[0] == 'C';
+
+ // We do not escape much member name here
+ foreach (var memberGroup in memberType.GroupBy (m => MakeMemberCaption (m, isCtors))) {
+ if (memberGroup.Count () > 1) {
+ // Generate overload
+ var overloadCaption = MakeMemberCaption (memberGroup.First (), false);
+ var overloadNode = node.CreateNode (overloadCaption, overloadCaption);
+ foreach (var member in memberGroup)
+ overloadNode.CreateNode (MakeMemberCaption (member, true), (memberIndex++).ToString ());
+ overloadNode.Sort ();
+ } else {
+ // We treat constructor differently by showing their argument list in all cases
+ node.CreateNode (MakeMemberCaption (memberGroup.First (), isCtors), (memberIndex++).ToString ());
+ }
+ }
+ node.Sort ();
+ }
+ }
+
+ nsNode.Sort ();
+ }
+ root.Sort ();
+ }
+ }
+
+ foreach (var summary in nsSummaries)
+ storage.Store ("xml.summary." + summary.Key, summary.Value.ToString ());
+
+ var masterSummary = new XElement ("elements",
+ directories
+ .SelectMany (d => Directory.EnumerateFiles (d, "ns-*.xml"))
+ .Select (ExtractNamespaceSummary));
+ storage.Store ("mastersummary.xml", masterSummary.ToString ());
+ }
+
+ string PluralizeMemberType (string memberType)
+ {
+ switch (memberType) {
+ case "Property":
+ return "Properties";
+ default:
+ return memberType + "s";
+ }
+ }
+
+ string MakeMemberCaption (XElement member, bool withArguments)
+ {
+ var caption = (string)member.Attribute ("MemberName");
+ // Use type name instead of .ctor for cosmetic sake
+ if (caption == ".ctor") {
+ caption = (string)member.Ancestors ("Type").First ().Attribute ("Name");
+ // If this is an inner type ctor, strip the parent type reference
+ var plusIndex = caption.LastIndexOf ('+');
+ if (plusIndex != -1)
+ caption = caption.Substring (plusIndex + 1);
+ }
+ if (caption.StartsWith ("op_")) {
+ string sig;
+ caption = MakeOperatorSignature (member, out sig);
+ caption = withArguments ? sig : caption;
+ return caption;
+ }
+ if (withArguments) {
+ var args = member.Element ("Parameters");
+ caption += '(';
+ if (args != null && args.Elements ("Parameter").Any ()) {
+ caption += args.Elements ("Parameter")
+ .Select (p => (string)p.Attribute ("Type"))
+ .Aggregate ((p1, p2) => p1 + "," + p2);
+ }
+ caption += ')';
+ }
+
+ return caption;
+ }
+
+ XElement ExtractClassSummary (string typeFilePath)
+ {
+ using (var reader = XmlReader.Create (typeFilePath)) {
+ reader.ReadToFollowing ("Type");
+ var name = reader.GetAttribute ("Name");
+ var fullName = reader.GetAttribute ("FullName");
+ reader.ReadToFollowing ("AssemblyName");
+ var assemblyName = reader.ReadElementString ();
+ reader.ReadToFollowing ("summary");
+ var summary = reader.ReadInnerXml ();
+ reader.ReadToFollowing ("remarks");
+ var remarks = reader.ReadInnerXml ();
+
+ return new XElement ("class",
+ new XAttribute ("name", name ?? string.Empty),
+ new XAttribute ("fullname", fullName ?? string.Empty),
+ new XAttribute ("assembly", assemblyName ?? string.Empty),
+ new XElement ("summary", new XCData (summary)),
+ new XElement ("remarks", new XCData (remarks)));
+ }
+ }
+
+ XElement ExtractNamespaceSummary (string nsFile)
+ {
+ using (var reader = XmlReader.Create (nsFile)) {
+ reader.ReadToFollowing ("Namespace");
+ var name = reader.GetAttribute ("Name");
+ reader.ReadToFollowing ("summary");
+ var summary = reader.ReadInnerXml ();
+ reader.ReadToFollowing ("remarks");
+ var remarks = reader.ReadInnerXml ();
+
+ return new XElement ("namespace",
+ new XAttribute ("ns", name ?? string.Empty),
+ new XElement ("summary", new XCData (summary)),
+ new XElement ("remarks", new XCData (remarks)));
+ }
+ }
+
+ public override void CloseTree (HelpSource hs, Tree tree)
+ {
+ AddImages (hs);
+ AddExtensionMethods (hs);
+ }
+
+ void AddEcmaXml (HelpSource hs)
+ {
+ var xmls = directories
+ .SelectMany (Directory.EnumerateDirectories) // Assemblies
+ .SelectMany (Directory.EnumerateDirectories) // Namespaces
+ .SelectMany (Directory.EnumerateFiles)
+ .Where (f => f.EndsWith (".xml")); // Type XML files
+
+ int resID = 0;
+ foreach (var xml in xmls)
+ using (var file = File.OpenRead (xml))
+ hs.Storage.Store ((resID++).ToString (), file);
+ }
+
+ void AddImages (HelpSource hs)
+ {
+ var imgs = directories
+ .SelectMany (Directory.EnumerateDirectories)
+ .Select (d => Path.Combine (d, "_images"))
+ .Where (Directory.Exists)
+ .SelectMany (Directory.EnumerateFiles);
+
+ foreach (var img in imgs)
+ using (var file = File.OpenRead (img))
+ hs.Storage.Store (Path.GetFileName (img), file);
+ }
+
+ void AddExtensionMethods (HelpSource hs)
+ {
+ var extensionMethods = directories
+ .SelectMany (Directory.EnumerateDirectories)
+ .Select (d => Path.Combine (d, "index.xml"))
+ .Where (File.Exists)
+ .Select (f => {
+ using (var file = File.OpenRead (f)) {
+ var reader = XmlReader.Create (file);
+ reader.ReadToFollowing ("ExtensionMethods");
+ return reader.ReadInnerXml ();
+ }
+ })
+ .DefaultIfEmpty (string.Empty);
+
+ hs.Storage.Store ("ExtensionMethods.xml",
+ "<ExtensionMethods>" + extensionMethods.Aggregate (string.Concat) + "</ExtensionMethods>");
+ }
+
+ IEnumerable<string> GetEcmaXmls ()
+ {
+ return directories
+ .SelectMany (Directory.EnumerateDirectories) // Assemblies
+ .SelectMany (Directory.EnumerateDirectories) // Namespaces
+ .SelectMany (Directory.EnumerateFiles)
+ .Where (f => f.EndsWith (".xml")); // Type XML files
+ }
+
+ string MakeOperatorSignature (XElement member, out string memberSignature)
+ {
+ string name = (string)member.Attribute ("MemberName");
+ var nicename = name.Substring(3);
+ memberSignature = null;
+
+ switch (name) {
+ // unary operators: no overloading possible [ECMA-335 §10.3.1]
+ case "op_UnaryPlus": // static R operator+ (T)
+ case "op_UnaryNegation": // static R operator- (T)
+ case "op_LogicalNot": // static R operator! (T)
+ case "op_OnesComplement": // static R operator~ (T)
+ case "op_Increment": // static R operator++ (T)
+ case "op_Decrement": // static R operator-- (T)
+ case "op_True": // static bool operator true (T)
+ case "op_False": // static bool operator false (T)
+ case "op_AddressOf": // static R operator& (T)
+ case "op_PointerDereference": // static R operator* (T)
+ memberSignature = nicename;
+ break;
+ // conversion operators: overloading based on parameter and return type [ECMA-335 §10.3.3]
+ case "op_Implicit": // static implicit operator R (T)
+ case "op_Explicit": // static explicit operator R (T)
+ nicename = name.EndsWith ("Implicit") ? "ImplicitConversion" : "ExplicitConversion";
+ string arg = (string)member.Element ("Parameters").Element ("Parameter").Attribute ("Type");
+ string ret = (string)member.Element ("ReturnValue").Element ("ReturnType");
+ memberSignature = arg + " to " + ret;
+ break;
+ // binary operators: overloading is possible [ECMA-335 §10.3.2]
+ default:
+ memberSignature =
+ nicename + "("
+ + string.Join (",", member.Element ("Parameters").Elements ("Parameter").Select (p => (string)p.Attribute ("Type")))
+ + ")";
+ break;
+ }
+
+ return nicename;
+ }
+ }
+
+ public class EcmaHelpSource : HelpSource
+ {
+ const string EcmaPrefix = "ecma:";
+ EcmaUrlParser parser = new EcmaUrlParser ();
+ LRUCache<string, Node> cache = new LRUCache<string, Node> (4);
+
+ public EcmaHelpSource (string base_file, bool create) : base (base_file, create)
+ {
+ }
+
+ protected override string UriPrefix {
+ get {
+ return EcmaPrefix;
+ }
+ }
+
+ public override bool CanHandleUrl (string url)
+ {
+ if (url.Length > 2 && url[1] == ':') {
+ switch (url[0]) {
+ case 'T':
+ case 'M':
+ case 'C':
+ case 'P':
+ case 'E':
+ case 'F':
+ case 'N':
+ case 'O':
+ return true;
+ }
+ }
+ return base.CanHandleUrl (url);
+ }
+
+ // Clean the extra paramers in the id
+ public override Stream GetHelpStream (string id)
+ {
+ var idParts = id.Split ('?');
+ return base.GetHelpStream (idParts[0]);
+ }
+
+ public override Stream GetCachedHelpStream (string id)
+ {
+ var idParts = id.Split ('?');
+ return base.GetCachedHelpStream (idParts[0]);
+ }
+
+ public override DocumentType GetDocumentTypeForId (string id, out Dictionary<string, string> extraParams)
+ {
+ extraParams = null;
+ int interMark = id.LastIndexOf ('?');
+ if (interMark != -1)
+ extraParams = id.Substring (interMark)
+ .Split ('&')
+ .Select (nvp => {
+ var eqIdx = nvp.IndexOf ('=');
+ return new { Key = nvp.Substring (0, eqIdx < 0 ? nvp.Length : eqIdx), Value = nvp.Substring (eqIdx + 1) };
+ })
+ .ToDictionary (kvp => kvp.Key, kvp => kvp.Value );
+ return DocumentType.EcmaXml;
+ }
+
+ public override string GetPublicUrl (Node node)
+ {
+ string url = string.Empty;
+ var type = GetNodeType (node);
+ //Console.WriteLine ("GetPublicUrl {0} : {1} [{2}]", node.Element, node.Caption, type.ToString ());
+ switch (type) {
+ case EcmaNodeType.Namespace:
+ return node.Element; // A namespace node has already a well formated internal url
+ case EcmaNodeType.Type:
+ return MakeTypeNodeUrl (node);
+ case EcmaNodeType.Meta:
+ return MakeTypeNodeUrl (GetNodeTypeParent (node)) + GenerateMetaSuffix (node);
+ case EcmaNodeType.Member:
+ var typeChar = GetNodeMemberTypeChar (node);
+ var parentNode = GetNodeTypeParent (node);
+ var typeNode = MakeTypeNodeUrl (parentNode).Substring (2);
+ return typeChar + ":" + typeNode + MakeMemberNodeUrl (typeChar, node);
+ default:
+ return null;
+ }
+ }
+
+ string MakeTypeNodeUrl (Node node)
+ {
+ // A Type node has a Element property of the form: 'ecma:{number}#{typename}/'
+ var hashIndex = node.Element.IndexOf ('#');
+ var typeName = node.Element.Substring (hashIndex + 1, node.Element.Length - hashIndex - 2);
+ return "T:" + node.Parent.Caption + '.' + typeName.Replace ('.', '+');
+ }
+
+ string MakeMemberNodeUrl (char typeChar, Node node)
+ {
+ // We clean inner type ctor name which may contain the outer type name
+ var caption = node.Caption;
+
+ // Sanitize constructor caption of inner types
+ if (typeChar == 'C') {
+ int lastDot = -1;
+ for (int i = 0; i < caption.Length && caption[i] != '('; i++)
+ lastDot = caption[i] == '.' ? i : lastDot;
+ return lastDot == -1 ? '.' + caption : caption.Substring (lastDot);
+ }
+
+ /* We handle type conversion operator by checking if the name contains " to "
+ * (as in 'foo to bar') and we generate a corresponding conversion signature
+ */
+ if (typeChar == 'O' && caption.IndexOf (" to ") != -1) {
+ var parts = caption.Split (' ');
+ return "." + node.Parent.Caption + "(" + parts[0] + ", " + parts[2] + ")";
+ }
+
+ /* The goal here is to treat method which are explicit interface definition
+ * such as 'void IDisposable.Dispose ()' for which the caption is a dot
+ * expression thus colliding with the ecma parser.
+ * If the first non-alpha character in the caption is a dot then we have an
+ * explicit member implementation (we assume the interface has namespace)
+ */
+ var firstNonAlpha = caption.FirstOrDefault (c => !char.IsLetterOrDigit (c));
+ if (firstNonAlpha == '.')
+ return "$" + caption;
+
+ return "." + caption;
+ }
+
+ EcmaNodeType GetNodeType (Node node)
+ {
+ // We guess the node type by checking the depth level it's at in the tree
+ int level = GetNodeLevel (node);
+ switch (level) {
+ case 0:
+ return EcmaNodeType.Namespace;
+ case 1:
+ return EcmaNodeType.Type;
+ case 2:
+ return EcmaNodeType.Meta;
+ case 3: // Here it's either a member or, in case of overload, a meta
+ return node.IsLeaf ? EcmaNodeType.Member : EcmaNodeType.Meta;
+ case 4: // At this level, everything is necessarily a member
+ return EcmaNodeType.Member;
+ default:
+ return EcmaNodeType.Invalid;
+ }
+ }
+
+ int GetNodeLevel (Node node)
+ {
+ int i = 0;
+ for (; !node.Element.StartsWith ("root:/", StringComparison.OrdinalIgnoreCase); i++) {
+ //Console.WriteLine ("\tLevel {0} : {1} {2}", i, node.Element, node.Caption);
+ node = node.Parent;
+ }
+ return i - 1;
+ }
+
+ char GetNodeMemberTypeChar (Node node)
+ {
+ int level = GetNodeLevel (node);
+ // We try to reach the member group node depending on node nested level
+ switch (level) {
+ case 2:
+ return node.Element[0];
+ case 3:
+ return node.Parent.Element[0];
+ case 4:
+ return node.Parent.Parent.Element[0];
+ default:
+ throw new ArgumentException ("node", "Couldn't determine member type of node `" + node.Caption + "'");
+ }
+ }
+
+ Node GetNodeTypeParent (Node node)
+ {
+ // Type nodes are always at level 2 so we just need to get there
+ while (node != null && node.Parent != null && !node.Parent.Parent.Element.StartsWith ("root:/", StringComparison.OrdinalIgnoreCase))
+ node = node.Parent;
+ return node;
+ }
+
+ string GenerateMetaSuffix (Node node)
+ {
+ string suffix = string.Empty;
+ // A meta node has always a type element to begin with
+ while (GetNodeType (node) != EcmaNodeType.Type) {
+ suffix = '/' + node.Element + suffix;
+ node = node.Parent;
+ }
+ return suffix;
+ }
+
+ public override string GetInternalIdForUrl (string url, out Node node)
+ {
+ var id = string.Empty;
+ node = null;
+
+ if (!url.StartsWith (EcmaPrefix, StringComparison.OrdinalIgnoreCase)) {
+ node = MatchNode (url);
+ if (node == null)
+ return null;
+ id = node.GetInternalUrl ();
+ }
+
+ if (id.StartsWith (UriPrefix, StringComparison.OrdinalIgnoreCase))
+ id = id.Substring (UriPrefix.Length);
+ else if (id.StartsWith ("N:", StringComparison.OrdinalIgnoreCase))
+ id = "xml.summary." + id.Substring ("N:".Length);
+
+ var hashIndex = id.IndexOf ('#');
+ var hash = string.Empty;
+ if (hashIndex != -1) {
+ hash = id.Substring (hashIndex + 1);
+ id = id.Substring (0, hashIndex);
+ }
+
+ return id + GetArgs (hash, node);
+ }
+
+ public override Node MatchNode (string url)
+ {
+ Node node = null;
+ if ((node = cache.Get (url)) == null) {
+ node = InternalMatchNode (url);
+ if (node != null)
+ cache.Put (url, node);
+ }
+ return node;
+ }
+
+ public Node InternalMatchNode (string url)
+ {
+ Node result = null;
+ EcmaDesc desc;
+ if (!parser.TryParse (url, out desc))
+ return null;
+
+ // Namespace search
+ Node currentNode = Tree.RootNode;
+ Node searchNode = new Node () { Caption = desc.Namespace };
+ int index = currentNode.Nodes.BinarySearch (searchNode, EcmaGenericNodeComparer.Instance);
+ if (index >= 0)
+ result = currentNode.Nodes[index];
+ if (desc.DescKind == EcmaDesc.Kind.Namespace || index < 0)
+ return result;
+
+ // Type search
+ currentNode = result;
+ result = null;
+ searchNode.Caption = desc.ToCompleteTypeName ();
+ index = currentNode.Nodes.BinarySearch (searchNode, EcmaTypeNodeComparer.Instance);
+ if (index >= 0)
+ result = currentNode.Nodes[index];
+ if ((desc.DescKind == EcmaDesc.Kind.Type && !desc.IsEtc) || index < 0)
+ return result;
+
+ // Member selection
+ currentNode = result;
+ result = null;
+ var caption = desc.IsEtc ? EtcKindToCaption (desc.Etc) : MemberKindToCaption (desc.DescKind);
+ currentNode = FindNodeForCaption (currentNode.Nodes, caption);
+ if (currentNode == null
+ || (desc.IsEtc && desc.DescKind == EcmaDesc.Kind.Type && string.IsNullOrEmpty (desc.EtcFilter)))
+ return currentNode;
+
+ // Member search
+ result = null;
+ var format = desc.DescKind == EcmaDesc.Kind.Constructor ? EcmaDesc.Format.WithArgs : EcmaDesc.Format.WithoutArgs;
+ searchNode.Caption = desc.ToCompleteMemberName (format);
+ index = currentNode.Nodes.BinarySearch (searchNode, EcmaGenericNodeComparer.Instance);
+ if (index < 0)
+ return null;
+ result = currentNode.Nodes[index];
+ if (result.Nodes.Count == 0 || desc.IsEtc)
+ return result;
+
+ // Overloads search
+ currentNode = result;
+ searchNode.Caption = desc.ToCompleteMemberName (EcmaDesc.Format.WithArgs);
+ index = currentNode.Nodes.BinarySearch (searchNode, EcmaGenericNodeComparer.Instance);
+ if (index < 0)
+ return result;
+ result = result.Nodes[index];
+
+ return result;
+ }
+
+ // This comparer returns the answer straight from caption comparison
+ class EcmaGenericNodeComparer : IComparer<Node>
+ {
+ public static readonly EcmaGenericNodeComparer Instance = new EcmaGenericNodeComparer ();
+
+ public int Compare (Node n1, Node n2)
+ {
+ return string.Compare (n1.Caption, n2.Caption, StringComparison.Ordinal);
+ }
+ }
+
+ // This comparer take into account the space in the caption
+ class EcmaTypeNodeComparer : IComparer<Node>
+ {
+ public static readonly EcmaTypeNodeComparer Instance = new EcmaTypeNodeComparer ();
+
+ public int Compare (Node n1, Node n2)
+ {
+ int length1 = CaptionLength (n1.Caption);
+ int length2 = CaptionLength (n2.Caption);
+
+ return string.Compare (n1.Caption, 0, n2.Caption, 0, Math.Max (length1, length2), StringComparison.Ordinal);
+ }
+
+ int CaptionLength (string caption)
+ {
+ var length = caption.LastIndexOf (' ');
+ return length == -1 ? caption.Length : length;
+ }
+ }
+
+ string EtcKindToCaption (char etc)
+ {
+ switch (etc) {
+ case 'M':
+ return "Methods";
+ case 'P':
+ return "Properties";
+ case 'C':
+ return "Constructors";
+ case 'F':
+ return "Fields";
+ case 'E':
+ return "Events";
+ case 'O':
+ return "Operators";
+ case '*':
+ return "Members";
+ default:
+ return null;
+ }
+ }
+
+ string MemberKindToCaption (EcmaDesc.Kind kind)
+ {
+ switch (kind) {
+ case EcmaDesc.Kind.Method:
+ return "Methods";
+ case EcmaDesc.Kind.Property:
+ return "Properties";
+ case EcmaDesc.Kind.Constructor:
+ return "Constructors";
+ case EcmaDesc.Kind.Field:
+ return "Fields";
+ case EcmaDesc.Kind.Event:
+ return "Events";
+ case EcmaDesc.Kind.Operator:
+ return "Operators";
+ default:
+ return null;
+ }
+ }
+
+ Node FindNodeForCaption (List<Node> nodes, string caption)
+ {
+ foreach (var node in nodes)
+ if (node.Caption.Equals (caption, StringComparison.OrdinalIgnoreCase))
+ return node;
+ return null;
+ }
+
+ string GetArgs (string hash, Node node)
+ {
+ var args = new Dictionary<string, string> ();
+
+ args["source-id"] = SourceID.ToString ();
+
+ if (node != null) {
+ var nodeType = GetNodeType (node);
+ switch (nodeType) {
+ case EcmaNodeType.Namespace:
+ args["show"] = "namespace";
+ args["namespace"] = node.Element.Substring ("N:".Length);
+ break;
+ case EcmaNodeType.Type:
+ args["show"] = "typeoverview";
+ break;
+ case EcmaNodeType.Member:
+ case EcmaNodeType.Meta:
+ switch (GetNodeMemberTypeChar (node)){
+ case 'C':
+ args["membertype"] = "Constructor";
+ break;
+ case 'M':
+ args["membertype"] = "Method";
+ break;
+ case 'P':
+ args["membertype"] = "Property";
+ break;
+ case 'F':
+ args["membertype"] = "Field";
+ break;
+ case 'E':
+ args["membertype"] = "Event";
+ break;
+ case 'O':
+ args["membertype"] = "Operator";
+ break;
+ case 'X':
+ args["membertype"] = "ExtensionMethod";
+ break;
+ case '*':
+ args["membertype"] = "All";
+ break;
+ }
+
+ if (nodeType == EcmaNodeType.Meta) {
+ args["show"] = "members";
+ args["index"] = "all";
+ } else {
+ args["show"] = "member";
+ args["index"] = node.Element;
+ }
+ break;
+ }
+ }
+
+ if (!string.IsNullOrEmpty (hash))
+ args["hash"] = hash;
+
+ return "?" + string.Join ("&", args.Select (kvp => kvp.Key == kvp.Value ? kvp.Key : kvp.Key + '=' + kvp.Value));
+ }
+ }
+}
--- /dev/null
+//
+// The ecmaspec provider is for ECMA specifications
+//
+// Authors:
+// John Luke (jluke@cfl.rr.com)
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// Use like this:
+// mono assembler.exe --ecmaspec DIRECTORY --out name
+//
+
+using System;
+using System.Diagnostics;
+using System.IO;
+using System.Text;
+using System.Xml.XPath;
+using System.Xml.Xsl;
+using System.Xml;
+using System.Collections.Generic;
+using Lucene.Net.Index;
+using Lucene.Net.Documents;
+
+namespace MonkeyDoc.Providers
+{
+ public class EcmaSpecProvider : Provider
+ {
+ string basedir;
+
+ public EcmaSpecProvider (string base_directory)
+ {
+ basedir = base_directory;
+ if (!Directory.Exists (basedir))
+ throw new DirectoryNotFoundException (String.Format ("The directory `{0}' does not exist", basedir));
+ }
+
+ public override void PopulateTree (Tree tree)
+ {
+ XPathNavigator n = new XPathDocument (Path.Combine (basedir, "toc.xml")).CreateNavigator ();
+ n.MoveToRoot ();
+ n.MoveToFirstChild ();
+ PopulateNode (n.SelectChildren ("node", ""), tree.RootNode);
+ }
+
+ void PopulateNode (XPathNodeIterator nodes, Node treeNode)
+ {
+ foreach (XPathNavigator n in nodes) {
+ string secNumber = n.GetAttribute ("number", "");
+ string secName = n.GetAttribute ("name", "");
+
+ var storage = treeNode.Tree.HelpSource.Storage;
+ using (var file = File.OpenRead (Path.Combine (basedir, secNumber + ".xml")))
+ storage.Store (secNumber, file);
+
+ Node thisNode = treeNode.GetOrCreateNode (secNumber + ": " + secName, "ecmaspec:" + secNumber);
+
+ if (n.HasChildren)
+ PopulateNode (n.SelectChildren ("node", ""), thisNode);
+ }
+ }
+
+ public override void CloseTree (HelpSource hs, Tree tree)
+ {
+ }
+ }
+
+ public class EcmaSpecHelpSource : HelpSource
+ {
+ const string EcmaspecPrefix = "ecmaspec:";
+ const string TocPart = "%toc"; // What is returned as TocXml
+ const string SpecPart = "%spec"; // What is returned as Ecmaspec
+
+ public EcmaSpecHelpSource (string base_file, bool create) : base (base_file, create)
+ {
+ }
+
+ public override DocumentType GetDocumentTypeForId (string id, out Dictionary<string, string> extraParams)
+ {
+ extraParams = null;
+ return id.EndsWith (TocPart) ? DocumentType.TocXml : DocumentType.EcmaSpecXml;
+ }
+
+ public override bool IsGeneratedContent (string id)
+ {
+ return id == "root:" || id.EndsWith (TocPart);
+ }
+
+ public override bool IsMultiPart (string id, out IEnumerable<string> parts)
+ {
+ if (id == "root:" || id.EndsWith (TocPart) || id.EndsWith (SpecPart)) {
+ parts = null;
+ return false;
+ }
+ parts = MakeMultiPart (id);
+ return true;
+ }
+
+ IEnumerable<string> MakeMultiPart (string baseId)
+ {
+ yield return baseId + SpecPart;
+ yield return baseId + TocPart;
+ }
+
+ public override string GetText (string id)
+ {
+ Node n = id == "root:" ? Tree.RootNode : MatchNode (EcmaspecPrefix + id.Substring (0, id.Length - TocPart.Length));
+ if (n == null)
+ throw new ArgumentException ("id", string.Format ("{0} -> {1}", id, EcmaspecPrefix + id.Substring (0, id.Length - TocPart.Length)));
+ return TreeDumper.ExportToTocXml (n, "C# Language Specification", "In this section:");
+ }
+
+ public override Stream GetHelpStream (string id)
+ {
+ return id.EndsWith (SpecPart) ? base.GetHelpStream (id.Substring (0, id.IndexOf (SpecPart))) : base.GetHelpStream (id);
+ }
+
+ public override void PopulateSearchableIndex (IndexWriter writer)
+ {
+ foreach (Node n in Tree.RootNode.Nodes)
+ AddDocuments (writer, n);
+ }
+
+ protected override string UriPrefix {
+ get {
+ return EcmaspecPrefix;
+ }
+ }
+
+ void AddDocuments (IndexWriter writer, Node node)
+ {
+ string url = node.PublicUrl;
+ Stream file_stream = GetHelpStream (url.Substring (9));
+ if (file_stream == null) //Error
+ return;
+ XmlDocument xdoc = new XmlDocument ();
+ xdoc.Load (new XmlTextReader (file_stream));
+
+ //Obtain the title
+ XmlNode nelem = xdoc.DocumentElement;
+ string title = nelem.Attributes["number"].Value + ": " + nelem.Attributes["title"].Value;
+
+ //Obtain the text
+ StringBuilder s = new StringBuilder ();
+ GetTextNode (nelem, s);
+ string text = s.ToString ();
+
+ //Obtain the examples
+ StringBuilder s2 = new StringBuilder ();
+ GetExamples (nelem, s2);
+ string examples = s2.ToString ();
+
+ //Write to the Lucene Index all the parts
+ SearchableDocument doc = new SearchableDocument ();
+ doc.title = title;
+ doc.hottext = title.Substring (title.IndexOf (':'));
+ doc.url = url;
+ doc.text = text;
+ doc.examples = examples;
+ writer.AddDocument (doc.LuceneDoc);
+
+ if (node.IsLeaf)
+ return;
+
+ foreach (Node n in node.Nodes)
+ AddDocuments (writer, n);
+ }
+
+ void GetTextNode (XmlNode n, StringBuilder s)
+ {
+ //dont include c# code
+ if (n.Name == "code_example")
+ return;
+ //include all text from nodes
+ if (n.NodeType == XmlNodeType.Text)
+ s.Append (n.Value);
+
+ //recursively explore all nodes
+ if (n.HasChildNodes)
+ foreach (XmlNode n_child in n.ChildNodes)
+ GetTextNode (n_child, s);
+ }
+
+ void GetExamples (XmlNode n, StringBuilder s)
+ {
+ if (n.Name == "code_example") {
+ if (n.FirstChild.Name == "#cdata-section")
+ s.Append (n.FirstChild.Value);
+ } else {
+ if (n.HasChildNodes)
+ foreach (XmlNode n_child in n.ChildNodes)
+ GetExamples (n_child, s);
+ }
+ }
+ }
+}
--- /dev/null
+//
+// error-provider.cs
+//
+// Author:
+// Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+// Copyright 2003-2011 Novell
+// Copyright 2011 Xamarin Inc
+//
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+using System.Xml;
+using System.Xml.Serialization;
+using System.Linq;
+using Lucene.Net.Index;
+using Lucene.Net.Documents;
+
+namespace MonkeyDoc.Providers
+{
+ public class ErrorProviderConfig
+ {
+ public string FilesPath;
+ public string Match;
+ public int ErrorNumSubstringStart;
+ public int ErrorNumSubstringLength;
+ public string FriendlyFormatString;
+
+ public override string ToString ()
+ {
+ var sb = new StringBuilder ();
+ var w = new StringWriter (sb);
+
+ w.WriteLine ("FilesPath: {0}", FilesPath);
+ w.WriteLine ("Match: {0}", Match);
+ w.WriteLine ("Error Number Substring: {0} Length:{1}", ErrorNumSubstringStart, ErrorNumSubstringLength);
+ w.WriteLine ("FriendlyFormatString: {0}", FriendlyFormatString);
+
+ return w.ToString ();
+ }
+
+ public Dictionary<string, ErrorDocumentation> Compile (HelpSource hs)
+ {
+ string[] files = Directory.GetFiles (FilesPath, Match);
+ var ret = new Dictionary<string, ErrorDocumentation> ();
+
+ foreach (string s in files) {
+ ErrorDocumentation d;
+ int errorNum = 0;
+
+ try {
+ errorNum = int.Parse (Path.GetFileName (s).Substring (ErrorNumSubstringStart, ErrorNumSubstringLength));
+ } catch {
+ Console.WriteLine ("Ignoring file {0}", s);
+ }
+
+ string errorName = String.Format (FriendlyFormatString, errorNum);
+
+ if (!ret.TryGetValue (errorName, out d))
+ ret[errorName] = d = new ErrorDocumentation (errorName);
+
+ if (d.Details == null) {
+ string xmlFile = Path.ChangeExtension (s, "xml");
+ if (File.Exists (xmlFile)) {
+ XmlSerializer cfgRdr = new XmlSerializer (typeof (ErrorDetails));
+ d.Details = (ErrorDetails)cfgRdr.Deserialize (new XmlTextReader (xmlFile));
+ }
+ }
+ // Encoding is same as used in MCS, so we will be able to do all those files
+ using (StreamReader reader = new StreamReader (s, Encoding.GetEncoding (28591))) {
+ d.Examples.Add (reader.ReadToEnd ());
+ }
+ }
+
+ return ret;
+ }
+ }
+
+ public class ErrorDocumentation
+ {
+ public string ErrorName;
+ public ErrorDetails Details;
+ public List<string> Examples = new List<string> ();
+
+ public ErrorDocumentation () {}
+ public ErrorDocumentation (string ErrorName)
+ {
+ this.ErrorName = ErrorName;
+ }
+ }
+
+ public class ErrorDetails
+ {
+ public XmlNode Summary;
+ public XmlNode Details;
+ }
+
+ public class ErrorProvider : Provider
+ {
+ ErrorProviderConfig config;
+
+ public ErrorProvider (string configFile)
+ {
+ config = ReadConfig (configFile);
+ }
+
+ public static ErrorProviderConfig ReadConfig (string file)
+ {
+ XmlSerializer cfgRdr = new XmlSerializer (typeof (ErrorProviderConfig));
+ ErrorProviderConfig ret = (ErrorProviderConfig)cfgRdr.Deserialize (new XmlTextReader (file));
+ // handle path rel to the config file
+ ret.FilesPath = Path.Combine (Path.GetDirectoryName (file), ret.FilesPath);
+ return ret;
+ }
+
+ public override void PopulateTree (Tree tree)
+ {
+ // everything is done in CloseTree so we can pack
+ }
+
+ public override void CloseTree (HelpSource hs, Tree tree)
+ {
+ var entries = config.Compile (hs);
+ MemoryStream ms = new MemoryStream ();
+ XmlSerializer writer = new XmlSerializer (typeof (ErrorDocumentation));
+
+ foreach (var de in entries) {
+ ErrorDocumentation d = de.Value;
+ string s = de.Key;
+
+ tree.RootNode.GetOrCreateNode (s, "error:" + s);
+
+ writer.Serialize (ms, d);
+ ms.Position = 0;
+ hs.Storage.Store (s, ms);
+ ms.SetLength (0);
+ }
+
+ tree.RootNode.Sort ();
+ }
+ }
+
+ public class ErrorHelpSource : HelpSource
+ {
+ public ErrorHelpSource (string base_file, bool create) : base (base_file, create)
+ {
+ }
+
+ public override string GetText (string id)
+ {
+ return TreeDumper.ExportToTocXml (Tree.RootNode, "Compiler Error Reference", "In this section:");
+ }
+
+ protected override string UriPrefix {
+ get {
+ return "error:";
+ }
+ }
+
+ public override bool IsGeneratedContent (string id)
+ {
+ return id == "root:";
+ }
+
+ public override DocumentType GetDocumentTypeForId (string id, out Dictionary<string, string> extraParams)
+ {
+ extraParams = null;
+ return id == "root:" ? DocumentType.TocXml : DocumentType.ErrorXml;
+ }
+
+ public override string GetInternalIdForUrl (string url, out Node node)
+ {
+ var result = base.GetInternalIdForUrl (url, out node);
+ return result.ToLower ();
+ }
+
+ public override void PopulateIndex (IndexMaker index_maker)
+ {
+ foreach (Node n in Tree.RootNode.Nodes)
+ index_maker.Add (n.Caption, n.Caption, n.Element);
+ }
+
+ public override void PopulateSearchableIndex (IndexWriter writer)
+ {
+ foreach (Node n in Tree.RootNode.Nodes) {
+ XmlSerializer reader = new XmlSerializer (typeof (ErrorDocumentation));
+ ErrorDocumentation d = (ErrorDocumentation)reader.Deserialize (GetHelpStream (n.Element.Substring (6)));
+ SearchableDocument doc = new SearchableDocument ();
+ doc.title = d.ErrorName;
+ doc.url = n.Element;
+ doc.text = d.Details != null ? d.Details.ToString () : string.Empty;
+ doc.examples = d.Examples.Cast<string> ().Aggregate ((e1, e2) => e1 + Environment.NewLine + e2);
+ doc.hottext = d.ErrorName;
+ writer.AddDocument (doc.LuceneDoc);
+ }
+ }
+ }
+}
--- /dev/null
+//
+// A provider to display man pages
+//
+// Authors:
+// Johannes Roith <johannes@roith.de>
+// Jonathan Pryor <jpryor@novell.com>
+//
+// (C) 2008 Novell, Inc.
+
+using System;
+using System.IO;
+using System.Text;
+using System.Xml;
+using System.Linq;
+using System.Collections.Generic;
+
+namespace MonkeyDoc.Providers
+{
+ public class ManProvider : Provider
+ {
+ string[] tocFiles;
+
+ public ManProvider (string[] handbookTocFiles)
+ {
+ tocFiles = handbookTocFiles;
+
+ // huh...
+ if (!File.Exists (tocFiles[0]))
+ throw new FileNotFoundException (String.Format ("The table of contents, `{0}' does not exist", tocFiles[0]));
+ }
+
+ public override void PopulateTree (Tree tree)
+ {
+ foreach(string TocFile in tocFiles) {
+ XmlDocument doc = new XmlDocument();
+ doc.Load (TocFile);
+
+ XmlNodeList nodeList = doc.GetElementsByTagName("manpage");
+ Node nodeToAddChildrenTo = tree.RootNode;
+ var storage = nodeToAddChildrenTo.Tree.HelpSource.Storage;
+
+ foreach (XmlNode node in nodeList) {
+
+ XmlAttribute name = node.Attributes["name"];
+ XmlAttribute page = node.Attributes["page"];
+
+ if (name == null || page == null) continue;
+
+ if (!File.Exists (page.Value))
+ continue;
+
+ string target = "man:" + name.Value;
+ nodeToAddChildrenTo.CreateNode (name.Value, target);
+
+ if (File.Exists (page.Value))
+ storage.Store (name.Value, File.OpenRead (page.Value));
+ }
+ }
+ }
+
+ public override void CloseTree (HelpSource hs, Tree tree)
+ {
+ }
+ }
+
+ public class ManHelpSource : HelpSource
+ {
+ const string ManPrefix = "man:";
+ Dictionary<string, Node> nodesMap;
+
+ public ManHelpSource (string base_file, bool create) : base (base_file, create)
+ {
+ nodesMap = Tree.RootNode.Nodes.ToDictionary (n => n.Element);
+ }
+
+ // Since man always has a flat tree and rather small amount of item
+ // we store them in a dictionary
+ public override Node MatchNode (string url)
+ {
+ Node result;
+ return nodesMap.TryGetValue (url, out result) ? result : null;
+ }
+
+ public override DocumentType GetDocumentTypeForId (string id, out Dictionary<string, string> extraParams)
+ {
+ extraParams = null;
+ return id == "root:" ? DocumentType.TocXml : DocumentType.Man;
+ }
+
+ public override bool IsGeneratedContent (string id)
+ {
+ return id == "root:";
+ }
+
+ public override string GetText (string url)
+ {
+ return TreeDumper.ExportToTocXml (Tree.RootNode, "Mono Documentation Library", "Available man pages:");
+ }
+
+ protected override string UriPrefix {
+ get {
+ return ManPrefix;
+ }
+ }
+ }
+}
--- /dev/null
+//
+// The simple provider is an example provider
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// Use like this:
+// mono assembler.exe --simple DIRECTORY --out name
+//
+// Then create a .source file in your sources directory, and copy
+// name.tree and name.zip to the sources directory.
+//
+// To view the tree generated, use:
+// mono dump.exe name.tree
+//
+namespace Monodoc {
+using System;
+using System.IO;
+using System.Text;
+
+//
+// The simple provider generates the information source
+//
+public class SimpleProvider : Provider {
+ string basedir;
+
+ public SimpleProvider (string base_directory)
+ {
+ basedir = base_directory;
+ if (!Directory.Exists (basedir))
+ throw new FileNotFoundException (String.Format ("The directory `{0}' does not exist", basedir));
+ }
+
+ public override void PopulateTree (Tree tree)
+ {
+ Node top = tree.LookupNode ("Directory at: " + basedir, "simple:");
+
+ foreach (string dir in Directory.GetDirectories (basedir)){
+ string url = Path.GetFileName (dir);
+ Node n = top.LookupNode ("Dir: " + url, url);
+ PopulateDir (n, dir);
+ }
+ }
+
+#pragma warning disable 219
+ void PopulateDir (Node me, string dir)
+ {
+ Console.WriteLine ("Adding: " + dir);
+ foreach (string child_dir in Directory.GetDirectories (dir)){
+ string url = Path.GetFileName (child_dir);
+ Node n = me.LookupNode ("Dir: " + url, "simple-directory:" + url);
+ PopulateDir (me, child_dir);
+ }
+
+ foreach (string file in Directory.GetFiles (dir)){
+ Console.WriteLine (" File: " + file);
+ string file_code = me.tree.HelpSource.PackFile (file);
+
+ //
+ // The url element encoded for the file is:
+ // originalfilename#CODE
+ //
+ // The code is assigned to us after the file has been packaged
+ // We use the original-filename later to render html or text files
+ //
+ Node n = me.LookupNode (Path.GetFileName (file), file + "#" + file_code);
+
+ }
+ }
+
+ public override void CloseTree (HelpSource hs, Tree tree)
+ {
+ }
+}
+
+//
+// The HelpSource is used during the rendering phase.
+//
+
+public class SimpleHelpSource : HelpSource {
+ Encoding enc;
+
+ public SimpleHelpSource (string base_file, bool create) : base (base_file, create)
+ {
+ enc = new UTF8Encoding (false, false);
+ }
+
+ public override string GetText (string url, out Node match_node)
+ {
+ match_node = null;
+
+ string c = GetCachedText (url);
+ if (c != null)
+ return c;
+
+ if (url.StartsWith ("simple:") || url.StartsWith ("simple-directory:"))
+ return GetTextFromUrl (url);
+
+ return null;
+ }
+
+ string GetTextFromUrl (string url)
+ {
+ // Remove "simple:" prefix
+ url = url.Substring (7);
+
+ if (url.StartsWith ("simple-directory:"))
+ return String.Format ("<html>This is a directory entry point: {0} </html>",
+ url.Substring (17));
+
+ // Otherwise the last element of the url is the file code we got.
+ int pound = url.LastIndexOf ("#");
+ string code;
+ if (pound == -1)
+ code = url;
+ else
+ code = url.Substring (pound+1);
+
+
+ Stream s = GetHelpStream (code);
+ if (s == null)
+ return String.Format ("<html>No stream for this node: {0} </html>", url);
+
+ //
+ // Now, get the file type
+ //
+ int slash = url.LastIndexOf ("/");
+ string fname = url.Substring (slash + 1, pound - slash - 1).ToLower ();
+
+ if (fname.EndsWith (".html") || fname.EndsWith (".htm")){
+ TextReader r = new StreamReader (s, enc);
+ return r.ReadToEnd ();
+ }
+
+ if (fname.EndsWith (".png") || fname.EndsWith (".jpg") ||
+ fname.EndsWith (".jpeg") || fname.EndsWith (".gif")){
+ return "<html>Image file, have not implemented rendering this yet</html>";
+ }
+
+ // Convert text to HTML
+ StringBuilder result = new StringBuilder ("<html>");
+ TextReader reader = new StreamReader (s, enc);
+ string line;
+
+ while ((line = reader.ReadLine ()) != null){
+ result.Append (line);
+ result.Append ("<br>");
+ }
+ result.Append ("<html>");
+ return result.ToString ();
+ }
+}
+}
--- /dev/null
+//
+// A provider that uses Windows help file xhtml TOC files and looks for the
+// referenced documents to create the help source.
+//
+// Authors:
+// Copyright 2003 Lee Mallabone <gnome@fonicmonkey.net>
+// Johannes Roith <johannes@roith.de>
+// Miguel de Icaza <miguel@ximian.com>
+
+using System;
+using System.IO;
+using System.Collections.Generic;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Xml;
+
+namespace MonkeyDoc.Providers
+{
+ public class XhtmlProvider : Provider
+ {
+ string tocFile;
+
+ public XhtmlProvider (string handbookTocFile)
+ {
+ tocFile = handbookTocFile;
+ if (!File.Exists (tocFile))
+ throw new FileNotFoundException (String.Format ("The table of contents, `{0}' does not exist", tocFile));
+ }
+
+ public override void PopulateTree (Tree tree)
+ {
+ //new SimpleHandbookTOCParser(tree, tocFile);
+ // TODO: port it
+ }
+
+ public override void CloseTree (HelpSource hs, Tree tree)
+ {
+ }
+ }
+
+ public class XhtmlHelpSource : HelpSource
+ {
+ public XhtmlHelpSource (string base_file, bool create) : base (base_file, create)
+ {
+
+ }
+
+ const string XhtmlPrefix = "xhtml:";
+
+ protected override string UriPrefix {
+ get {
+ return XhtmlPrefix;
+ }
+ }
+
+ public override DocumentType GetDocumentTypeForId (string id, out Dictionary<string, string> extraArgs)
+ {
+ extraArgs = null;
+ return id == "root:" ? DocumentType.TocXml : DocumentType.MonoBook;
+ }
+
+ public override bool IsGeneratedContent (string id)
+ {
+ return id == "root:";
+ }
+
+ public override string GetText (string url)
+ {
+ return TreeDumper.ExportToTocXml (Tree.RootNode, "Mono Handbook", string.Empty);
+ }
+
+ public static string GetAbsoluteLink(string target, string url)
+ {
+
+ string value = null;
+
+ if (target.StartsWith ("#") ||
+ target.StartsWith ("T:") ||
+ target.StartsWith ("M:") ||
+ target.StartsWith ("P:") ||
+ target.StartsWith ("T:") ||
+ target.StartsWith ("E:") ||
+ target.StartsWith ("F:") ||
+ target.StartsWith ("O:") ||
+ target.StartsWith ("N:") ||
+ target.StartsWith ("api:"))
+ return null;
+
+ int endp = target.IndexOf(':');
+
+ if (endp == -1)
+ endp = 0;
+ string protocol = target.Substring(0, endp);
+ switch (protocol) {
+ case "mailto":
+ case "http":
+ case "https":
+ case "ftp":
+ case "news":
+ case "irc":
+ break;
+ default:
+ // handle absolute urls like: /html/en/images/empty.png
+ if (!target.StartsWith("/")) {
+
+ // url is something like "gnome/bindings/mono.html"
+ // This will get the path "gnome/bindings"
+
+ int slash = url.LastIndexOf ("/");
+ string tmpurl = url;
+
+ if (slash != -1)
+ tmpurl = url.Substring(0, slash);
+
+ // Count "../" in target and go one level down
+ // for each in tmpurl, eventually, then remove "../".
+
+ Regex reg1 = new Regex("../");
+ MatchCollection matches = reg1.Matches(target);
+
+ for(int i = 1; i < matches.Count; i++) {
+ slash = tmpurl.LastIndexOf ("/");
+ if (slash != -1)
+ tmpurl = tmpurl.Substring(0, slash);
+ }
+
+ target = target.Replace("../", "");
+
+ value = tmpurl + "/" + target;
+
+ } else {
+ value = target.Substring(1, target.Length - 1);
+ }
+ break;
+ }
+ return value;
+ }
+
+ XmlDocument RewriteLinks(XmlDocument docToProcess, string url)
+ {
+ XmlNodeList nodeList = docToProcess.GetElementsByTagName("a");
+
+ foreach(XmlNode node in nodeList) {
+
+ XmlElement element = (XmlElement) node;
+
+ if (element.HasAttribute("href") ){
+
+ XmlAttribute href = element.GetAttributeNode("href");
+ string target = href.Value;
+
+ target = GetAbsoluteLink(target, url);
+ if (target != null) {
+ string newtarget = String.Format ("source-id:{0}:xhtml:{1}", SourceID, target);
+ href.Value = newtarget;
+ }
+ }
+ }
+
+ nodeList = docToProcess.GetElementsByTagName("img");
+
+ foreach(XmlNode node in nodeList) {
+
+ XmlElement element = (XmlElement) node;
+
+ if (element.HasAttribute("src") ){
+
+ XmlAttribute href = element.GetAttributeNode("src");
+ string target = href.Value;
+
+ target = GetAbsoluteLink(target, url);
+ if (target != null) {
+ string newtarget = String.Format ("source-id:{0}:xhtml:{1}", SourceID, target);
+ href.Value = newtarget;
+ }
+ }
+ }
+
+ return docToProcess;
+ }
+
+ public override void PopulateIndex (IndexMaker index_maker)
+ {
+ PopulateIndexFromNodes (Tree.RootNode);
+ }
+
+ void PopulateIndexFromNodes (Node start)
+ {
+ var nodes = start.Nodes;
+
+ if (nodes == null)
+ Console.WriteLine ("Leaf: " + start.Caption);
+ else {
+ Console.WriteLine ("Root: " + start.Caption);
+ foreach (Node n in nodes)
+ PopulateIndexFromNodes (n);
+ }
+ }
+ }
+}
--- /dev/null
+using System;
+using System.IO;
+using System.Collections.Generic;
+
+namespace MonkeyDoc
+{
+ // Define a storage mechanism for a help source
+ public interface IDocStorage : IDisposable
+ {
+ // Tell if the storage can store successive change to the doc as revision
+ bool SupportRevision { get; }
+ IDocRevisionManager RevisionManager { get; }
+
+ // Tell if the storage support modifying an existing data
+ bool SupportChange { get; }
+
+ /* Store data inside the storage backend
+ * if SupportChange is false and user try to store something with an existing id
+ * an exception will be thrown
+ * if id is null or empty, the storage will try to create an automatic id. In all
+ * case the id that has been used to store the content is returned by the method
+ */
+ string Store (string id, string text);
+ string Store (string id, byte[] data);
+ string Store (string id, Stream stream);
+
+ Stream Retrieve (string id);
+
+ IEnumerable<string> GetAvailableIds ();
+ }
+
+ public interface IDocRevisionManager
+ {
+ Stream RetrieveWithRevision (string id, string revision);
+
+ // This should be ordered by most recent first
+ IEnumerable<string> AvailableRevisionsForId (string id);
+ // This can simply be implemented with above property but it can also be
+ // a revision storage symbolic value like "HEAD"
+ string LatestRevisionForId (string id);
+
+ // A commit message for instance
+ string GetRevisionDescription (string revision);
+ }
+
+ public static class DocRevisionManagerExtensions
+ {
+ public static Stream RetrieveLatestRevision (this IDocRevisionManager revManager, string id)
+ {
+ return revManager.RetrieveWithRevision (id, revManager.LatestRevisionForId (id));
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.IO;
+using System.Xml;
+using System.Linq;
+using System.Text;
+using System.Collections.Generic;
+
+using ICSharpCode.SharpZipLib.Zip;
+
+namespace MonkeyDoc.Storage
+{
+ public class ZipStorage : IDocStorage
+ {
+ string zipFileName;
+ int code;
+ ZipOutputStream zipOutput;
+ ZipFile zipFile;
+ // SharpZipLib use linear search to map name to index, correct that a bit
+ Dictionary<string, int> entries = new Dictionary<string, int> ();
+
+ public ZipStorage (string zipFileName)
+ {
+ this.zipFileName = zipFileName;
+ }
+
+ public bool SupportRevision {
+ get {
+ return false;
+ }
+ }
+
+ public IDocRevisionManager RevisionManager {
+ get {
+ return null;
+ }
+ }
+
+ public bool SupportChange {
+ get {
+ return true;
+ }
+ }
+
+ public string Store (string id, string text)
+ {
+ EnsureOutput ();
+ SetupEntry (zipOutput, ref id);
+ var writer = new StreamWriter (zipOutput);
+ writer.Write (text);
+ writer.Flush ();
+
+ return id;
+ }
+
+ public string Store (string id, byte[] data)
+ {
+ EnsureOutput ();
+ SetupEntry (zipOutput, ref id);
+ zipOutput.Write (data, 0, data.Length);
+ return id;
+ }
+
+ public string Store (string id, Stream stream)
+ {
+ EnsureOutput ();
+ SetupEntry (zipOutput, ref id);
+ stream.CopyTo (zipOutput);
+ return id;
+ }
+
+ void SetupEntry (ZipOutputStream zipOutput, ref string id)
+ {
+ if (string.IsNullOrEmpty (id))
+ id = GetNewCode ();
+
+ ZipEntry entry = new ZipEntry (id);
+ zipOutput.PutNextEntry (entry);
+ }
+
+ public Stream Retrieve (string id)
+ {
+ EnsureInput ();
+ int index;
+ ZipEntry entry;
+ if (!entries.TryGetValue (id, out index) || (entry = zipFile[index]) == null)
+ entry = zipFile.GetEntry (id);
+ if (entry != null)
+ return zipFile.GetInputStream (entry);
+ else
+ throw new ArgumentException ("id", string.Format ("'{0}' isn't a valid id for this storage", id));
+ }
+
+ public IEnumerable<string> GetAvailableIds ()
+ {
+ EnsureInput ();
+ return zipFile.Cast<ZipEntry> ().Select (ze => ze.Name);
+ }
+
+ void EnsureOutput ()
+ {
+ if (zipFile != null)
+ throw new InvalidOperationException ("This ZipStorage instance is already used in read-mode");
+ if (zipOutput != null)
+ return;
+ zipOutput = new ZipOutputStream (File.Create (zipFileName));
+ }
+
+ void EnsureInput ()
+ {
+ if (zipOutput != null)
+ throw new InvalidOperationException ("This ZipStorage instance is already used in write-mode");
+ if (zipFile != null)
+ return;
+ zipFile = new ZipFile (zipFileName);
+ entries = Enumerable.Range (0, zipFile.Size).ToDictionary (i => zipFile[i].Name, i => i);
+ }
+
+ public void Dispose ()
+ {
+ if (zipOutput != null)
+ zipOutput.Dispose ();
+ if (zipFile != null)
+ zipFile.Close ();
+ }
+
+ string GetNewCode ()
+ {
+ return String.Format ("{0}", code++);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.IO;
+using System.Reflection;
+using System.Xml;
+
+namespace Mono.Documentation {
+ public class ManifestResourceResolver : XmlUrlResolver {
+ private string[] dirs;
+
+ public ManifestResourceResolver (params string[] dirs)
+ {
+ this.dirs = (string[]) dirs.Clone ();
+ }
+
+ public override Uri ResolveUri (Uri baseUri, string relativeUri)
+ {
+ if (Array.IndexOf (
+ Assembly.GetExecutingAssembly ().GetManifestResourceNames (),
+ relativeUri) >= 0)
+ return new Uri ("x-resource:///" + relativeUri);
+ foreach (var dir in dirs) {
+ if (File.Exists (Path.Combine (dir, relativeUri)))
+ return base.ResolveUri (new Uri ("file://" + new DirectoryInfo (dir).FullName + "/"),
+ relativeUri);
+ }
+ return base.ResolveUri (baseUri, relativeUri);
+ }
+
+ public override object GetEntity (Uri absoluteUri, string role, Type ofObjectToReturn)
+ {
+ if (ofObjectToReturn == null)
+ ofObjectToReturn = typeof(Stream);
+ if (ofObjectToReturn != typeof(Stream))
+ throw new XmlException ("This object type is not supported.");
+ if (absoluteUri.Scheme != "x-resource")
+ return base.GetEntity (absoluteUri, role, ofObjectToReturn);
+ return Assembly.GetExecutingAssembly().GetManifestResourceStream (
+ absoluteUri.Segments [1]);
+ }
+ }
+}
+
--- /dev/null
+using System;
+using System.Collections;
+using System.IO;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Web;
+using System.Xml;
+
+namespace Mono.Documentation {
+
+ public delegate XmlDocument DocLoader (string escapedTypeName);
+
+ public static class XmlDocUtils
+ {
+ public static XmlNodeList GetMemberGenericParameters (XmlNode member)
+ {
+ return member.SelectNodes ("Docs/typeparam");
+ }
+
+ public static XmlNodeList GetTypeGenericParameters (XmlNode member)
+ {
+ return member.SelectNodes ("/Type/TypeParameters/TypeParameter");
+ }
+
+ public static string ToTypeName (string type, XmlNode member)
+ {
+ return ToTypeName (type, GetTypeGenericParameters (member),
+ GetMemberGenericParameters (member));
+ }
+
+ public static string ToTypeName (string type, XmlNodeList typeGenParams, XmlNodeList memberGenParams)
+ {
+ type = type.Replace ("&", "@").Replace ("<", "{").Replace (">", "}");
+ for (int i = 0; i < typeGenParams.Count; ++i) {
+ string name = typeGenParams [i].InnerText;
+ type = Regex.Replace (type, @"\b" + name + @"\b", "`" + i);
+ }
+ for (int i = 0; i < memberGenParams.Count; ++i) {
+ string name = memberGenParams [i].Attributes ["name"].Value;
+ type = Regex.Replace (type, @"\b" + name + @"\b", "``" + i);
+ }
+ return type;
+ }
+
+ public static string ToEscapedTypeName (string name)
+ {
+ return GetCountedName (name, "`");
+ }
+
+ private static string GetCountedName (string name, string escape)
+ {
+ int lt = name.IndexOf ("<");
+ if (lt == -1)
+ return name;
+ StringBuilder type = new StringBuilder (name.Length);
+ int start = 0;
+ do {
+ type.Append (name.Substring (start, lt - start));
+ type.Append (escape);
+ type.Append (GetGenericCount (name, lt, out start));
+ } while ((lt = name.IndexOf ('<', start)) >= 0);
+ if (start < name.Length)
+ type.Append (name.Substring (start));
+ return type.ToString ().Replace ("+", ".");
+ }
+
+ private static int GetGenericCount (string name, int start, out int end)
+ {
+ int n = 1;
+ bool r = true;
+ int i = start;
+ int depth = 1;
+ for ( ++i; r && i < name.Length; ++i) {
+ switch (name [i]) {
+ case ',': if (depth == 1) ++n; break;
+ case '<': ++depth; break;
+ case '>': --depth; if (depth == 0) r = false; break;
+ }
+ }
+ end = i;
+ return n;
+ }
+
+ public static string ToEscapedMemberName (string member)
+ {
+ // Explicitly implemented interface members contain '.'s in the member
+ // name, e.g. System.Collections.Generic.IEnumerable<A>.GetEnumerator.
+ // CSC does a s/\./#/g for these.
+ member = member.Replace (".", "#");
+ if (member [member.Length-1] == '>') {
+ int i = member.LastIndexOf ("<");
+ int ignore;
+ return member.Substring (0, i).Replace ("<", "{").Replace (">", "}") +
+ "``" + GetGenericCount (member, i, out ignore);
+ }
+ return member.Replace ("<", "{").Replace (">", "}");
+ }
+
+ public static void AddExtensionMethods (XmlDocument typexml, ArrayList/*<XmlNode>*/ extensions, DocLoader loader)
+ {
+ // if no members (enum, delegate) don't add extensions
+ XmlNode m = typexml.SelectSingleNode ("/Type/Members");
+ if (m == null)
+ return;
+
+ // static classes can't be targets:
+ if (typexml.SelectSingleNode (
+ "/Type/TypeSignature[@Language='C#']/@Value")
+ .Value.IndexOf (" static ") >= 0)
+ return;
+
+ foreach (string s in GetSupportedTypes (typexml, loader)) {
+ foreach (XmlNode extension in extensions) {
+ bool add = false;
+ foreach (XmlNode target in extension.SelectNodes ("Targets/Target")) {
+ if (target.Attributes ["Type"].Value == s) {
+ add = true;
+ break;
+ }
+ }
+ if (!add) {
+ continue;
+ }
+ foreach (XmlNode c in extension.SelectNodes ("Member")) {
+ XmlNode cm = typexml.ImportNode (c, true);
+ m.AppendChild (cm);
+ }
+ }
+ }
+ }
+
+ private static IEnumerable GetSupportedTypes (XmlDocument type, DocLoader loader)
+ {
+ yield return "System.Object";
+ yield return GetEscapedPath (type, "Type/@FullName");
+
+ Hashtable h = new Hashtable ();
+ GetInterfaces (h, type, loader);
+
+ string s = GetEscapedPath (type, "Type/Base/BaseTypeName");
+ if (s != null) {
+ yield return s;
+ XmlDocument d;
+ string p = s;
+ while (s != null && (d = loader (s)) != null) {
+ GetInterfaces (h, d, loader);
+ s = GetEscapedPath (d, "Type/Base/BaseTypeName");
+ if (p == s)
+ break;
+ yield return s;
+ }
+ }
+
+ foreach (object o in h.Keys)
+ yield return o.ToString ();
+ }
+
+ private static string GetEscapedPath (XmlDocument d, string path)
+ {
+ XmlNode n = d.SelectSingleNode (path);
+ if (n == null)
+ return null;
+ return "T:" + ToEscapedTypeName (n.InnerText);
+ }
+
+ private static void GetInterfaces (Hashtable ifaces, XmlDocument doc, DocLoader loader)
+ {
+ foreach (XmlNode n in doc.SelectNodes ("Type/Interfaces/Interface/InterfaceName")) {
+ string t = ToEscapedTypeName (n.InnerText);
+ string tk = "T:" + t;
+ if (!ifaces.ContainsKey (tk)) {
+ ifaces.Add (tk, null);
+ try {
+ XmlDocument d = loader (t);
+ if (d != null)
+ GetInterfaces (ifaces, d, loader);
+ }
+ catch (FileNotFoundException e) {
+ // ignore; interface documentation couldn't be found.
+ }
+ }
+ }
+ }
+
+ // Turns e.g. sources/netdocs into sources/cache/netdocs
+ public static string GetCacheDirectory (string assembledBase)
+ {
+ return Path.Combine (
+ Path.Combine (Path.GetDirectoryName (assembledBase), "cache"),
+ Path.GetFileName (assembledBase));
+ }
+
+ public static string GetCachedFileName (string cacheDir, string url)
+ {
+ return Path.Combine (cacheDir,
+ Uri.EscapeUriString (url).Replace ('/', '+').Replace ("*", "%2a"));
+ }
+ }
+}
+
--- /dev/null
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+
+namespace Mono.Utilities
+{
+ public class LRUCache<TKey, TValue>
+ {
+ [ThreadStatic]
+ static LRUCache<TKey, TValue> deflt;
+
+ public static LRUCache<TKey, TValue> Default {
+ get {
+ return deflt != null ? deflt : (deflt = new LRUCache<TKey, TValue> (5));
+ }
+ }
+
+ int capacity;
+ LinkedList<ListValueEntry<TKey, TValue>> list;
+ Dictionary<TKey, LinkedListNode<ListValueEntry<TKey, TValue>>> lookup;
+ LinkedListNode<ListValueEntry<TKey, TValue>> openNode;
+
+ public LRUCache (int capacity)
+ {
+ this.capacity = capacity;
+ this.list = new LinkedList<ListValueEntry<TKey, TValue>>();
+ this.lookup = new Dictionary<TKey, LinkedListNode<ListValueEntry<TKey, TValue>>> (capacity + 1);
+ this.openNode = new LinkedListNode<ListValueEntry<TKey, TValue>>(new ListValueEntry<TKey, TValue> (default(TKey), default(TValue)));
+ }
+
+ public void Put (TKey key, TValue value)
+ {
+ if (Get(key) == null) {
+ this.openNode.Value.ItemKey = key;
+ this.openNode.Value.ItemValue = value;
+ this.list.AddFirst (this.openNode);
+ this.lookup.Add (key, this.openNode);
+
+ if (this.list.Count > this.capacity) {
+ // last node is to be removed and saved for the next addition to the cache
+ this.openNode = this.list.Last;
+
+ // remove from list & dictionary
+ this.list.RemoveLast();
+ this.lookup.Remove(this.openNode.Value.ItemKey);
+ } else {
+ // still filling the cache, create a new open node for the next time
+ this.openNode = new LinkedListNode<ListValueEntry<TKey, TValue>>(new ListValueEntry<TKey, TValue>(default(TKey), default(TValue)));
+ }
+ }
+ }
+
+ public TValue Get (TKey key)
+ {
+ LinkedListNode<ListValueEntry<TKey, TValue>> node = null;
+ if (!this.lookup.TryGetValue (key, out node))
+ return default (TValue);
+ this.list.Remove (node);
+ this.list.AddFirst (node);
+ return node.Value.ItemValue;
+ }
+
+ class ListValueEntry<K, V> where K : TKey
+ where V : TValue
+ {
+ internal V ItemValue;
+ internal K ItemKey;
+
+ internal ListValueEntry(K key, V value)
+ {
+ this.ItemKey = key;
+ this.ItemValue = value;
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+
+namespace Mono.Utilities
+{
+ public class LRUCache<TKey, TValue>
+ {
+ [ThreadStatic]
+ static LRUCache<TKey, TValue> deflt;
+
+ public static LRUCache<TKey, TValue> Default {
+ get {
+ return deflt != null ? deflt : (deflt = new LRUCache<TKey, TValue> (5));
+ }
+ }
+
+ int capacity;
+ LinkedList<ListValueEntry<TKey, TValue>> list;
+ Dictionary<TKey, LinkedListNode<ListValueEntry<TKey, TValue>>> lookup;
+ LinkedListNode<ListValueEntry<TKey, TValue>> openNode;
+
+ public LRUCache (int capacity)
+ {
+ this.capacity = capacity;
+ this.list = new LinkedList<ListValueEntry<TKey, TValue>>();
+ this.lookup = new Dictionary<TKey, LinkedListNode<ListValueEntry<TKey, TValue>>> (capacity + 1);
+ this.openNode = new LinkedListNode<ListValueEntry<TKey, TValue>>(new ListValueEntry<TKey, TValue> (default(TKey), default(TValue)));
+ }
+
+ public void Put (TKey key, TValue value)
+ {
+ if (Get(key) == null) {
+ this.openNode.Value.Itemkey = key;
+ this.openNode.Value.Itemvalue = value;
+ this.list.AddFirst (this.openNode);
+ this.lookup.Add (key, this.openNode);
+
+ if (this.list.Count > this.capacity) {
+ // last node is to be removed and saved for the next addition to the cache
+ this.openNode = this.list.Last;
+
+ // remove from list & dictionary
+ this.list.RemoveLast();
+ this.lookup.Remove(this.openNode.Value.Itemkey);
+ } else {
+ // still filling the cache, create a new open node for the next time
+ this.openNode = new LinkedListNode<ListValueEntry<Tkey, Tvalue>>(new ListValueEntry<Tkey, Tvalue>(default(Tkey), default(Tvalue)));
+ }
+ }
+ }
+
+ public TValue Get (TKey key)
+ {
+ LinkedListNode<ListValueEntry<TKey, TValue>> node = null;
+ if (!this.lookup.TryGetValue (key, out node))
+ return default (TValue);
+ this.list.Remove (node);
+ this.list.AddFirst (node);
+ return node.Value.ItemValue;
+ }
+
+ class ListValueEntry<K, V> where K : TKey
+ where V : TValue
+ {
+ internal V ItemValue;
+ internal K ItemKey;
+
+ internal ListValueEntry(K key, V value)
+ {
+ this.ItemKey = key;
+ this.ItemValue = value;
+ }
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Text.RegularExpressions;
+using System.Collections;
+
+namespace Mono.Utilities {
+ public class Colorizer {
+ //
+ // Syntax coloring
+ //
+
+ static string keywords_cs =
+ "(\\babstract\\b|\\bevent\\b|\\bnew\\b|\\bstruct\\b|\\bas\\b|\\bexplicit\\b|\\bnull\\b|\\bswitch\\b|\\bbase\\b|\\bextern\\b|"
+ +
+ "\\bobject\\b|\\bthis\\b|\\bbool\\b|\\bfalse\\b|\\boperator\\b|\\bthrow\\b|\\bbreak\\b|\\bfinally\\b|\\bout\\b|\\btrue\\b|"
+ +
+ "\\bbyte\\b|\\bfixed\\b|\\boverride\\b|\\btry\\b|\\bcase\\b|\\bfloat\\b|\\bparams\\b|\\btypeof\\b|\\bcatch\\b|\\bfor\\b|"
+ +
+ "\\bprivate\\b|\\buint\\b|\\bchar\\b|\\bforeach\\b|\\bprotected\\b|\\bulong\\b|\\bchecked\\b|\\bgoto\\b|\\bpublic\\b|"
+ +
+ "\\bunchecked\\b|\\bclass\\b|\\bif\\b|\\breadonly\\b|\\bunsafe\\b|\\bconst\\b|\\bimplicit\\b|\\bref\\b|\\bushort\\b|"
+ +
+ "\\bcontinue\\b|\\bin\\b|\\breturn\\b|\\busing\\b|\\bdecimal\\b|\\bint\\b|\\bsbyte\\b|\\bvirtual\\b|\\bdefault\\b|"
+ +
+ "\\binterface\\b|\\bsealed\\b|\\bvolatile\\b|\\bdelegate\\b|\\binternal\\b|\\bshort\\b|\\bvoid\\b|\\bdo\\b|\\bis\\b|"
+ +
+ "\\bsizeof\\b|\\bwhile\\b|\\bdouble\\b|\\block\\b|\\bstackalloc\\b|\\belse\\b|\\blong\\b|\\bstatic\\b|\\benum\\b|"
+ + "\\bnamespace\\b|\\bstring\\b)";
+
+#if false
+// currently not in use
+ static string keywords_vb =
+ "(\\bAddHandler\\b|\\bAddressOf\\b|\\bAlias\\b|\\bAnd\\b|\\bAndAlso\\b|\\bAnsi\\b|\\bAs\\b|\\bAssembly\\b|"
+ +
+ "\\bAuto\\b|\\bBoolean\\b|\\bByRef\\b|\\bByte\\b|\\bByVal\\b|\\bCall\\b|\\bCase\\b|\\bCatch\\b|"
+ +
+ "\\bCBool\\b|\\bCByte\\b|\\bCChar\\b|\\bCDate\\b|\\bCDec\\b|\\bCDbl\\b|\\bChar\\b|\\bCInt\\b|"
+ +
+ "\\bClass\\b|\\bCLng\\b|\\bCObj\\b|\\bConst\\b|\\bCShort\\b|\\bCSng\\b|\\bCStr\\b|\\bCType\\b|"
+ +
+ "\\bDate\\b|\\bDecimal\\b|\\bDeclare\\b|\\bDefault\\b|\\bDelegate\\b|\\bDim\\b|\\bDirectCast\\b|\\bDo\\b|"
+ +
+ "\\bDouble\\b|\\bEach\\b|\\bElse\\b|\\bElseIf\\b|\\bEnd\\b|\\bEnum\\b|\\bErase\\b|\\bError\\b|"
+ +
+ "\\bEvent\\b|\\bExit\\b|\\bFalse\\b|\\bFinally\\b|\\bFor\\b|\\bFriend\\b|\\bFunction\\b|\\bGet\\b|"
+ +
+ "\\bGetType\\b|\\bGoSub\\b|\\bGoTo\\b|\\bHandles\\b|\\bIf\\b|\\bImplements\\b|\\bImports\\b|\\bIn\\b|"
+ +
+ "\\bInherits\\b|\\bInteger\\b|\\bInterface\\b|\\bIs\\b|\\bLet\\b|\\bLib\\b|\\bLike\\b|\\bLong\\b|"
+ +
+ "\\bLoop\\b|\\bMe\\b|\\bMod\\b|\\bModule\\b|\\bMustInherit\\b|\\bMustOverride\\b|\\bMyBase\\b|\\bMyClass\\b|"
+ +
+ "\\bNamespace\\b|\\bNew\\b|\\bNext\\b|\\bNot\\b|\\bNothing\\b|\\bNotInheritable\\b|\\bNotOverridable\\b|\\bObject\\b|"
+ +
+ "\\bOn\\b|\\bOption\\b|\\bOptional\\b|\\bOr\\b|\\bOrElse\\b|\\bOverloads\\b|\\bOverridable\\b|\\bOverrides\\b|"
+ +
+ "\\bParamArray\\b|\\bPreserve\\b|\\bPrivate\\b|\\bProperty\\b|\\bProtected\\b|\\bPublic\\b|\\bRaiseEvent\\b|\\bReadOnly\\b|"
+ +
+ "\\bReDim\\b|\\bREM\\b|\\bRemoveHandler\\b|\\bResume\\b|\\bReturn\\b|\\bSelect\\b|\\bSet\\b|\\bShadows\\b|"
+ +
+ "\\bShared\\b|\\bShort\\b|\\bSingle\\b|\\bStatic\\b|\\bStep\\b|\\bStop\\b|\\bString\\b|\\bStructure\\b|"
+ +
+ "\\bSub\\b|\\bSyncLock\\b|\\bThen\\b|\\bThrow\\b|\\bTo\\b|\\bTrue\\b|\\bTry\\b|\\bTypeOf\\b|"
+ +
+ "\\bUnicode\\b|\\bUntil\\b|\\bVariant\\b|\\bWhen\\b|\\bWhile\\b|\\bWith\\b|\\bWithEvents\\b|\\bWriteOnly\\b|\\bXor\\b)";
+#endif
+
+ public static string Colorize(string text, string lang)
+ {
+ lang = lang.Trim().ToLower();
+ switch (lang) {
+ case "xml":
+ return ColorizeXml(text);
+ case "cs": case "c#": case "csharp":
+ return ColorizeCs(text);
+ case "vb":
+ return ColorizeVb(text);
+ }
+ return Escape (text);
+ }
+
+ static string ColorizeXml(string text)
+ {
+ // Order is highly important.
+
+ // s/ / /g must be first, as later substitutions add required spaces
+ text = text.Replace(" ", " ");
+
+ // Find & mark XML elements
+ Regex re = new Regex("<\\s*(\\/?)\\s*([\\s\\S]*?)\\s*(\\/?)\\s*>");
+ text = re.Replace(text, "{blue:<$1}{maroon:$2}{blue:$3>}");
+
+ // Colorize attribute strings; must be done before colorizing marked XML
+ // elements so that we don't clobber the colorized XML tags.
+ re = new Regex ("([\"'])(.*?)\\1");
+ text = re.Replace (text,
+ "$1<font color=\"purple\">$2</font>$1");
+
+ // Colorize marked XML elements
+ re = new Regex("\\{(\\w*):([\\s\\S]*?)\\}");
+ //text = re.Replace(text, "<span style='color:$1'>$2</span>");
+ text = re.Replace(text, "<font color=\"$1\">$2</font>");
+
+ // Standard Structure
+ text = text.Replace("\t", " ");
+ re = new Regex("\r\n|\r|\n");
+ text = re.Replace(text, "<br/>");
+
+ return text;
+ }
+
+ static string ColorizeCs(string text)
+ {
+ text = text.Replace(" ", " ");
+
+ text = text.Replace("<", "<");
+ text = text.Replace(">", ">");
+
+ Regex re = new Regex("\"((((?!\").)|\\\")*?)\"");
+
+ text =
+ re.Replace(text,
+ "<font color=\"purple\">\"$1\"</font>");
+ //"<span style='color:purple'>\"$1\"</span>");
+
+ re = new
+ Regex
+ ("//(((.(?!\"</font>))|\"(((?!\").)*)\"</font>)*)(\r|\n|\r\n)");
+ //("//(((.(?!\"</span>))|\"(((?!\").)*)\"</span>)*)(\r|\n|\r\n)");
+ text =
+ re.Replace(text,
+ "<font color=\"green\">//$1</font><br/>");
+ // "<span style='color:green'>//$1</span><br/>");
+
+ re = new Regex(keywords_cs);
+ text = re.Replace(text, "<font color=\"blue\">$1</font>");
+ //text = re.Replace(text, "<span style='color:blue'>$1</span>");
+
+ text = text.Replace("\t", " ");
+ text = text.Replace("\n", "<br/>");
+
+ return text;
+ }
+
+ static string ColorizeVb(string text) {
+ text = text.Replace(" ", " ");
+
+ /* Regex re = new Regex ("\"((((?!\").)|\\\")*?)\"");
+ text = re.Replace (text,"<span style='color:purple'>\"$1\"</span>");
+
+ re = new Regex ("'(((.(?!\"\\<\\/span\\>))|\"(((?!\").)*)\"\\<\\/span\\>)*)(\r|\n|\r\n)");
+ text = re.Replace (text,"<span style='color:green'>//$1</span><br/>");
+
+ re = new Regex (keywords_vb);
+ text = re.Replace (text,"<span style='color:blue'>$1</span>");
+ */
+ text = text.Replace("\t", " ");
+ text = text.Replace("\n", "<br/>");
+ return text;
+ }
+
+ static string Escape(string text)
+ {
+ text = text.Replace("&", "&");
+ text = text.Replace(" ", " ");
+ text = text.Replace("<", "<");
+ text = text.Replace(">", ">");
+ text = text.Replace("\n", "<br/>");
+ return text;
+ }
+ }
+}
--- /dev/null
+/helper.js -crlf
--- /dev/null
+/*
+* base.css: CSS applied to all the docs
+*
+* Author: Mario Sopena
+*/
+
+body, table {
+ margin: 0px;
+}
+
+body, table, pre, p {
+ font-family: @@FONT_FAMILY@@, sans-serif;
+ /* font-size: @@FONT_SIZE@@pt; */
+ font-size: 10pt;
+}
+
+div.header {
+ background-color: #FAFBFD;
+ font-size: 1.7em;
+ font-weight: bold;
+ padding: 8px 0 0 10px;
+ font-family: 'Segoe UI',Verdana,Arial;
+}
+
+div.title {
+ font-size: 130%;
+ font-weight: bolder;
+ margin-top: 0.3em;
+ margin-left: 0.2em;
+ margin-bottom: 0.1em;
+}
+
+.subtitle {
+ font-style: italic;
+}
+
--- /dev/null
+<?xml version="1.0"?>
+<xsl:stylesheet
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="1.0"
+ xmlns:monodoc="monodoc:///extensions"
+ exclude-result-prefixes="monodoc"
+ >
+<xsl:output omit-xml-declaration="yes" />
+
+<xsl:template match="/clause">
+ <div class="header" id="ecmaspec">
+ <div class="subtitle">ECMA-334 C# Language Specification</div>
+ <div class="title"><xsl:value-of select="@number"/>: <xsl:value-of select="@title"/>
+ <xsl:if test="@informative"> (informative) </xsl:if></div>
+ </div>
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="paragraph">
+ <p>
+ <xsl:apply-templates />
+ </p>
+</xsl:template>
+
+<xsl:template match="keyword">
+ <span class="keyword"> <xsl:apply-templates/></span> <xsl:text> </xsl:text>
+</xsl:template>
+
+<xsl:template match="hyperlink">
+ <a href="ecmaspec:{.}">
+ <xsl:value-of select="." />
+ </a>
+</xsl:template>
+
+<xsl:template match="list">
+ <ul>
+ <xsl:for-each select="list_item|list">
+ <li><xsl:apply-templates /></li>
+ </xsl:for-each>
+ </ul>
+</xsl:template>
+
+<xsl:template match="code_example">
+ <div class="code_example">
+ <div class="code_ex_title">Code example</div>
+ <span class="code">
+ <xsl:value-of select="monodoc:Colorize(string(descendant-or-self::text()), string('csharp'))" disable-output-escaping="yes" />
+ </span>
+ </div>
+</xsl:template>
+
+<xsl:template match="symbol">
+ <span class="symbol">
+ <xsl:apply-templates />
+ </span>
+</xsl:template>
+
+<xsl:template match="grammar_production">
+ <dl class="nt_{name/non_terminal/.}">
+ <dt><xsl:value-of select="name/non_terminal/." /></dt>
+
+ <xsl:for-each select="rhs">
+ <dd>
+ <xsl:apply-templates select="node()" />
+ </dd>
+ </xsl:for-each>
+ </dl>
+</xsl:template>
+
+<xsl:template match="non_terminal">
+ <span class="non_terminal"><xsl:text> </xsl:text><xsl:value-of select="." /></span>
+</xsl:template>
+
+<xsl:template match="terminal">
+ <span class="terminal"><xsl:text> </xsl:text><xsl:value-of select="." /></span>
+</xsl:template>
+
+<xsl:template match="opt">
+ <xsl:text> (</xsl:text><span class="opt">optional</span><xsl:text>) </xsl:text>
+</xsl:template>
+
+<xsl:template match="note|example">
+ <div class="note">
+ <xsl:apply-templates />
+ </div>
+</xsl:template>
+
+<xsl:template match="table_line">
+ <xsl:apply-templates /><br />
+</xsl:template>
+
+<xsl:template match="@*|node()">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+</xsl:template>
+
+</xsl:stylesheet>
--- /dev/null
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:output omit-xml-declaration="yes" />
+
+<xsl:template match="/clause">
+ <table width="100%" cellpadding="5">
+ <tr bgcolor="#b0c4de"><td>
+ <i>ECMA-334 C# Language Specification</i>
+
+ <h3>
+ <xsl:value-of select="@number"/>: <xsl:value-of select="@title"/>
+
+ <xsl:if test="@informative">
+ (informative)
+ </xsl:if>
+ </h3>
+ </td></tr>
+ </table>
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="paragraph">
+ <p>
+ <xsl:apply-templates />
+ </p>
+</xsl:template>
+
+<xsl:template match="keyword">
+ <i> <xsl:apply-templates/></i> <xsl:text> </xsl:text>
+</xsl:template>
+
+<xsl:template match="hyperlink">
+ <a href="ecmaspec:{.}">
+ <xsl:value-of select="." />
+ </a>
+</xsl:template>
+
+<xsl:template match="list">
+ <ul>
+ <xsl:for-each select="list_item|list">
+ <li><xsl:apply-templates /></li>
+ </xsl:for-each>
+ </ul>
+</xsl:template>
+
+<xsl:template match="code_example">
+ <table bgcolor="#f5f5dd" border="1" cellpadding="5">
+ <tr>
+ <td>
+ <pre>
+ <xsl:apply-templates />
+ </pre>
+ </td>
+ </tr>
+ </table>
+</xsl:template>
+
+<xsl:template match="symbol">
+ <code>
+ <xsl:apply-templates />
+ </code>
+</xsl:template>
+
+<xsl:template match="grammar_production">
+ <dl id="nt_{name/non_terminal/.}">
+ <dt><xsl:value-of select="name/non_terminal/." /></dt>
+
+ <xsl:for-each select="rhs">
+ <dd>
+ <xsl:apply-templates select="node()" />
+ </dd>
+ </xsl:for-each>
+ </dl>
+</xsl:template>
+
+<xsl:template match="non_terminal">
+
+ <code><xsl:text> </xsl:text><xsl:value-of select="." /></code>
+</xsl:template>
+
+<xsl:template match="terminal">
+ <code><xsl:text> </xsl:text><xsl:value-of select="." /></code>
+</xsl:template>
+
+<xsl:template match="opt">
+ <sub>opt</sub>
+</xsl:template>
+
+<xsl:template match="@*|node()">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+</xsl:template>
+
+</xsl:stylesheet>
--- /dev/null
+/*
+* ecmaspec.css: CSS applied to ECMA C# specs
+*
+* Author: Mario Sopena
+*/
+
+#ecmaspec {
+ background: #a4dda4; /*#83b183;*/
+ border: 2px solid #556655;
+}
+
+p {
+ text-align: justify;
+ margin-top: .5em;
+ margin-bottom: .5em;
+}
+
+span.keyword {
+ color: #a6563a;
+}
+
+a:link {
+ text-decoration: none;
+}
+
+a:hover {
+ text-decoration: underline;
+}
+
+div.code_example {
+ background: #f5f5dd;
+ border: 1px solid #cdcd82;
+ border: 1px solid black;
+ padding-left: 1em;
+ padding-bottom: 1em;
+ margin-top: 1em;
+ font-family: fixed;
+ white-space: pre;
+ margin-bottom: 1em;
+}
+div.code_ex_title {
+ position: relative;
+ top: -1em;
+ left: 30%;
+ background: #cdcd82;
+ border: 1px solid black;
+ color: black;
+ text-transform: uppercase;
+ width: 40%;
+ padding: 0.3em;
+ text-align: center;
+}
+
+span.symbol {
+ font-weight: bolder;
+}
+
+
+span.optional {
+ font-style: italic;
+}
+
+div.note {
+ background: #cdcd82;
+ border: 1px solid black;
+ padding: 1em;
+ margin-top: 1em;
+ margin-bottom: 1em;
+}
--- /dev/null
+function toggle_display (block) {\r
+ var w = document.getElementById (block);\r
+ var t = document.getElementById (block + ":toggle");\r
+ if (w.style.display == "none") {\r
+ w.style.display = "block";\r
+ t.getElementsByTagName("img")[0].setAttribute ("src", "xtree/images/clean/Lminus.gif"); // <img src="xtree/images/clean/Lminus.gif">\r
+ } else {\r
+ w.style.display = "none";\r
+ t.getElementsByTagName("img")[0].setAttribute ("src", "xtree/images/clean/Lplus.gif"); // <img src="xtree/images/clean/Lplus.gif">\r
+ }\r
+}\r
+\r
--- /dev/null
+<head>
+<style type="text/css">
+/* GENERAL */
+
+body, table {
+ font-family: @@FONT_FAMILY@@, sans-serif;
+ font-size: @@FONT_SIZE@@%;
+}
+
+/* ECMA BLOCK */
+#docs {
+ margin-bottom: 1em;
+}
+
+/* CONTRIBUTIONS */
+#contrib {
+ margin-top: 2em;
+ width: 98%;
+ margin-left: 1%;
+ color: black;
+ background: #fff3f3;
+ border: 1px solid #ffc9c9;
+ @@EDITING_ENABLED@@
+ }
+#contribTitle {
+ text-align: left;
+ font-weight: bold;
+ padding: .4em;
+ font-size: 110%;
+ @@CONTRIB_DISP@@
+}
+#contrib #content {
+ padding: .4em;
+}
+#some-contrib {
+ @@CONTRIB_DISP@@
+}
+#no-contrib {
+ @@NO_CONTRIB_DISP@@
+}
+#contrib p {
+ text-indent: 1em;
+ text-align: justify;
+ }
+</style>
+<link type="text/css" rel="stylesheet" href="mono-ecma.css"/>
+</head>
+
+<div class="Content">
+ <p>The following documentation collections are available:
+
+ <div id="docs">
+ <ul>
+ @@API_DOCS@@
+ </ul>
+ </div>
+
+ <div id="contrib">
+ <div id="contribTitle">Contributions</div>
+ <div id="content">
+ <div id="some-contrib">
+ @@CONTRIBS@@
+ </div>
+ <div id="no-contrib">
+ <p><b>You have not made any contributions yet.</b></p>
+ <p>The Documentation of the libraries is not complete and your contributions would be greatly appreciated. The procedure is easy, browse to the part of the documentation you want to contribute to and click on the <font color="blue">[Edit]</font> link to start writing documentation.</p>
+ <p>When you are happy with your changes, use the Contributing--> Upload Contribution--> menu to send your contributions to our server.</p></div> </div>
+ </div>
+</div>
--- /dev/null
+<?xml version="1.0"?>
+
+<!--
+ mdoc-html-format.xsl: HTML pass-through formatting support
+
+ Author: Jonathan Pryor (jpryor@novell.com)
+
+-->
+
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ >
+
+ <!-- pass-through any other elements unchanged - they may be HTML -->
+ <xsl:template match="//format[@type='text/html']//*">
+ <xsl:copy>
+ <xsl:copy-of select="@*" />
+ <xsl:apply-templates select="*|node()" />
+ </xsl:copy>
+ </xsl:template>
+
+</xsl:stylesheet>
+
--- /dev/null
+<?xml version="1.0"?>
+
+<!--
+ mdoc-html-utils.xsl: ECMA-style docs to HTML stylesheet transformation utils
+
+ Author: Joshua Tauberer (tauberer@for.net)
+ Author: Jonathan Pryor (jpryor@novell.com)
+
+ This file requires that including files define the following callable
+ templates:
+ - CreateCodeBlock (language, content)
+ - CreateEnumerationTable (content)
+ - CreateHeader (content)
+ - CreateListTable (header, content)
+ - CreateMembersTable (content)
+ - CreateSignature (content)
+ - CreateTypeDocumentationTable (content)
+ - GetLinkTarget (type, cref)
+ - CreateEditLink (e)
+
+-->
+
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:msxsl="urn:schemas-microsoft-com:xslt"
+ exclude-result-prefixes="msxsl"
+ >
+ <xsl:import href="mdoc-html-format.xsl" />
+
+ <!-- TEMPLATE PARAMETERS -->
+ <xsl:param name="language" select="'C#'"/>
+ <xsl:param name="index" />
+ <xsl:param name="source-id"/>
+
+ <xsl:variable name="ThisType" select="/Type"/>
+
+ <!-- The namespace that the current type belongs to. -->
+ <xsl:variable name="TypeNamespace" select="substring(/Type/@FullName, 1, string-length(/Type/@FullName) - string-length(/Type/@Name) - 1)"/>
+
+ <!-- THE MAIN RENDERING TEMPLATE -->
+
+ <!-- TYPE OVERVIEW -->
+
+ <xsl:template name="CreateTypeOverview">
+ <xsl:param name="implemented" />
+ <xsl:param name="show-members-link" />
+
+ <xsl:attribute name="id">
+ <xsl:text>T:</xsl:text>
+ <xsl:call-template name="GetEscapedTypeName">
+ <xsl:with-param name="typename" select="@FullName" />
+ </xsl:call-template>
+ <xsl:text>:Summary</xsl:text>
+ </xsl:attribute>
+ <!-- summary -->
+ <xsl:apply-templates select="Docs/summary" mode="notoppara"/>
+ <xsl:apply-templates select="Docs/summary" mode="editlink"/>
+
+ <xsl:if test="$implemented">
+ <p><b>Mono Implementation Note: </b></p>
+ <blockquote>
+ <xsl:value-of disable-output-escaping="yes" select="$implemented"/>
+ </blockquote>
+ </xsl:if>
+
+ <xsl:if test="$show-members-link and not(Base/BaseTypeName='System.Enum' or Base/BaseTypeName='System.Delegate' or Base/BaseTypeName='System.MulticastDelegate') and count(Members)">
+ <p>
+ See Also:
+ <a>
+ <xsl:attribute name="href">
+ <xsl:text>T</xsl:text>
+ <xsl:call-template name="GetLinkId">
+ <xsl:with-param name="type" select="." />
+ <xsl:with-param name="member" select="." />
+ </xsl:call-template>
+ <xsl:text>/*</xsl:text>
+ </xsl:attribute>
+ <xsl:value-of select="translate(@Name, '+', '.')"/>
+ <xsl:value-of select="' '" />
+ <xsl:text>Members</xsl:text>
+ </a>
+ </p>
+ </xsl:if>
+
+ <!--
+ Inheritance tree, but only for non-standard classes and not for interfaces
+ -->
+ <xsl:if test="not(Base/BaseTypeName='System.Enum' or Base/BaseTypeName='System.Delegate' or Base/BaseTypeName='System.ValueType' or Base/BaseTypeName='System.Object' or Base/BaseTypeName='System.MulticatDelegate' or count(Base/ParentType)=0)">
+ <p>
+ <xsl:for-each select="Base/ParentType">
+ <xsl:sort select="@Order" order="descending"/>
+ <xsl:variable name="p" select="position()" />
+ <xsl:for-each select="parent::Base/ParentType[position() < $p]">
+ <xsl:value-of select="'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'" disable-output-escaping="yes"/>
+ </xsl:for-each>
+ <a>
+ <xsl:attribute name="href">
+ <xsl:call-template name="GetLinkTargetHtml">
+ <xsl:with-param name="type" select="@Type" />
+ <xsl:with-param name="cref">
+ <xsl:text>T:</xsl:text>
+ <xsl:call-template name="GetEscapedTypeName">
+ <xsl:with-param name="typename" select="@Type" />
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:value-of select="@Type"/>
+ </a>
+ <br/>
+ </xsl:for-each>
+
+ <xsl:for-each select="Base/ParentType">
+ <xsl:value-of select="'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'" disable-output-escaping="yes"/>
+ </xsl:for-each>
+ <xsl:value-of select="@FullName"/>
+ </p>
+ </xsl:if>
+ <!--
+ <xsl:if test="Base/BaseTypeName='System.Enum'">
+ <br/>
+ The type of the values in this enumeration is
+ <xsl:apply-templates select="Members/Member[@MemberName='value__']/ReturnValue/ReturnType" mode="typelink"><xsl:with-param name="wrt" select="$TypeNamespace"/></xsl:apply-templates>.
+ </xsl:if>
+ -->
+ </xsl:template>
+
+ <xsl:template name="CreateTypeSignature">
+ <xsl:attribute name="id">
+ <xsl:text>T:</xsl:text>
+ <xsl:call-template name="GetEscapedTypeName">
+ <xsl:with-param name="typename" select="@FullName" />
+ </xsl:call-template>
+ <xsl:text>:Signature</xsl:text>
+ </xsl:attribute>
+ <!-- signature -->
+ <xsl:call-template name="CreateSignature">
+ <xsl:with-param name="content">
+ <xsl:choose>
+ <xsl:when test="$language='C#'">
+
+ <xsl:for-each select="Attributes/Attribute">
+ <xsl:text>[</xsl:text>
+ <xsl:value-of select="AttributeName"/>
+ <xsl:text>]</xsl:text>
+ <br/>
+ </xsl:for-each>
+
+ <xsl:for-each select="ReturnValue/Attributes/Attribute">
+ <xsl:text>[return:</xsl:text>
+ <xsl:value-of select="AttributeName"/>
+ <xsl:text>]</xsl:text>
+ <br/>
+ </xsl:for-each>
+
+ <xsl:choose>
+
+ <xsl:when test="Base/BaseTypeName='System.Enum'">
+ <xsl:call-template name="getmodifiers">
+ <xsl:with-param name="sig" select="TypeSignature[@Language='C#']/@Value"/>
+ </xsl:call-template>
+
+ <xsl:text>enum </xsl:text>
+
+ <!-- member name, argument list -->
+ <b>
+ <xsl:value-of select="translate (@Name, '+', '.')"/>
+ </b>
+ </xsl:when>
+
+ <xsl:when test="Base/BaseTypeName='System.Delegate' or Base/BaseTypeName='System.MulticastDelegate'">
+ <xsl:choose>
+
+ <xsl:when test="count(Parameters) > 0 and count(ReturnValue) > 0">
+ <!-- Only recreate the delegate signature if the appropriate information
+ is present in the XML file. -->
+
+ <xsl:call-template name="getmodifiers">
+ <xsl:with-param name="sig" select="TypeSignature[@Language='C#']/@Value"/>
+ </xsl:call-template>
+
+ <xsl:text>delegate </xsl:text>
+
+ <xsl:apply-templates select="ReturnValue/ReturnType" mode="typelink"><xsl:with-param name="wrt" select="$TypeNamespace"/></xsl:apply-templates>
+
+ <!-- hard space -->
+ <xsl:value-of select="' '"/>
+
+ <!-- member name, argument list -->
+ <b>
+ <xsl:call-template name="GetDefinitionName">
+ <xsl:with-param name="name" select="translate (@Name, '+', '.')" />
+ <xsl:with-param name="TypeParameters" select="TypeParameters" />
+ </xsl:call-template>
+ </b>
+
+ <!-- hard space -->
+ <xsl:value-of select="' '"/>
+
+ <xsl:value-of select="'('"/> <!-- prevents whitespace issues -->
+
+ <xsl:for-each select="Parameters/Parameter">
+ <xsl:call-template name="ShowParameter">
+ <xsl:with-param name="Param" select="."/>
+ <xsl:with-param name="TypeNamespace" select="$TypeNamespace"/>
+ </xsl:call-template>
+
+ <xsl:if test="not(position()=last())">, </xsl:if>
+ </xsl:for-each>
+
+ <xsl:value-of select="')'"/>
+
+ </xsl:when>
+
+ <xsl:otherwise>
+ <xsl:apply-templates select="TypeSignature[@Language=$language]/@Value"/>
+ </xsl:otherwise>
+
+ </xsl:choose>
+
+
+ </xsl:when>
+
+ <xsl:otherwise>
+ <xsl:call-template name="getmodifiers">
+ <xsl:with-param name="sig" select="TypeSignature[@Language='C#']/@Value"/>
+ <xsl:with-param name="typetype" select="true()"/>
+ </xsl:call-template>
+
+ <xsl:value-of select="' '"/>
+
+ <b>
+ <xsl:call-template name="GetDefinitionName">
+ <xsl:with-param name="name" select="translate (@Name, '+', '.')" />
+ <xsl:with-param name="TypeParameters" select="TypeParameters" />
+ </xsl:call-template>
+ </b>
+
+ <xsl:variable name="HasStandardBaseType" select="Base/BaseTypeName='System.Object' or Base/BaseTypeName='System.ValueType'"/>
+ <xsl:variable name="HasBaseType" select="count(Base/BaseTypeName)>0"/>
+ <xsl:if test="(($HasBaseType) and not($HasStandardBaseType)) or not(count(Interfaces/Interface)=0)">
+ <xsl:text> : </xsl:text>
+
+ <xsl:if test="$HasBaseType and not($HasStandardBaseType)">
+ <xsl:apply-templates select="Base/BaseTypeName" mode="typelink"><xsl:with-param name="wrt" select="$TypeNamespace"/></xsl:apply-templates>
+ <xsl:if test="not(count(Interfaces/Interface)=0)">, </xsl:if>
+ </xsl:if>
+
+ <xsl:for-each select="Interfaces/Interface">
+ <xsl:if test="not(position()=1)">, </xsl:if>
+ <xsl:apply-templates select="InterfaceName" mode="typelink"><xsl:with-param name="wrt" select="$TypeNamespace"/></xsl:apply-templates>
+ </xsl:for-each>
+
+ </xsl:if>
+ </xsl:otherwise>
+
+ </xsl:choose>
+
+ <xsl:call-template name="CreateGenericConstraints">
+ <xsl:with-param name="TypeParameters" select="TypeParameters" />
+ </xsl:call-template>
+
+ </xsl:when>
+
+ <xsl:otherwise>
+ <xsl:apply-templates select="TypeSignature[@Language=$language]/@Value"/>
+ </xsl:otherwise>
+
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:template>
+
+ <xsl:template name="GetDefinitionName">
+ <xsl:param name="name" />
+ <xsl:param name="TypeParameters" />
+
+ <xsl:choose>
+ <!-- do NOT process explicitly implemented generic interface members
+ unless they're actually generic methods. -->
+ <xsl:when test="contains ($name, '>') and
+ '>' = substring ($name, string-length ($name), 1)">
+ <xsl:value-of select="substring-before ($name, '<')" />
+ <xsl:text><</xsl:text>
+ <xsl:for-each select="$TypeParameters/TypeParameter">
+ <xsl:for-each select="Attributes/Attribute">
+ <xsl:text>[</xsl:text>
+ <xsl:value-of select="AttributeName"/>
+ <xsl:text>] </xsl:text>
+ </xsl:for-each>
+ <xsl:choose>
+ <xsl:when test="@Name">
+ <xsl:value-of select="@Name" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="." />
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="not(position()=last())">, </xsl:if>
+ </xsl:for-each>
+ <xsl:text>></xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$name" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="CreateGenericConstraints">
+ <xsl:param name="TypeParameters" />
+
+ <xsl:for-each select="$TypeParameters/TypeParameter">
+ <xsl:variable name="constraintsCount" select="count(Constraints/*)" />
+ <xsl:if test="$constraintsCount > 0 and count(Constraints/*[.='Contravariant' or .='Covariant']) != $constraintsCount">
+ <xsl:call-template name="CreateGenericParameterConstraints">
+ <xsl:with-param name="constraints" select="Constraints" />
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="CreateGenericParameterConstraints">
+ <xsl:param name="constraints" />
+
+ <br />
+ <xsl:text> where </xsl:text>
+ <xsl:value-of select="@Name" />
+ <xsl:text> : </xsl:text>
+ <xsl:variable name="kind"
+ select="count($constraints[ParameterAttribute='ReferenceTypeConstraint'])+
+ count($constraints[ParameterAttribute='NotNullableValueTypeConstraint'])" />
+ <xsl:variable name="base" select="count($constraints/BaseTypeName)" />
+ <xsl:variable name="iface" select="count($constraints/InterfaceName)" />
+ <xsl:variable name="struct" select="$constraints/ParameterAttribute='NotNullableValueTypeConstraint'" />
+ <xsl:if test="$constraints/ParameterAttribute='ReferenceTypeConstraint'">
+ <xsl:text>class</xsl:text>
+ </xsl:if>
+ <xsl:if test="$constraints/ParameterAttribute='NotNullableValueTypeConstraint'">
+ <xsl:text>struct</xsl:text>
+ </xsl:if>
+ <xsl:if test="$constraints/BaseTypeName and not($struct)">
+ <xsl:if test="$kind">, </xsl:if>
+ <xsl:apply-templates select="$constraints/BaseTypeName" mode="typelink" />
+ </xsl:if>
+ <xsl:for-each select="$constraints/InterfaceName">
+ <xsl:if test="position()=1">
+ <xsl:if test="$kind or $base">, </xsl:if>
+ </xsl:if>
+ <xsl:apply-templates select="." mode="typelink" />
+ <xsl:if test="not(position()=last())">, </xsl:if>
+ </xsl:for-each>
+ <xsl:if test="$constraints/ParameterAttribute='DefaultConstructorConstraint' and not($struct)">
+ <xsl:if test="$base or $iface">, </xsl:if>
+ <xsl:text>new()</xsl:text>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="CreateMemberOverview">
+ <xsl:param name="implemented" />
+
+ <p class="Summary">
+ <xsl:apply-templates select="Docs/summary" mode="notoppara"/>
+ <xsl:apply-templates select="Docs/summary" mode="editlink"/>
+ </p>
+
+ <xsl:if test="$implemented">
+ <p><b>Mono Implementation Note: </b></p>
+ <blockquote>
+ <xsl:value-of disable-output-escaping="yes" select="$implemented"/>
+ </blockquote>
+ </xsl:if>
+
+ <!-- member value -->
+ <xsl:if test="MemberValue">
+ <p><b>Value: </b>
+ <xsl:value-of select="MemberValue"/>
+ </p>
+ </xsl:if>
+
+ </xsl:template>
+
+ <xsl:template name="CreateRelatedSection">
+ <xsl:param name="section" />
+ <xsl:param name="type" />
+ <xsl:if test="count(Docs/related[@type=$type])">
+ <h3 class="{$type}"><xsl:value-of select="$section" /></h3>
+ <ul class="{$type}">
+ <xsl:for-each select="Docs/related[@type=$type]">
+ <li><a href="{@href}"><xsl:value-of select="." /></a></li>
+ </xsl:for-each>
+ </ul>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="CreatePlatformRequirements">
+ <!-- For now we only have that information in MonoTouch so only process that -->
+ <xsl:if test="starts-with(/Type/@FullName, 'MonoTouch')">
+ <xsl:choose>
+ <!-- We first check if we have a [Since] at the member level -->
+ <xsl:when test="count(Attributes/Attribute/AttributeName[starts-with(text(), 'MonoTouch.ObjCRuntime.Since')])">
+ <b>Minimum iOS version: </b>
+ <xsl:value-of select="translate(substring-before (substring-after (Attributes/Attribute/AttributeName[starts-with(text(), 'MonoTouch.ObjCRuntime.Since')], 'MonoTouch.ObjCRuntime.Since('), ')'), ', ', '.')" />
+ <br />
+ </xsl:when>
+ <!-- If not, we then check at the type level -->
+ <xsl:when test="count(/Type/Attributes/Attribute/AttributeName[starts-with(text(), 'MonoTouch.ObjCRuntime.Since')])">
+ <b>Minimum iOS version: </b>
+ <xsl:value-of select="translate(substring-before (substring-after (/Type/Attributes/Attribute/AttributeName[starts-with(text(), 'MonoTouch.ObjCRuntime.Since')], 'MonoTouch.ObjCRuntime.Since('), ')'), ', ', '.')" />
+ <br />
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="CreateMemberSignature">
+ <xsl:param name="linkid" select="''" />
+
+ <xsl:call-template name="CreateSignature">
+ <xsl:with-param name="content">
+ <xsl:if test="contains(MemberSignature[@Language='C#']/@Value,'this[')">
+ <p><i>This is the default property for this class.</i></p>
+ </xsl:if>
+
+ <!-- recreate the signature -->
+
+ <xsl:for-each select="Attributes/Attribute[AttributeName != 'System.Runtime.CompilerServices.Extension']">
+ <xsl:text>[</xsl:text>
+ <xsl:value-of select="AttributeName"/>
+ <xsl:text>]</xsl:text>
+ <br/>
+ </xsl:for-each>
+
+ <xsl:for-each select="ReturnValue/Attributes/Attribute">
+ <xsl:text>[return:</xsl:text>
+ <xsl:value-of select="AttributeName"/>
+ <xsl:text>]</xsl:text>
+ <br/>
+ </xsl:for-each>
+
+ <xsl:call-template name="getmodifiers">
+ <xsl:with-param name="sig" select="MemberSignature[@Language='C#']/@Value"/>
+ </xsl:call-template>
+
+ <xsl:if test="MemberType = 'Event'">
+ <xsl:text>event </xsl:text>
+
+ <xsl:if test="ReturnValue/ReturnType=''">
+ <xsl:value-of select="substring-before(substring-after(MemberSignature[@Language='C#']/@Value, 'event '), concat(' ', @MemberName))"/>
+ </xsl:if>
+ </xsl:if>
+
+ <!-- return value (comes out "" where not applicable/available) -->
+ <xsl:choose>
+ <xsl:when test="@MemberName='op_Implicit'">
+ <xsl:text>implicit operator</xsl:text>
+ </xsl:when>
+ <xsl:when test="@MemberName='op_Explicit'">
+ <xsl:text>explicit operator</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="ReturnValue/ReturnType" mode="typelink">
+ <xsl:with-param name="wrt" select="$TypeNamespace"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <!-- hard space -->
+ <xsl:value-of select="' '"/>
+
+ <!-- member name -->
+ <xsl:choose>
+
+ <!-- Constructors get the name of the class -->
+ <xsl:when test="MemberType='Constructor'">
+ <b>
+ <xsl:call-template name="GetConstructorName">
+ <xsl:with-param name="type" select="../.." />
+ <xsl:with-param name="ctor" select="." />
+ </xsl:call-template>
+ </b>
+ </xsl:when>
+
+ <!-- Conversion operators get the return type -->
+ <xsl:when test="@MemberName='op_Implicit' or @MemberName='op_Explicit'">
+ <xsl:apply-templates select="ReturnValue/ReturnType" mode="typelink">
+ <xsl:with-param name="wrt" select="$TypeNamespace"/>
+ </xsl:apply-templates>
+ </xsl:when>
+
+ <!-- Regular operators get their symbol -->
+ <xsl:when test="@MemberName='op_UnaryPlus'">operator+</xsl:when>
+ <xsl:when test="@MemberName='op_UnaryNegation'">operator-</xsl:when>
+ <xsl:when test="@MemberName='op_LogicalNot'">operator!</xsl:when>
+ <xsl:when test="@MemberName='op_OnesComplement'">operator~</xsl:when>
+ <xsl:when test="@MemberName='op_Increment'">operator++</xsl:when>
+ <xsl:when test="@MemberName='op_Decrement'">operator--</xsl:when>
+ <xsl:when test="@MemberName='op_True'">operator true</xsl:when>
+ <xsl:when test="@MemberName='op_False'">operator false</xsl:when>
+ <xsl:when test="@MemberName='op_Addition'">operator+</xsl:when>
+ <xsl:when test="@MemberName='op_Subtraction'">operator-</xsl:when>
+ <xsl:when test="@MemberName='op_Multiply'">operator*</xsl:when>
+ <xsl:when test="@MemberName='op_Division'">operator/</xsl:when>
+ <xsl:when test="@MemberName='op_Modulus'">operator%</xsl:when>
+ <xsl:when test="@MemberName='op_BitwiseAnd'">operator&</xsl:when>
+ <xsl:when test="@MemberName='op_BitwiseOr'">operator|</xsl:when>
+ <xsl:when test="@MemberName='op_ExclusiveOr'">operator^</xsl:when>
+ <xsl:when test="@MemberName='op_LeftShift'">operator<<</xsl:when>
+ <xsl:when test="@MemberName='op_RightShift'">operator>></xsl:when>
+ <xsl:when test="@MemberName='op_Equality'">operator==</xsl:when>
+ <xsl:when test="@MemberName='op_Inequality'">operator!=</xsl:when>
+ <xsl:when test="@MemberName='op_GreaterThan'">operator></xsl:when>
+ <xsl:when test="@MemberName='op_LessThan'">operator<</xsl:when>
+ <xsl:when test="@MemberName='op_GreaterThanOrEqual'">operator>=</xsl:when>
+ <xsl:when test="@MemberName='op_LessThanOrEqual'">operator<=</xsl:when>
+
+ <xsl:when test="MemberType='Property' and count(Parameters/Parameter) > 0">
+ <!-- C# only permits indexer properties to have arguments -->
+ <xsl:text>this</xsl:text>
+ </xsl:when>
+
+ <!-- Everything else just gets its name -->
+ <xsl:when test="contains (@MemberName, '<')">
+ <b>
+ <xsl:call-template name="GetDefinitionName">
+ <xsl:with-param name="name" select="@MemberName" />
+ <xsl:with-param name="TypeParameters" select="TypeParameters" />
+ </xsl:call-template>
+ </b>
+ </xsl:when>
+
+ <xsl:otherwise>
+ <b><xsl:value-of select="@MemberName"/></b>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <!-- hard space -->
+ <xsl:value-of select="' '"/>
+
+ <!-- argument list -->
+ <xsl:if test="MemberType='Method' or MemberType='Constructor' or (MemberType='Property' and count(Parameters/Parameter))">
+ <xsl:if test="not(MemberType='Property')">(</xsl:if>
+ <xsl:if test="MemberType='Property'">[</xsl:if>
+
+ <xsl:for-each select="Parameters/Parameter">
+ <xsl:call-template name="ShowParameter">
+ <xsl:with-param name="Param" select="."/>
+ <xsl:with-param name="TypeNamespace" select="$TypeNamespace"/>
+ </xsl:call-template>
+
+ <xsl:if test="not(position()=last())">, </xsl:if>
+ </xsl:for-each>
+ <xsl:if test="not(MemberType='Property')">)</xsl:if>
+ <xsl:if test="MemberType='Property'">]</xsl:if>
+ </xsl:if>
+
+ <xsl:if test="MemberType='Property'">
+ <xsl:value-of select="' '"/>
+ <xsl:text>{</xsl:text>
+ <xsl:value-of select="substring-before(substring-after(MemberSignature[@Language='C#']/@Value, '{'), '}')"/>
+ <xsl:text>}</xsl:text>
+ </xsl:if>
+ <xsl:call-template name="CreateGenericConstraints">
+ <xsl:with-param name="TypeParameters" select="TypeParameters" />
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+
+ </xsl:template>
+
+ <xsl:template name="GetConstructorName">
+ <xsl:param name="type" />
+ <xsl:param name="ctor" />
+
+ <xsl:choose>
+ <xsl:when test="contains($type/@Name, '<')">
+ <xsl:value-of select="translate (substring-before ($type/@Name, '<'), '+', '.')" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="translate ($type/@Name, '+', '.')" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="ShowParameter">
+ <xsl:param name="Param"/>
+ <xsl:param name="TypeNamespace"/>
+ <xsl:param name="prototype" select="false()"/>
+
+ <xsl:if test="not($prototype)">
+ <xsl:for-each select="$Param/Attributes/Attribute[not(Exclude='1') and not(AttributeName='ParamArrayAttribute' or AttributeName='System.ParamArray')]">
+ <xsl:text>[</xsl:text>
+ <xsl:value-of select="AttributeName"/>
+ <xsl:text>]</xsl:text>
+ <xsl:value-of select="' '"/>
+ </xsl:for-each>
+ </xsl:if>
+
+ <xsl:if test="count($Param/Attributes/Attribute/AttributeName[.='ParamArrayAttribute' or .='System.ParamArray'])">
+ <b>params</b>
+ <xsl:value-of select="' '"/>
+ </xsl:if>
+
+ <xsl:if test="$Param/@RefType">
+ <i><xsl:value-of select="$Param/@RefType"/></i>
+ <!-- hard space -->
+ <xsl:value-of select="' '"/>
+ </xsl:if>
+
+ <!-- parameter type link -->
+ <xsl:apply-templates select="$Param/@Type" mode="typelink">
+ <xsl:with-param name="wrt" select="$TypeNamespace"/>
+ </xsl:apply-templates>
+
+ <xsl:if test="not($prototype)">
+ <!-- hard space -->
+ <xsl:value-of select="' '"/>
+
+ <!-- parameter name -->
+ <xsl:value-of select="$Param/@Name"/>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="DisplayDocsInformation">
+ <xsl:param name="linkid" />
+
+ <!-- The namespace that the current type belongs to. -->
+ <xsl:variable name="TypeNamespace" select="substring(@FullName, 1, string-length(@FullName) - string-length(@Name) - 1)"/>
+
+ <!-- alt member: not sure what these are for, actually -->
+
+ <xsl:if test="count(Docs/altmember)">
+ <xsl:call-template name="CreateH4Section">
+ <xsl:with-param name="name" select="'See Also'"/>
+ <xsl:with-param name="child-id" select="concat ($linkid, ':See Also')" />
+ <xsl:with-param name="content">
+ <xsl:for-each select="Docs/altmember">
+ <div><xsl:apply-templates select="@cref" mode="cref"/></div>
+ </xsl:for-each>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:if>
+
+ <!-- parameters & return & value -->
+
+ <xsl:if test="count(Docs/typeparam)">
+ <xsl:call-template name="CreateH4Section">
+ <xsl:with-param name="name" select="'Type Parameters'"/>
+ <xsl:with-param name="child-id" select="concat ($linkid, ':Type Parameters')" />
+ <xsl:with-param name="content">
+ <dl>
+ <xsl:for-each select="Docs/typeparam">
+ <dt><i><xsl:value-of select="@name"/></i></dt>
+ <dd>
+ <xsl:apply-templates select="." mode="notoppara"/>
+ <xsl:apply-templates select="." mode="editlink"/>
+ </dd>
+ </xsl:for-each>
+ </dl>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="count(Docs/param)">
+ <xsl:call-template name="CreateH4Section">
+ <xsl:with-param name="name" select="'Parameters'"/>
+ <xsl:with-param name="child-id" select="concat ($linkid, ':Parameters')" />
+ <xsl:with-param name="content">
+ <dl>
+ <xsl:for-each select="Docs/param">
+ <dt><i><xsl:value-of select="@name"/></i></dt>
+ <dd>
+ <xsl:apply-templates select="." mode="notoppara"/>
+ <xsl:apply-templates select="." mode="editlink"/>
+ </dd>
+ </xsl:for-each>
+ </dl>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="count(Docs/returns)">
+ <xsl:call-template name="CreateH4Section">
+ <xsl:with-param name="name" select="'Returns'"/>
+ <xsl:with-param name="child-id" select="concat ($linkid, ':Returns')" />
+ <xsl:with-param name="content">
+ <xsl:apply-templates select="Docs/returns" mode="notoppara"/>
+ <xsl:apply-templates select="Docs/returns" mode="editlink"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="count(Docs/value)">
+ <xsl:call-template name="CreateH4Section">
+ <xsl:with-param name="name" select="'Value'"/>
+ <xsl:with-param name="child-id" select="concat ($linkid, ':Value')" />
+ <xsl:with-param name="content">
+ <xsl:apply-templates select="Docs/value" mode="notoppara"/>
+ <xsl:apply-templates select="Docs/value" mode="editlink"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:if>
+
+ <!-- method/property/constructor exceptions -->
+
+ <xsl:if test="count(Docs/exception)">
+ <xsl:call-template name="CreateH4Section">
+ <xsl:with-param name="name" select="'Exceptions'"/>
+ <xsl:with-param name="child-id" select="concat ($linkid, ':Exceptions')" />
+ <xsl:with-param name="content">
+ <xsl:call-template name="CreateTypeDocumentationTable">
+ <xsl:with-param name="content">
+ <xsl:for-each select="Docs/exception">
+ <tr valign="top">
+ <td>
+ <xsl:apply-templates select="@cref" mode="typelink">
+ <xsl:with-param name="wrt" select="$TypeNamespace"/>
+ </xsl:apply-templates>
+ </td>
+ <td>
+ <xsl:apply-templates select="." mode="notoppara"/>
+ <xsl:apply-templates select="." mode="editlink"/>
+ </td>
+ </tr>
+ </xsl:for-each>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:if>
+
+ <!-- remarks -->
+
+ <xsl:if test="count(Docs/remarks)">
+ <xsl:call-template name="CreateH2Section">
+ <xsl:with-param name="name" select="'Remarks'"/>
+ <xsl:with-param name="child-id" select="concat ($linkid, ':Remarks')" />
+ <xsl:with-param name="content">
+ <xsl:apply-templates select="Docs/remarks" mode="notoppara"/>
+ <xsl:apply-templates select="Docs/remarks" mode="editlink"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:if>
+
+ <!-- thread safety -->
+
+ <xsl:if test="count(ThreadingSafetyStatement)">
+ <xsl:call-template name="CreateH2Section">
+ <xsl:with-param name="name" select="'Thread Safety'"/>
+ <xsl:with-param name="child-id" select="concat ($linkid, ':Thread Safety')" />
+ <xsl:with-param name="content">
+ <xsl:apply-templates select="ThreadingSafetyStatement" mode="notoppara"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:if>
+
+
+ <!-- permissions -->
+
+ <xsl:if test="count(Docs/permission)">
+ <xsl:call-template name="CreateH2Section">
+ <xsl:with-param name="name" select="'Permissions'"/>
+ <xsl:with-param name="child-id" select="concat ($linkid, ':Permissions')" />
+ <xsl:with-param name="content">
+ <xsl:call-template name="CreateTypeDocumentationTable">
+ <xsl:with-param name="content">
+ <xsl:for-each select="Docs/permission">
+ <tr valign="top">
+ <td>
+ <xsl:apply-templates select="@cref" mode="typelink">
+ <xsl:with-param name="wrt" select="$TypeNamespace"/>
+ </xsl:apply-templates>
+ <xsl:apply-templates select="." mode="editlink"/>
+ </td>
+ <td>
+ <xsl:apply-templates select="." mode="notoppara"/>
+ </td>
+ </tr>
+ </xsl:for-each>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:if>
+
+ <!-- enumeration values -->
+
+ <xsl:if test="Base/BaseTypeName = 'System.Enum'">
+ <xsl:call-template name="CreateH2Section">
+ <xsl:with-param name="name" select="'Members'"/>
+ <xsl:with-param name="child-id" select="concat ($linkid, ':Members')" />
+ <xsl:with-param name="content">
+ <xsl:call-template name="CreateEnumerationTable">
+ <xsl:with-param name="content">
+
+ <xsl:for-each select="Members/Member[MemberType='Field']">
+ <xsl:if test="not(@MemberName='value__')">
+ <tr valign="top"><td>
+ <xsl:attribute name="id">
+ <xsl:text>F:</xsl:text>
+ <xsl:value-of select="translate (/Type/@FullName, '+', '.')" />
+ <xsl:text>.</xsl:text>
+ <xsl:value-of select="@MemberName" />
+ </xsl:attribute>
+ <b>
+ <xsl:value-of select="@MemberName"/>
+ </b>
+ </td>
+ <td>
+ <xsl:apply-templates select="Docs/summary" mode="notoppara"/>
+ <xsl:apply-templates select="Docs/summary" mode="editlink"/>
+ </td>
+ </tr>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:if>
+
+ <!-- examples -->
+
+ <xsl:if test="count(Docs/example)">
+ <xsl:for-each select="Docs/example">
+ <xsl:call-template name="CreateH2Section">
+ <xsl:with-param name="name" select="'Example'"/>
+ <xsl:with-param name="child-id" select="concat ($linkid, ':Example:', position())" />
+ <xsl:with-param name="content">
+ <xsl:apply-templates select="." mode="notoppara"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:if>
+
+ <!-- related content -->
+ <xsl:if test="count(Docs/related)">
+ <xsl:call-template name="CreateH2Section">
+ <xsl:with-param name="name" select="'Related content'" />
+ <xsl:with-param name="child-id" select="concat ($linkid, ':Related:')" />
+ <xsl:with-param name="content">
+ <div class="related">
+ <xsl:call-template name="CreateRelatedSection">
+ <xsl:with-param name="section" select="'Articles'" />
+ <xsl:with-param name="type" select="'article'" />
+ </xsl:call-template>
+ <xsl:call-template name="CreateRelatedSection">
+ <xsl:with-param name="section" select="'Available Samples'" />
+ <xsl:with-param name="type" select="'sample'" />
+ </xsl:call-template>
+ <xsl:call-template name="CreateRelatedSection">
+ <xsl:with-param name="section" select="'Related specifications'" />
+ <xsl:with-param name="type" select="'specification'" />
+ </xsl:call-template>
+ <xsl:call-template name="CreateRelatedSection">
+ <xsl:with-param name="section" select="'External Documentation'" />
+ <xsl:with-param name="type" select="'externalDocumentation'" />
+ </xsl:call-template>
+ </div>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:if>
+
+ <xsl:call-template name="CreateH2Section">
+ <xsl:with-param name="name" select="'Requirements'"/>
+ <xsl:with-param name="child-id" select="concat ($linkid, ':Version Information')" />
+ <xsl:with-param name="content">
+ <xsl:call-template name="CreatePlatformRequirements" />
+ <b>Namespace: </b><xsl:value-of select="substring(/Type/@FullName, 1, string-length(/Type/@FullName) - string-length(/Type/@Name) - 1)" />
+ <xsl:if test="count(/Type/AssemblyInfo/AssemblyName) > 0">
+ <br />
+ <b>Assembly: </b>
+ <xsl:value-of select="/Type/AssemblyInfo/AssemblyName" />
+ <xsl:text> (in </xsl:text>
+ <xsl:value-of select="/Type/AssemblyInfo/AssemblyName" />
+ <xsl:text>.dll)</xsl:text>
+ </xsl:if>
+ <xsl:if test="count(AssemblyInfo/AssemblyVersion) > 0">
+ <br />
+ <b>Assembly Versions: </b>
+ <xsl:for-each select="AssemblyInfo/AssemblyVersion">
+ <xsl:if test="not(position()=1)">, </xsl:if>
+ <xsl:value-of select="."/>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="count(Docs/since) > 0">
+ <br />
+ <b>Since: </b>
+ <xsl:for-each select="Docs/since">
+ <xsl:if test="not(position()=1)">; </xsl:if>
+ <xsl:value-of select="@version"/>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="count(Docs/since)=0 and count(/Type/Docs/since) > 0">
+ <br />
+ <b>Since: </b>
+ <xsl:for-each select="/Type/Docs/since">
+ <xsl:if test="not(position()=1)">; </xsl:if>
+ <xsl:value-of select="@version"/>
+ </xsl:for-each>
+ </xsl:if>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:template>
+
+
+ <!-- Transforms the contents of the selected node into a hyperlink to the type named by the node. The node can contain a type name (eg System.Object) or a type link (eg T:System.String). Use wrt parameter to specify the current namespace. -->
+
+ <xsl:template match="*|@*" mode="typelink">
+ <xsl:param name="wrt" select="'notset'"/>
+
+ <xsl:call-template name="maketypelink">
+ <xsl:with-param name="type" select="."/>
+ <xsl:with-param name="wrt" select="$wrt"/>
+ </xsl:call-template>
+ </xsl:template>
+
+ <xsl:template name="makenamespacelink">
+ <xsl:param name="cref" select="''"/>
+
+ <a>
+ <xsl:attribute name="href">
+ <xsl:call-template name="GetLinkTargetHtml">
+ <xsl:with-param name="cref" select="$cref" />
+ </xsl:call-template>
+ </xsl:attribute>
+
+ <xsl:value-of select="substring-after ($cref, 'N:')" />
+ </a>
+ </xsl:template>
+
+ <xsl:template name="maketypelink">
+ <xsl:param name="type" select="'notset'"/>
+ <xsl:param name="wrt" select="'notset'"/>
+ <xsl:param name="nested" select="0"/>
+
+ <xsl:variable name="btype">
+ <xsl:call-template name="ToBrackets">
+ <xsl:with-param name="s" select="$type" />
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="array">
+ <xsl:call-template name="GetArraySuffix">
+ <xsl:with-param name="type" select="$type" />
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:choose>
+
+ <!-- chop off T: -->
+ <xsl:when test="starts-with($type, 'T:')">
+ <xsl:call-template name="maketypelink">
+ <xsl:with-param name="type" select="substring($type, 3)"/>
+ <xsl:with-param name="wrt" select="$wrt"/>
+ </xsl:call-template>
+ </xsl:when>
+
+ <xsl:when test="contains ($type, '&') and
+ '&' = substring ($type, string-length ($type), 1)">
+ <xsl:call-template name="maketypelink">
+ <xsl:with-param name="type" select="substring($type, 1, string-length($type)-1)"/>
+ <xsl:with-param name="wrt" select="$wrt"/>
+ </xsl:call-template>
+ </xsl:when>
+
+ <xsl:when test="string($array)">
+ <xsl:call-template name="maketypelink">
+ <xsl:with-param name="type" select="substring($type, 1, string-length($type) - string-length ($array))"/>
+ <xsl:with-param name="wrt" select="$wrt"/>
+ </xsl:call-template>
+ <xsl:value-of select="$array"/>
+ </xsl:when>
+
+ <xsl:when test="contains ($type, '*') and
+ '*' = substring ($type, string-length ($type), 1)">
+ <xsl:call-template name="maketypelink">
+ <xsl:with-param name="type" select="substring($type, 1, string-length($type)-1)"/>
+ <xsl:with-param name="wrt" select="$wrt"/>
+ </xsl:call-template>
+ <xsl:value-of select="'*'"/>
+ </xsl:when>
+
+ <!-- if this is a generic type parameter, don't make a link but italicize it and give it a tooltip instead -->
+ <xsl:when test="count($ThisType/TypeParameters/TypeParameter[@Name=$type] |
+ $ThisType/TypeParameters/TypeParameter[child::text()=$type] |
+ ancestor::Member/Docs/typeparam[@name=$type]) = 1">
+ <!-- note that we check if it is a generic type using /Type/TypeParameters because that will have type parameters declared in an outer class if this is a nested class, but then we get the tooltip text from the type parameters documented in this file -->
+ <i title="{$ThisType/Docs/typeparam[@name=$type] | ancestor::Member/Docs/typeparam[@name=$type]}"><xsl:value-of select="$type"/></i>
+ </xsl:when>
+
+ <!-- if this is a generic type parameter of a base type, replace it with the type that it was instantiated with -->
+ <xsl:when test="count(ancestor::Members/BaseTypeArgument[@TypeParamName=$type]) = 1">
+ <!-- note that an overridden type parameter may be referenced in a type parameter within $type, but we can't replace that nicely since we can't parse generic type names here -->
+ <xsl:call-template name="maketypelink">
+ <xsl:with-param name="type" select="ancestor::Members/BaseTypeArgument[@TypeParamName=$type]"/>
+ <xsl:with-param name="wrt" select="$wrt"/>
+ </xsl:call-template>
+ </xsl:when>
+
+
+ <xsl:otherwise>
+ <xsl:variable name="escaped-type">
+ <xsl:call-template name="GetEscapedTypeName">
+ <xsl:with-param name="typename" select="$btype" />
+ </xsl:call-template>
+ </xsl:variable>
+ <a>
+ <xsl:attribute name="href">
+ <xsl:call-template name="GetLinkTargetHtml">
+ <xsl:with-param name="type" select="$escaped-type" />
+ <xsl:with-param name="cref" select="concat ('T:', $escaped-type)" />
+ </xsl:call-template>
+ </xsl:attribute>
+
+ <xsl:call-template name="GetTypeDisplayName">
+ <xsl:with-param name="T" select="$btype"/>
+ <xsl:with-param name="wrt" select="$wrt"/>
+ </xsl:call-template>
+ </a>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="GetArraySuffix">
+ <xsl:param name="type" />
+
+ <xsl:if test="contains ($type, ']') and
+ ']' = substring ($type, string-length ($type), 1)">
+ <xsl:variable name="start">
+ <xsl:call-template name="GetArraySuffixStart">
+ <xsl:with-param name="type" select="$type" />
+ <xsl:with-param name="i" select="string-length ($type) - 1" />
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="substring ($type, $start)" />
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="GetArraySuffixStart">
+ <xsl:param name="type" />
+ <xsl:param name="i" />
+
+ <xsl:choose>
+ <xsl:when test="substring ($type, $i, 1) = '['">
+ <xsl:value-of select="$i" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="GetArraySuffixStart">
+ <xsl:with-param name="type" select="$type" />
+ <xsl:with-param name="i" select="$i - 1" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="GetTypeDisplayName">
+ <xsl:param name="T"/>
+ <xsl:param name="wrt"/>
+
+ <!-- use C#-style names -->
+ <xsl:choose>
+ <xsl:when test="$T='System.Object'">object</xsl:when>
+ <xsl:when test="$T='System.Boolean'">bool</xsl:when>
+ <xsl:when test="$T='System.Byte'">byte</xsl:when>
+ <xsl:when test="$T='System.Char'">char</xsl:when>
+ <xsl:when test="$T='System.Decimal'">decimal</xsl:when>
+ <xsl:when test="$T='System.Double'">double</xsl:when>
+ <xsl:when test="$T='System.Int16'">short</xsl:when>
+ <xsl:when test="$T='System.Int32'">int</xsl:when>
+ <xsl:when test="$T='System.Int64'">long</xsl:when>
+ <xsl:when test="$T='System.SByte'">sbyte</xsl:when>
+ <xsl:when test="$T='System.Single'">float</xsl:when>
+ <xsl:when test="$T='System.String'">string</xsl:when>
+ <xsl:when test="$T='System.UInt16'">ushort</xsl:when>
+ <xsl:when test="$T='System.UInt32'">uint</xsl:when>
+ <xsl:when test="$T='System.UInt64'">ulong</xsl:when>
+ <xsl:when test="$T='System.Void'">void</xsl:when>
+
+ <xsl:when test="contains($T, '<')">
+ <xsl:call-template name="GetTypeDisplayName">
+ <xsl:with-param name="T" select="substring-before ($T, '<')" />
+ <xsl:with-param name="wrt" select="$wrt" />
+ </xsl:call-template>
+ <xsl:text><</xsl:text>
+ <xsl:call-template name="GetMemberArgList">
+ <xsl:with-param name="arglist" select="substring-after ($T, '<')" />
+ <xsl:with-param name="wrt" select="$wrt" />
+ </xsl:call-template>
+ <!-- don't need to append > as GetMemberArgList (eventually) appends it -->
+ </xsl:when>
+
+ <!-- if the type is in the wrt namespace, omit the namespace name -->
+ <xsl:when test="not($wrt='') and starts-with($T, concat($wrt,'.')) and not(contains(substring-after($T,concat($wrt,'.')), '.'))">
+ <xsl:value-of select="translate (substring-after($T,concat($wrt,'.')), '+', '.')"/>
+ </xsl:when>
+
+ <!-- if the type is in the System namespace, omit the namespace name -->
+ <xsl:when test="starts-with($T, 'System.') and not(contains(substring-after($T, 'System.'), '.'))">
+ <xsl:value-of select="translate (substring-after($T,'System.'), '+', '.')"/>
+ </xsl:when>
+
+ <!-- if the type is in the System.Collections namespace, omit the namespace name -->
+ <xsl:when test="starts-with($T, 'System.Collections.') and not(contains(substring-after($T, 'System.Collections.'), '.'))">
+ <xsl:value-of select="translate (substring-after($T,'System.Collections.'), '+', '.')"/>
+ </xsl:when>
+
+ <!-- if the type is in the System.Collections.Generic namespace, omit the namespace name -->
+ <xsl:when test="starts-with($T, 'System.Collections.Generic.') and not(contains(substring-after($T, 'System.Collections.Generic.'), '.'))">
+ <xsl:value-of select="translate (substring-after($T,'System.Collections.Generic.'), '+', '.')"/>
+ </xsl:when>
+
+ <xsl:otherwise>
+ <xsl:value-of select="translate ($T, '+', '.')" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="GetMemberDisplayName">
+ <xsl:param name="memberName" />
+ <xsl:param name="isproperty" select="false()" />
+
+ <xsl:choose>
+ <xsl:when test="contains($memberName, '.')">
+ <xsl:call-template name="GetTypeDisplayName">
+ <xsl:with-param name="T">
+ <xsl:call-template name="GetTypeName">
+ <xsl:with-param name="type" select="$memberName"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="wrt" select="''" />
+ </xsl:call-template>
+ <xsl:text>.</xsl:text>
+ <xsl:call-template name="GetMemberName">
+ <xsl:with-param name="type" select="$memberName" />
+ <xsl:with-param name="isproperty" select="$isproperty"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$memberName" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="ToBrackets">
+ <xsl:param name="s" />
+ <xsl:value-of select="translate (translate ($s, '{', '<'), '}', '>')" />
+ </xsl:template>
+
+ <xsl:template name="ToBraces">
+ <xsl:param name="s" />
+ <xsl:value-of select="translate (translate ($s, '<', '{'), '>', '}')" />
+ </xsl:template>
+
+ <xsl:template name="memberlinkprefix">
+ <xsl:param name="member" />
+ <xsl:choose>
+ <xsl:when test="$member/MemberType='Constructor'">C</xsl:when>
+ <xsl:when test="$member/MemberType='Method'">M</xsl:when>
+ <xsl:when test="$member/MemberType='Property'">P</xsl:when>
+ <xsl:when test="$member/MemberType='Field'">F</xsl:when>
+ <xsl:when test="$member/MemberType='Event'">E</xsl:when>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="makememberlink">
+ <xsl:param name="cref"/>
+
+ <xsl:variable name="bcref">
+ <xsl:call-template name="ToBrackets">
+ <xsl:with-param name="s" select="$cref" />
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="fullname">
+ <xsl:choose>
+ <xsl:when test="starts-with($bcref, 'C:') or starts-with($bcref, 'T:')">
+ <xsl:choose>
+ <xsl:when test="contains($bcref, '(')">
+ <xsl:value-of select="substring (substring-before ($bcref, '('), 3)" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring($bcref, 3)" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="GetTypeName">
+ <xsl:with-param name="type" select="substring($bcref, 3)"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:variable name="memberName">
+ <xsl:choose>
+ <xsl:when test="starts-with($bcref, 'T:')" />
+ <xsl:when test="starts-with($bcref, 'C:') and not(contains($bcref, '('))" />
+ <xsl:when test="starts-with($bcref, 'C:') and contains($bcref, '(')">
+ <xsl:text>(</xsl:text>
+ <xsl:call-template name="GetMemberArgList">
+ <xsl:with-param name="arglist" select="substring-before(substring-after($bcref, '('), ')')" />
+ <xsl:with-param name="wrt" select="$TypeNamespace" />
+ </xsl:call-template>
+ <xsl:text>)</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>.</xsl:text>
+ <xsl:call-template name="GetMemberName">
+ <xsl:with-param name="type" select="substring($bcref, 3)" />
+ <xsl:with-param name="wrt" select="$fullname"/>
+ <xsl:with-param name="isproperty" select="starts-with($bcref, 'P:')"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:variable name="escaped-type">
+ <xsl:call-template name="GetEscapedTypeName">
+ <xsl:with-param name="typename">
+ <xsl:call-template name="ToBrackets">
+ <xsl:with-param name="s" select="$fullname" />
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="displayname">
+ <xsl:call-template name="GetTypeDisplayName">
+ <xsl:with-param name="T" select="$fullname" />
+ <xsl:with-param name="wrt" select="$TypeNamespace"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <a>
+ <xsl:attribute name="href">
+ <xsl:call-template name="GetLinkTargetHtml">
+ <xsl:with-param name="type" select="$escaped-type" />
+ <xsl:with-param name="cref">
+ <xsl:call-template name="ToBraces">
+ <xsl:with-param name="s" select="$cref" />
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:value-of select="translate (concat($displayname, $memberName), '+', '.')" />
+ </a>
+ </xsl:template>
+
+ <xsl:template name="GetTypeName">
+ <xsl:param name="type" />
+ <xsl:variable name="prefix" select="substring-before($type, '.')" />
+ <xsl:variable name="suffix" select="substring-after($type, '.')" />
+ <xsl:choose>
+ <xsl:when test="contains($type, '(')">
+ <xsl:call-template name="GetTypeName">
+ <xsl:with-param name="type" select="substring-before($type, '(')" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="not(contains($suffix, '.'))">
+ <xsl:value-of select="$prefix" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$prefix" />
+ <xsl:text>.</xsl:text>
+ <xsl:call-template name="GetTypeName">
+ <xsl:with-param name="type" select="$suffix" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="GetMemberName">
+ <xsl:param name="type" />
+ <xsl:param name="isproperty" select="0"/>
+ <xsl:variable name="prefix" select="substring-before($type, '.')" />
+ <xsl:variable name="suffix" select="substring-after($type, '.')" />
+ <xsl:choose>
+ <xsl:when test="contains($type, '(')">
+ <xsl:call-template name="GetMemberName">
+ <xsl:with-param name="type" select="substring-before($type, '(')" />
+ </xsl:call-template>
+ <xsl:text>(</xsl:text>
+ <xsl:call-template name="GetMemberArgList">
+ <xsl:with-param name="arglist" select="substring-before(substring-after($type, '('), ')')" />
+ <xsl:with-param name="wrt" select="$TypeNamespace" />
+ </xsl:call-template>
+ <xsl:text>)</xsl:text>
+ </xsl:when>
+ <xsl:when test="not(contains($suffix, '.'))">
+ <xsl:value-of select="$suffix" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="GetMemberName">
+ <xsl:with-param name="type" select="$suffix" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="GetMemberArgList">
+ <xsl:param name="arglist" />
+ <xsl:param name="wrt" select="''"/>
+
+ <xsl:variable name="_arglist">
+ <xsl:choose>
+ <xsl:when test="starts-with ($arglist, ',')">
+ <xsl:value-of select="substring-after ($arglist, ',')" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$arglist" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:if test="starts-with ($arglist, ',')">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+
+ <xsl:variable name="c" select="substring-before ($_arglist, ',')" />
+ <xsl:variable name="lt" select="substring-before ($_arglist, '<')" />
+ <xsl:variable name="gt" select="substring-before ($_arglist, '>')" />
+
+ <xsl:choose>
+ <!-- Need to insert ',' between type arguments -->
+ <xsl:when test="
+ ($c != '' and $lt != '' and $gt != '' and
+ string-length ($c) < string-length ($lt) and
+ string-length ($c) < string-length ($gt)) or
+ ($c != '' and $lt != '' and $gt = '' and
+ string-length ($c) < string-length ($lt)) or
+ ($c != '' and $lt = '' and $gt != '' and
+ string-length ($c) < string-length ($gt)) or
+ ($c != '' and $lt = '' and $gt = '')">
+ <xsl:call-template name="GetTypeDisplayName">
+ <xsl:with-param name="T" select="$c"/>
+ <xsl:with-param name="wrt" select="$wrt"/>
+ </xsl:call-template>
+ <xsl:text>, </xsl:text>
+ <xsl:call-template name="GetMemberArgList">
+ <xsl:with-param name="arglist" select="substring-after($_arglist, ',')" />
+ <xsl:with-param name="wrt" select="$wrt" />
+ </xsl:call-template>
+ </xsl:when>
+
+ <!-- start of nested type argument list < -->
+ <xsl:when test="
+ ($c != '' and $lt != '' and $gt != '' and
+ string-length ($lt) < string-length ($c) and
+ string-length ($lt) < string-length ($gt)) or
+ ($c != '' and $lt != '' and $gt = '' and
+ string-length ($lt) < string-length ($c)) or
+ ($c = '' and $lt != '' and $gt != '' and
+ string-length ($lt) < string-length ($gt))">
+ <xsl:call-template name="GetTypeDisplayName">
+ <xsl:with-param name="T" select="$lt"/>
+ <xsl:with-param name="wrt" select="$wrt"/>
+ </xsl:call-template>
+ <xsl:text><</xsl:text>
+ <xsl:call-template name="GetMemberArgList">
+ <xsl:with-param name="arglist" select="substring-after($_arglist, '<')" />
+ <xsl:with-param name="wrt" select="$wrt" />
+ </xsl:call-template>
+ </xsl:when>
+
+ <!-- end of (nested?) type argument list > -->
+ <xsl:when test="
+ ($c != '' and $lt != '' and $gt != '' and
+ string-length ($gt) < string-length ($c) and
+ string-length ($gt) < string-length ($lt)) or
+ ($c != '' and $lt = '' and $gt = '' and
+ string-length ($gt) < string-length ($c)) or
+ ($c = '' and $lt != '' and $gt != '' and
+ string-length ($gt) < string-length ($lt)) or
+ ($c = '' and $lt = '' and $gt != '')">
+ <xsl:call-template name="GetTypeDisplayName">
+ <xsl:with-param name="T" select="$gt"/>
+ <xsl:with-param name="wrt" select="$wrt"/>
+ </xsl:call-template>
+ <xsl:text>></xsl:text>
+ <xsl:call-template name="GetMemberArgList">
+ <xsl:with-param name="arglist" select="substring-after($_arglist, '>')" />
+ <xsl:with-param name="wrt" select="$wrt" />
+ </xsl:call-template>
+ </xsl:when>
+
+ <!-- nothing left to do -->
+ <xsl:otherwise>
+ <xsl:call-template name="GetTypeDisplayName">
+ <xsl:with-param name="T" select="$_arglist"/>
+ <xsl:with-param name="wrt" select="$wrt"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- Transforms the contents of the selected node containing a cref into a hyperlink. -->
+ <xsl:template match="*|@*" mode="cref">
+ <xsl:call-template name="makememberlink">
+ <xsl:with-param name="cref" select="."/>
+ </xsl:call-template>
+ <!--
+ <a>
+ <xsl:attribute name="href"><xsl:value-of select="."/></xsl:attribute>
+ <xsl:value-of select="substring-after(., ':')"/></a>
+ -->
+ </xsl:template>
+
+ <xsl:template name="membertypeplural">
+ <xsl:param name="name"/>
+ <xsl:choose>
+ <xsl:when test="$name='ExtensionMethod'">Extension Methods</xsl:when>
+ <xsl:when test="$name='Constructor'">Constructors</xsl:when>
+ <xsl:when test="$name='Property'">Properties</xsl:when>
+ <xsl:when test="$name='Method'">Methods</xsl:when>
+ <xsl:when test="$name='Field'">Fields</xsl:when>
+ <xsl:when test="$name='Event'">Events</xsl:when>
+ <xsl:when test="$name='Operator'">Operators</xsl:when>
+ <xsl:when test="$name='Explicit'">Explicitly Implemented Interface Members</xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="membertypeplurallc">
+ <xsl:param name="name"/>
+ <xsl:choose>
+ <xsl:when test="$name='ExtensionMethod'">extension methods</xsl:when>
+ <xsl:when test="$name='Constructor'">constructors</xsl:when>
+ <xsl:when test="$name='Property'">properties</xsl:when>
+ <xsl:when test="$name='Method'">methods</xsl:when>
+ <xsl:when test="$name='Field'">fields</xsl:when>
+ <xsl:when test="$name='Event'">events</xsl:when>
+ <xsl:when test="$name='Operator'">operators</xsl:when>
+ <xsl:when test="$name='Explicit'">explicitly implemented interface members</xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="gettypetype">
+ <xsl:variable name="sig" select="concat(' ', TypeSignature[@Language='C#']/@Value, ' ')"/>
+ <xsl:choose>
+ <xsl:when test="contains($sig,'class')">Class</xsl:when>
+ <xsl:when test="contains($sig,'enum')">Enumeration</xsl:when>
+ <xsl:when test="contains($sig,'struct')">Structure</xsl:when>
+ <xsl:when test="contains($sig,'delegate')">Delegate</xsl:when>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- Ensures that the resuting node is not surrounded by a para tag. -->
+ <xsl:template match="*|@*" mode="editlink">
+ <xsl:call-template name="CreateEditLink">
+ <xsl:with-param name="e" select="." />
+ </xsl:call-template>
+ </xsl:template>
+
+ <xsl:template match="*" mode="notoppara">
+ <xsl:choose>
+ <xsl:when test="starts-with (string(.), 'To be added')">
+ <span class="NotEntered">Documentation for this section has not yet been entered.</span>
+ </xsl:when>
+ <xsl:when test="count(*) = 1 and count(para)=1">
+ <xsl:apply-templates select="para/node()"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="para">
+ <p>
+ <xsl:apply-templates/>
+ </p>
+ </xsl:template>
+
+ <xsl:template match="paramref">
+ <i><xsl:value-of select="@name"/>
+ <xsl:apply-templates/>
+ </i>
+ </xsl:template>
+
+ <xsl:template match="typeparamref">
+ <i><xsl:value-of select="@name"/>
+ <xsl:apply-templates/>
+ </i>
+ </xsl:template>
+
+ <xsl:template match="block[@type='note']">
+ <div>
+ <i>Note: </i>
+ <xsl:apply-templates/>
+ </div>
+ </xsl:template>
+ <xsl:template match="block[@type='behaviors']">
+ <h5 class="Subsection">Operation</h5>
+ <xsl:apply-templates/>
+ </xsl:template>
+ <xsl:template match="block[@type='overrides']">
+ <h5 class="Subsection">Note to Inheritors</h5>
+ <xsl:apply-templates/>
+ </xsl:template>
+ <xsl:template match="block[@type='usage']">
+ <h5 class="Subsection">Usage</h5>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="c">
+ <tt>
+ <xsl:apply-templates/>
+ </tt>
+ </xsl:template>
+ <xsl:template match="c//para">
+ <xsl:apply-templates/><br/>
+ </xsl:template>
+
+ <xsl:template match="code">
+ <xsl:call-template name="CreateCodeBlock">
+ <xsl:with-param name="language" select="@lang" />
+ <xsl:with-param name="content" select="string(descendant-or-self::text())" />
+ </xsl:call-template>
+ </xsl:template>
+ <xsl:template match="img">
+ <p>
+ <img src="source-id:{$source-id}:{@href}">
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when test="count(@class)>0">
+ <xsl:value-of select="@class" />
+ </xsl:when>
+ <xsl:otherwise>picture</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </img>
+ </p>
+ </xsl:template>
+
+ <xsl:template match="onequarter">¼</xsl:template>
+ <xsl:template match="pi">π</xsl:template>
+ <xsl:template match="theta">θ</xsl:template>
+ <xsl:template match="leq">≤</xsl:template>
+ <xsl:template match="geq">≥</xsl:template>
+ <xsl:template match="subscript">
+ <sub><xsl:value-of select="@term"/></sub>
+ </xsl:template>
+ <xsl:template match="superscript">
+ <sup><xsl:value-of select="@term"/></sup>
+ </xsl:template>
+
+ <!-- tabular data
+ example:
+
+ <list type="table">
+ <listheader>
+ <term>First Col Header</term>
+ <description>Second Col Header</description>
+ <description>Third Col Header</description>
+ </listheader>
+ <item>
+ <term>First Row First Col</term>
+ <description>First Row Second Col</description>
+ <description>First Row Third Col</description>
+ </item>
+ <item>
+ <term>Second Row First Col</term>
+ <description>Second Row Second Col</description>
+ <description>Second Row Third Col</description>
+ </item>
+ </list>
+ -->
+
+ <xsl:template match="list[@type='table']">
+ <xsl:call-template name="CreateListTable">
+ <xsl:with-param name="header">
+ <th><xsl:apply-templates select="listheader/term" mode="notoppara"/></th>
+ <xsl:for-each select="listheader/description">
+ <th><xsl:apply-templates mode="notoppara"/></th>
+ </xsl:for-each>
+ </xsl:with-param>
+
+ <xsl:with-param name="content">
+ <xsl:for-each select="item">
+ <tr valign="top">
+ <td>
+ <xsl:apply-templates select="term" mode="notoppara"/>
+ </td>
+ <xsl:for-each select="description">
+ <td>
+ <xsl:apply-templates mode="notoppara"/>
+ </td>
+ </xsl:for-each>
+ </tr>
+ </xsl:for-each>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:template>
+
+ <xsl:template match="list[@type='bullet']">
+ <ul>
+ <xsl:for-each select="item">
+ <li>
+ <xsl:apply-templates select="term" mode="notoppara"/>
+ </li>
+ </xsl:for-each>
+ </ul>
+ </xsl:template>
+ <xsl:template match="list[@type='number']">
+ <ol>
+ <xsl:for-each select="item">
+ <li>
+ <xsl:apply-templates select="term" mode="notoppara"/>
+ </li>
+ </xsl:for-each>
+ </ol>
+ </xsl:template>
+
+ <xsl:template match="list">
+ [<i>The '<xsl:value-of select="@type"/>' type of list has not been implemented in the ECMA stylesheet.</i>]
+
+ <xsl:message>
+ [<i>The '<xsl:value-of select="@type"/>' type of list has not been implemented in the ECMA stylesheet.</i>]
+ </xsl:message>
+ </xsl:template>
+
+ <xsl:template match="see[@cref]">
+ <xsl:choose>
+ <xsl:when test="not(substring-after(@cref, 'T:')='')">
+ <xsl:call-template name="maketypelink">
+ <xsl:with-param name="type" select="normalize-space (@cref)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="not(substring-after(@cref, 'N:')='')">
+ <xsl:call-template name="makenamespacelink">
+ <xsl:with-param name="cref" select="normalize-space (@cref)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="makememberlink">
+ <xsl:with-param name="cref" select="normalize-space (@cref)"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="see[@langword]">
+ <tt><xsl:value-of select="@langword"/></tt>
+ </xsl:template>
+
+ <xsl:template name="GetInheritedMembers">
+ <xsl:param name="declaringtype"/>
+ <xsl:param name="generictypereplacements"/>
+ <xsl:param name="listmembertype"/>
+ <xsl:param name="showprotected"/>
+ <xsl:param name="overloads-mode" select="false()" />
+ <xsl:param name="showstatic" select='1'/>
+
+ <xsl:choose>
+ <xsl:when test="$listmembertype='ExtensionMethod' and $showprotected=false()">
+ <xsl:for-each select="$declaringtype/Members/Member[MemberType=$listmembertype]">
+ <Members Name="Link/@Type" FullName="Link/@Type">
+ <Member MemberName="{@MemberName}">
+ <xsl:attribute name="ExplicitMemberName">
+ <xsl:call-template name="GetMemberNameWithoutGenericTypes">
+ <xsl:with-param name="m" select="@MemberName" />
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="TypeParameters">
+ <xsl:call-template name="GetTypeParameterNames">
+ <xsl:with-param name="member" select="." />
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="Parameters">
+ <xsl:call-template name="GetParameterTypes">
+ <xsl:with-param name="member" select="." />
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:copy-of select="./*" />
+ </Member>
+ </Members>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <Members Name="{$declaringtype/@Name}" FullName="{$declaringtype/@FullName}">
+
+ <xsl:copy-of select="$generictypereplacements"/>
+
+ <!-- Get all members in this type that are of listmembertype and are either
+ protected or not protected according to showprotected. -->
+ <xsl:choose>
+ <xsl:when test="$listmembertype = 'Explicit'">
+ <xsl:for-each select="$declaringtype/Members/Member
+ [MemberType != 'Constructor']
+ [contains (@MemberName, '.')]">
+ <Member MemberName="{@MemberName}">
+ <xsl:attribute name="ExplicitMemberName">
+ <xsl:call-template name="GetMemberName">
+ <xsl:with-param name="type" select="@MemberName" />
+ <xsl:with-param name="isproperty" select="$listmembertype = 'Property'"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="TypeParameters">
+ <xsl:call-template name="GetTypeParameterNames">
+ <xsl:with-param name="member" select="." />
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="Parameters">
+ <xsl:call-template name="GetParameterTypes">
+ <xsl:with-param name="member" select="." />
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:copy-of select="./*" />
+ </Member>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="$declaringtype/Members/Member
+ [(MemberType=$listmembertype or ($listmembertype='Operator' and MemberType='Method'))]
+ [(not($overloads-mode) or @MemberName=$index or
+ ($index='Conversion' and (@MemberName='op_Implicit' or @MemberName='op_Explicit'))) ]
+ [$showprotected=starts-with(MemberSignature[@Language='C#']/@Value, 'protected ')]
+ [($listmembertype='Method' and not(starts-with(@MemberName,'op_')))
+ or ($listmembertype='Operator' and starts-with(@MemberName,'op_'))
+ or (not($listmembertype='Method') and not($listmembertype='Operator'))]
+ [$showstatic or not(contains(MemberSignature[@Language='C#']/@Value,' static '))]
+ [$listmembertype = 'Constructor' or not(contains(@MemberName, '.'))]
+ ">
+ <Member MemberName="{@MemberName}">
+ <xsl:attribute name="ExplicitMemberName">
+ <xsl:call-template name="GetMemberNameWithoutGenericTypes">
+ <xsl:with-param name="m" select="@MemberName" />
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="TypeParameters">
+ <xsl:call-template name="GetTypeParameterNames">
+ <xsl:with-param name="member" select="." />
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="Parameters">
+ <xsl:call-template name="GetParameterTypes">
+ <xsl:with-param name="member" select="." />
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:copy-of select="./*" />
+ </Member>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <Docs>
+ <xsl:copy-of select="$declaringtype/Docs/typeparam" />
+ </Docs>
+
+ </Members>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:if test="not($listmembertype='Constructor') and count($declaringtype/Base/BaseTypeName)=1">
+ <xsl:variable name="basedocsfile">
+ <xsl:call-template name="GetLinkTarget">
+ <xsl:with-param name="type">
+ <xsl:call-template name="GetEscapedTypeName">
+ <xsl:with-param name="typename" select="$declaringtype/Base/BaseTypeName" />
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="cref">
+ </xsl:with-param>
+ <xsl:with-param name="local-suffix" />
+ <xsl:with-param name="remote"/>
+ <xsl:with-param name="xmltarget" select='1'/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:if test="not(string($basedocsfile) = '')">
+ <xsl:call-template name="GetInheritedMembers">
+ <xsl:with-param name="listmembertype" select="$listmembertype"/>
+ <xsl:with-param name="showprotected" select="$showprotected"/>
+ <xsl:with-param name="declaringtype" select="document(string($basedocsfile),.)/Type"/>
+ <xsl:with-param name="generictypereplacements" select="$declaringtype/Base/BaseTypeArguments/*"/>
+ <xsl:with-param name="showstatic" select='0'/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="GetMemberNameWithoutGenericTypes">
+ <xsl:param name="m" />
+ <xsl:choose>
+ <xsl:when test="contains ($m, '<')">
+ <xsl:value-of select="substring-before ($m, '<')" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$m" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="GetTypeParameterNames">
+ <xsl:param name="member" />
+
+ <xsl:for-each select="$member/TypeParameters/TypeParameter">
+ <xsl:if test="not(position()=1)">, </xsl:if>
+ <xsl:value-of select="@Name" />
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="GetParameterTypes">
+ <xsl:param name="member" />
+
+ <xsl:for-each select="$member/Parameters/Parameter">
+ <xsl:if test="not(position()=1)">, </xsl:if>
+ <xsl:value-of select="@Type" />
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="ListAllMembers">
+ <xsl:param name="html-anchor" select="false()" />
+
+ <xsl:call-template name="ListMembers">
+ <xsl:with-param name="listmembertype" select="'Constructor'"/>
+ <xsl:with-param name="showprotected" select="false()"/>
+ <xsl:with-param name="html-anchor" select="$html-anchor" />
+ </xsl:call-template>
+
+ <xsl:call-template name="ListMembers">
+ <xsl:with-param name="listmembertype" select="'Constructor'"/>
+ <xsl:with-param name="showprotected" select="true()"/>
+ <xsl:with-param name="html-anchor" select="$html-anchor" />
+ </xsl:call-template>
+
+ <xsl:call-template name="ListMembers">
+ <xsl:with-param name="listmembertype" select="'Field'"/>
+ <xsl:with-param name="showprotected" select="false()"/>
+ <xsl:with-param name="html-anchor" select="$html-anchor" />
+ </xsl:call-template>
+
+ <xsl:call-template name="ListMembers">
+ <xsl:with-param name="listmembertype" select="'Field'"/>
+ <xsl:with-param name="showprotected" select="true()"/>
+ <xsl:with-param name="html-anchor" select="$html-anchor" />
+ </xsl:call-template>
+
+ <xsl:call-template name="ListMembers">
+ <xsl:with-param name="listmembertype" select="'Property'"/>
+ <xsl:with-param name="showprotected" select="false()"/>
+ <xsl:with-param name="html-anchor" select="$html-anchor" />
+ </xsl:call-template>
+
+ <xsl:call-template name="ListMembers">
+ <xsl:with-param name="listmembertype" select="'Property'"/>
+ <xsl:with-param name="showprotected" select="true()"/>
+ <xsl:with-param name="html-anchor" select="$html-anchor" />
+ </xsl:call-template>
+
+ <xsl:call-template name="ListMembers">
+ <xsl:with-param name="listmembertype" select="'Method'"/>
+ <xsl:with-param name="showprotected" select="false()"/>
+ <xsl:with-param name="html-anchor" select="$html-anchor" />
+ </xsl:call-template>
+
+ <xsl:call-template name="ListMembers">
+ <xsl:with-param name="listmembertype" select="'Method'"/>
+ <xsl:with-param name="showprotected" select="true()"/>
+ <xsl:with-param name="html-anchor" select="$html-anchor" />
+ </xsl:call-template>
+
+ <xsl:call-template name="ListMembers">
+ <xsl:with-param name="listmembertype" select="'Event'"/>
+ <xsl:with-param name="showprotected" select="false()"/>
+ <xsl:with-param name="html-anchor" select="$html-anchor" />
+ </xsl:call-template>
+
+ <xsl:call-template name="ListMembers">
+ <xsl:with-param name="listmembertype" select="'Event'"/>
+ <xsl:with-param name="showprotected" select="true()"/>
+ <xsl:with-param name="html-anchor" select="$html-anchor" />
+ </xsl:call-template>
+
+ <xsl:call-template name="ListMembers">
+ <xsl:with-param name="listmembertype" select="'Operator'"/>
+ <xsl:with-param name="showprotected" select="false()"/>
+ <xsl:with-param name="html-anchor" select="$html-anchor" />
+ </xsl:call-template>
+
+ <xsl:call-template name="ListMembers">
+ <xsl:with-param name="listmembertype" select="'Explicit'"/>
+ <xsl:with-param name="showprotected" select="true()"/>
+ <xsl:with-param name="html-anchor" select="$html-anchor" />
+ </xsl:call-template>
+
+ <xsl:call-template name="ListMembers">
+ <xsl:with-param name="listmembertype" select="'ExtensionMethod'"/>
+ <xsl:with-param name="showprotected" select="false()"/>
+ <xsl:with-param name="html-anchor" select="$html-anchor" />
+ </xsl:call-template>
+ </xsl:template>
+
+ <!-- Lists the members in the current Type node.
+ Only lists members of type listmembertype.
+ Displays the signature in siglanguage.
+ showprotected = true() or false()
+ -->
+ <xsl:template name="ListMembers">
+ <xsl:param name="listmembertype"/>
+ <xsl:param name="showprotected"/>
+ <xsl:param name="overloads-mode" select="false()" />
+ <xsl:param name="html-anchor" select="false()" />
+
+ <!-- get name and namespace of current type -->
+ <xsl:variable name="TypeFullName" select="@FullName"/>
+ <xsl:variable name="TypeName" select="@Name"/>
+ <xsl:variable name="TypeNamespace" select="substring-before(@FullName, concat('.',@Name))"/>
+
+ <xsl:variable name="MEMBERS-rtf">
+ <xsl:call-template name="GetInheritedMembers">
+ <xsl:with-param name="listmembertype" select="$listmembertype"/>
+ <xsl:with-param name="showprotected" select="$showprotected"/>
+ <xsl:with-param name="declaringtype" select="."/>
+ <xsl:with-param name="overloads-mode" select="$overloads-mode" />
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="MEMBERS" select="msxsl:node-set($MEMBERS-rtf)" />
+
+ <!--
+ <xsl:variable name="MEMBERS" select="
+ $ALLMEMBERS/Member
+ [(MemberType=$listmembertype or ($listmembertype='Operator' and MemberType='Method'))]
+ [$showprotected=contains(MemberSignature[@Language='C#']/@Value,'protected')]
+ [($listmembertype='Method' and not(starts-with(@MemberName,'op_')))
+ or ($listmembertype='Operator' and starts-with(@MemberName,'op_'))
+ or (not($listmembertype='Method') and not($listmembertype='Operator'))]
+ "/>
+ -->
+
+ <!-- if there aren't any, skip this -->
+ <xsl:if test="count($MEMBERS//Member)">
+
+ <xsl:variable name="SectionName">
+ <xsl:if test="$listmembertype != 'Explicit' and $listmembertype != 'ExtensionMethod'">
+ <xsl:if test="$showprotected">Protected </xsl:if>
+ <xsl:if test="not($showprotected)">Public </xsl:if>
+ </xsl:if>
+ <xsl:call-template name="membertypeplural"><xsl:with-param name="name" select="$listmembertype"/></xsl:call-template>
+ </xsl:variable>
+
+ <!-- header -->
+ <xsl:call-template name="CreateH2Section">
+ <xsl:with-param name="name" select="$SectionName" />
+ <xsl:with-param name="child-id" select="$SectionName" />
+ <xsl:with-param name="content">
+ <div class="SubsectionBox">
+ <xsl:call-template name="CreateMembersTable">
+ <xsl:with-param name="content">
+
+ <xsl:for-each select="$MEMBERS/Members/Member">
+ <!--<xsl:sort select="contains(MemberSignature[@Language='C#']/@Value,' static ')" data-type="text"/>-->
+ <xsl:sort select="@MemberName = 'op_Implicit' or @MemberName = 'op_Explicit'"/>
+ <xsl:sort select="@ExplicitMemberName" data-type="text"/>
+ <xsl:sort select="count(TypeParameters/TypeParameter)"/>
+ <xsl:sort select="@TypeParameters"/>
+ <xsl:sort select="count(Parameters/Parameter)"/>
+ <xsl:sort select="@Parameters"/>
+
+ <xsl:variable name="local-id">
+ <xsl:choose>
+ <xsl:when test="count(Link) = 1">
+ <xsl:value-of select="Link/@Member" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="GetLinkId" >
+ <xsl:with-param name="type" select="parent::Members" />
+ <xsl:with-param name="member" select="." />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:variable name="linkfile">
+ <xsl:if test="not(parent::Members/@FullName = $TypeFullName)">
+ <xsl:call-template name="GetLinkTargetHtml">
+ <xsl:with-param name="type">
+ <xsl:choose>
+ <xsl:when test="count(Link) = 1">
+ <xsl:value-of select="Link/@Type"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="GetEscapedTypeName">
+ <xsl:with-param name="typename" select="parent::Members/@FullName" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="cref" />
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:variable>
+
+ <xsl:variable name="linkid">
+ <xsl:if test="$html-anchor">
+ <xsl:value-of select="$linkfile" />
+ <xsl:text>#</xsl:text>
+ </xsl:if>
+ <xsl:value-of select="$local-id" />
+ </xsl:variable>
+
+ <xsl:variable name="isinherited">
+ <xsl:if test="$listmembertype != 'ExtensionMethod' and not(parent::Members/@FullName = $TypeFullName)">
+ <xsl:text> (</xsl:text>
+ <i>
+ <xsl:text>Inherited from </xsl:text>
+ <xsl:call-template name="maketypelink">
+ <xsl:with-param name="type" select="parent::Members/@FullName"/>
+ <xsl:with-param name="wrt" select="$TypeNamespace"/>
+ </xsl:call-template>
+ <xsl:text>.</xsl:text>
+ </i>
+ <xsl:text>)</xsl:text>
+ </xsl:if>
+ </xsl:variable>
+
+ <tr valign="top">
+ <td>
+ <!-- random info -->
+
+ <!-- check if it has get and set accessors -->
+ <xsl:if test="MemberType='Property' and not(contains(MemberSignature[@Language='C#']/@Value, 'set;'))">
+ <xsl:text>[read-only]</xsl:text>
+ </xsl:if>
+ <xsl:if test="MemberType='Property' and not(contains(MemberSignature[@Language='C#']/@Value, 'get;'))">
+ <xsl:text>[write-only]</xsl:text>
+ </xsl:if>
+
+ <xsl:if test="contains(MemberSignature[@Language='C#']/@Value,'this[')">
+ <div><i>default property</i></div>
+ </xsl:if>
+
+ <div>
+ <xsl:call-template name="getmodifiers">
+ <xsl:with-param name="sig" select="MemberSignature[@Language='C#']/@Value"/>
+ <xsl:with-param name="protection" select="false()"/>
+ <xsl:with-param name="inheritance" select="true()"/>
+ <xsl:with-param name="extra" select="false()"/>
+ </xsl:call-template>
+ </div>
+ </td>
+
+ <xsl:choose>
+ <!-- constructor listing -->
+ <xsl:when test="MemberType='Constructor'">
+ <!-- link to constructor page -->
+ <td>
+ <div>
+ <b>
+ <a href="{$linkid}">
+ <xsl:call-template name="GetConstructorName">
+ <xsl:with-param name="type" select="parent::Members" />
+ <xsl:with-param name="ctor" select="." />
+ </xsl:call-template>
+ </a>
+ </b>
+
+ <!-- argument list -->
+ <xsl:value-of select="'('"/>
+ <xsl:for-each select="Parameters/Parameter">
+ <xsl:if test="not(position()=1)">, </xsl:if>
+
+ <xsl:call-template name="ShowParameter">
+ <xsl:with-param name="Param" select="."/>
+ <xsl:with-param name="TypeNamespace" select="$TypeNamespace"/>
+ <xsl:with-param name="prototype" select="true()"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ <xsl:value-of select="')'"/>
+ </div>
+
+ <!-- TODO: $implemented? -->
+
+ </td>
+ </xsl:when>
+
+ <xsl:when test="$listmembertype = 'Explicit'">
+ <td>
+ <a href="{$linkid}">
+ <b>
+ <xsl:call-template name="GetMemberDisplayName">
+ <xsl:with-param name="memberName" select="@MemberName" />
+ <xsl:with-param name="isproperty" select="MemberType='Property'" />
+ </xsl:call-template>
+ </b>
+ </a>
+ </td>
+ </xsl:when>
+
+ <!-- field, property and event listing -->
+ <xsl:when test="MemberType='Field' or MemberType='Property' or MemberType='Event'">
+ <td>
+
+ <!-- link to member page -->
+ <b>
+ <a href="{$linkid}">
+ <xsl:call-template name="GetMemberDisplayName">
+ <xsl:with-param name="memberName" select="@MemberName" />
+ <xsl:with-param name="isproperty" select="MemberType='Property'" />
+ </xsl:call-template>
+ </a>
+ </b>
+
+ <!-- argument list for accessors -->
+ <xsl:if test="Parameters/Parameter">
+ <xsl:value-of select="'('"/>
+ <xsl:for-each select="Parameters/Parameter">
+ <xsl:if test="not(position()=1)">, </xsl:if>
+
+ <xsl:call-template name="ShowParameter">
+ <xsl:with-param name="Param" select="."/>
+ <xsl:with-param name="TypeNamespace" select="$TypeNamespace"/>
+ <xsl:with-param name="prototype" select="true()"/>
+ </xsl:call-template>
+
+ </xsl:for-each>
+ <xsl:value-of select="')'"/>
+ </xsl:if>
+
+ </td>
+ </xsl:when>
+
+ <!-- method listing -->
+ <xsl:when test="$listmembertype='Method' or $listmembertype = 'ExtensionMethod'">
+ <td colspan="2">
+
+ <!-- link to method page -->
+ <b>
+ <a href="{$linkid}">
+ <xsl:call-template name="GetMemberDisplayName">
+ <xsl:with-param name="memberName" select="@MemberName" />
+ <xsl:with-param name="isproperty" select="MemberType='Property'" />
+ </xsl:call-template>
+ </a>
+ </b>
+
+ <!-- argument list -->
+ <xsl:value-of select="'('"/>
+ <xsl:for-each select="Parameters/Parameter">
+ <xsl:if test="not(position()=1)">, </xsl:if>
+
+ <xsl:call-template name="ShowParameter">
+ <xsl:with-param name="Param" select="."/>
+ <xsl:with-param name="TypeNamespace" select="$TypeNamespace"/>
+ <xsl:with-param name="prototype" select="true()"/>
+ </xsl:call-template>
+
+ </xsl:for-each>
+ <xsl:value-of select="')'"/>
+
+ <!-- return type -->
+ <xsl:if test="not(ReturnValue/ReturnType='System.Void')">
+ <nobr>
+ <xsl:text> : </xsl:text>
+ <xsl:apply-templates select="ReturnValue/ReturnType" mode="typelink"><xsl:with-param name="wrt" select="$TypeNamespace"/></xsl:apply-templates>
+ </nobr>
+ </xsl:if>
+
+ <blockquote>
+ <xsl:apply-templates select="Docs/summary" mode="notoppara"/>
+ <xsl:copy-of select="$isinherited"/>
+ </blockquote>
+ </td>
+ </xsl:when>
+
+ <xsl:when test="$listmembertype='Operator'">
+ <td>
+
+ <!-- link to operator page -->
+ <xsl:choose>
+ <xsl:when test="@MemberName='op_Implicit' or @MemberName='op_Explicit'">
+ <b>
+ <a href="{$linkid}">
+ <xsl:text>Conversion</xsl:text>
+ <xsl:choose>
+ <xsl:when test="ReturnValue/ReturnType = //Type/@FullName">
+ <xsl:text> From </xsl:text>
+ <xsl:value-of select="Parameters/Parameter/@Type"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text> to </xsl:text>
+ <xsl:value-of select="ReturnValue/ReturnType"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </a>
+ </b>
+
+ <xsl:choose>
+ <xsl:when test="@MemberName='op_Implicit'">
+ <xsl:text>(Implicit)</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>(Explicit)</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="count(Parameters/Parameter)=1">
+ <b>
+ <a href="{$linkid}">
+ <xsl:value-of select="substring-after(@MemberName, 'op_')"/>
+ </a>
+ </b>
+ </xsl:when>
+ <xsl:otherwise>
+ <b>
+ <a href="{$linkid}">
+ <xsl:value-of select="substring-after(@MemberName, 'op_')"/>
+ </a>
+ </b>
+ <xsl:value-of select="'('"/>
+ <xsl:for-each select="Parameters/Parameter">
+ <xsl:if test="not(position()=1)">, </xsl:if>
+
+ <xsl:call-template name="ShowParameter">
+ <xsl:with-param name="Param" select="."/>
+ <xsl:with-param name="TypeNamespace" select="$TypeNamespace"/>
+ <xsl:with-param name="prototype" select="true()"/>
+ </xsl:call-template>
+
+ </xsl:for-each>
+ <xsl:value-of select="')'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </xsl:when>
+
+ <xsl:otherwise>
+ <!-- Other types: just provide a link -->
+ <td>
+ <a href="{$linkid}">
+ <xsl:call-template name="GetMemberDisplayName">
+ <xsl:with-param name="memberName" select="@MemberName" />
+ <xsl:with-param name="isproperty" select="MemberType='Property'" />
+ </xsl:call-template>
+ </a>
+ </td>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:if test="$listmembertype != 'Method' and $listmembertype != 'ExtensionMethod'">
+ <td>
+ <!-- description -->
+ <xsl:if test="MemberType='Field' or MemberType = 'Property'">
+ <i><xsl:apply-templates select="ReturnValue/ReturnType" mode="typelink"><xsl:with-param name="wrt" select="$TypeNamespace"/></xsl:apply-templates></i>
+ <xsl:if test="MemberValue"> (<xsl:value-of select="MemberValue"/>)</xsl:if>
+ <xsl:text>. </xsl:text>
+ </xsl:if>
+
+ <xsl:apply-templates select="Docs/summary" mode="notoppara"/>
+ <xsl:copy-of select="$isinherited"/>
+ </td>
+ </xsl:if>
+
+ </tr>
+ </xsl:for-each>
+
+ </xsl:with-param>
+ </xsl:call-template>
+ </div>
+ </xsl:with-param>
+ </xsl:call-template>
+
+ </xsl:if>
+
+ </xsl:template>
+
+ <xsl:template name="GetLinkName">
+ <xsl:param name="type"/>
+ <xsl:param name="member"/>
+ <xsl:call-template name="memberlinkprefix">
+ <xsl:with-param name="member" select="$member"/>
+ </xsl:call-template>
+ <xsl:text>:</xsl:text>
+ <xsl:call-template name="GetEscapedTypeName">
+ <xsl:with-param name="typename" select="$type/@FullName" />
+ </xsl:call-template>
+ <xsl:if test="$member/MemberType != 'Constructor'">
+ <xsl:text>.</xsl:text>
+ <xsl:variable name="memberName">
+ <xsl:call-template name="GetGenericName">
+ <xsl:with-param name="membername" select="$member/@MemberName" />
+ <xsl:with-param name="member" select="$member" />
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="Replace">
+ <xsl:with-param name="s">
+ <xsl:call-template name="ToBraces">
+ <xsl:with-param name="s" select="$memberName" />
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="from">.</xsl:with-param>
+ <xsl:with-param name="to">#</xsl:with-param>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="GetGenericName">
+ <xsl:param name="membername" />
+ <xsl:param name="member" />
+ <xsl:variable name="numgenargs" select="count($member/Docs/typeparam)" />
+ <xsl:choose>
+ <xsl:when test="$numgenargs = 0">
+ <xsl:value-of select="$membername" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="contains($membername, '<')">
+ <xsl:value-of select="substring-before ($membername, '<')" />
+ </xsl:if>
+ <xsl:text>``</xsl:text>
+ <xsl:value-of select="$numgenargs" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="GetEscapedTypeName">
+ <xsl:param name="typename" />
+ <xsl:variable name="base" select="substring-before ($typename, '<')" />
+
+ <xsl:choose>
+ <xsl:when test="$base != ''">
+ <xsl:value-of select="translate ($base, '+', '.')" />
+ <xsl:text>`</xsl:text>
+ <xsl:call-template name="GetGenericArgumentCount">
+ <xsl:with-param name="arglist" select="substring-after ($typename, '<')" />
+ <xsl:with-param name="count">1</xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise><xsl:value-of select="translate ($typename, '+', '.')" /></xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="GetGenericArgumentCount">
+ <xsl:param name="arglist" />
+ <xsl:param name="count" />
+
+ <xsl:variable name="rest-rtf">
+ <xsl:call-template name="SkipTypeArgument">
+ <xsl:with-param name="s" select="$arglist" />
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="rest" select="string($rest-rtf)" />
+
+ <xsl:choose>
+ <xsl:when test="$arglist != '' and $rest = ''">
+ <xsl:value-of select="$count" />
+ </xsl:when>
+ <xsl:when test="$arglist = '' and $rest = ''">
+ <xsl:message terminate="yes">
+!WTF? arglist=<xsl:value-of select="$arglist" />; rest=<xsl:value-of select="$rest" />
+ </xsl:message>
+ </xsl:when>
+ <xsl:when test="starts-with ($rest, '>')">
+ <xsl:value-of select="$count" />
+ <xsl:call-template name="GetEscapedTypeName">
+ <xsl:with-param name="typename" select="substring-after ($rest, '>')" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with ($rest, ',')">
+ <xsl:call-template name="GetGenericArgumentCount">
+ <xsl:with-param name="arglist" select="substring-after ($rest, ',')" />
+ <xsl:with-param name="count" select="$count+1" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">
+!WTF 2? arglist=<xsl:value-of select="$arglist" />; rest=<xsl:value-of select="$rest" />
+ </xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="SkipTypeArgument">
+ <xsl:param name="s" />
+
+ <xsl:variable name="p-rtf">
+ <xsl:call-template name="GetCLtGtPositions">
+ <xsl:with-param name="s" select="$s" />
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="p" select="msxsl:node-set($p-rtf)"/>
+
+ <xsl:choose>
+ <!--
+ Have to select between three `s' patterns:
+ A,B>: need to return ",B>"
+ Foo<A,B>>: Need to forward to SkipGenericArgument to eventually return ">"
+ Foo<A,B>+C>: Need to forward to SkipGenericArgument to eventually return ">"
+ -->
+ <xsl:when test="starts-with ($s, '>')">
+ <xsl:message terminate="yes">
+SkipTypeArgument: invalid type substring '<xsl:value-of select="$s" />'
+ </xsl:message>
+ </xsl:when>
+ <xsl:when test="$p/Comma/@Length > 0 and
+ ($p/Lt/@Length = 0 or $p/Comma/@Length < $p/Lt/@Length) and
+ ($p/Gt/@Length > 0 and $p/Comma/@Length < $p/Gt/@Length)">
+ <xsl:text>,</xsl:text>
+ <xsl:value-of select="substring-after ($s, ',')" />
+ </xsl:when>
+ <xsl:when test="$p/Lt/@Length > 0 and $p/Lt/@Length < $p/Gt/@Length">
+ <xsl:variable name="r">
+ <xsl:call-template name="SkipGenericArgument">
+ <xsl:with-param name="s" select="substring-after ($s, '<')" />
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="starts-with ($r, '>') or starts-with ($r, '+')">
+ <xsl:value-of select="substring-after ($r, '>')" />
+ </xsl:when>
+ <xsl:when test="starts-with ($r, ',')">
+ <xsl:value-of select="$r" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>
+! WTF3: s=<xsl:value-of select="$s" />; r=<xsl:value-of select="$r" />
+ </xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$p/Gt/@Length > 0">
+ <xsl:text>></xsl:text>
+ <xsl:value-of select="substring-after ($s, '>')" />
+ </xsl:when>
+ <xsl:otherwise><xsl:value-of select="$s" /></xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="GetCLtGtPositions">
+ <xsl:param name="s" />
+
+ <xsl:variable name="c" select="substring-before ($s, ',')" />
+ <xsl:variable name="lt" select="substring-before ($s, '<')" />
+ <xsl:variable name="gt" select="substring-before ($s, '>')" />
+
+ <Comma String="{$c}" Length="{string-length ($c)}" />
+ <Lt String="{$lt}" Length="{string-length ($lt)}" />
+ <Gt String="{$gt}" Length="{string-length ($gt)}" />
+ </xsl:template>
+
+ <!--
+ when given 'Foo<A,Bar<Baz<C,D,E>>>>', returns '>'
+ when given 'Bar<C>+Nested>', returns '>'
+ when given 'Foo<A,Bar<Baz<C,D,E>>>,', returns ','
+ (basically, it matches '<' to '>' and "skips" the intermediate type-name contents.
+ -->
+ <xsl:template name="SkipGenericArgument">
+ <xsl:param name="s" />
+
+ <xsl:variable name="p-rtf">
+ <xsl:call-template name="GetCLtGtPositions">
+ <xsl:with-param name="s" select="$s" />
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="p" select="msxsl:node-set($p-rtf)" />
+
+ <xsl:choose>
+ <xsl:when test="starts-with ($s, '>')">
+ <xsl:message terminate="yes">
+SkipGenericArgument: invalid type substring '<xsl:value-of select="$s" />'
+ </xsl:message>
+ </xsl:when>
+ <xsl:when test="$p/Lt/@Length > 0 and $p/Lt/@Length < $p/Gt/@Length">
+ <!-- within 'Foo<A...'; look for matching '>' -->
+ <xsl:variable name="r">
+ <xsl:call-template name="SkipGenericArgument">
+ <xsl:with-param name="s" select="substring-after ($s, '<')" />
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="substring-after ($r, '>')" />
+ </xsl:when>
+ <xsl:when test="$p/Gt/@Length > 0">
+ <!--<xsl:value-of select="substring ($s, string-length ($gt)+1)" />-->
+ <xsl:value-of select="substring-after ($s, '>')" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$s" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="GetEscapedParameter">
+ <xsl:param name="orig-parameter-type" />
+ <xsl:param name="parameter-type" />
+ <xsl:param name="parameter-types" />
+ <xsl:param name="escape" />
+ <xsl:param name="index" />
+
+ <xsl:choose>
+ <xsl:when test="$index > count($parameter-types)">
+ <xsl:if test="$parameter-type != $orig-parameter-type">
+ <xsl:value-of select="$parameter-type" />
+ </xsl:if>
+ <!-- ignore -->
+ </xsl:when>
+ <xsl:when test="$parameter-types[position() = $index]/@name = $parameter-type">
+ <xsl:value-of select="concat ($escape, $index - 1)" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="typeparam" select="$parameter-types[position() = $index]/@name" />
+ <xsl:call-template name="GetEscapedParameter">
+ <xsl:with-param name="orig-parameter-type" select="$orig-parameter-type" />
+ <xsl:with-param name="parameter-type">
+ <xsl:call-template name="Replace">
+ <xsl:with-param name="s">
+ <xsl:call-template name="Replace">
+ <xsl:with-param name="s">
+ <xsl:call-template name="Replace">
+ <xsl:with-param name="s">
+ <xsl:call-template name="Replace">
+ <xsl:with-param name="s" select="$parameter-type"/>
+ <xsl:with-param name="from" select="concat('<', $typeparam, '>')" />
+ <xsl:with-param name="to" select="concat('<', $escape, $index - 1, '>')" />
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="from" select="concat('<', $typeparam, ',')" />
+ <xsl:with-param name="to" select="concat('<', $escape, $index - 1, ',')" />
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="from" select="concat (',', $typeparam, '>')" />
+ <xsl:with-param name="to" select="concat(',', $escape, $index - 1, '>')" />
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="from" select="concat (',', $typeparam, ',')" />
+ <xsl:with-param name="to" select="concat(',', $escape, $index - 1, ',')" />
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="parameter-types" select="$parameter-types" />
+ <xsl:with-param name="typeparam" select="$typeparam" />
+ <xsl:with-param name="escape" select="$escape" />
+ <xsl:with-param name="index" select="$index + 1" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="GetLinkId">
+ <xsl:param name="type"/>
+ <xsl:param name="member"/>
+ <xsl:call-template name="GetLinkName">
+ <xsl:with-param name="type" select="$type" />
+ <xsl:with-param name="member" select="$member" />
+ </xsl:call-template>
+ <xsl:if test="count($member/Parameters/Parameter) > 0">
+ <xsl:text>(</xsl:text>
+ <xsl:for-each select="Parameters/Parameter">
+ <xsl:if test="not(position()=1)">,</xsl:if>
+ <xsl:call-template name="GetParameterType">
+ <xsl:with-param name="type" select="$type" />
+ <xsl:with-param name="member" select="$member" />
+ <xsl:with-param name="parameter" select="." />
+ </xsl:call-template>
+ </xsl:for-each>
+ <xsl:text>)</xsl:text>
+ </xsl:if>
+ <xsl:if test="$member/@MemberName='op_Implicit' or $member/@MemberName='op_Explicit'">
+ <xsl:text>~</xsl:text>
+ <xsl:variable name="parameter-rtf">
+ <Parameter Type="{$member/ReturnValue/ReturnType}" />
+ </xsl:variable>
+ <xsl:call-template name="GetParameterType">
+ <xsl:with-param name="type" select="$type" />
+ <xsl:with-param name="member" select="$member" />
+ <xsl:with-param name="parameter" select="msxsl:node-set($parameter-rtf)/Parameter" />
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+
+ <!--
+ - what should be <xsl:value-of select="@Type" /> becomes a nightmare once
+ - generics enter the picture, since a parameter type could come from the
+ - type itelf (becoming `N) or from the method (becoming ``N).
+ -->
+ <xsl:template name="GetParameterType">
+ <xsl:param name="type" />
+ <xsl:param name="member" />
+ <xsl:param name="parameter" />
+
+ <!-- the actual parameter type -->
+ <xsl:variable name="ptype">
+ <xsl:choose>
+ <xsl:when test="contains($parameter/@Type, '[')">
+ <xsl:value-of select="substring-before ($parameter/@Type, '[')" />
+ </xsl:when>
+ <xsl:when test="contains($parameter/@Type, '&')">
+ <xsl:value-of select="substring-before ($parameter/@Type, '&')" />
+ </xsl:when>
+ <xsl:when test="contains($parameter/@Type, '*')">
+ <xsl:value-of select="substring-before ($parameter/@Type, '*')" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$parameter/@Type" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <!-- parameter modifiers -->
+ <xsl:variable name="pmodifier">
+ <xsl:call-template name="Replace">
+ <xsl:with-param name="s" select="substring-after ($parameter/@Type, $ptype)" />
+ <xsl:with-param name="from">&</xsl:with-param>
+ <xsl:with-param name="to">@</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="gen-type">
+ <xsl:call-template name="GetEscapedParameter">
+ <xsl:with-param name="orig-parameter-type" select="$ptype" />
+ <xsl:with-param name="parameter-type">
+ <xsl:variable name="nested">
+ <xsl:call-template name="GetEscapedParameter">
+ <xsl:with-param name="orig-parameter-type" select="$ptype" />
+ <xsl:with-param name="parameter-type" select="$ptype" />
+ <xsl:with-param name="parameter-types" select="$type/Docs/typeparam" />
+ <xsl:with-param name="escape" select="'`'" />
+ <xsl:with-param name="index" select="1" />
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$nested != ''">
+ <xsl:value-of select="$nested" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$ptype" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="parameter-types" select="$member/Docs/typeparam" />
+ <xsl:with-param name="escape" select="'``'" />
+ <xsl:with-param name="index" select="1" />
+ </xsl:call-template>
+ </xsl:variable>
+
+ <!-- the actual parameter type -->
+ <xsl:variable name="parameter-type">
+ <xsl:choose>
+ <xsl:when test="$gen-type != ''">
+ <xsl:value-of select="$gen-type" />
+ <xsl:value-of select="$pmodifier" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($ptype, $pmodifier)" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <!-- s/</{/g; s/>/}/g; so that less escaping is needed. -->
+ <xsl:call-template name="Replace">
+ <xsl:with-param name="s">
+ <xsl:call-template name="Replace">
+ <xsl:with-param name="s" select="translate ($parameter-type, '+', '.')" />
+ <xsl:with-param name="from">></xsl:with-param>
+ <xsl:with-param name="to">}</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="from"><</xsl:with-param>
+ <xsl:with-param name="to">{</xsl:with-param>
+ </xsl:call-template>
+ </xsl:template>
+
+ <xsl:template name="Replace">
+ <xsl:param name="s" />
+ <xsl:param name="from" />
+ <xsl:param name="to" />
+ <xsl:choose>
+ <xsl:when test="not(contains($s, $from))">
+ <xsl:value-of select="$s" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="prefix" select="substring-before($s, $from)"/>
+ <xsl:variable name="suffix" select="substring-after($s, $from)" />
+ <xsl:value-of select="$prefix" />
+ <xsl:value-of select="$to" />
+ <xsl:call-template name="Replace">
+ <xsl:with-param name="s" select="$suffix" />
+ <xsl:with-param name="from" select="$from" />
+ <xsl:with-param name="to" select="$to" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="getmodifiers">
+ <xsl:param name="sig"/>
+ <xsl:param name="protection" select="true()"/>
+ <xsl:param name="inheritance" select="true()"/>
+ <xsl:param name="extra" select="true()"/>
+ <xsl:param name="typetype" select="false()"/>
+
+ <xsl:variable name="Sig">
+ <xsl:text> </xsl:text>
+ <xsl:choose>
+ <xsl:when test="contains($sig, '{')">
+ <xsl:value-of select="substring-before ($sig, '{')" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$sig" />
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text> </xsl:text>
+ </xsl:variable>
+
+ <xsl:if test="$protection">
+ <xsl:if test="contains($Sig, ' public ')">public </xsl:if>
+ <xsl:if test="contains($Sig, ' private ')">private </xsl:if>
+ <xsl:if test="contains($Sig, ' protected ')">protected </xsl:if>
+ <xsl:if test="contains($Sig, ' internal ')">internal </xsl:if>
+ </xsl:if>
+
+ <xsl:if test="contains($Sig, ' static ')">static </xsl:if>
+ <xsl:if test="contains($Sig, ' abstract ')">abstract </xsl:if>
+ <xsl:if test="contains($Sig, ' operator ')">operator </xsl:if>
+
+ <xsl:if test="contains($Sig, ' const ')">const </xsl:if>
+ <xsl:if test="contains($Sig, ' readonly ')">readonly </xsl:if>
+
+ <xsl:if test="$inheritance">
+ <xsl:if test="contains($Sig, ' override ')">override </xsl:if>
+ <xsl:if test="contains($Sig, ' new ')">new </xsl:if>
+ </xsl:if>
+
+ <xsl:if test="$extra">
+ <xsl:if test="contains($Sig, ' sealed ')">sealed </xsl:if>
+ <xsl:if test="contains($Sig, ' virtual ')">virtual </xsl:if>
+
+ <xsl:if test="contains($Sig, ' extern ')">extern </xsl:if>
+ <xsl:if test="contains($Sig, ' checked ')">checked </xsl:if>
+ <xsl:if test="contains($Sig, ' unsafe ')">unsafe </xsl:if>
+ <xsl:if test="contains($Sig, ' volatile ')">volatile </xsl:if>
+ <xsl:if test="contains($Sig, ' explicit ')">explicit </xsl:if>
+ <xsl:if test="contains($Sig, ' implicit ')">implicit </xsl:if>
+ </xsl:if>
+
+ <xsl:if test="$typetype">
+ <xsl:if test="contains($Sig, ' class ')">class </xsl:if>
+ <xsl:if test="contains($Sig, ' interface ')">interface </xsl:if>
+ <xsl:if test="contains($Sig, ' struct ')">struct </xsl:if>
+ <xsl:if test="contains($Sig, ' delegate ')">delegate </xsl:if>
+ <xsl:if test="contains($Sig, ' enum ')">enum </xsl:if>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="GetTypeDescription">
+ <xsl:variable name="sig" select="TypeSignature[@Language='C#']/@Value"/>
+ <xsl:choose>
+ <xsl:when test="contains($sig, ' class ')">Class</xsl:when>
+ <xsl:when test="contains($sig, ' interface ')">Interface</xsl:when>
+ <xsl:when test="contains($sig, ' struct ')">Struct</xsl:when>
+ <xsl:when test="contains($sig, ' delegate ')">Delegate</xsl:when>
+ <xsl:when test="contains($sig, ' enum ')">Enum</xsl:when>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="since">
+ <p>
+ <i>Note: This namespace, class, or member is supported only in version <xsl:value-of select="@version" />
+ and later.</i>
+ </p>
+ </xsl:template>
+
+ <xsl:template name="GetLinkTargetHtml">
+ <xsl:param name="type" />
+ <xsl:param name="cref" />
+
+ <xsl:variable name="href">
+ <xsl:call-template name="GetLinkTarget">
+ <xsl:with-param name="type" select="$type" />
+ <xsl:with-param name="cref" select="$cref" />
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string($href) = ''">
+ <xsl:text>javascript:alert("Documentation not found.")</xsl:text>
+ </xsl:when>
+ <xsl:otherwise><xsl:value-of select="$href" /></xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+</xsl:stylesheet>
--- /dev/null
+<?xml version="1.0"?>
+
+<!--
+ mdoc-sections-css.xsl: Common CSS implementation of mdoc-html-utils.xsl
+ required functions.
+
+
+ Including XSLT files need to provide the following functions:
+
+ - CreateExpandedToggle()
+
+ Author: Jonathan Pryor <jpryor@novell.com>
+-->
+
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:monodoc="monodoc:///extensions"
+ exclude-result-prefixes="monodoc"
+ >
+
+ <xsl:template name="CreateH2Section">
+ <xsl:param name="name" />
+ <xsl:param name="id" select="''" />
+ <xsl:param name="child-id" select="generate-id (.)" />
+ <xsl:param name="content" />
+
+ <h2 class="Section">
+ <xsl:if test="$id != ''">
+ <xsl:attribute name="id">
+ <xsl:value-of select="$id" />
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:value-of select="$name" />
+ </h2>
+ <div class="SectionBox" id="{$child-id}">
+ <xsl:copy-of select="$content" />
+ </div>
+ </xsl:template>
+
+ <xsl:template name="CreateH3Section">
+ <xsl:param name="name" />
+ <xsl:param name="id" select="''" />
+ <xsl:param name="class" select="''" />
+ <xsl:param name="child-id" select="generate-id (.)" />
+ <xsl:param name="content" />
+
+ <h3>
+ <xsl:if test="$class != ''">
+ <xsl:attribute name="class">
+ <xsl:value-of select="$class" />
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$id != ''">
+ <xsl:attribute name="id">
+ <xsl:value-of select="$id" />
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:value-of select="$name" />
+ </h3>
+ <blockquote id="{$child-id}">
+ <xsl:copy-of select="$content" />
+ </blockquote>
+ </xsl:template>
+
+ <xsl:template name="CreateH4Section">
+ <xsl:param name="name" />
+ <xsl:param name="id" select="''" />
+ <xsl:param name="child-id" select="generate-id (.)" />
+ <xsl:param name="content" />
+
+ <h4 class="Subsection">
+ <xsl:if test="$id != ''">
+ <xsl:attribute name="id">
+ <xsl:value-of select="$id" />
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:value-of select="$name" />
+ </h4>
+ <blockquote class="SubsectionBox" id="{$child-id}">
+ <xsl:copy-of select="$content" />
+ </blockquote>
+ </xsl:template>
+
+ <xsl:template name="CreateEnumerationTable">
+ <xsl:param name="content" />
+ <table class="Enumeration">
+ <tr><th>Member Name</th><th>Description</th></tr>
+ <xsl:copy-of select="$content" />
+ </table>
+ </xsl:template>
+
+ <xsl:template name="CreateHeader">
+ <xsl:param name="content" />
+ <xsl:copy-of select="$content" />
+ </xsl:template>
+
+ <xsl:template name="CreateListTable">
+ <xsl:param name="header" />
+ <xsl:param name="content" />
+ <table class="Documentation">
+ <tr><xsl:copy-of select="$header" /></tr>
+ <xsl:copy-of select="$content" />
+ </table>
+ </xsl:template>
+
+ <xsl:template name="CreateMembersTable">
+ <xsl:param name="content" />
+ <table class="TypeMembers">
+ <xsl:copy-of select="$content" />
+ </table>
+ </xsl:template>
+
+ <xsl:template name="CreateSignature">
+ <xsl:param name="content" />
+ <h2>Syntax</h2>
+ <div class="Signature">
+ <xsl:copy-of select="$content" />
+ </div>
+ </xsl:template>
+
+ <xsl:template name="CreateTypeDocumentationTable">
+ <xsl:param name="content" />
+ <table class="TypeDocumentation">
+ <tr><th>Type</th><th>Reason</th></tr>
+ <xsl:copy-of select="$content" />
+ </table>
+ </xsl:template>
+
+</xsl:stylesheet>
+
--- /dev/null
+<?xml version="1.0"?>
+
+<!--
+ mdoc-sections.xsl: Common non-CSS implementation of mdoc-html-utils.xsl
+ required functions.
+
+ Author: Jonathan Pryor <jpryor@novell.com>
+
+-->
+
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:monodoc="monodoc:///extensions"
+ exclude-result-prefixes="monodoc"
+ >
+ <xsl:template name="CreateH2Section">
+ <xsl:param name="name" />
+ <xsl:param name="id" select="''" />
+ <xsl:param name="child-id" select="generate-id (.)" />
+ <xsl:param name="content" />
+
+ <h2 class="Section">
+ <xsl:value-of select="$name" />
+ </h2>
+ <blockquote id="{$child-id}">
+ <xsl:copy-of select="$content" />
+ </blockquote>
+ </xsl:template>
+
+ <xsl:template name="CreateH3Section">
+ <xsl:param name="name" />
+ <xsl:param name="id" select="''" />
+ <xsl:param name="class" select="''" />
+ <xsl:param name="child-id" select="generate-id (.)" />
+ <xsl:param name="content" />
+
+ <h3>
+ <xsl:value-of select="$name" />
+ </h3>
+ <blockquote id="{$child-id}">
+ <xsl:copy-of select="$content" />
+ </blockquote>
+ </xsl:template>
+
+ <xsl:template name="CreateH4Section">
+ <xsl:param name="name" />
+ <xsl:param name="id" select="''" />
+ <xsl:param name="child-id" select="generate-id (.)" />
+ <xsl:param name="content" />
+
+ <h4 class="Subsection">
+ <xsl:value-of select="$name" />
+ </h4>
+ <blockquote class="SubsectionBox" id="{$child-id}">
+ <xsl:copy-of select="$content" />
+ </blockquote>
+ </xsl:template>
+
+ <xsl:template name="CreateEnumerationTable">
+ <xsl:param name="content" />
+ <table class="EnumerationsTable" border="1" cellpadding="10" width="100%">
+ <tr bgcolor="#f2f2f2">
+ <th>Member Name</th>
+ <th>Description</th>
+ </tr>
+ <xsl:copy-of select="$content" />
+ </table>
+ </xsl:template>
+
+ <xsl:template name="CreateHeader">
+ <xsl:param name="content" />
+ <table class="HeaderTable" width="100%" cellpadding="5">
+ <tr bgcolor="#b0c4de">
+ <td>
+ <xsl:copy-of select="$content" />
+ </td>
+ </tr>
+ </table>
+ </xsl:template>
+
+ <xsl:template name="CreateListTable">
+ <xsl:param name="header" />
+ <xsl:param name="content" />
+ <table border="1" cellpadding="3" width="100%">
+ <tr bgcolor="#f2f2f2" valign="top">
+ <xsl:copy-of select="$header" />
+ </tr>
+ <xsl:copy-of select="$content" />
+ </table>
+ </xsl:template>
+
+ <xsl:template name="CreateMembersTable">
+ <xsl:param name="content" />
+ <table border="1" cellpadding="6" width="100%">
+ <xsl:copy-of select="$content" />
+ </table>
+ </xsl:template>
+
+ <xsl:template name="CreateSignature">
+ <xsl:param name="content" />
+ <table class="SignatureTable" bgcolor="#c0c0c0" cellspacing="0" width="100%">
+ <tr><td>
+ <table class="InnerSignatureTable" cellpadding="10" cellspacing="0" width="100%">
+ <tr bgcolor="#f2f2f2">
+ <td>
+ <xsl:copy-of select="$content" />
+ </td></tr>
+ </table>
+ </td></tr>
+ </table>
+ <br />
+ </xsl:template>
+
+ <xsl:template name="CreateTypeDocumentationTable">
+ <xsl:param name="content" />
+ <table class="TypePermissionsTable" border="1" cellpadding="6" width="100%">
+ <tr bgcolor="#f2f2f2"><th>Type</th><th>Reason</th></tr>
+ <xsl:copy-of select="$content" />
+ </table>
+ </xsl:template>
+
+</xsl:stylesheet>
--- /dev/null
+<?xml version="1.0"?>
+
+<!--
+ mono-ecma-css.xsl: ECMA-style docs to HTML+CSS stylesheet trasformation
+ based on mono-ecma.xsl by Joshua Tauberer
+
+ Author: Joshua Tauberer (tauberer@for.net)
+ Author: Mario Sopena Novales (mario.sopena@gmail.com)
+
+ TODO:
+ split this into multiple files
+-->
+
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:monodoc="monodoc:///extensions"
+ exclude-result-prefixes="monodoc"
+ >
+ <xsl:include href="mdoc-sections-css.xsl" />
+ <xsl:include href="mono-ecma-impl.xsl" />
+
+ <xsl:output omit-xml-declaration="yes" />
+
+ <xsl:template name="CreateExpandedToggle">
+ <img src="xtree/images/clean/Lminus.gif" border="0" align="top"/>
+ </xsl:template>
+
+ <xsl:template name="CreateCodeBlock">
+ <xsl:param name="language" />
+ <xsl:param name="content" />
+
+ <div class="CodeExample">
+ <p><b><xsl:value-of select="$language"/> Example</b></p>
+ <div>
+ <pre>
+ <!--
+ <xsl:value-of select="monodoc:Colorize($content, string($language))"
+ disable-output-escaping="yes" />
+ -->
+ <xsl:value-of select="$content" />
+ </pre>
+ </div>
+ </div>
+ </xsl:template>
+
+</xsl:stylesheet>
--- /dev/null
+<?xml version="1.0"?>
+
+<!--
+ mono-ecma-impl.xsl: ECMA-style docs to HTML stylesheet trasformation
+
+ Author: Joshua Tauberer (tauberer@for.net)
+ Author: Jonathan Pryor (jpryor@novell.com)
+
+ This file requires that including files define the following callable
+ templates:
+ - CreateCodeBlock (language, content)
+ - CreateEnumerationTable (content)
+ - CreateHeader (content)
+ - CreateListTable (header, content)
+ - CreateMembersTable (content)
+ - CreateSignature (content)
+ - CreateTypeDocumentationTable (content)
+
+-->
+
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:monodoc="monodoc:///extensions"
+ exclude-result-prefixes="monodoc"
+ >
+ <xsl:include href="mdoc-html-utils.xsl" />
+
+ <!-- TEMPLATE PARAMETERS -->
+
+ <xsl:param name="show"/>
+ <xsl:param name="membertype"/>
+ <xsl:param name="namespace"/>
+
+ <!-- THE MAIN RENDERING TEMPLATE -->
+
+ <xsl:template match="Type|elements">
+ <!-- The namespace that the current type belongs to. -->
+ <xsl:variable name="TypeNamespace" select="substring(@FullName, 1, string-length(@FullName) - string-length(@Name) - 1)"/>
+
+ <!-- HEADER -->
+
+ <xsl:variable name="typename" select="translate (@FullName, '+', '.')" />
+ <xsl:variable name="typelink">
+ <xsl:call-template name="GetEscapedTypeName">
+ <xsl:with-param name="typename" select="@FullName" />
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="basename">
+ <xsl:if test="Base/BaseTypeName">
+ <xsl:value-of select="translate (Base/BaseTypeName, '+', '.')" />
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="baselink">
+ <xsl:if test="Base/BaseTypeName">
+ <xsl:call-template name="GetEscapedTypeName">
+ <xsl:with-param name="typename" select="Base/BaseTypeName" />
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:variable>
+
+ <xsl:call-template name="CreateHeader">
+ <xsl:with-param name="content">
+ <ul class="breadcrumb">
+ <xsl:choose>
+ <xsl:when test="$show='masteroverview'">
+ <li class="namespace">
+ <xsl:text>Namespaces in this Collection</xsl:text>
+ </li>
+ </xsl:when>
+ <xsl:when test="$show='typeoverview'">
+ <li class="namespace">
+ <a>
+ <xsl:attribute name="href">N:<xsl:value-of select="$TypeNamespace"/></xsl:attribute>
+ <xsl:value-of select="$TypeNamespace"/></a>
+ </li>
+ <li class="pubclass">
+ <xsl:value-of select="@Name"/>
+ </li>
+ </xsl:when>
+ <xsl:when test="$show='members'">
+ <li class="namespace">
+ <a>
+ <xsl:attribute name="href">N:<xsl:value-of select="$TypeNamespace"/></xsl:attribute>
+ <xsl:value-of select="$TypeNamespace"/>
+ </a>
+ </li>
+ <li class="pubclass">
+ <a>
+ <xsl:attribute name="href">
+ <xsl:text>T:</xsl:text>
+ <xsl:value-of select="$typelink" />
+ </xsl:attribute>
+ <xsl:value-of select="@Name"/>
+ </a>
+ </li>
+ <li class="members">
+ Members
+ </li>
+ </xsl:when>
+ <xsl:when test="$show='member' or $show='overloads'">
+ <li class="namespace">
+ <a>
+ <xsl:attribute name="href">N:<xsl:value-of select="$TypeNamespace"/></xsl:attribute>
+ <xsl:value-of select="$TypeNamespace"/></a>
+ </li>
+ <li class="pubclass">
+ <a>
+ <xsl:attribute name="href">
+ <xsl:text>T:</xsl:text>
+ <xsl:value-of select="$typelink" />
+ </xsl:attribute>
+ <xsl:value-of select="@Name"/>
+ </a>
+ </li>
+ <li class="pubproperty">
+ <xsl:choose>
+ <xsl:when test="$membertype='Operator'">
+ <xsl:value-of select="$typename"/>
+ <xsl:value-of select="' '"/> <!-- hard space -->
+ <xsl:value-of select="substring-after(Members/Member[MemberType='Method'][position()=$index+1]/@MemberName, 'op_')"/>
+ </xsl:when>
+ <xsl:when test="$membertype='Constructor'">
+ <xsl:value-of select="$typename"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="Members/Member[MemberType=$membertype][position()=$index+1]/@MemberName"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </li>
+ </xsl:when>
+ <xsl:when test="$show='namespace'">
+ <li class="namespace">
+ <xsl:value-of select="$namespace"/>
+ </li>
+ </xsl:when>
+ </xsl:choose>
+ </ul>
+ <div class="named-header">
+ <xsl:choose>
+ <xsl:when test="$show='masteroverview'">
+ <xsl:text>Master Overview</xsl:text>
+ </xsl:when>
+ <xsl:when test="$show='typeoverview'">
+ <xsl:value-of select="$typename"/>
+ <xsl:value-of select="' '"/>
+ <xsl:call-template name="gettypetype"/>
+ </xsl:when>
+ <xsl:when test="$show='members' and $membertype='All'">
+ <xsl:value-of select="$typename"/>
+ <xsl:text> Members</xsl:text>
+ </xsl:when>
+ <xsl:when test="$show='members'">
+ <xsl:value-of select="$typename"/>
+ <xsl:text>: </xsl:text>
+ <xsl:value-of select="$membertype"/>
+ <xsl:text> Members</xsl:text>
+ </xsl:when>
+ <xsl:when test="$show='member'">
+ <xsl:choose>
+ <xsl:when test="$membertype='Operator'">
+ <xsl:value-of select="$typename"/>
+ <xsl:value-of select="' '"/> <!-- hard space -->
+ <xsl:value-of select="substring-after(Members/Member[MemberType='Method'][position()=$index+1]/@MemberName, 'op_')"/>
+ </xsl:when>
+ <xsl:when test="$membertype='Constructor'">
+ <xsl:value-of select="$typename"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$typename"/>.<xsl:value-of select="Members/Member[MemberType=$membertype][position()=$index+1]/@MemberName"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:value-of select="' '"/>
+ <xsl:value-of select="$membertype"/>
+ </xsl:when>
+
+ <xsl:when test="$show='namespace'">
+ <xsl:value-of select="$namespace"/>
+ <xsl:text> Namespace</xsl:text>
+ </xsl:when>
+
+ <xsl:when test="$show='overloads'">
+ <xsl:value-of select="$typename"/>.<xsl:value-of select="$index"/> Overloads
+ </xsl:when>
+
+ </xsl:choose>
+ </div>
+ </xsl:with-param>
+ </xsl:call-template>
+
+ <!-- SELECT WHAT TYPE OF VIEW:
+ typeoverview
+ members
+ member
+ -->
+ <div class="Content">
+ <xsl:choose>
+ <xsl:when test="$show='masteroverview'">
+
+ <xsl:for-each select="namespace">
+ <xsl:sort select="@ns"/>
+
+ <!-- Don't display the namespace if it is a sub-namespace of another one.
+ But don't consider namespaces without periods, e.g. 'System', to be
+ parent namespaces because then most everything will get grouped under it. -->
+ <xsl:variable name="ns" select="@ns"/>
+ <xsl:if test="count(parent::*/namespace[not(substring-before(@ns, '.')='') and starts-with($ns, concat(@ns, '.'))])=0">
+
+ <p>
+ <b><a href="N:{@ns}"><xsl:value-of select="@ns"/></a></b>
+ </p>
+ <blockquote>
+ <div>
+ <xsl:apply-templates select="summary" mode="notoppara"/>
+ </div>
+
+ <!-- Display the sub-namespaces of this namespace -->
+ <xsl:if test="not(substring-before($ns, '.')='')">
+ <xsl:for-each select="parent::*/namespace[starts-with(@ns, concat($ns, '.'))]">
+ <br/>
+ <div><a href="N:{@ns}"><xsl:value-of select="@ns"/></a></div>
+ <div><xsl:apply-templates select="summary" mode="notoppara"/></div>
+ </xsl:for-each>
+ </xsl:if>
+ </blockquote>
+
+ </xsl:if>
+ </xsl:for-each>
+
+ </xsl:when>
+ <!-- TYPE OVERVIEW -->
+ <xsl:when test="$show='typeoverview'">
+ <xsl:variable name="implemented" select="monodoc:MonoImpInfo(string(AssemblyInfo/AssemblyName), string(@FullName), true())" />
+ <xsl:call-template name="CreateTypeOverview">
+ <xsl:with-param name="implemented" select="$implemented" />
+ <xsl:with-param name="show-members-link" select="true()" />
+ </xsl:call-template>
+
+
+ <!-- signature -->
+ <xsl:call-template name="CreateTypeSignature" />
+
+ <xsl:call-template name="DisplayDocsInformation">
+ <xsl:with-param name="linkid" select="concat ('T:', @FullName)" />
+ </xsl:call-template>
+ </xsl:when>
+
+ <!-- MEMBER LISTING -->
+ <xsl:when test="$show='members'">
+ <xsl:if test="$membertype='All'">
+ <p>
+ The members of <xsl:value-of select="$typename"/> are listed below.
+ </p>
+
+ <xsl:if test="Base/BaseTypeName">
+ <p>
+ <xsl:text>See Also: </xsl:text>
+ <a>
+ <xsl:attribute name="href">T:<xsl:value-of select="$baselink"/>/*</xsl:attribute>
+ <xsl:text>Inherited members from </xsl:text>
+ <xsl:value-of select="$basename"/>
+ </a>
+ </p>
+ </xsl:if>
+
+ <ul class="TypeMembersIndex">
+ <xsl:if test="count(Members/Member[MemberType='Constructor'])">
+ <li>
+ <a><xsl:attribute name="href">T:<xsl:value-of select="$typelink"/>/C</xsl:attribute>Constructors</a>
+ </li>
+ </xsl:if>
+ <xsl:if test="count(Members/Member[MemberType='Field'])">
+ <li>
+ <a><xsl:attribute name="href">T:<xsl:value-of select="$typelink"/>/F</xsl:attribute>Fields</a>
+ </li>
+ </xsl:if>
+ <xsl:if test="count(Members/Member[MemberType='Property'])">
+ <li>
+ <a><xsl:attribute name="href">T:<xsl:value-of select="$typelink"/>/P</xsl:attribute>Properties</a>
+ </li>
+ </xsl:if>
+ <xsl:if test="count(Members/Member[MemberType='Method' and not(starts-with(@MemberName,'op_'))])">
+ <li>
+ <a><xsl:attribute name="href">T:<xsl:value-of select="$typelink"/>/M</xsl:attribute>Methods</a>
+ </li>
+ </xsl:if>
+ <xsl:if test="count(Members/Member[MemberType='Event'])">
+ <li>
+ <a><xsl:attribute name="href">T:<xsl:value-of select="$typelink"/>/E</xsl:attribute>Events</a>
+ </li>
+ </xsl:if>
+ <xsl:if test="count(Members/Member[MemberType='Method' and starts-with(@MemberName,'op_')])">
+ <li>
+ <a><xsl:attribute name="href">T:<xsl:value-of select="$typelink"/>/E</xsl:attribute>Events</a>
+ </li>
+ </xsl:if>
+ <xsl:if test="count(Members/Member[MemberType='ExtensionMethod'])">
+ <li>
+ <a><xsl:attribute name="href">T:<xsl:value-of select="$typelink"/>/X</xsl:attribute>Extension Methods</a>
+ </li>
+ </xsl:if>
+ </ul>
+
+ <!-- list each type of member (public, then protected) -->
+
+ <xsl:call-template name="ListAllMembers" />
+ </xsl:if>
+
+ <xsl:if test="not($membertype='All')">
+ <!-- list the members of this type (public, then protected) -->
+
+ <p>
+ The
+ <xsl:call-template name="membertypeplurallc"><xsl:with-param name="name" select="$membertype"/></xsl:call-template>
+ of <xsl:value-of select="$typename"/> are listed below. For a list of all members, see the <a>
+ <xsl:attribute name="href">T:<xsl:value-of select="$typelink"/>/*</xsl:attribute>
+ <xsl:value-of select="@Name"/> Members</a> list.
+ </p>
+
+ <xsl:if test="Base/BaseTypeName">
+ <p>
+ <xsl:text>See Also: </xsl:text>
+ <a>
+ <xsl:attribute name="href">T:<xsl:value-of select="$baselink"/>/*</xsl:attribute>
+ <xsl:text>Inherited members from </xsl:text>
+ <xsl:value-of select="$basename"/>
+ </a>
+ </p>
+ </xsl:if>
+
+ <xsl:call-template name="ListMembers">
+ <xsl:with-param name="listmembertype" select="$membertype"/>
+ <xsl:with-param name="showprotected" select="false()"/>
+ </xsl:call-template>
+
+ <xsl:call-template name="ListMembers">
+ <xsl:with-param name="listmembertype" select="$membertype"/>
+ <xsl:with-param name="showprotected" select="true()"/>
+ </xsl:call-template>
+ </xsl:if>
+
+ </xsl:when>
+
+ <xsl:when test="$show='overloads'">
+ <p>
+ The overloads of <xsl:value-of select="$index"/>
+ are listed below. For a list of all members, see the <a>
+ <xsl:attribute name="href">T:<xsl:value-of select="$typelink"/>/*</xsl:attribute>
+ <xsl:value-of select="@Name"/> Members</a> list.
+ </p>
+
+ <!-- TODO: can we make this actually test if there are any overloads
+ <xsl:if test="Base/BaseTypeName">
+ <p>
+ See Also: <a>
+ <xsl:attribute name="href">T:<xsl:value-of select="Base/BaseTypeName"/>/*</xsl:attribute>
+ Inherited members</a> from <xsl:value-of select="Base/BaseTypeName"/>
+ </p>
+ </xsl:if>
+ -->
+
+ <xsl:call-template name="ListMembers">
+ <xsl:with-param name="listmembertype" select="$membertype"/>
+ <xsl:with-param name="showprotected" select="false()"/>
+ <xsl:with-param name="overloads-mode" select="true()"/>
+ </xsl:call-template>
+
+ <xsl:call-template name="ListMembers">
+ <xsl:with-param name="listmembertype" select="$membertype"/>
+ <xsl:with-param name="showprotected" select="true()"/>
+ <xsl:with-param name="overloads-mode" select="true()"/>
+ </xsl:call-template>
+ </xsl:when>
+ <!-- MEMBER DETAILS -->
+ <xsl:when test="$show='member'">
+ <xsl:variable name="Type" select="."/>
+
+ <!-- select the member, this just loops through the one member that we are to display -->
+ <xsl:for-each select="Members/Member[MemberType=$membertype or ($membertype='Operator' and MemberType='Method')][position()=$index+1]">
+
+ <!-- summary -->
+
+ <xsl:call-template name="CreateMemberOverview">
+ <xsl:with-param name="implemented" select="monodoc:MonoImpInfo(string(AssemblyInfo/AssemblyName), string(@FullName), true())" />
+ </xsl:call-template>
+
+ <xsl:call-template name="CreateMemberSignature">
+ <xsl:with-param name="linkid" select="concat ('T:', @FullName)" />
+ </xsl:call-template>
+
+ <div class="MemberBox">
+ <xsl:call-template name="DisplayDocsInformation">
+ <xsl:with-param name="linkid" select="concat ('T:', @FullName)" />
+ </xsl:call-template>
+ </div>
+
+ </xsl:for-each>
+
+ </xsl:when>
+
+ <!-- NAMESPACE SUMMARY -->
+ <xsl:when test="$show='namespace'">
+
+ <!-- summary -->
+
+ <p>
+ <xsl:apply-templates select="summary" mode="notoppara"/>
+ <xsl:if test="monodoc:MonoEditing()">
+ <xsl:value-of select="' '" />
+ [<a href="{monodoc:EditUrlNamespace (., $namespace, 'summary')}">Edit</a>]
+ </xsl:if>
+ </p>
+
+ <!-- remarks -->
+
+ <xsl:if test="not(remarks = '')">
+ <h2>Remarks</h2>
+ <div class="SectionBox">
+ <xsl:apply-templates select="remarks"/>
+ <xsl:if test="monodoc:MonoEditing()">
+ <xsl:value-of select="' '" />
+ [<a href="{monodoc:EditUrlNamespace (., $namespace, 'remarks')}">Edit</a>]
+ </xsl:if>
+ </div>
+ </xsl:if>
+
+ <xsl:call-template name="namespacetypes">
+ <xsl:with-param name="typetype" select="'class'"/>
+ <xsl:with-param name="typetitle" select="'Classes'"/>
+ </xsl:call-template>
+
+ <xsl:call-template name="namespacetypes">
+ <xsl:with-param name="typetype" select="'interface'"/>
+ <xsl:with-param name="typetitle" select="'Interfaces'"/>
+ </xsl:call-template>
+
+ <xsl:call-template name="namespacetypes">
+ <xsl:with-param name="typetype" select="'struct'"/>
+ <xsl:with-param name="typetitle" select="'Structs'"/>
+ </xsl:call-template>
+
+ <xsl:call-template name="namespacetypes">
+ <xsl:with-param name="typetype" select="'delegate'"/>
+ <xsl:with-param name="typetitle" select="'Delegates'"/>
+ </xsl:call-template>
+
+ <xsl:call-template name="namespacetypes">
+ <xsl:with-param name="typetype" select="'enum'"/>
+ <xsl:with-param name="typetitle" select="'Enumerations'"/>
+ </xsl:call-template>
+
+
+ </xsl:when>
+
+ <!-- don't know what kind of page this is -->
+ <xsl:otherwise>
+ Don't know what to do!
+ </xsl:otherwise>
+
+ </xsl:choose>
+ </div>
+
+ <!-- FOOTER -->
+
+ <div class="Footer">
+ </div>
+
+ </xsl:template>
+
+ <xsl:template name="GetLinkTarget">
+ <xsl:param name="type" />
+ <xsl:param name="cref" />
+
+ <xsl:value-of select="$cref" />
+ </xsl:template>
+
+ <xsl:template name="namespacetypes">
+ <xsl:param name="typetype"/>
+ <xsl:param name="typetitle"/>
+
+ <xsl:variable name="NODES" select="*[name()=$typetype]"/>
+
+ <xsl:if test="count($NODES)">
+
+ <xsl:call-template name="CreateH2Section">
+ <xsl:with-param name="name" select="$typetitle" />
+ <xsl:with-param name="child-id" select="$typetitle" />
+ <xsl:with-param name="content">
+
+ <xsl:call-template name="CreateTypeDocumentationTable">
+ <xsl:with-param name="content">
+ <xsl:for-each select="$NODES">
+ <xsl:sort select="@name"/>
+
+ <tr>
+ <td>
+ <a>
+ <xsl:attribute name="href">
+ <xsl:text>T:</xsl:text>
+ <xsl:call-template name="GetEscapedTypeName">
+ <xsl:with-param name="typename" select="@fullname" />
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:value-of select="@name"/>
+ </a>
+
+ <xsl:variable name="containingtype" select="substring-before(@fullname, concat('+',@name))"/>
+ <xsl:if test="$containingtype">
+ <br/>(in
+ <xsl:call-template name="maketypelink">
+ <xsl:with-param name="type" select="$containingtype"/>
+ <xsl:with-param name="wrt" select="$namespace"/>
+ </xsl:call-template>)
+ </xsl:if>
+ </td>
+ <td>
+ <xsl:apply-templates select="summary" mode="notoppara"/>
+
+ <xsl:variable name="MonoImplInfo" select="monodoc:MonoImpInfo(string(@assembly), string(@fullname), false())"/>
+ <xsl:if test="$MonoImplInfo"><br/><b><xsl:value-of disable-output-escaping="yes" select="$MonoImplInfo"/></b></xsl:if>
+ </td>
+ </tr>
+ </xsl:for-each>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="CreateEditLink">
+ <xsl:param name="e" />
+ <xsl:if test="monodoc:MonoEditing()">
+ <xsl:value-of select="' '" />
+ [<a href="{monodoc:EditUrl ($e)}">Edit</a>]
+ </xsl:if>
+ </xsl:template>
+
+</xsl:stylesheet>
--- /dev/null
+body
+{
+ font-family: "Lucida Grande", Geneva, Helvetica, Arial, Verdana, Sans-Serif;
+ margin: 0;
+ padding: 0;
+ color: #333333;
+}
+
+a:link
+{
+ color: #034af3;
+ text-decoration: underline;
+}
+a:visited
+{
+ color: #505abc;
+}
+a:hover
+{
+ color: #1d60ff;
+ text-decoration: none;
+}
+a:active
+{
+ color: #12eb87;
+}
+
+pre
+{
+ font-family: Consolas, "Courier New", Monospace;
+ border: 1px solid #CCCCCC;
+ background-color: #F7F7F7;
+ padding: 7px;
+ margin: 0 20px 0 20px;
+ line-height: 1.3em;
+ -moz-border-radius: 3px;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+}
+
+img
+{
+ border: 0px;
+}
+
+/* HEADINGS
+----------------------------------------------------------*/
+h1, h2, h3, h4, h5, h6
+{
+ color: #000;
+ font-family: Arial, Helvetica, sans-serif;
+}
+
+h1
+{
+ font-size: 16pt;
+ padding-bottom: 0;
+ margin-bottom: 0;
+}
+h2
+{
+ font-size: 14pt;
+ padding: 0 0 1px 0;
+ border-bottom: 1px solid #DDDDDD;
+ margin-top: 20px;
+}
+h3
+{
+ font-size: 12pt;
+ margin-top: 20px;
+ margin-bottom: 5px;
+}
+h4
+{
+ font-size: 11pt;
+}
+h5, h6
+{
+ font-size: 10pt;
+}
+
+/* this rule styles <h2> tags that are the
+first child of the left and right table columns */
+.rightColumn > h1, .rightColumn > h2, .leftColumn > h1, .leftColumn > h2
+{
+ margin-top: 0;
+}
+
+/* PRIMARY LAYOUT ELEMENTS
+----------------------------------------------------------*/
+
+/* you can specify a greater or lesser percentage for the
+page width. Or, you can specify an exact pixel width. */
+.page
+{
+ padding: 0;
+ margin: 0;
+}
+
+#header
+{
+ position: relative;
+ margin-bottom: 0px;
+ color: #000;
+ padding: 0 0 0 15px;
+ background: url('mdocimages/headerbg.png');
+ background-position: right;
+ background-repeat: no-repeat;
+ background-color: #679EF1;
+ height: 40px;
+ border-bottom: 1px solid #98C2F7;
+ border-bottom: 1px dotted #3363BD;
+}
+
+#header h1
+{
+ font-weight: bold;
+ padding: 0;
+ margin: 0;
+ color: #fff;
+ border: none;
+ line-height: 1.8em;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 22px !important;
+}
+
+#main
+{
+ padding: 0px 0px 15px 0px;
+ background-color: #fff;
+ margin-bottom: 30px;
+ _height: 1px; /* only IE6 applies CSS properties starting with an underscore */
+}
+
+#footer
+{
+ color: #999;
+ padding: 10px 0;
+ text-align: center;
+ line-height: normal;
+ margin: 0;
+ font-size: 8pt;
+}
+
+#line-background
+{
+ background-image: url('mdocimages/treebg.png');
+ background-repeat: repeat-y;
+ height: 100%;
+}
+
+#left-content
+{
+ float: left;
+ width: 186px;
+ padding-top: 5px;
+ margin-right: 5px;
+ overflow: hidden;
+}
+
+#right-content
+{
+ padding-top: 0px;
+ overflow: auto;
+ height: 100%;
+}
+
+.right-content-pad
+{
+ margin: 6px 10px 0px 10px;
+}
+
+.named-header
+{
+ background: url('mdocimages/hatch.png') repeat-x left bottom;
+ height: 48px;
+ background-color: #FAFBFD;
+ font-size: 16pt;
+ font-weight: bold;
+ padding: 8px 0 0 10px;
+ font-family: 'Segoe UI',Verdana,Arial, sans-serif;
+}
+
+.member-list
+{
+ border-spacing: 0px;
+}
+
+.member-list td
+{
+ padding: 4px;
+ margin: 0px;
+ border-bottom: 1px dotted #CCCCCC;
+}
+
+.member-list
+{
+
+}
+/* TAB MENU
+----------------------------------------------------------*/
+ul#menu
+{
+ border-bottom: 1px #5C87B2 solid;
+ padding: 0 0 2px;
+ position: relative;
+ margin: 0;
+ text-align: right;
+}
+
+ul#menu li
+{
+ display: inline;
+ list-style: none;
+}
+
+ul#menu li#greeting
+{
+ padding: 10px 20px;
+ font-weight: bold;
+ text-decoration: none;
+ line-height: 2.8em;
+ color: #fff;
+}
+
+ul#menu li a
+{
+ padding: 10px 20px;
+ font-weight: bold;
+ text-decoration: none;
+ line-height: 2.8em;
+ background-color: #e8eef4;
+ color: #034af3;
+}
+
+ul#menu li a:hover
+{
+ background-color: #fff;
+ text-decoration: none;
+}
+
+ul#menu li a:active
+{
+ background-color: #a6e2a6;
+ text-decoration: none;
+}
+
+ul#menu li.selected a
+{
+ background-color: #fff;
+ color: #000;
+}
+
+/* FORM LAYOUT ELEMENTS
+----------------------------------------------------------*/
+
+fieldset
+{
+ margin: 1em 0;
+ padding: 1em;
+ border: 1px solid #CCC;
+}
+
+fieldset p
+{
+ margin: 2px 12px 10px 10px;
+}
+
+legend
+{
+ font-size: 11pt;
+ font-weight: 600;
+ padding: 2px 4px 8px 4px;
+}
+
+input[type="text"]
+{
+ width: 200px;
+ border: 1px solid #CCC;
+}
+
+input[type="password"]
+{
+ width: 200px;
+ border: 1px solid #CCC;
+}
+
+/* TABLE
+----------------------------------------------------------*/
+
+table
+{
+/* border: solid 1px #e8eef4;
+ border-collapse: collapse;*/
+}
+
+table td
+{
+ padding: 5px;
+/* border: solid 1px #e8eef4;*/
+}
+
+table th
+{
+ padding: 6px 5px;
+ text-align: left;
+ background-color: #e8eef4;
+ border: solid 1px #e8eef4;
+}
+
+/* MISC
+----------------------------------------------------------*/
+.clear
+{
+ clear: both;
+}
+
+.error
+{
+ color:Red;
+}
+
+.indent
+{
+ margin-left: 20px;
+ margin-right: 20px;
+}
+
+#menucontainer
+{
+ margin-top:40px;
+}
+
+div#title
+{
+ display:block;
+ float:left;
+ text-align:left;
+}
+
+#logindisplay
+{
+ font-size:11pt;
+ display:block;
+ text-align:right;
+ margin:0px;
+ color:White;
+}
+
+#logindisplay a:link
+{
+ color: white;
+ text-decoration: underline;
+}
+
+#logindisplay a:visited
+{
+ color: white;
+ text-decoration: underline;
+}
+
+#logindisplay a:hover
+{
+ color: white;
+ text-decoration: none;
+}
+
+/* Styles for validation helpers
+-----------------------------------------------------------*/
+.field-validation-error
+{
+ color: #ff0000;
+}
+
+.field-validation-valid
+{
+ display: none;
+}
+
+.input-validation-error
+{
+ border: 1px solid #ff0000;
+ background-color: #ffeeee;
+}
+
+.validation-summary-errors
+{
+ font-weight: bold;
+ color: #ff0000;
+}
+
+.validation-summary-valid
+{
+ display: none;
+}
+
+/* Styles for editor and display helpers
+----------------------------------------------------------*/
+.display-label,
+.editor-label,
+.display-field,
+.editor-field
+{
+ margin: 0.5em 0;
+}
+
+.text-box
+{
+ width: 30em;
+}
+
+.text-box.multi-line
+{
+ height: 6.5em;
+}
+
+.tri-state
+{
+ width: 6em;
+}
+
+/* Breadcrumb Bar */
+.breadcrumb
+{
+ border-left: 1px solid #cacaca;
+ border-right: 1px solid #cacaca;
+ border-bottom: 1px solid #cacaca;
+ background-image: url('mdocimages/bc_bg.png');
+ background-repeat: repeat-x;
+ height: 25px;
+ line-height: 25px;
+ color: #454545;
+ border-top: 0px;
+ width: 100%;
+ overflow: hidden;
+ margin-left: -2px;
+ padding: 0px;
+ font-style: normal;
+ font-variant: normal;
+ font-weight: normal;
+ font-size: 11px;
+ font-family: Arial, Helvetica, sans-serif;
+ margin-right: 0px;
+ margin-top: 0px;
+ margin-bottom: 0px;
+}
+
+.breadcrumb li
+{
+ list-style-type: none;
+ float: left;
+ padding-left: 25px;
+ background-position: 5px center;
+ background-repeat: no-repeat;
+}
+
+.breadcrumb li.pubclass { background-image: url('mdocimages/pubclass.png'); }
+.breadcrumb li.pubdelegate { background-image: url('mdocimages/pubdelegate.png'); }
+.breadcrumb li.pubenumeration { background-image: url('mdocimages/pubenumeration.png'); }
+.breadcrumb li.pubevent { background-image: url('mdocimages/pubevent.png'); }
+.breadcrumb li.pubextension { background-image: url('mdocimages/pubextension.png'); }
+.breadcrumb li.pubfield { background-image: url('mdocimages/pubfield.png'); }
+.breadcrumb li.pubinterface { background-image: url('mdocimages/pubinterface.png'); }
+.breadcrumb li.pubmethod { background-image: url('mdocimages/pubmethod.png'); }
+.breadcrumb li.pubproperty { background-image: url('mdocimages/pubproperty.png'); }
+.breadcrumb li.pubstructure { background-image: url('mdocimages/pubstructure.png'); }
+
+.breadcrumb li.protclass { background-image: url('mdocimages/protclass.png'); }
+.breadcrumb li.protdelegate { background-image: url('mdocimages/protdelegate.png'); }
+.breadcrumb li.protenumeration { background-image: url('mdocimages/protenumeration.png'); }
+.breadcrumb li.protevent { background-image: url('mdocimages/protevent.png'); }
+.breadcrumb li.protextension { background-image: url('mdocimages/protextension.png'); }
+.breadcrumb li.protfield { background-image: url('mdocimages/protfield.png'); }
+.breadcrumb li.protinterface { background-image: url('mdocimages/protinterface.png'); }
+.breadcrumb li.protmethod { background-image: url('mdocimages/protmethod.png'); }
+.breadcrumb li.protproperty { background-image: url('mdocimages/protproperty.png'); }
+.breadcrumb li.protstructure { background-image: url('mdocimages/protstructure.png'); }
+
+.breadcrumb li.privclass { background-image: url('mdocimages/privclass.png'); }
+.breadcrumb li.privdelegate { background-image: url('mdocimages/privdelegate.png'); }
+.breadcrumb li.privenumeration { background-image: url('mdocimages/privenumeration.png'); }
+.breadcrumb li.privevent { background-image: url('mdocimages/privevent.png'); }
+.breadcrumb li.privextension { background-image: url('mdocimages/privextension.png'); }
+.breadcrumb li.privfield { background-image: url('mdocimages/privfield.png'); }
+.breadcrumb li.privinterface { background-image: url('mdocimages/privinterface.png'); }
+.breadcrumb li.privmethod { background-image: url('mdocimages/privmethod.png'); }
+.breadcrumb li.privproperty { background-image: url('mdocimages/privproperty.png'); }
+.breadcrumb li.privstructure { background-image: url('mdocimages/privstructure.png'); }
+
+.breadcrumb li.namespace
+{
+ padding-left: 26px;
+ background-image: url('mdocimages/namespace.png');
+}
+
+.breadcrumb li.reference
+{
+ padding-left: 26px;
+ background-image: url('mdocimages/reference.png');
+}
+
+.breadcrumb li.members
+{
+ padding-left: 24px;
+ background-image: url('mdocimages/members.png');
+}
+
+.breadcrumb li.home
+{
+ padding-left: 31px;
+ background-image: url('mdocimages/house.png');
+ background-position: 8px center;
+}
+
+.breadcrumb li.help
+{
+ background-image: url('mdocimages/help.png');
+}
+
+.breadcrumb li.unrecognized
+{
+ background-image: url('mdocimages/error.png');
+}
+
+.breadcrumb a
+{
+ height: 25px;
+ display: block;
+ background-image: url('mdocimages/bc_separator.png');
+ background-repeat: no-repeat;
+ background-position: right;
+ padding-right: 15px;
+ color: #454545;
+ text-decoration: none;
+}
+
+.breadcrumb a:hover
+{
+ text-decoration: underline;
+}
+
+.clearer
+{
+ clear: both;
+}
+
+div.Signature {
+ border: 1px solid #C0C0C0;
+ background: #F2F2F2;
+ padding: 1em;
+ margin-left: 1em;
+}
+
+div.Content {
+ margin-left: 1em;
+}
+
+.SectionBox {
+ margin-left: 1em;
+}
+
+/* Salvaged from the old style */
+table.Documentation, table.Enumeration, table.TypeDocumentation {
+ border-collapse: collapse;
+ width: 100%;
+}
+
+table.Documentation tr th, table.TypeMembers tr th, table.Enumeration tr th, table.TypeDocumentation tr th {
+ background: whitesmoke;
+ padding: 0.8em;
+ border: 1px solid gray;
+ text-align: left;
+ vertical-align: bottom;
+}
+
+table.Documentation tr td, table.TypeMembers tr td, table.Enumeration tr td, table.TypeDocumentation tr td {
+ padding: 0.5em;
+ border: 1px solid gray;
+ text-align: left;
+ vertical-align: top;
+}
+
+table.TypeMembers {
+ border: 1px solid #C0C0C0;
+ width: 100%;
+}
+
+table.TypeMembers tr td {
+ background: #F8F8F8;
+ border: white;
+}
+
+span.NotEntered /* Documentation for this section has not yet been entered */ {
+ font-style: italic;
+ color: #aaa;
+}
--- /dev/null
+<?xml version="1.0"?>
+
+<!--
+ mono-ecma.xsl: ECMA-style docs to HTML stylesheet trasformation
+
+ Author: Joshua Tauberer (tauberer@for.net)
+
+ TODO:
+ split this into multiple files
+-->
+
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:monodoc="monodoc:///extensions"
+ exclude-result-prefixes="monodoc"
+ >
+ <xsl:import href="mdoc-sections.xsl" />
+ <xsl:import href="mono-ecma-impl.xsl" />
+
+ <xsl:output omit-xml-declaration="yes" />
+
+ <xsl:template name="CreateCodeBlock">
+ <xsl:param name="language" />
+ <xsl:param name="content" />
+ <table class="CodeExampleTable" bgcolor="#f5f5dd" border="1" cellpadding="5" width="100%">
+ <tr><td><b><xsl:value-of select="$language"/> Example</b></td></tr>
+ <tr>
+ <td>
+ <!--
+ <xsl:value-of select="monodoc:Colorize($content, string($language))"
+ disable-output-escaping="yes" />
+ -->
+ <pre>
+ <xsl:value-of select="$content" />
+ </pre>
+ </td>
+ </tr>
+ </table>
+ </xsl:template>
+
+</xsl:stylesheet>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:output method="html" />
+
+ <xsl:template match="/toc">
+ <table bgcolor="#b0c4de" width="100%" cellpadding="5"><tr><td><h3><xsl:value-of select="@title" /></h3></td></tr></table>
+ <xsl:apply-templates />
+ </xsl:template>
+
+ <xsl:template match="description">
+ <p><xsl:value-of select="." /></p>
+ </xsl:template>
+
+ <xsl:template match="list">
+ <ul>
+ <xsl:apply-templates />
+ </ul>
+ </xsl:template>
+
+ <xsl:template match="item">
+ <xsl:choose>
+ <xsl:when test="list">
+ <li>
+ <xsl:apply-templates select="list" />
+ </li>
+ </xsl:when>
+ <xsl:otherwise>
+ <li><a href="{@url}"><xsl:value-of select="." /></a></li>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file
--- /dev/null
+using System;
+using System.IO;
+using System.Linq;
+using System.Collections.Generic;
+
+using NUnit.Framework;
+
+using MonkeyDoc;
+using Monkeydoc.Ecma;
+
+namespace MonoTests.MonkeyDoc.Ecma
+{
+ [TestFixture]
+ public class EcmaUrlTests
+ {
+ EcmaUrlParser parser;
+
+ [SetUp]
+ public void Setup ()
+ {
+ parser = new EcmaUrlParser ();
+ }
+
+ void AssertValidUrl (string url)
+ {
+ try {
+ parser.IsValid (url);
+ } catch {
+ Assert.Fail (string.Format ("URL '{0}' deemed not valid", url));
+ }
+ }
+
+ void AssertInvalidUrl (string url)
+ {
+ try {
+ parser.IsValid (url);
+ } catch {
+ return;
+ }
+ Assert.Fail (string.Format ("URL '{0}' deemed valid", url));
+ }
+
+ void AssertUrlDesc (EcmaDesc expected, string url)
+ {
+ EcmaDesc actual = null;
+ try {
+ actual = parser.Parse (url);
+ } catch (Exception e) {
+ Assert.Fail (string.Format ("URL '{0}' deemed not valid: {1}{2}", url, Environment.NewLine, e.ToString ()));
+ }
+
+ Assert.AreEqual (expected, actual, "Converted URL differs");
+ }
+
+ [Test]
+ public void CommonMethodUrlIsValidTest ()
+ {
+ AssertValidUrl ("M:System.String.FooBar()");
+ AssertValidUrl ("M:System.String.FooBar(System.String, Int32)");
+ AssertValidUrl ("M:System.Foo.Int32<System.String+FooBar<System.Blop<T, U`2>>>.Foo()");
+ AssertValidUrl ("M:System.Foo.Int32<System.String+FooBar<System.Blop<T, U`2>>>.Foo(Bleh,Bar)");
+ AssertValidUrl ("M:System.Foo.Int32<System.String+FooBar<System.Blop<T, U`2>>>.Foo(Bleh<V>,Bar)");
+ AssertValidUrl ("M:Gendarme.Framework.Helpers.Log.WriteLine(string,string,object[])");
+ AssertValidUrl ("M:Mono.Security.X509.Extensions.SubjectKeyIdentifierExtension.Decode");
+ AssertValidUrl ("M:Mono.Security.PKCS7.IssuerAndSerialNumber");
+ }
+
+ [Test]
+ public void CommonTypeUrlIsValidTest ()
+ {
+ AssertValidUrl ("T:Int32");
+ AssertValidUrl ("T:System.Foo.Int32");
+ AssertValidUrl ("T:System.Foo.Int32<System.String+FooBar`1>");
+ AssertValidUrl ("T:System.Foo.Int32<System.String+FooBar<System.Blop<T, U>>>");
+ AssertValidUrl ("T:System.Foo.Int32<T>");
+ AssertValidUrl ("T:System.Foo.Int32<T,U>");
+ AssertValidUrl ("T:System.Foo.Int32<System.String+FooBar<System.Blop<T, U>>>");
+ AssertValidUrl ("T:System.Foo.Int32<System.String+FooBar<System.Blop<T, U`2>>>");
+ }
+
+ [Test]
+ public void CommonTypeUrlNotValidTest ()
+ {
+ AssertInvalidUrl ("TInt32");
+ AssertInvalidUrl ("K:Int32");
+ AssertInvalidUrl ("T:System..Foo.Int32");
+ AssertInvalidUrl ("T:System.Foo.Int32<System.String+FooBar`1");
+ AssertInvalidUrl ("T:System.Foo.Int32<System.String+FooBarSystem.Blop<T, U>>>");
+ AssertInvalidUrl ("T:System.Foo.Int32<T,>");
+ AssertInvalidUrl ("T:System.Foo.Int32<+FooBar<System.Blop<T, U>>>");
+ }
+
+ [Test]
+ public void NamespaceValidTest ()
+ {
+ AssertValidUrl ("N:Foo.Bar");
+ AssertValidUrl ("N:Foo");
+ AssertValidUrl ("N:Foo.Bar.Baz");
+ AssertValidUrl ("N:A.B.C");
+
+ var ast = new EcmaDesc () { DescKind = EcmaDesc.Kind.Namespace,
+ Namespace = "Foo.Bar.Blop" };
+ AssertUrlDesc (ast, "N:Foo.Bar.Blop");
+ }
+
+ [Test]
+ public void ConstructorValidTest ()
+ {
+ AssertValidUrl ("C:Gendarme.Rules.Concurrency.DecorateThreadsRule.DecorateThreadsRule");
+ AssertValidUrl ("C:Gendarme.Rules.Concurrency.DecorateThreadsRule.DecorateThreadsRule()");
+ AssertValidUrl ("C:Gendarme.Rules.Concurrency.DecorateThreadsRule.DecorateThreadsRule(System.String)");
+ AssertValidUrl ("C:Gendarme.Framework.Helpers.MethodSignature.MethodSignature(string,string,string[],System.Func<Mono.Cecil.MethodReference,System.Boolean>)");
+ AssertValidUrl ("C:System.Collections.Generic.Dictionary<TKey,TValue>+KeyCollection.KeyCollection(System.Collections.Generic.Dictionary<TKey,TValue>)");
+ }
+
+ [Test]
+ public void SlashExpressionValidTest ()
+ {
+ AssertValidUrl ("T:Foo.Bar.Type/*");
+ AssertValidUrl ("T:Foo.Bar.Type/M");
+ AssertValidUrl ("T:Gendarme.Framework.Bitmask<T>/M/Equals");
+ AssertValidUrl ("T:Gendarme.Framework.Helpers.Log/M/WriteLine<T>");
+ AssertValidUrl ("T:System.Windows.Forms.AxHost/M/System.ComponentModel.ICustomTypeDescriptor.GetEvents");
+ }
+
+ [Test]
+ public void MethodWithArgModValidTest ()
+ {
+ AssertValidUrl ("M:Foo.Bar.FooBar(int, System.Drawing.Imaging&)");
+ AssertValidUrl ("M:Foo.Bar.FooBar(int@, System.Drawing.Imaging)");
+ AssertValidUrl ("M:Foo.Bar.FooBar(int, System.Drawing.Imaging*)");
+ AssertValidUrl ("M:Foo.Bar.FooBar(int*, System.Drawing.Imaging&)");
+ AssertValidUrl ("M:Atk.NoOpObject.GetRunAttributes(int,int&,int&)");
+ }
+
+ [Test]
+ public void MethodWithJaggedArrayArgsValidTest ()
+ {
+ AssertValidUrl ("M:System.Reflection.Emit.SignatureHelper.GetPropertySigHelper(System.Reflection.Module,System.Reflection.CallingConventions,Type,Type[],Type[],Type[],Type[][],Type[][])");
+ }
+
+ [Test]
+ public void MethodWithInnerTypeValidTest ()
+ {
+ AssertValidUrl ("M:System.TimeZoneInfo+AdjustmentRule.CreateAdjustmentRule");
+ }
+
+ [Test]
+ public void FieldValidTest ()
+ {
+ AssertValidUrl ("F:Mono.Terminal.Curses.KeyF10");
+ AssertValidUrl ("F:Novell.Directory.Ldap.Utilclass.ExceptionMessages.NOT_IMPLEMENTED");
+ AssertValidUrl ("F:Novell.Directory.Ldap.LdapException.NOT_ALLOWED_ON_NONLEAF");
+ }
+
+ [Test]
+ public void PropertyValidTest ()
+ {
+ AssertValidUrl ("P:System.Foo.Bar");
+ AssertValidUrl ("P:System.ArraySegment<T>.Array");
+ }
+
+ [Test]
+ public void IndexPropertyValidTest ()
+ {
+ AssertValidUrl ("P:System.ComponentModel.PropertyDescriptorCollection.Item(int)");
+ AssertValidUrl ("P:System.ComponentModel.AttributeCollection.Item(Type)");
+ AssertValidUrl ("P:System.Web.SessionState.HttpSessionStateContainer$System.Web.SessionState.IHttpSessionState.Item(System.Int32)");
+ AssertValidUrl ("P:System.Collections.Specialized.BitVector32.Item(System.Collections.Specialized.BitVector32+Section)");
+ }
+
+ [Test]
+ public void ExplicitMethodImplValidTest ()
+ {
+ AssertValidUrl ("M:Microsoft.Win32.RegistryKey$System.IDisposable.Dispose");
+ }
+
+ [Test]
+ public void MetaEtcNodeTest ()
+ {
+ var ast = new EcmaDesc () { DescKind = EcmaDesc.Kind.Type,
+ Namespace = "Foo.Bar",
+ TypeName = "Type",
+ Etc = '*' };
+ AssertUrlDesc (ast, "T:Foo.Bar.Type/*");
+ }
+
+ [Test]
+ public void MetaEtcWithInnerTypeTest ()
+ {
+ var ast = new EcmaDesc () { DescKind = EcmaDesc.Kind.Type,
+ Namespace = "Novell.Directory.Ldap",
+ TypeName = "Connection",
+ NestedType = new EcmaDesc { DescKind = EcmaDesc.Kind.Type, TypeName = "ReaderThread" },
+ Etc = '*' };
+ AssertUrlDesc (ast, "T:Novell.Directory.Ldap.Connection+ReaderThread/*");
+ }
+
+ [Test]
+ public void SimpleTypeUrlParseTest ()
+ {
+ var ast = new EcmaDesc () { DescKind = EcmaDesc.Kind.Type,
+ TypeName = "String",
+ Namespace = "System" };
+ AssertUrlDesc (ast, "T:System.String");
+ }
+
+ [Test]
+ public void TypeWithOneGenericUrlParseTest ()
+ {
+ var generics = new[] {
+ new EcmaDesc {
+ DescKind = EcmaDesc.Kind.Type,
+ Namespace = string.Empty,
+ TypeName = "T"
+ }
+ };
+ var ast = new EcmaDesc () { DescKind = EcmaDesc.Kind.Type,
+ TypeName = "String",
+ Namespace = "System",
+ GenericTypeArguments = generics,
+ };
+
+ AssertUrlDesc (ast, "T:System.String<T>");
+ }
+
+ [Test]
+ public void TypeWithNestedGenericUrlParseTest ()
+ {
+ var generics = new[] {
+ new EcmaDesc {
+ DescKind = EcmaDesc.Kind.Type,
+ TypeName = "T",
+ Namespace = string.Empty
+ },
+ new EcmaDesc {
+ DescKind = EcmaDesc.Kind.Type,
+ Namespace = "System.Collections.Generic",
+ TypeName = "List",
+ GenericTypeArguments = new[] {
+ new EcmaDesc {
+ DescKind = EcmaDesc.Kind.Type,
+ TypeName = "V",
+ Namespace = string.Empty
+ }
+ }
+ }
+ };
+ var ast = new EcmaDesc () { DescKind = EcmaDesc.Kind.Type,
+ TypeName = "String",
+ Namespace = "System",
+ GenericTypeArguments = generics,
+ };
+
+ AssertUrlDesc (ast, "T:System.String<T, System.Collections.Generic.List<V>>");
+ }
+
+ [Test]
+ public void SimpleMethodUrlParseTest ()
+ {
+ var ast = new EcmaDesc () { DescKind = EcmaDesc.Kind.Method,
+ TypeName = "String",
+ Namespace = "System",
+ MemberName = "FooBar"
+ };
+ AssertUrlDesc (ast, "M:System.String.FooBar()");
+ }
+
+ [Test]
+ public void MethodWithArgsUrlParseTest ()
+ {
+ var args = new[] {
+ new EcmaDesc {
+ DescKind = EcmaDesc.Kind.Type,
+ Namespace = "System",
+ TypeName = "String"
+ },
+ new EcmaDesc {
+ DescKind = EcmaDesc.Kind.Type,
+ TypeName = "Int32",
+ Namespace = string.Empty
+ }
+ };
+ var ast = new EcmaDesc () { DescKind = EcmaDesc.Kind.Method,
+ TypeName = "String",
+ Namespace = "System",
+ MemberName = "FooBar",
+ MemberArguments = args
+ };
+ AssertUrlDesc (ast, "M:System.String.FooBar(System.String, Int32)");
+ }
+
+ [Test]
+ public void MethodWithArgsAndGenericsUrlParseTest ()
+ {
+ var args = new[] {
+ new EcmaDesc {
+ DescKind = EcmaDesc.Kind.Type,
+ Namespace = "System",
+ TypeName = "String"
+ },
+ new EcmaDesc {
+ DescKind = EcmaDesc.Kind.Type,
+ Namespace = "System.Collections.Generic",
+ TypeName = "Dictionary",
+ GenericTypeArguments = new[] {
+ new EcmaDesc {
+ DescKind = EcmaDesc.Kind.Type,
+ TypeName = "K",
+ Namespace = string.Empty
+ },
+ new EcmaDesc {
+ DescKind = EcmaDesc.Kind.Type,
+ TypeName = "V",
+ Namespace = string.Empty
+ }
+ }
+ }
+ };
+
+ var generics = new[] {
+ new EcmaDesc {
+ DescKind = EcmaDesc.Kind.Type,
+ TypeName = "Action",
+ Namespace = string.Empty,
+ GenericTypeArguments = new[] {
+ new EcmaDesc {
+ DescKind = EcmaDesc.Kind.Type,
+ Namespace = "System",
+ TypeName = "Single",
+ },
+ new EcmaDesc {
+ DescKind = EcmaDesc.Kind.Type,
+ TypeName = "int",
+ Namespace = string.Empty
+ },
+ }
+ }
+ };
+
+ var ast = new EcmaDesc () { DescKind = EcmaDesc.Kind.Method,
+ TypeName = "String",
+ Namespace = "System",
+ MemberName = "FooBar",
+ MemberArguments = args,
+ GenericMemberArguments = generics
+ };
+ AssertUrlDesc (ast, "M:System.String.FooBar<Action<System.Single, int>>(System.String, System.Collections.Generic.Dictionary<K, V>)");
+ }
+
+ [Test]
+ public void ExplicitMethodImplementationParseTest ()
+ {
+ var inner = new EcmaDesc {
+ MemberName = "Dispose",
+ TypeName = "IDisposable",
+ Namespace = "System"
+ };
+ var ast = new EcmaDesc {
+ DescKind = EcmaDesc.Kind.Method,
+ TypeName = "RegistryKey",
+ Namespace = "Microsoft.Win32",
+ ExplicitImplMember = inner
+ };
+ AssertUrlDesc (ast, "M:Microsoft.Win32.RegistryKey$System.IDisposable.Dispose");
+ }
+
+ [Test]
+ public void SimpleMethodWithNumberInType ()
+ {
+ var ast = new EcmaDesc {
+ DescKind = EcmaDesc.Kind.Method,
+ TypeName = "ASN1",
+ Namespace = "Mono.Security",
+ MemberName = "Add"
+ };
+ AssertUrlDesc (ast, "M:Mono.Security.ASN1.Add");
+ }
+
+ [Test]
+ public void JaggedArrayWithDimensions ()
+ {
+ var ast = new EcmaDesc {
+ DescKind = EcmaDesc.Kind.Type,
+ TypeName = "Int32",
+ Namespace = "System",
+ ArrayDimensions = new int[] { 3, 1, 1 }
+ };
+ AssertUrlDesc (ast, "T:System.Int32[,,][][]");
+ }
+
+ [Test]
+ public void ExplicitIndexerImplementation ()
+ {
+ var explicitImpl = new EcmaDesc {
+ Namespace = "System.Web.SessionState",
+ TypeName = "IHttpSessionState",
+ MemberName = "Item",
+ MemberArguments = new [] { new EcmaDesc { DescKind = EcmaDesc.Kind.Type, Namespace = "System", TypeName = "Int32" } },
+ };
+ var ast = new EcmaDesc {
+ DescKind = EcmaDesc.Kind.Property,
+ TypeName = "HttpSessionStateContainer",
+ Namespace = "System.Web.SessionState",
+ ExplicitImplMember = explicitImpl,
+ };
+ AssertUrlDesc (ast, "P:System.Web.SessionState.HttpSessionStateContainer$System.Web.SessionState.IHttpSessionState.Item(System.Int32)");
+ }
+
+ /* [Test]
+ public void TreeParsabilityTest ()
+ {
+ var rootTree = RootTree.LoadTree ("/home/jeremie/monodoc/");
+ Node result;
+ var generator = new CheckGenerator ();
+
+ foreach (var leaf in GetLeaves (rootTree.RootNode).Where (IsEcmaNode))
+ AssertUrl (leaf.PublicUrl);
+ }
+
+ IEnumerable<Node> GetLeaves (Node node)
+ {
+ if (node == null)
+ yield break;
+
+ if (node.IsLeaf)
+ yield return node;
+ else {
+ foreach (var child in node.Nodes) {
+ if (!string.IsNullOrEmpty (child.Element) && !child.Element.StartsWith ("root:/"))
+ yield return child;
+ foreach (var childLeaf in GetLeaves (child))
+ yield return childLeaf;
+ }
+ }
+ }
+
+ bool IsEcmaNode (Node node)
+ {
+ var url = node.PublicUrl;
+ return url != null && url.Length > 2 && url[1] == ':';
+ }*/
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.IO;
+using System.Linq;
+using System.Collections.Generic;
+
+using NUnit.Framework;
+
+using MonkeyDoc;
+
+namespace MonoTests.MonkeyDoc
+{
+ [TestFixture]
+ public class HelpSourceTest
+ {
+ const string BaseDir = "../../tools/monkeydoc/Test/monodoc/";
+
+ class CheckGenerator : IDocGenerator<bool>
+ {
+ public string LastCheckMessage { get; set; }
+
+ public bool Generate (HelpSource hs, string id)
+ {
+ LastCheckMessage = string.Format ("#1 : {0} {1}", hs, id);
+ if (hs == null || string.IsNullOrEmpty (id))
+ return false;
+
+ // Stripe the arguments parts since we don't need it
+ var argIdx = id.LastIndexOf ('?');
+ if (argIdx != -1)
+ id = id.Substring (0, argIdx);
+
+ LastCheckMessage = string.Format ("#2 : {0} {1}", hs, id);
+ if (hs.IsRawContent (id))
+ return hs.GetText (id) != null;
+
+ IEnumerable<string> parts;
+ if (hs.IsMultiPart (id, out parts)) {
+ LastCheckMessage = string.Format ("#4 : {0} {1} ({2})", hs, id, string.Join (", ", parts));
+ foreach (var partId in parts)
+ if (!Generate (hs, partId))
+ return false;
+ }
+
+ LastCheckMessage = string.Format ("#3 : {0} {1}", hs, id);
+ if (hs.IsGeneratedContent (id))
+ return hs.GetCachedText (id) != null;
+ else {
+ var s = hs.GetCachedHelpStream (id);
+ if (s != null) {
+ s.Close ();
+ return true;
+ } else {
+ return false;
+ }
+ }
+ }
+ }
+
+ /* This test verifies that for every node in our tree that possed a PublicUrl,
+ * we can correctly access it back through RenderUrl
+ */
+ [Test]
+ public void ReachabilityTest ()
+ {
+ var rootTree = RootTree.LoadTree (Path.GetFullPath (BaseDir), false);
+ Node result;
+ var generator = new CheckGenerator ();
+ int errorCount = 0;
+ int testCount = 0;
+
+ foreach (var leaf in GetLeaves (rootTree.RootNode)) {
+ if (!rootTree.RenderUrl (leaf.PublicUrl, generator, out result) || leaf != result) {
+ Console.WriteLine ("Error: {0} with HelpSource {1} ", leaf.PublicUrl, leaf.Tree.HelpSource.Name);
+ errorCount++;
+ }
+ testCount++;
+ }
+
+ Assert.AreEqual (0, errorCount, errorCount + " / " + testCount.ToString ());
+ }
+
+ IEnumerable<Node> GetLeaves (Node node)
+ {
+ if (node == null)
+ yield break;
+
+ if (node.IsLeaf)
+ yield return node;
+ else {
+ foreach (var child in node.Nodes) {
+ if (!string.IsNullOrEmpty (child.Element) && !child.Element.StartsWith ("root:/"))
+ yield return child;
+ foreach (var childLeaf in GetLeaves (child))
+ yield return childLeaf;
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0"?>
+<node label="Mono Documentation" name="libraries">
+ <node label="Commands and Files" name="man" />
+ <node label="Languages" name="languages" />
+ <node label="Tools" name="tools" />
+ <node label="Various" name="various" />
+</node>
--- /dev/null
+<config>
+ <appSettings>
+ <add key="docPath" value="@monodoc_refdir@" />
+ <add key="docExternalPath" value="" />
+ </appSettings>
+</config>
--- /dev/null
+Assembly/AssemblyInfo.cs
+Monkeydoc/SearchableIndex.cs
+Monkeydoc/SearchableDocument.cs
+Monkeydoc/storage/ZipStorage.cs
+Monkeydoc/providers/man-provider.cs
+Monkeydoc/providers/ecmaspec-provider.cs
+Monkeydoc/providers/error-provider.cs
+Monkeydoc/providers/xhtml-provider.cs
+Monkeydoc/providers/ecma-provider.cs
+Monkeydoc/providers/addins-provider.cs
+Monkeydoc/HelpSource.cs
+Monkeydoc/Tree.cs
+Monkeydoc/Node.cs
+Monkeydoc/generator.cs
+Monkeydoc/caches/NullCache.cs
+Monkeydoc/caches/FileCache.cs
+Monkeydoc/storage.cs
+Monkeydoc/Provider.cs
+Monkeydoc/cache.cs
+Monkeydoc/index.cs
+Monkeydoc/RootTree.cs
+Monkeydoc/TypeUtils.cs
+Monkeydoc/generators/html/Man2Html.cs
+Monkeydoc/generators/html/Toc2Html.cs
+Monkeydoc/generators/html/Ecmaspec2Html.cs
+Monkeydoc/generators/html/Error2Html.cs
+Monkeydoc/generators/html/MonoBook2Html.cs
+Monkeydoc/generators/html/Ecma2Html.cs
+Monkeydoc/generators/html/Addin2Html.cs
+Monkeydoc/generators/html/Idem.cs
+Monkeydoc/generators/HtmlGenerator.cs
+Mono.Utilities/colorizer.cs
+Mono.Utilities/LRUCache.cs
+Monkeydoc.Ecma/EcmaUrlParser.cs
+Monkeydoc.Ecma/EcmaUrlTokenizer.cs
+Monkeydoc.Ecma/EcmaDesc.cs
+Mono.Documentation/ManifestResourceResolver.cs
+Mono.Documentation/XmlDocUtils.cs
+../../../external/Lucene.Net/src/core/Analysis/Analyzer.cs
+../../../external/Lucene.Net/src/core/Analysis/ASCIIFoldingFilter.cs
+../../../external/Lucene.Net/src/core/Analysis/BaseCharFilter.cs
+../../../external/Lucene.Net/src/core/Analysis/CachingTokenFilter.cs
+../../../external/Lucene.Net/src/core/Analysis/CharArraySet.cs
+../../../external/Lucene.Net/src/core/Analysis/CharFilter.cs
+../../../external/Lucene.Net/src/core/Analysis/CharReader.cs
+../../../external/Lucene.Net/src/core/Analysis/CharStream.cs
+../../../external/Lucene.Net/src/core/Analysis/CharTokenizer.cs
+../../../external/Lucene.Net/src/core/Analysis/ISOLatin1AccentFilter.cs
+../../../external/Lucene.Net/src/core/Analysis/KeywordAnalyzer.cs
+../../../external/Lucene.Net/src/core/Analysis/KeywordTokenizer.cs
+../../../external/Lucene.Net/src/core/Analysis/LengthFilter.cs
+../../../external/Lucene.Net/src/core/Analysis/LetterTokenizer.cs
+../../../external/Lucene.Net/src/core/Analysis/LowerCaseFilter.cs
+../../../external/Lucene.Net/src/core/Analysis/LowerCaseTokenizer.cs
+../../../external/Lucene.Net/src/core/Analysis/MappingCharFilter.cs
+../../../external/Lucene.Net/src/core/Analysis/NormalizeCharMap.cs
+../../../external/Lucene.Net/src/core/Analysis/NumericTokenStream.cs
+../../../external/Lucene.Net/src/core/Analysis/PerFieldAnalyzerWrapper.cs
+../../../external/Lucene.Net/src/core/Analysis/PorterStemFilter.cs
+../../../external/Lucene.Net/src/core/Analysis/PorterStemmer.cs
+../../../external/Lucene.Net/src/core/Analysis/SimpleAnalyzer.cs
+../../../external/Lucene.Net/src/core/Analysis/Standard/StandardAnalyzer.cs
+../../../external/Lucene.Net/src/core/Analysis/Standard/StandardFilter.cs
+../../../external/Lucene.Net/src/core/Analysis/Standard/StandardTokenizer.cs
+../../../external/Lucene.Net/src/core/Analysis/Standard/StandardTokenizerImpl.cs
+../../../external/Lucene.Net/src/core/Analysis/StopAnalyzer.cs
+../../../external/Lucene.Net/src/core/Analysis/StopFilter.cs
+../../../external/Lucene.Net/src/core/Analysis/TeeSinkTokenFilter.cs
+../../../external/Lucene.Net/src/core/Analysis/Token.cs
+../../../external/Lucene.Net/src/core/Analysis/Tokenattributes/FlagsAttribute.cs
+../../../external/Lucene.Net/src/core/Analysis/Tokenattributes/IFlagsAttribute.cs
+../../../external/Lucene.Net/src/core/Analysis/Tokenattributes/IOffsetAttribute.cs
+../../../external/Lucene.Net/src/core/Analysis/Tokenattributes/IPayloadAttribute.cs
+../../../external/Lucene.Net/src/core/Analysis/Tokenattributes/IPositionIncrementAttribute.cs
+../../../external/Lucene.Net/src/core/Analysis/Tokenattributes/ITermAttribute.cs
+../../../external/Lucene.Net/src/core/Analysis/Tokenattributes/ITypeAttribute.cs
+../../../external/Lucene.Net/src/core/Analysis/Tokenattributes/OffsetAttribute.cs
+../../../external/Lucene.Net/src/core/Analysis/Tokenattributes/PayloadAttribute.cs
+../../../external/Lucene.Net/src/core/Analysis/Tokenattributes/PositionIncrementAttribute.cs
+../../../external/Lucene.Net/src/core/Analysis/Tokenattributes/TermAttribute.cs
+../../../external/Lucene.Net/src/core/Analysis/Tokenattributes/TypeAttribute.cs
+../../../external/Lucene.Net/src/core/Analysis/TokenFilter.cs
+../../../external/Lucene.Net/src/core/Analysis/Tokenizer.cs
+../../../external/Lucene.Net/src/core/Analysis/TokenStream.cs
+../../../external/Lucene.Net/src/core/Analysis/WhitespaceAnalyzer.cs
+../../../external/Lucene.Net/src/core/Analysis/WhitespaceTokenizer.cs
+../../../external/Lucene.Net/src/core/Analysis/WordlistLoader.cs
+../../../external/Lucene.Net/src/core/Document/AbstractField.cs
+../../../external/Lucene.Net/src/core/Document/CompressionTools.cs
+../../../external/Lucene.Net/src/core/Document/DateField.cs
+../../../external/Lucene.Net/src/core/Document/DateTools.cs
+../../../external/Lucene.Net/src/core/Document/Document.cs
+../../../external/Lucene.Net/src/core/Document/Field.cs
+../../../external/Lucene.Net/src/core/Document/Fieldable.cs
+../../../external/Lucene.Net/src/core/Document/FieldSelector.cs
+../../../external/Lucene.Net/src/core/Document/FieldSelectorResult.cs
+../../../external/Lucene.Net/src/core/Document/LoadFirstFieldSelector.cs
+../../../external/Lucene.Net/src/core/Document/MapFieldSelector.cs
+../../../external/Lucene.Net/src/core/Document/NumberTools.cs
+../../../external/Lucene.Net/src/core/Document/NumericField.cs
+../../../external/Lucene.Net/src/core/Document/SetBasedFieldSelector.cs
+../../../external/Lucene.Net/src/core/Index/AbstractAllTermDocs.cs
+../../../external/Lucene.Net/src/core/Index/AllTermDocs.cs
+../../../external/Lucene.Net/src/core/Index/BufferedDeletes.cs
+../../../external/Lucene.Net/src/core/Index/ByteBlockPool.cs
+../../../external/Lucene.Net/src/core/Index/ByteSliceReader.cs
+../../../external/Lucene.Net/src/core/Index/ByteSliceWriter.cs
+../../../external/Lucene.Net/src/core/Index/CharBlockPool.cs
+../../../external/Lucene.Net/src/core/Index/CheckIndex.cs
+../../../external/Lucene.Net/src/core/Index/CompoundFileReader.cs
+../../../external/Lucene.Net/src/core/Index/CompoundFileWriter.cs
+../../../external/Lucene.Net/src/core/Index/ConcurrentMergeScheduler.cs
+../../../external/Lucene.Net/src/core/Index/CorruptIndexException.cs
+../../../external/Lucene.Net/src/core/Index/DefaultSkipListReader.cs
+../../../external/Lucene.Net/src/core/Index/DefaultSkipListWriter.cs
+../../../external/Lucene.Net/src/core/Index/DirectoryReader.cs
+../../../external/Lucene.Net/src/core/Index/DocConsumer.cs
+../../../external/Lucene.Net/src/core/Index/DocConsumerPerThread.cs
+../../../external/Lucene.Net/src/core/Index/DocFieldConsumer.cs
+../../../external/Lucene.Net/src/core/Index/DocFieldConsumerPerField.cs
+../../../external/Lucene.Net/src/core/Index/DocFieldConsumerPerThread.cs
+../../../external/Lucene.Net/src/core/Index/DocFieldConsumers.cs
+../../../external/Lucene.Net/src/core/Index/DocFieldConsumersPerField.cs
+../../../external/Lucene.Net/src/core/Index/DocFieldConsumersPerThread.cs
+../../../external/Lucene.Net/src/core/Index/DocFieldProcessor.cs
+../../../external/Lucene.Net/src/core/Index/DocFieldProcessorPerField.cs
+../../../external/Lucene.Net/src/core/Index/DocFieldProcessorPerThread.cs
+../../../external/Lucene.Net/src/core/Index/DocInverter.cs
+../../../external/Lucene.Net/src/core/Index/DocInverterPerField.cs
+../../../external/Lucene.Net/src/core/Index/DocInverterPerThread.cs
+../../../external/Lucene.Net/src/core/Index/DocumentsWriter.cs
+../../../external/Lucene.Net/src/core/Index/DocumentsWriterThreadState.cs
+../../../external/Lucene.Net/src/core/Index/FieldInfo.cs
+../../../external/Lucene.Net/src/core/Index/FieldInfos.cs
+../../../external/Lucene.Net/src/core/Index/FieldInvertState.cs
+../../../external/Lucene.Net/src/core/Index/FieldReaderException.cs
+../../../external/Lucene.Net/src/core/Index/FieldSortedTermVectorMapper.cs
+../../../external/Lucene.Net/src/core/Index/FieldsReader.cs
+../../../external/Lucene.Net/src/core/Index/FieldsWriter.cs
+../../../external/Lucene.Net/src/core/Index/FilterIndexReader.cs
+../../../external/Lucene.Net/src/core/Index/FormatPostingsDocsConsumer.cs
+../../../external/Lucene.Net/src/core/Index/FormatPostingsDocsWriter.cs
+../../../external/Lucene.Net/src/core/Index/FormatPostingsFieldsConsumer.cs
+../../../external/Lucene.Net/src/core/Index/FormatPostingsFieldsWriter.cs
+../../../external/Lucene.Net/src/core/Index/FormatPostingsPositionsConsumer.cs
+../../../external/Lucene.Net/src/core/Index/FormatPostingsPositionsWriter.cs
+../../../external/Lucene.Net/src/core/Index/FormatPostingsTermsConsumer.cs
+../../../external/Lucene.Net/src/core/Index/FormatPostingsTermsWriter.cs
+../../../external/Lucene.Net/src/core/Index/FreqProxFieldMergeState.cs
+../../../external/Lucene.Net/src/core/Index/FreqProxTermsWriter.cs
+../../../external/Lucene.Net/src/core/Index/FreqProxTermsWriterPerField.cs
+../../../external/Lucene.Net/src/core/Index/FreqProxTermsWriterPerThread.cs
+../../../external/Lucene.Net/src/core/Index/IndexCommit.cs
+../../../external/Lucene.Net/src/core/Index/IndexDeletionPolicy.cs
+../../../external/Lucene.Net/src/core/Index/IndexFileDeleter.cs
+../../../external/Lucene.Net/src/core/Index/IndexFileNameFilter.cs
+../../../external/Lucene.Net/src/core/Index/IndexFileNames.cs
+../../../external/Lucene.Net/src/core/Index/IndexReader.cs
+../../../external/Lucene.Net/src/core/Index/IndexWriter.cs
+../../../external/Lucene.Net/src/core/Index/IntBlockPool.cs
+../../../external/Lucene.Net/src/core/Index/InvertedDocConsumer.cs
+../../../external/Lucene.Net/src/core/Index/InvertedDocConsumerPerField.cs
+../../../external/Lucene.Net/src/core/Index/InvertedDocConsumerPerThread.cs
+../../../external/Lucene.Net/src/core/Index/InvertedDocEndConsumer.cs
+../../../external/Lucene.Net/src/core/Index/InvertedDocEndConsumerPerField.cs
+../../../external/Lucene.Net/src/core/Index/InvertedDocEndConsumerPerThread.cs
+../../../external/Lucene.Net/src/core/Index/KeepOnlyLastCommitDeletionPolicy.cs
+../../../external/Lucene.Net/src/core/Index/LogByteSizeMergePolicy.cs
+../../../external/Lucene.Net/src/core/Index/LogDocMergePolicy.cs
+../../../external/Lucene.Net/src/core/Index/LogMergePolicy.cs
+../../../external/Lucene.Net/src/core/Index/MergeDocIDRemapper.cs
+../../../external/Lucene.Net/src/core/Index/MergePolicy.cs
+../../../external/Lucene.Net/src/core/Index/MergeScheduler.cs
+../../../external/Lucene.Net/src/core/Index/MultiLevelSkipListReader.cs
+../../../external/Lucene.Net/src/core/Index/MultiLevelSkipListWriter.cs
+../../../external/Lucene.Net/src/core/Index/MultipleTermPositions.cs
+../../../external/Lucene.Net/src/core/Index/MultiReader.cs
+../../../external/Lucene.Net/src/core/Index/NormsWriter.cs
+../../../external/Lucene.Net/src/core/Index/NormsWriterPerField.cs
+../../../external/Lucene.Net/src/core/Index/NormsWriterPerThread.cs
+../../../external/Lucene.Net/src/core/Index/ParallelReader.cs
+../../../external/Lucene.Net/src/core/Index/Payload.cs
+../../../external/Lucene.Net/src/core/Index/PositionBasedTermVectorMapper.cs
+../../../external/Lucene.Net/src/core/Index/RawPostingList.cs
+../../../external/Lucene.Net/src/core/Index/ReadOnlyDirectoryReader.cs
+../../../external/Lucene.Net/src/core/Index/ReadOnlySegmentReader.cs
+../../../external/Lucene.Net/src/core/Index/ReusableStringReader.cs
+../../../external/Lucene.Net/src/core/Index/SegmentInfo.cs
+../../../external/Lucene.Net/src/core/Index/SegmentInfos.cs
+../../../external/Lucene.Net/src/core/Index/SegmentMergeInfo.cs
+../../../external/Lucene.Net/src/core/Index/SegmentMergeQueue.cs
+../../../external/Lucene.Net/src/core/Index/SegmentMerger.cs
+../../../external/Lucene.Net/src/core/Index/SegmentReader.cs
+../../../external/Lucene.Net/src/core/Index/SegmentTermDocs.cs
+../../../external/Lucene.Net/src/core/Index/SegmentTermEnum.cs
+../../../external/Lucene.Net/src/core/Index/SegmentTermPositions.cs
+../../../external/Lucene.Net/src/core/Index/SegmentTermPositionVector.cs
+../../../external/Lucene.Net/src/core/Index/SegmentTermVector.cs
+../../../external/Lucene.Net/src/core/Index/SegmentWriteState.cs
+../../../external/Lucene.Net/src/core/Index/SerialMergeScheduler.cs
+../../../external/Lucene.Net/src/core/Index/SnapshotDeletionPolicy.cs
+../../../external/Lucene.Net/src/core/Index/SortedTermVectorMapper.cs
+../../../external/Lucene.Net/src/core/Index/StaleReaderException.cs
+../../../external/Lucene.Net/src/core/Index/StoredFieldsWriter.cs
+../../../external/Lucene.Net/src/core/Index/StoredFieldsWriterPerThread.cs
+../../../external/Lucene.Net/src/core/Index/Term.cs
+../../../external/Lucene.Net/src/core/Index/TermBuffer.cs
+../../../external/Lucene.Net/src/core/Index/TermDocs.cs
+../../../external/Lucene.Net/src/core/Index/TermEnum.cs
+../../../external/Lucene.Net/src/core/Index/TermFreqVector.cs
+../../../external/Lucene.Net/src/core/Index/TermInfo.cs
+../../../external/Lucene.Net/src/core/Index/TermInfosReader.cs
+../../../external/Lucene.Net/src/core/Index/TermInfosWriter.cs
+../../../external/Lucene.Net/src/core/Index/TermPositions.cs
+../../../external/Lucene.Net/src/core/Index/TermPositionVector.cs
+../../../external/Lucene.Net/src/core/Index/TermsHash.cs
+../../../external/Lucene.Net/src/core/Index/TermsHashConsumer.cs
+../../../external/Lucene.Net/src/core/Index/TermsHashConsumerPerField.cs
+../../../external/Lucene.Net/src/core/Index/TermsHashConsumerPerThread.cs
+../../../external/Lucene.Net/src/core/Index/TermsHashPerField.cs
+../../../external/Lucene.Net/src/core/Index/TermsHashPerThread.cs
+../../../external/Lucene.Net/src/core/Index/TermVectorEntry.cs
+../../../external/Lucene.Net/src/core/Index/TermVectorEntryFreqSortedComparator.cs
+../../../external/Lucene.Net/src/core/Index/TermVectorMapper.cs
+../../../external/Lucene.Net/src/core/Index/TermVectorOffsetInfo.cs
+../../../external/Lucene.Net/src/core/Index/TermVectorsReader.cs
+../../../external/Lucene.Net/src/core/Index/TermVectorsTermsWriter.cs
+../../../external/Lucene.Net/src/core/Index/TermVectorsTermsWriterPerField.cs
+../../../external/Lucene.Net/src/core/Index/TermVectorsTermsWriterPerThread.cs
+../../../external/Lucene.Net/src/core/Index/TermVectorsWriter.cs
+../../../external/Lucene.Net/src/core/LucenePackage.cs
+../../../external/Lucene.Net/src/core/LZOCompressor.cs
+../../../external/Lucene.Net/src/core/Messages/INLSException.cs
+../../../external/Lucene.Net/src/core/Messages/Message.cs
+../../../external/Lucene.Net/src/core/Messages/MessageImpl.cs
+../../../external/Lucene.Net/src/core/Messages/NLS.cs
+../../../external/Lucene.Net/src/core/QueryParser/CharStream.cs
+../../../external/Lucene.Net/src/core/QueryParser/FastCharStream.cs
+../../../external/Lucene.Net/src/core/QueryParser/MultiFieldQueryParser.cs
+../../../external/Lucene.Net/src/core/QueryParser/ParseException.cs
+../../../external/Lucene.Net/src/core/QueryParser/QueryParser.cs
+../../../external/Lucene.Net/src/core/QueryParser/QueryParserConstants.cs
+../../../external/Lucene.Net/src/core/QueryParser/QueryParserTokenManager.cs
+../../../external/Lucene.Net/src/core/QueryParser/Token.cs
+../../../external/Lucene.Net/src/core/QueryParser/TokenMgrError.cs
+../../../external/Lucene.Net/src/core/Search/BooleanClause.cs
+../../../external/Lucene.Net/src/core/Search/BooleanQuery.cs
+../../../external/Lucene.Net/src/core/Search/BooleanScorer.cs
+../../../external/Lucene.Net/src/core/Search/BooleanScorer2.cs
+../../../external/Lucene.Net/src/core/Search/CachingSpanFilter.cs
+../../../external/Lucene.Net/src/core/Search/CachingWrapperFilter.cs
+../../../external/Lucene.Net/src/core/Search/Collector.cs
+../../../external/Lucene.Net/src/core/Search/ComplexExplanation.cs
+../../../external/Lucene.Net/src/core/Search/ConjunctionScorer.cs
+../../../external/Lucene.Net/src/core/Search/ConstantScoreQuery.cs
+../../../external/Lucene.Net/src/core/Search/DefaultSimilarity.cs
+../../../external/Lucene.Net/src/core/Search/DisjunctionMaxQuery.cs
+../../../external/Lucene.Net/src/core/Search/DisjunctionMaxScorer.cs
+../../../external/Lucene.Net/src/core/Search/DisjunctionSumScorer.cs
+../../../external/Lucene.Net/src/core/Search/DocIdSet.cs
+../../../external/Lucene.Net/src/core/Search/DocIdSetIterator.cs
+../../../external/Lucene.Net/src/core/Search/ExactPhraseScorer.cs
+../../../external/Lucene.Net/src/core/Search/Explanation.cs
+../../../external/Lucene.Net/src/core/Search/FieldCache.cs
+../../../external/Lucene.Net/src/core/Search/FieldCacheImpl.cs
+../../../external/Lucene.Net/src/core/Search/FieldCacheRangeFilter.cs
+../../../external/Lucene.Net/src/core/Search/FieldCacheTermsFilter.cs
+../../../external/Lucene.Net/src/core/Search/FieldComparator.cs
+../../../external/Lucene.Net/src/core/Search/FieldComparatorSource.cs
+../../../external/Lucene.Net/src/core/Search/FieldDoc.cs
+../../../external/Lucene.Net/src/core/Search/FieldDocSortedHitQueue.cs
+../../../external/Lucene.Net/src/core/Search/FieldValueHitQueue.cs
+../../../external/Lucene.Net/src/core/Search/Filter.cs
+../../../external/Lucene.Net/src/core/Search/FilteredDocIdSet.cs
+../../../external/Lucene.Net/src/core/Search/FilteredDocIdSetIterator.cs
+../../../external/Lucene.Net/src/core/Search/FilteredQuery.cs
+../../../external/Lucene.Net/src/core/Search/FilteredTermEnum.cs
+../../../external/Lucene.Net/src/core/Search/FilterManager.cs
+../../../external/Lucene.Net/src/core/Search/Function/ByteFieldSource.cs
+../../../external/Lucene.Net/src/core/Search/Function/CustomScoreProvider.cs
+../../../external/Lucene.Net/src/core/Search/Function/CustomScoreQuery.cs
+../../../external/Lucene.Net/src/core/Search/Function/DocValues.cs
+../../../external/Lucene.Net/src/core/Search/Function/FieldCacheSource.cs
+../../../external/Lucene.Net/src/core/Search/Function/FieldScoreQuery.cs
+../../../external/Lucene.Net/src/core/Search/Function/FloatFieldSource.cs
+../../../external/Lucene.Net/src/core/Search/Function/IntFieldSource.cs
+../../../external/Lucene.Net/src/core/Search/Function/OrdFieldSource.cs
+../../../external/Lucene.Net/src/core/Search/Function/ReverseOrdFieldSource.cs
+../../../external/Lucene.Net/src/core/Search/Function/ShortFieldSource.cs
+../../../external/Lucene.Net/src/core/Search/Function/ValueSource.cs
+../../../external/Lucene.Net/src/core/Search/Function/ValueSourceQuery.cs
+../../../external/Lucene.Net/src/core/Search/FuzzyQuery.cs
+../../../external/Lucene.Net/src/core/Search/FuzzyTermEnum.cs
+../../../external/Lucene.Net/src/core/Search/HitQueue.cs
+../../../external/Lucene.Net/src/core/Search/IndexSearcher.cs
+../../../external/Lucene.Net/src/core/Search/MatchAllDocsQuery.cs
+../../../external/Lucene.Net/src/core/Search/MultiPhraseQuery.cs
+../../../external/Lucene.Net/src/core/Search/MultiSearcher.cs
+../../../external/Lucene.Net/src/core/Search/MultiTermQuery.cs
+../../../external/Lucene.Net/src/core/Search/MultiTermQueryWrapperFilter.cs
+../../../external/Lucene.Net/src/core/Search/NumericRangeFilter.cs
+../../../external/Lucene.Net/src/core/Search/NumericRangeQuery.cs
+../../../external/Lucene.Net/src/core/Search/ParallelMultiSearcher.cs
+../../../external/Lucene.Net/src/core/Search/Payloads/AveragePayloadFunction.cs
+../../../external/Lucene.Net/src/core/Search/Payloads/MaxPayloadFunction.cs
+../../../external/Lucene.Net/src/core/Search/Payloads/MinPayloadFunction.cs
+../../../external/Lucene.Net/src/core/Search/Payloads/PayloadFunction.cs
+../../../external/Lucene.Net/src/core/Search/Payloads/PayloadNearQuery.cs
+../../../external/Lucene.Net/src/core/Search/Payloads/PayloadSpanUtil.cs
+../../../external/Lucene.Net/src/core/Search/Payloads/PayloadTermQuery.cs
+../../../external/Lucene.Net/src/core/Search/PhrasePositions.cs
+../../../external/Lucene.Net/src/core/Search/PhraseQuery.cs
+../../../external/Lucene.Net/src/core/Search/PhraseQueue.cs
+../../../external/Lucene.Net/src/core/Search/PhraseScorer.cs
+../../../external/Lucene.Net/src/core/Search/PositiveScoresOnlyCollector.cs
+../../../external/Lucene.Net/src/core/Search/PrefixFilter.cs
+../../../external/Lucene.Net/src/core/Search/PrefixQuery.cs
+../../../external/Lucene.Net/src/core/Search/PrefixTermEnum.cs
+../../../external/Lucene.Net/src/core/Search/Query.cs
+../../../external/Lucene.Net/src/core/Search/QueryTermVector.cs
+../../../external/Lucene.Net/src/core/Search/QueryWrapperFilter.cs
+../../../external/Lucene.Net/src/core/Search/ReqExclScorer.cs
+../../../external/Lucene.Net/src/core/Search/ReqOptSumScorer.cs
+../../../external/Lucene.Net/src/core/Search/ScoreCachingWrappingScorer.cs
+../../../external/Lucene.Net/src/core/Search/ScoreDoc.cs
+../../../external/Lucene.Net/src/core/Search/Scorer.cs
+../../../external/Lucene.Net/src/core/Search/Searchable.cs
+../../../external/Lucene.Net/src/core/Search/Searcher.cs
+../../../external/Lucene.Net/src/core/Search/Similarity.cs
+../../../external/Lucene.Net/src/core/Search/SimilarityDelegator.cs
+../../../external/Lucene.Net/src/core/Search/SingleTermEnum.cs
+../../../external/Lucene.Net/src/core/Search/SloppyPhraseScorer.cs
+../../../external/Lucene.Net/src/core/Search/Sort.cs
+../../../external/Lucene.Net/src/core/Search/SortField.cs
+../../../external/Lucene.Net/src/core/Search/SpanFilter.cs
+../../../external/Lucene.Net/src/core/Search/SpanFilterResult.cs
+../../../external/Lucene.Net/src/core/Search/SpanQueryFilter.cs
+../../../external/Lucene.Net/src/core/Search/Spans/FieldMaskingSpanQuery.cs
+../../../external/Lucene.Net/src/core/Search/Spans/NearSpansOrdered.cs
+../../../external/Lucene.Net/src/core/Search/Spans/NearSpansUnordered.cs
+../../../external/Lucene.Net/src/core/Search/Spans/SpanFirstQuery.cs
+../../../external/Lucene.Net/src/core/Search/Spans/SpanNearQuery.cs
+../../../external/Lucene.Net/src/core/Search/Spans/SpanNotQuery.cs
+../../../external/Lucene.Net/src/core/Search/Spans/SpanOrQuery.cs
+../../../external/Lucene.Net/src/core/Search/Spans/SpanQuery.cs
+../../../external/Lucene.Net/src/core/Search/Spans/Spans.cs
+../../../external/Lucene.Net/src/core/Search/Spans/SpanScorer.cs
+../../../external/Lucene.Net/src/core/Search/Spans/SpanTermQuery.cs
+../../../external/Lucene.Net/src/core/Search/Spans/SpanWeight.cs
+../../../external/Lucene.Net/src/core/Search/Spans/TermSpans.cs
+../../../external/Lucene.Net/src/core/Search/TermQuery.cs
+../../../external/Lucene.Net/src/core/Search/TermRangeFilter.cs
+../../../external/Lucene.Net/src/core/Search/TermRangeQuery.cs
+../../../external/Lucene.Net/src/core/Search/TermRangeTermEnum.cs
+../../../external/Lucene.Net/src/core/Search/TermScorer.cs
+../../../external/Lucene.Net/src/core/Search/TimeLimitingCollector.cs
+../../../external/Lucene.Net/src/core/Search/TopDocs.cs
+../../../external/Lucene.Net/src/core/Search/TopDocsCollector.cs
+../../../external/Lucene.Net/src/core/Search/TopFieldCollector.cs
+../../../external/Lucene.Net/src/core/Search/TopFieldDocs.cs
+../../../external/Lucene.Net/src/core/Search/TopScoreDocCollector.cs
+../../../external/Lucene.Net/src/core/Search/Weight.cs
+../../../external/Lucene.Net/src/core/Search/WildcardQuery.cs
+../../../external/Lucene.Net/src/core/Search/WildcardTermEnum.cs
+../../../external/Lucene.Net/src/core/Store/AlreadyClosedException.cs
+../../../external/Lucene.Net/src/core/Store/BufferedIndexInput.cs
+../../../external/Lucene.Net/src/core/Store/BufferedIndexOutput.cs
+../../../external/Lucene.Net/src/core/Store/CheckSumIndexInput.cs
+../../../external/Lucene.Net/src/core/Store/CheckSumIndexOutput.cs
+../../../external/Lucene.Net/src/core/Store/Directory.cs
+../../../external/Lucene.Net/src/core/Store/FileSwitchDirectory.cs
+../../../external/Lucene.Net/src/core/Store/FSDirectory.cs
+../../../external/Lucene.Net/src/core/Store/FSLockFactory.cs
+../../../external/Lucene.Net/src/core/Store/IndexInput.cs
+../../../external/Lucene.Net/src/core/Store/IndexOutput.cs
+../../../external/Lucene.Net/src/core/Store/Lock.cs
+../../../external/Lucene.Net/src/core/Store/LockFactory.cs
+../../../external/Lucene.Net/src/core/Store/LockObtainFailedException.cs
+../../../external/Lucene.Net/src/core/Store/LockReleaseFailedException.cs
+../../../external/Lucene.Net/src/core/Store/LockStressTest.cs
+../../../external/Lucene.Net/src/core/Store/LockVerifyServer.cs
+../../../external/Lucene.Net/src/core/Store/MMapDirectory.cs
+../../../external/Lucene.Net/src/core/Store/NativeFSLockFactory.cs
+../../../external/Lucene.Net/src/core/Store/NIOFSDirectory.cs
+../../../external/Lucene.Net/src/core/Store/NoLockFactory.cs
+../../../external/Lucene.Net/src/core/Store/NoSuchDirectoryException.cs
+../../../external/Lucene.Net/src/core/Store/RAMDirectory.cs
+../../../external/Lucene.Net/src/core/Store/RAMFile.cs
+../../../external/Lucene.Net/src/core/Store/RAMInputStream.cs
+../../../external/Lucene.Net/src/core/Store/RAMOutputStream.cs
+../../../external/Lucene.Net/src/core/Store/SimpleFSDirectory.cs
+../../../external/Lucene.Net/src/core/Store/SimpleFSLockFactory.cs
+../../../external/Lucene.Net/src/core/Store/SingleInstanceLockFactory.cs
+../../../external/Lucene.Net/src/core/Store/VerifyingLockFactory.cs
+../../../external/Lucene.Net/src/core/Support/AppSettings.cs
+../../../external/Lucene.Net/src/core/Support/AttributeImplItem.cs
+../../../external/Lucene.Net/src/core/Support/BitSetSupport.cs
+../../../external/Lucene.Net/src/core/Support/BuildType.cs
+../../../external/Lucene.Net/src/core/Support/Character.cs
+../../../external/Lucene.Net/src/core/Support/CloseableThreadLocalProfiler.cs
+../../../external/Lucene.Net/src/core/Support/CollectionsHelper.cs
+../../../external/Lucene.Net/src/core/Support/Compare.cs
+../../../external/Lucene.Net/src/core/Support/Compatibility/ConcurrentDictionary.cs
+../../../external/Lucene.Net/src/core/Support/Compatibility/Func.cs
+../../../external/Lucene.Net/src/core/Support/Compatibility/ISet.cs
+../../../external/Lucene.Net/src/core/Support/Compatibility/SetFactory.cs
+../../../external/Lucene.Net/src/core/Support/Compatibility/SortedSet.cs
+../../../external/Lucene.Net/src/core/Support/Compatibility/ThreadLocal.cs
+../../../external/Lucene.Net/src/core/Support/Compatibility/WrappedHashSet.cs
+../../../external/Lucene.Net/src/core/Support/CRC32.cs
+../../../external/Lucene.Net/src/core/Support/Cryptography.cs
+../../../external/Lucene.Net/src/core/Support/Deflater.cs
+../../../external/Lucene.Net/src/core/Support/Double.cs
+../../../external/Lucene.Net/src/core/Support/EquatableList.cs
+../../../external/Lucene.Net/src/core/Support/FileSupport.cs
+../../../external/Lucene.Net/src/core/Support/GeneralKeyedCollection.cs
+../../../external/Lucene.Net/src/core/Support/HashMap.cs
+../../../external/Lucene.Net/src/core/Support/IChecksum.cs
+../../../external/Lucene.Net/src/core/Support/Inflater.cs
+../../../external/Lucene.Net/src/core/Support/IThreadRunnable.cs
+../../../external/Lucene.Net/src/core/Support/Number.cs
+../../../external/Lucene.Net/src/core/Support/OS.cs
+../../../external/Lucene.Net/src/core/Support/SharpZipLib.cs
+../../../external/Lucene.Net/src/core/Support/Single.cs
+../../../external/Lucene.Net/src/core/Support/TextSupport.cs
+../../../external/Lucene.Net/src/core/Support/ThreadClass.cs
+../../../external/Lucene.Net/src/core/Support/ThreadLock.cs
+../../../external/Lucene.Net/src/core/Support/WeakDictionary.cs
+../../../external/Lucene.Net/src/core/Util/ArrayUtil.cs
+../../../external/Lucene.Net/src/core/Util/Attribute.cs
+../../../external/Lucene.Net/src/core/Util/AttributeSource.cs
+../../../external/Lucene.Net/src/core/Util/AverageGuessMemoryModel.cs
+../../../external/Lucene.Net/src/core/Util/BitUtil.cs
+../../../external/Lucene.Net/src/core/Util/BitVector.cs
+../../../external/Lucene.Net/src/core/Util/Cache/Cache.cs
+../../../external/Lucene.Net/src/core/Util/Cache/SimpleLRUCache.cs
+../../../external/Lucene.Net/src/core/Util/Cache/SimpleMapCache.cs
+../../../external/Lucene.Net/src/core/Util/CloseableThreadLocal.cs
+../../../external/Lucene.Net/src/core/Util/Constants.cs
+../../../external/Lucene.Net/src/core/Util/DocIdBitSet.cs
+../../../external/Lucene.Net/src/core/Util/FieldCacheSanityChecker.cs
+../../../external/Lucene.Net/src/core/Util/IAttribute.cs
+../../../external/Lucene.Net/src/core/Util/IdentityDictionary.cs
+../../../external/Lucene.Net/src/core/Util/IndexableBinaryStringTools.cs
+../../../external/Lucene.Net/src/core/Util/MapOfSets.cs
+../../../external/Lucene.Net/src/core/Util/MemoryModel.cs
+../../../external/Lucene.Net/src/core/Util/NumericUtils.cs
+../../../external/Lucene.Net/src/core/Util/OpenBitSet.cs
+../../../external/Lucene.Net/src/core/Util/OpenBitSetDISI.cs
+../../../external/Lucene.Net/src/core/Util/OpenBitSetIterator.cs
+../../../external/Lucene.Net/src/core/Util/PriorityQueue.cs
+../../../external/Lucene.Net/src/core/Util/RamUsageEstimator.cs
+../../../external/Lucene.Net/src/core/Util/ReaderUtil.cs
+../../../external/Lucene.Net/src/core/Util/ScorerDocQueue.cs
+../../../external/Lucene.Net/src/core/Util/SimpleStringInterner.cs
+../../../external/Lucene.Net/src/core/Util/SmallFloat.cs
+../../../external/Lucene.Net/src/core/Util/SortedVIntList.cs
+../../../external/Lucene.Net/src/core/Util/SorterTemplate.cs
+../../../external/Lucene.Net/src/core/Util/StringHelper.cs
+../../../external/Lucene.Net/src/core/Util/StringInterner.cs
+../../../external/Lucene.Net/src/core/Util/ToStringUtils.cs
+../../../external/Lucene.Net/src/core/Util/UnicodeUtil.cs
+../../../external/Lucene.Net/src/core/Util/Version.cs
--- /dev/null
+Monkeydoc/HelpSourceTests.cs
+Monkeydoc.Ecma/EcmaUrlTests.cs
\ No newline at end of file
cleanup:
-rm -f Test/man-provider-test.exe*
+API_SERVER = root@api.xamarin.com
+
+push:
+ make PROFILE=net_4_0 MCS_FLAGS=/debug
+ scp "../../class/lib/net_4_0/monodoc.dll*" $(API_SERVER):/srv/monodoc/
+ ssh $(API_SERVER) "/etc/init.d/apache2 reload"
+ ssh $(API_SERVER) "echo On `date -u +"%F %R"` UTC by `whoami` based on revision: `git log -n1 --oneline` >> /srv/monodoc/Changelog"
if ((membername == "op_Implicit" || membername == "op_Explicit") && argtypes.Length == 2) {
isoperator = true;
- membername = "Conversion";
+ membername = membername.EndsWith ("Implicit") ? "ImplicitConversion" : "ExplicitConversion";
member = argtypes[0] + " to " + argtypes[1];
} else if (membername.StartsWith("op_")) {
isoperator = true;
// conversion operators: overloading based on parameter and return type [ECMA-335 §10.3.3]
case "op_Implicit": // static implicit operator R (T)
case "op_Explicit": // static explicit operator R (T)
- nicename = "Conversion";
+ nicename = name.EndsWith ("Implicit") ? "ImplicitConversion" : "ExplicitConversion";
string arg = n.SelectSingleNode("Parameters/Parameter/@Type").InnerText;
string ret = n.SelectSingleNode("ReturnValue/ReturnType").InnerText;
sig = EcmaDoc.ConvertCTSName(arg) + " to " + EcmaDoc.ConvertCTSName(ret);
.Concat (ncnodes.Where (n => n.Nodes.Count > 0).SelectMany (n => n.Nodes.Cast<Node> ()));
} else if (c.Caption == "Operators") {
ncnodes = ncnodes
- .Where (n => n.Caption != "Conversion")
- .Concat (ncnodes.Where (n => n.Caption == "Conversion").SelectMany (n => n.Nodes.Cast<Node> ()));
+ .Where (n => !n.Caption.EndsWith ("Conversion"))
+ .Concat (ncnodes.Where (n => n.Caption.EndsWith ("Conversion")).SelectMany (n => n.Nodes.Cast<Node> ()));
}
foreach (Node nc in ncnodes) {
//xpath to the docs xml node
Node parent;
protected ArrayList nodes;
protected internal int position;
- string compare_key;
static ArrayList empty = ArrayList.ReadOnly(new ArrayList(0));
LoadNode ();
if (other.position < 0)
other.LoadNode ();
- if (compare_key == null || other.compare_key == null) {
- Regex digits = new Regex (@"([\d]+)|([^\d]+)");
- MatchEvaluator eval = delegate (Match m) {
- return (m.Value.Length > 0 && char.IsDigit (m.Value [0]))
- ? m.Value.PadLeft (System.Math.Max (caption.Length, other.caption.Length))
- : m.Value;
- };
- if (compare_key == null)
- compare_key = digits.Replace (caption, eval);
- if (other.compare_key == null)
- other.compare_key = digits.Replace (other.caption, eval);
- }
- return compare_key.CompareTo (other.compare_key);
+
+ var cap1 = caption;
+ var cap2 = other.caption;
+
+ /* Some node (notably from ecmaspec) have number prepended to them
+ * which we need to sort better by padding them to the same number
+ * of digits
+ */
+ if (char.IsDigit (cap1[0]) && char.IsDigit (cap2[0])) {
+ int c1 = cap1.TakeWhile (char.IsDigit).Count ();
+ int c2 = cap2.TakeWhile (char.IsDigit).Count ();
+
+ if (c1 != c2) {
+ cap1 = cap1.PadLeft (cap1.Length + Math.Max (0, c2 - c1), '0');
+ cap2 = cap2.PadLeft (cap2.Length + Math.Max (0, c1 - c2), '0');
+ }
+ }
+
+ return string.Compare (cap1, cap2, StringComparison.OrdinalIgnoreCase);
}
}
bool IsSkipped (AssemblyDefinition assembly)
{
+ if (assembly.HasCustomAttributes) {
+ foreach (var ca in assembly.CustomAttributes) {
+ if (ca.AttributeType.Name == "PreserveAttribute")
+ return true;
+ }
+ }
return skipped_assemblies.Contains (assembly.Name.Name);
}
%_prefix/lib/mono/2.0/System.Xml.Linq.dll
%_prefix/lib/mono/2.0/System.Xml.dll
%_prefix/lib/mono/2.0/System.dll
+%_prefix/lib/mono/2.0/System.Json.dll
%_prefix/lib/mono/2.0/al.exe*
%_prefix/lib/mono/2.0/cscompmgd.dll
%_prefix/lib/mono/2.0/gacutil.exe*
%_prefix/lib/mono/4.0/System.Drawing.dll
%_prefix/lib/mono/4.0/System.Dynamic.dll
%_prefix/lib/mono/4.0/System.Json.dll
+%_prefix/lib/mono/4.0/System.Json.Microsoft.dll
%_prefix/lib/mono/4.0/System.Net.dll
%_prefix/lib/mono/4.0/System.Numerics.dll
%_prefix/lib/mono/4.0/System.Security.dll
%_prefix/lib/mono/4.5/System.Drawing.dll
%_prefix/lib/mono/4.5/System.Dynamic.dll
%_prefix/lib/mono/4.5/System.Json.dll
+%_prefix/lib/mono/4.5/System.Json.Microsoft.dll
%_prefix/lib/mono/4.5/System.Net.dll
%_prefix/lib/mono/4.5/System.Net.Http.dll
%_prefix/lib/mono/4.5/System.Numerics.dll
%_prefix/lib/mono/gac/System.Xml
%_prefix/lib/mono/gac/System.Xml.Linq
%_prefix/lib/mono/gac/System.Json
+%_prefix/lib/mono/gac/System.Json.Microsoft
%_prefix/lib/mono/gac/cscompmgd
%_prefix/lib/mono/mono-configuration-crypto
if CROSS_COMPILING
-SUBDIRS = arch utils io-layer cil metadata $(interpreter_dir) mini dis
+SUBDIRS = arch utils io-layer cil metadata $(interpreter_dir) mini dis profiler
+else
+if INSTALL_MONOTOUCH
+SUBDIRS = utils io-layer metadata arch mini profiler
+
+monotouch-do-build:
+ @list='$(SUBDIRS)'; for subdir in $$list; do \
+ case "x$$subdir" in \
+ xmetadata ) target="monotouch-do-build" ;; \
+ xmini ) target="monotouch-do-build" ;; \
+ * ) target="all" ;; \
+ esac; \
+ echo "Making $$target in $$subdir"; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$target); \
+ done;
+
+monotouch-do-clean:
+ @list='$(SUBDIRS)'; for subdir in $$list; do \
+ case "x$$subdir" in \
+ xmetadata ) target="monotouch-do-clean" ;; \
+ xmini ) target="monotouch-do-clean" ;; \
+ * ) target="clean" ;; \
+ esac; \
+ echo "Making $$target in $$subdir"; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$target); \
+ done;
else
if MOONLIGHT
SUBDIRS = arch utils io-layer metadata mini
SUBDIRS = arch utils io-layer cil metadata $(interpreter_dir) mini dis monograph tests benchmark profiler
endif
endif
+endif
DIST_SUBDIRS = arch utils io-layer cil metadata interpreter mini dis monograph tests benchmark profiler
#define ARM_FSTMD(p,first_reg,nregs,base) \
ARM_FSTMD_COND(p,first_reg,nregs,base,ARMCOND_AL)
-#include "arm_vfpmacros.h"
+#include <mono/arch/arm/arm_vfpmacros.h>
/* coprocessor register transfer */
#define ARM_FMSR(p,freg,reg) \
if DISABLE_EXECUTABLES
bin_PROGRAMS =
else
+if DISABLE_LIBRARIES
+bin_PROGRAMS =
+else
if SUPPORT_BOEHM
bin_PROGRAMS = monodis
endif
endif
+endif
noinst_LIBRARIES = libmonodis.a
/* sys/resource.h (for rusage) is required when using osx 10.3 (but not 10.4) */
#ifdef __APPLE__
+#include <TargetConditionals.h>
#include <sys/resource.h>
#ifdef HAVE_LIBPROC_H
/* proc_name */
}
g_free (filename);
#elif defined(PLATFORM_MACOSX)
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5) && !defined (__mono_ppc__) && !defined(__arm__)
+#if !defined (__mono_ppc__) && defined (TARGET_OSX)
/* No proc name on OSX < 10.5 nor ppc nor iOS */
memset (buf, '\0', sizeof(buf));
proc_name (pid, buf, sizeof(buf));
return (0);
}
- g_assert (thread_handle->id == GetCurrentThreadId ());
+ g_assert (thread_handle->id == (pthread_t)GetCurrentThreadId ());
/* No locking/memory barriers are needed here */
thread_handle->has_apc = TRUE;
return(1);
# convenience lib, so we have to do it ourselves
#
if SUPPORT_SGEN
+if DISABLE_EXECUTABLES
+shared_sgen_libraries = libmonoruntimesgen.la
+else
if SHARED_MONO
shared_sgen_libraries = libmonoruntimesgen.la
endif
+endif
sgen_libraries = $(shared_sgen_libraries) libmonoruntimesgen-static.la
endif
if SUPPORT_BOEHM
+if DISABLE_EXECUTABLES
+shared_boehm_libraries = libmonoruntime.la
+else
if SHARED_MONO
shared_boehm_libraries = libmonoruntime.la
endif
+endif
boehm_libraries = $(shared_boehm_libraries) libmonoruntime-static.la
endif
sgen-stw.c \
sgen-fin-weak-hash.c
-libmonoruntime_la_SOURCES = $(common_sources) $(gc_dependent_sources) $(sgen_sources) $(boehm_sources)
+libmonoruntime_la_SOURCES = $(common_sources) $(gc_dependent_sources) $(boehm_sources)
libmonoruntime_la_CFLAGS = $(BOEHM_DEFINES)
if MOONLIGHT
endif
endif
-libmonoruntimesgen_la_SOURCES = $(libmonoruntime_la_SOURCES)
+libmonoruntimesgen_la_SOURCES = $(common_sources) $(gc_dependent_sources) $(sgen_sources)
libmonoruntimesgen_la_CFLAGS = $(SGEN_DEFINES)
libmonoruntime_static_la_SOURCES = $(libmonoruntime_la_SOURCES)
libmonoruntime_static_la_LDFLAGS = -static
libmonoruntime_static_la_CFLAGS = $(BOEHM_DEFINES)
-libmonoruntimesgen_static_la_SOURCES = $(libmonoruntime_la_SOURCES)
+libmonoruntimesgen_static_la_SOURCES = $(libmonoruntimesgen_la_SOURCES)
libmonoruntimesgen_static_la_LDFLAGS = -static
libmonoruntimesgen_static_la_CFLAGS = $(SGEN_DEFINES)
{"System.Management", 0},
{"System.Messaging", 0},
{"System.Runtime.Remoting", 0},
+ {"System.Runtime.Serialization", 3},
{"System.Runtime.Serialization.Formatters.Soap", 0},
{"System.Security", 0},
{"System.ServiceProcess", 0},
{
MONO_GC_BEGIN (generation);
+#ifndef DISABLE_PERFCOUNTERS
mono_perfcounters->gc_induced++;
+#endif
GC_gcollect ();
MONO_GC_END (generation);
mono_thread_info_suspend_unlock ();
if (e == MONO_GC_EVENT_START) {
+#ifndef DISABLE_PERFCOUNTERS
if (mono_perfcounters)
mono_perfcounters->gc_collections0++;
+#endif
gc_stats.major_gc_count ++;
gc_start_time = mono_100ns_ticks ();
} else if (e == MONO_GC_EVENT_END) {
+#ifndef DISABLE_PERFCOUNTERS
if (mono_perfcounters) {
guint64 heap_size = GC_get_heap_size ();
guint64 used_size = heap_size - GC_get_free_bytes ();
mono_perfcounters->gc_reserved_bytes = heap_size;
mono_perfcounters->gc_gen0size = heap_size;
}
+#endif
gc_stats.major_gc_time_usecs += (mono_100ns_ticks () - gc_start_time) / 10;
mono_trace_message (MONO_TRACE_GC, "gc took %d usecs", (mono_100ns_ticks () - gc_start_time) / 10);
}
on_gc_heap_resize (size_t new_size)
{
guint64 heap_size = GC_get_heap_size ();
+#ifndef DISABLE_PERFCOUNTERS
if (mono_perfcounters) {
mono_perfcounters->gc_committed_bytes = heap_size;
mono_perfcounters->gc_reserved_bytes = heap_size;
mono_perfcounters->gc_gen0size = heap_size;
}
+#endif
mono_profiler_gc_heap_resize (new_size);
}
MonoClass *internals_visible_class;
MonoClass *generic_ilist_class;
MonoClass *generic_nullable_class;
+#ifndef DISABLE_COM
MonoClass *variant_class;
MonoClass *com_object_class;
MonoClass *com_interop_proxy_class;
MonoClass *iunknown_class;
MonoClass *idispatch_class;
+#endif
MonoClass *safehandle_class;
MonoClass *handleref_class;
MonoClass *attribute_class;
static void mono_field_resolve_type (MonoClassField *field, MonoError *error);
static guint32 mono_field_resolve_flags (MonoClassField *field);
static void mono_class_setup_vtable_full (MonoClass *class, GList *in_setup);
+static void mono_generic_class_setup_parent (MonoClass *klass, MonoClass *gklass);
void (*mono_debugger_class_init_func) (MonoClass *klass) = NULL;
void (*mono_debugger_class_loaded_methods_func) (MonoClass *klass) = NULL;
+
+/*
+We use gclass recording to allow recursive system f types to be referenced by a parent.
+
+Given the following type hierarchy:
+
+class TextBox : TextBoxBase<TextBox> {}
+class TextBoxBase<T> : TextInput<TextBox> where T : TextBoxBase<T> {}
+class TextInput<T> : Input<T> where T: TextInput<T> {}
+class Input<T> {}
+
+The runtime tries to load TextBoxBase<>.
+To load TextBoxBase<> to do so it must resolve the parent which is TextInput<TextBox>.
+To instantiate TextInput<TextBox> it must resolve TextInput<> and TextBox.
+To load TextBox it must resolve the parent which is TextBoxBase<TextBox>.
+
+At this point the runtime must instantiate TextBoxBase<TextBox>. Both types are partially loaded
+at this point, iow, both are registered in the type map and both and a NULL parent. This means
+that the resulting generic instance will have a NULL parent, which is wrong and will cause breakage.
+
+To fix that what we do is to record all generic instantes created while resolving the parent of
+any generic type definition and, after resolved, correct the parent field if needed.
+
+*/
+static int record_gclass_instantiation;
+static GSList *gclass_recorded_list;
+typedef gboolean (*gclass_record_func) (MonoClass*, void*);
+
+/*
+ * LOCKING: loader lock must be held until pairing disable_gclass_recording is called.
+*/
+static void
+enable_gclass_recording (void)
+{
+ ++record_gclass_instantiation;
+}
+
+/*
+ * LOCKING: loader lock must be held since pairing enable_gclass_recording was called.
+*/
+static void
+disable_gclass_recording (gclass_record_func func, void *user_data)
+{
+ GSList **head = &gclass_recorded_list;
+
+ g_assert (record_gclass_instantiation > 0);
+ --record_gclass_instantiation;
+
+ while (*head) {
+ GSList *node = *head;
+ if (func ((MonoClass*)node->data, user_data)) {
+ *head = node->next;
+ g_slist_free_1 (node);
+ } else {
+ head = &node->next;
+ }
+ }
+
+ /* We automatically discard all recorded gclasses when disabled. */
+ if (!record_gclass_instantiation && gclass_recorded_list) {
+ g_slist_free (gclass_recorded_list);
+ gclass_recorded_list = NULL;
+ }
+}
+
/*
* mono_class_from_typeref:
* @image: a MonoImage
}
+#ifndef DISABLE_COM
/*
* COM initialization (using mono_init_com_types) is delayed until needed.
* However when a [ComImport] attribute is present on a type it will trigger
/* FIXME : we should add an extra checks to ensure COM can be initialized properly before continuing */
mono_init_com_types ();
}
+#endif /*DISABLE_COM*/
/*
* LOCKING: this assumes the loader lock is held
if (!MONO_CLASS_IS_INTERFACE (class)) {
/* Imported COM Objects always derive from __ComObject. */
+#ifndef DISABLE_COM
if (MONO_CLASS_IS_IMPORT (class)) {
init_com_from_comimport (class);
if (parent == mono_defaults.object_class)
parent = mono_defaults.com_object_class;
}
+#endif
if (!parent) {
/* set the parent to something useful and safe, but mark the type as broken */
parent = mono_defaults.object_class;
/*class->enumtype = class->parent->enumtype; */
} else {
/* initialize com types if COM interfaces are present */
+#ifndef DISABLE_COM
if (MONO_CLASS_IS_IMPORT (class))
init_com_from_comimport (class);
+#endif
class->parent = NULL;
}
mono_atomic_store_release (&class->supertypes, supertypes);
}
+static gboolean
+fix_gclass_incomplete_instantiation (MonoClass *gclass, void *user_data)
+{
+ MonoClass *gtd = (MonoClass*)user_data;
+ /* Only try to fix generic instances of @gtd */
+ if (gclass->generic_class->container_class != gtd)
+ return FALSE;
+
+ /* Check if the generic instance has no parent. */
+ if (gtd->parent && !gclass->parent)
+ mono_generic_class_setup_parent (gclass, gtd);
+
+ return TRUE;
+}
+
/**
* mono_class_create_from_typedef:
* @image: image where the token is valid
context = &class->generic_container->context;
}
+ if (class->generic_container)
+ enable_gclass_recording ();
+
if (cols [MONO_TYPEDEF_EXTENDS]) {
MonoClass *tmp;
guint32 parent_token = mono_metadata_token_from_dor (cols [MONO_TYPEDEF_EXTENDS]);
/* uses ->valuetype, which is initialized by mono_class_setup_parent above */
mono_class_setup_mono_type (class);
+ if (class->generic_container)
+ disable_gclass_recording (fix_gclass_incomplete_instantiation, class);
+
/*
* This might access class->byval_arg for recursion generated by generic constraints,
* so it has to come after setup_mono_type ().
return mono_class_from_mono_type (klass->generic_class->context.class_inst->type_argv [0]);
}
+static void
+mono_generic_class_setup_parent (MonoClass *klass, MonoClass *gtd)
+{
+ if (gtd->parent) {
+ MonoError error;
+ MonoGenericClass *gclass = klass->generic_class;
+
+ klass->parent = mono_class_inflate_generic_class_checked (gtd->parent, mono_generic_class_get_context (gclass), &error);
+ if (!mono_error_ok (&error)) {
+ /*Set parent to something safe as the runtime doesn't handle well this kind of failure.*/
+ klass->parent = mono_defaults.object_class;
+ mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, NULL);
+ mono_error_cleanup (&error);
+ }
+ }
+ if (klass->parent)
+ mono_class_setup_parent (klass, klass->parent);
+
+ if (klass->enumtype) {
+ klass->cast_class = gtd->cast_class;
+ klass->element_class = gtd->element_class;
+ }
+}
+
+
/*
* Create the `MonoClass' for an instantiation of a generic type.
* We only do this if we actually need it.
gklass = gclass->container_class;
+ if (record_gclass_instantiation > 0)
+ gclass_recorded_list = g_slist_append (gclass_recorded_list, klass);
+
if (gklass->nested_in) {
/* The nested_in type should not be inflated since it's possible to produce a nested type with less generic arguments*/
klass->nested_in = gklass->nested_in;
* We use the generic type definition to look for nested classes.
*/
- if (gklass->parent) {
- MonoError error;
- klass->parent = mono_class_inflate_generic_class_checked (gklass->parent, mono_generic_class_get_context (gclass), &error);
- if (!mono_error_ok (&error)) {
- /*Set parent to something safe as the runtime doesn't handle well this kind of failure.*/
- klass->parent = mono_defaults.object_class;
- mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, NULL);
- mono_error_cleanup (&error);
- }
- }
-
- if (klass->parent)
- mono_class_setup_parent (klass, klass->parent);
-
- if (klass->enumtype) {
- klass->cast_class = gklass->cast_class;
- klass->element_class = gklass->element_class;
- }
+ mono_generic_class_setup_parent (klass, gklass);
if (gclass->is_dynamic) {
klass->inited = 1;
#include <string.h>
#include <errno.h>
+/*
+Code shared between the DISABLE_COM and !DISABLE_COM
+*/
+static void
+register_icall (gpointer func, const char *name, const char *sigstr, gboolean save)
+{
+ MonoMethodSignature *sig = mono_create_icall_signature (sigstr);
+
+ mono_register_jit_icall (func, name, sig, save);
+}
+
#ifndef DISABLE_COM
#define OPDEF(a,b,c,d,e,f,g,h,i,j) \
return mono_type_get_object (domain, handle);
}
-static void
-register_icall (gpointer func, const char *name, const char *sigstr, gboolean save)
-{
- MonoMethodSignature *sig = mono_create_icall_signature (sigstr);
-
- mono_register_jit_icall (func, name, sig, save);
-}
-
void
mono_cominterop_init (void)
{
void
mono_cominterop_init (void)
{
+ /*FIXME
+
+ This icalls are used by the marshal code when doing PtrToStructure and StructureToPtr and pinvoke.
+
+ If we leave them out and the FullAOT compiler finds the need to emit one of the above 3 wrappers it will
+ g_assert.
+
+ The proper fix would be to emit warning, remove them from marshal.c when DISABLE_COM is used and
+ emit an exception in the generated IL.
+ */
+ register_icall (mono_string_to_bstr, "mono_string_to_bstr", "ptr obj", FALSE);
+ register_icall (mono_string_from_bstr, "mono_string_from_bstr", "obj ptr", FALSE);
+ register_icall (mono_free_bstr, "mono_free_bstr", "void ptr", FALSE);
}
void
/* Used by threadpool.c */
MonoImage *system_image;
- MonoImage *system_net_dll;
MonoClass *corlib_asyncresult_class;
MonoClass *socket_class;
MonoClass *ad_unloaded_ex_class;
typedef struct {
const char runtime_version [12];
const char framework_version [4];
- const AssemblyVersionSet version_sets [3];
+ const AssemblyVersionSet version_sets [4];
} MonoRuntimeInfo;
#define mono_domain_lock(domain) mono_locks_acquire(&(domain)->lock, DomainLock)
/* This is the list of runtime versions supported by this JIT.
*/
static const MonoRuntimeInfo supported_runtimes[] = {
- {"v2.0.50215","2.0", { {2,0,0,0}, {8,0,0,0}, { 3, 5, 0, 0 } } },
- {"v2.0.50727","2.0", { {2,0,0,0}, {8,0,0,0}, { 3, 5, 0, 0 } } },
- {"v4.0.30319","4.5", { {4,0,0,0}, {10,0,0,0}, { 4, 0, 0, 0 } } },
- {"v4.0.30128","4.0", { {4,0,0,0}, {10,0,0,0}, { 4, 0, 0, 0 } } },
- {"v4.0.20506","4.0", { {4,0,0,0}, {10,0,0,0}, { 4, 0, 0, 0 } } },
- {"moonlight", "2.1", { {2,0,5,0}, {9,0,0,0}, { 3, 5, 0, 0 } } },
+ {"v2.0.50215","2.0", { {2,0,0,0}, { 8,0,0,0}, {3,5,0,0}, {3,0,0,0} } },
+ {"v2.0.50727","2.0", { {2,0,0,0}, { 8,0,0,0}, {3,5,0,0}, {3,0,0,0} } },
+ {"v4.0.30319","4.5", { {4,0,0,0}, {10,0,0,0}, {4,0,0,0}, {4,0,0,0} } },
+ {"v4.0.30128","4.0", { {4,0,0,0}, {10,0,0,0}, {4,0,0,0}, {4,0,0,0} } },
+ {"v4.0.20506","4.0", { {4,0,0,0}, {10,0,0,0}, {4,0,0,0}, {4,0,0,0} } },
+ {"moonlight", "2.1", { {2,0,5,0}, { 9,0,0,0}, {3,5,0,0}, {3,0,0,0} } },
};
domain_id_alloc (domain);
mono_appdomains_unlock ();
+#ifndef DISABLE_PERFCOUNTERS
mono_perfcounters->loader_appdomains++;
mono_perfcounters->loader_total_appdomains++;
+#endif
mono_debug_domain_create (domain);
wapi_init ();
#endif
+#ifndef DISABLE_PERFCOUNTERS
mono_perfcounters_init ();
+#endif
mono_counters_register ("Max native code in a domain", MONO_COUNTER_INT|MONO_COUNTER_JIT, &max_domain_code_size);
mono_counters_register ("Max code space allocated in a domain", MONO_COUNTER_INT|MONO_COUNTER_JIT, &max_domain_code_alloc);
mono_defaults.corlib, "System.Reflection", "CustomAttributeData");
/* these are initialized lazily when COM features are used */
+#ifndef DISABLE_COM
mono_defaults.variant_class = NULL;
mono_defaults.com_object_class = NULL;
mono_defaults.com_interop_proxy_class = NULL;
mono_defaults.iunknown_class = NULL;
mono_defaults.idispatch_class = NULL;
+#endif
/*
* Note that mono_defaults.generic_*_class is only non-NULL if we're
return mono_init_internal (domain_name, NULL, version);
}
+#ifndef DISABLE_COM
/**
* mono_init_com_types:
*
initialized = TRUE;
}
+#endif /*DISABLE_COM*/
/**
* mono_cleanup:
mono_mempool_invalidate (domain->mp);
mono_code_manager_invalidate (domain->code_mp);
#else
+#ifndef DISABLE_PERFCOUNTERS
mono_perfcounters->loader_bytes -= mono_mempool_get_allocated (domain->mp);
+#endif
mono_mempool_destroy (domain->mp);
domain->mp = NULL;
mono_code_manager_destroy (domain->code_mp);
mono_gc_free_fixed (domain);
+#ifndef DISABLE_PERFCOUNTERS
mono_perfcounters->loader_appdomains--;
+#endif
if (domain == mono_root_domain)
mono_root_domain = NULL;
gpointer res;
mono_domain_lock (domain);
+#ifndef DISABLE_PERFCOUNTERS
mono_perfcounters->loader_bytes += size;
+#endif
res = mono_mempool_alloc (domain->mp, size);
mono_domain_unlock (domain);
gpointer res;
mono_domain_lock (domain);
+#ifndef DISABLE_PERFCOUNTERS
mono_perfcounters->loader_bytes += size;
+#endif
res = mono_mempool_alloc0 (domain->mp, size);
mono_domain_unlock (domain);
//Support for io-layer free mmap'd files.
-#if (defined (__MACH__) && defined (TARGET_ARM)) || defined (TARGET_ANDROID)
+#if defined (TARGET_IOS) || defined (TARGET_ANDROID)
gint64
mono_filesize_from_path (MonoString *string)
mono_gc_weak_link_add (&(handles->entries [slot]), obj, track);
}
+#ifndef DISABLE_PERFCOUNTERS
mono_perfcounters->gc_num_handles++;
+#endif
unlock_handles (handles);
/*g_print ("allocated entry %d of type %d to object %p (in slot: %p)\n", slot, handles->type, obj, handles->entries [slot]);*/
res = (slot << 3) | (handles->type + 1);
} else {
/* print a warning? */
}
+#ifndef DISABLE_PERFCOUNTERS
mono_perfcounters->gc_num_handles--;
+#endif
/*g_print ("freed entry %d of type %d\n", slot, handles->type);*/
unlock_handles (handles);
mono_profiler_gc_handle (MONO_PROFILER_GC_HANDLE_DESTROYED, handles->type, gchandle, NULL);
return 0;
}
+#ifndef LAZY_GC_THREAD_CREATION
+static
+#endif
+void
+mono_gc_init_finalizer_thread (void)
+{
+ gc_thread = mono_thread_create_internal (mono_domain_get (), finalizer_thread, NULL, FALSE, 0);
+ ves_icall_System_Threading_Thread_SetName_internal (gc_thread, mono_string_new (mono_domain_get (), "Finalizer"));
+}
+
void
mono_gc_init (void)
{
MONO_SEM_INIT (&finalizer_sem, 0);
#endif
- gc_thread = mono_thread_create_internal (mono_domain_get (), finalizer_thread, NULL, FALSE, 0);
- ves_icall_System_Threading_Thread_SetName_internal (gc_thread, mono_string_new (mono_domain_get (), "Finalizer"));
+#ifndef LAZY_GC_THREAD_CREATION
+ mono_gc_init_finalizer_thread ();
+#endif
}
void
ICALL_TYPE(TRACEL, "System.Diagnostics.DefaultTraceListener", TRACEL_1)
ICALL(TRACEL_1, "WriteWindowsDebugString", ves_icall_System_Diagnostics_DefaultTraceListener_WriteWindowsDebugString)
-#ifndef DISABLE_PROCESS_HANDLING
ICALL_TYPE(FILEV, "System.Diagnostics.FileVersionInfo", FILEV_1)
ICALL(FILEV_1, "GetVersionInfo_internal(string)", ves_icall_System_Diagnostics_FileVersionInfo_GetVersionInfo_internal)
+#ifndef DISABLE_PROCESS_HANDLING
ICALL_TYPE(PERFCTR, "System.Diagnostics.PerformanceCounter", PERFCTR_1)
ICALL(PERFCTR_1, "FreeData", mono_perfcounter_free_data)
ICALL(PERFCTR_2, "GetImpl", mono_perfcounter_get_impl)
ICALL(INOW_2, "GetInotifyInstance", ves_icall_System_IO_InotifyWatcher_GetInotifyInstance)
ICALL(INOW_3, "RemoveWatch", ves_icall_System_IO_InotifyWatcher_RemoveWatch)
-#if (defined (__MACH__) && defined (TARGET_ARM)) || defined (TARGET_ANDROID)
+#if defined (TARGET_IOS) || defined (TARGET_ANDROID)
ICALL_TYPE(MMAPIMPL, "System.IO.MemoryMappedFiles.MemoryMapImpl", MMAPIMPL_1)
ICALL(MMAPIMPL_1, "mono_filesize_from_fd", mono_filesize_from_fd)
ICALL(MMAPIMPL_2, "mono_filesize_from_path", mono_filesize_from_path)
MONO_ARCH_SAVE_REGS;
+ /* This is called directly from the class libraries without going through the managed wrapper */
+ MONO_CHECK_ARG_NULL (src);
+ MONO_CHECK_ARG_NULL (dest);
+
/* watch out for integer overflow */
if ((src_offset > mono_array_get_byte_length (src) - count) || (dest_offset > mono_array_get_byte_length (dest) - count))
return FALSE;
if (image->modules)
g_free (image->modules);
+#ifndef DISABLE_PERFCOUNTERS
mono_perfcounters->loader_bytes -= mono_mempool_get_allocated (image->mempool);
+#endif
if (!image->dynamic) {
if (debug_assembly_unload)
{
gpointer res;
+#ifndef DISABLE_PERFCOUNTERS
mono_perfcounters->loader_bytes += size;
+#endif
mono_image_lock (image);
res = mono_mempool_alloc (image->mempool, size);
mono_image_unlock (image);
{
gpointer res;
+#ifndef DISABLE_PERFCOUNTERS
mono_perfcounters->loader_bytes += size;
+#endif
mono_image_lock (image);
res = mono_mempool_alloc0 (image->mempool, size);
mono_image_unlock (image);
{
char *res;
+#ifndef DISABLE_PERFCOUNTERS
mono_perfcounters->loader_bytes += strlen (s);
+#endif
mono_image_lock (image);
res = mono_mempool_strdup (image->mempool, s);
mono_image_unlock (image);
if (method->klass->generic_class)
return mono_method_signature (method);
+#ifndef DISABLE_REFLECTION_EMIT
if (image->dynamic) {
sig = mono_reflection_lookup_signature (image, method, token);
} else {
+#endif
mono_metadata_decode_row (&image->tables [MONO_TABLE_MEMBERREF], idx-1, cols, MONO_MEMBERREF_SIZE);
sig_idx = cols [MONO_MEMBERREF_SIGNATURE];
mono_loader_set_error_bad_image (g_strdup_printf ("Incompatible method signature class token 0x%08x field name %s token 0x%08x on image %s", class, fname, token, image->name));
return NULL;
}
+#ifndef DISABLE_REFLECTION_EMIT
}
+#endif
if (context) {
break;
}
case MONO_TYPE_OBJECT: {
+#ifndef DISABLE_COM
mono_init_com_types ();
if (to_object) {
static MonoMethod *variant_clear = NULL;
mono_mb_emit_byte(mb, CEE_LDIND_REF);
mono_mb_emit_ldloc (mb, 1);
mono_mb_emit_managed_call (mb, get_native_variant_for_object, NULL);
- }
+ }
+#else
+ char *msg = g_strdup_printf ("COM support was disabled at compilation time.");
+ mono_mb_emit_exception_marshal_directive (mb, msg);
+#endif
break;
}
return method;
/* this seems to be the best plase to put this, as all remoting invokes seem to get filtered through here */
+#ifndef DISABLE_COM
if (method->klass->is_com_object || method->klass == mono_defaults.com_object_class) {
MonoVTable *vtable = mono_class_vtable (mono_domain_get (), method->klass);
g_assert (vtable); /*FIXME do proper error handling*/
if (!vtable->remote) {
-#ifndef DISABLE_COM
return mono_cominterop_get_invoke (method);
-#else
- g_assert_not_reached ();
-#endif
}
}
+#endif
sig = mono_signature_no_pinvoke (method);
return conv_arg;
}
+
+#ifndef DISABLE_COM
+
static int
emit_marshal_variant (EmitMarshalContext *m, int argnum, MonoType *t,
MonoMarshalSpec *spec,
return conv_arg;
}
+#endif /* DISABLE_COM */
+
static gboolean
mono_pinvoke_is_unicode (MonoMethodPInvoke *piinfo)
{
return emit_marshal_string (m, argnum, t, spec, conv_arg, conv_arg_type, action);
case MONO_TYPE_CLASS:
case MONO_TYPE_OBJECT:
+#ifndef DISABLE_COM
if (spec && spec->native == MONO_NATIVE_STRUCT)
return emit_marshal_variant (m, argnum, t, spec, conv_arg, conv_arg_type, action);
-#ifndef DISABLE_COM
if (spec && (spec->native == MONO_NATIVE_IUNKNOWN ||
spec->native == MONO_NATIVE_IDISPATCH ||
spec->native == MONO_NATIVE_INTERFACE))
5, /*tables*/
MONO_TABLE_TYPEDEF,
MONO_TABLE_TYPEREF,
- MONO_TABLE_MODULE,
+ MONO_TABLE_MODULEREF,
MONO_TABLE_METHOD,
MONO_TABLE_TYPESPEC,
n = MAX (n, meta->tables [MONO_TABLE_METHOD].rows);
n = MAX (n, meta->tables [MONO_TABLE_MODULEREF].rows);
n = MAX (n, meta->tables [MONO_TABLE_TYPESPEC].rows);
- n = MAX (n, meta->tables [MONO_TABLE_MEMBERREF].rows);
/* 3 bits to encode */
field_size = rtsize (n, 16 - 3);
mon->data = monitor_freelist;
monitor_freelist = mon;
+#ifndef DISABLE_PERFCOUNTERS
mono_perfcounters->gc_sync_blocks--;
+#endif
}
/* LOCKING: this is called with monitor_mutex held */
new->owner = id;
new->nest = 1;
+#ifndef DISABLE_PERFCOUNTERS
mono_perfcounters->gc_sync_blocks++;
+#endif
return new;
}
}
/* The object must be locked by someone else... */
+#ifndef DISABLE_PERFCOUNTERS
mono_perfcounters->thread_contentions++;
+#endif
/* If ms is 0 we don't block, but just fail straight away */
if (ms == 0) {
InterlockedIncrement (&mon->entry_count);
+#ifndef DISABLE_PERFCOUNTERS
mono_perfcounters->thread_queue_len++;
mono_perfcounters->thread_queue_max++;
+#endif
thread = mono_thread_internal_current ();
mono_thread_set_state (thread, ThreadState_WaitSleepJoin);
mono_thread_clr_state (thread, ThreadState_WaitSleepJoin);
InterlockedDecrement (&mon->entry_count);
+#ifndef DISABLE_PERFCOUNTERS
mono_perfcounters->thread_queue_len--;
+#endif
if (ms != INFINITE) {
now = mono_msec_ticks ();
MonoDebugDataTable *table;
table = g_hash_table_lookup (data_table_hash, domain);
- g_assert (table);
+ if (!table) {
+ g_error ("lookup_data_table () failed for %p\n", domain);
+ g_assert (table);
+ }
return table;
}
int counterType;
};
+#ifndef DISABLE_PERFCOUNTERS
/* map of PerformanceCounterType.cs */
enum {
NumberOfItemsHEX32=0x00000000,
return mono_array_new (mono_domain_get (), mono_get_string_class (), 0);
}
}
+#else
+void*
+mono_perfcounter_get_impl (MonoString* category, MonoString* counter, MonoString* instance, MonoString* machine, int *type, MonoBoolean *custom)
+{
+ g_assert_not_reached ();
+}
+
+MonoBoolean
+mono_perfcounter_get_sample (void *impl, MonoBoolean only_value, MonoCounterSample *sample)
+{
+ g_assert_not_reached ();
+}
+
+gint64
+mono_perfcounter_update_value (void *impl, MonoBoolean do_incr, gint64 value)
+{
+ g_assert_not_reached ();
+}
+
+void
+mono_perfcounter_free_data (void *impl)
+{
+ g_assert_not_reached ();
+}
+
+/* Category icalls */
+MonoBoolean
+mono_perfcounter_category_del (MonoString *name)
+{
+ g_assert_not_reached ();
+}
+
+MonoString*
+mono_perfcounter_category_help (MonoString *category, MonoString *machine)
+{
+ g_assert_not_reached ();
+}
+MonoBoolean
+mono_perfcounter_category_exists (MonoString *counter, MonoString *category, MonoString *machine)
+{
+ g_assert_not_reached ();
+}
+
+MonoBoolean
+mono_perfcounter_create (MonoString *category, MonoString *help, int type, MonoArray *items)
+{
+ g_assert_not_reached ();
+}
+
+int
+mono_perfcounter_instance_exists (MonoString *instance, MonoString *category, MonoString *machine)
+{
+ g_assert_not_reached ();
+}
+
+MonoArray*
+mono_perfcounter_category_names (MonoString *machine)
+{
+ g_assert_not_reached ();
+}
+
+MonoArray*
+mono_perfcounter_counter_names (MonoString *category, MonoString *machine)
+{
+ g_assert_not_reached ();
+}
+
+MonoArray*
+mono_perfcounter_instance_names (MonoString *category, MonoString *machine)
+{
+ g_assert_not_reached ();
+}
+#endif
#endif
#define MONO_CHECK_ARG(arg, expr) G_STMT_START{ \
- if (!(expr)) \
+ if (G_UNLIKELY (!(expr))) \
{ \
MonoException *ex; \
char *msg = g_strdup_printf ("assertion `%s' failed", \
}; }G_STMT_END
#define MONO_CHECK_ARG_NULL(arg) G_STMT_START{ \
- if (arg == NULL) \
+ if (G_UNLIKELY (arg == NULL)) \
{ \
MonoException *ex; \
if (arg) {} /* check if the name exists */ \
rc->default_vtable = NULL;
rc->xdomain_vtable = NULL;
rc->proxy_class_name = name;
+#ifndef DISABLE_PERFCOUNTERS
mono_perfcounters->loader_bytes += mono_string_length (class_name) + 1;
+#endif
g_hash_table_insert (domain->proxy_vtable_hash, key, rc);
MonoClass *klass;
type = ((MonoReflectionType *)rp->class_to_proxy)->type;
klass = mono_class_from_mono_type (type);
+#ifndef DISABLE_COM
if ((klass->is_com_object || (mono_defaults.com_object_class && klass == mono_defaults.com_object_class)) && !mono_class_vtable (mono_domain_get (), klass)->remote)
remote_class->default_vtable = mono_class_proxy_vtable (domain, remote_class, MONO_REMOTING_TARGET_COMINTEROP);
else
+#endif
remote_class->default_vtable = mono_class_proxy_vtable (domain, remote_class, MONO_REMOTING_TARGET_UNKNOWN);
}
if (!file)
usage ();
+#ifndef DISABLE_PERFCOUNTERS
mono_perfcounters_init ();
+#endif
mono_metadata_init ();
mono_images_init ();
mono_assemblies_init ();
* Copyright 2005-2011 Novell, Inc (http://www.novell.com)
* Copyright 2011 Xamarin Inc (http://www.xamarin.com)
* Copyright 2011 Xamarin, Inc.
+ * Copyright (C) 2012 Xamarin Inc
*
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* visible before the vtable store.
*/
- DEBUG (6, fprintf (gc_debug_file, "Allocated object %p, vtable: %p (%s), size: %zd\n", p, vtable, vtable->klass->name, size));
+ SGEN_LOG (6, "Allocated object %p, vtable: %p (%s), size: %zd", p, vtable, vtable->klass->name, size);
binary_protocol_alloc (p , vtable, size);
if (G_UNLIKELY (MONO_GC_NURSERY_OBJ_ALLOC_ENABLED ()))
MONO_GC_NURSERY_OBJ_ALLOC ((mword)p, size, vtable->klass->name_space, vtable->klass->name);
} else {
size_t alloc_size = 0;
if (TLAB_START)
- DEBUG (3, fprintf (gc_debug_file, "Retire TLAB: %p-%p [%ld]\n", TLAB_START, TLAB_REAL_END, (long)(TLAB_REAL_END - TLAB_NEXT - size)));
+ SGEN_LOG (3, "Retire TLAB: %p-%p [%ld]", TLAB_START, TLAB_REAL_END, (long)(TLAB_REAL_END - TLAB_NEXT - size));
sgen_nursery_retire_region (p, available_in_tlab);
do {
sgen_set_nursery_scan_start ((char*)p);
/* we just bump tlab_temp_end as well */
TLAB_TEMP_END = MIN (TLAB_REAL_END, TLAB_NEXT + SGEN_SCAN_START_SIZE);
- DEBUG (5, fprintf (gc_debug_file, "Expanding local alloc: %p-%p\n", TLAB_NEXT, TLAB_TEMP_END));
+ SGEN_LOG (5, "Expanding local alloc: %p-%p", TLAB_NEXT, TLAB_TEMP_END);
}
}
if (G_LIKELY (p)) {
- DEBUG (6, fprintf (gc_debug_file, "Allocated object %p, vtable: %p (%s), size: %zd\n", p, vtable, vtable->klass->name, size));
+ SGEN_LOG (6, "Allocated object %p, vtable: %p (%s), size: %zd", p, vtable, vtable->klass->name, size);
binary_protocol_alloc (p, vtable, size);
if (G_UNLIKELY (MONO_GC_MAJOR_OBJ_ALLOC_LARGE_ENABLED ()|| MONO_GC_NURSERY_OBJ_ALLOC_ENABLED ())) {
if (size > SGEN_MAX_SMALL_OBJ_SIZE)
sgen_set_nursery_scan_start (new_next);
/* we just bump tlab_temp_end as well */
TLAB_TEMP_END = MIN (TLAB_REAL_END, TLAB_NEXT + SGEN_SCAN_START_SIZE);
- DEBUG (5, fprintf (gc_debug_file, "Expanding local alloc: %p-%p\n", TLAB_NEXT, TLAB_TEMP_END));
+ SGEN_LOG (5, "Expanding local alloc: %p-%p", TLAB_NEXT, TLAB_TEMP_END);
}
} else if (available_in_tlab > SGEN_MAX_NURSERY_WASTE) {
/* Allocate directly from the nursery */
HEAVY_STAT (++stat_objects_alloced);
HEAVY_STAT (stat_bytes_alloced += size);
- DEBUG (6, fprintf (gc_debug_file, "Allocated object %p, vtable: %p (%s), size: %zd\n", p, vtable, vtable->klass->name, size));
+ SGEN_LOG (6, "Allocated object %p, vtable: %p (%s), size: %zd", p, vtable, vtable->klass->name, size);
binary_protocol_alloc (p, vtable, size);
if (G_UNLIKELY (MONO_GC_NURSERY_OBJ_ALLOC_ENABLED ()))
MONO_GC_NURSERY_OBJ_ALLOC ((mword)p, size, vtable->klass->name_space, vtable->klass->name);
/* large objects are always pinned anyway */
p = sgen_los_alloc_large_inner (vtable, size);
} else {
- DEBUG (9, g_assert (vtable->klass->inited));
+ SGEN_ASSERT (9, vtable->klass->inited, "class %s:%s is not initialized", vtable->klass->name_space, vtable->klass->name);
p = major_collector.alloc_small_pinned_obj (size, SGEN_VTABLE_HAS_REFERENCES (vtable));
}
if (G_LIKELY (p)) {
- DEBUG (6, fprintf (gc_debug_file, "Allocated pinned object %p, vtable: %p (%s), size: %zd\n", p, vtable, vtable->klass->name, size));
+ SGEN_LOG (6, "Allocated pinned object %p, vtable: %p (%s), size: %zd", p, vtable, vtable->klass->name, size);
if (size > SGEN_MAX_SMALL_OBJ_SIZE)
MONO_GC_MAJOR_OBJ_ALLOC_LARGE ((mword)p, size, vtable->klass->name_space, vtable->klass->name);
else
/*
- * SGen is licensed under the terms of the MIT X11 license
+ * sgen-archdep.h: Architecture dependent parts of SGen.
*
* Copyright 2001-2003 Ximian, Inc
* Copyright 2003-2010 Novell, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __MONO_SGENARCHDEP_H__
#define __MONO_SGENARCHDEP_H__
#include <mono/utils/mono-sigcontext.h>
-#if defined(__i386__) || defined(TARGET_X86)
+#if defined(MONO_CROSS_COMPILE)
+
+#define REDZONE_SIZE 0
+
+#define ARCH_NUM_REGS 0
+#define ARCH_STORE_REGS(ptr)
+#define ARCH_SIGCTX_SP(ctx) NULL
+#define ARCH_SIGCTX_IP(ctx) NULL
+#define ARCH_COPY_SIGCTX_REGS(a,ctx)
+
+#elif defined(TARGET_X86)
#include <mono/utils/mono-context.h>
#define ARCH_SIGCTX_SP(ctx) (UCONTEXT_REG_ESP ((ctx)))
#define ARCH_SIGCTX_IP(ctx) (UCONTEXT_REG_EIP ((ctx)))
-#elif defined(__x86_64__) || defined(TARGET_AMD64)
+#elif defined(TARGET_AMD64)
#include <mono/utils/mono-context.h>
#define ARCH_SIGCTX_SP(ctx) (UCONTEXT_REG_RSP (ctx))
#define ARCH_SIGCTX_IP(ctx) (UCONTEXT_REG_RIP (ctx))
-#elif defined(__ppc__) || defined(__powerpc__) || defined(__powerpc64__)
+#elif defined(TARGET_PPC)
#define REDZONE_SIZE 224
((a)[__i]) = UCONTEXT_REG_Rn((ctx), __i); \
} while (0)
-#elif defined(__arm__)
+#elif defined(TARGET_ARM)
#define REDZONE_SIZE 0
+#define USE_MONO_CTX
/* We dont store ip, sp */
#define ARCH_NUM_REGS 14
#ifdef CARDTABLE_STATS
typedef struct {
- int total, marked, remarked;
+ int total, marked, remarked, gc_marked;
} card_stats;
static card_stats major_stats, los_stats;
{
mword end = start + size;
while (start <= end) {
+ guint8 card = *sgen_card_table_get_card_address (start);
++cur_stats->total;
- if (sgen_card_table_address_is_marked (start))
+ if (card)
++cur_stats->marked;
+ if (card == 2)
+ ++cur_stats->gc_marked;
start += CARD_SIZE_IN_BYTES;
}
}
{
mword end = start + size;
while (start <= end) {
- if (sgen_card_table_address_is_marked (start))
+ if (sgen_card_table_address_is_marked (start)) {
++cur_stats->remarked;
+ *sgen_card_table_get_card_address (start) = 2;
+ }
start += CARD_SIZE_IN_BYTES;
}
}
sgen_los_iterate_live_block_ranges (count_marked_cards);
} else {
cur_stats = &major_stats;
- sgen_major_collector_iterate_live_block_ranges (count_marked_cards);
+ sgen_major_collector_iterate_live_block_ranges (count_remarked_cards);
cur_stats = &los_stats;
sgen_los_iterate_live_block_ranges (count_remarked_cards);
- printf ("cards major (t %d m %d r %d) los (t %d m %d r %d) major_scan %.2fms los_scan %.2fms\n",
- major_stats.total, major_stats.marked, major_stats.remarked,
- los_stats.total, los_stats.marked, los_stats.remarked,
+ printf ("cards major (t %d m %d g %d r %d) los (t %d m %d g %d r %d) major_scan %.2fms los_scan %.2fms\n",
+ major_stats.total, major_stats.marked, major_stats.gc_marked, major_stats.remarked,
+ los_stats.total, los_stats.marked, los_stats.gc_marked, los_stats.remarked,
last_major_scan_time / 1000.0, last_los_scan_time / 1000.0);
}
#endif
/*
+ * sgen-conf.h: Tunable parameters and debugging switches.
+ *
* Copyright 2001-2003 Ximian, Inc
* Copyright 2003-2010 Novell, Inc.
* Copyright 2011 Xamarin Inc (http://www.xamarin.com)
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __MONO_SGENCONF_H__
#define __MONO_SGENCONF_H__
/*
* Maximum level of debug to enable on this build.
- * Making this a static variable enables us to put logging in a lot of places.
- * FIXME decouple logging from assertions
+ * Making this a constant enables us to put logging in a lot of places and
+ * not pay its cost on release builds.
*/
#define SGEN_MAX_DEBUG_LEVEL 2
+/*
+ * Maximum level of asserts to enable on this build.
+ * FIXME replace all magic numbers with defines.
+ */
+#define SGEN_MAX_ASSERT_LEVEL 2
+
#define GC_BITS_PER_WORD (sizeof (mword) * 8)
/*
+ * sgen-copy-object.h: This is where objects are copied.
+ *
* Copyright 2001-2003 Ximian, Inc
* Copyright 2003-2010 Novell, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
extern long long stat_copy_object_called_nursery;
extern long long stat_objects_copied_nursery;
static const void *copy_labels [] = { &&LAB_0, &&LAB_1, &&LAB_2, &&LAB_3, &&LAB_4, &&LAB_5, &&LAB_6, &&LAB_7, &&LAB_8 };
#endif
- DEBUG (9, g_assert (vt->klass->inited));
- DEBUG (9, fprintf (gc_debug_file, " (to %p, %s size: %lu)\n", destination, ((MonoObject*)obj)->vtable->klass->name, (unsigned long)objsize));
+ SGEN_ASSERT (9, vt->klass->inited, "vtable %p for class %s:%s was not initialized", vt, vt->klass->name_space, vt->klass->name);
+ SGEN_LOG (9, " (to %p, %s size: %lu)", destination, ((MonoObject*)obj)->vtable->klass->name, (unsigned long)objsize);
binary_protocol_copy (obj, destination, vt, objsize);
if (G_UNLIKELY (MONO_GC_OBJ_MOVED_ENABLED ())) {
mono_gc_memmove (destination + sizeof (mword), (char*)obj + sizeof (mword), objsize - sizeof (mword));
#endif
/* adjust array->bounds */
- DEBUG (9, g_assert (vt->gc_descr));
+ SGEN_ASSERT (9, vt->gc_descr, "vtable %p for class %s:%s has no gc descriptor", vt, vt->klass->name_space, vt->klass->name);
+
if (G_UNLIKELY (vt->rank && ((MonoArray*)obj)->bounds)) {
MonoArray *array = (MonoArray*)destination;
array->bounds = (MonoArrayBounds*)((char*)destination + ((char*)((MonoArray*)obj)->bounds - (char*)obj));
- DEBUG (9, fprintf (gc_debug_file, "Array instance %p: size: %lu, rank: %d, length: %lu\n", array, (unsigned long)objsize, vt->rank, (unsigned long)mono_array_length (array)));
+ SGEN_LOG (9, "Array instance %p: size: %lu, rank: %d, length: %lu", array, (unsigned long)objsize, vt->rank, (unsigned long)mono_array_length (array));
}
if (G_UNLIKELY (mono_profiler_events & MONO_PROFILE_GC_MOVES))
sgen_register_moved_object (obj, destination);
obj = destination;
if (queue) {
- DEBUG (9, fprintf (gc_debug_file, "Enqueuing gray object %p (%s)\n", obj, sgen_safe_name (obj)));
+ SGEN_LOG (9, "Enqueuing gray object %p (%s)", obj, sgen_safe_name (obj));
GRAY_OBJECT_ENQUEUE (queue, obj);
}
}
+/*
+ * This can return OBJ itself on OOM.
+ */
#ifdef _MSC_VER
static __declspec(noinline) void*
#else
MonoVTable *vt = ((MonoObject*)obj)->vtable;
gboolean has_references = SGEN_VTABLE_HAS_REFERENCES (vt);
mword objsize = SGEN_ALIGN_UP (sgen_par_object_get_size (vt, (MonoObject*)obj));
- char *destination = collector_serial_alloc_for_promotion (obj, objsize, has_references);
+ char *destination = COLLECTOR_SERIAL_ALLOC_FOR_PROMOTION (obj, objsize, has_references);
if (G_UNLIKELY (!destination)) {
collector_pin_object (obj, queue);
return destination;
}
-
-#ifdef GENERATE_COPY_FUNCTIONS
-
-extern long long stat_nursery_copy_object_failed_to_space; /* from sgen-gc.c */
-
-#if defined(SGEN_SIMPLE_NURSERY)
-#define serial_copy_object simple_nursery_serial_copy_object
-#define parallel_copy_object simple_nursery_parallel_copy_object
-
-#elif defined (SGEN_SPLIT_NURSERY)
-
-#define serial_copy_object split_nursery_serial_copy_object
-#define parallel_copy_object split_nursery_parallel_copy_object
-
-#else
-#error "Please define GC_CONF_NAME"
-#endif
-
-/*
- * This is how the copying happens from the nursery to the old generation.
- * We assume that at this time all the pinned objects have been identified and
- * marked as such.
- * We run scan_object() for each pinned object so that each referenced
- * objects if possible are copied. The new gray objects created can have
- * scan_object() run on them right away, too.
- * Then we run copy_object() for the precisely tracked roots. At this point
- * all the roots are either gray or black. We run scan_object() on the gray
- * objects until no more gray objects are created.
- * At the end of the process we walk again the pinned list and we unmark
- * the pinned flag. As we go we also create the list of free space for use
- * in the next allocation runs.
- *
- * We need to remember objects from the old generation that point to the new one
- * (or just addresses?).
- *
- * copy_object could be made into a macro once debugged (use inline for now).
- */
-
-#ifdef _MSC_VER
-static __forceinline void
-#else
-static inline void __attribute__((always_inline))
-#endif
-serial_copy_object (void **obj_slot, SgenGrayQueue *queue)
-{
- char *forwarded;
- char *obj = *obj_slot;
-
- DEBUG (9, g_assert (current_collection_generation == GENERATION_NURSERY));
-
- HEAVY_STAT (++stat_copy_object_called_nursery);
-
- if (!sgen_ptr_in_nursery (obj)) {
- HEAVY_STAT (++stat_nursery_copy_object_failed_from_space);
- return;
- }
-
- DEBUG (9, fprintf (gc_debug_file, "Precise copy of %p from %p", obj, obj_slot));
-
- /*
- * Before we can copy the object we must make sure that we are
- * allowed to, i.e. that the object not pinned, not already
- * forwarded or belongs to the nursery To Space.
- */
-
- if ((forwarded = SGEN_OBJECT_IS_FORWARDED (obj))) {
- DEBUG (9, g_assert ((*(MonoVTable**)SGEN_LOAD_VTABLE(obj))->gc_descr));
- DEBUG (9, fprintf (gc_debug_file, " (already forwarded to %p)\n", forwarded));
- HEAVY_STAT (++stat_nursery_copy_object_failed_forwarded);
- *obj_slot = forwarded;
- return;
- }
- if (SGEN_OBJECT_IS_PINNED (obj)) {
- DEBUG (9, g_assert (((MonoVTable*)SGEN_LOAD_VTABLE(obj))->gc_descr));
- DEBUG (9, fprintf (gc_debug_file, " (pinned, no change)\n"));
- HEAVY_STAT (++stat_nursery_copy_object_failed_pinned);
- return;
- }
-
- if (sgen_nursery_is_to_space (obj)) {
- DEBUG (9, g_assert (((MonoVTable*)SGEN_LOAD_VTABLE(obj))->gc_descr));
- DEBUG (9, fprintf (gc_debug_file, " (tospace, no change)\n"));
- HEAVY_STAT (++stat_nursery_copy_object_failed_to_space);
- return;
- }
-
- HEAVY_STAT (++stat_objects_copied_nursery);
-
- *obj_slot = copy_object_no_checks (obj, queue);
-}
-
-static void
-parallel_copy_object (void **obj_slot, SgenGrayQueue *queue)
-{
- char *obj = *obj_slot;
- mword vtable_word, objsize;
- MonoVTable *vt;
- void *destination;
- gboolean has_references;
-
- DEBUG (9, g_assert (current_collection_generation == GENERATION_NURSERY));
-
- HEAVY_STAT (++stat_copy_object_called_nursery);
-
- if (!sgen_ptr_in_nursery (obj)) {
- HEAVY_STAT (++stat_nursery_copy_object_failed_from_space);
- return;
- }
-
- vtable_word = *(mword*)obj;
- vt = (MonoVTable*)(vtable_word & ~SGEN_VTABLE_BITS_MASK);
-
- /*
- * Before we can copy the object we must make sure that we are
- * allowed to, i.e. that the object not pinned, not already
- * forwarded and not in the nursery To Space.
- */
-
- if (vtable_word & SGEN_FORWARDED_BIT) {
- HEAVY_STAT (++stat_nursery_copy_object_failed_forwarded);
- *obj_slot = vt;
- return;
- }
- if (vtable_word & SGEN_PINNED_BIT) {
- HEAVY_STAT (++stat_nursery_copy_object_failed_pinned);
- return;
- }
-
- if (sgen_nursery_is_to_space (obj)) {
- HEAVY_STAT (++stat_nursery_copy_object_failed_to_space);
- return;
- }
-
- HEAVY_STAT (++stat_objects_copied_nursery);
-
- objsize = SGEN_ALIGN_UP (sgen_par_object_get_size (vt, (MonoObject*)obj));
- has_references = SGEN_VTABLE_HAS_REFERENCES (vt);
-
- destination = collector_parallel_alloc_for_promotion (obj, objsize, has_references);
-
- if (G_UNLIKELY (!destination)) {
- sgen_parallel_pin_or_update (obj_slot, obj, vt, queue);
- return;
- }
-
- *(MonoVTable**)destination = vt;
-
- if (SGEN_CAS_PTR ((void*)obj, (void*)((mword)destination | SGEN_FORWARDED_BIT), vt) == vt) {
- par_copy_object_no_checks (destination, vt, obj, objsize, has_references ? queue : NULL);
- obj = destination;
- *obj_slot = obj;
- } else {
- /* FIXME: unify with code in major_copy_or_mark_object() */
-
- /* FIXME: Give destination back to the allocator. */
- /*The major collector only needs the first word zeroed and nursery requires all bits to be. */
- if (!sgen_ptr_in_nursery (destination))
- *(void**)destination = NULL;
- else
- memset (destination, 0, objsize);
-
- vtable_word = *(mword*)obj;
- g_assert (vtable_word & SGEN_FORWARDED_BIT);
-
- obj = (void*)(vtable_word & ~SGEN_VTABLE_BITS_MASK);
-
- *obj_slot = obj;
-
- HEAVY_STAT (++stat_slots_allocated_in_vain);
- }
-}
-
-#endif
* Copyright 2005-2011 Novell, Inc (http://www.novell.com)
* Copyright 2011 Xamarin Inc (http://www.xamarin.com)
* Copyright 2011 Xamarin, Inc.
+ * Copyright (C) 2012 Xamarin Inc
*
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "config.h"
else
printf ("Pointer is at offset 0x%x of object %p in LOS space.\n", (int)(ptr - start), start);
ptr = start;
- } else if (major_collector.ptr_is_in_non_pinned_space (ptr)) {
- printf ("Pointer inside oldspace.\n");
+ } else if (major_collector.ptr_is_in_non_pinned_space (ptr, &start)) {
+ if (ptr == start)
+ printf ("Pointer is the start of object %p in oldspace.\n", start);
+ else if (start)
+ printf ("Pointer is at offset 0x%x of object %p in oldspace.\n", (int)(ptr - start), start);
+ else
+ printf ("Pointer inside oldspace.\n");
+ if (start)
+ ptr = start;
} else if (major_collector.obj_is_from_pinned_alloc (ptr)) {
printf ("Pointer is inside a pinned chunk.\n");
} else {
#define HANDLE_PTR(ptr,obj) do { \
if (*(ptr) && sgen_ptr_in_nursery ((char*)*(ptr))) { \
if (!sgen_get_remset ()->find_address ((char*)(ptr))) { \
- fprintf (gc_debug_file, "Oldspace->newspace reference %p at offset %td in object %p (%s.%s) not found in remsets.\n", *(ptr), (char*)(ptr) - (char*)(obj), (obj), ((MonoObject*)(obj))->vtable->klass->name_space, ((MonoObject*)(obj))->vtable->klass->name); \
+ SGEN_LOG (1, "Oldspace->newspace reference %p at offset %td in object %p (%s.%s) not found in remsets.", *(ptr), (char*)(ptr) - (char*)(obj), (obj), ((MonoObject*)(obj))->vtable->klass->name_space, ((MonoObject*)(obj))->vtable->klass->name); \
binary_protocol_missing_remset ((obj), (gpointer)LOAD_VTABLE ((obj)), (char*)(ptr) - (char*)(obj), *(ptr), (gpointer)LOAD_VTABLE(*(ptr)), object_is_pinned (*(ptr))); \
if (!object_is_pinned (*(ptr))) \
missing_remsets = TRUE; \
check_consistency_callback (char *start, size_t size, void *dummy)
{
GCVTable *vt = (GCVTable*)LOAD_VTABLE (start);
- DEBUG (8, fprintf (gc_debug_file, "Scanning object %p, vtable: %p (%s)\n", start, vt, vt->klass->name));
+ SGEN_LOG (8, "Scanning object %p, vtable: %p (%s)", start, vt, vt->klass->name);
#define SCAN_OBJECT_ACTION
#include "sgen-scan-object.h"
missing_remsets = FALSE;
- DEBUG (1, fprintf (gc_debug_file, "Begin heap consistency check...\n"));
+ SGEN_LOG (1, "Begin heap consistency check...");
// Check that oldspace->newspace pointers are registered with the collector
major_collector.iterate_objects (TRUE, TRUE, (IterateObjectCallbackFunc)check_consistency_callback, NULL);
sgen_los_iterate_objects ((IterateObjectCallbackFunc)check_consistency_callback, NULL);
- DEBUG (1, fprintf (gc_debug_file, "Heap consistency check done.\n"));
+ SGEN_LOG (1, "Heap consistency check done.");
if (!binary_protocol_is_enabled ())
g_assert (!missing_remsets);
{
int i;
- fprintf (gc_debug_file, "nursery-ptr ");
for (i = 0; i < valid_nursery_object_count; ++i) {
if (valid_nursery_objects [i] >= ptr)
break;
}
if (i >= valid_nursery_object_count || valid_nursery_objects [i] + safe_object_get_size ((MonoObject *)valid_nursery_objects [i]) < ptr) {
- fprintf (gc_debug_file, "(unalloc'd-memory)");
+ SGEN_LOG (1, "nursery-ptr (unalloc'd-memory)");
} else {
char *obj = valid_nursery_objects [i];
MonoVTable *vtable = (MonoVTable*)LOAD_VTABLE (obj);
int size = safe_object_get_size ((MonoObject *)obj);
if (obj == ptr)
- fprintf (gc_debug_file, "(object %s.%s size %d)",
+ SGEN_LOG (1, "nursery-ptr (object %s.%s size %d)",
vtable->klass->name_space, vtable->klass->name, size);
else
- fprintf (gc_debug_file, "(interior-ptr offset %td of %p (%s.%s) size %d)",
+ SGEN_LOG (1, "nursery-ptr (interior-ptr offset %td of %p (%s.%s) size %d)",
ptr - obj, obj,
vtable->klass->name_space, vtable->klass->name, size);
}
} else if (major_collector.describe_pointer (ptr)) {
//Nothing really
} else if (!mono_sgen_los_describe_pointer (ptr)) {
- fprintf (gc_debug_file, "non-heap-ptr");
+ SGEN_LOG (1, "\tnon-heap-ptr");
}
}
char *ptr = *slot;
MonoVTable *vtable = (MonoVTable*)LOAD_VTABLE (obj);
- fprintf (gc_debug_file, "Invalid object pointer %p [", ptr);
- describe_pointer (ptr);
- fprintf (gc_debug_file, "] at offset %td in object %p (%s.%s).\n",
+ SGEN_LOG (1, "Invalid object pointer %p at offset %td in object %p (%s.%s):", ptr,
(char*)slot - obj,
obj, vtable->klass->name_space, vtable->klass->name);
+ describe_pointer (ptr);
broken_heap = TRUE;
}
char *ptr = *slot;
MonoVTable *vtable = (MonoVTable*)LOAD_VTABLE (obj);
- fprintf (gc_debug_file, "Oldspace->newspace reference %p at offset %td in object %p (%s.%s) not found in remsets.\n",
+ SGEN_LOG (1, "Oldspace->newspace reference %p at offset %td in object %p (%s.%s) not found in remsets.",
ptr, (char*)slot - obj, obj,
vtable->klass->name_space, vtable->klass->name);
continue;
while (start < (char**)info->stack_end) {
if (*start >= obj && *start < endobj) {
- DEBUG (0, fprintf (gc_debug_file, "Object %p referenced in thread %p (id %p) at %p, stack: %p-%p\n", obj, info, (gpointer)mono_thread_info_get_tid (info), start, info->stack_start, info->stack_end));
+ SGEN_LOG (1, "Object %p referenced in thread %p (id %p) at %p, stack: %p-%p", obj, info, (gpointer)mono_thread_info_get_tid (info), start, info->stack_start, info->stack_end);
}
start++;
}
#endif
if (w >= (mword)obj && w < (mword)obj + size)
- DEBUG (0, fprintf (gc_debug_file, "Object %p referenced in saved reg %d of thread %p (id %p)\n", obj, j, info, (gpointer)mono_thread_info_get_tid (info)));
+ SGEN_LOG (1, "Object %p referenced in saved reg %d of thread %p (id %p)", obj, j, info, (gpointer)mono_thread_info_get_tid (info));
} END_FOREACH_THREAD
}
}
if (!root->root_desc) {
while (start < (char**)root->end_root) {
if (*start >= obj && *start < endobj) {
- DEBUG (0, fprintf (gc_debug_file, "Object %p referenced in pinned roots %p-%p\n", obj, start, root->end_root));
+ SGEN_LOG (1, "Object %p referenced in pinned roots %p-%p\n", obj, start, root->end_root);
}
start++;
}
/*
+ * sgen-descriptor.c: GC descriptors describe object layout.
+ *
* Copyright 2001-2003 Ximian, Inc
* Copyright 2003-2010 Novell, Inc.
* Copyright 2011 Xamarin Inc (http://www.xamarin.com)
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "config.h"
#ifdef HAVE_SGEN_GC
complex_descriptors = g_realloc (complex_descriptors, new_size * sizeof (gsize));
complex_descriptors_size = new_size;
}
- DEBUG (6, fprintf (gc_debug_file, "Complex descriptor %d, size: %d (total desc memory: %d)\n", res, nwords, complex_descriptors_size));
+ SGEN_LOG (6, "Complex descriptor %d, size: %d (total desc memory: %d)", res, nwords, complex_descriptors_size);
complex_descriptors_next += nwords;
complex_descriptors [res] = nwords;
for (i = 0; i < nwords - 1; ++i) {
complex_descriptors [res + 1 + i] = bitmap [i];
- DEBUG (6, fprintf (gc_debug_file, "\tvalue: %p\n", (void*)complex_descriptors [res + 1 + i]));
+ SGEN_LOG (6, "\tvalue: %p", (void*)complex_descriptors [res + 1 + i]);
}
sgen_gc_unlock ();
return res;
}
if (first_set < 0) {
- DEBUG (6, fprintf (gc_debug_file, "Ptrfree descriptor %p, size: %zd\n", (void*)desc, stored_size));
+ SGEN_LOG (6, "Ptrfree descriptor %p, size: %zd", (void*)desc, stored_size);
if (stored_size <= MAX_RUNLEN_OBJECT_SIZE)
return (void*)(DESC_TYPE_RUN_LENGTH | stored_size);
return (void*)DESC_TYPE_COMPLEX_PTRFREE;
*/
if (first_set < 256 && num_set < 256 && (first_set + num_set == last_set + 1)) {
desc = DESC_TYPE_RUN_LENGTH | stored_size | (first_set << 16) | (num_set << 24);
- DEBUG (6, fprintf (gc_debug_file, "Runlen descriptor %p, size: %zd, first set: %d, num set: %d\n", (void*)desc, stored_size, first_set, num_set));
+ SGEN_LOG (6, "Runlen descriptor %p, size: %zd, first set: %d, num set: %d", (void*)desc, stored_size, first_set, num_set);
return (void*) desc;
}
}
/* we know the 2-word header is ptr-free */
if (last_set < SMALL_BITMAP_SIZE + OBJECT_HEADER_WORDS) {
desc = DESC_TYPE_SMALL_BITMAP | stored_size | ((*bitmap >> OBJECT_HEADER_WORDS) << SMALL_BITMAP_SHIFT);
- DEBUG (6, fprintf (gc_debug_file, "Smallbitmap descriptor %p, size: %zd, last set: %d\n", (void*)desc, stored_size, last_set));
+ SGEN_LOG (6, "Smallbitmap descriptor %p, size: %zd, last set: %d", (void*)desc, stored_size, last_set);
return (void*) desc;
}
/* we know the 2-word header is ptr-free */
if (last_set < LARGE_BITMAP_SIZE + OBJECT_HEADER_WORDS) {
desc = DESC_TYPE_LARGE_BITMAP | ((*bitmap >> OBJECT_HEADER_WORDS) << LOW_TYPE_BITS);
- DEBUG (6, fprintf (gc_debug_file, "Largebitmap descriptor %p, size: %zd, last set: %d\n", (void*)desc, stored_size, last_set));
+ SGEN_LOG (6, "Largebitmap descriptor %p, size: %zd, last set: %d", (void*)desc, stored_size, last_set);
return (void*) desc;
}
/* it's a complex object ... */
/*
+ * sgen-descriptor.h: GC descriptors describe object layout.
+
* Copyright 2001-2003 Ximian, Inc
* Copyright 2003-2010 Novell, Inc.
* Copyright 2011 Xamarin Inc (http://www.xamarin.com)
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __MONO_SGEN_DESCRIPTOR_H__
#define __MONO_SGEN_DESCRIPTOR_H__
void **_objptr = (void**)(obj); \
_objptr += ((desc) >> 16) & 0xff; \
_objptr_end = _objptr + (((desc) >> 24) & 0xff); \
+ HANDLE_PTR (_objptr, (obj)); \
+ _objptr ++; \
while (_objptr < _objptr_end) { \
HANDLE_PTR (_objptr, (obj)); \
_objptr++; \
} \
} while (0)
+#ifdef __GNUC__
#define OBJ_BITMAP_FOREACH_PTR(desc,obj) do { \
/* there are pointers */ \
void **_objptr = (void**)(obj); \
gsize _bmap = (desc) >> 16; \
_objptr += OBJECT_HEADER_WORDS; \
+ { \
+ int _index = __builtin_ctz (_bmap); \
+ _objptr += _index; \
+ _bmap >>= (_index + 1); \
+ HANDLE_PTR (_objptr, (obj)); \
+ _objptr ++; \
+ } \
while (_bmap) { \
- if ((_bmap & 1)) { \
- HANDLE_PTR (_objptr, (obj)); \
- } \
- _bmap >>= 1; \
- ++_objptr; \
- } \
+ int _index = __builtin_ctz (_bmap); \
+ _objptr += _index; \
+ _bmap >>= (_index + 1); \
+ HANDLE_PTR (_objptr, (obj)); \
+ _objptr ++; \
+ } \
+ } while (0)
+#else
+#define OBJ_BITMAP_FOREACH_PTR(desc,obj) do { \
+ /* there are pointers */ \
+ void **_objptr = (void**)(obj); \
+ gsize _bmap = (desc) >> 16; \
+ _objptr += OBJECT_HEADER_WORDS; \
+ while (_bmap) { \
+ if ((_bmap & 1)) { \
+ HANDLE_PTR (_objptr, (obj)); \
+ } \
+ _bmap >>= 1; \
+ ++_objptr; \
+ } \
} while (0)
+#endif
/* a bitmap desc means that there are pointer references or we'd have
* choosen run-length, instead: add an assert to check.
/*
- * sgen-fin-weak-hash.c:
+ * sgen-fin-weak-hash.c: Finalizers and weak links.
*
* Author:
* Paolo Molaro (lupus@ximian.com)
* Copyright 2005-2011 Novell, Inc (http://www.novell.com)
* Copyright 2011 Xamarin Inc (http://www.xamarin.com)
* Copyright 2011 Xamarin, Inc.
+ * Copyright (C) 2012 Xamarin Inc
*
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "config.h"
/* insert it into the major hash */
sgen_hash_table_replace (&major_finalizable_hash, tagged_object_apply (copy, tag), NULL, NULL);
- DEBUG (5, fprintf (gc_debug_file, "Promoting finalization of object %p (%s) (was at %p) to major table\n", copy, sgen_safe_name (copy), object));
+ SGEN_LOG (5, "Promoting finalization of object %p (%s) (was at %p) to major table", copy, sgen_safe_name (copy), object);
continue;
} else {
/* update pointer */
- DEBUG (5, fprintf (gc_debug_file, "Updating object for finalization: %p (%s) (was at %p)\n", copy, sgen_safe_name (copy), object));
+ SGEN_LOG (5, "Updating object for finalization: %p (%s) (was at %p)", copy, sgen_safe_name (copy), object);
SGEN_HASH_TABLE_FOREACH_SET_KEY (tagged_object_apply (copy, tag));
}
} SGEN_HASH_TABLE_FOREACH_END;
num_ready_finalizers++;
sgen_queue_finalization_entry (copy);
/* Make it survive */
- DEBUG (5, fprintf (gc_debug_file, "Queueing object for finalization: %p (%s) (was at %p) (%d/%d)\n", copy, sgen_safe_name (copy), object, num_ready_finalizers, sgen_hash_table_num_entries (hash_table)));
+ SGEN_LOG (5, "Queueing object for finalization: %p (%s) (was at %p) (%d/%d)", copy, sgen_safe_name (copy), object, num_ready_finalizers, sgen_hash_table_num_entries (hash_table));
continue;
} else {
if (hash_table == &minor_finalizable_hash && !ptr_in_nursery (copy)) {
/* insert it into the major hash */
sgen_hash_table_replace (&major_finalizable_hash, tagged_object_apply (copy, tag), NULL, NULL);
- DEBUG (5, fprintf (gc_debug_file, "Promoting finalization of object %p (%s) (was at %p) to major table\n", copy, sgen_safe_name (copy), object));
+ SGEN_LOG (5, "Promoting finalization of object %p (%s) (was at %p) to major table", copy, sgen_safe_name (copy), object);
continue;
} else {
/* update pointer */
- DEBUG (5, fprintf (gc_debug_file, "Updating object for finalization: %p (%s) (was at %p)\n", copy, sgen_safe_name (copy), object));
+ SGEN_LOG (5, "Updating object for finalization: %p (%s) (was at %p)", copy, sgen_safe_name (copy), object);
SGEN_HASH_TABLE_FOREACH_SET_KEY (tagged_object_apply (copy, tag));
}
}
if (user_data) {
if (sgen_hash_table_replace (hash_table, obj, NULL, NULL))
- DEBUG (5, fprintf (gc_debug_file, "Added finalizer for object: %p (%s) (%d) to %s table\n", obj, obj->vtable->klass->name, hash_table->num_entries, sgen_generation_name (generation)));
+ SGEN_LOG (5, "Added finalizer for object: %p (%s) (%d) to %s table", obj, obj->vtable->klass->name, hash_table->num_entries, sgen_generation_name (generation));
} else {
if (sgen_hash_table_remove (hash_table, obj, NULL))
- DEBUG (5, fprintf (gc_debug_file, "Removed finalizer for object: %p (%s) (%d)\n", obj, obj->vtable->klass->name, hash_table->num_entries));
+ SGEN_LOG (5, "Removed finalizer for object: %p (%s) (%d)", obj, obj->vtable->klass->name, hash_table->num_entries);
}
}
/* remove and put in out_array */
SGEN_HASH_TABLE_FOREACH_REMOVE (TRUE);
out_array [count ++] = object;
- DEBUG (5, fprintf (gc_debug_file, "Collecting object for finalization: %p (%s) (%d/%d)\n", object, sgen_safe_name (object), num_ready_finalizers, sgen_hash_table_num_entries (hash_table)));
+ SGEN_LOG (5, "Collecting object for finalization: %p (%s) (%d/%d)", object, sgen_safe_name (object), num_ready_finalizers, sgen_hash_table_num_entries (hash_table));
if (count == out_size)
return count;
continue;
if (!obj) {
if (sgen_hash_table_remove (hash_table, link, NULL)) {
- DEBUG (5, fprintf (gc_debug_file, "Removed dislink %p (%d) from %s table\n",
- link, hash_table->num_entries, sgen_generation_name (generation)));
+ SGEN_LOG (5, "Removed dislink %p (%d) from %s table",
+ link, hash_table->num_entries, sgen_generation_name (generation));
}
return;
}
sgen_hash_table_replace (hash_table, link, NULL, NULL);
- DEBUG (5, fprintf (gc_debug_file, "Added dislink for object: %p (%s) at %p to %s table\n",
- obj, obj->vtable->klass->name, link, sgen_generation_name (generation)));
+ SGEN_LOG (5, "Added dislink for object: %p (%s) at %p to %s table",
+ obj, obj->vtable->klass->name, link, sgen_generation_name (generation));
}
/* LOCKING: requires that the GC lock is held */
if (object >= start && object < end && !major_collector.is_object_live (object)) {
if (sgen_gc_is_object_ready_for_finalization (object)) {
*link = NULL;
- DEBUG (5, fprintf (gc_debug_file, "Dislink nullified at %p to GCed object %p\n", link, object));
+ SGEN_LOG (5, "Dislink nullified at %p to GCed object %p", link, object);
SGEN_HASH_TABLE_FOREACH_REMOVE (TRUE);
continue;
} else {
*link = HIDE_POINTER (copy, track);
add_or_remove_disappearing_link ((MonoObject*)copy, link, GENERATION_OLD);
- DEBUG (5, fprintf (gc_debug_file, "Upgraded dislink at %p to major because object %p moved to %p\n", link, object, copy));
+ SGEN_LOG (5, "Upgraded dislink at %p to major because object %p moved to %p", link, object, copy);
continue;
} else {
*link = HIDE_POINTER (copy, track);
- DEBUG (5, fprintf (gc_debug_file, "Updated dislink at %p to %p\n", link, DISLINK_OBJECT (link)));
+ SGEN_LOG (5, "Updated dislink at %p to %p", link, DISLINK_OBJECT (link));
}
}
}
* This can happen if finalizers are not ran, i.e. Environment.Exit ()
* is called from finalizer like in finalizer-abort.cs.
*/
- DEBUG (5, fprintf (gc_debug_file, "Disappearing link %p not freed", link));
+ SGEN_LOG (5, "Disappearing link %p not freed", link);
}
SGEN_HASH_TABLE_FOREACH_REMOVE (free);
void **link;
gpointer dummy;
SgenHashTable *hash = get_dislink_hash_table (generation);
- fprintf (stderr, "**** nulling links with predicate\n");
SGEN_HASH_TABLE_FOREACH (hash, link, dummy) {
char *object = DISLINK_OBJECT (link);
mono_bool is_alive = predicate ((MonoObject*)object, data);
- if (is_alive)
- fprintf (stderr, "ALIVE %p %s\n", object, sgen_safe_name (object));
- else
- fprintf (stderr, "DEAD %p %s\n", object, sgen_safe_name (object));
-
if (!is_alive) {
*link = NULL;
- DEBUG (5, fprintf (gc_debug_file, "Dislink nullified by predicate at %p to GCed object %p\n", link, object));
+ SGEN_LOG (5, "Dislink nullified by predicate at %p to GCed object %p", link, object);
SGEN_HASH_TABLE_FOREACH_REMOVE (TRUE);
continue;
}
object = tagged_object_get_object (object);
if (mono_object_domain (object) == domain) {
- DEBUG (5, fprintf (gc_debug_file, "Unregistering finalizer for object: %p (%s)\n", object, sgen_safe_name (object)));
+ SGEN_LOG (5, "Unregistering finalizer for object: %p (%s)", object, sgen_safe_name (object));
SGEN_HASH_TABLE_FOREACH_REMOVE (TRUE);
continue;
* Copyright (c) 1996 by Silicon Graphics. All rights reserved.
* Copyright (c) 1998 by Fergus Henderson. All rights reserved.
* Copyright (c) 2000-2004 by Hewlett-Packard Company. All rights reserved.
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program
- * for any purpose, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- *
* Copyright 2001-2003 Ximian, Inc
* Copyright 2003-2010 Novell, Inc.
* Copyright 2011 Xamarin, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * Copyright (C) 2012 Xamarin Inc
*
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Important: allocation provides always zeroed memory, having to do
* a memset after allocation is deadly for performance.
MonoNativeTlsKey thread_info_key;
#ifdef HAVE_KW_THREAD
-__thread SgenThreadInfo *thread_info;
+__thread SgenThreadInfo *sgen_thread_info;
__thread gpointer *store_remset_buffer;
__thread long store_remset_buffer_index;
__thread char *stack_end;
need_remove_object_for_domain (char *start, MonoDomain *domain)
{
if (mono_object_domain (start) == domain) {
- DEBUG (4, fprintf (gc_debug_file, "Need to cleanup object %p\n", start));
+ SGEN_LOG (4, "Need to cleanup object %p", start);
binary_protocol_cleanup (start, (gpointer)LOAD_VTABLE (start), safe_object_get_size ((MonoObject*)start));
return TRUE;
}
/* The server could already have been zeroed out, so
we need to check for that, too. */
if (server && (!LOAD_VTABLE (server) || mono_object_domain (server) == domain)) {
- DEBUG (4, fprintf (gc_debug_file, "Cleaning up remote pointer in %p to object %p\n",
- start, server));
+ SGEN_LOG (4, "Cleaning up remote pointer in %p to object %p", start, server);
((MonoRealProxy*)start)->unwrapped_server = NULL;
}
}
else
los_object_list = bigobj->next;
bigobj = bigobj->next;
- DEBUG (4, fprintf (gc_debug_file, "Freeing large object %p\n",
- bigobj->data));
+ SGEN_LOG (4, "Freeing large object %p", bigobj->data);
sgen_los_free_object (to_free);
continue;
}
GRAY_OBJECT_DEQUEUE (queue, obj);
if (!obj)
return TRUE;
- DEBUG (9, fprintf (gc_debug_file, "Precise gray object scan %p (%s)\n", obj, safe_name (obj)));
+ SGEN_LOG (9, "Precise gray object scan %p (%s)", obj, safe_name (obj));
scan_func (obj, queue);
}
} else {
GRAY_OBJECT_DEQUEUE (queue, obj);
if (!obj)
return TRUE;
- DEBUG (9, fprintf (gc_debug_file, "Precise gray object scan %p (%s)\n", obj, safe_name (obj)));
+ SGEN_LOG (9, "Precise gray object scan %p (%s)", obj, safe_name (obj));
scan_func (obj, queue);
}
} while (max_objs < 0);
addr = *start;
/* the range check should be reduntant */
if (addr != last && addr >= start_nursery && addr < end_nursery) {
- DEBUG (5, fprintf (gc_debug_file, "Considering pinning addr %p\n", addr));
+ SGEN_LOG (5, "Considering pinning addr %p", addr);
/* multiple pointers to the same object */
if (addr >= last_obj && (char*)addr < (char*)last_obj + last_obj_size) {
start++;
if (((MonoObject*)last_obj)->synchronisation == GINT_TO_POINTER (-1)) {
/* Marks the beginning of a nursery fragment, skip */
} else {
- DEBUG (8, fprintf (gc_debug_file, "Pinned try match %p (%s), size %zd\n", last_obj, safe_name (last_obj), last_obj_size));
+ SGEN_LOG (8, "Pinned try match %p (%s), size %zd", last_obj, safe_name (last_obj), last_obj_size);
if (addr >= search_start && (char*)addr < (char*)last_obj + last_obj_size) {
- DEBUG (4, fprintf (gc_debug_file, "Pinned object %p, vtable %p (%s), count %d\n", search_start, *(void**)search_start, safe_name (search_start), count));
+ SGEN_LOG (4, "Pinned object %p, vtable %p (%s), count %d\n", search_start, *(void**)search_start, safe_name (search_start), count);
binary_protocol_pin (search_start, (gpointer)LOAD_VTABLE (search_start), safe_object_get_size (search_start));
if (G_UNLIKELY (MONO_GC_OBJ_PINNED_ENABLED ())) {
int gen = sgen_ptr_in_nursery (search_start) ? GENERATION_NURSERY : GENERATION_OLD;
conservatively_pin_objects_from (void **start, void **end, void *start_nursery, void *end_nursery, int pin_type)
{
int count = 0;
+
+#ifdef VALGRIND_MAKE_MEM_DEFINED_IF_ADDRESSABLE
+ VALGRIND_MAKE_MEM_DEFINED_IF_ADDRESSABLE (start, (char*)end - (char*)start);
+#endif
+
while (start < end) {
if (*start >= start_nursery && *start < end_nursery) {
/*
*/
mword addr = (mword)*start;
addr &= ~(ALLOC_ALIGN - 1);
- if (addr >= (mword)start_nursery && addr < (mword)end_nursery)
+ if (addr >= (mword)start_nursery && addr < (mword)end_nursery) {
+ SGEN_LOG (6, "Pinning address %p from %p", (void*)addr, start);
sgen_pin_stage_ptr ((void*)addr);
+ count++;
+ }
if (G_UNLIKELY (do_pin_stats)) {
if (ptr_in_nursery ((void*)addr))
sgen_pin_stats_register_address ((char*)addr, pin_type);
}
- DEBUG (6, if (count) fprintf (gc_debug_file, "Pinning address %p from %p\n", (void*)addr, start));
- count++;
}
start++;
}
- DEBUG (7, if (count) fprintf (gc_debug_file, "found %d potential pinned heap pointers\n", count));
+ if (count)
+ SGEN_LOG (7, "found %d potential pinned heap pointers", count);
}
/*
{
void **start_root;
RootRecord *root;
- DEBUG (2, fprintf (gc_debug_file, "Scanning pinned roots (%d bytes, %d/%d entries)\n", (int)roots_size, roots_hash [ROOT_TYPE_NORMAL].num_entries, roots_hash [ROOT_TYPE_PINNED].num_entries));
+ SGEN_LOG (2, "Scanning pinned roots (%d bytes, %d/%d entries)", (int)roots_size, roots_hash [ROOT_TYPE_NORMAL].num_entries, roots_hash [ROOT_TYPE_PINNED].num_entries);
/* objects pinned from the API are inside these roots */
SGEN_HASH_TABLE_FOREACH (&roots_hash [ROOT_TYPE_PINNED], start_root, root) {
- DEBUG (6, fprintf (gc_debug_file, "Pinned roots %p-%p\n", start_root, root->end_root));
+ SGEN_LOG (6, "Pinned roots %p-%p", start_root, root->end_root);
conservatively_pin_objects_from (start_root, (void**)root->end_root, start_nursery, end_nursery, PIN_TYPE_OTHER);
} SGEN_HASH_TABLE_FOREACH_END;
/* now deal with the thread stacks
while (desc) {
if ((desc & 1) && *start_root) {
copy_func (start_root, queue);
- DEBUG (9, fprintf (gc_debug_file, "Overwrote root at %p with %p\n", start_root, *start_root));
+ SGEN_LOG (9, "Overwrote root at %p with %p", start_root, *start_root);
sgen_drain_gray_stack (queue, -1);
}
desc >>= 1;
while (bmap) {
if ((bmap & 1) && *objptr) {
copy_func (objptr, queue);
- DEBUG (9, fprintf (gc_debug_file, "Overwrote root at %p with %p\n", objptr, *objptr));
+ SGEN_LOG (9, "Overwrote root at %p with %p", objptr, *objptr);
sgen_drain_gray_stack (queue, -1);
}
bmap >>= 1;
if (nursery_section)
return;
- DEBUG (2, fprintf (gc_debug_file, "Allocating nursery size: %lu\n", (unsigned long)sgen_nursery_size));
+ SGEN_LOG (2, "Allocating nursery size: %lu", (unsigned long)sgen_nursery_size);
/* later we will alloc a larger area for the nursery but only activate
* what we need. The rest will be used as expansion if we have too many pinned
* objects in the existing nursery.
data = major_collector.alloc_heap (alloc_size, 0, DEFAULT_NURSERY_BITS);
#endif
sgen_update_heap_boundaries ((mword)data, (mword)(data + sgen_nursery_size));
- DEBUG (4, fprintf (gc_debug_file, "Expanding nursery size (%p-%p): %lu, total: %lu\n", data, data + alloc_size, (unsigned long)sgen_nursery_size, (unsigned long)mono_gc_get_heap_size ()));
+ SGEN_LOG (4, "Expanding nursery size (%p-%p): %lu, total: %lu", data, data + alloc_size, (unsigned long)sgen_nursery_size, (unsigned long)mono_gc_get_heap_size ());
section->data = section->next_data = data;
section->size = alloc_size;
section->end_data = data + sgen_nursery_size;
FILE *
mono_gc_get_logfile (void)
{
- return sgen_get_logfile ();
+ return gc_debug_file;
}
static void
RootRecord *root;
report.count = 0;
SGEN_HASH_TABLE_FOREACH (&roots_hash [root_type], start_root, root) {
- DEBUG (6, fprintf (gc_debug_file, "Precise root scan %p-%p (desc: %p)\n", start_root, root->end_root, (void*)root->root_desc));
+ SGEN_LOG (6, "Precise root scan %p-%p (desc: %p)", start_root, root->end_root, (void*)root->root_desc);
precisely_report_roots_from (&report, start_root, (void**)root->end_root, root->root_desc);
} SGEN_HASH_TABLE_FOREACH_END;
notify_gc_roots (&report);
for (fin = list; fin; fin = fin->next) {
if (!fin->object)
continue;
- DEBUG (5, fprintf (gc_debug_file, "Scan of fin ready object: %p (%s)\n", fin->object, safe_name (fin->object)));
+ SGEN_LOG (5, "Scan of fin ready object: %p (%s)\n", fin->object, safe_name (fin->object));
copy_func (&fin->object, queue);
}
}
*/
sgen_drain_gray_stack (queue, -1);
TV_GETTIME (atv);
- DEBUG (2, fprintf (gc_debug_file, "%s generation done\n", generation_name (generation)));
+ SGEN_LOG (2, "%s generation done", generation_name (generation));
/*
Reset bridge data, we might have lingering data from a previous collection if this is a major
if (generation == GENERATION_OLD)
sgen_finalize_in_range (copy_func, sgen_get_nursery_start (), sgen_get_nursery_end (), GENERATION_NURSERY, queue);
/* drain the new stack that might have been created */
- DEBUG (6, fprintf (gc_debug_file, "Precise scan of gray area post fin\n"));
+ SGEN_LOG (6, "Precise scan of gray area post fin");
sgen_drain_gray_stack (queue, -1);
/*
clear_unreachable_ephemerons (copy_func, start_addr, end_addr, queue);
TV_GETTIME (btv);
- DEBUG (2, fprintf (gc_debug_file, "Finalize queue handling scan for %s generation: %d usecs %d ephemeron roundss\n", generation_name (generation), TV_ELAPSED (atv, btv), ephemeron_rounds));
+ SGEN_LOG (2, "Finalize queue handling scan for %s generation: %d usecs %d ephemeron rounds", generation_name (generation), TV_ELAPSED (atv, btv), ephemeron_rounds);
/*
* handle disappearing links
void **start_root;
RootRecord *root;
SGEN_HASH_TABLE_FOREACH (&roots_hash [root_type], start_root, root) {
- DEBUG (6, fprintf (gc_debug_file, "Precise root scan %p-%p (desc: %p)\n", start_root, root->end_root, (void*)root->root_desc));
+ SGEN_LOG (6, "Precise root scan %p-%p (desc: %p)", start_root, root->end_root, (void*)root->root_desc);
precisely_scan_objects_from (copy_func, start_root, (void**)root->end_root, addr_start, addr_end, root->root_desc, queue);
} SGEN_HASH_TABLE_FOREACH_END;
}
for (i = 0; i < nursery_section->num_scan_start; ++i) {
char *addr = nursery_section->scan_starts [i];
if (addr > start && addr < end)
- fprintf (gc_debug_file, "NFC-BAD SCAN START [%d] %p for obj [%p %p]\n", i, addr, start, end);
+ SGEN_LOG (1, "NFC-BAD SCAN START [%d] %p for obj [%p %p]", i, addr, start, end);
}
}
}
if (object_is_forwarded (cur))
- fprintf (gc_debug_file, "FORWARDED OBJ %p\n", cur);
+ SGEN_LOG (1, "FORWARDED OBJ %p", cur);
else if (object_is_pinned (cur))
- fprintf (gc_debug_file, "PINNED OBJ %p\n", cur);
+ SGEN_LOG (1, "PINNED OBJ %p", cur);
ss = safe_object_get_size ((MonoObject*)cur);
size = ALIGN_UP (safe_object_get_size ((MonoObject*)cur));
verify_scan_starts (cur, cur + size);
if (do_dump_nursery_content) {
if (cur > hole_start)
- fprintf (gc_debug_file, "HOLE [%p %p %d]\n", hole_start, cur, (int)(cur - hole_start));
- fprintf (gc_debug_file, "OBJ [%p %p %d %d %s %d]\n", cur, cur + size, (int)size, (int)ss, sgen_safe_name ((MonoObject*)cur), (gpointer)LOAD_VTABLE (cur) == sgen_get_array_fill_vtable ());
+ SGEN_LOG (1, "HOLE [%p %p %d]", hole_start, cur, (int)(cur - hole_start));
+ SGEN_LOG (1, "OBJ [%p %p %d %d %s %d]", cur, cur + size, (int)size, (int)ss, sgen_safe_name ((MonoObject*)cur), (gpointer)LOAD_VTABLE (cur) == sgen_get_array_fill_vtable ());
}
cur += size;
hole_start = cur;
}
- fflush (gc_debug_file);
}
/*
verify_nursery ();
+#ifndef DISABLE_PERFCOUNTERS
mono_perfcounters->gc_collections0++;
+#endif
current_collection_generation = GENERATION_NURSERY;
if (sgen_collection_is_parallel ())
/* FIXME: optimize later to use the higher address where an object can be present */
nursery_next = MAX (nursery_next, sgen_get_nursery_end ());
- DEBUG (1, fprintf (gc_debug_file, "Start nursery collection %d %p-%p, size: %d\n", stat_minor_gcs, sgen_get_nursery_start (), nursery_next, (int)(nursery_next - sgen_get_nursery_start ())));
+ SGEN_LOG (1, "Start nursery collection %d %p-%p, size: %d", stat_minor_gcs, sgen_get_nursery_start (), nursery_next, (int)(nursery_next - sgen_get_nursery_start ()));
max_garbage_amount = nursery_next - sgen_get_nursery_start ();
g_assert (nursery_section->size >= max_garbage_amount);
TV_GETTIME (atv);
time_minor_pinning += TV_ELAPSED (btv, atv);
- DEBUG (2, fprintf (gc_debug_file, "Finding pinned pointers: %d in %d usecs\n", sgen_get_pinned_count (), TV_ELAPSED (btv, atv)));
- DEBUG (4, fprintf (gc_debug_file, "Start scan with %d pinned objects\n", sgen_get_pinned_count ()));
+ SGEN_LOG (2, "Finding pinned pointers: %d in %d usecs", sgen_get_pinned_count (), TV_ELAPSED (btv, atv));
+ SGEN_LOG (4, "Start scan with %d pinned objects", sgen_get_pinned_count ());
if (whole_heap_check_before_collection)
sgen_check_whole_heap ();
/* we don't have complete write barrier yet, so we scan all the old generation sections */
TV_GETTIME (btv);
time_minor_scan_remsets += TV_ELAPSED (atv, btv);
- DEBUG (2, fprintf (gc_debug_file, "Old generation scan: %d usecs\n", TV_ELAPSED (atv, btv)));
+ SGEN_LOG (2, "Old generation scan: %d usecs", TV_ELAPSED (atv, btv));
if (!sgen_collection_is_parallel ())
sgen_drain_gray_stack (&gray_queue, -1);
mono_profiler_gc_event (MONO_GC_EVENT_RECLAIM_END, 0);
TV_GETTIME (btv);
time_minor_fragment_creation += TV_ELAPSED (atv, btv);
- DEBUG (2, fprintf (gc_debug_file, "Fragment creation: %d usecs, %lu bytes available\n", TV_ELAPSED (atv, btv), (unsigned long)fragment_total));
+ SGEN_LOG (2, "Fragment creation: %d usecs, %lu bytes available", TV_ELAPSED (atv, btv), (unsigned long)fragment_total);
if (consistency_check_at_minor_collection)
sgen_check_major_refs ();
/* prepare the pin queue for the next collection */
sgen_finish_pinning ();
if (fin_ready_list || critical_fin_list) {
- DEBUG (4, fprintf (gc_debug_file, "Finalizer-thread wakeup: ready %d\n", num_ready_finalizers));
+ SGEN_LOG (4, "Finalizer-thread wakeup: ready %d", num_ready_finalizers);
mono_gc_finalize_notify ();
}
sgen_pin_stats_reset ();
MONO_GC_BEGIN (GENERATION_OLD);
current_collection_generation = GENERATION_OLD;
+#ifndef DISABLE_PERFCOUNTERS
mono_perfcounters->gc_collections1++;
+#endif
current_object_ops = major_collector.major_ops;
sgen_nursery_alloc_prepare_for_major ();
degraded_mode = 0;
- DEBUG (1, fprintf (gc_debug_file, "Start major collection %d\n", stat_major_gcs));
+ SGEN_LOG (1, "Start major collection %d", stat_major_gcs);
stat_major_gcs++;
gc_stats.major_gc_count ++;
TV_GETTIME (atv);
sgen_init_pinning ();
- DEBUG (6, fprintf (gc_debug_file, "Collecting pinned addresses\n"));
+ SGEN_LOG (6, "Collecting pinned addresses");
pin_from_roots ((void*)lowest_heap_address, (void*)highest_heap_address, WORKERS_DISTRIBUTE_GRAY_QUEUE);
sgen_optimize_pin_queue (0);
* The second, destructive, pass is to reduce the section
* areas to pointers to the actually pinned objects.
*/
- DEBUG (6, fprintf (gc_debug_file, "Pinning from sections\n"));
+ SGEN_LOG (6, "Pinning from sections");
/* first pass for the sections */
sgen_find_section_pin_queue_start_end (nursery_section);
major_collector.find_pin_queue_start_ends (WORKERS_DISTRIBUTE_GRAY_QUEUE);
/* identify possible pointers to the insize of large objects */
- DEBUG (6, fprintf (gc_debug_file, "Pinning from large objects\n"));
+ SGEN_LOG (6, "Pinning from large objects");
for (bigobj = los_object_list; bigobj; bigobj = bigobj->next) {
int dummy;
gboolean profile_roots = mono_profiler_get_events () & MONO_PROFILE_GC_ROOTS;
GRAY_OBJECT_ENQUEUE (WORKERS_DISTRIBUTE_GRAY_QUEUE, bigobj->data);
if (G_UNLIKELY (do_pin_stats))
sgen_pin_stats_register_object ((char*) bigobj->data, safe_object_get_size ((MonoObject*) bigobj->data));
- DEBUG (6, fprintf (gc_debug_file, "Marked large object %p (%s) size: %lu from roots\n", bigobj->data, safe_name (bigobj->data), (unsigned long)bigobj->size));
+ SGEN_LOG (6, "Marked large object %p (%s) size: %lu from roots", bigobj->data, safe_name (bigobj->data), (unsigned long)bigobj->size);
if (profile_roots)
add_profile_gc_root (&report, bigobj->data, MONO_PROFILE_GC_ROOT_PINNING | MONO_PROFILE_GC_ROOT_MISC, 0);
TV_GETTIME (btv);
time_major_pinning += TV_ELAPSED (atv, btv);
- DEBUG (2, fprintf (gc_debug_file, "Finding pinned pointers: %d in %d usecs\n", sgen_get_pinned_count (), TV_ELAPSED (atv, btv)));
- DEBUG (4, fprintf (gc_debug_file, "Start scan with %d pinned objects\n", sgen_get_pinned_count ()));
+ SGEN_LOG (2, "Finding pinned pointers: %d in %d usecs", sgen_get_pinned_count (), TV_ELAPSED (atv, btv));
+ SGEN_LOG (4, "Start scan with %d pinned objects", sgen_get_pinned_count ());
major_collector.init_to_space ();
TV_GETTIME (atv);
time_major_scan_finalized += TV_ELAPSED (btv, atv);
- DEBUG (2, fprintf (gc_debug_file, "Root scan: %d usecs\n", TV_ELAPSED (btv, atv)));
+ SGEN_LOG (2, "Root scan: %d usecs", TV_ELAPSED (btv, atv));
TV_GETTIME (btv);
time_major_scan_big_objects += TV_ELAPSED (atv, btv);
sgen_finish_pinning ();
if (fin_ready_list || critical_fin_list) {
- DEBUG (4, fprintf (gc_debug_file, "Finalizer-thread wakeup: ready %d\n", num_ready_finalizers));
+ SGEN_LOG (4, "Finalizer-thread wakeup: ready %d", num_ready_finalizers);
mono_gc_finalize_notify ();
}
sgen_pin_stats_reset ();
mono_profiler_gc_event (MONO_GC_EVENT_END, overflow_generation_to_collect);
}
- DEBUG (2, fprintf (gc_debug_file, "Heap size: %lu, LOS size: %lu\n", (unsigned long)mono_gc_get_heap_size (), (unsigned long)los_memory_usage));
+ SGEN_LOG (2, "Heap size: %lu, LOS size: %lu", (unsigned long)mono_gc_get_heap_size (), (unsigned long)los_memory_usage);
/* this also sets the proper pointers for the next allocation */
if (generation_to_collect == GENERATION_NURSERY && !sgen_can_alloc_size (requested_size)) {
/* TypeBuilder and MonoMethod are killing mcs with fragmentation */
- DEBUG (1, fprintf (gc_debug_file, "nursery collection didn't find enough room for %zd alloc (%d pinned)\n", requested_size, sgen_get_pinned_count ()));
+ SGEN_LOG (1, "nursery collection didn't find enough room for %zd alloc (%d pinned)", requested_size, sgen_get_pinned_count ());
sgen_dump_pin_queue ();
degraded_mode = 1;
}
if (!object_is_reachable (object, start, end)) {
EphemeronLinkNode *tmp = current;
- DEBUG (5, fprintf (gc_debug_file, "Dead Ephemeron array at %p\n", object));
+ SGEN_LOG (5, "Dead Ephemeron array at %p", object);
if (prev)
prev->next = current->next;
/*The array was promoted, add global remsets for key/values left behind in nursery.*/
was_promoted = was_in_nursery && !ptr_in_nursery (object);
- DEBUG (5, fprintf (gc_debug_file, "Clearing unreachable entries for ephemeron array at %p\n", object));
+ SGEN_LOG (5, "Clearing unreachable entries for ephemeron array at %p", object);
array = (MonoArray*)object;
cur = mono_array_addr (array, Ephemeron, 0);
if (!key || key == tombstone)
continue;
- DEBUG (5, fprintf (gc_debug_file, "[%td] key %p (%s) value %p (%s)\n", cur - mono_array_addr (array, Ephemeron, 0),
+ SGEN_LOG (5, "[%td] key %p (%s) value %p (%s)", cur - mono_array_addr (array, Ephemeron, 0),
key, object_is_reachable (key, start, end) ? "reachable" : "unreachable",
- cur->value, cur->value && object_is_reachable (cur->value, start, end) ? "reachable" : "unreachable"));
+ cur->value, cur->value && object_is_reachable (cur->value, start, end) ? "reachable" : "unreachable");
if (!object_is_reachable (key, start, end)) {
cur->key = tombstone;
if (was_promoted) {
if (ptr_in_nursery (key)) {/*key was not promoted*/
- DEBUG (5, fprintf (gc_debug_file, "\tAdded remset to key %p\n", key));
+ SGEN_LOG (5, "\tAdded remset to key %p", key);
sgen_add_to_global_remset (&cur->key);
}
if (ptr_in_nursery (cur->value)) {/*value was not promoted*/
- DEBUG (5, fprintf (gc_debug_file, "\tAdded remset to value %p\n", cur->value));
+ SGEN_LOG (5, "\tAdded remset to value %p", cur->value);
sgen_add_to_global_remset (&cur->value);
}
}
for (current = ephemeron_list; current; current = current->next) {
char *object = current->array;
- DEBUG (5, fprintf (gc_debug_file, "Ephemeron array at %p\n", object));
+ SGEN_LOG (5, "Ephemeron array at %p", object);
/*
For now we process all ephemerons during all collections.
/*It has to be alive*/
if (!object_is_reachable (object, start, end)) {
- DEBUG (5, fprintf (gc_debug_file, "\tnot reachable\n"));
+ SGEN_LOG (5, "\tnot reachable");
continue;
}
if (!key || key == tombstone)
continue;
- DEBUG (5, fprintf (gc_debug_file, "[%td] key %p (%s) value %p (%s)\n", cur - mono_array_addr (array, Ephemeron, 0),
+ SGEN_LOG (5, "[%td] key %p (%s) value %p (%s)", cur - mono_array_addr (array, Ephemeron, 0),
key, object_is_reachable (key, start, end) ? "reachable" : "unreachable",
- cur->value, cur->value && object_is_reachable (cur->value, start, end) ? "reachable" : "unreachable"));
+ cur->value, cur->value && object_is_reachable (cur->value, start, end) ? "reachable" : "unreachable");
if (object_is_reachable (key, start, end)) {
char *value = cur->value;
}
}
- DEBUG (5, fprintf (gc_debug_file, "Ephemeron run finished. Is it done %d\n", nothing_marked));
+ SGEN_LOG (5, "Ephemeron run finished. Is it done %d", nothing_marked);
return nothing_marked;
}
num_ready_finalizers--;
obj = entry->object;
entry->object = NULL;
- DEBUG (7, fprintf (gc_debug_file, "Finalizing object %p (%s)\n", obj, safe_name (obj)));
+ SGEN_LOG (7, "Finalizing object %p (%s)", obj, safe_name (obj));
}
UNLOCK_GC;
sgen_hash_table_replace (&roots_hash [root_type], start, &new_root, NULL);
roots_size += size;
- DEBUG (3, fprintf (gc_debug_file, "Added root for range: %p-%p, descr: %p (%d/%d bytes)\n", start, new_root.end_root, descr, (int)size, (int)roots_size));
+ SGEN_LOG (3, "Added root for range: %p-%p, descr: %p (%d/%d bytes)", start, new_root.end_root, descr, (int)size, (int)roots_size);
UNLOCK_GC;
return TRUE;
FOREACH_THREAD (info) {
if (info->skip) {
- DEBUG (3, fprintf (gc_debug_file, "Skipping dead thread %p, range: %p-%p, size: %td\n", info, info->stack_start, info->stack_end, (char*)info->stack_end - (char*)info->stack_start));
+ SGEN_LOG (3, "Skipping dead thread %p, range: %p-%p, size: %td", info, info->stack_start, info->stack_end, (char*)info->stack_end - (char*)info->stack_start);
continue;
}
if (info->gc_disabled) {
- DEBUG (3, fprintf (gc_debug_file, "GC disabled for thread %p, range: %p-%p, size: %td\n", info, info->stack_start, info->stack_end, (char*)info->stack_end - (char*)info->stack_start));
+ SGEN_LOG (3, "GC disabled for thread %p, range: %p-%p, size: %td", info, info->stack_start, info->stack_end, (char*)info->stack_end - (char*)info->stack_start);
continue;
}
if (!info->joined_stw) {
- DEBUG (3, fprintf (gc_debug_file, "Skipping thread not seen in STW %p, range: %p-%p, size: %td\n", info, info->stack_start, info->stack_end, (char*)info->stack_end - (char*)info->stack_start));
+ SGEN_LOG (3, "Skipping thread not seen in STW %p, range: %p-%p, size: %td", info, info->stack_start, info->stack_end, (char*)info->stack_end - (char*)info->stack_start);
continue;
}
- DEBUG (3, fprintf (gc_debug_file, "Scanning thread %p, range: %p-%p, size: %td, pinned=%d\n", info, info->stack_start, info->stack_end, (char*)info->stack_end - (char*)info->stack_start, sgen_get_pinned_count ()));
+ SGEN_LOG (3, "Scanning thread %p, range: %p-%p, size: %td, pinned=%d", info, info->stack_start, info->stack_end, (char*)info->stack_end - (char*)info->stack_start, sgen_get_pinned_count ());
if (!info->thread_is_dying) {
if (gc_callbacks.thread_mark_func && !conservative_stack_mark) {
UserCopyOrMarkData data = { NULL, queue };
g_assert (!mono_native_tls_get_value (thread_info_key));
mono_native_tls_set_value (thread_info_key, info);
#else
- thread_info = info;
+ sgen_thread_info = info;
#endif
#if !defined(__MACH__)
if (remset.register_thread)
remset.register_thread (info);
- DEBUG (3, fprintf (gc_debug_file, "registered thread %p (%p) stack end %p\n", info, (gpointer)mono_thread_info_get_tid (info), info->stack_end));
+ SGEN_LOG (3, "registered thread %p (%p) stack end %p", info, (gpointer)mono_thread_info_get_tid (info), info->stack_end);
if (gc_callbacks.thread_attach_func)
info->runtime_data = gc_callbacks.thread_attach_func ();
#endif
binary_protocol_thread_unregister ((gpointer)mono_thread_info_get_tid (p));
- DEBUG (3, fprintf (gc_debug_file, "unregister thread %p (%p)\n", p, (gpointer)mono_thread_info_get_tid (p)));
+ SGEN_LOG (3, "unregister thread %p (%p)", p, (gpointer)mono_thread_info_get_tid (p));
if (gc_callbacks.thread_detach_func) {
gc_callbacks.thread_detach_func (p->runtime_data);
*(void**)field_ptr = value;
return;
}
- DEBUG (8, fprintf (gc_debug_file, "Adding remset at %p\n", field_ptr));
+ SGEN_LOG (8, "Adding remset at %p", field_ptr);
if (value)
binary_protocol_wbarrier (field_ptr, value, value->vtable);
*(void**)slot_ptr = value;
return;
}
- DEBUG (8, fprintf (gc_debug_file, "Adding remset at %p\n", slot_ptr));
+ SGEN_LOG (8, "Adding remset at %p", slot_ptr);
if (value)
binary_protocol_wbarrier (slot_ptr, value, value->vtable);
binary_protocol_wbarrier (ptr, *(gpointer*)ptr, (gpointer)LOAD_VTABLE (*(gpointer*)ptr));
if (ptr_in_nursery (ptr) || ptr_on_stack (ptr) || !ptr_in_nursery (*(gpointer*)ptr)) {
- DEBUG (8, fprintf (gc_debug_file, "Skipping remset at %p\n", ptr));
+ SGEN_LOG (8, "Skipping remset at %p", ptr);
return;
}
- DEBUG (8, fprintf (gc_debug_file, "Adding remset at %p\n", ptr));
+ SGEN_LOG (8, "Adding remset at %p", ptr);
remset.wbarrier_generic_nostore (ptr);
}
void
mono_gc_wbarrier_generic_store (gpointer ptr, MonoObject* value)
{
- DEBUG (8, fprintf (gc_debug_file, "Wbarrier store at %p to %p (%s)\n", ptr, value, value ? safe_name (value) : "null"));
+ SGEN_LOG (8, "Wbarrier store at %p to %p (%s)", ptr, value, value ? safe_name (value) : "null");
*(void**)ptr = value;
if (ptr_in_nursery (value))
mono_gc_wbarrier_generic_nostore (ptr);
HEAVY_STAT (++stat_wbarrier_value_copy);
g_assert (klass->valuetype);
- DEBUG (8, fprintf (gc_debug_file, "Adding value remset at %p, count %d, descr %p for class %s (%p)\n", dest, count, klass->gc_descr, klass->name, klass));
+ SGEN_LOG (8, "Adding value remset at %p, count %d, descr %p for class %s (%p)", dest, count, klass->gc_descr, klass->name, klass);
if (ptr_in_nursery (dest) || ptr_on_stack (dest) || !SGEN_CLASS_HAS_REFERENCES (klass)) {
size_t element_size = mono_class_value_size (klass, NULL);
node->next = ephemeron_list;
ephemeron_list = node;
- DEBUG (5, fprintf (gc_debug_file, "Registered ephemeron array %p\n", obj));
+ SGEN_LOG (5, "Registered ephemeron array %p", obj);
UNLOCK_GC;
return TRUE;
fprintf (stderr, " max-heap-size=N (where N is an integer, possibly with a k, m or a g suffix)\n");
fprintf (stderr, " soft-heap-limit=n (where N is an integer, possibly with a k, m or a g suffix)\n");
fprintf (stderr, " nursery-size=N (where N is an integer, possibly with a k, m or a g suffix)\n");
- fprintf (stderr, " major=COLLECTOR (where COLLECTOR is `marksweep', `marksweep-par' or `copying')\n");
+ fprintf (stderr, " major=COLLECTOR (where COLLECTOR is `marksweep', `marksweep-par', 'marksweep-fixed', 'marksweep-fixed-par' or `copying')\n");
fprintf (stderr, " minor=COLLECTOR (where COLLECTOR is `simple' or `split')\n");
fprintf (stderr, " wbarrier=WBARRIER (where WBARRIER is `remset' or `cardtable')\n");
fprintf (stderr, " stack-mark=MARK-METHOD (where MARK-METHOD is 'precise' or 'conservative')\n");
return FALSE;
}
-void
-sgen_debug_printf (int level, const char *format, ...)
-{
- va_list ap;
-
- if (level > gc_debug_level)
- return;
-
- va_start (ap, format);
- vfprintf (gc_debug_file, format, ap);
- va_end (ap);
-}
-
-FILE*
-sgen_get_logfile (void)
-{
- return gc_debug_file;
-}
-
#ifdef HOST_WIN32
BOOL APIENTRY mono_gc_dllmain (HMODULE module_handle, DWORD reason, LPVOID reserved)
{
/*
+ * sgen-gc.c: Simple generational GC.
+ *
* Copyright 2001-2003 Ximian, Inc
* Copyright 2003-2010 Novell, Inc.
* Copyright 2011 Xamarin Inc (http://www.xamarin.com)
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __MONO_SGENGC_H__
#define __MONO_SGENGC_H__
#include <mono/utils/mono-compiler.h>
#include <mono/utils/mono-threads.h>
#include <mono/utils/dtrace.h>
+#include <mono/utils/mono-logger-internal.h>
#include <mono/io-layer/mono-mutex.h>
#include <mono/metadata/class-internals.h>
#include <mono/metadata/object-internals.h>
#define HEAVY_STAT(x)
#endif
-#define DEBUG(level,a) do {if (G_UNLIKELY ((level) <= SGEN_MAX_DEBUG_LEVEL && (level) <= gc_debug_level)) { a; fflush (gc_debug_file); } } while (0)
+#define SGEN_ASSERT(level, a, ...) do { \
+ if (G_UNLIKELY ((level) <= SGEN_MAX_ASSERT_LEVEL && !(a))) { \
+ g_error (__VA_ARGS__); \
+} } while (0)
+
+
+#define SGEN_LOG(level, format, ...) do { \
+ if (G_UNLIKELY ((level) <= SGEN_MAX_DEBUG_LEVEL && (level) <= gc_debug_level)) { \
+ mono_gc_printf (gc_debug_file, format, ##__VA_ARGS__); \
+} } while (0)
+
+#define SGEN_COND_LOG(level, cond, format, ...) do { \
+ if (G_UNLIKELY ((level) <= SGEN_MAX_DEBUG_LEVEL && (level) <= gc_debug_level)) { \
+ if (cond) \
+ mono_gc_printf (gc_debug_file, format, ##__VA_ARGS__); \
+} } while (0)
+
+#define SGEN_LOG_DO(level, fun) do { \
+ if (G_UNLIKELY ((level) <= SGEN_MAX_DEBUG_LEVEL && (level) <= gc_debug_level)) { \
+ fun; \
+} } while (0)
extern int gc_debug_level;
extern FILE* gc_debug_file;
void* sgen_alloc_pinned (SgenPinnedAllocator *allocator, size_t size) MONO_INTERNAL;
void sgen_free_pinned (SgenPinnedAllocator *allocator, void *addr, size_t size) MONO_INTERNAL;
-
-void sgen_debug_printf (int level, const char *format, ...) MONO_INTERNAL;
-
gboolean sgen_parse_environment_string_extract_number (const char *str, glong *out) MONO_INTERNAL;
void sgen_pinned_scan_objects (SgenPinnedAllocator *alc, IterateObjectCallbackFunc callback, void *callback_data) MONO_INTERNAL;
int byte = idx / 8;
int bit = idx & 0x7;
- DEBUG (4, g_assert (sgen_ptr_in_nursery (object)));
- DEBUG (4, g_assert (byte < sgen_space_bitmap_size));
+ SGEN_ASSERT (4, sgen_ptr_in_nursery (object), "object %p is not in nursery [%p - %p]", object, sgen_get_nursery_start (), sgen_get_nursery_end ());
+ SGEN_ASSERT (4, byte < sgen_space_bitmap_size, "byte index %d out of range", byte, sgen_space_bitmap_size);
return (sgen_space_bitmap [byte] & (1 << bit)) != 0;
}
void (*start_major_collection) (void);
void (*finish_major_collection) (void);
void (*have_computed_minor_collection_allowance) (void);
- gboolean (*ptr_is_in_non_pinned_space) (char *ptr);
+ gboolean (*ptr_is_in_non_pinned_space) (char *ptr, char **start);
gboolean (*obj_is_from_pinned_alloc) (char *obj);
void (*report_pinned_memory_usage) (void);
int (*get_num_major_sections) (void);
void sgen_los_iterate_live_block_ranges (sgen_cardtable_block_callback callback) MONO_INTERNAL;
void sgen_los_scan_card_table (SgenGrayQueue *queue) MONO_INTERNAL;
void sgen_major_collector_scan_card_table (SgenGrayQueue *queue) MONO_INTERNAL;
-FILE *sgen_get_logfile (void) MONO_INTERNAL;
gboolean sgen_los_is_valid_object (char *object) MONO_INTERNAL;
gboolean mono_sgen_los_describe_pointer (char *ptr) MONO_INTERNAL;
extern MonoNativeTlsKey thread_info_key;
#ifdef HAVE_KW_THREAD
-extern __thread SgenThreadInfo *thread_info;
+extern __thread SgenThreadInfo *sgen_thread_info;
extern __thread gpointer *store_remset_buffer;
extern __thread long store_remset_buffer_index;
extern __thread char *stack_end;
#define REMEMBERED_SET remembered_set
#define STORE_REMSET_BUFFER store_remset_buffer
#define STORE_REMSET_BUFFER_INDEX store_remset_buffer_index
-#define IN_CRITICAL_REGION thread_info->in_critical_region
+#define IN_CRITICAL_REGION sgen_thread_info->in_critical_region
#else
#define TLAB_ACCESS_INIT SgenThreadInfo *__thread_info__ = mono_native_tls_get_value (thread_info_key)
#define REMEMBERED_SET (__thread_info__->remset)
#ifndef DISABLE_CRITICAL_REGION
#ifdef HAVE_KW_THREAD
-#define IN_CRITICAL_REGION thread_info->in_critical_region
+#define IN_CRITICAL_REGION sgen_thread_info->in_critical_region
#else
#define IN_CRITICAL_REGION (__thread_info__->in_critical_region)
#endif
/*
+ * sgen-gray.c: Gray queue management.
+ *
* Copyright 2001-2003 Ximian, Inc
* Copyright 2003-2010 Novell, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "config.h"
#ifdef HAVE_SGEN_GC
void
sgen_gray_object_enqueue (SgenGrayQueue *queue, char *obj)
{
- DEBUG (9, g_assert (obj));
+ SGEN_ASSERT (9, obj, "enqueueing a null object");
//sgen_check_objref (obj);
if (G_UNLIKELY (!queue->first || queue->first->end == SGEN_GRAY_QUEUE_SECTION_SIZE))
sgen_gray_object_alloc_queue_section (queue);
- DEBUG (9, g_assert (queue->first && queue->first->end < SGEN_GRAY_QUEUE_SECTION_SIZE));
+ SGEN_ASSERT (9, queue->first->end < SGEN_GRAY_QUEUE_SECTION_SIZE, "gray queue %p overflow, first %p, end %d", queue, queue->first, queue->first->end);
queue->first->objects [queue->first->end++] = obj;
- DEBUG (9, ++queue->balance);
+ SGEN_LOG_DO (9, ++queue->balance);
}
char*
if (sgen_gray_object_queue_is_empty (queue))
return NULL;
- DEBUG (9, g_assert (queue->first->end));
+ SGEN_ASSERT (9, queue->first->end, "gray queue %p underflow, first %p, end %d", queue, queue->first, queue->first->end);
obj = queue->first->objects [--queue->first->end];
queue->free_list = section;
}
- DEBUG (9, --queue->balance);
+ SGEN_LOG_DO (9, --queue->balance);
return obj;
}
int i;
g_assert (sgen_gray_object_queue_is_empty (queue));
- DEBUG (9, g_assert (queue->balance == 0));
+ SGEN_ASSERT (9, queue->balance == 0, "unbalanced queue on init %d", queue->balance);
/* Free the extra sections allocated during the last collection */
i = 0;
/*
- * sgen-los.c: Simple generational GC.
+ * sgen-los.c: Large objects space.
*
* Author:
* Paolo Molaro (lupus@ximian.com)
* Copyright (c) 1996 by Silicon Graphics. All rights reserved.
* Copyright (c) 1998 by Fergus Henderson. All rights reserved.
* Copyright (c) 2000-2004 by Hewlett-Packard Company. All rights reserved.
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program
- * for any purpose, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- *
* Copyright 2001-2003 Ximian, Inc
* Copyright 2003-2010 Novell, Inc.
+ * Copyright (C) 2012 Xamarin Inc
*
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
*
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
*
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "config.h"
{
#ifndef LOS_DUMMY
size_t size = obj->size;
- DEBUG (4, fprintf (gc_debug_file, "Freed large object %p, size %lu\n", obj->data, (unsigned long)obj->size));
+ SGEN_LOG (4, "Freed large object %p, size %lu", obj->data, (unsigned long)obj->size);
binary_protocol_empty (obj->data, obj->size);
los_memory_usage -= size;
los_object_list = obj;
los_memory_usage += size;
los_num_objects++;
- DEBUG (4, fprintf (gc_debug_file, "Allocated large object %p, vtable: %p (%s), size: %zd\n", obj->data, vtable, vtable->klass->name, size));
+ SGEN_LOG (4, "Allocated large object %p, vtable: %p (%s), size: %zd", obj->data, vtable, vtable->klass->name, size);
binary_protocol_alloc (obj->data, vtable, size);
#ifdef LOS_CONSISTENCY_CHECK
for (obj = los_object_list; obj; obj = obj->next) {
MonoVTable *vtable;
+ const char *los_kind;
if (obj->data > ptr || obj->data + obj->size <= ptr)
continue;
if (obj->size > LOS_SECTION_OBJECT_LIMIT)
- fprintf (gc_debug_file, "huge-los-ptr ");
+ los_kind = "huge-los-ptr ";
else
- fprintf (gc_debug_file, "los-ptr ");
+ los_kind = "los-ptr ";
vtable = (MonoVTable*)SGEN_LOAD_VTABLE (obj->data);
if (obj->data == ptr)
- fprintf (gc_debug_file, "(object %s.%s size %d)",
- vtable->klass->name_space, vtable->klass->name, (int)obj->size);
+ SGEN_LOG (1, "%s (object %s.%s size %d)",
+ los_kind, vtable->klass->name_space, vtable->klass->name, (int)obj->size);
else
- fprintf (gc_debug_file, "(interior-ptr offset %td of %p (%s.%s) size %d)",
- ptr - obj->data, obj->data,
+ SGEN_LOG (1, "%s (interior-ptr offset %td of %p (%s.%s) size %d)",
+ los_kind, ptr - obj->data, obj->data,
vtable->klass->name_space, vtable->klass->name, (int)obj->size);
return TRUE;
/*
+ * sgen-major-copy-object.h: Object copying in the major collectors.
+ *
* Copyright 2001-2003 Ximian, Inc
* Copyright 2003-2010 Novell, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#define collector_pin_object(obj, queue) do { \
} \
} while (0)
-#define collector_serial_alloc_for_promotion sgen_minor_collector.alloc_for_promotion
-#define collector_parallel_alloc_for_promotion sgen_minor_collector.par_alloc_for_promotion
+#define COLLECTOR_SERIAL_ALLOC_FOR_PROMOTION sgen_minor_collector.alloc_for_promotion
+#define COLLECTOR_PARALLEL_ALLOC_FOR_PROMOTION sgen_minor_collector.par_alloc_for_promotion
#include "sgen-copy-object.h"
/*
- * sgen-major-copying.c: Simple generational GC.
+ * sgen-major-copying.c: The copying major collector.
*
* Author:
* Paolo Molaro (lupus@ximian.com)
*
* Copyright 2005-2010 Novell, Inc (http://www.novell.com)
+ * Copyright 2001-2003 Ximian, Inc
+ * Copyright 2003-2010 Novell, Inc.
+ * Copyright (C) 2012 Xamarin Inc
*
* Thread start/stop adapted from Boehm's GC:
* Copyright (c) 1994 by Xerox Corporation. All rights reserved.
* Copyright (c) 1998 by Fergus Henderson. All rights reserved.
* Copyright (c) 2000-2004 by Hewlett-Packard Company. All rights reserved.
*
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
*
- * Permission is hereby granted to use or copy this program
- * for any purpose, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
*
- *
- * Copyright 2001-2003 Ximian, Inc
- * Copyright 2003-2010 Novell, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "config.h"
#include "metadata/profiler-private.h"
#include "metadata/sgen-memory-governor.h"
+#ifndef DISABLE_SGEN_MAJOR_COPYING
+
#define MAJOR_SECTION_SIZE SGEN_PINNED_CHUNK_SIZE
#define BLOCK_FOR_OBJECT(o) SGEN_PINNED_CHUNK_FOR_PTR ((o))
#define MAJOR_SECTION_FOR_OBJECT(o) ((GCMemSection*)BLOCK_FOR_OBJECT ((o)))
section->size = MAJOR_SECTION_SIZE - SGEN_SIZEOF_GC_MEM_SECTION;
section->end_data = section->data + section->size;
sgen_update_heap_boundaries ((mword)section->data, (mword)section->end_data);
- DEBUG (3, fprintf (gc_debug_file, "New major heap section: (%p-%p), total: %lld\n", section->data, section->end_data, (long long int)mono_gc_get_heap_size ()));
+ SGEN_LOG (3, "New major heap section: (%p-%p), total: %lld", section->data, section->end_data, (long long int)mono_gc_get_heap_size ());
scan_starts = (section->size + SGEN_SCAN_START_SIZE - 1) / SGEN_SCAN_START_SIZE;
section->scan_starts = sgen_alloc_internal_dynamic (sizeof (char*) * scan_starts, INTERNAL_MEM_SCAN_STARTS, TRUE);
section->num_scan_start = scan_starts;
static void
free_major_section (GCMemSection *section)
{
- DEBUG (3, fprintf (gc_debug_file, "Freed major section %p (%p-%p)\n", section, section->data, section->end_data));
+ SGEN_LOG (3, "Freed major section %p (%p-%p)", section, section->data, section->end_data);
sgen_free_internal_dynamic (section->scan_starts,
(section->size + SGEN_SCAN_START_SIZE - 1) / SGEN_SCAN_START_SIZE * sizeof (char*), INTERNAL_MEM_SCAN_STARTS);
sgen_free_os_memory (section, MAJOR_SECTION_SIZE, SGEN_ALLOC_HEAP);
if (dest + size > to_space_top) {
to_space_expand ();
(dest) = to_space_bumper;
- DEBUG (8, g_assert (dest + size <= to_space_top));
+ SGEN_ASSERT (8, dest + size <= to_space_top, "space allocation overflow dest %p size %d to-space-top %p", dest, size, to_space_top);
}
to_space_bumper += size;
- DEBUG (8, g_assert (to_space_bumper <= to_space_top));
+ SGEN_ASSERT (8, to_space_bumper <= to_space_top, "to-space-bumper %p overflow to-space-top %p", to_space_bumper, to_space_top);
to_space_section->scan_starts [(dest - (char*)to_space_section->data)/SGEN_SCAN_START_SIZE] = dest;
return dest;
}
sgen_register_major_sections_alloced (1);
}
section->next_data += size;
- DEBUG (3, fprintf (gc_debug_file, "Allocated (degraded) object %p, vtable: %p (%s), size: %zd in section %p\n", p, vtable, vtable->klass->name, size, section));
+ SGEN_LOG (3, "Allocated (degraded) object %p, vtable: %p (%s), size: %zd in section %p", p, vtable, vtable->klass->name, size, section);
*p = vtable;
return p;
}
char *obj = *obj_slot;
mword objsize;
- DEBUG (9, g_assert (current_collection_generation == GENERATION_OLD));
+ SGEN_ASSERT (9, current_collection_generation == GENERATION_OLD, "old gen parallel allocator called from a %d collection", current_collection_generation);
HEAVY_STAT (++stat_copy_object_called_major);
- DEBUG (9, fprintf (gc_debug_file, "Precise copy of %p from %p", obj, obj_slot));
+ SGEN_LOG (9, "Precise copy of %p from %p", obj, obj_slot);
/*
* obj must belong to one of:
*/
if ((forwarded = SGEN_OBJECT_IS_FORWARDED (obj))) {
- DEBUG (9, g_assert (((MonoVTable*)SGEN_LOAD_VTABLE(obj))->gc_descr));
- DEBUG (9, fprintf (gc_debug_file, " (already forwarded to %p)\n", forwarded));
+ SGEN_ASSERT (9, (*(MonoVTable**)SGEN_LOAD_VTABLE (obj))->gc_descr, "forwarded object %p has no gc descriptor", forwarded);
+ SGEN_LOG (9, " (already forwarded to %p)", forwarded);
HEAVY_STAT (++stat_major_copy_object_failed_forwarded);
*obj_slot = forwarded;
return;
}
if (SGEN_OBJECT_IS_PINNED (obj)) {
- DEBUG (9, g_assert (((MonoVTable*)SGEN_LOAD_VTABLE(obj))->gc_descr));
- DEBUG (9, fprintf (gc_debug_file, " (pinned, no change)\n"));
+ SGEN_ASSERT (9, ((MonoVTable*)SGEN_LOAD_VTABLE(obj))->gc_descr, "pinned object %p has no gc descriptor", obj);
+ SGEN_LOG (9, " (pinned, no change)");
HEAVY_STAT (++stat_major_copy_object_failed_pinned);
return;
}
if (ptr_in_nursery (obj)) {
/* A To Space object is already on its final destination for the current collection. */
- if (sgen_nursery_is_to_space (obj))
+ if (sgen_nursery_is_to_space (obj)) {
+ SGEN_ASSERT (9, ((MonoVTable*)SGEN_LOAD_VTABLE(obj))->gc_descr, "to space object %p has no gc descriptor", obj);
+ SGEN_LOG (9, " (tospace, no change)");
return;
+ }
goto copy;
}
if (G_UNLIKELY (objsize > SGEN_MAX_SMALL_OBJ_SIZE || obj_is_from_pinned_alloc (obj))) {
if (SGEN_OBJECT_IS_PINNED (obj))
return;
- DEBUG (9, fprintf (gc_debug_file, " (marked LOS/Pinned %p (%s), size: %td)\n", obj, sgen_safe_name (obj), objsize));
+ SGEN_LOG (9, " (marked LOS/Pinned %p (%s), size: %td)", obj, sgen_safe_name (obj), objsize);
binary_protocol_pin (obj, (gpointer)SGEN_LOAD_VTABLE (obj), sgen_safe_object_get_size ((MonoObject*)obj));
SGEN_PIN_OBJECT (obj);
GRAY_OBJECT_ENQUEUE (queue, obj);
* not (4).
*/
if (MAJOR_OBJ_IS_IN_TO_SPACE (obj)) {
- DEBUG (9, g_assert (objsize <= SGEN_MAX_SMALL_OBJ_SIZE));
- DEBUG (9, fprintf (gc_debug_file, " (already copied)\n"));
+ SGEN_ASSERT (9, objsize <= SGEN_MAX_SMALL_OBJ_SIZE, "object %p in to space is too big, size %d", objsize);
+ SGEN_LOG (9, " (already copied)");
HEAVY_STAT (++stat_major_copy_object_failed_to_space);
return;
}
{
if (SGEN_OBJECT_IS_PINNED (ptr)) {
SGEN_UNPIN_OBJECT (ptr);
- DEBUG (6, fprintf (gc_debug_file, "Unmarked pinned object %p (%s)\n", ptr, sgen_safe_name (ptr)));
+ SGEN_LOG (6, "Unmarked pinned object %p (%s)", ptr, sgen_safe_name (ptr));
} else {
- DEBUG (6, fprintf (gc_debug_file, "Freeing unmarked pinned object %p (%s)\n", ptr, sgen_safe_name (ptr)));
+ SGEN_LOG (6, "Freeing unmarked pinned object %p (%s)", ptr, sgen_safe_name (ptr));
free_pinned_object (ptr, size);
}
}
sgen_pin_stats_register_object ((char*) addr, sgen_safe_object_get_size ((MonoObject*) addr));
SGEN_PIN_OBJECT (addr);
GRAY_OBJECT_ENQUEUE (queue, addr);
- DEBUG (6, fprintf (gc_debug_file, "Marked pinned object %p (%s) from roots\n", addr, sgen_safe_name (addr)));
+ SGEN_LOG (6, "Marked pinned object %p (%s) from roots", addr, sgen_safe_name (addr));
}
static void
free_major_section (to_free);
continue;
} else {
- DEBUG (6, fprintf (gc_debug_file, "Section %p has still pinned objects (%d)\n", section, section->pin_queue_num_entries));
+ SGEN_LOG (6, "Section %p has still pinned objects (%d)", section, section->pin_queue_num_entries);
build_section_fragments (section);
}
prev_section = section;
}
static gboolean
-major_ptr_is_in_non_pinned_space (char *ptr)
+major_ptr_is_in_non_pinned_space (char *ptr, char **start)
{
GCMemSection *section;
+
+ // FIXME:
+ *start = NULL;
for (section = section_list; section;) {
if (ptr >= section->data && ptr < section->data + section->size)
return TRUE;
collector->major_ops.scan_object = major_scan_object;
}
+#else /* DISABLE_SGEN_MAJOR_COPYING */
+
+void
+sgen_copying_init (SgenMajorCollector *collector)
+{
+ fprintf (stderr, "Error: Mono was configured using --enable-minimal=sgen_copying.\n");
+ exit (1);
+}
+
+#endif /* DISABLE_SGEN_MAJOR_COPYING */
+
#endif
/*
+ * sgen-major-scan-object.h: Object scanning in the major collectors.
+ *
* Copyright 2001-2003 Ximian, Inc
* Copyright 2003-2010 Novell, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+
extern long long stat_scan_object_called_major;
#ifdef FIXED_HEAP
PREFETCH_DYNAMIC_HEAP (__old); \
major_copy_or_mark_object ((ptr), queue); \
__copy = *(ptr); \
- DEBUG (9, if (__old != __copy) sgen_debug_printf (9, "Overwrote field at %p with %p (was: %p)\n", (ptr), *(ptr), __old)); \
+ SGEN_COND_LOG (9, __old != __copy, "Overwrote field at %p with %p (was: %p)", (ptr), *(ptr), __old); \
if (G_UNLIKELY (sgen_ptr_in_nursery (__copy) && !sgen_ptr_in_nursery ((ptr)))) \
sgen_add_to_global_remset ((ptr)); \
} \
+#include "config.h"
+
+#ifdef HAVE_SGEN_GC
+
+#ifndef DISABLE_SGEN_MARKSWEEP_FIXED_PAR
+
#define SGEN_PARALLEL_MARK
#define FIXED_HEAP
#include "sgen-marksweep.c"
+
+#else
+
+#include "metadata/sgen-gc.h"
+
+void
+sgen_marksweep_fixed_par_init (SgenMajorCollector *collector)
+{
+ fprintf (stderr, "Error: Mono was configured using --enable-minimal=sgen_marksweep_fixed_par.\n");
+ exit (1);
+}
+
+#endif
+
+#endif
+#include "config.h"
+
+#ifdef HAVE_SGEN_GC
+
+#ifndef DISABLE_SGEN_MARKSWEEP_FIXED
+
#define FIXED_HEAP
#include "sgen-marksweep.c"
+
+#else
+
+#include "metadata/sgen-gc.h"
+
+void
+sgen_marksweep_fixed_init (SgenMajorCollector *collector)
+{
+ fprintf (stderr, "Error: Mono was configured using --enable-minimal=sgen_marksweep_fixed.\n");
+ exit (1);
+}
+
+#endif
+
+#endif
+#include "config.h"
+
+#ifdef HAVE_SGEN_GC
+
+#ifndef DISABLE_SGEN_MAJOR_MARKSWEEP_PAR
+
#define SGEN_PARALLEL_MARK
#include "sgen-marksweep.c"
+
+#else
+
+#include "metadata/sgen-gc.h"
+
+void
+sgen_marksweep_par_init (SgenMajorCollector *collector)
+{
+ fprintf (stderr, "Error: Mono was configured using --enable-minimal=sgen_marksweep_par.\n");
+ exit (1);
+}
+
+#endif /* DISABLE_SGEN_MAJOR_MARKSWEEP_PAR */
+
+#endif
/*
- * sgen-marksweep.c: Simple generational GC.
+ * sgen-marksweep.c: The Mark & Sweep major collector.
*
* Author:
* Mark Probst <mark.probst@gmail.com>
*
* Copyright 2009-2010 Novell, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "config.h"
unsigned int has_references : 1;
unsigned int has_pinned : 1; /* means cannot evacuate */
unsigned int is_to_space : 1;
+ unsigned int swept : 1;
#ifdef FIXED_HEAP
unsigned int used : 1;
unsigned int zeroed : 1;
#endif
#define MS_BLOCK_OBJ(b,i) ((b)->block + MS_BLOCK_SKIP + (b)->obj_size * (i))
+#define MS_BLOCK_OBJ_FOR_SIZE(b,i,obj_size) ((b)->block + MS_BLOCK_SKIP + (obj_size) * (i))
#define MS_BLOCK_DATA_FOR_OBJ(o) ((char*)((mword)(o) & ~(mword)(MS_BLOCK_SIZE - 1)))
#ifdef FIXED_HEAP
static float evacuation_threshold = 0.666;
static gboolean concurrent_sweep = FALSE;
+static gboolean lazy_sweep = TRUE;
static gboolean have_swept;
/* all allocated blocks in the system */
static long long stat_major_blocks_alloced = 0;
static long long stat_major_blocks_freed = 0;
+static long long stat_major_blocks_lazy_swept = 0;
static long long stat_major_objects_evacuated = 0;
static long long stat_time_wait_for_sweep = 0;
static MonoSemType ms_sweep_cmd_semaphore;
static MonoSemType ms_sweep_done_semaphore;
+static void
+sweep_block (MSBlockInfo *block);
+
static void
ms_signal_sweep_command (void)
{
ms_find_block_obj_size_index (int size)
{
int i;
- DEBUG (9, g_assert (size <= SGEN_MAX_SMALL_OBJ_SIZE));
+ SGEN_ASSERT (9, size <= SGEN_MAX_SMALL_OBJ_SIZE, "size %d is bigger than max small object size %d", size, SGEN_MAX_SMALL_OBJ_SIZE);
for (i = 0; i < num_block_obj_sizes; ++i)
if (block_obj_sizes [i] >= size)
return i;
/* blocks in the free lists must have at least
one free slot */
- g_assert (block->free_list);
+ if (block->swept)
+ g_assert (block->free_list);
#ifdef FIXED_HEAP
/* the block must not be in the empty_blocks list */
g_assert (num_free == 0);
/* check all mark words are zero */
- for (i = 0; i < MS_NUM_MARK_WORDS; ++i)
- g_assert (block->mark_words [i] == 0);
+ if (block->swept) {
+ for (i = 0; i < MS_NUM_MARK_WORDS; ++i)
+ g_assert (block->mark_words [i] == 0);
+ }
} END_FOREACH_BLOCK;
/* check free blocks */
info = sgen_alloc_internal (INTERNAL_MEM_MS_BLOCK_INFO);
#endif
- DEBUG (9, g_assert (count >= 2));
+ SGEN_ASSERT (9, count >= 2, "block with %d objects, it must hold at least 2", count);
info->obj_size = size;
info->obj_size_index = size_index;
info->has_references = has_references;
info->has_pinned = pinned;
info->is_to_space = (sgen_get_current_collection_generation () == GENERATION_OLD); /*FIXME WHY??? */
+ info->swept = 1;
#ifndef FIXED_HEAP
info->block = ms_get_empty_block ();
void *obj;
block = free_blocks [size_index];
- DEBUG (9, g_assert (block));
+ SGEN_ASSERT (9, block, "no free block to unlink from free_blocks %p size_index %d", free_blocks, size_index);
+
+ if (G_UNLIKELY (!block->swept)) {
+ stat_major_blocks_lazy_swept ++;
+ sweep_block (block);
+ }
obj = block->free_list;
- DEBUG (9, g_assert (obj));
+ SGEN_ASSERT (9, obj, "block %p in free list had no available object to alloc from", block);
block->free_list = *(void**)obj;
if (!block->free_list) {
MSBlockInfo *block;
void *obj;
- DEBUG (9, g_assert (!ms_sweep_in_progress));
- DEBUG (9, g_assert (current_collection_generation == GENERATION_OLD));
+ SGEN_ASSERT (9, !ms_sweep_in_progress, "concurrent sweep in progress with concurrent allocation");
+ SGEN_ASSERT (9, current_collection_generation == GENERATION_OLD, "old gen parallel allocator called from a %d collection", current_collection_generation);
if (free_blocks_local [size_index]) {
get_slot:
void *obj;
#ifdef SGEN_PARALLEL_MARK
- DEBUG (9, g_assert (current_collection_generation != GENERATION_OLD));
+ SGEN_ASSERT (9, current_collection_generation == GENERATION_OLD, "old gen parallel allocator called from a %d collection", current_collection_generation);
+
#endif
- DEBUG (9, g_assert (!ms_sweep_in_progress));
+ SGEN_ASSERT (9, !ms_sweep_in_progress, "concurrent sweep in progress with concurrent allocation");
if (!free_blocks [size_index]) {
if (G_UNLIKELY (!ms_alloc_block (size_index, pinned, has_references)))
{
MSBlockInfo *block = MS_BLOCK_FOR_OBJ (obj);
int word, bit;
- DEBUG (9, g_assert ((pinned && block->pinned) || (!pinned && !block->pinned)));
- DEBUG (9, g_assert (MS_OBJ_ALLOCED (obj, block)));
+
+ if (!block->swept)
+ sweep_block (block);
+ SGEN_ASSERT (9, (pinned && block->pinned) || (!pinned && !block->pinned), "free-object pinning mixup object %p pinned %d block %p pinned %d", obj, pinned, block, block->pinned);
+ SGEN_ASSERT (9, MS_OBJ_ALLOCED (obj, block), "object %p is already free", obj);
MS_CALC_MARK_BIT (word, bit, obj);
- DEBUG (9, g_assert (!MS_MARK_BIT (block, word, bit)));
+ SGEN_ASSERT (9, !MS_MARK_BIT (block, word, bit), "object %p has mark bit set");
if (!block->free_list) {
MSBlockInfo **free_blocks = FREE_BLOCKS (pinned, block->has_references);
int size_index = MS_BLOCK_OBJ_SIZE_INDEX (size);
- DEBUG (9, g_assert (!block->next_free));
+ SGEN_ASSERT (9, !block->next_free, "block %p doesn't have a free-list of object but belongs to a free-list of blocks");
block->next_free = free_blocks [size_index];
free_blocks [size_index] = block;
}
/* now we know it's in a major block */
block = MS_BLOCK_FOR_OBJ (obj);
- DEBUG (9, g_assert (!block->pinned));
+ SGEN_ASSERT (9, !block->pinned, "block %p is pinned, BTW why is this bad?");
MS_CALC_MARK_BIT (word, bit, obj);
return MS_MARK_BIT (block, word, bit) ? TRUE : FALSE;
}
static gboolean
-major_ptr_is_in_non_pinned_space (char *ptr)
+major_ptr_is_in_non_pinned_space (char *ptr, char **start)
{
MSBlockInfo *block;
FOREACH_BLOCK (block) {
- if (ptr >= block->block && ptr <= block->block + MS_BLOCK_SIZE)
+ if (ptr >= block->block && ptr <= block->block + MS_BLOCK_SIZE) {
+ int count = MS_BLOCK_FREE / block->obj_size;
+ int i;
+
+ *start = NULL;
+ for (i = 0; i <= count; ++i) {
+ if (ptr >= MS_BLOCK_OBJ (block, i) && ptr < MS_BLOCK_OBJ (block, i + 1)) {
+ *start = MS_BLOCK_OBJ (block, i);
+ break;
+ }
+ }
return !block->pinned;
+ }
} END_FOREACH_BLOCK;
return FALSE;
}
continue;
if (!block->pinned && !non_pinned)
continue;
+ if (lazy_sweep)
+ sweep_block (block);
for (i = 0; i < count; ++i) {
void **obj = (void**) MS_BLOCK_OBJ (block, i);
if ((block->block > ptr) || ((block->block + MS_BLOCK_SIZE) <= ptr))
continue;
- fprintf (gc_debug_file, "major-ptr (block %p sz %d pin %d ref %d) ",
+ SGEN_LOG (1, "major-ptr (block %p sz %d pin %d ref %d) ",
block->block, block->obj_size, block->pinned, block->has_references);
idx = MS_BLOCK_OBJ_INDEX (ptr, block);
if (obj == ptr) {
if (live)
- fprintf (gc_debug_file, "(object %s.%s)", vtable->klass->name_space, vtable->klass->name);
+ SGEN_LOG (1, "\t(object %s.%s)", vtable->klass->name_space, vtable->klass->name);
else
- fprintf (gc_debug_file, "(dead-object)");
+ SGEN_LOG (1, "(dead-object)");
} else {
if (live)
- fprintf (gc_debug_file, "(interior-ptr offset %td of %p %s.%s)",
+ SGEN_LOG (1, "(interior-ptr offset %td of %p %s.%s)",
ptr - obj,
obj, vtable->klass->name_space, vtable->klass->name);
else
- fprintf (gc_debug_file, "(dead-interior-ptr to %td to %p)",
+ SGEN_LOG (1, "(dead-interior-ptr to %td to %p)",
ptr - obj, obj);
}
#define MS_MARK_OBJECT_AND_ENQUEUE(obj,block,queue) do { \
int __word, __bit; \
MS_CALC_MARK_BIT (__word, __bit, (obj)); \
- DEBUG (9, g_assert (MS_OBJ_ALLOCED ((obj), (block)))); \
+ SGEN_ASSERT (9, MS_OBJ_ALLOCED ((obj), (block)), "object %p not allocated", obj); \
if (!MS_MARK_BIT ((block), __word, __bit)) { \
MS_SET_MARK_BIT ((block), __word, __bit); \
if ((block)->has_references) \
#define MS_PAR_MARK_OBJECT_AND_ENQUEUE(obj,block,queue) do { \
int __word, __bit; \
gboolean __was_marked; \
- DEBUG (9, g_assert (MS_OBJ_ALLOCED ((obj), (block)))); \
+ SGEN_ASSERT (9, MS_OBJ_ALLOCED ((obj), (block)), "object %p not allocated", obj); \
MS_CALC_MARK_BIT (__word, __bit, (obj)); \
MS_PAR_SET_MARK_BIT (__was_marked, (block), __word, __bit); \
if (!__was_marked) { \
HEAVY_STAT (++stat_copy_object_called_major);
- DEBUG (9, g_assert (obj));
- DEBUG (9, g_assert (current_collection_generation == GENERATION_OLD));
+ SGEN_ASSERT (9, obj, "null object from pointer %p", ptr);
+ SGEN_ASSERT (9, current_collection_generation == GENERATION_OLD, "old gen parallel allocator called from a %d collection", current_collection_generation);
if (sgen_ptr_in_nursery (obj)) {
int word, bit;
if (!sgen_ptr_in_nursery (obj)) {
block = MS_BLOCK_FOR_OBJ (obj);
MS_CALC_MARK_BIT (word, bit, obj);
- DEBUG (9, g_assert (!MS_MARK_BIT (block, word, bit)));
+ SGEN_ASSERT (9, !MS_MARK_BIT (block, word, bit), "object %p already marked", obj);
MS_PAR_SET_MARK_BIT (was_marked, block, word, bit);
}
} else {
HEAVY_STAT (++stat_copy_object_called_major);
- DEBUG (9, g_assert (obj));
- DEBUG (9, g_assert (current_collection_generation == GENERATION_OLD));
+ SGEN_ASSERT (9, obj, "null object from pointer %p", ptr);
+ SGEN_ASSERT (9, current_collection_generation == GENERATION_OLD, "old gen parallel allocator called from a %d collection", current_collection_generation);
if (sgen_ptr_in_nursery (obj)) {
int word, bit;
if (!sgen_ptr_in_nursery (obj)) {
block = MS_BLOCK_FOR_OBJ (obj);
MS_CALC_MARK_BIT (word, bit, obj);
- DEBUG (9, g_assert (!MS_MARK_BIT (block, word, bit)));
+ SGEN_ASSERT (9, !MS_MARK_BIT (block, word, bit), "object %p already marked", obj);
MS_SET_MARK_BIT (block, word, bit);
}
} else {
for (i = 0; i < block->pin_queue_num_entries; ++i) {
int index = MS_BLOCK_OBJ_INDEX (block->pin_queue_start [i], block);
- DEBUG (9, g_assert (index >= 0 && index < MS_BLOCK_FREE / block->obj_size));
+ SGEN_ASSERT (9, index >= 0 && index < MS_BLOCK_FREE / block->obj_size, "invalid object %p index %d max-index %d", block->pin_queue_start [i], index, MS_BLOCK_FREE / block->obj_size);
if (index == last_index)
continue;
MS_MARK_OBJECT_AND_ENQUEUE_CHECKED (MS_BLOCK_OBJ (block, index), block, queue);
}
}
+static inline void
+sweep_block_for_size (MSBlockInfo *block, int count, int obj_size)
+{
+ int obj_index;
+
+ for (obj_index = 0; obj_index < count; ++obj_index) {
+ int word, bit;
+ void *obj = MS_BLOCK_OBJ_FOR_SIZE (block, obj_index, obj_size);
+
+ MS_CALC_MARK_BIT (word, bit, obj);
+ if (MS_MARK_BIT (block, word, bit)) {
+ SGEN_ASSERT (9, MS_OBJ_ALLOCED (obj, block), "object %p not allocated", obj);
+ } else {
+ /* an unmarked object */
+ if (MS_OBJ_ALLOCED (obj, block)) {
+ /*
+ * FIXME: Merge consecutive
+ * slots for lower reporting
+ * overhead. Maybe memset
+ * will also benefit?
+ */
+ binary_protocol_empty (obj, obj_size);
+ MONO_GC_MAJOR_SWEPT ((mword)obj, obj_size);
+ memset (obj, 0, obj_size);
+ }
+ *(void**)obj = block->free_list;
+ block->free_list = obj;
+ }
+ }
+}
+
+/*
+ * sweep_block:
+ *
+ * Traverse BLOCK, freeing and zeroing unused objects.
+ */
+static void
+sweep_block (MSBlockInfo *block)
+{
+ int count;
+
+ if (block->swept)
+ return;
+
+ count = MS_BLOCK_FREE / block->obj_size;
+
+ block->free_list = NULL;
+
+ /* Use inline instances specialized to constant sizes, this allows the compiler to replace the memset calls with inline code */
+ // FIXME: Add more sizes
+ switch (block->obj_size) {
+ case 16:
+ sweep_block_for_size (block, count, 16);
+ break;
+ default:
+ sweep_block_for_size (block, count, block->obj_size);
+ break;
+ }
+
+ /* reset mark bits */
+ memset (block->mark_words, 0, sizeof (mword) * MS_NUM_MARK_WORDS);
+
+ /*
+ * FIXME: reverse free list so that it's in address
+ * order
+ */
+
+ block->swept = 1;
+}
+
+static inline int
+bitcount (mword d)
+{
+#if SIZEOF_VOID_P == 8
+ /* http://www.jjj.de/bitwizardry/bitwizardrypage.html */
+ d -= (d>>1) & 0x5555555555555555;
+ d = ((d>>2) & 0x3333333333333333) + (d & 0x3333333333333333);
+ d = ((d>>4) + d) & 0x0f0f0f0f0f0f0f0f;
+ d *= 0x0101010101010101;
+ return d >> 56;
+#else
+ /* http://aggregate.org/MAGIC/ */
+ d -= ((d >> 1) & 0x55555555);
+ d = (((d >> 2) & 0x33333333) + (d & 0x33333333));
+ d = (((d >> 4) + d) & 0x0f0f0f0f);
+ d += (d >> 8);
+ d += (d >> 16);
+ return (d & 0x0000003f);
+#endif
+}
+
static void
ms_sweep (void)
{
int count;
gboolean have_live = FALSE;
gboolean has_pinned;
- int obj_index;
+ gboolean have_free = FALSE;
int obj_size_index;
+ int nused = 0;
obj_size_index = block->obj_size_index;
block->has_pinned = block->pinned;
block->is_to_space = FALSE;
+ block->swept = 0;
count = MS_BLOCK_FREE / block->obj_size;
- block->free_list = NULL;
-
- for (obj_index = 0; obj_index < count; ++obj_index) {
- int word, bit;
- void *obj = MS_BLOCK_OBJ (block, obj_index);
- MS_CALC_MARK_BIT (word, bit, obj);
- if (MS_MARK_BIT (block, word, bit)) {
- DEBUG (9, g_assert (MS_OBJ_ALLOCED (obj, block)));
- have_live = TRUE;
- if (!has_pinned)
- ++slots_used [obj_size_index];
- } else {
- /* an unmarked object */
- if (MS_OBJ_ALLOCED (obj, block)) {
- /*
- * FIXME: Merge consecutive
- * slots for lower reporting
- * overhead. Maybe memset
- * will also benefit?
- */
- binary_protocol_empty (obj, block->obj_size);
- MONO_GC_MAJOR_SWEPT ((mword)obj, block->obj_size);
- memset (obj, 0, block->obj_size);
- }
- *(void**)obj = block->free_list;
- block->free_list = obj;
- }
+ /* Count marked objects in the block */
+ for (i = 0; i < MS_NUM_MARK_WORDS; ++i) {
+ nused += bitcount (block->mark_words [i]);
}
+ if (nused) {
+ have_live = TRUE;
+ }
+ if (nused < count)
+ have_free = TRUE;
- /* reset mark bits */
- memset (block->mark_words, 0, sizeof (mword) * MS_NUM_MARK_WORDS);
-
- /*
- * FIXME: reverse free list so that it's in address
- * order
- */
+ if (!lazy_sweep)
+ sweep_block (block);
if (have_live) {
if (!has_pinned) {
++num_blocks [obj_size_index];
+ slots_used [obj_size_index] += nused;
slots_available [obj_size_index] += count;
}
* If there are free slots in the block, add
* the block to the corresponding free list.
*/
- if (block->free_list) {
+ if (have_free) {
MSBlockInfo **free_blocks = FREE_BLOCKS (block->pinned, block->has_references);
int index = MS_BLOCK_OBJ_SIZE_INDEX (block->obj_size);
block->next_free = free_blocks [index];
--num_major_sections;
}
}
-
for (i = 0; i < num_block_obj_sizes; ++i) {
float usage = (float)slots_used [i] / (float)slots_available [i];
if (num_blocks [i] > 5 && usage < evacuation_threshold) {
free_block_lists [0][i] = NULL;
free_block_lists [MS_BLOCK_FLAG_REFS][i] = NULL;
}
+
+ // Sweep all unswept blocks
+ if (lazy_sweep) {
+ MSBlockInfo **iter;
+
+ iter = &all_blocks;
+ while (*iter) {
+ MSBlockInfo *block = *iter;
+
+ sweep_block (block);
+
+ iter = &block->next;
+ }
+ }
}
static void
continue;
#endif
+ if (!block->swept)
+ sweep_block (block);
+
obj = (char*)MS_BLOCK_OBJ_FAST (block_start, block_obj_size, 0);
end = block_start + MS_BLOCK_SIZE;
base = sgen_card_table_align_pointer (obj);
if (!*card_data)
continue;
+ if (!block->swept)
+ sweep_block (block);
+
HEAVY_STAT (++marked_cards);
sgen_card_table_prepare_card_for_scanning (card_data);
mono_counters_register ("# major blocks allocated", MONO_COUNTER_GC | MONO_COUNTER_LONG, &stat_major_blocks_alloced);
mono_counters_register ("# major blocks freed", MONO_COUNTER_GC | MONO_COUNTER_LONG, &stat_major_blocks_freed);
+ mono_counters_register ("# major blocks lazy swept", MONO_COUNTER_GC | MONO_COUNTER_LONG, &stat_major_blocks_lazy_swept);
mono_counters_register ("# major objects evacuated", MONO_COUNTER_GC | MONO_COUNTER_LONG, &stat_major_objects_evacuated);
mono_counters_register ("Wait for sweep time", MONO_COUNTER_GC | MONO_COUNTER_TIME_INTERVAL, &stat_time_wait_for_sweep);
#ifdef SGEN_PARALLEL_MARK
/*
- * sgen-cardtable.c: Card table implementation for sgen
+ * sgen-memory-governor.c: When to schedule collections based on
+ * memory usage.
*
* Author:
* Rodrigo Kumpera (rkumpera@novell.com)
*
- * SGen is licensed under the terms of the MIT X11 license
- *
* Copyright 2001-2003 Ximian, Inc
* Copyright 2003-2010 Novell, Inc.
* Copyright 2011 Xamarin Inc (http://www.xamarin.com)
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "config.h"
if (debug_print_allowance) {
mword old_major = last_collection_old_num_major_sections * major_collector.section_size;
- fprintf (gc_debug_file, "Before collection: %td bytes (%td major, %td LOS)\n",
+ SGEN_LOG (1, "Before collection: %td bytes (%td major, %td LOS)",
old_major + last_collection_old_los_memory_usage, old_major, last_collection_old_los_memory_usage);
- fprintf (gc_debug_file, "After collection: %td bytes (%td major, %td LOS)\n",
+ SGEN_LOG (1, "After collection: %td bytes (%td major, %td LOS)",
new_heap_size, new_major, last_collection_los_memory_usage);
- fprintf (gc_debug_file, "Allowance: %td bytes\n", minor_collection_allowance);
+ SGEN_LOG (1, "Allowance: %td bytes", minor_collection_allowance);
}
if (major_collector.have_computed_minor_collection_allowance)
if (info->generation == GENERATION_OLD)
mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC, "GC_MAJOR%s: (%s) pause %.2fms, %s major %dK/%dK los %dK/%dK",
info->is_overflow ? "_OVERFLOW" : "",
- info->reason,
+ info->reason ? info->reason : "",
(int)info->total_time / 1000.0f,
full_timing_buff,
major_collector.section_size * num_major_sections / 1024,
else
mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC, "GC_MINOR%s: (%s) pause %.2fms, %s promoted %dK major %dK los %dK",
info->is_overflow ? "_OVERFLOW" : "",
- info->reason,
+ info->reason ? info->reason : "",
(int)info->total_time / 1000.0f,
full_timing_buff,
(num_major_sections - last_major_num_sections) * major_collector.section_size / 1024,
{
int i;
for (i = 0; i < info_count; ++i) {
- if (info->generation != -1)
+ if (info[i].generation != -1)
log_timming (&info [i]);
}
}
/*
+ * sgen-minor-copy-object.h: Copy functions for nursery collections.
+ *
* Copyright 2001-2003 Ximian, Inc
* Copyright 2003-2010 Novell, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#define collector_pin_object(obj, queue) sgen_pin_object (obj, queue);
-#define collector_serial_alloc_for_promotion alloc_for_promotion
-#define collector_parallel_alloc_for_promotion par_alloc_for_promotion
-
-#define GENERATE_COPY_FUNCTIONS 1
+#define COLLECTOR_SERIAL_ALLOC_FOR_PROMOTION alloc_for_promotion
+#define COLLECTOR_PARALLEL_ALLOC_FOR_PROMOTION par_alloc_for_promotion
+extern long long stat_nursery_copy_object_failed_to_space; /* from sgen-gc.c */
#include "sgen-copy-object.h"
+/*
+ * This is how the copying happens from the nursery to the old generation.
+ * We assume that at this time all the pinned objects have been identified and
+ * marked as such.
+ * We run scan_object() for each pinned object so that each referenced
+ * objects if possible are copied. The new gray objects created can have
+ * scan_object() run on them right away, too.
+ * Then we run copy_object() for the precisely tracked roots. At this point
+ * all the roots are either gray or black. We run scan_object() on the gray
+ * objects until no more gray objects are created.
+ * At the end of the process we walk again the pinned list and we unmark
+ * the pinned flag. As we go we also create the list of free space for use
+ * in the next allocation runs.
+ *
+ * We need to remember objects from the old generation that point to the new one
+ * (or just addresses?).
+ *
+ * copy_object could be made into a macro once debugged (use inline for now).
+ */
+
+#ifdef _MSC_VER
+static __forceinline void
+#else
+static inline void __attribute__((always_inline))
+#endif
+SERIAL_COPY_OBJECT (void **obj_slot, SgenGrayQueue *queue)
+{
+ char *forwarded;
+ char *obj = *obj_slot;
+
+ SGEN_ASSERT (9, current_collection_generation == GENERATION_NURSERY, "calling minor-serial-copy from a %d generation collection", current_collection_generation);
+
+ HEAVY_STAT (++stat_copy_object_called_nursery);
+
+ if (!sgen_ptr_in_nursery (obj)) {
+ HEAVY_STAT (++stat_nursery_copy_object_failed_from_space);
+ return;
+ }
+
+ SGEN_LOG (9, "Precise copy of %p from %p", obj, obj_slot);
+
+ /*
+ * Before we can copy the object we must make sure that we are
+ * allowed to, i.e. that the object not pinned, not already
+ * forwarded or belongs to the nursery To Space.
+ */
+
+ if ((forwarded = SGEN_OBJECT_IS_FORWARDED (obj))) {
+ SGEN_ASSERT (9, (*(MonoVTable**)SGEN_LOAD_VTABLE (obj))->gc_descr, "forwarded object %p has no gc descriptor", forwarded);
+ SGEN_LOG (9, " (already forwarded to %p)", forwarded);
+ HEAVY_STAT (++stat_nursery_copy_object_failed_forwarded);
+ *obj_slot = forwarded;
+ return;
+ }
+ if (G_UNLIKELY (SGEN_OBJECT_IS_PINNED (obj))) {
+ SGEN_ASSERT (9, ((MonoVTable*)SGEN_LOAD_VTABLE(obj))->gc_descr, "pinned object %p has no gc descriptor", obj);
+ SGEN_LOG (9, " (pinned, no change)");
+ HEAVY_STAT (++stat_nursery_copy_object_failed_pinned);
+ return;
+ }
+
+#ifndef SGEN_SIMPLE_NURSERY
+ if (sgen_nursery_is_to_space (obj)) {
+ SGEN_ASSERT (9, ((MonoVTable*)SGEN_LOAD_VTABLE(obj))->gc_descr, "to space object %p has no gc descriptor", obj);
+ SGEN_LOG (9, " (tospace, no change)");
+ HEAVY_STAT (++stat_nursery_copy_object_failed_to_space);
+ return;
+ }
+#endif
+
+ HEAVY_STAT (++stat_objects_copied_nursery);
+
+ *obj_slot = copy_object_no_checks (obj, queue);
+}
+
+/*
+ * SERIAL_COPY_OBJECT_FROM_OBJ:
+ *
+ * Similar to SERIAL_COPY_OBJECT, but assumes that OBJ_SLOT is part of an object, so it handles global remsets as well.
+ */
+#ifdef _MSC_VER
+static __forceinline void
+#else
+static inline void __attribute__((always_inline))
+#endif
+SERIAL_COPY_OBJECT_FROM_OBJ (void **obj_slot, SgenGrayQueue *queue)
+{
+ char *forwarded;
+ char *obj = *obj_slot;
+ void *copy;
+
+ SGEN_ASSERT (9, current_collection_generation == GENERATION_NURSERY, "calling minor-serial-copy-from-obj from a %d generation collection", current_collection_generation);
+
+ HEAVY_STAT (++stat_copy_object_called_nursery);
+
+ if (!sgen_ptr_in_nursery (obj)) {
+ HEAVY_STAT (++stat_nursery_copy_object_failed_from_space);
+ return;
+ }
+
+ SGEN_LOG (9, "Precise copy of %p from %p", obj, obj_slot);
+
+ /*
+ * Before we can copy the object we must make sure that we are
+ * allowed to, i.e. that the object not pinned, not already
+ * forwarded or belongs to the nursery To Space.
+ */
+
+ if ((forwarded = SGEN_OBJECT_IS_FORWARDED (obj))) {
+ SGEN_ASSERT (9, (*(MonoVTable**)SGEN_LOAD_VTABLE (obj))->gc_descr, "forwarded object %p has no gc descriptor", forwarded);
+ SGEN_LOG (9, " (already forwarded to %p)", forwarded);
+ HEAVY_STAT (++stat_nursery_copy_object_failed_forwarded);
+ *obj_slot = forwarded;
+#ifndef SGEN_SIMPLE_NURSERY
+ if (G_UNLIKELY (sgen_ptr_in_nursery (forwarded) && !sgen_ptr_in_nursery (obj_slot)))
+ sgen_add_to_global_remset (obj_slot);
+#endif
+ return;
+ }
+ if (G_UNLIKELY (SGEN_OBJECT_IS_PINNED (obj))) {
+ SGEN_ASSERT (9, ((MonoVTable*)SGEN_LOAD_VTABLE(obj))->gc_descr, "pinned object %p has no gc descriptor", obj);
+ SGEN_LOG (9, " (pinned, no change)");
+ HEAVY_STAT (++stat_nursery_copy_object_failed_pinned);
+ if (!sgen_ptr_in_nursery (obj_slot))
+ sgen_add_to_global_remset (obj_slot);
+ return;
+ }
+
+#ifndef SGEN_SIMPLE_NURSERY
+ if (sgen_nursery_is_to_space (obj)) {
+ SGEN_ASSERT (9, ((MonoVTable*)SGEN_LOAD_VTABLE(obj))->gc_descr, "to space object %p has no gc descriptor", obj);
+ SGEN_LOG (9, " (tospace, no change)");
+ HEAVY_STAT (++stat_nursery_copy_object_failed_to_space);
+ return;
+ }
+#endif
+
+ HEAVY_STAT (++stat_objects_copied_nursery);
+
+ copy = copy_object_no_checks (obj, queue);
+ *obj_slot = copy;
+#ifndef SGEN_SIMPLE_NURSERY
+ if (G_UNLIKELY (sgen_ptr_in_nursery (copy) && !sgen_ptr_in_nursery (obj_slot)))
+ sgen_add_to_global_remset (obj_slot);
+#else
+ /* copy_object_no_checks () can return obj on OOM */
+ if (G_UNLIKELY (obj == copy)) {
+ if (G_UNLIKELY (sgen_ptr_in_nursery (copy) && !sgen_ptr_in_nursery (obj_slot)))
+ sgen_add_to_global_remset (obj_slot);
+ }
+#endif
+}
+
+static void
+PARALLEL_COPY_OBJECT (void **obj_slot, SgenGrayQueue *queue)
+{
+ char *obj = *obj_slot;
+ mword vtable_word, objsize;
+ MonoVTable *vt;
+ void *destination;
+ gboolean has_references;
+
+ SGEN_ASSERT (9, current_collection_generation == GENERATION_NURSERY, "calling minor-par-copy from a %d generation collection", current_collection_generation);
+
+ HEAVY_STAT (++stat_copy_object_called_nursery);
+
+ if (!sgen_ptr_in_nursery (obj)) {
+ HEAVY_STAT (++stat_nursery_copy_object_failed_from_space);
+ return;
+ }
+
+ vtable_word = *(mword*)obj;
+ vt = (MonoVTable*)(vtable_word & ~SGEN_VTABLE_BITS_MASK);
+
+ /*
+ * Before we can copy the object we must make sure that we are
+ * allowed to, i.e. that the object not pinned, not already
+ * forwarded and not in the nursery To Space.
+ */
+
+ if (vtable_word & SGEN_FORWARDED_BIT) {
+ HEAVY_STAT (++stat_nursery_copy_object_failed_forwarded);
+ *obj_slot = vt;
+ return;
+ }
+ if (vtable_word & SGEN_PINNED_BIT) {
+ HEAVY_STAT (++stat_nursery_copy_object_failed_pinned);
+ return;
+ }
+
+ if (sgen_nursery_is_to_space (obj)) {
+ HEAVY_STAT (++stat_nursery_copy_object_failed_to_space);
+ return;
+ }
+
+ HEAVY_STAT (++stat_objects_copied_nursery);
+
+ objsize = SGEN_ALIGN_UP (sgen_par_object_get_size (vt, (MonoObject*)obj));
+ has_references = SGEN_VTABLE_HAS_REFERENCES (vt);
+
+ destination = COLLECTOR_PARALLEL_ALLOC_FOR_PROMOTION (obj, objsize, has_references);
+
+ if (G_UNLIKELY (!destination)) {
+ sgen_parallel_pin_or_update (obj_slot, obj, vt, queue);
+ return;
+ }
+
+ *(MonoVTable**)destination = vt;
+
+ if (SGEN_CAS_PTR ((void*)obj, (void*)((mword)destination | SGEN_FORWARDED_BIT), vt) == vt) {
+ par_copy_object_no_checks (destination, vt, obj, objsize, has_references ? queue : NULL);
+ obj = destination;
+ *obj_slot = obj;
+ } else {
+ /* FIXME: unify with code in major_copy_or_mark_object() */
+
+ /* FIXME: Give destination back to the allocator. */
+ /*The major collector only needs the first word zeroed and nursery requires all bits to be. */
+ if (!sgen_ptr_in_nursery (destination))
+ *(void**)destination = NULL;
+ else
+ memset (destination, 0, objsize);
+
+ vtable_word = *(mword*)obj;
+ g_assert (vtable_word & SGEN_FORWARDED_BIT);
+
+ obj = (void*)(vtable_word & ~SGEN_VTABLE_BITS_MASK);
+
+ *obj_slot = obj;
+
+ HEAVY_STAT (++stat_slots_allocated_in_vain);
+ }
+}
+
#define FILL_MINOR_COLLECTOR_COPY_OBJECT(collector) do { \
- (collector)->serial_ops.copy_or_mark_object = serial_copy_object; \
- (collector)->parallel_ops.copy_or_mark_object = parallel_copy_object; \
+ (collector)->serial_ops.copy_or_mark_object = SERIAL_COPY_OBJECT; \
+ (collector)->parallel_ops.copy_or_mark_object = PARALLEL_COPY_OBJECT; \
} while (0)
/*
+ * sgen-minor-scan-object.h: Object scanning in the nursery collectors.
+ *
* Copyright 2001-2003 Ximian, Inc
* Copyright 2003-2010 Novell, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+
extern long long stat_scan_object_called_nursery;
#if defined(SGEN_SIMPLE_NURSERY)
-#define serial_scan_object simple_nursery_serial_scan_object
-#define serial_scan_vtype simple_nursery_serial_scan_vtype
-#define parallel_scan_object simple_nursery_parallel_scan_object
-#define parallel_scan_vtype simple_nursery_parallel_scan_vtype
+#define SERIAL_SCAN_OBJECT simple_nursery_serial_scan_object
+#define SERIAL_SCAN_VTYPE simple_nursery_serial_scan_vtype
+#define PARALLEL_SCAN_OBJECT simple_nursery_parallel_scan_object
+#define PARALLEL_SCAN_VTYPE simple_nursery_parallel_scan_vtype
#elif defined (SGEN_SPLIT_NURSERY)
-#define serial_scan_object split_nursery_serial_scan_object
-#define serial_scan_vtype split_nursery_serial_scan_vtype
-#define parallel_scan_object split_nursery_parallel_scan_object
-#define parallel_scan_vtype split_nursery_parallel_scan_vtype
+#define SERIAL_SCAN_OBJECT split_nursery_serial_scan_object
+#define SERIAL_SCAN_VTYPE split_nursery_serial_scan_vtype
+#define PARALLEL_SCAN_OBJECT split_nursery_parallel_scan_object
+#define PARALLEL_SCAN_VTYPE split_nursery_parallel_scan_vtype
#else
#error "Please define GC_CONF_NAME"
void *__old = *(ptr); \
void *__copy; \
if (__old) { \
- parallel_copy_object ((ptr), queue); \
+ PARALLEL_COPY_OBJECT ((ptr), queue); \
__copy = *(ptr); \
- DEBUG (9, if (__old != __copy) fprintf (gc_debug_file, "Overwrote field at %p with %p (was: %p)\n", (ptr), *(ptr), __old)); \
+ SGEN_COND_LOG (9, __old != __copy, "Overwrote field at %p with %p (was: %p)", (ptr), *(ptr), __old); \
if (G_UNLIKELY (sgen_ptr_in_nursery (__copy) && !sgen_ptr_in_nursery ((ptr)))) \
sgen_add_to_global_remset ((ptr)); \
} \
* them to the gray_objects area.
*/
static void
-parallel_scan_object (char *start, SgenGrayQueue *queue)
+PARALLEL_SCAN_OBJECT (char *start, SgenGrayQueue *queue)
{
#include "sgen-scan-object.h"
* Returns a pointer to the end of the object.
*/
static void
-parallel_scan_vtype (char *start, mword desc, SgenGrayQueue *queue)
+PARALLEL_SCAN_VTYPE (char *start, mword desc, SgenGrayQueue *queue)
{
/* The descriptors include info about the MonoObject header as well */
start -= sizeof (MonoObject);
}
#undef HANDLE_PTR
+/* Global remsets are handled in SERIAL_COPY_OBJECT_FROM_OBJ */
#define HANDLE_PTR(ptr,obj) do { \
void *__old = *(ptr); \
- void *__copy; \
if (__old) { \
- serial_copy_object ((ptr), queue); \
- __copy = *(ptr); \
- DEBUG (9, if (__old != __copy) fprintf (gc_debug_file, "Overwrote field at %p with %p (was: %p)\n", (ptr), *(ptr), __old)); \
- if (G_UNLIKELY (sgen_ptr_in_nursery (__copy) && !sgen_ptr_in_nursery ((ptr)))) \
- sgen_add_to_global_remset ((ptr)); \
+ SERIAL_COPY_OBJECT_FROM_OBJ ((ptr), queue); \
+ SGEN_COND_LOG (9, __old != *(ptr), "Overwrote field at %p with %p (was: %p)", (ptr), *(ptr), __old); \
} \
} while (0)
static void
-serial_scan_object (char *start, SgenGrayQueue *queue)
+SERIAL_SCAN_OBJECT (char *start, SgenGrayQueue *queue)
{
#include "sgen-scan-object.h"
}
static void
-serial_scan_vtype (char *start, mword desc, SgenGrayQueue *queue)
+SERIAL_SCAN_VTYPE (char *start, mword desc, SgenGrayQueue *queue)
{
/* The descriptors include info about the MonoObject header as well */
start -= sizeof (MonoObject);
}
#define FILL_MINOR_COLLECTOR_SCAN_OBJECT(collector) do { \
- (collector)->parallel_ops.scan_object = parallel_scan_object; \
- (collector)->parallel_ops.scan_vtype = parallel_scan_vtype; \
- (collector)->serial_ops.scan_object = serial_scan_object; \
- (collector)->serial_ops.scan_vtype = serial_scan_vtype; \
+ (collector)->parallel_ops.scan_object = PARALLEL_SCAN_OBJECT; \
+ (collector)->parallel_ops.scan_vtype = PARALLEL_SCAN_VTYPE; \
+ (collector)->serial_ops.scan_object = SERIAL_SCAN_OBJECT; \
+ (collector)->serial_ops.scan_vtype = SERIAL_SCAN_VTYPE; \
} while (0)
/*
* sgen-nursery-allocator.c: Nursery allocation code.
*
- *
* Copyright 2009-2010 Novell, Inc.
* 2011 Rodrigo Kumpera
*
* Copyright 2011 Xamarin Inc (http://www.xamarin.com)
+ * Copyright (C) 2012 Xamarin Inc
*
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
*
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
SgenFragment *frag;
for (frag = unmask (allocator->alloc_head); frag; frag = unmask (frag->next)) {
- DEBUG (4, fprintf (gc_debug_file, "Clear nursery frag %p-%p\n", frag->fragment_next, frag->fragment_end));
+ SGEN_LOG (4, "Clear nursery frag %p-%p", frag->fragment_next, frag->fragment_end);
sgen_clear_range (frag->fragment_next, frag->fragment_end);
#ifdef NALLOC_DEBUG
add_alloc_record (frag->fragment_next, frag->fragment_end - frag->fragment_next, CLEAR_NURSERY_FRAGS);
static void
add_nursery_frag (SgenFragmentAllocator *allocator, size_t frag_size, char* frag_start, char* frag_end)
{
- DEBUG (4, fprintf (gc_debug_file, "Found empty fragment: %p-%p, size: %zd\n", frag_start, frag_end, frag_size));
+ SGEN_LOG (4, "Found empty fragment: %p-%p, size: %zd", frag_start, frag_end, frag_size);
binary_protocol_empty (frag_start, frag_size);
MONO_GC_NURSERY_SWEPT ((mword)frag_start, frag_end - frag_start);
/* Not worth dealing with smaller fragments: need to tune */
sgen_minor_collector.build_fragments_finish (&mutator_allocator);
if (!unmask (mutator_allocator.alloc_head)) {
- DEBUG (1, fprintf (gc_debug_file, "Nursery fully pinned (%d)\n", num_entries));
+ SGEN_LOG (1, "Nursery fully pinned (%d)", num_entries);
for (i = 0; i < num_entries; ++i) {
- DEBUG (3, fprintf (gc_debug_file, "Bastard pinning obj %p (%s), size: %d\n", start [i], sgen_safe_name (start [i]), sgen_safe_object_get_size (start [i])));
+ SGEN_LOG (3, "Bastard pinning obj %p (%s), size: %d", start [i], sgen_safe_name (start [i]), sgen_safe_object_get_size (start [i]));
}
}
return fragment_total;
void*
sgen_nursery_alloc (size_t size)
{
- DEBUG (4, fprintf (gc_debug_file, "Searching nursery for size: %zd\n", size));
+ SGEN_LOG (4, "Searching nursery for size: %zd", size);
size = SGEN_ALIGN_UP (size);
HEAVY_STAT (InterlockedIncrement (&stat_nursery_alloc_requests));
void*
sgen_nursery_alloc_range (size_t desired_size, size_t minimum_size, size_t *out_alloc_size)
{
- DEBUG (4, fprintf (gc_debug_file, "Searching for byte range desired size: %zd minimum size %zd\n", desired_size, minimum_size));
+ SGEN_LOG (4, "Searching for byte range desired size: %zd minimum size %zd", desired_size, minimum_size);
HEAVY_STAT (InterlockedIncrement (&stat_nursery_alloc_range_requests));
/*
- * sgen-os-mach.c: Simple generational GC.
+ * sgen-os-mach.c: Mach-OS support.
*
* Author:
* Paolo Molaro (lupus@ximian.com)
* Geoff Norton (gnorton@novell.com)
*
* Copyright 2010 Novell, Inc (http://www.novell.com)
+ * Copyright (C) 2012 Xamarin Inc
*
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "config.h"
ctx.uc_mcontext = mctx;
info->stopped_domain = mono_mach_arch_get_tls_value_from_thread (
- mono_thread_info_get_tid (info), mono_domain_get_tls_offset ());
+ mono_thread_info_get_tid (info), mono_domain_get_tls_key ());
info->stopped_ip = (gpointer) mono_mach_arch_get_ip (state);
info->stack_start = NULL;
stack_start = (char*) mono_mach_arch_get_sp (state) - REDZONE_SIZE;
if (mono_gc_get_gc_callbacks ()->thread_suspend_func)
mono_gc_get_gc_callbacks ()->thread_suspend_func (info->runtime_data, &ctx, NULL);
- DEBUG (1, fprintf (gc_debug_file, "thread %p stopped at %p stack_start=%p\n", (void*)info->info.native_handle, info->stopped_ip, info->stack_start));
+ SGEN_LOG (2, "thread %p stopped at %p stack_start=%p", (void*)info->info.native_handle, info->stopped_ip, info->stack_start);
binary_protocol_thread_suspend ((gpointer)mono_thread_info_get_tid (info), info->stopped_ip);
/*
- * sgen-os-posix.c: Simple generational GC.
+ * sgen-os-posix.c: Posix support.
*
* Author:
* Paolo Molaro (lupus@ximian.com)
* Geoff Norton (gnorton@novell.com)
*
* Copyright 2010 Novell, Inc (http://www.novell.com)
+ * Copyright (C) 2012 Xamarin Inc
*
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "config.h"
if (mono_gc_get_gc_callbacks ()->thread_suspend_func)
mono_gc_get_gc_callbacks ()->thread_suspend_func (info->runtime_data, context, NULL);
- DEBUG (4, fprintf (gc_debug_file, "Posting suspend_ack_semaphore for suspend from %p %p\n", info, (gpointer)mono_native_thread_id_get ()));
+ SGEN_LOG (4, "Posting suspend_ack_semaphore for suspend from %p %p", info, (gpointer)mono_native_thread_id_get ());
/*
Block the restart signal.
/* Unblock the restart signal. */
pthread_sigmask (SIG_UNBLOCK, &suspend_ack_signal_mask, NULL);
- DEBUG (4, fprintf (gc_debug_file, "Posting suspend_ack_semaphore for resume from %p %p\n", info, (gpointer)mono_native_thread_id_get ()));
+ SGEN_LOG (4, "Posting suspend_ack_semaphore for resume from %p %p\n", info, (gpointer)mono_native_thread_id_get ());
/* notify the waiting thread */
MONO_SEM_POST (suspend_ack_semaphore_ptr);
}
*/
if (info) {
info->signal = restart_signal_num;
- DEBUG (4, fprintf (gc_debug_file, "Restart handler in %p %p\n", info, (gpointer)mono_native_thread_id_get ()));
+ SGEN_LOG (4, "Restart handler in %p %p", info, (gpointer)mono_native_thread_id_get ());
}
errno = old_errno;
}
/*
- * sgen-pinned-allocator.c: Simple generational GC.
+ * sgen-pinned-allocator.c: Allocator for small pinned objects.
+ * Only used in the copying major collector.
*
* Author:
* Paolo Molaro (lupus@ximian.com)
* Copyright (c) 1996 by Silicon Graphics. All rights reserved.
* Copyright (c) 1998 by Fergus Henderson. All rights reserved.
* Copyright (c) 2000-2004 by Hewlett-Packard Company. All rights reserved.
+ * Copyright 2001-2003 Ximian, Inc
+ * Copyright 2003-2010 Novell, Inc.
+ * Copyright (C) 2012 Xamarin Inc
*
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program
- * for any purpose, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
*
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
*
- * Copyright 2001-2003 Ximian, Inc
- * Copyright 2003-2010 Novell, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "config.h"
chunk->page_sizes [0] = PINNED_FIRST_SLOT_SIZE;
build_freelist (alc, chunk, slot_for_size (PINNED_FIRST_SLOT_SIZE), PINNED_FIRST_SLOT_SIZE,
chunk->start_data, ((char*)chunk + FREELIST_PAGESIZE));
- sgen_debug_printf (4, "Allocated pinned chunk %p, size: %d\n", chunk, size);
+ SGEN_LOG (4, "Allocated pinned chunk %p, size: %d", chunk, size);
chunk->block.next = alc->chunk_list;
alc->chunk_list = chunk;
void *end_chunk;
for (chunk = alc->chunk_list; chunk; chunk = chunk->block.next) {
end_chunk = (char*)chunk + chunk->num_pages * FREELIST_PAGESIZE;
- sgen_debug_printf (6, "Scanning pinned chunk %p (range: %p-%p)\n", chunk, chunk->start_data, end_chunk);
+ SGEN_LOG (6, "Scanning pinned chunk %p (range: %p-%p)", chunk, chunk->start_data, end_chunk);
for (i = 0; i < chunk->num_pages; ++i) {
obj_size = chunk->page_sizes [i];
if (!obj_size)
continue;
p = i? (char*)chunk + i * FREELIST_PAGESIZE: chunk->start_data;
endp = i? p + FREELIST_PAGESIZE: (char*)chunk + FREELIST_PAGESIZE;
- sgen_debug_printf (6, "Page %d (size: %d, range: %p-%p)\n", i, obj_size, p, endp);
+ SGEN_LOG (6, "Page %d (size: %d, range: %p-%p)", i, obj_size, p, endp);
while (p + obj_size <= endp) {
ptr = (void**)p;
/* if the first word (the vtable) is outside the chunk we have an object */
SgenPinnedChunk *chunk;
/* look for pinned addresses for pinned-alloc objects */
- sgen_debug_printf (6, "Pinning from pinned-alloc objects\n");
+ SGEN_LOG (6, "Pinning from pinned-alloc objects");
for (chunk = alc->chunk_list; chunk; chunk = chunk->block.next) {
int num_pinned;
void **pinned = sgen_find_optimized_pin_queue_area (chunk->start_data,
/*
+ * sgen-pinning.c: The pin queue.
+ *
* Copyright 2001-2003 Ximian, Inc
* Copyright 2003-2010 Novell, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "config.h"
sgen_free_internal_dynamic (pin_queue, sizeof (void*) * pin_queue_size, INTERNAL_MEM_PIN_QUEUE);
pin_queue = new_pin;
pin_queue_size = new_size;
- DEBUG (4, fprintf (gc_debug_file, "Reallocated pin queue to size: %d\n", new_size));
+ SGEN_LOG (4, "Reallocated pin queue to size: %d", new_size);
}
void
void
sgen_find_section_pin_queue_start_end (GCMemSection *section)
{
- DEBUG (6, fprintf (gc_debug_file, "Pinning from section %p (%p-%p)\n", section, section->data, section->end_data));
+ SGEN_LOG (6, "Pinning from section %p (%p-%p)", section, section->data, section->end_data);
section->pin_queue_start = sgen_find_optimized_pin_queue_area (section->data, section->end_data, §ion->pin_queue_num_entries);
- DEBUG (6, fprintf (gc_debug_file, "Found %d pinning addresses in section %p\n", section->pin_queue_num_entries, section));
+ SGEN_LOG (6, "Found %d pinning addresses in section %p", section->pin_queue_num_entries, section);
}
/*This will setup the given section for the while pin queue. */
}
}
-static G_GNUC_UNUSED void
-print_nursery_gaps (void* start_nursery, void *end_nursery)
-{
- int i;
- gpointer first = start_nursery;
- gpointer next;
- for (i = 0; i < next_pin_slot; ++i) {
- next = pin_queue [i];
- fprintf (gc_debug_file, "Nursery range: %p-%p, size: %td\n", first, next, (char*)next-(char*)first);
- first = next;
- }
- next = end_nursery;
- fprintf (gc_debug_file, "Nursery range: %p-%p, size: %td\n", first, next, (char*)next-(char*)first);
-}
-
/* reduce the info in the pin queue, removing duplicate pointers and sorting them */
void
sgen_optimize_pin_queue (int start_slot)
void **start, **cur, **end;
/* sort and uniq pin_queue: we just sort and we let the rest discard multiple values */
/* it may be better to keep ranges of pinned memory instead of individually pinning objects */
- DEBUG (5, fprintf (gc_debug_file, "Sorting pin queue, size: %d\n", next_pin_slot));
+ SGEN_LOG (5, "Sorting pin queue, size: %d", next_pin_slot);
if ((next_pin_slot - start_slot) > 1)
sgen_sort_addresses (pin_queue + start_slot, next_pin_slot - start_slot);
start = cur = pin_queue + start_slot;
start++;
};
next_pin_slot = start - pin_queue;
- DEBUG (5, fprintf (gc_debug_file, "Pin queue reduced to size: %d\n", next_pin_slot));
- //DEBUG (6, print_nursery_gaps (start_nursery, end_nursery));
+ SGEN_LOG (5, "Pin queue reduced to size: %d", next_pin_slot);
}
int
int i;
for (i = 0; i < last_num_pinned; ++i) {
- DEBUG (3, fprintf (gc_debug_file, "Bastard pinning obj %p (%s), size: %d\n", pin_queue [i], sgen_safe_name (pin_queue [i]), sgen_safe_object_get_size (pin_queue [i])));
+ SGEN_LOG (3, "Bastard pinning obj %p (%s), size: %d", pin_queue [i], sgen_safe_name (pin_queue [i]), sgen_safe_object_get_size (pin_queue [i]));
}
}
/*
* sgen-simple-nursery.c: Simple always promote nursery.
*
- *
- * SGen is licensed under the terms of the MIT X11 license
- *
* Copyright 2001-2003 Ximian, Inc
* Copyright 2003-2010 Novell, Inc.
* Copyright 2011 Xamarin Inc (http://www.xamarin.com)
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "config.h"
#define SGEN_SIMPLE_NURSERY
+#define SERIAL_COPY_OBJECT simple_nursery_serial_copy_object
+#define PARALLEL_COPY_OBJECT simple_nursery_parallel_copy_object
+#define SERIAL_COPY_OBJECT_FROM_OBJ simple_nursery_serial_copy_object_from_obj
+
#include "sgen-minor-copy-object.h"
#include "sgen-minor-scan-object.h"
* Author:
* Rodrigo Kumpera Kumpera <kumpera@gmail.com>
*
- * SGen is licensed under the terms of the MIT X11 license
- *
* Copyright 2001-2003 Ximian, Inc
* Copyright 2003-2010 Novell, Inc.
* Copyright 2011-2012 Xamarin Inc (http://www.xamarin.com)
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "config.h"
#define SGEN_SPLIT_NURSERY
+#define SERIAL_COPY_OBJECT split_nursery_serial_copy_object
+#define PARALLEL_COPY_OBJECT split_nursery_parallel_copy_object
+#define SERIAL_COPY_OBJECT_FROM_OBJ split_nursery_serial_copy_object_from_obj
+
#include "sgen-minor-copy-object.h"
#include "sgen-minor-scan-object.h"
-
void
sgen_split_nursery_init (SgenMinorCollector *collector)
{
/*
- * sgen-cardtable.c: Card table implementation for sgen
+ * sgen-ssb.c: Remembered sets - sequential store buffer
*
* Author:
* Rodrigo Kumpera (rkumpera@novell.com)
*
- * SGen is licensed under the terms of the MIT X11 license
- *
* Copyright 2001-2003 Ximian, Inc
* Copyright 2003-2010 Novell, Inc.
* Copyright 2011 Xamarin Inc (http://www.xamarin.com)
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "config.h"
#include "metadata/sgen-protocol.h"
#include "utils/mono-counters.h"
+#ifndef DISABLE_SGEN_REMSET
+
/*A two slots cache for recently inserted remsets */
static gpointer global_remset_cache [2];
res->store_next = res->data;
res->end_set = res->data + size;
res->next = NULL;
- DEBUG (4, fprintf (gc_debug_file, "Allocated%s remset size %d at %p for %p\n", global ? " global" : "", size, res->data, id));
+ SGEN_LOG (4, "Allocated%s remset size %d at %p for %p", global ? " global" : "", size, res->data, id);
return res;
}
mono_gc_memmove (dest_ptr, src_ptr, count * sizeof (gpointer));
rs = REMEMBERED_SET;
- DEBUG (8, fprintf (gc_debug_file, "Adding remset at %p, %d\n", dest_ptr, count));
+ SGEN_LOG (8, "Adding remset at %p, %d", dest_ptr, count);
if (rs->store_next + 1 < rs->end_set) {
*(rs->store_next++) = (mword)dest_ptr | REMSET_RANGE;
*(rs->store_next++) = count;
size = mono_object_class (obj)->instance_size;
rs = REMEMBERED_SET;
- DEBUG (6, fprintf (gc_debug_file, "Adding object remset for %p\n", obj));
+ SGEN_LOG (6, "Adding object remset for %p", obj);
LOCK_GC;
/* do not copy the sync state */
gpointer old = *ptr;
sgen_get_current_object_ops ()->copy_or_mark_object (ptr, queue);
- DEBUG (9, fprintf (gc_debug_file, "Overwrote remset at %p with %p\n", ptr, *ptr));
+ SGEN_LOG (9, "Overwrote remset at %p with %p", ptr, *ptr);
if (old)
binary_protocol_ptr_update (ptr, old, *ptr, (gpointer)SGEN_LOAD_VTABLE (*ptr), sgen_safe_object_get_size (*ptr));
if (!global && *ptr >= start_nursery && *ptr < end_nursery) {
* If the object is pinned, each reference to it from nonpinned objects
* becomes part of the global remset, which can grow very large.
*/
- DEBUG (9, fprintf (gc_debug_file, "Add to global remset because of pinning %p (%p %s)\n", ptr, *ptr, sgen_safe_name (*ptr)));
+ SGEN_LOG (9, "Add to global remset because of pinning %p (%p %s)", ptr, *ptr, sgen_safe_name (*ptr));
sgen_add_to_global_remset (ptr);
}
} else {
- DEBUG (9, fprintf (gc_debug_file, "Skipping remset at %p holding %p\n", ptr, *ptr));
+ SGEN_LOG (9, "Skipping remset at %p holding %p", ptr, *ptr);
}
return p + 1;
case REMSET_RANGE: {
count = p [1];
while (count-- > 0) {
copy_func (ptr, queue);
- DEBUG (9, fprintf (gc_debug_file, "Overwrote remset at %p with %p (count: %d)\n", ptr, *ptr, (int)count));
+ SGEN_LOG (9, "Overwrote remset at %p with %p (count: %d)", ptr, *ptr, (int)count);
if (!global && *ptr >= start_nursery && *ptr < end_nursery)
sgen_add_to_global_remset (ptr);
++ptr;
/* the global one */
for (remset = global_remset; remset; remset = remset->next) {
- DEBUG (4, fprintf (gc_debug_file, "Scanning global remset range: %p-%p, size: %td\n", remset->data, remset->store_next, remset->store_next - remset->data));
+ SGEN_LOG (4, "Scanning global remset range: %p-%p, size: %td", remset->data, remset->store_next, remset->store_next - remset->data);
store_pos = remset->data;
for (p = remset->data; p < remset->store_next; p = next_p) {
void **ptr = (void**)p [0];
RememberedSet *next;
int j;
for (remset = info->remset; remset; remset = next) {
- DEBUG (4, fprintf (gc_debug_file, "Scanning remset for thread %p, range: %p-%p, size: %td\n", info, remset->data, remset->store_next, remset->store_next - remset->data));
+ SGEN_LOG (4, "Scanning remset for thread %p, range: %p-%p, size: %td", info, remset->data, remset->store_next, remset->store_next - remset->data);
for (p = remset->data; p < remset->store_next;)
p = handle_remset (p, start_nursery, end_nursery, FALSE, queue);
remset->store_next = remset->data;
next = remset->next;
remset->next = NULL;
if (remset != info->remset) {
- DEBUG (4, fprintf (gc_debug_file, "Freed remset at %p\n", remset->data));
+ SGEN_LOG (4, "Freed remset at %p", remset->data);
sgen_free_internal_dynamic (remset, remset_byte_size (remset), INTERNAL_MEM_REMSET);
}
}
while (freed_thread_remsets) {
RememberedSet *next;
remset = freed_thread_remsets;
- DEBUG (4, fprintf (gc_debug_file, "Scanning remset for freed thread, range: %p-%p, size: %td\n", remset->data, remset->store_next, remset->store_next - remset->data));
+ SGEN_LOG (4, "Scanning remset for freed thread, range: %p-%p, size: %td", remset->data, remset->store_next, remset->store_next - remset->data);
for (p = remset->data; p < remset->store_next;)
p = handle_remset (p, start_nursery, end_nursery, FALSE, queue);
next = remset->next;
- DEBUG (4, fprintf (gc_debug_file, "Freed remset at %p\n", remset->data));
+ SGEN_LOG (4, "Freed remset at %p", remset->data);
sgen_free_internal_dynamic (remset, remset_byte_size (remset), INTERNAL_MEM_REMSET);
freed_thread_remsets = next;
}
next = remset->next;
remset->next = NULL;
if (remset != global_remset) {
- DEBUG (4, fprintf (gc_debug_file, "Freed remset at %p\n", remset->data));
+ SGEN_LOG (4, "Freed remset at %p", remset->data);
sgen_free_internal_dynamic (remset, remset_byte_size (remset), INTERNAL_MEM_REMSET);
}
}
next = remset->next;
remset->next = NULL;
if (remset != info->remset) {
- DEBUG (3, fprintf (gc_debug_file, "Freed remset at %p\n", remset->data));
+ SGEN_LOG (3, "Freed remset at %p", remset->data);
sgen_free_internal_dynamic (remset, remset_byte_size (remset), INTERNAL_MEM_REMSET);
}
}
/* the freed thread ones */
while (freed_thread_remsets) {
next = freed_thread_remsets->next;
- DEBUG (4, fprintf (gc_debug_file, "Freed remset at %p\n", freed_thread_remsets->data));
+ SGEN_LOG (4, "Freed remset at %p", freed_thread_remsets->data);
sgen_free_internal_dynamic (freed_thread_remsets, remset_byte_size (freed_thread_remsets), INTERNAL_MEM_REMSET);
freed_thread_remsets = next;
}
if (G_UNLIKELY (do_pin_stats))
sgen_pin_stats_register_global_remset (obj);
- DEBUG (8, fprintf (gc_debug_file, "Adding global remset for %p\n", ptr));
+ SGEN_LOG (8, "Adding global remset for %p", ptr);
binary_protocol_global_remset (ptr, *(gpointer*)ptr, (gpointer)SGEN_LOAD_VTABLE (obj));
HEAVY_STAT (++stat_global_remsets_added);
global_remset = rs;
*(global_remset->store_next++) = (mword)ptr;
+#if SGEN_MAX_DEBUG_LEVEL >= 4
{
int global_rs_size = 0;
for (rs = global_remset; rs; rs = rs->next) {
global_rs_size += rs->store_next - rs->data;
}
- DEBUG (4, fprintf (gc_debug_file, "Global remset now has size %d\n", global_rs_size));
+ SGEN_LOG (4, "Global remset now has size %d", global_rs_size);
}
+#endif
done:
if (lock)
/* the global one */
for (remset = global_remset; remset; remset = remset->next) {
- DEBUG (4, fprintf (gc_debug_file, "Scanning global remset range: %p-%p, size: %td\n", remset->data, remset->store_next, remset->store_next - remset->data));
+ SGEN_LOG (4, "Scanning global remset range: %p-%p, size: %td", remset->data, remset->store_next, remset->store_next - remset->data);
for (p = remset->data; p < remset->store_next;) {
p = find_in_remset_loc (p, addr, &found);
if (found)
FOREACH_THREAD (info) {
int j;
for (remset = info->remset; remset; remset = remset->next) {
- DEBUG (4, fprintf (gc_debug_file, "Scanning remset for thread %p, range: %p-%p, size: %td\n", info, remset->data, remset->store_next, remset->store_next - remset->data));
+ SGEN_LOG (4, "Scanning remset for thread %p, range: %p-%p, size: %td", info, remset->data, remset->store_next, remset->store_next - remset->data);
for (p = remset->data; p < remset->store_next;) {
p = find_in_remset_loc (p, addr, &found);
if (found)
/* the freed thread ones */
for (remset = freed_thread_remsets; remset; remset = remset->next) {
- DEBUG (4, fprintf (gc_debug_file, "Scanning remset for freed thread, range: %p-%p, size: %td\n", remset->data, remset->store_next, remset->store_next - remset->data));
+ SGEN_LOG (4, "Scanning remset for freed thread, range: %p-%p, size: %td", remset->data, remset->store_next, remset->store_next - remset->data);
for (p = remset->data; p < remset->store_next;) {
p = find_in_remset_loc (p, addr, &found);
if (found)
return FALSE;
}
-
void
sgen_ssb_init (SgenRemeberedSet *remset)
{
remset->find_address = sgen_ssb_find_address;
}
-#endif
+
+#else
+
+void
+sgen_ssb_init (SgenRemeberedSet *remset)
+{
+ fprintf (stderr, "Error: Mono was configured using --enable-minimal=sgen_wbarrier.\n");
+ exit (1);
+}
+
+#endif /* DISABLE_SGEN_REMSET */
+
+#endif /* HAVE_SGEN_GC */
* Copyright 2005-2011 Novell, Inc (http://www.novell.com)
* Copyright 2011 Xamarin Inc (http://www.xamarin.com)
* Copyright 2011 Xamarin, Inc.
+ * Copyright (C) 2012 Xamarin Inc
*
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "config.h"
if (!info->thread_is_dying && (!info->stack_start || info->in_critical_region ||
is_ip_in_managed_allocator (info->stopped_domain, info->stopped_ip))) {
binary_protocol_thread_restart ((gpointer)mono_thread_info_get_tid (info));
- DEBUG (3, fprintf (gc_debug_file, "thread %p resumed.\n", (void*)info->info.native_handle));
+ SGEN_LOG (3, "thread %p resumed.", (void*)info->info.native_handle);
result = sgen_resume_thread (info);
if (result) {
++restart_count;
update_current_thread_stack (&count);
sgen_global_stop_count++;
- DEBUG (3, fprintf (gc_debug_file, "stopping world n %d from %p %p\n", sgen_global_stop_count, mono_thread_info_current (), (gpointer)mono_native_thread_id_get ()));
+ SGEN_LOG (3, "stopping world n %d from %p %p", sgen_global_stop_count, mono_thread_info_current (), (gpointer)mono_native_thread_id_get ());
TV_GETTIME (stop_world_time);
count = sgen_thread_handshake (TRUE);
dead = restart_threads_until_none_in_managed_allocator ();
g_error ("More threads have died (%d) that been initialy suspended %d", dead, count);
count -= dead;
- DEBUG (3, fprintf (gc_debug_file, "world stopped %d thread(s)\n", count));
+ SGEN_LOG (3, "world stopped %d thread(s)", count);
mono_profiler_gc_event (MONO_GC_EVENT_POST_STOP_WORLD, generation);
sgen_memgov_collection_start (generation);
TV_GETTIME (end_sw);
usec = TV_ELAPSED (stop_world_time, end_sw);
max_pause_usec = MAX (usec, max_pause_usec);
- DEBUG (2, fprintf (gc_debug_file, "restarted %d thread(s) (pause time: %d usec, max: %d)\n", count, (int)usec, (int)max_pause_usec));
+ SGEN_LOG (2, "restarted %d thread(s) (pause time: %d usec, max: %d)", count, (int)usec, (int)max_pause_usec);
mono_profiler_gc_event (MONO_GC_EVENT_POST_START_WORLD, generation);
bridge_process (generation);
/*
- *
* sgen-toggleref.c: toggleref support for sgen
*
- * Copyright 2011 Xamarin, Inc.
- *
* Author:
* Rodrigo Kumpera (kumpera@gmail.com)
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Copyright 2011 Xamarin, Inc.
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
#include "config.h"
#ifdef HAVE_SGEN_GC
int i, w;
int toggle_ref_counts [3] = { 0, 0, 0 };
- DEBUG (4, fprintf (gc_debug_file, "Proccessing ToggleRefs %d\n", toggleref_array_size));
+ SGEN_LOG (4, "Proccessing ToggleRefs %d", toggleref_array_size);
for (i = w = 0; i < toggleref_array_size; ++i) {
int res;
toggleref_array_size = w;
- DEBUG (4, fprintf (gc_debug_file, "Done Proccessing ToggleRefs dropped %d strong %d weak %d final size %d\n",
+ SGEN_LOG (4, "Done Proccessing ToggleRefs dropped %d strong %d weak %d final size %d",
toggle_ref_counts [MONO_TOGGLE_REF_DROP],
toggle_ref_counts [MONO_TOGGLE_REF_STRONG],
toggle_ref_counts [MONO_TOGGLE_REF_WEAK],
- w));
+ w);
}
void
{
int i;
- DEBUG (4, fprintf (gc_debug_file, "Scanning ToggleRefs %d\n", toggleref_array_size));
+ SGEN_LOG (4, "Scanning ToggleRefs %d", toggleref_array_size);
for (i = 0; i < toggleref_array_size; ++i) {
if (toggleref_array [i].strong_ref) {
char *object = toggleref_array [i].strong_ref;
if (object >= start && object < end) {
- DEBUG (6, fprintf (gc_debug_file, "\tcopying strong slot %d\n", i));
+ SGEN_LOG (6, "\tcopying strong slot %d", i);
copy_func (&toggleref_array [i].strong_ref, queue);
}
} else if (toggleref_array [i].weak_ref) {
if (object >= start && object < end) {
if (sgen_gc_is_object_ready_for_finalization (object)) {
- DEBUG (6, fprintf (gc_debug_file, "\tcleaning weak slot %d\n", i));
+ SGEN_LOG (6, "\tcleaning weak slot %d", i);
toggleref_array [i].weak_ref = NULL; /* We defer compaction to only happen on the callback step. */
} else {
- DEBUG (6, fprintf (gc_debug_file, "\tkeeping weak slot %d\n", i));
+ SGEN_LOG (6, "\tkeeping weak slot %d", i);
copy_func (&toggleref_array [i].weak_ref, queue);
}
}
if (!toggleref_callback)
return;
- DEBUG (4, fprintf (gc_debug_file, "Adding toggleref %p %d\n", object, strong_ref));
+ SGEN_LOG (4, "Adding toggleref %p %d", object, strong_ref);
sgen_gc_lock ();
#include <mono/metadata/threadpool-internals.h>
#include <mono/metadata/domain-internals.h>
#include <mono/utils/mono-threads.h>
+#include <mono/utils/mono-memory-model.h>
#include <time.h>
#ifdef HAVE_SYS_TIME_H
static MonoImage *get_socket_assembly (void)
{
- static const char *version = NULL;
- static gboolean moonlight;
MonoDomain *domain = mono_domain_get ();
- if (version == NULL) {
- version = mono_get_runtime_info ()->framework_version;
- moonlight = !strcmp (version, "2.1");
- }
-
if (domain->socket_assembly == NULL) {
MonoImage *socket_assembly;
- if (moonlight) {
- socket_assembly = mono_image_loaded ("System.Net");
- if (!socket_assembly) {
- MonoAssembly *sa = mono_assembly_open ("System.Net.dll", NULL);
-
- if (!sa) {
- g_assert_not_reached ();
- } else {
- socket_assembly = mono_assembly_get_image (sa);
- }
- }
- } else {
- socket_assembly = mono_image_loaded ("System");
- if (!socket_assembly) {
- MonoAssembly *sa = mono_assembly_open ("System.dll", NULL);
-
- if (!sa) {
- g_assert_not_reached ();
- } else {
- socket_assembly = mono_assembly_get_image (sa);
- }
+ socket_assembly = mono_image_loaded ("System");
+ if (!socket_assembly) {
+ MonoAssembly *sa = mono_assembly_open ("System.dll", NULL);
+
+ if (!sa) {
+ g_assert_not_reached ();
+ } else {
+ socket_assembly = mono_assembly_get_image (sa);
}
}
-
- domain->socket_assembly = socket_assembly;
+ mono_atomic_store_release (&domain->socket_assembly, socket_assembly);
}
return domain->socket_assembly;
g_assert (domain->sockaddr_data_field);
}
- /* Make sure there is space for the family and size bytes */
-#ifdef HAVE_SYS_UN_H
- if (saddr->sa_family == AF_UNIX) {
- /* sa_len includes the entire sockaddr size, so we don't need the
- * N bytes (sizeof (unsigned short)) of the family. */
- data=mono_array_new_cached(domain, mono_get_byte_class (), sa_size);
- } else
-#endif
- {
- /* May be the +2 here is too conservative, as sa_len returns
- * the length of the entire sockaddr_in/in6, including
- * sizeof (unsigned short) of the family */
- data=mono_array_new_cached(domain, mono_get_byte_class (), sa_size+2);
- }
+ /* May be the +2 here is too conservative, as sa_len returns
+ * the length of the entire sockaddr_in/in6, including
+ * sizeof (unsigned short) of the family */
+ /* We can't really avoid the +2 as all code below depends on this size - INCLUDING unix domain sockets.*/
+ data=mono_array_new_cached(domain, mono_get_byte_class (), sa_size+2);
/* The data buffer is laid out as follows:
* bytes 0 and 1 are the address family
#include <mono/metadata/tpool-poll.c>
#ifdef HAVE_EPOLL
#include <mono/metadata/tpool-epoll.c>
-#elif defined(HAVE_KQUEUE)
+#elif defined(USE_KQUEUE_FOR_THREADPOOL)
#include <mono/metadata/tpool-kqueue.c>
#endif
/*
/*
* Note that we call it is_socket_type() where 'socket' refers to the image
* that contains the System.Net.Sockets.Socket type.
- * For moonlight there is a System.Net.Sockets.Socket class in both System.dll and System.Net.dll.
*/
static gboolean
is_socket_type (MonoDomain *domain, MonoClass *klass)
{
- static const char *version = NULL;
- static gboolean moonlight;
-
- if (is_system_type (domain, klass))
- return TRUE;
-
- /* If moonlight, check if the type is in System.Net.dll too */
- if (version == NULL) {
- version = mono_get_runtime_info ()->framework_version;
- moonlight = !strcmp (version, "2.1");
- }
-
- if (!moonlight)
- return FALSE;
-
- if (domain->system_net_dll == NULL)
- domain->system_net_dll = mono_image_loaded ("System.Net");
-
- return klass->image == domain->system_net_dll;
+ return is_system_type (domain, klass);
}
#define check_type_cached(domain, ASSEMBLY, _class, _namespace, _name, loc) do { \
data->event_system = POLL_BACKEND;
}
}
-#elif defined(HAVE_KQUEUE)
+#elif defined(USE_KQUEUE_FOR_THREADPOOL)
if (data->event_system == KQUEUE_BACKEND)
data->event_data = tp_kqueue_init (data);
#endif
data->sock_to_state = mono_g_hash_table_new_type (g_direct_hash, g_direct_equal, MONO_HASH_VALUE_GC);
#ifdef HAVE_EPOLL
data->event_system = EPOLL_BACKEND;
-#elif defined(HAVE_KQUEUE)
+#elif defined(USE_KQUEUE_FOR_THREADPOOL)
data->event_system = KQUEUE_BACKEND;
#else
data->event_system = POLL_BACKEND;
if (InterlockedCompareExchange (&tp->nthreads, n + 1, n) == n)
break;
}
+#ifndef DISABLE_PERFCOUNTERS
mono_perfcounter_update_value (tp->pc_nthreads, TRUE, 1);
+#endif
mono_thread_create_internal (mono_get_root_domain (), tp->async_invoke, tp, TRUE, stack_size);
SleepEx (100, TRUE);
} while (1);
MONO_SEM_INIT (&tp->new_job, 0);
}
+#ifndef DISABLE_PERFCOUNTERS
static void *
init_perf_counter (const char *category, const char *counter)
{
machine = mono_string_new (root, ".");
return mono_perfcounter_get_impl (category_str, counter_str, NULL, machine, &type, &custom);
}
+#endif
#ifdef DEBUG
static void
wsqs = g_ptr_array_sized_new (MAX (100 * cpu_count, thread_count));
mono_wsq_init ();
+#ifndef DISABLE_PERFCOUNTERS
async_tp.pc_nitems = init_perf_counter ("Mono Threadpool", "Work Items Added");
g_assert (async_tp.pc_nitems);
async_io_tp.pc_nthreads = init_perf_counter ("Mono Threadpool", "# of IO Threads");
g_assert (async_io_tp.pc_nthreads);
+#endif
tp_inited = 2;
#ifdef DEBUG
signal (SIGALRM, signal_handler);
stack_size = (!tp->is_io) ? 0 : SMALL_STACK;
while (!mono_runtime_is_shutting_down () && (n = tp->nthreads) < tp->max_threads) {
if (InterlockedCompareExchange (&tp->nthreads, n + 1, n) == n) {
+#ifndef DISABLE_PERFCOUNTERS
mono_perfcounter_update_value (tp->pc_nthreads, TRUE, 1);
+#endif
mono_thread_create_internal (mono_get_root_domain (), tp->async_invoke, tp, TRUE, stack_size);
return TRUE;
}
o->add_time = mono_100ns_ticks ();
}
threadpool_jobs_inc (ar);
+#ifndef DISABLE_PERFCOUNTERS
mono_perfcounter_update_value (tp->pc_nitems, TRUE, 1);
+#endif
if (!tp->is_io && mono_wsq_local_push (ar))
continue;
if (!down && nt <= tp->min_threads)
break;
if (down || InterlockedCompareExchange (&tp->nthreads, nt - 1, nt) == nt) {
+#ifndef DISABLE_PERFCOUNTERS
mono_perfcounter_update_value (tp->pc_nthreads, TRUE, -1);
+#endif
if (!tp->is_io) {
remove_wsq (wsq);
}
return(FALSE);
}
+static gint32
+mono_wait_uninterrupted (MonoInternalThread *thread, gboolean multiple, guint32 numhandles, gpointer *handles, gboolean waitall, gint32 ms, gboolean alertable)
+{
+ MonoException *exc;
+ guint32 ret;
+ gint64 start;
+ gint32 diff_ms;
+ gint32 wait = ms;
+
+ start = (ms == -1) ? 0 : mono_100ns_ticks ();
+ do {
+ if (multiple)
+ ret = WaitForMultipleObjectsEx (numhandles, handles, waitall, wait, alertable);
+ else
+ ret = WaitForSingleObjectEx (handles [0], ms, alertable);
+
+ if (ret != WAIT_IO_COMPLETION)
+ break;
+
+ exc = mono_thread_execute_interruption (thread);
+ if (exc)
+ mono_raise_exception (exc);
+
+ if (ms == -1)
+ continue;
+
+ /* Re-calculate ms according to the time passed */
+ diff_ms = (mono_100ns_ticks () - start) / 10000;
+ if (diff_ms >= ms) {
+ ret = WAIT_TIMEOUT;
+ break;
+ }
+ wait = ms - diff_ms;
+ } while (TRUE);
+
+ return ret;
+}
+
/* FIXME: exitContext isnt documented */
gboolean ves_icall_System_Threading_WaitHandle_WaitAll_internal(MonoArray *mono_handles, gint32 ms, gboolean exitContext)
{
mono_thread_set_state (thread, ThreadState_WaitSleepJoin);
- ret=WaitForMultipleObjectsEx(numhandles, handles, TRUE, ms, TRUE);
+ ret = mono_wait_uninterrupted (thread, TRUE, numhandles, handles, TRUE, ms, TRUE);
mono_thread_clr_state (thread, ThreadState_WaitSleepJoin);
if(ret==WAIT_FAILED) {
THREAD_WAIT_DEBUG (g_message ("%s: (%"G_GSIZE_FORMAT") Wait failed", __func__, GetCurrentThreadId ()));
return(FALSE);
- } else if(ret==WAIT_TIMEOUT || ret == WAIT_IO_COMPLETION) {
- /* Do we want to try again if we get
- * WAIT_IO_COMPLETION? The documentation for
- * WaitHandle doesn't give any clues. (We'd have to
- * fiddle with the timeout if we retry.)
- */
+ } else if(ret==WAIT_TIMEOUT) {
THREAD_WAIT_DEBUG (g_message ("%s: (%"G_GSIZE_FORMAT") Wait timed out", __func__, GetCurrentThreadId ()));
return(FALSE);
}
guint32 i;
MonoObject *waitHandle;
MonoInternalThread *thread = mono_thread_internal_current ();
- guint32 start;
/* Do this WaitSleepJoin check before creating objects */
mono_thread_current_check_pending_interrupt ();
mono_thread_set_state (thread, ThreadState_WaitSleepJoin);
- start = (ms == -1) ? 0 : mono_msec_ticks ();
- do {
- ret = WaitForMultipleObjectsEx (numhandles, handles, FALSE, ms, TRUE);
- if (ret != WAIT_IO_COMPLETION)
- break;
- if (ms != -1) {
- guint32 diff;
-
- diff = mono_msec_ticks () - start;
- ms -= diff;
- if (ms <= 0)
- break;
- }
- } while (ms == -1 || ms > 0);
+ ret = mono_wait_uninterrupted (thread, TRUE, numhandles, handles, FALSE, ms, TRUE);
mono_thread_clr_state (thread, ThreadState_WaitSleepJoin);
mono_thread_set_state (thread, ThreadState_WaitSleepJoin);
- ret=WaitForSingleObjectEx (handle, ms, TRUE);
+ ret = mono_wait_uninterrupted (thread, FALSE, 1, &handle, FALSE, ms, TRUE);
mono_thread_clr_state (thread, ThreadState_WaitSleepJoin);
if(ret==WAIT_FAILED) {
THREAD_WAIT_DEBUG (g_message ("%s: (%"G_GSIZE_FORMAT") Wait failed", __func__, GetCurrentThreadId ()));
return(FALSE);
- } else if(ret==WAIT_TIMEOUT || ret == WAIT_IO_COMPLETION) {
- /* Do we want to try again if we get
- * WAIT_IO_COMPLETION? The documentation for
- * WaitHandle doesn't give any clues. (We'd have to
- * fiddle with the timeout if we retry.)
- */
+ } else if(ret==WAIT_TIMEOUT) {
THREAD_WAIT_DEBUG (g_message ("%s: (%"G_GSIZE_FORMAT") Wait timed out", __func__, GetCurrentThreadId ()));
return(FALSE);
}
noinst_PROGRAMS = genmdesc
+if DISABLE_EXECUTABLES
+shared_libraries = $(boehm_libraries) $(sgen_libraries)
+else
if SHARED_MONO
shared_libraries = $(boehm_libraries) $(sgen_libraries)
endif
+endif
lib_LTLIBRARIES = $(shared_libraries)
libmonosgen_2_0_la_CFLAGS = $(mono_sgen_CFLAGS)
libmonosgen_2_0_la_LIBADD = libmini.la $(sgen_libs) $(LIBMONO_DTRACE_OBJECT)
+if PLATFORM_ANDROID
+libmonosgen_2_0_la_LDFLAGS = -avoid-version
+endif
+
if MOONLIGHT
libmono_moon_la_SOURCES = $(libmini_la_SOURCES)
if MOONLIGHT_BOEHM
LLVM_AOT_RUNTIME_OPTS=$(if $(LLVM),--llvm,)
aotcheck: mono $(regtests)
- rm -f *.exe.so *.exe.dylib *.exe.dylib.dSYM
+ rm -rf *.exe.so *.exe.dylib *.exe.dylib.dSYM
$(RUNTIME) $(LLVM_AOT_RUNTIME_OPTS) --aot $(regtests) || exit 1
for i in $(regtests); do $(RUNTIME_AOTCHECK) --regression $$i || exit 1; done
- rm -f *.exe.so *.exe.dylib *.exe.dylib.dSYM
+ rm -rf *.exe.so *.exe.dylib *.exe.dylib.dSYM
llvmaotcheck:
$(MAKE) aotcheck LLVM=1
gboolean log_generics;
gboolean direct_pinvoke;
gboolean direct_icalls;
+ gboolean no_direct_calls;
int nthreads;
int ntrampolines;
int nrgctx_trampolines;
GHashTable *plt_entry_debug_sym_cache;
gboolean thumb_mixed, need_no_dead_strip, need_pt_gnu_stack;
GHashTable *ginst_hash;
+ gboolean global_symbols;
+#ifdef MONOTOUCH
+ gboolean direct_method_addresses;
+#endif
} MonoAotCompile;
typedef struct {
#if defined(__linux__) && !defined(TARGET_ARM)
acfg->need_pt_gnu_stack = TRUE;
#endif
+
+#ifdef MONOTOUCH
+ acfg->direct_method_addresses = TRUE;
+ acfg->global_symbols = TRUE;
+#endif
}
/*
// FIXME: Maybe call the wrapper directly ?
direct_callable = FALSE;
- if (acfg->aot_opts.soft_debug) {
+ if (acfg->aot_opts.soft_debug || acfg->aot_opts.no_direct_calls) {
/* Disable this so all calls go through load_method (), see the
* mini_get_debug_options ()->load_aot_jit_info_eagerly = TRUE; line in
* mono_debugger_agent_init ().
MonoMethodHeader *header;
gboolean skip, direct_call;
guint32 got_slot;
- char direct_call_target [1024];
+ const char *direct_call_target;
const char *direct_pinvoke;
if (method) {
MonoCompile *callee_cfg = g_hash_table_lookup (acfg->method_to_cfg, patch_info->data.method);
//printf ("DIRECT: %s %s\n", method ? mono_method_full_name (method, TRUE) : "", mono_method_full_name (callee_cfg->method, TRUE));
direct_call = TRUE;
- g_assert (strlen (callee_cfg->asm_symbol) < 1000);
- sprintf (direct_call_target, "%s", callee_cfg->asm_symbol);
+ direct_call_target = callee_cfg->asm_symbol;
+ patch_info->type = MONO_PATCH_INFO_NONE;
+ acfg->stats.direct_calls ++;
}
acfg->stats.all_calls ++;
#endif
direct_call = TRUE;
g_assert (strlen (direct_pinvoke) < 1000);
- sprintf (direct_call_target, "%s%s", prefix, direct_pinvoke);
+ direct_call_target = g_strdup_printf ("%s%s", prefix, direct_pinvoke);
}
}
}
if (plt_entry) {
/* This patch has a PLT entry, so we must emit a call to the PLT entry */
direct_call = TRUE;
- sprintf (direct_call_target, "%s", plt_entry->symbol);
+ direct_call_target = plt_entry->symbol;
/* Nullify the patch */
patch_info->type = MONO_PATCH_INFO_NONE;
int method_index;
guint8 *code;
char *debug_sym = NULL;
- char symbol [128];
+ char *symbol = NULL;
int func_alignment = AOT_FUNC_ALIGNMENT;
MonoMethodHeader *header;
char *export_name;
header = cfg->header;
method_index = get_method_index (acfg, method);
+ symbol = g_strdup_printf ("%sme_%x", acfg->temp_prefix, method_index);
- /* Make the labels local */
- sprintf (symbol, "%s", cfg->asm_symbol);
+ /* Make the labels local */
emit_section_change (acfg, ".text", 0);
emit_alignment (acfg, func_alignment);
- emit_label (acfg, symbol);
+
+ if (acfg->global_symbols && acfg->need_no_dead_strip)
+ fprintf (acfg->fp, " .no_dead_strip %s\n", cfg->asm_symbol);
+
+ emit_label (acfg, cfg->asm_symbol);
- if (acfg->aot_opts.write_symbols) {
+ if (acfg->aot_opts.write_symbols && !acfg->global_symbols) {
/*
* Write a C style symbol for every method, this has two uses:
* - it works on platforms where the dwarf debugging info is not
*/
debug_sym = get_debug_sym (method, "", acfg->method_label_hash);
- sprintf (symbol, "%sme_%x", acfg->temp_prefix, method_index);
if (acfg->need_no_dead_strip)
fprintf (acfg->fp, " .no_dead_strip %s\n", debug_sym);
emit_local_symbol (acfg, debug_sym, symbol, TRUE);
}
if (cfg->verbose_level > 0)
- g_print ("Method %s emitted as %s\n", mono_method_full_name (method, TRUE), symbol);
+ g_print ("Method %s emitted as %s\n", mono_method_full_name (method, TRUE), cfg->asm_symbol);
acfg->stats.code_size += cfg->code_len;
g_free (debug_sym);
}
- sprintf (symbol, "%sme_%x", acfg->temp_prefix, method_index);
emit_label (acfg, symbol);
+ g_free (symbol);
}
/**
/* Emit only a thumb version */
continue;
- if (!acfg->thumb_mixed)
+ if (acfg->llvm && !acfg->thumb_mixed)
emit_label (acfg, plt_entry->llvm_symbol);
if (debug_sym) {
- if (acfg->need_no_dead_strip)
+ if (acfg->need_no_dead_strip) {
+ img_writer_emit_unset_mode (acfg->w);
fprintf (acfg->fp, " .no_dead_strip %s\n", debug_sym);
+ }
emit_local_symbol (acfg, debug_sym, NULL, TRUE);
emit_label (acfg, debug_sym);
}
opts->direct_pinvoke = TRUE;
} else if (str_begins_with (arg, "direct-icalls")) {
opts->direct_icalls = TRUE;
+#if defined(TARGET_ARM)
+ } else if (str_begins_with (arg, "iphone-abi")) {
+ // older full-aot users did depend on this.
+#endif
+ } else if (str_begins_with (arg, "no-direct-calls")) {
+ opts->no_direct_calls = TRUE;
} else if (str_begins_with (arg, "print-skipped")) {
opts->print_skipped_methods = TRUE;
} else if (str_begins_with (arg, "stats")) {
static void
emit_llvm_file (MonoAotCompile *acfg)
{
- char *command, *opts;
+ char *command, *opts, *tempbc;
int i;
MonoJumpInfo *patch_info;
*/
if (strcmp (acfg->image->assembly->aname.name, "mscorlib") == 0) {
/* For the generic + rgctx trampolines */
- acfg->final_got_size += 200;
+ acfg->final_got_size += 400;
/* For the specific trampolines */
for (ntype = 0; ntype < MONO_AOT_TRAMP_NUM; ++ntype)
acfg->final_got_size += acfg->num_trampolines [ntype] * 2;
}
- mono_llvm_emit_aot_module ("temp.bc", acfg->final_got_size);
+ tempbc = g_strdup_printf ("%s.bc", acfg->tmpfname);
+ mono_llvm_emit_aot_module (tempbc, acfg->final_got_size);
+ g_free (tempbc);
/*
* FIXME: Experiment with adding optimizations, the -std-compile-opts set takes
opts = g_strdup ("-instcombine -simplifycfg");
opts = g_strdup ("-simplifycfg -domtree -domfrontier -scalarrepl -instcombine -simplifycfg -domtree -domfrontier -scalarrepl -simplify-libcalls -instcombine -simplifycfg -instcombine -simplifycfg -reassociate -domtree -loops -loop-simplify -domfrontier -loop-simplify -lcssa -loop-rotate -licm -lcssa -loop-unswitch -instcombine -scalar-evolution -loop-simplify -lcssa -iv-users -indvars -loop-deletion -loop-simplify -lcssa -loop-unroll -instcombine -memdep -gvn -memdep -memcpyopt -sccp -instcombine -domtree -memdep -dse -adce -simplifycfg -preverify -domtree -verify");
#if 1
- command = g_strdup_printf ("%sopt -f %s -o temp.opt.bc temp.bc", acfg->aot_opts.llvm_path, opts);
+ command = g_strdup_printf ("%sopt -f %s -o %s.opt.bc %s.bc", acfg->aot_opts.llvm_path, opts, acfg->tmpfname, acfg->tmpfname);
printf ("Executing opt: %s\n", command);
if (system (command) != 0) {
exit (1);
g_string_append_printf (acfg->llc_args, " -relocation-model=pic");
unlink (acfg->tmpfname);
- command = g_strdup_printf ("%sllc %s -disable-gnu-eh-frame -enable-mono-eh-frame -o %s temp.opt.bc", acfg->aot_opts.llvm_path, acfg->llc_args->str, acfg->tmpfname);
+ command = g_strdup_printf ("%sllc %s -disable-gnu-eh-frame -enable-mono-eh-frame -o %s %s.opt.bc", acfg->aot_opts.llvm_path, acfg->llc_args->str, acfg->tmpfname, acfg->tmpfname);
printf ("Executing llc: %s\n", command);
}
}
+#ifdef MONOTOUCH
+ if (acfg->direct_method_addresses) {
+ acfg->flags |= MONO_AOT_FILE_FLAG_DIRECT_METHOD_ADDRESSES;
+
+ sprintf (symbol, "method_addresses");
+ emit_section_change (acfg, RODATA_SECT, 1);
+ emit_alignment (acfg, 8);
+ emit_label (acfg, symbol);
+
+ for (i = 0; i < acfg->nmethods; ++i) {
+ if (acfg->cfgs [i]) {
+ emit_pointer (acfg, acfg->cfgs [i]->asm_symbol);
+ } else {
+ emit_pointer (acfg, NULL);
+ }
+ }
+
+ /* Empty */
+ sprintf (symbol, "code_offsets");
+ emit_section_change (acfg, RODATA_SECT, 1);
+ emit_alignment (acfg, 8);
+ emit_label (acfg, symbol);
+ } else {
+ sprintf (symbol, "code_offsets");
+ emit_section_change (acfg, RODATA_SECT, 1);
+ emit_alignment (acfg, 8);
+ emit_label (acfg, symbol);
+
+ acfg->stats.offsets_size += acfg->nmethods * 4;
+
+ sprintf (end_symbol, "methods");
+ for (i = 0; i < acfg->nmethods; ++i) {
+ if (acfg->cfgs [i]) {
+ emit_symbol_diff (acfg, acfg->cfgs [i]->asm_symbol, end_symbol, 0);
+ } else {
+ emit_int32 (acfg, 0xffffffff);
+ }
+ }
+ }
+#else
sprintf (symbol, "code_offsets");
emit_section_change (acfg, RODATA_SECT, 1);
emit_alignment (acfg, 8);
emit_int32 (acfg, 0xffffffff);
}
}
+#endif
emit_line (acfg);
/* Emit a sorted table mapping methods to their unbox trampolines */
emit_pointer (acfg, "method_info_offsets");
emit_pointer (acfg, "ex_info_offsets");
emit_pointer (acfg, "code_offsets");
+#ifdef MONOTOUCH
+ emit_pointer (acfg, "method_addresses");
+#endif
emit_pointer (acfg, "extra_method_info_offsets");
emit_pointer (acfg, "extra_method_table");
emit_pointer (acfg, "got_info_offsets");
emit_int32 (acfg, acfg->trampoline_size [i]);
#if defined (TARGET_ARM) && defined (TARGET_MACH)
- {
- MonoType t;
- int align = 0;
+ {
+ MonoType t;
+ int align = 0;
- t.type = MONO_TYPE_R8;
- mono_type_size (&t, &align);
+ memset (&t, 0, sizeof (MonoType));
+ t.type = MONO_TYPE_R8;
+ mono_type_size (&t, &align);
- emit_int32 (acfg, align);
+ emit_int32 (acfg, align);
- t.type = MONO_TYPE_I8;
- mono_type_size (&t, &align);
+ memset (&t, 0, sizeof (MonoType));
+ t.type = MONO_TYPE_I8;
+ mono_type_size (&t, &align);
- emit_int32 (acfg, align);
- }
+ emit_int32 (acfg, align);
+ }
#else
emit_int32 (acfg, __alignof__ (double));
emit_int32 (acfg, __alignof__ (gint64));
{
#ifdef EMIT_DWARF_INFO
int i;
- char symbol [128], symbol2 [128];
+ char symbol2 [128];
/* DIEs for methods */
for (i = 0; i < acfg->nmethods; ++i) {
if (cfg->compile_llvm)
continue;
- sprintf (symbol, "%s", cfg->asm_symbol);
sprintf (symbol2, "%sme_%x", acfg->temp_prefix, i);
- mono_dwarf_writer_emit_method (acfg->dwarf, cfg, cfg->method, symbol, symbol2, cfg->jit_info->code_start, cfg->jit_info->code_size, cfg->args, cfg->locals, cfg->unwind_ops, mono_debug_find_method (cfg->jit_info->method, mono_domain_get ()));
+ mono_dwarf_writer_emit_method (acfg->dwarf, cfg, cfg->method, cfg->asm_symbol, symbol2, cfg->jit_info->code_start, cfg->jit_info->code_size, cfg->args, cfg->locals, cfg->unwind_ops, mono_debug_find_method (cfg->jit_info->method, mono_domain_get ()));
}
#endif
}
if (COMPILE_LLVM (cfg))
cfg->asm_symbol = g_strdup_printf ("%s%s", acfg->llvm_label_prefix, cfg->llvm_method_name);
+ else if (acfg->global_symbols)
+ cfg->asm_symbol = get_debug_sym (cfg->method, "", acfg->method_label_hash);
else
cfg->asm_symbol = g_strdup_printf ("%s%sm_%x", acfg->temp_prefix, acfg->llvm_label_prefix, method_index);
}
guint8 *plt_end;
guint8 *blob;
gint32 *code_offsets;
+#ifdef MONOTOUCH
+ gpointer *method_addresses;
+#endif
/* This contains <offset, index> pairs sorted by offset */
/* This is needed because LLVM emitted methods can be in any order */
gint32 *sorted_code_offsets;
}
amodule->code_offsets = info->code_offsets;
+#ifdef MONOTOUCH
+ amodule->method_addresses = info->method_addresses;
+#endif
amodule->code = info->methods;
#ifdef TARGET_ARM
/* Mask out thumb interop bit */
amodule->trampolines [MONO_AOT_TRAMP_IMT_THUNK] = info->imt_thunks;
amodule->thumb_end = info->thumb_end;
+#ifdef MONOTOUCH
+ if (info->flags & MONO_AOT_FILE_FLAG_DIRECT_METHOD_ADDRESSES) {
+ /* Compute code_offsets from the method addresses */
+ amodule->code_offsets = g_malloc0 (amodule->info.nmethods * sizeof (gint32));
+ for (i = 0; i < amodule->info.nmethods; ++i) {
+ if (!amodule->method_addresses [i])
+ amodule->code_offsets [i] = 0xffffffff;
+ else
+ amodule->code_offsets [i] = (char*)amodule->method_addresses [i] - (char*)amodule->code;
+ }
+ }
+#endif
+
if (make_unreadable) {
#ifndef TARGET_WIN32
guint8 *addr;
if (!method)
method = mono_get_method (image, token, NULL);
full_name = mono_method_full_name (method, TRUE);
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_AOT, "AOT NOT FOUND: %s.\n", full_name);
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_AOT, "AOT NOT FOUND: %s.", full_name);
g_free (full_name);
}
return NULL;
info = &amodule->blob [mono_aot_get_offset (amodule->method_info_offsets, method_index)];
- if (amodule->thumb_end && code < amodule->thumb_end) {
+ if (amodule->thumb_end && code < amodule->thumb_end && ((amodule->info.flags & MONO_AOT_FILE_FLAG_DIRECT_METHOD_ADDRESSES) == 0)) {
/* Convert this into a thumb address */
g_assert ((amodule->code_offsets [method_index] & 0x1) == 0);
code = &amodule->code [amodule->code_offsets [method_index] + 1];
if (!jinfo)
jinfo = mono_aot_find_jit_info (domain, amodule->assembly->image, code);
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_AOT, "AOT FOUND method %s [%p - %p %p]\n", full_name, code, code + jinfo->code_size, info);
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_AOT, "AOT FOUND method %s [%p - %p %p]", full_name, code, code + jinfo->code_size, info);
g_free (full_name);
}
g_assert_not_reached ();
#endif
+#ifdef MONOTOUCH
+ while (target != NULL) {
+ if ((target >= (guint8*)(amodule->plt)) && (target < (guint8*)(amodule->plt_end)))
+ return target;
+
+ // Add 4 since mono_arch_get_call_target assumes we're passing
+ // the instruction after the actual branch instruction.
+ target = mono_arch_get_call_target (target + 4);
+ }
+
+ return NULL;
+#else
if ((target >= (guint8*)(amodule->plt)) && (target < (guint8*)(amodule->plt_end)))
return target;
else
return NULL;
+#endif
}
/*
*out_amodule = amodule;
- if (amodule->trampoline_index [tramp_type] == amodule->info.num_trampolines [tramp_type])
- g_error ("Ran out of trampolines of type %d in '%s' (%d)\n", tramp_type, image->name, amodule->info.num_trampolines [tramp_type]);
-
+ if (amodule->trampoline_index [tramp_type] == amodule->info.num_trampolines [tramp_type]) {
+ g_error ("Ran out of trampolines of type %d in '%s' (%d)%s\n",
+ tramp_type, image->name, amodule->info.num_trampolines [tramp_type],
+#ifdef MONOTOUCH
+ ". See http://docs.xamarin.com/ios/troubleshooting for instruction on how to fix this condition"
+#else
+ ""
+#endif
+ );
+ }
index = amodule->trampoline_index [tramp_type] ++;
mono_aot_unlock ();
#include "debugger-agent.h"
#include "mini.h"
+/*
+On iOS we can't use System.Environment.Exit () as it will do the wrong
+shutdown sequence.
+*/
+#if !defined (TARGET_IOS)
+#define TRY_MANAGED_SYSTEM_ENVIRONMENT_EXIT
+#endif
+
+
#ifndef MONO_ARCH_SOFT_DEBUG_SUPPORTED
#define DISABLE_DEBUGGER_AGENT 1
#endif
static DebuggerTransport transports [MAX_TRANSPORTS];
static int ntransports;
+void
+mono_debugger_agent_register_transport (DebuggerTransport *trans);
+
+void
+mono_debugger_agent_register_transport (DebuggerTransport *trans)
+{
+ register_transport (trans);
+}
+
static void
register_transport (DebuggerTransport *trans)
{
return transport->recv (buf, len);
}
+gboolean
+mono_debugger_agent_transport_handshake (void)
+{
+ return transport_handshake ();
+}
+
static gboolean
transport_handshake (void)
{
MonoJitInfo *ji;
info = mono_thread_info_safe_suspend_sync ((MonoNativeThreadId)(gpointer)(gsize)thread->tid, FALSE);
- g_assert (info);
-
- ji = mono_jit_info_table_find (info->suspend_state.unwind_data [MONO_UNWIND_DATA_DOMAIN], MONO_CONTEXT_GET_IP (&info->suspend_state.ctx));
+ if (!info) {
+ DEBUG(1, fprintf (log_file, "[%p] mono_thread_info_suspend_sync () failed for %p...\n", (gpointer)GetCurrentThreadId (), (gpointer)tid));
+ /*
+ * Attached thread which died without detaching.
+ */
+ tls->terminated = TRUE;
+ } else {
+ ji = mono_jit_info_table_find (info->suspend_state.unwind_data [MONO_UNWIND_DATA_DOMAIN], MONO_CONTEXT_GET_IP (&info->suspend_state.ctx));
- thread_interrupt (tls, info, NULL, ji);
+ thread_interrupt (tls, info, NULL, ji);
- mono_thread_info_resume (mono_thread_info_get_tid (info));
+ mono_thread_info_resume (mono_thread_info_get_tid (info));
+ }
} else {
res = mono_thread_kill (thread, mono_thread_get_abort_signal ());
if (res) {
return agent_config.enabled;
}
+#ifdef PLATFORM_ANDROID
+void
+mono_debugger_agent_unhandled_exception (MonoException *exc)
+{
+ int suspend_policy;
+ GSList *events;
+ EventInfo ei;
+
+ if (!inited)
+ return;
+
+ memset (&ei, 0, sizeof (EventInfo));
+ ei.exc = (MonoObject*)exc;
+
+ mono_loader_lock ();
+ events = create_event_list (EVENT_KIND_EXCEPTION, NULL, NULL, &ei, &suspend_policy);
+ mono_loader_unlock ();
+
+ process_event (EVENT_KIND_EXCEPTION, &ei, 0, NULL, events, suspend_policy);
+}
+#endif
+
void
mono_debugger_agent_handle_exception (MonoException *exc, MonoContext *throw_ctx,
MonoContext *catch_ctx)
{
- int suspend_policy;
+ int i, j, suspend_policy;
GSList *events;
- MonoJitInfo *ji;
+ MonoJitInfo *ji, *catch_ji;
EventInfo ei;
DebuggerTlsData *tls = NULL;
return;
ji = mini_jit_info_table_find (mono_domain_get (), MONO_CONTEXT_GET_IP (throw_ctx), NULL);
+ if (catch_ctx)
+ catch_ji = mini_jit_info_table_find (mono_domain_get (), MONO_CONTEXT_GET_IP (catch_ctx), NULL);
+ else
+ catch_ji = NULL;
ei.exc = (MonoObject*)exc;
ei.caught = catch_ctx != NULL;
mono_loader_lock ();
+
+ /* Treat exceptions which are caught in non-user code as unhandled */
+ for (i = 0; i < event_requests->len; ++i) {
+ EventRequest *req = g_ptr_array_index (event_requests, i);
+ if (req->event_kind != EVENT_KIND_EXCEPTION)
+ continue;
+
+ for (j = 0; j < req->nmodifiers; ++j) {
+ Modifier *mod = &req->modifiers [j];
+
+ if (mod->kind == MOD_KIND_ASSEMBLY_ONLY && catch_ji) {
+ int k;
+ gboolean found = FALSE;
+ MonoAssembly **assemblies = mod->data.assemblies;
+
+ if (assemblies) {
+ for (k = 0; assemblies [k]; ++k)
+ if (assemblies [k] == catch_ji->method->klass->image->assembly)
+ found = TRUE;
+ }
+ if (!found)
+ ei.caught = FALSE;
+ }
+ }
+ }
+
events = create_event_list (EVENT_KIND_EXCEPTION, NULL, ji, &ei, &suspend_policy);
mono_loader_unlock ();
- if (tls && catch_ctx) {
+ if (tls && ei.caught && catch_ctx) {
tls->catch_ctx = *catch_ctx;
tls->has_catch_ctx = TRUE;
}
suspend_vm ();
wait_for_suspend ();
+#ifdef TRY_MANAGED_SYSTEM_ENVIRONMENT_EXIT
env_class = mono_class_from_name (mono_defaults.corlib, "System", "Environment");
if (env_class)
exit_method = mono_class_get_method_from_name (env_class, "Exit", 1);
+#endif
mono_loader_lock ();
thread = mono_g_hash_table_find (tid_to_thread, is_really_suspended, NULL);
res = transport_recv (header, HEADER_LENGTH);
/* This will break if the socket is closed during shutdown too */
- if (res != HEADER_LENGTH)
+ if (res != HEADER_LENGTH) {
+ DEBUG (1, fprintf (log_file, "[dbg] transport_recv () returned %d, expected %d.\n", res, HEADER_LENGTH));
break;
+ }
p = header;
end = header + HEADER_LENGTH;
if (len - HEADER_LENGTH > 0)
{
res = transport_recv (data, len - HEADER_LENGTH);
- if (res != len - HEADER_LENGTH)
+ if (res != len - HEADER_LENGTH) {
+ DEBUG (1, fprintf (log_file, "[dbg] transport_recv () returned %d, expected %d.\n", res, len - HEADER_LENGTH));
break;
+ }
}
p = data;
gboolean mono_debugger_agent_thread_interrupt (void *sigctx, MonoJitInfo *ji) MONO_INTERNAL;
+#ifdef PLATFORM_ANDROID
+void
+mono_debugger_agent_unhandled_exception (MonoException *exc);
+#endif
+
void
mono_debugger_agent_handle_exception (MonoException *ext, MonoContext *throw_ctx, MonoContext *catch_ctx) MONO_INTERNAL;
gboolean
mono_debugger_agent_debug_log_is_enabled (void) MONO_INTERNAL;
+gboolean
+mono_debugger_agent_transport_handshake (void) MONO_INTERNAL;
+
#endif
const char *temp_prefix;
gboolean emit_line, appending, collect_line_info;
GSList *line_info;
+ int cur_file_index;
};
static void
w->class_to_vtype_die = g_hash_table_new (NULL, NULL);
w->class_to_pointer_die = g_hash_table_new (NULL, NULL);
w->class_to_reference_die = g_hash_table_new (NULL, NULL);
+ w->cur_file_index = -1;
return w;
}
static int subprogram_attr [] = {
DW_AT_name , DW_FORM_string,
+#ifndef TARGET_IOS
DW_AT_description , DW_FORM_string,
+#endif
DW_AT_low_pc , DW_FORM_addr,
DW_AT_high_pc , DW_FORM_addr,
DW_AT_frame_base , DW_FORM_block1
static int tramp_subprogram_attr [] = {
DW_AT_name , DW_FORM_string,
+#ifndef TARGET_IOS
DW_AT_description , DW_FORM_string,
+#endif
DW_AT_low_pc , DW_FORM_addr,
DW_AT_high_pc , DW_FORM_addr,
};
int i;
GHashTable *dir_to_index, *index_to_dir;
GSList *l;
+ GSList *info_list;
g_assert (w->collect_line_info);
add_line_number_file_name (w, "<unknown>", 0, 0);
/* Collect files */
- // FIXME: Revert list
- for (l = w->line_info; l; l = l->next) {
+ info_list = g_slist_reverse (w->line_info);
+ for (l = info_list; l; l = l->next) {
MethodLineNumberInfo *info = l->data;
MonoDebugMethodInfo *minfo;
char *source_file;
emit_label (w, ".Ldebug_line_header_end");
/* Emit line number table */
- for (l = w->line_info; l; l = l->next) {
+ for (l = info_list; l; l = l->next) {
MethodLineNumberInfo *info = l->data;
emit_line_number_info (w, info->method, info->start_symbol, info->end_symbol, info->code, info->code_size, info->debug_info);
}
+ g_slist_free (info_list);
emit_byte (w, 0);
emit_byte (w, 1);
if (opcode != 0) {
emit_byte (w, opcode);
} else {
+ //printf ("large: %d %d %d\n", line_diff, addr_diff, max_special_addr_diff);
emit_byte (w, DW_LNS_advance_line);
emit_sleb128 (w, line_diff);
emit_byte (w, DW_LNS_advance_pc);
MonoDebugMethodInfo *minfo;
MonoDebugLineNumberEntry *ln_array;
int *native_to_il_offset = NULL;
-
+
if (!w->emit_line) {
mono_metadata_free_mh (header);
return;
prev_il_offset = -1;
for (i = 0; i < code_size; ++i) {
+ int line_diff, addr_diff;
+
if (!minfo)
continue;
prev_il_offset = il_offset;
loc = mono_debug_symfile_lookup_location (minfo, il_offset);
- if (loc && loc->source_file) {
- int line_diff = (gint32)loc->row - (gint32)prev_line;
- int addr_diff = i - prev_native_offset;
-
- if (first) {
- emit_section_change (w, ".debug_line", LINE_SUBSECTION_DATA);
-
- emit_byte (w, 0);
- emit_byte (w, sizeof (gpointer) + 1);
- emit_byte (w, DW_LNE_set_address);
- if (start_symbol)
- emit_pointer_unaligned (w, start_symbol);
- else
- emit_pointer_value (w, code);
+ if (!(loc && loc->source_file))
+ continue;
- /*
- * The prolog+initlocals region does not have a line number, this
- * makes them belong to the first line of the method.
- */
- emit_byte (w, DW_LNS_advance_line);
- emit_sleb128 (w, (gint32)loc->row - (gint32)prev_line);
- prev_line = loc->row;
- }
+ line_diff = (gint32)loc->row - (gint32)prev_line;
+ addr_diff = i - prev_native_offset;
+
+ if (first) {
+ emit_section_change (w, ".debug_line", LINE_SUBSECTION_DATA);
- if (loc->row != prev_line) {
- if (!prev_file_name || strcmp (loc->source_file, prev_file_name) != 0) {
- /* Add an entry to the file table */
- /* FIXME: Avoid duplicates */
- if (w->collect_line_info)
- file_index = get_line_number_file_name (w, loc->source_file) + 1;
- else
- file_index = emit_line_number_file_name (w, loc->source_file, 0, 0);
- g_free (prev_file_name);
- prev_file_name = g_strdup (loc->source_file);
+ emit_byte (w, 0);
+ emit_byte (w, sizeof (gpointer) + 1);
+ emit_byte (w, DW_LNE_set_address);
+ if (start_symbol)
+ emit_pointer_unaligned (w, start_symbol);
+ else
+ emit_pointer_value (w, code);
+
+ /*
+ * The prolog+initlocals region does not have a line number, this
+ * makes them belong to the first line of the method.
+ */
+ emit_byte (w, DW_LNS_advance_line);
+ //printf ("FIRST: %d %d %d\n", prev_line, loc->row, il_offset);
+ emit_sleb128 (w, (gint32)loc->row - (gint32)prev_line);
+ prev_line = loc->row;
+ first = FALSE;
+ }
+ if (loc->row != prev_line) {
+ if (!prev_file_name || strcmp (loc->source_file, prev_file_name) != 0) {
+ /* Add an entry to the file table */
+ /* FIXME: Avoid duplicates */
+ if (w->collect_line_info)
+ file_index = get_line_number_file_name (w, loc->source_file) + 1;
+ else
+ file_index = emit_line_number_file_name (w, loc->source_file, 0, 0);
+ g_free (prev_file_name);
+ prev_file_name = g_strdup (loc->source_file);
+
+ if (w->cur_file_index != file_index) {
emit_byte (w, DW_LNS_set_file);
emit_uleb128 (w, file_index);
emit_byte (w, DW_LNS_copy);
- }
- //printf ("X: %p(+0x%x) %d %s:%d(+%d)\n", code + i, addr_diff, loc->il_offset, loc->source_file, loc->row, line_diff);
-
- emit_advance_op (w, line_diff, addr_diff);
-
- prev_line = loc->row;
- prev_native_offset = i;
+ w->cur_file_index = file_index;
+ }
}
+ //printf ("X: %p(+0x%x) %d %s:%d(+%d)\n", code + i, addr_diff, loc->il_offset, loc->source_file, loc->row, line_diff);
+ emit_advance_op (w, line_diff, addr_diff);
- first = FALSE;
-
- mono_debug_symfile_free_location (loc);
+ prev_line = loc->row;
+ prev_native_offset = i;
}
+
+ mono_debug_symfile_free_location (loc);
}
g_free (native_to_il_offset);
emit_uleb128 (w, ABBREV_SUBPROGRAM);
name = mono_method_full_name (method, FALSE);
emit_string (w, name);
+#ifndef TARGET_IOS
emit_string (w, name);
+#endif
g_free (name);
if (start_symbol) {
emit_pointer_unaligned (w, start_symbol);
code = mono_arch_emit_load_aotconst (start, code, &ji, MONO_PATCH_INFO_JIT_ICALL_ADDR, corlib ? "mono_x86_throw_corlib_exception" : "mono_x86_throw_exception");
x86_call_reg (code, X86_EAX);
} else {
- x86_call_code (code, resume_unwind ? (mono_x86_resume_unwind) : (corlib ? (gpointer)mono_x86_throw_corlib_exception : (gpointer)mono_x86_throw_exception));
+ x86_call_code (code, resume_unwind ? (gpointer)(mono_x86_resume_unwind) : (corlib ? (gpointer)mono_x86_throw_corlib_exception : (gpointer)mono_x86_throw_exception));
}
x86_breakpoint (code);
/* Pop arguments off the stack */
/* FIXME: Handle the delegate case too ((*lmf)->method == NULL) */
/* FIXME: Handle the IMT/vtable case too */
+#if 0
#ifndef ENABLE_LLVM
if ((*lmf)->method) {
MonoMethod *method = (*lmf)->method;
guint32 stack_to_pop = mono_arch_get_argument_info (NULL, mono_method_signature (method), mono_method_signature (method)->param_count, arg_info);
new_ctx->esp += stack_to_pop;
}
+#endif
#endif
}
else
ret
}
+ .method public static default int32 test_1_sizeof_ref () cil managed {
+ call int32 Tests::SizeOfT<object>()
+ sizeof [mscorlib]System.IntPtr
+ ceq
+ ret
+ }
+
.field static public int32 volatile_int
.method public static default int32 test_5_volatile_load_store () cil managed {
#if (defined(TARGET_X86) && defined(TARGET_ASM_APPLE))
name = get_label(name);
fprintf (acfg->fp, "%s:\n", name);
- if (name[0] != 'L')
+ if (name[0] != 'L' && name[0] != '_')
fprintf (acfg->fp, "_%s:\n", name);
#elif (defined(HOST_WIN32) && (defined(TARGET_X86) || defined(TARGET_AMD64))) || (defined(TARGET_X86) && defined(TARGET_ASM_APPLE))
if (offset == 0 && strcmp (start, ".") != 0) {
char symbol [128];
- sprintf (symbol, ".LDIFF_SYM%d", acfg->label_gen);
+ sprintf (symbol, "%sDIFF_SYM%d", AS_TEMP_LABEL_PREFIX, acfg->label_gen);
acfg->label_gen ++;
fprintf (acfg->fp, "\n%s=%s - %s", symbol, end, start);
fprintf (acfg->fp, "\n\t%s ", AS_INT32_DIRECTIVE);
_MONO_DEBUGGER__debugger_info_ptr:
.long _MONO_DEBUGGER__debugger_info
_MONO_DEBUGGER__using_debugger:
- .quad 0
+ .long 0
+ .long 0
return;
MONO_INST_NEW (cfg, getaddr, OP_LOAD_GOTADDR);
+ getaddr->cil_code = cfg->header->code;
getaddr->dreg = cfg->got_var->dreg;
/* Add it to the start of the first bblock */
init_locals = header->init_locals;
seq_points = cfg->gen_seq_points && cfg->method == method;
+#ifdef PLATFORM_ANDROID
+ seq_points &= cfg->method->wrapper_type == MONO_WRAPPER_NONE;
+#endif
if (cfg->gen_seq_points && cfg->method == method) {
minfo = mono_debug_lookup_method (method);
token = read32 (ip + 2);
func = mono_method_get_wrapper_data (method, token);
info = mono_find_jit_icall_by_addr (func);
+ if (!info)
+ g_error ("Could not find icall address in wrapper %s", mono_method_full_name (method, 1));
g_assert (info);
CHECK_STACK (info->sig->param_count);
break;
}
case CEE_SIZEOF: {
- guint32 align;
+ guint32 val;
int ialign;
CHECK_STACK_OVF (1);
token = read32 (ip + 2);
if (mono_metadata_token_table (token) == MONO_TABLE_TYPESPEC && !method->klass->image->dynamic && !generic_context) {
MonoType *type = mono_type_create_from_typespec (image, token);
- token = mono_type_size (type, &ialign);
+ val = mono_type_size (type, &ialign);
} else {
MonoClass *klass = mono_class_get_full (image, token, generic_context);
CHECK_TYPELOAD (klass);
mono_class_init (klass);
- token = mono_class_value_size (klass, &align);
+ val = mono_type_size (&klass->byval_arg, &ialign);
}
- EMIT_NEW_ICONST (cfg, ins, token);
+ EMIT_NEW_ICONST (cfg, ins, val);
*sp++= ins;
ip += 6;
break;
#define MONO_ARCH_GC_MAPS_SUPPORTED 1
#define MONO_ARCH_HAVE_CONTEXT_SET_INT_REG 1
#define MONO_ARCH_HAVE_SETUP_ASYNC_CALLBACK 1
+#define MONO_ARCH_HAVE_CREATE_LLVM_NATIVE_THUNK 1
gboolean
mono_amd64_tail_call_supported (MonoMethodSignature *caller_sig, MonoMethodSignature *callee_sig) MONO_INTERNAL;
#define ALIGN_TO(val,align) ((((guint64)val) + ((align) - 1)) & ~((align) - 1))
+#if __APPLE__
+void sys_icache_invalidate (void *start, size_t len);
+#endif
+
static gint lmf_tls_offset = -1;
static gint lmf_addr_tls_offset = -1;
#include <dlfcn.h>
#include <AvailabilityMacros.h>
-#if (MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_5) && !defined (TARGET_ARM)
+#if defined (TARGET_OSX) && (MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_5)
#define NEEDS_EXCEPTION_THREAD
#endif
mono_sigctx_to_monoctx (&ctx, &tctx->ctx);
- domain_key = mono_domain_get_tls_offset ();
+ domain_key = mono_domain_get_tls_key ();
jit_key = mono_get_jit_tls_key ();
jit_tls = mono_mach_arch_get_tls_value_from_thread (thread_id, jit_key);
#include <mono/metadata/mono-endian.h>
#include <mono/metadata/environment.h>
#include <mono/utils/mono-mmap.h>
+#include <mono/utils/mono-logger-internal.h>
#include "mini.h"
#include "debug-mini.h"
if (ei->flags == MONO_EXCEPTION_CLAUSE_FILTER) {
gboolean is_user_frame = ji->method->wrapper_type == MONO_WRAPPER_NONE || ji->method->wrapper_type == MONO_WRAPPER_DYNAMIC_METHOD;
+#ifndef DISABLE_PERFCOUNTERS
mono_perfcounters->exceptions_filters++;
+#endif
mono_debugger_call_exception_handler (ei->data.filter, MONO_CONTEXT_GET_SP (ctx), ex_obj);
/*
mono_debugger_agent_handle_exception (obj, ctx, NULL);
if (mini_get_debug_options ()->suspend_on_unhandled) {
- fprintf (stderr, "Unhandled exception, suspending...");
+ mono_runtime_printf_err ("Unhandled exception, suspending...");
while (1)
;
}
mono_debugger_call_exception_handler (ei->handler_start, MONO_CONTEXT_GET_SP (ctx), ex_obj);
MONO_CONTEXT_SET_IP (ctx, ei->handler_start);
*(mono_get_lmf_addr ()) = lmf;
+#ifndef DISABLE_PERFCOUNTERS
mono_perfcounters->exceptions_depth += frame_count;
+#endif
if (obj == domain->stack_overflow_ex)
jit_tls->handling_stack_ovf = FALSE;
mono_profiler_exception_clause_handler (ji->method, ei->flags, i);
jit_tls->orig_ex_ctx_set = FALSE;
mono_debugger_call_exception_handler (ei->handler_start, MONO_CONTEXT_GET_SP (ctx), ex_obj);
+#ifndef DISABLE_PERFCOUNTERS
mono_perfcounters->exceptions_finallys++;
+#endif
*(mono_get_lmf_addr ()) = lmf;
if (ji->from_llvm) {
/*
gboolean
mono_handle_exception (MonoContext *ctx, gpointer obj)
{
+#ifndef DISABLE_PERFCOUNTERS
mono_perfcounters->exceptions_thrown++;
+#endif
return mono_handle_exception_internal (ctx, obj, FALSE, NULL);
}
/* We print a message: after this even managed stack overflows
* may crash the runtime
*/
- fprintf (stderr, "Stack overflow in unmanaged: IP: %p, fault addr: %p\n", mono_arch_ip_from_context (ctx), fault_addr);
+ mono_runtime_printf_err ("Stack overflow in unmanaged: IP: %p, fault addr: %p", mono_arch_ip_from_context (ctx), fault_addr);
if (!jit_tls->handling_stack_ovf) {
jit_tls->restore_stack_prot = restore_stack_protection_tramp;
jit_tls->handling_stack_ovf = 1;
}
typedef struct {
- FILE *stream;
MonoMethod *omethod;
int count;
} PrintOverflowUserData;
{
MonoMethod *method = NULL;
PrintOverflowUserData *user_data = data;
- FILE *stream = user_data->stream;
gchar *location;
if (frame->ji)
return FALSE;
location = mono_debug_print_stack_frame (method, frame->native_offset, mono_domain_get ());
- fprintf (stream, " %s\n", location);
+ mono_runtime_printf_err (" %s", location);
g_free (location);
if (user_data->count == 1) {
- fprintf (stream, " <...>\n");
+ mono_runtime_printf_err (" <...>");
user_data->omethod = method;
} else {
user_data->omethod = NULL;
user_data->count ++;
} else
- fprintf (stream, " at <unknown> <0x%05x>\n", frame->native_offset);
+ mono_runtime_printf_err (" at <unknown> <0x%05x>", frame->native_offset);
return FALSE;
}
MonoContext mctx;
/* we don't do much now, but we can warn the user with a useful message */
- fprintf (stderr, "Stack overflow: IP: %p, fault addr: %p\n", mono_arch_ip_from_context (ctx), fault_addr);
+ mono_runtime_printf_err ("Stack overflow: IP: %p, fault addr: %p", mono_arch_ip_from_context (ctx), fault_addr);
#ifdef MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX
mono_arch_sigctx_to_monoctx (ctx, &mctx);
- fprintf (stderr, "Stacktrace:\n");
+ mono_runtime_printf_err ("Stacktrace:");
memset (&ud, 0, sizeof (ud));
- ud.stream = stderr;
mono_walk_stack_with_ctx (print_overflow_stack_frame, &mctx, MONO_UNWIND_LOOKUP_ACTUAL_METHOD, &ud);
#else
if (ji && ji->method)
- fprintf (stderr, "At %s\n", mono_method_full_name (ji->method, TRUE));
+ mono_runtime_printf_err ("At %s", mono_method_full_name (ji->method, TRUE));
else
- fprintf (stderr, "At <unmanaged>.\n");
+ mono_runtime_printf_err ("At <unmanaged>.");
#endif
_exit (1);
}
static gboolean
-print_stack_frame (StackFrameInfo *frame, MonoContext *ctx, gpointer data)
+print_stack_frame_to_stderr (StackFrameInfo *frame, MonoContext *ctx, gpointer data)
{
- FILE *stream = (FILE*)data;
MonoMethod *method = NULL;
if (frame->ji)
method = frame->ji->method;
if (method) {
gchar *location = mono_debug_print_stack_frame (method, frame->native_offset, mono_domain_get ());
- fprintf (stream, " %s\n", location);
+ mono_runtime_printf_err (" %s", location);
g_free (location);
} else
- fprintf (stream, " at <unknown> <0x%05x>\n", frame->native_offset);
+ mono_runtime_printf_err (" at <unknown> <0x%05x>", frame->native_offset);
return FALSE;
}
return;
if (mini_get_debug_options ()->suspend_on_sigsegv) {
- fprintf (stderr, "Received SIGSEGV, suspending...");
+ mono_runtime_printf_err ("Received SIGSEGV, suspending...");
while (1)
;
}
/* !jit_tls means the thread was not registered with the runtime */
if (jit_tls && mono_thread_internal_current ()) {
- fprintf (stderr, "Stacktrace:\n\n");
-
- mono_walk_stack (print_stack_frame, TRUE, stderr);
+ mono_runtime_printf_err ("Stacktrace:\n");
- fflush (stderr);
+ mono_walk_stack (print_stack_frame_to_stderr, TRUE, NULL);
}
#ifdef HAVE_BACKTRACE_SYMBOLS
int i, size;
const char *signal_str = (signal == SIGSEGV) ? "SIGSEGV" : "SIGABRT";
- fprintf (stderr, "\nNative stacktrace:\n\n");
+ mono_runtime_printf_err ("\nNative stacktrace:\n");
size = backtrace (array, 256);
names = backtrace_symbols (array, size);
for (i =0; i < size; ++i) {
- fprintf (stderr, "\t%s\n", names [i]);
+ mono_runtime_printf_err ("\t%s", names [i]);
}
free (names);
- fflush (stderr);
-
/* Try to get more meaningful information using gdb */
#if !defined(HOST_WIN32) && defined(HAVE_SYS_SYSCALL_H) && defined(SYS_fork)
exit (1);
}
- fprintf (stderr, "\nDebug info from gdb:\n\n");
+ mono_runtime_printf_err ("\nDebug info from gdb:\n");
waitpid (pid, &status, 0);
}
#endif
* on anything working. So try to print out lots of diagnostics, starting
* with ones which have a greater chance of working.
*/
- fprintf (stderr,
+ mono_runtime_printf_err (
"\n"
"=================================================================\n"
"Got a %s while executing native code. This usually indicates\n"
"a fatal error in the mono runtime or one of the native libraries \n"
"used by your application.\n"
- "=================================================================\n"
- "\n", signal_str);
+ "=================================================================\n",
+ signal_str);
}
#endif
mono_walk_stack_with_ctx (print_stack_frame_to_string, &ctx, MONO_UNWIND_LOOKUP_ALL, text);
#else
- printf ("\t<Stack traces in thread dumps not supported on this platform>\n");
+ mono_runtime_printf ("\t<Stack traces in thread dumps not supported on this platform>");
#endif
- fprintf (stdout, "%s", text->str);
+ mono_runtime_printf ("%s", text->str);
#if PLATFORM_WIN32 && TARGET_WIN32 && _DEBUG
OutputDebugStringA(text->str);
#endif
g_string_free (text, TRUE);
- fflush (stdout);
+ mono_runtime_stdout_fflush ();
}
/*
MonoString *str = mono_object_to_string (exc, &other);
if (str) {
char *msg = mono_string_to_utf8 (str);
- fprintf (stderr, "[ERROR] FATAL UNHANDLED EXCEPTION: %s\n", msg);
- fflush (stderr);
+ mono_runtime_printf_err ("[ERROR] FATAL UNHANDLED EXCEPTION: %s", msg);
g_free (msg);
}
+#if defined(__APPLE__) && defined(__arm__)
+ g_assertion_message ("Terminating runtime due to unhandled exception");
+#else
exit (mono_environment_exitcode_get ());
+#endif
}
g_assert_not_reached ();
ji = frame.ji;
+ // FIXME: For skipped frames, scan the param area of the parent frame conservatively ?
+
if (frame.type == FRAME_TYPE_MANAGED_TO_NATIVE) {
/*
* These frames are problematic for several reasons:
return (slot * SIZEOF_SLOT) + gcfg->min_offset;
}
-static inline void
+static inline MONO_ALWAYS_INLINE void
set_slot (MonoCompileGC *gcfg, int slot, int callsite_index, GCSlotType type)
{
g_assert (slot >= 0 && slot < gcfg->nslots);
if (type == SLOT_PIN) {
- clear_bit (gcfg->stack_ref_bitmap, gcfg->stack_bitmap_width, callsite_index, slot);
- set_bit (gcfg->stack_pin_bitmap, gcfg->stack_bitmap_width, callsite_index, slot);
+ clear_bit (gcfg->stack_ref_bitmap, gcfg->stack_bitmap_width, slot, callsite_index);
+ set_bit (gcfg->stack_pin_bitmap, gcfg->stack_bitmap_width, slot, callsite_index);
} else if (type == SLOT_REF) {
- set_bit (gcfg->stack_ref_bitmap, gcfg->stack_bitmap_width, callsite_index, slot);
- clear_bit (gcfg->stack_pin_bitmap, gcfg->stack_bitmap_width, callsite_index, slot);
+ set_bit (gcfg->stack_ref_bitmap, gcfg->stack_bitmap_width, slot, callsite_index);
+ clear_bit (gcfg->stack_pin_bitmap, gcfg->stack_bitmap_width, slot, callsite_index);
} else if (type == SLOT_NOREF) {
- clear_bit (gcfg->stack_ref_bitmap, gcfg->stack_bitmap_width, callsite_index, slot);
- clear_bit (gcfg->stack_pin_bitmap, gcfg->stack_bitmap_width, callsite_index, slot);
+ clear_bit (gcfg->stack_ref_bitmap, gcfg->stack_bitmap_width, slot, callsite_index);
+ clear_bit (gcfg->stack_pin_bitmap, gcfg->stack_bitmap_width, slot, callsite_index);
}
}
static inline void
set_slot_everywhere (MonoCompileGC *gcfg, int slot, GCSlotType type)
{
+ int width, pos;
+ guint8 *ref_bitmap, *pin_bitmap;
+
+ /*
int cindex;
for (cindex = 0; cindex < gcfg->ncallsites; ++cindex)
set_slot (gcfg, slot, cindex, type);
+ */
+ ref_bitmap = gcfg->stack_ref_bitmap;
+ pin_bitmap = gcfg->stack_pin_bitmap;
+ width = gcfg->stack_bitmap_width;
+ pos = width * slot;
+
+ if (type == SLOT_PIN) {
+ memset (ref_bitmap + pos, 0, width);
+ memset (pin_bitmap + pos, 0xff, width);
+ } else if (type == SLOT_REF) {
+ memset (ref_bitmap + pos, 0xff, width);
+ memset (pin_bitmap + pos, 0, width);
+ } else if (type == SLOT_NOREF) {
+ memset (ref_bitmap + pos, 0, width);
+ memset (pin_bitmap + pos, 0, width);
+ }
}
static inline void
g_assert (slot >= 0 && slot < gcfg->nregs);
if (type == SLOT_PIN) {
- clear_bit (gcfg->reg_ref_bitmap, gcfg->reg_bitmap_width, callsite_index, slot);
- set_bit (gcfg->reg_pin_bitmap, gcfg->reg_bitmap_width, callsite_index, slot);
+ clear_bit (gcfg->reg_ref_bitmap, gcfg->reg_bitmap_width, slot, callsite_index);
+ set_bit (gcfg->reg_pin_bitmap, gcfg->reg_bitmap_width, slot, callsite_index);
} else if (type == SLOT_REF) {
- set_bit (gcfg->reg_ref_bitmap, gcfg->reg_bitmap_width, callsite_index, slot);
- clear_bit (gcfg->reg_pin_bitmap, gcfg->reg_bitmap_width, callsite_index, slot);
+ set_bit (gcfg->reg_ref_bitmap, gcfg->reg_bitmap_width, slot, callsite_index);
+ clear_bit (gcfg->reg_pin_bitmap, gcfg->reg_bitmap_width, slot, callsite_index);
} else if (type == SLOT_NOREF) {
- clear_bit (gcfg->reg_ref_bitmap, gcfg->reg_bitmap_width, callsite_index, slot);
- clear_bit (gcfg->reg_pin_bitmap, gcfg->reg_bitmap_width, callsite_index, slot);
+ clear_bit (gcfg->reg_ref_bitmap, gcfg->reg_bitmap_width, slot, callsite_index);
+ clear_bit (gcfg->reg_pin_bitmap, gcfg->reg_bitmap_width, slot, callsite_index);
}
}
if (ins->inst_offset % SIZEOF_SLOT != 0)
continue;
- if (is_arg && ins->inst_offset >= gcfg->max_offset)
- /* In parent frame */
- continue;
-
pos = fp_offset_to_slot (cfg, ins->inst_offset);
if (is_arg && ins->flags & MONO_INST_IS_DEAD) {
* before the liveness pass. We emit OP_GC_LIVENESS_DEF instructions for
* them during VZERO decomposition.
*/
- if (!pc_offsets [vmv->vreg])
- pin = TRUE;
+ if (!is_arg) {
+ if (!pc_offsets [vmv->vreg])
+ pin = TRUE;
- if (ins->backend.is_pinvoke)
- pin = TRUE;
+ if (ins->backend.is_pinvoke)
+ pin = TRUE;
+ }
if (bitmap) {
for (cindex = 0; cindex < gcfg->ncallsites; ++cindex) {
if (!mini_type_is_reference (cfg, t)) {
set_slot_everywhere (gcfg, pos, SLOT_NOREF);
if (cfg->verbose_level > 1)
- printf ("\tnoref at %s0x%x(fp) (R%d, slot = %d): %s\n", ins->inst_offset < 0 ? "-" : "", (ins->inst_offset < 0) ? -(int)ins->inst_offset : (int)ins->inst_offset, vmv->vreg, pos, mono_type_full_name (ins->inst_vtype));
+ printf ("\tnoref%s at %s0x%x(fp) (R%d, slot = %d): %s\n", (is_arg ? " arg" : ""), ins->inst_offset < 0 ? "-" : "", (ins->inst_offset < 0) ? -(int)ins->inst_offset : (int)ins->inst_offset, vmv->vreg, pos, mono_type_full_name (ins->inst_vtype));
if (!t->byref && sizeof (mgreg_t) == 4 && (t->type == MONO_TYPE_I8 || t->type == MONO_TYPE_U8 || t->type == MONO_TYPE_R8)) {
set_slot_everywhere (gcfg, pos + 1, SLOT_NOREF);
if (cfg->verbose_level > 1)
}
if (cfg->verbose_level > 1) {
- printf ("\tref at %s0x%x(fp) (R%d, slot = %d): %s\n", ins->inst_offset < 0 ? "-" : "", (ins->inst_offset < 0) ? -(int)ins->inst_offset : (int)ins->inst_offset, vmv->vreg, pos, mono_type_full_name (ins->inst_vtype));
+ printf ("\tref%s at %s0x%x(fp) (R%d, slot = %d): %s\n", (is_arg ? " arg" : ""), ins->inst_offset < 0 ? "-" : "", (ins->inst_offset < 0) ? -(int)ins->inst_offset : (int)ins->inst_offset, vmv->vreg, pos, mono_type_full_name (ins->inst_vtype));
}
}
#endif
}
-static GCSlotType
-type_to_gc_slot_type (MonoCompile *cfg, MonoType *t)
-{
- if (t->byref)
- return SLOT_PIN;
- t = mini_type_get_underlying_type (NULL, t);
- if (mini_type_is_reference (cfg, t))
- return SLOT_REF;
- else {
- if (MONO_TYPE_ISSTRUCT (t)) {
- MonoClass *klass = mono_class_from_mono_type (t);
- if (!klass->has_references) {
- return SLOT_NOREF;
- } else {
- // FIXME:
- return SLOT_PIN;
- }
- }
- return SLOT_NOREF;
- }
-}
-
static void
process_param_area_slots (MonoCompile *cfg)
{
set_slot_everywhere (gcfg, i, SLOT_NOREF);
}
- for (cindex = 0; cindex < gcfg->ncallsites; ++cindex) {
- GCCallSite *callsite = gcfg->callsites [cindex];
- GSList *l;
-
- for (l = callsite->param_slots; l; l = l->next) {
- MonoInst *def = l->data;
- MonoType *t = def->inst_vtype;
- int sp_offset = def->inst_offset;
- int fp_offset = sp_offset_to_fp_offset (cfg, sp_offset);
- int slot = fp_offset_to_slot (cfg, fp_offset);
- GCSlotType type = type_to_gc_slot_type (cfg, t);
-
- if (MONO_TYPE_ISSTRUCT (t)) {
- guint32 align;
- guint32 size;
- int size_in_slots;
- gsize *bitmap;
- int j, numbits;
-
- size = mini_type_stack_size_full (cfg->generic_sharing_context, t, &align, FALSE);
- size_in_slots = ALIGN_TO (size, SIZEOF_SLOT) / SIZEOF_SLOT;
-
- bitmap = get_vtype_bitmap (t, &numbits);
- if (type == SLOT_NOREF || !bitmap) {
- for (i = 0; i < size_in_slots; ++i) {
- set_slot_in_range (gcfg, slot + i, def->backend.pc_offset, callsite->pc_offset + 1, type);
- }
- if (cfg->verbose_level > 1)
- printf ("\t%s param area slots at %s0x%x(fp)=0x%x(sp) (slot = %d-%d) [0x%x-0x%x]\n", slot_type_to_string (type), get_offset_sign (fp_offset), get_offset_val (fp_offset), sp_offset, slot, slot + (size / (int)sizeof (mgreg_t)), def->backend.pc_offset, callsite->pc_offset + 1);
- } else {
- for (j = 0; j < numbits; ++j) {
- if (bitmap [j / GC_BITS_PER_WORD] & ((gsize)1 << (j % GC_BITS_PER_WORD))) {
- /* The descriptor is for the boxed object */
- set_slot (gcfg, (slot + j - (sizeof (MonoObject) / SIZEOF_SLOT)), cindex, SLOT_REF);
- }
- }
- if (cfg->verbose_level > 1)
- printf ("\tvtype param area slots at %s0x%x(fp)=0x%x(sp) (slot = %d-%d) [0x%x-0x%x]\n", get_offset_sign (fp_offset), get_offset_val (fp_offset), sp_offset, slot, slot + (size / (int)sizeof (mgreg_t)), def->backend.pc_offset, callsite->pc_offset + 1);
- }
- g_free (bitmap);
- } else {
- /* The slot is live between the def instruction and the call */
- set_slot_in_range (gcfg, slot, def->backend.pc_offset, callsite->pc_offset + 1, type);
- if (cfg->verbose_level > 1)
- printf ("\t%s param area slot at %s0x%x(fp)=0x%x(sp) (slot = %d) [0x%x-0x%x]\n", slot_type_to_string (type), get_offset_sign (fp_offset), get_offset_val (fp_offset), sp_offset, slot, def->backend.pc_offset, callsite->pc_offset + 1);
- }
- }
- }
+ /*
+ * We treat param area slots as being part of the callee's frame, to be able to handle tail calls which overwrite
+ * the argument area of the caller.
+ */
}
static void
for (i = 0; i < sig->param_count + sig->hasthis; ++i) {
MonoInst *ins = cfg->args [i];
- if (ins->opcode == OP_REGOFFSET)
+ if (ins->opcode == OP_REGOFFSET) {
+ int size, size_in_slots;
+ size = mini_type_stack_size_full (cfg->generic_sharing_context, ins->inst_vtype, NULL, ins->backend.is_pinvoke);
+ size_in_slots = ALIGN_TO (size, SIZEOF_SLOT) / SIZEOF_SLOT;
+
min_offset = MIN (min_offset, ins->inst_offset);
+ max_offset = MAX ((int)max_offset, (int)(ins->inst_offset + (size_in_slots * SIZEOF_SLOT)));
+ }
}
/* Cfa slots */
gcfg->nregs = nregs;
gcfg->callsites = callsites;
gcfg->ncallsites = ncallsites;
- gcfg->stack_bitmap_width = ALIGN_TO (nslots, 8) / 8;
- gcfg->reg_bitmap_width = ALIGN_TO (nregs, 8) / 8;
- gcfg->stack_ref_bitmap = mono_mempool_alloc0 (cfg->mempool, gcfg->stack_bitmap_width * ncallsites);
- gcfg->stack_pin_bitmap = mono_mempool_alloc0 (cfg->mempool, gcfg->stack_bitmap_width * ncallsites);
- gcfg->reg_ref_bitmap = mono_mempool_alloc0 (cfg->mempool, gcfg->reg_bitmap_width * ncallsites);
- gcfg->reg_pin_bitmap = mono_mempool_alloc0 (cfg->mempool, gcfg->reg_bitmap_width * ncallsites);
+ gcfg->stack_bitmap_width = ALIGN_TO (ncallsites, 8) / 8;
+ gcfg->reg_bitmap_width = ALIGN_TO (ncallsites, 8) / 8;
+ gcfg->stack_ref_bitmap = mono_mempool_alloc0 (cfg->mempool, gcfg->stack_bitmap_width * nslots);
+ gcfg->stack_pin_bitmap = mono_mempool_alloc0 (cfg->mempool, gcfg->stack_bitmap_width * nslots);
+ gcfg->reg_ref_bitmap = mono_mempool_alloc0 (cfg->mempool, gcfg->reg_bitmap_width * nregs);
+ gcfg->reg_pin_bitmap = mono_mempool_alloc0 (cfg->mempool, gcfg->reg_bitmap_width * nregs);
/* All slots start out as PIN */
- memset (gcfg->stack_pin_bitmap, 0xff, gcfg->stack_bitmap_width * ncallsites);
+ memset (gcfg->stack_pin_bitmap, 0xff, gcfg->stack_bitmap_width * nregs);
for (i = 0; i < nregs; ++i) {
/*
* By default, registers are NOREF.
}
}
+static inline gboolean
+has_bit_set (guint8 *bitmap, int width, int slot)
+{
+ int i;
+ int pos = width * slot;
+
+ for (i = 0; i < width; ++i) {
+ if (bitmap [pos + i])
+ break;
+ }
+ return i < width;
+}
+
static void
create_map (MonoCompile *cfg)
{
gboolean has_ref = FALSE;
gboolean has_pin = FALSE;
- for (j = 0; j < ncallsites; ++j) {
- if (get_bit (gcfg->stack_pin_bitmap, gcfg->stack_bitmap_width, j, i))
- has_pin = TRUE;
- if (get_bit (gcfg->stack_ref_bitmap, gcfg->stack_bitmap_width, j, i))
- has_ref = TRUE;
- }
+ if (has_bit_set (gcfg->stack_pin_bitmap, gcfg->stack_bitmap_width, i))
+ has_pin = TRUE;
+ if (has_bit_set (gcfg->stack_ref_bitmap, gcfg->stack_bitmap_width, i))
+ has_ref = TRUE;
if (has_ref)
has_ref_slots = TRUE;
if (!(cfg->used_int_regs & (1 << i)))
continue;
- for (j = 0; j < ncallsites; ++j) {
- if (get_bit (gcfg->reg_ref_bitmap, gcfg->reg_bitmap_width, j, i)) {
- has_ref = TRUE;
- break;
- }
- }
- for (j = 0; j < ncallsites; ++j) {
- if (get_bit (gcfg->reg_pin_bitmap, gcfg->reg_bitmap_width, j, i)) {
- has_pin = TRUE;
- break;
- }
- }
+ if (has_bit_set (gcfg->reg_pin_bitmap, gcfg->reg_bitmap_width, i))
+ has_pin = TRUE;
+ if (has_bit_set (gcfg->reg_ref_bitmap, gcfg->reg_bitmap_width, i))
+ has_ref = TRUE;
if (has_ref) {
reg_ref_mask |= (1 << i);
/* Create the GC Map */
+ /* The work bitmaps have one row for each slot, since this is how we access them during construction */
stack_bitmap_width = ALIGN_TO (end - start, 8) / 8;
stack_bitmap_size = stack_bitmap_width * ncallsites;
reg_ref_bitmap_width = ALIGN_TO (nref_regs, 8) / 8;
bitmap = &bitmaps [map->stack_ref_bitmap_offset];
for (i = 0; i < nslots; ++i) {
for (j = 0; j < ncallsites; ++j) {
- if (get_bit (gcfg->stack_ref_bitmap, gcfg->stack_bitmap_width, j, i))
+ if (get_bit (gcfg->stack_ref_bitmap, gcfg->stack_bitmap_width, i, j))
set_bit (bitmap, stack_bitmap_width, j, i - start);
}
}
bitmap = &bitmaps [map->stack_pin_bitmap_offset];
for (i = 0; i < nslots; ++i) {
for (j = 0; j < ncallsites; ++j) {
- if (get_bit (gcfg->stack_pin_bitmap, gcfg->stack_bitmap_width, j, i))
+ if (get_bit (gcfg->stack_pin_bitmap, gcfg->stack_bitmap_width, i, j))
set_bit (bitmap, stack_bitmap_width, j, i - start);
}
}
for (i = 0; i < nregs; ++i) {
if (reg_ref_mask & (1 << i)) {
for (j = 0; j < ncallsites; ++j) {
- if (get_bit (gcfg->reg_ref_bitmap, gcfg->reg_bitmap_width, j, i))
+ if (get_bit (gcfg->reg_ref_bitmap, gcfg->reg_bitmap_width, i, j))
set_bit (bitmap, reg_ref_bitmap_width, j, bindex);
}
bindex ++;
for (i = 0; i < nregs; ++i) {
if (reg_pin_mask & (1 << i)) {
for (j = 0; j < ncallsites; ++j) {
- if (get_bit (gcfg->reg_pin_bitmap, gcfg->reg_bitmap_width, j, i))
+ if (get_bit (gcfg->reg_pin_bitmap, gcfg->reg_bitmap_width, i, j))
set_bit (bitmap, reg_pin_bitmap_width, j, bindex);
}
bindex ++;
// possible
//
+#include "config.h"
+//undef those as llvm defines them on its own config.h as well.
+#undef PACKAGE_BUGREPORT
+#undef PACKAGE_NAME
+#undef PACKAGE_STRING
+#undef PACKAGE_TARNAME
+#undef PACKAGE_VERSION
+
#include <stdint.h>
#include <llvm/Support/raw_ostream.h>
((LLVM_MAJOR_VERSION > (major)) || \
((LLVM_MAJOR_VERSION == (major)) && (LLVM_MINOR_VERSION >= (minor))))
+// extern "C" void LLVMInitializeARMTargetInfo();
+// extern "C" void LLVMInitializeARMTarget ();
+// extern "C" void LLVMInitializeARMTargetMC ();
+
using namespace llvm;
class MonoJITMemoryManager : public JITMemoryManager
}
virtual void* getPointerToNamedFunction(const std::string &Name, bool AbortOnFailure) {
- if (!strcmp (Name.c_str (), "__bzero")) {
- return (void*)bzero;
- } else {
- void *res;
- char *err;
-
- err = dlsym_cb (Name.c_str (), &res);
- if (err) {
- outs () << "Unable to resolve: " << Name << ": " << err << "\n";
- assert(0);
- return NULL;
- }
- return res;
+ void *res;
+ char *err;
+
+ err = dlsym_cb (Name.c_str (), &res);
+ if (err) {
+ outs () << "Unable to resolve: " << Name << ": " << err << "\n";
+ assert(0);
+ return NULL;
}
+ return res;
}
};
force_pass_linking ();
+#ifdef TARGET_ARM
+ LLVMInitializeARMTarget ();
+ LLVMInitializeARMTargetInfo ();
+ LLVMInitializeARMTargetMC ();
+#else
LLVMInitializeX86Target ();
LLVMInitializeX86TargetInfo ();
LLVMInitializeX86TargetMC ();
+#endif
mono_mm = new MonoJITMemoryManager ();
mono_mm->alloc_cb = alloc_cb;
simd_op_to_intrins (int opcode)
{
switch (opcode) {
-#ifdef MONO_ARCH_SIMD_INTRINSICS
+#if defined(TARGET_X86) || defined(TARGET_AMD64)
case OP_MINPD:
return "llvm.x86.sse2.min.pd";
case OP_MINPS:
static LLVMTypeRef
simd_op_to_llvm_type (int opcode)
{
-#ifdef MONO_ARCH_SIMD_INTRINSICS
+#if defined(TARGET_X86) || defined(TARGET_AMD64)
switch (opcode) {
case OP_EXTRACT_R8:
case OP_EXPAND_R8:
LLVMValueRef *args;
LLVMCallInfo *cinfo;
GSList *l;
- int i, len;
+ int i, len, nargs;
gboolean vretaddr;
LLVMTypeRef llvm_sig;
gpointer target;
/*
* Collect and convert arguments
*/
- len = sizeof (LLVMValueRef) * ((sig->param_count * 2) + sig->hasthis + vretaddr + call->rgctx_reg);
+ nargs = (sig->param_count * 2) + sig->hasthis + vretaddr + call->rgctx_reg + call->imt_arg_reg;
+ len = sizeof (LLVMValueRef) * nargs;
args = alloca (len);
memset (args, 0, len);
l = call->out_ireg_args;
if (call->rgctx_arg_reg) {
g_assert (values [call->rgctx_arg_reg]);
+ g_assert (sinfo.rgctx_arg_pindex < nargs);
args [sinfo.rgctx_arg_pindex] = values [call->rgctx_arg_reg];
}
if (call->imt_arg_reg) {
g_assert (values [call->imt_arg_reg]);
+ g_assert (sinfo.imt_arg_pindex < nargs);
args [sinfo.imt_arg_pindex] = values [call->imt_arg_reg];
}
if (vretaddr) {
if (!addresses [call->inst.dreg])
addresses [call->inst.dreg] = build_alloca (ctx, sig->ret);
+ g_assert (sinfo.vret_arg_pindex < nargs);
args [sinfo.vret_arg_pindex] = LLVMBuildPtrToInt (builder, addresses [call->inst.dreg], IntPtrType (), "");
}
/*
* SIMD
*/
-#ifdef MONO_ARCH_SIMD_INTRINSICS
+#if defined(TARGET_X86) || defined(TARGET_AMD64)
case OP_XZERO: {
values [ins->dreg] = LLVMConstNull (type_to_llvm_type (ctx, &ins->klass->byval_arg));
break;
void
mono_llvm_check_method_supported (MonoCompile *cfg)
{
- /*
MonoMethodHeader *header = cfg->header;
MonoExceptionClause *clause;
int i;
- */
if (cfg->method->save_lmf) {
cfg->exception_message = g_strdup ("lmf");
cfg->disable_llvm = TRUE;
}
-#if 0
+#if 1
for (i = 0; i < header->num_clauses; ++i) {
clause = &header->clauses [i];
dlsym_cb (const char *name, void **symbol)
{
MonoDl *current;
+ char *err;
- current = mono_dl_open (NULL, 0, NULL);
- g_assert (current);
+ err = NULL;
+ if (!strcmp (name, "__bzero")) {
+ *symbol = (void*)bzero;
+ } else {
+ current = mono_dl_open (NULL, 0, NULL);
+ g_assert (current);
- return mono_dl_symbol (current, name, symbol);
+ err = mono_dl_symbol (current, name, symbol);
+ }
+#ifdef MONO_ARCH_HAVE_CREATE_LLVM_NATIVE_THUNK
+ *symbol = (char*)mono_arch_create_llvm_native_thunk (mono_domain_get (), (guint8*)(*symbol));
+#endif
+ return err;
}
static inline void
MINI_OP(OP_STORER4_MEMBASE_REG, "storer4_membase_reg", IREG, FREG, NONE)
MINI_OP(OP_STORER8_MEMBASE_REG, "storer8_membase_reg", IREG, FREG, NONE)
-#ifdef MONO_ARCH_SIMD_INTRINSICS
+#if defined(TARGET_X86) || defined(TARGET_AMD64)
MINI_OP(OP_STOREX_MEMBASE_REG, "storex_membase_reg", IREG, XREG, NONE)
MINI_OP(OP_STOREX_ALIGNED_MEMBASE_REG, "storex_aligned_membase_reg", IREG, XREG, NONE)
MINI_OP(OP_STOREX_NTA_MEMBASE_REG, "storex_nta_membase_reg", IREG, XREG, NONE)
MINI_OP(OP_LOADX_MEMBASE, "loadx_membase", XREG, IREG, NONE)
-#ifdef MONO_ARCH_SIMD_INTRINSICS
+#if defined(TARGET_X86) || defined(TARGET_AMD64)
MINI_OP(OP_LOADX_ALIGNED_MEMBASE, "loadx_aligned_membase", XREG, IREG, NONE)
#endif
/* SIMD opcodes. */
-#ifdef MONO_ARCH_SIMD_INTRINSICS
+#if defined(TARGET_X86) || defined(TARGET_AMD64)
MINI_OP(OP_ADDPS, "addps", XREG, XREG, XREG)
MINI_OP(OP_DIVPS, "divps", XREG, XREG, XREG)
MonoCallInst *call = (MonoCallInst*)ins;
int pos = 0, i;
+ ins->flags |= MONO_INST_GC_CALLSITE;
+ ins->backend.pc_offset = code - cfg->native_code;
+
/* FIXME: no tracing support... */
if (cfg->prof_options & MONO_PROFILE_ENTER_LEAVE)
code = mono_arch_instrument_epilog (cfg, mono_profiler_method_leave, code, FALSE);
{
if ((code [0] == 0x8b) && (x86_modrm_mod (code [1]) == 0x2))
return 2;
- else if ((code [0] == 0xba))
+ else if (code [0] == 0xba)
return 1;
- else if ((code [0] == 0x68))
+ else if (code [0] == 0x68)
/* push IMM */
return 1;
else if ((code [0] == 0xff) && (x86_modrm_reg (code [1]) == 0x6))
}
/* collect statistics */
+#ifndef DISABLE_PERFCOUNTERS
mono_perfcounters->jit_methods++;
mono_perfcounters->jit_bytes += header->code_size;
+#endif
mono_jit_stats.allocated_code_size += cfg->code_len;
code_size_ratio = cfg->code_len;
if (code_size_ratio > mono_jit_stats.biggest_method_size && mono_jit_stats.enabled) {
if (mono_aot_only) {
char *fullname = mono_method_full_name (method, TRUE);
- char *msg = g_strdup_printf ("Attempting to JIT compile method '%s' while running with --aot-only.\n", fullname);
+ char *msg = g_strdup_printf ("Attempting to JIT compile method '%s' while running with --aot-only. See http://docs.xamarin.com/ios/about/limitations for more information.\n", fullname);
*jit_ex = mono_get_exception_execution_engine (msg);
g_free (fullname);
invalidated_delegate_trampoline (char *desc)
{
g_error ("Unmanaged code called delegate of type %s which was already garbage collected.\n"
- "See http://www.go-mono.com/delegate.html for an explanation and ways to fix this.",
+ "See http://www.mono-project.com/Diagnostic:Delegate for an explanation and ways to fix this.",
desc);
}
#endif
g_thread_init (NULL);
mono_native_tls_alloc (&mono_jit_tls_id, NULL);
- setup_jit_tls_data ((gpointer)-1, mono_thread_abort);
if (default_opt & MONO_OPT_AOT)
mono_aot_init ();
mono_add_internal_call ("Mono.Runtime::mono_runtime_install_handlers",
mono_runtime_install_handlers);
+#ifdef PLATFORM_ANDROID
+ mono_add_internal_call ("System.Diagnostics.Debugger::Mono_UnhandledException_internal",
+ mono_debugger_agent_unhandled_exception);
+#endif
+
mono_create_helper_signatures ();
register_jit_stats ();
typedef enum {
MONO_AOT_FILE_FLAG_WITH_LLVM = 1,
MONO_AOT_FILE_FLAG_FULL_AOT = 2,
- MONO_AOT_FILE_FLAG_DEBUG = 4
+ MONO_AOT_FILE_FLAG_DEBUG = 4,
+ MONO_AOT_FILE_FLAG_DIRECT_METHOD_ADDRESSES = 8
} MonoAotFileFlags;
/* This structure is stored in the AOT file */
gpointer method_info_offsets;
gpointer ex_info_offsets;
gpointer code_offsets;
+#ifdef MONOTOUCH
+ gpointer method_addresses;
+#endif
gpointer extra_method_info_offsets;
gpointer extra_method_table;
gpointer got_info_offsets;
gpointer mono_arch_get_nullified_class_init_trampoline (MonoTrampInfo **info) MONO_INTERNAL;
gpointer mono_arch_create_monitor_enter_trampoline (MonoTrampInfo **info, gboolean aot) MONO_INTERNAL;
gpointer mono_arch_create_monitor_exit_trampoline (MonoTrampInfo **info, gboolean aot) MONO_INTERNAL;
+guint8 *mono_arch_create_llvm_native_thunk (MonoDomain *domain, guint8* addr) MONO_LLVM_INTERNAL;
GList *mono_arch_get_allocatable_int_vars (MonoCompile *cfg) MONO_INTERNAL;
GList *mono_arch_get_global_int_regs (MonoCompile *cfg) MONO_INTERNAL;
GList *mono_arch_get_global_fp_regs (MonoCompile *cfg) MONO_INTERNAL;
#include <mono/utils/mono-time.h>
#include "trace.h"
+#if defined (PLATFORM_ANDROID) || (defined (TARGET_IOS) && defined (TARGET_IOS))
+# undef printf
+# define printf(...) g_log("mono", G_LOG_LEVEL_MESSAGE, __VA_ARGS__)
+# undef fprintf
+# define fprintf(__ignore, ...) g_log ("mono-gc", G_LOG_LEVEL_MESSAGE, __VA_ARGS__)
+#endif
+
static MonoTraceSpec trace_spec;
gboolean
#endif
}
+guint8*
+mono_arch_create_llvm_native_thunk (MonoDomain *domain, guint8 *addr)
+{
+ /*
+ * The caller is LLVM code and the call displacement might exceed 32 bits. We can't determine the caller address, so
+ * we add a thunk every time.
+ * Since the caller is also allocated using the domain code manager, hopefully the displacement will fit into 32 bits.
+ * FIXME: Avoid this if possible if !MONO_ARCH_NOMAP32BIT and ADDR is 32 bits.
+ */
+ guint8 *thunk_start, *thunk_code;
+
+ thunk_start = thunk_code = mono_domain_code_reserve (mono_domain_get (), 32);
+ amd64_jump_membase (thunk_code, AMD64_RIP, 0);
+ *(guint64*)thunk_code = (guint64)addr;
+ addr = thunk_start;
+ mono_arch_flush_icache (thunk_start, thunk_code - thunk_start);
+ return addr;
+}
+
void
mono_arch_patch_plt_entry (guint8 *code, gpointer *got, mgreg_t *regs, guint8 *addr)
{
{
guint32 ins = ((guint32*)(gpointer)code) [-1];
+#if MONOTOUCH
+ /* Should be a 'bl' or a 'b' */
+ if (((ins >> 25) & 0x7) == 0x5) {
+#else
/* Should be a 'bl' */
if ((((ins >> 25) & 0x7) == 0x5) && (((ins >> 24) & 0x1) == 0x1)) {
+#endif
gint32 disp = ((gint32)ins) & 0xffffff;
guint8 *target = code - 4 + 8 + (disp * 4);
*/
code -= 6;
orig_code -= 6;
- if ((code [1] == 0xe8)) {
+ if (code [1] == 0xe8) {
if (can_write) {
InterlockedExchange ((gint32*)(orig_code + 2), (guint)addr - ((guint)orig_code + 1) - 5);
endif
if JIT_SUPPORTED
+if DISABLE_EXECUTABLES
+runtime_lib=../mini/$(LIBMONO_LA) $(static_libs)
+else
if !SHARED_MONO
static_libs= \
$(top_builddir)/mono/metadata/libmonoruntime-static.la \
else
runtime_lib=../mini/$(LIBMONO_LA)
endif
+endif
else
runtime_lib=../interpreter/libmint.la
endif
+if DISABLE_LIBRARIES
+else
bin_PROGRAMS = monograph
+endif
AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir) \
$(GLIB_CFLAGS)
+if !DISABLE_LIBRARIES
if !DISABLE_PROFILER
if JIT_SUPPORTED
bin_PROGRAMS = mprof-report
if PLATFORM_DARWIN
libmono_profiler_log_la_LDFLAGS = -Wl,-undefined -Wl,suppress -Wl,-flat_namespace
endif
+if PLATFORM_ANDROID
+libmono_profiler_log_la_LDFLAGS = -avoid-version
+endif
+endif
endif
endif
endif
if SUPPORT_BOEHM
+if DISABLE_EXECUTABLES
+LIBMONO=$(top_builddir)/mono/mini/$(LIBMONO_LA)
+else
if !SHARED_MONO
static_libs= \
$(top_builddir)/mono/metadata/libmonoruntime-static.la \
else
LIBMONO=$(top_builddir)/mono/mini/$(LIBMONO_LA)
endif
+endif
else
LIBMONO=$(top_builddir)/mono/mini/libmonosgen-$(API_VER).la
endif
libmono_profiler_log_la_SOURCES = proflog.c
libmono_profiler_log_la_LIBADD = $(LIBMONO) $(Z_LIBS)
+if PLATFORM_ANDROID
+libmono_profiler_log_la_LIBADD += $(GLIB_LIBS)
+endif
+
mprof_report_SOURCES = decode.c
mprof_report_LDADD = $(Z_LIBS)
@$(RUNTIME) load-exceptions.exe > load-exceptions.exe.stdout 2> load-exceptions.exe.stderr
-EXTRA_DIST += sgen-bridge.cs sgen-descriptors.cs sgen-gshared-vtype.cs sgen-bridge-major-fragmentation.cs
+EXTRA_DIST += sgen-bridge.cs sgen-descriptors.cs sgen-gshared-vtype.cs sgen-bridge-major-fragmentation.cs sgen-domain-unload.cs
SGEN_TESTS = \
sgen-descriptors.exe \
- sgen-gshared-vtype.exe
+ sgen-gshared-vtype.exe \
+ sgen-domain-unload.exe
sgen-regular-tests: $(SGEN_TESTS)
@for fn in $+ ; do \
echo "Testing $$fn ..."; \
- MONO_GC_PARAMS=major=marksweep-par MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) $$fn > $$fn.stdout 2> $$fn.stderr || exit 1; \
- MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) $$fn > $$fn.stdout 2> $$fn.stderr || exit 1; \
- MONO_GC_PARAMS=major=marksweep-par,minor=split MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) $$fn > $$fn.stdout 2> $$fn.stderr || exit 1; \
- MONO_GC_PARAMS=minor=split MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) $$fn > $$fn.stdout 2> $$fn.stderr || exit 1; \
- MONO_GC_PARAMS=major=marksweep,concurrent-sweep MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) $$fn > $$fn.stdout 2> $$fn.stderr || exit 1; \
- MONO_GC_PARAMS=minor=split,major=marksweep,concurrent-sweep MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) $$fn > $$fn.stdout 2> $$fn.stderr || exit 1; \
- MONO_GC_PARAMS=major=marksweep-par,minor=split,alloc-ratio=95 MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) $$fn > $$fn.stdout 2> $$fn.stderr || exit 1; \
- MONO_GC_PARAMS=minor=split,alloc-ratio=95 MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) $$fn > $$fn.stdout 2> $$fn.stderr || exit 1; \
+ MONO_GC_PARAMS=major=marksweep-par MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) $$fn > $$fn.1.stdout 2> $$fn.1.stderr || exit 1; \
+ MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) $$fn > $$fn.2.stdout 2> $$fn.2.stderr || exit 1; \
+ MONO_GC_PARAMS=major=marksweep-par,minor=split MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) $$fn > $$fn.3.stdout 2> $$fn.3.stderr || exit 1; \
+ MONO_GC_PARAMS=minor=split MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) $$fn > $$fn.4.stdout 2> $$fn.4.stderr || exit 1; \
+ MONO_GC_PARAMS=major=marksweep,concurrent-sweep MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) $$fn > $$fn.5.stdout 2> $$fn.5.stderr || exit 1; \
+ MONO_GC_PARAMS=minor=split,major=marksweep,concurrent-sweep MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) $$fn > $$fn.6.stdout 2> $$fn.6.stderr || exit 1; \
+ MONO_GC_PARAMS=major=marksweep-par,minor=split,alloc-ratio=95 MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) $$fn > $$fn.7.stdout 2> $$fn.7.stderr || exit 1; \
+ MONO_GC_PARAMS=minor=split,alloc-ratio=95 MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) $$fn > $$fn.8.stdout 2> $$fn.8.stderr || exit 1; \
done
sgen-tests: sgen-regular-tests sgen-bridge.exe sgen-bridge-major-fragmentation.exe
@echo "Testing sgen-bridge.exe ..."; \
- MONO_GC_PARAMS=bridge=Bridge MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) sgen-bridge.exe > sgen-bridge.exe.stdout 2> sgen-bridge.exe.stderr || exit 1; \
- MONO_GC_PARAMS=bridge=Bridge,minor=split MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) sgen-bridge.exe > sgen-bridge.exe.stdout 2> sgen-bridge.exe.stderr || exit 1; \
+ MONO_GC_PARAMS=bridge=Bridge MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) sgen-bridge.exe > sgen-bridge.exe.1.stdout 2> sgen-bridge.exe.1.stderr || exit 1; \
+ MONO_GC_PARAMS=bridge=Bridge,minor=split MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) sgen-bridge.exe > sgen-bridge.exe.2.stdout 2> sgen-bridge.exe.2.stderr || exit 1; \
echo "Testing sgen-bridge-major-fragmentation.exe ..."; \
- MONO_GC_PARAMS=bridge=Bridge MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) sgen-bridge-major-fragmentation.exe > sgen-bridge-major-fragmentation.exe.stdout 2> sgen-bridge-major-fragmentation.exe.stderr || exit 1; \
- MONO_GC_PARAMS=bridge=Bridge,minor=split MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) sgen-bridge-major-fragmentation.exe > sgen-bridge-major-fragmentation.exe.stdout 2> sgen-bridge-major-fragmentation.exe.stderr || exit 1;
+ MONO_GC_PARAMS=bridge=Bridge MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) sgen-bridge-major-fragmentation.exe > sgen-bridge-major-fragmentation.exe.1.stdout 2> sgen-bridge-major-fragmentation.exe.1.stderr || exit 1; \
+ MONO_GC_PARAMS=bridge=Bridge,minor=split MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) sgen-bridge-major-fragmentation.exe > sgen-bridge-major-fragmentation.exe.2.stdout 2> sgen-bridge-major-fragmentation.exe.2.stderr || exit 1;
# Generated tests for runtime invoke
throw new Exception ();
}
+ /*
+ * We allocate the exception object deep down the stack so
+ * that it doesn't get pinned.
+ */
+ public static void MakeException (int depth) {
+ if (depth <= 0) {
+ new FinalizerException ();
+ return;
+ }
+ MakeException (depth - 1);
+ }
+
public static int Main () {
AppDomain.CurrentDomain.UnhandledException += (sender, args) => {
Console.WriteLine ("caught");
Environment.Exit (0);
};
- new FinalizerException ();
+ MakeException (100);
GC.Collect ();
GC.WaitForPendingFinalizers ();
--- /dev/null
+using System;
+using System.Collections.Generic;
+
+public class Bar {
+ public object a, b, c;
+
+}
+class Driver {
+ static void ProduceSimpleHeapWithLOS () {
+ Console.WriteLine ("running in {0}", AppDomain.CurrentDomain);
+ byte[] a = new byte [4 * 1000 * 1000];
+ byte[] b = new byte [4 * 1000 * 1000];
+ byte[] c = new byte [4 * 1000 * 1000];
+ var lst = new List<object> ();
+
+ Bar la, lb, lc;
+ la = lb = lc = null;
+ for (int i = 0; i < 1000 * 200; ++i) {
+ var ba = new Bar ();
+ var bb = new Bar ();
+ var bc = new Bar ();
+ ba.a = la;
+ ba.b = bb;
+ ba.c = a;
+
+ bb.a = bc;
+ ba.b = b;
+ bb.c = lb;
+
+ bc.a = c;
+ bc.b = lc;
+ bc.c = ba;
+
+ la = ba;
+ lb = bb;
+ lc = bc;
+
+ lst.Add (ba);
+ }
+
+ }
+
+ static void SimpleHeapWithLOS () {
+ ProduceSimpleHeapWithLOS ();
+ }
+
+ static void CrossDomainTest (string name, CrossAppDomainDelegate dele) {
+ Console.WriteLine ("----Testing {0}----", name);
+ for (int i = 0; i < 20; ++i) {
+ var ad = AppDomain.CreateDomain (string.Format ("domain-{0}-{1}", name, i));
+ ad.DoCallBack (dele);
+ AppDomain.Unload (ad);
+ }
+ }
+
+ static void Main () {
+ CrossDomainTest ("simple-heap-with-los", Driver.SimpleHeapWithLOS);
+ }
+}
\ No newline at end of file
arch_sources =
+if !CROSS_COMPILE
+
if X86
arch_sources += mach-support-x86.c
endif
arch_sources += mach-support-arm.c
endif
+else
+
+arch_sources += mach-support-unknown.c
+
+endif
+
libmonoutils_la_SOURCES = $(monoutils_sources) $(arch_sources)
libmonoutilsincludedir = $(includedir)/mono-$(API_VER)/mono/utils
struct _MonoLockFreeAllocDescriptor {
MonoLockFreeQueueNode node;
MonoLockFreeAllocator *heap;
- Anchor anchor;
+ volatile Anchor anchor;
unsigned int slot_size;
unsigned int max_count;
gpointer sb;
#ifndef DESC_AVAIL_DUMMY
- Descriptor *next;
+ Descriptor * volatile next;
#endif
- gboolean in_use;
+ gboolean in_use; /* used for debugging only */
};
#define NUM_DESC_BATCH 64
typedef struct _MonoLockFreeQueueNode MonoLockFreeQueueNode;
struct _MonoLockFreeQueueNode {
- MonoLockFreeQueueNode *next;
+ MonoLockFreeQueueNode * volatile next;
#ifdef QUEUE_DEBUG
gint32 in_queue;
#endif
typedef struct {
MonoLockFreeQueueNode node;
- gint32 in_use;
+ volatile gint32 in_use;
} MonoLockFreeQueueDummy;
#define MONO_LOCK_FREE_QUEUE_NUM_DUMMIES 2
typedef struct {
- volatile MonoLockFreeQueueNode *head;
- volatile MonoLockFreeQueueNode *tail;
+ MonoLockFreeQueueNode * volatile head;
+ MonoLockFreeQueueNode * volatile tail;
MonoLockFreeQueueDummy dummies [MONO_LOCK_FREE_QUEUE_NUM_DUMMIES];
- gint32 has_dummy;
+ volatile gint32 has_dummy;
} MonoLockFreeQueue;
void mono_lock_free_queue_init (MonoLockFreeQueue *q) MONO_INTERNAL;
}
void
-mono_mach_arch_thread_state_to_mcontext (thread_state_t state, mcontext_t context)
+mono_mach_arch_thread_state_to_mcontext (thread_state_t state, void *context)
{
x86_thread_state64_t *arch_state = (x86_thread_state64_t *) state;
struct __darwin_mcontext64 *ctx = (struct __darwin_mcontext64 *) context;
}
void
-mono_mach_arch_mcontext_to_thread_state (mcontext_t context, thread_state_t state)
+mono_mach_arch_mcontext_to_thread_state (void *context, thread_state_t state)
{
x86_thread_state64_t *arch_state = (x86_thread_state64_t *) state;
struct __darwin_mcontext64 *ctx = (struct __darwin_mcontext64 *) context;
}
void
-mono_mach_arch_thread_state_to_mcontext (thread_state_t state, mcontext_t context)
+mono_mach_arch_thread_state_to_mcontext (thread_state_t state, void *context)
{
arm_thread_state_t *arch_state = (arm_thread_state_t *) state;
struct __darwin_mcontext *ctx = (struct __darwin_mcontext *) context;
}
void
-mono_mach_arch_mcontext_to_thread_state (mcontext_t context, thread_state_t state)
+mono_mach_arch_mcontext_to_thread_state (void *context, thread_state_t state)
{
arm_thread_state_t *arch_state = (arm_thread_state_t *) state;
struct __darwin_mcontext *ctx = (struct __darwin_mcontext *) context;
*count = ARM_THREAD_STATE_COUNT;
- ret = thread_get_state (thread, ARM_THREAD_STATE_COUNT, (thread_state_t) arch_state, count);
+ ret = thread_get_state (thread, ARM_THREAD_STATE, (thread_state_t) arch_state, count);
return ret;
}
--- /dev/null
+/*
+ * mach-support-unknown.c: mach support for cross compilers (IOW, none)
+ *
+ * Authors:
+ * Rodrigo Kumpera (kumpera@gmail.com)
+ *
+ * (C) 2012 Xamarin, Inc.
+ */
+
+#include <config.h>
+
+#if defined(__MACH__)
+#include <stdint.h>
+#include <glib.h>
+#include <pthread.h>
+#include "utils/mono-sigcontext.h"
+#include "mach-support.h"
+
+void *
+mono_mach_arch_get_ip (thread_state_t state)
+{
+ g_assert_not_reached ();
+}
+
+void *
+mono_mach_arch_get_sp (thread_state_t state)
+{
+ g_assert_not_reached ();
+}
+
+int
+mono_mach_arch_get_mcontext_size ()
+{
+ g_assert_not_reached ();
+}
+
+void
+mono_mach_arch_thread_state_to_mcontext (thread_state_t state, void *context)
+{
+ g_assert_not_reached ();
+}
+
+void
+mono_mach_arch_mcontext_to_thread_state (void *context, thread_state_t state)
+{
+ g_assert_not_reached ();
+}
+
+
+int
+mono_mach_arch_get_thread_state_size ()
+{
+ g_assert_not_reached ();
+}
+
+kern_return_t
+mono_mach_arch_get_thread_state (thread_port_t thread, thread_state_t state, mach_msg_type_number_t *count)
+{
+ g_assert_not_reached ();
+}
+
+kern_return_t
+mono_mach_arch_set_thread_state (thread_port_t thread, thread_state_t state, mach_msg_type_number_t count)
+{
+ g_assert_not_reached ();
+}
+
+void *
+mono_mach_arch_get_tls_value_from_thread (pthread_t thread, guint32 key)
+{
+ g_assert_not_reached ();
+}
+#endif
}
void
-mono_mach_arch_thread_state_to_mcontext (thread_state_t state, mcontext_t context)
+mono_mach_arch_thread_state_to_mcontext (thread_state_t state, void *context)
{
x86_thread_state32_t *arch_state = (x86_thread_state32_t *) state;
struct __darwin_mcontext32 *ctx = (struct __darwin_mcontext32 *) context;
}
void
-mono_mach_arch_mcontext_to_thread_state (mcontext_t context, thread_state_t state)
+mono_mach_arch_mcontext_to_thread_state (void *context, thread_state_t state)
{
x86_thread_state32_t *arch_state = (x86_thread_state32_t *) state;
struct __darwin_mcontext32 *ctx = (struct __darwin_mcontext32 *) context;
void *mono_mach_arch_get_sp (thread_state_t state) MONO_INTERNAL;
int mono_mach_arch_get_mcontext_size (void) MONO_INTERNAL;
-void mono_mach_arch_thread_state_to_mcontext (thread_state_t state, mcontext_t context) MONO_INTERNAL;
-void mono_mach_arch_mcontext_to_thread_state (mcontext_t context, thread_state_t state) MONO_INTERNAL;
+void mono_mach_arch_thread_state_to_mcontext (thread_state_t state, void *context) MONO_INTERNAL;
+void mono_mach_arch_mcontext_to_thread_state (void *context, thread_state_t state) MONO_INTERNAL;
int mono_mach_arch_get_thread_state_size (void) MONO_INTERNAL;
kern_return_t mono_mach_get_threads (thread_act_array_t *threads, guint32 *count) MONO_INTERNAL;
-
+
/*
----------------------------------------------------------------
This file is part of MemCheck, a heavyweight Valgrind tool for
detecting memory errors.
- Copyright (C) 2000-2009 Julian Seward. All rights reserved.
+ Copyright (C) 2000-2012 Julian Seward. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
#ifndef __MEMCHECK_H
#define __MEMCHECK_H
-#ifdef __GNUC__
/* This file is for inclusion into client (your!) code.
/* Mark memory at _qzz_addr as unaddressable for _qzz_len bytes. */
#define VALGRIND_MAKE_MEM_NOACCESS(_qzz_addr,_qzz_len) \
- (__extension__({unsigned long _qzz_res; \
- VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* default return */, \
+ VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */, \
VG_USERREQ__MAKE_MEM_NOACCESS, \
- _qzz_addr, _qzz_len, 0, 0, 0); \
- _qzz_res; \
- }))
+ (_qzz_addr), (_qzz_len), 0, 0, 0)
/* Similarly, mark memory at _qzz_addr as addressable but undefined
for _qzz_len bytes. */
#define VALGRIND_MAKE_MEM_UNDEFINED(_qzz_addr,_qzz_len) \
- (__extension__({unsigned long _qzz_res; \
- VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* default return */, \
+ VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */, \
VG_USERREQ__MAKE_MEM_UNDEFINED, \
- _qzz_addr, _qzz_len, 0, 0, 0); \
- _qzz_res; \
- }))
+ (_qzz_addr), (_qzz_len), 0, 0, 0)
/* Similarly, mark memory at _qzz_addr as addressable and defined
for _qzz_len bytes. */
#define VALGRIND_MAKE_MEM_DEFINED(_qzz_addr,_qzz_len) \
- (__extension__({unsigned long _qzz_res; \
- VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* default return */, \
+ VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */, \
VG_USERREQ__MAKE_MEM_DEFINED, \
- _qzz_addr, _qzz_len, 0, 0, 0); \
- _qzz_res; \
- }))
+ (_qzz_addr), (_qzz_len), 0, 0, 0)
/* Similar to VALGRIND_MAKE_MEM_DEFINED except that addressability is
not altered: bytes which are addressable are marked as defined,
but those which are not addressable are left unchanged. */
-#define VALGRIND_MAKE_MEM_DEFINED_IF_ADDRESSABLE(_qzz_addr,_qzz_len) \
- (__extension__({unsigned long _qzz_res; \
- VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* default return */, \
+#define VALGRIND_MAKE_MEM_DEFINED_IF_ADDRESSABLE(_qzz_addr,_qzz_len) \
+ VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */, \
VG_USERREQ__MAKE_MEM_DEFINED_IF_ADDRESSABLE, \
- _qzz_addr, _qzz_len, 0, 0, 0); \
- _qzz_res; \
- }))
+ (_qzz_addr), (_qzz_len), 0, 0, 0)
/* Create a block-description handle. The description is an ascii
string which is included in any messages pertaining to addresses
within the specified memory range. Has no other effect on the
properties of the memory range. */
-#define VALGRIND_CREATE_BLOCK(_qzz_addr,_qzz_len, _qzz_desc) \
- (__extension__({unsigned long _qzz_res; \
- VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* default return */, \
- VG_USERREQ__CREATE_BLOCK, \
- _qzz_addr, _qzz_len, _qzz_desc, \
- 0, 0); \
- _qzz_res; \
- }))
+#define VALGRIND_CREATE_BLOCK(_qzz_addr,_qzz_len, _qzz_desc) \
+ VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */, \
+ VG_USERREQ__CREATE_BLOCK, \
+ (_qzz_addr), (_qzz_len), (_qzz_desc), \
+ 0, 0)
/* Discard a block-description-handle. Returns 1 for an
invalid handle, 0 for a valid handle. */
#define VALGRIND_DISCARD(_qzz_blkindex) \
- (__extension__ ({unsigned long _qzz_res; \
- VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* default return */, \
+ VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */, \
VG_USERREQ__DISCARD, \
- 0, _qzz_blkindex, 0, 0, 0); \
- _qzz_res; \
- }))
+ 0, (_qzz_blkindex), 0, 0, 0)
/* Client-code macros to check the state of memory. */
If suitable addressibility is not established, Valgrind prints an
error message and returns the address of the first offending byte.
Otherwise it returns zero. */
-#define VALGRIND_CHECK_MEM_IS_ADDRESSABLE(_qzz_addr,_qzz_len) \
- (__extension__({unsigned long _qzz_res; \
- VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
- VG_USERREQ__CHECK_MEM_IS_ADDRESSABLE,\
- _qzz_addr, _qzz_len, 0, 0, 0); \
- _qzz_res; \
- }))
+#define VALGRIND_CHECK_MEM_IS_ADDRESSABLE(_qzz_addr,_qzz_len) \
+ VALGRIND_DO_CLIENT_REQUEST_EXPR(0, \
+ VG_USERREQ__CHECK_MEM_IS_ADDRESSABLE, \
+ (_qzz_addr), (_qzz_len), 0, 0, 0)
/* Check that memory at _qzz_addr is addressable and defined for
_qzz_len bytes. If suitable addressibility and definedness are not
established, Valgrind prints an error message and returns the
address of the first offending byte. Otherwise it returns zero. */
#define VALGRIND_CHECK_MEM_IS_DEFINED(_qzz_addr,_qzz_len) \
- (__extension__({unsigned long _qzz_res; \
- VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ VALGRIND_DO_CLIENT_REQUEST_EXPR(0, \
VG_USERREQ__CHECK_MEM_IS_DEFINED, \
- _qzz_addr, _qzz_len, 0, 0, 0); \
- _qzz_res; \
- }))
+ (_qzz_addr), (_qzz_len), 0, 0, 0)
/* Use this macro to force the definedness and addressibility of an
lvalue to be checked. If suitable addressibility and definedness
/* Do a full memory leak check (like --leak-check=full) mid-execution. */
#define VALGRIND_DO_LEAK_CHECK \
- {unsigned long _qzz_res; \
- VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
- VG_USERREQ__DO_LEAK_CHECK, \
- 0, 0, 0, 0, 0); \
- }
+ VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__DO_LEAK_CHECK, \
+ 0, 0, 0, 0, 0)
+
+/* Same as VALGRIND_DO_LEAK_CHECK but only showing the entries for
+ which there was an increase in leaked bytes or leaked nr of blocks
+ since the previous leak search. */
+#define VALGRIND_DO_ADDED_LEAK_CHECK \
+ VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__DO_LEAK_CHECK, \
+ 0, 1, 0, 0, 0)
+
+/* Same as VALGRIND_DO_ADDED_LEAK_CHECK but showing entries with
+ increased or decreased leaked bytes/blocks since previous leak
+ search. */
+#define VALGRIND_DO_CHANGED_LEAK_CHECK \
+ VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__DO_LEAK_CHECK, \
+ 0, 2, 0, 0, 0)
/* Do a summary memory leak check (like --leak-check=summary) mid-execution. */
-#define VALGRIND_DO_QUICK_LEAK_CHECK \
- {unsigned long _qzz_res; \
- VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
- VG_USERREQ__DO_LEAK_CHECK, \
- 1, 0, 0, 0, 0); \
- }
+#define VALGRIND_DO_QUICK_LEAK_CHECK \
+ VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__DO_LEAK_CHECK, \
+ 1, 0, 0, 0, 0)
/* Return number of leaked, dubious, reachable and suppressed bytes found by
all previous leak checks. They must be lvalues. */
are. We also initialise '_qzz_leaked', etc because
VG_USERREQ__COUNT_LEAKS doesn't mark the values returned as
defined. */ \
- {unsigned long _qzz_res; \
+ { \
unsigned long _qzz_leaked = 0, _qzz_dubious = 0; \
unsigned long _qzz_reachable = 0, _qzz_suppressed = 0; \
- VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ VALGRIND_DO_CLIENT_REQUEST_STMT( \
VG_USERREQ__COUNT_LEAKS, \
&_qzz_leaked, &_qzz_dubious, \
&_qzz_reachable, &_qzz_suppressed, 0); \
are. We also initialise '_qzz_leaked', etc because
VG_USERREQ__COUNT_LEAKS doesn't mark the values returned as
defined. */ \
- {unsigned long _qzz_res; \
+ { \
unsigned long _qzz_leaked = 0, _qzz_dubious = 0; \
unsigned long _qzz_reachable = 0, _qzz_suppressed = 0; \
- VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ VALGRIND_DO_CLIENT_REQUEST_STMT( \
VG_USERREQ__COUNT_LEAK_BLOCKS, \
&_qzz_leaked, &_qzz_dubious, \
&_qzz_reachable, &_qzz_suppressed, 0); \
The metadata is not copied in cases 0, 2 or 3 so it should be
impossible to segfault your system by using this call.
*/
-#define VALGRIND_GET_VBITS(zza,zzvbits,zznbytes) \
- (__extension__({unsigned long _qzz_res; \
- char* czza = (char*)zza; \
- char* czzvbits = (char*)zzvbits; \
- VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
- VG_USERREQ__GET_VBITS, \
- czza, czzvbits, zznbytes, 0, 0 ); \
- _qzz_res; \
- }))
+#define VALGRIND_GET_VBITS(zza,zzvbits,zznbytes) \
+ (unsigned)VALGRIND_DO_CLIENT_REQUEST_EXPR(0, \
+ VG_USERREQ__GET_VBITS, \
+ (const char*)(zza), \
+ (char*)(zzvbits), \
+ (zznbytes), 0, 0)
/* Set the validity data for addresses [zza..zza+zznbytes-1], copying it
from the provided zzvbits array. Return values:
The metadata is not copied in cases 0, 2 or 3 so it should be
impossible to segfault your system by using this call.
*/
-#define VALGRIND_SET_VBITS(zza,zzvbits,zznbytes) \
- (__extension__({unsigned int _qzz_res; \
- char* czza = (char*)zza; \
- char* czzvbits = (char*)zzvbits; \
- VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
- VG_USERREQ__SET_VBITS, \
- czza, czzvbits, zznbytes, 0, 0 ); \
- _qzz_res; \
- }))
-
-#else /* __GNUC__ */
-
-#define RUNNING_ON_VALGRIND 0
-#define VALGRIND_DISCARD_TRANSLATIONS(x,y) do { } while (0)
-
-#endif /* __GNUC__ */
+#define VALGRIND_SET_VBITS(zza,zzvbits,zznbytes) \
+ (unsigned)VALGRIND_DO_CLIENT_REQUEST_EXPR(0, \
+ VG_USERREQ__SET_VBITS, \
+ (const char*)(zza), \
+ (const char*)(zzvbits), \
+ (zznbytes), 0, 0 )
#endif
#define MONO_DEPRECATED
#endif
+#ifdef __GNUC__
+#define MONO_ALWAYS_INLINE __attribute__((always_inline))
+#else
+#define MONO_ALWAYS_INLINE
+#endif
+
#endif /* __UTILS_MONO_COMPILER_H__*/
#include <mono/utils/mono-context.h>
#include <mono/arch/arm/arm-codegen.h>
+#include <mono/arch/arm/arm-vfp-codegen.h>
void
mono_sigctx_to_monoctx (void *sigctx, MonoContext *mctx)
#define MONO_CONTEXT_GET_BP(ctx) ((gpointer)((ctx)->regs [ARMREG_FP]))
#define MONO_CONTEXT_GET_SP(ctx) ((gpointer)((ctx)->regs [ARMREG_SP]))
-// FIXME:
#define MONO_CONTEXT_GET_CURRENT(ctx) do { \
- g_assert_not_reached (); \
+ __asm__ __volatile__( \
+ "push {r0}\n" \
+ "push {r1}\n" \
+ "mov r1, r0\n" \
+ "mov r0, %0\n" \
+ "str r1, [r0]!\n" \
+ "pop {r1}\n" \
+ "str r1, [r0]!\n" \
+ "stmia r0!, {r2-r12}\n" \
+ "str sp, [r0]!\n" \
+ "str lr, [r0]!\n" \
+ "str pc, [r0]!\n" \
+ "pop {r0}\n" \
+ : \
+ : "r" (&ctx.regs) \
+ : "memory" \
+ ); \
+ ctx.pc = ctx.regs [15]; \
} while (0)
+
#elif defined(__mono_ppc__) /* defined(__arm__) */
/* we define our own structure and we'll copy the data
#endif /* RTLD_LAZY */
#define SO_HANDLE_TYPE void*
-#define LL_SO_OPEN(file,flags) dlopen ((file), (flags))
+#ifdef PLATFORM_ANDROID
+/* Bionic doesn't support NULL filenames */
+# define LL_SO_OPEN(file,flags) ((file) ? dlopen ((file), (flags)) : NULL)
+#else
+# define LL_SO_OPEN(file,flags) dlopen ((file), (flags))
+#endif
#define LL_SO_CLOSE(module) dlclose ((module)->handle)
#define LL_SO_SYMBOL(module, name) dlsym ((module)->handle, (name))
#define LL_SO_TRFLAGS(flags) convert_flags ((flags))
#endif /* !__GNUC__ */
+#if defined (PLATFORM_ANDROID) || (defined (TARGET_IOS) && defined (TARGET_IOS))
+
+#define mono_gc_printf(gc_log_file, format, ...) g_log ("mono-gc", G_LOG_LEVEL_MESSAGE, format "\n", ##__VA_ARGS__)
+#define mono_runtime_printf(format, ...) g_log ("mono-rt", G_LOG_LEVEL_MESSAGE, format "\n", ##__VA_ARGS__)
+#define mono_runtime_printf_err(format, ...) g_log ("mono-rt", G_LOG_LEVEL_ERROR, format "\n", ##__VA_ARGS__)
+#define mono_runtime_stdout_fflush() do { } while (0)
+
+#else
+
+#define mono_gc_printf(gc_log_file, format, ...) do { \
+ fprintf (gc_log_file, format "\n", ##__VA_ARGS__); \
+ fflush (gc_log_file); \
+} while (0)
+
+#define mono_runtime_printf(format, ...) fprintf (stdout, format "\n", ##__VA_ARGS__)
+#define mono_runtime_printf_err(format, ...) fprintf (stderr, format "\n", ##__VA_ARGS__)
+#define mono_runtime_stdout_fflush() do { fflush (stdout); } while (0)
+
+#endif
+
+
G_END_DECLS
#endif /* __MONO_LOGGER_INTERNAL_H__ */
#include <signal.h>
#endif
-#if defined(__i386__)
+#if defined(TARGET_X86)
#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__)
#include <ucontext.h>
#define UCONTEXT_REG_EDI(ctx) (((ucontext_t*)(ctx))->uc_mcontext.mc_edi)
#define UCONTEXT_REG_EIP(ctx) (((ucontext_t*)(ctx))->uc_mcontext.mc_eip)
#elif defined(__APPLE__)
-# if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
+# if defined (TARGET_IOS) || (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5)
#define UCONTEXT_REG_EAX(ctx) (((ucontext_t*)(ctx))->uc_mcontext->__ss.__eax)
#define UCONTEXT_REG_EBX(ctx) (((ucontext_t*)(ctx))->uc_mcontext->__ss.__ebx)
#define UCONTEXT_REG_ECX(ctx) (((ucontext_t*)(ctx))->uc_mcontext->__ss.__ecx)
#define UCONTEXT_REG_EIP(ctx) (((ucontext_t*)(ctx))->uc_mcontext.gregs [REG_EIP])
#endif
-#elif defined(__x86_64__)
+#elif defined(TARGET_AMD64)
#if defined(__FreeBSD__)
#include <ucontext.h>
#define UCONTEXT_REG_LNK(ctx) ((ctx)->uc_mcontext.mc_lr)
#endif
-#elif defined(__arm__)
+#elif defined(TARGET_ARM)
#if defined(__APPLE__)
typedef ucontext_t arm_ucontext;
This file is part of Valgrind, a dynamic binary instrumentation
framework.
- Copyright (C) 2000-2009 Julian Seward. All rights reserved.
+ Copyright (C) 2000-2012 Julian Seward. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
#ifndef __VALGRIND_H
#define __VALGRIND_H
-#ifdef __GNUC__
+
+/* ------------------------------------------------------------------ */
+/* VERSION NUMBER OF VALGRIND */
+/* ------------------------------------------------------------------ */
+
+/* Specify Valgrind's version number, so that user code can
+ conditionally compile based on our version number. Note that these
+ were introduced at version 3.6 and so do not exist in version 3.5
+ or earlier. The recommended way to use them to check for "version
+ X.Y or later" is (eg)
+
+#if defined(__VALGRIND_MAJOR__) && defined(__VALGRIND_MINOR__) \
+ && (__VALGRIND_MAJOR__ > 3 \
+ || (__VALGRIND_MAJOR__ == 3 && __VALGRIND_MINOR__ >= 6))
+*/
+#define __VALGRIND_MAJOR__ 3
+#define __VALGRIND_MINOR__ 8
+
#include <stdarg.h>
identifying architectures, which are different to the ones we use
within the rest of Valgrind. Note, __powerpc__ is active for both
32 and 64-bit PPC, whereas __powerpc64__ is only active for the
- latter (on Linux, that is). */
+ latter (on Linux, that is).
+
+ Misc note: how to find out what's predefined in gcc by default:
+ gcc -Wp,-dM somefile.c
+*/
+#undef PLAT_x86_darwin
+#undef PLAT_amd64_darwin
+#undef PLAT_x86_win32
#undef PLAT_x86_linux
#undef PLAT_amd64_linux
#undef PLAT_ppc32_linux
#undef PLAT_ppc64_linux
-#undef PLAT_ppc32_aix5
-#undef PLAT_ppc64_aix5
+#undef PLAT_arm_linux
+#undef PLAT_s390x_linux
+#undef PLAT_mips32_linux
-#if defined(_AIX) && defined(__64BIT__)
-# define PLAT_ppc64_aix5 1
-#elif defined(_AIX) && !defined(__64BIT__)
-# define PLAT_ppc32_aix5 1
-#elif defined(__APPLE__) && defined(__i386__)
+#if defined(__APPLE__) && defined(__i386__)
# define PLAT_x86_darwin 1
#elif defined(__APPLE__) && defined(__x86_64__)
# define PLAT_amd64_darwin 1
-#elif defined(__i386__)
+#elif defined(__MINGW32__) || defined(__CYGWIN32__) \
+ || (defined(_WIN32) && defined(_M_IX86))
+# define PLAT_x86_win32 1
+#elif defined(__linux__) && defined(__i386__)
# define PLAT_x86_linux 1
-#elif defined(__x86_64__)
+#elif defined(__linux__) && defined(__x86_64__)
# define PLAT_amd64_linux 1
-#elif defined(__powerpc__) && !defined(__powerpc64__)
+#elif defined(__linux__) && defined(__powerpc__) && !defined(__powerpc64__)
# define PLAT_ppc32_linux 1
-#elif defined(__powerpc__) && defined(__powerpc64__)
+#elif defined(__linux__) && defined(__powerpc__) && defined(__powerpc64__)
# define PLAT_ppc64_linux 1
+#elif defined(__linux__) && defined(__arm__)
+# define PLAT_arm_linux 1
+#elif defined(__linux__) && defined(__s390__) && defined(__s390x__)
+# define PLAT_s390x_linux 1
+#elif defined(__linux__) && defined(__mips__)
+# define PLAT_mips32_linux 1
#else
/* If we're not compiling for our target platform, don't generate
any inline asms. */
/* in here of use to end-users -- skip to the next section. */
/* ------------------------------------------------------------------ */
+/*
+ * VALGRIND_DO_CLIENT_REQUEST(): a statement that invokes a Valgrind client
+ * request. Accepts both pointers and integers as arguments.
+ *
+ * VALGRIND_DO_CLIENT_REQUEST_STMT(): a statement that invokes a Valgrind
+ * client request that does not return a value.
+
+ * VALGRIND_DO_CLIENT_REQUEST_EXPR(): a C expression that invokes a Valgrind
+ * client request and whose value equals the client request result. Accepts
+ * both pointers and integers as arguments. Note that such calls are not
+ * necessarily pure functions -- they may have side effects.
+ */
+
+#define VALGRIND_DO_CLIENT_REQUEST(_zzq_rlval, _zzq_default, \
+ _zzq_request, _zzq_arg1, _zzq_arg2, \
+ _zzq_arg3, _zzq_arg4, _zzq_arg5) \
+ do { (_zzq_rlval) = VALGRIND_DO_CLIENT_REQUEST_EXPR((_zzq_default), \
+ (_zzq_request), (_zzq_arg1), (_zzq_arg2), \
+ (_zzq_arg3), (_zzq_arg4), (_zzq_arg5)); } while (0)
+
+#define VALGRIND_DO_CLIENT_REQUEST_STMT(_zzq_request, _zzq_arg1, \
+ _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
+ do { (void) VALGRIND_DO_CLIENT_REQUEST_EXPR(0, \
+ (_zzq_request), (_zzq_arg1), (_zzq_arg2), \
+ (_zzq_arg3), (_zzq_arg4), (_zzq_arg5)); } while (0)
+
#if defined(NVALGRIND)
/* Define NVALGRIND to completely remove the Valgrind magic sequence
from the compiled code (analogous to NDEBUG's effects on
assert()) */
-#define VALGRIND_DO_CLIENT_REQUEST( \
- _zzq_rlval, _zzq_default, _zzq_request, \
+#define VALGRIND_DO_CLIENT_REQUEST_EXPR( \
+ _zzq_default, _zzq_request, \
_zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
- { \
- (_zzq_rlval) = (_zzq_default); \
- }
+ (_zzq_default)
#else /* ! NVALGRIND */
/* ------------------------- x86-{linux,darwin} ---------------- */
-#if defined(PLAT_x86_linux) || defined(PLAT_x86_darwin)
+#if defined(PLAT_x86_linux) || defined(PLAT_x86_darwin) \
+ || (defined(PLAT_x86_win32) && defined(__GNUC__))
typedef
struct {
"roll $3, %%edi ; roll $13, %%edi\n\t" \
"roll $29, %%edi ; roll $19, %%edi\n\t"
-#define VALGRIND_DO_CLIENT_REQUEST( \
- _zzq_rlval, _zzq_default, _zzq_request, \
+#define VALGRIND_DO_CLIENT_REQUEST_EXPR( \
+ _zzq_default, _zzq_request, \
_zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
- { volatile unsigned int _zzq_args[6]; \
+ __extension__ \
+ ({volatile unsigned int _zzq_args[6]; \
volatile unsigned int _zzq_result; \
_zzq_args[0] = (unsigned int)(_zzq_request); \
_zzq_args[1] = (unsigned int)(_zzq_arg1); \
: "a" (&_zzq_args[0]), "0" (_zzq_default) \
: "cc", "memory" \
); \
- _zzq_rlval = _zzq_result; \
- }
+ _zzq_result; \
+ })
#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
{ volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
__SPECIAL_INSTRUCTION_PREAMBLE \
/* call-noredir *%EAX */ \
"xchgl %%edx,%%edx\n\t"
-#endif /* PLAT_x86_linux || PLAT_x86_darwin */
+
+#define VALGRIND_VEX_INJECT_IR() \
+ do { \
+ __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
+ "xchgl %%edi,%%edi\n\t" \
+ : : : "cc", "memory" \
+ ); \
+ } while (0)
+
+#endif /* PLAT_x86_linux || PLAT_x86_darwin || (PLAT_x86_win32 && __GNUC__) */
+
+/* ------------------------- x86-Win32 ------------------------- */
+
+#if defined(PLAT_x86_win32) && !defined(__GNUC__)
+
+typedef
+ struct {
+ unsigned int nraddr; /* where's the code? */
+ }
+ OrigFn;
+
+#if defined(_MSC_VER)
+
+#define __SPECIAL_INSTRUCTION_PREAMBLE \
+ __asm rol edi, 3 __asm rol edi, 13 \
+ __asm rol edi, 29 __asm rol edi, 19
+
+#define VALGRIND_DO_CLIENT_REQUEST_EXPR( \
+ _zzq_default, _zzq_request, \
+ _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
+ valgrind_do_client_request_expr((uintptr_t)(_zzq_default), \
+ (uintptr_t)(_zzq_request), (uintptr_t)(_zzq_arg1), \
+ (uintptr_t)(_zzq_arg2), (uintptr_t)(_zzq_arg3), \
+ (uintptr_t)(_zzq_arg4), (uintptr_t)(_zzq_arg5))
+
+static __inline uintptr_t
+valgrind_do_client_request_expr(uintptr_t _zzq_default, uintptr_t _zzq_request,
+ uintptr_t _zzq_arg1, uintptr_t _zzq_arg2,
+ uintptr_t _zzq_arg3, uintptr_t _zzq_arg4,
+ uintptr_t _zzq_arg5)
+{
+ volatile uintptr_t _zzq_args[6];
+ volatile unsigned int _zzq_result;
+ _zzq_args[0] = (uintptr_t)(_zzq_request);
+ _zzq_args[1] = (uintptr_t)(_zzq_arg1);
+ _zzq_args[2] = (uintptr_t)(_zzq_arg2);
+ _zzq_args[3] = (uintptr_t)(_zzq_arg3);
+ _zzq_args[4] = (uintptr_t)(_zzq_arg4);
+ _zzq_args[5] = (uintptr_t)(_zzq_arg5);
+ __asm { __asm lea eax, _zzq_args __asm mov edx, _zzq_default
+ __SPECIAL_INSTRUCTION_PREAMBLE
+ /* %EDX = client_request ( %EAX ) */
+ __asm xchg ebx,ebx
+ __asm mov _zzq_result, edx
+ }
+ return _zzq_result;
+}
+
+#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
+ { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
+ volatile unsigned int __addr; \
+ __asm { __SPECIAL_INSTRUCTION_PREAMBLE \
+ /* %EAX = guest_NRADDR */ \
+ __asm xchg ecx,ecx \
+ __asm mov __addr, eax \
+ } \
+ _zzq_orig->nraddr = __addr; \
+ }
+
+#define VALGRIND_CALL_NOREDIR_EAX ERROR
+
+#define VALGRIND_VEX_INJECT_IR() \
+ do { \
+ __asm { __SPECIAL_INSTRUCTION_PREAMBLE \
+ __asm xchg edi,edi \
+ } \
+ } while (0)
+
+#else
+#error Unsupported compiler.
+#endif
+
+#endif /* PLAT_x86_win32 */
/* ------------------------ amd64-{linux,darwin} --------------- */
"rolq $3, %%rdi ; rolq $13, %%rdi\n\t" \
"rolq $61, %%rdi ; rolq $51, %%rdi\n\t"
-#define VALGRIND_DO_CLIENT_REQUEST( \
- _zzq_rlval, _zzq_default, _zzq_request, \
+#define VALGRIND_DO_CLIENT_REQUEST_EXPR( \
+ _zzq_default, _zzq_request, \
_zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
- { volatile unsigned long long int _zzq_args[6]; \
+ __extension__ \
+ ({ volatile unsigned long long int _zzq_args[6]; \
volatile unsigned long long int _zzq_result; \
_zzq_args[0] = (unsigned long long int)(_zzq_request); \
_zzq_args[1] = (unsigned long long int)(_zzq_arg1); \
: "a" (&_zzq_args[0]), "0" (_zzq_default) \
: "cc", "memory" \
); \
- _zzq_rlval = _zzq_result; \
- }
+ _zzq_result; \
+ })
#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
{ volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
__SPECIAL_INSTRUCTION_PREAMBLE \
/* call-noredir *%RAX */ \
"xchgq %%rdx,%%rdx\n\t"
+
+#define VALGRIND_VEX_INJECT_IR() \
+ do { \
+ __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
+ "xchgq %%rdi,%%rdi\n\t" \
+ : : : "cc", "memory" \
+ ); \
+ } while (0)
+
#endif /* PLAT_amd64_linux || PLAT_amd64_darwin */
/* ------------------------ ppc32-linux ------------------------ */
"rlwinm 0,0,3,0,0 ; rlwinm 0,0,13,0,0\n\t" \
"rlwinm 0,0,29,0,0 ; rlwinm 0,0,19,0,0\n\t"
-#define VALGRIND_DO_CLIENT_REQUEST( \
- _zzq_rlval, _zzq_default, _zzq_request, \
+#define VALGRIND_DO_CLIENT_REQUEST_EXPR( \
+ _zzq_default, _zzq_request, \
_zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
\
- { unsigned int _zzq_args[6]; \
+ __extension__ \
+ ({ unsigned int _zzq_args[6]; \
unsigned int _zzq_result; \
unsigned int* _zzq_ptr; \
_zzq_args[0] = (unsigned int)(_zzq_request); \
: "=b" (_zzq_result) \
: "b" (_zzq_default), "b" (_zzq_ptr) \
: "cc", "memory", "r3", "r4"); \
- _zzq_rlval = _zzq_result; \
- }
+ _zzq_result; \
+ })
#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
{ volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
__SPECIAL_INSTRUCTION_PREAMBLE \
/* branch-and-link-to-noredir *%R11 */ \
"or 3,3,3\n\t"
+
+#define VALGRIND_VEX_INJECT_IR() \
+ do { \
+ __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
+ "or 5,5,5\n\t" \
+ ); \
+ } while (0)
+
#endif /* PLAT_ppc32_linux */
/* ------------------------ ppc64-linux ------------------------ */
"rotldi 0,0,3 ; rotldi 0,0,13\n\t" \
"rotldi 0,0,61 ; rotldi 0,0,51\n\t"
-#define VALGRIND_DO_CLIENT_REQUEST( \
- _zzq_rlval, _zzq_default, _zzq_request, \
+#define VALGRIND_DO_CLIENT_REQUEST_EXPR( \
+ _zzq_default, _zzq_request, \
_zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
\
- { unsigned long long int _zzq_args[6]; \
- register unsigned long long int _zzq_result __asm__("r3"); \
- register unsigned long long int* _zzq_ptr __asm__("r4"); \
+ __extension__ \
+ ({ unsigned long long int _zzq_args[6]; \
+ unsigned long long int _zzq_result; \
+ unsigned long long int* _zzq_ptr; \
_zzq_args[0] = (unsigned long long int)(_zzq_request); \
_zzq_args[1] = (unsigned long long int)(_zzq_arg1); \
_zzq_args[2] = (unsigned long long int)(_zzq_arg2); \
_zzq_args[4] = (unsigned long long int)(_zzq_arg4); \
_zzq_args[5] = (unsigned long long int)(_zzq_arg5); \
_zzq_ptr = _zzq_args; \
- __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
+ __asm__ volatile("mr 3,%1\n\t" /*default*/ \
+ "mr 4,%2\n\t" /*ptr*/ \
+ __SPECIAL_INSTRUCTION_PREAMBLE \
/* %R3 = client_request ( %R4 ) */ \
- "or 1,1,1" \
- : "=r" (_zzq_result) \
- : "0" (_zzq_default), "r" (_zzq_ptr) \
- : "cc", "memory"); \
- _zzq_rlval = _zzq_result; \
- }
+ "or 1,1,1\n\t" \
+ "mr %0,3" /*result*/ \
+ : "=b" (_zzq_result) \
+ : "b" (_zzq_default), "b" (_zzq_ptr) \
+ : "cc", "memory", "r3", "r4"); \
+ _zzq_result; \
+ })
#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
{ volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
- register unsigned long long int __addr __asm__("r3"); \
+ unsigned long long int __addr; \
__asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
/* %R3 = guest_NRADDR */ \
- "or 2,2,2" \
- : "=r" (__addr) \
+ "or 2,2,2\n\t" \
+ "mr %0,3" \
+ : "=b" (__addr) \
: \
- : "cc", "memory" \
+ : "cc", "memory", "r3" \
); \
_zzq_orig->nraddr = __addr; \
__asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
/* %R3 = guest_NRADDR_GPR2 */ \
- "or 4,4,4" \
- : "=r" (__addr) \
+ "or 4,4,4\n\t" \
+ "mr %0,3" \
+ : "=b" (__addr) \
: \
- : "cc", "memory" \
+ : "cc", "memory", "r3" \
); \
_zzq_orig->r2 = __addr; \
}
/* branch-and-link-to-noredir *%R11 */ \
"or 3,3,3\n\t"
+#define VALGRIND_VEX_INJECT_IR() \
+ do { \
+ __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
+ "or 5,5,5\n\t" \
+ ); \
+ } while (0)
+
#endif /* PLAT_ppc64_linux */
-/* ------------------------ ppc32-aix5 ------------------------- */
+/* ------------------------- arm-linux ------------------------- */
-#if defined(PLAT_ppc32_aix5)
+#if defined(PLAT_arm_linux)
typedef
struct {
unsigned int nraddr; /* where's the code? */
- unsigned int r2; /* what tocptr do we need? */
}
OrigFn;
#define __SPECIAL_INSTRUCTION_PREAMBLE \
- "rlwinm 0,0,3,0,0 ; rlwinm 0,0,13,0,0\n\t" \
- "rlwinm 0,0,29,0,0 ; rlwinm 0,0,19,0,0\n\t"
+ "mov r12, r12, ror #3 ; mov r12, r12, ror #13 \n\t" \
+ "mov r12, r12, ror #29 ; mov r12, r12, ror #19 \n\t"
-#define VALGRIND_DO_CLIENT_REQUEST( \
- _zzq_rlval, _zzq_default, _zzq_request, \
+#define VALGRIND_DO_CLIENT_REQUEST_EXPR( \
+ _zzq_default, _zzq_request, \
_zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
\
- { unsigned int _zzq_args[7]; \
- register unsigned int _zzq_result; \
- register unsigned int* _zzq_ptr; \
+ __extension__ \
+ ({volatile unsigned int _zzq_args[6]; \
+ volatile unsigned int _zzq_result; \
_zzq_args[0] = (unsigned int)(_zzq_request); \
_zzq_args[1] = (unsigned int)(_zzq_arg1); \
_zzq_args[2] = (unsigned int)(_zzq_arg2); \
_zzq_args[3] = (unsigned int)(_zzq_arg3); \
_zzq_args[4] = (unsigned int)(_zzq_arg4); \
_zzq_args[5] = (unsigned int)(_zzq_arg5); \
- _zzq_args[6] = (unsigned int)(_zzq_default); \
- _zzq_ptr = _zzq_args; \
- __asm__ volatile("mr 4,%1\n\t" \
- "lwz 3, 24(4)\n\t" \
+ __asm__ volatile("mov r3, %1\n\t" /*default*/ \
+ "mov r4, %2\n\t" /*ptr*/ \
__SPECIAL_INSTRUCTION_PREAMBLE \
- /* %R3 = client_request ( %R4 ) */ \
- "or 1,1,1\n\t" \
- "mr %0,3" \
- : "=b" (_zzq_result) \
- : "b" (_zzq_ptr) \
- : "r3", "r4", "cc", "memory"); \
- _zzq_rlval = _zzq_result; \
- }
+ /* R3 = client_request ( R4 ) */ \
+ "orr r10, r10, r10\n\t" \
+ "mov %0, r3" /*result*/ \
+ : "=r" (_zzq_result) \
+ : "r" (_zzq_default), "r" (&_zzq_args[0]) \
+ : "cc","memory", "r3", "r4"); \
+ _zzq_result; \
+ })
#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
{ volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
- register unsigned int __addr; \
+ unsigned int __addr; \
__asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
- /* %R3 = guest_NRADDR */ \
- "or 2,2,2\n\t" \
- "mr %0,3" \
- : "=b" (__addr) \
+ /* R3 = guest_NRADDR */ \
+ "orr r11, r11, r11\n\t" \
+ "mov %0, r3" \
+ : "=r" (__addr) \
: \
- : "r3", "cc", "memory" \
+ : "cc", "memory", "r3" \
); \
_zzq_orig->nraddr = __addr; \
- __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
- /* %R3 = guest_NRADDR_GPR2 */ \
- "or 4,4,4\n\t" \
- "mr %0,3" \
- : "=b" (__addr) \
- : \
- : "r3", "cc", "memory" \
- ); \
- _zzq_orig->r2 = __addr; \
}
-#define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+#define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
__SPECIAL_INSTRUCTION_PREAMBLE \
- /* branch-and-link-to-noredir *%R11 */ \
- "or 3,3,3\n\t"
+ /* branch-and-link-to-noredir *%R4 */ \
+ "orr r12, r12, r12\n\t"
-#endif /* PLAT_ppc32_aix5 */
+#define VALGRIND_VEX_INJECT_IR() \
+ do { \
+ __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
+ "orr r9, r9, r9\n\t" \
+ : : : "cc", "memory" \
+ ); \
+ } while (0)
-/* ------------------------ ppc64-aix5 ------------------------- */
+#endif /* PLAT_arm_linux */
-#if defined(PLAT_ppc64_aix5)
+/* ------------------------ s390x-linux ------------------------ */
+
+#if defined(PLAT_s390x_linux)
+
+typedef
+ struct {
+ unsigned long long int nraddr; /* where's the code? */
+ }
+ OrigFn;
+
+/* __SPECIAL_INSTRUCTION_PREAMBLE will be used to identify Valgrind specific
+ * code. This detection is implemented in platform specific toIR.c
+ * (e.g. VEX/priv/guest_s390_decoder.c).
+ */
+#define __SPECIAL_INSTRUCTION_PREAMBLE \
+ "lr 15,15\n\t" \
+ "lr 1,1\n\t" \
+ "lr 2,2\n\t" \
+ "lr 3,3\n\t"
+
+#define __CLIENT_REQUEST_CODE "lr 2,2\n\t"
+#define __GET_NR_CONTEXT_CODE "lr 3,3\n\t"
+#define __CALL_NO_REDIR_CODE "lr 4,4\n\t"
+#define __VEX_INJECT_IR_CODE "lr 5,5\n\t"
+
+#define VALGRIND_DO_CLIENT_REQUEST_EXPR( \
+ _zzq_default, _zzq_request, \
+ _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
+ __extension__ \
+ ({volatile unsigned long long int _zzq_args[6]; \
+ volatile unsigned long long int _zzq_result; \
+ _zzq_args[0] = (unsigned long long int)(_zzq_request); \
+ _zzq_args[1] = (unsigned long long int)(_zzq_arg1); \
+ _zzq_args[2] = (unsigned long long int)(_zzq_arg2); \
+ _zzq_args[3] = (unsigned long long int)(_zzq_arg3); \
+ _zzq_args[4] = (unsigned long long int)(_zzq_arg4); \
+ _zzq_args[5] = (unsigned long long int)(_zzq_arg5); \
+ __asm__ volatile(/* r2 = args */ \
+ "lgr 2,%1\n\t" \
+ /* r3 = default */ \
+ "lgr 3,%2\n\t" \
+ __SPECIAL_INSTRUCTION_PREAMBLE \
+ __CLIENT_REQUEST_CODE \
+ /* results = r3 */ \
+ "lgr %0, 3\n\t" \
+ : "=d" (_zzq_result) \
+ : "a" (&_zzq_args[0]), "0" (_zzq_default) \
+ : "cc", "2", "3", "memory" \
+ ); \
+ _zzq_result; \
+ })
+
+#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
+ { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
+ volatile unsigned long long int __addr; \
+ __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
+ __GET_NR_CONTEXT_CODE \
+ "lgr %0, 3\n\t" \
+ : "=a" (__addr) \
+ : \
+ : "cc", "3", "memory" \
+ ); \
+ _zzq_orig->nraddr = __addr; \
+ }
+
+#define VALGRIND_CALL_NOREDIR_R1 \
+ __SPECIAL_INSTRUCTION_PREAMBLE \
+ __CALL_NO_REDIR_CODE
+
+#define VALGRIND_VEX_INJECT_IR() \
+ do { \
+ __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
+ __VEX_INJECT_IR_CODE); \
+ } while (0)
+
+#endif /* PLAT_s390x_linux */
+
+/* ------------------------- mips32-linux ---------------- */
+
+#if defined(PLAT_mips32_linux)
typedef
struct {
- unsigned long long int nraddr; /* where's the code? */
- unsigned long long int r2; /* what tocptr do we need? */
+ unsigned int nraddr; /* where's the code? */
}
OrigFn;
-#define __SPECIAL_INSTRUCTION_PREAMBLE \
- "rotldi 0,0,3 ; rotldi 0,0,13\n\t" \
- "rotldi 0,0,61 ; rotldi 0,0,51\n\t"
-
-#define VALGRIND_DO_CLIENT_REQUEST( \
- _zzq_rlval, _zzq_default, _zzq_request, \
- _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
- \
- { unsigned long long int _zzq_args[7]; \
- register unsigned long long int _zzq_result; \
- register unsigned long long int* _zzq_ptr; \
- _zzq_args[0] = (unsigned int long long)(_zzq_request); \
- _zzq_args[1] = (unsigned int long long)(_zzq_arg1); \
- _zzq_args[2] = (unsigned int long long)(_zzq_arg2); \
- _zzq_args[3] = (unsigned int long long)(_zzq_arg3); \
- _zzq_args[4] = (unsigned int long long)(_zzq_arg4); \
- _zzq_args[5] = (unsigned int long long)(_zzq_arg5); \
- _zzq_args[6] = (unsigned int long long)(_zzq_default); \
- _zzq_ptr = _zzq_args; \
- __asm__ volatile("mr 4,%1\n\t" \
- "ld 3, 48(4)\n\t" \
+/* .word 0x342
+ * .word 0x742
+ * .word 0xC2
+ * .word 0x4C2*/
+#define __SPECIAL_INSTRUCTION_PREAMBLE \
+ "srl $0, $0, 13\n\t" \
+ "srl $0, $0, 29\n\t" \
+ "srl $0, $0, 3\n\t" \
+ "srl $0, $0, 19\n\t"
+
+#define VALGRIND_DO_CLIENT_REQUEST_EXPR( \
+ _zzq_default, _zzq_request, \
+ _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
+ __extension__ \
+ ({ volatile unsigned int _zzq_args[6]; \
+ volatile unsigned int _zzq_result; \
+ _zzq_args[0] = (unsigned int)(_zzq_request); \
+ _zzq_args[1] = (unsigned int)(_zzq_arg1); \
+ _zzq_args[2] = (unsigned int)(_zzq_arg2); \
+ _zzq_args[3] = (unsigned int)(_zzq_arg3); \
+ _zzq_args[4] = (unsigned int)(_zzq_arg4); \
+ _zzq_args[5] = (unsigned int)(_zzq_arg5); \
+ __asm__ volatile("move $11, %1\n\t" /*default*/ \
+ "move $12, %2\n\t" /*ptr*/ \
__SPECIAL_INSTRUCTION_PREAMBLE \
- /* %R3 = client_request ( %R4 ) */ \
- "or 1,1,1\n\t" \
- "mr %0,3" \
- : "=b" (_zzq_result) \
- : "b" (_zzq_ptr) \
- : "r3", "r4", "cc", "memory"); \
- _zzq_rlval = _zzq_result; \
- }
+ /* T3 = client_request ( T4 ) */ \
+ "or $13, $13, $13\n\t" \
+ "move %0, $11\n\t" /*result*/ \
+ : "=r" (_zzq_result) \
+ : "r" (_zzq_default), "r" (&_zzq_args[0]) \
+ : "cc","memory", "t3", "t4"); \
+ _zzq_result; \
+ })
#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
{ volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
- register unsigned long long int __addr; \
+ volatile unsigned int __addr; \
__asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
- /* %R3 = guest_NRADDR */ \
- "or 2,2,2\n\t" \
- "mr %0,3" \
- : "=b" (__addr) \
+ /* %t9 = guest_NRADDR */ \
+ "or $14, $14, $14\n\t" \
+ "move %0, $11" /*result*/ \
+ : "=r" (__addr) \
: \
- : "r3", "cc", "memory" \
+ : "cc", "memory" , "t3" \
); \
_zzq_orig->nraddr = __addr; \
- __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
- /* %R3 = guest_NRADDR_GPR2 */ \
- "or 4,4,4\n\t" \
- "mr %0,3" \
- : "=b" (__addr) \
- : \
- : "r3", "cc", "memory" \
- ); \
- _zzq_orig->r2 = __addr; \
}
-#define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- __SPECIAL_INSTRUCTION_PREAMBLE \
- /* branch-and-link-to-noredir *%R11 */ \
- "or 3,3,3\n\t"
+#define VALGRIND_CALL_NOREDIR_T9 \
+ __SPECIAL_INSTRUCTION_PREAMBLE \
+ /* call-noredir *%t9 */ \
+ "or $15, $15, $15\n\t"
+
+#define VALGRIND_VEX_INJECT_IR() \
+ do { \
+ __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
+ "or $11, $11, $11\n\t" \
+ ); \
+ } while (0)
-#endif /* PLAT_ppc64_aix5 */
+
+#endif /* PLAT_mips32_linux */
/* Insert assembly code for other platforms here... */
*/
/* Use these to write the name of your wrapper. NOTE: duplicates
- VG_WRAP_FUNCTION_Z{U,Z} in pub_tool_redir.h. */
+ VG_WRAP_FUNCTION_Z{U,Z} in pub_tool_redir.h. NOTE also: inserts
+ the default behaviour equivalance class tag "0000" into the name.
+ See pub_tool_redir.h for details -- normally you don't need to
+ think about this, though. */
/* Use an extra level of macroisation so as to ensure the soname/fnname
args are fully macro-expanded before pasting them together. */
#define VG_CONCAT4(_aa,_bb,_cc,_dd) _aa##_bb##_cc##_dd
#define I_WRAP_SONAME_FNNAME_ZU(soname,fnname) \
- VG_CONCAT4(_vgwZU_,soname,_,fnname)
+ VG_CONCAT4(_vgw00000ZU_,soname,_,fnname)
#define I_WRAP_SONAME_FNNAME_ZZ(soname,fnname) \
- VG_CONCAT4(_vgwZZ_,soname,_,fnname)
+ VG_CONCAT4(_vgw00000ZZ_,soname,_,fnname)
/* Use this macro from within a wrapper function to collect the
context (address and possibly other info) of the original function.
macros. The type of the argument _lval is OrigFn. */
#define VALGRIND_GET_ORIG_FN(_lval) VALGRIND_GET_NR_CONTEXT(_lval)
+/* Also provide end-user facilities for function replacement, rather
+ than wrapping. A replacement function differs from a wrapper in
+ that it has no way to get hold of the original function being
+ called, and hence no way to call onwards to it. In a replacement
+ function, VALGRIND_GET_ORIG_FN always returns zero. */
+
+#define I_REPLACE_SONAME_FNNAME_ZU(soname,fnname) \
+ VG_CONCAT4(_vgr00000ZU_,soname,_,fnname)
+
+#define I_REPLACE_SONAME_FNNAME_ZZ(soname,fnname) \
+ VG_CONCAT4(_vgr00000ZZ_,soname,_,fnname)
+
/* Derivatives of the main macros below, for calling functions
returning void. */
as gcc can already see that, plus causes gcc to bomb. */
#define __CALLER_SAVED_REGS /*"eax"*/ "ecx", "edx"
+/* Macros to save and align the stack before making a function
+ call and restore it afterwards as gcc may not keep the stack
+ pointer aligned if it doesn't realise calls are being made
+ to other functions. */
+
+#define VALGRIND_ALIGN_STACK \
+ "movl %%esp,%%edi\n\t" \
+ "andl $0xfffffff0,%%esp\n\t"
+#define VALGRIND_RESTORE_STACK \
+ "movl %%edi,%%esp\n\t"
+
/* These CALL_FN_ macros assume that on x86-linux, sizeof(unsigned
long) == 4. */
volatile unsigned long _res; \
_argvec[0] = (unsigned long)_orig.nraddr; \
__asm__ volatile( \
+ VALGRIND_ALIGN_STACK \
"movl (%%eax), %%eax\n\t" /* target->%eax */ \
VALGRIND_CALL_NOREDIR_EAX \
+ VALGRIND_RESTORE_STACK \
: /*out*/ "=a" (_res) \
: /*in*/ "a" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "edi" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
_argvec[0] = (unsigned long)_orig.nraddr; \
_argvec[1] = (unsigned long)(arg1); \
__asm__ volatile( \
+ VALGRIND_ALIGN_STACK \
+ "subl $12, %%esp\n\t" \
"pushl 4(%%eax)\n\t" \
"movl (%%eax), %%eax\n\t" /* target->%eax */ \
VALGRIND_CALL_NOREDIR_EAX \
- "addl $4, %%esp\n" \
+ VALGRIND_RESTORE_STACK \
: /*out*/ "=a" (_res) \
: /*in*/ "a" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "edi" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
_argvec[1] = (unsigned long)(arg1); \
_argvec[2] = (unsigned long)(arg2); \
__asm__ volatile( \
+ VALGRIND_ALIGN_STACK \
+ "subl $8, %%esp\n\t" \
"pushl 8(%%eax)\n\t" \
"pushl 4(%%eax)\n\t" \
"movl (%%eax), %%eax\n\t" /* target->%eax */ \
VALGRIND_CALL_NOREDIR_EAX \
- "addl $8, %%esp\n" \
+ VALGRIND_RESTORE_STACK \
: /*out*/ "=a" (_res) \
: /*in*/ "a" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "edi" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
_argvec[2] = (unsigned long)(arg2); \
_argvec[3] = (unsigned long)(arg3); \
__asm__ volatile( \
+ VALGRIND_ALIGN_STACK \
+ "subl $4, %%esp\n\t" \
"pushl 12(%%eax)\n\t" \
"pushl 8(%%eax)\n\t" \
"pushl 4(%%eax)\n\t" \
"movl (%%eax), %%eax\n\t" /* target->%eax */ \
VALGRIND_CALL_NOREDIR_EAX \
- "addl $12, %%esp\n" \
+ VALGRIND_RESTORE_STACK \
: /*out*/ "=a" (_res) \
: /*in*/ "a" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "edi" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
_argvec[3] = (unsigned long)(arg3); \
_argvec[4] = (unsigned long)(arg4); \
__asm__ volatile( \
+ VALGRIND_ALIGN_STACK \
"pushl 16(%%eax)\n\t" \
"pushl 12(%%eax)\n\t" \
"pushl 8(%%eax)\n\t" \
"pushl 4(%%eax)\n\t" \
"movl (%%eax), %%eax\n\t" /* target->%eax */ \
VALGRIND_CALL_NOREDIR_EAX \
- "addl $16, %%esp\n" \
+ VALGRIND_RESTORE_STACK \
: /*out*/ "=a" (_res) \
: /*in*/ "a" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "edi" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
_argvec[4] = (unsigned long)(arg4); \
_argvec[5] = (unsigned long)(arg5); \
__asm__ volatile( \
+ VALGRIND_ALIGN_STACK \
+ "subl $12, %%esp\n\t" \
"pushl 20(%%eax)\n\t" \
"pushl 16(%%eax)\n\t" \
"pushl 12(%%eax)\n\t" \
"pushl 4(%%eax)\n\t" \
"movl (%%eax), %%eax\n\t" /* target->%eax */ \
VALGRIND_CALL_NOREDIR_EAX \
- "addl $20, %%esp\n" \
+ VALGRIND_RESTORE_STACK \
: /*out*/ "=a" (_res) \
: /*in*/ "a" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "edi" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
_argvec[5] = (unsigned long)(arg5); \
_argvec[6] = (unsigned long)(arg6); \
__asm__ volatile( \
+ VALGRIND_ALIGN_STACK \
+ "subl $8, %%esp\n\t" \
"pushl 24(%%eax)\n\t" \
"pushl 20(%%eax)\n\t" \
"pushl 16(%%eax)\n\t" \
"pushl 4(%%eax)\n\t" \
"movl (%%eax), %%eax\n\t" /* target->%eax */ \
VALGRIND_CALL_NOREDIR_EAX \
- "addl $24, %%esp\n" \
+ VALGRIND_RESTORE_STACK \
: /*out*/ "=a" (_res) \
: /*in*/ "a" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "edi" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
_argvec[6] = (unsigned long)(arg6); \
_argvec[7] = (unsigned long)(arg7); \
__asm__ volatile( \
+ VALGRIND_ALIGN_STACK \
+ "subl $4, %%esp\n\t" \
"pushl 28(%%eax)\n\t" \
"pushl 24(%%eax)\n\t" \
"pushl 20(%%eax)\n\t" \
"pushl 4(%%eax)\n\t" \
"movl (%%eax), %%eax\n\t" /* target->%eax */ \
VALGRIND_CALL_NOREDIR_EAX \
- "addl $28, %%esp\n" \
+ VALGRIND_RESTORE_STACK \
: /*out*/ "=a" (_res) \
: /*in*/ "a" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "edi" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
_argvec[7] = (unsigned long)(arg7); \
_argvec[8] = (unsigned long)(arg8); \
__asm__ volatile( \
+ VALGRIND_ALIGN_STACK \
"pushl 32(%%eax)\n\t" \
"pushl 28(%%eax)\n\t" \
"pushl 24(%%eax)\n\t" \
"pushl 4(%%eax)\n\t" \
"movl (%%eax), %%eax\n\t" /* target->%eax */ \
VALGRIND_CALL_NOREDIR_EAX \
- "addl $32, %%esp\n" \
+ VALGRIND_RESTORE_STACK \
: /*out*/ "=a" (_res) \
: /*in*/ "a" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "edi" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
_argvec[8] = (unsigned long)(arg8); \
_argvec[9] = (unsigned long)(arg9); \
__asm__ volatile( \
+ VALGRIND_ALIGN_STACK \
+ "subl $12, %%esp\n\t" \
"pushl 36(%%eax)\n\t" \
"pushl 32(%%eax)\n\t" \
"pushl 28(%%eax)\n\t" \
"pushl 4(%%eax)\n\t" \
"movl (%%eax), %%eax\n\t" /* target->%eax */ \
VALGRIND_CALL_NOREDIR_EAX \
- "addl $36, %%esp\n" \
+ VALGRIND_RESTORE_STACK \
: /*out*/ "=a" (_res) \
: /*in*/ "a" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "edi" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
_argvec[9] = (unsigned long)(arg9); \
_argvec[10] = (unsigned long)(arg10); \
__asm__ volatile( \
+ VALGRIND_ALIGN_STACK \
+ "subl $8, %%esp\n\t" \
"pushl 40(%%eax)\n\t" \
"pushl 36(%%eax)\n\t" \
"pushl 32(%%eax)\n\t" \
"pushl 4(%%eax)\n\t" \
"movl (%%eax), %%eax\n\t" /* target->%eax */ \
VALGRIND_CALL_NOREDIR_EAX \
- "addl $40, %%esp\n" \
+ VALGRIND_RESTORE_STACK \
: /*out*/ "=a" (_res) \
: /*in*/ "a" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "edi" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
_argvec[10] = (unsigned long)(arg10); \
_argvec[11] = (unsigned long)(arg11); \
__asm__ volatile( \
+ VALGRIND_ALIGN_STACK \
+ "subl $4, %%esp\n\t" \
"pushl 44(%%eax)\n\t" \
"pushl 40(%%eax)\n\t" \
"pushl 36(%%eax)\n\t" \
"pushl 4(%%eax)\n\t" \
"movl (%%eax), %%eax\n\t" /* target->%eax */ \
VALGRIND_CALL_NOREDIR_EAX \
- "addl $44, %%esp\n" \
+ VALGRIND_RESTORE_STACK \
: /*out*/ "=a" (_res) \
: /*in*/ "a" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "edi" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
_argvec[11] = (unsigned long)(arg11); \
_argvec[12] = (unsigned long)(arg12); \
__asm__ volatile( \
+ VALGRIND_ALIGN_STACK \
"pushl 48(%%eax)\n\t" \
"pushl 44(%%eax)\n\t" \
"pushl 40(%%eax)\n\t" \
"pushl 4(%%eax)\n\t" \
"movl (%%eax), %%eax\n\t" /* target->%eax */ \
VALGRIND_CALL_NOREDIR_EAX \
- "addl $48, %%esp\n" \
+ VALGRIND_RESTORE_STACK \
: /*out*/ "=a" (_res) \
: /*in*/ "a" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "edi" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
#define __CALLER_SAVED_REGS /*"rax",*/ "rcx", "rdx", "rsi", \
"rdi", "r8", "r9", "r10", "r11"
+/* This is all pretty complex. It's so as to make stack unwinding
+ work reliably. See bug 243270. The basic problem is the sub and
+ add of 128 of %rsp in all of the following macros. If gcc believes
+ the CFA is in %rsp, then unwinding may fail, because what's at the
+ CFA is not what gcc "expected" when it constructs the CFIs for the
+ places where the macros are instantiated.
+
+ But we can't just add a CFI annotation to increase the CFA offset
+ by 128, to match the sub of 128 from %rsp, because we don't know
+ whether gcc has chosen %rsp as the CFA at that point, or whether it
+ has chosen some other register (eg, %rbp). In the latter case,
+ adding a CFI annotation to change the CFA offset is simply wrong.
+
+ So the solution is to get hold of the CFA using
+ __builtin_dwarf_cfa(), put it in a known register, and add a
+ CFI annotation to say what the register is. We choose %rbp for
+ this (perhaps perversely), because:
+
+ (1) %rbp is already subject to unwinding. If a new register was
+ chosen then the unwinder would have to unwind it in all stack
+ traces, which is expensive, and
+
+ (2) %rbp is already subject to precise exception updates in the
+ JIT. If a new register was chosen, we'd have to have precise
+ exceptions for it too, which reduces performance of the
+ generated code.
+
+ However .. one extra complication. We can't just whack the result
+ of __builtin_dwarf_cfa() into %rbp and then add %rbp to the
+ list of trashed registers at the end of the inline assembly
+ fragments; gcc won't allow %rbp to appear in that list. Hence
+ instead we need to stash %rbp in %r15 for the duration of the asm,
+ and say that %r15 is trashed instead. gcc seems happy to go with
+ that.
+
+ Oh .. and this all needs to be conditionalised so that it is
+ unchanged from before this commit, when compiled with older gccs
+ that don't support __builtin_dwarf_cfa. Furthermore, since
+ this header file is freestanding, it has to be independent of
+ config.h, and so the following conditionalisation cannot depend on
+ configure time checks.
+
+ Although it's not clear from
+ 'defined(__GNUC__) && defined(__GCC_HAVE_DWARF2_CFI_ASM)',
+ this expression excludes Darwin.
+ .cfi directives in Darwin assembly appear to be completely
+ different and I haven't investigated how they work.
+
+ For even more entertainment value, note we have to use the
+ completely undocumented __builtin_dwarf_cfa(), which appears to
+ really compute the CFA, whereas __builtin_frame_address(0) claims
+ to but actually doesn't. See
+ https://bugs.kde.org/show_bug.cgi?id=243270#c47
+*/
+#if defined(__GNUC__) && defined(__GCC_HAVE_DWARF2_CFI_ASM)
+# define __FRAME_POINTER \
+ ,"r"(__builtin_dwarf_cfa())
+# define VALGRIND_CFI_PROLOGUE \
+ "movq %%rbp, %%r15\n\t" \
+ "movq %2, %%rbp\n\t" \
+ ".cfi_remember_state\n\t" \
+ ".cfi_def_cfa rbp, 0\n\t"
+# define VALGRIND_CFI_EPILOGUE \
+ "movq %%r15, %%rbp\n\t" \
+ ".cfi_restore_state\n\t"
+#else
+# define __FRAME_POINTER
+# define VALGRIND_CFI_PROLOGUE
+# define VALGRIND_CFI_EPILOGUE
+#endif
+
+/* Macros to save and align the stack before making a function
+ call and restore it afterwards as gcc may not keep the stack
+ pointer aligned if it doesn't realise calls are being made
+ to other functions. */
+
+#define VALGRIND_ALIGN_STACK \
+ "movq %%rsp,%%r14\n\t" \
+ "andq $0xfffffffffffffff0,%%rsp\n\t"
+#define VALGRIND_RESTORE_STACK \
+ "movq %%r14,%%rsp\n\t"
+
/* These CALL_FN_ macros assume that on amd64-linux, sizeof(unsigned
long) == 8. */
redzone, for the duration of the hidden call, to make it safe.
Probably the same problem afflicts the other redzone-style ABIs too
- (ppc64-linux, ppc32-aix5, ppc64-aix5); but for those, the stack is
+ (ppc64-linux); but for those, the stack is
self describing (none of this CFI nonsense) so at least messing
with the stack pointer doesn't give a danger of non-unwindable
stack. */
+#define CALL_FN_W_v(lval, orig) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[1]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ __asm__ volatile( \
+ VALGRIND_CFI_PROLOGUE \
+ VALGRIND_ALIGN_STACK \
+ "subq $128,%%rsp\n\t" \
+ "movq (%%rax), %%rax\n\t" /* target->%rax */ \
+ VALGRIND_CALL_NOREDIR_RAX \
+ VALGRIND_RESTORE_STACK \
+ VALGRIND_CFI_EPILOGUE \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_W(lval, orig, arg1) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[2]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ __asm__ volatile( \
+ VALGRIND_CFI_PROLOGUE \
+ VALGRIND_ALIGN_STACK \
+ "subq $128,%%rsp\n\t" \
+ "movq 8(%%rax), %%rdi\n\t" \
+ "movq (%%rax), %%rax\n\t" /* target->%rax */ \
+ VALGRIND_CALL_NOREDIR_RAX \
+ VALGRIND_RESTORE_STACK \
+ VALGRIND_CFI_EPILOGUE \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_WW(lval, orig, arg1,arg2) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ __asm__ volatile( \
+ VALGRIND_CFI_PROLOGUE \
+ VALGRIND_ALIGN_STACK \
+ "subq $128,%%rsp\n\t" \
+ "movq 16(%%rax), %%rsi\n\t" \
+ "movq 8(%%rax), %%rdi\n\t" \
+ "movq (%%rax), %%rax\n\t" /* target->%rax */ \
+ VALGRIND_CALL_NOREDIR_RAX \
+ VALGRIND_RESTORE_STACK \
+ VALGRIND_CFI_EPILOGUE \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[4]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ __asm__ volatile( \
+ VALGRIND_CFI_PROLOGUE \
+ VALGRIND_ALIGN_STACK \
+ "subq $128,%%rsp\n\t" \
+ "movq 24(%%rax), %%rdx\n\t" \
+ "movq 16(%%rax), %%rsi\n\t" \
+ "movq 8(%%rax), %%rdi\n\t" \
+ "movq (%%rax), %%rax\n\t" /* target->%rax */ \
+ VALGRIND_CALL_NOREDIR_RAX \
+ VALGRIND_RESTORE_STACK \
+ VALGRIND_CFI_EPILOGUE \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[5]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ __asm__ volatile( \
+ VALGRIND_CFI_PROLOGUE \
+ VALGRIND_ALIGN_STACK \
+ "subq $128,%%rsp\n\t" \
+ "movq 32(%%rax), %%rcx\n\t" \
+ "movq 24(%%rax), %%rdx\n\t" \
+ "movq 16(%%rax), %%rsi\n\t" \
+ "movq 8(%%rax), %%rdi\n\t" \
+ "movq (%%rax), %%rax\n\t" /* target->%rax */ \
+ VALGRIND_CALL_NOREDIR_RAX \
+ VALGRIND_RESTORE_STACK \
+ VALGRIND_CFI_EPILOGUE \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[6]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ __asm__ volatile( \
+ VALGRIND_CFI_PROLOGUE \
+ VALGRIND_ALIGN_STACK \
+ "subq $128,%%rsp\n\t" \
+ "movq 40(%%rax), %%r8\n\t" \
+ "movq 32(%%rax), %%rcx\n\t" \
+ "movq 24(%%rax), %%rdx\n\t" \
+ "movq 16(%%rax), %%rsi\n\t" \
+ "movq 8(%%rax), %%rdi\n\t" \
+ "movq (%%rax), %%rax\n\t" /* target->%rax */ \
+ VALGRIND_CALL_NOREDIR_RAX \
+ VALGRIND_RESTORE_STACK \
+ VALGRIND_CFI_EPILOGUE \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[7]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ _argvec[6] = (unsigned long)(arg6); \
+ __asm__ volatile( \
+ VALGRIND_CFI_PROLOGUE \
+ VALGRIND_ALIGN_STACK \
+ "subq $128,%%rsp\n\t" \
+ "movq 48(%%rax), %%r9\n\t" \
+ "movq 40(%%rax), %%r8\n\t" \
+ "movq 32(%%rax), %%rcx\n\t" \
+ "movq 24(%%rax), %%rdx\n\t" \
+ "movq 16(%%rax), %%rsi\n\t" \
+ "movq 8(%%rax), %%rdi\n\t" \
+ "movq (%%rax), %%rax\n\t" /* target->%rax */ \
+ VALGRIND_CALL_NOREDIR_RAX \
+ VALGRIND_RESTORE_STACK \
+ VALGRIND_CFI_EPILOGUE \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[8]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ _argvec[6] = (unsigned long)(arg6); \
+ _argvec[7] = (unsigned long)(arg7); \
+ __asm__ volatile( \
+ VALGRIND_CFI_PROLOGUE \
+ VALGRIND_ALIGN_STACK \
+ "subq $136,%%rsp\n\t" \
+ "pushq 56(%%rax)\n\t" \
+ "movq 48(%%rax), %%r9\n\t" \
+ "movq 40(%%rax), %%r8\n\t" \
+ "movq 32(%%rax), %%rcx\n\t" \
+ "movq 24(%%rax), %%rdx\n\t" \
+ "movq 16(%%rax), %%rsi\n\t" \
+ "movq 8(%%rax), %%rdi\n\t" \
+ "movq (%%rax), %%rax\n\t" /* target->%rax */ \
+ VALGRIND_CALL_NOREDIR_RAX \
+ VALGRIND_RESTORE_STACK \
+ VALGRIND_CFI_EPILOGUE \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[9]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ _argvec[6] = (unsigned long)(arg6); \
+ _argvec[7] = (unsigned long)(arg7); \
+ _argvec[8] = (unsigned long)(arg8); \
+ __asm__ volatile( \
+ VALGRIND_CFI_PROLOGUE \
+ VALGRIND_ALIGN_STACK \
+ "subq $128,%%rsp\n\t" \
+ "pushq 64(%%rax)\n\t" \
+ "pushq 56(%%rax)\n\t" \
+ "movq 48(%%rax), %%r9\n\t" \
+ "movq 40(%%rax), %%r8\n\t" \
+ "movq 32(%%rax), %%rcx\n\t" \
+ "movq 24(%%rax), %%rdx\n\t" \
+ "movq 16(%%rax), %%rsi\n\t" \
+ "movq 8(%%rax), %%rdi\n\t" \
+ "movq (%%rax), %%rax\n\t" /* target->%rax */ \
+ VALGRIND_CALL_NOREDIR_RAX \
+ VALGRIND_RESTORE_STACK \
+ VALGRIND_CFI_EPILOGUE \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8,arg9) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[10]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ _argvec[6] = (unsigned long)(arg6); \
+ _argvec[7] = (unsigned long)(arg7); \
+ _argvec[8] = (unsigned long)(arg8); \
+ _argvec[9] = (unsigned long)(arg9); \
+ __asm__ volatile( \
+ VALGRIND_CFI_PROLOGUE \
+ VALGRIND_ALIGN_STACK \
+ "subq $136,%%rsp\n\t" \
+ "pushq 72(%%rax)\n\t" \
+ "pushq 64(%%rax)\n\t" \
+ "pushq 56(%%rax)\n\t" \
+ "movq 48(%%rax), %%r9\n\t" \
+ "movq 40(%%rax), %%r8\n\t" \
+ "movq 32(%%rax), %%rcx\n\t" \
+ "movq 24(%%rax), %%rdx\n\t" \
+ "movq 16(%%rax), %%rsi\n\t" \
+ "movq 8(%%rax), %%rdi\n\t" \
+ "movq (%%rax), %%rax\n\t" /* target->%rax */ \
+ VALGRIND_CALL_NOREDIR_RAX \
+ VALGRIND_RESTORE_STACK \
+ VALGRIND_CFI_EPILOGUE \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8,arg9,arg10) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[11]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ _argvec[6] = (unsigned long)(arg6); \
+ _argvec[7] = (unsigned long)(arg7); \
+ _argvec[8] = (unsigned long)(arg8); \
+ _argvec[9] = (unsigned long)(arg9); \
+ _argvec[10] = (unsigned long)(arg10); \
+ __asm__ volatile( \
+ VALGRIND_CFI_PROLOGUE \
+ VALGRIND_ALIGN_STACK \
+ "subq $128,%%rsp\n\t" \
+ "pushq 80(%%rax)\n\t" \
+ "pushq 72(%%rax)\n\t" \
+ "pushq 64(%%rax)\n\t" \
+ "pushq 56(%%rax)\n\t" \
+ "movq 48(%%rax), %%r9\n\t" \
+ "movq 40(%%rax), %%r8\n\t" \
+ "movq 32(%%rax), %%rcx\n\t" \
+ "movq 24(%%rax), %%rdx\n\t" \
+ "movq 16(%%rax), %%rsi\n\t" \
+ "movq 8(%%rax), %%rdi\n\t" \
+ "movq (%%rax), %%rax\n\t" /* target->%rax */ \
+ VALGRIND_CALL_NOREDIR_RAX \
+ VALGRIND_RESTORE_STACK \
+ VALGRIND_CFI_EPILOGUE \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8,arg9,arg10,arg11) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[12]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ _argvec[6] = (unsigned long)(arg6); \
+ _argvec[7] = (unsigned long)(arg7); \
+ _argvec[8] = (unsigned long)(arg8); \
+ _argvec[9] = (unsigned long)(arg9); \
+ _argvec[10] = (unsigned long)(arg10); \
+ _argvec[11] = (unsigned long)(arg11); \
+ __asm__ volatile( \
+ VALGRIND_CFI_PROLOGUE \
+ VALGRIND_ALIGN_STACK \
+ "subq $136,%%rsp\n\t" \
+ "pushq 88(%%rax)\n\t" \
+ "pushq 80(%%rax)\n\t" \
+ "pushq 72(%%rax)\n\t" \
+ "pushq 64(%%rax)\n\t" \
+ "pushq 56(%%rax)\n\t" \
+ "movq 48(%%rax), %%r9\n\t" \
+ "movq 40(%%rax), %%r8\n\t" \
+ "movq 32(%%rax), %%rcx\n\t" \
+ "movq 24(%%rax), %%rdx\n\t" \
+ "movq 16(%%rax), %%rsi\n\t" \
+ "movq 8(%%rax), %%rdi\n\t" \
+ "movq (%%rax), %%rax\n\t" /* target->%rax */ \
+ VALGRIND_CALL_NOREDIR_RAX \
+ VALGRIND_RESTORE_STACK \
+ VALGRIND_CFI_EPILOGUE \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8,arg9,arg10,arg11,arg12) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[13]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ _argvec[6] = (unsigned long)(arg6); \
+ _argvec[7] = (unsigned long)(arg7); \
+ _argvec[8] = (unsigned long)(arg8); \
+ _argvec[9] = (unsigned long)(arg9); \
+ _argvec[10] = (unsigned long)(arg10); \
+ _argvec[11] = (unsigned long)(arg11); \
+ _argvec[12] = (unsigned long)(arg12); \
+ __asm__ volatile( \
+ VALGRIND_CFI_PROLOGUE \
+ VALGRIND_ALIGN_STACK \
+ "subq $128,%%rsp\n\t" \
+ "pushq 96(%%rax)\n\t" \
+ "pushq 88(%%rax)\n\t" \
+ "pushq 80(%%rax)\n\t" \
+ "pushq 72(%%rax)\n\t" \
+ "pushq 64(%%rax)\n\t" \
+ "pushq 56(%%rax)\n\t" \
+ "movq 48(%%rax), %%r9\n\t" \
+ "movq 40(%%rax), %%r8\n\t" \
+ "movq 32(%%rax), %%rcx\n\t" \
+ "movq 24(%%rax), %%rdx\n\t" \
+ "movq 16(%%rax), %%rsi\n\t" \
+ "movq 8(%%rax), %%rdi\n\t" \
+ "movq (%%rax), %%rax\n\t" /* target->%rax */ \
+ VALGRIND_CALL_NOREDIR_RAX \
+ VALGRIND_RESTORE_STACK \
+ VALGRIND_CFI_EPILOGUE \
+ : /*out*/ "=a" (_res) \
+ : /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#endif /* PLAT_amd64_linux || PLAT_amd64_darwin */
+
+/* ------------------------ ppc32-linux ------------------------ */
+
+#if defined(PLAT_ppc32_linux)
+
+/* This is useful for finding out about the on-stack stuff:
+
+ extern int f9 ( int,int,int,int,int,int,int,int,int );
+ extern int f10 ( int,int,int,int,int,int,int,int,int,int );
+ extern int f11 ( int,int,int,int,int,int,int,int,int,int,int );
+ extern int f12 ( int,int,int,int,int,int,int,int,int,int,int,int );
+
+ int g9 ( void ) {
+ return f9(11,22,33,44,55,66,77,88,99);
+ }
+ int g10 ( void ) {
+ return f10(11,22,33,44,55,66,77,88,99,110);
+ }
+ int g11 ( void ) {
+ return f11(11,22,33,44,55,66,77,88,99,110,121);
+ }
+ int g12 ( void ) {
+ return f12(11,22,33,44,55,66,77,88,99,110,121,132);
+ }
+*/
+
+/* ARGREGS: r3 r4 r5 r6 r7 r8 r9 r10 (the rest on stack somewhere) */
+
+/* These regs are trashed by the hidden call. */
+#define __CALLER_SAVED_REGS \
+ "lr", "ctr", "xer", \
+ "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", \
+ "r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", \
+ "r11", "r12", "r13"
+
+/* Macros to save and align the stack before making a function
+ call and restore it afterwards as gcc may not keep the stack
+ pointer aligned if it doesn't realise calls are being made
+ to other functions. */
+
+#define VALGRIND_ALIGN_STACK \
+ "mr 28,1\n\t" \
+ "rlwinm 1,1,0,0,27\n\t"
+#define VALGRIND_RESTORE_STACK \
+ "mr 1,28\n\t"
+
+/* These CALL_FN_ macros assume that on ppc32-linux,
+ sizeof(unsigned long) == 4. */
+
#define CALL_FN_W_v(lval, orig) \
do { \
volatile OrigFn _orig = (orig); \
volatile unsigned long _res; \
_argvec[0] = (unsigned long)_orig.nraddr; \
__asm__ volatile( \
- "subq $128,%%rsp\n\t" \
- "movq (%%rax), %%rax\n\t" /* target->%rax */ \
- VALGRIND_CALL_NOREDIR_RAX \
- "addq $128,%%rsp\n\t" \
- : /*out*/ "=a" (_res) \
- : /*in*/ "a" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ VALGRIND_ALIGN_STACK \
+ "mr 11,%1\n\t" \
+ "lwz 11,0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ VALGRIND_RESTORE_STACK \
+ "mr %0,3" \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
volatile unsigned long _argvec[2]; \
volatile unsigned long _res; \
_argvec[0] = (unsigned long)_orig.nraddr; \
- _argvec[1] = (unsigned long)(arg1); \
+ _argvec[1] = (unsigned long)arg1; \
__asm__ volatile( \
- "subq $128,%%rsp\n\t" \
- "movq 8(%%rax), %%rdi\n\t" \
- "movq (%%rax), %%rax\n\t" /* target->%rax */ \
- VALGRIND_CALL_NOREDIR_RAX \
- "addq $128,%%rsp\n\t" \
- : /*out*/ "=a" (_res) \
- : /*in*/ "a" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
- ); \
- lval = (__typeof__(lval)) _res; \
- } while (0)
-
+ VALGRIND_ALIGN_STACK \
+ "mr 11,%1\n\t" \
+ "lwz 3,4(11)\n\t" /* arg1->r3 */ \
+ "lwz 11,0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ VALGRIND_RESTORE_STACK \
+ "mr %0,3" \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28" \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
#define CALL_FN_W_WW(lval, orig, arg1,arg2) \
do { \
volatile OrigFn _orig = (orig); \
volatile unsigned long _argvec[3]; \
volatile unsigned long _res; \
_argvec[0] = (unsigned long)_orig.nraddr; \
- _argvec[1] = (unsigned long)(arg1); \
- _argvec[2] = (unsigned long)(arg2); \
+ _argvec[1] = (unsigned long)arg1; \
+ _argvec[2] = (unsigned long)arg2; \
__asm__ volatile( \
- "subq $128,%%rsp\n\t" \
- "movq 16(%%rax), %%rsi\n\t" \
- "movq 8(%%rax), %%rdi\n\t" \
- "movq (%%rax), %%rax\n\t" /* target->%rax */ \
- VALGRIND_CALL_NOREDIR_RAX \
- "addq $128,%%rsp\n\t" \
- : /*out*/ "=a" (_res) \
- : /*in*/ "a" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ VALGRIND_ALIGN_STACK \
+ "mr 11,%1\n\t" \
+ "lwz 3,4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4,8(11)\n\t" \
+ "lwz 11,0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ VALGRIND_RESTORE_STACK \
+ "mr %0,3" \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
volatile unsigned long _argvec[4]; \
volatile unsigned long _res; \
_argvec[0] = (unsigned long)_orig.nraddr; \
- _argvec[1] = (unsigned long)(arg1); \
- _argvec[2] = (unsigned long)(arg2); \
- _argvec[3] = (unsigned long)(arg3); \
+ _argvec[1] = (unsigned long)arg1; \
+ _argvec[2] = (unsigned long)arg2; \
+ _argvec[3] = (unsigned long)arg3; \
__asm__ volatile( \
- "subq $128,%%rsp\n\t" \
- "movq 24(%%rax), %%rdx\n\t" \
- "movq 16(%%rax), %%rsi\n\t" \
- "movq 8(%%rax), %%rdi\n\t" \
- "movq (%%rax), %%rax\n\t" /* target->%rax */ \
- VALGRIND_CALL_NOREDIR_RAX \
- "addq $128,%%rsp\n\t" \
- : /*out*/ "=a" (_res) \
- : /*in*/ "a" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ VALGRIND_ALIGN_STACK \
+ "mr 11,%1\n\t" \
+ "lwz 3,4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4,8(11)\n\t" \
+ "lwz 5,12(11)\n\t" \
+ "lwz 11,0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ VALGRIND_RESTORE_STACK \
+ "mr %0,3" \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
volatile unsigned long _argvec[5]; \
volatile unsigned long _res; \
_argvec[0] = (unsigned long)_orig.nraddr; \
- _argvec[1] = (unsigned long)(arg1); \
- _argvec[2] = (unsigned long)(arg2); \
- _argvec[3] = (unsigned long)(arg3); \
- _argvec[4] = (unsigned long)(arg4); \
+ _argvec[1] = (unsigned long)arg1; \
+ _argvec[2] = (unsigned long)arg2; \
+ _argvec[3] = (unsigned long)arg3; \
+ _argvec[4] = (unsigned long)arg4; \
__asm__ volatile( \
- "subq $128,%%rsp\n\t" \
- "movq 32(%%rax), %%rcx\n\t" \
- "movq 24(%%rax), %%rdx\n\t" \
- "movq 16(%%rax), %%rsi\n\t" \
- "movq 8(%%rax), %%rdi\n\t" \
- "movq (%%rax), %%rax\n\t" /* target->%rax */ \
- VALGRIND_CALL_NOREDIR_RAX \
- "addq $128,%%rsp\n\t" \
- : /*out*/ "=a" (_res) \
- : /*in*/ "a" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ VALGRIND_ALIGN_STACK \
+ "mr 11,%1\n\t" \
+ "lwz 3,4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4,8(11)\n\t" \
+ "lwz 5,12(11)\n\t" \
+ "lwz 6,16(11)\n\t" /* arg4->r6 */ \
+ "lwz 11,0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ VALGRIND_RESTORE_STACK \
+ "mr %0,3" \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
volatile unsigned long _argvec[6]; \
volatile unsigned long _res; \
_argvec[0] = (unsigned long)_orig.nraddr; \
- _argvec[1] = (unsigned long)(arg1); \
- _argvec[2] = (unsigned long)(arg2); \
- _argvec[3] = (unsigned long)(arg3); \
- _argvec[4] = (unsigned long)(arg4); \
- _argvec[5] = (unsigned long)(arg5); \
+ _argvec[1] = (unsigned long)arg1; \
+ _argvec[2] = (unsigned long)arg2; \
+ _argvec[3] = (unsigned long)arg3; \
+ _argvec[4] = (unsigned long)arg4; \
+ _argvec[5] = (unsigned long)arg5; \
__asm__ volatile( \
- "subq $128,%%rsp\n\t" \
- "movq 40(%%rax), %%r8\n\t" \
- "movq 32(%%rax), %%rcx\n\t" \
- "movq 24(%%rax), %%rdx\n\t" \
- "movq 16(%%rax), %%rsi\n\t" \
- "movq 8(%%rax), %%rdi\n\t" \
- "movq (%%rax), %%rax\n\t" /* target->%rax */ \
- VALGRIND_CALL_NOREDIR_RAX \
- "addq $128,%%rsp\n\t" \
- : /*out*/ "=a" (_res) \
- : /*in*/ "a" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ VALGRIND_ALIGN_STACK \
+ "mr 11,%1\n\t" \
+ "lwz 3,4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4,8(11)\n\t" \
+ "lwz 5,12(11)\n\t" \
+ "lwz 6,16(11)\n\t" /* arg4->r6 */ \
+ "lwz 7,20(11)\n\t" \
+ "lwz 11,0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ VALGRIND_RESTORE_STACK \
+ "mr %0,3" \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
volatile unsigned long _argvec[7]; \
volatile unsigned long _res; \
_argvec[0] = (unsigned long)_orig.nraddr; \
- _argvec[1] = (unsigned long)(arg1); \
- _argvec[2] = (unsigned long)(arg2); \
- _argvec[3] = (unsigned long)(arg3); \
- _argvec[4] = (unsigned long)(arg4); \
- _argvec[5] = (unsigned long)(arg5); \
- _argvec[6] = (unsigned long)(arg6); \
+ _argvec[1] = (unsigned long)arg1; \
+ _argvec[2] = (unsigned long)arg2; \
+ _argvec[3] = (unsigned long)arg3; \
+ _argvec[4] = (unsigned long)arg4; \
+ _argvec[5] = (unsigned long)arg5; \
+ _argvec[6] = (unsigned long)arg6; \
__asm__ volatile( \
- "subq $128,%%rsp\n\t" \
- "movq 48(%%rax), %%r9\n\t" \
- "movq 40(%%rax), %%r8\n\t" \
- "movq 32(%%rax), %%rcx\n\t" \
- "movq 24(%%rax), %%rdx\n\t" \
- "movq 16(%%rax), %%rsi\n\t" \
- "movq 8(%%rax), %%rdi\n\t" \
- "movq (%%rax), %%rax\n\t" /* target->%rax */ \
- "addq $128,%%rsp\n\t" \
- VALGRIND_CALL_NOREDIR_RAX \
- : /*out*/ "=a" (_res) \
- : /*in*/ "a" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ VALGRIND_ALIGN_STACK \
+ "mr 11,%1\n\t" \
+ "lwz 3,4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4,8(11)\n\t" \
+ "lwz 5,12(11)\n\t" \
+ "lwz 6,16(11)\n\t" /* arg4->r6 */ \
+ "lwz 7,20(11)\n\t" \
+ "lwz 8,24(11)\n\t" \
+ "lwz 11,0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ VALGRIND_RESTORE_STACK \
+ "mr %0,3" \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
volatile unsigned long _argvec[8]; \
volatile unsigned long _res; \
_argvec[0] = (unsigned long)_orig.nraddr; \
- _argvec[1] = (unsigned long)(arg1); \
- _argvec[2] = (unsigned long)(arg2); \
- _argvec[3] = (unsigned long)(arg3); \
- _argvec[4] = (unsigned long)(arg4); \
- _argvec[5] = (unsigned long)(arg5); \
- _argvec[6] = (unsigned long)(arg6); \
- _argvec[7] = (unsigned long)(arg7); \
+ _argvec[1] = (unsigned long)arg1; \
+ _argvec[2] = (unsigned long)arg2; \
+ _argvec[3] = (unsigned long)arg3; \
+ _argvec[4] = (unsigned long)arg4; \
+ _argvec[5] = (unsigned long)arg5; \
+ _argvec[6] = (unsigned long)arg6; \
+ _argvec[7] = (unsigned long)arg7; \
__asm__ volatile( \
- "subq $128,%%rsp\n\t" \
- "pushq 56(%%rax)\n\t" \
- "movq 48(%%rax), %%r9\n\t" \
- "movq 40(%%rax), %%r8\n\t" \
- "movq 32(%%rax), %%rcx\n\t" \
- "movq 24(%%rax), %%rdx\n\t" \
- "movq 16(%%rax), %%rsi\n\t" \
- "movq 8(%%rax), %%rdi\n\t" \
- "movq (%%rax), %%rax\n\t" /* target->%rax */ \
- VALGRIND_CALL_NOREDIR_RAX \
- "addq $8, %%rsp\n" \
- "addq $128,%%rsp\n\t" \
- : /*out*/ "=a" (_res) \
- : /*in*/ "a" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ VALGRIND_ALIGN_STACK \
+ "mr 11,%1\n\t" \
+ "lwz 3,4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4,8(11)\n\t" \
+ "lwz 5,12(11)\n\t" \
+ "lwz 6,16(11)\n\t" /* arg4->r6 */ \
+ "lwz 7,20(11)\n\t" \
+ "lwz 8,24(11)\n\t" \
+ "lwz 9,28(11)\n\t" \
+ "lwz 11,0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ VALGRIND_RESTORE_STACK \
+ "mr %0,3" \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
volatile unsigned long _argvec[9]; \
volatile unsigned long _res; \
_argvec[0] = (unsigned long)_orig.nraddr; \
- _argvec[1] = (unsigned long)(arg1); \
- _argvec[2] = (unsigned long)(arg2); \
- _argvec[3] = (unsigned long)(arg3); \
- _argvec[4] = (unsigned long)(arg4); \
- _argvec[5] = (unsigned long)(arg5); \
- _argvec[6] = (unsigned long)(arg6); \
- _argvec[7] = (unsigned long)(arg7); \
- _argvec[8] = (unsigned long)(arg8); \
+ _argvec[1] = (unsigned long)arg1; \
+ _argvec[2] = (unsigned long)arg2; \
+ _argvec[3] = (unsigned long)arg3; \
+ _argvec[4] = (unsigned long)arg4; \
+ _argvec[5] = (unsigned long)arg5; \
+ _argvec[6] = (unsigned long)arg6; \
+ _argvec[7] = (unsigned long)arg7; \
+ _argvec[8] = (unsigned long)arg8; \
__asm__ volatile( \
- "subq $128,%%rsp\n\t" \
- "pushq 64(%%rax)\n\t" \
- "pushq 56(%%rax)\n\t" \
- "movq 48(%%rax), %%r9\n\t" \
- "movq 40(%%rax), %%r8\n\t" \
- "movq 32(%%rax), %%rcx\n\t" \
- "movq 24(%%rax), %%rdx\n\t" \
- "movq 16(%%rax), %%rsi\n\t" \
- "movq 8(%%rax), %%rdi\n\t" \
- "movq (%%rax), %%rax\n\t" /* target->%rax */ \
- VALGRIND_CALL_NOREDIR_RAX \
- "addq $16, %%rsp\n" \
- "addq $128,%%rsp\n\t" \
- : /*out*/ "=a" (_res) \
- : /*in*/ "a" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ VALGRIND_ALIGN_STACK \
+ "mr 11,%1\n\t" \
+ "lwz 3,4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4,8(11)\n\t" \
+ "lwz 5,12(11)\n\t" \
+ "lwz 6,16(11)\n\t" /* arg4->r6 */ \
+ "lwz 7,20(11)\n\t" \
+ "lwz 8,24(11)\n\t" \
+ "lwz 9,28(11)\n\t" \
+ "lwz 10,32(11)\n\t" /* arg8->r10 */ \
+ "lwz 11,0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ VALGRIND_RESTORE_STACK \
+ "mr %0,3" \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
volatile unsigned long _argvec[10]; \
volatile unsigned long _res; \
_argvec[0] = (unsigned long)_orig.nraddr; \
- _argvec[1] = (unsigned long)(arg1); \
- _argvec[2] = (unsigned long)(arg2); \
- _argvec[3] = (unsigned long)(arg3); \
- _argvec[4] = (unsigned long)(arg4); \
- _argvec[5] = (unsigned long)(arg5); \
- _argvec[6] = (unsigned long)(arg6); \
- _argvec[7] = (unsigned long)(arg7); \
- _argvec[8] = (unsigned long)(arg8); \
- _argvec[9] = (unsigned long)(arg9); \
+ _argvec[1] = (unsigned long)arg1; \
+ _argvec[2] = (unsigned long)arg2; \
+ _argvec[3] = (unsigned long)arg3; \
+ _argvec[4] = (unsigned long)arg4; \
+ _argvec[5] = (unsigned long)arg5; \
+ _argvec[6] = (unsigned long)arg6; \
+ _argvec[7] = (unsigned long)arg7; \
+ _argvec[8] = (unsigned long)arg8; \
+ _argvec[9] = (unsigned long)arg9; \
__asm__ volatile( \
- "subq $128,%%rsp\n\t" \
- "pushq 72(%%rax)\n\t" \
- "pushq 64(%%rax)\n\t" \
- "pushq 56(%%rax)\n\t" \
- "movq 48(%%rax), %%r9\n\t" \
- "movq 40(%%rax), %%r8\n\t" \
- "movq 32(%%rax), %%rcx\n\t" \
- "movq 24(%%rax), %%rdx\n\t" \
- "movq 16(%%rax), %%rsi\n\t" \
- "movq 8(%%rax), %%rdi\n\t" \
- "movq (%%rax), %%rax\n\t" /* target->%rax */ \
- VALGRIND_CALL_NOREDIR_RAX \
- "addq $24, %%rsp\n" \
- "addq $128,%%rsp\n\t" \
- : /*out*/ "=a" (_res) \
- : /*in*/ "a" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ VALGRIND_ALIGN_STACK \
+ "mr 11,%1\n\t" \
+ "addi 1,1,-16\n\t" \
+ /* arg9 */ \
+ "lwz 3,36(11)\n\t" \
+ "stw 3,8(1)\n\t" \
+ /* args1-8 */ \
+ "lwz 3,4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4,8(11)\n\t" \
+ "lwz 5,12(11)\n\t" \
+ "lwz 6,16(11)\n\t" /* arg4->r6 */ \
+ "lwz 7,20(11)\n\t" \
+ "lwz 8,24(11)\n\t" \
+ "lwz 9,28(11)\n\t" \
+ "lwz 10,32(11)\n\t" /* arg8->r10 */ \
+ "lwz 11,0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ VALGRIND_RESTORE_STACK \
+ "mr %0,3" \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
volatile unsigned long _argvec[11]; \
volatile unsigned long _res; \
_argvec[0] = (unsigned long)_orig.nraddr; \
- _argvec[1] = (unsigned long)(arg1); \
- _argvec[2] = (unsigned long)(arg2); \
- _argvec[3] = (unsigned long)(arg3); \
- _argvec[4] = (unsigned long)(arg4); \
- _argvec[5] = (unsigned long)(arg5); \
- _argvec[6] = (unsigned long)(arg6); \
- _argvec[7] = (unsigned long)(arg7); \
- _argvec[8] = (unsigned long)(arg8); \
- _argvec[9] = (unsigned long)(arg9); \
- _argvec[10] = (unsigned long)(arg10); \
+ _argvec[1] = (unsigned long)arg1; \
+ _argvec[2] = (unsigned long)arg2; \
+ _argvec[3] = (unsigned long)arg3; \
+ _argvec[4] = (unsigned long)arg4; \
+ _argvec[5] = (unsigned long)arg5; \
+ _argvec[6] = (unsigned long)arg6; \
+ _argvec[7] = (unsigned long)arg7; \
+ _argvec[8] = (unsigned long)arg8; \
+ _argvec[9] = (unsigned long)arg9; \
+ _argvec[10] = (unsigned long)arg10; \
__asm__ volatile( \
- "subq $128,%%rsp\n\t" \
- "pushq 80(%%rax)\n\t" \
- "pushq 72(%%rax)\n\t" \
- "pushq 64(%%rax)\n\t" \
- "pushq 56(%%rax)\n\t" \
- "movq 48(%%rax), %%r9\n\t" \
- "movq 40(%%rax), %%r8\n\t" \
- "movq 32(%%rax), %%rcx\n\t" \
- "movq 24(%%rax), %%rdx\n\t" \
- "movq 16(%%rax), %%rsi\n\t" \
- "movq 8(%%rax), %%rdi\n\t" \
- "movq (%%rax), %%rax\n\t" /* target->%rax */ \
- VALGRIND_CALL_NOREDIR_RAX \
- "addq $32, %%rsp\n" \
- "addq $128,%%rsp\n\t" \
- : /*out*/ "=a" (_res) \
- : /*in*/ "a" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
- ); \
- lval = (__typeof__(lval)) _res; \
- } while (0)
-
-#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
- arg7,arg8,arg9,arg10,arg11) \
- do { \
- volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[12]; \
- volatile unsigned long _res; \
- _argvec[0] = (unsigned long)_orig.nraddr; \
- _argvec[1] = (unsigned long)(arg1); \
- _argvec[2] = (unsigned long)(arg2); \
- _argvec[3] = (unsigned long)(arg3); \
- _argvec[4] = (unsigned long)(arg4); \
- _argvec[5] = (unsigned long)(arg5); \
- _argvec[6] = (unsigned long)(arg6); \
- _argvec[7] = (unsigned long)(arg7); \
- _argvec[8] = (unsigned long)(arg8); \
- _argvec[9] = (unsigned long)(arg9); \
- _argvec[10] = (unsigned long)(arg10); \
- _argvec[11] = (unsigned long)(arg11); \
+ VALGRIND_ALIGN_STACK \
+ "mr 11,%1\n\t" \
+ "addi 1,1,-16\n\t" \
+ /* arg10 */ \
+ "lwz 3,40(11)\n\t" \
+ "stw 3,12(1)\n\t" \
+ /* arg9 */ \
+ "lwz 3,36(11)\n\t" \
+ "stw 3,8(1)\n\t" \
+ /* args1-8 */ \
+ "lwz 3,4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4,8(11)\n\t" \
+ "lwz 5,12(11)\n\t" \
+ "lwz 6,16(11)\n\t" /* arg4->r6 */ \
+ "lwz 7,20(11)\n\t" \
+ "lwz 8,24(11)\n\t" \
+ "lwz 9,28(11)\n\t" \
+ "lwz 10,32(11)\n\t" /* arg8->r10 */ \
+ "lwz 11,0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ VALGRIND_RESTORE_STACK \
+ "mr %0,3" \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28" \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
+
+#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
+ arg7,arg8,arg9,arg10,arg11) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[12]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)arg1; \
+ _argvec[2] = (unsigned long)arg2; \
+ _argvec[3] = (unsigned long)arg3; \
+ _argvec[4] = (unsigned long)arg4; \
+ _argvec[5] = (unsigned long)arg5; \
+ _argvec[6] = (unsigned long)arg6; \
+ _argvec[7] = (unsigned long)arg7; \
+ _argvec[8] = (unsigned long)arg8; \
+ _argvec[9] = (unsigned long)arg9; \
+ _argvec[10] = (unsigned long)arg10; \
+ _argvec[11] = (unsigned long)arg11; \
__asm__ volatile( \
- "subq $128,%%rsp\n\t" \
- "pushq 88(%%rax)\n\t" \
- "pushq 80(%%rax)\n\t" \
- "pushq 72(%%rax)\n\t" \
- "pushq 64(%%rax)\n\t" \
- "pushq 56(%%rax)\n\t" \
- "movq 48(%%rax), %%r9\n\t" \
- "movq 40(%%rax), %%r8\n\t" \
- "movq 32(%%rax), %%rcx\n\t" \
- "movq 24(%%rax), %%rdx\n\t" \
- "movq 16(%%rax), %%rsi\n\t" \
- "movq 8(%%rax), %%rdi\n\t" \
- "movq (%%rax), %%rax\n\t" /* target->%rax */ \
- VALGRIND_CALL_NOREDIR_RAX \
- "addq $40, %%rsp\n" \
- "addq $128,%%rsp\n\t" \
- : /*out*/ "=a" (_res) \
- : /*in*/ "a" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ VALGRIND_ALIGN_STACK \
+ "mr 11,%1\n\t" \
+ "addi 1,1,-32\n\t" \
+ /* arg11 */ \
+ "lwz 3,44(11)\n\t" \
+ "stw 3,16(1)\n\t" \
+ /* arg10 */ \
+ "lwz 3,40(11)\n\t" \
+ "stw 3,12(1)\n\t" \
+ /* arg9 */ \
+ "lwz 3,36(11)\n\t" \
+ "stw 3,8(1)\n\t" \
+ /* args1-8 */ \
+ "lwz 3,4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4,8(11)\n\t" \
+ "lwz 5,12(11)\n\t" \
+ "lwz 6,16(11)\n\t" /* arg4->r6 */ \
+ "lwz 7,20(11)\n\t" \
+ "lwz 8,24(11)\n\t" \
+ "lwz 9,28(11)\n\t" \
+ "lwz 10,32(11)\n\t" /* arg8->r10 */ \
+ "lwz 11,0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ VALGRIND_RESTORE_STACK \
+ "mr %0,3" \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
volatile unsigned long _argvec[13]; \
volatile unsigned long _res; \
_argvec[0] = (unsigned long)_orig.nraddr; \
- _argvec[1] = (unsigned long)(arg1); \
- _argvec[2] = (unsigned long)(arg2); \
- _argvec[3] = (unsigned long)(arg3); \
- _argvec[4] = (unsigned long)(arg4); \
- _argvec[5] = (unsigned long)(arg5); \
- _argvec[6] = (unsigned long)(arg6); \
- _argvec[7] = (unsigned long)(arg7); \
- _argvec[8] = (unsigned long)(arg8); \
- _argvec[9] = (unsigned long)(arg9); \
- _argvec[10] = (unsigned long)(arg10); \
- _argvec[11] = (unsigned long)(arg11); \
- _argvec[12] = (unsigned long)(arg12); \
+ _argvec[1] = (unsigned long)arg1; \
+ _argvec[2] = (unsigned long)arg2; \
+ _argvec[3] = (unsigned long)arg3; \
+ _argvec[4] = (unsigned long)arg4; \
+ _argvec[5] = (unsigned long)arg5; \
+ _argvec[6] = (unsigned long)arg6; \
+ _argvec[7] = (unsigned long)arg7; \
+ _argvec[8] = (unsigned long)arg8; \
+ _argvec[9] = (unsigned long)arg9; \
+ _argvec[10] = (unsigned long)arg10; \
+ _argvec[11] = (unsigned long)arg11; \
+ _argvec[12] = (unsigned long)arg12; \
__asm__ volatile( \
- "subq $128,%%rsp\n\t" \
- "pushq 96(%%rax)\n\t" \
- "pushq 88(%%rax)\n\t" \
- "pushq 80(%%rax)\n\t" \
- "pushq 72(%%rax)\n\t" \
- "pushq 64(%%rax)\n\t" \
- "pushq 56(%%rax)\n\t" \
- "movq 48(%%rax), %%r9\n\t" \
- "movq 40(%%rax), %%r8\n\t" \
- "movq 32(%%rax), %%rcx\n\t" \
- "movq 24(%%rax), %%rdx\n\t" \
- "movq 16(%%rax), %%rsi\n\t" \
- "movq 8(%%rax), %%rdi\n\t" \
- "movq (%%rax), %%rax\n\t" /* target->%rax */ \
- VALGRIND_CALL_NOREDIR_RAX \
- "addq $48, %%rsp\n" \
- "addq $128,%%rsp\n\t" \
- : /*out*/ "=a" (_res) \
- : /*in*/ "a" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ VALGRIND_ALIGN_STACK \
+ "mr 11,%1\n\t" \
+ "addi 1,1,-32\n\t" \
+ /* arg12 */ \
+ "lwz 3,48(11)\n\t" \
+ "stw 3,20(1)\n\t" \
+ /* arg11 */ \
+ "lwz 3,44(11)\n\t" \
+ "stw 3,16(1)\n\t" \
+ /* arg10 */ \
+ "lwz 3,40(11)\n\t" \
+ "stw 3,12(1)\n\t" \
+ /* arg9 */ \
+ "lwz 3,36(11)\n\t" \
+ "stw 3,8(1)\n\t" \
+ /* args1-8 */ \
+ "lwz 3,4(11)\n\t" /* arg1->r3 */ \
+ "lwz 4,8(11)\n\t" \
+ "lwz 5,12(11)\n\t" \
+ "lwz 6,16(11)\n\t" /* arg4->r6 */ \
+ "lwz 7,20(11)\n\t" \
+ "lwz 8,24(11)\n\t" \
+ "lwz 9,28(11)\n\t" \
+ "lwz 10,32(11)\n\t" /* arg8->r10 */ \
+ "lwz 11,0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ VALGRIND_RESTORE_STACK \
+ "mr %0,3" \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
-#endif /* PLAT_amd64_linux || PLAT_amd64_darwin */
-
-/* ------------------------ ppc32-linux ------------------------ */
-
-#if defined(PLAT_ppc32_linux)
-
-/* This is useful for finding out about the on-stack stuff:
+#endif /* PLAT_ppc32_linux */
- extern int f9 ( int,int,int,int,int,int,int,int,int );
- extern int f10 ( int,int,int,int,int,int,int,int,int,int );
- extern int f11 ( int,int,int,int,int,int,int,int,int,int,int );
- extern int f12 ( int,int,int,int,int,int,int,int,int,int,int,int );
+/* ------------------------ ppc64-linux ------------------------ */
- int g9 ( void ) {
- return f9(11,22,33,44,55,66,77,88,99);
- }
- int g10 ( void ) {
- return f10(11,22,33,44,55,66,77,88,99,110);
- }
- int g11 ( void ) {
- return f11(11,22,33,44,55,66,77,88,99,110,121);
- }
- int g12 ( void ) {
- return f12(11,22,33,44,55,66,77,88,99,110,121,132);
- }
-*/
+#if defined(PLAT_ppc64_linux)
/* ARGREGS: r3 r4 r5 r6 r7 r8 r9 r10 (the rest on stack somewhere) */
"r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", \
"r11", "r12", "r13"
-/* These CALL_FN_ macros assume that on ppc32-linux,
- sizeof(unsigned long) == 4. */
+/* Macros to save and align the stack before making a function
+ call and restore it afterwards as gcc may not keep the stack
+ pointer aligned if it doesn't realise calls are being made
+ to other functions. */
+
+#define VALGRIND_ALIGN_STACK \
+ "mr 28,1\n\t" \
+ "rldicr 1,1,0,59\n\t"
+#define VALGRIND_RESTORE_STACK \
+ "mr 1,28\n\t"
+
+/* These CALL_FN_ macros assume that on ppc64-linux, sizeof(unsigned
+ long) == 8. */
#define CALL_FN_W_v(lval, orig) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[1]; \
+ volatile unsigned long _argvec[3+0]; \
volatile unsigned long _res; \
- _argvec[0] = (unsigned long)_orig.nraddr; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
__asm__ volatile( \
+ VALGRIND_ALIGN_STACK \
"mr 11,%1\n\t" \
- "lwz 11,0(11)\n\t" /* target->r11 */ \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr %0,3" \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)\n\t" /* restore tocptr */ \
+ VALGRIND_RESTORE_STACK \
: /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
#define CALL_FN_W_W(lval, orig, arg1) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[2]; \
+ volatile unsigned long _argvec[3+1]; \
volatile unsigned long _res; \
- _argvec[0] = (unsigned long)_orig.nraddr; \
- _argvec[1] = (unsigned long)arg1; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
__asm__ volatile( \
+ VALGRIND_ALIGN_STACK \
"mr 11,%1\n\t" \
- "lwz 3,4(11)\n\t" /* arg1->r3 */ \
- "lwz 11,0(11)\n\t" /* target->r11 */ \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr %0,3" \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)\n\t" /* restore tocptr */ \
+ VALGRIND_RESTORE_STACK \
: /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
#define CALL_FN_W_WW(lval, orig, arg1,arg2) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3]; \
+ volatile unsigned long _argvec[3+2]; \
volatile unsigned long _res; \
- _argvec[0] = (unsigned long)_orig.nraddr; \
- _argvec[1] = (unsigned long)arg1; \
- _argvec[2] = (unsigned long)arg2; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
__asm__ volatile( \
+ VALGRIND_ALIGN_STACK \
"mr 11,%1\n\t" \
- "lwz 3,4(11)\n\t" /* arg1->r3 */ \
- "lwz 4,8(11)\n\t" \
- "lwz 11,0(11)\n\t" /* target->r11 */ \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 4, 16(11)\n\t" /* arg2->r4 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr %0,3" \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)\n\t" /* restore tocptr */ \
+ VALGRIND_RESTORE_STACK \
: /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[4]; \
+ volatile unsigned long _argvec[3+3]; \
volatile unsigned long _res; \
- _argvec[0] = (unsigned long)_orig.nraddr; \
- _argvec[1] = (unsigned long)arg1; \
- _argvec[2] = (unsigned long)arg2; \
- _argvec[3] = (unsigned long)arg3; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
__asm__ volatile( \
+ VALGRIND_ALIGN_STACK \
"mr 11,%1\n\t" \
- "lwz 3,4(11)\n\t" /* arg1->r3 */ \
- "lwz 4,8(11)\n\t" \
- "lwz 5,12(11)\n\t" \
- "lwz 11,0(11)\n\t" /* target->r11 */ \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 4, 16(11)\n\t" /* arg2->r4 */ \
+ "ld 5, 24(11)\n\t" /* arg3->r5 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr %0,3" \
- : /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)\n\t" /* restore tocptr */ \
+ VALGRIND_RESTORE_STACK \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[5]; \
+ volatile unsigned long _argvec[3+4]; \
volatile unsigned long _res; \
- _argvec[0] = (unsigned long)_orig.nraddr; \
- _argvec[1] = (unsigned long)arg1; \
- _argvec[2] = (unsigned long)arg2; \
- _argvec[3] = (unsigned long)arg3; \
- _argvec[4] = (unsigned long)arg4; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[2+4] = (unsigned long)arg4; \
__asm__ volatile( \
+ VALGRIND_ALIGN_STACK \
"mr 11,%1\n\t" \
- "lwz 3,4(11)\n\t" /* arg1->r3 */ \
- "lwz 4,8(11)\n\t" \
- "lwz 5,12(11)\n\t" \
- "lwz 6,16(11)\n\t" /* arg4->r6 */ \
- "lwz 11,0(11)\n\t" /* target->r11 */ \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 4, 16(11)\n\t" /* arg2->r4 */ \
+ "ld 5, 24(11)\n\t" /* arg3->r5 */ \
+ "ld 6, 32(11)\n\t" /* arg4->r6 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr %0,3" \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)\n\t" /* restore tocptr */ \
+ VALGRIND_RESTORE_STACK \
: /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[6]; \
+ volatile unsigned long _argvec[3+5]; \
volatile unsigned long _res; \
- _argvec[0] = (unsigned long)_orig.nraddr; \
- _argvec[1] = (unsigned long)arg1; \
- _argvec[2] = (unsigned long)arg2; \
- _argvec[3] = (unsigned long)arg3; \
- _argvec[4] = (unsigned long)arg4; \
- _argvec[5] = (unsigned long)arg5; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[2+4] = (unsigned long)arg4; \
+ _argvec[2+5] = (unsigned long)arg5; \
__asm__ volatile( \
+ VALGRIND_ALIGN_STACK \
"mr 11,%1\n\t" \
- "lwz 3,4(11)\n\t" /* arg1->r3 */ \
- "lwz 4,8(11)\n\t" \
- "lwz 5,12(11)\n\t" \
- "lwz 6,16(11)\n\t" /* arg4->r6 */ \
- "lwz 7,20(11)\n\t" \
- "lwz 11,0(11)\n\t" /* target->r11 */ \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 4, 16(11)\n\t" /* arg2->r4 */ \
+ "ld 5, 24(11)\n\t" /* arg3->r5 */ \
+ "ld 6, 32(11)\n\t" /* arg4->r6 */ \
+ "ld 7, 40(11)\n\t" /* arg5->r7 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr %0,3" \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)\n\t" /* restore tocptr */ \
+ VALGRIND_RESTORE_STACK \
: /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[7]; \
+ volatile unsigned long _argvec[3+6]; \
volatile unsigned long _res; \
- _argvec[0] = (unsigned long)_orig.nraddr; \
- _argvec[1] = (unsigned long)arg1; \
- _argvec[2] = (unsigned long)arg2; \
- _argvec[3] = (unsigned long)arg3; \
- _argvec[4] = (unsigned long)arg4; \
- _argvec[5] = (unsigned long)arg5; \
- _argvec[6] = (unsigned long)arg6; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[2+4] = (unsigned long)arg4; \
+ _argvec[2+5] = (unsigned long)arg5; \
+ _argvec[2+6] = (unsigned long)arg6; \
__asm__ volatile( \
+ VALGRIND_ALIGN_STACK \
"mr 11,%1\n\t" \
- "lwz 3,4(11)\n\t" /* arg1->r3 */ \
- "lwz 4,8(11)\n\t" \
- "lwz 5,12(11)\n\t" \
- "lwz 6,16(11)\n\t" /* arg4->r6 */ \
- "lwz 7,20(11)\n\t" \
- "lwz 8,24(11)\n\t" \
- "lwz 11,0(11)\n\t" /* target->r11 */ \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 4, 16(11)\n\t" /* arg2->r4 */ \
+ "ld 5, 24(11)\n\t" /* arg3->r5 */ \
+ "ld 6, 32(11)\n\t" /* arg4->r6 */ \
+ "ld 7, 40(11)\n\t" /* arg5->r7 */ \
+ "ld 8, 48(11)\n\t" /* arg6->r8 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr %0,3" \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)\n\t" /* restore tocptr */ \
+ VALGRIND_RESTORE_STACK \
: /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
arg7) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[8]; \
+ volatile unsigned long _argvec[3+7]; \
volatile unsigned long _res; \
- _argvec[0] = (unsigned long)_orig.nraddr; \
- _argvec[1] = (unsigned long)arg1; \
- _argvec[2] = (unsigned long)arg2; \
- _argvec[3] = (unsigned long)arg3; \
- _argvec[4] = (unsigned long)arg4; \
- _argvec[5] = (unsigned long)arg5; \
- _argvec[6] = (unsigned long)arg6; \
- _argvec[7] = (unsigned long)arg7; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[2+4] = (unsigned long)arg4; \
+ _argvec[2+5] = (unsigned long)arg5; \
+ _argvec[2+6] = (unsigned long)arg6; \
+ _argvec[2+7] = (unsigned long)arg7; \
__asm__ volatile( \
+ VALGRIND_ALIGN_STACK \
"mr 11,%1\n\t" \
- "lwz 3,4(11)\n\t" /* arg1->r3 */ \
- "lwz 4,8(11)\n\t" \
- "lwz 5,12(11)\n\t" \
- "lwz 6,16(11)\n\t" /* arg4->r6 */ \
- "lwz 7,20(11)\n\t" \
- "lwz 8,24(11)\n\t" \
- "lwz 9,28(11)\n\t" \
- "lwz 11,0(11)\n\t" /* target->r11 */ \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 4, 16(11)\n\t" /* arg2->r4 */ \
+ "ld 5, 24(11)\n\t" /* arg3->r5 */ \
+ "ld 6, 32(11)\n\t" /* arg4->r6 */ \
+ "ld 7, 40(11)\n\t" /* arg5->r7 */ \
+ "ld 8, 48(11)\n\t" /* arg6->r8 */ \
+ "ld 9, 56(11)\n\t" /* arg7->r9 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr %0,3" \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)\n\t" /* restore tocptr */ \
+ VALGRIND_RESTORE_STACK \
: /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
arg7,arg8) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[9]; \
+ volatile unsigned long _argvec[3+8]; \
volatile unsigned long _res; \
- _argvec[0] = (unsigned long)_orig.nraddr; \
- _argvec[1] = (unsigned long)arg1; \
- _argvec[2] = (unsigned long)arg2; \
- _argvec[3] = (unsigned long)arg3; \
- _argvec[4] = (unsigned long)arg4; \
- _argvec[5] = (unsigned long)arg5; \
- _argvec[6] = (unsigned long)arg6; \
- _argvec[7] = (unsigned long)arg7; \
- _argvec[8] = (unsigned long)arg8; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[2+4] = (unsigned long)arg4; \
+ _argvec[2+5] = (unsigned long)arg5; \
+ _argvec[2+6] = (unsigned long)arg6; \
+ _argvec[2+7] = (unsigned long)arg7; \
+ _argvec[2+8] = (unsigned long)arg8; \
__asm__ volatile( \
+ VALGRIND_ALIGN_STACK \
"mr 11,%1\n\t" \
- "lwz 3,4(11)\n\t" /* arg1->r3 */ \
- "lwz 4,8(11)\n\t" \
- "lwz 5,12(11)\n\t" \
- "lwz 6,16(11)\n\t" /* arg4->r6 */ \
- "lwz 7,20(11)\n\t" \
- "lwz 8,24(11)\n\t" \
- "lwz 9,28(11)\n\t" \
- "lwz 10,32(11)\n\t" /* arg8->r10 */ \
- "lwz 11,0(11)\n\t" /* target->r11 */ \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 4, 16(11)\n\t" /* arg2->r4 */ \
+ "ld 5, 24(11)\n\t" /* arg3->r5 */ \
+ "ld 6, 32(11)\n\t" /* arg4->r6 */ \
+ "ld 7, 40(11)\n\t" /* arg5->r7 */ \
+ "ld 8, 48(11)\n\t" /* arg6->r8 */ \
+ "ld 9, 56(11)\n\t" /* arg7->r9 */ \
+ "ld 10, 64(11)\n\t" /* arg8->r10 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr %0,3" \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)\n\t" /* restore tocptr */ \
+ VALGRIND_RESTORE_STACK \
: /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
arg7,arg8,arg9) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[10]; \
+ volatile unsigned long _argvec[3+9]; \
volatile unsigned long _res; \
- _argvec[0] = (unsigned long)_orig.nraddr; \
- _argvec[1] = (unsigned long)arg1; \
- _argvec[2] = (unsigned long)arg2; \
- _argvec[3] = (unsigned long)arg3; \
- _argvec[4] = (unsigned long)arg4; \
- _argvec[5] = (unsigned long)arg5; \
- _argvec[6] = (unsigned long)arg6; \
- _argvec[7] = (unsigned long)arg7; \
- _argvec[8] = (unsigned long)arg8; \
- _argvec[9] = (unsigned long)arg9; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[2+4] = (unsigned long)arg4; \
+ _argvec[2+5] = (unsigned long)arg5; \
+ _argvec[2+6] = (unsigned long)arg6; \
+ _argvec[2+7] = (unsigned long)arg7; \
+ _argvec[2+8] = (unsigned long)arg8; \
+ _argvec[2+9] = (unsigned long)arg9; \
__asm__ volatile( \
+ VALGRIND_ALIGN_STACK \
"mr 11,%1\n\t" \
- "addi 1,1,-16\n\t" \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "addi 1,1,-128\n\t" /* expand stack frame */ \
/* arg9 */ \
- "lwz 3,36(11)\n\t" \
- "stw 3,8(1)\n\t" \
+ "ld 3,72(11)\n\t" \
+ "std 3,112(1)\n\t" \
/* args1-8 */ \
- "lwz 3,4(11)\n\t" /* arg1->r3 */ \
- "lwz 4,8(11)\n\t" \
- "lwz 5,12(11)\n\t" \
- "lwz 6,16(11)\n\t" /* arg4->r6 */ \
- "lwz 7,20(11)\n\t" \
- "lwz 8,24(11)\n\t" \
- "lwz 9,28(11)\n\t" \
- "lwz 10,32(11)\n\t" /* arg8->r10 */ \
- "lwz 11,0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "addi 1,1,16\n\t" \
- "mr %0,3" \
- : /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 4, 16(11)\n\t" /* arg2->r4 */ \
+ "ld 5, 24(11)\n\t" /* arg3->r5 */ \
+ "ld 6, 32(11)\n\t" /* arg4->r6 */ \
+ "ld 7, 40(11)\n\t" /* arg5->r7 */ \
+ "ld 8, 48(11)\n\t" /* arg6->r8 */ \
+ "ld 9, 56(11)\n\t" /* arg7->r9 */ \
+ "ld 10, 64(11)\n\t" /* arg8->r10 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)\n\t" /* restore tocptr */ \
+ VALGRIND_RESTORE_STACK \
+ : /*out*/ "=r" (_res) \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
arg7,arg8,arg9,arg10) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[11]; \
+ volatile unsigned long _argvec[3+10]; \
volatile unsigned long _res; \
- _argvec[0] = (unsigned long)_orig.nraddr; \
- _argvec[1] = (unsigned long)arg1; \
- _argvec[2] = (unsigned long)arg2; \
- _argvec[3] = (unsigned long)arg3; \
- _argvec[4] = (unsigned long)arg4; \
- _argvec[5] = (unsigned long)arg5; \
- _argvec[6] = (unsigned long)arg6; \
- _argvec[7] = (unsigned long)arg7; \
- _argvec[8] = (unsigned long)arg8; \
- _argvec[9] = (unsigned long)arg9; \
- _argvec[10] = (unsigned long)arg10; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[2+4] = (unsigned long)arg4; \
+ _argvec[2+5] = (unsigned long)arg5; \
+ _argvec[2+6] = (unsigned long)arg6; \
+ _argvec[2+7] = (unsigned long)arg7; \
+ _argvec[2+8] = (unsigned long)arg8; \
+ _argvec[2+9] = (unsigned long)arg9; \
+ _argvec[2+10] = (unsigned long)arg10; \
__asm__ volatile( \
+ VALGRIND_ALIGN_STACK \
"mr 11,%1\n\t" \
- "addi 1,1,-16\n\t" \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "addi 1,1,-128\n\t" /* expand stack frame */ \
/* arg10 */ \
- "lwz 3,40(11)\n\t" \
- "stw 3,12(1)\n\t" \
+ "ld 3,80(11)\n\t" \
+ "std 3,120(1)\n\t" \
/* arg9 */ \
- "lwz 3,36(11)\n\t" \
- "stw 3,8(1)\n\t" \
+ "ld 3,72(11)\n\t" \
+ "std 3,112(1)\n\t" \
/* args1-8 */ \
- "lwz 3,4(11)\n\t" /* arg1->r3 */ \
- "lwz 4,8(11)\n\t" \
- "lwz 5,12(11)\n\t" \
- "lwz 6,16(11)\n\t" /* arg4->r6 */ \
- "lwz 7,20(11)\n\t" \
- "lwz 8,24(11)\n\t" \
- "lwz 9,28(11)\n\t" \
- "lwz 10,32(11)\n\t" /* arg8->r10 */ \
- "lwz 11,0(11)\n\t" /* target->r11 */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 4, 16(11)\n\t" /* arg2->r4 */ \
+ "ld 5, 24(11)\n\t" /* arg3->r5 */ \
+ "ld 6, 32(11)\n\t" /* arg4->r6 */ \
+ "ld 7, 40(11)\n\t" /* arg5->r7 */ \
+ "ld 8, 48(11)\n\t" /* arg6->r8 */ \
+ "ld 9, 56(11)\n\t" /* arg7->r9 */ \
+ "ld 10, 64(11)\n\t" /* arg8->r10 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "addi 1,1,16\n\t" \
- "mr %0,3" \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)\n\t" /* restore tocptr */ \
+ VALGRIND_RESTORE_STACK \
: /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
arg7,arg8,arg9,arg10,arg11) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[12]; \
+ volatile unsigned long _argvec[3+11]; \
volatile unsigned long _res; \
- _argvec[0] = (unsigned long)_orig.nraddr; \
- _argvec[1] = (unsigned long)arg1; \
- _argvec[2] = (unsigned long)arg2; \
- _argvec[3] = (unsigned long)arg3; \
- _argvec[4] = (unsigned long)arg4; \
- _argvec[5] = (unsigned long)arg5; \
- _argvec[6] = (unsigned long)arg6; \
- _argvec[7] = (unsigned long)arg7; \
- _argvec[8] = (unsigned long)arg8; \
- _argvec[9] = (unsigned long)arg9; \
- _argvec[10] = (unsigned long)arg10; \
- _argvec[11] = (unsigned long)arg11; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[2+4] = (unsigned long)arg4; \
+ _argvec[2+5] = (unsigned long)arg5; \
+ _argvec[2+6] = (unsigned long)arg6; \
+ _argvec[2+7] = (unsigned long)arg7; \
+ _argvec[2+8] = (unsigned long)arg8; \
+ _argvec[2+9] = (unsigned long)arg9; \
+ _argvec[2+10] = (unsigned long)arg10; \
+ _argvec[2+11] = (unsigned long)arg11; \
__asm__ volatile( \
+ VALGRIND_ALIGN_STACK \
"mr 11,%1\n\t" \
- "addi 1,1,-32\n\t" \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "addi 1,1,-144\n\t" /* expand stack frame */ \
/* arg11 */ \
- "lwz 3,44(11)\n\t" \
- "stw 3,16(1)\n\t" \
+ "ld 3,88(11)\n\t" \
+ "std 3,128(1)\n\t" \
/* arg10 */ \
- "lwz 3,40(11)\n\t" \
- "stw 3,12(1)\n\t" \
+ "ld 3,80(11)\n\t" \
+ "std 3,120(1)\n\t" \
/* arg9 */ \
- "lwz 3,36(11)\n\t" \
- "stw 3,8(1)\n\t" \
+ "ld 3,72(11)\n\t" \
+ "std 3,112(1)\n\t" \
/* args1-8 */ \
- "lwz 3,4(11)\n\t" /* arg1->r3 */ \
- "lwz 4,8(11)\n\t" \
- "lwz 5,12(11)\n\t" \
- "lwz 6,16(11)\n\t" /* arg4->r6 */ \
- "lwz 7,20(11)\n\t" \
- "lwz 8,24(11)\n\t" \
- "lwz 9,28(11)\n\t" \
- "lwz 10,32(11)\n\t" /* arg8->r10 */ \
- "lwz 11,0(11)\n\t" /* target->r11 */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 4, 16(11)\n\t" /* arg2->r4 */ \
+ "ld 5, 24(11)\n\t" /* arg3->r5 */ \
+ "ld 6, 32(11)\n\t" /* arg4->r6 */ \
+ "ld 7, 40(11)\n\t" /* arg5->r7 */ \
+ "ld 8, 48(11)\n\t" /* arg6->r8 */ \
+ "ld 9, 56(11)\n\t" /* arg7->r9 */ \
+ "ld 10, 64(11)\n\t" /* arg8->r10 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "addi 1,1,32\n\t" \
- "mr %0,3" \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)\n\t" /* restore tocptr */ \
+ VALGRIND_RESTORE_STACK \
: /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
arg7,arg8,arg9,arg10,arg11,arg12) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[13]; \
+ volatile unsigned long _argvec[3+12]; \
volatile unsigned long _res; \
- _argvec[0] = (unsigned long)_orig.nraddr; \
- _argvec[1] = (unsigned long)arg1; \
- _argvec[2] = (unsigned long)arg2; \
- _argvec[3] = (unsigned long)arg3; \
- _argvec[4] = (unsigned long)arg4; \
- _argvec[5] = (unsigned long)arg5; \
- _argvec[6] = (unsigned long)arg6; \
- _argvec[7] = (unsigned long)arg7; \
- _argvec[8] = (unsigned long)arg8; \
- _argvec[9] = (unsigned long)arg9; \
- _argvec[10] = (unsigned long)arg10; \
- _argvec[11] = (unsigned long)arg11; \
- _argvec[12] = (unsigned long)arg12; \
+ /* _argvec[0] holds current r2 across the call */ \
+ _argvec[1] = (unsigned long)_orig.r2; \
+ _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[2+4] = (unsigned long)arg4; \
+ _argvec[2+5] = (unsigned long)arg5; \
+ _argvec[2+6] = (unsigned long)arg6; \
+ _argvec[2+7] = (unsigned long)arg7; \
+ _argvec[2+8] = (unsigned long)arg8; \
+ _argvec[2+9] = (unsigned long)arg9; \
+ _argvec[2+10] = (unsigned long)arg10; \
+ _argvec[2+11] = (unsigned long)arg11; \
+ _argvec[2+12] = (unsigned long)arg12; \
__asm__ volatile( \
+ VALGRIND_ALIGN_STACK \
"mr 11,%1\n\t" \
- "addi 1,1,-32\n\t" \
+ "std 2,-16(11)\n\t" /* save tocptr */ \
+ "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
+ "addi 1,1,-144\n\t" /* expand stack frame */ \
/* arg12 */ \
- "lwz 3,48(11)\n\t" \
- "stw 3,20(1)\n\t" \
+ "ld 3,96(11)\n\t" \
+ "std 3,136(1)\n\t" \
/* arg11 */ \
- "lwz 3,44(11)\n\t" \
- "stw 3,16(1)\n\t" \
+ "ld 3,88(11)\n\t" \
+ "std 3,128(1)\n\t" \
/* arg10 */ \
- "lwz 3,40(11)\n\t" \
- "stw 3,12(1)\n\t" \
+ "ld 3,80(11)\n\t" \
+ "std 3,120(1)\n\t" \
/* arg9 */ \
- "lwz 3,36(11)\n\t" \
- "stw 3,8(1)\n\t" \
+ "ld 3,72(11)\n\t" \
+ "std 3,112(1)\n\t" \
/* args1-8 */ \
- "lwz 3,4(11)\n\t" /* arg1->r3 */ \
- "lwz 4,8(11)\n\t" \
- "lwz 5,12(11)\n\t" \
- "lwz 6,16(11)\n\t" /* arg4->r6 */ \
- "lwz 7,20(11)\n\t" \
- "lwz 8,24(11)\n\t" \
- "lwz 9,28(11)\n\t" \
- "lwz 10,32(11)\n\t" /* arg8->r10 */ \
- "lwz 11,0(11)\n\t" /* target->r11 */ \
+ "ld 3, 8(11)\n\t" /* arg1->r3 */ \
+ "ld 4, 16(11)\n\t" /* arg2->r4 */ \
+ "ld 5, 24(11)\n\t" /* arg3->r5 */ \
+ "ld 6, 32(11)\n\t" /* arg4->r6 */ \
+ "ld 7, 40(11)\n\t" /* arg5->r7 */ \
+ "ld 8, 48(11)\n\t" /* arg6->r8 */ \
+ "ld 9, 56(11)\n\t" /* arg7->r9 */ \
+ "ld 10, 64(11)\n\t" /* arg8->r10 */ \
+ "ld 11, 0(11)\n\t" /* target->r11 */ \
VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "addi 1,1,32\n\t" \
- "mr %0,3" \
+ "mr 11,%1\n\t" \
+ "mr %0,3\n\t" \
+ "ld 2,-16(11)\n\t" /* restore tocptr */ \
+ VALGRIND_RESTORE_STACK \
: /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[0]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*in*/ "r" (&_argvec[2]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
-#endif /* PLAT_ppc32_linux */
-
-/* ------------------------ ppc64-linux ------------------------ */
+#endif /* PLAT_ppc64_linux */
-#if defined(PLAT_ppc64_linux)
+/* ------------------------- arm-linux ------------------------- */
-/* ARGREGS: r3 r4 r5 r6 r7 r8 r9 r10 (the rest on stack somewhere) */
+#if defined(PLAT_arm_linux)
/* These regs are trashed by the hidden call. */
-#define __CALLER_SAVED_REGS \
- "lr", "ctr", "xer", \
- "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", \
- "r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", \
- "r11", "r12", "r13"
-
-/* These CALL_FN_ macros assume that on ppc64-linux, sizeof(unsigned
- long) == 8. */
+#define __CALLER_SAVED_REGS "r0", "r1", "r2", "r3","r4","r14"
+
+/* Macros to save and align the stack before making a function
+ call and restore it afterwards as gcc may not keep the stack
+ pointer aligned if it doesn't realise calls are being made
+ to other functions. */
+
+/* This is a bit tricky. We store the original stack pointer in r10
+ as it is callee-saves. gcc doesn't allow the use of r11 for some
+ reason. Also, we can't directly "bic" the stack pointer in thumb
+ mode since r13 isn't an allowed register number in that context.
+ So use r4 as a temporary, since that is about to get trashed
+ anyway, just after each use of this macro. Side effect is we need
+ to be very careful about any future changes, since
+ VALGRIND_ALIGN_STACK simply assumes r4 is usable. */
+#define VALGRIND_ALIGN_STACK \
+ "mov r10, sp\n\t" \
+ "mov r4, sp\n\t" \
+ "bic r4, r4, #7\n\t" \
+ "mov sp, r4\n\t"
+#define VALGRIND_RESTORE_STACK \
+ "mov sp, r10\n\t"
+
+/* These CALL_FN_ macros assume that on arm-linux, sizeof(unsigned
+ long) == 4. */
#define CALL_FN_W_v(lval, orig) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+0]; \
+ volatile unsigned long _argvec[1]; \
volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
__asm__ volatile( \
- "mr 11,%1\n\t" \
- "std 2,-16(11)\n\t" /* save tocptr */ \
- "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
- "ld 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "ld 2,-16(11)" /* restore tocptr */ \
+ VALGRIND_ALIGN_STACK \
+ "ldr r4, [%1] \n\t" /* target->r4 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
+ VALGRIND_RESTORE_STACK \
+ "mov %0, r0\n" \
: /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*in*/ "0" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r10" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
#define CALL_FN_W_W(lval, orig, arg1) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+1]; \
+ volatile unsigned long _argvec[2]; \
volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
- _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
__asm__ volatile( \
- "mr 11,%1\n\t" \
- "std 2,-16(11)\n\t" /* save tocptr */ \
- "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
- "ld 3, 8(11)\n\t" /* arg1->r3 */ \
- "ld 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "ld 2,-16(11)" /* restore tocptr */ \
+ VALGRIND_ALIGN_STACK \
+ "ldr r0, [%1, #4] \n\t" \
+ "ldr r4, [%1] \n\t" /* target->r4 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
+ VALGRIND_RESTORE_STACK \
+ "mov %0, r0\n" \
: /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*in*/ "0" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r10" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
#define CALL_FN_W_WW(lval, orig, arg1,arg2) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+2]; \
+ volatile unsigned long _argvec[3]; \
volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
- _argvec[2+1] = (unsigned long)arg1; \
- _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
__asm__ volatile( \
- "mr 11,%1\n\t" \
- "std 2,-16(11)\n\t" /* save tocptr */ \
- "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
- "ld 3, 8(11)\n\t" /* arg1->r3 */ \
- "ld 4, 16(11)\n\t" /* arg2->r4 */ \
- "ld 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "ld 2,-16(11)" /* restore tocptr */ \
+ VALGRIND_ALIGN_STACK \
+ "ldr r0, [%1, #4] \n\t" \
+ "ldr r1, [%1, #8] \n\t" \
+ "ldr r4, [%1] \n\t" /* target->r4 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
+ VALGRIND_RESTORE_STACK \
+ "mov %0, r0\n" \
: /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*in*/ "0" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r10" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+3]; \
+ volatile unsigned long _argvec[4]; \
volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
- _argvec[2+1] = (unsigned long)arg1; \
- _argvec[2+2] = (unsigned long)arg2; \
- _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
__asm__ volatile( \
- "mr 11,%1\n\t" \
- "std 2,-16(11)\n\t" /* save tocptr */ \
- "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
- "ld 3, 8(11)\n\t" /* arg1->r3 */ \
- "ld 4, 16(11)\n\t" /* arg2->r4 */ \
- "ld 5, 24(11)\n\t" /* arg3->r5 */ \
- "ld 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "ld 2,-16(11)" /* restore tocptr */ \
+ VALGRIND_ALIGN_STACK \
+ "ldr r0, [%1, #4] \n\t" \
+ "ldr r1, [%1, #8] \n\t" \
+ "ldr r2, [%1, #12] \n\t" \
+ "ldr r4, [%1] \n\t" /* target->r4 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
+ VALGRIND_RESTORE_STACK \
+ "mov %0, r0\n" \
: /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*in*/ "0" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r10" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+4]; \
+ volatile unsigned long _argvec[5]; \
volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
- _argvec[2+1] = (unsigned long)arg1; \
- _argvec[2+2] = (unsigned long)arg2; \
- _argvec[2+3] = (unsigned long)arg3; \
- _argvec[2+4] = (unsigned long)arg4; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
__asm__ volatile( \
- "mr 11,%1\n\t" \
- "std 2,-16(11)\n\t" /* save tocptr */ \
- "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
- "ld 3, 8(11)\n\t" /* arg1->r3 */ \
- "ld 4, 16(11)\n\t" /* arg2->r4 */ \
- "ld 5, 24(11)\n\t" /* arg3->r5 */ \
- "ld 6, 32(11)\n\t" /* arg4->r6 */ \
- "ld 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "ld 2,-16(11)" /* restore tocptr */ \
+ VALGRIND_ALIGN_STACK \
+ "ldr r0, [%1, #4] \n\t" \
+ "ldr r1, [%1, #8] \n\t" \
+ "ldr r2, [%1, #12] \n\t" \
+ "ldr r3, [%1, #16] \n\t" \
+ "ldr r4, [%1] \n\t" /* target->r4 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
+ VALGRIND_RESTORE_STACK \
+ "mov %0, r0" \
: /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*in*/ "0" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r10" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+5]; \
+ volatile unsigned long _argvec[6]; \
volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
- _argvec[2+1] = (unsigned long)arg1; \
- _argvec[2+2] = (unsigned long)arg2; \
- _argvec[2+3] = (unsigned long)arg3; \
- _argvec[2+4] = (unsigned long)arg4; \
- _argvec[2+5] = (unsigned long)arg5; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
__asm__ volatile( \
- "mr 11,%1\n\t" \
- "std 2,-16(11)\n\t" /* save tocptr */ \
- "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
- "ld 3, 8(11)\n\t" /* arg1->r3 */ \
- "ld 4, 16(11)\n\t" /* arg2->r4 */ \
- "ld 5, 24(11)\n\t" /* arg3->r5 */ \
- "ld 6, 32(11)\n\t" /* arg4->r6 */ \
- "ld 7, 40(11)\n\t" /* arg5->r7 */ \
- "ld 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "ld 2,-16(11)" /* restore tocptr */ \
+ VALGRIND_ALIGN_STACK \
+ "sub sp, sp, #4 \n\t" \
+ "ldr r0, [%1, #20] \n\t" \
+ "push {r0} \n\t" \
+ "ldr r0, [%1, #4] \n\t" \
+ "ldr r1, [%1, #8] \n\t" \
+ "ldr r2, [%1, #12] \n\t" \
+ "ldr r3, [%1, #16] \n\t" \
+ "ldr r4, [%1] \n\t" /* target->r4 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
+ VALGRIND_RESTORE_STACK \
+ "mov %0, r0" \
: /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*in*/ "0" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r10" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+6]; \
+ volatile unsigned long _argvec[7]; \
volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
- _argvec[2+1] = (unsigned long)arg1; \
- _argvec[2+2] = (unsigned long)arg2; \
- _argvec[2+3] = (unsigned long)arg3; \
- _argvec[2+4] = (unsigned long)arg4; \
- _argvec[2+5] = (unsigned long)arg5; \
- _argvec[2+6] = (unsigned long)arg6; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ _argvec[6] = (unsigned long)(arg6); \
__asm__ volatile( \
- "mr 11,%1\n\t" \
- "std 2,-16(11)\n\t" /* save tocptr */ \
- "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
- "ld 3, 8(11)\n\t" /* arg1->r3 */ \
- "ld 4, 16(11)\n\t" /* arg2->r4 */ \
- "ld 5, 24(11)\n\t" /* arg3->r5 */ \
- "ld 6, 32(11)\n\t" /* arg4->r6 */ \
- "ld 7, 40(11)\n\t" /* arg5->r7 */ \
- "ld 8, 48(11)\n\t" /* arg6->r8 */ \
- "ld 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "ld 2,-16(11)" /* restore tocptr */ \
+ VALGRIND_ALIGN_STACK \
+ "ldr r0, [%1, #20] \n\t" \
+ "ldr r1, [%1, #24] \n\t" \
+ "push {r0, r1} \n\t" \
+ "ldr r0, [%1, #4] \n\t" \
+ "ldr r1, [%1, #8] \n\t" \
+ "ldr r2, [%1, #12] \n\t" \
+ "ldr r3, [%1, #16] \n\t" \
+ "ldr r4, [%1] \n\t" /* target->r4 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
+ VALGRIND_RESTORE_STACK \
+ "mov %0, r0" \
: /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*in*/ "0" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r10" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
arg7) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+7]; \
+ volatile unsigned long _argvec[8]; \
volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
- _argvec[2+1] = (unsigned long)arg1; \
- _argvec[2+2] = (unsigned long)arg2; \
- _argvec[2+3] = (unsigned long)arg3; \
- _argvec[2+4] = (unsigned long)arg4; \
- _argvec[2+5] = (unsigned long)arg5; \
- _argvec[2+6] = (unsigned long)arg6; \
- _argvec[2+7] = (unsigned long)arg7; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ _argvec[6] = (unsigned long)(arg6); \
+ _argvec[7] = (unsigned long)(arg7); \
__asm__ volatile( \
- "mr 11,%1\n\t" \
- "std 2,-16(11)\n\t" /* save tocptr */ \
- "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
- "ld 3, 8(11)\n\t" /* arg1->r3 */ \
- "ld 4, 16(11)\n\t" /* arg2->r4 */ \
- "ld 5, 24(11)\n\t" /* arg3->r5 */ \
- "ld 6, 32(11)\n\t" /* arg4->r6 */ \
- "ld 7, 40(11)\n\t" /* arg5->r7 */ \
- "ld 8, 48(11)\n\t" /* arg6->r8 */ \
- "ld 9, 56(11)\n\t" /* arg7->r9 */ \
- "ld 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "ld 2,-16(11)" /* restore tocptr */ \
+ VALGRIND_ALIGN_STACK \
+ "sub sp, sp, #4 \n\t" \
+ "ldr r0, [%1, #20] \n\t" \
+ "ldr r1, [%1, #24] \n\t" \
+ "ldr r2, [%1, #28] \n\t" \
+ "push {r0, r1, r2} \n\t" \
+ "ldr r0, [%1, #4] \n\t" \
+ "ldr r1, [%1, #8] \n\t" \
+ "ldr r2, [%1, #12] \n\t" \
+ "ldr r3, [%1, #16] \n\t" \
+ "ldr r4, [%1] \n\t" /* target->r4 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
+ VALGRIND_RESTORE_STACK \
+ "mov %0, r0" \
: /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*in*/ "0" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r10" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
arg7,arg8) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+8]; \
+ volatile unsigned long _argvec[9]; \
volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
- _argvec[2+1] = (unsigned long)arg1; \
- _argvec[2+2] = (unsigned long)arg2; \
- _argvec[2+3] = (unsigned long)arg3; \
- _argvec[2+4] = (unsigned long)arg4; \
- _argvec[2+5] = (unsigned long)arg5; \
- _argvec[2+6] = (unsigned long)arg6; \
- _argvec[2+7] = (unsigned long)arg7; \
- _argvec[2+8] = (unsigned long)arg8; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ _argvec[6] = (unsigned long)(arg6); \
+ _argvec[7] = (unsigned long)(arg7); \
+ _argvec[8] = (unsigned long)(arg8); \
__asm__ volatile( \
- "mr 11,%1\n\t" \
- "std 2,-16(11)\n\t" /* save tocptr */ \
- "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
- "ld 3, 8(11)\n\t" /* arg1->r3 */ \
- "ld 4, 16(11)\n\t" /* arg2->r4 */ \
- "ld 5, 24(11)\n\t" /* arg3->r5 */ \
- "ld 6, 32(11)\n\t" /* arg4->r6 */ \
- "ld 7, 40(11)\n\t" /* arg5->r7 */ \
- "ld 8, 48(11)\n\t" /* arg6->r8 */ \
- "ld 9, 56(11)\n\t" /* arg7->r9 */ \
- "ld 10, 64(11)\n\t" /* arg8->r10 */ \
- "ld 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "ld 2,-16(11)" /* restore tocptr */ \
+ VALGRIND_ALIGN_STACK \
+ "ldr r0, [%1, #20] \n\t" \
+ "ldr r1, [%1, #24] \n\t" \
+ "ldr r2, [%1, #28] \n\t" \
+ "ldr r3, [%1, #32] \n\t" \
+ "push {r0, r1, r2, r3} \n\t" \
+ "ldr r0, [%1, #4] \n\t" \
+ "ldr r1, [%1, #8] \n\t" \
+ "ldr r2, [%1, #12] \n\t" \
+ "ldr r3, [%1, #16] \n\t" \
+ "ldr r4, [%1] \n\t" /* target->r4 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
+ VALGRIND_RESTORE_STACK \
+ "mov %0, r0" \
: /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*in*/ "0" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r10" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
arg7,arg8,arg9) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+9]; \
+ volatile unsigned long _argvec[10]; \
volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
- _argvec[2+1] = (unsigned long)arg1; \
- _argvec[2+2] = (unsigned long)arg2; \
- _argvec[2+3] = (unsigned long)arg3; \
- _argvec[2+4] = (unsigned long)arg4; \
- _argvec[2+5] = (unsigned long)arg5; \
- _argvec[2+6] = (unsigned long)arg6; \
- _argvec[2+7] = (unsigned long)arg7; \
- _argvec[2+8] = (unsigned long)arg8; \
- _argvec[2+9] = (unsigned long)arg9; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ _argvec[6] = (unsigned long)(arg6); \
+ _argvec[7] = (unsigned long)(arg7); \
+ _argvec[8] = (unsigned long)(arg8); \
+ _argvec[9] = (unsigned long)(arg9); \
__asm__ volatile( \
- "mr 11,%1\n\t" \
- "std 2,-16(11)\n\t" /* save tocptr */ \
- "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
- "addi 1,1,-128\n\t" /* expand stack frame */ \
- /* arg9 */ \
- "ld 3,72(11)\n\t" \
- "std 3,112(1)\n\t" \
- /* args1-8 */ \
- "ld 3, 8(11)\n\t" /* arg1->r3 */ \
- "ld 4, 16(11)\n\t" /* arg2->r4 */ \
- "ld 5, 24(11)\n\t" /* arg3->r5 */ \
- "ld 6, 32(11)\n\t" /* arg4->r6 */ \
- "ld 7, 40(11)\n\t" /* arg5->r7 */ \
- "ld 8, 48(11)\n\t" /* arg6->r8 */ \
- "ld 9, 56(11)\n\t" /* arg7->r9 */ \
- "ld 10, 64(11)\n\t" /* arg8->r10 */ \
- "ld 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "ld 2,-16(11)\n\t" /* restore tocptr */ \
- "addi 1,1,128" /* restore frame */ \
+ VALGRIND_ALIGN_STACK \
+ "sub sp, sp, #4 \n\t" \
+ "ldr r0, [%1, #20] \n\t" \
+ "ldr r1, [%1, #24] \n\t" \
+ "ldr r2, [%1, #28] \n\t" \
+ "ldr r3, [%1, #32] \n\t" \
+ "ldr r4, [%1, #36] \n\t" \
+ "push {r0, r1, r2, r3, r4} \n\t" \
+ "ldr r0, [%1, #4] \n\t" \
+ "ldr r1, [%1, #8] \n\t" \
+ "ldr r2, [%1, #12] \n\t" \
+ "ldr r3, [%1, #16] \n\t" \
+ "ldr r4, [%1] \n\t" /* target->r4 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
+ VALGRIND_RESTORE_STACK \
+ "mov %0, r0" \
: /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*in*/ "0" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r10" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
arg7,arg8,arg9,arg10) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+10]; \
+ volatile unsigned long _argvec[11]; \
volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
- _argvec[2+1] = (unsigned long)arg1; \
- _argvec[2+2] = (unsigned long)arg2; \
- _argvec[2+3] = (unsigned long)arg3; \
- _argvec[2+4] = (unsigned long)arg4; \
- _argvec[2+5] = (unsigned long)arg5; \
- _argvec[2+6] = (unsigned long)arg6; \
- _argvec[2+7] = (unsigned long)arg7; \
- _argvec[2+8] = (unsigned long)arg8; \
- _argvec[2+9] = (unsigned long)arg9; \
- _argvec[2+10] = (unsigned long)arg10; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ _argvec[6] = (unsigned long)(arg6); \
+ _argvec[7] = (unsigned long)(arg7); \
+ _argvec[8] = (unsigned long)(arg8); \
+ _argvec[9] = (unsigned long)(arg9); \
+ _argvec[10] = (unsigned long)(arg10); \
__asm__ volatile( \
- "mr 11,%1\n\t" \
- "std 2,-16(11)\n\t" /* save tocptr */ \
- "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
- "addi 1,1,-128\n\t" /* expand stack frame */ \
- /* arg10 */ \
- "ld 3,80(11)\n\t" \
- "std 3,120(1)\n\t" \
- /* arg9 */ \
- "ld 3,72(11)\n\t" \
- "std 3,112(1)\n\t" \
- /* args1-8 */ \
- "ld 3, 8(11)\n\t" /* arg1->r3 */ \
- "ld 4, 16(11)\n\t" /* arg2->r4 */ \
- "ld 5, 24(11)\n\t" /* arg3->r5 */ \
- "ld 6, 32(11)\n\t" /* arg4->r6 */ \
- "ld 7, 40(11)\n\t" /* arg5->r7 */ \
- "ld 8, 48(11)\n\t" /* arg6->r8 */ \
- "ld 9, 56(11)\n\t" /* arg7->r9 */ \
- "ld 10, 64(11)\n\t" /* arg8->r10 */ \
- "ld 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "ld 2,-16(11)\n\t" /* restore tocptr */ \
- "addi 1,1,128" /* restore frame */ \
+ VALGRIND_ALIGN_STACK \
+ "ldr r0, [%1, #40] \n\t" \
+ "push {r0} \n\t" \
+ "ldr r0, [%1, #20] \n\t" \
+ "ldr r1, [%1, #24] \n\t" \
+ "ldr r2, [%1, #28] \n\t" \
+ "ldr r3, [%1, #32] \n\t" \
+ "ldr r4, [%1, #36] \n\t" \
+ "push {r0, r1, r2, r3, r4} \n\t" \
+ "ldr r0, [%1, #4] \n\t" \
+ "ldr r1, [%1, #8] \n\t" \
+ "ldr r2, [%1, #12] \n\t" \
+ "ldr r3, [%1, #16] \n\t" \
+ "ldr r4, [%1] \n\t" /* target->r4 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
+ VALGRIND_RESTORE_STACK \
+ "mov %0, r0" \
: /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*in*/ "0" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r10" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
-#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
- arg7,arg8,arg9,arg10,arg11) \
+#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5, \
+ arg6,arg7,arg8,arg9,arg10, \
+ arg11) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+11]; \
+ volatile unsigned long _argvec[12]; \
volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
- _argvec[2+1] = (unsigned long)arg1; \
- _argvec[2+2] = (unsigned long)arg2; \
- _argvec[2+3] = (unsigned long)arg3; \
- _argvec[2+4] = (unsigned long)arg4; \
- _argvec[2+5] = (unsigned long)arg5; \
- _argvec[2+6] = (unsigned long)arg6; \
- _argvec[2+7] = (unsigned long)arg7; \
- _argvec[2+8] = (unsigned long)arg8; \
- _argvec[2+9] = (unsigned long)arg9; \
- _argvec[2+10] = (unsigned long)arg10; \
- _argvec[2+11] = (unsigned long)arg11; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ _argvec[6] = (unsigned long)(arg6); \
+ _argvec[7] = (unsigned long)(arg7); \
+ _argvec[8] = (unsigned long)(arg8); \
+ _argvec[9] = (unsigned long)(arg9); \
+ _argvec[10] = (unsigned long)(arg10); \
+ _argvec[11] = (unsigned long)(arg11); \
__asm__ volatile( \
- "mr 11,%1\n\t" \
- "std 2,-16(11)\n\t" /* save tocptr */ \
- "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
- "addi 1,1,-144\n\t" /* expand stack frame */ \
- /* arg11 */ \
- "ld 3,88(11)\n\t" \
- "std 3,128(1)\n\t" \
- /* arg10 */ \
- "ld 3,80(11)\n\t" \
- "std 3,120(1)\n\t" \
- /* arg9 */ \
- "ld 3,72(11)\n\t" \
- "std 3,112(1)\n\t" \
- /* args1-8 */ \
- "ld 3, 8(11)\n\t" /* arg1->r3 */ \
- "ld 4, 16(11)\n\t" /* arg2->r4 */ \
- "ld 5, 24(11)\n\t" /* arg3->r5 */ \
- "ld 6, 32(11)\n\t" /* arg4->r6 */ \
- "ld 7, 40(11)\n\t" /* arg5->r7 */ \
- "ld 8, 48(11)\n\t" /* arg6->r8 */ \
- "ld 9, 56(11)\n\t" /* arg7->r9 */ \
- "ld 10, 64(11)\n\t" /* arg8->r10 */ \
- "ld 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "ld 2,-16(11)\n\t" /* restore tocptr */ \
- "addi 1,1,144" /* restore frame */ \
+ VALGRIND_ALIGN_STACK \
+ "sub sp, sp, #4 \n\t" \
+ "ldr r0, [%1, #40] \n\t" \
+ "ldr r1, [%1, #44] \n\t" \
+ "push {r0, r1} \n\t" \
+ "ldr r0, [%1, #20] \n\t" \
+ "ldr r1, [%1, #24] \n\t" \
+ "ldr r2, [%1, #28] \n\t" \
+ "ldr r3, [%1, #32] \n\t" \
+ "ldr r4, [%1, #36] \n\t" \
+ "push {r0, r1, r2, r3, r4} \n\t" \
+ "ldr r0, [%1, #4] \n\t" \
+ "ldr r1, [%1, #8] \n\t" \
+ "ldr r2, [%1, #12] \n\t" \
+ "ldr r3, [%1, #16] \n\t" \
+ "ldr r4, [%1] \n\t" /* target->r4 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
+ VALGRIND_RESTORE_STACK \
+ "mov %0, r0" \
: /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*in*/ "0" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r10" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
-#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
- arg7,arg8,arg9,arg10,arg11,arg12) \
+#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5, \
+ arg6,arg7,arg8,arg9,arg10, \
+ arg11,arg12) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+12]; \
+ volatile unsigned long _argvec[13]; \
volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
- _argvec[2+1] = (unsigned long)arg1; \
- _argvec[2+2] = (unsigned long)arg2; \
- _argvec[2+3] = (unsigned long)arg3; \
- _argvec[2+4] = (unsigned long)arg4; \
- _argvec[2+5] = (unsigned long)arg5; \
- _argvec[2+6] = (unsigned long)arg6; \
- _argvec[2+7] = (unsigned long)arg7; \
- _argvec[2+8] = (unsigned long)arg8; \
- _argvec[2+9] = (unsigned long)arg9; \
- _argvec[2+10] = (unsigned long)arg10; \
- _argvec[2+11] = (unsigned long)arg11; \
- _argvec[2+12] = (unsigned long)arg12; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ _argvec[6] = (unsigned long)(arg6); \
+ _argvec[7] = (unsigned long)(arg7); \
+ _argvec[8] = (unsigned long)(arg8); \
+ _argvec[9] = (unsigned long)(arg9); \
+ _argvec[10] = (unsigned long)(arg10); \
+ _argvec[11] = (unsigned long)(arg11); \
+ _argvec[12] = (unsigned long)(arg12); \
__asm__ volatile( \
- "mr 11,%1\n\t" \
- "std 2,-16(11)\n\t" /* save tocptr */ \
- "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
- "addi 1,1,-144\n\t" /* expand stack frame */ \
- /* arg12 */ \
- "ld 3,96(11)\n\t" \
- "std 3,136(1)\n\t" \
- /* arg11 */ \
- "ld 3,88(11)\n\t" \
- "std 3,128(1)\n\t" \
- /* arg10 */ \
- "ld 3,80(11)\n\t" \
- "std 3,120(1)\n\t" \
- /* arg9 */ \
- "ld 3,72(11)\n\t" \
- "std 3,112(1)\n\t" \
- /* args1-8 */ \
- "ld 3, 8(11)\n\t" /* arg1->r3 */ \
- "ld 4, 16(11)\n\t" /* arg2->r4 */ \
- "ld 5, 24(11)\n\t" /* arg3->r5 */ \
- "ld 6, 32(11)\n\t" /* arg4->r6 */ \
- "ld 7, 40(11)\n\t" /* arg5->r7 */ \
- "ld 8, 48(11)\n\t" /* arg6->r8 */ \
- "ld 9, 56(11)\n\t" /* arg7->r9 */ \
- "ld 10, 64(11)\n\t" /* arg8->r10 */ \
- "ld 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "ld 2,-16(11)\n\t" /* restore tocptr */ \
- "addi 1,1,144" /* restore frame */ \
+ VALGRIND_ALIGN_STACK \
+ "ldr r0, [%1, #40] \n\t" \
+ "ldr r1, [%1, #44] \n\t" \
+ "ldr r2, [%1, #48] \n\t" \
+ "push {r0, r1, r2} \n\t" \
+ "ldr r0, [%1, #20] \n\t" \
+ "ldr r1, [%1, #24] \n\t" \
+ "ldr r2, [%1, #28] \n\t" \
+ "ldr r3, [%1, #32] \n\t" \
+ "ldr r4, [%1, #36] \n\t" \
+ "push {r0, r1, r2, r3, r4} \n\t" \
+ "ldr r0, [%1, #4] \n\t" \
+ "ldr r1, [%1, #8] \n\t" \
+ "ldr r2, [%1, #12] \n\t" \
+ "ldr r3, [%1, #16] \n\t" \
+ "ldr r4, [%1] \n\t" /* target->r4 */ \
+ VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
+ VALGRIND_RESTORE_STACK \
+ "mov %0, r0" \
: /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*in*/ "0" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r10" \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
-#endif /* PLAT_ppc64_linux */
+#endif /* PLAT_arm_linux */
+
+/* ------------------------- s390x-linux ------------------------- */
+
+#if defined(PLAT_s390x_linux)
+
+/* Similar workaround as amd64 (see above), but we use r11 as frame
+ pointer and save the old r11 in r7. r11 might be used for
+ argvec, therefore we copy argvec in r1 since r1 is clobbered
+ after the call anyway. */
+#if defined(__GNUC__) && defined(__GCC_HAVE_DWARF2_CFI_ASM)
+# define __FRAME_POINTER \
+ ,"d"(__builtin_dwarf_cfa())
+# define VALGRIND_CFI_PROLOGUE \
+ ".cfi_remember_state\n\t" \
+ "lgr 1,%1\n\t" /* copy the argvec pointer in r1 */ \
+ "lgr 7,11\n\t" \
+ "lgr 11,%2\n\t" \
+ ".cfi_def_cfa r11, 0\n\t"
+# define VALGRIND_CFI_EPILOGUE \
+ "lgr 11, 7\n\t" \
+ ".cfi_restore_state\n\t"
+#else
+# define __FRAME_POINTER
+# define VALGRIND_CFI_PROLOGUE \
+ "lgr 1,%1\n\t"
+# define VALGRIND_CFI_EPILOGUE
+#endif
-/* ------------------------ ppc32-aix5 ------------------------- */
+/* Nb: On s390 the stack pointer is properly aligned *at all times*
+ according to the s390 GCC maintainer. (The ABI specification is not
+ precise in this regard.) Therefore, VALGRIND_ALIGN_STACK and
+ VALGRIND_RESTORE_STACK are not defined here. */
+
+/* These regs are trashed by the hidden call. Note that we overwrite
+ r14 in s390_irgen_noredir (VEX/priv/guest_s390_irgen.c) to give the
+ function a proper return address. All others are ABI defined call
+ clobbers. */
+#define __CALLER_SAVED_REGS "0","1","2","3","4","5","14", \
+ "f0","f1","f2","f3","f4","f5","f6","f7"
+
+/* Nb: Although r11 is modified in the asm snippets below (inside
+ VALGRIND_CFI_PROLOGUE) it is not listed in the clobber section, for
+ two reasons:
+ (1) r11 is restored in VALGRIND_CFI_EPILOGUE, so effectively it is not
+ modified
+ (2) GCC will complain that r11 cannot appear inside a clobber section,
+ when compiled with -O -fno-omit-frame-pointer
+ */
+
+#define CALL_FN_W_v(lval, orig) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[1]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ __asm__ volatile( \
+ VALGRIND_CFI_PROLOGUE \
+ "aghi 15,-160\n\t" \
+ "lg 1, 0(1)\n\t" /* target->r1 */ \
+ VALGRIND_CALL_NOREDIR_R1 \
+ "lgr %0, 2\n\t" \
+ "aghi 15,160\n\t" \
+ VALGRIND_CFI_EPILOGUE \
+ : /*out*/ "=d" (_res) \
+ : /*in*/ "d" (&_argvec[0]) __FRAME_POINTER \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"7" \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
-#if defined(PLAT_ppc32_aix5)
+/* The call abi has the arguments in r2-r6 and stack */
+#define CALL_FN_W_W(lval, orig, arg1) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[2]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)arg1; \
+ __asm__ volatile( \
+ VALGRIND_CFI_PROLOGUE \
+ "aghi 15,-160\n\t" \
+ "lg 2, 8(1)\n\t" \
+ "lg 1, 0(1)\n\t" \
+ VALGRIND_CALL_NOREDIR_R1 \
+ "lgr %0, 2\n\t" \
+ "aghi 15,160\n\t" \
+ VALGRIND_CFI_EPILOGUE \
+ : /*out*/ "=d" (_res) \
+ : /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"7" \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
-/* ARGREGS: r3 r4 r5 r6 r7 r8 r9 r10 (the rest on stack somewhere) */
+#define CALL_FN_W_WW(lval, orig, arg1, arg2) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[3]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)arg1; \
+ _argvec[2] = (unsigned long)arg2; \
+ __asm__ volatile( \
+ VALGRIND_CFI_PROLOGUE \
+ "aghi 15,-160\n\t" \
+ "lg 2, 8(1)\n\t" \
+ "lg 3,16(1)\n\t" \
+ "lg 1, 0(1)\n\t" \
+ VALGRIND_CALL_NOREDIR_R1 \
+ "lgr %0, 2\n\t" \
+ "aghi 15,160\n\t" \
+ VALGRIND_CFI_EPILOGUE \
+ : /*out*/ "=d" (_res) \
+ : /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"7" \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
-/* These regs are trashed by the hidden call. */
-#define __CALLER_SAVED_REGS \
- "lr", "ctr", "xer", \
- "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", \
- "r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", \
- "r11", "r12", "r13"
+#define CALL_FN_W_WWW(lval, orig, arg1, arg2, arg3) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[4]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)arg1; \
+ _argvec[2] = (unsigned long)arg2; \
+ _argvec[3] = (unsigned long)arg3; \
+ __asm__ volatile( \
+ VALGRIND_CFI_PROLOGUE \
+ "aghi 15,-160\n\t" \
+ "lg 2, 8(1)\n\t" \
+ "lg 3,16(1)\n\t" \
+ "lg 4,24(1)\n\t" \
+ "lg 1, 0(1)\n\t" \
+ VALGRIND_CALL_NOREDIR_R1 \
+ "lgr %0, 2\n\t" \
+ "aghi 15,160\n\t" \
+ VALGRIND_CFI_EPILOGUE \
+ : /*out*/ "=d" (_res) \
+ : /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"7" \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
-/* Expand the stack frame, copying enough info that unwinding
- still works. Trashes r3. */
+#define CALL_FN_W_WWWW(lval, orig, arg1, arg2, arg3, arg4) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[5]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)arg1; \
+ _argvec[2] = (unsigned long)arg2; \
+ _argvec[3] = (unsigned long)arg3; \
+ _argvec[4] = (unsigned long)arg4; \
+ __asm__ volatile( \
+ VALGRIND_CFI_PROLOGUE \
+ "aghi 15,-160\n\t" \
+ "lg 2, 8(1)\n\t" \
+ "lg 3,16(1)\n\t" \
+ "lg 4,24(1)\n\t" \
+ "lg 5,32(1)\n\t" \
+ "lg 1, 0(1)\n\t" \
+ VALGRIND_CALL_NOREDIR_R1 \
+ "lgr %0, 2\n\t" \
+ "aghi 15,160\n\t" \
+ VALGRIND_CFI_EPILOGUE \
+ : /*out*/ "=d" (_res) \
+ : /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"7" \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
-#define VG_EXPAND_FRAME_BY_trashes_r3(_n_fr) \
- "addi 1,1,-" #_n_fr "\n\t" \
- "lwz 3," #_n_fr "(1)\n\t" \
- "stw 3,0(1)\n\t"
+#define CALL_FN_W_5W(lval, orig, arg1, arg2, arg3, arg4, arg5) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[6]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)arg1; \
+ _argvec[2] = (unsigned long)arg2; \
+ _argvec[3] = (unsigned long)arg3; \
+ _argvec[4] = (unsigned long)arg4; \
+ _argvec[5] = (unsigned long)arg5; \
+ __asm__ volatile( \
+ VALGRIND_CFI_PROLOGUE \
+ "aghi 15,-160\n\t" \
+ "lg 2, 8(1)\n\t" \
+ "lg 3,16(1)\n\t" \
+ "lg 4,24(1)\n\t" \
+ "lg 5,32(1)\n\t" \
+ "lg 6,40(1)\n\t" \
+ "lg 1, 0(1)\n\t" \
+ VALGRIND_CALL_NOREDIR_R1 \
+ "lgr %0, 2\n\t" \
+ "aghi 15,160\n\t" \
+ VALGRIND_CFI_EPILOGUE \
+ : /*out*/ "=d" (_res) \
+ : /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
-#define VG_CONTRACT_FRAME_BY(_n_fr) \
- "addi 1,1," #_n_fr "\n\t"
+#define CALL_FN_W_6W(lval, orig, arg1, arg2, arg3, arg4, arg5, \
+ arg6) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[7]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)arg1; \
+ _argvec[2] = (unsigned long)arg2; \
+ _argvec[3] = (unsigned long)arg3; \
+ _argvec[4] = (unsigned long)arg4; \
+ _argvec[5] = (unsigned long)arg5; \
+ _argvec[6] = (unsigned long)arg6; \
+ __asm__ volatile( \
+ VALGRIND_CFI_PROLOGUE \
+ "aghi 15,-168\n\t" \
+ "lg 2, 8(1)\n\t" \
+ "lg 3,16(1)\n\t" \
+ "lg 4,24(1)\n\t" \
+ "lg 5,32(1)\n\t" \
+ "lg 6,40(1)\n\t" \
+ "mvc 160(8,15), 48(1)\n\t" \
+ "lg 1, 0(1)\n\t" \
+ VALGRIND_CALL_NOREDIR_R1 \
+ "lgr %0, 2\n\t" \
+ "aghi 15,168\n\t" \
+ VALGRIND_CFI_EPILOGUE \
+ : /*out*/ "=d" (_res) \
+ : /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
-/* These CALL_FN_ macros assume that on ppc32-aix5, sizeof(unsigned
- long) == 4. */
+#define CALL_FN_W_7W(lval, orig, arg1, arg2, arg3, arg4, arg5, \
+ arg6, arg7) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[8]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)arg1; \
+ _argvec[2] = (unsigned long)arg2; \
+ _argvec[3] = (unsigned long)arg3; \
+ _argvec[4] = (unsigned long)arg4; \
+ _argvec[5] = (unsigned long)arg5; \
+ _argvec[6] = (unsigned long)arg6; \
+ _argvec[7] = (unsigned long)arg7; \
+ __asm__ volatile( \
+ VALGRIND_CFI_PROLOGUE \
+ "aghi 15,-176\n\t" \
+ "lg 2, 8(1)\n\t" \
+ "lg 3,16(1)\n\t" \
+ "lg 4,24(1)\n\t" \
+ "lg 5,32(1)\n\t" \
+ "lg 6,40(1)\n\t" \
+ "mvc 160(8,15), 48(1)\n\t" \
+ "mvc 168(8,15), 56(1)\n\t" \
+ "lg 1, 0(1)\n\t" \
+ VALGRIND_CALL_NOREDIR_R1 \
+ "lgr %0, 2\n\t" \
+ "aghi 15,176\n\t" \
+ VALGRIND_CFI_EPILOGUE \
+ : /*out*/ "=d" (_res) \
+ : /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
+ ); \
+ lval = (__typeof__(lval)) _res; \
+ } while (0)
-#define CALL_FN_W_v(lval, orig) \
- do { \
- volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+0]; \
- volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
- __asm__ volatile( \
- "mr 11,%1\n\t" \
- VG_EXPAND_FRAME_BY_trashes_r3(512) \
- "stw 2,-8(11)\n\t" /* save tocptr */ \
- "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
- "lwz 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "lwz 2,-8(11)\n\t" /* restore tocptr */ \
- VG_CONTRACT_FRAME_BY(512) \
- : /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
- ); \
- lval = (__typeof__(lval)) _res; \
+#define CALL_FN_W_8W(lval, orig, arg1, arg2, arg3, arg4, arg5, \
+ arg6, arg7 ,arg8) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[9]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)arg1; \
+ _argvec[2] = (unsigned long)arg2; \
+ _argvec[3] = (unsigned long)arg3; \
+ _argvec[4] = (unsigned long)arg4; \
+ _argvec[5] = (unsigned long)arg5; \
+ _argvec[6] = (unsigned long)arg6; \
+ _argvec[7] = (unsigned long)arg7; \
+ _argvec[8] = (unsigned long)arg8; \
+ __asm__ volatile( \
+ VALGRIND_CFI_PROLOGUE \
+ "aghi 15,-184\n\t" \
+ "lg 2, 8(1)\n\t" \
+ "lg 3,16(1)\n\t" \
+ "lg 4,24(1)\n\t" \
+ "lg 5,32(1)\n\t" \
+ "lg 6,40(1)\n\t" \
+ "mvc 160(8,15), 48(1)\n\t" \
+ "mvc 168(8,15), 56(1)\n\t" \
+ "mvc 176(8,15), 64(1)\n\t" \
+ "lg 1, 0(1)\n\t" \
+ VALGRIND_CALL_NOREDIR_R1 \
+ "lgr %0, 2\n\t" \
+ "aghi 15,184\n\t" \
+ VALGRIND_CFI_EPILOGUE \
+ : /*out*/ "=d" (_res) \
+ : /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
+ ); \
+ lval = (__typeof__(lval)) _res; \
} while (0)
-#define CALL_FN_W_W(lval, orig, arg1) \
- do { \
- volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+1]; \
- volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
- _argvec[2+1] = (unsigned long)arg1; \
- __asm__ volatile( \
- "mr 11,%1\n\t" \
- VG_EXPAND_FRAME_BY_trashes_r3(512) \
- "stw 2,-8(11)\n\t" /* save tocptr */ \
- "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
- "lwz 3, 4(11)\n\t" /* arg1->r3 */ \
- "lwz 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "lwz 2,-8(11)\n\t" /* restore tocptr */ \
- VG_CONTRACT_FRAME_BY(512) \
- : /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
- ); \
- lval = (__typeof__(lval)) _res; \
+#define CALL_FN_W_9W(lval, orig, arg1, arg2, arg3, arg4, arg5, \
+ arg6, arg7 ,arg8, arg9) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[10]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)arg1; \
+ _argvec[2] = (unsigned long)arg2; \
+ _argvec[3] = (unsigned long)arg3; \
+ _argvec[4] = (unsigned long)arg4; \
+ _argvec[5] = (unsigned long)arg5; \
+ _argvec[6] = (unsigned long)arg6; \
+ _argvec[7] = (unsigned long)arg7; \
+ _argvec[8] = (unsigned long)arg8; \
+ _argvec[9] = (unsigned long)arg9; \
+ __asm__ volatile( \
+ VALGRIND_CFI_PROLOGUE \
+ "aghi 15,-192\n\t" \
+ "lg 2, 8(1)\n\t" \
+ "lg 3,16(1)\n\t" \
+ "lg 4,24(1)\n\t" \
+ "lg 5,32(1)\n\t" \
+ "lg 6,40(1)\n\t" \
+ "mvc 160(8,15), 48(1)\n\t" \
+ "mvc 168(8,15), 56(1)\n\t" \
+ "mvc 176(8,15), 64(1)\n\t" \
+ "mvc 184(8,15), 72(1)\n\t" \
+ "lg 1, 0(1)\n\t" \
+ VALGRIND_CALL_NOREDIR_R1 \
+ "lgr %0, 2\n\t" \
+ "aghi 15,192\n\t" \
+ VALGRIND_CFI_EPILOGUE \
+ : /*out*/ "=d" (_res) \
+ : /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
+ ); \
+ lval = (__typeof__(lval)) _res; \
} while (0)
-#define CALL_FN_W_WW(lval, orig, arg1,arg2) \
- do { \
- volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+2]; \
- volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
- _argvec[2+1] = (unsigned long)arg1; \
- _argvec[2+2] = (unsigned long)arg2; \
- __asm__ volatile( \
- "mr 11,%1\n\t" \
- VG_EXPAND_FRAME_BY_trashes_r3(512) \
- "stw 2,-8(11)\n\t" /* save tocptr */ \
- "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
- "lwz 3, 4(11)\n\t" /* arg1->r3 */ \
- "lwz 4, 8(11)\n\t" /* arg2->r4 */ \
- "lwz 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "lwz 2,-8(11)\n\t" /* restore tocptr */ \
- VG_CONTRACT_FRAME_BY(512) \
- : /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
- ); \
- lval = (__typeof__(lval)) _res; \
- } while (0)
-
-#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \
- do { \
- volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+3]; \
- volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
- _argvec[2+1] = (unsigned long)arg1; \
- _argvec[2+2] = (unsigned long)arg2; \
- _argvec[2+3] = (unsigned long)arg3; \
- __asm__ volatile( \
- "mr 11,%1\n\t" \
- VG_EXPAND_FRAME_BY_trashes_r3(512) \
- "stw 2,-8(11)\n\t" /* save tocptr */ \
- "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
- "lwz 3, 4(11)\n\t" /* arg1->r3 */ \
- "lwz 4, 8(11)\n\t" /* arg2->r4 */ \
- "lwz 5, 12(11)\n\t" /* arg3->r5 */ \
- "lwz 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "lwz 2,-8(11)\n\t" /* restore tocptr */ \
- VG_CONTRACT_FRAME_BY(512) \
- : /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
- ); \
- lval = (__typeof__(lval)) _res; \
- } while (0)
-
-#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \
- do { \
- volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+4]; \
- volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
- _argvec[2+1] = (unsigned long)arg1; \
- _argvec[2+2] = (unsigned long)arg2; \
- _argvec[2+3] = (unsigned long)arg3; \
- _argvec[2+4] = (unsigned long)arg4; \
- __asm__ volatile( \
- "mr 11,%1\n\t" \
- VG_EXPAND_FRAME_BY_trashes_r3(512) \
- "stw 2,-8(11)\n\t" /* save tocptr */ \
- "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
- "lwz 3, 4(11)\n\t" /* arg1->r3 */ \
- "lwz 4, 8(11)\n\t" /* arg2->r4 */ \
- "lwz 5, 12(11)\n\t" /* arg3->r5 */ \
- "lwz 6, 16(11)\n\t" /* arg4->r6 */ \
- "lwz 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "lwz 2,-8(11)\n\t" /* restore tocptr */ \
- VG_CONTRACT_FRAME_BY(512) \
- : /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
- ); \
- lval = (__typeof__(lval)) _res; \
- } while (0)
-
-#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \
- do { \
- volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+5]; \
- volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
- _argvec[2+1] = (unsigned long)arg1; \
- _argvec[2+2] = (unsigned long)arg2; \
- _argvec[2+3] = (unsigned long)arg3; \
- _argvec[2+4] = (unsigned long)arg4; \
- _argvec[2+5] = (unsigned long)arg5; \
- __asm__ volatile( \
- "mr 11,%1\n\t" \
- VG_EXPAND_FRAME_BY_trashes_r3(512) \
- "stw 2,-8(11)\n\t" /* save tocptr */ \
- "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
- "lwz 3, 4(11)\n\t" /* arg1->r3 */ \
- "lwz 4, 8(11)\n\t" /* arg2->r4 */ \
- "lwz 5, 12(11)\n\t" /* arg3->r5 */ \
- "lwz 6, 16(11)\n\t" /* arg4->r6 */ \
- "lwz 7, 20(11)\n\t" /* arg5->r7 */ \
- "lwz 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "lwz 2,-8(11)\n\t" /* restore tocptr */ \
- VG_CONTRACT_FRAME_BY(512) \
- : /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
- ); \
- lval = (__typeof__(lval)) _res; \
+#define CALL_FN_W_10W(lval, orig, arg1, arg2, arg3, arg4, arg5, \
+ arg6, arg7 ,arg8, arg9, arg10) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[11]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)arg1; \
+ _argvec[2] = (unsigned long)arg2; \
+ _argvec[3] = (unsigned long)arg3; \
+ _argvec[4] = (unsigned long)arg4; \
+ _argvec[5] = (unsigned long)arg5; \
+ _argvec[6] = (unsigned long)arg6; \
+ _argvec[7] = (unsigned long)arg7; \
+ _argvec[8] = (unsigned long)arg8; \
+ _argvec[9] = (unsigned long)arg9; \
+ _argvec[10] = (unsigned long)arg10; \
+ __asm__ volatile( \
+ VALGRIND_CFI_PROLOGUE \
+ "aghi 15,-200\n\t" \
+ "lg 2, 8(1)\n\t" \
+ "lg 3,16(1)\n\t" \
+ "lg 4,24(1)\n\t" \
+ "lg 5,32(1)\n\t" \
+ "lg 6,40(1)\n\t" \
+ "mvc 160(8,15), 48(1)\n\t" \
+ "mvc 168(8,15), 56(1)\n\t" \
+ "mvc 176(8,15), 64(1)\n\t" \
+ "mvc 184(8,15), 72(1)\n\t" \
+ "mvc 192(8,15), 80(1)\n\t" \
+ "lg 1, 0(1)\n\t" \
+ VALGRIND_CALL_NOREDIR_R1 \
+ "lgr %0, 2\n\t" \
+ "aghi 15,200\n\t" \
+ VALGRIND_CFI_EPILOGUE \
+ : /*out*/ "=d" (_res) \
+ : /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
+ ); \
+ lval = (__typeof__(lval)) _res; \
} while (0)
-#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \
- do { \
- volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+6]; \
- volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
- _argvec[2+1] = (unsigned long)arg1; \
- _argvec[2+2] = (unsigned long)arg2; \
- _argvec[2+3] = (unsigned long)arg3; \
- _argvec[2+4] = (unsigned long)arg4; \
- _argvec[2+5] = (unsigned long)arg5; \
- _argvec[2+6] = (unsigned long)arg6; \
- __asm__ volatile( \
- "mr 11,%1\n\t" \
- VG_EXPAND_FRAME_BY_trashes_r3(512) \
- "stw 2,-8(11)\n\t" /* save tocptr */ \
- "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
- "lwz 3, 4(11)\n\t" /* arg1->r3 */ \
- "lwz 4, 8(11)\n\t" /* arg2->r4 */ \
- "lwz 5, 12(11)\n\t" /* arg3->r5 */ \
- "lwz 6, 16(11)\n\t" /* arg4->r6 */ \
- "lwz 7, 20(11)\n\t" /* arg5->r7 */ \
- "lwz 8, 24(11)\n\t" /* arg6->r8 */ \
- "lwz 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "lwz 2,-8(11)\n\t" /* restore tocptr */ \
- VG_CONTRACT_FRAME_BY(512) \
- : /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
- ); \
- lval = (__typeof__(lval)) _res; \
+#define CALL_FN_W_11W(lval, orig, arg1, arg2, arg3, arg4, arg5, \
+ arg6, arg7 ,arg8, arg9, arg10, arg11) \
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[12]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)arg1; \
+ _argvec[2] = (unsigned long)arg2; \
+ _argvec[3] = (unsigned long)arg3; \
+ _argvec[4] = (unsigned long)arg4; \
+ _argvec[5] = (unsigned long)arg5; \
+ _argvec[6] = (unsigned long)arg6; \
+ _argvec[7] = (unsigned long)arg7; \
+ _argvec[8] = (unsigned long)arg8; \
+ _argvec[9] = (unsigned long)arg9; \
+ _argvec[10] = (unsigned long)arg10; \
+ _argvec[11] = (unsigned long)arg11; \
+ __asm__ volatile( \
+ VALGRIND_CFI_PROLOGUE \
+ "aghi 15,-208\n\t" \
+ "lg 2, 8(1)\n\t" \
+ "lg 3,16(1)\n\t" \
+ "lg 4,24(1)\n\t" \
+ "lg 5,32(1)\n\t" \
+ "lg 6,40(1)\n\t" \
+ "mvc 160(8,15), 48(1)\n\t" \
+ "mvc 168(8,15), 56(1)\n\t" \
+ "mvc 176(8,15), 64(1)\n\t" \
+ "mvc 184(8,15), 72(1)\n\t" \
+ "mvc 192(8,15), 80(1)\n\t" \
+ "mvc 200(8,15), 88(1)\n\t" \
+ "lg 1, 0(1)\n\t" \
+ VALGRIND_CALL_NOREDIR_R1 \
+ "lgr %0, 2\n\t" \
+ "aghi 15,208\n\t" \
+ VALGRIND_CFI_EPILOGUE \
+ : /*out*/ "=d" (_res) \
+ : /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
+ ); \
+ lval = (__typeof__(lval)) _res; \
} while (0)
-#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
- arg7) \
- do { \
- volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+7]; \
- volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
- _argvec[2+1] = (unsigned long)arg1; \
- _argvec[2+2] = (unsigned long)arg2; \
- _argvec[2+3] = (unsigned long)arg3; \
- _argvec[2+4] = (unsigned long)arg4; \
- _argvec[2+5] = (unsigned long)arg5; \
- _argvec[2+6] = (unsigned long)arg6; \
- _argvec[2+7] = (unsigned long)arg7; \
- __asm__ volatile( \
- "mr 11,%1\n\t" \
- VG_EXPAND_FRAME_BY_trashes_r3(512) \
- "stw 2,-8(11)\n\t" /* save tocptr */ \
- "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
- "lwz 3, 4(11)\n\t" /* arg1->r3 */ \
- "lwz 4, 8(11)\n\t" /* arg2->r4 */ \
- "lwz 5, 12(11)\n\t" /* arg3->r5 */ \
- "lwz 6, 16(11)\n\t" /* arg4->r6 */ \
- "lwz 7, 20(11)\n\t" /* arg5->r7 */ \
- "lwz 8, 24(11)\n\t" /* arg6->r8 */ \
- "lwz 9, 28(11)\n\t" /* arg7->r9 */ \
- "lwz 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "lwz 2,-8(11)\n\t" /* restore tocptr */ \
- VG_CONTRACT_FRAME_BY(512) \
- : /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
- ); \
- lval = (__typeof__(lval)) _res; \
+#define CALL_FN_W_12W(lval, orig, arg1, arg2, arg3, arg4, arg5, \
+ arg6, arg7 ,arg8, arg9, arg10, arg11, arg12)\
+ do { \
+ volatile OrigFn _orig = (orig); \
+ volatile unsigned long _argvec[13]; \
+ volatile unsigned long _res; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)arg1; \
+ _argvec[2] = (unsigned long)arg2; \
+ _argvec[3] = (unsigned long)arg3; \
+ _argvec[4] = (unsigned long)arg4; \
+ _argvec[5] = (unsigned long)arg5; \
+ _argvec[6] = (unsigned long)arg6; \
+ _argvec[7] = (unsigned long)arg7; \
+ _argvec[8] = (unsigned long)arg8; \
+ _argvec[9] = (unsigned long)arg9; \
+ _argvec[10] = (unsigned long)arg10; \
+ _argvec[11] = (unsigned long)arg11; \
+ _argvec[12] = (unsigned long)arg12; \
+ __asm__ volatile( \
+ VALGRIND_CFI_PROLOGUE \
+ "aghi 15,-216\n\t" \
+ "lg 2, 8(1)\n\t" \
+ "lg 3,16(1)\n\t" \
+ "lg 4,24(1)\n\t" \
+ "lg 5,32(1)\n\t" \
+ "lg 6,40(1)\n\t" \
+ "mvc 160(8,15), 48(1)\n\t" \
+ "mvc 168(8,15), 56(1)\n\t" \
+ "mvc 176(8,15), 64(1)\n\t" \
+ "mvc 184(8,15), 72(1)\n\t" \
+ "mvc 192(8,15), 80(1)\n\t" \
+ "mvc 200(8,15), 88(1)\n\t" \
+ "mvc 208(8,15), 96(1)\n\t" \
+ "lg 1, 0(1)\n\t" \
+ VALGRIND_CALL_NOREDIR_R1 \
+ "lgr %0, 2\n\t" \
+ "aghi 15,216\n\t" \
+ VALGRIND_CFI_EPILOGUE \
+ : /*out*/ "=d" (_res) \
+ : /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
+ ); \
+ lval = (__typeof__(lval)) _res; \
} while (0)
-#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
- arg7,arg8) \
- do { \
- volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+8]; \
- volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
- _argvec[2+1] = (unsigned long)arg1; \
- _argvec[2+2] = (unsigned long)arg2; \
- _argvec[2+3] = (unsigned long)arg3; \
- _argvec[2+4] = (unsigned long)arg4; \
- _argvec[2+5] = (unsigned long)arg5; \
- _argvec[2+6] = (unsigned long)arg6; \
- _argvec[2+7] = (unsigned long)arg7; \
- _argvec[2+8] = (unsigned long)arg8; \
- __asm__ volatile( \
- "mr 11,%1\n\t" \
- VG_EXPAND_FRAME_BY_trashes_r3(512) \
- "stw 2,-8(11)\n\t" /* save tocptr */ \
- "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
- "lwz 3, 4(11)\n\t" /* arg1->r3 */ \
- "lwz 4, 8(11)\n\t" /* arg2->r4 */ \
- "lwz 5, 12(11)\n\t" /* arg3->r5 */ \
- "lwz 6, 16(11)\n\t" /* arg4->r6 */ \
- "lwz 7, 20(11)\n\t" /* arg5->r7 */ \
- "lwz 8, 24(11)\n\t" /* arg6->r8 */ \
- "lwz 9, 28(11)\n\t" /* arg7->r9 */ \
- "lwz 10, 32(11)\n\t" /* arg8->r10 */ \
- "lwz 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "lwz 2,-8(11)\n\t" /* restore tocptr */ \
- VG_CONTRACT_FRAME_BY(512) \
- : /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
- ); \
- lval = (__typeof__(lval)) _res; \
- } while (0)
-
-#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
- arg7,arg8,arg9) \
- do { \
- volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+9]; \
- volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
- _argvec[2+1] = (unsigned long)arg1; \
- _argvec[2+2] = (unsigned long)arg2; \
- _argvec[2+3] = (unsigned long)arg3; \
- _argvec[2+4] = (unsigned long)arg4; \
- _argvec[2+5] = (unsigned long)arg5; \
- _argvec[2+6] = (unsigned long)arg6; \
- _argvec[2+7] = (unsigned long)arg7; \
- _argvec[2+8] = (unsigned long)arg8; \
- _argvec[2+9] = (unsigned long)arg9; \
- __asm__ volatile( \
- "mr 11,%1\n\t" \
- VG_EXPAND_FRAME_BY_trashes_r3(512) \
- "stw 2,-8(11)\n\t" /* save tocptr */ \
- "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
- VG_EXPAND_FRAME_BY_trashes_r3(64) \
- /* arg9 */ \
- "lwz 3,36(11)\n\t" \
- "stw 3,56(1)\n\t" \
- /* args1-8 */ \
- "lwz 3, 4(11)\n\t" /* arg1->r3 */ \
- "lwz 4, 8(11)\n\t" /* arg2->r4 */ \
- "lwz 5, 12(11)\n\t" /* arg3->r5 */ \
- "lwz 6, 16(11)\n\t" /* arg4->r6 */ \
- "lwz 7, 20(11)\n\t" /* arg5->r7 */ \
- "lwz 8, 24(11)\n\t" /* arg6->r8 */ \
- "lwz 9, 28(11)\n\t" /* arg7->r9 */ \
- "lwz 10, 32(11)\n\t" /* arg8->r10 */ \
- "lwz 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "lwz 2,-8(11)\n\t" /* restore tocptr */ \
- VG_CONTRACT_FRAME_BY(64) \
- VG_CONTRACT_FRAME_BY(512) \
- : /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
- ); \
- lval = (__typeof__(lval)) _res; \
- } while (0)
-
-#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
- arg7,arg8,arg9,arg10) \
- do { \
- volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+10]; \
- volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
- _argvec[2+1] = (unsigned long)arg1; \
- _argvec[2+2] = (unsigned long)arg2; \
- _argvec[2+3] = (unsigned long)arg3; \
- _argvec[2+4] = (unsigned long)arg4; \
- _argvec[2+5] = (unsigned long)arg5; \
- _argvec[2+6] = (unsigned long)arg6; \
- _argvec[2+7] = (unsigned long)arg7; \
- _argvec[2+8] = (unsigned long)arg8; \
- _argvec[2+9] = (unsigned long)arg9; \
- _argvec[2+10] = (unsigned long)arg10; \
- __asm__ volatile( \
- "mr 11,%1\n\t" \
- VG_EXPAND_FRAME_BY_trashes_r3(512) \
- "stw 2,-8(11)\n\t" /* save tocptr */ \
- "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
- VG_EXPAND_FRAME_BY_trashes_r3(64) \
- /* arg10 */ \
- "lwz 3,40(11)\n\t" \
- "stw 3,60(1)\n\t" \
- /* arg9 */ \
- "lwz 3,36(11)\n\t" \
- "stw 3,56(1)\n\t" \
- /* args1-8 */ \
- "lwz 3, 4(11)\n\t" /* arg1->r3 */ \
- "lwz 4, 8(11)\n\t" /* arg2->r4 */ \
- "lwz 5, 12(11)\n\t" /* arg3->r5 */ \
- "lwz 6, 16(11)\n\t" /* arg4->r6 */ \
- "lwz 7, 20(11)\n\t" /* arg5->r7 */ \
- "lwz 8, 24(11)\n\t" /* arg6->r8 */ \
- "lwz 9, 28(11)\n\t" /* arg7->r9 */ \
- "lwz 10, 32(11)\n\t" /* arg8->r10 */ \
- "lwz 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "lwz 2,-8(11)\n\t" /* restore tocptr */ \
- VG_CONTRACT_FRAME_BY(64) \
- VG_CONTRACT_FRAME_BY(512) \
- : /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
- ); \
- lval = (__typeof__(lval)) _res; \
- } while (0)
-
-#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
- arg7,arg8,arg9,arg10,arg11) \
- do { \
- volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+11]; \
- volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
- _argvec[2+1] = (unsigned long)arg1; \
- _argvec[2+2] = (unsigned long)arg2; \
- _argvec[2+3] = (unsigned long)arg3; \
- _argvec[2+4] = (unsigned long)arg4; \
- _argvec[2+5] = (unsigned long)arg5; \
- _argvec[2+6] = (unsigned long)arg6; \
- _argvec[2+7] = (unsigned long)arg7; \
- _argvec[2+8] = (unsigned long)arg8; \
- _argvec[2+9] = (unsigned long)arg9; \
- _argvec[2+10] = (unsigned long)arg10; \
- _argvec[2+11] = (unsigned long)arg11; \
- __asm__ volatile( \
- "mr 11,%1\n\t" \
- VG_EXPAND_FRAME_BY_trashes_r3(512) \
- "stw 2,-8(11)\n\t" /* save tocptr */ \
- "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
- VG_EXPAND_FRAME_BY_trashes_r3(72) \
- /* arg11 */ \
- "lwz 3,44(11)\n\t" \
- "stw 3,64(1)\n\t" \
- /* arg10 */ \
- "lwz 3,40(11)\n\t" \
- "stw 3,60(1)\n\t" \
- /* arg9 */ \
- "lwz 3,36(11)\n\t" \
- "stw 3,56(1)\n\t" \
- /* args1-8 */ \
- "lwz 3, 4(11)\n\t" /* arg1->r3 */ \
- "lwz 4, 8(11)\n\t" /* arg2->r4 */ \
- "lwz 5, 12(11)\n\t" /* arg3->r5 */ \
- "lwz 6, 16(11)\n\t" /* arg4->r6 */ \
- "lwz 7, 20(11)\n\t" /* arg5->r7 */ \
- "lwz 8, 24(11)\n\t" /* arg6->r8 */ \
- "lwz 9, 28(11)\n\t" /* arg7->r9 */ \
- "lwz 10, 32(11)\n\t" /* arg8->r10 */ \
- "lwz 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "lwz 2,-8(11)\n\t" /* restore tocptr */ \
- VG_CONTRACT_FRAME_BY(72) \
- VG_CONTRACT_FRAME_BY(512) \
- : /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
- ); \
- lval = (__typeof__(lval)) _res; \
- } while (0)
-
-#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
- arg7,arg8,arg9,arg10,arg11,arg12) \
- do { \
- volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+12]; \
- volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
- _argvec[2+1] = (unsigned long)arg1; \
- _argvec[2+2] = (unsigned long)arg2; \
- _argvec[2+3] = (unsigned long)arg3; \
- _argvec[2+4] = (unsigned long)arg4; \
- _argvec[2+5] = (unsigned long)arg5; \
- _argvec[2+6] = (unsigned long)arg6; \
- _argvec[2+7] = (unsigned long)arg7; \
- _argvec[2+8] = (unsigned long)arg8; \
- _argvec[2+9] = (unsigned long)arg9; \
- _argvec[2+10] = (unsigned long)arg10; \
- _argvec[2+11] = (unsigned long)arg11; \
- _argvec[2+12] = (unsigned long)arg12; \
- __asm__ volatile( \
- "mr 11,%1\n\t" \
- VG_EXPAND_FRAME_BY_trashes_r3(512) \
- "stw 2,-8(11)\n\t" /* save tocptr */ \
- "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \
- VG_EXPAND_FRAME_BY_trashes_r3(72) \
- /* arg12 */ \
- "lwz 3,48(11)\n\t" \
- "stw 3,68(1)\n\t" \
- /* arg11 */ \
- "lwz 3,44(11)\n\t" \
- "stw 3,64(1)\n\t" \
- /* arg10 */ \
- "lwz 3,40(11)\n\t" \
- "stw 3,60(1)\n\t" \
- /* arg9 */ \
- "lwz 3,36(11)\n\t" \
- "stw 3,56(1)\n\t" \
- /* args1-8 */ \
- "lwz 3, 4(11)\n\t" /* arg1->r3 */ \
- "lwz 4, 8(11)\n\t" /* arg2->r4 */ \
- "lwz 5, 12(11)\n\t" /* arg3->r5 */ \
- "lwz 6, 16(11)\n\t" /* arg4->r6 */ \
- "lwz 7, 20(11)\n\t" /* arg5->r7 */ \
- "lwz 8, 24(11)\n\t" /* arg6->r8 */ \
- "lwz 9, 28(11)\n\t" /* arg7->r9 */ \
- "lwz 10, 32(11)\n\t" /* arg8->r10 */ \
- "lwz 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "lwz 2,-8(11)\n\t" /* restore tocptr */ \
- VG_CONTRACT_FRAME_BY(72) \
- VG_CONTRACT_FRAME_BY(512) \
- : /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
- ); \
- lval = (__typeof__(lval)) _res; \
- } while (0)
-
-#endif /* PLAT_ppc32_aix5 */
-
-/* ------------------------ ppc64-aix5 ------------------------- */
-
-#if defined(PLAT_ppc64_aix5)
-
-/* ARGREGS: r3 r4 r5 r6 r7 r8 r9 r10 (the rest on stack somewhere) */
-
-/* These regs are trashed by the hidden call. */
-#define __CALLER_SAVED_REGS \
- "lr", "ctr", "xer", \
- "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", \
- "r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", \
- "r11", "r12", "r13"
-/* Expand the stack frame, copying enough info that unwinding
- still works. Trashes r3. */
+#endif /* PLAT_s390x_linux */
-#define VG_EXPAND_FRAME_BY_trashes_r3(_n_fr) \
- "addi 1,1,-" #_n_fr "\n\t" \
- "ld 3," #_n_fr "(1)\n\t" \
- "std 3,0(1)\n\t"
+/* ------------------------- mips-linux ------------------------- */
+
+#if defined(PLAT_mips32_linux)
-#define VG_CONTRACT_FRAME_BY(_n_fr) \
- "addi 1,1," #_n_fr "\n\t"
+/* These regs are trashed by the hidden call. */
+#define __CALLER_SAVED_REGS "$2", "$3", "$4", "$5", "$6", \
+"$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", \
+"$25", "$31"
-/* These CALL_FN_ macros assume that on ppc64-aix5, sizeof(unsigned
- long) == 8. */
+/* These CALL_FN_ macros assume that on mips-linux, sizeof(unsigned
+ long) == 4. */
#define CALL_FN_W_v(lval, orig) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+0]; \
+ volatile unsigned long _argvec[1]; \
volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
__asm__ volatile( \
- "mr 11,%1\n\t" \
- VG_EXPAND_FRAME_BY_trashes_r3(512) \
- "std 2,-16(11)\n\t" /* save tocptr */ \
- "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
- "ld 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "ld 2,-16(11)\n\t" /* restore tocptr */ \
- VG_CONTRACT_FRAME_BY(512) \
+ "subu $29, $29, 8 \n\t" \
+ "sw $gp, 0($sp) \n\t" \
+ "sw $ra, 4($sp) \n\t" \
+ "subu $29, $29, 16 \n\t" \
+ "lw $t9, 0(%1) \n\t" /* target->t9 */ \
+ VALGRIND_CALL_NOREDIR_T9 \
+ "addu $29, $29, 16\n\t" \
+ "lw $gp, 0($sp) \n\t" \
+ "lw $ra, 4($sp) \n\t" \
+ "addu $29, $29, 8 \n\t" \
+ "move %0, $v0\n" \
: /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
+ : /*in*/ "0" (&_argvec[0]) \
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
); \
lval = (__typeof__(lval)) _res; \
#define CALL_FN_W_W(lval, orig, arg1) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+1]; \
+ volatile unsigned long _argvec[2]; \
volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
- _argvec[2+1] = (unsigned long)arg1; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
__asm__ volatile( \
- "mr 11,%1\n\t" \
- VG_EXPAND_FRAME_BY_trashes_r3(512) \
- "std 2,-16(11)\n\t" /* save tocptr */ \
- "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
- "ld 3, 8(11)\n\t" /* arg1->r3 */ \
- "ld 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "ld 2,-16(11)\n\t" /* restore tocptr */ \
- VG_CONTRACT_FRAME_BY(512) \
+ "subu $29, $29, 8 \n\t" \
+ "sw $gp, 0($sp) \n\t" \
+ "sw $ra, 4($sp) \n\t" \
+ "subu $29, $29, 16 \n\t" \
+ "lw $a0, 4(%1) \n\t" /* arg1*/ \
+ "lw $t9, 0(%1) \n\t" /* target->t9 */ \
+ VALGRIND_CALL_NOREDIR_T9 \
+ "addu $29, $29, 16 \n\t" \
+ "lw $gp, 0($sp) \n\t" \
+ "lw $ra, 4($sp) \n\t" \
+ "addu $29, $29, 8 \n\t" \
+ "move %0, $v0\n" \
: /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
- : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
+ : /*in*/ "0" (&_argvec[0]) \
+ : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
#define CALL_FN_W_WW(lval, orig, arg1,arg2) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+2]; \
+ volatile unsigned long _argvec[3]; \
volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
- _argvec[2+1] = (unsigned long)arg1; \
- _argvec[2+2] = (unsigned long)arg2; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
__asm__ volatile( \
- "mr 11,%1\n\t" \
- VG_EXPAND_FRAME_BY_trashes_r3(512) \
- "std 2,-16(11)\n\t" /* save tocptr */ \
- "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
- "ld 3, 8(11)\n\t" /* arg1->r3 */ \
- "ld 4, 16(11)\n\t" /* arg2->r4 */ \
- "ld 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "ld 2,-16(11)\n\t" /* restore tocptr */ \
- VG_CONTRACT_FRAME_BY(512) \
+ "subu $29, $29, 8 \n\t" \
+ "sw $gp, 0($sp) \n\t" \
+ "sw $ra, 4($sp) \n\t" \
+ "subu $29, $29, 16 \n\t" \
+ "lw $a0, 4(%1) \n\t" \
+ "lw $a1, 8(%1) \n\t" \
+ "lw $t9, 0(%1) \n\t" /* target->t9 */ \
+ VALGRIND_CALL_NOREDIR_T9 \
+ "addu $29, $29, 16 \n\t" \
+ "lw $gp, 0($sp) \n\t" \
+ "lw $ra, 4($sp) \n\t" \
+ "addu $29, $29, 8 \n\t" \
+ "move %0, $v0\n" \
: /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
+ : /*in*/ "0" (&_argvec[0]) \
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
); \
lval = (__typeof__(lval)) _res; \
#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+3]; \
+ volatile unsigned long _argvec[4]; \
volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
- _argvec[2+1] = (unsigned long)arg1; \
- _argvec[2+2] = (unsigned long)arg2; \
- _argvec[2+3] = (unsigned long)arg3; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
__asm__ volatile( \
- "mr 11,%1\n\t" \
- VG_EXPAND_FRAME_BY_trashes_r3(512) \
- "std 2,-16(11)\n\t" /* save tocptr */ \
- "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
- "ld 3, 8(11)\n\t" /* arg1->r3 */ \
- "ld 4, 16(11)\n\t" /* arg2->r4 */ \
- "ld 5, 24(11)\n\t" /* arg3->r5 */ \
- "ld 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "ld 2,-16(11)\n\t" /* restore tocptr */ \
- VG_CONTRACT_FRAME_BY(512) \
+ "subu $29, $29, 8 \n\t" \
+ "sw $gp, 0($sp) \n\t" \
+ "sw $ra, 4($sp) \n\t" \
+ "subu $29, $29, 16 \n\t" \
+ "lw $a0, 4(%1) \n\t" \
+ "lw $a1, 8(%1) \n\t" \
+ "lw $a2, 12(%1) \n\t" \
+ "lw $t9, 0(%1) \n\t" /* target->t9 */ \
+ VALGRIND_CALL_NOREDIR_T9 \
+ "addu $29, $29, 16 \n\t" \
+ "lw $gp, 0($sp) \n\t" \
+ "lw $ra, 4($sp) \n\t" \
+ "addu $29, $29, 8 \n\t" \
+ "move %0, $v0\n" \
: /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
+ : /*in*/ "0" (&_argvec[0]) \
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
); \
lval = (__typeof__(lval)) _res; \
#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+4]; \
+ volatile unsigned long _argvec[5]; \
volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
- _argvec[2+1] = (unsigned long)arg1; \
- _argvec[2+2] = (unsigned long)arg2; \
- _argvec[2+3] = (unsigned long)arg3; \
- _argvec[2+4] = (unsigned long)arg4; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
__asm__ volatile( \
- "mr 11,%1\n\t" \
- VG_EXPAND_FRAME_BY_trashes_r3(512) \
- "std 2,-16(11)\n\t" /* save tocptr */ \
- "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
- "ld 3, 8(11)\n\t" /* arg1->r3 */ \
- "ld 4, 16(11)\n\t" /* arg2->r4 */ \
- "ld 5, 24(11)\n\t" /* arg3->r5 */ \
- "ld 6, 32(11)\n\t" /* arg4->r6 */ \
- "ld 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "ld 2,-16(11)\n\t" /* restore tocptr */ \
- VG_CONTRACT_FRAME_BY(512) \
+ "subu $29, $29, 8 \n\t" \
+ "sw $gp, 0($sp) \n\t" \
+ "sw $ra, 4($sp) \n\t" \
+ "subu $29, $29, 16 \n\t" \
+ "lw $a0, 4(%1) \n\t" \
+ "lw $a1, 8(%1) \n\t" \
+ "lw $a2, 12(%1) \n\t" \
+ "lw $a3, 16(%1) \n\t" \
+ "lw $t9, 0(%1) \n\t" /* target->t9 */ \
+ VALGRIND_CALL_NOREDIR_T9 \
+ "addu $29, $29, 16 \n\t" \
+ "lw $gp, 0($sp) \n\t" \
+ "lw $ra, 4($sp) \n\t" \
+ "addu $29, $29, 8 \n\t" \
+ "move %0, $v0\n" \
: /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
+ : /*in*/ "0" (&_argvec[0]) \
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
); \
lval = (__typeof__(lval)) _res; \
#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+5]; \
+ volatile unsigned long _argvec[6]; \
volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
- _argvec[2+1] = (unsigned long)arg1; \
- _argvec[2+2] = (unsigned long)arg2; \
- _argvec[2+3] = (unsigned long)arg3; \
- _argvec[2+4] = (unsigned long)arg4; \
- _argvec[2+5] = (unsigned long)arg5; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
__asm__ volatile( \
- "mr 11,%1\n\t" \
- VG_EXPAND_FRAME_BY_trashes_r3(512) \
- "std 2,-16(11)\n\t" /* save tocptr */ \
- "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
- "ld 3, 8(11)\n\t" /* arg1->r3 */ \
- "ld 4, 16(11)\n\t" /* arg2->r4 */ \
- "ld 5, 24(11)\n\t" /* arg3->r5 */ \
- "ld 6, 32(11)\n\t" /* arg4->r6 */ \
- "ld 7, 40(11)\n\t" /* arg5->r7 */ \
- "ld 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "ld 2,-16(11)\n\t" /* restore tocptr */ \
- VG_CONTRACT_FRAME_BY(512) \
+ "subu $29, $29, 8 \n\t" \
+ "sw $gp, 0($sp) \n\t" \
+ "sw $ra, 4($sp) \n\t" \
+ "lw $a0, 20(%1) \n\t" \
+ "subu $sp, $sp, 24\n\t" \
+ "sw $a0, 16($sp) \n\t" \
+ "lw $a0, 4(%1) \n\t" \
+ "lw $a1, 8(%1) \n\t" \
+ "lw $a2, 12(%1) \n\t" \
+ "lw $a3, 16(%1) \n\t" \
+ "lw $t9, 0(%1) \n\t" /* target->t9 */ \
+ VALGRIND_CALL_NOREDIR_T9 \
+ "addu $29, $29, 24 \n\t" \
+ "lw $gp, 0($sp) \n\t" \
+ "lw $ra, 4($sp) \n\t" \
+ "addu $sp, $sp, 8 \n\t" \
+ "move %0, $v0\n" \
: /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
+ : /*in*/ "0" (&_argvec[0]) \
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
-
#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+6]; \
+ volatile unsigned long _argvec[7]; \
volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
- _argvec[2+1] = (unsigned long)arg1; \
- _argvec[2+2] = (unsigned long)arg2; \
- _argvec[2+3] = (unsigned long)arg3; \
- _argvec[2+4] = (unsigned long)arg4; \
- _argvec[2+5] = (unsigned long)arg5; \
- _argvec[2+6] = (unsigned long)arg6; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ _argvec[6] = (unsigned long)(arg6); \
__asm__ volatile( \
- "mr 11,%1\n\t" \
- VG_EXPAND_FRAME_BY_trashes_r3(512) \
- "std 2,-16(11)\n\t" /* save tocptr */ \
- "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
- "ld 3, 8(11)\n\t" /* arg1->r3 */ \
- "ld 4, 16(11)\n\t" /* arg2->r4 */ \
- "ld 5, 24(11)\n\t" /* arg3->r5 */ \
- "ld 6, 32(11)\n\t" /* arg4->r6 */ \
- "ld 7, 40(11)\n\t" /* arg5->r7 */ \
- "ld 8, 48(11)\n\t" /* arg6->r8 */ \
- "ld 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "ld 2,-16(11)\n\t" /* restore tocptr */ \
- VG_CONTRACT_FRAME_BY(512) \
+ "subu $29, $29, 8 \n\t" \
+ "sw $gp, 0($sp) \n\t" \
+ "sw $ra, 4($sp) \n\t" \
+ "lw $a0, 20(%1) \n\t" \
+ "subu $sp, $sp, 32\n\t" \
+ "sw $a0, 16($sp) \n\t" \
+ "lw $a0, 24(%1) \n\t" \
+ "nop\n\t" \
+ "sw $a0, 20($sp) \n\t" \
+ "lw $a0, 4(%1) \n\t" \
+ "lw $a1, 8(%1) \n\t" \
+ "lw $a2, 12(%1) \n\t" \
+ "lw $a3, 16(%1) \n\t" \
+ "lw $t9, 0(%1) \n\t" /* target->t9 */ \
+ VALGRIND_CALL_NOREDIR_T9 \
+ "addu $sp, $sp, 32 \n\t" \
+ "lw $gp, 0($sp) \n\t" \
+ "lw $ra, 4($sp) \n\t" \
+ "addu $sp, $sp, 8 \n\t" \
+ "move %0, $v0\n" \
: /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
+ : /*in*/ "0" (&_argvec[0]) \
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
); \
lval = (__typeof__(lval)) _res; \
arg7) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+7]; \
+ volatile unsigned long _argvec[8]; \
volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
- _argvec[2+1] = (unsigned long)arg1; \
- _argvec[2+2] = (unsigned long)arg2; \
- _argvec[2+3] = (unsigned long)arg3; \
- _argvec[2+4] = (unsigned long)arg4; \
- _argvec[2+5] = (unsigned long)arg5; \
- _argvec[2+6] = (unsigned long)arg6; \
- _argvec[2+7] = (unsigned long)arg7; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ _argvec[6] = (unsigned long)(arg6); \
+ _argvec[7] = (unsigned long)(arg7); \
__asm__ volatile( \
- "mr 11,%1\n\t" \
- VG_EXPAND_FRAME_BY_trashes_r3(512) \
- "std 2,-16(11)\n\t" /* save tocptr */ \
- "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
- "ld 3, 8(11)\n\t" /* arg1->r3 */ \
- "ld 4, 16(11)\n\t" /* arg2->r4 */ \
- "ld 5, 24(11)\n\t" /* arg3->r5 */ \
- "ld 6, 32(11)\n\t" /* arg4->r6 */ \
- "ld 7, 40(11)\n\t" /* arg5->r7 */ \
- "ld 8, 48(11)\n\t" /* arg6->r8 */ \
- "ld 9, 56(11)\n\t" /* arg7->r9 */ \
- "ld 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "ld 2,-16(11)\n\t" /* restore tocptr */ \
- VG_CONTRACT_FRAME_BY(512) \
+ "subu $29, $29, 8 \n\t" \
+ "sw $gp, 0($sp) \n\t" \
+ "sw $ra, 4($sp) \n\t" \
+ "lw $a0, 20(%1) \n\t" \
+ "subu $sp, $sp, 32\n\t" \
+ "sw $a0, 16($sp) \n\t" \
+ "lw $a0, 24(%1) \n\t" \
+ "sw $a0, 20($sp) \n\t" \
+ "lw $a0, 28(%1) \n\t" \
+ "sw $a0, 24($sp) \n\t" \
+ "lw $a0, 4(%1) \n\t" \
+ "lw $a1, 8(%1) \n\t" \
+ "lw $a2, 12(%1) \n\t" \
+ "lw $a3, 16(%1) \n\t" \
+ "lw $t9, 0(%1) \n\t" /* target->t9 */ \
+ VALGRIND_CALL_NOREDIR_T9 \
+ "addu $sp, $sp, 32 \n\t" \
+ "lw $gp, 0($sp) \n\t" \
+ "lw $ra, 4($sp) \n\t" \
+ "addu $sp, $sp, 8 \n\t" \
+ "move %0, $v0\n" \
: /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
+ : /*in*/ "0" (&_argvec[0]) \
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
); \
lval = (__typeof__(lval)) _res; \
arg7,arg8) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+8]; \
+ volatile unsigned long _argvec[9]; \
volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
- _argvec[2+1] = (unsigned long)arg1; \
- _argvec[2+2] = (unsigned long)arg2; \
- _argvec[2+3] = (unsigned long)arg3; \
- _argvec[2+4] = (unsigned long)arg4; \
- _argvec[2+5] = (unsigned long)arg5; \
- _argvec[2+6] = (unsigned long)arg6; \
- _argvec[2+7] = (unsigned long)arg7; \
- _argvec[2+8] = (unsigned long)arg8; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ _argvec[6] = (unsigned long)(arg6); \
+ _argvec[7] = (unsigned long)(arg7); \
+ _argvec[8] = (unsigned long)(arg8); \
__asm__ volatile( \
- "mr 11,%1\n\t" \
- VG_EXPAND_FRAME_BY_trashes_r3(512) \
- "std 2,-16(11)\n\t" /* save tocptr */ \
- "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
- "ld 3, 8(11)\n\t" /* arg1->r3 */ \
- "ld 4, 16(11)\n\t" /* arg2->r4 */ \
- "ld 5, 24(11)\n\t" /* arg3->r5 */ \
- "ld 6, 32(11)\n\t" /* arg4->r6 */ \
- "ld 7, 40(11)\n\t" /* arg5->r7 */ \
- "ld 8, 48(11)\n\t" /* arg6->r8 */ \
- "ld 9, 56(11)\n\t" /* arg7->r9 */ \
- "ld 10, 64(11)\n\t" /* arg8->r10 */ \
- "ld 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "ld 2,-16(11)\n\t" /* restore tocptr */ \
- VG_CONTRACT_FRAME_BY(512) \
+ "subu $29, $29, 8 \n\t" \
+ "sw $gp, 0($sp) \n\t" \
+ "sw $ra, 4($sp) \n\t" \
+ "lw $a0, 20(%1) \n\t" \
+ "subu $sp, $sp, 40\n\t" \
+ "sw $a0, 16($sp) \n\t" \
+ "lw $a0, 24(%1) \n\t" \
+ "sw $a0, 20($sp) \n\t" \
+ "lw $a0, 28(%1) \n\t" \
+ "sw $a0, 24($sp) \n\t" \
+ "lw $a0, 32(%1) \n\t" \
+ "sw $a0, 28($sp) \n\t" \
+ "lw $a0, 4(%1) \n\t" \
+ "lw $a1, 8(%1) \n\t" \
+ "lw $a2, 12(%1) \n\t" \
+ "lw $a3, 16(%1) \n\t" \
+ "lw $t9, 0(%1) \n\t" /* target->t9 */ \
+ VALGRIND_CALL_NOREDIR_T9 \
+ "addu $sp, $sp, 40 \n\t" \
+ "lw $gp, 0($sp) \n\t" \
+ "lw $ra, 4($sp) \n\t" \
+ "addu $sp, $sp, 8 \n\t" \
+ "move %0, $v0\n" \
: /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
+ : /*in*/ "0" (&_argvec[0]) \
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
); \
lval = (__typeof__(lval)) _res; \
arg7,arg8,arg9) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+9]; \
+ volatile unsigned long _argvec[10]; \
volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
- _argvec[2+1] = (unsigned long)arg1; \
- _argvec[2+2] = (unsigned long)arg2; \
- _argvec[2+3] = (unsigned long)arg3; \
- _argvec[2+4] = (unsigned long)arg4; \
- _argvec[2+5] = (unsigned long)arg5; \
- _argvec[2+6] = (unsigned long)arg6; \
- _argvec[2+7] = (unsigned long)arg7; \
- _argvec[2+8] = (unsigned long)arg8; \
- _argvec[2+9] = (unsigned long)arg9; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ _argvec[6] = (unsigned long)(arg6); \
+ _argvec[7] = (unsigned long)(arg7); \
+ _argvec[8] = (unsigned long)(arg8); \
+ _argvec[9] = (unsigned long)(arg9); \
__asm__ volatile( \
- "mr 11,%1\n\t" \
- VG_EXPAND_FRAME_BY_trashes_r3(512) \
- "std 2,-16(11)\n\t" /* save tocptr */ \
- "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
- VG_EXPAND_FRAME_BY_trashes_r3(128) \
- /* arg9 */ \
- "ld 3,72(11)\n\t" \
- "std 3,112(1)\n\t" \
- /* args1-8 */ \
- "ld 3, 8(11)\n\t" /* arg1->r3 */ \
- "ld 4, 16(11)\n\t" /* arg2->r4 */ \
- "ld 5, 24(11)\n\t" /* arg3->r5 */ \
- "ld 6, 32(11)\n\t" /* arg4->r6 */ \
- "ld 7, 40(11)\n\t" /* arg5->r7 */ \
- "ld 8, 48(11)\n\t" /* arg6->r8 */ \
- "ld 9, 56(11)\n\t" /* arg7->r9 */ \
- "ld 10, 64(11)\n\t" /* arg8->r10 */ \
- "ld 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "ld 2,-16(11)\n\t" /* restore tocptr */ \
- VG_CONTRACT_FRAME_BY(128) \
- VG_CONTRACT_FRAME_BY(512) \
+ "subu $29, $29, 8 \n\t" \
+ "sw $gp, 0($sp) \n\t" \
+ "sw $ra, 4($sp) \n\t" \
+ "lw $a0, 20(%1) \n\t" \
+ "subu $sp, $sp, 40\n\t" \
+ "sw $a0, 16($sp) \n\t" \
+ "lw $a0, 24(%1) \n\t" \
+ "sw $a0, 20($sp) \n\t" \
+ "lw $a0, 28(%1) \n\t" \
+ "sw $a0, 24($sp) \n\t" \
+ "lw $a0, 32(%1) \n\t" \
+ "sw $a0, 28($sp) \n\t" \
+ "lw $a0, 36(%1) \n\t" \
+ "sw $a0, 32($sp) \n\t" \
+ "lw $a0, 4(%1) \n\t" \
+ "lw $a1, 8(%1) \n\t" \
+ "lw $a2, 12(%1) \n\t" \
+ "lw $a3, 16(%1) \n\t" \
+ "lw $t9, 0(%1) \n\t" /* target->t9 */ \
+ VALGRIND_CALL_NOREDIR_T9 \
+ "addu $sp, $sp, 40 \n\t" \
+ "lw $gp, 0($sp) \n\t" \
+ "lw $ra, 4($sp) \n\t" \
+ "addu $sp, $sp, 8 \n\t" \
+ "move %0, $v0\n" \
: /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
+ : /*in*/ "0" (&_argvec[0]) \
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
); \
lval = (__typeof__(lval)) _res; \
arg7,arg8,arg9,arg10) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+10]; \
+ volatile unsigned long _argvec[11]; \
volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
- _argvec[2+1] = (unsigned long)arg1; \
- _argvec[2+2] = (unsigned long)arg2; \
- _argvec[2+3] = (unsigned long)arg3; \
- _argvec[2+4] = (unsigned long)arg4; \
- _argvec[2+5] = (unsigned long)arg5; \
- _argvec[2+6] = (unsigned long)arg6; \
- _argvec[2+7] = (unsigned long)arg7; \
- _argvec[2+8] = (unsigned long)arg8; \
- _argvec[2+9] = (unsigned long)arg9; \
- _argvec[2+10] = (unsigned long)arg10; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ _argvec[6] = (unsigned long)(arg6); \
+ _argvec[7] = (unsigned long)(arg7); \
+ _argvec[8] = (unsigned long)(arg8); \
+ _argvec[9] = (unsigned long)(arg9); \
+ _argvec[10] = (unsigned long)(arg10); \
__asm__ volatile( \
- "mr 11,%1\n\t" \
- VG_EXPAND_FRAME_BY_trashes_r3(512) \
- "std 2,-16(11)\n\t" /* save tocptr */ \
- "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
- VG_EXPAND_FRAME_BY_trashes_r3(128) \
- /* arg10 */ \
- "ld 3,80(11)\n\t" \
- "std 3,120(1)\n\t" \
- /* arg9 */ \
- "ld 3,72(11)\n\t" \
- "std 3,112(1)\n\t" \
- /* args1-8 */ \
- "ld 3, 8(11)\n\t" /* arg1->r3 */ \
- "ld 4, 16(11)\n\t" /* arg2->r4 */ \
- "ld 5, 24(11)\n\t" /* arg3->r5 */ \
- "ld 6, 32(11)\n\t" /* arg4->r6 */ \
- "ld 7, 40(11)\n\t" /* arg5->r7 */ \
- "ld 8, 48(11)\n\t" /* arg6->r8 */ \
- "ld 9, 56(11)\n\t" /* arg7->r9 */ \
- "ld 10, 64(11)\n\t" /* arg8->r10 */ \
- "ld 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "ld 2,-16(11)\n\t" /* restore tocptr */ \
- VG_CONTRACT_FRAME_BY(128) \
- VG_CONTRACT_FRAME_BY(512) \
+ "subu $29, $29, 8 \n\t" \
+ "sw $gp, 0($sp) \n\t" \
+ "sw $ra, 4($sp) \n\t" \
+ "lw $a0, 20(%1) \n\t" \
+ "subu $sp, $sp, 48\n\t" \
+ "sw $a0, 16($sp) \n\t" \
+ "lw $a0, 24(%1) \n\t" \
+ "sw $a0, 20($sp) \n\t" \
+ "lw $a0, 28(%1) \n\t" \
+ "sw $a0, 24($sp) \n\t" \
+ "lw $a0, 32(%1) \n\t" \
+ "sw $a0, 28($sp) \n\t" \
+ "lw $a0, 36(%1) \n\t" \
+ "sw $a0, 32($sp) \n\t" \
+ "lw $a0, 40(%1) \n\t" \
+ "sw $a0, 36($sp) \n\t" \
+ "lw $a0, 4(%1) \n\t" \
+ "lw $a1, 8(%1) \n\t" \
+ "lw $a2, 12(%1) \n\t" \
+ "lw $a3, 16(%1) \n\t" \
+ "lw $t9, 0(%1) \n\t" /* target->t9 */ \
+ VALGRIND_CALL_NOREDIR_T9 \
+ "addu $sp, $sp, 48 \n\t" \
+ "lw $gp, 0($sp) \n\t" \
+ "lw $ra, 4($sp) \n\t" \
+ "addu $sp, $sp, 8 \n\t" \
+ "move %0, $v0\n" \
: /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
+ : /*in*/ "0" (&_argvec[0]) \
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
-#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
- arg7,arg8,arg9,arg10,arg11) \
+#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5, \
+ arg6,arg7,arg8,arg9,arg10, \
+ arg11) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+11]; \
+ volatile unsigned long _argvec[12]; \
volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
- _argvec[2+1] = (unsigned long)arg1; \
- _argvec[2+2] = (unsigned long)arg2; \
- _argvec[2+3] = (unsigned long)arg3; \
- _argvec[2+4] = (unsigned long)arg4; \
- _argvec[2+5] = (unsigned long)arg5; \
- _argvec[2+6] = (unsigned long)arg6; \
- _argvec[2+7] = (unsigned long)arg7; \
- _argvec[2+8] = (unsigned long)arg8; \
- _argvec[2+9] = (unsigned long)arg9; \
- _argvec[2+10] = (unsigned long)arg10; \
- _argvec[2+11] = (unsigned long)arg11; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ _argvec[6] = (unsigned long)(arg6); \
+ _argvec[7] = (unsigned long)(arg7); \
+ _argvec[8] = (unsigned long)(arg8); \
+ _argvec[9] = (unsigned long)(arg9); \
+ _argvec[10] = (unsigned long)(arg10); \
+ _argvec[11] = (unsigned long)(arg11); \
__asm__ volatile( \
- "mr 11,%1\n\t" \
- VG_EXPAND_FRAME_BY_trashes_r3(512) \
- "std 2,-16(11)\n\t" /* save tocptr */ \
- "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
- VG_EXPAND_FRAME_BY_trashes_r3(144) \
- /* arg11 */ \
- "ld 3,88(11)\n\t" \
- "std 3,128(1)\n\t" \
- /* arg10 */ \
- "ld 3,80(11)\n\t" \
- "std 3,120(1)\n\t" \
- /* arg9 */ \
- "ld 3,72(11)\n\t" \
- "std 3,112(1)\n\t" \
- /* args1-8 */ \
- "ld 3, 8(11)\n\t" /* arg1->r3 */ \
- "ld 4, 16(11)\n\t" /* arg2->r4 */ \
- "ld 5, 24(11)\n\t" /* arg3->r5 */ \
- "ld 6, 32(11)\n\t" /* arg4->r6 */ \
- "ld 7, 40(11)\n\t" /* arg5->r7 */ \
- "ld 8, 48(11)\n\t" /* arg6->r8 */ \
- "ld 9, 56(11)\n\t" /* arg7->r9 */ \
- "ld 10, 64(11)\n\t" /* arg8->r10 */ \
- "ld 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "ld 2,-16(11)\n\t" /* restore tocptr */ \
- VG_CONTRACT_FRAME_BY(144) \
- VG_CONTRACT_FRAME_BY(512) \
+ "subu $29, $29, 8 \n\t" \
+ "sw $gp, 0($sp) \n\t" \
+ "sw $ra, 4($sp) \n\t" \
+ "lw $a0, 20(%1) \n\t" \
+ "subu $sp, $sp, 48\n\t" \
+ "sw $a0, 16($sp) \n\t" \
+ "lw $a0, 24(%1) \n\t" \
+ "sw $a0, 20($sp) \n\t" \
+ "lw $a0, 28(%1) \n\t" \
+ "sw $a0, 24($sp) \n\t" \
+ "lw $a0, 32(%1) \n\t" \
+ "sw $a0, 28($sp) \n\t" \
+ "lw $a0, 36(%1) \n\t" \
+ "sw $a0, 32($sp) \n\t" \
+ "lw $a0, 40(%1) \n\t" \
+ "sw $a0, 36($sp) \n\t" \
+ "lw $a0, 44(%1) \n\t" \
+ "sw $a0, 40($sp) \n\t" \
+ "lw $a0, 4(%1) \n\t" \
+ "lw $a1, 8(%1) \n\t" \
+ "lw $a2, 12(%1) \n\t" \
+ "lw $a3, 16(%1) \n\t" \
+ "lw $t9, 0(%1) \n\t" /* target->t9 */ \
+ VALGRIND_CALL_NOREDIR_T9 \
+ "addu $sp, $sp, 48 \n\t" \
+ "lw $gp, 0($sp) \n\t" \
+ "lw $ra, 4($sp) \n\t" \
+ "addu $sp, $sp, 8 \n\t" \
+ "move %0, $v0\n" \
: /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
+ : /*in*/ "0" (&_argvec[0]) \
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
-#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
- arg7,arg8,arg9,arg10,arg11,arg12) \
+#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5, \
+ arg6,arg7,arg8,arg9,arg10, \
+ arg11,arg12) \
do { \
volatile OrigFn _orig = (orig); \
- volatile unsigned long _argvec[3+12]; \
+ volatile unsigned long _argvec[13]; \
volatile unsigned long _res; \
- /* _argvec[0] holds current r2 across the call */ \
- _argvec[1] = (unsigned long)_orig.r2; \
- _argvec[2] = (unsigned long)_orig.nraddr; \
- _argvec[2+1] = (unsigned long)arg1; \
- _argvec[2+2] = (unsigned long)arg2; \
- _argvec[2+3] = (unsigned long)arg3; \
- _argvec[2+4] = (unsigned long)arg4; \
- _argvec[2+5] = (unsigned long)arg5; \
- _argvec[2+6] = (unsigned long)arg6; \
- _argvec[2+7] = (unsigned long)arg7; \
- _argvec[2+8] = (unsigned long)arg8; \
- _argvec[2+9] = (unsigned long)arg9; \
- _argvec[2+10] = (unsigned long)arg10; \
- _argvec[2+11] = (unsigned long)arg11; \
- _argvec[2+12] = (unsigned long)arg12; \
+ _argvec[0] = (unsigned long)_orig.nraddr; \
+ _argvec[1] = (unsigned long)(arg1); \
+ _argvec[2] = (unsigned long)(arg2); \
+ _argvec[3] = (unsigned long)(arg3); \
+ _argvec[4] = (unsigned long)(arg4); \
+ _argvec[5] = (unsigned long)(arg5); \
+ _argvec[6] = (unsigned long)(arg6); \
+ _argvec[7] = (unsigned long)(arg7); \
+ _argvec[8] = (unsigned long)(arg8); \
+ _argvec[9] = (unsigned long)(arg9); \
+ _argvec[10] = (unsigned long)(arg10); \
+ _argvec[11] = (unsigned long)(arg11); \
+ _argvec[12] = (unsigned long)(arg12); \
__asm__ volatile( \
- "mr 11,%1\n\t" \
- VG_EXPAND_FRAME_BY_trashes_r3(512) \
- "std 2,-16(11)\n\t" /* save tocptr */ \
- "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \
- VG_EXPAND_FRAME_BY_trashes_r3(144) \
- /* arg12 */ \
- "ld 3,96(11)\n\t" \
- "std 3,136(1)\n\t" \
- /* arg11 */ \
- "ld 3,88(11)\n\t" \
- "std 3,128(1)\n\t" \
- /* arg10 */ \
- "ld 3,80(11)\n\t" \
- "std 3,120(1)\n\t" \
- /* arg9 */ \
- "ld 3,72(11)\n\t" \
- "std 3,112(1)\n\t" \
- /* args1-8 */ \
- "ld 3, 8(11)\n\t" /* arg1->r3 */ \
- "ld 4, 16(11)\n\t" /* arg2->r4 */ \
- "ld 5, 24(11)\n\t" /* arg3->r5 */ \
- "ld 6, 32(11)\n\t" /* arg4->r6 */ \
- "ld 7, 40(11)\n\t" /* arg5->r7 */ \
- "ld 8, 48(11)\n\t" /* arg6->r8 */ \
- "ld 9, 56(11)\n\t" /* arg7->r9 */ \
- "ld 10, 64(11)\n\t" /* arg8->r10 */ \
- "ld 11, 0(11)\n\t" /* target->r11 */ \
- VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
- "mr 11,%1\n\t" \
- "mr %0,3\n\t" \
- "ld 2,-16(11)\n\t" /* restore tocptr */ \
- VG_CONTRACT_FRAME_BY(144) \
- VG_CONTRACT_FRAME_BY(512) \
+ "subu $29, $29, 8 \n\t" \
+ "sw $gp, 0($sp) \n\t" \
+ "sw $ra, 4($sp) \n\t" \
+ "lw $a0, 20(%1) \n\t" \
+ "subu $sp, $sp, 56\n\t" \
+ "sw $a0, 16($sp) \n\t" \
+ "lw $a0, 24(%1) \n\t" \
+ "sw $a0, 20($sp) \n\t" \
+ "lw $a0, 28(%1) \n\t" \
+ "sw $a0, 24($sp) \n\t" \
+ "lw $a0, 32(%1) \n\t" \
+ "sw $a0, 28($sp) \n\t" \
+ "lw $a0, 36(%1) \n\t" \
+ "sw $a0, 32($sp) \n\t" \
+ "lw $a0, 40(%1) \n\t" \
+ "sw $a0, 36($sp) \n\t" \
+ "lw $a0, 44(%1) \n\t" \
+ "sw $a0, 40($sp) \n\t" \
+ "lw $a0, 48(%1) \n\t" \
+ "sw $a0, 44($sp) \n\t" \
+ "lw $a0, 4(%1) \n\t" \
+ "lw $a1, 8(%1) \n\t" \
+ "lw $a2, 12(%1) \n\t" \
+ "lw $a3, 16(%1) \n\t" \
+ "lw $t9, 0(%1) \n\t" /* target->t9 */ \
+ VALGRIND_CALL_NOREDIR_T9 \
+ "addu $sp, $sp, 56 \n\t" \
+ "lw $gp, 0($sp) \n\t" \
+ "lw $ra, 4($sp) \n\t" \
+ "addu $sp, $sp, 8 \n\t" \
+ "move %0, $v0\n" \
: /*out*/ "=r" (_res) \
- : /*in*/ "r" (&_argvec[2]) \
+ : /*in*/ "0" (&_argvec[0]) \
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
-#endif /* PLAT_ppc64_aix5 */
+#endif /* PLAT_mips32_linux */
/* ------------------------------------------------------------------ */
errors. */
VG_USERREQ__COUNT_ERRORS = 0x1201,
+ /* Allows a string (gdb monitor command) to be passed to the tool
+ Used for interaction with vgdb/gdb */
+ VG_USERREQ__GDB_MONITOR_COMMAND = 0x1202,
+
/* These are useful and can be interpreted by any tool that
tracks malloc() et al, by using vg_replace_malloc.c. */
VG_USERREQ__MALLOCLIKE_BLOCK = 0x1301,
+ VG_USERREQ__RESIZEINPLACE_BLOCK = 0x130b,
VG_USERREQ__FREELIKE_BLOCK = 0x1302,
/* Memory pool support. */
VG_USERREQ__CREATE_MEMPOOL = 0x1303,
VG_USERREQ__MEMPOOL_EXISTS = 0x130a,
/* Allow printfs to valgrind log. */
+ /* The first two pass the va_list argument by value, which
+ assumes it is the same size as or smaller than a UWord,
+ which generally isn't the case. Hence are deprecated.
+ The second two pass the vargs by reference and so are
+ immune to this problem. */
+ /* both :: char* fmt, va_list vargs (DEPRECATED) */
VG_USERREQ__PRINTF = 0x1401,
VG_USERREQ__PRINTF_BACKTRACE = 0x1402,
+ /* both :: char* fmt, va_list* vargs */
+ VG_USERREQ__PRINTF_VALIST_BY_REF = 0x1403,
+ VG_USERREQ__PRINTF_BACKTRACE_VALIST_BY_REF = 0x1404,
/* Stack support. */
VG_USERREQ__STACK_REGISTER = 0x1501,
VG_USERREQ__STACK_CHANGE = 0x1503,
/* Wine support */
- VG_USERREQ__LOAD_PDB_DEBUGINFO = 0x1601
+ VG_USERREQ__LOAD_PDB_DEBUGINFO = 0x1601,
+
+ /* Querying of debug info. */
+ VG_USERREQ__MAP_IP_TO_SRCLOC = 0x1701,
+
+ /* Disable/enable error reporting level. Takes a single
+ Word arg which is the delta to this thread's error
+ disablement indicator. Hence 1 disables or further
+ disables errors, and -1 moves back towards enablement.
+ Other values are not allowed. */
+ VG_USERREQ__CHANGE_ERR_DISABLEMENT = 0x1801,
+
+ /* Initialise IR injection */
+ VG_USERREQ__VEX_INIT_FOR_IRI = 0x1901
} Vg_ClientRequest;
#if !defined(__GNUC__)
# define __extension__ /* */
#endif
+
/* Returns the number of Valgrinds this code is running under. That
is, 0 if running natively, 1 if running under Valgrind, 2 if
running under Valgrind which is running under another Valgrind,
etc. */
-#if defined(HOST_WIN32) || defined(TARGET_WIN32)
-#define RUNNING_ON_VALGRIND 0
-#else
-#define RUNNING_ON_VALGRIND __extension__ \
- ({unsigned int _qzz_res; \
- VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* if not */, \
- VG_USERREQ__RUNNING_ON_VALGRIND, \
- 0, 0, 0, 0, 0); \
- _qzz_res; \
- })
-#endif
+#define RUNNING_ON_VALGRIND \
+ (unsigned)VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* if not */, \
+ VG_USERREQ__RUNNING_ON_VALGRIND, \
+ 0, 0, 0, 0, 0) \
+
/* Discard translation of code in the range [_qzz_addr .. _qzz_addr +
_qzz_len - 1]. Useful if you are debugging a JITter or some such,
since it provides a way to make sure valgrind will retranslate the
invalidated area. Returns no value. */
-#define VALGRIND_DISCARD_TRANSLATIONS(_qzz_addr,_qzz_len) \
- {unsigned int _qzz_res; \
- VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
- VG_USERREQ__DISCARD_TRANSLATIONS, \
- _qzz_addr, _qzz_len, 0, 0, 0); \
- }
+#define VALGRIND_DISCARD_TRANSLATIONS(_qzz_addr,_qzz_len) \
+ VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__DISCARD_TRANSLATIONS, \
+ _qzz_addr, _qzz_len, 0, 0, 0)
/* These requests are for getting Valgrind itself to print something.
is the number of characters printed, excluding the "**<pid>** " part at the
start and the backtrace (if present). */
-#if defined(NVALGRIND)
-
-# define VALGRIND_PRINTF(...)
-# define VALGRIND_PRINTF_BACKTRACE(...)
-
-#else /* NVALGRIND */
-
+#if defined(__GNUC__) || defined(__INTEL_COMPILER) && !defined(_MSC_VER)
/* Modern GCC will optimize the static routine out if unused,
and unused attribute will shut down warnings about it. */
static int VALGRIND_PRINTF(const char *format, ...)
__attribute__((format(__printf__, 1, 2), __unused__));
+#endif
static int
+#if defined(_MSC_VER)
+__inline
+#endif
VALGRIND_PRINTF(const char *format, ...)
{
+#if defined(NVALGRIND)
+ return 0;
+#else /* NVALGRIND */
+#if defined(_MSC_VER)
+ uintptr_t _qzz_res;
+#else
unsigned long _qzz_res;
+#endif
va_list vargs;
va_start(vargs, format);
- VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, VG_USERREQ__PRINTF,
- (unsigned long)format, (unsigned long)vargs,
+#if defined(_MSC_VER)
+ _qzz_res = VALGRIND_DO_CLIENT_REQUEST_EXPR(0,
+ VG_USERREQ__PRINTF_VALIST_BY_REF,
+ (uintptr_t)format,
+ (uintptr_t)&vargs,
+ 0, 0, 0);
+#else
+ _qzz_res = VALGRIND_DO_CLIENT_REQUEST_EXPR(0,
+ VG_USERREQ__PRINTF_VALIST_BY_REF,
+ (unsigned long)format,
+ (unsigned long)&vargs,
0, 0, 0);
+#endif
va_end(vargs);
return (int)_qzz_res;
+#endif /* NVALGRIND */
}
+#if defined(__GNUC__) || defined(__INTEL_COMPILER) && !defined(_MSC_VER)
static int VALGRIND_PRINTF_BACKTRACE(const char *format, ...)
__attribute__((format(__printf__, 1, 2), __unused__));
+#endif
static int
+#if defined(_MSC_VER)
+__inline
+#endif
VALGRIND_PRINTF_BACKTRACE(const char *format, ...)
{
+#if defined(NVALGRIND)
+ return 0;
+#else /* NVALGRIND */
+#if defined(_MSC_VER)
+ uintptr_t _qzz_res;
+#else
unsigned long _qzz_res;
+#endif
va_list vargs;
va_start(vargs, format);
- VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, VG_USERREQ__PRINTF_BACKTRACE,
- (unsigned long)format, (unsigned long)vargs,
+#if defined(_MSC_VER)
+ _qzz_res = VALGRIND_DO_CLIENT_REQUEST_EXPR(0,
+ VG_USERREQ__PRINTF_BACKTRACE_VALIST_BY_REF,
+ (uintptr_t)format,
+ (uintptr_t)&vargs,
+ 0, 0, 0);
+#else
+ _qzz_res = VALGRIND_DO_CLIENT_REQUEST_EXPR(0,
+ VG_USERREQ__PRINTF_BACKTRACE_VALIST_BY_REF,
+ (unsigned long)format,
+ (unsigned long)&vargs,
0, 0, 0);
+#endif
va_end(vargs);
return (int)_qzz_res;
-}
-
#endif /* NVALGRIND */
+}
/* These requests allow control to move from the simulated CPU to the
with a lot in the past.
*/
#define VALGRIND_NON_SIMD_CALL0(_qyy_fn) \
- __extension__ \
- ({unsigned long _qyy_res; \
- VALGRIND_DO_CLIENT_REQUEST(_qyy_res, 0 /* default return */, \
- VG_USERREQ__CLIENT_CALL0, \
- _qyy_fn, \
- 0, 0, 0, 0); \
- _qyy_res; \
- })
-
-#define VALGRIND_NON_SIMD_CALL1(_qyy_fn, _qyy_arg1) \
- __extension__ \
- ({unsigned long _qyy_res; \
- VALGRIND_DO_CLIENT_REQUEST(_qyy_res, 0 /* default return */, \
- VG_USERREQ__CLIENT_CALL1, \
- _qyy_fn, \
- _qyy_arg1, 0, 0, 0); \
- _qyy_res; \
- })
-
-#define VALGRIND_NON_SIMD_CALL2(_qyy_fn, _qyy_arg1, _qyy_arg2) \
- __extension__ \
- ({unsigned long _qyy_res; \
- VALGRIND_DO_CLIENT_REQUEST(_qyy_res, 0 /* default return */, \
- VG_USERREQ__CLIENT_CALL2, \
- _qyy_fn, \
- _qyy_arg1, _qyy_arg2, 0, 0); \
- _qyy_res; \
- })
+ VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */, \
+ VG_USERREQ__CLIENT_CALL0, \
+ _qyy_fn, \
+ 0, 0, 0, 0)
+
+#define VALGRIND_NON_SIMD_CALL1(_qyy_fn, _qyy_arg1) \
+ VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */, \
+ VG_USERREQ__CLIENT_CALL1, \
+ _qyy_fn, \
+ _qyy_arg1, 0, 0, 0)
+
+#define VALGRIND_NON_SIMD_CALL2(_qyy_fn, _qyy_arg1, _qyy_arg2) \
+ VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */, \
+ VG_USERREQ__CLIENT_CALL2, \
+ _qyy_fn, \
+ _qyy_arg1, _qyy_arg2, 0, 0)
#define VALGRIND_NON_SIMD_CALL3(_qyy_fn, _qyy_arg1, _qyy_arg2, _qyy_arg3) \
- __extension__ \
- ({unsigned long _qyy_res; \
- VALGRIND_DO_CLIENT_REQUEST(_qyy_res, 0 /* default return */, \
- VG_USERREQ__CLIENT_CALL3, \
- _qyy_fn, \
- _qyy_arg1, _qyy_arg2, \
- _qyy_arg3, 0); \
- _qyy_res; \
- })
+ VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */, \
+ VG_USERREQ__CLIENT_CALL3, \
+ _qyy_fn, \
+ _qyy_arg1, _qyy_arg2, \
+ _qyy_arg3, 0)
/* Counts the number of errors that have been recorded by a tool. Nb:
the tool must record the errors with VG_(maybe_record_error)() or
VG_(unique_error)() for them to be counted. */
#define VALGRIND_COUNT_ERRORS \
- __extension__ \
- ({unsigned int _qyy_res; \
- VALGRIND_DO_CLIENT_REQUEST(_qyy_res, 0 /* default return */, \
+ (unsigned)VALGRIND_DO_CLIENT_REQUEST_EXPR( \
+ 0 /* default return */, \
VG_USERREQ__COUNT_ERRORS, \
- 0, 0, 0, 0, 0); \
- _qyy_res; \
- })
+ 0, 0, 0, 0, 0)
/* Several Valgrind tools (Memcheck, Massif, Helgrind, DRD) rely on knowing
when heap blocks are allocated in order to give accurate results. This
VALGRIND_FREELIKE_BLOCK should be put immediately after the point where a
heap block is deallocated.
- In many cases, these two client requests will not be enough to get your
+ VALGRIND_RESIZEINPLACE_BLOCK informs a tool about reallocation. For
+ Memcheck, it does four things:
+
+ - It records that the size of a block has been changed. This assumes that
+ the block was annotated as having been allocated via
+ VALGRIND_MALLOCLIKE_BLOCK. Otherwise, an error will be issued.
+
+ - If the block shrunk, it marks the freed memory as being unaddressable.
+
+ - If the block grew, it marks the new area as undefined and defines a red
+ zone past the end of the new block.
+
+ - The V-bits of the overlap between the old and the new block are preserved.
+
+ VALGRIND_RESIZEINPLACE_BLOCK should be put after allocation of the new block
+ and before deallocation of the old block.
+
+ In many cases, these three client requests will not be enough to get your
allocator working well with Memcheck. More specifically, if your allocator
writes to freed blocks in any way then a VALGRIND_MAKE_MEM_UNDEFINED call
will be necessary to mark the memory as addressable just before the zeroing
understand the distinction between the allocator and the rest of the
program.
- Note: there is currently no VALGRIND_REALLOCLIKE_BLOCK client request; it
- has to be emulated with MALLOCLIKE/FREELIKE and memory copying.
-
Ignored if addr == 0.
*/
-#define VALGRIND_MALLOCLIKE_BLOCK(addr, sizeB, rzB, is_zeroed) \
- {unsigned int _qzz_res; \
- VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
- VG_USERREQ__MALLOCLIKE_BLOCK, \
- addr, sizeB, rzB, is_zeroed, 0); \
- }
+#define VALGRIND_MALLOCLIKE_BLOCK(addr, sizeB, rzB, is_zeroed) \
+ VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__MALLOCLIKE_BLOCK, \
+ addr, sizeB, rzB, is_zeroed, 0)
/* See the comment for VALGRIND_MALLOCLIKE_BLOCK for details.
Ignored if addr == 0.
*/
-#define VALGRIND_FREELIKE_BLOCK(addr, rzB) \
- {unsigned int _qzz_res; \
- VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
- VG_USERREQ__FREELIKE_BLOCK, \
- addr, rzB, 0, 0, 0); \
- }
+#define VALGRIND_RESIZEINPLACE_BLOCK(addr, oldSizeB, newSizeB, rzB) \
+ VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__RESIZEINPLACE_BLOCK, \
+ addr, oldSizeB, newSizeB, rzB, 0)
+
+/* See the comment for VALGRIND_MALLOCLIKE_BLOCK for details.
+ Ignored if addr == 0.
+*/
+#define VALGRIND_FREELIKE_BLOCK(addr, rzB) \
+ VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__FREELIKE_BLOCK, \
+ addr, rzB, 0, 0, 0)
/* Create a memory pool. */
#define VALGRIND_CREATE_MEMPOOL(pool, rzB, is_zeroed) \
- {unsigned int _qzz_res; \
- VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
- VG_USERREQ__CREATE_MEMPOOL, \
- pool, rzB, is_zeroed, 0, 0); \
- }
+ VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__CREATE_MEMPOOL, \
+ pool, rzB, is_zeroed, 0, 0)
/* Destroy a memory pool. */
#define VALGRIND_DESTROY_MEMPOOL(pool) \
- {unsigned int _qzz_res; \
- VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
- VG_USERREQ__DESTROY_MEMPOOL, \
- pool, 0, 0, 0, 0); \
- }
+ VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__DESTROY_MEMPOOL, \
+ pool, 0, 0, 0, 0)
/* Associate a piece of memory with a memory pool. */
#define VALGRIND_MEMPOOL_ALLOC(pool, addr, size) \
- {unsigned int _qzz_res; \
- VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
- VG_USERREQ__MEMPOOL_ALLOC, \
- pool, addr, size, 0, 0); \
- }
+ VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__MEMPOOL_ALLOC, \
+ pool, addr, size, 0, 0)
/* Disassociate a piece of memory from a memory pool. */
#define VALGRIND_MEMPOOL_FREE(pool, addr) \
- {unsigned int _qzz_res; \
- VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
- VG_USERREQ__MEMPOOL_FREE, \
- pool, addr, 0, 0, 0); \
- }
+ VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__MEMPOOL_FREE, \
+ pool, addr, 0, 0, 0)
/* Disassociate any pieces outside a particular range. */
#define VALGRIND_MEMPOOL_TRIM(pool, addr, size) \
- {unsigned int _qzz_res; \
- VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
- VG_USERREQ__MEMPOOL_TRIM, \
- pool, addr, size, 0, 0); \
- }
+ VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__MEMPOOL_TRIM, \
+ pool, addr, size, 0, 0)
/* Resize and/or move a piece associated with a memory pool. */
#define VALGRIND_MOVE_MEMPOOL(poolA, poolB) \
- {unsigned int _qzz_res; \
- VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
- VG_USERREQ__MOVE_MEMPOOL, \
- poolA, poolB, 0, 0, 0); \
- }
+ VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__MOVE_MEMPOOL, \
+ poolA, poolB, 0, 0, 0)
/* Resize and/or move a piece associated with a memory pool. */
#define VALGRIND_MEMPOOL_CHANGE(pool, addrA, addrB, size) \
- {unsigned int _qzz_res; \
- VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
- VG_USERREQ__MEMPOOL_CHANGE, \
- pool, addrA, addrB, size, 0); \
- }
+ VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__MEMPOOL_CHANGE, \
+ pool, addrA, addrB, size, 0)
/* Return 1 if a mempool exists, else 0. */
#define VALGRIND_MEMPOOL_EXISTS(pool) \
- __extension__ \
- ({unsigned int _qzz_res; \
- VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ (unsigned)VALGRIND_DO_CLIENT_REQUEST_EXPR(0, \
VG_USERREQ__MEMPOOL_EXISTS, \
- pool, 0, 0, 0, 0); \
- _qzz_res; \
- })
+ pool, 0, 0, 0, 0)
/* Mark a piece of memory as being a stack. Returns a stack id. */
#define VALGRIND_STACK_REGISTER(start, end) \
- __extension__ \
- ({unsigned int _qzz_res; \
- VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
+ (unsigned)VALGRIND_DO_CLIENT_REQUEST_EXPR(0, \
VG_USERREQ__STACK_REGISTER, \
- start, end, 0, 0, 0); \
- _qzz_res; \
- })
+ start, end, 0, 0, 0)
/* Unmark the piece of memory associated with a stack id as being a
stack. */
#define VALGRIND_STACK_DEREGISTER(id) \
- {unsigned int _qzz_res; \
- VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
- VG_USERREQ__STACK_DEREGISTER, \
- id, 0, 0, 0, 0); \
- }
+ VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__STACK_DEREGISTER, \
+ id, 0, 0, 0, 0)
/* Change the start and end address of the stack id. */
#define VALGRIND_STACK_CHANGE(id, start, end) \
- {unsigned int _qzz_res; \
- VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
- VG_USERREQ__STACK_CHANGE, \
- id, start, end, 0, 0); \
- }
+ VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__STACK_CHANGE, \
+ id, start, end, 0, 0)
/* Load PDB debug info for Wine PE image_map. */
-#define VALGRIND_LOAD_PDB_DEBUGINFO(fd, ptr, total_size, delta) \
- {unsigned int _qzz_res; \
- VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
- VG_USERREQ__LOAD_PDB_DEBUGINFO, \
- fd, ptr, total_size, delta, 0); \
- }
-
-
+#define VALGRIND_LOAD_PDB_DEBUGINFO(fd, ptr, total_size, delta) \
+ VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__LOAD_PDB_DEBUGINFO, \
+ fd, ptr, total_size, delta, 0)
+
+/* Map a code address to a source file name and line number. buf64
+ must point to a 64-byte buffer in the caller's address space. The
+ result will be dumped in there and is guaranteed to be zero
+ terminated. If no info is found, the first byte is set to zero. */
+#define VALGRIND_MAP_IP_TO_SRCLOC(addr, buf64) \
+ (unsigned)VALGRIND_DO_CLIENT_REQUEST_EXPR(0, \
+ VG_USERREQ__MAP_IP_TO_SRCLOC, \
+ addr, buf64, 0, 0, 0)
+
+/* Disable error reporting for this thread. Behaves in a stack like
+ way, so you can safely call this multiple times provided that
+ VALGRIND_ENABLE_ERROR_REPORTING is called the same number of times
+ to re-enable reporting. The first call of this macro disables
+ reporting. Subsequent calls have no effect except to increase the
+ number of VALGRIND_ENABLE_ERROR_REPORTING calls needed to re-enable
+ reporting. Child threads do not inherit this setting from their
+ parents -- they are always created with reporting enabled. */
+#define VALGRIND_DISABLE_ERROR_REPORTING \
+ VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__CHANGE_ERR_DISABLEMENT, \
+ 1, 0, 0, 0, 0)
+
+/* Re-enable error reporting, as per comments on
+ VALGRIND_DISABLE_ERROR_REPORTING. */
+#define VALGRIND_ENABLE_ERROR_REPORTING \
+ VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__CHANGE_ERR_DISABLEMENT, \
+ -1, 0, 0, 0, 0)
+
+#undef PLAT_x86_darwin
+#undef PLAT_amd64_darwin
+#undef PLAT_x86_win32
#undef PLAT_x86_linux
#undef PLAT_amd64_linux
#undef PLAT_ppc32_linux
#undef PLAT_ppc64_linux
-#undef PLAT_ppc32_aix5
-#undef PLAT_ppc64_aix5
+#undef PLAT_arm_linux
+#undef PLAT_s390x_linux
+#undef PLAT_mips32_linux
-#else /* __GNUC__ */
-#define RUNNING_ON_VALGRIND 0
-#endif
#endif /* __VALGRIND_H */
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: http://www.mono-project.com/Bugs\n"
-"POT-Creation-Date: 2012-05-30 18:30+0100\n"
+"POT-Creation-Date: 2012-12-05 09:29+0100\n"
"PO-Revision-Date: 2008-09-26 15:14+0100\n"
"Last-Translator: Daniel Nauck <dna@mono-project.de>\n"
"Language-Team: http://www.mono-project.de\n"
"mismatch"
msgstr ""
-#: mcs/mcs/anonymous.cs:1027 mcs/mcs/ecore.cs:4913
+#: mcs/mcs/anonymous.cs:1027 mcs/mcs/ecore.cs:5056
#, csharp-format
msgid "Delegate `{0}' does not take `{1}' arguments"
msgstr ""
msgid "Parameter `{0}' is declared as type `{1}' but should be `{2}'"
msgstr ""
-#: mcs/mcs/anonymous.cs:1202
+#: mcs/mcs/anonymous.cs:1212
msgid "Async lambda expressions cannot be converted to expression trees"
msgstr ""
-#: mcs/mcs/anonymous.cs:1240
+#: mcs/mcs/anonymous.cs:1250
msgid "An anonymous method cannot be converted to an expression tree"
msgstr ""
-#: mcs/mcs/anonymous.cs:1259
+#: mcs/mcs/anonymous.cs:1269
#, csharp-format
msgid ""
"Cannot convert anonymous method block without a parameter list to delegate "
"type `{0}' because it has one or more `out' parameters"
msgstr ""
-#: mcs/mcs/anonymous.cs:1283
+#: mcs/mcs/anonymous.cs:1293
msgid ""
"Anonymous methods and lambda expressions cannot be used in the current "
"context"
msgstr ""
-#: mcs/mcs/anonymous.cs:1326
+#: mcs/mcs/anonymous.cs:1336
#, csharp-format
msgid ""
"Local variable or parameter `{0}' cannot have their address taken and be "
"used inside an anonymous method, lambda expression or query expression"
msgstr ""
-#: mcs/mcs/anonymous.cs:1346
+#: mcs/mcs/anonymous.cs:1356
#, fuzzy, csharp-format
msgid "Cannot convert async {0} to delegate type `{1}'"
msgstr "Kann Typ `{0}'<...> nicht finden"
-#: mcs/mcs/anonymous.cs:1596
+#: mcs/mcs/anonymous.cs:1594
msgid "An expression tree cannot contain an anonymous method expression"
msgstr ""
-#: mcs/mcs/anonymous.cs:1879
+#: mcs/mcs/anonymous.cs:1877
#, csharp-format
msgid ""
"`{0}': An anonymous type cannot have multiple properties with the same name"
msgid "Cannot assign to `{0}' because it is a `{1}'"
msgstr ""
-#: mcs/mcs/assembly.cs:286
+#: mcs/mcs/assembly.cs:279
msgid "Invalid type specified as an argument for TypeForwardedTo attribute"
msgstr ""
-#: mcs/mcs/assembly.cs:294
+#: mcs/mcs/assembly.cs:287
#, csharp-format
msgid "A duplicate type forward of type `{0}'"
msgstr ""
-#: mcs/mcs/assembly.cs:303
+#: mcs/mcs/assembly.cs:296
#, fuzzy, csharp-format
msgid "Cannot forward type `{0}' because it is defined in this assembly"
msgstr ""
"NULL kann nicht in `{0}' konvertiert werden, da dies ein Werttyp ist, der "
"nicht auf NULL festgelegt werden kann"
-#: mcs/mcs/assembly.cs:309
+#: mcs/mcs/assembly.cs:302
#, fuzzy, csharp-format
msgid "Cannot forward type `{0}' because it is a nested type"
msgstr ""
"NULL kann nicht in `{0}' konvertiert werden, da dies ein Werttyp ist, der "
"nicht auf NULL festgelegt werden kann"
-#: mcs/mcs/assembly.cs:338
+#: mcs/mcs/assembly.cs:331
#, csharp-format
msgid ""
"Friend assembly reference `{0}' is invalid. InternalsVisibleTo declarations "
"cannot have a version, culture or processor architecture specified"
msgstr ""
-#: mcs/mcs/assembly.cs:346
+#: mcs/mcs/assembly.cs:339
#, csharp-format
msgid ""
"Friend assembly reference `{0}' is invalid. Strong named assemblies must "
"specify a public key in their InternalsVisibleTo declarations"
msgstr ""
-#: mcs/mcs/assembly.cs:381
+#: mcs/mcs/assembly.cs:374
#, csharp-format
msgid "Referenced assembly `{0}' does not have a strong name"
msgstr ""
-#: mcs/mcs/assembly.cs:387
+#: mcs/mcs/assembly.cs:380
#, csharp-format
msgid "Referenced assembly `{0}' has different culture setting of `{1}'"
msgstr ""
-#: mcs/mcs/assembly.cs:402
+#: mcs/mcs/assembly.cs:395
#, csharp-format
msgid ""
"Friend access was granted to `{0}', but the output assembly is named `{1}'. "
"it"
msgstr ""
-#: mcs/mcs/assembly.cs:416
+#: mcs/mcs/assembly.cs:409
msgid ""
"Could not sign the assembly. ECMA key can only be used to delay-sign "
"assemblies"
msgstr ""
-#: mcs/mcs/assembly.cs:657
+#: mcs/mcs/assembly.cs:650
msgid ""
"Added modules must be marked with the CLSCompliant attribute to match the "
"assembly"
msgstr ""
-#: mcs/mcs/assembly.cs:692 mcs/mcs/assembly.cs:707
+#: mcs/mcs/assembly.cs:685 mcs/mcs/assembly.cs:700
#, csharp-format
msgid ""
"Option `{0}' overrides attribute `{1}' given in a source file or added module"
msgstr ""
-#: mcs/mcs/assembly.cs:742
+#: mcs/mcs/assembly.cs:735
msgid "Delay signing was requested but no key file was given"
msgstr ""
-#: mcs/mcs/assembly.cs:763
+#: mcs/mcs/assembly.cs:756
msgid "Cannot link resource file when building a module"
msgstr ""
-#: mcs/mcs/assembly.cs:768
+#: mcs/mcs/assembly.cs:761
#, fuzzy, csharp-format
msgid "Error reading resource file `{0}'"
msgstr "Fehler beim erstellen der XML-Dokumentationsdatei `{0}' (`{1}')"
-#: mcs/mcs/assembly.cs:838
+#: mcs/mcs/assembly.cs:831
msgid "Could not write to file `"
msgstr ""
-#: mcs/mcs/assembly.cs:882
+#: mcs/mcs/assembly.cs:875
msgid "Cannot specify -main if building a module or library"
msgstr ""
-#: mcs/mcs/assembly.cs:908
+#: mcs/mcs/assembly.cs:901
#, csharp-format
msgid "Could not find `{0}' specified for Main method"
msgstr ""
-#: mcs/mcs/assembly.cs:914
+#: mcs/mcs/assembly.cs:907
#, fuzzy, csharp-format
msgid "`{0}' specified for Main method must be a valid class or struct"
msgstr "`{0}': Erweiterungsmethoden müssen statisch sein"
-#: mcs/mcs/assembly.cs:918
+#: mcs/mcs/assembly.cs:911
#, csharp-format
msgid "`{0}' does not have a suitable static Main method"
msgstr ""
-#: mcs/mcs/assembly.cs:921
+#: mcs/mcs/assembly.cs:914
#, csharp-format
msgid ""
"Program `{0}' does not contain a static `Main' method suitable for an entry "
"point"
msgstr ""
-#: mcs/mcs/assembly.cs:940
+#: mcs/mcs/assembly.cs:933
msgid "Error during assembly signing. "
msgstr ""
-#: mcs/mcs/assembly.cs:1125
+#: mcs/mcs/assembly.cs:1118
#, csharp-format
msgid "Metadata file `{0}' could not be found"
msgstr ""
-#: mcs/mcs/assembly.cs:1130
+#: mcs/mcs/assembly.cs:1123
#, csharp-format
msgid "Metadata file `{0}' does not contain valid metadata"
msgstr ""
-#: mcs/mcs/assembly.cs:1136
+#: mcs/mcs/assembly.cs:1129
#, csharp-format
msgid ""
"Referenced assembly file `{0}' is a module. Consider using `-addmodule' "
"option to add the module"
msgstr ""
-#: mcs/mcs/assembly.cs:1143
+#: mcs/mcs/assembly.cs:1136
#, csharp-format
msgid ""
"Added module file `{0}' is an assembly. Consider using `-r' option to "
"reference the file"
msgstr ""
-#: mcs/mcs/async.cs:70
+#: mcs/mcs/async.cs:72
#, fuzzy
msgid "The `await' operator cannot be used in the body of a lock statement"
msgstr ""
"Die `new()'-Einschränkung kann nicht mit der `struct'-Einschränkung genutzt "
"werden"
-#: mcs/mcs/async.cs:75
+#: mcs/mcs/async.cs:77
#, fuzzy
msgid "The `await' operator cannot be used in an unsafe context"
msgstr ""
"Die `new()'-Einschränkung kann nicht mit der `struct'-Einschränkung genutzt "
"werden"
-#: mcs/mcs/async.cs:140
+#: mcs/mcs/async.cs:142
#, csharp-format
msgid ""
"Cannot await void method `{0}'. Consider changing method return type to "
"`Task'"
msgstr ""
-#: mcs/mcs/async.cs:143
+#: mcs/mcs/async.cs:145
#, csharp-format
msgid "Cannot await `{0}' expression"
msgstr ""
-#: mcs/mcs/async.cs:293
+#: mcs/mcs/async.cs:291
#, csharp-format
msgid ""
"The awaiter type `{0}' must have suitable IsCompleted and GetResult members"
msgstr ""
-#: mcs/mcs/async.cs:301
+#: mcs/mcs/async.cs:299
msgid ""
"The `await' operator may only be used in a query expression within the first "
"collection expression of the initial `from' clause or within the collection "
"expression of a `join' clause"
msgstr ""
-#: mcs/mcs/async.cs:335
+#: mcs/mcs/async.cs:333
#, csharp-format
msgid "The `await' operand type `{0}' must have suitable GetAwaiter method"
msgstr ""
-#: mcs/mcs/async.cs:374
+#: mcs/mcs/async.cs:372
#, fuzzy, csharp-format
msgid "The awaiter type `{0}' must implement interface `{1}'"
msgstr "`{0}' implementiert den Schnittstellenmember `{1}' nicht"
-#: mcs/mcs/async.cs:601
+#: mcs/mcs/async.cs:605
msgid ""
"Cannot find compiler required types for asynchronous functions support. Are "
"you targeting the wrong framework version?"
msgstr ""
-#: mcs/mcs/attribute.cs:222
+#: mcs/mcs/attribute.cs:228
#, csharp-format
msgid ""
"`{0}' is not a valid named attribute argument. Named attribute arguments "
"properties which are public and not static"
msgstr ""
-#: mcs/mcs/attribute.cs:231
+#: mcs/mcs/attribute.cs:237
#, csharp-format
msgid ""
"`{0}' is not a valid named attribute argument because it is not a valid "
"attribute parameter type"
msgstr ""
-#: mcs/mcs/attribute.cs:237
+#: mcs/mcs/attribute.cs:243
msgid "An attribute argument cannot be dynamic expression"
msgstr ""
-#: mcs/mcs/attribute.cs:242
+#: mcs/mcs/attribute.cs:248
msgid "The Guid attribute must be specified with the ComImport attribute"
msgstr ""
-#: mcs/mcs/attribute.cs:247
+#: mcs/mcs/attribute.cs:253
#, csharp-format
msgid "Do not use `{0}' directly. Use parameter modifier `this' instead"
msgstr ""
-#: mcs/mcs/attribute.cs:252
+#: mcs/mcs/attribute.cs:258
#, csharp-format
msgid "Do not use `{0}' directly. Use `dynamic' keyword instead"
msgstr ""
-#: mcs/mcs/attribute.cs:261
+#: mcs/mcs/attribute.cs:267
#, csharp-format
msgid "Error during emitting `{0}' attribute. The reason is `{1}'"
msgstr ""
-#: mcs/mcs/attribute.cs:314
+#: mcs/mcs/attribute.cs:321
#, csharp-format
msgid ""
"`{0}' is ambiguous between `{1}' and `{2}'. Use either `@{0}' or `{0}"
"Attribute'"
msgstr ""
-#: mcs/mcs/attribute.cs:336 mcs/mcs/attribute.cs:342
+#: mcs/mcs/attribute.cs:348 mcs/mcs/attribute.cs:354
#, csharp-format
msgid "`{0}': is not an attribute class"
msgstr ""
-#: mcs/mcs/attribute.cs:434
+#: mcs/mcs/attribute.cs:446
#, csharp-format
msgid "Cannot apply attribute class `{0}' because it is abstract"
msgstr ""
-#: mcs/mcs/attribute.cs:505
+#: mcs/mcs/attribute.cs:517
#, csharp-format
msgid "Duplicate named attribute `{0}' argument"
msgstr ""
-#: mcs/mcs/attribute.cs:964
+#: mcs/mcs/attribute.cs:976
#, csharp-format
msgid ""
"The attribute `{0}' is not valid on this declaration type. It is valid on `"
"{1}' declarations only"
msgstr ""
-#: mcs/mcs/attribute.cs:986
+#: mcs/mcs/attribute.cs:998
#, csharp-format
msgid "The argument to the `{0}' attribute must be a valid identifier"
msgstr ""
-#: mcs/mcs/attribute.cs:1000
+#: mcs/mcs/attribute.cs:1012
#, csharp-format
msgid "Invalid value for argument to `{0}' attribute"
msgstr ""
-#: mcs/mcs/attribute.cs:1252
+#: mcs/mcs/attribute.cs:1274
#, csharp-format
msgid "The attribute `{0}' cannot be applied multiple times"
msgstr ""
-#: mcs/mcs/attribute.cs:1552
+#: mcs/mcs/attribute.cs:1580
#, csharp-format
msgid "`{0}' is obsolete: `{1}'"
msgstr "`{0}' ist veraltet: `{1}'"
"`struct', `interface', or `void' keyword"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:1470 mcs/mcs/cs-tokenizer.cs:1533
+#: mcs/mcs/cs-tokenizer.cs:1478 mcs/mcs/cs-tokenizer.cs:1541
msgid "Invalid number"
msgstr "Ungültige Zahl"
-#: mcs/mcs/cs-tokenizer.cs:1745
+#: mcs/mcs/cs-tokenizer.cs:1753
#, csharp-format
msgid "Unrecognized escape sequence `\\{0}'"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:1764
+#: mcs/mcs/cs-tokenizer.cs:1772
msgid "Unrecognized escape sequence"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:2034
+#: mcs/mcs/cs-tokenizer.cs:2041
msgid "Filename, single-line comment or end-of-line expected"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:2084
+#: mcs/mcs/cs-tokenizer.cs:2090
#, fuzzy
msgid "Missing identifier to pre-processor directive"
msgstr "Ungültige Präprozessor Direktive"
-#: mcs/mcs/cs-tokenizer.cs:2094 mcs/mcs/cs-tokenizer.cs:2098
+#: mcs/mcs/cs-tokenizer.cs:2100 mcs/mcs/cs-tokenizer.cs:2104
#, csharp-format
msgid "Identifier expected: {0}"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:2587
+#: mcs/mcs/cs-tokenizer.cs:2610
#, fuzzy
msgid "Integral constant is too large"
msgstr "Numerische Konstante ist zu lang"
-#: mcs/mcs/cs-tokenizer.cs:2592
+#: mcs/mcs/cs-tokenizer.cs:2615
msgid "Invalid preprocessor directive"
msgstr "Ungültige Präprozessor Direktive"
-#: mcs/mcs/cs-tokenizer.cs:2599
+#: mcs/mcs/cs-tokenizer.cs:2622
#, csharp-format
msgid "Unexpected processor directive ({0})"
msgstr "Unerwartete Prozessor Direktive ({0})"
-#: mcs/mcs/cs-tokenizer.cs:2605
+#: mcs/mcs/cs-tokenizer.cs:2628
msgid ""
"Cannot define or undefine preprocessor symbols after first token in file"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:2611
+#: mcs/mcs/cs-tokenizer.cs:2634
msgid ""
"Preprocessor directives must appear as the first non-whitespace character on "
"a line"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:2616
+#: mcs/mcs/cs-tokenizer.cs:2639
msgid "Single-line comment or end-of-line expected"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:2661 mcs/mcs/cs-tokenizer.cs:3679
+#: mcs/mcs/cs-tokenizer.cs:2684 mcs/mcs/cs-tokenizer.cs:3719
msgid "Expected `#endif' directive"
msgstr "`#endif' Direktive erwartet"
-#: mcs/mcs/cs-tokenizer.cs:2694 mcs/mcs/cs-tokenizer.cs:2715
-#: mcs/mcs/cs-tokenizer.cs:2746 mcs/mcs/cs-tokenizer.cs:3677
+#: mcs/mcs/cs-tokenizer.cs:2717 mcs/mcs/cs-tokenizer.cs:2738
+#: mcs/mcs/cs-tokenizer.cs:2769 mcs/mcs/cs-tokenizer.cs:3717
msgid "#endregion directive expected"
msgstr "`#endregion' Direktive erwartet"
-#: mcs/mcs/cs-tokenizer.cs:2793
+#: mcs/mcs/cs-tokenizer.cs:2816
msgid "Wrong preprocessor directive"
msgstr "Falsche Präprozessor Direktive"
-#: mcs/mcs/cs-tokenizer.cs:2805
+#: mcs/mcs/cs-tokenizer.cs:2828
#, csharp-format
msgid "#error: '{0}'"
msgstr "#Fehler: '{0}'"
-#: mcs/mcs/cs-tokenizer.cs:2823
+#: mcs/mcs/cs-tokenizer.cs:2846
msgid "The line number specified for #line directive is missing or invalid"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:2876 mcs/mcs/cs-tokenizer.cs:3514
+#: mcs/mcs/cs-tokenizer.cs:2908 mcs/mcs/cs-tokenizer.cs:3554
msgid "Newline in constant"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:2893
+#: mcs/mcs/cs-tokenizer.cs:2934
msgid "Unterminated string literal"
msgstr "Nicht beendetes Zeichenfolgeliteral"
-#: mcs/mcs/cs-tokenizer.cs:2968
+#: mcs/mcs/cs-tokenizer.cs:3011
msgid "Identifier too long (limit is 512 chars)"
msgstr "Der Bezeichner ist zu lang. (Maximal 512 Zeichen)"
-#: mcs/mcs/cs-tokenizer.cs:3354
+#: mcs/mcs/cs-tokenizer.cs:3394
msgid "End-of-file found, '*/' expected"
msgstr "Dateiende gefunden. `*/' erwartet."
-#: mcs/mcs/cs-tokenizer.cs:3463
+#: mcs/mcs/cs-tokenizer.cs:3503
msgid "Keyword, identifier, or string expected after verbatim specifier: @"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:3484
+#: mcs/mcs/cs-tokenizer.cs:3524
#, fuzzy, csharp-format
msgid "Unexpected character `{0}'"
msgstr "`{0}' erwartet"
-#: mcs/mcs/cs-tokenizer.cs:3509
+#: mcs/mcs/cs-tokenizer.cs:3549
msgid "Empty character literal"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:3530
+#: mcs/mcs/cs-tokenizer.cs:3570
msgid "Too many characters in character literal"
msgstr ""
"declaration of this type exists"
msgstr ""
-#: mcs/mcs/class.cs:713
+#: mcs/mcs/class.cs:734
#, csharp-format
msgid ""
"`{0}': explicit interface declaration can only be declared in a class or "
"struct"
msgstr ""
-#: mcs/mcs/class.cs:772
+#: mcs/mcs/class.cs:793
#, csharp-format
msgid "Duplicate type parameter `{0}'"
msgstr ""
-#: mcs/mcs/class.cs:775
+#: mcs/mcs/class.cs:796
#, csharp-format
msgid "The type `{0}' already contains a definition for `{1}'"
msgstr ""
-#: mcs/mcs/class.cs:841
+#: mcs/mcs/class.cs:862
msgid ""
"Cannot specify the `DefaultMember' attribute on type containing an indexer"
msgstr ""
-#: mcs/mcs/class.cs:846
+#: mcs/mcs/class.cs:867
msgid "The RequiredAttribute attribute is not permitted on C# types"
msgstr ""
-#: mcs/mcs/class.cs:1069
+#: mcs/mcs/class.cs:1093
#, csharp-format
msgid "Class `{0}' cannot derive from the dynamic type"
msgstr ""
-#: mcs/mcs/class.cs:1086
+#: mcs/mcs/class.cs:1110
#, csharp-format
msgid "`{0}' is already listed in interface list"
msgstr ""
-#: mcs/mcs/class.cs:1094
+#: mcs/mcs/class.cs:1118
#, csharp-format
msgid ""
"Inconsistent accessibility: base interface `{0}' is less accessible than "
"interface `{1}'"
msgstr ""
-#: mcs/mcs/class.cs:1100
+#: mcs/mcs/class.cs:1124
#, csharp-format
msgid "Type `{0}' in interface list is not an interface"
msgstr ""
-#: mcs/mcs/class.cs:1102
+#: mcs/mcs/class.cs:1126
#, csharp-format
msgid "`{0}': Classes cannot have multiple base classes (`{1}' and `{2}')"
msgstr ""
-#: mcs/mcs/class.cs:1105
+#: mcs/mcs/class.cs:1129
#, csharp-format
msgid "`{0}': Base class `{1}' must be specified as first"
msgstr ""
-#: mcs/mcs/class.cs:1166
+#: mcs/mcs/class.cs:1190
#, csharp-format
msgid ""
"The operator `{0}' requires a matching operator `{1}' to also be defined"
msgstr ""
-#: mcs/mcs/class.cs:1397
+#: mcs/mcs/class.cs:1421
#, csharp-format
msgid "Partial declarations of `{0}' must not specify different base classes"
msgstr ""
-#: mcs/mcs/class.cs:1441
+#: mcs/mcs/class.cs:1465
#, csharp-format
msgid ""
"Inherited interface `{0}' causes a cycle in the interface hierarchy of `{1}'"
msgstr ""
-#: mcs/mcs/class.cs:1447
+#: mcs/mcs/class.cs:1471
#, csharp-format
msgid "Circular base class dependency involving `{0}' and `{1}'"
msgstr ""
-#: mcs/mcs/class.cs:1593
+#: mcs/mcs/class.cs:1617
#, csharp-format
msgid ""
"Partial declarations of `{0}' have inconsistent constraints for type "
"parameter `{1}'"
msgstr ""
-#: mcs/mcs/class.cs:1702
+#: mcs/mcs/class.cs:1726
#, fuzzy, csharp-format
msgid "`{0}': cannot implement a dynamic interface `{1}'"
msgstr "`{0}' implementiert den Schnittstellenmember `{1}' nicht"
-#: mcs/mcs/class.cs:1718
+#: mcs/mcs/class.cs:1742
#, csharp-format
msgid ""
"`{0}' cannot implement both `{1}' and `{2}' because they may unify for some "
"type parameter substitutions"
msgstr ""
-#: mcs/mcs/class.cs:1737
+#: mcs/mcs/class.cs:1761
#, csharp-format
msgid ""
"A generic type cannot derive from `{0}' because it is an attribute class"
msgstr ""
-#: mcs/mcs/class.cs:1839
+#: mcs/mcs/class.cs:1870
msgid ""
"Two indexers have different names; the IndexerName attribute must be used "
"with the same name on every indexer within a type"
msgstr ""
-#: mcs/mcs/class.cs:2089
+#: mcs/mcs/class.cs:2120
#, csharp-format
msgid "A static member `{0}' cannot be marked as override, virtual or abstract"
msgstr ""
-#: mcs/mcs/class.cs:2096
+#: mcs/mcs/class.cs:2127
#, csharp-format
msgid "A member `{0}' marked as override cannot be marked as new or virtual"
msgstr ""
-#: mcs/mcs/class.cs:2108
+#: mcs/mcs/class.cs:2139
#, csharp-format
msgid "`{0}' cannot be both extern and abstract"
msgstr ""
-#: mcs/mcs/class.cs:2113
+#: mcs/mcs/class.cs:2144
#, csharp-format
msgid "`{0}' cannot be both abstract and sealed"
msgstr "`{0}' Eine Klasse kann nicht gleichzeitig statisch und versiegelt sein"
-#: mcs/mcs/class.cs:2118
+#: mcs/mcs/class.cs:2149
#, csharp-format
msgid "The abstract method `{0}' cannot be marked virtual"
msgstr ""
-#: mcs/mcs/class.cs:2124
+#: mcs/mcs/class.cs:2155
#, csharp-format
msgid "`{0}' is abstract but it is declared in the non-abstract class `{1}'"
msgstr ""
-#: mcs/mcs/class.cs:2132
+#: mcs/mcs/class.cs:2163
#, csharp-format
msgid "`{0}': virtual or abstract members cannot be private"
msgstr ""
-#: mcs/mcs/class.cs:2139
+#: mcs/mcs/class.cs:2170
#, csharp-format
msgid "`{0}' cannot be sealed because it is not an override"
msgstr ""
-#: mcs/mcs/class.cs:2179
+#: mcs/mcs/class.cs:2210
#, csharp-format
msgid "`{0}': containing type does not implement interface `{1}'"
msgstr ""
-#: mcs/mcs/class.cs:2369
+#: mcs/mcs/class.cs:2400
#, csharp-format
msgid "Type parameter `{0}' has same name as containing type, or method"
msgstr ""
-#: mcs/mcs/class.cs:2377
+#: mcs/mcs/class.cs:2408
#, csharp-format
msgid "`{0}': member names cannot be the same as their enclosing type"
msgstr ""
-#: mcs/mcs/class.cs:2496
+#: mcs/mcs/class.cs:2527
msgid ""
"The class System.Object cannot have a base class or implement an interface."
msgstr ""
-#: mcs/mcs/class.cs:2505
+#: mcs/mcs/class.cs:2536
#, csharp-format
msgid "Attribute `{0}' is only valid on classes derived from System.Attribute"
msgstr ""
-#: mcs/mcs/class.cs:2510
+#: mcs/mcs/class.cs:2541
msgid ""
"Attribute `System.Diagnostics.ConditionalAttribute' is only valid on methods "
"or attribute classes"
msgstr ""
-#: mcs/mcs/class.cs:2539
+#: mcs/mcs/class.cs:2570
#, csharp-format
msgid "`{0}': an abstract class cannot be sealed or static"
msgstr "`{0}': Eine abstrakte Klasse darf nicht versiegelt oder statisch sein"
-#: mcs/mcs/class.cs:2543
+#: mcs/mcs/class.cs:2574
#, csharp-format
msgid "`{0}': a class cannot be both static and sealed"
msgstr ""
-#: mcs/mcs/class.cs:2549
+#: mcs/mcs/class.cs:2580
#, csharp-format
msgid "`{0}': Static classes cannot contain user-defined operators"
msgstr ""
"`{0}': Statische Klassen können keine benutzerdefinierten Operatoren "
"beinhalten"
-#: mcs/mcs/class.cs:2554
+#: mcs/mcs/class.cs:2585
#, csharp-format
msgid "`{0}': Static classes cannot contain destructor"
msgstr "`{0}': Statische Klassen können keinen Destruktor enthalten"
-#: mcs/mcs/class.cs:2559
+#: mcs/mcs/class.cs:2590
#, csharp-format
msgid "`{0}': cannot declare indexers in a static class"
msgstr ""
-#: mcs/mcs/class.cs:2567
+#: mcs/mcs/class.cs:2598
#, csharp-format
msgid "`{0}': Static classes cannot have instance constructors"
msgstr ""
-#: mcs/mcs/class.cs:2571
+#: mcs/mcs/class.cs:2602
#, csharp-format
msgid "`{0}': cannot declare instance members in a static class"
msgstr ""
-#: mcs/mcs/class.cs:2602
+#: mcs/mcs/class.cs:2633
#, fuzzy, csharp-format
msgid "`{0}': Cannot derive from type parameter `{1}'"
msgstr "`{0}' implementiert den Schnittstellenmember `{1}' nicht"
-#: mcs/mcs/class.cs:2606
+#: mcs/mcs/class.cs:2637
#, csharp-format
msgid "`{0}': Cannot derive from static class `{1}'"
msgstr ""
-#: mcs/mcs/class.cs:2610
+#: mcs/mcs/class.cs:2641
#, csharp-format
msgid "`{0}': cannot derive from sealed type `{1}'"
msgstr ""
-#: mcs/mcs/class.cs:2613
+#: mcs/mcs/class.cs:2644
#, csharp-format
msgid ""
"Static class `{0}' cannot derive from type `{1}'. Static classes must derive "
"from object"
msgstr ""
-#: mcs/mcs/class.cs:2624
+#: mcs/mcs/class.cs:2655
#, csharp-format
msgid "`{0}' cannot derive from special class `{1}'"
msgstr ""
-#: mcs/mcs/class.cs:2634
+#: mcs/mcs/class.cs:2665
#, csharp-format
msgid ""
"Inconsistent accessibility: base class `{0}' is less accessible than class `"
"{1}'"
msgstr ""
-#: mcs/mcs/class.cs:2642
+#: mcs/mcs/class.cs:2673
#, csharp-format
msgid "Static class `{0}' cannot implement interfaces"
msgstr ""
-#: mcs/mcs/class.cs:2753 mcs/mcs/class.cs:2767
+#: mcs/mcs/class.cs:2784 mcs/mcs/class.cs:2798
#, csharp-format
msgid "Struct member `{0}' of type `{1}' causes a cycle in the struct layout"
msgstr ""
-#: mcs/mcs/class.cs:2849
+#: mcs/mcs/class.cs:2880
#, csharp-format
msgid "`{0}': Structs cannot have instance field initializers"
msgstr "`{0}': Instanzfeldinitialisierungen können nicht in Strukturen sein"
-#: mcs/mcs/class.cs:3037
+#: mcs/mcs/class.cs:3068
#, csharp-format
msgid "Do not override `{0}'. Use destructor syntax instead"
msgstr ""
-#: mcs/mcs/class.cs:3040
+#: mcs/mcs/class.cs:3071
#, csharp-format
msgid "`{0}' is marked as an override but no suitable {1} found to override"
msgstr ""
-#: mcs/mcs/class.cs:3046
+#: mcs/mcs/class.cs:3077
#, csharp-format
msgid "`{0}': cannot override because `{1}' is not an event"
msgstr ""
-#: mcs/mcs/class.cs:3049
+#: mcs/mcs/class.cs:3080
#, csharp-format
msgid "`{0}': cannot override because `{1}' is not a property"
msgstr ""
-#: mcs/mcs/class.cs:3052
+#: mcs/mcs/class.cs:3083
#, csharp-format
msgid "`{0}': cannot override because `{1}' is not a method"
msgstr ""
-#: mcs/mcs/class.cs:3071
+#: mcs/mcs/class.cs:3102
#, csharp-format
msgid ""
"`{0}' cannot override inherited members `{1}' and `{2}' because they have "
"the same signature when used in type `{3}'"
msgstr ""
-#: mcs/mcs/class.cs:3124 mcs/mcs/field.cs:198
+#: mcs/mcs/class.cs:3155 mcs/mcs/field.cs:198
#, csharp-format
msgid "`{0}' hides inherited abstract member `{1}'"
msgstr ""
-#: mcs/mcs/class.cs:3148
+#: mcs/mcs/class.cs:3179
#, csharp-format
msgid ""
"`{0}': cannot override inherited member `{1}' because it is not marked "
"virtual, abstract or override"
msgstr ""
-#: mcs/mcs/class.cs:3156
+#: mcs/mcs/class.cs:3187
#, csharp-format
msgid "`{0}': cannot override inherited member `{1}' because it is sealed"
msgstr ""
-#: mcs/mcs/class.cs:3165
+#: mcs/mcs/class.cs:3196
#, csharp-format
msgid "`{0}': type must be `{1}' to match overridden member `{2}'"
msgstr ""
-#: mcs/mcs/class.cs:3168
+#: mcs/mcs/class.cs:3199
#, csharp-format
msgid "`{0}': return type must be `{1}' to match overridden member `{2}'"
msgstr ""
-#: mcs/mcs/class.cs:3236
+#: mcs/mcs/class.cs:3267
#, csharp-format
msgid "A partial method `{0}' cannot explicitly implement an interface"
msgstr ""
-#: mcs/mcs/class.cs:3242
+#: mcs/mcs/class.cs:3273
#, csharp-format
msgid "The type `{0}' in explicit interface declaration is not an interface"
msgstr ""
-#: mcs/mcs/class.cs:3273
+#: mcs/mcs/class.cs:3304
#, csharp-format
msgid ""
"Inconsistent accessibility: parameter type `{0}' is less accessible than "
"indexer `{1}'"
msgstr ""
-#: mcs/mcs/class.cs:3277
+#: mcs/mcs/class.cs:3308
#, csharp-format
msgid ""
"Inconsistent accessibility: parameter type `{0}' is less accessible than "
"operator `{1}'"
msgstr ""
-#: mcs/mcs/class.cs:3281
+#: mcs/mcs/class.cs:3312
#, csharp-format
msgid ""
"Inconsistent accessibility: parameter type `{0}' is less accessible than "
"method `{1}'"
msgstr ""
-#: mcs/mcs/class.cs:3341
+#: mcs/mcs/class.cs:3372
#, csharp-format
msgid ""
"`{0}': cannot change access modifiers when overriding `{1}' inherited member "
"`{2}'"
msgstr ""
-#: mcs/mcs/class.cs:3350
+#: mcs/mcs/class.cs:3381
#, fuzzy, csharp-format
msgid "`{0}': static types cannot be used as return types"
msgstr ""
"`{0}': Statische Klassen können keine benutzerdefinierten Operatoren "
"beinhalten"
-#: mcs/mcs/class.cs:3463
+#: mcs/mcs/class.cs:3442
+#, csharp-format
+msgid ""
+"`{0}': Cannot specify constraints for overrides and explicit interface "
+"implementation methods"
+msgstr ""
+
+#: mcs/mcs/class.cs:3504
#, csharp-format
msgid "New virtual member `{0}' is declared in a sealed class `{1}'"
msgstr ""
-#: mcs/mcs/class.cs:3478
+#: mcs/mcs/class.cs:3519
msgid "Inconsistent accessibility: property type `"
msgstr ""
-#: mcs/mcs/class.cs:3483
+#: mcs/mcs/class.cs:3524
msgid "Inconsistent accessibility: indexer return type `"
msgstr ""
-#: mcs/mcs/class.cs:3489 mcs/mcs/class.cs:3494 mcs/mcs/delegate.cs:171
+#: mcs/mcs/class.cs:3530 mcs/mcs/class.cs:3535 mcs/mcs/delegate.cs:171
msgid "Inconsistent accessibility: return type `"
msgstr ""
-#: mcs/mcs/class.cs:3499
+#: mcs/mcs/class.cs:3540
msgid "Inconsistent accessibility: field type `"
msgstr ""
-#: mcs/mcs/class.cs:3511
+#: mcs/mcs/class.cs:3552
#, csharp-format
msgid ""
"Parameters or local variables of type `{0}' cannot be declared in async "
"methods or iterators"
msgstr ""
-#: mcs/mcs/class.cs:3515
+#: mcs/mcs/class.cs:3556
#, csharp-format
msgid ""
"Local variables of type `{0}' cannot be used inside anonymous methods, "
"lambda expressions or query expressions"
msgstr ""
-#: mcs/mcs/class.cs:3519
+#: mcs/mcs/class.cs:3560
#, csharp-format
msgid "Field or property cannot be of type `{0}'"
msgstr ""
"The evaluation of the constant value for `{0}' involves a circular definition"
msgstr ""
-#: mcs/mcs/constant.cs:66 mcs/mcs/constant.cs:392
+#: mcs/mcs/constant.cs:66 mcs/mcs/constant.cs:403
#, csharp-format
msgid "Constant value `{0}' cannot be converted to a `{1}'"
msgstr ""
-#: mcs/mcs/constant.cs:264
+#: mcs/mcs/constant.cs:266
#, csharp-format
msgid ""
"Constant value `{0}' cannot be converted to a `{1}' (use `unchecked' syntax "
"to override)"
msgstr ""
-#: mcs/mcs/convert.cs:1184
+#: mcs/mcs/convert.cs:1185
#, csharp-format
msgid ""
"Ambiguous user defined operators `{0}' and `{1}' when converting from `{2}' "
"Extension method `{0}' of value type `{1}' cannot be used to create delegates"
msgstr ""
-#: mcs/mcs/delegate.cs:532
+#: mcs/mcs/delegate.cs:535
#, csharp-format
msgid "Cannot create delegate from partial method declaration `{0}'"
msgstr ""
-#: mcs/mcs/delegate.cs:535
+#: mcs/mcs/delegate.cs:538
#, csharp-format
msgid ""
"Cannot create delegate with `{0}' because it has a Conditional attribute"
msgstr ""
-#: mcs/mcs/delegate.cs:578
+#: mcs/mcs/delegate.cs:581
#, csharp-format
msgid ""
"A method or delegate `{0} {1}' parameters and return type must be same as "
"delegate `{2} {3}' parameters and return type"
msgstr ""
-#: mcs/mcs/delegate.cs:585
+#: mcs/mcs/delegate.cs:588
#, csharp-format
msgid ""
"A method or delegate `{0}' parameters do not match delegate `{1}' parameters"
msgstr ""
-#: mcs/mcs/delegate.cs:590
+#: mcs/mcs/delegate.cs:593
#, csharp-format
msgid ""
"A method or delegate `{0} {1}' return type does not match delegate `{2} {3}' "
"return type"
msgstr ""
-#: mcs/mcs/delegate.cs:673
+#: mcs/mcs/delegate.cs:676
msgid "Method name expected"
msgstr "Methodennamen erwartet"
-#: mcs/mcs/doc.cs:613
+#: mcs/mcs/doc.cs:621
#, csharp-format
msgid "Error generating XML documentation file `{0}' (`{1}')"
msgstr "Fehler beim erstellen der XML-Dokumentationsdatei `{0}' (`{1}')"
-#: mcs/mcs/driver.cs:51
+#: mcs/mcs/driver.cs:52
msgid "Source file `"
msgstr ""
-#: mcs/mcs/driver.cs:96
-#, csharp-format
-msgid "Source file `{0}' could not be found"
-msgstr ""
-
-#: mcs/mcs/driver.cs:103
-#, csharp-format
-msgid "Source file `{0}' is a binary file and not a text file"
-msgstr ""
-
-#: mcs/mcs/driver.cs:210
+#: mcs/mcs/driver.cs:258
msgid "No files to compile were specified"
msgstr "Es wurden keine Dateien zum kompilieren angegeben"
-#: mcs/mcs/driver.cs:215
+#: mcs/mcs/driver.cs:263
msgid "Platform option `anycpu32bitpreferred' is valid only for executables"
msgstr ""
-#: mcs/mcs/driver.cs:245
+#: mcs/mcs/driver.cs:293
msgid ""
"If no source files are specified you must specify the output file with -out:"
msgstr ""
-#: mcs/mcs/driver.cs:262
+#: mcs/mcs/driver.cs:310
msgid "Output file name is not valid"
msgstr ""
msgstr ""
#: mcs/mcs/ecore.cs:328
-#, csharp-format
-msgid ""
-"Members of value type `{0}' cannot be assigned using a property `{1}' object "
-"initializer"
-msgstr ""
-
-#: mcs/mcs/ecore.cs:331
-#, csharp-format
-msgid ""
-"Cannot modify a value type return value of `{0}'. Consider storing the value "
-"in a temporary variable"
-msgstr ""
-
-#: mcs/mcs/ecore.cs:335
msgid ""
"The left-hand side of an assignment must be a variable, a property or an "
"indexer"
msgstr ""
-#: mcs/mcs/ecore.cs:341
+#: mcs/mcs/ecore.cs:334
msgid "The operation in question is undefined on void pointers"
msgstr ""
-#: mcs/mcs/ecore.cs:408 mcs/mcs/statement.cs:3001 mcs/mcs/statement.cs:3003
+#: mcs/mcs/ecore.cs:422 mcs/mcs/statement.cs:3038 mcs/mcs/statement.cs:3040
#, csharp-format
msgid "Internal compiler error: {0}"
msgstr ""
-#: mcs/mcs/ecore.cs:448
+#: mcs/mcs/ecore.cs:462
msgid "A ref or out argument must be an assignable variable"
msgstr ""
-#: mcs/mcs/ecore.cs:467
+#: mcs/mcs/ecore.cs:481
msgid ""
"An attribute argument must be a constant expression, typeof expression or "
"array creation expression"
msgstr ""
-#: mcs/mcs/ecore.cs:641
+#: mcs/mcs/ecore.cs:655
#, csharp-format
msgid "The class `{0}' has no constructors defined"
msgstr ""
-#: mcs/mcs/ecore.cs:763
+#: mcs/mcs/ecore.cs:777
#, csharp-format
msgid "The `{0}' operator cannot be applied to operand of type `{1}'"
msgstr ""
-#: mcs/mcs/ecore.cs:769
+#: mcs/mcs/ecore.cs:783
msgid "An expression tree cannot contain an unsafe pointer operation"
msgstr ""
-#: mcs/mcs/ecore.cs:847
+#: mcs/mcs/ecore.cs:861
#, csharp-format
msgid "`{0}' is a `{1}' but a `{2}' was expected"
msgstr ""
-#: mcs/mcs/ecore.cs:880
+#: mcs/mcs/ecore.cs:894
#, csharp-format
msgid "Expression denotes a `{0}', where a `{1}' was expected"
msgstr ""
-#: mcs/mcs/ecore.cs:890
+#: mcs/mcs/ecore.cs:904
msgid "Pointers and fixed size buffers may only be used in an unsafe context"
msgstr ""
-#: mcs/mcs/ecore.cs:2323
+#: mcs/mcs/ecore.cs:2364
#, fuzzy, csharp-format
msgid ""
"Dynamic keyword requires `{0}' to be defined. Are you missing System.Core."
"Der Typ oder Namespacename `{0}' konnte nicht gefunden werden. Fehlt eine "
"using-Direktive oder ein Assemblyverweis?"
-#: mcs/mcs/ecore.cs:2399
+#: mcs/mcs/ecore.cs:2440
#, csharp-format
msgid ""
"A local variable `{0}' cannot be used before it is declared. Consider "
"renaming the local variable when it hides the member `{1}'"
msgstr ""
-#: mcs/mcs/ecore.cs:2414 mcs/mcs/ecore.cs:2457
+#: mcs/mcs/ecore.cs:2455 mcs/mcs/ecore.cs:2498
#, csharp-format
msgid "`{0}' conflicts with a declaration in a child block"
msgstr ""
-#: mcs/mcs/ecore.cs:2466
+#: mcs/mcs/ecore.cs:2507
#, csharp-format
msgid "A local variable `{0}' cannot be used before it is declared"
msgstr ""
-#: mcs/mcs/ecore.cs:2520
+#: mcs/mcs/ecore.cs:2561
#, csharp-format
msgid "The name `{0}' does not exist in the current context"
msgstr ""
-#: mcs/mcs/ecore.cs:2616
+#: mcs/mcs/ecore.cs:2657
msgid "System.Void cannot be used from C#. Consider using `void'"
msgstr ""
-#: mcs/mcs/ecore.cs:2900
+#: mcs/mcs/ecore.cs:2941
#, csharp-format
msgid "Cannot call an abstract base member `{0}'"
msgstr ""
-#: mcs/mcs/ecore.cs:2907
+#: mcs/mcs/ecore.cs:2948
#, csharp-format
msgid ""
"Cannot access protected member `{0}' via a qualifier of type `{1}'. The "
"qualifier must be of type `{2}' or derived from it"
msgstr ""
-#: mcs/mcs/ecore.cs:2950
+#: mcs/mcs/ecore.cs:2964
+#, csharp-format
+msgid ""
+"Members of value type `{0}' cannot be assigned using a property `{1}' object "
+"initializer"
+msgstr ""
+
+#: mcs/mcs/ecore.cs:2968
+#, csharp-format
+msgid ""
+"Cannot modify a value type return value of `{0}'. Consider storing the value "
+"in a temporary variable"
+msgstr ""
+
+#: mcs/mcs/ecore.cs:2994
#, csharp-format
msgid ""
"Static member `{0}' cannot be accessed with an instance reference, qualify "
"it with a type name instead"
msgstr ""
-#: mcs/mcs/ecore.cs:2965
+#: mcs/mcs/ecore.cs:3009
#, csharp-format
msgid ""
"A field initializer cannot reference the nonstatic field, method, or "
"property `{0}'"
msgstr ""
-#: mcs/mcs/ecore.cs:2969
+#: mcs/mcs/ecore.cs:3013
#, csharp-format
msgid "An object reference is required to access non-static member `{0}'"
msgstr ""
-#: mcs/mcs/ecore.cs:2978
+#: mcs/mcs/ecore.cs:3022
#, csharp-format
msgid ""
"Cannot access a nonstatic member of outer type `{0}' via nested type `{1}'"
msgstr ""
-#: mcs/mcs/ecore.cs:3026
+#: mcs/mcs/ecore.cs:3070
msgid "Cannot modify the result of an unboxing conversion"
msgstr "Das Ergebnis einer Unboxing-Konvertierung kann nicht geändert werden"
-#: mcs/mcs/ecore.cs:3192
+#: mcs/mcs/ecore.cs:3240
#, csharp-format
msgid ""
"Type `{0}' does not contain a member `{1}' and the best extension method "
"overload `{2}' has some invalid arguments"
msgstr ""
-#: mcs/mcs/ecore.cs:3197
+#: mcs/mcs/ecore.cs:3245
#, csharp-format
msgid "Extension method instance type `{0}' cannot be converted to `{1}'"
msgstr ""
-#: mcs/mcs/ecore.cs:3331
+#: mcs/mcs/ecore.cs:3379
msgid "An expression tree cannot contain an expression with method group"
msgstr ""
-#: mcs/mcs/ecore.cs:3337
+#: mcs/mcs/ecore.cs:3385
msgid ""
"Partial methods with only a defining declaration or removed conditional "
"methods cannot be used in an expression tree"
msgstr ""
-#: mcs/mcs/ecore.cs:3369
+#: mcs/mcs/ecore.cs:3417
#, csharp-format
msgid ""
"Cannot convert method group `{0}' to non-delegate type `{1}'. Consider using "
"parentheses to invoke the method"
msgstr ""
-#: mcs/mcs/ecore.cs:4049
+#: mcs/mcs/ecore.cs:4150
#, csharp-format
msgid ""
"The type `{0}' does not contain a constructor that takes `{1}' arguments"
msgstr ""
-#: mcs/mcs/ecore.cs:4715
+#: mcs/mcs/ecore.cs:4837
#, csharp-format
msgid ""
"Type `{0}' does not contain a member `{1}' and the best extension method "
"without the extension method syntax"
msgstr ""
-#: mcs/mcs/ecore.cs:4743
+#: mcs/mcs/ecore.cs:4876
#, csharp-format
msgid ""
"The call is ambiguous between the following methods or properties: `{0}' and "
"`{1}'"
msgstr ""
-#: mcs/mcs/ecore.cs:4801
+#: mcs/mcs/ecore.cs:4939
#, csharp-format
msgid ""
-"The best overloaded collection initalizer method `{0}' cannot have 'ref', or "
+"The best overloaded collection initalizer method `{0}' cannot have `ref' or "
"`out' modifier"
msgstr ""
-#: mcs/mcs/ecore.cs:4805
+#: mcs/mcs/ecore.cs:4943
#, csharp-format
msgid ""
"The best overloaded collection initalizer method `{0}' has some invalid "
"arguments"
msgstr ""
-#: mcs/mcs/ecore.cs:4808
+#: mcs/mcs/ecore.cs:4946
#, csharp-format
msgid "Delegate `{0}' has some invalid arguments"
msgstr ""
-#: mcs/mcs/ecore.cs:4812
+#: mcs/mcs/ecore.cs:4950
#, csharp-format
msgid "The best overloaded method match for `{0}' has some invalid arguments"
msgstr ""
-#: mcs/mcs/ecore.cs:4821
+#: mcs/mcs/ecore.cs:4959
#, csharp-format
msgid ""
"Argument `#{0}' does not require `{1}' modifier. Consider removing `{1}' "
"modifier"
msgstr ""
-#: mcs/mcs/ecore.cs:4824
+#: mcs/mcs/ecore.cs:4962
#, csharp-format
msgid "Argument `#{0}' is missing `{1}' modifier"
msgstr ""
-#: mcs/mcs/ecore.cs:4836
+#: mcs/mcs/ecore.cs:4979
#, csharp-format
msgid "Argument `#{0}' cannot convert `{1}' expression to type `{2}'"
msgstr ""
-#: mcs/mcs/ecore.cs:4889
+#: mcs/mcs/ecore.cs:5032
#, csharp-format
msgid ""
"The type arguments for method `{0}' cannot be inferred from the usage. Try "
"specifying the type arguments explicitly"
msgstr ""
-#: mcs/mcs/ecore.cs:4918
+#: mcs/mcs/ecore.cs:5061
#, csharp-format
msgid "No overload for method `{0}' takes `{1}' arguments"
msgstr ""
-#: mcs/mcs/ecore.cs:4971
+#: mcs/mcs/ecore.cs:5114
#, csharp-format
msgid "The delegate `{0}' does not contain a parameter named `{1}'"
msgstr ""
-#: mcs/mcs/ecore.cs:4976
+#: mcs/mcs/ecore.cs:5119
#, csharp-format
msgid ""
"The best overloaded method match for `{0}' does not contain a parameter "
"named `{1}'"
msgstr ""
-#: mcs/mcs/ecore.cs:4986
+#: mcs/mcs/ecore.cs:5129
#, csharp-format
msgid ""
"Named argument `{0}' cannot be used for a parameter which has positional "
"argument specified"
msgstr ""
-#: mcs/mcs/ecore.cs:5322
+#: mcs/mcs/ecore.cs:5467
msgid ""
"You cannot use fixed size buffers contained in unfixed expressions. Try "
"using the fixed statement"
msgstr ""
-#: mcs/mcs/ecore.cs:5327
+#: mcs/mcs/ecore.cs:5472
#, csharp-format
msgid "`{0}': Fixed size buffers can only be accessed through locals or fields"
msgstr ""
-#: mcs/mcs/ecore.cs:5363
+#: mcs/mcs/ecore.cs:5508
#, fuzzy, csharp-format
msgid "Use of possibly unassigned field `{0}'"
msgstr "Verwendung eines möglicherweise nicht zugewiesenen Feldes `"
-#: mcs/mcs/ecore.cs:5789
+#: mcs/mcs/ecore.cs:5935
#, fuzzy, csharp-format
msgid "Property or event `{0}' is not supported by the C# language"
msgstr ""
"Die Eigenschaft `{0}' wird von der C# Sprache nicht unterstützt. Rufen Sie "
"die `{1}'-Accessormethode direkt auf."
-#: mcs/mcs/ecore.cs:5969
+#: mcs/mcs/ecore.cs:6131
#, csharp-format
msgid "A range variable `{0}' may not be passes as `ref' or `out' parameter"
msgstr ""
-#: mcs/mcs/ecore.cs:6047
+#: mcs/mcs/ecore.cs:6204
#, csharp-format
msgid ""
"The property or indexer `{0}' cannot be used in this context because it "
"lacks the `get' accessor"
msgstr ""
-#: mcs/mcs/ecore.cs:6054
+#: mcs/mcs/ecore.cs:6211
#, csharp-format
msgid ""
"The property or indexer `{0}' cannot be used in this context because the get "
"accessor is inaccessible"
msgstr ""
-#: mcs/mcs/ecore.cs:6073
+#: mcs/mcs/ecore.cs:6230
#, csharp-format
msgid "Property or indexer `{0}' cannot be assigned to (it is read-only)"
msgstr ""
-#: mcs/mcs/ecore.cs:6081
+#: mcs/mcs/ecore.cs:6238
#, csharp-format
msgid ""
"The property or indexer `{0}' cannot be used in this context because the set "
"accessor is inaccessible"
msgstr ""
-#: mcs/mcs/ecore.cs:6249
+#: mcs/mcs/ecore.cs:6406
#, csharp-format
msgid ""
"The event `{0}' can only appear on the left hand side of `+=' or `-=' "
"operator"
msgstr ""
-#: mcs/mcs/ecore.cs:6253
+#: mcs/mcs/ecore.cs:6410
#, csharp-format
msgid ""
"The event `{0}' can only appear on the left hand side of += or -= when used "
"outside of the type `{1}'"
msgstr ""
-#: mcs/mcs/ecore.cs:6423
+#: mcs/mcs/ecore.cs:6580
#, csharp-format
msgid ""
"An implicitly typed local variable declaration cannot be initialized with `"
"{0}'"
msgstr ""
-#: mcs/mcs/ecore.cs:6437
+#: mcs/mcs/ecore.cs:6594
msgid ""
"The contextual keyword `var' may only appear within a local variable "
"declaration"
msgid "Type byte, sbyte, short, ushort, int, uint, long or ulong expected"
msgstr "Typ byte, sbyte, short, ushort, int, uint, long oder ulong erwartet"
-#: mcs/mcs/eval.cs:562
+#: mcs/mcs/eval.cs:563
msgid "Detection Parsing Error"
msgstr ""
"{1}' is used as a short circuit operator"
msgstr ""
-#: mcs/mcs/expression.cs:4635
+#: mcs/mcs/expression.cs:4656
#, csharp-format
msgid ""
"Type of conditional expression cannot be determined as `{0}' and `{1}' "
"convert implicitly to each other"
msgstr ""
-#: mcs/mcs/expression.cs:4645
+#: mcs/mcs/expression.cs:4666
#, csharp-format
msgid ""
"Type of conditional expression cannot be determined because there is no "
"implicit conversion between `{0}' and `{1}'"
msgstr ""
-#: mcs/mcs/expression.cs:4943
+#: mcs/mcs/expression.cs:4964
#, fuzzy, csharp-format
msgid "Use of unassigned local variable `{0}'"
msgstr "Verwendung der nicht zugewiesenen lokalen Variable `"
-#: mcs/mcs/expression.cs:4963
+#: mcs/mcs/expression.cs:4984
#, csharp-format
msgid ""
"Cannot use fixed local `{0}' inside an anonymous method, lambda expression "
"or query expression"
msgstr ""
-#: mcs/mcs/expression.cs:5156
+#: mcs/mcs/expression.cs:5177
#, csharp-format
msgid ""
"Parameter `{0}' cannot be used inside `{1}' when using `ref' or `out' "
"modifier"
msgstr ""
-#: mcs/mcs/expression.cs:5235
+#: mcs/mcs/expression.cs:5256
#, csharp-format
msgid "Use of unassigned out parameter `{0}'"
msgstr ""
-#: mcs/mcs/expression.cs:5345
+#: mcs/mcs/expression.cs:5368
#, fuzzy, csharp-format
msgid "Cannot invoke a non-delegate type `{0}'"
msgstr "Kann Typ `{0}'<...> nicht finden"
-#: mcs/mcs/expression.cs:5356
+#: mcs/mcs/expression.cs:5379
#, csharp-format
msgid "The member `{0}' cannot be used as method or delegate"
msgstr ""
-#: mcs/mcs/expression.cs:5376
+#: mcs/mcs/expression.cs:5399
msgid ""
"Do not directly call your base class Finalize method. It is called "
"automatically from your destructor"
msgstr ""
-#: mcs/mcs/expression.cs:5378
+#: mcs/mcs/expression.cs:5401
msgid ""
"Destructors and object.Finalize cannot be called directly. Consider calling "
"IDisposable.Dispose if available"
msgstr ""
-#: mcs/mcs/expression.cs:5407
+#: mcs/mcs/expression.cs:5430
#, csharp-format
msgid ""
"The base call to method `{0}' cannot be dynamically dispatched. Consider "
"casting the dynamic arguments or eliminating the base access"
msgstr ""
-#: mcs/mcs/expression.cs:5480
+#: mcs/mcs/expression.cs:5503
#, csharp-format
msgid "`{0}': cannot explicitly call operator or accessor"
msgstr ""
-#: mcs/mcs/expression.cs:5664
+#: mcs/mcs/expression.cs:5687
#, csharp-format
msgid "Unsafe type `{0}' cannot be used in an object creation expression"
msgstr ""
-#: mcs/mcs/expression.cs:5687
+#: mcs/mcs/expression.cs:5710
#, csharp-format
msgid ""
"Cannot create an instance of the variable type `{0}' because it does not "
"have the new() constraint"
msgstr ""
-#: mcs/mcs/expression.cs:5693
+#: mcs/mcs/expression.cs:5716
#, csharp-format
msgid ""
"`{0}': cannot provide arguments when creating an instance of a variable type"
msgstr ""
-#: mcs/mcs/expression.cs:5702
+#: mcs/mcs/expression.cs:5725
#, csharp-format
msgid "Cannot create an instance of the static class `{0}'"
msgstr ""
-#: mcs/mcs/expression.cs:5714
+#: mcs/mcs/expression.cs:5737
#, csharp-format
msgid "Cannot create an instance of the abstract class or interface `{0}'"
msgstr ""
-#: mcs/mcs/expression.cs:6015
+#: mcs/mcs/expression.cs:6038
msgid ""
"An implicitly typed local variable declarator cannot use an array initializer"
msgstr ""
-#: mcs/mcs/expression.cs:6159 mcs/mcs/expression.cs:6167
-#: mcs/mcs/statement.cs:1206 mcs/mcs/statement.cs:3582
+#: mcs/mcs/expression.cs:6182 mcs/mcs/expression.cs:6190
+#: mcs/mcs/statement.cs:1227 mcs/mcs/statement.cs:3619
msgid "A constant value is expected"
msgstr ""
-#: mcs/mcs/expression.cs:6173
+#: mcs/mcs/expression.cs:6196 mcs/mcs/expression.cs:6221
#, csharp-format
msgid "An array initializer of length `{0}' was expected"
msgstr ""
-#: mcs/mcs/expression.cs:6189
+#: mcs/mcs/expression.cs:6212
msgid ""
"Array initializers can only be used in a variable or field initializer. Try "
"using a new expression instead"
msgstr ""
-#: mcs/mcs/expression.cs:6197
+#: mcs/mcs/expression.cs:6229
msgid "A nested array initializer was expected"
msgstr ""
-#: mcs/mcs/expression.cs:6244
+#: mcs/mcs/expression.cs:6276
msgid "An expression tree cannot contain a multidimensional array initializer"
msgstr ""
-#: mcs/mcs/expression.cs:6280
+#: mcs/mcs/expression.cs:6312
msgid "Cannot create an array with a negative size"
msgstr ""
-#: mcs/mcs/expression.cs:6361
+#: mcs/mcs/expression.cs:6393
msgid ""
"Can only use array initializer expressions to assign to array types. Try "
"using a new expression instead"
msgstr ""
-#: mcs/mcs/expression.cs:6829
+#: mcs/mcs/expression.cs:6830
msgid ""
"The type of an implicitly typed array cannot be inferred from the "
"initializer. Try specifying array type explicitly"
msgstr ""
-#: mcs/mcs/expression.cs:6972
+#: mcs/mcs/expression.cs:6973
msgid ""
"The `this' object cannot be used before all of its fields are assigned to"
msgstr ""
-#: mcs/mcs/expression.cs:6979
+#: mcs/mcs/expression.cs:6980
msgid ""
"Keyword `this' is not valid in a static property, static method, or static "
"field initializer"
msgstr ""
-#: mcs/mcs/expression.cs:6982
+#: mcs/mcs/expression.cs:6983
msgid ""
"Anonymous methods inside structs cannot access instance members of `this'. "
"Consider copying `this' to a local variable outside the anonymous method and "
"using the local instead"
msgstr ""
-#: mcs/mcs/expression.cs:6985
+#: mcs/mcs/expression.cs:6986
msgid "Keyword `this' is not available in the current context"
msgstr ""
-#: mcs/mcs/expression.cs:7062
+#: mcs/mcs/expression.cs:7063
msgid "Cannot take the address of `this' because it is read-only"
msgstr ""
-#: mcs/mcs/expression.cs:7064
+#: mcs/mcs/expression.cs:7065
msgid "Cannot pass `this' as a ref or out argument because it is read-only"
msgstr ""
-#: mcs/mcs/expression.cs:7066
+#: mcs/mcs/expression.cs:7067
msgid "Cannot assign to `this' because it is read-only"
msgstr ""
-#: mcs/mcs/expression.cs:7138
+#: mcs/mcs/expression.cs:7139
msgid "The __arglist construct is valid only within a variable argument method"
msgstr ""
-#: mcs/mcs/expression.cs:7199
+#: mcs/mcs/expression.cs:7200
msgid "An expression tree cannot contain a method with variable arguments"
msgstr ""
-#: mcs/mcs/expression.cs:7436
+#: mcs/mcs/expression.cs:7437
msgid "The typeof operator cannot be used on the dynamic type"
msgstr ""
-#: mcs/mcs/expression.cs:7477
+#: mcs/mcs/expression.cs:7478
#, csharp-format
msgid "`{0}': an attribute argument cannot use type parameters"
msgstr ""
-#: mcs/mcs/expression.cs:7692
+#: mcs/mcs/expression.cs:7693
#, csharp-format
msgid ""
"`{0}' does not have a predefined size, therefore sizeof can only be used in "
"SizeOf)"
msgstr ""
-#: mcs/mcs/expression.cs:7759
+#: mcs/mcs/expression.cs:7760
#, csharp-format
msgid "Alias `{0}' not found"
msgstr "Alias `{0}' wurde nicht gefunden"
-#: mcs/mcs/expression.cs:7785
+#: mcs/mcs/expression.cs:7786
msgid ""
"The namespace alias qualifier `::' cannot be used to invoke a method. "
"Consider using `.' instead"
msgstr ""
-#: mcs/mcs/expression.cs:7894
+#: mcs/mcs/expression.cs:7895
msgid "Cannot perform member binding on `null' value"
msgstr ""
-#: mcs/mcs/expression.cs:8057
+#: mcs/mcs/expression.cs:8068
#, csharp-format
-msgid "`{0}': cannot reference a type through an expression; try `{1}' instead"
+msgid ""
+"`{0}': cannot reference a type through an expression. Consider using `{1}' "
+"instead"
msgstr ""
-#: mcs/mcs/expression.cs:8138
+#: mcs/mcs/expression.cs:8147
#, csharp-format
msgid "A nested type cannot be specified through a type parameter `{0}'"
msgstr ""
-#: mcs/mcs/expression.cs:8146
+#: mcs/mcs/expression.cs:8155
#, fuzzy, csharp-format
msgid ""
"Alias `{0}' cannot be used with `::' since it denotes a type. Consider "
"Der Alias `{0}' kann nicht mit '::' verwendet werden, da der Alias auf einen "
"Typ verweist. Verwenden Sie '.' stattdessen."
-#: mcs/mcs/expression.cs:8211
+#: mcs/mcs/expression.cs:8220
#, csharp-format
msgid "The nested type `{0}' does not exist in the type `{1}'"
msgstr ""
-#: mcs/mcs/expression.cs:8220
+#: mcs/mcs/expression.cs:8239
#, csharp-format
msgid ""
"Type `{0}' does not contain a definition for `{1}' and no extension method `"
-"{1}' of type `{0}' could be found (are you missing a using directive or an "
-"assembly reference?)"
+"{1}' of type `{0}' could be found. Are you missing {2}?"
msgstr ""
-#: mcs/mcs/expression.cs:8432
+#: mcs/mcs/expression.cs:8451
#, csharp-format
msgid "Cannot apply indexing with [] to an expression of type `{0}'"
msgstr ""
-#: mcs/mcs/expression.cs:8450
+#: mcs/mcs/expression.cs:8469
msgid "A pointer must be indexed by only one value"
msgstr ""
-#: mcs/mcs/expression.cs:8504
+#: mcs/mcs/expression.cs:8518
msgid "An element access expression cannot use named argument"
msgstr ""
-#: mcs/mcs/expression.cs:8582
+#: mcs/mcs/expression.cs:8596
#, csharp-format
msgid "Wrong number of indexes `{0}' inside [], expected `{1}'"
msgstr ""
-#: mcs/mcs/expression.cs:8970
+#: mcs/mcs/expression.cs:8984
msgid ""
"The indexer base access cannot be dynamically dispatched. Consider casting "
"the dynamic arguments or eliminating the base access"
msgstr ""
-#: mcs/mcs/expression.cs:9055
+#: mcs/mcs/expression.cs:9069
msgid "An expression tree may not contain a base access"
msgstr ""
-#: mcs/mcs/expression.cs:9073
+#: mcs/mcs/expression.cs:9087
msgid "Keyword `base' is not available in a static method"
msgstr ""
-#: mcs/mcs/expression.cs:9075
+#: mcs/mcs/expression.cs:9089
msgid "Keyword `base' is not available in the current context"
msgstr ""
-#: mcs/mcs/expression.cs:9113
+#: mcs/mcs/expression.cs:9127
msgid ""
"A property, indexer or dynamic member access may not be passed as `ref' or "
"`out' parameter"
msgstr ""
-#: mcs/mcs/expression.cs:9438
+#: mcs/mcs/expression.cs:9455
#, csharp-format
msgid "Array elements cannot be of type `{0}'"
msgstr ""
-#: mcs/mcs/expression.cs:9441
+#: mcs/mcs/expression.cs:9458
#, csharp-format
msgid "Array elements cannot be of static type `{0}'"
msgstr ""
-#: mcs/mcs/expression.cs:9617
+#: mcs/mcs/expression.cs:9634
msgid "Cannot use a negative size with stackalloc"
msgstr ""
-#: mcs/mcs/expression.cs:9621
+#: mcs/mcs/expression.cs:9638
msgid "Cannot use stackalloc in finally or catch"
msgstr ""
-#: mcs/mcs/expression.cs:9738
+#: mcs/mcs/expression.cs:9755
#, csharp-format
msgid ""
"Member `{0}' cannot be initialized. An object initializer may only be used "
"for fields, or properties"
msgstr ""
-#: mcs/mcs/expression.cs:9747
+#: mcs/mcs/expression.cs:9764
#, csharp-format
msgid ""
"Static field or property `{0}' cannot be assigned in an object initializer"
msgstr ""
-#: mcs/mcs/expression.cs:9946
+#: mcs/mcs/expression.cs:9963
#, csharp-format
msgid ""
"A field or property `{0}' cannot be initialized with a collection object "
"initializer because type `{1}' does not implement `{2}' interface"
msgstr ""
-#: mcs/mcs/expression.cs:9957
+#: mcs/mcs/expression.cs:9974
#, csharp-format
msgid "Inconsistent `{0}' member declaration"
msgstr ""
-#: mcs/mcs/expression.cs:9965
+#: mcs/mcs/expression.cs:9982
#, csharp-format
msgid ""
"An object initializer includes more than one member `{0}' initialization"
msgstr ""
-#: mcs/mcs/expression.cs:9983
+#: mcs/mcs/expression.cs:10000
#, csharp-format
msgid "Cannot initialize object of type `{0}' with a collection initializer"
msgstr ""
-#: mcs/mcs/expression.cs:10268
+#: mcs/mcs/expression.cs:10285
msgid "Anonymous types cannot be used in this expression"
msgstr ""
-#: mcs/mcs/expression.cs:10367
+#: mcs/mcs/expression.cs:10384
#, csharp-format
msgid "An anonymous type property `{0}' cannot be initialized with `{1}'"
msgstr ""
"Fixed size buffer `{0}' of length `{1}' and type `{2}' exceeded 2^31 limit"
msgstr ""
-#: mcs/mcs/field.cs:667
+#: mcs/mcs/field.cs:666
#, csharp-format
msgid "`{0}': A volatile field cannot be of the type `{1}'"
msgstr ""
-#: mcs/mcs/field.cs:672
+#: mcs/mcs/field.cs:671
#, fuzzy, csharp-format
msgid "`{0}': A field cannot be both volatile and readonly"
msgstr "`{0}' Eine Klasse kann nicht gleichzeitig statisch und versiegelt sein"
msgstr ""
#: mcs/mcs/flowanalysis.cs:996 mcs/mcs/flowanalysis.cs:1012
-#: mcs/mcs/flowanalysis.cs:1048 mcs/mcs/statement.cs:782
+#: mcs/mcs/flowanalysis.cs:1048 mcs/mcs/statement.cs:795
msgid "Control cannot leave the body of a finally clause"
msgstr ""
"`{0}' is not a valid constraint. Static classes cannot be used as constraints"
msgstr ""
-#: mcs/mcs/generic.cs:601
+#: mcs/mcs/generic.cs:613
#, csharp-format
msgid "The {2} type parameter `{0}' must be {3} valid on `{1}{4}'"
msgstr ""
-#: mcs/mcs/generic.cs:1974
+#: mcs/mcs/generic.cs:2032
#, csharp-format
msgid "`{0}': static classes cannot be used as generic arguments"
msgstr ""
-#: mcs/mcs/generic.cs:1981
+#: mcs/mcs/generic.cs:2039
#, csharp-format
msgid "The type `{0}' may not be used as a type argument"
msgstr ""
-#: mcs/mcs/generic.cs:2075
+#: mcs/mcs/generic.cs:2133
msgid "Variant type parameters can only be used with interfaces and delegates"
msgstr ""
-#: mcs/mcs/generic.cs:2314
+#: mcs/mcs/generic.cs:2354
#, fuzzy, csharp-format
msgid ""
"The type `{0}' must be a reference type in order to use it as type parameter "
"Der Typ `{0}' muss ein Referenztyp sein, damit er als `{1}'-Parameter in "
"generischen Typ oder in der generischen Methode `{2}' verwendet werden kann."
-#: mcs/mcs/generic.cs:2324
+#: mcs/mcs/generic.cs:2364
#, fuzzy, csharp-format
msgid ""
"The type `{0}' must be a non-nullable value type in order to use it as type "
"Der Typ `{0}' darf keine NULL-Werte zulassen, wenn er als `{1}'-Parameter im "
"generischen Typ oder in der generischen Methode `{2}' verwendet werden soll."
-#: mcs/mcs/generic.cs:2383
+#: mcs/mcs/generic.cs:2423
#, csharp-format
msgid ""
"The type `{0}' must have a public parameterless constructor in order to use "
"it as parameter `{1}' in the generic type or method `{2}'"
msgstr ""
-#: mcs/mcs/generic.cs:2451
+#: mcs/mcs/generic.cs:2479
#, fuzzy, csharp-format
msgid ""
"The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
"Der Typ `{0}' muss ein Referenztyp sein, damit er als `{1}'-Parameter in "
"generischen Typ oder in der generischen Methode `{2}' verwendet werden kann."
-#: mcs/mcs/generic.cs:2457
+#: mcs/mcs/generic.cs:2485
#, fuzzy, csharp-format
msgid ""
"The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
"Der Typ `{0}' muss ein Referenztyp sein, damit er als `{1}'-Parameter in "
"generischen Typ oder in der generischen Methode `{2}' verwendet werden kann."
-#: mcs/mcs/generic.cs:2461
+#: mcs/mcs/generic.cs:2489
#, fuzzy, csharp-format
msgid ""
"The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
"Der Typ `{0}' muss ein Referenztyp sein, damit er als `{1}'-Parameter in "
"generischen Typ oder in der generischen Methode `{2}' verwendet werden kann."
-#: mcs/mcs/generic.cs:2466
+#: mcs/mcs/generic.cs:2494
#, fuzzy, csharp-format
msgid ""
"The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
"Der Typ `{0}' muss ein Referenztyp sein, damit er als `{1}'-Parameter in "
"generischen Typ oder in der generischen Methode `{2}' verwendet werden kann."
-#: mcs/mcs/generic.cs:2471
+#: mcs/mcs/generic.cs:2499
#, fuzzy, csharp-format
msgid ""
"The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
"Der Typ `{0}' muss ein Referenztyp sein, damit er als `{1}'-Parameter in "
"generischen Typ oder in der generischen Methode `{2}' verwendet werden kann."
-#: mcs/mcs/import.cs:1818
+#: mcs/mcs/import.cs:1868
#, csharp-format
msgid ""
"Reference to type `{0}' claims it is defined in this assembly, but it is not "
"defined in source or any added modules"
msgstr ""
-#: mcs/mcs/import.cs:1822
+#: mcs/mcs/import.cs:1873
+#, csharp-format
+msgid ""
+"The type `{0}' has been forwarded to an assembly that is not referenced. "
+"Consider adding a reference to assembly `{1}'"
+msgstr ""
+
+#: mcs/mcs/import.cs:1877
#, csharp-format
msgid ""
"The type `{0}' is defined in an assembly that is not referenced. Consider "
"adding a reference to assembly `{1}'"
msgstr ""
-#: mcs/mcs/import.cs:1826
+#: mcs/mcs/import.cs:1882
#, csharp-format
msgid ""
"Reference to type `{0}' claims it is defined assembly `{1}', but it could "
msgid "Iterators cannot have unsafe parameters or yield types"
msgstr ""
-#: mcs/mcs/iterators.cs:1132 mcs/mcs/statement.cs:4950
+#: mcs/mcs/iterators.cs:1132 mcs/mcs/statement.cs:4987
msgid "Unsafe code may not appear in iterators"
msgstr ""
-#: mcs/mcs/ikvm.cs:236
+#: mcs/mcs/ikvm.cs:266
msgid "SDK path could not be resolved"
msgstr ""
-#: mcs/mcs/ikvm.cs:314
+#: mcs/mcs/ikvm.cs:344
#, csharp-format
msgid ""
"Assembly `{0}' references `{1}' which has a higher version number than "
"imported assembly `{2}'"
msgstr ""
-#: mcs/mcs/ikvm.cs:323 mcs/mcs/ikvm.cs:327
+#: mcs/mcs/ikvm.cs:353 mcs/mcs/ikvm.cs:357
#, csharp-format
msgid ""
"Assuming assembly reference `{0}' matches assembly `{1}'. You may need to "
"supply runtime policy"
msgstr ""
-#: mcs/mcs/ikvm.cs:413
+#: mcs/mcs/ikvm.cs:444
#, csharp-format
msgid ""
"An assembly with the same name `{0}' has already been imported. Consider "
"removing one of the references or sign the assembly"
msgstr ""
-#: mcs/mcs/ikvm.cs:422
+#: mcs/mcs/ikvm.cs:453
#, csharp-format
msgid ""
"An assembly with the same identity `{0}' has already been imported. Consider "
"suffix `{1}' to create a literal of this type"
msgstr ""
-#: mcs/mcs/membercache.cs:1388
+#: mcs/mcs/membercache.cs:1391
msgid ""
"A partial method declaration and partial method implementation cannot differ "
"on use of `params' modifier"
msgstr ""
-#: mcs/mcs/membercache.cs:1391
+#: mcs/mcs/membercache.cs:1394
msgid ""
"A partial method declaration and partial method implementation must be both "
"an extension method or neither"
msgstr ""
-#: mcs/mcs/membercache.cs:1395
+#: mcs/mcs/membercache.cs:1398
#, csharp-format
msgid ""
"Overloaded contructor `{0}' cannot differ on use of parameter modifiers only"
msgstr ""
-#: mcs/mcs/membercache.cs:1399
+#: mcs/mcs/membercache.cs:1402
#, csharp-format
msgid ""
"Overloaded method `{0}' cannot differ on use of parameter modifiers only"
msgstr ""
-#: mcs/mcs/membercache.cs:1431
+#: mcs/mcs/membercache.cs:1434
msgid ""
"A partial method declaration and partial method implementation must be both "
"`static' or neither"
msgstr ""
-#: mcs/mcs/membercache.cs:1436
+#: mcs/mcs/membercache.cs:1439
msgid ""
"A partial method declaration and partial method implementation must be both "
"`unsafe' or neither"
msgstr ""
-#: mcs/mcs/membercache.cs:1442
+#: mcs/mcs/membercache.cs:1445
#, csharp-format
msgid "A partial method `{0}' declaration is already defined"
msgstr ""
-#: mcs/mcs/membercache.cs:1446
+#: mcs/mcs/membercache.cs:1449
#, csharp-format
msgid "A partial method `{0}' implementation is already defined"
msgstr ""
-#: mcs/mcs/membercache.cs:1457 mcs/mcs/property.cs:81
+#: mcs/mcs/membercache.cs:1460 mcs/mcs/property.cs:81
#, csharp-format
msgid "A member `{0}' is already reserved"
msgstr ""
-#: mcs/mcs/membercache.cs:1468
+#: mcs/mcs/membercache.cs:1471
#, csharp-format
msgid "Duplicate user-defined conversion in type `{0}'"
msgstr ""
-#: mcs/mcs/membercache.cs:1474
+#: mcs/mcs/membercache.cs:1477
#, csharp-format
msgid ""
"A member `{0}' is already defined. Rename this member or use different "
"parameter types"
msgstr ""
-#: mcs/mcs/method.cs:552
+#: mcs/mcs/method.cs:558
#, csharp-format
msgid "`{0}': Async methods cannot use `MethodImplOptions.Synchronized'"
msgstr ""
-#: mcs/mcs/method.cs:560
+#: mcs/mcs/method.cs:566
msgid ""
"The DllImport attribute must be specified on a method marked `static' and "
"`extern'"
msgstr ""
-#: mcs/mcs/method.cs:655
+#: mcs/mcs/method.cs:661
#, csharp-format
msgid "`{0}': A partial method parameters cannot use `out' modifier"
msgstr ""
-#: mcs/mcs/method.cs:716
+#: mcs/mcs/method.cs:722
#, csharp-format
msgid ""
"Conditional not valid on `{0}' because it is a constructor, destructor, "
"Das Conditional-Attribut ist für `{0}' ungültig, weil dies ein Konstruktor, "
"Destruktor, Operator oder eine explizite Schnittstellenimplementierung ist"
-#: mcs/mcs/method.cs:855
-#, csharp-format
-msgid ""
-"`{0}': Cannot specify constraints for overrides and explicit interface "
-"implementation methods"
-msgstr ""
-
#: mcs/mcs/method.cs:865
msgid ""
"A partial method cannot define access modifier or any of abstract, extern, "
msgid "The return type of an async method must be void, Task, or Task<T>"
msgstr ""
-#: mcs/mcs/method.cs:1224
+#: mcs/mcs/method.cs:1227
#, fuzzy, csharp-format
msgid "`{0}': Extension methods cannot be defined in a nested class"
msgstr ""
"`{0}': Erweiterungsmethoden müssen in einer nicht generischen statischen "
"Klasse definiert werden"
-#: mcs/mcs/method.cs:1230
+#: mcs/mcs/method.cs:1233
#, csharp-format
msgid ""
"`{0}': Extension methods require `System.Runtime.CompilerServices."
"reference?"
msgstr ""
-#: mcs/mcs/method.cs:1239
+#: mcs/mcs/method.cs:1242
#, csharp-format
msgid "`{0}': Extension methods must be defined in a non-generic static class"
msgstr ""
"`{0}': Erweiterungsmethoden müssen in einer nicht generischen statischen "
"Klasse definiert werden"
-#: mcs/mcs/method.cs:1255
+#: mcs/mcs/method.cs:1258
#, fuzzy, csharp-format
msgid "`{0}': an entry point cannot be async method"
msgstr "`{0}': Abstrakte Eigenschaften können keine privaten-Accessoren haben"
-#: mcs/mcs/method.cs:1292
+#: mcs/mcs/method.cs:1295
#, csharp-format
msgid ""
"A partial method `{0}' implementation is missing a partial method declaration"
msgstr ""
-#: mcs/mcs/method.cs:1325
+#: mcs/mcs/method.cs:1336
#, csharp-format
msgid "Method or delegate cannot return type `{0}'"
msgstr ""
-#: mcs/mcs/method.cs:1404
+#: mcs/mcs/method.cs:1415
msgid ""
"The constructor call cannot be dynamically dispatched within constructor "
"initializer"
msgstr ""
-#: mcs/mcs/method.cs:1418
+#: mcs/mcs/method.cs:1429
#, fuzzy, csharp-format
msgid "`{0}': Struct constructors cannot call base constructors"
msgstr "`{0}': Statische Klassen können keinen Destruktor enthalten"
-#: mcs/mcs/method.cs:1436
+#: mcs/mcs/method.cs:1447
#, csharp-format
msgid "Constructor `{0}' cannot call itself"
msgstr ""
-#: mcs/mcs/method.cs:1565
+#: mcs/mcs/method.cs:1576
#, csharp-format
msgid "`{0}': The static constructor must be parameterless"
msgstr ""
-#: mcs/mcs/method.cs:1586
+#: mcs/mcs/method.cs:1597
msgid "Structs cannot contain explicit parameterless constructors"
msgstr ""
-#: mcs/mcs/method.cs:1636
+#: mcs/mcs/method.cs:1652
#, csharp-format
msgid ""
"`{0}': A class with the ComImport attribute cannot have a user-defined "
"constructor"
msgstr ""
-#: mcs/mcs/method.cs:1886
+#: mcs/mcs/method.cs:1902
#, fuzzy, csharp-format
msgid "`{0}' is an accessor not found in interface member `{1}{2}'"
msgstr "`{0}' implementiert den Schnittstellenmember `{1}' nicht"
-#: mcs/mcs/method.cs:1892
+#: mcs/mcs/method.cs:1908
#, csharp-format
msgid ""
"`{0}.{1}' in explicit interface declaration is not a member of interface"
msgstr ""
-#: mcs/mcs/method.cs:1900
+#: mcs/mcs/method.cs:1916
#, csharp-format
msgid ""
"`{0}' explicit method implementation cannot implement `{1}' because it is an "
"accessor"
msgstr ""
-#: mcs/mcs/method.cs:1910
+#: mcs/mcs/method.cs:1926
#, fuzzy, csharp-format
msgid "Method `{0}' cannot implement interface accessor `{1}'"
msgstr "`{0}' implementiert den Schnittstellenmember `{1}' nicht"
-#: mcs/mcs/method.cs:1917
+#: mcs/mcs/method.cs:1933
#, csharp-format
msgid ""
"Accessor `{0}' cannot implement interface member `{1}' for type `{2}'. Use "
"an explicit interface implementation"
msgstr ""
-#: mcs/mcs/method.cs:1924
+#: mcs/mcs/method.cs:1940
#, fuzzy, csharp-format
msgid ""
"Accessor `{0}' must be declared public to implement interface member `{1}'"
msgstr "`{0}' implementiert den Schnittstellenmember `{1}' nicht"
-#: mcs/mcs/method.cs:1944
+#: mcs/mcs/method.cs:1960
#, csharp-format
msgid ""
"`{0}': the explicit interface implementation cannot introduce the params "
"modifier"
msgstr ""
-#: mcs/mcs/method.cs:2282
+#: mcs/mcs/method.cs:2308
#, csharp-format
msgid ""
"Attribute `{0}' is not valid on property or event accessors. It is valid on `"
"{1}' declarations only"
msgstr ""
-#: mcs/mcs/method.cs:2510
+#: mcs/mcs/method.cs:2536
#, csharp-format
msgid "User-defined operator `{0}' must be declared static and public"
msgstr ""
-#: mcs/mcs/method.cs:2549
+#: mcs/mcs/method.cs:2580
msgid ""
"User-defined operator cannot take an object of the enclosing type and "
"convert to an object of the enclosing type"
msgstr ""
-#: mcs/mcs/method.cs:2560
+#: mcs/mcs/method.cs:2591
msgid "User-defined conversion must convert to or from the enclosing type"
msgstr ""
-#: mcs/mcs/method.cs:2566
+#: mcs/mcs/method.cs:2597
#, csharp-format
msgid ""
"User-defined conversion `{0}' cannot convert to or from the dynamic type"
msgstr ""
-#: mcs/mcs/method.cs:2573
+#: mcs/mcs/method.cs:2604
#, csharp-format
msgid ""
"User-defined conversion `{0}' cannot convert to or from an interface type"
msgstr ""
-#: mcs/mcs/method.cs:2580
+#: mcs/mcs/method.cs:2611
#, csharp-format
msgid "User-defined conversion `{0}' cannot convert to or from a base class"
msgstr ""
-#: mcs/mcs/method.cs:2586
+#: mcs/mcs/method.cs:2617
#, csharp-format
msgid "User-defined conversion `{0}' cannot convert to or from a derived class"
msgstr ""
-#: mcs/mcs/method.cs:2593
+#: mcs/mcs/method.cs:2624
msgid ""
"Overloaded shift operator must have the type of the first operand be the "
"containing type, and the type of the second operand must be int"
msgstr ""
-#: mcs/mcs/method.cs:2602
+#: mcs/mcs/method.cs:2633
msgid ""
"The return type for ++ or -- operator must be the containing type or derived "
"from the containing type"
"Der Rückgabetyp für die Operatoren ++ und -- muss der enthaltene Typ sein "
"oder vom enthaltenen Typ abgeleitet sein"
-#: mcs/mcs/method.cs:2607
+#: mcs/mcs/method.cs:2638
msgid "The parameter type for ++ or -- operator must be the containing type"
msgstr "Der Parameter für den ++ oder -- Operator muss der enthaltene Typ sein"
-#: mcs/mcs/method.cs:2614
+#: mcs/mcs/method.cs:2645
#, fuzzy
msgid "The parameter type of a unary operator must be the containing type"
msgstr "Der Parameter für den ++ oder -- Operator muss der enthaltene Typ sein"
-#: mcs/mcs/method.cs:2622
+#: mcs/mcs/method.cs:2653
msgid "The return type of operator True or False must be bool"
msgstr ""
-#: mcs/mcs/method.cs:2637
+#: mcs/mcs/method.cs:2668
#, fuzzy
msgid "One of the parameters of a binary operator must be the containing type"
msgstr "Der Parameter für den ++ oder -- Operator muss der enthaltene Typ sein"
msgid "The modifier `{0}' is not valid for this item"
msgstr ""
-#: mcs/mcs/namespace.cs:186
-#, csharp-format
+#: mcs/mcs/namespace.cs:263
+#, fuzzy, csharp-format
msgid ""
-"The type or namespace name `{0}' could not be found in the global namespace "
-"(are you missing an assembly reference?)"
+"The type or namespace name `{0}' could not be found in the global namespace. "
+"Are you missing {1} assembly reference?"
msgstr ""
"Der Typ oder Namespacename `{0}' konnte im globalen Namesapce nicht gefunden "
"werden. Fehlt ein Assemblyverweis?"
-#: mcs/mcs/namespace.cs:190
-#, csharp-format
+#: mcs/mcs/namespace.cs:267
+#, fuzzy, csharp-format
msgid ""
"The type or namespace name `{0}' does not exist in the namespace `{1}'. Are "
-"you missing an assembly reference?"
+"you missing {2} assembly reference?"
msgstr ""
"Der Typ oder Namespacename `{0}' existiert nicht im Namespace `{1}'. Fehlt "
"ein Assemblyverweis?"
-#: mcs/mcs/namespace.cs:284
+#: mcs/mcs/namespace.cs:367
#, csharp-format
msgid "The imported type `{0}' is defined multiple times"
msgstr ""
-#: mcs/mcs/namespace.cs:749 mcs/mcs/namespace.cs:761
+#: mcs/mcs/namespace.cs:839 mcs/mcs/namespace.cs:851
msgid ""
"A using clause must precede all other namespace elements except extern alias "
"declarations"
msgstr ""
-#: mcs/mcs/namespace.cs:777
+#: mcs/mcs/namespace.cs:867
#, csharp-format
msgid "The using alias `{0}' appeared previously in this namespace"
msgstr ""
-#: mcs/mcs/namespace.cs:815
+#: mcs/mcs/namespace.cs:905 mcs/mcs/namespace.cs:928
#, csharp-format
msgid "The namespace `{0}' already contains a definition for `{1}'"
msgstr ""
-#: mcs/mcs/namespace.cs:1037
+#: mcs/mcs/namespace.cs:1147
#, csharp-format
msgid "Namespace `{0}' contains a definition with same name as alias `{1}'"
msgstr ""
-#: mcs/mcs/namespace.cs:1089
+#: mcs/mcs/namespace.cs:1199
#, csharp-format
msgid "`{0}' is an ambiguous reference between `{1}' and `{2}'"
msgstr ""
-#: mcs/mcs/namespace.cs:1115
-#, csharp-format
-msgid ""
-"The type or namespace name `{0}' could not be found. Are you missing a using "
-"directive or an assembly reference?"
-msgstr ""
-"Der Typ oder Namespacename `{0}' konnte nicht gefunden werden. Fehlt eine "
-"using-Direktive oder ein Assemblyverweis?"
-
-#: mcs/mcs/namespace.cs:1317
+#: mcs/mcs/namespace.cs:1390
#, csharp-format
msgid ""
"`{0}' is a type not a namespace. A using namespace directive can only be "
"applied to namespaces"
msgstr ""
-#: mcs/mcs/namespace.cs:1336
+#: mcs/mcs/namespace.cs:1414
#, csharp-format
msgid "The extern alias `{0}' was not specified in -reference option"
msgstr ""
msgid "`{0}': abstract properties cannot have private accessors"
msgstr "`{0}': Abstrakte Eigenschaften können keine privaten-Accessoren haben"
-#: mcs/mcs/property.cs:397
+#: mcs/mcs/property.cs:402
#, csharp-format
msgid ""
"The accessibility modifier of the `{0}' accessor must be more restrictive "
"than the modifier of the property or indexer `{1}'"
msgstr ""
-#: mcs/mcs/property.cs:506
+#: mcs/mcs/property.cs:511
#, csharp-format
msgid "Explicit interface implementation `{0}' is missing accessor `{1}'"
msgstr ""
-#: mcs/mcs/property.cs:525
+#: mcs/mcs/property.cs:530
#, csharp-format
msgid ""
"`{0}': cannot override because `{1}' does not have an overridable get "
"accessor"
msgstr ""
-#: mcs/mcs/property.cs:542
+#: mcs/mcs/property.cs:547
#, csharp-format
msgid ""
"`{0}': cannot override because `{1}' does not have an overridable set "
"accessor"
msgstr ""
-#: mcs/mcs/property.cs:583
+#: mcs/mcs/property.cs:588
#, csharp-format
msgid ""
"`{0}': Cannot specify accessibility modifiers for both accessors of the "
"property or indexer"
msgstr ""
-#: mcs/mcs/property.cs:590
+#: mcs/mcs/property.cs:595
#, csharp-format
msgid ""
"`{0}': accessibility modifiers on accessors may only be used if the property "
"or indexer has both a get and a set accessor"
msgstr ""
-#: mcs/mcs/property.cs:818
+#: mcs/mcs/property.cs:823
#, csharp-format
msgid ""
"Automatically implemented property `{0}' cannot be used inside a type with "
"an explicit StructLayout attribute"
msgstr ""
-#: mcs/mcs/property.cs:1305
+#: mcs/mcs/property.cs:1312
#, csharp-format
msgid "`{0}': event must be of a delegate type"
msgstr ""
-#: mcs/mcs/property.cs:1581
+#: mcs/mcs/property.cs:1588
#, csharp-format
msgid ""
"The `{0}' attribute is valid only on an indexer that is not an explicit "
"interface member declaration"
msgstr ""
-#: mcs/mcs/property.cs:1585
+#: mcs/mcs/property.cs:1592
msgid "Cannot set the `IndexerName' attribute on an indexer marked override"
msgstr ""
msgid "Value specified for the argument to `{0}' is not valid"
msgstr ""
-#: mcs/mcs/statement.cs:92
+#: mcs/mcs/statement.cs:100
msgid ""
"A lambda expression with statement body cannot be converted to an expresion "
"tree"
msgstr ""
-#: mcs/mcs/statement.cs:845
+#: mcs/mcs/statement.cs:858
#, csharp-format
msgid ""
"An object of a type convertible to `{0}' is required for the return statement"
msgstr ""
-#: mcs/mcs/statement.cs:859 mcs/mcs/statement.cs:884
+#: mcs/mcs/statement.cs:872 mcs/mcs/statement.cs:896
#, csharp-format
msgid ""
"`{0}': A return keyword must not be followed by any expression when method "
"returns void"
msgstr ""
-#: mcs/mcs/statement.cs:895
+#: mcs/mcs/statement.cs:907
#, csharp-format
msgid ""
"`{0}': A return keyword must not be followed by an expression when async "
"method returns `Task'. Consider using `Task<T>' return type"
msgstr ""
-#: mcs/mcs/statement.cs:905
+#: mcs/mcs/statement.cs:917
#, csharp-format
msgid ""
"`{0}': The return expression type of async method must be `{1}' rather than "
"`Task<{1}>'"
msgstr ""
-#: mcs/mcs/statement.cs:929
+#: mcs/mcs/statement.cs:927
+#, csharp-format
+msgid ""
+"`{0}': A return keyword must not be followed by any expression when delegate "
+"returns void"
+msgstr ""
+
+#: mcs/mcs/statement.cs:950
#, csharp-format
msgid ""
"Cannot convert `{0}' to delegate type `{1}' because some of the return types "
"in the block are not implicitly convertible to the delegate return type"
msgstr ""
-#: mcs/mcs/statement.cs:977
+#: mcs/mcs/statement.cs:998
msgid ""
"Cannot return a value from iterators. Use the yield return statement to "
"return a value, or yield break to end the iteration"
msgstr ""
-#: mcs/mcs/statement.cs:1149 mcs/mcs/statement.cs:1194
+#: mcs/mcs/statement.cs:1170 mcs/mcs/statement.cs:1215
msgid "A goto case is only valid inside a switch statement"
msgstr ""
-#: mcs/mcs/statement.cs:1282 mcs/mcs/statement.cs:5351
+#: mcs/mcs/statement.cs:1303 mcs/mcs/statement.cs:5388
msgid "The type caught or thrown must be derived from System.Exception"
msgstr ""
-#: mcs/mcs/statement.cs:1527
+#: mcs/mcs/statement.cs:1548
msgid "A fixed statement cannot use an implicitly typed local variable"
msgstr ""
-#: mcs/mcs/statement.cs:1532
+#: mcs/mcs/statement.cs:1553
msgid "An implicitly typed local variable cannot be a constant"
msgstr ""
-#: mcs/mcs/statement.cs:1537
+#: mcs/mcs/statement.cs:1558
msgid ""
"An implicitly typed local variable declarator must include an initializer"
msgstr ""
-#: mcs/mcs/statement.cs:1542
+#: mcs/mcs/statement.cs:1563
msgid ""
"An implicitly typed local variable declaration cannot include multiple "
"declarators"
msgstr ""
-#: mcs/mcs/statement.cs:2164
+#: mcs/mcs/statement.cs:2185
#, csharp-format
msgid ""
"A local variable named `{0}' cannot be declared in this scope because it "
"scope to denote something else"
msgstr ""
-#: mcs/mcs/statement.cs:2176
+#: mcs/mcs/statement.cs:2197
#, csharp-format
msgid "A local variable named `{0}' is already defined in this scope"
msgstr ""
-#: mcs/mcs/statement.cs:2183
+#: mcs/mcs/statement.cs:2204
#, csharp-format
msgid ""
"The type parameter name `{0}' is the same as local variable or parameter name"
msgstr ""
-#: mcs/mcs/statement.cs:2898
+#: mcs/mcs/statement.cs:2935
#, csharp-format
msgid ""
"The out parameter `{0}' must be assigned to before control leaves the "
"current method"
msgstr ""
-#: mcs/mcs/statement.cs:3016
+#: mcs/mcs/statement.cs:3053
#, csharp-format
msgid "`{0}': not all code paths return a value"
msgstr ""
-#: mcs/mcs/statement.cs:3033
+#: mcs/mcs/statement.cs:3070
#, csharp-format
msgid "Not all code paths return a value in anonymous method of type `{0}'"
msgstr ""
-#: mcs/mcs/statement.cs:3081
+#: mcs/mcs/statement.cs:3118
#, fuzzy
msgid "Async methods cannot have ref or out parameters"
msgstr "`{0}' implementiert den Schnittstellenmember `{1}' nicht"
-#: mcs/mcs/statement.cs:3087
+#: mcs/mcs/statement.cs:3124
msgid "__arglist is not allowed in parameter list of async methods"
msgstr ""
-#: mcs/mcs/statement.cs:3093
+#: mcs/mcs/statement.cs:3130
#, fuzzy
msgid "Async methods cannot have unsafe parameters"
msgstr "`{0}' implementiert den Schnittstellenmember `{1}' nicht"
-#: mcs/mcs/statement.cs:3288
+#: mcs/mcs/statement.cs:3325
#, csharp-format
msgid "The label `{0}' is a duplicate"
msgstr ""
-#: mcs/mcs/statement.cs:3297 mcs/mcs/statement.cs:3308
+#: mcs/mcs/statement.cs:3334 mcs/mcs/statement.cs:3345
#, csharp-format
msgid ""
"The label `{0}' shadows another label by the same name in a contained scope"
msgstr ""
-#: mcs/mcs/statement.cs:3604
+#: mcs/mcs/statement.cs:3641
#, csharp-format
msgid "The label `case {0}:' already occurs in this switch statement"
msgstr ""
-#: mcs/mcs/statement.cs:4123
+#: mcs/mcs/statement.cs:4160
#, csharp-format
msgid ""
"A switch expression of type `{0}' cannot be converted to an integral type, "
"bool, char, string, enum or nullable type"
msgstr ""
-#: mcs/mcs/statement.cs:4734
+#: mcs/mcs/statement.cs:4771
#, csharp-format
msgid "`{0}' is not a reference type as required by the lock statement"
msgstr ""
-#: mcs/mcs/statement.cs:5081
+#: mcs/mcs/statement.cs:5118
msgid "The type of locals declared in a fixed statement must be a pointer type"
msgstr ""
-#: mcs/mcs/statement.cs:5097
+#: mcs/mcs/statement.cs:5134
msgid ""
"The right hand side of a fixed statement assignment may not be a cast "
"expression"
msgstr ""
-#: mcs/mcs/statement.cs:5167
+#: mcs/mcs/statement.cs:5204
msgid ""
"You cannot use the fixed statement to take the address of an already fixed "
"expression"
msgstr ""
-#: mcs/mcs/statement.cs:5523
+#: mcs/mcs/statement.cs:5560
#, csharp-format
msgid ""
"A previous catch clause already catches all exceptions of this or a super "
"type `{0}'"
msgstr ""
-#: mcs/mcs/statement.cs:5663
+#: mcs/mcs/statement.cs:5700
#, csharp-format
msgid ""
"`{0}': type used in a using statement must be implicitly convertible to "
"`System.IDisposable'"
msgstr ""
-#: mcs/mcs/statement.cs:6067
+#: mcs/mcs/statement.cs:6104
#, csharp-format
msgid ""
"foreach statement requires that the return type `{0}' of `{1}' must have a "
"suitable public MoveNext method and public Current property"
msgstr ""
-#: mcs/mcs/statement.cs:6112
+#: mcs/mcs/statement.cs:6149
#, csharp-format
msgid ""
"foreach statement cannot operate on variables of type `{0}' because it "
"implementation"
msgstr ""
-#: mcs/mcs/statement.cs:6141
+#: mcs/mcs/statement.cs:6178
#, csharp-format
msgid ""
"foreach statement cannot operate on variables of type `{0}' because it does "
"not contain a definition for `{1}' or is inaccessible"
msgstr ""
-#: mcs/mcs/statement.cs:6372
+#: mcs/mcs/statement.cs:6409
msgid "Use of null is not valid in this context"
msgstr ""
-#: mcs/mcs/statement.cs:6384
+#: mcs/mcs/statement.cs:6421
#, csharp-format
msgid "Foreach statement cannot operate on a `{0}'"
msgstr ""
-#: mcs/mcs/typemanager.cs:771
+#: mcs/mcs/typemanager.cs:785
#, csharp-format
msgid "The predefined type `{0}.{1}' is not defined or imported"
msgstr ""
-#: mcs/mcs/typemanager.cs:816
+#: mcs/mcs/typemanager.cs:830
#, csharp-format
msgid ""
"The predefined type `{0}.{1}' is defined multiple times. Using definition "
"from `{2}'"
msgstr ""
-#: mcs/mcs/typemanager.cs:831
+#: mcs/mcs/typemanager.cs:845
#, csharp-format
msgid "The predefined type `{0}.{1}' is not declared correctly"
msgstr ""
-#: mcs/mcs/typemanager.cs:956
+#: mcs/mcs/typemanager.cs:970
#, csharp-format
msgid ""
"The compiler required member `{0}.{1}{2}' could not be found or is "
"inaccessible"
msgstr ""
-#: mcs/mcs/typemanager.cs:1070
+#: mcs/mcs/typemanager.cs:1084
#, csharp-format
msgid ""
"Cannot take the address of, get the size of, or declare a pointer to a "
"managed type `{0}'"
msgstr ""
+#~ msgid ""
+#~ "The type or namespace name `{0}' could not be found. Are you missing a "
+#~ "using directive or an assembly reference?"
+#~ msgstr ""
+#~ "Der Typ oder Namespacename `{0}' konnte nicht gefunden werden. Fehlt eine "
+#~ "using-Direktive oder ein Assemblyverweis?"
+
#, fuzzy
#~ msgid "An expression tree cannot contain an await operator"
#~ msgstr ""
msgstr ""
"Project-Id-Version: mono 2.1\n"
"Report-Msgid-Bugs-To: http://www.mono-project.com/Bugs\n"
-"POT-Creation-Date: 2012-05-30 18:30+0100\n"
+"POT-Creation-Date: 2012-12-05 09:29+0100\n"
"PO-Revision-Date: 2008-09-19 13:28-0400\n"
"Last-Translator: Miguel de Icaza <miguel@novell.com>\n"
"Language-Team: es <mono-list@lists.ximian.com>\n"
"mismatch"
msgstr ""
-#: mcs/mcs/anonymous.cs:1027 mcs/mcs/ecore.cs:4913
+#: mcs/mcs/anonymous.cs:1027 mcs/mcs/ecore.cs:5056
#, csharp-format
msgid "Delegate `{0}' does not take `{1}' arguments"
msgstr "El delegado `{0} no toma {1} argumentos"
msgid "Parameter `{0}' is declared as type `{1}' but should be `{2}'"
msgstr "El parámetro `{0}' está declarado con `{1}' pero debería de ser `{2}'"
-#: mcs/mcs/anonymous.cs:1202
+#: mcs/mcs/anonymous.cs:1212
#, fuzzy
msgid "Async lambda expressions cannot be converted to expression trees"
msgstr ""
"Los métodos anónimos no pueden ser convertidos a árboles de expresiones"
-#: mcs/mcs/anonymous.cs:1240
+#: mcs/mcs/anonymous.cs:1250
msgid "An anonymous method cannot be converted to an expression tree"
msgstr ""
"Los métodos anónimos no pueden ser convertidos a árboles de expresiones"
-#: mcs/mcs/anonymous.cs:1259
+#: mcs/mcs/anonymous.cs:1269
#, csharp-format
msgid ""
"Cannot convert anonymous method block without a parameter list to delegate "
"type `{0}' because it has one or more `out' parameters"
msgstr ""
-#: mcs/mcs/anonymous.cs:1283
+#: mcs/mcs/anonymous.cs:1293
msgid ""
"Anonymous methods and lambda expressions cannot be used in the current "
"context"
"Los métodos anónimos y las expresiones lambdas no pueden ser usados en este "
"contexto"
-#: mcs/mcs/anonymous.cs:1326
+#: mcs/mcs/anonymous.cs:1336
#, fuzzy, csharp-format
msgid ""
"Local variable or parameter `{0}' cannot have their address taken and be "
"No se le puede tomar la dirección a la variable local o el parámetro `{0}' y "
"ser al mismo tiempo usada dentro de un método anónimo o una expresión lambda."
-#: mcs/mcs/anonymous.cs:1346
+#: mcs/mcs/anonymous.cs:1356
#, fuzzy, csharp-format
msgid "Cannot convert async {0} to delegate type `{1}'"
msgstr "No es posible convertir `{0}' a un un tipo que no es un delegado `{1}'"
-#: mcs/mcs/anonymous.cs:1596
+#: mcs/mcs/anonymous.cs:1594
msgid "An expression tree cannot contain an anonymous method expression"
msgstr ""
"Un árbol de expresiones no puede contener una expresión que sea una método "
"anónimo"
-#: mcs/mcs/anonymous.cs:1879
+#: mcs/mcs/anonymous.cs:1877
#, csharp-format
msgid ""
"`{0}': An anonymous type cannot have multiple properties with the same name"
msgid "Cannot assign to `{0}' because it is a `{1}'"
msgstr ""
-#: mcs/mcs/assembly.cs:286
+#: mcs/mcs/assembly.cs:279
msgid "Invalid type specified as an argument for TypeForwardedTo attribute"
msgstr ""
-#: mcs/mcs/assembly.cs:294
+#: mcs/mcs/assembly.cs:287
#, csharp-format
msgid "A duplicate type forward of type `{0}'"
msgstr ""
-#: mcs/mcs/assembly.cs:303
+#: mcs/mcs/assembly.cs:296
#, csharp-format
msgid "Cannot forward type `{0}' because it is defined in this assembly"
msgstr ""
-#: mcs/mcs/assembly.cs:309
+#: mcs/mcs/assembly.cs:302
#, fuzzy, csharp-format
msgid "Cannot forward type `{0}' because it is a nested type"
msgstr "No es posible aplicar el atributo `{0}' ya que es abstracto"
-#: mcs/mcs/assembly.cs:338
+#: mcs/mcs/assembly.cs:331
#, csharp-format
msgid ""
"Friend assembly reference `{0}' is invalid. InternalsVisibleTo declarations "
"cannot have a version, culture or processor architecture specified"
msgstr ""
-#: mcs/mcs/assembly.cs:346
+#: mcs/mcs/assembly.cs:339
#, csharp-format
msgid ""
"Friend assembly reference `{0}' is invalid. Strong named assemblies must "
"specify a public key in their InternalsVisibleTo declarations"
msgstr ""
-#: mcs/mcs/assembly.cs:381
+#: mcs/mcs/assembly.cs:374
#, csharp-format
msgid "Referenced assembly `{0}' does not have a strong name"
msgstr ""
-#: mcs/mcs/assembly.cs:387
+#: mcs/mcs/assembly.cs:380
#, csharp-format
msgid "Referenced assembly `{0}' has different culture setting of `{1}'"
msgstr ""
-#: mcs/mcs/assembly.cs:402
+#: mcs/mcs/assembly.cs:395
#, csharp-format
msgid ""
"Friend access was granted to `{0}', but the output assembly is named `{1}'. "
"it"
msgstr ""
-#: mcs/mcs/assembly.cs:416
+#: mcs/mcs/assembly.cs:409
msgid ""
"Could not sign the assembly. ECMA key can only be used to delay-sign "
"assemblies"
msgstr ""
-#: mcs/mcs/assembly.cs:657
+#: mcs/mcs/assembly.cs:650
msgid ""
"Added modules must be marked with the CLSCompliant attribute to match the "
"assembly"
msgstr ""
-#: mcs/mcs/assembly.cs:692 mcs/mcs/assembly.cs:707
+#: mcs/mcs/assembly.cs:685 mcs/mcs/assembly.cs:700
#, csharp-format
msgid ""
"Option `{0}' overrides attribute `{1}' given in a source file or added module"
msgstr ""
-#: mcs/mcs/assembly.cs:742
+#: mcs/mcs/assembly.cs:735
msgid "Delay signing was requested but no key file was given"
msgstr ""
-#: mcs/mcs/assembly.cs:763
+#: mcs/mcs/assembly.cs:756
msgid "Cannot link resource file when building a module"
msgstr ""
-#: mcs/mcs/assembly.cs:768
+#: mcs/mcs/assembly.cs:761
#, csharp-format
msgid "Error reading resource file `{0}'"
msgstr ""
-#: mcs/mcs/assembly.cs:838
+#: mcs/mcs/assembly.cs:831
msgid "Could not write to file `"
msgstr ""
-#: mcs/mcs/assembly.cs:882
+#: mcs/mcs/assembly.cs:875
#, fuzzy
msgid "Cannot specify -main if building a module or library"
msgstr ""
"No puede especificar el atributo `DefaultMember' en un tipo que contiene un "
"indexador"
-#: mcs/mcs/assembly.cs:908
+#: mcs/mcs/assembly.cs:901
#, csharp-format
msgid "Could not find `{0}' specified for Main method"
msgstr ""
-#: mcs/mcs/assembly.cs:914
+#: mcs/mcs/assembly.cs:907
#, fuzzy, csharp-format
msgid "`{0}' specified for Main method must be a valid class or struct"
msgstr "`{0}' Los métodos de extensión deben de ser estáticos"
-#: mcs/mcs/assembly.cs:918
+#: mcs/mcs/assembly.cs:911
#, fuzzy, csharp-format
msgid "`{0}' does not have a suitable static Main method"
msgstr ""
"La palabra reservada `new' no está permitida en los elementos de un espacio "
"de nombres"
-#: mcs/mcs/assembly.cs:921
+#: mcs/mcs/assembly.cs:914
#, csharp-format
msgid ""
"Program `{0}' does not contain a static `Main' method suitable for an entry "
"point"
msgstr ""
-#: mcs/mcs/assembly.cs:940
+#: mcs/mcs/assembly.cs:933
msgid "Error during assembly signing. "
msgstr ""
-#: mcs/mcs/assembly.cs:1125
+#: mcs/mcs/assembly.cs:1118
#, csharp-format
msgid "Metadata file `{0}' could not be found"
msgstr ""
-#: mcs/mcs/assembly.cs:1130
+#: mcs/mcs/assembly.cs:1123
#, fuzzy, csharp-format
msgid "Metadata file `{0}' does not contain valid metadata"
msgstr "El delegado `{0} no toma {1} argumentos"
-#: mcs/mcs/assembly.cs:1136
+#: mcs/mcs/assembly.cs:1129
#, csharp-format
msgid ""
"Referenced assembly file `{0}' is a module. Consider using `-addmodule' "
"option to add the module"
msgstr ""
-#: mcs/mcs/assembly.cs:1143
+#: mcs/mcs/assembly.cs:1136
#, csharp-format
msgid ""
"Added module file `{0}' is an assembly. Consider using `-r' option to "
"reference the file"
msgstr ""
-#: mcs/mcs/async.cs:70
+#: mcs/mcs/async.cs:72
msgid "The `await' operator cannot be used in the body of a lock statement"
msgstr ""
-#: mcs/mcs/async.cs:75
+#: mcs/mcs/async.cs:77
msgid "The `await' operator cannot be used in an unsafe context"
msgstr ""
-#: mcs/mcs/async.cs:140
+#: mcs/mcs/async.cs:142
#, csharp-format
msgid ""
"Cannot await void method `{0}'. Consider changing method return type to "
"`Task'"
msgstr ""
-#: mcs/mcs/async.cs:143
+#: mcs/mcs/async.cs:145
#, csharp-format
msgid "Cannot await `{0}' expression"
msgstr ""
-#: mcs/mcs/async.cs:293
+#: mcs/mcs/async.cs:291
#, csharp-format
msgid ""
"The awaiter type `{0}' must have suitable IsCompleted and GetResult members"
msgstr ""
-#: mcs/mcs/async.cs:301
+#: mcs/mcs/async.cs:299
msgid ""
"The `await' operator may only be used in a query expression within the first "
"collection expression of the initial `from' clause or within the collection "
"expression of a `join' clause"
msgstr ""
-#: mcs/mcs/async.cs:335
+#: mcs/mcs/async.cs:333
#, csharp-format
msgid "The `await' operand type `{0}' must have suitable GetAwaiter method"
msgstr ""
-#: mcs/mcs/async.cs:374
+#: mcs/mcs/async.cs:372
#, fuzzy, csharp-format
msgid "The awaiter type `{0}' must implement interface `{1}'"
msgstr "`{0}': el tipo contenedor no implementa la interface `{1}'"
-#: mcs/mcs/async.cs:601
+#: mcs/mcs/async.cs:605
msgid ""
"Cannot find compiler required types for asynchronous functions support. Are "
"you targeting the wrong framework version?"
msgstr ""
-#: mcs/mcs/attribute.cs:222
+#: mcs/mcs/attribute.cs:228
#, csharp-format
msgid ""
"`{0}' is not a valid named attribute argument. Named attribute arguments "
"properties which are public and not static"
msgstr ""
-#: mcs/mcs/attribute.cs:231
+#: mcs/mcs/attribute.cs:237
#, csharp-format
msgid ""
"`{0}' is not a valid named attribute argument because it is not a valid "
"attribute parameter type"
msgstr ""
-#: mcs/mcs/attribute.cs:237
+#: mcs/mcs/attribute.cs:243
#, fuzzy
msgid "An attribute argument cannot be dynamic expression"
msgstr ""
"Los métodos anónimos no pueden ser convertidos a árboles de expresiones"
-#: mcs/mcs/attribute.cs:242
+#: mcs/mcs/attribute.cs:248
msgid "The Guid attribute must be specified with the ComImport attribute"
msgstr ""
"El atributo Guid debe de ser especificado junto con el atributo ComImport"
-#: mcs/mcs/attribute.cs:247
+#: mcs/mcs/attribute.cs:253
#, csharp-format
msgid "Do not use `{0}' directly. Use parameter modifier `this' instead"
msgstr ""
"No use `{0}' directamente. Use el modificador de parámetro `this' en su "
"lugar"
-#: mcs/mcs/attribute.cs:252
+#: mcs/mcs/attribute.cs:258
#, fuzzy, csharp-format
msgid "Do not use `{0}' directly. Use `dynamic' keyword instead"
msgstr ""
"No use `{0}' directamente. Use el modificador de parámetro `this' en su "
"lugar"
-#: mcs/mcs/attribute.cs:261
+#: mcs/mcs/attribute.cs:267
#, csharp-format
msgid "Error during emitting `{0}' attribute. The reason is `{1}'"
msgstr "Error al emitir el atributo `{0}'. La razón es `{1}'"
-#: mcs/mcs/attribute.cs:314
+#: mcs/mcs/attribute.cs:321
#, fuzzy, csharp-format
msgid ""
"`{0}' is ambiguous between `{1}' and `{2}'. Use either `@{0}' or `{0}"
"`{0}' produce una amiguedad entre `{0}' y `{0}Attribute'. Use `@{0}' o `{0}"
"Attribute'"
-#: mcs/mcs/attribute.cs:336 mcs/mcs/attribute.cs:342
+#: mcs/mcs/attribute.cs:348 mcs/mcs/attribute.cs:354
#, csharp-format
msgid "`{0}': is not an attribute class"
msgstr "`{0}' no es una clase atributo"
-#: mcs/mcs/attribute.cs:434
+#: mcs/mcs/attribute.cs:446
#, csharp-format
msgid "Cannot apply attribute class `{0}' because it is abstract"
msgstr "No es posible aplicar el atributo `{0}' ya que es abstracto"
-#: mcs/mcs/attribute.cs:505
+#: mcs/mcs/attribute.cs:517
#, csharp-format
msgid "Duplicate named attribute `{0}' argument"
msgstr ""
-#: mcs/mcs/attribute.cs:964
+#: mcs/mcs/attribute.cs:976
#, csharp-format
msgid ""
"The attribute `{0}' is not valid on this declaration type. It is valid on `"
"{1}' declarations only"
msgstr ""
-#: mcs/mcs/attribute.cs:986
+#: mcs/mcs/attribute.cs:998
#, csharp-format
msgid "The argument to the `{0}' attribute must be a valid identifier"
msgstr ""
"El argumento pasado al atributo `{0}' debe de ser un identificador válido"
-#: mcs/mcs/attribute.cs:1000
+#: mcs/mcs/attribute.cs:1012
#, fuzzy, csharp-format
msgid "Invalid value for argument to `{0}' attribute"
msgstr "Valor inválido pasado a `System.AttributeUsage'"
-#: mcs/mcs/attribute.cs:1252
+#: mcs/mcs/attribute.cs:1274
#, csharp-format
msgid "The attribute `{0}' cannot be applied multiple times"
msgstr ""
-#: mcs/mcs/attribute.cs:1552
+#: mcs/mcs/attribute.cs:1580
#, csharp-format
msgid "`{0}' is obsolete: `{1}'"
msgstr ""
"El modificador `partial' solamente puede ser utilizado antes de `class', "
"`struct', `interface' o la palabra clave `void'"
-#: mcs/mcs/cs-tokenizer.cs:1470 mcs/mcs/cs-tokenizer.cs:1533
+#: mcs/mcs/cs-tokenizer.cs:1478 mcs/mcs/cs-tokenizer.cs:1541
msgid "Invalid number"
msgstr "Número inválido"
-#: mcs/mcs/cs-tokenizer.cs:1745
+#: mcs/mcs/cs-tokenizer.cs:1753
#, csharp-format
msgid "Unrecognized escape sequence `\\{0}'"
msgstr "Secuencia de escape no reconocida: `\\\\{0}'"
-#: mcs/mcs/cs-tokenizer.cs:1764
+#: mcs/mcs/cs-tokenizer.cs:1772
msgid "Unrecognized escape sequence"
msgstr "Secuencia de escape no reconocida"
-#: mcs/mcs/cs-tokenizer.cs:2034
+#: mcs/mcs/cs-tokenizer.cs:2041
#, fuzzy
msgid "Filename, single-line comment or end-of-line expected"
msgstr "Esperaba un comentario de una sola línea o el final de archivo"
-#: mcs/mcs/cs-tokenizer.cs:2084
+#: mcs/mcs/cs-tokenizer.cs:2090
#, fuzzy
msgid "Missing identifier to pre-processor directive"
msgstr "La directiva del pre-procesador requiere un identificador"
-#: mcs/mcs/cs-tokenizer.cs:2094 mcs/mcs/cs-tokenizer.cs:2098
+#: mcs/mcs/cs-tokenizer.cs:2100 mcs/mcs/cs-tokenizer.cs:2104
#, csharp-format
msgid "Identifier expected: {0}"
msgstr "Esperaba un identificador: {0}."
-#: mcs/mcs/cs-tokenizer.cs:2587
+#: mcs/mcs/cs-tokenizer.cs:2610
#, fuzzy
msgid "Integral constant is too large"
msgstr "La constante numérica es demasiado grande"
-#: mcs/mcs/cs-tokenizer.cs:2592
+#: mcs/mcs/cs-tokenizer.cs:2615
msgid "Invalid preprocessor directive"
msgstr "Directiva inválida para el pre-procesador."
-#: mcs/mcs/cs-tokenizer.cs:2599
+#: mcs/mcs/cs-tokenizer.cs:2622
#, csharp-format
msgid "Unexpected processor directive ({0})"
msgstr "Directiva inválida para el pre-procesador ({0})."
-#: mcs/mcs/cs-tokenizer.cs:2605
+#: mcs/mcs/cs-tokenizer.cs:2628
msgid ""
"Cannot define or undefine preprocessor symbols after first token in file"
msgstr ""
"No es posible definir nuevos símbolos para el preprocesador o elimiar las "
"definiciones existentes después del primer tóken del archivo"
-#: mcs/mcs/cs-tokenizer.cs:2611
+#: mcs/mcs/cs-tokenizer.cs:2634
msgid ""
"Preprocessor directives must appear as the first non-whitespace character on "
"a line"
"Las directivas del pre-procesador deben aparecer como el primer carácter en "
"la línea (que no sea un espacio en blanco)"
-#: mcs/mcs/cs-tokenizer.cs:2616
+#: mcs/mcs/cs-tokenizer.cs:2639
msgid "Single-line comment or end-of-line expected"
msgstr "Esperaba un comentario de una sola línea o el final de archivo"
-#: mcs/mcs/cs-tokenizer.cs:2661 mcs/mcs/cs-tokenizer.cs:3679
+#: mcs/mcs/cs-tokenizer.cs:2684 mcs/mcs/cs-tokenizer.cs:3719
msgid "Expected `#endif' directive"
msgstr "Esperaba la directiva `#endif'"
-#: mcs/mcs/cs-tokenizer.cs:2694 mcs/mcs/cs-tokenizer.cs:2715
-#: mcs/mcs/cs-tokenizer.cs:2746 mcs/mcs/cs-tokenizer.cs:3677
+#: mcs/mcs/cs-tokenizer.cs:2717 mcs/mcs/cs-tokenizer.cs:2738
+#: mcs/mcs/cs-tokenizer.cs:2769 mcs/mcs/cs-tokenizer.cs:3717
msgid "#endregion directive expected"
msgstr "Esperaba la directiva `#endregion'"
-#: mcs/mcs/cs-tokenizer.cs:2793
+#: mcs/mcs/cs-tokenizer.cs:2816
msgid "Wrong preprocessor directive"
msgstr "La directiva del pre-procesador es errónea"
-#: mcs/mcs/cs-tokenizer.cs:2805
+#: mcs/mcs/cs-tokenizer.cs:2828
#, csharp-format
msgid "#error: '{0}'"
msgstr "#error: '{0}'"
-#: mcs/mcs/cs-tokenizer.cs:2823
+#: mcs/mcs/cs-tokenizer.cs:2846
msgid "The line number specified for #line directive is missing or invalid"
msgstr ""
"Falta el número de linea especificado en la directiva #line o el número es "
"inválido"
-#: mcs/mcs/cs-tokenizer.cs:2876 mcs/mcs/cs-tokenizer.cs:3514
+#: mcs/mcs/cs-tokenizer.cs:2908 mcs/mcs/cs-tokenizer.cs:3554
msgid "Newline in constant"
msgstr "Hay un carácter nueva-linea en la constante"
-#: mcs/mcs/cs-tokenizer.cs:2893
+#: mcs/mcs/cs-tokenizer.cs:2934
msgid "Unterminated string literal"
msgstr "La literal de texto no tiene fin"
-#: mcs/mcs/cs-tokenizer.cs:2968
+#: mcs/mcs/cs-tokenizer.cs:3011
msgid "Identifier too long (limit is 512 chars)"
msgstr "El identificador es demasiado grande (el límite son 512 caracteres)"
-#: mcs/mcs/cs-tokenizer.cs:3354
+#: mcs/mcs/cs-tokenizer.cs:3394
msgid "End-of-file found, '*/' expected"
msgstr "El archivo se terminó, y esperaba encontrar un `*/'"
-#: mcs/mcs/cs-tokenizer.cs:3463
+#: mcs/mcs/cs-tokenizer.cs:3503
msgid "Keyword, identifier, or string expected after verbatim specifier: @"
msgstr ""
"Esperaba una palabra clave, un identificador o una cadena después del "
"especificador '@' (al pie de la letra)"
-#: mcs/mcs/cs-tokenizer.cs:3484
+#: mcs/mcs/cs-tokenizer.cs:3524
#, fuzzy, csharp-format
msgid "Unexpected character `{0}'"
msgstr "Esperaba `{0}'"
-#: mcs/mcs/cs-tokenizer.cs:3509
+#: mcs/mcs/cs-tokenizer.cs:3549
msgid "Empty character literal"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:3530
+#: mcs/mcs/cs-tokenizer.cs:3570
msgid "Too many characters in character literal"
msgstr ""
"declaration of this type exists"
msgstr ""
-#: mcs/mcs/class.cs:713
+#: mcs/mcs/class.cs:734
#, csharp-format
msgid ""
"`{0}': explicit interface declaration can only be declared in a class or "
"`{0}': las declaraciones explícitas de interfaces solamente pueden ser "
"declaradas en una clase o estructura"
-#: mcs/mcs/class.cs:772
+#: mcs/mcs/class.cs:793
#, csharp-format
msgid "Duplicate type parameter `{0}'"
msgstr ""
-#: mcs/mcs/class.cs:775
+#: mcs/mcs/class.cs:796
#, csharp-format
msgid "The type `{0}' already contains a definition for `{1}'"
msgstr ""
-#: mcs/mcs/class.cs:841
+#: mcs/mcs/class.cs:862
msgid ""
"Cannot specify the `DefaultMember' attribute on type containing an indexer"
msgstr ""
"No puede especificar el atributo `DefaultMember' en un tipo que contiene un "
"indexador"
-#: mcs/mcs/class.cs:846
+#: mcs/mcs/class.cs:867
msgid "The RequiredAttribute attribute is not permitted on C# types"
msgstr ""
-#: mcs/mcs/class.cs:1069
+#: mcs/mcs/class.cs:1093
#, fuzzy, csharp-format
msgid "Class `{0}' cannot derive from the dynamic type"
msgstr "`{0}' no es posible derivad de la clase especial `{1}'"
-#: mcs/mcs/class.cs:1086
+#: mcs/mcs/class.cs:1110
#, csharp-format
msgid "`{0}' is already listed in interface list"
msgstr "`{0}' ya está listado en la lista de interfaces"
-#: mcs/mcs/class.cs:1094
+#: mcs/mcs/class.cs:1118
#, csharp-format
msgid ""
"Inconsistent accessibility: base interface `{0}' is less accessible than "
"Accesibilidad inconsistente: la interface base `{0}' es menos accessible que "
"la interface `{1}'"
-#: mcs/mcs/class.cs:1100
+#: mcs/mcs/class.cs:1124
#, csharp-format
msgid "Type `{0}' in interface list is not an interface"
msgstr "El tipo `{0} en la lista de interfaces no es una interface"
-#: mcs/mcs/class.cs:1102
+#: mcs/mcs/class.cs:1126
#, csharp-format
msgid "`{0}': Classes cannot have multiple base classes (`{1}' and `{2}')"
msgstr ""
"`{0}': las clases no pueden tener múltiples clases base (`{1}' y `{2}')"
-#: mcs/mcs/class.cs:1105
+#: mcs/mcs/class.cs:1129
#, csharp-format
msgid "`{0}': Base class `{1}' must be specified as first"
msgstr "`{0}': la clase base `{1}' tiene que ser especificada primero"
-#: mcs/mcs/class.cs:1166
+#: mcs/mcs/class.cs:1190
#, csharp-format
msgid ""
"The operator `{0}' requires a matching operator `{1}' to also be defined"
"El operador `{0}' require que el operador correspondiente `{1}' también sea "
"definido"
-#: mcs/mcs/class.cs:1397
+#: mcs/mcs/class.cs:1421
#, csharp-format
msgid "Partial declarations of `{0}' must not specify different base classes"
msgstr ""
"Las declaraciones parciales de `{0}' no deben de especificar clases bases "
"distintas"
-#: mcs/mcs/class.cs:1441
+#: mcs/mcs/class.cs:1465
#, csharp-format
msgid ""
"Inherited interface `{0}' causes a cycle in the interface hierarchy of `{1}'"
"La interface heredada `{0}' produce un ciclo en la jerarquía de la interface "
"`{1}'"
-#: mcs/mcs/class.cs:1447
+#: mcs/mcs/class.cs:1471
#, csharp-format
msgid "Circular base class dependency involving `{0}' and `{1}'"
msgstr "Dependencia circular en la clase base involucrando `{0}' y `{1}'"
-#: mcs/mcs/class.cs:1593
+#: mcs/mcs/class.cs:1617
#, csharp-format
msgid ""
"Partial declarations of `{0}' have inconsistent constraints for type "
"Las declaraciones parciales de `{0}' tienen limitaciones inconsistentes para "
"el tipo parametrizado `{1}'"
-#: mcs/mcs/class.cs:1702
+#: mcs/mcs/class.cs:1726
#, fuzzy, csharp-format
msgid "`{0}': cannot implement a dynamic interface `{1}'"
msgstr "`{0}': el tipo contenedor no implementa la interface `{1}'"
-#: mcs/mcs/class.cs:1718
+#: mcs/mcs/class.cs:1742
#, csharp-format
msgid ""
"`{0}' cannot implement both `{1}' and `{2}' because they may unify for some "
"`{0}' no es posible implementar tanto `{1}' como `{2}' por que se pueden "
"unificar en algunos casos"
-#: mcs/mcs/class.cs:1737
+#: mcs/mcs/class.cs:1761
#, csharp-format
msgid ""
"A generic type cannot derive from `{0}' because it is an attribute class"
msgstr "Los tipos genericos no pueden derivad de `{0} ya que es un atributo"
-#: mcs/mcs/class.cs:1839
+#: mcs/mcs/class.cs:1870
msgid ""
"Two indexers have different names; the IndexerName attribute must be used "
"with the same name on every indexer within a type"
"Hay dos indexadores con nombres distintos; El atributo IndexerName debe "
"ser usado con el mismo nombre en todos los indexadores dentro de un tipo"
-#: mcs/mcs/class.cs:2089
+#: mcs/mcs/class.cs:2120
#, csharp-format
msgid "A static member `{0}' cannot be marked as override, virtual or abstract"
msgstr ""
"El miembro estático `{0}' no puede ser marcado con override, virtual o "
"abstract"
-#: mcs/mcs/class.cs:2096
+#: mcs/mcs/class.cs:2127
#, csharp-format
msgid "A member `{0}' marked as override cannot be marked as new or virtual"
msgstr ""
"El miembro `{0}' está usa `override' y no puede usar `new' o `virtual' "
-#: mcs/mcs/class.cs:2108
+#: mcs/mcs/class.cs:2139
#, csharp-format
msgid "`{0}' cannot be both extern and abstract"
msgstr "`{0}' no puede ser tanto externo como abstracto"
-#: mcs/mcs/class.cs:2113
+#: mcs/mcs/class.cs:2144
#, csharp-format
msgid "`{0}' cannot be both abstract and sealed"
msgstr "`{0}'' no puede ser tanto sellado como abstracto"
-#: mcs/mcs/class.cs:2118
+#: mcs/mcs/class.cs:2149
#, csharp-format
msgid "The abstract method `{0}' cannot be marked virtual"
msgstr "El método abstracto `{0} no puede ser marcado como virtual"
-#: mcs/mcs/class.cs:2124
+#: mcs/mcs/class.cs:2155
#, csharp-format
msgid "`{0}' is abstract but it is declared in the non-abstract class `{1}'"
msgstr ""
"`{0}' es abstracto pero ha sido declarado dentro de una clase que no es "
"abstracta (`{1}')"
-#: mcs/mcs/class.cs:2132
+#: mcs/mcs/class.cs:2163
#, csharp-format
msgid "`{0}': virtual or abstract members cannot be private"
msgstr "`{0}': los miembros virtuales o abstractos no pueden ser privados"
-#: mcs/mcs/class.cs:2139
+#: mcs/mcs/class.cs:2170
#, csharp-format
msgid "`{0}' cannot be sealed because it is not an override"
msgstr "`{0}' no puede sellarse por que no es una sobrecarga"
-#: mcs/mcs/class.cs:2179
+#: mcs/mcs/class.cs:2210
#, csharp-format
msgid "`{0}': containing type does not implement interface `{1}'"
msgstr "`{0}': el tipo contenedor no implementa la interface `{1}'"
-#: mcs/mcs/class.cs:2369
+#: mcs/mcs/class.cs:2400
#, csharp-format
msgid "Type parameter `{0}' has same name as containing type, or method"
msgstr ""
"El tipo parametrizado `{0}' tiene el mimo nombre que el tipo contenedor, o "
"el método"
-#: mcs/mcs/class.cs:2377
+#: mcs/mcs/class.cs:2408
#, csharp-format
msgid "`{0}': member names cannot be the same as their enclosing type"
msgstr ""
"`{0}': los nombres de los miembros no pueden ser el mismo que el del tipo "
"contenedor"
-#: mcs/mcs/class.cs:2496
+#: mcs/mcs/class.cs:2527
msgid ""
"The class System.Object cannot have a base class or implement an interface."
msgstr ""
"La clase Syste.Object no puede tener una clase base o implementar una "
"interface."
-#: mcs/mcs/class.cs:2505
+#: mcs/mcs/class.cs:2536
#, csharp-format
msgid "Attribute `{0}' is only valid on classes derived from System.Attribute"
msgstr ""
"El atributo `{0}' solamente es válido en las clases derivadas de System."
"Attribute"
-#: mcs/mcs/class.cs:2510
+#: mcs/mcs/class.cs:2541
msgid ""
"Attribute `System.Diagnostics.ConditionalAttribute' is only valid on methods "
"or attribute classes"
"El atributo `System.Diagnostics.ConditionalAttribute' solamente es válido en "
"métodos o en clases derivadas de System.Attribute"
-#: mcs/mcs/class.cs:2539
+#: mcs/mcs/class.cs:2570
#, csharp-format
msgid "`{0}': an abstract class cannot be sealed or static"
msgstr "`{0}': una clase abstracta no puede estar sellada o ser estática"
-#: mcs/mcs/class.cs:2543
+#: mcs/mcs/class.cs:2574
#, csharp-format
msgid "`{0}': a class cannot be both static and sealed"
msgstr "`{0}': una clase no puede estar sellada y ser estática al mismo tiempo"
-#: mcs/mcs/class.cs:2549
+#: mcs/mcs/class.cs:2580
#, csharp-format
msgid "`{0}': Static classes cannot contain user-defined operators"
msgstr ""
"`{0}': las clases estáticas no pueden contener operadores definidos por el "
"usuario"
-#: mcs/mcs/class.cs:2554
+#: mcs/mcs/class.cs:2585
#, csharp-format
msgid "`{0}': Static classes cannot contain destructor"
msgstr "`{0}': las clases estáticas no pueden contener un destructor"
-#: mcs/mcs/class.cs:2559
+#: mcs/mcs/class.cs:2590
#, csharp-format
msgid "`{0}': cannot declare indexers in a static class"
msgstr "`{0}': no es posible declarar indexadores en una clase estática"
-#: mcs/mcs/class.cs:2567
+#: mcs/mcs/class.cs:2598
#, csharp-format
msgid "`{0}': Static classes cannot have instance constructors"
msgstr ""
"`{0}': las clases estáticas no pueden tener constructores de instancias"
-#: mcs/mcs/class.cs:2571
+#: mcs/mcs/class.cs:2602
#, csharp-format
msgid "`{0}': cannot declare instance members in a static class"
msgstr ""
"`{0}'L no es posible declarar miembros de instancia en una clase estática"
-#: mcs/mcs/class.cs:2602
+#: mcs/mcs/class.cs:2633
#, fuzzy, csharp-format
msgid "`{0}': Cannot derive from type parameter `{1}'"
msgstr "`{0}': no es posible derivar de una clase estática (`{1}')"
-#: mcs/mcs/class.cs:2606
+#: mcs/mcs/class.cs:2637
#, csharp-format
msgid "`{0}': Cannot derive from static class `{1}'"
msgstr "`{0}': no es posible derivar de una clase estática (`{1}')"
-#: mcs/mcs/class.cs:2610
+#: mcs/mcs/class.cs:2641
#, fuzzy, csharp-format
msgid "`{0}': cannot derive from sealed type `{1}'"
msgstr "`{0}': no es posible derivad de una clase sellada (`{1}')"
-#: mcs/mcs/class.cs:2613
+#: mcs/mcs/class.cs:2644
#, csharp-format
msgid ""
"Static class `{0}' cannot derive from type `{1}'. Static classes must derive "
"La clase estática `{0}' no puede derivarse del tipo `{1}'. Las clases "
"estáticas deben derivar de `System.Object'"
-#: mcs/mcs/class.cs:2624
+#: mcs/mcs/class.cs:2655
#, csharp-format
msgid "`{0}' cannot derive from special class `{1}'"
msgstr "`{0}' no es posible derivad de la clase especial `{1}'"
-#: mcs/mcs/class.cs:2634
+#: mcs/mcs/class.cs:2665
#, csharp-format
msgid ""
"Inconsistent accessibility: base class `{0}' is less accessible than class `"
"Accesibilidad inconsistente: la clase base `{0}' es menos accessible que la "
"clase `{1}'"
-#: mcs/mcs/class.cs:2642
+#: mcs/mcs/class.cs:2673
#, csharp-format
msgid "Static class `{0}' cannot implement interfaces"
msgstr "Las clases estáticas no pueden implementar interfaces (`{0}')"
-#: mcs/mcs/class.cs:2753 mcs/mcs/class.cs:2767
+#: mcs/mcs/class.cs:2784 mcs/mcs/class.cs:2798
#, csharp-format
msgid "Struct member `{0}' of type `{1}' causes a cycle in the struct layout"
msgstr ""
-#: mcs/mcs/class.cs:2849
+#: mcs/mcs/class.cs:2880
#, csharp-format
msgid "`{0}': Structs cannot have instance field initializers"
msgstr ""
"`{0}': las estructuras no pueden tener inicializadores de campos en "
"instancias"
-#: mcs/mcs/class.cs:3037
+#: mcs/mcs/class.cs:3068
#, fuzzy, csharp-format
msgid "Do not override `{0}'. Use destructor syntax instead"
msgstr ""
"No use `{0}' directamente. Use el modificador de parámetro `this' en su "
"lugar"
-#: mcs/mcs/class.cs:3040
+#: mcs/mcs/class.cs:3071
#, csharp-format
msgid "`{0}' is marked as an override but no suitable {1} found to override"
msgstr ""
"`{0}' está marcado como una sobreescritura pero no es posible encontrar {1} "
"para usar override"
-#: mcs/mcs/class.cs:3046
+#: mcs/mcs/class.cs:3077
#, csharp-format
msgid "`{0}': cannot override because `{1}' is not an event"
msgstr "`{0}': no es posible sobreescribir ya que `{1}' no es un evento"
-#: mcs/mcs/class.cs:3049
+#: mcs/mcs/class.cs:3080
#, csharp-format
msgid "`{0}': cannot override because `{1}' is not a property"
msgstr "`{0}': no es posible sobreescribir `{1}' ya que no es una propiedad"
-#: mcs/mcs/class.cs:3052
+#: mcs/mcs/class.cs:3083
#, csharp-format
msgid "`{0}': cannot override because `{1}' is not a method"
msgstr "`{0}': no es posible sobreescribir `{1}' ya que no es un método"
-#: mcs/mcs/class.cs:3071
+#: mcs/mcs/class.cs:3102
#, fuzzy, csharp-format
msgid ""
"`{0}' cannot override inherited members `{1}' and `{2}' because they have "
"`{0}': no es posible sobreescribir el miembro heredado `{1}' ya que este "
"está sellado"
-#: mcs/mcs/class.cs:3124 mcs/mcs/field.cs:198
+#: mcs/mcs/class.cs:3155 mcs/mcs/field.cs:198
#, csharp-format
msgid "`{0}' hides inherited abstract member `{1}'"
msgstr "`{0}' esconde el miembro abstracto heredado `{1}'"
-#: mcs/mcs/class.cs:3148
+#: mcs/mcs/class.cs:3179
#, csharp-format
msgid ""
"`{0}': cannot override inherited member `{1}' because it is not marked "
"`{0}': no es posible sobreescribir el miembro heredado `{1}' ya que este no "
"está marcado con `virtual', `abstract' u `override'"
-#: mcs/mcs/class.cs:3156
+#: mcs/mcs/class.cs:3187
#, csharp-format
msgid "`{0}': cannot override inherited member `{1}' because it is sealed"
msgstr ""
"`{0}': no es posible sobreescribir el miembro heredado `{1}' ya que este "
"está sellado"
-#: mcs/mcs/class.cs:3165
+#: mcs/mcs/class.cs:3196
#, csharp-format
msgid "`{0}': type must be `{1}' to match overridden member `{2}'"
msgstr ""
"`{0}': el tipo debe de ser `{1}' para que corresponda con el miembro "
"sobreescrito `{2}'"
-#: mcs/mcs/class.cs:3168
+#: mcs/mcs/class.cs:3199
#, csharp-format
msgid "`{0}': return type must be `{1}' to match overridden member `{2}'"
msgstr ""
"`{0}': El tipo de regreso debe de ser `{1}' para qu ecorresponda con el "
"miembro sobreescrito `{2}'"
-#: mcs/mcs/class.cs:3236
+#: mcs/mcs/class.cs:3267
#, csharp-format
msgid "A partial method `{0}' cannot explicitly implement an interface"
msgstr ""
-#: mcs/mcs/class.cs:3242
+#: mcs/mcs/class.cs:3273
#, fuzzy, csharp-format
msgid "The type `{0}' in explicit interface declaration is not an interface"
msgstr "El tipo `{0} en la lista de interfaces no es una interface"
-#: mcs/mcs/class.cs:3273
+#: mcs/mcs/class.cs:3304
#, csharp-format
msgid ""
"Inconsistent accessibility: parameter type `{0}' is less accessible than "
"Accesibilidad inconsistente: la interface base `{0}' es menos accessible que "
"el indexador `{1}'"
-#: mcs/mcs/class.cs:3277
+#: mcs/mcs/class.cs:3308
#, csharp-format
msgid ""
"Inconsistent accessibility: parameter type `{0}' is less accessible than "
"Accesibilidad inconsistente: el tipo del parámetro `{0}' es menos accessible "
"que el operador `{1}'"
-#: mcs/mcs/class.cs:3281
+#: mcs/mcs/class.cs:3312
#, csharp-format
msgid ""
"Inconsistent accessibility: parameter type `{0}' is less accessible than "
"method `{1}'"
msgstr ""
-#: mcs/mcs/class.cs:3341
+#: mcs/mcs/class.cs:3372
#, csharp-format
msgid ""
"`{0}': cannot change access modifiers when overriding `{1}' inherited member "
"`{2}'"
msgstr ""
-#: mcs/mcs/class.cs:3350
+#: mcs/mcs/class.cs:3381
#, fuzzy, csharp-format
msgid "`{0}': static types cannot be used as return types"
msgstr ""
"`{0}': las clases estáticas no pueden tener constructores de instancias"
-#: mcs/mcs/class.cs:3463
+#: mcs/mcs/class.cs:3442
+#, csharp-format
+msgid ""
+"`{0}': Cannot specify constraints for overrides and explicit interface "
+"implementation methods"
+msgstr ""
+
+#: mcs/mcs/class.cs:3504
#, csharp-format
msgid "New virtual member `{0}' is declared in a sealed class `{1}'"
msgstr ""
-#: mcs/mcs/class.cs:3478
+#: mcs/mcs/class.cs:3519
msgid "Inconsistent accessibility: property type `"
msgstr ""
-#: mcs/mcs/class.cs:3483
+#: mcs/mcs/class.cs:3524
msgid "Inconsistent accessibility: indexer return type `"
msgstr ""
-#: mcs/mcs/class.cs:3489 mcs/mcs/class.cs:3494 mcs/mcs/delegate.cs:171
+#: mcs/mcs/class.cs:3530 mcs/mcs/class.cs:3535 mcs/mcs/delegate.cs:171
msgid "Inconsistent accessibility: return type `"
msgstr ""
-#: mcs/mcs/class.cs:3499
+#: mcs/mcs/class.cs:3540
msgid "Inconsistent accessibility: field type `"
msgstr ""
-#: mcs/mcs/class.cs:3511
+#: mcs/mcs/class.cs:3552
#, csharp-format
msgid ""
"Parameters or local variables of type `{0}' cannot be declared in async "
"methods or iterators"
msgstr ""
-#: mcs/mcs/class.cs:3515
+#: mcs/mcs/class.cs:3556
#, fuzzy, csharp-format
msgid ""
"Local variables of type `{0}' cannot be used inside anonymous methods, "
"No se le puede tomar la dirección a la variable local o el parámetro `{0}' y "
"ser al mismo tiempo usada dentro de un método anónimo o una expresión lambda."
-#: mcs/mcs/class.cs:3519
+#: mcs/mcs/class.cs:3560
#, csharp-format
msgid "Field or property cannot be of type `{0}'"
msgstr ""
"The evaluation of the constant value for `{0}' involves a circular definition"
msgstr ""
-#: mcs/mcs/constant.cs:66 mcs/mcs/constant.cs:392
+#: mcs/mcs/constant.cs:66 mcs/mcs/constant.cs:403
#, csharp-format
msgid "Constant value `{0}' cannot be converted to a `{1}'"
msgstr ""
-#: mcs/mcs/constant.cs:264
+#: mcs/mcs/constant.cs:266
#, csharp-format
msgid ""
"Constant value `{0}' cannot be converted to a `{1}' (use `unchecked' syntax "
"to override)"
msgstr ""
-#: mcs/mcs/convert.cs:1184
+#: mcs/mcs/convert.cs:1185
#, csharp-format
msgid ""
"Ambiguous user defined operators `{0}' and `{1}' when converting from `{2}' "
"Extension method `{0}' of value type `{1}' cannot be used to create delegates"
msgstr ""
-#: mcs/mcs/delegate.cs:532
+#: mcs/mcs/delegate.cs:535
#, csharp-format
msgid "Cannot create delegate from partial method declaration `{0}'"
msgstr ""
-#: mcs/mcs/delegate.cs:535
+#: mcs/mcs/delegate.cs:538
#, csharp-format
msgid ""
"Cannot create delegate with `{0}' because it has a Conditional attribute"
msgstr ""
-#: mcs/mcs/delegate.cs:578
+#: mcs/mcs/delegate.cs:581
#, csharp-format
msgid ""
"A method or delegate `{0} {1}' parameters and return type must be same as "
"delegate `{2} {3}' parameters and return type"
msgstr ""
-#: mcs/mcs/delegate.cs:585
+#: mcs/mcs/delegate.cs:588
#, csharp-format
msgid ""
"A method or delegate `{0}' parameters do not match delegate `{1}' parameters"
msgstr ""
-#: mcs/mcs/delegate.cs:590
+#: mcs/mcs/delegate.cs:593
#, csharp-format
msgid ""
"A method or delegate `{0} {1}' return type does not match delegate `{2} {3}' "
"return type"
msgstr ""
-#: mcs/mcs/delegate.cs:673
+#: mcs/mcs/delegate.cs:676
msgid "Method name expected"
msgstr ""
-#: mcs/mcs/doc.cs:613
+#: mcs/mcs/doc.cs:621
#, csharp-format
msgid "Error generating XML documentation file `{0}' (`{1}')"
msgstr ""
-#: mcs/mcs/driver.cs:51
+#: mcs/mcs/driver.cs:52
msgid "Source file `"
msgstr ""
-#: mcs/mcs/driver.cs:96
-#, csharp-format
-msgid "Source file `{0}' could not be found"
-msgstr ""
-
-#: mcs/mcs/driver.cs:103
-#, csharp-format
-msgid "Source file `{0}' is a binary file and not a text file"
-msgstr ""
-
-#: mcs/mcs/driver.cs:210
+#: mcs/mcs/driver.cs:258
msgid "No files to compile were specified"
msgstr ""
-#: mcs/mcs/driver.cs:215
+#: mcs/mcs/driver.cs:263
msgid "Platform option `anycpu32bitpreferred' is valid only for executables"
msgstr ""
-#: mcs/mcs/driver.cs:245
+#: mcs/mcs/driver.cs:293
msgid ""
"If no source files are specified you must specify the output file with -out:"
msgstr ""
-#: mcs/mcs/driver.cs:262
+#: mcs/mcs/driver.cs:310
msgid "Output file name is not valid"
msgstr ""
msgstr ""
#: mcs/mcs/ecore.cs:328
-#, csharp-format
-msgid ""
-"Members of value type `{0}' cannot be assigned using a property `{1}' object "
-"initializer"
-msgstr ""
-
-#: mcs/mcs/ecore.cs:331
-#, csharp-format
-msgid ""
-"Cannot modify a value type return value of `{0}'. Consider storing the value "
-"in a temporary variable"
-msgstr ""
-
-#: mcs/mcs/ecore.cs:335
msgid ""
"The left-hand side of an assignment must be a variable, a property or an "
"indexer"
msgstr ""
-#: mcs/mcs/ecore.cs:341
+#: mcs/mcs/ecore.cs:334
msgid "The operation in question is undefined on void pointers"
msgstr ""
-#: mcs/mcs/ecore.cs:408 mcs/mcs/statement.cs:3001 mcs/mcs/statement.cs:3003
+#: mcs/mcs/ecore.cs:422 mcs/mcs/statement.cs:3038 mcs/mcs/statement.cs:3040
#, csharp-format
msgid "Internal compiler error: {0}"
msgstr ""
-#: mcs/mcs/ecore.cs:448
+#: mcs/mcs/ecore.cs:462
msgid "A ref or out argument must be an assignable variable"
msgstr ""
-#: mcs/mcs/ecore.cs:467
+#: mcs/mcs/ecore.cs:481
msgid ""
"An attribute argument must be a constant expression, typeof expression or "
"array creation expression"
msgstr ""
-#: mcs/mcs/ecore.cs:641
+#: mcs/mcs/ecore.cs:655
#, csharp-format
msgid "The class `{0}' has no constructors defined"
msgstr ""
-#: mcs/mcs/ecore.cs:763
+#: mcs/mcs/ecore.cs:777
#, csharp-format
msgid "The `{0}' operator cannot be applied to operand of type `{1}'"
msgstr ""
-#: mcs/mcs/ecore.cs:769
+#: mcs/mcs/ecore.cs:783
msgid "An expression tree cannot contain an unsafe pointer operation"
msgstr ""
-#: mcs/mcs/ecore.cs:847
+#: mcs/mcs/ecore.cs:861
#, csharp-format
msgid "`{0}' is a `{1}' but a `{2}' was expected"
msgstr ""
-#: mcs/mcs/ecore.cs:880
+#: mcs/mcs/ecore.cs:894
#, csharp-format
msgid "Expression denotes a `{0}', where a `{1}' was expected"
msgstr ""
-#: mcs/mcs/ecore.cs:890
+#: mcs/mcs/ecore.cs:904
msgid "Pointers and fixed size buffers may only be used in an unsafe context"
msgstr ""
-#: mcs/mcs/ecore.cs:2323
+#: mcs/mcs/ecore.cs:2364
#, csharp-format
msgid ""
"Dynamic keyword requires `{0}' to be defined. Are you missing System.Core."
"dll assembly reference?"
msgstr ""
-#: mcs/mcs/ecore.cs:2399
+#: mcs/mcs/ecore.cs:2440
#, csharp-format
msgid ""
"A local variable `{0}' cannot be used before it is declared. Consider "
"renaming the local variable when it hides the member `{1}'"
msgstr ""
-#: mcs/mcs/ecore.cs:2414 mcs/mcs/ecore.cs:2457
+#: mcs/mcs/ecore.cs:2455 mcs/mcs/ecore.cs:2498
#, csharp-format
msgid "`{0}' conflicts with a declaration in a child block"
msgstr ""
-#: mcs/mcs/ecore.cs:2466
+#: mcs/mcs/ecore.cs:2507
#, csharp-format
msgid "A local variable `{0}' cannot be used before it is declared"
msgstr ""
-#: mcs/mcs/ecore.cs:2520
+#: mcs/mcs/ecore.cs:2561
#, csharp-format
msgid "The name `{0}' does not exist in the current context"
msgstr ""
-#: mcs/mcs/ecore.cs:2616
+#: mcs/mcs/ecore.cs:2657
msgid "System.Void cannot be used from C#. Consider using `void'"
msgstr ""
-#: mcs/mcs/ecore.cs:2900
+#: mcs/mcs/ecore.cs:2941
#, csharp-format
msgid "Cannot call an abstract base member `{0}'"
msgstr ""
-#: mcs/mcs/ecore.cs:2907
+#: mcs/mcs/ecore.cs:2948
#, csharp-format
msgid ""
"Cannot access protected member `{0}' via a qualifier of type `{1}'. The "
"qualifier must be of type `{2}' or derived from it"
msgstr ""
-#: mcs/mcs/ecore.cs:2950
+#: mcs/mcs/ecore.cs:2964
+#, csharp-format
+msgid ""
+"Members of value type `{0}' cannot be assigned using a property `{1}' object "
+"initializer"
+msgstr ""
+
+#: mcs/mcs/ecore.cs:2968
+#, csharp-format
+msgid ""
+"Cannot modify a value type return value of `{0}'. Consider storing the value "
+"in a temporary variable"
+msgstr ""
+
+#: mcs/mcs/ecore.cs:2994
#, csharp-format
msgid ""
"Static member `{0}' cannot be accessed with an instance reference, qualify "
"it with a type name instead"
msgstr ""
-#: mcs/mcs/ecore.cs:2965
+#: mcs/mcs/ecore.cs:3009
#, csharp-format
msgid ""
"A field initializer cannot reference the nonstatic field, method, or "
"property `{0}'"
msgstr ""
-#: mcs/mcs/ecore.cs:2969
+#: mcs/mcs/ecore.cs:3013
#, csharp-format
msgid "An object reference is required to access non-static member `{0}'"
msgstr ""
-#: mcs/mcs/ecore.cs:2978
+#: mcs/mcs/ecore.cs:3022
#, csharp-format
msgid ""
"Cannot access a nonstatic member of outer type `{0}' via nested type `{1}'"
msgstr ""
-#: mcs/mcs/ecore.cs:3026
+#: mcs/mcs/ecore.cs:3070
msgid "Cannot modify the result of an unboxing conversion"
msgstr ""
-#: mcs/mcs/ecore.cs:3192
+#: mcs/mcs/ecore.cs:3240
#, csharp-format
msgid ""
"Type `{0}' does not contain a member `{1}' and the best extension method "
"overload `{2}' has some invalid arguments"
msgstr ""
-#: mcs/mcs/ecore.cs:3197
+#: mcs/mcs/ecore.cs:3245
#, csharp-format
msgid "Extension method instance type `{0}' cannot be converted to `{1}'"
msgstr ""
-#: mcs/mcs/ecore.cs:3331
+#: mcs/mcs/ecore.cs:3379
msgid "An expression tree cannot contain an expression with method group"
msgstr ""
-#: mcs/mcs/ecore.cs:3337
+#: mcs/mcs/ecore.cs:3385
msgid ""
"Partial methods with only a defining declaration or removed conditional "
"methods cannot be used in an expression tree"
msgstr ""
-#: mcs/mcs/ecore.cs:3369
+#: mcs/mcs/ecore.cs:3417
#, csharp-format
msgid ""
"Cannot convert method group `{0}' to non-delegate type `{1}'. Consider using "
"parentheses to invoke the method"
msgstr ""
-#: mcs/mcs/ecore.cs:4049
+#: mcs/mcs/ecore.cs:4150
#, csharp-format
msgid ""
"The type `{0}' does not contain a constructor that takes `{1}' arguments"
msgstr ""
-#: mcs/mcs/ecore.cs:4715
+#: mcs/mcs/ecore.cs:4837
#, csharp-format
msgid ""
"Type `{0}' does not contain a member `{1}' and the best extension method "
"without the extension method syntax"
msgstr ""
-#: mcs/mcs/ecore.cs:4743
+#: mcs/mcs/ecore.cs:4876
#, csharp-format
msgid ""
"The call is ambiguous between the following methods or properties: `{0}' and "
"`{1}'"
msgstr ""
-#: mcs/mcs/ecore.cs:4801
+#: mcs/mcs/ecore.cs:4939
#, csharp-format
msgid ""
-"The best overloaded collection initalizer method `{0}' cannot have 'ref', or "
+"The best overloaded collection initalizer method `{0}' cannot have `ref' or "
"`out' modifier"
msgstr ""
-#: mcs/mcs/ecore.cs:4805
+#: mcs/mcs/ecore.cs:4943
#, csharp-format
msgid ""
"The best overloaded collection initalizer method `{0}' has some invalid "
"arguments"
msgstr ""
-#: mcs/mcs/ecore.cs:4808
+#: mcs/mcs/ecore.cs:4946
#, csharp-format
msgid "Delegate `{0}' has some invalid arguments"
msgstr ""
-#: mcs/mcs/ecore.cs:4812
+#: mcs/mcs/ecore.cs:4950
#, csharp-format
msgid "The best overloaded method match for `{0}' has some invalid arguments"
msgstr ""
-#: mcs/mcs/ecore.cs:4821
+#: mcs/mcs/ecore.cs:4959
#, csharp-format
msgid ""
"Argument `#{0}' does not require `{1}' modifier. Consider removing `{1}' "
"modifier"
msgstr ""
-#: mcs/mcs/ecore.cs:4824
+#: mcs/mcs/ecore.cs:4962
#, csharp-format
msgid "Argument `#{0}' is missing `{1}' modifier"
msgstr ""
-#: mcs/mcs/ecore.cs:4836
+#: mcs/mcs/ecore.cs:4979
#, csharp-format
msgid "Argument `#{0}' cannot convert `{1}' expression to type `{2}'"
msgstr ""
-#: mcs/mcs/ecore.cs:4889
+#: mcs/mcs/ecore.cs:5032
#, csharp-format
msgid ""
"The type arguments for method `{0}' cannot be inferred from the usage. Try "
"specifying the type arguments explicitly"
msgstr ""
-#: mcs/mcs/ecore.cs:4918
+#: mcs/mcs/ecore.cs:5061
#, csharp-format
msgid "No overload for method `{0}' takes `{1}' arguments"
msgstr ""
-#: mcs/mcs/ecore.cs:4971
+#: mcs/mcs/ecore.cs:5114
#, fuzzy, csharp-format
msgid "The delegate `{0}' does not contain a parameter named `{1}'"
msgstr "El delegado `{0} no toma {1} argumentos"
-#: mcs/mcs/ecore.cs:4976
+#: mcs/mcs/ecore.cs:5119
#, csharp-format
msgid ""
"The best overloaded method match for `{0}' does not contain a parameter "
"named `{1}'"
msgstr ""
-#: mcs/mcs/ecore.cs:4986
+#: mcs/mcs/ecore.cs:5129
#, csharp-format
msgid ""
"Named argument `{0}' cannot be used for a parameter which has positional "
"argument specified"
msgstr ""
-#: mcs/mcs/ecore.cs:5322
+#: mcs/mcs/ecore.cs:5467
msgid ""
"You cannot use fixed size buffers contained in unfixed expressions. Try "
"using the fixed statement"
msgstr ""
-#: mcs/mcs/ecore.cs:5327
+#: mcs/mcs/ecore.cs:5472
#, csharp-format
msgid "`{0}': Fixed size buffers can only be accessed through locals or fields"
msgstr ""
-#: mcs/mcs/ecore.cs:5363
+#: mcs/mcs/ecore.cs:5508
#, csharp-format
msgid "Use of possibly unassigned field `{0}'"
msgstr ""
-#: mcs/mcs/ecore.cs:5789
+#: mcs/mcs/ecore.cs:5935
#, csharp-format
msgid "Property or event `{0}' is not supported by the C# language"
msgstr ""
-#: mcs/mcs/ecore.cs:5969
+#: mcs/mcs/ecore.cs:6131
#, csharp-format
msgid "A range variable `{0}' may not be passes as `ref' or `out' parameter"
msgstr ""
-#: mcs/mcs/ecore.cs:6047
+#: mcs/mcs/ecore.cs:6204
#, csharp-format
msgid ""
"The property or indexer `{0}' cannot be used in this context because it "
"lacks the `get' accessor"
msgstr ""
-#: mcs/mcs/ecore.cs:6054
+#: mcs/mcs/ecore.cs:6211
#, csharp-format
msgid ""
"The property or indexer `{0}' cannot be used in this context because the get "
"accessor is inaccessible"
msgstr ""
-#: mcs/mcs/ecore.cs:6073
+#: mcs/mcs/ecore.cs:6230
#, csharp-format
msgid "Property or indexer `{0}' cannot be assigned to (it is read-only)"
msgstr ""
-#: mcs/mcs/ecore.cs:6081
+#: mcs/mcs/ecore.cs:6238
#, csharp-format
msgid ""
"The property or indexer `{0}' cannot be used in this context because the set "
"accessor is inaccessible"
msgstr ""
-#: mcs/mcs/ecore.cs:6249
+#: mcs/mcs/ecore.cs:6406
#, csharp-format
msgid ""
"The event `{0}' can only appear on the left hand side of `+=' or `-=' "
"operator"
msgstr ""
-#: mcs/mcs/ecore.cs:6253
+#: mcs/mcs/ecore.cs:6410
#, csharp-format
msgid ""
"The event `{0}' can only appear on the left hand side of += or -= when used "
"outside of the type `{1}'"
msgstr ""
-#: mcs/mcs/ecore.cs:6423
+#: mcs/mcs/ecore.cs:6580
#, csharp-format
msgid ""
"An implicitly typed local variable declaration cannot be initialized with `"
"{0}'"
msgstr ""
-#: mcs/mcs/ecore.cs:6437
+#: mcs/mcs/ecore.cs:6594
msgid ""
"The contextual keyword `var' may only appear within a local variable "
"declaration"
msgid "Type byte, sbyte, short, ushort, int, uint, long or ulong expected"
msgstr ""
-#: mcs/mcs/eval.cs:562
+#: mcs/mcs/eval.cs:563
msgid "Detection Parsing Error"
msgstr ""
"{1}' is used as a short circuit operator"
msgstr ""
-#: mcs/mcs/expression.cs:4635
+#: mcs/mcs/expression.cs:4656
#, csharp-format
msgid ""
"Type of conditional expression cannot be determined as `{0}' and `{1}' "
"convert implicitly to each other"
msgstr ""
-#: mcs/mcs/expression.cs:4645
+#: mcs/mcs/expression.cs:4666
#, csharp-format
msgid ""
"Type of conditional expression cannot be determined because there is no "
"implicit conversion between `{0}' and `{1}'"
msgstr ""
-#: mcs/mcs/expression.cs:4943
+#: mcs/mcs/expression.cs:4964
#, csharp-format
msgid "Use of unassigned local variable `{0}'"
msgstr ""
-#: mcs/mcs/expression.cs:4963
+#: mcs/mcs/expression.cs:4984
#, csharp-format
msgid ""
"Cannot use fixed local `{0}' inside an anonymous method, lambda expression "
"or query expression"
msgstr ""
-#: mcs/mcs/expression.cs:5156
+#: mcs/mcs/expression.cs:5177
#, csharp-format
msgid ""
"Parameter `{0}' cannot be used inside `{1}' when using `ref' or `out' "
"modifier"
msgstr ""
-#: mcs/mcs/expression.cs:5235
+#: mcs/mcs/expression.cs:5256
#, csharp-format
msgid "Use of unassigned out parameter `{0}'"
msgstr ""
-#: mcs/mcs/expression.cs:5345
+#: mcs/mcs/expression.cs:5368
#, fuzzy, csharp-format
msgid "Cannot invoke a non-delegate type `{0}'"
msgstr "No es posible convertir `{0}' a un un tipo que no es un delegado `{1}'"
-#: mcs/mcs/expression.cs:5356
+#: mcs/mcs/expression.cs:5379
#, csharp-format
msgid "The member `{0}' cannot be used as method or delegate"
msgstr ""
-#: mcs/mcs/expression.cs:5376
+#: mcs/mcs/expression.cs:5399
msgid ""
"Do not directly call your base class Finalize method. It is called "
"automatically from your destructor"
msgstr ""
-#: mcs/mcs/expression.cs:5378
+#: mcs/mcs/expression.cs:5401
msgid ""
"Destructors and object.Finalize cannot be called directly. Consider calling "
"IDisposable.Dispose if available"
msgstr ""
-#: mcs/mcs/expression.cs:5407
+#: mcs/mcs/expression.cs:5430
#, csharp-format
msgid ""
"The base call to method `{0}' cannot be dynamically dispatched. Consider "
"casting the dynamic arguments or eliminating the base access"
msgstr ""
-#: mcs/mcs/expression.cs:5480
+#: mcs/mcs/expression.cs:5503
#, csharp-format
msgid "`{0}': cannot explicitly call operator or accessor"
msgstr ""
-#: mcs/mcs/expression.cs:5664
+#: mcs/mcs/expression.cs:5687
#, csharp-format
msgid "Unsafe type `{0}' cannot be used in an object creation expression"
msgstr ""
-#: mcs/mcs/expression.cs:5687
+#: mcs/mcs/expression.cs:5710
#, csharp-format
msgid ""
"Cannot create an instance of the variable type `{0}' because it does not "
"have the new() constraint"
msgstr ""
-#: mcs/mcs/expression.cs:5693
+#: mcs/mcs/expression.cs:5716
#, csharp-format
msgid ""
"`{0}': cannot provide arguments when creating an instance of a variable type"
msgstr ""
-#: mcs/mcs/expression.cs:5702
+#: mcs/mcs/expression.cs:5725
#, csharp-format
msgid "Cannot create an instance of the static class `{0}'"
msgstr ""
-#: mcs/mcs/expression.cs:5714
+#: mcs/mcs/expression.cs:5737
#, csharp-format
msgid "Cannot create an instance of the abstract class or interface `{0}'"
msgstr ""
-#: mcs/mcs/expression.cs:6015
+#: mcs/mcs/expression.cs:6038
msgid ""
"An implicitly typed local variable declarator cannot use an array initializer"
msgstr ""
-#: mcs/mcs/expression.cs:6159 mcs/mcs/expression.cs:6167
-#: mcs/mcs/statement.cs:1206 mcs/mcs/statement.cs:3582
+#: mcs/mcs/expression.cs:6182 mcs/mcs/expression.cs:6190
+#: mcs/mcs/statement.cs:1227 mcs/mcs/statement.cs:3619
msgid "A constant value is expected"
msgstr ""
-#: mcs/mcs/expression.cs:6173
+#: mcs/mcs/expression.cs:6196 mcs/mcs/expression.cs:6221
#, csharp-format
msgid "An array initializer of length `{0}' was expected"
msgstr ""
-#: mcs/mcs/expression.cs:6189
+#: mcs/mcs/expression.cs:6212
msgid ""
"Array initializers can only be used in a variable or field initializer. Try "
"using a new expression instead"
msgstr ""
-#: mcs/mcs/expression.cs:6197
+#: mcs/mcs/expression.cs:6229
msgid "A nested array initializer was expected"
msgstr ""
-#: mcs/mcs/expression.cs:6244
+#: mcs/mcs/expression.cs:6276
msgid "An expression tree cannot contain a multidimensional array initializer"
msgstr ""
-#: mcs/mcs/expression.cs:6280
+#: mcs/mcs/expression.cs:6312
msgid "Cannot create an array with a negative size"
msgstr ""
-#: mcs/mcs/expression.cs:6361
+#: mcs/mcs/expression.cs:6393
msgid ""
"Can only use array initializer expressions to assign to array types. Try "
"using a new expression instead"
msgstr ""
-#: mcs/mcs/expression.cs:6829
+#: mcs/mcs/expression.cs:6830
msgid ""
"The type of an implicitly typed array cannot be inferred from the "
"initializer. Try specifying array type explicitly"
msgstr ""
-#: mcs/mcs/expression.cs:6972
+#: mcs/mcs/expression.cs:6973
msgid ""
"The `this' object cannot be used before all of its fields are assigned to"
msgstr ""
-#: mcs/mcs/expression.cs:6979
+#: mcs/mcs/expression.cs:6980
msgid ""
"Keyword `this' is not valid in a static property, static method, or static "
"field initializer"
msgstr ""
-#: mcs/mcs/expression.cs:6982
+#: mcs/mcs/expression.cs:6983
msgid ""
"Anonymous methods inside structs cannot access instance members of `this'. "
"Consider copying `this' to a local variable outside the anonymous method and "
"using the local instead"
msgstr ""
-#: mcs/mcs/expression.cs:6985
+#: mcs/mcs/expression.cs:6986
msgid "Keyword `this' is not available in the current context"
msgstr ""
-#: mcs/mcs/expression.cs:7062
+#: mcs/mcs/expression.cs:7063
msgid "Cannot take the address of `this' because it is read-only"
msgstr ""
-#: mcs/mcs/expression.cs:7064
+#: mcs/mcs/expression.cs:7065
msgid "Cannot pass `this' as a ref or out argument because it is read-only"
msgstr ""
-#: mcs/mcs/expression.cs:7066
+#: mcs/mcs/expression.cs:7067
msgid "Cannot assign to `this' because it is read-only"
msgstr ""
-#: mcs/mcs/expression.cs:7138
+#: mcs/mcs/expression.cs:7139
msgid "The __arglist construct is valid only within a variable argument method"
msgstr ""
-#: mcs/mcs/expression.cs:7199
+#: mcs/mcs/expression.cs:7200
msgid "An expression tree cannot contain a method with variable arguments"
msgstr ""
-#: mcs/mcs/expression.cs:7436
+#: mcs/mcs/expression.cs:7437
msgid "The typeof operator cannot be used on the dynamic type"
msgstr ""
-#: mcs/mcs/expression.cs:7477
+#: mcs/mcs/expression.cs:7478
#, csharp-format
msgid "`{0}': an attribute argument cannot use type parameters"
msgstr ""
-#: mcs/mcs/expression.cs:7692
+#: mcs/mcs/expression.cs:7693
#, csharp-format
msgid ""
"`{0}' does not have a predefined size, therefore sizeof can only be used in "
"SizeOf)"
msgstr ""
-#: mcs/mcs/expression.cs:7759
+#: mcs/mcs/expression.cs:7760
#, csharp-format
msgid "Alias `{0}' not found"
msgstr ""
-#: mcs/mcs/expression.cs:7785
+#: mcs/mcs/expression.cs:7786
msgid ""
"The namespace alias qualifier `::' cannot be used to invoke a method. "
"Consider using `.' instead"
msgstr ""
-#: mcs/mcs/expression.cs:7894
+#: mcs/mcs/expression.cs:7895
msgid "Cannot perform member binding on `null' value"
msgstr ""
-#: mcs/mcs/expression.cs:8057
+#: mcs/mcs/expression.cs:8068
#, csharp-format
-msgid "`{0}': cannot reference a type through an expression; try `{1}' instead"
+msgid ""
+"`{0}': cannot reference a type through an expression. Consider using `{1}' "
+"instead"
msgstr ""
-#: mcs/mcs/expression.cs:8138
+#: mcs/mcs/expression.cs:8147
#, csharp-format
msgid "A nested type cannot be specified through a type parameter `{0}'"
msgstr ""
-#: mcs/mcs/expression.cs:8146
+#: mcs/mcs/expression.cs:8155
#, csharp-format
msgid ""
"Alias `{0}' cannot be used with `::' since it denotes a type. Consider "
"replacing `::' with `.'"
msgstr ""
-#: mcs/mcs/expression.cs:8211
+#: mcs/mcs/expression.cs:8220
#, csharp-format
msgid "The nested type `{0}' does not exist in the type `{1}'"
msgstr ""
-#: mcs/mcs/expression.cs:8220
+#: mcs/mcs/expression.cs:8239
#, csharp-format
msgid ""
"Type `{0}' does not contain a definition for `{1}' and no extension method `"
-"{1}' of type `{0}' could be found (are you missing a using directive or an "
-"assembly reference?)"
+"{1}' of type `{0}' could be found. Are you missing {2}?"
msgstr ""
-#: mcs/mcs/expression.cs:8432
+#: mcs/mcs/expression.cs:8451
#, csharp-format
msgid "Cannot apply indexing with [] to an expression of type `{0}'"
msgstr ""
-#: mcs/mcs/expression.cs:8450
+#: mcs/mcs/expression.cs:8469
msgid "A pointer must be indexed by only one value"
msgstr ""
-#: mcs/mcs/expression.cs:8504
+#: mcs/mcs/expression.cs:8518
msgid "An element access expression cannot use named argument"
msgstr ""
-#: mcs/mcs/expression.cs:8582
+#: mcs/mcs/expression.cs:8596
#, csharp-format
msgid "Wrong number of indexes `{0}' inside [], expected `{1}'"
msgstr ""
-#: mcs/mcs/expression.cs:8970
+#: mcs/mcs/expression.cs:8984
msgid ""
"The indexer base access cannot be dynamically dispatched. Consider casting "
"the dynamic arguments or eliminating the base access"
msgstr ""
-#: mcs/mcs/expression.cs:9055
+#: mcs/mcs/expression.cs:9069
msgid "An expression tree may not contain a base access"
msgstr ""
-#: mcs/mcs/expression.cs:9073
+#: mcs/mcs/expression.cs:9087
#, fuzzy
msgid "Keyword `base' is not available in a static method"
msgstr ""
"La palabra reservada `new' no está permitida en los elementos de un espacio "
"de nombres"
-#: mcs/mcs/expression.cs:9075
+#: mcs/mcs/expression.cs:9089
#, fuzzy
msgid "Keyword `base' is not available in the current context"
msgstr ""
"La palabra reservada `new' no está permitida en los elementos de un espacio "
"de nombres"
-#: mcs/mcs/expression.cs:9113
+#: mcs/mcs/expression.cs:9127
msgid ""
"A property, indexer or dynamic member access may not be passed as `ref' or "
"`out' parameter"
msgstr ""
-#: mcs/mcs/expression.cs:9438
+#: mcs/mcs/expression.cs:9455
#, csharp-format
msgid "Array elements cannot be of type `{0}'"
msgstr ""
-#: mcs/mcs/expression.cs:9441
+#: mcs/mcs/expression.cs:9458
#, csharp-format
msgid "Array elements cannot be of static type `{0}'"
msgstr ""
-#: mcs/mcs/expression.cs:9617
+#: mcs/mcs/expression.cs:9634
msgid "Cannot use a negative size with stackalloc"
msgstr ""
-#: mcs/mcs/expression.cs:9621
+#: mcs/mcs/expression.cs:9638
msgid "Cannot use stackalloc in finally or catch"
msgstr ""
-#: mcs/mcs/expression.cs:9738
+#: mcs/mcs/expression.cs:9755
#, csharp-format
msgid ""
"Member `{0}' cannot be initialized. An object initializer may only be used "
"for fields, or properties"
msgstr ""
-#: mcs/mcs/expression.cs:9747
+#: mcs/mcs/expression.cs:9764
#, csharp-format
msgid ""
"Static field or property `{0}' cannot be assigned in an object initializer"
msgstr ""
-#: mcs/mcs/expression.cs:9946
+#: mcs/mcs/expression.cs:9963
#, csharp-format
msgid ""
"A field or property `{0}' cannot be initialized with a collection object "
"initializer because type `{1}' does not implement `{2}' interface"
msgstr ""
-#: mcs/mcs/expression.cs:9957
+#: mcs/mcs/expression.cs:9974
#, csharp-format
msgid "Inconsistent `{0}' member declaration"
msgstr ""
-#: mcs/mcs/expression.cs:9965
+#: mcs/mcs/expression.cs:9982
#, csharp-format
msgid ""
"An object initializer includes more than one member `{0}' initialization"
msgstr ""
-#: mcs/mcs/expression.cs:9983
+#: mcs/mcs/expression.cs:10000
#, csharp-format
msgid "Cannot initialize object of type `{0}' with a collection initializer"
msgstr ""
-#: mcs/mcs/expression.cs:10268
+#: mcs/mcs/expression.cs:10285
#, fuzzy
msgid "Anonymous types cannot be used in this expression"
msgstr ""
"Los métodos anónimos no pueden ser convertidos a árboles de expresiones"
-#: mcs/mcs/expression.cs:10367
+#: mcs/mcs/expression.cs:10384
#, csharp-format
msgid "An anonymous type property `{0}' cannot be initialized with `{1}'"
msgstr ""
"Fixed size buffer `{0}' of length `{1}' and type `{2}' exceeded 2^31 limit"
msgstr ""
-#: mcs/mcs/field.cs:667
+#: mcs/mcs/field.cs:666
#, fuzzy, csharp-format
msgid "`{0}': A volatile field cannot be of the type `{1}'"
msgstr "`{0}': no es posible derivad de una clase sellada (`{1}')"
-#: mcs/mcs/field.cs:672
+#: mcs/mcs/field.cs:671
#, fuzzy, csharp-format
msgid "`{0}': A field cannot be both volatile and readonly"
msgstr "`{0}': una clase no puede estar sellada y ser estática al mismo tiempo"
msgstr ""
#: mcs/mcs/flowanalysis.cs:996 mcs/mcs/flowanalysis.cs:1012
-#: mcs/mcs/flowanalysis.cs:1048 mcs/mcs/statement.cs:782
+#: mcs/mcs/flowanalysis.cs:1048 mcs/mcs/statement.cs:795
msgid "Control cannot leave the body of a finally clause"
msgstr ""
"`{0}' is not a valid constraint. Static classes cannot be used as constraints"
msgstr ""
-#: mcs/mcs/generic.cs:601
+#: mcs/mcs/generic.cs:613
#, csharp-format
msgid "The {2} type parameter `{0}' must be {3} valid on `{1}{4}'"
msgstr ""
-#: mcs/mcs/generic.cs:1974
+#: mcs/mcs/generic.cs:2032
#, csharp-format
msgid "`{0}': static classes cannot be used as generic arguments"
msgstr ""
-#: mcs/mcs/generic.cs:1981
+#: mcs/mcs/generic.cs:2039
#, csharp-format
msgid "The type `{0}' may not be used as a type argument"
msgstr ""
-#: mcs/mcs/generic.cs:2075
+#: mcs/mcs/generic.cs:2133
msgid "Variant type parameters can only be used with interfaces and delegates"
msgstr ""
-#: mcs/mcs/generic.cs:2314
+#: mcs/mcs/generic.cs:2354
#, csharp-format
msgid ""
"The type `{0}' must be a reference type in order to use it as type parameter "
"`{1}' in the generic type or method `{2}'"
msgstr ""
-#: mcs/mcs/generic.cs:2324
+#: mcs/mcs/generic.cs:2364
#, csharp-format
msgid ""
"The type `{0}' must be a non-nullable value type in order to use it as type "
"parameter `{1}' in the generic type or method `{2}'"
msgstr ""
-#: mcs/mcs/generic.cs:2383
+#: mcs/mcs/generic.cs:2423
#, csharp-format
msgid ""
"The type `{0}' must have a public parameterless constructor in order to use "
"it as parameter `{1}' in the generic type or method `{2}'"
msgstr ""
-#: mcs/mcs/generic.cs:2451
+#: mcs/mcs/generic.cs:2479
#, csharp-format
msgid ""
"The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
"{3}'"
msgstr ""
-#: mcs/mcs/generic.cs:2457
+#: mcs/mcs/generic.cs:2485
#, csharp-format
msgid ""
"The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
"{3}'"
msgstr ""
-#: mcs/mcs/generic.cs:2461
+#: mcs/mcs/generic.cs:2489
#, csharp-format
msgid ""
"The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
"method `{2}'. The nullable type `{0}' does not satisfy constraint `{3}'"
msgstr ""
-#: mcs/mcs/generic.cs:2466
+#: mcs/mcs/generic.cs:2494
#, csharp-format
msgid ""
"The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
"method `{2}'. There is no boxing conversion from `{0}' to `{3}'"
msgstr ""
-#: mcs/mcs/generic.cs:2471
+#: mcs/mcs/generic.cs:2499
#, csharp-format
msgid ""
"The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
"method `{2}'. There is no implicit reference conversion from `{0}' to `{3}'"
msgstr ""
-#: mcs/mcs/import.cs:1818
+#: mcs/mcs/import.cs:1868
#, csharp-format
msgid ""
"Reference to type `{0}' claims it is defined in this assembly, but it is not "
"defined in source or any added modules"
msgstr ""
-#: mcs/mcs/import.cs:1822
+#: mcs/mcs/import.cs:1873
+#, csharp-format
+msgid ""
+"The type `{0}' has been forwarded to an assembly that is not referenced. "
+"Consider adding a reference to assembly `{1}'"
+msgstr ""
+
+#: mcs/mcs/import.cs:1877
#, csharp-format
msgid ""
"The type `{0}' is defined in an assembly that is not referenced. Consider "
"adding a reference to assembly `{1}'"
msgstr ""
-#: mcs/mcs/import.cs:1826
+#: mcs/mcs/import.cs:1882
#, csharp-format
msgid ""
"Reference to type `{0}' claims it is defined assembly `{1}', but it could "
msgid "Iterators cannot have unsafe parameters or yield types"
msgstr ""
-#: mcs/mcs/iterators.cs:1132 mcs/mcs/statement.cs:4950
+#: mcs/mcs/iterators.cs:1132 mcs/mcs/statement.cs:4987
msgid "Unsafe code may not appear in iterators"
msgstr ""
-#: mcs/mcs/ikvm.cs:236
+#: mcs/mcs/ikvm.cs:266
msgid "SDK path could not be resolved"
msgstr ""
-#: mcs/mcs/ikvm.cs:314
+#: mcs/mcs/ikvm.cs:344
#, csharp-format
msgid ""
"Assembly `{0}' references `{1}' which has a higher version number than "
"imported assembly `{2}'"
msgstr ""
-#: mcs/mcs/ikvm.cs:323 mcs/mcs/ikvm.cs:327
+#: mcs/mcs/ikvm.cs:353 mcs/mcs/ikvm.cs:357
#, csharp-format
msgid ""
"Assuming assembly reference `{0}' matches assembly `{1}'. You may need to "
"supply runtime policy"
msgstr ""
-#: mcs/mcs/ikvm.cs:413
+#: mcs/mcs/ikvm.cs:444
#, csharp-format
msgid ""
"An assembly with the same name `{0}' has already been imported. Consider "
"removing one of the references or sign the assembly"
msgstr ""
-#: mcs/mcs/ikvm.cs:422
+#: mcs/mcs/ikvm.cs:453
#, csharp-format
msgid ""
"An assembly with the same identity `{0}' has already been imported. Consider "
"suffix `{1}' to create a literal of this type"
msgstr ""
-#: mcs/mcs/membercache.cs:1388
+#: mcs/mcs/membercache.cs:1391
msgid ""
"A partial method declaration and partial method implementation cannot differ "
"on use of `params' modifier"
msgstr ""
-#: mcs/mcs/membercache.cs:1391
+#: mcs/mcs/membercache.cs:1394
msgid ""
"A partial method declaration and partial method implementation must be both "
"an extension method or neither"
msgstr ""
-#: mcs/mcs/membercache.cs:1395
+#: mcs/mcs/membercache.cs:1398
#, csharp-format
msgid ""
"Overloaded contructor `{0}' cannot differ on use of parameter modifiers only"
msgstr ""
-#: mcs/mcs/membercache.cs:1399
+#: mcs/mcs/membercache.cs:1402
#, csharp-format
msgid ""
"Overloaded method `{0}' cannot differ on use of parameter modifiers only"
msgstr ""
-#: mcs/mcs/membercache.cs:1431
+#: mcs/mcs/membercache.cs:1434
msgid ""
"A partial method declaration and partial method implementation must be both "
"`static' or neither"
msgstr ""
-#: mcs/mcs/membercache.cs:1436
+#: mcs/mcs/membercache.cs:1439
msgid ""
"A partial method declaration and partial method implementation must be both "
"`unsafe' or neither"
msgstr ""
-#: mcs/mcs/membercache.cs:1442
+#: mcs/mcs/membercache.cs:1445
#, csharp-format
msgid "A partial method `{0}' declaration is already defined"
msgstr ""
-#: mcs/mcs/membercache.cs:1446
+#: mcs/mcs/membercache.cs:1449
#, csharp-format
msgid "A partial method `{0}' implementation is already defined"
msgstr ""
-#: mcs/mcs/membercache.cs:1457 mcs/mcs/property.cs:81
+#: mcs/mcs/membercache.cs:1460 mcs/mcs/property.cs:81
#, csharp-format
msgid "A member `{0}' is already reserved"
msgstr ""
-#: mcs/mcs/membercache.cs:1468
+#: mcs/mcs/membercache.cs:1471
#, csharp-format
msgid "Duplicate user-defined conversion in type `{0}'"
msgstr ""
-#: mcs/mcs/membercache.cs:1474
+#: mcs/mcs/membercache.cs:1477
#, csharp-format
msgid ""
"A member `{0}' is already defined. Rename this member or use different "
"El miembro `{0} ya ha sido definido. Renombre este miembro o use tipos de "
"parámetro distintos"
-#: mcs/mcs/method.cs:552
+#: mcs/mcs/method.cs:558
#, csharp-format
msgid "`{0}': Async methods cannot use `MethodImplOptions.Synchronized'"
msgstr ""
-#: mcs/mcs/method.cs:560
+#: mcs/mcs/method.cs:566
#, fuzzy
msgid ""
"The DllImport attribute must be specified on a method marked `static' and "
msgstr ""
"El atributo Guid debe de ser especificado junto con el atributo ComImport"
-#: mcs/mcs/method.cs:655
+#: mcs/mcs/method.cs:661
#, fuzzy, csharp-format
msgid "`{0}': A partial method parameters cannot use `out' modifier"
msgstr "`{0}': los miembros virtuales o abstractos no pueden ser privados"
-#: mcs/mcs/method.cs:716
+#: mcs/mcs/method.cs:722
#, csharp-format
msgid ""
"Conditional not valid on `{0}' because it is a constructor, destructor, "
"operator or explicit interface implementation"
msgstr ""
-#: mcs/mcs/method.cs:855
-#, csharp-format
-msgid ""
-"`{0}': Cannot specify constraints for overrides and explicit interface "
-"implementation methods"
-msgstr ""
-
#: mcs/mcs/method.cs:865
msgid ""
"A partial method cannot define access modifier or any of abstract, extern, "
msgid "The return type of an async method must be void, Task, or Task<T>"
msgstr ""
-#: mcs/mcs/method.cs:1224
+#: mcs/mcs/method.cs:1227
#, fuzzy, csharp-format
msgid "`{0}': Extension methods cannot be defined in a nested class"
msgstr "`{0}' Los métodos de extensión deben de ser estáticos"
-#: mcs/mcs/method.cs:1230
+#: mcs/mcs/method.cs:1233
#, csharp-format
msgid ""
"`{0}': Extension methods require `System.Runtime.CompilerServices."
"reference?"
msgstr ""
-#: mcs/mcs/method.cs:1239
+#: mcs/mcs/method.cs:1242
#, fuzzy, csharp-format
msgid "`{0}': Extension methods must be defined in a non-generic static class"
msgstr "`{0}' Los métodos de extensión deben de ser estáticos"
-#: mcs/mcs/method.cs:1255
+#: mcs/mcs/method.cs:1258
#, fuzzy, csharp-format
msgid "`{0}': an entry point cannot be async method"
msgstr "`{0}': no es posible sobreescribir `{1}' ya que no es un método"
-#: mcs/mcs/method.cs:1292
+#: mcs/mcs/method.cs:1295
#, csharp-format
msgid ""
"A partial method `{0}' implementation is missing a partial method declaration"
msgstr ""
-#: mcs/mcs/method.cs:1325
+#: mcs/mcs/method.cs:1336
#, csharp-format
msgid "Method or delegate cannot return type `{0}'"
msgstr ""
-#: mcs/mcs/method.cs:1404
+#: mcs/mcs/method.cs:1415
msgid ""
"The constructor call cannot be dynamically dispatched within constructor "
"initializer"
msgstr ""
-#: mcs/mcs/method.cs:1418
+#: mcs/mcs/method.cs:1429
#, fuzzy, csharp-format
msgid "`{0}': Struct constructors cannot call base constructors"
msgstr ""
"`{0}': las clases estáticas no pueden tener constructores de instancias"
-#: mcs/mcs/method.cs:1436
+#: mcs/mcs/method.cs:1447
#, csharp-format
msgid "Constructor `{0}' cannot call itself"
msgstr ""
-#: mcs/mcs/method.cs:1565
+#: mcs/mcs/method.cs:1576
#, csharp-format
msgid "`{0}': The static constructor must be parameterless"
msgstr ""
-#: mcs/mcs/method.cs:1586
+#: mcs/mcs/method.cs:1597
msgid "Structs cannot contain explicit parameterless constructors"
msgstr ""
-#: mcs/mcs/method.cs:1636
+#: mcs/mcs/method.cs:1652
#, fuzzy, csharp-format
msgid ""
"`{0}': A class with the ComImport attribute cannot have a user-defined "
msgstr ""
"`{0}': las clases estáticas no pueden tener constructores de instancias"
-#: mcs/mcs/method.cs:1886
+#: mcs/mcs/method.cs:1902
#, fuzzy, csharp-format
msgid "`{0}' is an accessor not found in interface member `{1}{2}'"
msgstr "`{0}' esconde el miembro abstracto heredado `{1}'"
-#: mcs/mcs/method.cs:1892
+#: mcs/mcs/method.cs:1908
#, fuzzy, csharp-format
msgid ""
"`{0}.{1}' in explicit interface declaration is not a member of interface"
msgstr "El tipo `{0} en la lista de interfaces no es una interface"
-#: mcs/mcs/method.cs:1900
+#: mcs/mcs/method.cs:1916
#, csharp-format
msgid ""
"`{0}' explicit method implementation cannot implement `{1}' because it is an "
"accessor"
msgstr ""
-#: mcs/mcs/method.cs:1910
+#: mcs/mcs/method.cs:1926
#, fuzzy, csharp-format
msgid "Method `{0}' cannot implement interface accessor `{1}'"
msgstr "`{0}': el tipo contenedor no implementa la interface `{1}'"
-#: mcs/mcs/method.cs:1917
+#: mcs/mcs/method.cs:1933
#, csharp-format
msgid ""
"Accessor `{0}' cannot implement interface member `{1}' for type `{2}'. Use "
"an explicit interface implementation"
msgstr ""
-#: mcs/mcs/method.cs:1924
+#: mcs/mcs/method.cs:1940
#, fuzzy, csharp-format
msgid ""
"Accessor `{0}' must be declared public to implement interface member `{1}'"
msgstr "`{0}': el tipo contenedor no implementa la interface `{1}'"
-#: mcs/mcs/method.cs:1944
+#: mcs/mcs/method.cs:1960
#, fuzzy, csharp-format
msgid ""
"`{0}': the explicit interface implementation cannot introduce the params "
"`{0}': las declaraciones explícitas de interfaces solamente pueden ser "
"declaradas en una clase o estructura"
-#: mcs/mcs/method.cs:2282
+#: mcs/mcs/method.cs:2308
#, csharp-format
msgid ""
"Attribute `{0}' is not valid on property or event accessors. It is valid on `"
"{1}' declarations only"
msgstr ""
-#: mcs/mcs/method.cs:2510
+#: mcs/mcs/method.cs:2536
#, csharp-format
msgid "User-defined operator `{0}' must be declared static and public"
msgstr ""
-#: mcs/mcs/method.cs:2549
+#: mcs/mcs/method.cs:2580
msgid ""
"User-defined operator cannot take an object of the enclosing type and "
"convert to an object of the enclosing type"
msgstr ""
-#: mcs/mcs/method.cs:2560
+#: mcs/mcs/method.cs:2591
msgid "User-defined conversion must convert to or from the enclosing type"
msgstr ""
-#: mcs/mcs/method.cs:2566
+#: mcs/mcs/method.cs:2597
#, fuzzy, csharp-format
msgid ""
"User-defined conversion `{0}' cannot convert to or from the dynamic type"
msgstr "`{0}' no es posible derivad de la clase especial `{1}'"
-#: mcs/mcs/method.cs:2573
+#: mcs/mcs/method.cs:2604
#, csharp-format
msgid ""
"User-defined conversion `{0}' cannot convert to or from an interface type"
msgstr ""
-#: mcs/mcs/method.cs:2580
+#: mcs/mcs/method.cs:2611
#, csharp-format
msgid "User-defined conversion `{0}' cannot convert to or from a base class"
msgstr ""
-#: mcs/mcs/method.cs:2586
+#: mcs/mcs/method.cs:2617
#, csharp-format
msgid "User-defined conversion `{0}' cannot convert to or from a derived class"
msgstr ""
-#: mcs/mcs/method.cs:2593
+#: mcs/mcs/method.cs:2624
msgid ""
"Overloaded shift operator must have the type of the first operand be the "
"containing type, and the type of the second operand must be int"
msgstr ""
-#: mcs/mcs/method.cs:2602
+#: mcs/mcs/method.cs:2633
msgid ""
"The return type for ++ or -- operator must be the containing type or derived "
"from the containing type"
msgstr ""
-#: mcs/mcs/method.cs:2607
+#: mcs/mcs/method.cs:2638
msgid "The parameter type for ++ or -- operator must be the containing type"
msgstr ""
-#: mcs/mcs/method.cs:2614
+#: mcs/mcs/method.cs:2645
msgid "The parameter type of a unary operator must be the containing type"
msgstr ""
-#: mcs/mcs/method.cs:2622
+#: mcs/mcs/method.cs:2653
msgid "The return type of operator True or False must be bool"
msgstr ""
-#: mcs/mcs/method.cs:2637
+#: mcs/mcs/method.cs:2668
msgid "One of the parameters of a binary operator must be the containing type"
msgstr ""
msgid "The modifier `{0}' is not valid for this item"
msgstr "El tipo predefinido `{0}.{1}' no está definido o no ha sido importado"
-#: mcs/mcs/namespace.cs:186
+#: mcs/mcs/namespace.cs:263
#, csharp-format
msgid ""
-"The type or namespace name `{0}' could not be found in the global namespace "
-"(are you missing an assembly reference?)"
+"The type or namespace name `{0}' could not be found in the global namespace. "
+"Are you missing {1} assembly reference?"
msgstr ""
-#: mcs/mcs/namespace.cs:190
+#: mcs/mcs/namespace.cs:267
#, csharp-format
msgid ""
"The type or namespace name `{0}' does not exist in the namespace `{1}'. Are "
-"you missing an assembly reference?"
+"you missing {2} assembly reference?"
msgstr ""
-#: mcs/mcs/namespace.cs:284
+#: mcs/mcs/namespace.cs:367
#, csharp-format
msgid "The imported type `{0}' is defined multiple times"
msgstr ""
-#: mcs/mcs/namespace.cs:749 mcs/mcs/namespace.cs:761
+#: mcs/mcs/namespace.cs:839 mcs/mcs/namespace.cs:851
msgid ""
"A using clause must precede all other namespace elements except extern alias "
"declarations"
msgstr ""
-#: mcs/mcs/namespace.cs:777
+#: mcs/mcs/namespace.cs:867
#, csharp-format
msgid "The using alias `{0}' appeared previously in this namespace"
msgstr ""
-#: mcs/mcs/namespace.cs:815
+#: mcs/mcs/namespace.cs:905 mcs/mcs/namespace.cs:928
#, csharp-format
msgid "The namespace `{0}' already contains a definition for `{1}'"
msgstr ""
-#: mcs/mcs/namespace.cs:1037
+#: mcs/mcs/namespace.cs:1147
#, csharp-format
msgid "Namespace `{0}' contains a definition with same name as alias `{1}'"
msgstr ""
-#: mcs/mcs/namespace.cs:1089
+#: mcs/mcs/namespace.cs:1199
#, csharp-format
msgid "`{0}' is an ambiguous reference between `{1}' and `{2}'"
msgstr ""
-#: mcs/mcs/namespace.cs:1115
-#, csharp-format
-msgid ""
-"The type or namespace name `{0}' could not be found. Are you missing a using "
-"directive or an assembly reference?"
-msgstr ""
-
-#: mcs/mcs/namespace.cs:1317
+#: mcs/mcs/namespace.cs:1390
#, csharp-format
msgid ""
"`{0}' is a type not a namespace. A using namespace directive can only be "
"applied to namespaces"
msgstr ""
-#: mcs/mcs/namespace.cs:1336
+#: mcs/mcs/namespace.cs:1414
#, csharp-format
msgid "The extern alias `{0}' was not specified in -reference option"
msgstr ""
msgid "`{0}': abstract properties cannot have private accessors"
msgstr "`{0}': los miembros virtuales o abstractos no pueden ser privados"
-#: mcs/mcs/property.cs:397
+#: mcs/mcs/property.cs:402
#, csharp-format
msgid ""
"The accessibility modifier of the `{0}' accessor must be more restrictive "
"than the modifier of the property or indexer `{1}'"
msgstr ""
-#: mcs/mcs/property.cs:506
+#: mcs/mcs/property.cs:511
#, csharp-format
msgid "Explicit interface implementation `{0}' is missing accessor `{1}'"
msgstr ""
-#: mcs/mcs/property.cs:525
+#: mcs/mcs/property.cs:530
#, fuzzy, csharp-format
msgid ""
"`{0}': cannot override because `{1}' does not have an overridable get "
"accessor"
msgstr "`{0}': no es posible sobreescribir ya que `{1}' no es un evento"
-#: mcs/mcs/property.cs:542
+#: mcs/mcs/property.cs:547
#, fuzzy, csharp-format
msgid ""
"`{0}': cannot override because `{1}' does not have an overridable set "
"accessor"
msgstr "`{0}': no es posible sobreescribir ya que `{1}' no es un evento"
-#: mcs/mcs/property.cs:583
+#: mcs/mcs/property.cs:588
#, csharp-format
msgid ""
"`{0}': Cannot specify accessibility modifiers for both accessors of the "
"property or indexer"
msgstr ""
-#: mcs/mcs/property.cs:590
+#: mcs/mcs/property.cs:595
#, csharp-format
msgid ""
"`{0}': accessibility modifiers on accessors may only be used if the property "
"or indexer has both a get and a set accessor"
msgstr ""
-#: mcs/mcs/property.cs:818
+#: mcs/mcs/property.cs:823
#, csharp-format
msgid ""
"Automatically implemented property `{0}' cannot be used inside a type with "
"an explicit StructLayout attribute"
msgstr ""
-#: mcs/mcs/property.cs:1305
+#: mcs/mcs/property.cs:1312
#, csharp-format
msgid "`{0}': event must be of a delegate type"
msgstr ""
-#: mcs/mcs/property.cs:1581
+#: mcs/mcs/property.cs:1588
#, csharp-format
msgid ""
"The `{0}' attribute is valid only on an indexer that is not an explicit "
"interface member declaration"
msgstr ""
-#: mcs/mcs/property.cs:1585
+#: mcs/mcs/property.cs:1592
#, fuzzy
msgid "Cannot set the `IndexerName' attribute on an indexer marked override"
msgstr ""
msgid "Value specified for the argument to `{0}' is not valid"
msgstr ""
-#: mcs/mcs/statement.cs:92
+#: mcs/mcs/statement.cs:100
msgid ""
"A lambda expression with statement body cannot be converted to an expresion "
"tree"
msgstr ""
-#: mcs/mcs/statement.cs:845
+#: mcs/mcs/statement.cs:858
#, csharp-format
msgid ""
"An object of a type convertible to `{0}' is required for the return statement"
msgstr ""
-#: mcs/mcs/statement.cs:859 mcs/mcs/statement.cs:884
+#: mcs/mcs/statement.cs:872 mcs/mcs/statement.cs:896
#, csharp-format
msgid ""
"`{0}': A return keyword must not be followed by any expression when method "
"returns void"
msgstr ""
-#: mcs/mcs/statement.cs:895
+#: mcs/mcs/statement.cs:907
#, csharp-format
msgid ""
"`{0}': A return keyword must not be followed by an expression when async "
"method returns `Task'. Consider using `Task<T>' return type"
msgstr ""
-#: mcs/mcs/statement.cs:905
+#: mcs/mcs/statement.cs:917
#, csharp-format
msgid ""
"`{0}': The return expression type of async method must be `{1}' rather than "
"`Task<{1}>'"
msgstr ""
-#: mcs/mcs/statement.cs:929
+#: mcs/mcs/statement.cs:927
+#, csharp-format
+msgid ""
+"`{0}': A return keyword must not be followed by any expression when delegate "
+"returns void"
+msgstr ""
+
+#: mcs/mcs/statement.cs:950
#, csharp-format
msgid ""
"Cannot convert `{0}' to delegate type `{1}' because some of the return types "
"in the block are not implicitly convertible to the delegate return type"
msgstr ""
-#: mcs/mcs/statement.cs:977
+#: mcs/mcs/statement.cs:998
msgid ""
"Cannot return a value from iterators. Use the yield return statement to "
"return a value, or yield break to end the iteration"
msgstr ""
-#: mcs/mcs/statement.cs:1149 mcs/mcs/statement.cs:1194
+#: mcs/mcs/statement.cs:1170 mcs/mcs/statement.cs:1215
msgid "A goto case is only valid inside a switch statement"
msgstr ""
-#: mcs/mcs/statement.cs:1282 mcs/mcs/statement.cs:5351
+#: mcs/mcs/statement.cs:1303 mcs/mcs/statement.cs:5388
msgid "The type caught or thrown must be derived from System.Exception"
msgstr ""
-#: mcs/mcs/statement.cs:1527
+#: mcs/mcs/statement.cs:1548
msgid "A fixed statement cannot use an implicitly typed local variable"
msgstr ""
-#: mcs/mcs/statement.cs:1532
+#: mcs/mcs/statement.cs:1553
msgid "An implicitly typed local variable cannot be a constant"
msgstr ""
-#: mcs/mcs/statement.cs:1537
+#: mcs/mcs/statement.cs:1558
msgid ""
"An implicitly typed local variable declarator must include an initializer"
msgstr ""
-#: mcs/mcs/statement.cs:1542
+#: mcs/mcs/statement.cs:1563
msgid ""
"An implicitly typed local variable declaration cannot include multiple "
"declarators"
msgstr ""
-#: mcs/mcs/statement.cs:2164
+#: mcs/mcs/statement.cs:2185
#, csharp-format
msgid ""
"A local variable named `{0}' cannot be declared in this scope because it "
"scope to denote something else"
msgstr ""
-#: mcs/mcs/statement.cs:2176
+#: mcs/mcs/statement.cs:2197
#, csharp-format
msgid "A local variable named `{0}' is already defined in this scope"
msgstr ""
-#: mcs/mcs/statement.cs:2183
+#: mcs/mcs/statement.cs:2204
#, fuzzy, csharp-format
msgid ""
"The type parameter name `{0}' is the same as local variable or parameter name"
"El tipo parametrizado `{0}' tiene el mimo nombre que el tipo contenedor, o "
"el método"
-#: mcs/mcs/statement.cs:2898
+#: mcs/mcs/statement.cs:2935
#, csharp-format
msgid ""
"The out parameter `{0}' must be assigned to before control leaves the "
"current method"
msgstr ""
-#: mcs/mcs/statement.cs:3016
+#: mcs/mcs/statement.cs:3053
#, csharp-format
msgid "`{0}': not all code paths return a value"
msgstr ""
-#: mcs/mcs/statement.cs:3033
+#: mcs/mcs/statement.cs:3070
#, csharp-format
msgid "Not all code paths return a value in anonymous method of type `{0}'"
msgstr ""
-#: mcs/mcs/statement.cs:3081
+#: mcs/mcs/statement.cs:3118
#, fuzzy
msgid "Async methods cannot have ref or out parameters"
msgstr "`{0}': no es posible derivar de una clase estática (`{1}')"
-#: mcs/mcs/statement.cs:3087
+#: mcs/mcs/statement.cs:3124
msgid "__arglist is not allowed in parameter list of async methods"
msgstr ""
-#: mcs/mcs/statement.cs:3093
+#: mcs/mcs/statement.cs:3130
#, fuzzy
msgid "Async methods cannot have unsafe parameters"
msgstr "`{0}': no es posible derivar de una clase estática (`{1}')"
-#: mcs/mcs/statement.cs:3288
+#: mcs/mcs/statement.cs:3325
#, csharp-format
msgid "The label `{0}' is a duplicate"
msgstr ""
-#: mcs/mcs/statement.cs:3297 mcs/mcs/statement.cs:3308
+#: mcs/mcs/statement.cs:3334 mcs/mcs/statement.cs:3345
#, csharp-format
msgid ""
"The label `{0}' shadows another label by the same name in a contained scope"
msgstr ""
-#: mcs/mcs/statement.cs:3604
+#: mcs/mcs/statement.cs:3641
#, csharp-format
msgid "The label `case {0}:' already occurs in this switch statement"
msgstr ""
-#: mcs/mcs/statement.cs:4123
+#: mcs/mcs/statement.cs:4160
#, csharp-format
msgid ""
"A switch expression of type `{0}' cannot be converted to an integral type, "
"bool, char, string, enum or nullable type"
msgstr ""
-#: mcs/mcs/statement.cs:4734
+#: mcs/mcs/statement.cs:4771
#, csharp-format
msgid "`{0}' is not a reference type as required by the lock statement"
msgstr ""
-#: mcs/mcs/statement.cs:5081
+#: mcs/mcs/statement.cs:5118
msgid "The type of locals declared in a fixed statement must be a pointer type"
msgstr ""
-#: mcs/mcs/statement.cs:5097
+#: mcs/mcs/statement.cs:5134
msgid ""
"The right hand side of a fixed statement assignment may not be a cast "
"expression"
msgstr ""
-#: mcs/mcs/statement.cs:5167
+#: mcs/mcs/statement.cs:5204
msgid ""
"You cannot use the fixed statement to take the address of an already fixed "
"expression"
msgstr ""
-#: mcs/mcs/statement.cs:5523
+#: mcs/mcs/statement.cs:5560
#, csharp-format
msgid ""
"A previous catch clause already catches all exceptions of this or a super "
"type `{0}'"
msgstr ""
-#: mcs/mcs/statement.cs:5663
+#: mcs/mcs/statement.cs:5700
#, csharp-format
msgid ""
"`{0}': type used in a using statement must be implicitly convertible to "
"`System.IDisposable'"
msgstr ""
-#: mcs/mcs/statement.cs:6067
+#: mcs/mcs/statement.cs:6104
#, csharp-format
msgid ""
"foreach statement requires that the return type `{0}' of `{1}' must have a "
"suitable public MoveNext method and public Current property"
msgstr ""
-#: mcs/mcs/statement.cs:6112
+#: mcs/mcs/statement.cs:6149
#, csharp-format
msgid ""
"foreach statement cannot operate on variables of type `{0}' because it "
"implementation"
msgstr ""
-#: mcs/mcs/statement.cs:6141
+#: mcs/mcs/statement.cs:6178
#, csharp-format
msgid ""
"foreach statement cannot operate on variables of type `{0}' because it does "
"not contain a definition for `{1}' or is inaccessible"
msgstr ""
-#: mcs/mcs/statement.cs:6372
+#: mcs/mcs/statement.cs:6409
msgid "Use of null is not valid in this context"
msgstr ""
-#: mcs/mcs/statement.cs:6384
+#: mcs/mcs/statement.cs:6421
#, csharp-format
msgid "Foreach statement cannot operate on a `{0}'"
msgstr "El mandato `foreach' no puede operar en un `{0}'"
-#: mcs/mcs/typemanager.cs:771
+#: mcs/mcs/typemanager.cs:785
#, csharp-format
msgid "The predefined type `{0}.{1}' is not defined or imported"
msgstr "El tipo predefinido `{0}.{1}' no está definido o no ha sido importado"
-#: mcs/mcs/typemanager.cs:816
+#: mcs/mcs/typemanager.cs:830
#, fuzzy, csharp-format
msgid ""
"The predefined type `{0}.{1}' is defined multiple times. Using definition "
"from `{2}'"
msgstr "El tipo predefinido `{0}.{1}' no está definido o no ha sido importado"
-#: mcs/mcs/typemanager.cs:831
+#: mcs/mcs/typemanager.cs:845
#, csharp-format
msgid "The predefined type `{0}.{1}' is not declared correctly"
msgstr "El tipo predefinido `{0}.{1}' fue incorrectamente declarado"
-#: mcs/mcs/typemanager.cs:956
+#: mcs/mcs/typemanager.cs:970
#, csharp-format
msgid ""
"The compiler required member `{0}.{1}{2}' could not be found or is "
"inaccessible"
msgstr "El compilador no encuentra el miembro `{0}.{1}{2}' o no es accessible"
-#: mcs/mcs/typemanager.cs:1070
+#: mcs/mcs/typemanager.cs:1084
#, csharp-format
msgid ""
"Cannot take the address of, get the size of, or declare a pointer to a "
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: http://www.mono-project.com/Bugs\n"
-"POT-Creation-Date: 2012-05-30 18:30+0100\n"
+"POT-Creation-Date: 2012-12-05 09:29+0100\n"
"PO-Revision-Date: \n"
"Last-Translator: Atsushi Eno <atsushi@ximian.com>\n"
"Language-Team: \n"
"mismatch"
msgstr "パラメータ不一致のため、`{0}' をデリゲート型 `{1}'に変換できません"
-#: mcs/mcs/anonymous.cs:1027 mcs/mcs/ecore.cs:4913
+#: mcs/mcs/anonymous.cs:1027 mcs/mcs/ecore.cs:5056
#, csharp-format
msgid "Delegate `{0}' does not take `{1}' arguments"
msgstr "デリゲート `{0}' は `{1}' 個の引数をもちません"
msgstr ""
"パラメータ `{0}' は型 `{1}' として宣言されていますが、 `{2}' であるはずです"
-#: mcs/mcs/anonymous.cs:1202
+#: mcs/mcs/anonymous.cs:1212
#, fuzzy
msgid "Async lambda expressions cannot be converted to expression trees"
msgstr "匿名メソッドを式ツリーに変換することはできません"
-#: mcs/mcs/anonymous.cs:1240
+#: mcs/mcs/anonymous.cs:1250
msgid "An anonymous method cannot be converted to an expression tree"
msgstr "匿名メソッドを式ツリーに変換することはできません"
-#: mcs/mcs/anonymous.cs:1259
+#: mcs/mcs/anonymous.cs:1269
#, fuzzy, csharp-format
msgid ""
"Cannot convert anonymous method block without a parameter list to delegate "
"デリゲート型 `{0}' には引数に`out'パラメータがあるので、パラメータリスト無し"
"では匿名メソッドのブロックから変換できません"
-#: mcs/mcs/anonymous.cs:1283
+#: mcs/mcs/anonymous.cs:1293
msgid ""
"Anonymous methods and lambda expressions cannot be used in the current "
"context"
msgstr "匿名メソッドとラムダ式は現在の文脈では使用できません"
-#: mcs/mcs/anonymous.cs:1326
+#: mcs/mcs/anonymous.cs:1336
#, fuzzy, csharp-format
msgid ""
"Local variable or parameter `{0}' cannot have their address taken and be "
"ローカル変数またはパラメータである `{0}' は、そのアドレスを取得して匿名メソッ"
"ドあるいはラムダ式の中で使用することができません"
-#: mcs/mcs/anonymous.cs:1346
+#: mcs/mcs/anonymous.cs:1356
#, fuzzy, csharp-format
msgid "Cannot convert async {0} to delegate type `{1}'"
msgstr "`{0}' をデリゲートでない型 `{1}'に変換できません"
-#: mcs/mcs/anonymous.cs:1596
+#: mcs/mcs/anonymous.cs:1594
msgid "An expression tree cannot contain an anonymous method expression"
msgstr "式ツリーに匿名メソッド式を含むことはできません"
-#: mcs/mcs/anonymous.cs:1879
+#: mcs/mcs/anonymous.cs:1877
#, csharp-format
msgid ""
"`{0}': An anonymous type cannot have multiple properties with the same name"
msgid "Cannot assign to `{0}' because it is a `{1}'"
msgstr ""
-#: mcs/mcs/assembly.cs:286
+#: mcs/mcs/assembly.cs:279
msgid "Invalid type specified as an argument for TypeForwardedTo attribute"
msgstr ""
-#: mcs/mcs/assembly.cs:294
+#: mcs/mcs/assembly.cs:287
#, fuzzy, csharp-format
msgid "A duplicate type forward of type `{0}'"
msgstr "属性の引数名 '{0}' が重複しています"
-#: mcs/mcs/assembly.cs:303
+#: mcs/mcs/assembly.cs:296
#, csharp-format
msgid "Cannot forward type `{0}' because it is defined in this assembly"
msgstr ""
-#: mcs/mcs/assembly.cs:309
+#: mcs/mcs/assembly.cs:302
#, fuzzy, csharp-format
msgid "Cannot forward type `{0}' because it is a nested type"
msgstr "`{0}' は型パラメータであるため、ここから派生することはできません"
-#: mcs/mcs/assembly.cs:338
+#: mcs/mcs/assembly.cs:331
#, csharp-format
msgid ""
"Friend assembly reference `{0}' is invalid. InternalsVisibleTo declarations "
"cannot have a version, culture or processor architecture specified"
msgstr ""
-#: mcs/mcs/assembly.cs:346
+#: mcs/mcs/assembly.cs:339
#, csharp-format
msgid ""
"Friend assembly reference `{0}' is invalid. Strong named assemblies must "
"specify a public key in their InternalsVisibleTo declarations"
msgstr ""
-#: mcs/mcs/assembly.cs:381
+#: mcs/mcs/assembly.cs:374
#, csharp-format
msgid "Referenced assembly `{0}' does not have a strong name"
msgstr ""
-#: mcs/mcs/assembly.cs:387
+#: mcs/mcs/assembly.cs:380
#, csharp-format
msgid "Referenced assembly `{0}' has different culture setting of `{1}'"
msgstr ""
-#: mcs/mcs/assembly.cs:402
+#: mcs/mcs/assembly.cs:395
#, csharp-format
msgid ""
"Friend access was granted to `{0}', but the output assembly is named `{1}'. "
"it"
msgstr ""
-#: mcs/mcs/assembly.cs:416
+#: mcs/mcs/assembly.cs:409
msgid ""
"Could not sign the assembly. ECMA key can only be used to delay-sign "
"assemblies"
msgstr ""
-#: mcs/mcs/assembly.cs:657
+#: mcs/mcs/assembly.cs:650
msgid ""
"Added modules must be marked with the CLSCompliant attribute to match the "
"assembly"
"追加されるモジュールは、アセンブリに適合するCLSCompliant属性でマークされなけ"
"ればなりません"
-#: mcs/mcs/assembly.cs:692 mcs/mcs/assembly.cs:707
+#: mcs/mcs/assembly.cs:685 mcs/mcs/assembly.cs:700
#, csharp-format
msgid ""
"Option `{0}' overrides attribute `{1}' given in a source file or added module"
msgstr ""
-#: mcs/mcs/assembly.cs:742
+#: mcs/mcs/assembly.cs:735
msgid "Delay signing was requested but no key file was given"
msgstr ""
-#: mcs/mcs/assembly.cs:763
+#: mcs/mcs/assembly.cs:756
msgid "Cannot link resource file when building a module"
msgstr ""
-#: mcs/mcs/assembly.cs:768
+#: mcs/mcs/assembly.cs:761
#, csharp-format
msgid "Error reading resource file `{0}'"
msgstr ""
-#: mcs/mcs/assembly.cs:838
+#: mcs/mcs/assembly.cs:831
msgid "Could not write to file `"
msgstr ""
-#: mcs/mcs/assembly.cs:882
+#: mcs/mcs/assembly.cs:875
#, fuzzy
msgid "Cannot specify -main if building a module or library"
msgstr "インデクサを含む型には`DefaultMember'属性を指定できません"
-#: mcs/mcs/assembly.cs:908
+#: mcs/mcs/assembly.cs:901
#, csharp-format
msgid "Could not find `{0}' specified for Main method"
msgstr ""
-#: mcs/mcs/assembly.cs:914
+#: mcs/mcs/assembly.cs:907
#, fuzzy, csharp-format
msgid "`{0}' specified for Main method must be a valid class or struct"
msgstr "`{0}': 拡張メソッドはstaticで宣言されなければなりません"
-#: mcs/mcs/assembly.cs:918
+#: mcs/mcs/assembly.cs:911
#, fuzzy, csharp-format
msgid "`{0}' does not have a suitable static Main method"
msgstr "キーワード `new' は名前空間要素で認められていません"
-#: mcs/mcs/assembly.cs:921
+#: mcs/mcs/assembly.cs:914
#, csharp-format
msgid ""
"Program `{0}' does not contain a static `Main' method suitable for an entry "
"point"
msgstr ""
-#: mcs/mcs/assembly.cs:940
+#: mcs/mcs/assembly.cs:933
msgid "Error during assembly signing. "
msgstr ""
-#: mcs/mcs/assembly.cs:1125
+#: mcs/mcs/assembly.cs:1118
#, csharp-format
msgid "Metadata file `{0}' could not be found"
msgstr ""
-#: mcs/mcs/assembly.cs:1130
+#: mcs/mcs/assembly.cs:1123
#, fuzzy, csharp-format
msgid "Metadata file `{0}' does not contain valid metadata"
msgstr "デリゲート `{0}' は `{1}' 個の引数をもちません"
-#: mcs/mcs/assembly.cs:1136
+#: mcs/mcs/assembly.cs:1129
#, fuzzy, csharp-format
msgid ""
"Referenced assembly file `{0}' is a module. Consider using `-addmodule' "
"参照ファイル `{0}' はアセンブリではありません。代わりに`-addmodule' オプショ"
"ンを使用してみてください"
-#: mcs/mcs/assembly.cs:1143
+#: mcs/mcs/assembly.cs:1136
#, fuzzy, csharp-format
msgid ""
"Added module file `{0}' is an assembly. Consider using `-r' option to "
"参照ファイル `{0}' はアセンブリではありません。代わりに`-addmodule' オプショ"
"ンを使用してみてください"
-#: mcs/mcs/async.cs:70
+#: mcs/mcs/async.cs:72
msgid "The `await' operator cannot be used in the body of a lock statement"
msgstr ""
-#: mcs/mcs/async.cs:75
+#: mcs/mcs/async.cs:77
msgid "The `await' operator cannot be used in an unsafe context"
msgstr ""
-#: mcs/mcs/async.cs:140
+#: mcs/mcs/async.cs:142
#, csharp-format
msgid ""
"Cannot await void method `{0}'. Consider changing method return type to "
"`Task'"
msgstr ""
-#: mcs/mcs/async.cs:143
+#: mcs/mcs/async.cs:145
#, csharp-format
msgid "Cannot await `{0}' expression"
msgstr ""
-#: mcs/mcs/async.cs:293
+#: mcs/mcs/async.cs:291
#, csharp-format
msgid ""
"The awaiter type `{0}' must have suitable IsCompleted and GetResult members"
msgstr ""
-#: mcs/mcs/async.cs:301
+#: mcs/mcs/async.cs:299
msgid ""
"The `await' operator may only be used in a query expression within the first "
"collection expression of the initial `from' clause or within the collection "
"expression of a `join' clause"
msgstr ""
-#: mcs/mcs/async.cs:335
+#: mcs/mcs/async.cs:333
#, csharp-format
msgid "The `await' operand type `{0}' must have suitable GetAwaiter method"
msgstr ""
-#: mcs/mcs/async.cs:374
+#: mcs/mcs/async.cs:372
#, fuzzy, csharp-format
msgid "The awaiter type `{0}' must implement interface `{1}'"
msgstr ""
"Conditionalメンバ `{0}' はインターフェースメンバ `{1}' を実装できません"
-#: mcs/mcs/async.cs:601
+#: mcs/mcs/async.cs:605
msgid ""
"Cannot find compiler required types for asynchronous functions support. Are "
"you targeting the wrong framework version?"
msgstr ""
-#: mcs/mcs/attribute.cs:222
+#: mcs/mcs/attribute.cs:228
#, csharp-format
msgid ""
"`{0}' is not a valid named attribute argument. Named attribute arguments "
"み専用ではなくstaticでも定数でもないフィールドか、またはpublicでstaticではな"
"い読み書き可能なプロパティでなければなりません"
-#: mcs/mcs/attribute.cs:231
+#: mcs/mcs/attribute.cs:237
#, csharp-format
msgid ""
"`{0}' is not a valid named attribute argument because it is not a valid "
"`{0}' は、有効な属性パラメータ型ではないため、有効な名前付き属性の引数ではあ"
"りません"
-#: mcs/mcs/attribute.cs:237
+#: mcs/mcs/attribute.cs:243
#, fuzzy
msgid "An attribute argument cannot be dynamic expression"
msgstr "匿名メソッドを式ツリーに変換することはできません"
-#: mcs/mcs/attribute.cs:242
+#: mcs/mcs/attribute.cs:248
msgid "The Guid attribute must be specified with the ComImport attribute"
msgstr "Guid属性はComImport属性とともに指定されなければなりません"
-#: mcs/mcs/attribute.cs:247
+#: mcs/mcs/attribute.cs:253
#, csharp-format
msgid "Do not use `{0}' directly. Use parameter modifier `this' instead"
msgstr ""
"`{0}' を直接使用せず、代わりにパラメータ修飾子 `this' を使用してください"
-#: mcs/mcs/attribute.cs:252
+#: mcs/mcs/attribute.cs:258
#, fuzzy, csharp-format
msgid "Do not use `{0}' directly. Use `dynamic' keyword instead"
msgstr ""
"`{0}' を直接使用せず、代わりにパラメータ修飾子 `this' を使用してください"
-#: mcs/mcs/attribute.cs:261
+#: mcs/mcs/attribute.cs:267
#, csharp-format
msgid "Error during emitting `{0}' attribute. The reason is `{1}'"
msgstr "`{0}' の属性の出力中にエラーが発生しました。理由: '{1}'"
-#: mcs/mcs/attribute.cs:314
+#: mcs/mcs/attribute.cs:321
#, fuzzy, csharp-format
msgid ""
"`{0}' is ambiguous between `{1}' and `{2}'. Use either `@{0}' or `{0}"
"`{0} は `{0}' と `{0}Attribute' の間で曖昧です。`@{0}' または `{0}Attribute' "
"を使用してください"
-#: mcs/mcs/attribute.cs:336 mcs/mcs/attribute.cs:342
+#: mcs/mcs/attribute.cs:348 mcs/mcs/attribute.cs:354
#, csharp-format
msgid "`{0}': is not an attribute class"
msgstr "`{0}' は属性クラスではありません"
-#: mcs/mcs/attribute.cs:434
+#: mcs/mcs/attribute.cs:446
#, csharp-format
msgid "Cannot apply attribute class `{0}' because it is abstract"
msgstr "属性クラス `{0}' はabstractなので適用できません"
-#: mcs/mcs/attribute.cs:505
+#: mcs/mcs/attribute.cs:517
#, fuzzy, csharp-format
msgid "Duplicate named attribute `{0}' argument"
msgstr "属性の引数名 '{0}' が重複しています"
-#: mcs/mcs/attribute.cs:964
+#: mcs/mcs/attribute.cs:976
#, csharp-format
msgid ""
"The attribute `{0}' is not valid on this declaration type. It is valid on `"
"{1}' declarations only"
msgstr "属性 `{0}' はこの宣言型では無効です。 `{1}' の宣言でのみ有効です"
-#: mcs/mcs/attribute.cs:986
+#: mcs/mcs/attribute.cs:998
#, csharp-format
msgid "The argument to the `{0}' attribute must be a valid identifier"
msgstr "`{0}' 属性への引数は有効な識別子である必要があります"
-#: mcs/mcs/attribute.cs:1000
+#: mcs/mcs/attribute.cs:1012
#, fuzzy, csharp-format
msgid "Invalid value for argument to `{0}' attribute"
msgstr "`System.AttributeUsage' 属性への無効な引数値です"
-#: mcs/mcs/attribute.cs:1252
+#: mcs/mcs/attribute.cs:1274
#, csharp-format
msgid "The attribute `{0}' cannot be applied multiple times"
msgstr "属性 `{0}' は複数回指定することができません"
-#: mcs/mcs/attribute.cs:1552
+#: mcs/mcs/attribute.cs:1580
#, csharp-format
msgid "`{0}' is obsolete: `{1}'"
msgstr "`{0}'は廃止されています: `{1}'"
"`partial' 修飾子は `class'、`struct'、`interface'、`void' キーワードの直前で"
"のみ使用できます"
-#: mcs/mcs/cs-tokenizer.cs:1470 mcs/mcs/cs-tokenizer.cs:1533
+#: mcs/mcs/cs-tokenizer.cs:1478 mcs/mcs/cs-tokenizer.cs:1541
msgid "Invalid number"
msgstr "無効な数値です"
-#: mcs/mcs/cs-tokenizer.cs:1745
+#: mcs/mcs/cs-tokenizer.cs:1753
#, csharp-format
msgid "Unrecognized escape sequence `\\{0}'"
msgstr "認識できないエスケープシーケンス `\\{0}' です"
-#: mcs/mcs/cs-tokenizer.cs:1764
+#: mcs/mcs/cs-tokenizer.cs:1772
msgid "Unrecognized escape sequence"
msgstr "認識できないエスケープシーケンスです"
-#: mcs/mcs/cs-tokenizer.cs:2034
+#: mcs/mcs/cs-tokenizer.cs:2041
#, fuzzy
msgid "Filename, single-line comment or end-of-line expected"
msgstr "1行コメントまたは行末が必要です"
-#: mcs/mcs/cs-tokenizer.cs:2084
+#: mcs/mcs/cs-tokenizer.cs:2090
#, fuzzy
msgid "Missing identifier to pre-processor directive"
msgstr "プリプロセッサ指令の識別子がありません"
-#: mcs/mcs/cs-tokenizer.cs:2094 mcs/mcs/cs-tokenizer.cs:2098
+#: mcs/mcs/cs-tokenizer.cs:2100 mcs/mcs/cs-tokenizer.cs:2104
#, csharp-format
msgid "Identifier expected: {0}"
msgstr "識別子が必要です: {0}"
-#: mcs/mcs/cs-tokenizer.cs:2587
+#: mcs/mcs/cs-tokenizer.cs:2610
#, fuzzy
msgid "Integral constant is too large"
msgstr "数値定数が長すぎます"
-#: mcs/mcs/cs-tokenizer.cs:2592
+#: mcs/mcs/cs-tokenizer.cs:2615
msgid "Invalid preprocessor directive"
msgstr "無効なプリプロセッサ指令です"
-#: mcs/mcs/cs-tokenizer.cs:2599
+#: mcs/mcs/cs-tokenizer.cs:2622
#, csharp-format
msgid "Unexpected processor directive ({0})"
msgstr "予期しないプリプロセッサ指令です({0})"
-#: mcs/mcs/cs-tokenizer.cs:2605
+#: mcs/mcs/cs-tokenizer.cs:2628
msgid ""
"Cannot define or undefine preprocessor symbols after first token in file"
msgstr ""
"ファイル中の最初のトークンの出現後は、プリプロセッサシンボルを定義または定義"
"解除することはできません"
-#: mcs/mcs/cs-tokenizer.cs:2611
+#: mcs/mcs/cs-tokenizer.cs:2634
msgid ""
"Preprocessor directives must appear as the first non-whitespace character on "
"a line"
"プリプロセッサ指令は、1行の中で、最初の空白でない文字として出現しなければなり"
"ません"
-#: mcs/mcs/cs-tokenizer.cs:2616
+#: mcs/mcs/cs-tokenizer.cs:2639
msgid "Single-line comment or end-of-line expected"
msgstr "1行コメントまたは行末が必要です"
-#: mcs/mcs/cs-tokenizer.cs:2661 mcs/mcs/cs-tokenizer.cs:3679
+#: mcs/mcs/cs-tokenizer.cs:2684 mcs/mcs/cs-tokenizer.cs:3719
msgid "Expected `#endif' directive"
msgstr "`#endif' 指令が必要です"
-#: mcs/mcs/cs-tokenizer.cs:2694 mcs/mcs/cs-tokenizer.cs:2715
-#: mcs/mcs/cs-tokenizer.cs:2746 mcs/mcs/cs-tokenizer.cs:3677
+#: mcs/mcs/cs-tokenizer.cs:2717 mcs/mcs/cs-tokenizer.cs:2738
+#: mcs/mcs/cs-tokenizer.cs:2769 mcs/mcs/cs-tokenizer.cs:3717
msgid "#endregion directive expected"
msgstr "#endregion指令が必要です"
-#: mcs/mcs/cs-tokenizer.cs:2793
+#: mcs/mcs/cs-tokenizer.cs:2816
msgid "Wrong preprocessor directive"
msgstr "正しくないプリプロセッサ指令です"
-#: mcs/mcs/cs-tokenizer.cs:2805
+#: mcs/mcs/cs-tokenizer.cs:2828
#, csharp-format
msgid "#error: '{0}'"
msgstr "#error: `{0}'"
-#: mcs/mcs/cs-tokenizer.cs:2823
+#: mcs/mcs/cs-tokenizer.cs:2846
msgid "The line number specified for #line directive is missing or invalid"
msgstr "#line指令で指定される行番号が無いか、または無効です"
-#: mcs/mcs/cs-tokenizer.cs:2876 mcs/mcs/cs-tokenizer.cs:3514
+#: mcs/mcs/cs-tokenizer.cs:2908 mcs/mcs/cs-tokenizer.cs:3554
msgid "Newline in constant"
msgstr "定数の中に改行文字が含まれています"
-#: mcs/mcs/cs-tokenizer.cs:2893
+#: mcs/mcs/cs-tokenizer.cs:2934
msgid "Unterminated string literal"
msgstr "文字列に終端がありません"
-#: mcs/mcs/cs-tokenizer.cs:2968
+#: mcs/mcs/cs-tokenizer.cs:3011
msgid "Identifier too long (limit is 512 chars)"
msgstr "識別子が長すぎます(最大512文字)"
-#: mcs/mcs/cs-tokenizer.cs:3354
+#: mcs/mcs/cs-tokenizer.cs:3394
msgid "End-of-file found, '*/' expected"
msgstr "ファイルの終端に到達しましたが、 '*/' が必要です"
-#: mcs/mcs/cs-tokenizer.cs:3463
+#: mcs/mcs/cs-tokenizer.cs:3503
msgid "Keyword, identifier, or string expected after verbatim specifier: @"
msgstr "厳密指定子@の直後には、キーワード、識別子または文字列が必要です"
-#: mcs/mcs/cs-tokenizer.cs:3484
+#: mcs/mcs/cs-tokenizer.cs:3524
#, fuzzy, csharp-format
msgid "Unexpected character `{0}'"
msgstr "`{0}' が必要です"
-#: mcs/mcs/cs-tokenizer.cs:3509
+#: mcs/mcs/cs-tokenizer.cs:3549
msgid "Empty character literal"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:3530
+#: mcs/mcs/cs-tokenizer.cs:3570
msgid "Too many characters in character literal"
msgstr ""
"declaration of this type exists"
msgstr ""
-#: mcs/mcs/class.cs:713
+#: mcs/mcs/class.cs:734
#, csharp-format
msgid ""
"`{0}': explicit interface declaration can only be declared in a class or "
msgstr ""
"`{0}': インターフェースの明示的な実装は、クラスまたは構造体でのみ宣言できます"
-#: mcs/mcs/class.cs:772
+#: mcs/mcs/class.cs:793
#, csharp-format
msgid "Duplicate type parameter `{0}'"
msgstr ""
-#: mcs/mcs/class.cs:775
+#: mcs/mcs/class.cs:796
#, csharp-format
msgid "The type `{0}' already contains a definition for `{1}'"
msgstr ""
-#: mcs/mcs/class.cs:841
+#: mcs/mcs/class.cs:862
msgid ""
"Cannot specify the `DefaultMember' attribute on type containing an indexer"
msgstr "インデクサを含む型には`DefaultMember'属性を指定できません"
-#: mcs/mcs/class.cs:846
+#: mcs/mcs/class.cs:867
msgid "The RequiredAttribute attribute is not permitted on C# types"
msgstr ""
-#: mcs/mcs/class.cs:1069
+#: mcs/mcs/class.cs:1093
#, fuzzy, csharp-format
msgid "Class `{0}' cannot derive from the dynamic type"
msgstr "`{0}' は特別なクラス `{1}' から派生することはできません"
-#: mcs/mcs/class.cs:1086
+#: mcs/mcs/class.cs:1110
#, csharp-format
msgid "`{0}' is already listed in interface list"
msgstr "`{0}'は既にインターフェースのリストに含まれています"
-#: mcs/mcs/class.cs:1094
+#: mcs/mcs/class.cs:1118
#, csharp-format
msgid ""
"Inconsistent accessibility: base interface `{0}' is less accessible than "
"一貫性の無いアクセス修飾子です: 基底インターフェース `{0}' はインターフェー"
"ス `{1}' よりもアクセスが限定的です"
-#: mcs/mcs/class.cs:1100
+#: mcs/mcs/class.cs:1124
#, csharp-format
msgid "Type `{0}' in interface list is not an interface"
msgstr ""
"インターフェースリストに含まれる型 `{0}' はインターフェースではありません"
-#: mcs/mcs/class.cs:1102
+#: mcs/mcs/class.cs:1126
#, csharp-format
msgid "`{0}': Classes cannot have multiple base classes (`{1}' and `{2}')"
msgstr ""
"`{0}': クラスには複数の基底クラスを指定することはできません(`{1}' と `{2}')"
-#: mcs/mcs/class.cs:1105
+#: mcs/mcs/class.cs:1129
#, csharp-format
msgid "`{0}': Base class `{1}' must be specified as first"
msgstr "`{0}': 基底クラス `{1}' が先に指定されなければなりません"
-#: mcs/mcs/class.cs:1166
+#: mcs/mcs/class.cs:1190
#, csharp-format
msgid ""
"The operator `{0}' requires a matching operator `{1}' to also be defined"
msgstr "演算子 `{0}' は対応する演算子 `{1}' の定義も必要とします"
-#: mcs/mcs/class.cs:1397
+#: mcs/mcs/class.cs:1421
#, csharp-format
msgid "Partial declarations of `{0}' must not specify different base classes"
msgstr "`{0}' の部分的な宣言の間で、別々の基底クラスを指定することはできません"
-#: mcs/mcs/class.cs:1441
+#: mcs/mcs/class.cs:1465
#, csharp-format
msgid ""
"Inherited interface `{0}' causes a cycle in the interface hierarchy of `{1}'"
"継承されたインターフェース `{0}' で、`{1}' のインターフェース階層構造の循環定"
"義が生じています"
-#: mcs/mcs/class.cs:1447
+#: mcs/mcs/class.cs:1471
#, csharp-format
msgid "Circular base class dependency involving `{0}' and `{1}'"
msgstr "`{0}' と `{1}' の間で基底クラスの循環依存が生じています"
-#: mcs/mcs/class.cs:1593
+#: mcs/mcs/class.cs:1617
#, csharp-format
msgid ""
"Partial declarations of `{0}' have inconsistent constraints for type "
"`{0}' の部分的な宣言の間で、型パラメータ `{1}' について一貫性のない制約が含ま"
"れています"
-#: mcs/mcs/class.cs:1702
+#: mcs/mcs/class.cs:1726
#, fuzzy, csharp-format
msgid "`{0}': cannot implement a dynamic interface `{1}'"
msgstr "`{0}' を含む型はインターフェース `{1}' を実装しません"
-#: mcs/mcs/class.cs:1718
+#: mcs/mcs/class.cs:1742
#, csharp-format
msgid ""
"`{0}' cannot implement both `{1}' and `{2}' because they may unify for some "
"`{0}' は `{1}' と `{2}' が型パラメータ置換後に重複する可能性があるため、これ"
"らの両方を実装することはできません"
-#: mcs/mcs/class.cs:1737
+#: mcs/mcs/class.cs:1761
#, csharp-format
msgid ""
"A generic type cannot derive from `{0}' because it is an attribute class"
msgstr ""
"`{0}' は属性クラスなので、ここからジェネリック型を派生することはできません"
-#: mcs/mcs/class.cs:1839
+#: mcs/mcs/class.cs:1870
msgid ""
"Two indexers have different names; the IndexerName attribute must be used "
"with the same name on every indexer within a type"
"2つのインデクサ間で別々の名前が定義されています; 1つの型において、IndexerName"
"属性は全てのインデクサにおいて同一の名前をもたなければなりません"
-#: mcs/mcs/class.cs:2089
+#: mcs/mcs/class.cs:2120
#, csharp-format
msgid "A static member `{0}' cannot be marked as override, virtual or abstract"
msgstr ""
"staticメンバ `{0}' はoverride, virtual, abstractとして宣言することはできませ"
"ん"
-#: mcs/mcs/class.cs:2096
+#: mcs/mcs/class.cs:2127
#, csharp-format
msgid "A member `{0}' marked as override cannot be marked as new or virtual"
msgstr ""
"overrideとして宣言されたメンバ `{0}' にはnewおよびvirtualを指定できません"
-#: mcs/mcs/class.cs:2108
+#: mcs/mcs/class.cs:2139
#, csharp-format
msgid "`{0}' cannot be both extern and abstract"
msgstr "`{0}' はexternかつabstractとすることはできません"
-#: mcs/mcs/class.cs:2113
+#: mcs/mcs/class.cs:2144
#, csharp-format
msgid "`{0}' cannot be both abstract and sealed"
msgstr "`{0}' はabstractかつsealedとすることはできません"
-#: mcs/mcs/class.cs:2118
+#: mcs/mcs/class.cs:2149
#, csharp-format
msgid "The abstract method `{0}' cannot be marked virtual"
msgstr "abstractメソッド `{0}' はvirtualとすることはできません"
-#: mcs/mcs/class.cs:2124
+#: mcs/mcs/class.cs:2155
#, csharp-format
msgid "`{0}' is abstract but it is declared in the non-abstract class `{1}'"
msgstr ""
"`{0}' はabstractですが、abstractでないクラス `{1}' の中で宣言されています"
-#: mcs/mcs/class.cs:2132
+#: mcs/mcs/class.cs:2163
#, csharp-format
msgid "`{0}': virtual or abstract members cannot be private"
msgstr "`{0}': virtualまたはabstractのメンバはprivateにはできません"
-#: mcs/mcs/class.cs:2139
+#: mcs/mcs/class.cs:2170
#, csharp-format
msgid "`{0}' cannot be sealed because it is not an override"
msgstr "`{0}' はoverrideではないため、sealedとすることはできません"
-#: mcs/mcs/class.cs:2179
+#: mcs/mcs/class.cs:2210
#, csharp-format
msgid "`{0}': containing type does not implement interface `{1}'"
msgstr "`{0}' を含む型はインターフェース `{1}' を実装しません"
-#: mcs/mcs/class.cs:2369
+#: mcs/mcs/class.cs:2400
#, csharp-format
msgid "Type parameter `{0}' has same name as containing type, or method"
msgstr ""
"型パラメータ `{0}' が、その宣言型あるいはメソッドと同じ名前になっています"
-#: mcs/mcs/class.cs:2377
+#: mcs/mcs/class.cs:2408
#, csharp-format
msgid "`{0}': member names cannot be the same as their enclosing type"
msgstr "`{0}': メンバ名はその宣言型と同一にはできません"
-#: mcs/mcs/class.cs:2496
+#: mcs/mcs/class.cs:2527
msgid ""
"The class System.Object cannot have a base class or implement an interface."
msgstr ""
"クラス System.Object には基底クラスやインターフェースを指定することはできませ"
"ん"
-#: mcs/mcs/class.cs:2505
+#: mcs/mcs/class.cs:2536
#, csharp-format
msgid "Attribute `{0}' is only valid on classes derived from System.Attribute"
msgstr "属性 `{0}' はSystem.Attribute から派生したクラスでのみ有効です"
-#: mcs/mcs/class.cs:2510
+#: mcs/mcs/class.cs:2541
msgid ""
"Attribute `System.Diagnostics.ConditionalAttribute' is only valid on methods "
"or attribute classes"
"属性 `System.Diagnostics.ConditionalAttribute' はメソッドまたは属性クラスでの"
"み有効です"
-#: mcs/mcs/class.cs:2539
+#: mcs/mcs/class.cs:2570
#, csharp-format
msgid "`{0}': an abstract class cannot be sealed or static"
msgstr "`{0}': abstractクラスはsealedまたはstaticにはできません"
-#: mcs/mcs/class.cs:2543
+#: mcs/mcs/class.cs:2574
#, csharp-format
msgid "`{0}': a class cannot be both static and sealed"
msgstr "`{0}': クラスはstaticかつsealedとすることはできません"
-#: mcs/mcs/class.cs:2549
+#: mcs/mcs/class.cs:2580
#, csharp-format
msgid "`{0}': Static classes cannot contain user-defined operators"
msgstr "`{0}': staticクラスにはユーザー定義の演算子を含むことはできません"
-#: mcs/mcs/class.cs:2554
+#: mcs/mcs/class.cs:2585
#, csharp-format
msgid "`{0}': Static classes cannot contain destructor"
msgstr "`{0}': staticクラスではデストラクタを定義できません"
-#: mcs/mcs/class.cs:2559
+#: mcs/mcs/class.cs:2590
#, csharp-format
msgid "`{0}': cannot declare indexers in a static class"
msgstr "`{0}': staticクラスではインデクサを宣言できません"
-#: mcs/mcs/class.cs:2567
+#: mcs/mcs/class.cs:2598
#, csharp-format
msgid "`{0}': Static classes cannot have instance constructors"
msgstr "`{0}': staticクラスではインスタンス コンストラクタを定義できません"
-#: mcs/mcs/class.cs:2571
+#: mcs/mcs/class.cs:2602
#, csharp-format
msgid "`{0}': cannot declare instance members in a static class"
msgstr "`{0}': インスタンス メンバをstaticクラスで宣言することはできません"
-#: mcs/mcs/class.cs:2602
+#: mcs/mcs/class.cs:2633
#, fuzzy, csharp-format
msgid "`{0}': Cannot derive from type parameter `{1}'"
msgstr "`{0}': staticクラス '{1}' から派生することはできません"
-#: mcs/mcs/class.cs:2606
+#: mcs/mcs/class.cs:2637
#, csharp-format
msgid "`{0}': Cannot derive from static class `{1}'"
msgstr "`{0}': staticクラス '{1}' から派生することはできません"
-#: mcs/mcs/class.cs:2610
+#: mcs/mcs/class.cs:2641
#, fuzzy, csharp-format
msgid "`{0}': cannot derive from sealed type `{1}'"
msgstr "`{0}': sealedクラス `{1}' から派生することはできません"
-#: mcs/mcs/class.cs:2613
+#: mcs/mcs/class.cs:2644
#, csharp-format
msgid ""
"Static class `{0}' cannot derive from type `{1}'. Static classes must derive "
"staticクラス `{0}' は型 `{1}' から派生できません。staticクラスはobjectから派"
"生しなければなりません"
-#: mcs/mcs/class.cs:2624
+#: mcs/mcs/class.cs:2655
#, csharp-format
msgid "`{0}' cannot derive from special class `{1}'"
msgstr "`{0}' は特別なクラス `{1}' から派生することはできません"
-#: mcs/mcs/class.cs:2634
+#: mcs/mcs/class.cs:2665
#, csharp-format
msgid ""
"Inconsistent accessibility: base class `{0}' is less accessible than class `"
"一貫性の無いアクセス修飾子: 基底クラス `{0}' はクラス `{1}' よりもアクセスが"
"限定的です"
-#: mcs/mcs/class.cs:2642
+#: mcs/mcs/class.cs:2673
#, csharp-format
msgid "Static class `{0}' cannot implement interfaces"
msgstr "staticクラス `{0}' はインターフェースを実装できません"
-#: mcs/mcs/class.cs:2753 mcs/mcs/class.cs:2767
+#: mcs/mcs/class.cs:2784 mcs/mcs/class.cs:2798
#, csharp-format
msgid "Struct member `{0}' of type `{1}' causes a cycle in the struct layout"
msgstr ""
-#: mcs/mcs/class.cs:2849
+#: mcs/mcs/class.cs:2880
#, csharp-format
msgid "`{0}': Structs cannot have instance field initializers"
msgstr "`{0}': 構造体ではインスタンス フィールドを初期化できません"
-#: mcs/mcs/class.cs:3037
+#: mcs/mcs/class.cs:3068
#, fuzzy, csharp-format
msgid "Do not override `{0}'. Use destructor syntax instead"
msgstr ""
"`{0}' を直接使用せず、代わりにパラメータ修飾子 `this' を使用してください"
-#: mcs/mcs/class.cs:3040
+#: mcs/mcs/class.cs:3071
#, csharp-format
msgid "`{0}' is marked as an override but no suitable {1} found to override"
msgstr ""
"`{0}' はoverrideとして宣言されていますが、オーバーライドすべき{1}が見つかりま"
"せん"
-#: mcs/mcs/class.cs:3046
+#: mcs/mcs/class.cs:3077
#, csharp-format
msgid "`{0}': cannot override because `{1}' is not an event"
msgstr "`{0}': `{1}' はイベントではないため、オーバーライドできません"
-#: mcs/mcs/class.cs:3049
+#: mcs/mcs/class.cs:3080
#, csharp-format
msgid "`{0}': cannot override because `{1}' is not a property"
msgstr "`{0}': `{1}' はプロパティではないため、オーバーライドできません"
-#: mcs/mcs/class.cs:3052
+#: mcs/mcs/class.cs:3083
#, csharp-format
msgid "`{0}': cannot override because `{1}' is not a method"
msgstr "`{0}': `{1}' はメソッドではないため、オーバーライドできません"
-#: mcs/mcs/class.cs:3071
+#: mcs/mcs/class.cs:3102
#, fuzzy, csharp-format
msgid ""
"`{0}' cannot override inherited members `{1}' and `{2}' because they have "
"`{0}': 継承しようとするメンバ `{1}' はsealedであるため、オーバーライドできま"
"せん"
-#: mcs/mcs/class.cs:3124 mcs/mcs/field.cs:198
+#: mcs/mcs/class.cs:3155 mcs/mcs/field.cs:198
#, csharp-format
msgid "`{0}' hides inherited abstract member `{1}'"
msgstr "`{0}' は継承されるabstractメンバ `{1}' を隠蔽してしまいます"
-#: mcs/mcs/class.cs:3148
+#: mcs/mcs/class.cs:3179
#, csharp-format
msgid ""
"`{0}': cannot override inherited member `{1}' because it is not marked "
"`{0}': 継承しようとするメンバ `{1}' は、virtual, abstractあるいはoverrideとし"
"て宣言されていないので、オーバーライドすることはできません"
-#: mcs/mcs/class.cs:3156
+#: mcs/mcs/class.cs:3187
#, csharp-format
msgid "`{0}': cannot override inherited member `{1}' because it is sealed"
msgstr ""
"`{0}': 継承しようとするメンバ `{1}' はsealedであるため、オーバーライドできま"
"せん"
-#: mcs/mcs/class.cs:3165
+#: mcs/mcs/class.cs:3196
#, csharp-format
msgid "`{0}': type must be `{1}' to match overridden member `{2}'"
msgstr ""
"`{0}': オーバーライドされたメンバ `{2}' に適合するためには、型が `{1}' でなけ"
"ればなりません"
-#: mcs/mcs/class.cs:3168
+#: mcs/mcs/class.cs:3199
#, csharp-format
msgid "`{0}': return type must be `{1}' to match overridden member `{2}'"
msgstr ""
"`{0}': オーバーライドされたメンバ `{2}' に適合するには、戻り値型は `{1}' でな"
"ければなりません"
-#: mcs/mcs/class.cs:3236
+#: mcs/mcs/class.cs:3267
#, csharp-format
msgid "A partial method `{0}' cannot explicitly implement an interface"
msgstr "部分メソッド `{0}' はインターフェースを明示的に実装できません"
-#: mcs/mcs/class.cs:3242
+#: mcs/mcs/class.cs:3273
#, fuzzy, csharp-format
msgid "The type `{0}' in explicit interface declaration is not an interface"
msgstr ""
"明示的なインターフェース実装で記述された `{0}' は、インターフェースではありま"
"せん"
-#: mcs/mcs/class.cs:3273
+#: mcs/mcs/class.cs:3304
#, csharp-format
msgid ""
"Inconsistent accessibility: parameter type `{0}' is less accessible than "
"一貫性の無いアクセス制限: パラメータ型 `{0}' はインデクサ '{1}' よりもアクセ"
"スが限られています"
-#: mcs/mcs/class.cs:3277
+#: mcs/mcs/class.cs:3308
#, csharp-format
msgid ""
"Inconsistent accessibility: parameter type `{0}' is less accessible than "
"一貫性の無いアクセス制限: パラメータ型 `{0}' は演算子 '{1}' よりもアクセスが"
"限られています"
-#: mcs/mcs/class.cs:3281
+#: mcs/mcs/class.cs:3312
#, csharp-format
msgid ""
"Inconsistent accessibility: parameter type `{0}' is less accessible than "
"一貫性の無いアクセス制限: パラメータ型 `{0}' はメソッド '{1}' よりもアクセス"
"が限られています"
-#: mcs/mcs/class.cs:3341
+#: mcs/mcs/class.cs:3372
#, csharp-format
msgid ""
"`{0}': cannot change access modifiers when overriding `{1}' inherited member "
"`{0}': `{1}' の継承されたメンバー `{2}' をオーバーライドするとき、アクセス修"
"飾子は変更できません"
-#: mcs/mcs/class.cs:3350
+#: mcs/mcs/class.cs:3381
#, fuzzy, csharp-format
msgid "`{0}': static types cannot be used as return types"
msgstr "`{0}': staticクラスではインスタンス コンストラクタを定義できません"
-#: mcs/mcs/class.cs:3463
+#: mcs/mcs/class.cs:3442
+#, csharp-format
+msgid ""
+"`{0}': Cannot specify constraints for overrides and explicit interface "
+"implementation methods"
+msgstr ""
+
+#: mcs/mcs/class.cs:3504
#, csharp-format
msgid "New virtual member `{0}' is declared in a sealed class `{1}'"
msgstr ""
-#: mcs/mcs/class.cs:3478
+#: mcs/mcs/class.cs:3519
msgid "Inconsistent accessibility: property type `"
msgstr ""
-#: mcs/mcs/class.cs:3483
+#: mcs/mcs/class.cs:3524
msgid "Inconsistent accessibility: indexer return type `"
msgstr ""
-#: mcs/mcs/class.cs:3489 mcs/mcs/class.cs:3494 mcs/mcs/delegate.cs:171
+#: mcs/mcs/class.cs:3530 mcs/mcs/class.cs:3535 mcs/mcs/delegate.cs:171
msgid "Inconsistent accessibility: return type `"
msgstr ""
-#: mcs/mcs/class.cs:3499
+#: mcs/mcs/class.cs:3540
msgid "Inconsistent accessibility: field type `"
msgstr ""
-#: mcs/mcs/class.cs:3511
+#: mcs/mcs/class.cs:3552
#, csharp-format
msgid ""
"Parameters or local variables of type `{0}' cannot be declared in async "
"methods or iterators"
msgstr ""
-#: mcs/mcs/class.cs:3515
+#: mcs/mcs/class.cs:3556
#, fuzzy, csharp-format
msgid ""
"Local variables of type `{0}' cannot be used inside anonymous methods, "
"ローカル変数またはパラメータである `{0}' は、そのアドレスを取得して匿名メソッ"
"ドあるいはラムダ式の中で使用することができません"
-#: mcs/mcs/class.cs:3519
+#: mcs/mcs/class.cs:3560
#, csharp-format
msgid "Field or property cannot be of type `{0}'"
msgstr ""
"The evaluation of the constant value for `{0}' involves a circular definition"
msgstr ""
-#: mcs/mcs/constant.cs:66 mcs/mcs/constant.cs:392
+#: mcs/mcs/constant.cs:66 mcs/mcs/constant.cs:403
#, csharp-format
msgid "Constant value `{0}' cannot be converted to a `{1}'"
msgstr ""
-#: mcs/mcs/constant.cs:264
+#: mcs/mcs/constant.cs:266
#, csharp-format
msgid ""
"Constant value `{0}' cannot be converted to a `{1}' (use `unchecked' syntax "
"to override)"
msgstr ""
-#: mcs/mcs/convert.cs:1184
+#: mcs/mcs/convert.cs:1185
#, csharp-format
msgid ""
"Ambiguous user defined operators `{0}' and `{1}' when converting from `{2}' "
"Extension method `{0}' of value type `{1}' cannot be used to create delegates"
msgstr ""
-#: mcs/mcs/delegate.cs:532
+#: mcs/mcs/delegate.cs:535
#, csharp-format
msgid "Cannot create delegate from partial method declaration `{0}'"
msgstr ""
-#: mcs/mcs/delegate.cs:535
+#: mcs/mcs/delegate.cs:538
#, csharp-format
msgid ""
"Cannot create delegate with `{0}' because it has a Conditional attribute"
msgstr ""
-#: mcs/mcs/delegate.cs:578
+#: mcs/mcs/delegate.cs:581
#, csharp-format
msgid ""
"A method or delegate `{0} {1}' parameters and return type must be same as "
"delegate `{2} {3}' parameters and return type"
msgstr ""
-#: mcs/mcs/delegate.cs:585
+#: mcs/mcs/delegate.cs:588
#, csharp-format
msgid ""
"A method or delegate `{0}' parameters do not match delegate `{1}' parameters"
msgstr ""
-#: mcs/mcs/delegate.cs:590
+#: mcs/mcs/delegate.cs:593
#, csharp-format
msgid ""
"A method or delegate `{0} {1}' return type does not match delegate `{2} {3}' "
"return type"
msgstr ""
-#: mcs/mcs/delegate.cs:673
+#: mcs/mcs/delegate.cs:676
msgid "Method name expected"
msgstr ""
-#: mcs/mcs/doc.cs:613
+#: mcs/mcs/doc.cs:621
#, csharp-format
msgid "Error generating XML documentation file `{0}' (`{1}')"
msgstr ""
-#: mcs/mcs/driver.cs:51
+#: mcs/mcs/driver.cs:52
msgid "Source file `"
msgstr ""
-#: mcs/mcs/driver.cs:96
-#, csharp-format
-msgid "Source file `{0}' could not be found"
-msgstr ""
-
-#: mcs/mcs/driver.cs:103
-#, csharp-format
-msgid "Source file `{0}' is a binary file and not a text file"
-msgstr ""
-
-#: mcs/mcs/driver.cs:210
+#: mcs/mcs/driver.cs:258
msgid "No files to compile were specified"
msgstr "コンパイルするファイルが指定されていません"
-#: mcs/mcs/driver.cs:215
+#: mcs/mcs/driver.cs:263
msgid "Platform option `anycpu32bitpreferred' is valid only for executables"
msgstr ""
-#: mcs/mcs/driver.cs:245
+#: mcs/mcs/driver.cs:293
msgid ""
"If no source files are specified you must specify the output file with -out:"
msgstr ""
-#: mcs/mcs/driver.cs:262
+#: mcs/mcs/driver.cs:310
msgid "Output file name is not valid"
msgstr ""
msgstr ""
#: mcs/mcs/ecore.cs:328
-#, csharp-format
-msgid ""
-"Members of value type `{0}' cannot be assigned using a property `{1}' object "
-"initializer"
-msgstr ""
-
-#: mcs/mcs/ecore.cs:331
-#, csharp-format
-msgid ""
-"Cannot modify a value type return value of `{0}'. Consider storing the value "
-"in a temporary variable"
-msgstr ""
-
-#: mcs/mcs/ecore.cs:335
msgid ""
"The left-hand side of an assignment must be a variable, a property or an "
"indexer"
msgstr ""
-#: mcs/mcs/ecore.cs:341
+#: mcs/mcs/ecore.cs:334
msgid "The operation in question is undefined on void pointers"
msgstr ""
-#: mcs/mcs/ecore.cs:408 mcs/mcs/statement.cs:3001 mcs/mcs/statement.cs:3003
+#: mcs/mcs/ecore.cs:422 mcs/mcs/statement.cs:3038 mcs/mcs/statement.cs:3040
#, csharp-format
msgid "Internal compiler error: {0}"
msgstr ""
-#: mcs/mcs/ecore.cs:448
+#: mcs/mcs/ecore.cs:462
msgid "A ref or out argument must be an assignable variable"
msgstr ""
-#: mcs/mcs/ecore.cs:467
+#: mcs/mcs/ecore.cs:481
msgid ""
"An attribute argument must be a constant expression, typeof expression or "
"array creation expression"
msgstr "属性の引数は定数、typeof式または配列生成式でなければなりません"
-#: mcs/mcs/ecore.cs:641
+#: mcs/mcs/ecore.cs:655
#, csharp-format
msgid "The class `{0}' has no constructors defined"
msgstr ""
-#: mcs/mcs/ecore.cs:763
+#: mcs/mcs/ecore.cs:777
#, csharp-format
msgid "The `{0}' operator cannot be applied to operand of type `{1}'"
msgstr ""
-#: mcs/mcs/ecore.cs:769
+#: mcs/mcs/ecore.cs:783
msgid "An expression tree cannot contain an unsafe pointer operation"
msgstr ""
-#: mcs/mcs/ecore.cs:847
+#: mcs/mcs/ecore.cs:861
#, csharp-format
msgid "`{0}' is a `{1}' but a `{2}' was expected"
msgstr ""
-#: mcs/mcs/ecore.cs:880
+#: mcs/mcs/ecore.cs:894
#, csharp-format
msgid "Expression denotes a `{0}', where a `{1}' was expected"
msgstr ""
-#: mcs/mcs/ecore.cs:890
+#: mcs/mcs/ecore.cs:904
msgid "Pointers and fixed size buffers may only be used in an unsafe context"
msgstr ""
-#: mcs/mcs/ecore.cs:2323
+#: mcs/mcs/ecore.cs:2364
#, csharp-format
msgid ""
"Dynamic keyword requires `{0}' to be defined. Are you missing System.Core."
"dll assembly reference?"
msgstr ""
-#: mcs/mcs/ecore.cs:2399
+#: mcs/mcs/ecore.cs:2440
#, csharp-format
msgid ""
"A local variable `{0}' cannot be used before it is declared. Consider "
"renaming the local variable when it hides the member `{1}'"
msgstr ""
-#: mcs/mcs/ecore.cs:2414 mcs/mcs/ecore.cs:2457
+#: mcs/mcs/ecore.cs:2455 mcs/mcs/ecore.cs:2498
#, csharp-format
msgid "`{0}' conflicts with a declaration in a child block"
msgstr ""
-#: mcs/mcs/ecore.cs:2466
+#: mcs/mcs/ecore.cs:2507
#, csharp-format
msgid "A local variable `{0}' cannot be used before it is declared"
msgstr ""
-#: mcs/mcs/ecore.cs:2520
+#: mcs/mcs/ecore.cs:2561
#, csharp-format
msgid "The name `{0}' does not exist in the current context"
msgstr ""
-#: mcs/mcs/ecore.cs:2616
+#: mcs/mcs/ecore.cs:2657
msgid "System.Void cannot be used from C#. Consider using `void'"
msgstr ""
-#: mcs/mcs/ecore.cs:2900
+#: mcs/mcs/ecore.cs:2941
#, csharp-format
msgid "Cannot call an abstract base member `{0}'"
msgstr ""
-#: mcs/mcs/ecore.cs:2907
+#: mcs/mcs/ecore.cs:2948
#, csharp-format
msgid ""
"Cannot access protected member `{0}' via a qualifier of type `{1}'. The "
"qualifier must be of type `{2}' or derived from it"
msgstr ""
-#: mcs/mcs/ecore.cs:2950
+#: mcs/mcs/ecore.cs:2964
+#, csharp-format
+msgid ""
+"Members of value type `{0}' cannot be assigned using a property `{1}' object "
+"initializer"
+msgstr ""
+
+#: mcs/mcs/ecore.cs:2968
+#, csharp-format
+msgid ""
+"Cannot modify a value type return value of `{0}'. Consider storing the value "
+"in a temporary variable"
+msgstr ""
+
+#: mcs/mcs/ecore.cs:2994
#, csharp-format
msgid ""
"Static member `{0}' cannot be accessed with an instance reference, qualify "
"it with a type name instead"
msgstr ""
-#: mcs/mcs/ecore.cs:2965
+#: mcs/mcs/ecore.cs:3009
#, csharp-format
msgid ""
"A field initializer cannot reference the nonstatic field, method, or "
"property `{0}'"
msgstr ""
-#: mcs/mcs/ecore.cs:2969
+#: mcs/mcs/ecore.cs:3013
#, csharp-format
msgid "An object reference is required to access non-static member `{0}'"
msgstr ""
-#: mcs/mcs/ecore.cs:2978
+#: mcs/mcs/ecore.cs:3022
#, csharp-format
msgid ""
"Cannot access a nonstatic member of outer type `{0}' via nested type `{1}'"
msgstr ""
-#: mcs/mcs/ecore.cs:3026
+#: mcs/mcs/ecore.cs:3070
msgid "Cannot modify the result of an unboxing conversion"
msgstr ""
-#: mcs/mcs/ecore.cs:3192
+#: mcs/mcs/ecore.cs:3240
#, csharp-format
msgid ""
"Type `{0}' does not contain a member `{1}' and the best extension method "
"overload `{2}' has some invalid arguments"
msgstr ""
-#: mcs/mcs/ecore.cs:3197
+#: mcs/mcs/ecore.cs:3245
#, csharp-format
msgid "Extension method instance type `{0}' cannot be converted to `{1}'"
msgstr ""
-#: mcs/mcs/ecore.cs:3331
+#: mcs/mcs/ecore.cs:3379
msgid "An expression tree cannot contain an expression with method group"
msgstr ""
-#: mcs/mcs/ecore.cs:3337
+#: mcs/mcs/ecore.cs:3385
msgid ""
"Partial methods with only a defining declaration or removed conditional "
"methods cannot be used in an expression tree"
msgstr ""
-#: mcs/mcs/ecore.cs:3369
+#: mcs/mcs/ecore.cs:3417
#, csharp-format
msgid ""
"Cannot convert method group `{0}' to non-delegate type `{1}'. Consider using "
"parentheses to invoke the method"
msgstr ""
-#: mcs/mcs/ecore.cs:4049
+#: mcs/mcs/ecore.cs:4150
#, csharp-format
msgid ""
"The type `{0}' does not contain a constructor that takes `{1}' arguments"
msgstr ""
-#: mcs/mcs/ecore.cs:4715
+#: mcs/mcs/ecore.cs:4837
#, csharp-format
msgid ""
"Type `{0}' does not contain a member `{1}' and the best extension method "
"without the extension method syntax"
msgstr ""
-#: mcs/mcs/ecore.cs:4743
+#: mcs/mcs/ecore.cs:4876
#, csharp-format
msgid ""
"The call is ambiguous between the following methods or properties: `{0}' and "
"`{1}'"
msgstr ""
-#: mcs/mcs/ecore.cs:4801
+#: mcs/mcs/ecore.cs:4939
#, csharp-format
msgid ""
-"The best overloaded collection initalizer method `{0}' cannot have 'ref', or "
+"The best overloaded collection initalizer method `{0}' cannot have `ref' or "
"`out' modifier"
msgstr ""
-#: mcs/mcs/ecore.cs:4805
+#: mcs/mcs/ecore.cs:4943
#, csharp-format
msgid ""
"The best overloaded collection initalizer method `{0}' has some invalid "
"arguments"
msgstr ""
-#: mcs/mcs/ecore.cs:4808
+#: mcs/mcs/ecore.cs:4946
#, csharp-format
msgid "Delegate `{0}' has some invalid arguments"
msgstr ""
-#: mcs/mcs/ecore.cs:4812
+#: mcs/mcs/ecore.cs:4950
#, csharp-format
msgid "The best overloaded method match for `{0}' has some invalid arguments"
msgstr ""
-#: mcs/mcs/ecore.cs:4821
+#: mcs/mcs/ecore.cs:4959
#, csharp-format
msgid ""
"Argument `#{0}' does not require `{1}' modifier. Consider removing `{1}' "
"modifier"
msgstr ""
-#: mcs/mcs/ecore.cs:4824
+#: mcs/mcs/ecore.cs:4962
#, csharp-format
msgid "Argument `#{0}' is missing `{1}' modifier"
msgstr ""
-#: mcs/mcs/ecore.cs:4836
+#: mcs/mcs/ecore.cs:4979
#, csharp-format
msgid "Argument `#{0}' cannot convert `{1}' expression to type `{2}'"
msgstr ""
-#: mcs/mcs/ecore.cs:4889
+#: mcs/mcs/ecore.cs:5032
#, csharp-format
msgid ""
"The type arguments for method `{0}' cannot be inferred from the usage. Try "
"specifying the type arguments explicitly"
msgstr ""
-#: mcs/mcs/ecore.cs:4918
+#: mcs/mcs/ecore.cs:5061
#, csharp-format
msgid "No overload for method `{0}' takes `{1}' arguments"
msgstr ""
-#: mcs/mcs/ecore.cs:4971
+#: mcs/mcs/ecore.cs:5114
#, fuzzy, csharp-format
msgid "The delegate `{0}' does not contain a parameter named `{1}'"
msgstr "デリゲート `{0}' は `{1}' 個の引数をもちません"
-#: mcs/mcs/ecore.cs:4976
+#: mcs/mcs/ecore.cs:5119
#, csharp-format
msgid ""
"The best overloaded method match for `{0}' does not contain a parameter "
"named `{1}'"
msgstr ""
-#: mcs/mcs/ecore.cs:4986
+#: mcs/mcs/ecore.cs:5129
#, csharp-format
msgid ""
"Named argument `{0}' cannot be used for a parameter which has positional "
"argument specified"
msgstr ""
-#: mcs/mcs/ecore.cs:5322
+#: mcs/mcs/ecore.cs:5467
msgid ""
"You cannot use fixed size buffers contained in unfixed expressions. Try "
"using the fixed statement"
msgstr ""
-#: mcs/mcs/ecore.cs:5327
+#: mcs/mcs/ecore.cs:5472
#, csharp-format
msgid "`{0}': Fixed size buffers can only be accessed through locals or fields"
msgstr ""
-#: mcs/mcs/ecore.cs:5363
+#: mcs/mcs/ecore.cs:5508
#, csharp-format
msgid "Use of possibly unassigned field `{0}'"
msgstr ""
-#: mcs/mcs/ecore.cs:5789
+#: mcs/mcs/ecore.cs:5935
#, csharp-format
msgid "Property or event `{0}' is not supported by the C# language"
msgstr ""
-#: mcs/mcs/ecore.cs:5969
+#: mcs/mcs/ecore.cs:6131
#, csharp-format
msgid "A range variable `{0}' may not be passes as `ref' or `out' parameter"
msgstr ""
-#: mcs/mcs/ecore.cs:6047
+#: mcs/mcs/ecore.cs:6204
#, csharp-format
msgid ""
"The property or indexer `{0}' cannot be used in this context because it "
"lacks the `get' accessor"
msgstr ""
-#: mcs/mcs/ecore.cs:6054
+#: mcs/mcs/ecore.cs:6211
#, csharp-format
msgid ""
"The property or indexer `{0}' cannot be used in this context because the get "
"accessor is inaccessible"
msgstr ""
-#: mcs/mcs/ecore.cs:6073
+#: mcs/mcs/ecore.cs:6230
#, csharp-format
msgid "Property or indexer `{0}' cannot be assigned to (it is read-only)"
msgstr ""
-#: mcs/mcs/ecore.cs:6081
+#: mcs/mcs/ecore.cs:6238
#, csharp-format
msgid ""
"The property or indexer `{0}' cannot be used in this context because the set "
"accessor is inaccessible"
msgstr ""
-#: mcs/mcs/ecore.cs:6249
+#: mcs/mcs/ecore.cs:6406
#, csharp-format
msgid ""
"The event `{0}' can only appear on the left hand side of `+=' or `-=' "
"operator"
msgstr ""
-#: mcs/mcs/ecore.cs:6253
+#: mcs/mcs/ecore.cs:6410
#, csharp-format
msgid ""
"The event `{0}' can only appear on the left hand side of += or -= when used "
"outside of the type `{1}'"
msgstr ""
-#: mcs/mcs/ecore.cs:6423
+#: mcs/mcs/ecore.cs:6580
#, csharp-format
msgid ""
"An implicitly typed local variable declaration cannot be initialized with `"
"{0}'"
msgstr ""
-#: mcs/mcs/ecore.cs:6437
+#: mcs/mcs/ecore.cs:6594
msgid ""
"The contextual keyword `var' may only appear within a local variable "
"declaration"
msgid "Type byte, sbyte, short, ushort, int, uint, long or ulong expected"
msgstr ""
-#: mcs/mcs/eval.cs:562
+#: mcs/mcs/eval.cs:563
msgid "Detection Parsing Error"
msgstr ""
"{1}' is used as a short circuit operator"
msgstr ""
-#: mcs/mcs/expression.cs:4635
+#: mcs/mcs/expression.cs:4656
#, csharp-format
msgid ""
"Type of conditional expression cannot be determined as `{0}' and `{1}' "
"convert implicitly to each other"
msgstr ""
-#: mcs/mcs/expression.cs:4645
+#: mcs/mcs/expression.cs:4666
#, csharp-format
msgid ""
"Type of conditional expression cannot be determined because there is no "
"implicit conversion between `{0}' and `{1}'"
msgstr ""
-#: mcs/mcs/expression.cs:4943
+#: mcs/mcs/expression.cs:4964
#, csharp-format
msgid "Use of unassigned local variable `{0}'"
msgstr ""
-#: mcs/mcs/expression.cs:4963
+#: mcs/mcs/expression.cs:4984
#, csharp-format
msgid ""
"Cannot use fixed local `{0}' inside an anonymous method, lambda expression "
"or query expression"
msgstr ""
-#: mcs/mcs/expression.cs:5156
+#: mcs/mcs/expression.cs:5177
#, csharp-format
msgid ""
"Parameter `{0}' cannot be used inside `{1}' when using `ref' or `out' "
"modifier"
msgstr ""
-#: mcs/mcs/expression.cs:5235
+#: mcs/mcs/expression.cs:5256
#, csharp-format
msgid "Use of unassigned out parameter `{0}'"
msgstr ""
-#: mcs/mcs/expression.cs:5345
+#: mcs/mcs/expression.cs:5368
#, fuzzy, csharp-format
msgid "Cannot invoke a non-delegate type `{0}'"
msgstr "`{0}' をデリゲートでない型 `{1}'に変換できません"
-#: mcs/mcs/expression.cs:5356
+#: mcs/mcs/expression.cs:5379
#, csharp-format
msgid "The member `{0}' cannot be used as method or delegate"
msgstr ""
-#: mcs/mcs/expression.cs:5376
+#: mcs/mcs/expression.cs:5399
msgid ""
"Do not directly call your base class Finalize method. It is called "
"automatically from your destructor"
msgstr ""
-#: mcs/mcs/expression.cs:5378
+#: mcs/mcs/expression.cs:5401
msgid ""
"Destructors and object.Finalize cannot be called directly. Consider calling "
"IDisposable.Dispose if available"
msgstr ""
-#: mcs/mcs/expression.cs:5407
+#: mcs/mcs/expression.cs:5430
#, csharp-format
msgid ""
"The base call to method `{0}' cannot be dynamically dispatched. Consider "
"casting the dynamic arguments or eliminating the base access"
msgstr ""
-#: mcs/mcs/expression.cs:5480
+#: mcs/mcs/expression.cs:5503
#, csharp-format
msgid "`{0}': cannot explicitly call operator or accessor"
msgstr ""
-#: mcs/mcs/expression.cs:5664
+#: mcs/mcs/expression.cs:5687
#, csharp-format
msgid "Unsafe type `{0}' cannot be used in an object creation expression"
msgstr ""
-#: mcs/mcs/expression.cs:5687
+#: mcs/mcs/expression.cs:5710
#, csharp-format
msgid ""
"Cannot create an instance of the variable type `{0}' because it does not "
"have the new() constraint"
msgstr ""
-#: mcs/mcs/expression.cs:5693
+#: mcs/mcs/expression.cs:5716
#, csharp-format
msgid ""
"`{0}': cannot provide arguments when creating an instance of a variable type"
msgstr ""
-#: mcs/mcs/expression.cs:5702
+#: mcs/mcs/expression.cs:5725
#, csharp-format
msgid "Cannot create an instance of the static class `{0}'"
msgstr ""
-#: mcs/mcs/expression.cs:5714
+#: mcs/mcs/expression.cs:5737
#, csharp-format
msgid "Cannot create an instance of the abstract class or interface `{0}'"
msgstr ""
-#: mcs/mcs/expression.cs:6015
+#: mcs/mcs/expression.cs:6038
msgid ""
"An implicitly typed local variable declarator cannot use an array initializer"
msgstr ""
-#: mcs/mcs/expression.cs:6159 mcs/mcs/expression.cs:6167
-#: mcs/mcs/statement.cs:1206 mcs/mcs/statement.cs:3582
+#: mcs/mcs/expression.cs:6182 mcs/mcs/expression.cs:6190
+#: mcs/mcs/statement.cs:1227 mcs/mcs/statement.cs:3619
msgid "A constant value is expected"
msgstr ""
-#: mcs/mcs/expression.cs:6173
+#: mcs/mcs/expression.cs:6196 mcs/mcs/expression.cs:6221
#, csharp-format
msgid "An array initializer of length `{0}' was expected"
msgstr ""
-#: mcs/mcs/expression.cs:6189
+#: mcs/mcs/expression.cs:6212
msgid ""
"Array initializers can only be used in a variable or field initializer. Try "
"using a new expression instead"
msgstr ""
-#: mcs/mcs/expression.cs:6197
+#: mcs/mcs/expression.cs:6229
msgid "A nested array initializer was expected"
msgstr ""
-#: mcs/mcs/expression.cs:6244
+#: mcs/mcs/expression.cs:6276
msgid "An expression tree cannot contain a multidimensional array initializer"
msgstr ""
-#: mcs/mcs/expression.cs:6280
+#: mcs/mcs/expression.cs:6312
msgid "Cannot create an array with a negative size"
msgstr ""
-#: mcs/mcs/expression.cs:6361
+#: mcs/mcs/expression.cs:6393
msgid ""
"Can only use array initializer expressions to assign to array types. Try "
"using a new expression instead"
msgstr ""
-#: mcs/mcs/expression.cs:6829
+#: mcs/mcs/expression.cs:6830
msgid ""
"The type of an implicitly typed array cannot be inferred from the "
"initializer. Try specifying array type explicitly"
msgstr ""
-#: mcs/mcs/expression.cs:6972
+#: mcs/mcs/expression.cs:6973
msgid ""
"The `this' object cannot be used before all of its fields are assigned to"
msgstr ""
-#: mcs/mcs/expression.cs:6979
+#: mcs/mcs/expression.cs:6980
msgid ""
"Keyword `this' is not valid in a static property, static method, or static "
"field initializer"
msgstr ""
-#: mcs/mcs/expression.cs:6982
+#: mcs/mcs/expression.cs:6983
msgid ""
"Anonymous methods inside structs cannot access instance members of `this'. "
"Consider copying `this' to a local variable outside the anonymous method and "
"using the local instead"
msgstr ""
-#: mcs/mcs/expression.cs:6985
+#: mcs/mcs/expression.cs:6986
msgid "Keyword `this' is not available in the current context"
msgstr ""
-#: mcs/mcs/expression.cs:7062
+#: mcs/mcs/expression.cs:7063
msgid "Cannot take the address of `this' because it is read-only"
msgstr ""
-#: mcs/mcs/expression.cs:7064
+#: mcs/mcs/expression.cs:7065
msgid "Cannot pass `this' as a ref or out argument because it is read-only"
msgstr ""
-#: mcs/mcs/expression.cs:7066
+#: mcs/mcs/expression.cs:7067
msgid "Cannot assign to `this' because it is read-only"
msgstr ""
-#: mcs/mcs/expression.cs:7138
+#: mcs/mcs/expression.cs:7139
msgid "The __arglist construct is valid only within a variable argument method"
msgstr ""
-#: mcs/mcs/expression.cs:7199
+#: mcs/mcs/expression.cs:7200
msgid "An expression tree cannot contain a method with variable arguments"
msgstr ""
-#: mcs/mcs/expression.cs:7436
+#: mcs/mcs/expression.cs:7437
msgid "The typeof operator cannot be used on the dynamic type"
msgstr ""
-#: mcs/mcs/expression.cs:7477
+#: mcs/mcs/expression.cs:7478
#, csharp-format
msgid "`{0}': an attribute argument cannot use type parameters"
msgstr ""
-#: mcs/mcs/expression.cs:7692
+#: mcs/mcs/expression.cs:7693
#, csharp-format
msgid ""
"`{0}' does not have a predefined size, therefore sizeof can only be used in "
"SizeOf)"
msgstr ""
-#: mcs/mcs/expression.cs:7759
+#: mcs/mcs/expression.cs:7760
#, csharp-format
msgid "Alias `{0}' not found"
msgstr ""
-#: mcs/mcs/expression.cs:7785
+#: mcs/mcs/expression.cs:7786
msgid ""
"The namespace alias qualifier `::' cannot be used to invoke a method. "
"Consider using `.' instead"
msgstr ""
-#: mcs/mcs/expression.cs:7894
+#: mcs/mcs/expression.cs:7895
msgid "Cannot perform member binding on `null' value"
msgstr ""
-#: mcs/mcs/expression.cs:8057
+#: mcs/mcs/expression.cs:8068
#, csharp-format
-msgid "`{0}': cannot reference a type through an expression; try `{1}' instead"
+msgid ""
+"`{0}': cannot reference a type through an expression. Consider using `{1}' "
+"instead"
msgstr ""
-#: mcs/mcs/expression.cs:8138
+#: mcs/mcs/expression.cs:8147
#, csharp-format
msgid "A nested type cannot be specified through a type parameter `{0}'"
msgstr ""
-#: mcs/mcs/expression.cs:8146
+#: mcs/mcs/expression.cs:8155
#, csharp-format
msgid ""
"Alias `{0}' cannot be used with `::' since it denotes a type. Consider "
"replacing `::' with `.'"
msgstr ""
-#: mcs/mcs/expression.cs:8211
+#: mcs/mcs/expression.cs:8220
#, csharp-format
msgid "The nested type `{0}' does not exist in the type `{1}'"
msgstr ""
-#: mcs/mcs/expression.cs:8220
+#: mcs/mcs/expression.cs:8239
#, csharp-format
msgid ""
"Type `{0}' does not contain a definition for `{1}' and no extension method `"
-"{1}' of type `{0}' could be found (are you missing a using directive or an "
-"assembly reference?)"
+"{1}' of type `{0}' could be found. Are you missing {2}?"
msgstr ""
-#: mcs/mcs/expression.cs:8432
+#: mcs/mcs/expression.cs:8451
#, csharp-format
msgid "Cannot apply indexing with [] to an expression of type `{0}'"
msgstr ""
-#: mcs/mcs/expression.cs:8450
+#: mcs/mcs/expression.cs:8469
msgid "A pointer must be indexed by only one value"
msgstr ""
-#: mcs/mcs/expression.cs:8504
+#: mcs/mcs/expression.cs:8518
msgid "An element access expression cannot use named argument"
msgstr ""
-#: mcs/mcs/expression.cs:8582
+#: mcs/mcs/expression.cs:8596
#, csharp-format
msgid "Wrong number of indexes `{0}' inside [], expected `{1}'"
msgstr ""
-#: mcs/mcs/expression.cs:8970
+#: mcs/mcs/expression.cs:8984
msgid ""
"The indexer base access cannot be dynamically dispatched. Consider casting "
"the dynamic arguments or eliminating the base access"
msgstr ""
-#: mcs/mcs/expression.cs:9055
+#: mcs/mcs/expression.cs:9069
msgid "An expression tree may not contain a base access"
msgstr ""
-#: mcs/mcs/expression.cs:9073
+#: mcs/mcs/expression.cs:9087
#, fuzzy
msgid "Keyword `base' is not available in a static method"
msgstr "キーワード `new' は名前空間要素で認められていません"
-#: mcs/mcs/expression.cs:9075
+#: mcs/mcs/expression.cs:9089
#, fuzzy
msgid "Keyword `base' is not available in the current context"
msgstr "キーワード `new' は名前空間要素で認められていません"
-#: mcs/mcs/expression.cs:9113
+#: mcs/mcs/expression.cs:9127
msgid ""
"A property, indexer or dynamic member access may not be passed as `ref' or "
"`out' parameter"
msgstr ""
-#: mcs/mcs/expression.cs:9438
+#: mcs/mcs/expression.cs:9455
#, csharp-format
msgid "Array elements cannot be of type `{0}'"
msgstr ""
-#: mcs/mcs/expression.cs:9441
+#: mcs/mcs/expression.cs:9458
#, csharp-format
msgid "Array elements cannot be of static type `{0}'"
msgstr ""
-#: mcs/mcs/expression.cs:9617
+#: mcs/mcs/expression.cs:9634
msgid "Cannot use a negative size with stackalloc"
msgstr ""
-#: mcs/mcs/expression.cs:9621
+#: mcs/mcs/expression.cs:9638
msgid "Cannot use stackalloc in finally or catch"
msgstr ""
-#: mcs/mcs/expression.cs:9738
+#: mcs/mcs/expression.cs:9755
#, csharp-format
msgid ""
"Member `{0}' cannot be initialized. An object initializer may only be used "
"for fields, or properties"
msgstr ""
-#: mcs/mcs/expression.cs:9747
+#: mcs/mcs/expression.cs:9764
#, csharp-format
msgid ""
"Static field or property `{0}' cannot be assigned in an object initializer"
msgstr ""
-#: mcs/mcs/expression.cs:9946
+#: mcs/mcs/expression.cs:9963
#, csharp-format
msgid ""
"A field or property `{0}' cannot be initialized with a collection object "
"initializer because type `{1}' does not implement `{2}' interface"
msgstr ""
-#: mcs/mcs/expression.cs:9957
+#: mcs/mcs/expression.cs:9974
#, csharp-format
msgid "Inconsistent `{0}' member declaration"
msgstr ""
-#: mcs/mcs/expression.cs:9965
+#: mcs/mcs/expression.cs:9982
#, csharp-format
msgid ""
"An object initializer includes more than one member `{0}' initialization"
msgstr ""
-#: mcs/mcs/expression.cs:9983
+#: mcs/mcs/expression.cs:10000
#, csharp-format
msgid "Cannot initialize object of type `{0}' with a collection initializer"
msgstr ""
-#: mcs/mcs/expression.cs:10268
+#: mcs/mcs/expression.cs:10285
#, fuzzy
msgid "Anonymous types cannot be used in this expression"
msgstr "匿名メソッドを式ツリーに変換することはできません"
-#: mcs/mcs/expression.cs:10367
+#: mcs/mcs/expression.cs:10384
#, csharp-format
msgid "An anonymous type property `{0}' cannot be initialized with `{1}'"
msgstr ""
"Fixed size buffer `{0}' of length `{1}' and type `{2}' exceeded 2^31 limit"
msgstr ""
-#: mcs/mcs/field.cs:667
+#: mcs/mcs/field.cs:666
#, fuzzy, csharp-format
msgid "`{0}': A volatile field cannot be of the type `{1}'"
msgstr "`{0}': sealedクラス `{1}' から派生することはできません"
-#: mcs/mcs/field.cs:672
+#: mcs/mcs/field.cs:671
#, fuzzy, csharp-format
msgid "`{0}': A field cannot be both volatile and readonly"
msgstr "`{0}': クラスはstaticかつsealedとすることはできません"
msgstr ""
#: mcs/mcs/flowanalysis.cs:996 mcs/mcs/flowanalysis.cs:1012
-#: mcs/mcs/flowanalysis.cs:1048 mcs/mcs/statement.cs:782
+#: mcs/mcs/flowanalysis.cs:1048 mcs/mcs/statement.cs:795
msgid "Control cannot leave the body of a finally clause"
msgstr ""
"`{0}' is not a valid constraint. Static classes cannot be used as constraints"
msgstr ""
-#: mcs/mcs/generic.cs:601
+#: mcs/mcs/generic.cs:613
#, csharp-format
msgid "The {2} type parameter `{0}' must be {3} valid on `{1}{4}'"
msgstr ""
-#: mcs/mcs/generic.cs:1974
+#: mcs/mcs/generic.cs:2032
#, csharp-format
msgid "`{0}': static classes cannot be used as generic arguments"
msgstr ""
-#: mcs/mcs/generic.cs:1981
+#: mcs/mcs/generic.cs:2039
#, csharp-format
msgid "The type `{0}' may not be used as a type argument"
msgstr ""
-#: mcs/mcs/generic.cs:2075
+#: mcs/mcs/generic.cs:2133
msgid "Variant type parameters can only be used with interfaces and delegates"
msgstr ""
-#: mcs/mcs/generic.cs:2314
+#: mcs/mcs/generic.cs:2354
#, csharp-format
msgid ""
"The type `{0}' must be a reference type in order to use it as type parameter "
"`{1}' in the generic type or method `{2}'"
msgstr ""
-#: mcs/mcs/generic.cs:2324
+#: mcs/mcs/generic.cs:2364
#, csharp-format
msgid ""
"The type `{0}' must be a non-nullable value type in order to use it as type "
"parameter `{1}' in the generic type or method `{2}'"
msgstr ""
-#: mcs/mcs/generic.cs:2383
+#: mcs/mcs/generic.cs:2423
#, csharp-format
msgid ""
"The type `{0}' must have a public parameterless constructor in order to use "
"it as parameter `{1}' in the generic type or method `{2}'"
msgstr ""
-#: mcs/mcs/generic.cs:2451
+#: mcs/mcs/generic.cs:2479
#, csharp-format
msgid ""
"The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
"{3}'"
msgstr ""
-#: mcs/mcs/generic.cs:2457
+#: mcs/mcs/generic.cs:2485
#, csharp-format
msgid ""
"The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
"{3}'"
msgstr ""
-#: mcs/mcs/generic.cs:2461
+#: mcs/mcs/generic.cs:2489
#, csharp-format
msgid ""
"The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
"method `{2}'. The nullable type `{0}' does not satisfy constraint `{3}'"
msgstr ""
-#: mcs/mcs/generic.cs:2466
+#: mcs/mcs/generic.cs:2494
#, csharp-format
msgid ""
"The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
"method `{2}'. There is no boxing conversion from `{0}' to `{3}'"
msgstr ""
-#: mcs/mcs/generic.cs:2471
+#: mcs/mcs/generic.cs:2499
#, csharp-format
msgid ""
"The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
"method `{2}'. There is no implicit reference conversion from `{0}' to `{3}'"
msgstr ""
-#: mcs/mcs/import.cs:1818
+#: mcs/mcs/import.cs:1868
#, csharp-format
msgid ""
"Reference to type `{0}' claims it is defined in this assembly, but it is not "
"defined in source or any added modules"
msgstr ""
-#: mcs/mcs/import.cs:1822
+#: mcs/mcs/import.cs:1873
+#, csharp-format
+msgid ""
+"The type `{0}' has been forwarded to an assembly that is not referenced. "
+"Consider adding a reference to assembly `{1}'"
+msgstr ""
+
+#: mcs/mcs/import.cs:1877
#, csharp-format
msgid ""
"The type `{0}' is defined in an assembly that is not referenced. Consider "
"adding a reference to assembly `{1}'"
msgstr ""
-#: mcs/mcs/import.cs:1826
+#: mcs/mcs/import.cs:1882
#, csharp-format
msgid ""
"Reference to type `{0}' claims it is defined assembly `{1}', but it could "
msgid "Iterators cannot have unsafe parameters or yield types"
msgstr ""
-#: mcs/mcs/iterators.cs:1132 mcs/mcs/statement.cs:4950
+#: mcs/mcs/iterators.cs:1132 mcs/mcs/statement.cs:4987
msgid "Unsafe code may not appear in iterators"
msgstr ""
-#: mcs/mcs/ikvm.cs:236
+#: mcs/mcs/ikvm.cs:266
msgid "SDK path could not be resolved"
msgstr ""
-#: mcs/mcs/ikvm.cs:314
+#: mcs/mcs/ikvm.cs:344
#, csharp-format
msgid ""
"Assembly `{0}' references `{1}' which has a higher version number than "
"imported assembly `{2}'"
msgstr ""
-#: mcs/mcs/ikvm.cs:323 mcs/mcs/ikvm.cs:327
+#: mcs/mcs/ikvm.cs:353 mcs/mcs/ikvm.cs:357
#, csharp-format
msgid ""
"Assuming assembly reference `{0}' matches assembly `{1}'. You may need to "
"supply runtime policy"
msgstr ""
-#: mcs/mcs/ikvm.cs:413
+#: mcs/mcs/ikvm.cs:444
#, csharp-format
msgid ""
"An assembly with the same name `{0}' has already been imported. Consider "
"removing one of the references or sign the assembly"
msgstr ""
-#: mcs/mcs/ikvm.cs:422
+#: mcs/mcs/ikvm.cs:453
#, csharp-format
msgid ""
"An assembly with the same identity `{0}' has already been imported. Consider "
"suffix `{1}' to create a literal of this type"
msgstr ""
-#: mcs/mcs/membercache.cs:1388
+#: mcs/mcs/membercache.cs:1391
msgid ""
"A partial method declaration and partial method implementation cannot differ "
"on use of `params' modifier"
msgstr ""
-#: mcs/mcs/membercache.cs:1391
+#: mcs/mcs/membercache.cs:1394
msgid ""
"A partial method declaration and partial method implementation must be both "
"an extension method or neither"
msgstr ""
-#: mcs/mcs/membercache.cs:1395
+#: mcs/mcs/membercache.cs:1398
#, csharp-format
msgid ""
"Overloaded contructor `{0}' cannot differ on use of parameter modifiers only"
msgstr ""
-#: mcs/mcs/membercache.cs:1399
+#: mcs/mcs/membercache.cs:1402
#, fuzzy, csharp-format
msgid ""
"Overloaded method `{0}' cannot differ on use of parameter modifiers only"
msgstr "Conditionalメソッド `{0}' ではoutパラメータを指定できません"
-#: mcs/mcs/membercache.cs:1431
+#: mcs/mcs/membercache.cs:1434
msgid ""
"A partial method declaration and partial method implementation must be both "
"`static' or neither"
msgstr ""
-#: mcs/mcs/membercache.cs:1436
+#: mcs/mcs/membercache.cs:1439
msgid ""
"A partial method declaration and partial method implementation must be both "
"`unsafe' or neither"
msgstr ""
-#: mcs/mcs/membercache.cs:1442
+#: mcs/mcs/membercache.cs:1445
#, fuzzy, csharp-format
msgid "A partial method `{0}' declaration is already defined"
msgstr "部分メソッド `{0}' はインターフェースを明示的に実装できません"
-#: mcs/mcs/membercache.cs:1446
+#: mcs/mcs/membercache.cs:1449
#, fuzzy, csharp-format
msgid "A partial method `{0}' implementation is already defined"
msgstr "部分メソッド `{0}' はインターフェースを明示的に実装できません"
-#: mcs/mcs/membercache.cs:1457 mcs/mcs/property.cs:81
+#: mcs/mcs/membercache.cs:1460 mcs/mcs/property.cs:81
#, csharp-format
msgid "A member `{0}' is already reserved"
msgstr ""
-#: mcs/mcs/membercache.cs:1468
+#: mcs/mcs/membercache.cs:1471
#, csharp-format
msgid "Duplicate user-defined conversion in type `{0}'"
msgstr ""
-#: mcs/mcs/membercache.cs:1474
+#: mcs/mcs/membercache.cs:1477
#, csharp-format
msgid ""
"A member `{0}' is already defined. Rename this member or use different "
"メンバ `{0}' が既に定義されています。このメンバの名前を変更するか、別のパラ"
"メータ型を使用してください"
-#: mcs/mcs/method.cs:552
+#: mcs/mcs/method.cs:558
#, csharp-format
msgid "`{0}': Async methods cannot use `MethodImplOptions.Synchronized'"
msgstr ""
-#: mcs/mcs/method.cs:560
+#: mcs/mcs/method.cs:566
msgid ""
"The DllImport attribute must be specified on a method marked `static' and "
"`extern'"
"`static'かつ`extern'で宣言されたメソッドには、DllImport属性が指定されなければ"
"なりません"
-#: mcs/mcs/method.cs:655
+#: mcs/mcs/method.cs:661
#, csharp-format
msgid "`{0}': A partial method parameters cannot use `out' modifier"
msgstr "`{0}': 部分メソッドのパラメータで`out'修飾子は使用できません"
-#: mcs/mcs/method.cs:716
+#: mcs/mcs/method.cs:722
#, csharp-format
msgid ""
"Conditional not valid on `{0}' because it is a constructor, destructor, "
"Conditionalは コンストラクタ、デストラクタ、演算子または明示的なインター"
"フェースの実装である `{0}' では無効です"
-#: mcs/mcs/method.cs:855
-#, csharp-format
-msgid ""
-"`{0}': Cannot specify constraints for overrides and explicit interface "
-"implementation methods"
-msgstr ""
-
#: mcs/mcs/method.cs:865
msgid ""
"A partial method cannot define access modifier or any of abstract, extern, "
msgid "The return type of an async method must be void, Task, or Task<T>"
msgstr ""
-#: mcs/mcs/method.cs:1224
+#: mcs/mcs/method.cs:1227
#, fuzzy, csharp-format
msgid "`{0}': Extension methods cannot be defined in a nested class"
msgstr "`{0}': 拡張メソッドはstaticで宣言されなければなりません"
-#: mcs/mcs/method.cs:1230
+#: mcs/mcs/method.cs:1233
#, csharp-format
msgid ""
"`{0}': Extension methods require `System.Runtime.CompilerServices."
"reference?"
msgstr ""
-#: mcs/mcs/method.cs:1239
+#: mcs/mcs/method.cs:1242
#, fuzzy, csharp-format
msgid "`{0}': Extension methods must be defined in a non-generic static class"
msgstr "`{0}': 拡張メソッドはstaticで宣言されなければなりません"
-#: mcs/mcs/method.cs:1255
+#: mcs/mcs/method.cs:1258
#, fuzzy, csharp-format
msgid "`{0}': an entry point cannot be async method"
msgstr "`{0}': `{1}' はメソッドではないため、オーバーライドできません"
-#: mcs/mcs/method.cs:1292
+#: mcs/mcs/method.cs:1295
#, csharp-format
msgid ""
"A partial method `{0}' implementation is missing a partial method declaration"
msgstr ""
-#: mcs/mcs/method.cs:1325
+#: mcs/mcs/method.cs:1336
#, csharp-format
msgid "Method or delegate cannot return type `{0}'"
msgstr ""
-#: mcs/mcs/method.cs:1404
+#: mcs/mcs/method.cs:1415
msgid ""
"The constructor call cannot be dynamically dispatched within constructor "
"initializer"
msgstr ""
-#: mcs/mcs/method.cs:1418
+#: mcs/mcs/method.cs:1429
#, fuzzy, csharp-format
msgid "`{0}': Struct constructors cannot call base constructors"
msgstr "`{0}': staticクラスではインスタンス コンストラクタを定義できません"
-#: mcs/mcs/method.cs:1436
+#: mcs/mcs/method.cs:1447
#, csharp-format
msgid "Constructor `{0}' cannot call itself"
msgstr ""
-#: mcs/mcs/method.cs:1565
+#: mcs/mcs/method.cs:1576
#, csharp-format
msgid "`{0}': The static constructor must be parameterless"
msgstr ""
-#: mcs/mcs/method.cs:1586
+#: mcs/mcs/method.cs:1597
msgid "Structs cannot contain explicit parameterless constructors"
msgstr ""
-#: mcs/mcs/method.cs:1636
+#: mcs/mcs/method.cs:1652
#, fuzzy, csharp-format
msgid ""
"`{0}': A class with the ComImport attribute cannot have a user-defined "
"constructor"
msgstr "`{0}': staticクラスではインスタンス コンストラクタを定義できません"
-#: mcs/mcs/method.cs:1886
+#: mcs/mcs/method.cs:1902
#, fuzzy, csharp-format
msgid "`{0}' is an accessor not found in interface member `{1}{2}'"
msgstr "`{0}' は継承されるabstractメンバ `{1}' を隠蔽してしまいます"
-#: mcs/mcs/method.cs:1892
+#: mcs/mcs/method.cs:1908
#, fuzzy, csharp-format
msgid ""
"`{0}.{1}' in explicit interface declaration is not a member of interface"
"明示的なインターフェースの宣言で記述された `{0}' は、インターフェースではあり"
"ません"
-#: mcs/mcs/method.cs:1900
+#: mcs/mcs/method.cs:1916
#, csharp-format
msgid ""
"`{0}' explicit method implementation cannot implement `{1}' because it is an "
"accessor"
msgstr ""
-#: mcs/mcs/method.cs:1910
+#: mcs/mcs/method.cs:1926
#, fuzzy, csharp-format
msgid "Method `{0}' cannot implement interface accessor `{1}'"
msgstr ""
"Conditionalメンバ `{0}' はインターフェースメンバ `{1}' を実装できません"
-#: mcs/mcs/method.cs:1917
+#: mcs/mcs/method.cs:1933
#, csharp-format
msgid ""
"Accessor `{0}' cannot implement interface member `{1}' for type `{2}'. Use "
"an explicit interface implementation"
msgstr ""
-#: mcs/mcs/method.cs:1924
+#: mcs/mcs/method.cs:1940
#, fuzzy, csharp-format
msgid ""
"Accessor `{0}' must be declared public to implement interface member `{1}'"
msgstr ""
"Conditionalメンバ `{0}' はインターフェースメンバ `{1}' を実装できません"
-#: mcs/mcs/method.cs:1944
+#: mcs/mcs/method.cs:1960
#, fuzzy, csharp-format
msgid ""
"`{0}': the explicit interface implementation cannot introduce the params "
"明示的なインターフェースの宣言で記述された `{0}' は、インターフェースではあり"
"ません"
-#: mcs/mcs/method.cs:2282
+#: mcs/mcs/method.cs:2308
#, fuzzy, csharp-format
msgid ""
"Attribute `{0}' is not valid on property or event accessors. It is valid on `"
"{1}' declarations only"
msgstr "属性 `{0}' はこの宣言型では無効です。 `{1}' の宣言でのみ有効です"
-#: mcs/mcs/method.cs:2510
+#: mcs/mcs/method.cs:2536
#, csharp-format
msgid "User-defined operator `{0}' must be declared static and public"
msgstr ""
-#: mcs/mcs/method.cs:2549
+#: mcs/mcs/method.cs:2580
msgid ""
"User-defined operator cannot take an object of the enclosing type and "
"convert to an object of the enclosing type"
msgstr ""
-#: mcs/mcs/method.cs:2560
+#: mcs/mcs/method.cs:2591
msgid "User-defined conversion must convert to or from the enclosing type"
msgstr ""
-#: mcs/mcs/method.cs:2566
+#: mcs/mcs/method.cs:2597
#, fuzzy, csharp-format
msgid ""
"User-defined conversion `{0}' cannot convert to or from the dynamic type"
msgstr "`{0}' は特別なクラス `{1}' から派生することはできません"
-#: mcs/mcs/method.cs:2573
+#: mcs/mcs/method.cs:2604
#, csharp-format
msgid ""
"User-defined conversion `{0}' cannot convert to or from an interface type"
msgstr ""
-#: mcs/mcs/method.cs:2580
+#: mcs/mcs/method.cs:2611
#, csharp-format
msgid "User-defined conversion `{0}' cannot convert to or from a base class"
msgstr ""
-#: mcs/mcs/method.cs:2586
+#: mcs/mcs/method.cs:2617
#, csharp-format
msgid "User-defined conversion `{0}' cannot convert to or from a derived class"
msgstr ""
-#: mcs/mcs/method.cs:2593
+#: mcs/mcs/method.cs:2624
msgid ""
"Overloaded shift operator must have the type of the first operand be the "
"containing type, and the type of the second operand must be int"
msgstr ""
-#: mcs/mcs/method.cs:2602
+#: mcs/mcs/method.cs:2633
msgid ""
"The return type for ++ or -- operator must be the containing type or derived "
"from the containing type"
msgstr ""
-#: mcs/mcs/method.cs:2607
+#: mcs/mcs/method.cs:2638
msgid "The parameter type for ++ or -- operator must be the containing type"
msgstr ""
-#: mcs/mcs/method.cs:2614
+#: mcs/mcs/method.cs:2645
msgid "The parameter type of a unary operator must be the containing type"
msgstr ""
-#: mcs/mcs/method.cs:2622
+#: mcs/mcs/method.cs:2653
msgid "The return type of operator True or False must be bool"
msgstr ""
-#: mcs/mcs/method.cs:2637
+#: mcs/mcs/method.cs:2668
msgid "One of the parameters of a binary operator must be the containing type"
msgstr ""
msgid "The modifier `{0}' is not valid for this item"
msgstr ""
-#: mcs/mcs/namespace.cs:186
+#: mcs/mcs/namespace.cs:263
#, csharp-format
msgid ""
-"The type or namespace name `{0}' could not be found in the global namespace "
-"(are you missing an assembly reference?)"
+"The type or namespace name `{0}' could not be found in the global namespace. "
+"Are you missing {1} assembly reference?"
msgstr ""
-#: mcs/mcs/namespace.cs:190
+#: mcs/mcs/namespace.cs:267
#, csharp-format
msgid ""
"The type or namespace name `{0}' does not exist in the namespace `{1}'. Are "
-"you missing an assembly reference?"
+"you missing {2} assembly reference?"
msgstr ""
-#: mcs/mcs/namespace.cs:284
+#: mcs/mcs/namespace.cs:367
#, csharp-format
msgid "The imported type `{0}' is defined multiple times"
msgstr ""
-#: mcs/mcs/namespace.cs:749 mcs/mcs/namespace.cs:761
+#: mcs/mcs/namespace.cs:839 mcs/mcs/namespace.cs:851
msgid ""
"A using clause must precede all other namespace elements except extern alias "
"declarations"
msgstr ""
-#: mcs/mcs/namespace.cs:777
+#: mcs/mcs/namespace.cs:867
#, csharp-format
msgid "The using alias `{0}' appeared previously in this namespace"
msgstr ""
-#: mcs/mcs/namespace.cs:815
+#: mcs/mcs/namespace.cs:905 mcs/mcs/namespace.cs:928
#, csharp-format
msgid "The namespace `{0}' already contains a definition for `{1}'"
msgstr ""
-#: mcs/mcs/namespace.cs:1037
+#: mcs/mcs/namespace.cs:1147
#, csharp-format
msgid "Namespace `{0}' contains a definition with same name as alias `{1}'"
msgstr ""
-#: mcs/mcs/namespace.cs:1089
+#: mcs/mcs/namespace.cs:1199
#, csharp-format
msgid "`{0}' is an ambiguous reference between `{1}' and `{2}'"
msgstr ""
-#: mcs/mcs/namespace.cs:1115
-#, csharp-format
-msgid ""
-"The type or namespace name `{0}' could not be found. Are you missing a using "
-"directive or an assembly reference?"
-msgstr ""
-
-#: mcs/mcs/namespace.cs:1317
+#: mcs/mcs/namespace.cs:1390
#, csharp-format
msgid ""
"`{0}' is a type not a namespace. A using namespace directive can only be "
"applied to namespaces"
msgstr ""
-#: mcs/mcs/namespace.cs:1336
+#: mcs/mcs/namespace.cs:1414
#, csharp-format
msgid "The extern alias `{0}' was not specified in -reference option"
msgstr ""
msgid "`{0}': abstract properties cannot have private accessors"
msgstr "`{0}': virtualまたはabstractのメンバはprivateにはできません"
-#: mcs/mcs/property.cs:397
+#: mcs/mcs/property.cs:402
#, csharp-format
msgid ""
"The accessibility modifier of the `{0}' accessor must be more restrictive "
"than the modifier of the property or indexer `{1}'"
msgstr ""
-#: mcs/mcs/property.cs:506
+#: mcs/mcs/property.cs:511
#, csharp-format
msgid "Explicit interface implementation `{0}' is missing accessor `{1}'"
msgstr ""
-#: mcs/mcs/property.cs:525
+#: mcs/mcs/property.cs:530
#, fuzzy, csharp-format
msgid ""
"`{0}': cannot override because `{1}' does not have an overridable get "
"accessor"
msgstr "`{0}': `{1}' はイベントではないため、オーバーライドできません"
-#: mcs/mcs/property.cs:542
+#: mcs/mcs/property.cs:547
#, fuzzy, csharp-format
msgid ""
"`{0}': cannot override because `{1}' does not have an overridable set "
"accessor"
msgstr "`{0}': `{1}' はイベントではないため、オーバーライドできません"
-#: mcs/mcs/property.cs:583
+#: mcs/mcs/property.cs:588
#, csharp-format
msgid ""
"`{0}': Cannot specify accessibility modifiers for both accessors of the "
"property or indexer"
msgstr ""
-#: mcs/mcs/property.cs:590
+#: mcs/mcs/property.cs:595
#, csharp-format
msgid ""
"`{0}': accessibility modifiers on accessors may only be used if the property "
"or indexer has both a get and a set accessor"
msgstr ""
-#: mcs/mcs/property.cs:818
+#: mcs/mcs/property.cs:823
#, csharp-format
msgid ""
"Automatically implemented property `{0}' cannot be used inside a type with "
"an explicit StructLayout attribute"
msgstr ""
-#: mcs/mcs/property.cs:1305
+#: mcs/mcs/property.cs:1312
#, csharp-format
msgid "`{0}': event must be of a delegate type"
msgstr ""
-#: mcs/mcs/property.cs:1581
+#: mcs/mcs/property.cs:1588
#, csharp-format
msgid ""
"The `{0}' attribute is valid only on an indexer that is not an explicit "
"interface member declaration"
msgstr ""
-#: mcs/mcs/property.cs:1585
+#: mcs/mcs/property.cs:1592
#, fuzzy
msgid "Cannot set the `IndexerName' attribute on an indexer marked override"
msgstr "インデクサを含む型には`DefaultMember'属性を指定できません"
msgid "Value specified for the argument to `{0}' is not valid"
msgstr ""
-#: mcs/mcs/statement.cs:92
+#: mcs/mcs/statement.cs:100
msgid ""
"A lambda expression with statement body cannot be converted to an expresion "
"tree"
msgstr ""
-#: mcs/mcs/statement.cs:845
+#: mcs/mcs/statement.cs:858
#, csharp-format
msgid ""
"An object of a type convertible to `{0}' is required for the return statement"
msgstr ""
-#: mcs/mcs/statement.cs:859 mcs/mcs/statement.cs:884
+#: mcs/mcs/statement.cs:872 mcs/mcs/statement.cs:896
#, csharp-format
msgid ""
"`{0}': A return keyword must not be followed by any expression when method "
"returns void"
msgstr ""
-#: mcs/mcs/statement.cs:895
+#: mcs/mcs/statement.cs:907
#, csharp-format
msgid ""
"`{0}': A return keyword must not be followed by an expression when async "
"method returns `Task'. Consider using `Task<T>' return type"
msgstr ""
-#: mcs/mcs/statement.cs:905
+#: mcs/mcs/statement.cs:917
#, csharp-format
msgid ""
"`{0}': The return expression type of async method must be `{1}' rather than "
"`Task<{1}>'"
msgstr ""
-#: mcs/mcs/statement.cs:929
+#: mcs/mcs/statement.cs:927
+#, csharp-format
+msgid ""
+"`{0}': A return keyword must not be followed by any expression when delegate "
+"returns void"
+msgstr ""
+
+#: mcs/mcs/statement.cs:950
#, csharp-format
msgid ""
"Cannot convert `{0}' to delegate type `{1}' because some of the return types "
"in the block are not implicitly convertible to the delegate return type"
msgstr ""
-#: mcs/mcs/statement.cs:977
+#: mcs/mcs/statement.cs:998
msgid ""
"Cannot return a value from iterators. Use the yield return statement to "
"return a value, or yield break to end the iteration"
msgstr ""
-#: mcs/mcs/statement.cs:1149 mcs/mcs/statement.cs:1194
+#: mcs/mcs/statement.cs:1170 mcs/mcs/statement.cs:1215
msgid "A goto case is only valid inside a switch statement"
msgstr ""
-#: mcs/mcs/statement.cs:1282 mcs/mcs/statement.cs:5351
+#: mcs/mcs/statement.cs:1303 mcs/mcs/statement.cs:5388
msgid "The type caught or thrown must be derived from System.Exception"
msgstr ""
-#: mcs/mcs/statement.cs:1527
+#: mcs/mcs/statement.cs:1548
msgid "A fixed statement cannot use an implicitly typed local variable"
msgstr ""
-#: mcs/mcs/statement.cs:1532
+#: mcs/mcs/statement.cs:1553
msgid "An implicitly typed local variable cannot be a constant"
msgstr ""
-#: mcs/mcs/statement.cs:1537
+#: mcs/mcs/statement.cs:1558
msgid ""
"An implicitly typed local variable declarator must include an initializer"
msgstr ""
-#: mcs/mcs/statement.cs:1542
+#: mcs/mcs/statement.cs:1563
msgid ""
"An implicitly typed local variable declaration cannot include multiple "
"declarators"
msgstr ""
-#: mcs/mcs/statement.cs:2164
+#: mcs/mcs/statement.cs:2185
#, csharp-format
msgid ""
"A local variable named `{0}' cannot be declared in this scope because it "
"scope to denote something else"
msgstr ""
-#: mcs/mcs/statement.cs:2176
+#: mcs/mcs/statement.cs:2197
#, csharp-format
msgid "A local variable named `{0}' is already defined in this scope"
msgstr ""
-#: mcs/mcs/statement.cs:2183
+#: mcs/mcs/statement.cs:2204
#, fuzzy, csharp-format
msgid ""
"The type parameter name `{0}' is the same as local variable or parameter name"
msgstr ""
"型パラメータ `{0}' が、その宣言型あるいはメソッドと同じ名前になっています"
-#: mcs/mcs/statement.cs:2898
+#: mcs/mcs/statement.cs:2935
#, csharp-format
msgid ""
"The out parameter `{0}' must be assigned to before control leaves the "
"current method"
msgstr ""
-#: mcs/mcs/statement.cs:3016
+#: mcs/mcs/statement.cs:3053
#, csharp-format
msgid "`{0}': not all code paths return a value"
msgstr ""
-#: mcs/mcs/statement.cs:3033
+#: mcs/mcs/statement.cs:3070
#, csharp-format
msgid "Not all code paths return a value in anonymous method of type `{0}'"
msgstr ""
-#: mcs/mcs/statement.cs:3081
+#: mcs/mcs/statement.cs:3118
#, fuzzy
msgid "Async methods cannot have ref or out parameters"
msgstr "Conditionalメソッド `{0}' ではoutパラメータを指定できません"
-#: mcs/mcs/statement.cs:3087
+#: mcs/mcs/statement.cs:3124
msgid "__arglist is not allowed in parameter list of async methods"
msgstr ""
-#: mcs/mcs/statement.cs:3093
+#: mcs/mcs/statement.cs:3130
#, fuzzy
msgid "Async methods cannot have unsafe parameters"
msgstr "`{0}': staticクラス '{1}' から派生することはできません"
-#: mcs/mcs/statement.cs:3288
+#: mcs/mcs/statement.cs:3325
#, csharp-format
msgid "The label `{0}' is a duplicate"
msgstr ""
-#: mcs/mcs/statement.cs:3297 mcs/mcs/statement.cs:3308
+#: mcs/mcs/statement.cs:3334 mcs/mcs/statement.cs:3345
#, csharp-format
msgid ""
"The label `{0}' shadows another label by the same name in a contained scope"
msgstr ""
-#: mcs/mcs/statement.cs:3604
+#: mcs/mcs/statement.cs:3641
#, csharp-format
msgid "The label `case {0}:' already occurs in this switch statement"
msgstr ""
-#: mcs/mcs/statement.cs:4123
+#: mcs/mcs/statement.cs:4160
#, csharp-format
msgid ""
"A switch expression of type `{0}' cannot be converted to an integral type, "
"bool, char, string, enum or nullable type"
msgstr ""
-#: mcs/mcs/statement.cs:4734
+#: mcs/mcs/statement.cs:4771
#, csharp-format
msgid "`{0}' is not a reference type as required by the lock statement"
msgstr ""
-#: mcs/mcs/statement.cs:5081
+#: mcs/mcs/statement.cs:5118
msgid "The type of locals declared in a fixed statement must be a pointer type"
msgstr ""
-#: mcs/mcs/statement.cs:5097
+#: mcs/mcs/statement.cs:5134
msgid ""
"The right hand side of a fixed statement assignment may not be a cast "
"expression"
msgstr ""
-#: mcs/mcs/statement.cs:5167
+#: mcs/mcs/statement.cs:5204
msgid ""
"You cannot use the fixed statement to take the address of an already fixed "
"expression"
msgstr ""
-#: mcs/mcs/statement.cs:5523
+#: mcs/mcs/statement.cs:5560
#, csharp-format
msgid ""
"A previous catch clause already catches all exceptions of this or a super "
"type `{0}'"
msgstr ""
-#: mcs/mcs/statement.cs:5663
+#: mcs/mcs/statement.cs:5700
#, csharp-format
msgid ""
"`{0}': type used in a using statement must be implicitly convertible to "
"`System.IDisposable'"
msgstr ""
-#: mcs/mcs/statement.cs:6067
+#: mcs/mcs/statement.cs:6104
#, csharp-format
msgid ""
"foreach statement requires that the return type `{0}' of `{1}' must have a "
"suitable public MoveNext method and public Current property"
msgstr ""
-#: mcs/mcs/statement.cs:6112
+#: mcs/mcs/statement.cs:6149
#, csharp-format
msgid ""
"foreach statement cannot operate on variables of type `{0}' because it "
"implementation"
msgstr ""
-#: mcs/mcs/statement.cs:6141
+#: mcs/mcs/statement.cs:6178
#, csharp-format
msgid ""
"foreach statement cannot operate on variables of type `{0}' because it does "
"not contain a definition for `{1}' or is inaccessible"
msgstr ""
-#: mcs/mcs/statement.cs:6372
+#: mcs/mcs/statement.cs:6409
msgid "Use of null is not valid in this context"
msgstr ""
-#: mcs/mcs/statement.cs:6384
+#: mcs/mcs/statement.cs:6421
#, csharp-format
msgid "Foreach statement cannot operate on a `{0}'"
msgstr ""
-#: mcs/mcs/typemanager.cs:771
+#: mcs/mcs/typemanager.cs:785
#, csharp-format
msgid "The predefined type `{0}.{1}' is not defined or imported"
msgstr ""
-#: mcs/mcs/typemanager.cs:816
+#: mcs/mcs/typemanager.cs:830
#, csharp-format
msgid ""
"The predefined type `{0}.{1}' is defined multiple times. Using definition "
"from `{2}'"
msgstr ""
-#: mcs/mcs/typemanager.cs:831
+#: mcs/mcs/typemanager.cs:845
#, csharp-format
msgid "The predefined type `{0}.{1}' is not declared correctly"
msgstr ""
-#: mcs/mcs/typemanager.cs:956
+#: mcs/mcs/typemanager.cs:970
#, csharp-format
msgid ""
"The compiler required member `{0}.{1}{2}' could not be found or is "
"inaccessible"
msgstr ""
-#: mcs/mcs/typemanager.cs:1070
+#: mcs/mcs/typemanager.cs:1084
#, csharp-format
msgid ""
"Cannot take the address of, get the size of, or declare a pointer to a "
#, fuzzy
msgid ""
msgstr ""
-"Project-Id-Version: mono 2.11.2\n"
+"Project-Id-Version: mono 3.0.2\n"
"Report-Msgid-Bugs-To: http://www.mono-project.com/Bugs\n"
-"POT-Creation-Date: 2012-05-30 18:30+0100\n"
+"POT-Creation-Date: 2012-12-05 09:29+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"mismatch"
msgstr ""
-#: mcs/mcs/anonymous.cs:1027 mcs/mcs/ecore.cs:4913
+#: mcs/mcs/anonymous.cs:1027 mcs/mcs/ecore.cs:5056
#, csharp-format
msgid "Delegate `{0}' does not take `{1}' arguments"
msgstr ""
msgid "Parameter `{0}' is declared as type `{1}' but should be `{2}'"
msgstr ""
-#: mcs/mcs/anonymous.cs:1202
+#: mcs/mcs/anonymous.cs:1212
msgid "Async lambda expressions cannot be converted to expression trees"
msgstr ""
-#: mcs/mcs/anonymous.cs:1240
+#: mcs/mcs/anonymous.cs:1250
msgid "An anonymous method cannot be converted to an expression tree"
msgstr ""
-#: mcs/mcs/anonymous.cs:1259
+#: mcs/mcs/anonymous.cs:1269
#, csharp-format
msgid ""
"Cannot convert anonymous method block without a parameter list to delegate "
"type `{0}' because it has one or more `out' parameters"
msgstr ""
-#: mcs/mcs/anonymous.cs:1283
+#: mcs/mcs/anonymous.cs:1293
msgid ""
"Anonymous methods and lambda expressions cannot be used in the current "
"context"
msgstr ""
-#: mcs/mcs/anonymous.cs:1326
+#: mcs/mcs/anonymous.cs:1336
#, csharp-format
msgid ""
"Local variable or parameter `{0}' cannot have their address taken and be "
"used inside an anonymous method, lambda expression or query expression"
msgstr ""
-#: mcs/mcs/anonymous.cs:1346
+#: mcs/mcs/anonymous.cs:1356
#, csharp-format
msgid "Cannot convert async {0} to delegate type `{1}'"
msgstr ""
-#: mcs/mcs/anonymous.cs:1596
+#: mcs/mcs/anonymous.cs:1594
msgid "An expression tree cannot contain an anonymous method expression"
msgstr ""
-#: mcs/mcs/anonymous.cs:1879
+#: mcs/mcs/anonymous.cs:1877
#, csharp-format
msgid ""
"`{0}': An anonymous type cannot have multiple properties with the same name"
msgid "Cannot assign to `{0}' because it is a `{1}'"
msgstr ""
-#: mcs/mcs/assembly.cs:286
+#: mcs/mcs/assembly.cs:279
msgid "Invalid type specified as an argument for TypeForwardedTo attribute"
msgstr ""
-#: mcs/mcs/assembly.cs:294
+#: mcs/mcs/assembly.cs:287
#, csharp-format
msgid "A duplicate type forward of type `{0}'"
msgstr ""
-#: mcs/mcs/assembly.cs:303
+#: mcs/mcs/assembly.cs:296
#, csharp-format
msgid "Cannot forward type `{0}' because it is defined in this assembly"
msgstr ""
-#: mcs/mcs/assembly.cs:309
+#: mcs/mcs/assembly.cs:302
#, csharp-format
msgid "Cannot forward type `{0}' because it is a nested type"
msgstr ""
-#: mcs/mcs/assembly.cs:338
+#: mcs/mcs/assembly.cs:331
#, csharp-format
msgid ""
"Friend assembly reference `{0}' is invalid. InternalsVisibleTo declarations "
"cannot have a version, culture or processor architecture specified"
msgstr ""
-#: mcs/mcs/assembly.cs:346
+#: mcs/mcs/assembly.cs:339
#, csharp-format
msgid ""
"Friend assembly reference `{0}' is invalid. Strong named assemblies must "
"specify a public key in their InternalsVisibleTo declarations"
msgstr ""
-#: mcs/mcs/assembly.cs:381
+#: mcs/mcs/assembly.cs:374
#, csharp-format
msgid "Referenced assembly `{0}' does not have a strong name"
msgstr ""
-#: mcs/mcs/assembly.cs:387
+#: mcs/mcs/assembly.cs:380
#, csharp-format
msgid "Referenced assembly `{0}' has different culture setting of `{1}'"
msgstr ""
-#: mcs/mcs/assembly.cs:402
+#: mcs/mcs/assembly.cs:395
#, csharp-format
msgid ""
"Friend access was granted to `{0}', but the output assembly is named `{1}'. "
"it"
msgstr ""
-#: mcs/mcs/assembly.cs:416
+#: mcs/mcs/assembly.cs:409
msgid ""
"Could not sign the assembly. ECMA key can only be used to delay-sign "
"assemblies"
msgstr ""
-#: mcs/mcs/assembly.cs:657
+#: mcs/mcs/assembly.cs:650
msgid ""
"Added modules must be marked with the CLSCompliant attribute to match the "
"assembly"
msgstr ""
-#: mcs/mcs/assembly.cs:692 mcs/mcs/assembly.cs:707
+#: mcs/mcs/assembly.cs:685 mcs/mcs/assembly.cs:700
#, csharp-format
msgid ""
"Option `{0}' overrides attribute `{1}' given in a source file or added module"
msgstr ""
-#: mcs/mcs/assembly.cs:742
+#: mcs/mcs/assembly.cs:735
msgid "Delay signing was requested but no key file was given"
msgstr ""
-#: mcs/mcs/assembly.cs:763
+#: mcs/mcs/assembly.cs:756
msgid "Cannot link resource file when building a module"
msgstr ""
-#: mcs/mcs/assembly.cs:768
+#: mcs/mcs/assembly.cs:761
#, csharp-format
msgid "Error reading resource file `{0}'"
msgstr ""
-#: mcs/mcs/assembly.cs:838
+#: mcs/mcs/assembly.cs:831
msgid "Could not write to file `"
msgstr ""
-#: mcs/mcs/assembly.cs:882
+#: mcs/mcs/assembly.cs:875
msgid "Cannot specify -main if building a module or library"
msgstr ""
-#: mcs/mcs/assembly.cs:908
+#: mcs/mcs/assembly.cs:901
#, csharp-format
msgid "Could not find `{0}' specified for Main method"
msgstr ""
-#: mcs/mcs/assembly.cs:914
+#: mcs/mcs/assembly.cs:907
#, csharp-format
msgid "`{0}' specified for Main method must be a valid class or struct"
msgstr ""
-#: mcs/mcs/assembly.cs:918
+#: mcs/mcs/assembly.cs:911
#, csharp-format
msgid "`{0}' does not have a suitable static Main method"
msgstr ""
-#: mcs/mcs/assembly.cs:921
+#: mcs/mcs/assembly.cs:914
#, csharp-format
msgid ""
"Program `{0}' does not contain a static `Main' method suitable for an entry "
"point"
msgstr ""
-#: mcs/mcs/assembly.cs:940
+#: mcs/mcs/assembly.cs:933
msgid "Error during assembly signing. "
msgstr ""
-#: mcs/mcs/assembly.cs:1125
+#: mcs/mcs/assembly.cs:1118
#, csharp-format
msgid "Metadata file `{0}' could not be found"
msgstr ""
-#: mcs/mcs/assembly.cs:1130
+#: mcs/mcs/assembly.cs:1123
#, csharp-format
msgid "Metadata file `{0}' does not contain valid metadata"
msgstr ""
-#: mcs/mcs/assembly.cs:1136
+#: mcs/mcs/assembly.cs:1129
#, csharp-format
msgid ""
"Referenced assembly file `{0}' is a module. Consider using `-addmodule' "
"option to add the module"
msgstr ""
-#: mcs/mcs/assembly.cs:1143
+#: mcs/mcs/assembly.cs:1136
#, csharp-format
msgid ""
"Added module file `{0}' is an assembly. Consider using `-r' option to "
"reference the file"
msgstr ""
-#: mcs/mcs/async.cs:70
+#: mcs/mcs/async.cs:72
msgid "The `await' operator cannot be used in the body of a lock statement"
msgstr ""
-#: mcs/mcs/async.cs:75
+#: mcs/mcs/async.cs:77
msgid "The `await' operator cannot be used in an unsafe context"
msgstr ""
-#: mcs/mcs/async.cs:140
+#: mcs/mcs/async.cs:142
#, csharp-format
msgid ""
"Cannot await void method `{0}'. Consider changing method return type to "
"`Task'"
msgstr ""
-#: mcs/mcs/async.cs:143
+#: mcs/mcs/async.cs:145
#, csharp-format
msgid "Cannot await `{0}' expression"
msgstr ""
-#: mcs/mcs/async.cs:293
+#: mcs/mcs/async.cs:291
#, csharp-format
msgid ""
"The awaiter type `{0}' must have suitable IsCompleted and GetResult members"
msgstr ""
-#: mcs/mcs/async.cs:301
+#: mcs/mcs/async.cs:299
msgid ""
"The `await' operator may only be used in a query expression within the first "
"collection expression of the initial `from' clause or within the collection "
"expression of a `join' clause"
msgstr ""
-#: mcs/mcs/async.cs:335
+#: mcs/mcs/async.cs:333
#, csharp-format
msgid "The `await' operand type `{0}' must have suitable GetAwaiter method"
msgstr ""
-#: mcs/mcs/async.cs:374
+#: mcs/mcs/async.cs:372
#, csharp-format
msgid "The awaiter type `{0}' must implement interface `{1}'"
msgstr ""
-#: mcs/mcs/async.cs:601
+#: mcs/mcs/async.cs:605
msgid ""
"Cannot find compiler required types for asynchronous functions support. Are "
"you targeting the wrong framework version?"
msgstr ""
-#: mcs/mcs/attribute.cs:222
+#: mcs/mcs/attribute.cs:228
#, csharp-format
msgid ""
"`{0}' is not a valid named attribute argument. Named attribute arguments "
"properties which are public and not static"
msgstr ""
-#: mcs/mcs/attribute.cs:231
+#: mcs/mcs/attribute.cs:237
#, csharp-format
msgid ""
"`{0}' is not a valid named attribute argument because it is not a valid "
"attribute parameter type"
msgstr ""
-#: mcs/mcs/attribute.cs:237
+#: mcs/mcs/attribute.cs:243
msgid "An attribute argument cannot be dynamic expression"
msgstr ""
-#: mcs/mcs/attribute.cs:242
+#: mcs/mcs/attribute.cs:248
msgid "The Guid attribute must be specified with the ComImport attribute"
msgstr ""
-#: mcs/mcs/attribute.cs:247
+#: mcs/mcs/attribute.cs:253
#, csharp-format
msgid "Do not use `{0}' directly. Use parameter modifier `this' instead"
msgstr ""
-#: mcs/mcs/attribute.cs:252
+#: mcs/mcs/attribute.cs:258
#, csharp-format
msgid "Do not use `{0}' directly. Use `dynamic' keyword instead"
msgstr ""
-#: mcs/mcs/attribute.cs:261
+#: mcs/mcs/attribute.cs:267
#, csharp-format
msgid "Error during emitting `{0}' attribute. The reason is `{1}'"
msgstr ""
-#: mcs/mcs/attribute.cs:314
+#: mcs/mcs/attribute.cs:321
#, csharp-format
msgid ""
"`{0}' is ambiguous between `{1}' and `{2}'. Use either `@{0}' or `{0}"
"Attribute'"
msgstr ""
-#: mcs/mcs/attribute.cs:336 mcs/mcs/attribute.cs:342
+#: mcs/mcs/attribute.cs:348 mcs/mcs/attribute.cs:354
#, csharp-format
msgid "`{0}': is not an attribute class"
msgstr ""
-#: mcs/mcs/attribute.cs:434
+#: mcs/mcs/attribute.cs:446
#, csharp-format
msgid "Cannot apply attribute class `{0}' because it is abstract"
msgstr ""
-#: mcs/mcs/attribute.cs:505
+#: mcs/mcs/attribute.cs:517
#, csharp-format
msgid "Duplicate named attribute `{0}' argument"
msgstr ""
-#: mcs/mcs/attribute.cs:964
+#: mcs/mcs/attribute.cs:976
#, csharp-format
msgid ""
"The attribute `{0}' is not valid on this declaration type. It is valid on `"
"{1}' declarations only"
msgstr ""
-#: mcs/mcs/attribute.cs:986
+#: mcs/mcs/attribute.cs:998
#, csharp-format
msgid "The argument to the `{0}' attribute must be a valid identifier"
msgstr ""
-#: mcs/mcs/attribute.cs:1000
+#: mcs/mcs/attribute.cs:1012
#, csharp-format
msgid "Invalid value for argument to `{0}' attribute"
msgstr ""
-#: mcs/mcs/attribute.cs:1252
+#: mcs/mcs/attribute.cs:1274
#, csharp-format
msgid "The attribute `{0}' cannot be applied multiple times"
msgstr ""
-#: mcs/mcs/attribute.cs:1552
+#: mcs/mcs/attribute.cs:1580
#, csharp-format
msgid "`{0}' is obsolete: `{1}'"
msgstr ""
"`struct', `interface', or `void' keyword"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:1470 mcs/mcs/cs-tokenizer.cs:1533
+#: mcs/mcs/cs-tokenizer.cs:1478 mcs/mcs/cs-tokenizer.cs:1541
msgid "Invalid number"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:1745
+#: mcs/mcs/cs-tokenizer.cs:1753
#, csharp-format
msgid "Unrecognized escape sequence `\\{0}'"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:1764
+#: mcs/mcs/cs-tokenizer.cs:1772
msgid "Unrecognized escape sequence"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:2034
+#: mcs/mcs/cs-tokenizer.cs:2041
msgid "Filename, single-line comment or end-of-line expected"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:2084
+#: mcs/mcs/cs-tokenizer.cs:2090
msgid "Missing identifier to pre-processor directive"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:2094 mcs/mcs/cs-tokenizer.cs:2098
+#: mcs/mcs/cs-tokenizer.cs:2100 mcs/mcs/cs-tokenizer.cs:2104
#, csharp-format
msgid "Identifier expected: {0}"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:2587
+#: mcs/mcs/cs-tokenizer.cs:2610
msgid "Integral constant is too large"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:2592
+#: mcs/mcs/cs-tokenizer.cs:2615
msgid "Invalid preprocessor directive"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:2599
+#: mcs/mcs/cs-tokenizer.cs:2622
#, csharp-format
msgid "Unexpected processor directive ({0})"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:2605
+#: mcs/mcs/cs-tokenizer.cs:2628
msgid ""
"Cannot define or undefine preprocessor symbols after first token in file"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:2611
+#: mcs/mcs/cs-tokenizer.cs:2634
msgid ""
"Preprocessor directives must appear as the first non-whitespace character on "
"a line"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:2616
+#: mcs/mcs/cs-tokenizer.cs:2639
msgid "Single-line comment or end-of-line expected"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:2661 mcs/mcs/cs-tokenizer.cs:3679
+#: mcs/mcs/cs-tokenizer.cs:2684 mcs/mcs/cs-tokenizer.cs:3719
msgid "Expected `#endif' directive"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:2694 mcs/mcs/cs-tokenizer.cs:2715
-#: mcs/mcs/cs-tokenizer.cs:2746 mcs/mcs/cs-tokenizer.cs:3677
+#: mcs/mcs/cs-tokenizer.cs:2717 mcs/mcs/cs-tokenizer.cs:2738
+#: mcs/mcs/cs-tokenizer.cs:2769 mcs/mcs/cs-tokenizer.cs:3717
msgid "#endregion directive expected"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:2793
+#: mcs/mcs/cs-tokenizer.cs:2816
msgid "Wrong preprocessor directive"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:2805
+#: mcs/mcs/cs-tokenizer.cs:2828
#, csharp-format
msgid "#error: '{0}'"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:2823
+#: mcs/mcs/cs-tokenizer.cs:2846
msgid "The line number specified for #line directive is missing or invalid"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:2876 mcs/mcs/cs-tokenizer.cs:3514
+#: mcs/mcs/cs-tokenizer.cs:2908 mcs/mcs/cs-tokenizer.cs:3554
msgid "Newline in constant"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:2893
+#: mcs/mcs/cs-tokenizer.cs:2934
msgid "Unterminated string literal"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:2968
+#: mcs/mcs/cs-tokenizer.cs:3011
msgid "Identifier too long (limit is 512 chars)"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:3354
+#: mcs/mcs/cs-tokenizer.cs:3394
msgid "End-of-file found, '*/' expected"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:3463
+#: mcs/mcs/cs-tokenizer.cs:3503
msgid "Keyword, identifier, or string expected after verbatim specifier: @"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:3484
+#: mcs/mcs/cs-tokenizer.cs:3524
#, csharp-format
msgid "Unexpected character `{0}'"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:3509
+#: mcs/mcs/cs-tokenizer.cs:3549
msgid "Empty character literal"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:3530
+#: mcs/mcs/cs-tokenizer.cs:3570
msgid "Too many characters in character literal"
msgstr ""
"declaration of this type exists"
msgstr ""
-#: mcs/mcs/class.cs:713
+#: mcs/mcs/class.cs:734
#, csharp-format
msgid ""
"`{0}': explicit interface declaration can only be declared in a class or "
"struct"
msgstr ""
-#: mcs/mcs/class.cs:772
+#: mcs/mcs/class.cs:793
#, csharp-format
msgid "Duplicate type parameter `{0}'"
msgstr ""
-#: mcs/mcs/class.cs:775
+#: mcs/mcs/class.cs:796
#, csharp-format
msgid "The type `{0}' already contains a definition for `{1}'"
msgstr ""
-#: mcs/mcs/class.cs:841
+#: mcs/mcs/class.cs:862
msgid ""
"Cannot specify the `DefaultMember' attribute on type containing an indexer"
msgstr ""
-#: mcs/mcs/class.cs:846
+#: mcs/mcs/class.cs:867
msgid "The RequiredAttribute attribute is not permitted on C# types"
msgstr ""
-#: mcs/mcs/class.cs:1069
+#: mcs/mcs/class.cs:1093
#, csharp-format
msgid "Class `{0}' cannot derive from the dynamic type"
msgstr ""
-#: mcs/mcs/class.cs:1086
+#: mcs/mcs/class.cs:1110
#, csharp-format
msgid "`{0}' is already listed in interface list"
msgstr ""
-#: mcs/mcs/class.cs:1094
+#: mcs/mcs/class.cs:1118
#, csharp-format
msgid ""
"Inconsistent accessibility: base interface `{0}' is less accessible than "
"interface `{1}'"
msgstr ""
-#: mcs/mcs/class.cs:1100
+#: mcs/mcs/class.cs:1124
#, csharp-format
msgid "Type `{0}' in interface list is not an interface"
msgstr ""
-#: mcs/mcs/class.cs:1102
+#: mcs/mcs/class.cs:1126
#, csharp-format
msgid "`{0}': Classes cannot have multiple base classes (`{1}' and `{2}')"
msgstr ""
-#: mcs/mcs/class.cs:1105
+#: mcs/mcs/class.cs:1129
#, csharp-format
msgid "`{0}': Base class `{1}' must be specified as first"
msgstr ""
-#: mcs/mcs/class.cs:1166
+#: mcs/mcs/class.cs:1190
#, csharp-format
msgid ""
"The operator `{0}' requires a matching operator `{1}' to also be defined"
msgstr ""
-#: mcs/mcs/class.cs:1397
+#: mcs/mcs/class.cs:1421
#, csharp-format
msgid "Partial declarations of `{0}' must not specify different base classes"
msgstr ""
-#: mcs/mcs/class.cs:1441
+#: mcs/mcs/class.cs:1465
#, csharp-format
msgid ""
"Inherited interface `{0}' causes a cycle in the interface hierarchy of `{1}'"
msgstr ""
-#: mcs/mcs/class.cs:1447
+#: mcs/mcs/class.cs:1471
#, csharp-format
msgid "Circular base class dependency involving `{0}' and `{1}'"
msgstr ""
-#: mcs/mcs/class.cs:1593
+#: mcs/mcs/class.cs:1617
#, csharp-format
msgid ""
"Partial declarations of `{0}' have inconsistent constraints for type "
"parameter `{1}'"
msgstr ""
-#: mcs/mcs/class.cs:1702
+#: mcs/mcs/class.cs:1726
#, csharp-format
msgid "`{0}': cannot implement a dynamic interface `{1}'"
msgstr ""
-#: mcs/mcs/class.cs:1718
+#: mcs/mcs/class.cs:1742
#, csharp-format
msgid ""
"`{0}' cannot implement both `{1}' and `{2}' because they may unify for some "
"type parameter substitutions"
msgstr ""
-#: mcs/mcs/class.cs:1737
+#: mcs/mcs/class.cs:1761
#, csharp-format
msgid ""
"A generic type cannot derive from `{0}' because it is an attribute class"
msgstr ""
-#: mcs/mcs/class.cs:1839
+#: mcs/mcs/class.cs:1870
msgid ""
"Two indexers have different names; the IndexerName attribute must be used "
"with the same name on every indexer within a type"
msgstr ""
-#: mcs/mcs/class.cs:2089
+#: mcs/mcs/class.cs:2120
#, csharp-format
msgid "A static member `{0}' cannot be marked as override, virtual or abstract"
msgstr ""
-#: mcs/mcs/class.cs:2096
+#: mcs/mcs/class.cs:2127
#, csharp-format
msgid "A member `{0}' marked as override cannot be marked as new or virtual"
msgstr ""
-#: mcs/mcs/class.cs:2108
+#: mcs/mcs/class.cs:2139
#, csharp-format
msgid "`{0}' cannot be both extern and abstract"
msgstr ""
-#: mcs/mcs/class.cs:2113
+#: mcs/mcs/class.cs:2144
#, csharp-format
msgid "`{0}' cannot be both abstract and sealed"
msgstr ""
-#: mcs/mcs/class.cs:2118
+#: mcs/mcs/class.cs:2149
#, csharp-format
msgid "The abstract method `{0}' cannot be marked virtual"
msgstr ""
-#: mcs/mcs/class.cs:2124
+#: mcs/mcs/class.cs:2155
#, csharp-format
msgid "`{0}' is abstract but it is declared in the non-abstract class `{1}'"
msgstr ""
-#: mcs/mcs/class.cs:2132
+#: mcs/mcs/class.cs:2163
#, csharp-format
msgid "`{0}': virtual or abstract members cannot be private"
msgstr ""
-#: mcs/mcs/class.cs:2139
+#: mcs/mcs/class.cs:2170
#, csharp-format
msgid "`{0}' cannot be sealed because it is not an override"
msgstr ""
-#: mcs/mcs/class.cs:2179
+#: mcs/mcs/class.cs:2210
#, csharp-format
msgid "`{0}': containing type does not implement interface `{1}'"
msgstr ""
-#: mcs/mcs/class.cs:2369
+#: mcs/mcs/class.cs:2400
#, csharp-format
msgid "Type parameter `{0}' has same name as containing type, or method"
msgstr ""
-#: mcs/mcs/class.cs:2377
+#: mcs/mcs/class.cs:2408
#, csharp-format
msgid "`{0}': member names cannot be the same as their enclosing type"
msgstr ""
-#: mcs/mcs/class.cs:2496
+#: mcs/mcs/class.cs:2527
msgid ""
"The class System.Object cannot have a base class or implement an interface."
msgstr ""
-#: mcs/mcs/class.cs:2505
+#: mcs/mcs/class.cs:2536
#, csharp-format
msgid "Attribute `{0}' is only valid on classes derived from System.Attribute"
msgstr ""
-#: mcs/mcs/class.cs:2510
+#: mcs/mcs/class.cs:2541
msgid ""
"Attribute `System.Diagnostics.ConditionalAttribute' is only valid on methods "
"or attribute classes"
msgstr ""
-#: mcs/mcs/class.cs:2539
+#: mcs/mcs/class.cs:2570
#, csharp-format
msgid "`{0}': an abstract class cannot be sealed or static"
msgstr ""
-#: mcs/mcs/class.cs:2543
+#: mcs/mcs/class.cs:2574
#, csharp-format
msgid "`{0}': a class cannot be both static and sealed"
msgstr ""
-#: mcs/mcs/class.cs:2549
+#: mcs/mcs/class.cs:2580
#, csharp-format
msgid "`{0}': Static classes cannot contain user-defined operators"
msgstr ""
-#: mcs/mcs/class.cs:2554
+#: mcs/mcs/class.cs:2585
#, csharp-format
msgid "`{0}': Static classes cannot contain destructor"
msgstr ""
-#: mcs/mcs/class.cs:2559
+#: mcs/mcs/class.cs:2590
#, csharp-format
msgid "`{0}': cannot declare indexers in a static class"
msgstr ""
-#: mcs/mcs/class.cs:2567
+#: mcs/mcs/class.cs:2598
#, csharp-format
msgid "`{0}': Static classes cannot have instance constructors"
msgstr ""
-#: mcs/mcs/class.cs:2571
+#: mcs/mcs/class.cs:2602
#, csharp-format
msgid "`{0}': cannot declare instance members in a static class"
msgstr ""
-#: mcs/mcs/class.cs:2602
+#: mcs/mcs/class.cs:2633
#, csharp-format
msgid "`{0}': Cannot derive from type parameter `{1}'"
msgstr ""
-#: mcs/mcs/class.cs:2606
+#: mcs/mcs/class.cs:2637
#, csharp-format
msgid "`{0}': Cannot derive from static class `{1}'"
msgstr ""
-#: mcs/mcs/class.cs:2610
+#: mcs/mcs/class.cs:2641
#, csharp-format
msgid "`{0}': cannot derive from sealed type `{1}'"
msgstr ""
-#: mcs/mcs/class.cs:2613
+#: mcs/mcs/class.cs:2644
#, csharp-format
msgid ""
"Static class `{0}' cannot derive from type `{1}'. Static classes must derive "
"from object"
msgstr ""
-#: mcs/mcs/class.cs:2624
+#: mcs/mcs/class.cs:2655
#, csharp-format
msgid "`{0}' cannot derive from special class `{1}'"
msgstr ""
-#: mcs/mcs/class.cs:2634
+#: mcs/mcs/class.cs:2665
#, csharp-format
msgid ""
"Inconsistent accessibility: base class `{0}' is less accessible than class `"
"{1}'"
msgstr ""
-#: mcs/mcs/class.cs:2642
+#: mcs/mcs/class.cs:2673
#, csharp-format
msgid "Static class `{0}' cannot implement interfaces"
msgstr ""
-#: mcs/mcs/class.cs:2753 mcs/mcs/class.cs:2767
+#: mcs/mcs/class.cs:2784 mcs/mcs/class.cs:2798
#, csharp-format
msgid "Struct member `{0}' of type `{1}' causes a cycle in the struct layout"
msgstr ""
-#: mcs/mcs/class.cs:2849
+#: mcs/mcs/class.cs:2880
#, csharp-format
msgid "`{0}': Structs cannot have instance field initializers"
msgstr ""
-#: mcs/mcs/class.cs:3037
+#: mcs/mcs/class.cs:3068
#, csharp-format
msgid "Do not override `{0}'. Use destructor syntax instead"
msgstr ""
-#: mcs/mcs/class.cs:3040
+#: mcs/mcs/class.cs:3071
#, csharp-format
msgid "`{0}' is marked as an override but no suitable {1} found to override"
msgstr ""
-#: mcs/mcs/class.cs:3046
+#: mcs/mcs/class.cs:3077
#, csharp-format
msgid "`{0}': cannot override because `{1}' is not an event"
msgstr ""
-#: mcs/mcs/class.cs:3049
+#: mcs/mcs/class.cs:3080
#, csharp-format
msgid "`{0}': cannot override because `{1}' is not a property"
msgstr ""
-#: mcs/mcs/class.cs:3052
+#: mcs/mcs/class.cs:3083
#, csharp-format
msgid "`{0}': cannot override because `{1}' is not a method"
msgstr ""
-#: mcs/mcs/class.cs:3071
+#: mcs/mcs/class.cs:3102
#, csharp-format
msgid ""
"`{0}' cannot override inherited members `{1}' and `{2}' because they have "
"the same signature when used in type `{3}'"
msgstr ""
-#: mcs/mcs/class.cs:3124 mcs/mcs/field.cs:198
+#: mcs/mcs/class.cs:3155 mcs/mcs/field.cs:198
#, csharp-format
msgid "`{0}' hides inherited abstract member `{1}'"
msgstr ""
-#: mcs/mcs/class.cs:3148
+#: mcs/mcs/class.cs:3179
#, csharp-format
msgid ""
"`{0}': cannot override inherited member `{1}' because it is not marked "
"virtual, abstract or override"
msgstr ""
-#: mcs/mcs/class.cs:3156
+#: mcs/mcs/class.cs:3187
#, csharp-format
msgid "`{0}': cannot override inherited member `{1}' because it is sealed"
msgstr ""
-#: mcs/mcs/class.cs:3165
+#: mcs/mcs/class.cs:3196
#, csharp-format
msgid "`{0}': type must be `{1}' to match overridden member `{2}'"
msgstr ""
-#: mcs/mcs/class.cs:3168
+#: mcs/mcs/class.cs:3199
#, csharp-format
msgid "`{0}': return type must be `{1}' to match overridden member `{2}'"
msgstr ""
-#: mcs/mcs/class.cs:3236
+#: mcs/mcs/class.cs:3267
#, csharp-format
msgid "A partial method `{0}' cannot explicitly implement an interface"
msgstr ""
-#: mcs/mcs/class.cs:3242
+#: mcs/mcs/class.cs:3273
#, csharp-format
msgid "The type `{0}' in explicit interface declaration is not an interface"
msgstr ""
-#: mcs/mcs/class.cs:3273
+#: mcs/mcs/class.cs:3304
#, csharp-format
msgid ""
"Inconsistent accessibility: parameter type `{0}' is less accessible than "
"indexer `{1}'"
msgstr ""
-#: mcs/mcs/class.cs:3277
+#: mcs/mcs/class.cs:3308
#, csharp-format
msgid ""
"Inconsistent accessibility: parameter type `{0}' is less accessible than "
"operator `{1}'"
msgstr ""
-#: mcs/mcs/class.cs:3281
+#: mcs/mcs/class.cs:3312
#, csharp-format
msgid ""
"Inconsistent accessibility: parameter type `{0}' is less accessible than "
"method `{1}'"
msgstr ""
-#: mcs/mcs/class.cs:3341
+#: mcs/mcs/class.cs:3372
#, csharp-format
msgid ""
"`{0}': cannot change access modifiers when overriding `{1}' inherited member "
"`{2}'"
msgstr ""
-#: mcs/mcs/class.cs:3350
+#: mcs/mcs/class.cs:3381
#, csharp-format
msgid "`{0}': static types cannot be used as return types"
msgstr ""
-#: mcs/mcs/class.cs:3463
+#: mcs/mcs/class.cs:3442
+#, csharp-format
+msgid ""
+"`{0}': Cannot specify constraints for overrides and explicit interface "
+"implementation methods"
+msgstr ""
+
+#: mcs/mcs/class.cs:3504
#, csharp-format
msgid "New virtual member `{0}' is declared in a sealed class `{1}'"
msgstr ""
-#: mcs/mcs/class.cs:3478
+#: mcs/mcs/class.cs:3519
msgid "Inconsistent accessibility: property type `"
msgstr ""
-#: mcs/mcs/class.cs:3483
+#: mcs/mcs/class.cs:3524
msgid "Inconsistent accessibility: indexer return type `"
msgstr ""
-#: mcs/mcs/class.cs:3489 mcs/mcs/class.cs:3494 mcs/mcs/delegate.cs:171
+#: mcs/mcs/class.cs:3530 mcs/mcs/class.cs:3535 mcs/mcs/delegate.cs:171
msgid "Inconsistent accessibility: return type `"
msgstr ""
-#: mcs/mcs/class.cs:3499
+#: mcs/mcs/class.cs:3540
msgid "Inconsistent accessibility: field type `"
msgstr ""
-#: mcs/mcs/class.cs:3511
+#: mcs/mcs/class.cs:3552
#, csharp-format
msgid ""
"Parameters or local variables of type `{0}' cannot be declared in async "
"methods or iterators"
msgstr ""
-#: mcs/mcs/class.cs:3515
+#: mcs/mcs/class.cs:3556
#, csharp-format
msgid ""
"Local variables of type `{0}' cannot be used inside anonymous methods, "
"lambda expressions or query expressions"
msgstr ""
-#: mcs/mcs/class.cs:3519
+#: mcs/mcs/class.cs:3560
#, csharp-format
msgid "Field or property cannot be of type `{0}'"
msgstr ""
"The evaluation of the constant value for `{0}' involves a circular definition"
msgstr ""
-#: mcs/mcs/constant.cs:66 mcs/mcs/constant.cs:392
+#: mcs/mcs/constant.cs:66 mcs/mcs/constant.cs:403
#, csharp-format
msgid "Constant value `{0}' cannot be converted to a `{1}'"
msgstr ""
-#: mcs/mcs/constant.cs:264
+#: mcs/mcs/constant.cs:266
#, csharp-format
msgid ""
"Constant value `{0}' cannot be converted to a `{1}' (use `unchecked' syntax "
"to override)"
msgstr ""
-#: mcs/mcs/convert.cs:1184
+#: mcs/mcs/convert.cs:1185
#, csharp-format
msgid ""
"Ambiguous user defined operators `{0}' and `{1}' when converting from `{2}' "
"Extension method `{0}' of value type `{1}' cannot be used to create delegates"
msgstr ""
-#: mcs/mcs/delegate.cs:532
+#: mcs/mcs/delegate.cs:535
#, csharp-format
msgid "Cannot create delegate from partial method declaration `{0}'"
msgstr ""
-#: mcs/mcs/delegate.cs:535
+#: mcs/mcs/delegate.cs:538
#, csharp-format
msgid ""
"Cannot create delegate with `{0}' because it has a Conditional attribute"
msgstr ""
-#: mcs/mcs/delegate.cs:578
+#: mcs/mcs/delegate.cs:581
#, csharp-format
msgid ""
"A method or delegate `{0} {1}' parameters and return type must be same as "
"delegate `{2} {3}' parameters and return type"
msgstr ""
-#: mcs/mcs/delegate.cs:585
+#: mcs/mcs/delegate.cs:588
#, csharp-format
msgid ""
"A method or delegate `{0}' parameters do not match delegate `{1}' parameters"
msgstr ""
-#: mcs/mcs/delegate.cs:590
+#: mcs/mcs/delegate.cs:593
#, csharp-format
msgid ""
"A method or delegate `{0} {1}' return type does not match delegate `{2} {3}' "
"return type"
msgstr ""
-#: mcs/mcs/delegate.cs:673
+#: mcs/mcs/delegate.cs:676
msgid "Method name expected"
msgstr ""
-#: mcs/mcs/doc.cs:613
+#: mcs/mcs/doc.cs:621
#, csharp-format
msgid "Error generating XML documentation file `{0}' (`{1}')"
msgstr ""
-#: mcs/mcs/driver.cs:51
+#: mcs/mcs/driver.cs:52
msgid "Source file `"
msgstr ""
-#: mcs/mcs/driver.cs:96
-#, csharp-format
-msgid "Source file `{0}' could not be found"
-msgstr ""
-
-#: mcs/mcs/driver.cs:103
-#, csharp-format
-msgid "Source file `{0}' is a binary file and not a text file"
-msgstr ""
-
-#: mcs/mcs/driver.cs:210
+#: mcs/mcs/driver.cs:258
msgid "No files to compile were specified"
msgstr ""
-#: mcs/mcs/driver.cs:215
+#: mcs/mcs/driver.cs:263
msgid "Platform option `anycpu32bitpreferred' is valid only for executables"
msgstr ""
-#: mcs/mcs/driver.cs:245
+#: mcs/mcs/driver.cs:293
msgid ""
"If no source files are specified you must specify the output file with -out:"
msgstr ""
-#: mcs/mcs/driver.cs:262
+#: mcs/mcs/driver.cs:310
msgid "Output file name is not valid"
msgstr ""
msgstr ""
#: mcs/mcs/ecore.cs:328
-#, csharp-format
-msgid ""
-"Members of value type `{0}' cannot be assigned using a property `{1}' object "
-"initializer"
-msgstr ""
-
-#: mcs/mcs/ecore.cs:331
-#, csharp-format
-msgid ""
-"Cannot modify a value type return value of `{0}'. Consider storing the value "
-"in a temporary variable"
-msgstr ""
-
-#: mcs/mcs/ecore.cs:335
msgid ""
"The left-hand side of an assignment must be a variable, a property or an "
"indexer"
msgstr ""
-#: mcs/mcs/ecore.cs:341
+#: mcs/mcs/ecore.cs:334
msgid "The operation in question is undefined on void pointers"
msgstr ""
-#: mcs/mcs/ecore.cs:408 mcs/mcs/statement.cs:3001 mcs/mcs/statement.cs:3003
+#: mcs/mcs/ecore.cs:422 mcs/mcs/statement.cs:3038 mcs/mcs/statement.cs:3040
#, csharp-format
msgid "Internal compiler error: {0}"
msgstr ""
-#: mcs/mcs/ecore.cs:448
+#: mcs/mcs/ecore.cs:462
msgid "A ref or out argument must be an assignable variable"
msgstr ""
-#: mcs/mcs/ecore.cs:467
+#: mcs/mcs/ecore.cs:481
msgid ""
"An attribute argument must be a constant expression, typeof expression or "
"array creation expression"
msgstr ""
-#: mcs/mcs/ecore.cs:641
+#: mcs/mcs/ecore.cs:655
#, csharp-format
msgid "The class `{0}' has no constructors defined"
msgstr ""
-#: mcs/mcs/ecore.cs:763
+#: mcs/mcs/ecore.cs:777
#, csharp-format
msgid "The `{0}' operator cannot be applied to operand of type `{1}'"
msgstr ""
-#: mcs/mcs/ecore.cs:769
+#: mcs/mcs/ecore.cs:783
msgid "An expression tree cannot contain an unsafe pointer operation"
msgstr ""
-#: mcs/mcs/ecore.cs:847
+#: mcs/mcs/ecore.cs:861
#, csharp-format
msgid "`{0}' is a `{1}' but a `{2}' was expected"
msgstr ""
-#: mcs/mcs/ecore.cs:880
+#: mcs/mcs/ecore.cs:894
#, csharp-format
msgid "Expression denotes a `{0}', where a `{1}' was expected"
msgstr ""
-#: mcs/mcs/ecore.cs:890
+#: mcs/mcs/ecore.cs:904
msgid "Pointers and fixed size buffers may only be used in an unsafe context"
msgstr ""
-#: mcs/mcs/ecore.cs:2323
+#: mcs/mcs/ecore.cs:2364
#, csharp-format
msgid ""
"Dynamic keyword requires `{0}' to be defined. Are you missing System.Core."
"dll assembly reference?"
msgstr ""
-#: mcs/mcs/ecore.cs:2399
+#: mcs/mcs/ecore.cs:2440
#, csharp-format
msgid ""
"A local variable `{0}' cannot be used before it is declared. Consider "
"renaming the local variable when it hides the member `{1}'"
msgstr ""
-#: mcs/mcs/ecore.cs:2414 mcs/mcs/ecore.cs:2457
+#: mcs/mcs/ecore.cs:2455 mcs/mcs/ecore.cs:2498
#, csharp-format
msgid "`{0}' conflicts with a declaration in a child block"
msgstr ""
-#: mcs/mcs/ecore.cs:2466
+#: mcs/mcs/ecore.cs:2507
#, csharp-format
msgid "A local variable `{0}' cannot be used before it is declared"
msgstr ""
-#: mcs/mcs/ecore.cs:2520
+#: mcs/mcs/ecore.cs:2561
#, csharp-format
msgid "The name `{0}' does not exist in the current context"
msgstr ""
-#: mcs/mcs/ecore.cs:2616
+#: mcs/mcs/ecore.cs:2657
msgid "System.Void cannot be used from C#. Consider using `void'"
msgstr ""
-#: mcs/mcs/ecore.cs:2900
+#: mcs/mcs/ecore.cs:2941
#, csharp-format
msgid "Cannot call an abstract base member `{0}'"
msgstr ""
-#: mcs/mcs/ecore.cs:2907
+#: mcs/mcs/ecore.cs:2948
#, csharp-format
msgid ""
"Cannot access protected member `{0}' via a qualifier of type `{1}'. The "
"qualifier must be of type `{2}' or derived from it"
msgstr ""
-#: mcs/mcs/ecore.cs:2950
+#: mcs/mcs/ecore.cs:2964
+#, csharp-format
+msgid ""
+"Members of value type `{0}' cannot be assigned using a property `{1}' object "
+"initializer"
+msgstr ""
+
+#: mcs/mcs/ecore.cs:2968
+#, csharp-format
+msgid ""
+"Cannot modify a value type return value of `{0}'. Consider storing the value "
+"in a temporary variable"
+msgstr ""
+
+#: mcs/mcs/ecore.cs:2994
#, csharp-format
msgid ""
"Static member `{0}' cannot be accessed with an instance reference, qualify "
"it with a type name instead"
msgstr ""
-#: mcs/mcs/ecore.cs:2965
+#: mcs/mcs/ecore.cs:3009
#, csharp-format
msgid ""
"A field initializer cannot reference the nonstatic field, method, or "
"property `{0}'"
msgstr ""
-#: mcs/mcs/ecore.cs:2969
+#: mcs/mcs/ecore.cs:3013
#, csharp-format
msgid "An object reference is required to access non-static member `{0}'"
msgstr ""
-#: mcs/mcs/ecore.cs:2978
+#: mcs/mcs/ecore.cs:3022
#, csharp-format
msgid ""
"Cannot access a nonstatic member of outer type `{0}' via nested type `{1}'"
msgstr ""
-#: mcs/mcs/ecore.cs:3026
+#: mcs/mcs/ecore.cs:3070
msgid "Cannot modify the result of an unboxing conversion"
msgstr ""
-#: mcs/mcs/ecore.cs:3192
+#: mcs/mcs/ecore.cs:3240
#, csharp-format
msgid ""
"Type `{0}' does not contain a member `{1}' and the best extension method "
"overload `{2}' has some invalid arguments"
msgstr ""
-#: mcs/mcs/ecore.cs:3197
+#: mcs/mcs/ecore.cs:3245
#, csharp-format
msgid "Extension method instance type `{0}' cannot be converted to `{1}'"
msgstr ""
-#: mcs/mcs/ecore.cs:3331
+#: mcs/mcs/ecore.cs:3379
msgid "An expression tree cannot contain an expression with method group"
msgstr ""
-#: mcs/mcs/ecore.cs:3337
+#: mcs/mcs/ecore.cs:3385
msgid ""
"Partial methods with only a defining declaration or removed conditional "
"methods cannot be used in an expression tree"
msgstr ""
-#: mcs/mcs/ecore.cs:3369
+#: mcs/mcs/ecore.cs:3417
#, csharp-format
msgid ""
"Cannot convert method group `{0}' to non-delegate type `{1}'. Consider using "
"parentheses to invoke the method"
msgstr ""
-#: mcs/mcs/ecore.cs:4049
+#: mcs/mcs/ecore.cs:4150
#, csharp-format
msgid ""
"The type `{0}' does not contain a constructor that takes `{1}' arguments"
msgstr ""
-#: mcs/mcs/ecore.cs:4715
+#: mcs/mcs/ecore.cs:4837
#, csharp-format
msgid ""
"Type `{0}' does not contain a member `{1}' and the best extension method "
"without the extension method syntax"
msgstr ""
-#: mcs/mcs/ecore.cs:4743
+#: mcs/mcs/ecore.cs:4876
#, csharp-format
msgid ""
"The call is ambiguous between the following methods or properties: `{0}' and "
"`{1}'"
msgstr ""
-#: mcs/mcs/ecore.cs:4801
+#: mcs/mcs/ecore.cs:4939
#, csharp-format
msgid ""
-"The best overloaded collection initalizer method `{0}' cannot have 'ref', or "
+"The best overloaded collection initalizer method `{0}' cannot have `ref' or "
"`out' modifier"
msgstr ""
-#: mcs/mcs/ecore.cs:4805
+#: mcs/mcs/ecore.cs:4943
#, csharp-format
msgid ""
"The best overloaded collection initalizer method `{0}' has some invalid "
"arguments"
msgstr ""
-#: mcs/mcs/ecore.cs:4808
+#: mcs/mcs/ecore.cs:4946
#, csharp-format
msgid "Delegate `{0}' has some invalid arguments"
msgstr ""
-#: mcs/mcs/ecore.cs:4812
+#: mcs/mcs/ecore.cs:4950
#, csharp-format
msgid "The best overloaded method match for `{0}' has some invalid arguments"
msgstr ""
-#: mcs/mcs/ecore.cs:4821
+#: mcs/mcs/ecore.cs:4959
#, csharp-format
msgid ""
"Argument `#{0}' does not require `{1}' modifier. Consider removing `{1}' "
"modifier"
msgstr ""
-#: mcs/mcs/ecore.cs:4824
+#: mcs/mcs/ecore.cs:4962
#, csharp-format
msgid "Argument `#{0}' is missing `{1}' modifier"
msgstr ""
-#: mcs/mcs/ecore.cs:4836
+#: mcs/mcs/ecore.cs:4979
#, csharp-format
msgid "Argument `#{0}' cannot convert `{1}' expression to type `{2}'"
msgstr ""
-#: mcs/mcs/ecore.cs:4889
+#: mcs/mcs/ecore.cs:5032
#, csharp-format
msgid ""
"The type arguments for method `{0}' cannot be inferred from the usage. Try "
"specifying the type arguments explicitly"
msgstr ""
-#: mcs/mcs/ecore.cs:4918
+#: mcs/mcs/ecore.cs:5061
#, csharp-format
msgid "No overload for method `{0}' takes `{1}' arguments"
msgstr ""
-#: mcs/mcs/ecore.cs:4971
+#: mcs/mcs/ecore.cs:5114
#, csharp-format
msgid "The delegate `{0}' does not contain a parameter named `{1}'"
msgstr ""
-#: mcs/mcs/ecore.cs:4976
+#: mcs/mcs/ecore.cs:5119
#, csharp-format
msgid ""
"The best overloaded method match for `{0}' does not contain a parameter "
"named `{1}'"
msgstr ""
-#: mcs/mcs/ecore.cs:4986
+#: mcs/mcs/ecore.cs:5129
#, csharp-format
msgid ""
"Named argument `{0}' cannot be used for a parameter which has positional "
"argument specified"
msgstr ""
-#: mcs/mcs/ecore.cs:5322
+#: mcs/mcs/ecore.cs:5467
msgid ""
"You cannot use fixed size buffers contained in unfixed expressions. Try "
"using the fixed statement"
msgstr ""
-#: mcs/mcs/ecore.cs:5327
+#: mcs/mcs/ecore.cs:5472
#, csharp-format
msgid "`{0}': Fixed size buffers can only be accessed through locals or fields"
msgstr ""
-#: mcs/mcs/ecore.cs:5363
+#: mcs/mcs/ecore.cs:5508
#, csharp-format
msgid "Use of possibly unassigned field `{0}'"
msgstr ""
-#: mcs/mcs/ecore.cs:5789
+#: mcs/mcs/ecore.cs:5935
#, csharp-format
msgid "Property or event `{0}' is not supported by the C# language"
msgstr ""
-#: mcs/mcs/ecore.cs:5969
+#: mcs/mcs/ecore.cs:6131
#, csharp-format
msgid "A range variable `{0}' may not be passes as `ref' or `out' parameter"
msgstr ""
-#: mcs/mcs/ecore.cs:6047
+#: mcs/mcs/ecore.cs:6204
#, csharp-format
msgid ""
"The property or indexer `{0}' cannot be used in this context because it "
"lacks the `get' accessor"
msgstr ""
-#: mcs/mcs/ecore.cs:6054
+#: mcs/mcs/ecore.cs:6211
#, csharp-format
msgid ""
"The property or indexer `{0}' cannot be used in this context because the get "
"accessor is inaccessible"
msgstr ""
-#: mcs/mcs/ecore.cs:6073
+#: mcs/mcs/ecore.cs:6230
#, csharp-format
msgid "Property or indexer `{0}' cannot be assigned to (it is read-only)"
msgstr ""
-#: mcs/mcs/ecore.cs:6081
+#: mcs/mcs/ecore.cs:6238
#, csharp-format
msgid ""
"The property or indexer `{0}' cannot be used in this context because the set "
"accessor is inaccessible"
msgstr ""
-#: mcs/mcs/ecore.cs:6249
+#: mcs/mcs/ecore.cs:6406
#, csharp-format
msgid ""
"The event `{0}' can only appear on the left hand side of `+=' or `-=' "
"operator"
msgstr ""
-#: mcs/mcs/ecore.cs:6253
+#: mcs/mcs/ecore.cs:6410
#, csharp-format
msgid ""
"The event `{0}' can only appear on the left hand side of += or -= when used "
"outside of the type `{1}'"
msgstr ""
-#: mcs/mcs/ecore.cs:6423
+#: mcs/mcs/ecore.cs:6580
#, csharp-format
msgid ""
"An implicitly typed local variable declaration cannot be initialized with `"
"{0}'"
msgstr ""
-#: mcs/mcs/ecore.cs:6437
+#: mcs/mcs/ecore.cs:6594
msgid ""
"The contextual keyword `var' may only appear within a local variable "
"declaration"
msgid "Type byte, sbyte, short, ushort, int, uint, long or ulong expected"
msgstr ""
-#: mcs/mcs/eval.cs:562
+#: mcs/mcs/eval.cs:563
msgid "Detection Parsing Error"
msgstr ""
"{1}' is used as a short circuit operator"
msgstr ""
-#: mcs/mcs/expression.cs:4635
+#: mcs/mcs/expression.cs:4656
#, csharp-format
msgid ""
"Type of conditional expression cannot be determined as `{0}' and `{1}' "
"convert implicitly to each other"
msgstr ""
-#: mcs/mcs/expression.cs:4645
+#: mcs/mcs/expression.cs:4666
#, csharp-format
msgid ""
"Type of conditional expression cannot be determined because there is no "
"implicit conversion between `{0}' and `{1}'"
msgstr ""
-#: mcs/mcs/expression.cs:4943
+#: mcs/mcs/expression.cs:4964
#, csharp-format
msgid "Use of unassigned local variable `{0}'"
msgstr ""
-#: mcs/mcs/expression.cs:4963
+#: mcs/mcs/expression.cs:4984
#, csharp-format
msgid ""
"Cannot use fixed local `{0}' inside an anonymous method, lambda expression "
"or query expression"
msgstr ""
-#: mcs/mcs/expression.cs:5156
+#: mcs/mcs/expression.cs:5177
#, csharp-format
msgid ""
"Parameter `{0}' cannot be used inside `{1}' when using `ref' or `out' "
"modifier"
msgstr ""
-#: mcs/mcs/expression.cs:5235
+#: mcs/mcs/expression.cs:5256
#, csharp-format
msgid "Use of unassigned out parameter `{0}'"
msgstr ""
-#: mcs/mcs/expression.cs:5345
+#: mcs/mcs/expression.cs:5368
#, csharp-format
msgid "Cannot invoke a non-delegate type `{0}'"
msgstr ""
-#: mcs/mcs/expression.cs:5356
+#: mcs/mcs/expression.cs:5379
#, csharp-format
msgid "The member `{0}' cannot be used as method or delegate"
msgstr ""
-#: mcs/mcs/expression.cs:5376
+#: mcs/mcs/expression.cs:5399
msgid ""
"Do not directly call your base class Finalize method. It is called "
"automatically from your destructor"
msgstr ""
-#: mcs/mcs/expression.cs:5378
+#: mcs/mcs/expression.cs:5401
msgid ""
"Destructors and object.Finalize cannot be called directly. Consider calling "
"IDisposable.Dispose if available"
msgstr ""
-#: mcs/mcs/expression.cs:5407
+#: mcs/mcs/expression.cs:5430
#, csharp-format
msgid ""
"The base call to method `{0}' cannot be dynamically dispatched. Consider "
"casting the dynamic arguments or eliminating the base access"
msgstr ""
-#: mcs/mcs/expression.cs:5480
+#: mcs/mcs/expression.cs:5503
#, csharp-format
msgid "`{0}': cannot explicitly call operator or accessor"
msgstr ""
-#: mcs/mcs/expression.cs:5664
+#: mcs/mcs/expression.cs:5687
#, csharp-format
msgid "Unsafe type `{0}' cannot be used in an object creation expression"
msgstr ""
-#: mcs/mcs/expression.cs:5687
+#: mcs/mcs/expression.cs:5710
#, csharp-format
msgid ""
"Cannot create an instance of the variable type `{0}' because it does not "
"have the new() constraint"
msgstr ""
-#: mcs/mcs/expression.cs:5693
+#: mcs/mcs/expression.cs:5716
#, csharp-format
msgid ""
"`{0}': cannot provide arguments when creating an instance of a variable type"
msgstr ""
-#: mcs/mcs/expression.cs:5702
+#: mcs/mcs/expression.cs:5725
#, csharp-format
msgid "Cannot create an instance of the static class `{0}'"
msgstr ""
-#: mcs/mcs/expression.cs:5714
+#: mcs/mcs/expression.cs:5737
#, csharp-format
msgid "Cannot create an instance of the abstract class or interface `{0}'"
msgstr ""
-#: mcs/mcs/expression.cs:6015
+#: mcs/mcs/expression.cs:6038
msgid ""
"An implicitly typed local variable declarator cannot use an array initializer"
msgstr ""
-#: mcs/mcs/expression.cs:6159 mcs/mcs/expression.cs:6167
-#: mcs/mcs/statement.cs:1206 mcs/mcs/statement.cs:3582
+#: mcs/mcs/expression.cs:6182 mcs/mcs/expression.cs:6190
+#: mcs/mcs/statement.cs:1227 mcs/mcs/statement.cs:3619
msgid "A constant value is expected"
msgstr ""
-#: mcs/mcs/expression.cs:6173
+#: mcs/mcs/expression.cs:6196 mcs/mcs/expression.cs:6221
#, csharp-format
msgid "An array initializer of length `{0}' was expected"
msgstr ""
-#: mcs/mcs/expression.cs:6189
+#: mcs/mcs/expression.cs:6212
msgid ""
"Array initializers can only be used in a variable or field initializer. Try "
"using a new expression instead"
msgstr ""
-#: mcs/mcs/expression.cs:6197
+#: mcs/mcs/expression.cs:6229
msgid "A nested array initializer was expected"
msgstr ""
-#: mcs/mcs/expression.cs:6244
+#: mcs/mcs/expression.cs:6276
msgid "An expression tree cannot contain a multidimensional array initializer"
msgstr ""
-#: mcs/mcs/expression.cs:6280
+#: mcs/mcs/expression.cs:6312
msgid "Cannot create an array with a negative size"
msgstr ""
-#: mcs/mcs/expression.cs:6361
+#: mcs/mcs/expression.cs:6393
msgid ""
"Can only use array initializer expressions to assign to array types. Try "
"using a new expression instead"
msgstr ""
-#: mcs/mcs/expression.cs:6829
+#: mcs/mcs/expression.cs:6830
msgid ""
"The type of an implicitly typed array cannot be inferred from the "
"initializer. Try specifying array type explicitly"
msgstr ""
-#: mcs/mcs/expression.cs:6972
+#: mcs/mcs/expression.cs:6973
msgid ""
"The `this' object cannot be used before all of its fields are assigned to"
msgstr ""
-#: mcs/mcs/expression.cs:6979
+#: mcs/mcs/expression.cs:6980
msgid ""
"Keyword `this' is not valid in a static property, static method, or static "
"field initializer"
msgstr ""
-#: mcs/mcs/expression.cs:6982
+#: mcs/mcs/expression.cs:6983
msgid ""
"Anonymous methods inside structs cannot access instance members of `this'. "
"Consider copying `this' to a local variable outside the anonymous method and "
"using the local instead"
msgstr ""
-#: mcs/mcs/expression.cs:6985
+#: mcs/mcs/expression.cs:6986
msgid "Keyword `this' is not available in the current context"
msgstr ""
-#: mcs/mcs/expression.cs:7062
+#: mcs/mcs/expression.cs:7063
msgid "Cannot take the address of `this' because it is read-only"
msgstr ""
-#: mcs/mcs/expression.cs:7064
+#: mcs/mcs/expression.cs:7065
msgid "Cannot pass `this' as a ref or out argument because it is read-only"
msgstr ""
-#: mcs/mcs/expression.cs:7066
+#: mcs/mcs/expression.cs:7067
msgid "Cannot assign to `this' because it is read-only"
msgstr ""
-#: mcs/mcs/expression.cs:7138
+#: mcs/mcs/expression.cs:7139
msgid "The __arglist construct is valid only within a variable argument method"
msgstr ""
-#: mcs/mcs/expression.cs:7199
+#: mcs/mcs/expression.cs:7200
msgid "An expression tree cannot contain a method with variable arguments"
msgstr ""
-#: mcs/mcs/expression.cs:7436
+#: mcs/mcs/expression.cs:7437
msgid "The typeof operator cannot be used on the dynamic type"
msgstr ""
-#: mcs/mcs/expression.cs:7477
+#: mcs/mcs/expression.cs:7478
#, csharp-format
msgid "`{0}': an attribute argument cannot use type parameters"
msgstr ""
-#: mcs/mcs/expression.cs:7692
+#: mcs/mcs/expression.cs:7693
#, csharp-format
msgid ""
"`{0}' does not have a predefined size, therefore sizeof can only be used in "
"SizeOf)"
msgstr ""
-#: mcs/mcs/expression.cs:7759
+#: mcs/mcs/expression.cs:7760
#, csharp-format
msgid "Alias `{0}' not found"
msgstr ""
-#: mcs/mcs/expression.cs:7785
+#: mcs/mcs/expression.cs:7786
msgid ""
"The namespace alias qualifier `::' cannot be used to invoke a method. "
"Consider using `.' instead"
msgstr ""
-#: mcs/mcs/expression.cs:7894
+#: mcs/mcs/expression.cs:7895
msgid "Cannot perform member binding on `null' value"
msgstr ""
-#: mcs/mcs/expression.cs:8057
+#: mcs/mcs/expression.cs:8068
#, csharp-format
-msgid "`{0}': cannot reference a type through an expression; try `{1}' instead"
+msgid ""
+"`{0}': cannot reference a type through an expression. Consider using `{1}' "
+"instead"
msgstr ""
-#: mcs/mcs/expression.cs:8138
+#: mcs/mcs/expression.cs:8147
#, csharp-format
msgid "A nested type cannot be specified through a type parameter `{0}'"
msgstr ""
-#: mcs/mcs/expression.cs:8146
+#: mcs/mcs/expression.cs:8155
#, csharp-format
msgid ""
"Alias `{0}' cannot be used with `::' since it denotes a type. Consider "
"replacing `::' with `.'"
msgstr ""
-#: mcs/mcs/expression.cs:8211
+#: mcs/mcs/expression.cs:8220
#, csharp-format
msgid "The nested type `{0}' does not exist in the type `{1}'"
msgstr ""
-#: mcs/mcs/expression.cs:8220
+#: mcs/mcs/expression.cs:8239
#, csharp-format
msgid ""
"Type `{0}' does not contain a definition for `{1}' and no extension method `"
-"{1}' of type `{0}' could be found (are you missing a using directive or an "
-"assembly reference?)"
+"{1}' of type `{0}' could be found. Are you missing {2}?"
msgstr ""
-#: mcs/mcs/expression.cs:8432
+#: mcs/mcs/expression.cs:8451
#, csharp-format
msgid "Cannot apply indexing with [] to an expression of type `{0}'"
msgstr ""
-#: mcs/mcs/expression.cs:8450
+#: mcs/mcs/expression.cs:8469
msgid "A pointer must be indexed by only one value"
msgstr ""
-#: mcs/mcs/expression.cs:8504
+#: mcs/mcs/expression.cs:8518
msgid "An element access expression cannot use named argument"
msgstr ""
-#: mcs/mcs/expression.cs:8582
+#: mcs/mcs/expression.cs:8596
#, csharp-format
msgid "Wrong number of indexes `{0}' inside [], expected `{1}'"
msgstr ""
-#: mcs/mcs/expression.cs:8970
+#: mcs/mcs/expression.cs:8984
msgid ""
"The indexer base access cannot be dynamically dispatched. Consider casting "
"the dynamic arguments or eliminating the base access"
msgstr ""
-#: mcs/mcs/expression.cs:9055
+#: mcs/mcs/expression.cs:9069
msgid "An expression tree may not contain a base access"
msgstr ""
-#: mcs/mcs/expression.cs:9073
+#: mcs/mcs/expression.cs:9087
msgid "Keyword `base' is not available in a static method"
msgstr ""
-#: mcs/mcs/expression.cs:9075
+#: mcs/mcs/expression.cs:9089
msgid "Keyword `base' is not available in the current context"
msgstr ""
-#: mcs/mcs/expression.cs:9113
+#: mcs/mcs/expression.cs:9127
msgid ""
"A property, indexer or dynamic member access may not be passed as `ref' or "
"`out' parameter"
msgstr ""
-#: mcs/mcs/expression.cs:9438
+#: mcs/mcs/expression.cs:9455
#, csharp-format
msgid "Array elements cannot be of type `{0}'"
msgstr ""
-#: mcs/mcs/expression.cs:9441
+#: mcs/mcs/expression.cs:9458
#, csharp-format
msgid "Array elements cannot be of static type `{0}'"
msgstr ""
-#: mcs/mcs/expression.cs:9617
+#: mcs/mcs/expression.cs:9634
msgid "Cannot use a negative size with stackalloc"
msgstr ""
-#: mcs/mcs/expression.cs:9621
+#: mcs/mcs/expression.cs:9638
msgid "Cannot use stackalloc in finally or catch"
msgstr ""
-#: mcs/mcs/expression.cs:9738
+#: mcs/mcs/expression.cs:9755
#, csharp-format
msgid ""
"Member `{0}' cannot be initialized. An object initializer may only be used "
"for fields, or properties"
msgstr ""
-#: mcs/mcs/expression.cs:9747
+#: mcs/mcs/expression.cs:9764
#, csharp-format
msgid ""
"Static field or property `{0}' cannot be assigned in an object initializer"
msgstr ""
-#: mcs/mcs/expression.cs:9946
+#: mcs/mcs/expression.cs:9963
#, csharp-format
msgid ""
"A field or property `{0}' cannot be initialized with a collection object "
"initializer because type `{1}' does not implement `{2}' interface"
msgstr ""
-#: mcs/mcs/expression.cs:9957
+#: mcs/mcs/expression.cs:9974
#, csharp-format
msgid "Inconsistent `{0}' member declaration"
msgstr ""
-#: mcs/mcs/expression.cs:9965
+#: mcs/mcs/expression.cs:9982
#, csharp-format
msgid ""
"An object initializer includes more than one member `{0}' initialization"
msgstr ""
-#: mcs/mcs/expression.cs:9983
+#: mcs/mcs/expression.cs:10000
#, csharp-format
msgid "Cannot initialize object of type `{0}' with a collection initializer"
msgstr ""
-#: mcs/mcs/expression.cs:10268
+#: mcs/mcs/expression.cs:10285
msgid "Anonymous types cannot be used in this expression"
msgstr ""
-#: mcs/mcs/expression.cs:10367
+#: mcs/mcs/expression.cs:10384
#, csharp-format
msgid "An anonymous type property `{0}' cannot be initialized with `{1}'"
msgstr ""
"Fixed size buffer `{0}' of length `{1}' and type `{2}' exceeded 2^31 limit"
msgstr ""
-#: mcs/mcs/field.cs:667
+#: mcs/mcs/field.cs:666
#, csharp-format
msgid "`{0}': A volatile field cannot be of the type `{1}'"
msgstr ""
-#: mcs/mcs/field.cs:672
+#: mcs/mcs/field.cs:671
#, csharp-format
msgid "`{0}': A field cannot be both volatile and readonly"
msgstr ""
msgstr ""
#: mcs/mcs/flowanalysis.cs:996 mcs/mcs/flowanalysis.cs:1012
-#: mcs/mcs/flowanalysis.cs:1048 mcs/mcs/statement.cs:782
+#: mcs/mcs/flowanalysis.cs:1048 mcs/mcs/statement.cs:795
msgid "Control cannot leave the body of a finally clause"
msgstr ""
"`{0}' is not a valid constraint. Static classes cannot be used as constraints"
msgstr ""
-#: mcs/mcs/generic.cs:601
+#: mcs/mcs/generic.cs:613
#, csharp-format
msgid "The {2} type parameter `{0}' must be {3} valid on `{1}{4}'"
msgstr ""
-#: mcs/mcs/generic.cs:1974
+#: mcs/mcs/generic.cs:2032
#, csharp-format
msgid "`{0}': static classes cannot be used as generic arguments"
msgstr ""
-#: mcs/mcs/generic.cs:1981
+#: mcs/mcs/generic.cs:2039
#, csharp-format
msgid "The type `{0}' may not be used as a type argument"
msgstr ""
-#: mcs/mcs/generic.cs:2075
+#: mcs/mcs/generic.cs:2133
msgid "Variant type parameters can only be used with interfaces and delegates"
msgstr ""
-#: mcs/mcs/generic.cs:2314
+#: mcs/mcs/generic.cs:2354
#, csharp-format
msgid ""
"The type `{0}' must be a reference type in order to use it as type parameter "
"`{1}' in the generic type or method `{2}'"
msgstr ""
-#: mcs/mcs/generic.cs:2324
+#: mcs/mcs/generic.cs:2364
#, csharp-format
msgid ""
"The type `{0}' must be a non-nullable value type in order to use it as type "
"parameter `{1}' in the generic type or method `{2}'"
msgstr ""
-#: mcs/mcs/generic.cs:2383
+#: mcs/mcs/generic.cs:2423
#, csharp-format
msgid ""
"The type `{0}' must have a public parameterless constructor in order to use "
"it as parameter `{1}' in the generic type or method `{2}'"
msgstr ""
-#: mcs/mcs/generic.cs:2451
+#: mcs/mcs/generic.cs:2479
#, csharp-format
msgid ""
"The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
"{3}'"
msgstr ""
-#: mcs/mcs/generic.cs:2457
+#: mcs/mcs/generic.cs:2485
#, csharp-format
msgid ""
"The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
"{3}'"
msgstr ""
-#: mcs/mcs/generic.cs:2461
+#: mcs/mcs/generic.cs:2489
#, csharp-format
msgid ""
"The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
"method `{2}'. The nullable type `{0}' does not satisfy constraint `{3}'"
msgstr ""
-#: mcs/mcs/generic.cs:2466
+#: mcs/mcs/generic.cs:2494
#, csharp-format
msgid ""
"The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
"method `{2}'. There is no boxing conversion from `{0}' to `{3}'"
msgstr ""
-#: mcs/mcs/generic.cs:2471
+#: mcs/mcs/generic.cs:2499
#, csharp-format
msgid ""
"The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
"method `{2}'. There is no implicit reference conversion from `{0}' to `{3}'"
msgstr ""
-#: mcs/mcs/import.cs:1818
+#: mcs/mcs/import.cs:1868
#, csharp-format
msgid ""
"Reference to type `{0}' claims it is defined in this assembly, but it is not "
"defined in source or any added modules"
msgstr ""
-#: mcs/mcs/import.cs:1822
+#: mcs/mcs/import.cs:1873
+#, csharp-format
+msgid ""
+"The type `{0}' has been forwarded to an assembly that is not referenced. "
+"Consider adding a reference to assembly `{1}'"
+msgstr ""
+
+#: mcs/mcs/import.cs:1877
#, csharp-format
msgid ""
"The type `{0}' is defined in an assembly that is not referenced. Consider "
"adding a reference to assembly `{1}'"
msgstr ""
-#: mcs/mcs/import.cs:1826
+#: mcs/mcs/import.cs:1882
#, csharp-format
msgid ""
"Reference to type `{0}' claims it is defined assembly `{1}', but it could "
msgid "Iterators cannot have unsafe parameters or yield types"
msgstr ""
-#: mcs/mcs/iterators.cs:1132 mcs/mcs/statement.cs:4950
+#: mcs/mcs/iterators.cs:1132 mcs/mcs/statement.cs:4987
msgid "Unsafe code may not appear in iterators"
msgstr ""
-#: mcs/mcs/ikvm.cs:236
+#: mcs/mcs/ikvm.cs:266
msgid "SDK path could not be resolved"
msgstr ""
-#: mcs/mcs/ikvm.cs:314
+#: mcs/mcs/ikvm.cs:344
#, csharp-format
msgid ""
"Assembly `{0}' references `{1}' which has a higher version number than "
"imported assembly `{2}'"
msgstr ""
-#: mcs/mcs/ikvm.cs:323 mcs/mcs/ikvm.cs:327
+#: mcs/mcs/ikvm.cs:353 mcs/mcs/ikvm.cs:357
#, csharp-format
msgid ""
"Assuming assembly reference `{0}' matches assembly `{1}'. You may need to "
"supply runtime policy"
msgstr ""
-#: mcs/mcs/ikvm.cs:413
+#: mcs/mcs/ikvm.cs:444
#, csharp-format
msgid ""
"An assembly with the same name `{0}' has already been imported. Consider "
"removing one of the references or sign the assembly"
msgstr ""
-#: mcs/mcs/ikvm.cs:422
+#: mcs/mcs/ikvm.cs:453
#, csharp-format
msgid ""
"An assembly with the same identity `{0}' has already been imported. Consider "
"suffix `{1}' to create a literal of this type"
msgstr ""
-#: mcs/mcs/membercache.cs:1388
+#: mcs/mcs/membercache.cs:1391
msgid ""
"A partial method declaration and partial method implementation cannot differ "
"on use of `params' modifier"
msgstr ""
-#: mcs/mcs/membercache.cs:1391
+#: mcs/mcs/membercache.cs:1394
msgid ""
"A partial method declaration and partial method implementation must be both "
"an extension method or neither"
msgstr ""
-#: mcs/mcs/membercache.cs:1395
+#: mcs/mcs/membercache.cs:1398
#, csharp-format
msgid ""
"Overloaded contructor `{0}' cannot differ on use of parameter modifiers only"
msgstr ""
-#: mcs/mcs/membercache.cs:1399
+#: mcs/mcs/membercache.cs:1402
#, csharp-format
msgid ""
"Overloaded method `{0}' cannot differ on use of parameter modifiers only"
msgstr ""
-#: mcs/mcs/membercache.cs:1431
+#: mcs/mcs/membercache.cs:1434
msgid ""
"A partial method declaration and partial method implementation must be both "
"`static' or neither"
msgstr ""
-#: mcs/mcs/membercache.cs:1436
+#: mcs/mcs/membercache.cs:1439
msgid ""
"A partial method declaration and partial method implementation must be both "
"`unsafe' or neither"
msgstr ""
-#: mcs/mcs/membercache.cs:1442
+#: mcs/mcs/membercache.cs:1445
#, csharp-format
msgid "A partial method `{0}' declaration is already defined"
msgstr ""
-#: mcs/mcs/membercache.cs:1446
+#: mcs/mcs/membercache.cs:1449
#, csharp-format
msgid "A partial method `{0}' implementation is already defined"
msgstr ""
-#: mcs/mcs/membercache.cs:1457 mcs/mcs/property.cs:81
+#: mcs/mcs/membercache.cs:1460 mcs/mcs/property.cs:81
#, csharp-format
msgid "A member `{0}' is already reserved"
msgstr ""
-#: mcs/mcs/membercache.cs:1468
+#: mcs/mcs/membercache.cs:1471
#, csharp-format
msgid "Duplicate user-defined conversion in type `{0}'"
msgstr ""
-#: mcs/mcs/membercache.cs:1474
+#: mcs/mcs/membercache.cs:1477
#, csharp-format
msgid ""
"A member `{0}' is already defined. Rename this member or use different "
"parameter types"
msgstr ""
-#: mcs/mcs/method.cs:552
+#: mcs/mcs/method.cs:558
#, csharp-format
msgid "`{0}': Async methods cannot use `MethodImplOptions.Synchronized'"
msgstr ""
-#: mcs/mcs/method.cs:560
+#: mcs/mcs/method.cs:566
msgid ""
"The DllImport attribute must be specified on a method marked `static' and "
"`extern'"
msgstr ""
-#: mcs/mcs/method.cs:655
+#: mcs/mcs/method.cs:661
#, csharp-format
msgid "`{0}': A partial method parameters cannot use `out' modifier"
msgstr ""
-#: mcs/mcs/method.cs:716
+#: mcs/mcs/method.cs:722
#, csharp-format
msgid ""
"Conditional not valid on `{0}' because it is a constructor, destructor, "
"operator or explicit interface implementation"
msgstr ""
-#: mcs/mcs/method.cs:855
-#, csharp-format
-msgid ""
-"`{0}': Cannot specify constraints for overrides and explicit interface "
-"implementation methods"
-msgstr ""
-
#: mcs/mcs/method.cs:865
msgid ""
"A partial method cannot define access modifier or any of abstract, extern, "
msgid "The return type of an async method must be void, Task, or Task<T>"
msgstr ""
-#: mcs/mcs/method.cs:1224
+#: mcs/mcs/method.cs:1227
#, csharp-format
msgid "`{0}': Extension methods cannot be defined in a nested class"
msgstr ""
-#: mcs/mcs/method.cs:1230
+#: mcs/mcs/method.cs:1233
#, csharp-format
msgid ""
"`{0}': Extension methods require `System.Runtime.CompilerServices."
"reference?"
msgstr ""
-#: mcs/mcs/method.cs:1239
+#: mcs/mcs/method.cs:1242
#, csharp-format
msgid "`{0}': Extension methods must be defined in a non-generic static class"
msgstr ""
-#: mcs/mcs/method.cs:1255
+#: mcs/mcs/method.cs:1258
#, csharp-format
msgid "`{0}': an entry point cannot be async method"
msgstr ""
-#: mcs/mcs/method.cs:1292
+#: mcs/mcs/method.cs:1295
#, csharp-format
msgid ""
"A partial method `{0}' implementation is missing a partial method declaration"
msgstr ""
-#: mcs/mcs/method.cs:1325
+#: mcs/mcs/method.cs:1336
#, csharp-format
msgid "Method or delegate cannot return type `{0}'"
msgstr ""
-#: mcs/mcs/method.cs:1404
+#: mcs/mcs/method.cs:1415
msgid ""
"The constructor call cannot be dynamically dispatched within constructor "
"initializer"
msgstr ""
-#: mcs/mcs/method.cs:1418
+#: mcs/mcs/method.cs:1429
#, csharp-format
msgid "`{0}': Struct constructors cannot call base constructors"
msgstr ""
-#: mcs/mcs/method.cs:1436
+#: mcs/mcs/method.cs:1447
#, csharp-format
msgid "Constructor `{0}' cannot call itself"
msgstr ""
-#: mcs/mcs/method.cs:1565
+#: mcs/mcs/method.cs:1576
#, csharp-format
msgid "`{0}': The static constructor must be parameterless"
msgstr ""
-#: mcs/mcs/method.cs:1586
+#: mcs/mcs/method.cs:1597
msgid "Structs cannot contain explicit parameterless constructors"
msgstr ""
-#: mcs/mcs/method.cs:1636
+#: mcs/mcs/method.cs:1652
#, csharp-format
msgid ""
"`{0}': A class with the ComImport attribute cannot have a user-defined "
"constructor"
msgstr ""
-#: mcs/mcs/method.cs:1886
+#: mcs/mcs/method.cs:1902
#, csharp-format
msgid "`{0}' is an accessor not found in interface member `{1}{2}'"
msgstr ""
-#: mcs/mcs/method.cs:1892
+#: mcs/mcs/method.cs:1908
#, csharp-format
msgid ""
"`{0}.{1}' in explicit interface declaration is not a member of interface"
msgstr ""
-#: mcs/mcs/method.cs:1900
+#: mcs/mcs/method.cs:1916
#, csharp-format
msgid ""
"`{0}' explicit method implementation cannot implement `{1}' because it is an "
"accessor"
msgstr ""
-#: mcs/mcs/method.cs:1910
+#: mcs/mcs/method.cs:1926
#, csharp-format
msgid "Method `{0}' cannot implement interface accessor `{1}'"
msgstr ""
-#: mcs/mcs/method.cs:1917
+#: mcs/mcs/method.cs:1933
#, csharp-format
msgid ""
"Accessor `{0}' cannot implement interface member `{1}' for type `{2}'. Use "
"an explicit interface implementation"
msgstr ""
-#: mcs/mcs/method.cs:1924
+#: mcs/mcs/method.cs:1940
#, csharp-format
msgid ""
"Accessor `{0}' must be declared public to implement interface member `{1}'"
msgstr ""
-#: mcs/mcs/method.cs:1944
+#: mcs/mcs/method.cs:1960
#, csharp-format
msgid ""
"`{0}': the explicit interface implementation cannot introduce the params "
"modifier"
msgstr ""
-#: mcs/mcs/method.cs:2282
+#: mcs/mcs/method.cs:2308
#, csharp-format
msgid ""
"Attribute `{0}' is not valid on property or event accessors. It is valid on `"
"{1}' declarations only"
msgstr ""
-#: mcs/mcs/method.cs:2510
+#: mcs/mcs/method.cs:2536
#, csharp-format
msgid "User-defined operator `{0}' must be declared static and public"
msgstr ""
-#: mcs/mcs/method.cs:2549
+#: mcs/mcs/method.cs:2580
msgid ""
"User-defined operator cannot take an object of the enclosing type and "
"convert to an object of the enclosing type"
msgstr ""
-#: mcs/mcs/method.cs:2560
+#: mcs/mcs/method.cs:2591
msgid "User-defined conversion must convert to or from the enclosing type"
msgstr ""
-#: mcs/mcs/method.cs:2566
+#: mcs/mcs/method.cs:2597
#, csharp-format
msgid ""
"User-defined conversion `{0}' cannot convert to or from the dynamic type"
msgstr ""
-#: mcs/mcs/method.cs:2573
+#: mcs/mcs/method.cs:2604
#, csharp-format
msgid ""
"User-defined conversion `{0}' cannot convert to or from an interface type"
msgstr ""
-#: mcs/mcs/method.cs:2580
+#: mcs/mcs/method.cs:2611
#, csharp-format
msgid "User-defined conversion `{0}' cannot convert to or from a base class"
msgstr ""
-#: mcs/mcs/method.cs:2586
+#: mcs/mcs/method.cs:2617
#, csharp-format
msgid "User-defined conversion `{0}' cannot convert to or from a derived class"
msgstr ""
-#: mcs/mcs/method.cs:2593
+#: mcs/mcs/method.cs:2624
msgid ""
"Overloaded shift operator must have the type of the first operand be the "
"containing type, and the type of the second operand must be int"
msgstr ""
-#: mcs/mcs/method.cs:2602
+#: mcs/mcs/method.cs:2633
msgid ""
"The return type for ++ or -- operator must be the containing type or derived "
"from the containing type"
msgstr ""
-#: mcs/mcs/method.cs:2607
+#: mcs/mcs/method.cs:2638
msgid "The parameter type for ++ or -- operator must be the containing type"
msgstr ""
-#: mcs/mcs/method.cs:2614
+#: mcs/mcs/method.cs:2645
msgid "The parameter type of a unary operator must be the containing type"
msgstr ""
-#: mcs/mcs/method.cs:2622
+#: mcs/mcs/method.cs:2653
msgid "The return type of operator True or False must be bool"
msgstr ""
-#: mcs/mcs/method.cs:2637
+#: mcs/mcs/method.cs:2668
msgid "One of the parameters of a binary operator must be the containing type"
msgstr ""
msgid "The modifier `{0}' is not valid for this item"
msgstr ""
-#: mcs/mcs/namespace.cs:186
+#: mcs/mcs/namespace.cs:263
#, csharp-format
msgid ""
-"The type or namespace name `{0}' could not be found in the global namespace "
-"(are you missing an assembly reference?)"
+"The type or namespace name `{0}' could not be found in the global namespace. "
+"Are you missing {1} assembly reference?"
msgstr ""
-#: mcs/mcs/namespace.cs:190
+#: mcs/mcs/namespace.cs:267
#, csharp-format
msgid ""
"The type or namespace name `{0}' does not exist in the namespace `{1}'. Are "
-"you missing an assembly reference?"
+"you missing {2} assembly reference?"
msgstr ""
-#: mcs/mcs/namespace.cs:284
+#: mcs/mcs/namespace.cs:367
#, csharp-format
msgid "The imported type `{0}' is defined multiple times"
msgstr ""
-#: mcs/mcs/namespace.cs:749 mcs/mcs/namespace.cs:761
+#: mcs/mcs/namespace.cs:839 mcs/mcs/namespace.cs:851
msgid ""
"A using clause must precede all other namespace elements except extern alias "
"declarations"
msgstr ""
-#: mcs/mcs/namespace.cs:777
+#: mcs/mcs/namespace.cs:867
#, csharp-format
msgid "The using alias `{0}' appeared previously in this namespace"
msgstr ""
-#: mcs/mcs/namespace.cs:815
+#: mcs/mcs/namespace.cs:905 mcs/mcs/namespace.cs:928
#, csharp-format
msgid "The namespace `{0}' already contains a definition for `{1}'"
msgstr ""
-#: mcs/mcs/namespace.cs:1037
+#: mcs/mcs/namespace.cs:1147
#, csharp-format
msgid "Namespace `{0}' contains a definition with same name as alias `{1}'"
msgstr ""
-#: mcs/mcs/namespace.cs:1089
+#: mcs/mcs/namespace.cs:1199
#, csharp-format
msgid "`{0}' is an ambiguous reference between `{1}' and `{2}'"
msgstr ""
-#: mcs/mcs/namespace.cs:1115
-#, csharp-format
-msgid ""
-"The type or namespace name `{0}' could not be found. Are you missing a using "
-"directive or an assembly reference?"
-msgstr ""
-
-#: mcs/mcs/namespace.cs:1317
+#: mcs/mcs/namespace.cs:1390
#, csharp-format
msgid ""
"`{0}' is a type not a namespace. A using namespace directive can only be "
"applied to namespaces"
msgstr ""
-#: mcs/mcs/namespace.cs:1336
+#: mcs/mcs/namespace.cs:1414
#, csharp-format
msgid "The extern alias `{0}' was not specified in -reference option"
msgstr ""
msgid "`{0}': abstract properties cannot have private accessors"
msgstr ""
-#: mcs/mcs/property.cs:397
+#: mcs/mcs/property.cs:402
#, csharp-format
msgid ""
"The accessibility modifier of the `{0}' accessor must be more restrictive "
"than the modifier of the property or indexer `{1}'"
msgstr ""
-#: mcs/mcs/property.cs:506
+#: mcs/mcs/property.cs:511
#, csharp-format
msgid "Explicit interface implementation `{0}' is missing accessor `{1}'"
msgstr ""
-#: mcs/mcs/property.cs:525
+#: mcs/mcs/property.cs:530
#, csharp-format
msgid ""
"`{0}': cannot override because `{1}' does not have an overridable get "
"accessor"
msgstr ""
-#: mcs/mcs/property.cs:542
+#: mcs/mcs/property.cs:547
#, csharp-format
msgid ""
"`{0}': cannot override because `{1}' does not have an overridable set "
"accessor"
msgstr ""
-#: mcs/mcs/property.cs:583
+#: mcs/mcs/property.cs:588
#, csharp-format
msgid ""
"`{0}': Cannot specify accessibility modifiers for both accessors of the "
"property or indexer"
msgstr ""
-#: mcs/mcs/property.cs:590
+#: mcs/mcs/property.cs:595
#, csharp-format
msgid ""
"`{0}': accessibility modifiers on accessors may only be used if the property "
"or indexer has both a get and a set accessor"
msgstr ""
-#: mcs/mcs/property.cs:818
+#: mcs/mcs/property.cs:823
#, csharp-format
msgid ""
"Automatically implemented property `{0}' cannot be used inside a type with "
"an explicit StructLayout attribute"
msgstr ""
-#: mcs/mcs/property.cs:1305
+#: mcs/mcs/property.cs:1312
#, csharp-format
msgid "`{0}': event must be of a delegate type"
msgstr ""
-#: mcs/mcs/property.cs:1581
+#: mcs/mcs/property.cs:1588
#, csharp-format
msgid ""
"The `{0}' attribute is valid only on an indexer that is not an explicit "
"interface member declaration"
msgstr ""
-#: mcs/mcs/property.cs:1585
+#: mcs/mcs/property.cs:1592
msgid "Cannot set the `IndexerName' attribute on an indexer marked override"
msgstr ""
msgid "Value specified for the argument to `{0}' is not valid"
msgstr ""
-#: mcs/mcs/statement.cs:92
+#: mcs/mcs/statement.cs:100
msgid ""
"A lambda expression with statement body cannot be converted to an expresion "
"tree"
msgstr ""
-#: mcs/mcs/statement.cs:845
+#: mcs/mcs/statement.cs:858
#, csharp-format
msgid ""
"An object of a type convertible to `{0}' is required for the return statement"
msgstr ""
-#: mcs/mcs/statement.cs:859 mcs/mcs/statement.cs:884
+#: mcs/mcs/statement.cs:872 mcs/mcs/statement.cs:896
#, csharp-format
msgid ""
"`{0}': A return keyword must not be followed by any expression when method "
"returns void"
msgstr ""
-#: mcs/mcs/statement.cs:895
+#: mcs/mcs/statement.cs:907
#, csharp-format
msgid ""
"`{0}': A return keyword must not be followed by an expression when async "
"method returns `Task'. Consider using `Task<T>' return type"
msgstr ""
-#: mcs/mcs/statement.cs:905
+#: mcs/mcs/statement.cs:917
#, csharp-format
msgid ""
"`{0}': The return expression type of async method must be `{1}' rather than "
"`Task<{1}>'"
msgstr ""
-#: mcs/mcs/statement.cs:929
+#: mcs/mcs/statement.cs:927
+#, csharp-format
+msgid ""
+"`{0}': A return keyword must not be followed by any expression when delegate "
+"returns void"
+msgstr ""
+
+#: mcs/mcs/statement.cs:950
#, csharp-format
msgid ""
"Cannot convert `{0}' to delegate type `{1}' because some of the return types "
"in the block are not implicitly convertible to the delegate return type"
msgstr ""
-#: mcs/mcs/statement.cs:977
+#: mcs/mcs/statement.cs:998
msgid ""
"Cannot return a value from iterators. Use the yield return statement to "
"return a value, or yield break to end the iteration"
msgstr ""
-#: mcs/mcs/statement.cs:1149 mcs/mcs/statement.cs:1194
+#: mcs/mcs/statement.cs:1170 mcs/mcs/statement.cs:1215
msgid "A goto case is only valid inside a switch statement"
msgstr ""
-#: mcs/mcs/statement.cs:1282 mcs/mcs/statement.cs:5351
+#: mcs/mcs/statement.cs:1303 mcs/mcs/statement.cs:5388
msgid "The type caught or thrown must be derived from System.Exception"
msgstr ""
-#: mcs/mcs/statement.cs:1527
+#: mcs/mcs/statement.cs:1548
msgid "A fixed statement cannot use an implicitly typed local variable"
msgstr ""
-#: mcs/mcs/statement.cs:1532
+#: mcs/mcs/statement.cs:1553
msgid "An implicitly typed local variable cannot be a constant"
msgstr ""
-#: mcs/mcs/statement.cs:1537
+#: mcs/mcs/statement.cs:1558
msgid ""
"An implicitly typed local variable declarator must include an initializer"
msgstr ""
-#: mcs/mcs/statement.cs:1542
+#: mcs/mcs/statement.cs:1563
msgid ""
"An implicitly typed local variable declaration cannot include multiple "
"declarators"
msgstr ""
-#: mcs/mcs/statement.cs:2164
+#: mcs/mcs/statement.cs:2185
#, csharp-format
msgid ""
"A local variable named `{0}' cannot be declared in this scope because it "
"scope to denote something else"
msgstr ""
-#: mcs/mcs/statement.cs:2176
+#: mcs/mcs/statement.cs:2197
#, csharp-format
msgid "A local variable named `{0}' is already defined in this scope"
msgstr ""
-#: mcs/mcs/statement.cs:2183
+#: mcs/mcs/statement.cs:2204
#, csharp-format
msgid ""
"The type parameter name `{0}' is the same as local variable or parameter name"
msgstr ""
-#: mcs/mcs/statement.cs:2898
+#: mcs/mcs/statement.cs:2935
#, csharp-format
msgid ""
"The out parameter `{0}' must be assigned to before control leaves the "
"current method"
msgstr ""
-#: mcs/mcs/statement.cs:3016
+#: mcs/mcs/statement.cs:3053
#, csharp-format
msgid "`{0}': not all code paths return a value"
msgstr ""
-#: mcs/mcs/statement.cs:3033
+#: mcs/mcs/statement.cs:3070
#, csharp-format
msgid "Not all code paths return a value in anonymous method of type `{0}'"
msgstr ""
-#: mcs/mcs/statement.cs:3081
+#: mcs/mcs/statement.cs:3118
msgid "Async methods cannot have ref or out parameters"
msgstr ""
-#: mcs/mcs/statement.cs:3087
+#: mcs/mcs/statement.cs:3124
msgid "__arglist is not allowed in parameter list of async methods"
msgstr ""
-#: mcs/mcs/statement.cs:3093
+#: mcs/mcs/statement.cs:3130
msgid "Async methods cannot have unsafe parameters"
msgstr ""
-#: mcs/mcs/statement.cs:3288
+#: mcs/mcs/statement.cs:3325
#, csharp-format
msgid "The label `{0}' is a duplicate"
msgstr ""
-#: mcs/mcs/statement.cs:3297 mcs/mcs/statement.cs:3308
+#: mcs/mcs/statement.cs:3334 mcs/mcs/statement.cs:3345
#, csharp-format
msgid ""
"The label `{0}' shadows another label by the same name in a contained scope"
msgstr ""
-#: mcs/mcs/statement.cs:3604
+#: mcs/mcs/statement.cs:3641
#, csharp-format
msgid "The label `case {0}:' already occurs in this switch statement"
msgstr ""
-#: mcs/mcs/statement.cs:4123
+#: mcs/mcs/statement.cs:4160
#, csharp-format
msgid ""
"A switch expression of type `{0}' cannot be converted to an integral type, "
"bool, char, string, enum or nullable type"
msgstr ""
-#: mcs/mcs/statement.cs:4734
+#: mcs/mcs/statement.cs:4771
#, csharp-format
msgid "`{0}' is not a reference type as required by the lock statement"
msgstr ""
-#: mcs/mcs/statement.cs:5081
+#: mcs/mcs/statement.cs:5118
msgid "The type of locals declared in a fixed statement must be a pointer type"
msgstr ""
-#: mcs/mcs/statement.cs:5097
+#: mcs/mcs/statement.cs:5134
msgid ""
"The right hand side of a fixed statement assignment may not be a cast "
"expression"
msgstr ""
-#: mcs/mcs/statement.cs:5167
+#: mcs/mcs/statement.cs:5204
msgid ""
"You cannot use the fixed statement to take the address of an already fixed "
"expression"
msgstr ""
-#: mcs/mcs/statement.cs:5523
+#: mcs/mcs/statement.cs:5560
#, csharp-format
msgid ""
"A previous catch clause already catches all exceptions of this or a super "
"type `{0}'"
msgstr ""
-#: mcs/mcs/statement.cs:5663
+#: mcs/mcs/statement.cs:5700
#, csharp-format
msgid ""
"`{0}': type used in a using statement must be implicitly convertible to "
"`System.IDisposable'"
msgstr ""
-#: mcs/mcs/statement.cs:6067
+#: mcs/mcs/statement.cs:6104
#, csharp-format
msgid ""
"foreach statement requires that the return type `{0}' of `{1}' must have a "
"suitable public MoveNext method and public Current property"
msgstr ""
-#: mcs/mcs/statement.cs:6112
+#: mcs/mcs/statement.cs:6149
#, csharp-format
msgid ""
"foreach statement cannot operate on variables of type `{0}' because it "
"implementation"
msgstr ""
-#: mcs/mcs/statement.cs:6141
+#: mcs/mcs/statement.cs:6178
#, csharp-format
msgid ""
"foreach statement cannot operate on variables of type `{0}' because it does "
"not contain a definition for `{1}' or is inaccessible"
msgstr ""
-#: mcs/mcs/statement.cs:6372
+#: mcs/mcs/statement.cs:6409
msgid "Use of null is not valid in this context"
msgstr ""
-#: mcs/mcs/statement.cs:6384
+#: mcs/mcs/statement.cs:6421
#, csharp-format
msgid "Foreach statement cannot operate on a `{0}'"
msgstr ""
-#: mcs/mcs/typemanager.cs:771
+#: mcs/mcs/typemanager.cs:785
#, csharp-format
msgid "The predefined type `{0}.{1}' is not defined or imported"
msgstr ""
-#: mcs/mcs/typemanager.cs:816
+#: mcs/mcs/typemanager.cs:830
#, csharp-format
msgid ""
"The predefined type `{0}.{1}' is defined multiple times. Using definition "
"from `{2}'"
msgstr ""
-#: mcs/mcs/typemanager.cs:831
+#: mcs/mcs/typemanager.cs:845
#, csharp-format
msgid "The predefined type `{0}.{1}' is not declared correctly"
msgstr ""
-#: mcs/mcs/typemanager.cs:956
+#: mcs/mcs/typemanager.cs:970
#, csharp-format
msgid ""
"The compiler required member `{0}.{1}{2}' could not be found or is "
"inaccessible"
msgstr ""
-#: mcs/mcs/typemanager.cs:1070
+#: mcs/mcs/typemanager.cs:1084
#, csharp-format
msgid ""
"Cannot take the address of, get the size of, or declare a pointer to a "
msgstr ""
"Project-Id-Version: mono 2.1\n"
"Report-Msgid-Bugs-To: http://www.mono-project.com/Bugs\n"
-"POT-Creation-Date: 2012-05-30 18:30+0100\n"
+"POT-Creation-Date: 2012-12-05 09:29+0100\n"
"PO-Revision-Date: 2009-03-01 07:52-0300\n"
"Last-Translator: Rodrigo Luiz Marques Flores <mail@rodrigoflores.org>\n"
"Language-Team: pt-BR <mono-list@lists.ximian.com>\n"
"Não foi possível converter \"{0}\" para um tipo delegate \"{1}\"pois os "
"parâmetros não conferem"
-#: mcs/mcs/anonymous.cs:1027 mcs/mcs/ecore.cs:4913
+#: mcs/mcs/anonymous.cs:1027 mcs/mcs/ecore.cs:5056
#, csharp-format
msgid "Delegate `{0}' does not take `{1}' arguments"
msgstr "Delegate \"{0}\" não recebe \"{1}\" argumentos"
msgstr ""
"O parâmetro \"{0}\" é declarado como tipo \"{1}\" mas deveria ser \"{2}\""
-#: mcs/mcs/anonymous.cs:1202
+#: mcs/mcs/anonymous.cs:1212
#, fuzzy
msgid "Async lambda expressions cannot be converted to expression trees"
msgstr ""
"Uma expressão lambda com um corpo de declarações não pode ser convertida "
"para uma árvore de expressão"
-#: mcs/mcs/anonymous.cs:1240
+#: mcs/mcs/anonymous.cs:1250
msgid "An anonymous method cannot be converted to an expression tree"
msgstr "Um método anônimo não pode ser convertido para uma árvore de expressão"
-#: mcs/mcs/anonymous.cs:1259
+#: mcs/mcs/anonymous.cs:1269
#, fuzzy, csharp-format
msgid ""
"Cannot convert anonymous method block without a parameter list to delegate "
"parâmetros para representar o tipo \"{0}\" por que este possui um ou mais "
"parâmetros \"externos\"."
-#: mcs/mcs/anonymous.cs:1283
+#: mcs/mcs/anonymous.cs:1293
msgid ""
"Anonymous methods and lambda expressions cannot be used in the current "
"context"
"Métodos anônimos ou expressões lambdas não podem ser utilizados no contexto "
"atual"
-#: mcs/mcs/anonymous.cs:1326
+#: mcs/mcs/anonymous.cs:1336
#, fuzzy, csharp-format
msgid ""
"Local variable or parameter `{0}' cannot have their address taken and be "
"A variável local ou parâmetro \"{0}\" não pode ter seu endereço obtido e ser "
"utilizado dentro de um método anônimo ou expressão lambda"
-#: mcs/mcs/anonymous.cs:1346
+#: mcs/mcs/anonymous.cs:1356
#, fuzzy, csharp-format
msgid "Cannot convert async {0} to delegate type `{1}'"
msgstr "Não foi possível converter \"{0}\" para um tipo não-delegate \"{1}\""
-#: mcs/mcs/anonymous.cs:1596
+#: mcs/mcs/anonymous.cs:1594
msgid "An expression tree cannot contain an anonymous method expression"
msgstr ""
"Uma árvore de expressão não pode conter uma expressão que seja um método "
"anônimo"
-#: mcs/mcs/anonymous.cs:1879
+#: mcs/mcs/anonymous.cs:1877
#, csharp-format
msgid ""
"`{0}': An anonymous type cannot have multiple properties with the same name"
msgid "Cannot assign to `{0}' because it is a `{1}'"
msgstr "Não foi possível atribuir a \"{0}\" por que este é um \"{1}\""
-#: mcs/mcs/assembly.cs:286
+#: mcs/mcs/assembly.cs:279
msgid "Invalid type specified as an argument for TypeForwardedTo attribute"
msgstr ""
"Tipo inválido especificado com um argumento para um atributo TypeForwardedTo"
-#: mcs/mcs/assembly.cs:294
+#: mcs/mcs/assembly.cs:287
#, csharp-format
msgid "A duplicate type forward of type `{0}'"
msgstr "Um encaminhamento de tipo duplicado do tipo \"{0}\""
-#: mcs/mcs/assembly.cs:303
+#: mcs/mcs/assembly.cs:296
#, csharp-format
msgid "Cannot forward type `{0}' because it is defined in this assembly"
msgstr ""
"Não foi possível encaminhar o tipo \"{0}\" porque este está definido neste "
"assembly"
-#: mcs/mcs/assembly.cs:309
+#: mcs/mcs/assembly.cs:302
#, csharp-format
msgid "Cannot forward type `{0}' because it is a nested type"
msgstr "Não foi possível encaminhar tipo \"{0}\" por que é um tipo aninhado"
-#: mcs/mcs/assembly.cs:338
+#: mcs/mcs/assembly.cs:331
#, csharp-format
msgid ""
"Friend assembly reference `{0}' is invalid. InternalsVisibleTo declarations "
"cannot have a version, culture or processor architecture specified"
msgstr ""
-#: mcs/mcs/assembly.cs:346
+#: mcs/mcs/assembly.cs:339
#, csharp-format
msgid ""
"Friend assembly reference `{0}' is invalid. Strong named assemblies must "
"specify a public key in their InternalsVisibleTo declarations"
msgstr ""
-#: mcs/mcs/assembly.cs:381
+#: mcs/mcs/assembly.cs:374
#, csharp-format
msgid "Referenced assembly `{0}' does not have a strong name"
msgstr ""
-#: mcs/mcs/assembly.cs:387
+#: mcs/mcs/assembly.cs:380
#, csharp-format
msgid "Referenced assembly `{0}' has different culture setting of `{1}'"
msgstr ""
-#: mcs/mcs/assembly.cs:402
+#: mcs/mcs/assembly.cs:395
#, csharp-format
msgid ""
"Friend access was granted to `{0}', but the output assembly is named `{1}'. "
"nomeada \"{1}\". Tente adicionar uma referência para \"{0}\" ou alterar a "
"saída do assembly para igualar isso"
-#: mcs/mcs/assembly.cs:416
+#: mcs/mcs/assembly.cs:409
msgid ""
"Could not sign the assembly. ECMA key can only be used to delay-sign "
"assemblies"
"Não foi possível assinar o assembly. Chave ECMA pode apenas ser utilizada "
"para assinar o adiamento do assembly"
-#: mcs/mcs/assembly.cs:657
+#: mcs/mcs/assembly.cs:650
msgid ""
"Added modules must be marked with the CLSCompliant attribute to match the "
"assembly"
"Módulos adicionados devem ser marcados com o atributo CLSCompliant para "
"coincidir com o assembly"
-#: mcs/mcs/assembly.cs:692 mcs/mcs/assembly.cs:707
+#: mcs/mcs/assembly.cs:685 mcs/mcs/assembly.cs:700
#, csharp-format
msgid ""
"Option `{0}' overrides attribute `{1}' given in a source file or added module"
"Opção \"{0}\" sobrescreve atributo \"{1}\" dado num código-fonte ou módulo "
"adicionado"
-#: mcs/mcs/assembly.cs:742
+#: mcs/mcs/assembly.cs:735
msgid "Delay signing was requested but no key file was given"
msgstr ""
-#: mcs/mcs/assembly.cs:763
+#: mcs/mcs/assembly.cs:756
msgid "Cannot link resource file when building a module"
msgstr ""
"Não é possível apontar arquivo de recursos quando estiver compilando um "
"módulo"
-#: mcs/mcs/assembly.cs:768
+#: mcs/mcs/assembly.cs:761
#, csharp-format
msgid "Error reading resource file `{0}'"
msgstr "Erro ao ler arquivo de recurso \"{0}\""
-#: mcs/mcs/assembly.cs:838
+#: mcs/mcs/assembly.cs:831
msgid "Could not write to file `"
msgstr "Não foi possível escrever para o arquivo \""
-#: mcs/mcs/assembly.cs:882
+#: mcs/mcs/assembly.cs:875
msgid "Cannot specify -main if building a module or library"
msgstr ""
"Não é possível especificar -main se estiver compilando um módulo ou "
"biblioteca"
-#: mcs/mcs/assembly.cs:908
+#: mcs/mcs/assembly.cs:901
#, csharp-format
msgid "Could not find `{0}' specified for Main method"
msgstr "Não foi possível encontrar o \"{0}\" especificado para o método Main"
-#: mcs/mcs/assembly.cs:914
+#: mcs/mcs/assembly.cs:907
#, csharp-format
msgid "`{0}' specified for Main method must be a valid class or struct"
msgstr ""
"\"{0}\" especificado para o método Main deve ser uma classe válida ou struct"
-#: mcs/mcs/assembly.cs:918
+#: mcs/mcs/assembly.cs:911
#, csharp-format
msgid "`{0}' does not have a suitable static Main method"
msgstr "\"{0}\" não possue um método Main estático apropriado"
-#: mcs/mcs/assembly.cs:921
+#: mcs/mcs/assembly.cs:914
#, csharp-format
msgid ""
"Program `{0}' does not contain a static `Main' method suitable for an entry "
"Programa \"{0}\" não contém um método estático \"Main\" apropriado para um "
"ponto de entrada"
-#: mcs/mcs/assembly.cs:940
+#: mcs/mcs/assembly.cs:933
msgid "Error during assembly signing. "
msgstr "Erro durante a assinatura do assembly. "
-#: mcs/mcs/assembly.cs:1125
+#: mcs/mcs/assembly.cs:1118
#, fuzzy, csharp-format
msgid "Metadata file `{0}' could not be found"
msgstr "Arquivo fonte \"{0}\" não pôde ser encontrado"
-#: mcs/mcs/assembly.cs:1130
+#: mcs/mcs/assembly.cs:1123
#, fuzzy, csharp-format
msgid "Metadata file `{0}' does not contain valid metadata"
msgstr "arquivo \"{0}\" possui metadados inválidos \"{1}\""
-#: mcs/mcs/assembly.cs:1136
+#: mcs/mcs/assembly.cs:1129
#, fuzzy, csharp-format
msgid ""
"Referenced assembly file `{0}' is a module. Consider using `-addmodule' "
"Arquivo referenciado \"{0}\" não é um assembly. Considere, ao invés disso, "
"utilizar a opção \"-addmodule\""
-#: mcs/mcs/assembly.cs:1143
+#: mcs/mcs/assembly.cs:1136
#, fuzzy, csharp-format
msgid ""
"Added module file `{0}' is an assembly. Consider using `-r' option to "
"Arquivo referenciado \"{0}\" não é um assembly. Considere, ao invés disso, "
"utilizar a opção \"-addmodule\""
-#: mcs/mcs/async.cs:70
+#: mcs/mcs/async.cs:72
#, fuzzy
msgid "The `await' operator cannot be used in the body of a lock statement"
msgstr ""
"O operador \"{0}\" não pode ser aplicado a um operando de tipo estático"
-#: mcs/mcs/async.cs:75
+#: mcs/mcs/async.cs:77
#, fuzzy
msgid "The `await' operator cannot be used in an unsafe context"
msgstr "O controle não pode deixar o corpo de uma cláusula final"
-#: mcs/mcs/async.cs:140
+#: mcs/mcs/async.cs:142
#, csharp-format
msgid ""
"Cannot await void method `{0}'. Consider changing method return type to "
"`Task'"
msgstr ""
-#: mcs/mcs/async.cs:143
+#: mcs/mcs/async.cs:145
#, csharp-format
msgid "Cannot await `{0}' expression"
msgstr ""
-#: mcs/mcs/async.cs:293
+#: mcs/mcs/async.cs:291
#, csharp-format
msgid ""
"The awaiter type `{0}' must have suitable IsCompleted and GetResult members"
msgstr ""
-#: mcs/mcs/async.cs:301
+#: mcs/mcs/async.cs:299
msgid ""
"The `await' operator may only be used in a query expression within the first "
"collection expression of the initial `from' clause or within the collection "
"expression of a `join' clause"
msgstr ""
-#: mcs/mcs/async.cs:335
+#: mcs/mcs/async.cs:333
#, csharp-format
msgid "The `await' operand type `{0}' must have suitable GetAwaiter method"
msgstr ""
-#: mcs/mcs/async.cs:374
+#: mcs/mcs/async.cs:372
#, fuzzy, csharp-format
msgid "The awaiter type `{0}' must implement interface `{1}'"
msgstr "\"{0}\" não implementa o membro da interface \"{1}\""
-#: mcs/mcs/async.cs:601
+#: mcs/mcs/async.cs:605
msgid ""
"Cannot find compiler required types for asynchronous functions support. Are "
"you targeting the wrong framework version?"
msgstr ""
-#: mcs/mcs/attribute.cs:222
+#: mcs/mcs/attribute.cs:228
#, csharp-format
msgid ""
"`{0}' is not a valid named attribute argument. Named attribute arguments "
"constantes ou possuir propriedades de leitura-escrita que são públicas e não "
"estáticas"
-#: mcs/mcs/attribute.cs:231
+#: mcs/mcs/attribute.cs:237
#, csharp-format
msgid ""
"`{0}' is not a valid named attribute argument because it is not a valid "
"\"{0}\" não é um atributo nomeado válida para um argumento de atributo por "
"quê não é um tipo de parâmetro de atributo válido"
-#: mcs/mcs/attribute.cs:237
+#: mcs/mcs/attribute.cs:243
#, fuzzy
msgid "An attribute argument cannot be dynamic expression"
msgstr "\"{0}\": um argumento de atributo não pode usar parâmetros de tipo"
-#: mcs/mcs/attribute.cs:242
+#: mcs/mcs/attribute.cs:248
msgid "The Guid attribute must be specified with the ComImport attribute"
msgstr "O atributo Guid deve ser especificado com o atributo ComImport"
-#: mcs/mcs/attribute.cs:247
+#: mcs/mcs/attribute.cs:253
#, csharp-format
msgid "Do not use `{0}' directly. Use parameter modifier `this' instead"
msgstr ""
"Não use \"{0}\" diretamente. Ao invés disso, use o modificador de parâmetro "
"\"this\""
-#: mcs/mcs/attribute.cs:252
+#: mcs/mcs/attribute.cs:258
#, fuzzy, csharp-format
msgid "Do not use `{0}' directly. Use `dynamic' keyword instead"
msgstr ""
"Não use \"{0}\" diretamente. Ao invés disso, use o modificador de parâmetro "
"\"this\""
-#: mcs/mcs/attribute.cs:261
+#: mcs/mcs/attribute.cs:267
#, csharp-format
msgid "Error during emitting `{0}' attribute. The reason is `{1}'"
msgstr "Erro enquanto emitia o atributo \"{0}\". O motivo é \"{1}\""
-#: mcs/mcs/attribute.cs:314
+#: mcs/mcs/attribute.cs:321
#, fuzzy, csharp-format
msgid ""
"`{0}' is ambiguous between `{1}' and `{2}'. Use either `@{0}' or `{0}"
"\"{0}\" está ambíguo entre \"{0}\" e \"{0}Atributo\". Utilize \"@{0}\" ou "
"\"{0}Atributo\""
-#: mcs/mcs/attribute.cs:336 mcs/mcs/attribute.cs:342
+#: mcs/mcs/attribute.cs:348 mcs/mcs/attribute.cs:354
#, csharp-format
msgid "`{0}': is not an attribute class"
msgstr "\"{0}\" não é uma classe de atributos"
-#: mcs/mcs/attribute.cs:434
+#: mcs/mcs/attribute.cs:446
#, csharp-format
msgid "Cannot apply attribute class `{0}' because it is abstract"
msgstr ""
"Não foi possível aplicar a classe de atributo \"{0}\" por que esta é abstrata"
-#: mcs/mcs/attribute.cs:505
+#: mcs/mcs/attribute.cs:517
#, fuzzy, csharp-format
msgid "Duplicate named attribute `{0}' argument"
msgstr "argumento de atributo nomeado \"{0}\" duplicado"
-#: mcs/mcs/attribute.cs:964
+#: mcs/mcs/attribute.cs:976
#, csharp-format
msgid ""
"The attribute `{0}' is not valid on this declaration type. It is valid on `"
"O atributo \"{0}\" não é válido neste tipo de declaração. Isso é válido "
"somente nas declarações \"{1}\""
-#: mcs/mcs/attribute.cs:986
+#: mcs/mcs/attribute.cs:998
#, csharp-format
msgid "The argument to the `{0}' attribute must be a valid identifier"
msgstr "O argumento para o atributo \"{0}\" deve ser um identificador válido"
-#: mcs/mcs/attribute.cs:1000
+#: mcs/mcs/attribute.cs:1012
#, fuzzy, csharp-format
msgid "Invalid value for argument to `{0}' attribute"
msgstr ""
"Valor inválido para o argumento para o atributo \"System.AttributeUsage\""
-#: mcs/mcs/attribute.cs:1252
+#: mcs/mcs/attribute.cs:1274
#, csharp-format
msgid "The attribute `{0}' cannot be applied multiple times"
msgstr "O atributo \"{0}\" não pode ser aplicado múltiplas vezes"
-#: mcs/mcs/attribute.cs:1552
+#: mcs/mcs/attribute.cs:1580
#, csharp-format
msgid "`{0}' is obsolete: `{1}'"
msgstr "\"{0}\" é obsoleto: \"{1}\""
"O modificador \"parcial\" pode ser utilizado somente imediatamente antesdas "
"palavras chave \"class\", \"struct\", \"interface\" ou \"void\""
-#: mcs/mcs/cs-tokenizer.cs:1470 mcs/mcs/cs-tokenizer.cs:1533
+#: mcs/mcs/cs-tokenizer.cs:1478 mcs/mcs/cs-tokenizer.cs:1541
msgid "Invalid number"
msgstr "Número inválido"
-#: mcs/mcs/cs-tokenizer.cs:1745
+#: mcs/mcs/cs-tokenizer.cs:1753
#, csharp-format
msgid "Unrecognized escape sequence `\\{0}'"
msgstr "Sequência de escape não reconhecida \"\\{0}\""
-#: mcs/mcs/cs-tokenizer.cs:1764
+#: mcs/mcs/cs-tokenizer.cs:1772
msgid "Unrecognized escape sequence"
msgstr "Sequência de escape não reconhecida"
-#: mcs/mcs/cs-tokenizer.cs:2034
+#: mcs/mcs/cs-tokenizer.cs:2041
#, fuzzy
msgid "Filename, single-line comment or end-of-line expected"
msgstr "Comentário de linha única ou fim-de-linha esperado"
-#: mcs/mcs/cs-tokenizer.cs:2084
+#: mcs/mcs/cs-tokenizer.cs:2090
msgid "Missing identifier to pre-processor directive"
msgstr "Identificador faltando para a diretiva do pré-processador"
-#: mcs/mcs/cs-tokenizer.cs:2094 mcs/mcs/cs-tokenizer.cs:2098
+#: mcs/mcs/cs-tokenizer.cs:2100 mcs/mcs/cs-tokenizer.cs:2104
#, csharp-format
msgid "Identifier expected: {0}"
msgstr "Identificador esperado: {0}"
-#: mcs/mcs/cs-tokenizer.cs:2587
+#: mcs/mcs/cs-tokenizer.cs:2610
#, fuzzy
msgid "Integral constant is too large"
msgstr "Constante numérica muito longa"
-#: mcs/mcs/cs-tokenizer.cs:2592
+#: mcs/mcs/cs-tokenizer.cs:2615
msgid "Invalid preprocessor directive"
msgstr "Diretiva de pré-processador inválida"
-#: mcs/mcs/cs-tokenizer.cs:2599
+#: mcs/mcs/cs-tokenizer.cs:2622
#, csharp-format
msgid "Unexpected processor directive ({0})"
msgstr "Diretiva de processador inesperada ({0})"
-#: mcs/mcs/cs-tokenizer.cs:2605
+#: mcs/mcs/cs-tokenizer.cs:2628
msgid ""
"Cannot define or undefine preprocessor symbols after first token in file"
msgstr ""
"Não foi possível definir ou indefinir símbolos depois do primeiro token no "
"arquivo"
-#: mcs/mcs/cs-tokenizer.cs:2611
+#: mcs/mcs/cs-tokenizer.cs:2634
msgid ""
"Preprocessor directives must appear as the first non-whitespace character on "
"a line"
"Diretivas de pré-processador devem aparecer como o primeiro caractere não-"
"branco na linha"
-#: mcs/mcs/cs-tokenizer.cs:2616
+#: mcs/mcs/cs-tokenizer.cs:2639
msgid "Single-line comment or end-of-line expected"
msgstr "Comentário de linha única ou fim-de-linha esperado"
-#: mcs/mcs/cs-tokenizer.cs:2661 mcs/mcs/cs-tokenizer.cs:3679
+#: mcs/mcs/cs-tokenizer.cs:2684 mcs/mcs/cs-tokenizer.cs:3719
msgid "Expected `#endif' directive"
msgstr "Esperada diretiva \"#endif\""
-#: mcs/mcs/cs-tokenizer.cs:2694 mcs/mcs/cs-tokenizer.cs:2715
-#: mcs/mcs/cs-tokenizer.cs:2746 mcs/mcs/cs-tokenizer.cs:3677
+#: mcs/mcs/cs-tokenizer.cs:2717 mcs/mcs/cs-tokenizer.cs:2738
+#: mcs/mcs/cs-tokenizer.cs:2769 mcs/mcs/cs-tokenizer.cs:3717
msgid "#endregion directive expected"
msgstr "diretiva #endregion esperada"
-#: mcs/mcs/cs-tokenizer.cs:2793
+#: mcs/mcs/cs-tokenizer.cs:2816
msgid "Wrong preprocessor directive"
msgstr "Diretiva do pré-processador incorreta"
-#: mcs/mcs/cs-tokenizer.cs:2805
+#: mcs/mcs/cs-tokenizer.cs:2828
#, csharp-format
msgid "#error: '{0}'"
msgstr "#erro: \"{0}\""
-#: mcs/mcs/cs-tokenizer.cs:2823
+#: mcs/mcs/cs-tokenizer.cs:2846
msgid "The line number specified for #line directive is missing or invalid"
msgstr ""
"O número da linha especificada para a diretiva #line está faltando ou está "
"inválida"
-#: mcs/mcs/cs-tokenizer.cs:2876 mcs/mcs/cs-tokenizer.cs:3514
+#: mcs/mcs/cs-tokenizer.cs:2908 mcs/mcs/cs-tokenizer.cs:3554
msgid "Newline in constant"
msgstr "Quebra de linha em constante"
-#: mcs/mcs/cs-tokenizer.cs:2893
+#: mcs/mcs/cs-tokenizer.cs:2934
msgid "Unterminated string literal"
msgstr "Literal de string não terminada"
-#: mcs/mcs/cs-tokenizer.cs:2968
+#: mcs/mcs/cs-tokenizer.cs:3011
msgid "Identifier too long (limit is 512 chars)"
msgstr "Identificador muito longo (o limite é 512 caracteres)"
-#: mcs/mcs/cs-tokenizer.cs:3354
+#: mcs/mcs/cs-tokenizer.cs:3394
msgid "End-of-file found, '*/' expected"
msgstr "Fim de arquivo encontrado, \"*/\" esperado"
-#: mcs/mcs/cs-tokenizer.cs:3463
+#: mcs/mcs/cs-tokenizer.cs:3503
msgid "Keyword, identifier, or string expected after verbatim specifier: @"
msgstr ""
"Palavra-chave, identificador ou string esperado depois do especificador "
"verbatim: @"
-#: mcs/mcs/cs-tokenizer.cs:3484
+#: mcs/mcs/cs-tokenizer.cs:3524
#, fuzzy, csharp-format
msgid "Unexpected character `{0}'"
msgstr "Experado \"{0}\""
-#: mcs/mcs/cs-tokenizer.cs:3509
+#: mcs/mcs/cs-tokenizer.cs:3549
msgid "Empty character literal"
msgstr ""
-#: mcs/mcs/cs-tokenizer.cs:3530
+#: mcs/mcs/cs-tokenizer.cs:3570
msgid "Too many characters in character literal"
msgstr ""
"Está faltando o modificador parcial na declaração do tipo \"{0}\". Outra "
"declaração parcial deste tipo existe"
-#: mcs/mcs/class.cs:713
+#: mcs/mcs/class.cs:734
#, csharp-format
msgid ""
"`{0}': explicit interface declaration can only be declared in a class or "
"\"{0}\": declaração explícita de interface pode apenas ser declarada em uma "
"classe ou struct"
-#: mcs/mcs/class.cs:772
+#: mcs/mcs/class.cs:793
#, csharp-format
msgid "Duplicate type parameter `{0}'"
msgstr "Tipo de parâmetro duplicado \"{0}\""
-#: mcs/mcs/class.cs:775
+#: mcs/mcs/class.cs:796
#, csharp-format
msgid "The type `{0}' already contains a definition for `{1}'"
msgstr "O tipo \"{0}\" já contém uma definição para \"{1}\""
-#: mcs/mcs/class.cs:841
+#: mcs/mcs/class.cs:862
msgid ""
"Cannot specify the `DefaultMember' attribute on type containing an indexer"
msgstr ""
"Não foi possível especificar o atributo \"DefaultMember\" no tipo contendo "
"um indexador"
-#: mcs/mcs/class.cs:846
+#: mcs/mcs/class.cs:867
msgid "The RequiredAttribute attribute is not permitted on C# types"
msgstr "O atributo RequiredAttribute não é permitido em tipos de C#"
-#: mcs/mcs/class.cs:1069
+#: mcs/mcs/class.cs:1093
#, fuzzy, csharp-format
msgid "Class `{0}' cannot derive from the dynamic type"
msgstr "\"{0}\": não foi possível declarar variáveis de tipo estático"
-#: mcs/mcs/class.cs:1086
+#: mcs/mcs/class.cs:1110
#, csharp-format
msgid "`{0}' is already listed in interface list"
msgstr "\"{0}\" já está listado na lista de interfaces"
-#: mcs/mcs/class.cs:1094
+#: mcs/mcs/class.cs:1118
#, csharp-format
msgid ""
"Inconsistent accessibility: base interface `{0}' is less accessible than "
"Acessibilidade inconsistente: interface base \"{0}\" é menos acessível que a "
"interface \"{1}\""
-#: mcs/mcs/class.cs:1100
+#: mcs/mcs/class.cs:1124
#, csharp-format
msgid "Type `{0}' in interface list is not an interface"
msgstr "Tipo \"{0}\" na lista de interfaces não é uma interface"
-#: mcs/mcs/class.cs:1102
+#: mcs/mcs/class.cs:1126
#, csharp-format
msgid "`{0}': Classes cannot have multiple base classes (`{1}' and `{2}')"
msgstr ""
"\"{0}\": Classes não podem ter múltiplas classes base (\"{1}\" e \"{2}\")"
-#: mcs/mcs/class.cs:1105
+#: mcs/mcs/class.cs:1129
#, csharp-format
msgid "`{0}': Base class `{1}' must be specified as first"
msgstr "\"{0}\": Classe base \"{1}\" deve ser especificada como primeira"
-#: mcs/mcs/class.cs:1166
+#: mcs/mcs/class.cs:1190
#, csharp-format
msgid ""
"The operator `{0}' requires a matching operator `{1}' to also be defined"
"O operador `{0}' necessita um operador correspondente \"{1}\" para também "
"ser definido"
-#: mcs/mcs/class.cs:1397
+#: mcs/mcs/class.cs:1421
#, csharp-format
msgid "Partial declarations of `{0}' must not specify different base classes"
msgstr ""
"Declarações parciais de \"{0}\" não devem especificar diferentes classes base"
-#: mcs/mcs/class.cs:1441
+#: mcs/mcs/class.cs:1465
#, csharp-format
msgid ""
"Inherited interface `{0}' causes a cycle in the interface hierarchy of `{1}'"
"Interface herdada \"{0}\" causa um ciclo na hierarquia de interfaces de "
"\"{1}\""
-#: mcs/mcs/class.cs:1447
+#: mcs/mcs/class.cs:1471
#, csharp-format
msgid "Circular base class dependency involving `{0}' and `{1}'"
msgstr "Dependência circular na classe base envolvendo \"{0}\" e \"{1}\""
-#: mcs/mcs/class.cs:1593
+#: mcs/mcs/class.cs:1617
#, csharp-format
msgid ""
"Partial declarations of `{0}' have inconsistent constraints for type "
"Declarações parciais \"{0}\" possuem restrições inconsistentes para o tipo "
"de parâmetro \"{1}\""
-#: mcs/mcs/class.cs:1702
+#: mcs/mcs/class.cs:1726
#, fuzzy, csharp-format
msgid "`{0}': cannot implement a dynamic interface `{1}'"
msgstr "\"{0}\": tipo contendo não implementa interface \"{1}\""
-#: mcs/mcs/class.cs:1718
+#: mcs/mcs/class.cs:1742
#, csharp-format
msgid ""
"`{0}' cannot implement both `{1}' and `{2}' because they may unify for some "
"\"{0}\" não pode implementar ambos \"{1}\" e \"{2}\" por que estes devem "
"unificar para alguma substituição de tipo de parâmetro"
-#: mcs/mcs/class.cs:1737
+#: mcs/mcs/class.cs:1761
#, csharp-format
msgid ""
"A generic type cannot derive from `{0}' because it is an attribute class"
msgstr ""
"Um tipo genérico não pode derivar de \"{0}\" por que é uma classe de atributo"
-#: mcs/mcs/class.cs:1839
+#: mcs/mcs/class.cs:1870
msgid ""
"Two indexers have different names; the IndexerName attribute must be used "
"with the same name on every indexer within a type"
"Dois indexadores tem nomes diferentes; o atributo IndexerName deve ser "
"utilizado com o mesmo nome em todo indexador de um tipo"
-#: mcs/mcs/class.cs:2089
+#: mcs/mcs/class.cs:2120
#, csharp-format
msgid "A static member `{0}' cannot be marked as override, virtual or abstract"
msgstr ""
"Um membro estático \"{0}\" não pode ser marcado como sobrescrito, virtual ou "
"abstrato"
-#: mcs/mcs/class.cs:2096
+#: mcs/mcs/class.cs:2127
#, csharp-format
msgid "A member `{0}' marked as override cannot be marked as new or virtual"
msgstr ""
"Um membro \"{0}\" marcado como sobrescrito não pode ser marcado como novo ou "
"virtual"
-#: mcs/mcs/class.cs:2108
+#: mcs/mcs/class.cs:2139
#, csharp-format
msgid "`{0}' cannot be both extern and abstract"
msgstr "\"{0}\" não pode ser externo e abstrato ao mesmo tempo"
-#: mcs/mcs/class.cs:2113
+#: mcs/mcs/class.cs:2144
#, csharp-format
msgid "`{0}' cannot be both abstract and sealed"
msgstr "\"{0}\" não pode ser abstrato e selado"
-#: mcs/mcs/class.cs:2118
+#: mcs/mcs/class.cs:2149
#, csharp-format
msgid "The abstract method `{0}' cannot be marked virtual"
msgstr "O método abstrato \"{0}\" não pode ser marcado como virtual"
-#: mcs/mcs/class.cs:2124
+#: mcs/mcs/class.cs:2155
#, csharp-format
msgid "`{0}' is abstract but it is declared in the non-abstract class `{1}'"
msgstr "\"{0}\" é abstrato mas está declarado na classe não-abstrata \"{1}\""
-#: mcs/mcs/class.cs:2132
+#: mcs/mcs/class.cs:2163
#, csharp-format
msgid "`{0}': virtual or abstract members cannot be private"
msgstr "\"{0}\": membros virtuais ou abstratos não podem ser privados"
-#: mcs/mcs/class.cs:2139
+#: mcs/mcs/class.cs:2170
#, csharp-format
msgid "`{0}' cannot be sealed because it is not an override"
msgstr "\"{0}\" não pode ser selado por que não é um sobrescrito"
-#: mcs/mcs/class.cs:2179
+#: mcs/mcs/class.cs:2210
#, csharp-format
msgid "`{0}': containing type does not implement interface `{1}'"
msgstr "\"{0}\": tipo contendo não implementa interface \"{1}\""
-#: mcs/mcs/class.cs:2369
+#: mcs/mcs/class.cs:2400
#, csharp-format
msgid "Type parameter `{0}' has same name as containing type, or method"
msgstr ""
"Parâmetro de tipo \"{0}\" tem o mesmo nome que o tipo contendo, ou método"
-#: mcs/mcs/class.cs:2377
+#: mcs/mcs/class.cs:2408
#, csharp-format
msgid "`{0}': member names cannot be the same as their enclosing type"
msgstr ""
"\"{0}\": nomes de membros não podem ser os mesmos que seus tipos de "
"fechamento"
-#: mcs/mcs/class.cs:2496
+#: mcs/mcs/class.cs:2527
msgid ""
"The class System.Object cannot have a base class or implement an interface."
msgstr ""
"A classe System.Object não pode ter uma classe base ou implementar uma "
"interface."
-#: mcs/mcs/class.cs:2505
+#: mcs/mcs/class.cs:2536
#, csharp-format
msgid "Attribute `{0}' is only valid on classes derived from System.Attribute"
msgstr ""
"Atributo \"{0}\" é válido somente em classes derivadas de System.Attribute"
-#: mcs/mcs/class.cs:2510
+#: mcs/mcs/class.cs:2541
msgid ""
"Attribute `System.Diagnostics.ConditionalAttribute' is only valid on methods "
"or attribute classes"
"Atributo \"System.Diagnostics.ConditionalAttribute\" é somente válido em "
"métodos ou classes de atributos"
-#: mcs/mcs/class.cs:2539
+#: mcs/mcs/class.cs:2570
#, csharp-format
msgid "`{0}': an abstract class cannot be sealed or static"
msgstr "\"{0}\": uma classe abstrata não pode ser selada ou estática"
-#: mcs/mcs/class.cs:2543
+#: mcs/mcs/class.cs:2574
#, csharp-format
msgid "`{0}': a class cannot be both static and sealed"
msgstr "\"{0}\": uma classe não pode ser estática e selada ao mesmo tempo"
-#: mcs/mcs/class.cs:2549
+#: mcs/mcs/class.cs:2580
#, csharp-format
msgid "`{0}': Static classes cannot contain user-defined operators"
msgstr ""
"\"{0}\": Classes estáticas não podem conter operadores definidos pelo usuário"
-#: mcs/mcs/class.cs:2554
+#: mcs/mcs/class.cs:2585
#, csharp-format
msgid "`{0}': Static classes cannot contain destructor"
msgstr "\"{0}\": Classes estáticas não podem conter um destrutor"
-#: mcs/mcs/class.cs:2559
+#: mcs/mcs/class.cs:2590
#, csharp-format
msgid "`{0}': cannot declare indexers in a static class"
msgstr "\"{0}\": não é possível declarar indexadores como uma classe estática"
-#: mcs/mcs/class.cs:2567
+#: mcs/mcs/class.cs:2598
#, csharp-format
msgid "`{0}': Static classes cannot have instance constructors"
msgstr "\"{0}\": Classes estáticas não podem ter construtores de instâncias"
-#: mcs/mcs/class.cs:2571
+#: mcs/mcs/class.cs:2602
#, csharp-format
msgid "`{0}': cannot declare instance members in a static class"
msgstr ""
"\"{0}\": não foi possível declarar membros de instâncias em uma classe "
"estática"
-#: mcs/mcs/class.cs:2602
+#: mcs/mcs/class.cs:2633
#, fuzzy, csharp-format
msgid "`{0}': Cannot derive from type parameter `{1}'"
msgstr "\"{0}\": Não foi possível derivar da classe estática \"{1}\""
-#: mcs/mcs/class.cs:2606
+#: mcs/mcs/class.cs:2637
#, csharp-format
msgid "`{0}': Cannot derive from static class `{1}'"
msgstr "\"{0}\": Não foi possível derivar da classe estática \"{1}\""
-#: mcs/mcs/class.cs:2610
+#: mcs/mcs/class.cs:2641
#, fuzzy, csharp-format
msgid "`{0}': cannot derive from sealed type `{1}'"
msgstr "\"{0}\": não foi possível derivar da classe selada \"{1}\""
-#: mcs/mcs/class.cs:2613
+#: mcs/mcs/class.cs:2644
#, csharp-format
msgid ""
"Static class `{0}' cannot derive from type `{1}'. Static classes must derive "
"Classe estática \"{0}\" não pode derivar do tipo \"{1}\". Classes estáticas "
"devem derivar de objetos"
-#: mcs/mcs/class.cs:2624
+#: mcs/mcs/class.cs:2655
#, csharp-format
msgid "`{0}' cannot derive from special class `{1}'"
msgstr "\"{0}\" não foi possível derivar da classe especial \"{1}\""
-#: mcs/mcs/class.cs:2634
+#: mcs/mcs/class.cs:2665
#, csharp-format
msgid ""
"Inconsistent accessibility: base class `{0}' is less accessible than class `"
"Acessibilidade inconsistente: classe base \"{0}\" é menos acessível que a "
"classe \"{1}\""
-#: mcs/mcs/class.cs:2642
+#: mcs/mcs/class.cs:2673
#, csharp-format
msgid "Static class `{0}' cannot implement interfaces"
msgstr "Classe estática \"{0}\" não pode implementar interfaces"
-#: mcs/mcs/class.cs:2753 mcs/mcs/class.cs:2767
+#: mcs/mcs/class.cs:2784 mcs/mcs/class.cs:2798
#, csharp-format
msgid "Struct member `{0}' of type `{1}' causes a cycle in the struct layout"
msgstr ""
"Membro da estrutura \"{0}\" do tipo \"{1}\" causou um ciclo na disposição de "
"structs"
-#: mcs/mcs/class.cs:2849
+#: mcs/mcs/class.cs:2880
#, csharp-format
msgid "`{0}': Structs cannot have instance field initializers"
msgstr "\"{0}\": Structs não podem ter inicializadores de campos de instância"
-#: mcs/mcs/class.cs:3037
+#: mcs/mcs/class.cs:3068
#, fuzzy, csharp-format
msgid "Do not override `{0}'. Use destructor syntax instead"
msgstr ""
"Não use \"{0}\" diretamente. Ao invés disso, use o modificador de parâmetro "
"\"this\""
-#: mcs/mcs/class.cs:3040
+#: mcs/mcs/class.cs:3071
#, csharp-format
msgid "`{0}' is marked as an override but no suitable {1} found to override"
msgstr ""
"\"{0}\" está marcado como uma sobrescrita mas nenhuma {1} foi encontrada "
"para substituir"
-#: mcs/mcs/class.cs:3046
+#: mcs/mcs/class.cs:3077
#, csharp-format
msgid "`{0}': cannot override because `{1}' is not an event"
msgstr "\"{0}\": não foi possível sobrescrever pois \"{1}\" não é um evento"
-#: mcs/mcs/class.cs:3049
+#: mcs/mcs/class.cs:3080
#, csharp-format
msgid "`{0}': cannot override because `{1}' is not a property"
msgstr ""
"\"{0}\": não foi possível sobrescrever pois \"{1}\" não é uma propriedade"
-#: mcs/mcs/class.cs:3052
+#: mcs/mcs/class.cs:3083
#, csharp-format
msgid "`{0}': cannot override because `{1}' is not a method"
msgstr "\"{0}\": não foi possível sobrescrever pois \"{1}\" não é um método"
-#: mcs/mcs/class.cs:3071
+#: mcs/mcs/class.cs:3102
#, fuzzy, csharp-format
msgid ""
"`{0}' cannot override inherited members `{1}' and `{2}' because they have "
"\"{0}\": não foi possível sobrescrever membro herdado \"{1}\" por que está "
"selado"
-#: mcs/mcs/class.cs:3124 mcs/mcs/field.cs:198
+#: mcs/mcs/class.cs:3155 mcs/mcs/field.cs:198
#, csharp-format
msgid "`{0}' hides inherited abstract member `{1}'"
msgstr "\"{0}\" esconde membro abstrato herdado \"{1}\""
-#: mcs/mcs/class.cs:3148
+#: mcs/mcs/class.cs:3179
#, csharp-format
msgid ""
"`{0}': cannot override inherited member `{1}' because it is not marked "
"\"{0}\": não foi possível sobrescrever membro herdado \"{1}\" porque este "
"não está marcado como virtual, abstrato ou substituto"
-#: mcs/mcs/class.cs:3156
+#: mcs/mcs/class.cs:3187
#, csharp-format
msgid "`{0}': cannot override inherited member `{1}' because it is sealed"
msgstr ""
"\"{0}\": não foi possível sobrescrever membro herdado \"{1}\" por que está "
"selado"
-#: mcs/mcs/class.cs:3165
+#: mcs/mcs/class.cs:3196
#, csharp-format
msgid "`{0}': type must be `{1}' to match overridden member `{2}'"
msgstr ""
"\"{0}\": o tipo deve ser \"{1}\" para corresponder com o membro da "
"substituição \"{2}\""
-#: mcs/mcs/class.cs:3168
+#: mcs/mcs/class.cs:3199
#, csharp-format
msgid "`{0}': return type must be `{1}' to match overridden member `{2}'"
msgstr ""
"\"{0}\": tipo de retorno deve ser \"{1}\" para corresponder com o membro da "
"substituição \"{2}\""
-#: mcs/mcs/class.cs:3236
+#: mcs/mcs/class.cs:3267
#, csharp-format
msgid "A partial method `{0}' cannot explicitly implement an interface"
msgstr ""
"Um método parcial \"{0}\" não pode implementar uma interface explicitamente"
-#: mcs/mcs/class.cs:3242
+#: mcs/mcs/class.cs:3273
#, fuzzy, csharp-format
msgid "The type `{0}' in explicit interface declaration is not an interface"
msgstr "\"{0}\" na declaração explícita da interface não é uma interface"
-#: mcs/mcs/class.cs:3273
+#: mcs/mcs/class.cs:3304
#, csharp-format
msgid ""
"Inconsistent accessibility: parameter type `{0}' is less accessible than "
"Acessibilidade inconsistente: tipo de parâmetro \"{0}\" é menos acessível "
"que o indexador \"{1}\""
-#: mcs/mcs/class.cs:3277
+#: mcs/mcs/class.cs:3308
#, csharp-format
msgid ""
"Inconsistent accessibility: parameter type `{0}' is less accessible than "
"Acessibilidade inconsistente: tipo de parâmetro \"{0}\" é menos acessível "
"que o operador \"{1}\""
-#: mcs/mcs/class.cs:3281
+#: mcs/mcs/class.cs:3312
#, csharp-format
msgid ""
"Inconsistent accessibility: parameter type `{0}' is less accessible than "
"Acessibilidade inconsistente: tipo de parâmetro \"{0}\" é menos acessível "
"que o método \"{1}\""
-#: mcs/mcs/class.cs:3341
+#: mcs/mcs/class.cs:3372
#, csharp-format
msgid ""
"`{0}': cannot change access modifiers when overriding `{1}' inherited member "
"\"{0}\": não foi possível alterar modificadores de acesso ao substituir "
"\"{1}\" membro herdado \"{2}\""
-#: mcs/mcs/class.cs:3350
+#: mcs/mcs/class.cs:3381
#, fuzzy, csharp-format
msgid "`{0}': static types cannot be used as return types"
msgstr "\"{0}\": tipos estáticos não podem ser utilizados como parâmetros"
-#: mcs/mcs/class.cs:3463
+#: mcs/mcs/class.cs:3442
+#, fuzzy, csharp-format
+msgid ""
+"`{0}': Cannot specify constraints for overrides and explicit interface "
+"implementation methods"
+msgstr ""
+"\"{0}\": Não foi possível especificar restrições para sobrescritos ou "
+"métodos de implementação explícitos de interface"
+
+#: mcs/mcs/class.cs:3504
#, csharp-format
msgid "New virtual member `{0}' is declared in a sealed class `{1}'"
msgstr "Novo membro virtual \"{0}\" é declarado em uma classe selada \"{1}\""
-#: mcs/mcs/class.cs:3478
+#: mcs/mcs/class.cs:3519
msgid "Inconsistent accessibility: property type `"
msgstr "Acessibilidade inconsistente: tipo da propriedade \""
-#: mcs/mcs/class.cs:3483
+#: mcs/mcs/class.cs:3524
msgid "Inconsistent accessibility: indexer return type `"
msgstr "Acessibilidade inconsistente: tipo de retorno do indexador \""
-#: mcs/mcs/class.cs:3489 mcs/mcs/class.cs:3494 mcs/mcs/delegate.cs:171
+#: mcs/mcs/class.cs:3530 mcs/mcs/class.cs:3535 mcs/mcs/delegate.cs:171
msgid "Inconsistent accessibility: return type `"
msgstr "Acessibilidade inconsistente: tipo de retorno \""
-#: mcs/mcs/class.cs:3499
+#: mcs/mcs/class.cs:3540
msgid "Inconsistent accessibility: field type `"
msgstr "Acessibilidade inconsistente: tipo de campo \""
-#: mcs/mcs/class.cs:3511
+#: mcs/mcs/class.cs:3552
#, csharp-format
msgid ""
"Parameters or local variables of type `{0}' cannot be declared in async "
"methods or iterators"
msgstr ""
-#: mcs/mcs/class.cs:3515
+#: mcs/mcs/class.cs:3556
#, fuzzy, csharp-format
msgid ""
"Local variables of type `{0}' cannot be used inside anonymous methods, "
"A variável local ou parâmetro \"{0}\" não pode ter seu endereço obtido e ser "
"utilizado dentro de um método anônimo ou expressão lambda"
-#: mcs/mcs/class.cs:3519
+#: mcs/mcs/class.cs:3560
#, csharp-format
msgid "Field or property cannot be of type `{0}'"
msgstr "Campo ou propriedade não podem ser do tipo \"{0}\""
msgstr ""
"O cálculo do valor constante para \"{0}\" involve uma definição circular"
-#: mcs/mcs/constant.cs:66 mcs/mcs/constant.cs:392
+#: mcs/mcs/constant.cs:66 mcs/mcs/constant.cs:403
#, csharp-format
msgid "Constant value `{0}' cannot be converted to a `{1}'"
msgstr "Valor constante \"{0}\" não pode ser convertido para um \"{1}\""
-#: mcs/mcs/constant.cs:264
+#: mcs/mcs/constant.cs:266
#, csharp-format
msgid ""
"Constant value `{0}' cannot be converted to a `{1}' (use `unchecked' syntax "
"Valor constante \"{0}\" não pode ser convertido para um \"{1}\" (use a "
"sintaxe \"unchecked\" para sobrescrever)"
-#: mcs/mcs/convert.cs:1184
+#: mcs/mcs/convert.cs:1185
#, csharp-format
msgid ""
"Ambiguous user defined operators `{0}' and `{1}' when converting from `{2}' "
"Método de extensão \"{0}\" de tipo de valor \"{1}\" não pode ser utilizado "
"para criar delegates"
-#: mcs/mcs/delegate.cs:532
+#: mcs/mcs/delegate.cs:535
#, csharp-format
msgid "Cannot create delegate from partial method declaration `{0}'"
msgstr ""
"Não foi possível criar delegate da declaração de método parcial \"{0}\""
-#: mcs/mcs/delegate.cs:535
+#: mcs/mcs/delegate.cs:538
#, csharp-format
msgid ""
"Cannot create delegate with `{0}' because it has a Conditional attribute"
"Não foi possível criar delegate com \"{0}\" porque este contém um atributo "
"Conditional"
-#: mcs/mcs/delegate.cs:578
+#: mcs/mcs/delegate.cs:581
#, csharp-format
msgid ""
"A method or delegate `{0} {1}' parameters and return type must be same as "
"devem ser os mesmos dos parâmetros do delegate \"{2} {3}\" e dos tipos de "
"retorno"
-#: mcs/mcs/delegate.cs:585
+#: mcs/mcs/delegate.cs:588
#, csharp-format
msgid ""
"A method or delegate `{0}' parameters do not match delegate `{1}' parameters"
"Os parâmetros do método ou do delegate \"{0}\" não coincidem com os "
"parâmetros do delegate \"{1}\""
-#: mcs/mcs/delegate.cs:590
+#: mcs/mcs/delegate.cs:593
#, csharp-format
msgid ""
"A method or delegate `{0} {1}' return type does not match delegate `{2} {3}' "
"Os tipos de retorno do método o do delegate \"{0} {1}\" não coincidem com o "
"tipo de retorno do delegate \"{2} {3}\""
-#: mcs/mcs/delegate.cs:673
+#: mcs/mcs/delegate.cs:676
msgid "Method name expected"
msgstr "Nome do método esperado"
-#: mcs/mcs/doc.cs:613
+#: mcs/mcs/doc.cs:621
#, csharp-format
msgid "Error generating XML documentation file `{0}' (`{1}')"
msgstr "Erro ao gerar arquivo de documentação XML \"{0}\" (\"{1}\")"
-#: mcs/mcs/driver.cs:51
+#: mcs/mcs/driver.cs:52
msgid "Source file `"
msgstr "Arquivo fonte \""
-#: mcs/mcs/driver.cs:96
-#, csharp-format
-msgid "Source file `{0}' could not be found"
-msgstr "Arquivo fonte \"{0}\" não pôde ser encontrado"
-
-#: mcs/mcs/driver.cs:103
-#, csharp-format
-msgid "Source file `{0}' is a binary file and not a text file"
-msgstr "Arquivo fonte \"{0}\" é um arquivo binário e não um arquivo texto"
-
-#: mcs/mcs/driver.cs:210
+#: mcs/mcs/driver.cs:258
msgid "No files to compile were specified"
msgstr "Nenhum arquivo para compilar foi especificado"
-#: mcs/mcs/driver.cs:215
+#: mcs/mcs/driver.cs:263
msgid "Platform option `anycpu32bitpreferred' is valid only for executables"
msgstr ""
-#: mcs/mcs/driver.cs:245
+#: mcs/mcs/driver.cs:293
msgid ""
"If no source files are specified you must specify the output file with -out:"
msgstr ""
"Se nenhum código fonte for especificado você deve especificar o arquivo de "
"saída com -out:"
-#: mcs/mcs/driver.cs:262
+#: mcs/mcs/driver.cs:310
msgid "Output file name is not valid"
msgstr ""
msgstr "\"{0}\" não contém uma definição para \"{1}\""
#: mcs/mcs/ecore.cs:328
-#, csharp-format
-msgid ""
-"Members of value type `{0}' cannot be assigned using a property `{1}' object "
-"initializer"
-msgstr ""
-"Membros do tipo de valor \"{0}\" não podem ser atribuidos usando uma "
-"propriedade \"{1}\" inicializadora de objeto"
-
-#: mcs/mcs/ecore.cs:331
-#, csharp-format
-msgid ""
-"Cannot modify a value type return value of `{0}'. Consider storing the value "
-"in a temporary variable"
-msgstr ""
-"Não foi possível modificar o valor do retorno do tipo de valor de \"{0}\". "
-"Considere guardar o valor em uma variável temporária"
-
-#: mcs/mcs/ecore.cs:335
msgid ""
"The left-hand side of an assignment must be a variable, a property or an "
"indexer"
"O lado esquerdo de uma atribuição deve ser uma variável, uma propriedade ou "
"um indexador"
-#: mcs/mcs/ecore.cs:341
+#: mcs/mcs/ecore.cs:334
msgid "The operation in question is undefined on void pointers"
msgstr ""
-#: mcs/mcs/ecore.cs:408 mcs/mcs/statement.cs:3001 mcs/mcs/statement.cs:3003
+#: mcs/mcs/ecore.cs:422 mcs/mcs/statement.cs:3038 mcs/mcs/statement.cs:3040
#, csharp-format
msgid "Internal compiler error: {0}"
msgstr ""
-#: mcs/mcs/ecore.cs:448
+#: mcs/mcs/ecore.cs:462
msgid "A ref or out argument must be an assignable variable"
msgstr "Um argumento ref ou out deve ser uma variável atribuível"
-#: mcs/mcs/ecore.cs:467
+#: mcs/mcs/ecore.cs:481
msgid ""
"An attribute argument must be a constant expression, typeof expression or "
"array creation expression"
"Um argumento de atributo deve ser uma expressão constante, typeof ou "
"expressão de criação de array"
-#: mcs/mcs/ecore.cs:641
+#: mcs/mcs/ecore.cs:655
#, csharp-format
msgid "The class `{0}' has no constructors defined"
msgstr ""
-#: mcs/mcs/ecore.cs:763
+#: mcs/mcs/ecore.cs:777
#, csharp-format
msgid "The `{0}' operator cannot be applied to operand of type `{1}'"
msgstr "O operador \"{0}\" não pode ser aplicado ao operando de tipo \"{1}\""
-#: mcs/mcs/ecore.cs:769
+#: mcs/mcs/ecore.cs:783
msgid "An expression tree cannot contain an unsafe pointer operation"
msgstr ""
"Uma árvore de expressão não pode conter uma operação de ponteiro insegura"
-#: mcs/mcs/ecore.cs:847
+#: mcs/mcs/ecore.cs:861
#, csharp-format
msgid "`{0}' is a `{1}' but a `{2}' was expected"
msgstr "\"{0}\" é um \"{1}\" mas um \"{2}\" era esperado"
-#: mcs/mcs/ecore.cs:880
+#: mcs/mcs/ecore.cs:894
#, csharp-format
msgid "Expression denotes a `{0}', where a `{1}' was expected"
msgstr "A expressão denota um \"{0}\", onde um \"{1}\" era esperado"
-#: mcs/mcs/ecore.cs:890
+#: mcs/mcs/ecore.cs:904
msgid "Pointers and fixed size buffers may only be used in an unsafe context"
msgstr ""
"Ponteiros e buffers de tamanho fixo devem apenas ser utilizados num contexto "
"inseguro"
-#: mcs/mcs/ecore.cs:2323
+#: mcs/mcs/ecore.cs:2364
#, fuzzy, csharp-format
msgid ""
"Dynamic keyword requires `{0}' to be defined. Are you missing System.Core."
"O tipo ou nome de namespace \"{0}\" não pôde ser encontrado. Você está "
"esquecendo de uma diretiva em uso ou uma referência do assembly?"
-#: mcs/mcs/ecore.cs:2399
+#: mcs/mcs/ecore.cs:2440
#, fuzzy, csharp-format
msgid ""
"A local variable `{0}' cannot be used before it is declared. Consider "
"A variável local \"{0}\" não pode ser utilizada antes de ser declarada. "
"Considere renomear a variável local quando esta esconder o campo \"{1}\""
-#: mcs/mcs/ecore.cs:2414 mcs/mcs/ecore.cs:2457
+#: mcs/mcs/ecore.cs:2455 mcs/mcs/ecore.cs:2498
#, csharp-format
msgid "`{0}' conflicts with a declaration in a child block"
msgstr "\"{0}\" conflita com uma declaração em um bloco filho"
-#: mcs/mcs/ecore.cs:2466
+#: mcs/mcs/ecore.cs:2507
#, csharp-format
msgid "A local variable `{0}' cannot be used before it is declared"
msgstr ""
"Uma variável local \"{0}\" não pode ser utilizada antes de ser declarada"
-#: mcs/mcs/ecore.cs:2520
+#: mcs/mcs/ecore.cs:2561
#, csharp-format
msgid "The name `{0}' does not exist in the current context"
msgstr "O nome \"{0}\" não existe no contexto atual"
-#: mcs/mcs/ecore.cs:2616
+#: mcs/mcs/ecore.cs:2657
msgid "System.Void cannot be used from C#. Consider using `void'"
msgstr ""
-#: mcs/mcs/ecore.cs:2900
+#: mcs/mcs/ecore.cs:2941
#, csharp-format
msgid "Cannot call an abstract base member `{0}'"
msgstr "Não foi possível chamar um membro abstrato da base \"{0}\""
-#: mcs/mcs/ecore.cs:2907
+#: mcs/mcs/ecore.cs:2948
#, csharp-format
msgid ""
"Cannot access protected member `{0}' via a qualifier of type `{1}'. The "
"qualificador do tipo \"{1}\". O qualificador deve ser do tipo \"{2}\" ou "
"derivado deste"
-#: mcs/mcs/ecore.cs:2950
+#: mcs/mcs/ecore.cs:2964
+#, csharp-format
+msgid ""
+"Members of value type `{0}' cannot be assigned using a property `{1}' object "
+"initializer"
+msgstr ""
+"Membros do tipo de valor \"{0}\" não podem ser atribuidos usando uma "
+"propriedade \"{1}\" inicializadora de objeto"
+
+#: mcs/mcs/ecore.cs:2968
+#, csharp-format
+msgid ""
+"Cannot modify a value type return value of `{0}'. Consider storing the value "
+"in a temporary variable"
+msgstr ""
+"Não foi possível modificar o valor do retorno do tipo de valor de \"{0}\". "
+"Considere guardar o valor em uma variável temporária"
+
+#: mcs/mcs/ecore.cs:2994
#, csharp-format
msgid ""
"Static member `{0}' cannot be accessed with an instance reference, qualify "
"O membro estático \"{0}\" não pode ser acessado com uma referência de "
"instância, ao invés disso, qualifique com um nome de tipo"
-#: mcs/mcs/ecore.cs:2965
+#: mcs/mcs/ecore.cs:3009
#, csharp-format
msgid ""
"A field initializer cannot reference the nonstatic field, method, or "
"Um inicializador de campo não pode referenciar um campo não estático, método "
"ou propriedade \"{0}\""
-#: mcs/mcs/ecore.cs:2969
+#: mcs/mcs/ecore.cs:3013
#, csharp-format
msgid "An object reference is required to access non-static member `{0}'"
msgstr ""
"Uma referência de objeto é necessária para acessar o membro não estático "
"\"{0}\""
-#: mcs/mcs/ecore.cs:2978
+#: mcs/mcs/ecore.cs:3022
#, csharp-format
msgid ""
"Cannot access a nonstatic member of outer type `{0}' via nested type `{1}'"
"Não foi possível acessar um membro não estático de um tipo externo \"{0}\" "
"de um tipo aninhado \"{1}\""
-#: mcs/mcs/ecore.cs:3026
+#: mcs/mcs/ecore.cs:3070
msgid "Cannot modify the result of an unboxing conversion"
msgstr "Não foi possível modificar o resultado de uma conversão unboxing"
-#: mcs/mcs/ecore.cs:3192
+#: mcs/mcs/ecore.cs:3240
#, csharp-format
msgid ""
"Type `{0}' does not contain a member `{1}' and the best extension method "
"Tipo \"{0}\" não contém um membro \"{1}\" e o melhor método de extensão "
"sobrecarregado \"{2}\" tem alguns argumentos inválidos"
-#: mcs/mcs/ecore.cs:3197
+#: mcs/mcs/ecore.cs:3245
#, csharp-format
msgid "Extension method instance type `{0}' cannot be converted to `{1}'"
msgstr ""
"Tipo de instância do método de extensão \"{0}\" não pode ser convertido para "
"\"{1}\""
-#: mcs/mcs/ecore.cs:3331
+#: mcs/mcs/ecore.cs:3379
msgid "An expression tree cannot contain an expression with method group"
msgstr ""
"Uma árvore de expressão não pode conter uma expressão com um grupo de método"
-#: mcs/mcs/ecore.cs:3337
+#: mcs/mcs/ecore.cs:3385
msgid ""
"Partial methods with only a defining declaration or removed conditional "
"methods cannot be used in an expression tree"
"Métodos parciais com somente uma declaração de definição ou métodos com "
"condicionais removidos não podem ser utilizados em uma árvore de expressão"
-#: mcs/mcs/ecore.cs:3369
+#: mcs/mcs/ecore.cs:3417
#, csharp-format
msgid ""
"Cannot convert method group `{0}' to non-delegate type `{1}'. Consider using "
"Não foi possível converter o grupo de método \"{0}\" para o tipo não-"
"delegate \"{1}\". Consider a utilização de parênteses quando chamar o método"
-#: mcs/mcs/ecore.cs:4049
+#: mcs/mcs/ecore.cs:4150
#, csharp-format
msgid ""
"The type `{0}' does not contain a constructor that takes `{1}' arguments"
msgstr ""
"O tipo \"{0}\" não contém um construtor que aceite os argumentos \"{1}\""
-#: mcs/mcs/ecore.cs:4715
+#: mcs/mcs/ecore.cs:4837
#, fuzzy, csharp-format
msgid ""
"Type `{0}' does not contain a member `{1}' and the best extension method "
"Tipo \"{0}\" não contém um membro \"{1}\" e o melhor método de extensão "
"sobrecarregado \"{2}\" tem alguns argumentos inválidos"
-#: mcs/mcs/ecore.cs:4743
+#: mcs/mcs/ecore.cs:4876
#, csharp-format
msgid ""
"The call is ambiguous between the following methods or properties: `{0}' and "
"Essa chamada é ambígua entre os seguintes métodos ou propriedades: \"{0}\" e "
"\"{1}\""
-#: mcs/mcs/ecore.cs:4801
-#, csharp-format
+#: mcs/mcs/ecore.cs:4939
+#, fuzzy, csharp-format
msgid ""
-"The best overloaded collection initalizer method `{0}' cannot have 'ref', or "
+"The best overloaded collection initalizer method `{0}' cannot have `ref' or "
"`out' modifier"
msgstr ""
"O melhor método sobrecarregado de coleção \"{0}\" não pode ter o modificador "
"\"ref\" ou \"out\""
-#: mcs/mcs/ecore.cs:4805
+#: mcs/mcs/ecore.cs:4943
#, csharp-format
msgid ""
"The best overloaded collection initalizer method `{0}' has some invalid "
"O melhor método sobrecarregado inicializador de coleção \"{0}\" tem alguns "
"argumentos inválidos"
-#: mcs/mcs/ecore.cs:4808
+#: mcs/mcs/ecore.cs:4946
#, csharp-format
msgid "Delegate `{0}' has some invalid arguments"
msgstr "Delegate \"{0}\" tem alguns argumentos inválidos"
-#: mcs/mcs/ecore.cs:4812
+#: mcs/mcs/ecore.cs:4950
#, csharp-format
msgid "The best overloaded method match for `{0}' has some invalid arguments"
msgstr ""
"O melhor método sobrecarregado para \"{0}\" tem alguns argumentos inválidos"
-#: mcs/mcs/ecore.cs:4821
+#: mcs/mcs/ecore.cs:4959
#, csharp-format
msgid ""
"Argument `#{0}' does not require `{1}' modifier. Consider removing `{1}' "
"Argumento \"#{0}\" não requer o modificador \"{1}\". Considere remover o "
"modificador \"{1}\""
-#: mcs/mcs/ecore.cs:4824
+#: mcs/mcs/ecore.cs:4962
#, csharp-format
msgid "Argument `#{0}' is missing `{1}' modifier"
msgstr "Argumento \"#{0}\" não encontrou o modificador \"{1}\""
-#: mcs/mcs/ecore.cs:4836
+#: mcs/mcs/ecore.cs:4979
#, csharp-format
msgid "Argument `#{0}' cannot convert `{1}' expression to type `{2}'"
msgstr ""
"Argumento \"#{0}\" não pôde converter a expressão \"{1}\" para o tipo \"{2}\""
-#: mcs/mcs/ecore.cs:4889
+#: mcs/mcs/ecore.cs:5032
#, csharp-format
msgid ""
"The type arguments for method `{0}' cannot be inferred from the usage. Try "
"O argumentos de tipo para o método \"{0}\" não pôde ser inferido do uso. "
"Tente especificar os tipos dos argumentos explicitamente"
-#: mcs/mcs/ecore.cs:4918
+#: mcs/mcs/ecore.cs:5061
#, csharp-format
msgid "No overload for method `{0}' takes `{1}' arguments"
msgstr "Sem sobrecarga para o método \"{0}\" aceitar os argumentos \"{1}\""
-#: mcs/mcs/ecore.cs:4971
+#: mcs/mcs/ecore.cs:5114
#, fuzzy, csharp-format
msgid "The delegate `{0}' does not contain a parameter named `{1}'"
msgstr "O tipo aninhado \"{0}\" não existe no tipo \"{1}\""
-#: mcs/mcs/ecore.cs:4976
+#: mcs/mcs/ecore.cs:5119
#, fuzzy, csharp-format
msgid ""
"The best overloaded method match for `{0}' does not contain a parameter "
msgstr ""
"O melhor método sobrecarregado para \"{0}\" tem alguns argumentos inválidos"
-#: mcs/mcs/ecore.cs:4986
+#: mcs/mcs/ecore.cs:5129
#, csharp-format
msgid ""
"Named argument `{0}' cannot be used for a parameter which has positional "
"argument specified"
msgstr ""
-#: mcs/mcs/ecore.cs:5322
+#: mcs/mcs/ecore.cs:5467
msgid ""
"You cannot use fixed size buffers contained in unfixed expressions. Try "
"using the fixed statement"
"Você não pode usar buffers de tamanho fixo contidos em expressões não "
"fixadas. Tente utilizar a declaração fixa"
-#: mcs/mcs/ecore.cs:5327
+#: mcs/mcs/ecore.cs:5472
#, csharp-format
msgid "`{0}': Fixed size buffers can only be accessed through locals or fields"
msgstr ""
"\"{0}\": Buffers de tamanho fixo podem apenas ser acessados atravéis de "
"locais ou campos"
-#: mcs/mcs/ecore.cs:5363
+#: mcs/mcs/ecore.cs:5508
#, fuzzy, csharp-format
msgid "Use of possibly unassigned field `{0}'"
msgstr "Uso de campo possivelmente não atribuído \""
-#: mcs/mcs/ecore.cs:5789
+#: mcs/mcs/ecore.cs:5935
#, fuzzy, csharp-format
msgid "Property or event `{0}' is not supported by the C# language"
msgstr ""
"A propriedade \"{0}\" não tem suporte na linguagem C#. Tente chamar o método "
"acessor \"{1}\" diretamente"
-#: mcs/mcs/ecore.cs:5969
+#: mcs/mcs/ecore.cs:6131
#, csharp-format
msgid "A range variable `{0}' may not be passes as `ref' or `out' parameter"
msgstr ""
"Uma variável de intervalo \"{0}\" não deve ser passada como parâmetros \"ref"
"\" ou \"out\""
-#: mcs/mcs/ecore.cs:6047
+#: mcs/mcs/ecore.cs:6204
#, csharp-format
msgid ""
"The property or indexer `{0}' cannot be used in this context because it "
"A propriedade ou indexador \"{0}\" não pôde ser utilizada nesse contexto "
"porque falta o acessor \"get\""
-#: mcs/mcs/ecore.cs:6054
+#: mcs/mcs/ecore.cs:6211
#, csharp-format
msgid ""
"The property or indexer `{0}' cannot be used in this context because the get "
"A propriedade ou indexador \"{0}\" não pôde ser utilizada nesse contexto "
"porque o acessor get está inacessível"
-#: mcs/mcs/ecore.cs:6073
+#: mcs/mcs/ecore.cs:6230
#, fuzzy, csharp-format
msgid "Property or indexer `{0}' cannot be assigned to (it is read-only)"
msgstr ""
"Propriedade ou indexador \"{0}\" não pôde ser atribuida (ela é somente "
"leitura)"
-#: mcs/mcs/ecore.cs:6081
+#: mcs/mcs/ecore.cs:6238
#, csharp-format
msgid ""
"The property or indexer `{0}' cannot be used in this context because the set "
"A propriedade ou indexador \"{0}\" não pôde ser utilizada neste contexto por "
"que o acessor do conjunto está inacessível"
-#: mcs/mcs/ecore.cs:6249
+#: mcs/mcs/ecore.cs:6406
#, csharp-format
msgid ""
"The event `{0}' can only appear on the left hand side of `+=' or `-=' "
"O evento \"{0}\" pode apenas aparecer no lado esquerdo do operador \"+=\" ou "
"\"-=\""
-#: mcs/mcs/ecore.cs:6253
+#: mcs/mcs/ecore.cs:6410
#, csharp-format
msgid ""
"The event `{0}' can only appear on the left hand side of += or -= when used "
"O evento \"{0}\" pode apenas aparecer no lado esquerdo do operador += ou -= "
"quando utilizado fora do tipo \"{1}\""
-#: mcs/mcs/ecore.cs:6423
+#: mcs/mcs/ecore.cs:6580
#, csharp-format
msgid ""
"An implicitly typed local variable declaration cannot be initialized with `"
"Uma declaração de variável local tipada implicitamente não pode ser "
"inicializada com \"{0}\""
-#: mcs/mcs/ecore.cs:6437
+#: mcs/mcs/ecore.cs:6594
msgid ""
"The contextual keyword `var' may only appear within a local variable "
"declaration"
msgid "Type byte, sbyte, short, ushort, int, uint, long or ulong expected"
msgstr "Tipo byte, sbyte, short, ushort, int, uint, long ou ulong esperado"
-#: mcs/mcs/eval.cs:562
+#: mcs/mcs/eval.cs:563
msgid "Detection Parsing Error"
msgstr "Erro na Análise de Detecção"
"O tipo \"{0}\" deve ter operadores \"true\" e \"false\" definidos quando "
"\"{1}\" é utilizado como um operador curto circuito"
-#: mcs/mcs/expression.cs:4635
+#: mcs/mcs/expression.cs:4656
#, fuzzy, csharp-format
msgid ""
"Type of conditional expression cannot be determined as `{0}' and `{1}' "
"Tipo da expressão condicional não pôde ser determinada por que não há uma "
"conversão implícita entre \"{0}\" e \"{1}\""
-#: mcs/mcs/expression.cs:4645
+#: mcs/mcs/expression.cs:4666
#, csharp-format
msgid ""
"Type of conditional expression cannot be determined because there is no "
"Tipo da expressão condicional não pôde ser determinada por que não há uma "
"conversão implícita entre \"{0}\" e \"{1}\""
-#: mcs/mcs/expression.cs:4943
+#: mcs/mcs/expression.cs:4964
#, fuzzy, csharp-format
msgid "Use of unassigned local variable `{0}'"
msgstr "Uso de variável não atríbuida \""
-#: mcs/mcs/expression.cs:4963
+#: mcs/mcs/expression.cs:4984
#, csharp-format
msgid ""
"Cannot use fixed local `{0}' inside an anonymous method, lambda expression "
"or query expression"
msgstr ""
-#: mcs/mcs/expression.cs:5156
+#: mcs/mcs/expression.cs:5177
#, csharp-format
msgid ""
"Parameter `{0}' cannot be used inside `{1}' when using `ref' or `out' "
"Parâmetro \"{0}\" não pôde ser utilizado dentro de \"{1}\" quando estiver "
"usando modificadores \"ref\" ou \"out\""
-#: mcs/mcs/expression.cs:5235
+#: mcs/mcs/expression.cs:5256
#, csharp-format
msgid "Use of unassigned out parameter `{0}'"
msgstr "Uso do parâmetro removido \"{0}\""
-#: mcs/mcs/expression.cs:5345
+#: mcs/mcs/expression.cs:5368
#, fuzzy, csharp-format
msgid "Cannot invoke a non-delegate type `{0}'"
msgstr "Não foi possível converter \"{0}\" para um tipo não-delegate \"{1}\""
-#: mcs/mcs/expression.cs:5356
+#: mcs/mcs/expression.cs:5379
#, csharp-format
msgid "The member `{0}' cannot be used as method or delegate"
msgstr "O membro \"{0}\" não pode ser utilizado como método ou delegate"
-#: mcs/mcs/expression.cs:5376
+#: mcs/mcs/expression.cs:5399
msgid ""
"Do not directly call your base class Finalize method. It is called "
"automatically from your destructor"
"Não chame diretamente seu método Finalize da classe base. Este é chamado "
"automaticamente de seu destrutor"
-#: mcs/mcs/expression.cs:5378
+#: mcs/mcs/expression.cs:5401
msgid ""
"Destructors and object.Finalize cannot be called directly. Consider calling "
"IDisposable.Dispose if available"
"Destrutores e o object.Finalize não podem ser chamados diretamente. "
"Considere chamar IDisposable.Dispose se disponível"
-#: mcs/mcs/expression.cs:5407
+#: mcs/mcs/expression.cs:5430
#, csharp-format
msgid ""
"The base call to method `{0}' cannot be dynamically dispatched. Consider "
"casting the dynamic arguments or eliminating the base access"
msgstr ""
-#: mcs/mcs/expression.cs:5480
+#: mcs/mcs/expression.cs:5503
#, csharp-format
msgid "`{0}': cannot explicitly call operator or accessor"
msgstr "\"{0}\": não foi possível chamar explicitamente operador ou acessor"
-#: mcs/mcs/expression.cs:5664
+#: mcs/mcs/expression.cs:5687
#, csharp-format
msgid "Unsafe type `{0}' cannot be used in an object creation expression"
msgstr ""
"Tipo inseguro \"{0}\" não pode ser utilizado em uma expressão criadora de "
"objetos"
-#: mcs/mcs/expression.cs:5687
+#: mcs/mcs/expression.cs:5710
#, csharp-format
msgid ""
"Cannot create an instance of the variable type `{0}' because it does not "
"have the new() constraint"
msgstr ""
-#: mcs/mcs/expression.cs:5693
+#: mcs/mcs/expression.cs:5716
#, csharp-format
msgid ""
"`{0}': cannot provide arguments when creating an instance of a variable type"
msgstr ""
-#: mcs/mcs/expression.cs:5702
+#: mcs/mcs/expression.cs:5725
#, csharp-format
msgid "Cannot create an instance of the static class `{0}'"
msgstr "Não foi possível criar uma instância da classe estática \"{0}\""
-#: mcs/mcs/expression.cs:5714
+#: mcs/mcs/expression.cs:5737
#, csharp-format
msgid "Cannot create an instance of the abstract class or interface `{0}'"
msgstr ""
"Não foi possível criar uma instância da classe abstrata ou interface \"{0}\""
-#: mcs/mcs/expression.cs:6015
+#: mcs/mcs/expression.cs:6038
msgid ""
"An implicitly typed local variable declarator cannot use an array initializer"
msgstr ""
"Um declarador de variável local tipada implícitamente não pode usar um "
"inicializador de array"
-#: mcs/mcs/expression.cs:6159 mcs/mcs/expression.cs:6167
-#: mcs/mcs/statement.cs:1206 mcs/mcs/statement.cs:3582
+#: mcs/mcs/expression.cs:6182 mcs/mcs/expression.cs:6190
+#: mcs/mcs/statement.cs:1227 mcs/mcs/statement.cs:3619
msgid "A constant value is expected"
msgstr "Um valor constante é esperado"
-#: mcs/mcs/expression.cs:6173
+#: mcs/mcs/expression.cs:6196 mcs/mcs/expression.cs:6221
#, csharp-format
msgid "An array initializer of length `{0}' was expected"
msgstr ""
-#: mcs/mcs/expression.cs:6189
+#: mcs/mcs/expression.cs:6212
#, fuzzy
msgid ""
"Array initializers can only be used in a variable or field initializer. Try "
"atríbui-la a tipos de array. Tente, ao invés disso, utilizar uma nova "
"expressão"
-#: mcs/mcs/expression.cs:6197
+#: mcs/mcs/expression.cs:6229
#, fuzzy
msgid "A nested array initializer was expected"
msgstr "Um valor constante é esperado"
-#: mcs/mcs/expression.cs:6244
+#: mcs/mcs/expression.cs:6276
msgid "An expression tree cannot contain a multidimensional array initializer"
msgstr ""
"Uma árvore de expressão não pode contar um inicializador de array "
"multidimensional"
-#: mcs/mcs/expression.cs:6280
+#: mcs/mcs/expression.cs:6312
msgid "Cannot create an array with a negative size"
msgstr "Não foi possível criar um array com um tamanho negativo"
-#: mcs/mcs/expression.cs:6361
+#: mcs/mcs/expression.cs:6393
msgid ""
"Can only use array initializer expressions to assign to array types. Try "
"using a new expression instead"
"atríbui-la a tipos de array. Tente, ao invés disso, utilizar uma nova "
"expressão"
-#: mcs/mcs/expression.cs:6829
+#: mcs/mcs/expression.cs:6830
msgid ""
"The type of an implicitly typed array cannot be inferred from the "
"initializer. Try specifying array type explicitly"
"O tipo de um array tipado implicitamente não pode ser inferido do "
"inicializador. Tente especificar o tipo de array explicitamente"
-#: mcs/mcs/expression.cs:6972
+#: mcs/mcs/expression.cs:6973
msgid ""
"The `this' object cannot be used before all of its fields are assigned to"
msgstr ""
-#: mcs/mcs/expression.cs:6979
+#: mcs/mcs/expression.cs:6980
msgid ""
"Keyword `this' is not valid in a static property, static method, or static "
"field initializer"
msgstr ""
-#: mcs/mcs/expression.cs:6982
+#: mcs/mcs/expression.cs:6983
msgid ""
"Anonymous methods inside structs cannot access instance members of `this'. "
"Consider copying `this' to a local variable outside the anonymous method and "
"Considere copiar \"this\" para um variável local fora do método anônimo e "
"utilizar, ao invés disso, o local"
-#: mcs/mcs/expression.cs:6985
+#: mcs/mcs/expression.cs:6986
#, fuzzy
msgid "Keyword `this' is not available in the current context"
msgstr "O nome \"{0}\" não existe no contexto atual"
-#: mcs/mcs/expression.cs:7062
+#: mcs/mcs/expression.cs:7063
msgid "Cannot take the address of `this' because it is read-only"
msgstr ""
"Não foi possível encontrar o endereço de \"this\" por que este é somente "
"leitura"
-#: mcs/mcs/expression.cs:7064
+#: mcs/mcs/expression.cs:7065
msgid "Cannot pass `this' as a ref or out argument because it is read-only"
msgstr ""
"Não foi possível passar \"thus\" com uma ref ou argumento out por que este é "
"somente leitura"
-#: mcs/mcs/expression.cs:7066
+#: mcs/mcs/expression.cs:7067
msgid "Cannot assign to `this' because it is read-only"
msgstr "Não foi possível atribuir para \"this\" por que este é somente leitura"
-#: mcs/mcs/expression.cs:7138
+#: mcs/mcs/expression.cs:7139
msgid "The __arglist construct is valid only within a variable argument method"
msgstr ""
-#: mcs/mcs/expression.cs:7199
+#: mcs/mcs/expression.cs:7200
msgid "An expression tree cannot contain a method with variable arguments"
msgstr ""
"Uma árvore de expressão não pode conter um método com argumentos variáveis"
-#: mcs/mcs/expression.cs:7436
+#: mcs/mcs/expression.cs:7437
#, fuzzy
msgid "The typeof operator cannot be used on the dynamic type"
msgstr ""
"O operador \"{0}\" não pode ser aplicado a um operando de tipo estático"
-#: mcs/mcs/expression.cs:7477
+#: mcs/mcs/expression.cs:7478
#, csharp-format
msgid "`{0}': an attribute argument cannot use type parameters"
msgstr "\"{0}\": um argumento de atributo não pode usar parâmetros de tipo"
-#: mcs/mcs/expression.cs:7692
+#: mcs/mcs/expression.cs:7693
#, csharp-format
msgid ""
"`{0}' does not have a predefined size, therefore sizeof can only be used in "
"utilizado em um contexto inseguro (consider utilizar System.Runtime."
"InteropServices.Marshal.SizeOf)"
-#: mcs/mcs/expression.cs:7759
+#: mcs/mcs/expression.cs:7760
#, csharp-format
msgid "Alias `{0}' not found"
msgstr "Apelido \"{0}\" não encontrado"
-#: mcs/mcs/expression.cs:7785
+#: mcs/mcs/expression.cs:7786
#, fuzzy
msgid ""
"The namespace alias qualifier `::' cannot be used to invoke a method. "
"O qualificador de apelidos do namespace \"{0}\" não resolveu para um "
"namespace ou um tipo"
-#: mcs/mcs/expression.cs:7894
+#: mcs/mcs/expression.cs:7895
msgid "Cannot perform member binding on `null' value"
msgstr ""
-#: mcs/mcs/expression.cs:8057
-#, csharp-format
-msgid "`{0}': cannot reference a type through an expression; try `{1}' instead"
+#: mcs/mcs/expression.cs:8068
+#, fuzzy, csharp-format
+msgid ""
+"`{0}': cannot reference a type through an expression. Consider using `{1}' "
+"instead"
msgstr ""
"\"{0}\" não pôde referenciar um tipo através de uma expressão; tente, ao "
"invés, \"{1}\""
-#: mcs/mcs/expression.cs:8138
+#: mcs/mcs/expression.cs:8147
#, csharp-format
msgid "A nested type cannot be specified through a type parameter `{0}'"
msgstr ""
"Um tipo aninhado não pode ser especificado através de um tipo parâmetro "
"\"{0}\""
-#: mcs/mcs/expression.cs:8146
+#: mcs/mcs/expression.cs:8155
#, fuzzy, csharp-format
msgid ""
"Alias `{0}' cannot be used with `::' since it denotes a type. Consider "
"Apelido \"{0}\" não pôde ser utilizado com \"::\" pois denota um tipo. "
"Considere substituir \"::\" com \".\""
-#: mcs/mcs/expression.cs:8211
+#: mcs/mcs/expression.cs:8220
#, csharp-format
msgid "The nested type `{0}' does not exist in the type `{1}'"
msgstr "O tipo aninhado \"{0}\" não existe no tipo \"{1}\""
-#: mcs/mcs/expression.cs:8220
-#, csharp-format
+#: mcs/mcs/expression.cs:8239
+#, fuzzy, csharp-format
msgid ""
"Type `{0}' does not contain a definition for `{1}' and no extension method `"
-"{1}' of type `{0}' could be found (are you missing a using directive or an "
-"assembly reference?)"
+"{1}' of type `{0}' could be found. Are you missing {2}?"
msgstr ""
"O tipo \"{0}\" não contém uma definição para \"{1}\" e nenhuma extensão de "
"método \"{1}\" do tipo \"{0}\" pôde ser encontrada (você está esquecendo uma "
"diretiva em uso ou uma referência do assembly?)"
-#: mcs/mcs/expression.cs:8432
+#: mcs/mcs/expression.cs:8451
#, csharp-format
msgid "Cannot apply indexing with [] to an expression of type `{0}'"
msgstr ""
"Não foi possível aplicar uma indexação com [] para uma expressão do tipo "
"\"{0}\""
-#: mcs/mcs/expression.cs:8450
+#: mcs/mcs/expression.cs:8469
msgid "A pointer must be indexed by only one value"
msgstr ""
-#: mcs/mcs/expression.cs:8504
+#: mcs/mcs/expression.cs:8518
msgid "An element access expression cannot use named argument"
msgstr ""
-#: mcs/mcs/expression.cs:8582
+#: mcs/mcs/expression.cs:8596
#, csharp-format
msgid "Wrong number of indexes `{0}' inside [], expected `{1}'"
msgstr "Número incorreto de índices \"{0}\" dentro de [], esperados \"{1}\""
-#: mcs/mcs/expression.cs:8970
+#: mcs/mcs/expression.cs:8984
msgid ""
"The indexer base access cannot be dynamically dispatched. Consider casting "
"the dynamic arguments or eliminating the base access"
msgstr ""
-#: mcs/mcs/expression.cs:9055
+#: mcs/mcs/expression.cs:9069
msgid "An expression tree may not contain a base access"
msgstr "Uma árvore de expressão não deve conter uma acesso de base"
-#: mcs/mcs/expression.cs:9073
+#: mcs/mcs/expression.cs:9087
#, fuzzy
msgid "Keyword `base' is not available in a static method"
msgstr "Palavra chave \"new\" não é permitida em elementos do namespace"
-#: mcs/mcs/expression.cs:9075
+#: mcs/mcs/expression.cs:9089
#, fuzzy
msgid "Keyword `base' is not available in the current context"
msgstr "O nome \"{0}\" não existe no contexto atual"
-#: mcs/mcs/expression.cs:9113
+#: mcs/mcs/expression.cs:9127
#, fuzzy
msgid ""
"A property, indexer or dynamic member access may not be passed as `ref' or "
"Uma propriedade ou indexador \"{0}\" não deve ser passada como parâmetos "
"\"ref\" ou \"out\""
-#: mcs/mcs/expression.cs:9438
+#: mcs/mcs/expression.cs:9455
#, csharp-format
msgid "Array elements cannot be of type `{0}'"
msgstr "Elementos de array não podem ser do tipo \"{0}\""
-#: mcs/mcs/expression.cs:9441
+#: mcs/mcs/expression.cs:9458
#, csharp-format
msgid "Array elements cannot be of static type `{0}'"
msgstr "Elementos de array não podem ser do tipo estático \"{0}\""
-#: mcs/mcs/expression.cs:9617
+#: mcs/mcs/expression.cs:9634
msgid "Cannot use a negative size with stackalloc"
msgstr "Não é possível utilizar um tamanho negativo com stackalloc"
-#: mcs/mcs/expression.cs:9621
+#: mcs/mcs/expression.cs:9638
msgid "Cannot use stackalloc in finally or catch"
msgstr ""
-#: mcs/mcs/expression.cs:9738
+#: mcs/mcs/expression.cs:9755
#, csharp-format
msgid ""
"Member `{0}' cannot be initialized. An object initializer may only be used "
"Membro \"{0}\" não pode ser inicializado. Um inicializador de objetos pode "
"apenas ser utilizado para campos, ou propriedades"
-#: mcs/mcs/expression.cs:9747
+#: mcs/mcs/expression.cs:9764
#, fuzzy, csharp-format
msgid ""
"Static field or property `{0}' cannot be assigned in an object initializer"
" Campo estático ou propriedade \"{0}\" não podem ser atribuídas a um "
"inicializador de objeto"
-#: mcs/mcs/expression.cs:9946
+#: mcs/mcs/expression.cs:9963
#, csharp-format
msgid ""
"A field or property `{0}' cannot be initialized with a collection object "
"inicializador de coleção de objetos porque o tipo \"{1}\" não implementa a "
"interface \"{2}\""
-#: mcs/mcs/expression.cs:9957
+#: mcs/mcs/expression.cs:9974
#, csharp-format
msgid "Inconsistent `{0}' member declaration"
msgstr "Declaração do membro \"{0}\" inconsistente"
-#: mcs/mcs/expression.cs:9965
+#: mcs/mcs/expression.cs:9982
#, csharp-format
msgid ""
"An object initializer includes more than one member `{0}' initialization"
msgstr ""
"Um inicializador de objeto inclui mais que um membro \"{0}\" de inicialização"
-#: mcs/mcs/expression.cs:9983
+#: mcs/mcs/expression.cs:10000
#, csharp-format
msgid "Cannot initialize object of type `{0}' with a collection initializer"
msgstr ""
"Não foi possível inicializar objetos do tipo \"{0}\" com um inicializador de "
"coleções"
-#: mcs/mcs/expression.cs:10268
+#: mcs/mcs/expression.cs:10285
msgid "Anonymous types cannot be used in this expression"
msgstr "Tipos anônimos não podem ser utilizados nesta expressão"
-#: mcs/mcs/expression.cs:10367
+#: mcs/mcs/expression.cs:10384
#, csharp-format
msgid "An anonymous type property `{0}' cannot be initialized with `{1}'"
msgstr ""
"Buffer de tamanho fixo \"{0}\" de comprimento \"{1}\" e tipo \"{2}\" excedeu "
"o limite de 2^31"
-#: mcs/mcs/field.cs:667
+#: mcs/mcs/field.cs:666
#, csharp-format
msgid "`{0}': A volatile field cannot be of the type `{1}'"
msgstr "\"{0}\": Um campo volátil não pode ser do tipo \"{1}\""
-#: mcs/mcs/field.cs:672
+#: mcs/mcs/field.cs:671
#, csharp-format
msgid "`{0}': A field cannot be both volatile and readonly"
msgstr ""
msgstr "Não foi possível deixar no corpo uma cláusula final"
#: mcs/mcs/flowanalysis.cs:996 mcs/mcs/flowanalysis.cs:1012
-#: mcs/mcs/flowanalysis.cs:1048 mcs/mcs/statement.cs:782
+#: mcs/mcs/flowanalysis.cs:1048 mcs/mcs/statement.cs:795
msgid "Control cannot leave the body of a finally clause"
msgstr "O controle não pode deixar o corpo de uma cláusula final"
"\"{0}\" não é uma restrição válida. Classes estáticas não pode ser "
"utilizadas como restrições"
-#: mcs/mcs/generic.cs:601
+#: mcs/mcs/generic.cs:613
#, fuzzy, csharp-format
msgid "The {2} type parameter `{0}' must be {3} valid on `{1}{4}'"
msgstr "O nome do tipo parâmetro \"{0}\" é o mesmo que \"{1}\""
-#: mcs/mcs/generic.cs:1974
+#: mcs/mcs/generic.cs:2032
#, csharp-format
msgid "`{0}': static classes cannot be used as generic arguments"
msgstr ""
"\"{0}\": classes estáticas não podem ser utilizadas como argumentos genéricos"
-#: mcs/mcs/generic.cs:1981
+#: mcs/mcs/generic.cs:2039
#, csharp-format
msgid "The type `{0}' may not be used as a type argument"
msgstr "O tipo \"{0}\" não deve ser utilizado como um tipo argumento"
-#: mcs/mcs/generic.cs:2075
+#: mcs/mcs/generic.cs:2133
msgid "Variant type parameters can only be used with interfaces and delegates"
msgstr ""
-#: mcs/mcs/generic.cs:2314
+#: mcs/mcs/generic.cs:2354
#, fuzzy, csharp-format
msgid ""
"The type `{0}' must be a reference type in order to use it as type parameter "
"O tipo \"{0}\" deve ser uma refêrencia de tipo para poder utilizá-lo como o "
"tipo parâmetro \"{1}\" no tipo genérico ou método \"{2}\"."
-#: mcs/mcs/generic.cs:2324
+#: mcs/mcs/generic.cs:2364
#, fuzzy, csharp-format
msgid ""
"The type `{0}' must be a non-nullable value type in order to use it as type "
"O tipo \"{0}\" deve ser um tipo de valor não NULL para poder utilizá-lo como "
"tipo parâmetro \"{1}\" no tipo genérico ou método \"{2}\"."
-#: mcs/mcs/generic.cs:2383
+#: mcs/mcs/generic.cs:2423
#, csharp-format
msgid ""
"The type `{0}' must have a public parameterless constructor in order to use "
"O tipo \"{0}\" deve ter um construtor público sem parâmetros para poder "
"utilizá-lo como parâmetro \"{1}\" no tipo genérico ou método \"{2}\""
-#: mcs/mcs/generic.cs:2451
+#: mcs/mcs/generic.cs:2479
#, fuzzy, csharp-format
msgid ""
"The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
"genérico ou método \"{2}\". O tipo anulável \"{0}\" nunca satisfaz a "
"restrição de interface do tipo \"{3}\""
-#: mcs/mcs/generic.cs:2457
+#: mcs/mcs/generic.cs:2485
#, fuzzy, csharp-format
msgid ""
"The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
"genérico ou método \"{2}\". O tipo anulável \"{0}\" nunca satisfaz a "
"restrição de interface do tipo \"{3}\""
-#: mcs/mcs/generic.cs:2461
+#: mcs/mcs/generic.cs:2489
#, fuzzy, csharp-format
msgid ""
"The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
"genérico ou método \"{2}\". O tipo anulável \"{0}\" nunca satisfaz a "
"restrição de interface do tipo \"{3}\""
-#: mcs/mcs/generic.cs:2466
+#: mcs/mcs/generic.cs:2494
#, fuzzy, csharp-format
msgid ""
"The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
"genérico ou método \"{2}\". O tipo anulável \"{0}\" nunca satisfaz a "
"restrição de interface do tipo \"{3}\""
-#: mcs/mcs/generic.cs:2471
+#: mcs/mcs/generic.cs:2499
#, fuzzy, csharp-format
msgid ""
"The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
"genérico ou método \"{2}\". O tipo anulável \"{0}\" nunca satisfaz a "
"restrição de interface do tipo \"{3}\""
-#: mcs/mcs/import.cs:1818
+#: mcs/mcs/import.cs:1868
#, csharp-format
msgid ""
"Reference to type `{0}' claims it is defined in this assembly, but it is not "
"defined in source or any added modules"
msgstr ""
-#: mcs/mcs/import.cs:1822
+#: mcs/mcs/import.cs:1873
+#, csharp-format
+msgid ""
+"The type `{0}' has been forwarded to an assembly that is not referenced. "
+"Consider adding a reference to assembly `{1}'"
+msgstr ""
+
+#: mcs/mcs/import.cs:1877
#, csharp-format
msgid ""
"The type `{0}' is defined in an assembly that is not referenced. Consider "
"adding a reference to assembly `{1}'"
msgstr ""
-#: mcs/mcs/import.cs:1826
+#: mcs/mcs/import.cs:1882
#, csharp-format
msgid ""
"Reference to type `{0}' claims it is defined assembly `{1}', but it could "
msgid "Iterators cannot have unsafe parameters or yield types"
msgstr "Iteradores não podem ter parâmetros inseguros ou tipos yield"
-#: mcs/mcs/iterators.cs:1132 mcs/mcs/statement.cs:4950
+#: mcs/mcs/iterators.cs:1132 mcs/mcs/statement.cs:4987
msgid "Unsafe code may not appear in iterators"
msgstr "Código inseguro não pode aparecer em iteradores"
-#: mcs/mcs/ikvm.cs:236
+#: mcs/mcs/ikvm.cs:266
msgid "SDK path could not be resolved"
msgstr ""
-#: mcs/mcs/ikvm.cs:314
+#: mcs/mcs/ikvm.cs:344
#, csharp-format
msgid ""
"Assembly `{0}' references `{1}' which has a higher version number than "
"imported assembly `{2}'"
msgstr ""
-#: mcs/mcs/ikvm.cs:323 mcs/mcs/ikvm.cs:327
+#: mcs/mcs/ikvm.cs:353 mcs/mcs/ikvm.cs:357
#, csharp-format
msgid ""
"Assuming assembly reference `{0}' matches assembly `{1}'. You may need to "
"supply runtime policy"
msgstr ""
-#: mcs/mcs/ikvm.cs:413
+#: mcs/mcs/ikvm.cs:444
#, csharp-format
msgid ""
"An assembly with the same name `{0}' has already been imported. Consider "
"removing one of the references or sign the assembly"
msgstr ""
-#: mcs/mcs/ikvm.cs:422
+#: mcs/mcs/ikvm.cs:453
#, csharp-format
msgid ""
"An assembly with the same identity `{0}' has already been imported. Consider "
"Literal do tipo double não pode ser implicitamente convertido para o tipo "
"\"{0}\". Adicione o sufixo \"{1}\" para criar um literal desse tipo"
-#: mcs/mcs/membercache.cs:1388
+#: mcs/mcs/membercache.cs:1391
msgid ""
"A partial method declaration and partial method implementation cannot differ "
"on use of `params' modifier"
"Uma declaração de método parcial e uma implementação de método parcial não "
"podem diferir no uso do modificador \"params\""
-#: mcs/mcs/membercache.cs:1391
+#: mcs/mcs/membercache.cs:1394
msgid ""
"A partial method declaration and partial method implementation must be both "
"an extension method or neither"
"Uma declaração de método parcial e uma implementação de método parcial ou "
"devem ser ambas um método de extenção ou ambas não serem"
-#: mcs/mcs/membercache.cs:1395
+#: mcs/mcs/membercache.cs:1398
#, fuzzy, csharp-format
msgid ""
"Overloaded contructor `{0}' cannot differ on use of parameter modifiers only"
"Um método sobrecarregado \"{0}\" não pode diferir no uso de modificadores de "
"parâmetros somente"
-#: mcs/mcs/membercache.cs:1399
+#: mcs/mcs/membercache.cs:1402
#, fuzzy, csharp-format
msgid ""
"Overloaded method `{0}' cannot differ on use of parameter modifiers only"
"Um método sobrecarregado \"{0}\" não pode diferir no uso de modificadores de "
"parâmetros somente"
-#: mcs/mcs/membercache.cs:1431
+#: mcs/mcs/membercache.cs:1434
msgid ""
"A partial method declaration and partial method implementation must be both "
"`static' or neither"
"Uma declaração de método parcial e uma implementação de método parcial ou "
"devem ser ambas estáticas ou ambas não serem"
-#: mcs/mcs/membercache.cs:1436
+#: mcs/mcs/membercache.cs:1439
msgid ""
"A partial method declaration and partial method implementation must be both "
"`unsafe' or neither"
"Uma declaração de método parcial e uma implementação de método parcial ou "
"devem ser ambas inseguras ou ambas não serem"
-#: mcs/mcs/membercache.cs:1442
+#: mcs/mcs/membercache.cs:1445
#, csharp-format
msgid "A partial method `{0}' declaration is already defined"
msgstr "Uma declaração do método parcial \"{0}\" já está definida"
-#: mcs/mcs/membercache.cs:1446
+#: mcs/mcs/membercache.cs:1449
#, csharp-format
msgid "A partial method `{0}' implementation is already defined"
msgstr "Uma implementação do método parcial \"{0}\" já esa definido"
-#: mcs/mcs/membercache.cs:1457 mcs/mcs/property.cs:81
+#: mcs/mcs/membercache.cs:1460 mcs/mcs/property.cs:81
#, csharp-format
msgid "A member `{0}' is already reserved"
msgstr "Um membro \"{0}\" já está reservado"
-#: mcs/mcs/membercache.cs:1468
+#: mcs/mcs/membercache.cs:1471
#, csharp-format
msgid "Duplicate user-defined conversion in type `{0}'"
msgstr "Conversão definida pelo usuário duplicada no topo \"{0}\""
-#: mcs/mcs/membercache.cs:1474
+#: mcs/mcs/membercache.cs:1477
#, csharp-format
msgid ""
"A member `{0}' is already defined. Rename this member or use different "
"Um membro \"{0}\" já está definido. Renomeie esse membro ou use tipos de "
"parâmetros distintos"
-#: mcs/mcs/method.cs:552
+#: mcs/mcs/method.cs:558
#, csharp-format
msgid "`{0}': Async methods cannot use `MethodImplOptions.Synchronized'"
msgstr ""
-#: mcs/mcs/method.cs:560
+#: mcs/mcs/method.cs:566
msgid ""
"The DllImport attribute must be specified on a method marked `static' and "
"`extern'"
"O atributo DllImport deve ser especificado em um método marcado \"estático\" "
"e \"externo\""
-#: mcs/mcs/method.cs:655
+#: mcs/mcs/method.cs:661
#, csharp-format
msgid "`{0}': A partial method parameters cannot use `out' modifier"
msgstr ""
"\"{0}\": Os parâmetros parciais de um método não podem utilizar o "
"modificador \"out\""
-#: mcs/mcs/method.cs:716
+#: mcs/mcs/method.cs:722
#, csharp-format
msgid ""
"Conditional not valid on `{0}' because it is a constructor, destructor, "
"Condicional inválido em \"{0}\" por que é um construtor, destrutor, operador "
"ou interface explícita de implementação"
-#: mcs/mcs/method.cs:855
-#, fuzzy, csharp-format
-msgid ""
-"`{0}': Cannot specify constraints for overrides and explicit interface "
-"implementation methods"
-msgstr ""
-"\"{0}\": Não foi possível especificar restrições para sobrescritos ou "
-"métodos de implementação explícitos de interface"
-
#: mcs/mcs/method.cs:865
msgid ""
"A partial method cannot define access modifier or any of abstract, extern, "
msgid "The return type of an async method must be void, Task, or Task<T>"
msgstr ""
-#: mcs/mcs/method.cs:1224
+#: mcs/mcs/method.cs:1227
#, csharp-format
msgid "`{0}': Extension methods cannot be defined in a nested class"
msgstr ""
"\"{0}\": Métodos de extensão não podem ser definidos em uma classe aninhada"
-#: mcs/mcs/method.cs:1230
+#: mcs/mcs/method.cs:1233
#, csharp-format
msgid ""
"`{0}': Extension methods require `System.Runtime.CompilerServices."
"reference?"
msgstr ""
-#: mcs/mcs/method.cs:1239
+#: mcs/mcs/method.cs:1242
#, csharp-format
msgid "`{0}': Extension methods must be defined in a non-generic static class"
msgstr ""
"\"{0}\": Métodos de estensão devem ser definidos em uma classe estática não-"
"genérica"
-#: mcs/mcs/method.cs:1255
+#: mcs/mcs/method.cs:1258
#, fuzzy, csharp-format
msgid "`{0}': an entry point cannot be async method"
msgstr "\"{0}\": tipos estáticos não podem ser utilizados como parâmetros"
-#: mcs/mcs/method.cs:1292
+#: mcs/mcs/method.cs:1295
#, csharp-format
msgid ""
"A partial method `{0}' implementation is missing a partial method declaration"
"Na implementação do método parcial \"{0}\" está faltando a declaração do "
"método parcial"
-#: mcs/mcs/method.cs:1325
+#: mcs/mcs/method.cs:1336
#, csharp-format
msgid "Method or delegate cannot return type `{0}'"
msgstr "Método ou delegate não podem ter um tipo de retorno \"{0}\""
-#: mcs/mcs/method.cs:1404
+#: mcs/mcs/method.cs:1415
msgid ""
"The constructor call cannot be dynamically dispatched within constructor "
"initializer"
msgstr ""
-#: mcs/mcs/method.cs:1418
+#: mcs/mcs/method.cs:1429
#, csharp-format
msgid "`{0}': Struct constructors cannot call base constructors"
msgstr "\"{0}\": Construtores de structs não podem chamar construtores da base"
-#: mcs/mcs/method.cs:1436
+#: mcs/mcs/method.cs:1447
#, csharp-format
msgid "Constructor `{0}' cannot call itself"
msgstr "Construtor \"{0}\" não pode chamar a si mesmo"
-#: mcs/mcs/method.cs:1565
+#: mcs/mcs/method.cs:1576
#, csharp-format
msgid "`{0}': The static constructor must be parameterless"
msgstr "\"{0}\": O construtor estático não deve ter parâmetros"
-#: mcs/mcs/method.cs:1586
+#: mcs/mcs/method.cs:1597
msgid "Structs cannot contain explicit parameterless constructors"
msgstr "Structs não podem conter construtores explícitos sem parâmetros"
-#: mcs/mcs/method.cs:1636
+#: mcs/mcs/method.cs:1652
#, csharp-format
msgid ""
"`{0}': A class with the ComImport attribute cannot have a user-defined "
"\"{0}\": Uma classe com o atributo ComImport não pode ter um construtor "
"definido pelo usuário"
-#: mcs/mcs/method.cs:1886
+#: mcs/mcs/method.cs:1902
#, csharp-format
msgid "`{0}' is an accessor not found in interface member `{1}{2}'"
msgstr "\"{0}\" é um acessor não encontrado no membro da interface \"{1}{2}\""
-#: mcs/mcs/method.cs:1892
+#: mcs/mcs/method.cs:1908
#, csharp-format
msgid ""
"`{0}.{1}' in explicit interface declaration is not a member of interface"
msgstr ""
"\"{0}.{1}\" na declaração da interface explícita não é um membro da interface"
-#: mcs/mcs/method.cs:1900
+#: mcs/mcs/method.cs:1916
#, csharp-format
msgid ""
"`{0}' explicit method implementation cannot implement `{1}' because it is an "
"\"{0}\" implementação de método explícito não pode implementar \"{1}\" "
"porque é um acessor"
-#: mcs/mcs/method.cs:1910
+#: mcs/mcs/method.cs:1926
#, fuzzy, csharp-format
msgid "Method `{0}' cannot implement interface accessor `{1}'"
msgstr "Método \"{0}\" não pode implementar acessor de interface \"{1}.{2}\""
-#: mcs/mcs/method.cs:1917
+#: mcs/mcs/method.cs:1933
#, csharp-format
msgid ""
"Accessor `{0}' cannot implement interface member `{1}' for type `{2}'. Use "
"Acessor \"{0}\" não pode implementar o membro da interface \"{1}\" para o "
"tipo \"{2}\". Utilize uma implementação explícita da interface"
-#: mcs/mcs/method.cs:1924
+#: mcs/mcs/method.cs:1940
#, csharp-format
msgid ""
"Accessor `{0}' must be declared public to implement interface member `{1}'"
"Acessor \"{0}\" deve ser declarado público para implementar o membro da "
"interface \"{1}\""
-#: mcs/mcs/method.cs:1944
+#: mcs/mcs/method.cs:1960
#, csharp-format
msgid ""
"`{0}': the explicit interface implementation cannot introduce the params "
"\"{0}\": a implementação explicita da interface não pode fornecer o "
"modificador de parâmetros"
-#: mcs/mcs/method.cs:2282
+#: mcs/mcs/method.cs:2308
#, csharp-format
msgid ""
"Attribute `{0}' is not valid on property or event accessors. It is valid on `"
"Atributo \"{0}\" não é válido em propriedade ou acessores de evento. É "
"válido nas declarações \"{1}\" somente"
-#: mcs/mcs/method.cs:2510
+#: mcs/mcs/method.cs:2536
#, csharp-format
msgid "User-defined operator `{0}' must be declared static and public"
msgstr ""
"Operador definido pelo usuário \"{0}\" deve ser declarado estático e público"
-#: mcs/mcs/method.cs:2549
+#: mcs/mcs/method.cs:2580
msgid ""
"User-defined operator cannot take an object of the enclosing type and "
"convert to an object of the enclosing type"
"Operador definido pelo usuário não pode pegar um objeto de um tipo no qual "
"está definido e converter para um objeto deste tipo"
-#: mcs/mcs/method.cs:2560
+#: mcs/mcs/method.cs:2591
msgid "User-defined conversion must convert to or from the enclosing type"
msgstr ""
"Converção definida pela usuário deve conver para ou a partir de um tipo no "
"qual está definido"
-#: mcs/mcs/method.cs:2566
+#: mcs/mcs/method.cs:2597
#, fuzzy, csharp-format
msgid ""
"User-defined conversion `{0}' cannot convert to or from the dynamic type"
"Conversão definida pelo usuário \"{0}\" não pode converter para ou a partir "
"de um tipo de interface"
-#: mcs/mcs/method.cs:2573
+#: mcs/mcs/method.cs:2604
#, csharp-format
msgid ""
"User-defined conversion `{0}' cannot convert to or from an interface type"
"Conversão definida pelo usuário \"{0}\" não pode converter para ou a partir "
"de um tipo de interface"
-#: mcs/mcs/method.cs:2580
+#: mcs/mcs/method.cs:2611
#, csharp-format
msgid "User-defined conversion `{0}' cannot convert to or from a base class"
msgstr ""
"Conversão definida pelo usuário \"{0}\" não pode converter para ou a partir "
"de uma classe base"
-#: mcs/mcs/method.cs:2586
+#: mcs/mcs/method.cs:2617
#, csharp-format
msgid "User-defined conversion `{0}' cannot convert to or from a derived class"
msgstr ""
"Conversão definida pelo usuário \"{0}\" não pode converter para ou a partir "
"de uma classe derivada"
-#: mcs/mcs/method.cs:2593
+#: mcs/mcs/method.cs:2624
msgid ""
"Overloaded shift operator must have the type of the first operand be the "
"containing type, and the type of the second operand must be int"
"Operador de shift sobrecarregado deve ter o tipo do primeiro operando como "
"sendo o próprio tipo, e o tipo do segundo operando deve ser int"
-#: mcs/mcs/method.cs:2602
+#: mcs/mcs/method.cs:2633
msgid ""
"The return type for ++ or -- operator must be the containing type or derived "
"from the containing type"
"O tipo de retorno para o operador ++ ou -- deve ser do próprio tipo ou "
"derivadodo próprio tipo"
-#: mcs/mcs/method.cs:2607
+#: mcs/mcs/method.cs:2638
msgid "The parameter type for ++ or -- operator must be the containing type"
msgstr "O tipo de parâmetro para o operador ++ ou -- deve ser do próprio tipo"
-#: mcs/mcs/method.cs:2614
+#: mcs/mcs/method.cs:2645
msgid "The parameter type of a unary operator must be the containing type"
msgstr "O tipo de parâmetro de um operador unário deve ser do próprio tipo"
-#: mcs/mcs/method.cs:2622
+#: mcs/mcs/method.cs:2653
msgid "The return type of operator True or False must be bool"
msgstr "O tipo de retorno do operador True ou False deve ser bool"
-#: mcs/mcs/method.cs:2637
+#: mcs/mcs/method.cs:2668
msgid "One of the parameters of a binary operator must be the containing type"
msgstr "Um dos parâmetros de um operador binário deve ser do próprio tipo"
msgid "The modifier `{0}' is not valid for this item"
msgstr "Código de página \"{0}\" é inválido ou não está instalado"
-#: mcs/mcs/namespace.cs:186
-#, csharp-format
+#: mcs/mcs/namespace.cs:263
+#, fuzzy, csharp-format
msgid ""
-"The type or namespace name `{0}' could not be found in the global namespace "
-"(are you missing an assembly reference?)"
+"The type or namespace name `{0}' could not be found in the global namespace. "
+"Are you missing {1} assembly reference?"
msgstr ""
"O tipo ou nome de namespace \"{0}\" não pôde ser encontrado no namespace "
"global (você não está esquecendo de uma referência do assembly?)"
-#: mcs/mcs/namespace.cs:190
-#, csharp-format
+#: mcs/mcs/namespace.cs:267
+#, fuzzy, csharp-format
msgid ""
"The type or namespace name `{0}' does not exist in the namespace `{1}'. Are "
-"you missing an assembly reference?"
+"you missing {2} assembly reference?"
msgstr ""
"O tipo ou nome do namespace \"{0}\" não existe no namespace \"{1}\". Você "
"não está esquecendo de uma referência do assembly?"
-#: mcs/mcs/namespace.cs:284
+#: mcs/mcs/namespace.cs:367
#, csharp-format
msgid "The imported type `{0}' is defined multiple times"
msgstr "O tipo importado \"{0}\" é definido múltiplas vezes"
-#: mcs/mcs/namespace.cs:749 mcs/mcs/namespace.cs:761
+#: mcs/mcs/namespace.cs:839 mcs/mcs/namespace.cs:851
msgid ""
"A using clause must precede all other namespace elements except extern alias "
"declarations"
"Uma cláusula em uso deve preceder todos os outros elementos do namespace, "
"exceto declarações de alias externos"
-#: mcs/mcs/namespace.cs:777
+#: mcs/mcs/namespace.cs:867
#, csharp-format
msgid "The using alias `{0}' appeared previously in this namespace"
msgstr "O alias em uso \"{0}\" apareceu antes neste namespace"
-#: mcs/mcs/namespace.cs:815
+#: mcs/mcs/namespace.cs:905 mcs/mcs/namespace.cs:928
#, csharp-format
msgid "The namespace `{0}' already contains a definition for `{1}'"
msgstr "O namespace \"{0}\" já contém uma definição para \"{1}\""
-#: mcs/mcs/namespace.cs:1037
+#: mcs/mcs/namespace.cs:1147
#, csharp-format
msgid "Namespace `{0}' contains a definition with same name as alias `{1}'"
msgstr ""
"O namespace \"{0}\" contém uma definição com o mesmo nome do alias \"{1}\""
-#: mcs/mcs/namespace.cs:1089
+#: mcs/mcs/namespace.cs:1199
#, csharp-format
msgid "`{0}' is an ambiguous reference between `{1}' and `{2}'"
msgstr "\"{0}\" é uma referência ambígua entre \"{1}\" e \"{2}\""
-#: mcs/mcs/namespace.cs:1115
-#, csharp-format
-msgid ""
-"The type or namespace name `{0}' could not be found. Are you missing a using "
-"directive or an assembly reference?"
-msgstr ""
-"O tipo ou nome de namespace \"{0}\" não pôde ser encontrado. Você está "
-"esquecendo de uma diretiva em uso ou uma referência do assembly?"
-
-#: mcs/mcs/namespace.cs:1317
+#: mcs/mcs/namespace.cs:1390
#, csharp-format
msgid ""
"`{0}' is a type not a namespace. A using namespace directive can only be "
"\"{0}\" é um tipo e não um namespace. Uma diretiva de namespace em uso pode "
"apenas ser aplicado a namespaces"
-#: mcs/mcs/namespace.cs:1336
+#: mcs/mcs/namespace.cs:1414
#, csharp-format
msgid "The extern alias `{0}' was not specified in -reference option"
msgstr "O alias externo \"{0}\" não foi especificado na opção -reference"
msgid "`{0}': abstract properties cannot have private accessors"
msgstr "\"{0}\": propriedades abstratas não podem ter acessores privados"
-#: mcs/mcs/property.cs:397
+#: mcs/mcs/property.cs:402
#, csharp-format
msgid ""
"The accessibility modifier of the `{0}' accessor must be more restrictive "
"O modificador de acessibilidade do acessor \"{0}\" deve ser mais restritivo "
"que o modificador da propriedade ou indexador \"{1}\""
-#: mcs/mcs/property.cs:506
+#: mcs/mcs/property.cs:511
#, csharp-format
msgid "Explicit interface implementation `{0}' is missing accessor `{1}'"
msgstr ""
"Implementação explícita de interface \"{0}\" está faltando acessor \"{1}\""
-#: mcs/mcs/property.cs:525
+#: mcs/mcs/property.cs:530
#, fuzzy, csharp-format
msgid ""
"`{0}': cannot override because `{1}' does not have an overridable get "
"\"{0}.get\": não foi possível sobrescrever porque \"{1}\" não possui um "
"acessor get que pode ser sobrescrito"
-#: mcs/mcs/property.cs:542
+#: mcs/mcs/property.cs:547
#, fuzzy, csharp-format
msgid ""
"`{0}': cannot override because `{1}' does not have an overridable set "
"\"{0}.set\": não foi possível substituir porque \"{1}\" não possui um "
"acessor set que pode ser sobrescrito"
-#: mcs/mcs/property.cs:583
+#: mcs/mcs/property.cs:588
#, csharp-format
msgid ""
"`{0}': Cannot specify accessibility modifiers for both accessors of the "
"\"{0}\": Não foi possível especificar modificadores de acessibilidade para "
"ambos os acessores de propriedade ou indexadores"
-#: mcs/mcs/property.cs:590
+#: mcs/mcs/property.cs:595
#, csharp-format
msgid ""
"`{0}': accessibility modifiers on accessors may only be used if the property "
"\"{0}\": modificadores de acessibilidade em acessores devem apenas ser "
"utilizados se a propriedade ou indexador tiverem, ambas, um acessor get e set"
-#: mcs/mcs/property.cs:818
+#: mcs/mcs/property.cs:823
#, csharp-format
msgid ""
"Automatically implemented property `{0}' cannot be used inside a type with "
"Propriedade implementada automaticamente \"{0}\" não pode ser utilizada "
"dentro de um tipo com um atributo StructLayout explícito"
-#: mcs/mcs/property.cs:1305
+#: mcs/mcs/property.cs:1312
#, csharp-format
msgid "`{0}': event must be of a delegate type"
msgstr "\"{0}\": evento deve ser de um tipo delegate"
-#: mcs/mcs/property.cs:1581
+#: mcs/mcs/property.cs:1588
#, fuzzy, csharp-format
msgid ""
"The `{0}' attribute is valid only on an indexer that is not an explicit "
"O atributo \"IndexerName\" é válido somente em um indexador que não seja uma "
"declaração explícita de um membro da interface"
-#: mcs/mcs/property.cs:1585
+#: mcs/mcs/property.cs:1592
msgid "Cannot set the `IndexerName' attribute on an indexer marked override"
msgstr ""
"Não foi possível definir o atributo \"IndexerName\" em um indexador marcado "
"Valor especificado para o argumento ao \"System.Runtime.InteropServices."
"DefaultCharSetAttribute\" não é válido"
-#: mcs/mcs/statement.cs:92
+#: mcs/mcs/statement.cs:100
msgid ""
"A lambda expression with statement body cannot be converted to an expresion "
"tree"
"Uma expressão lambda com um corpo de declarações não pode ser convertida "
"para uma árvore de expressão"
-#: mcs/mcs/statement.cs:845
+#: mcs/mcs/statement.cs:858
#, csharp-format
msgid ""
"An object of a type convertible to `{0}' is required for the return statement"
msgstr ""
-#: mcs/mcs/statement.cs:859 mcs/mcs/statement.cs:884
+#: mcs/mcs/statement.cs:872 mcs/mcs/statement.cs:896
#, csharp-format
msgid ""
"`{0}': A return keyword must not be followed by any expression when method "
"\"{0}\": Uma palavra chave return não deve ser seguida por nenhuma expressão "
"quando o método retornar void"
-#: mcs/mcs/statement.cs:895
+#: mcs/mcs/statement.cs:907
#, fuzzy, csharp-format
msgid ""
"`{0}': A return keyword must not be followed by an expression when async "
"\"{0}\": Uma palavra chave return não deve ser seguida por nenhuma expressão "
"quando o método retornar void"
-#: mcs/mcs/statement.cs:905
+#: mcs/mcs/statement.cs:917
#, csharp-format
msgid ""
"`{0}': The return expression type of async method must be `{1}' rather than "
"`Task<{1}>'"
msgstr ""
-#: mcs/mcs/statement.cs:929
+#: mcs/mcs/statement.cs:927
+#, fuzzy, csharp-format
+msgid ""
+"`{0}': A return keyword must not be followed by any expression when delegate "
+"returns void"
+msgstr ""
+"\"{0}\": Uma palavra chave return não deve ser seguida por nenhuma expressão "
+"quando o método retornar void"
+
+#: mcs/mcs/statement.cs:950
#, csharp-format
msgid ""
"Cannot convert `{0}' to delegate type `{1}' because some of the return types "
"alguns dos tipos de retorno no bloco não são implicitamente conversíveis no "
"tipo de retorno delegate"
-#: mcs/mcs/statement.cs:977
+#: mcs/mcs/statement.cs:998
msgid ""
"Cannot return a value from iterators. Use the yield return statement to "
"return a value, or yield break to end the iteration"
"Não foi possível devolver um valor de iteradores. Use a declaração yield do "
"return para devolver um valor, ou yield break para terminar a iteração"
-#: mcs/mcs/statement.cs:1149 mcs/mcs/statement.cs:1194
+#: mcs/mcs/statement.cs:1170 mcs/mcs/statement.cs:1215
msgid "A goto case is only valid inside a switch statement"
msgstr "Um case do goto é válido somente dentro de uma declaração switch"
-#: mcs/mcs/statement.cs:1282 mcs/mcs/statement.cs:5351
+#: mcs/mcs/statement.cs:1303 mcs/mcs/statement.cs:5388
msgid "The type caught or thrown must be derived from System.Exception"
msgstr ""
-#: mcs/mcs/statement.cs:1527
+#: mcs/mcs/statement.cs:1548
msgid "A fixed statement cannot use an implicitly typed local variable"
msgstr ""
"Uma declaração fixa não pode utilizar uma variável local tipada "
"implicitamente"
-#: mcs/mcs/statement.cs:1532
+#: mcs/mcs/statement.cs:1553
msgid "An implicitly typed local variable cannot be a constant"
msgstr "Uma variável local implicitamente tipada não pode ser uma constante"
-#: mcs/mcs/statement.cs:1537
+#: mcs/mcs/statement.cs:1558
msgid ""
"An implicitly typed local variable declarator must include an initializer"
msgstr ""
"Uma declaração de variável local tipada implicitamente deve incluir um "
"inicializador"
-#: mcs/mcs/statement.cs:1542
+#: mcs/mcs/statement.cs:1563
msgid ""
"An implicitly typed local variable declaration cannot include multiple "
"declarators"
"Uma declaração de variável local tipada implicitamente não pode incluir "
"múltiplos declaradores"
-#: mcs/mcs/statement.cs:2164
+#: mcs/mcs/statement.cs:2185
#, csharp-format
msgid ""
"A local variable named `{0}' cannot be declared in this scope because it "
"esta daria um significado distinto para \"{0}\", que já é usada em um escopo "
"\"{1}\" para denotar outra coisa"
-#: mcs/mcs/statement.cs:2176
+#: mcs/mcs/statement.cs:2197
#, csharp-format
msgid "A local variable named `{0}' is already defined in this scope"
msgstr "Uma variável local nomeada \"{0}\" já foi definida neste escopo"
-#: mcs/mcs/statement.cs:2183
+#: mcs/mcs/statement.cs:2204
#, fuzzy, csharp-format
msgid ""
"The type parameter name `{0}' is the same as local variable or parameter name"
msgstr "O nome do tipo parâmetro \"{0}\" é o mesmo que \"{1}\""
-#: mcs/mcs/statement.cs:2898
+#: mcs/mcs/statement.cs:2935
#, csharp-format
msgid ""
"The out parameter `{0}' must be assigned to before control leaves the "
"O parâmetro externo \"{0}\" deve estar atribuída para antes que o controle "
"deixe o método atual"
-#: mcs/mcs/statement.cs:3016
+#: mcs/mcs/statement.cs:3053
#, csharp-format
msgid "`{0}': not all code paths return a value"
msgstr "\"{0}\": nem todos caminhos de códigos devolvem um valor"
-#: mcs/mcs/statement.cs:3033
+#: mcs/mcs/statement.cs:3070
#, csharp-format
msgid "Not all code paths return a value in anonymous method of type `{0}'"
msgstr ""
"Nem todos os caminhos de código devolvem um valor num método anônimo do tipo "
"\"{0}\""
-#: mcs/mcs/statement.cs:3081
+#: mcs/mcs/statement.cs:3118
#, fuzzy
msgid "Async methods cannot have ref or out parameters"
msgstr "Iteradores não podem ter parâmetros ref ou out"
-#: mcs/mcs/statement.cs:3087
+#: mcs/mcs/statement.cs:3124
#, fuzzy
msgid "__arglist is not allowed in parameter list of async methods"
msgstr "__arglist não é permitida em parâmetros de listas de iteradores"
-#: mcs/mcs/statement.cs:3093
+#: mcs/mcs/statement.cs:3130
#, fuzzy
msgid "Async methods cannot have unsafe parameters"
msgstr "Iteradores não podem ter parâmetros ref ou out"
-#: mcs/mcs/statement.cs:3288
+#: mcs/mcs/statement.cs:3325
#, csharp-format
msgid "The label `{0}' is a duplicate"
msgstr "O rótulo \"{0}\" é uma duplicata"
-#: mcs/mcs/statement.cs:3297 mcs/mcs/statement.cs:3308
+#: mcs/mcs/statement.cs:3334 mcs/mcs/statement.cs:3345
#, csharp-format
msgid ""
"The label `{0}' shadows another label by the same name in a contained scope"
msgstr ""
"O rótulo \"{0}\" esconde outro rótulo pelo mesmo nome em um escopo contido"
-#: mcs/mcs/statement.cs:3604
+#: mcs/mcs/statement.cs:3641
#, csharp-format
msgid "The label `case {0}:' already occurs in this switch statement"
msgstr "O rótulo \"case {0}:\" já ocorre nesta declaração de switch"
-#: mcs/mcs/statement.cs:4123
+#: mcs/mcs/statement.cs:4160
#, csharp-format
msgid ""
"A switch expression of type `{0}' cannot be converted to an integral type, "
"bool, char, string, enum or nullable type"
msgstr ""
-#: mcs/mcs/statement.cs:4734
+#: mcs/mcs/statement.cs:4771
#, csharp-format
msgid "`{0}' is not a reference type as required by the lock statement"
msgstr ""
"\"{0}\" não é um tipo de referência como necessário para a declaração lock"
-#: mcs/mcs/statement.cs:5081
+#: mcs/mcs/statement.cs:5118
msgid "The type of locals declared in a fixed statement must be a pointer type"
msgstr ""
"O tipo de locais declarados em uma declaração fixa devem ser tipos ponteiros"
-#: mcs/mcs/statement.cs:5097
+#: mcs/mcs/statement.cs:5134
msgid ""
"The right hand side of a fixed statement assignment may not be a cast "
"expression"
msgstr "O lado direito de uma declaração fixa não deve ser uma expressão cast"
-#: mcs/mcs/statement.cs:5167
+#: mcs/mcs/statement.cs:5204
msgid ""
"You cannot use the fixed statement to take the address of an already fixed "
"expression"
"Você não pode usar a declaração fixa para pegar o endereço de uma expressão "
"já fixa"
-#: mcs/mcs/statement.cs:5523
+#: mcs/mcs/statement.cs:5560
#, csharp-format
msgid ""
"A previous catch clause already catches all exceptions of this or a super "
"Uma cláusula catch anterior já pega todas as exceções do this ou um tipo "
"super \"{0}\""
-#: mcs/mcs/statement.cs:5663
+#: mcs/mcs/statement.cs:5700
#, csharp-format
msgid ""
"`{0}': type used in a using statement must be implicitly convertible to "
"\"{0}\": tipo utilizado em uma declaração em uso deve ser implicitamente "
"conversível para \"System.IDisposable\""
-#: mcs/mcs/statement.cs:6067
+#: mcs/mcs/statement.cs:6104
#, csharp-format
msgid ""
"foreach statement requires that the return type `{0}' of `{1}' must have a "
"declaração do foreach requer que o tipo de retorno \"{0}\" de \"{1}\" deve "
"ter um método apropriado público MoveNext e a propriedade pública Current"
-#: mcs/mcs/statement.cs:6112
+#: mcs/mcs/statement.cs:6149
#, csharp-format
msgid ""
"foreach statement cannot operate on variables of type `{0}' because it "
"estas contém múltiplas implementações de \"{1}\". Tente um casting para uma "
"implementação específica"
-#: mcs/mcs/statement.cs:6141
+#: mcs/mcs/statement.cs:6178
#, fuzzy, csharp-format
msgid ""
"foreach statement cannot operate on variables of type `{0}' because it does "
"declaração do foreach não pode operar em variáveis do tipo \"{0}\" pois "
"estas não contém uma definição para \"GetEnumerator\" ou não estão acessíveis"
-#: mcs/mcs/statement.cs:6372
+#: mcs/mcs/statement.cs:6409
msgid "Use of null is not valid in this context"
msgstr "Uso do null é inválido neste contexto"
-#: mcs/mcs/statement.cs:6384
+#: mcs/mcs/statement.cs:6421
#, csharp-format
msgid "Foreach statement cannot operate on a `{0}'"
msgstr "Declaração do foreach não pode operar em um \"{0}\""
-#: mcs/mcs/typemanager.cs:771
+#: mcs/mcs/typemanager.cs:785
#, csharp-format
msgid "The predefined type `{0}.{1}' is not defined or imported"
msgstr "O tipo predefinido \"{0}.{1}\" não está definido ou importado"
-#: mcs/mcs/typemanager.cs:816
+#: mcs/mcs/typemanager.cs:830
#, fuzzy, csharp-format
msgid ""
"The predefined type `{0}.{1}' is defined multiple times. Using definition "
"from `{2}'"
msgstr "O tipo importado \"{0}\" é definido múltiplas vezes"
-#: mcs/mcs/typemanager.cs:831
+#: mcs/mcs/typemanager.cs:845
#, csharp-format
msgid "The predefined type `{0}.{1}' is not declared correctly"
msgstr "O tipo predefinido \"{0}.{1}\" não está declarado corretamente"
-#: mcs/mcs/typemanager.cs:956
+#: mcs/mcs/typemanager.cs:970
#, csharp-format
msgid ""
"The compiler required member `{0}.{1}{2}' could not be found or is "
"O membro necessário para o compilador \"{0}.{1}{2}\" não pode ser encontrado "
"ou é inacessível"
-#: mcs/mcs/typemanager.cs:1070
+#: mcs/mcs/typemanager.cs:1084
#, csharp-format
msgid ""
"Cannot take the address of, get the size of, or declare a pointer to a "
"Não foi possível obter o acesso de, conseguir o tamanho de, ou declarar um "
"ponteiro para um tipo gerenciado \"{0}\""
+#~ msgid "Source file `{0}' could not be found"
+#~ msgstr "Arquivo fonte \"{0}\" não pôde ser encontrado"
+
+#~ msgid "Source file `{0}' is a binary file and not a text file"
+#~ msgstr "Arquivo fonte \"{0}\" é um arquivo binário e não um arquivo texto"
+
+#~ msgid ""
+#~ "The type or namespace name `{0}' could not be found. Are you missing a "
+#~ "using directive or an assembly reference?"
+#~ msgstr ""
+#~ "O tipo ou nome de namespace \"{0}\" não pôde ser encontrado. Você está "
+#~ "esquecendo de uma diretiva em uso ou uma referência do assembly?"
+
#, fuzzy
#~ msgid "An expression tree cannot contain an await operator"
#~ msgstr "Uma árvore de expressão não pode conter um operador de atribuição"
cd $(mcs_topdir)/ && $(MAKE) NO_DIR_CHECK=1 PROFILE=moonlight_raw clean
endif
+if ONLY_MONOTOUCH
+build_profiles = monotouch
+else
if ONLY_MOONLIGHT
build_profiles = moonlight_raw
test_profiles = moonlight_raw
test_profiles = $(build_profiles)
+endif
endif
if BUILD_MCS