# https://github.com/blog/2392-introducing-code-owners
# https://help.github.com/articles/about-codeowners
-acceptance-tests/profiler-stress @alexrp
+acceptance-tests/* @akoeplinger
+acceptance-tests/profiler-stress* @alexrp
docs/sources/mono-api-profiler.html @alexrp
+man @marek-safar @miguel
man/mprof-report.1 @alexrp
+mcs/build @marek-safar
+mcs/class @marek-safar
+mcs/class/corlib/System.Reflection*/ @vargaz @lambdageek
+mcs/class/Mono.Btls.Interface @baulig
+mcs/class/Mono.Data.Tds @egorbo
+mcs/class/Mono.Debugger.Soft @vargaz
+mcs/class/Mono.Options @jonpryor
mcs/class/Mono.Profiler.Log @alexrp
-mono/metadata/profiler* @alexrp
+mcs/class/Mono.Security/Mono.Security/Interface @baulig
+mcs/class/System/Mono.AppleTls @baulig
+mcs/class/System/Mono.Btls @baulig
+mcs/class/System/Mono.Net.Security @baulig
+mcs/class/System/Mono.Security.Interface @baulig
+mcs/class/System.Data @egorbo
+mcs/errors @marek-safar
+mcs/mcs @marek-safar
+mcs/tests @marek-safar
+mono/eglib @kumpera
+mono/metadata @vargaz
+mono/metadata/*profiler* @alexrp
+mono/metadata/monitor* @brzvlad
+mono/metadata/sgen* @brzvlad
+mono/metadata/threads* @luhenry @kumpera
+mono/metadata/threadpool* @luhenry
+mono/metadata/w32* @luhenry
+mono/mini @vargaz
+mono/mini/*cfgdump* @lewurm
+mono/mini/*exceptions* @lewurm
+mono/mini/*ppc* @lewurm
+mono/mini/*type-check* @lewurm
+mono/mini/interp/* @lewurm
+mono/mini/*profiler* @alexrp
mono/profiler @alexrp
+mono/sgen @brzvlad
+mono/utils @kumpera
mono/utils/atomic* @alexrp
mono/utils/mono-hwcap* @alexrp
mono/utils/mono-mem* @alexrp
+mono/utils/mono-threads* @luhenry @kumpera
msvc/*profiler* @alexrp
+msvc/scripts @akoeplinger
+packaging/Windows @akoeplinger
samples/profiler @alexrp
samples/size @alexrp
+scripts @akoeplinger
+scripts/ci @akoeplinger
scripts/ci/run-test-profiler-stress-tests.sh @alexrp
The Mono runtime, compilers, and tools and most of the class libraries
are licensed under the MIT license. But include some bits of code
-licensed under different licenses. The exact list is [available here] (https://github.com/mono/mono/blob/master/LICENSE).
+licensed under different licenses. The exact list is [available here](https://github.com/mono/mono/blob/master/LICENSE).
Different parts of Mono use different licenses. The actual details of
which licenses are used for which parts are detailed on the LICENSE
CLA
=======
-Contributions are now taken under the [.NET Foundation CLA] (https://cla2.dotnetfoundation.org/).
+Contributions are now taken under the [.NET Foundation CLA](https://cla2.dotnetfoundation.org/).
Testing
=======
AM_CFLAGS = $(WERROR_CFLAGS)
-MONOTOUCH_SUBDIRS = $(libgc_dir) eglib/src mono
+MONOTOUCH_SUBDIRS = $(libgc_dir) mono
# Some tools might not build when cross-compiling
if CROSS_COMPILING
tools_dir = tools
endif
-SUBDIRS = po $(libgc_dir) eglib mono $(ikvm_native_dir) support data runtime scripts man samples $(tools_dir) msvc $(docs_dir) acceptance-tests llvm
+SUBDIRS = po $(libgc_dir) mono $(ikvm_native_dir) support data runtime scripts man samples $(tools_dir) msvc $(docs_dir) acceptance-tests llvm
# Keep in sync with SUBDIRS
-DIST_SUBDIRS = m4 po $(libgc_dir) eglib mono ikvm-native support data runtime scripts man samples tools msvc docs acceptance-tests llvm
+DIST_SUBDIRS = m4 po $(libgc_dir) mono ikvm-native support data runtime scripts man samples tools msvc docs acceptance-tests llvm
all: update_submodules
check-profiler-stress:
@$(MAKE) validate-benchmarker RESET_VERSIONS=1
- cd profiler-stress && $(MCS) -target:exe $(addprefix -r:, $(SYS_REFS)) -out:runner.exe @runner.exe.sources
+ cd profiler-stress && $(MCS) -debug -define:ARCH_$(arch_target) -target:exe $(addprefix -r:, $(SYS_REFS)) -out:runner.exe @runner.exe.sources
cd profiler-stress && $(RUNTIME) runner.exe
public ProcessStartInfo StartInfo { get; set; }
public Stopwatch Stopwatch { get; set; } = new Stopwatch ();
public int? ExitCode { get; set; }
- public StringBuilder StandardOutput { get; set; } = new StringBuilder ();
- public StringBuilder StandardError { get; set; } = new StringBuilder ();
+ public string StandardOutput { get; set; }
+ public string StandardError { get; set; }
}
static class Program {
static readonly string[] _options = new [] {
- "domain",
- "assembly",
- "module",
- "class",
- "jit",
"exception",
- "gcalloc",
- "gc",
- "thread",
- // "calls", // Way too heavy.
"monitor",
+ "gc",
+ "gcalloc",
"gcmove",
"gcroot",
- "context",
+ "gchandle",
"finalization",
"counter",
- "gchandle",
+ "jit",
};
- static readonly TimeSpan _timeout = TimeSpan.FromHours (6);
+ static readonly TimeSpan _timeout = TimeSpan.FromHours (8);
+
+ static readonly Dictionary<string, Predicate<Benchmark>> _filters = new Dictionary<string, Predicate<Benchmark>> {
+ { "ironjs-v8", FilterArmArchitecture },
+ };
+
+ static readonly Dictionary<string, Action<TestResult>> _processors = new Dictionary<string, Action<TestResult>> {
+ { "msbiology", Process32BitOutOfMemory },
+ };
static string FilterInvalidXmlChars (string text) {
return Regex.Replace (text, @"[^\x09\x0A\x0D\x20-\uD7FF\uE000-\uFFFD\u10000-\u10FFFF]", string.Empty);
}
+ static bool FilterArmArchitecture (Benchmark benchmark)
+ {
+#if ARCH_arm || ARCH_arm64
+ return false;
+#else
+ return true;
+#endif
+ }
+
+ static void Process32BitOutOfMemory (TestResult result)
+ {
+ if (Environment.Is64BitProcess)
+ return;
+
+ if (result.ExitCode == null || result.ExitCode == 0)
+ return;
+
+ if (result.StandardError.Contains ("OutOfMemoryException"))
+ result.ExitCode = 0;
+ }
+
+ static bool IsSupported (Benchmark benchmark)
+ {
+ return _filters.TryGetValue (benchmark.Name, out var filter) ? filter (benchmark) : true;
+ }
+
static int Main ()
{
var depDir = Path.Combine ("..", "external", "benchmarker");
var benchmarks = Directory.EnumerateFiles (benchDir, "*.benchmark")
.Select (Benchmark.Load)
- .Where (b => !b.OnlyExplicit && b.ClientCommandLine == null)
+ .Where (b => !b.OnlyExplicit && b.ClientCommandLine == null && IsSupported (b))
.OrderBy (b => b.Name)
.ToArray ();
var bench = benchmarks [i];
var sampleFreq = rand.Next (-1000, 1001);
- var sampleMode = rand.Next (0, 2) == 1 ? "real" : "process";
+ var sampleMode = rand.Next (0, 2) == 1 ? "-real" : string.Empty;
var maxSamples = rand.Next (0, cpus * 2000 + 1);
var heapShotFreq = rand.Next (-10, 11);
var maxFrames = rand.Next (0, 33);
var profOptions = $"maxframes={maxFrames},{string.Join (",", options)},output=/dev/null";
if (sampleFreq > 0)
- profOptions += $",sample={sampleFreq},sampling-{sampleMode},maxsamples={maxSamples}";
+ profOptions += $",sample{sampleMode}={sampleFreq},maxsamples={maxSamples}";
if (heapShotFreq > 0)
profOptions += $",heapshot={heapShotFreq}gc";
using (var proc = new Process ()) {
proc.StartInfo = info;
+ var stdout = new StringBuilder ();
+ var stderr = new StringBuilder ();
+
proc.OutputDataReceived += (sender, args) => {
if (args.Data != null)
- result.StandardOutput.AppendLine (args.Data);
+ lock (result)
+ stdout.AppendLine (args.Data);
};
proc.ErrorDataReceived += (sender, args) => {
if (args.Data != null)
- result.StandardError.AppendLine (args.Data);
+ lock (result)
+ stderr.AppendLine (args.Data);
};
result.Stopwatch.Start ();
result.ExitCode = proc.ExitCode;
result.Stopwatch.Stop ();
+
+ lock (result) {
+ result.StandardOutput = stdout.ToString ();
+ result.StandardError = stderr.ToString ();
+ }
}
var resultStr = result.ExitCode == null ? "timed out" : $"exited with code: {result.ExitCode}";
Console.WriteLine ("===== stdout =====");
Console.ResetColor ();
- Console.WriteLine (result.StandardOutput.ToString ());
+ Console.WriteLine (result.StandardOutput);
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine ("===== stderr =====");
Console.ResetColor ();
- Console.WriteLine (result.StandardError.ToString ());
+ Console.WriteLine (result.StandardError);
}
+ if (_processors.TryGetValue (bench.Name, out var processor))
+ processor (result);
+
results.Add (result);
}
writer.WriteStartElement ("failure");
writer.WriteStartElement ("message");
- writer.WriteCData (FilterInvalidXmlChars (result.StandardOutput.ToString ()));
+ writer.WriteCData (FilterInvalidXmlChars (result.StandardOutput));
writer.WriteEndElement ();
writer.WriteStartElement ("stack-trace");
- writer.WriteCData (FilterInvalidXmlChars (result.StandardError.ToString ()));
+ writer.WriteCData (FilterInvalidXmlChars (result.StandardError));
writer.WriteEndElement ();
writer.WriteEndElement ();
echo Done running libgc/autogen.sh ...
fi
-if test -d $srcdir/eglib; then
- echo Running eglib/autogen.sh ...
- (cd $srcdir/eglib ; NOCONFIGURE=1 ./autogen.sh "$@")
- echo Done running eglib/autogen.sh ...
-fi
-
if test x$MONO_EXTRA_CONFIGURE_FLAGS != x; then
echo "MONO_EXTRA_CONFIGURE_FLAGS is $MONO_EXTRA_CONFIGURE_FLAGS"
fi
# Process this file with autoconf to produce a configure script.
#AC_PREREQ([2.62])
-AC_INIT(mono, [5.5.0],
+AC_INIT(mono, [5.7.0],
[http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono])
AC_CONFIG_SRCDIR([README.md])
# This can be reset to 0 when Mono's version number is bumped
# since it's part of the corlib version (the prefix '1' in the full
# version number is to ensure the number isn't treated as octal in C)
-MONO_CORLIB_COUNTER=2
+MONO_CORLIB_COUNTER=0
MONO_CORLIB_VERSION=`printf "1%02d%02d%02d%03d" $MONO_VERSION_MAJOR $MONO_VERSION_MINOR $MONO_VERSION_BUILD $MONO_CORLIB_COUNTER`
AC_DEFINE_UNQUOTED(MONO_CORLIB_VERSION,$MONO_CORLIB_VERSION,[Version of the corlib-runtime interface])
# libgc should inherit the original CFLAGS/CPPFLAGS passed to configure, i.e. -O0
CPPFLAGS_FOR_LIBGC=$CPPFLAGS
CFLAGS_FOR_LIBGC=$CFLAGS
-CPPFLAGS_FOR_EGLIB=$CPPFLAGS
-CFLAGS_FOR_EGLIB=$CFLAGS
CPPFLAGS_FOR_BTLS=$CPPFLAGS
CFLAGS_FOR_BTLS=$CFLAGS
CCASFLAGS="$CCASFLAGS $BROKEN_DARWIN_FLAGS"
CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC $BROKEN_DARWIN_CPPFLAGS"
CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC $BROKEN_DARWIN_FLAGS"
- CPPFLAGS_FOR_EGLIB="$CPPFLAGS_FOR_EGLIB $BROKEN_DARWIN_CPPFLAGS"
- CFLAGS_FOR_EGLIB="$CFLAGS_FOR_EGLIB $BROKEN_DARWIN_FLAGS"
with_sgen_default_concurrent=yes
;;
x*64-*-darwin*)
if test x"$disable_visibility_hidden" = xno; then
# Don't export any symbols by default
SHARED_CFLAGS="-fvisibility=hidden"
- CFLAGS_FOR_EGLIB="$CFLAGS_FOR_EGLIB -fvisibility=hidden"
CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
fi
fi
)
+AC_CHECK_PROG(ninja, ninja, yes, no)
+AM_CONDITIONAL(NINJA, test x$ninja != xno)
+
AC_ARG_ENABLE(werror, [ --enable-werror Pass -Werror to the C compiler], werror_flag=$enableval, werror_flag=no)
if test x$werror_flag = xyes; then
WERROR_CFLAGS="-Werror"
AC_SUBST([WERROR_CFLAGS])
AC_SUBST([SHARED_CFLAGS])
-ac_configure_args="$ac_configure_args \"CPPFLAGS_FOR_EGLIB=$EGLIB_CPPFLAGS\" \"CFLAGS_FOR_EGLIB=$CFLAGS_FOR_EGLIB\""
-AC_CONFIG_SUBDIRS(eglib)
-
-GLIB_CFLAGS='-I$(top_srcdir)/eglib/src -I$(top_builddir)/eglib/src'
-GLIB_LIBS='-L$(top_builddir)/eglib/src -leglib -lm'
+GLIB_CFLAGS='-I$(top_srcdir)/mono/eglib -I$(top_builddir)/mono/eglib'
+GLIB_LIBS='$(top_builddir)/mono/eglib/libeglib.la -lm'
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
if test $endian = big; then
csc_compiler=mcs
elif test $endian = little; then
- csc_compiler=roslyn
+ case "$host" in
+ powerpc*) csc_compiler=mcs ;;
+ *) csc_compiler=roslyn ;;
+ esac
else
csc_compiler=mcs
fi
AC_ARG_WITH(unreal, [ --with-unreal=yes,no If you want to build the Unreal assemblies (defaults to no)], [], [with_unreal=default])
-AC_ARG_WITH(runtime_preset, [ --with-runtime_preset=net_4_x,all,aot,hybridaot,fullaot,bitcode Which default profile to build (defaults to net_4_x)], [], [with_runtime_preset=net_4_x])
+AC_ARG_WITH(runtime_preset, [ --with-runtime_preset=net_4_x,all,aot,hybridaot,fullaot,bitcode,unreal Which default profile to build (defaults to net_4_x)], [], [with_runtime_preset=net_4_x])
dnl
dnl Profile defaults
elif test x$with_runtime_preset = xunreal; then
DISABLE_MCS_DOCS_default=yes
with_unreal_default=yes
- TEST_PROFILE=ounreal
+ TEST_PROFILE=unreal
mono_feature_disable_com='yes'
mono_feature_disable_remoting='yes'
- mono_feature_disable_appdomains='yes'
+ mono_feature_disable_appdomains='no'
AOT_BUILD_FLAGS="--runtime=mobile --aot=hybrid,$INVARIANT_AOT_OPTIONS"
AOT_RUN_FLAGS="--runtime=mobile --hybrid-aot"
CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC -DTARGET_IOS"
CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC -DTARGET_IOS"
BTLS_SUPPORTED=no
+ target_ios=yes
])
fi
AC_DEFINE(TARGET_MACH,1,[The JIT/AOT targets Apple platforms])
AC_DEFINE(SIZEOF_REGISTER,SIZEOF_VOID_P,[size of machine integer registers])
fi
+AC_SUBST(SIZEOF_VOID_P,[$ac_cv_sizeof_void_p])
+
if test "x$target_byte_order" = "xG_BIG_ENDIAN"; then
AC_DEFINE(TARGET_BYTE_ORDER,G_BIG_ENDIAN,[byte order of target])
elif test "x$target_byte_order" = "xG_LITTLE_ENDIAN"; then
;;
esac
-
AC_SUBST(libsuffix)
+######################################
+# EGLIB CHECKS
+######################################
+
+GNUC_PRETTY=
+GNUC_UNUSED=
+BREAKPOINT="G_STMT_START { raise (SIGTRAP); } G_STMT_END"
+if test x$GCC = xyes; then
+ GNUC_UNUSED='__attribute__((__unused__))'
+ GNUC_NORETURN='__attribute__((__noreturn__))'
+ case $host_cpu in
+ i*86|x86_64) BREAKPOINT="G_STMT_START { __asm__ (\"int \$03\"); } G_STMT_END" ;;
+ esac
+fi
+AC_SUBST(GNUC_PRETTY)
+AC_SUBST(GNUC_UNUSED)
+AC_SUBST(GNUC_NORETURN)
+AC_SUBST(BREAKPOINT)
+
+AC_C_BIGENDIAN([ORDER=G_BIG_ENDIAN],[ORDER=G_LITTLE_ENDIAN])
+
+case $host in
+*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
+ PATHSEP='\\'
+ SEARCHSEP=';'
+ OS="WIN32"
+ PIDTYPE='void *'
+ ;;
+*)
+ PATHSEP='/'
+ SEARCHSEP=':'
+ OS="UNIX"
+ PIDTYPE='int'
+ ;;
+esac
+
+case $host in
+ *-*-solaris*)
+ CFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS"
+ ;;
+esac
+
+case $target in
+arm*-darwin*|aarch64*-*)
+ CFLAGS="$CFLAGS -U_FORTIFY_SOURCE"
+ ;;
+i*86-*-darwin*)
+ ORDER=G_LITTLE_ENDIAN
+ ;;
+*-*-haiku*)
+ LDFLAGS="$LDFLAGS -ltextencoding"
+ ;;
+*-*-openbsd*)
+ CFLAGS="$CFLAGS -pthread"
+ LDFLAGS="$LDFLAGS -pthread"
+ ;;
+esac
+
+AC_SUBST(ORDER)
+AC_SUBST(CFLAGS)
+AC_SUBST(PATHSEP)
+AC_SUBST(SEARCHSEP)
+AC_SUBST(OS)
+AC_SUBST(PIDTYPE)
+
+# Defined for all targets/platforms using classic Windows API support.
+AC_DEFINE(HAVE_CLASSIC_WINAPI_SUPPORT, 1, [Use classic Windows API support])
+AC_DEFINE(HAVE_UWP_WINAPI_SUPPORT, 0, [Don't use UWP Windows API support])
+
+AC_CHECK_SIZEOF(int)
+AC_CHECK_SIZEOF(void *)
+AC_CHECK_SIZEOF(long)
+AC_CHECK_SIZEOF(long long)
+AC_CHECK_FUNCS(strlcpy stpcpy strtok_r rewinddir vasprintf strerror_r)
+AC_CHECK_FUNCS(getrlimit)
+AC_CHECK_FUNCS(fork execv execve)
+
+AC_ARG_WITH([overridable-allocators], [ --with-overridable-allocators allow g_*alloc/g_free to call custom allocators set via g_mem_set_vtable])
+
+if test x$with_overridable_allocators = xyes; then
+ AC_DEFINE(ENABLE_OVERRIDABLE_ALLOCATORS,1,[Overridable allocator support enabled])
+ AC_MSG_NOTICE([Overridable allocator support enabled])
+else
+ AC_MSG_NOTICE([Overridable allocator support disabled])
+fi
+
+#
+# Mono currently supports 10.6, but strndup is not available prior to 10.7; avoiding
+# the detection of strndup on OS X so Mono built on 10.7+ still runs on 10.6. This can be
+# removed once support for 10.6 is dropped.
+#
+# iOS detection of strndup and getpwuid_r is faulty for some reason so let's simply avoid it
+#
+if test x$target_osx = xyes; then
+AC_CHECK_FUNCS(getpwuid_r)
+elif test x$target_ios = xno; then
+AC_CHECK_FUNCS(strndup getpwuid_r)
+fi
+
+AM_CONDITIONAL(NEED_VASPRINTF, test x$ac_cv_func_vasprintf = xno || test x$with_overridable_allocators = xyes)
+AM_ICONV()
+AC_SEARCH_LIBS(sqrtf, m)
+
+# nanosleep may not be part of libc, also search it in other libraries
+AC_SEARCH_LIBS(nanosleep, rt)
+
+AC_SEARCH_LIBS(dlopen, dl)
+old_ldflags="${LDFLAGS}"
+LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
+AC_TRY_LINK(, [int i;], found_export_dynamic=yes, found_export_dynamic=no)
+if test $found_export_dynamic = no; then
+ LDFLAGS="${old_ldflags}"
+fi
+
+AC_MSG_CHECKING(for varargs macros)
+AC_TRY_COMPILE([],[
+int foo (int i, int j);
+#define bar(...) foo (1, __VA_ARGS__)
+void main () {
+ bar (2);
+}
+],have_iso_varargs=yes,have_iso_varargs=no)
+AC_MSG_RESULT($have_iso_varargs)
+G_HAVE_ISO_VARARGS=0
+if test "x$have_iso_varargs" = "xyes"; then
+ G_HAVE_ISO_VARARGS=1
+fi
+AC_SUBST(G_HAVE_ISO_VARARGS)
+
+AC_CHECK_HEADERS(getopt.h sys/select.h sys/time.h sys/wait.h pwd.h iconv.h localcharset.h sys/types.h sys/resource.h)
+AC_CHECK_LIB([iconv], [locale_charset],[],[AC_CHECK_LIB([charset], [locale_charset],[LIBS+="-liconv -lcharset"])])
+AC_CHECK_HEADER(alloca.h, [HAVE_ALLOCA_H=1], [HAVE_ALLOCA_H=0])
+AC_SUBST(HAVE_ALLOCA_H)
+
+if test $ac_cv_sizeof_void_p = $ac_cv_sizeof_int; then
+ GPOINTER_TO_INT="((gint) (ptr))"
+ GPOINTER_TO_UINT="((guint) (ptr))"
+ GINT_TO_POINTER="((gpointer) (v))"
+ GUINT_TO_POINTER="((gpointer) (v))"
+ GSIZE="int"
+ GSIZE_FORMAT='"u"'
+elif test $ac_cv_sizeof_void_p = $ac_cv_sizeof_long; then
+ GPOINTER_TO_INT="((gint)(long) (ptr))"
+ GPOINTER_TO_UINT="((guint)(long) (ptr))"
+ GINT_TO_POINTER="((gpointer)(glong) (v))"
+ GUINT_TO_POINTER="((gpointer)(gulong) (v))"
+ GSIZE="long"
+ GSIZE_FORMAT='"lu"'
+elif test $ac_cv_sizeof_void_p = $ac_cv_sizeof_long_long; then
+ GPOINTER_TO_INT="((gint)(long long) (ptr))"
+ GPOINTER_TO_UINT="((guint)(unsigned long long) (ptr))"
+ GINT_TO_POINTER="((gpointer)(long long) (v))"
+ GUINT_TO_POINTER="((gpointer)(unsigned long long) (v))"
+ GSIZE="long long"
+ GSIZE_FORMAT='"I64u"'
+else
+ AC_MSG_ERROR([unsupported pointer size])
+fi
+
+AC_SUBST(GPOINTER_TO_INT)
+AC_SUBST(GPOINTER_TO_UINT)
+AC_SUBST(GINT_TO_POINTER)
+AC_SUBST(GUINT_TO_POINTER)
+AC_SUBST(GSIZE)
+AC_SUBST(GSIZE_FORMAT)
+AC_SUBST(G_GUINT64_FORMAT)
+AC_SUBST(G_GINT64_FORMAT)
+AC_SUBST(G_GUINT32_FORMAT)
+AC_SUBST(G_GINT32_FORMAT)
+
+#
+# END OF EGLIB CHECKS
+#
+
AC_ARG_WITH([libgdiplus],
[ --with-libgdiplus=installed|sibling|<path> Override the libgdiplus used for System.Drawing tests (defaults to installed)],
[], [with_libgdiplus=installed])
mono_runtime=mono/mini/mono
AC_SUBST(mono_runtime)
-CSC_LOCATION=`cd $srcdir && pwd`/external/roslyn-binaries/Microsoft.Net.Compilers/Microsoft.Net.Compilers.2.3.0/tools/csc.exe
+CSC_LOCATION=`cd $srcdir && pwd`/external/roslyn-binaries/Microsoft.Net.Compilers/Microsoft.Net.Compilers.2.3.1/tools/csc.exe
if test $csc_compiler = mcs; then
CSC=$mcs_topdir/class/lib/build/mcs.exe
mono/benchmark/Makefile
mono/mini/Makefile
mono/profiler/Makefile
+mono/eglib/Makefile
+mono/eglib/eglib-config.h
m4/Makefile
ikvm-native/Makefile
scripts/Makefile
+++ /dev/null
-/
-/depcomp
-/config.guess
-/config.sub
-/ltmain.sh
-/eglib-*.tar.gz
-/missing
-/install-sh
-/compile
-/Makefile
-/Makefile.in
-/stamp-h1
-/config.h.in
-/libtool
-/autom4te.cache
-/aclocal.m4
-/config.log
-/configure
-/config.h
-/config.status
-/INSTALL
-dolt*
+++ /dev/null
-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.
+++ /dev/null
-ACLOCAL_AMFLAGS = -I m4
-
-AM_CFLAGS = $(WERROR_CFLAGS)
-
-if HOST_WIN32
-SUBDIRS = m4 src
-else
-if PLATFORM_DARWIN
-SUBDIRS = m4 src
-else
-if CROSS_COMPILING
-SUBDIRS = m4 src
-else
-SUBDIRS = m4 src test
-endif
-endif
-endif
-
-EXTRA_DIST = autogen.sh README NEWS AUTHORS winconfig.h
+++ /dev/null
-
-The purpose of eglib is to be an X11-licensed subset of glib that can
-be used with Mono when the Mono runtime is explicitly relicensed under
-a different license by Novell.
-
-The implementation is done from the public documentation available here:
-
- http://developer.gnome.org/doc/API/2.0/glib/
-
-Currently this is only being built standalone, use:
-
- ./autogen.sh --prefix=/tmp/test
-
-Currently all the definitions go into a single file: glib.h, there are
-no separate files, please try to follow the convetions in the source code
-
-* Tests
-
- Please read the README in tests/
-
-* Features
-
- The source code is designed to allow for different operating
- system builds of the eglib code.
-
- Files in src that:
-
- * Have a plain name: are cross platform, and should work on
- every operating system.
-
- * That end in -unix.c: These files contain Unix specific code.
-
- * That end in -win32.c: These files contain Win32 specific code.
-
- * That end in -posix.c: Will work on both Windows and Unix,
- but should not be included for other operating systems.
-
-* Plans: short and long term.
-
- The short term plans for eglib is to allow Mono to optionally
- build with it instead of using glib, gmodule and gthread, but
- the default build will continue to be done against glib 2.0.
-
- In the long-term we are considering dropping glib as a
- dependency, considering that Mono requires a modern Unix
- system to run anyways (for its thread support) it would allow
- us to fix some of the glib API limitations we have to live
- with (explicit thread support for example), rework the API to
- use types from stdint.h and we would be able to drop three
- external shared libraries.
-
- This would reduce memory usage for the handful of routines
- that we use from glib, dynamic linker overhead for those and
- would allow us to tune the implementation to Mono's needs.
+++ /dev/null
-* Missing code
-
- * Process launching
- 3 g_shell_quote
- 1 g_shell_unquote
-
-----------------------------------------------------------------------
-
-* Should implement, for better performance:
-
-Macros:
- 6 G_UNLIKELY
- 4 G_LIKELY
-
-* Unimplemented, not supported currently:
-
- (none as yet.)
-
-* Dead Code
-
- The GMainLoop code was no longer in use in Mono.
-
-* Windows implementations needed
-
- Directory, File manipulation:
-
- g_dir_open, g_dir_close, g_dir_read_name
-
- We're missing a native windows implementation. The unix one is in place.
-
- * Information retrieval
- 1 g_win32_getlocale
-
+++ /dev/null
-dnl dolt, a replacement for libtool
-dnl Copyright © 2007-2008 Josh Triplett <josh@freedesktop.org>
-dnl Copying and distribution of this file, with or without modification,
-dnl are permitted in any medium without royalty provided the copyright
-dnl notice and this notice are preserved.
-dnl
-dnl To use dolt, invoke the DOLT macro immediately after the libtool macros.
-dnl Optionally, copy this file into acinclude.m4, to avoid the need to have it
-dnl installed when running autoconf on your project.
-
-AC_DEFUN([DOLT], [
-AC_REQUIRE([AC_CANONICAL_HOST])
-# dolt, a replacement for libtool
-# Josh Triplett <josh@freedesktop.org>
-AC_PATH_PROG(DOLT_BASH, bash)
-AC_MSG_CHECKING([if dolt supports this host])
-dolt_supported=yes
-if test x$DOLT_BASH = x; then
- dolt_supported=no
-fi
-if test x$GCC != xyes; then
- dolt_supported=no
-fi
-case $host in
-i?86-*-linux*|i?86-apple-darwin*|x86_64-*-linux*|powerpc-*-linux*|powerpc64-*-linux* \
-|amd64-*-freebsd*|i?86-*-freebsd*|ia64-*-freebsd*|arm*-*-linux*|sparc*-*-linux*|mips*-*-linux*|x86_64-apple-darwin*|aarch64*)
- pic_options='-fPIC'
- ;;
-?86-pc-cygwin*|i?86-pc-cygwin*|i?86-pc-mingw32*)
- pic_options='-DDLL_EXPORT'
- ;;
-i?86-apple-darwin*|arm-apple-darwin*)
- pic_options='-fno-common'
- ;;
-*)
- dolt_supported=no
- ;;
-esac
-if test x$dolt_supported = xno ; then
- AC_MSG_RESULT([no, falling back to libtool])
- LTCOMPILE='$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(COMPILE)'
- LTCXXCOMPILE='$(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXXCOMPILE)'
-else
- AC_MSG_RESULT([yes, replacing libtool])
-
-dnl Start writing out doltcompile.
- cat <<__DOLTCOMPILE__EOF__ >doltcompile
-#!$DOLT_BASH
-__DOLTCOMPILE__EOF__
- cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
-args=("$[]@")
-for ((arg=0; arg<${#args@<:@@@:>@}; arg++)) ; do
- if test x"${args@<:@$arg@:>@}" = x-o ; then
- objarg=$((arg+1))
- break
- fi
-done
-if test x$objarg = x ; then
- echo 'Error: no -o on compiler command line' 1>&2
- exit 1
-fi
-lo="${args@<:@$objarg@:>@}"
-obj="${lo%.lo}"
-if test x"$lo" = x"$obj" ; then
- echo "Error: libtool object file name \"$lo\" does not end in .lo" 1>&2
- exit 1
-fi
-objbase="${obj##*/}"
-__DOLTCOMPILE__EOF__
-
-dnl Write out shared compilation code.
- if test x$enable_shared = xyes; then
- cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
-libobjdir="${obj%$objbase}.libs"
-if test ! -d "$libobjdir" ; then
- mkdir_out="$(mkdir "$libobjdir" 2>&1)"
- mkdir_ret=$?
- if test "$mkdir_ret" -ne 0 && test ! -d "$libobjdir" ; then
- echo "$mkdir_out" 1>&2
- exit $mkdir_ret
- fi
-fi
-pic_object="$libobjdir/$objbase.o"
-args@<:@$objarg@:>@="$pic_object"
-__DOLTCOMPILE__EOF__
- cat <<__DOLTCOMPILE__EOF__ >>doltcompile
-"\${args@<:@@@:>@}" $pic_options -DPIC || exit \$?
-__DOLTCOMPILE__EOF__
- fi
-
-dnl Write out static compilation code.
-dnl Avoid duplicate compiler output if also building shared objects.
- if test x$enable_static = xyes; then
- cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
-non_pic_object="$obj.o"
-args@<:@$objarg@:>@="$non_pic_object"
-__DOLTCOMPILE__EOF__
- if test x$enable_shared = xyes; then
- cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
-"${args@<:@@@:>@}" >/dev/null 2>&1 || exit $?
-__DOLTCOMPILE__EOF__
- else
- cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
-"${args@<:@@@:>@}" || exit $?
-__DOLTCOMPILE__EOF__
- fi
- fi
-
-dnl Write out the code to write the .lo file.
-dnl The second line of the .lo file must match "^# Generated by .*libtool"
- cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
-{
-echo "# $lo - a libtool object file"
-echo "# Generated by doltcompile, not libtool"
-__DOLTCOMPILE__EOF__
-
- if test x$enable_shared = xyes; then
- cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
-echo "pic_object='.libs/${objbase}.o'"
-__DOLTCOMPILE__EOF__
- else
- cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
-echo pic_object=none
-__DOLTCOMPILE__EOF__
- fi
-
- if test x$enable_static = xyes; then
- cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
-echo "non_pic_object='${objbase}.o'"
-__DOLTCOMPILE__EOF__
- else
- cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
-echo non_pic_object=none
-__DOLTCOMPILE__EOF__
- fi
-
- cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
-} > "$lo"
-__DOLTCOMPILE__EOF__
-
-dnl Done writing out doltcompile; substitute it for libtool compilation.
- chmod +x doltcompile
- LTCOMPILE='$(top_builddir)/doltcompile $(COMPILE)'
- LTCXXCOMPILE='$(top_builddir)/doltcompile $(CXXCOMPILE)'
-
-dnl automake ignores LTCOMPILE and LTCXXCOMPILE when it has separate CFLAGS for
-dnl a target, so write out a libtool wrapper to handle that case.
-dnl Note that doltlibtool does not handle inferred tags or option arguments
-dnl without '=', because automake does not use them.
- cat <<__DOLTLIBTOOL__EOF__ > doltlibtool
-#!$DOLT_BASH
-__DOLTLIBTOOL__EOF__
- cat <<'__DOLTLIBTOOL__EOF__' >>doltlibtool
-top_builddir_slash="${0%%doltlibtool}"
-: ${top_builddir_slash:=./}
-args=()
-modeok=false
-tagok=false
-for arg in "$[]@"; do
- case "$arg" in
- --silent) ;;
- --mode=compile) modeok=true ;;
- --tag=CC|--tag=CXX) tagok=true ;;
- --quiet) ;;
- *) args@<:@${#args[@]}@:>@="$arg" ;;
- esac
-done
-if $modeok && $tagok ; then
- . ${top_builddir_slash}doltcompile "${args@<:@@@:>@}"
-else
- exec ${top_builddir_slash}libtool "$[]@"
-fi
-__DOLTLIBTOOL__EOF__
-
-dnl Done writing out doltlibtool; substitute it for libtool.
- chmod +x doltlibtool
- LIBTOOL='$(top_builddir)/doltlibtool'
-fi
-AC_SUBST(LTCOMPILE)
-AC_SUBST(LTCXXCOMPILE)
-# end dolt
-])
+++ /dev/null
-#!/bin/sh
-# Run this to generate all the initial makefiles, etc.
-# Ripped off from GNOME macros version
-
-DIE=0
-
-srcdir=`dirname $0`
-test -z "$srcdir" && srcdir=.
-
-if [ -n "$MONO_PATH" ]; then
- # from -> /mono/lib:/another/mono/lib
- # to -> /mono /another/mono
- for i in `echo ${MONO_PATH} | tr ":" " "`; do
- i=`dirname ${i}`
- if [ -n "{i}" -a -d "${i}/share/aclocal" ]; then
- ACLOCAL_FLAGS="-I ${i}/share/aclocal $ACLOCAL_FLAGS"
- fi
- if [ -n "{i}" -a -d "${i}/bin" ]; then
- PATH="${i}/bin:$PATH"
- fi
- done
- export PATH
-fi
-
-(autoconf --version) < /dev/null > /dev/null 2>&1 || {
- echo
- echo "**Error**: You must have \`autoconf' installed to compile Mono."
- echo "Download the appropriate package for your distribution,"
- echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
- DIE=1
-}
-
-if [ -z "$LIBTOOLIZE" ]; then
- LIBTOOLIZE=`which glibtoolize 2>/dev/null`
- if [ ! -x "$LIBTOOLIZE" ]; then
- LIBTOOLIZE=`which libtoolize`
- fi
-fi
-
-(grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && {
- ($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 || {
- echo
- echo "**Error**: You must have \`libtoolize' installed to compile Mono."
- echo "Get ftp://ftp.gnu.org/gnu/libtool/libtool-1.2.tar.gz"
- echo "(or a newer version if it is available)"
- DIE=1
- }
-}
-
-grep "^AM_GNU_GETTEXT" $srcdir/configure.ac >/dev/null && {
- grep "sed.*POTFILES" $srcdir/configure.ac >/dev/null || \
- (gettext --version) < /dev/null > /dev/null 2>&1 || {
- echo
- echo "**Error**: You must have \`gettext' installed to compile Mono."
- echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
- echo "(or a newer version if it is available)"
- DIE=1
- }
-}
-
-(automake --version) < /dev/null > /dev/null 2>&1 || {
- echo
- echo "**Error**: You must have \`automake' installed to compile Mono."
- echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
- echo "(or a newer version if it is available)"
- DIE=1
- NO_AUTOMAKE=yes
-}
-
-
-# if no automake, don't bother testing for aclocal
-test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
- echo
- echo "**Error**: Missing \`aclocal'. The version of \`automake'"
- echo "installed doesn't appear recent enough."
- echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
- echo "(or a newer version if it is available)"
- DIE=1
-}
-
-if test "$DIE" -eq 1; then
- exit 1
-fi
-
-if test x$NOCONFIGURE = x && test -z "$*"; then
- echo "**Warning**: I am going to run \`configure' with no arguments."
- echo "If you wish to pass any to it, please specify them on the"
- echo \`$0\'" command line."
- echo
-fi
-
-case $CC in
-xlc )
- am_opt=--include-deps;;
-esac
-
-
-if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then
- if test -z "$NO_LIBTOOLIZE" ; then
- echo "Running libtoolize..."
- $LIBTOOLIZE --force --copy
- fi
-fi
-
-echo "Running aclocal -I m4 $ACLOCAL_FLAGS ..."
-aclocal -I m4 $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"
- echo "set ACLOCAL_FLAGS to include \"-I \$prefix/share/aclocal\""
- echo "for the prefix where you installed the packages whose"
- echo "macros were not found"
- exit 1
-}
-
-if grep "^AC_CONFIG_HEADERS" configure.ac >/dev/null; then
- echo "Running autoheader..."
- autoheader || { echo "**Error**: autoheader failed."; exit 1; }
-fi
-
-echo "Running automake --gnu $am_opt ..."
-automake --add-missing --gnu $am_opt ||
- { echo "**Error**: automake failed."; exit 1; }
-echo "Running autoconf ..."
-autoconf || { echo "**Error**: autoconf failed."; exit 1; }
-
-
-conf_flags="--enable-maintainer-mode" #--enable-compile-warnings --enable-iso-c
-
-if test x$NOCONFIGURE = x; then
- echo Running $srcdir/configure $conf_flags "$@" ...
- $srcdir/configure $conf_flags "$@" \
- && echo Now type \`make\' to compile $PKG_NAME || exit 1
-else
- echo Skipping configure process.
-fi
+++ /dev/null
-#! /bin/sh
-# Output a system dependent set of variables, describing how to set the
-# run time search path of shared libraries in an executable.
-#
-# Copyright 1996-2010 Free Software Foundation, Inc.
-# Taken from GNU libtool, 2001
-# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
-#
-# This file is free software; the Free Software Foundation gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-#
-# The first argument passed to this file is the canonical host specification,
-# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
-# or
-# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
-# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
-# should be set by the caller.
-#
-# The set of defined variables is at the end of this script.
-
-# Known limitations:
-# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
-# than 256 bytes, otherwise the compiler driver will dump core. The only
-# known workaround is to choose shorter directory names for the build
-# directory and/or the installation directory.
-
-# All known linkers require a `.a' archive for static linking (except MSVC,
-# which needs '.lib').
-libext=a
-shrext=.so
-
-host="$1"
-host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-
-# Code taken from libtool.m4's _LT_CC_BASENAME.
-
-for cc_temp in $CC""; do
- case $cc_temp in
- compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
- distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
- \-*) ;;
- *) break;;
- esac
-done
-cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
-
-# Code taken from libtool.m4's _LT_COMPILER_PIC.
-
-wl=
-if test "$GCC" = yes; then
- wl='-Wl,'
-else
- case "$host_os" in
- aix*)
- wl='-Wl,'
- ;;
- darwin*)
- case $cc_basename in
- xlc*)
- wl='-Wl,'
- ;;
- esac
- ;;
- mingw* | cygwin* | pw32* | os2* | cegcc*)
- ;;
- hpux9* | hpux10* | hpux11*)
- wl='-Wl,'
- ;;
- irix5* | irix6* | nonstopux*)
- wl='-Wl,'
- ;;
- newsos6)
- ;;
- linux* | k*bsd*-gnu)
- case $cc_basename in
- ecc*)
- wl='-Wl,'
- ;;
- icc* | ifort*)
- wl='-Wl,'
- ;;
- lf95*)
- wl='-Wl,'
- ;;
- pgcc | pgf77 | pgf90)
- wl='-Wl,'
- ;;
- ccc*)
- wl='-Wl,'
- ;;
- como)
- wl='-lopt='
- ;;
- *)
- case `$CC -V 2>&1 | sed 5q` in
- *Sun\ C*)
- wl='-Wl,'
- ;;
- esac
- ;;
- esac
- ;;
- osf3* | osf4* | osf5*)
- wl='-Wl,'
- ;;
- rdos*)
- ;;
- solaris*)
- wl='-Wl,'
- ;;
- sunos4*)
- wl='-Qoption ld '
- ;;
- sysv4 | sysv4.2uw2* | sysv4.3*)
- wl='-Wl,'
- ;;
- sysv4*MP*)
- ;;
- sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
- wl='-Wl,'
- ;;
- unicos*)
- wl='-Wl,'
- ;;
- uts4*)
- ;;
- esac
-fi
-
-# Code taken from libtool.m4's _LT_LINKER_SHLIBS.
-
-hardcode_libdir_flag_spec=
-hardcode_libdir_separator=
-hardcode_direct=no
-hardcode_minus_L=no
-
-case "$host_os" in
- cygwin* | mingw* | pw32* | cegcc*)
- # FIXME: the MSVC++ port hasn't been tested in a loooong time
- # When not using gcc, we currently assume that we are using
- # Microsoft Visual C++.
- if test "$GCC" != yes; then
- with_gnu_ld=no
- fi
- ;;
- interix*)
- # we just hope/assume this is gcc and not c89 (= MSVC++)
- with_gnu_ld=yes
- ;;
- openbsd*)
- with_gnu_ld=no
- ;;
-esac
-
-ld_shlibs=yes
-if test "$with_gnu_ld" = yes; then
- # Set some defaults for GNU ld with shared library support. These
- # are reset later if shared libraries are not supported. Putting them
- # here allows them to be overridden if necessary.
- # Unlike libtool, we use -rpath here, not --rpath, since the documented
- # option of GNU ld is called -rpath, not --rpath.
- hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
- case "$host_os" in
- aix[3-9]*)
- # On AIX/PPC, the GNU linker is very broken
- if test "$host_cpu" != ia64; then
- ld_shlibs=no
- fi
- ;;
- amigaos*)
- hardcode_libdir_flag_spec='-L$libdir'
- hardcode_minus_L=yes
- # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
- # that the semantics of dynamic libraries on AmigaOS, at least up
- # to version 4, is to share data among multiple programs linked
- # with the same dynamic library. Since this doesn't match the
- # behavior of shared libraries on other platforms, we cannot use
- # them.
- ld_shlibs=no
- ;;
- beos*)
- if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- :
- else
- ld_shlibs=no
- fi
- ;;
- cygwin* | mingw* | pw32* | cegcc*)
- # hardcode_libdir_flag_spec is actually meaningless, as there is
- # no search path for DLLs.
- hardcode_libdir_flag_spec='-L$libdir'
- if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
- :
- else
- ld_shlibs=no
- fi
- ;;
- interix[3-9]*)
- hardcode_direct=no
- hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
- ;;
- gnu* | linux* | k*bsd*-gnu)
- if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- :
- else
- ld_shlibs=no
- fi
- ;;
- netbsd*)
- ;;
- solaris*)
- if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
- ld_shlibs=no
- elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- :
- else
- ld_shlibs=no
- fi
- ;;
- sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
- case `$LD -v 2>&1` in
- *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
- ld_shlibs=no
- ;;
- *)
- if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
- else
- ld_shlibs=no
- fi
- ;;
- esac
- ;;
- sunos4*)
- hardcode_direct=yes
- ;;
- *)
- if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- :
- else
- ld_shlibs=no
- fi
- ;;
- esac
- if test "$ld_shlibs" = no; then
- hardcode_libdir_flag_spec=
- fi
-else
- case "$host_os" in
- aix3*)
- # Note: this linker hardcodes the directories in LIBPATH if there
- # are no directories specified by -L.
- hardcode_minus_L=yes
- if test "$GCC" = yes; then
- # Neither direct hardcoding nor static linking is supported with a
- # broken collect2.
- hardcode_direct=unsupported
- fi
- ;;
- aix[4-9]*)
- if test "$host_cpu" = ia64; then
- # On IA64, the linker does run time linking by default, so we don't
- # have to do anything special.
- aix_use_runtimelinking=no
- else
- aix_use_runtimelinking=no
- # Test if we are trying to use run time linking or normal
- # AIX style linking. If -brtl is somewhere in LDFLAGS, we
- # need to do runtime linking.
- case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
- for ld_flag in $LDFLAGS; do
- if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
- aix_use_runtimelinking=yes
- break
- fi
- done
- ;;
- esac
- fi
- hardcode_direct=yes
- hardcode_libdir_separator=':'
- if test "$GCC" = yes; then
- case $host_os in aix4.[012]|aix4.[012].*)
- collect2name=`${CC} -print-prog-name=collect2`
- if test -f "$collect2name" && \
- strings "$collect2name" | grep resolve_lib_name >/dev/null
- then
- # We have reworked collect2
- :
- else
- # We have old collect2
- hardcode_direct=unsupported
- hardcode_minus_L=yes
- hardcode_libdir_flag_spec='-L$libdir'
- hardcode_libdir_separator=
- fi
- ;;
- esac
- fi
- # Begin _LT_AC_SYS_LIBPATH_AIX.
- echo 'int main () { return 0; }' > conftest.c
- ${CC} ${LDFLAGS} conftest.c -o conftest
- aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
-}'`
- if test -z "$aix_libpath"; then
- aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
-}'`
- fi
- if test -z "$aix_libpath"; then
- aix_libpath="/usr/lib:/lib"
- fi
- rm -f conftest.c conftest
- # End _LT_AC_SYS_LIBPATH_AIX.
- if test "$aix_use_runtimelinking" = yes; then
- hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
- else
- if test "$host_cpu" = ia64; then
- hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
- else
- hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
- fi
- fi
- ;;
- amigaos*)
- hardcode_libdir_flag_spec='-L$libdir'
- hardcode_minus_L=yes
- # see comment about different semantics on the GNU ld section
- ld_shlibs=no
- ;;
- bsdi[45]*)
- ;;
- cygwin* | mingw* | pw32* | cegcc*)
- # When not using gcc, we currently assume that we are using
- # Microsoft Visual C++.
- # hardcode_libdir_flag_spec is actually meaningless, as there is
- # no search path for DLLs.
- hardcode_libdir_flag_spec=' '
- libext=lib
- ;;
- darwin* | rhapsody*)
- hardcode_direct=no
- if test "$GCC" = yes ; then
- :
- else
- case $cc_basename in
- xlc*)
- ;;
- *)
- ld_shlibs=no
- ;;
- esac
- fi
- ;;
- dgux*)
- hardcode_libdir_flag_spec='-L$libdir'
- ;;
- freebsd1*)
- ld_shlibs=no
- ;;
- freebsd2.2*)
- hardcode_libdir_flag_spec='-R$libdir'
- hardcode_direct=yes
- ;;
- freebsd2*)
- hardcode_direct=yes
- hardcode_minus_L=yes
- ;;
- freebsd* | dragonfly*)
- hardcode_libdir_flag_spec='-R$libdir'
- hardcode_direct=yes
- ;;
- hpux9*)
- hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
- hardcode_libdir_separator=:
- hardcode_direct=yes
- # hardcode_minus_L: Not really in the search PATH,
- # but as the default location of the library.
- hardcode_minus_L=yes
- ;;
- hpux10*)
- if test "$with_gnu_ld" = no; then
- hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
- hardcode_libdir_separator=:
- hardcode_direct=yes
- # hardcode_minus_L: Not really in the search PATH,
- # but as the default location of the library.
- hardcode_minus_L=yes
- fi
- ;;
- hpux11*)
- if test "$with_gnu_ld" = no; then
- hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
- hardcode_libdir_separator=:
- case $host_cpu in
- hppa*64*|ia64*)
- hardcode_direct=no
- ;;
- *)
- hardcode_direct=yes
- # hardcode_minus_L: Not really in the search PATH,
- # but as the default location of the library.
- hardcode_minus_L=yes
- ;;
- esac
- fi
- ;;
- irix5* | irix6* | nonstopux*)
- hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
- hardcode_libdir_separator=:
- ;;
- netbsd*)
- hardcode_libdir_flag_spec='-R$libdir'
- hardcode_direct=yes
- ;;
- newsos6)
- hardcode_direct=yes
- hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
- hardcode_libdir_separator=:
- ;;
- openbsd*)
- if test -f /usr/libexec/ld.so; then
- hardcode_direct=yes
- if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
- hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
- else
- case "$host_os" in
- openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
- hardcode_libdir_flag_spec='-R$libdir'
- ;;
- *)
- hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
- ;;
- esac
- fi
- else
- ld_shlibs=no
- fi
- ;;
- os2*)
- hardcode_libdir_flag_spec='-L$libdir'
- hardcode_minus_L=yes
- ;;
- osf3*)
- hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
- hardcode_libdir_separator=:
- ;;
- osf4* | osf5*)
- if test "$GCC" = yes; then
- hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
- else
- # Both cc and cxx compiler support -rpath directly
- hardcode_libdir_flag_spec='-rpath $libdir'
- fi
- hardcode_libdir_separator=:
- ;;
- solaris*)
- hardcode_libdir_flag_spec='-R$libdir'
- ;;
- sunos4*)
- hardcode_libdir_flag_spec='-L$libdir'
- hardcode_direct=yes
- hardcode_minus_L=yes
- ;;
- sysv4)
- case $host_vendor in
- sni)
- hardcode_direct=yes # is this really true???
- ;;
- siemens)
- hardcode_direct=no
- ;;
- motorola)
- hardcode_direct=no #Motorola manual says yes, but my tests say they lie
- ;;
- esac
- ;;
- sysv4.3*)
- ;;
- sysv4*MP*)
- if test -d /usr/nec; then
- ld_shlibs=yes
- fi
- ;;
- sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
- ;;
- sysv5* | sco3.2v5* | sco5v6*)
- hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
- hardcode_libdir_separator=':'
- ;;
- uts4*)
- hardcode_libdir_flag_spec='-L$libdir'
- ;;
- *)
- ld_shlibs=no
- ;;
- esac
-fi
-
-# Check dynamic linker characteristics
-# Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER.
-# Unlike libtool.m4, here we don't care about _all_ names of the library, but
-# only about the one the linker finds when passed -lNAME. This is the last
-# element of library_names_spec in libtool.m4, or possibly two of them if the
-# linker has special search rules.
-library_names_spec= # the last element of library_names_spec in libtool.m4
-libname_spec='lib$name'
-case "$host_os" in
- aix3*)
- library_names_spec='$libname.a'
- ;;
- aix[4-9]*)
- library_names_spec='$libname$shrext'
- ;;
- amigaos*)
- library_names_spec='$libname.a'
- ;;
- beos*)
- library_names_spec='$libname$shrext'
- ;;
- bsdi[45]*)
- library_names_spec='$libname$shrext'
- ;;
- cygwin* | mingw* | pw32* | cegcc*)
- shrext=.dll
- library_names_spec='$libname.dll.a $libname.lib'
- ;;
- darwin* | rhapsody*)
- shrext=.dylib
- library_names_spec='$libname$shrext'
- ;;
- dgux*)
- library_names_spec='$libname$shrext'
- ;;
- freebsd1*)
- ;;
- freebsd* | dragonfly*)
- case "$host_os" in
- freebsd[123]*)
- library_names_spec='$libname$shrext$versuffix' ;;
- *)
- library_names_spec='$libname$shrext' ;;
- esac
- ;;
- gnu*)
- library_names_spec='$libname$shrext'
- ;;
- hpux9* | hpux10* | hpux11*)
- case $host_cpu in
- ia64*)
- shrext=.so
- ;;
- hppa*64*)
- shrext=.sl
- ;;
- *)
- shrext=.sl
- ;;
- esac
- library_names_spec='$libname$shrext'
- ;;
- interix[3-9]*)
- library_names_spec='$libname$shrext'
- ;;
- irix5* | irix6* | nonstopux*)
- library_names_spec='$libname$shrext'
- case "$host_os" in
- irix5* | nonstopux*)
- libsuff= shlibsuff=
- ;;
- *)
- case $LD in
- *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
- *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
- *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
- *) libsuff= shlibsuff= ;;
- esac
- ;;
- esac
- ;;
- linux*oldld* | linux*aout* | linux*coff*)
- ;;
- linux* | k*bsd*-gnu)
- library_names_spec='$libname$shrext'
- ;;
- knetbsd*-gnu)
- library_names_spec='$libname$shrext'
- ;;
- netbsd*)
- library_names_spec='$libname$shrext'
- ;;
- newsos6)
- library_names_spec='$libname$shrext'
- ;;
- nto-qnx*)
- library_names_spec='$libname$shrext'
- ;;
- openbsd*)
- library_names_spec='$libname$shrext$versuffix'
- ;;
- os2*)
- libname_spec='$name'
- shrext=.dll
- library_names_spec='$libname.a'
- ;;
- osf3* | osf4* | osf5*)
- library_names_spec='$libname$shrext'
- ;;
- rdos*)
- ;;
- solaris*)
- library_names_spec='$libname$shrext'
- ;;
- sunos4*)
- library_names_spec='$libname$shrext$versuffix'
- ;;
- sysv4 | sysv4.3*)
- library_names_spec='$libname$shrext'
- ;;
- sysv4*MP*)
- library_names_spec='$libname$shrext'
- ;;
- sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
- library_names_spec='$libname$shrext'
- ;;
- uts4*)
- library_names_spec='$libname$shrext'
- ;;
-esac
-
-sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
-escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
-shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
-escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
-escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
-escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
-
-LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
-
-# How to pass a linker flag through the compiler.
-wl="$escaped_wl"
-
-# Static library suffix (normally "a").
-libext="$libext"
-
-# Shared library suffix (normally "so").
-shlibext="$shlibext"
-
-# Format of library name prefix.
-libname_spec="$escaped_libname_spec"
-
-# Library names that the linker finds when passed -lNAME.
-library_names_spec="$escaped_library_names_spec"
-
-# Flag to hardcode \$libdir into a binary during linking.
-# This must work even if \$libdir does not exist.
-hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
-
-# Whether we need a single -rpath flag with a separated argument.
-hardcode_libdir_separator="$hardcode_libdir_separator"
-
-# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
-# resulting binary.
-hardcode_direct="$hardcode_direct"
-
-# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
-# resulting binary.
-hardcode_minus_L="$hardcode_minus_L"
-
-EOF
+++ /dev/null
-#
-# Copyright 2012 Xamarin Inc
-#
-AC_INIT(eglib, [0.3],
- [http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono])
-
-AC_CONFIG_SRCDIR([README])
-AC_CONFIG_MACRO_DIR([m4])
-AC_CANONICAL_SYSTEM
-AC_CANONICAL_HOST
-
-AM_INIT_AUTOMAKE([1.9 dist-bzip2 tar-ustar no-dist-gzip foreign])
-AC_CONFIG_HEADERS([config.h])
-AM_MAINTAINER_MODE
-
-m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
-
-AC_PROG_CC
-AM_PROG_LIBTOOL
-# Use dolt (http://dolt.freedesktop.org/) instead of libtool for building.
-DOLT
-GNUC_PRETTY=
-GNUC_UNUSED=
-BREAKPOINT="G_STMT_START { raise (SIGTRAP); } G_STMT_END"
-if test x$GCC = xyes; then
- GNUC_UNUSED='__attribute__((__unused__))'
- GNUC_NORETURN='__attribute__((__noreturn__))'
- case $host_cpu in
- i*86|x86_64) BREAKPOINT="G_STMT_START { __asm__ (\"int \$03\"); } G_STMT_END" ;;
- esac
-fi
-AC_SUBST(GNUC_PRETTY)
-AC_SUBST(GNUC_UNUSED)
-AC_SUBST(GNUC_NORETURN)
-AC_SUBST(BREAKPOINT)
-
-# We use a separate variable to pass down CPPFLAGS and CFLAGS from the main mono
-# configure, because of autoconf brokeness
-if test "x$CPPFLAGS_FOR_EGLIB" != "x"; then
- CPPFLAGS=$CPPFLAGS_FOR_EGLIB
-fi
-if test "x$CFLAGS_FOR_EGLIB" != "x"; then
- CFLAGS=$CFLAGS_FOR_EGLIB
-fi
-
-CFLAGS="$CFLAGS -g -D_GNU_SOURCE"
-
-AM_CONDITIONAL(CROSS_COMPILING, [test x$cross_compiling = xyes])
-AC_C_BIGENDIAN([ORDER=G_BIG_ENDIAN],[ORDER=G_LITTLE_ENDIAN])
-
-platform_darwin=no
-platform_android=no
-
-case $host in
-*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
- PATHSEP='\\'
- SEARCHSEP=';'
- OS="WIN32"
- PIDTYPE='void *'
- ;;
-*-*darwin*)
- platform_darwin=yes
- PATHSEP='/'
- SEARCHSEP=':'
- OS="UNIX"
- PIDTYPE='int'
- ;;
-*-*-linux-android*)
- platform_android=yes
- AC_DEFINE(PLATFORM_ANDROID,1,[Targeting the Android platform])
- PATHSEP='/'
- SEARCHSEP=':'
- OS="UNIX"
- PIDTYPE='int'
- ;;
-*)
- PATHSEP='/'
- SEARCHSEP=':'
- OS="UNIX"
- PIDTYPE='int'
- ;;
-esac
-
-case $host in
- *-*-solaris*)
- CFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS"
- ;;
-esac
-
-case $target in
-arm*-darwin*|aarch64*-*)
- CFLAGS="$CFLAGS -U_FORTIFY_SOURCE"
- ;;
-i*86-*-darwin*)
- ORDER=G_LITTLE_ENDIAN
- ;;
-*-*-haiku*)
- LDFLAGS="$LDFLAGS -ltextencoding"
- ;;
-*-*-openbsd*)
- CFLAGS="$CFLAGS -pthread"
- LDFLAGS="$LDFLAGS -pthread"
- ;;
-esac
-
-target_osx=no
-target_ios=no
-
-if test "x$platform_darwin" = "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])
- target_osx=yes
- ], [
- AC_DEFINE(TARGET_IOS,1,[The JIT/AOT targets iOS])
- target_ios=yes
- ])
- AC_DEFINE(TARGET_MACH,1,[The JIT/AOT targets Apple platforms])
-fi
-
-AC_SUBST(ORDER)
-AC_SUBST(CFLAGS)
-AC_SUBST(PATHSEP)
-AC_SUBST(SEARCHSEP)
-AC_SUBST(OS)
-AC_SUBST(PIDTYPE)
-AM_CONDITIONAL(HOST_WIN32, test x$OS = xWIN32)
-AM_CONDITIONAL(TARGET_WIN32, test x$OS = xWIN32)
-AM_CONDITIONAL(PLATFORM_DARWIN, test x$platform_darwin = xyes)
-AM_CONDITIONAL(PLATFORM_ANDROID, test x$platform_android = xyes)
-
-# Defined for all targets/platforms using classic Windows API support.
-AC_DEFINE(HAVE_CLASSIC_WINAPI_SUPPORT, 1, [Use classic Windows API support])
-AC_DEFINE(HAVE_UWP_WINAPI_SUPPORT, 0, [Don't use UWP Windows API support])
-
-AC_CHECK_SIZEOF(int)
-AC_CHECK_SIZEOF(void *)
-AC_CHECK_SIZEOF(long)
-AC_CHECK_SIZEOF(long long)
-AC_CHECK_FUNCS(strlcpy stpcpy strtok_r rewinddir vasprintf strerror_r)
-AC_CHECK_FUNCS(getrlimit)
-AC_CHECK_FUNCS(fork execv execve)
-
-AC_ARG_WITH([overridable-allocators], [ --with-overridable-allocators allow g_*alloc/g_free to call custom allocators set via g_mem_set_vtable])
-
-if test x$with_overridable_allocators = xyes; then
- AC_DEFINE(ENABLE_OVERRIDABLE_ALLOCATORS,1,[Overridable allocator support enabled])
- AC_MSG_NOTICE([Overridable allocator support enabled])
-else
- AC_MSG_NOTICE([Overridable allocator support disabled])
-fi
-
-#
-# Mono currently supports 10.6, but strndup is not available prior to 10.7; avoiding
-# the detection of strndup on OS X so Mono built on 10.7+ still runs on 10.6. This can be
-# removed once support for 10.6 is dropped.
-#
-# iOS detection of strndup and getpwuid_r is faulty for some reason so let's simply avoid it
-#
-if test x$target_osx = xyes; then
-AC_CHECK_FUNCS(getpwuid_r)
-elif test x$target_ios = xno; then
-AC_CHECK_FUNCS(strndup getpwuid_r)
-fi
-
-AM_CONDITIONAL(NEED_VASPRINTF, test x$ac_cv_func_vasprintf = xno || test x$with_overridable_allocators = xyes)
-AM_ICONV()
-AC_SEARCH_LIBS(sqrtf, m)
-
-# nanosleep may not be part of libc, also search it in other libraries
-AC_SEARCH_LIBS(nanosleep, rt)
-
-AC_SEARCH_LIBS(dlopen, dl)
-old_ldflags="${LDFLAGS}"
-LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
-AC_TRY_LINK(, [int i;], found_export_dynamic=yes, found_export_dynamic=no)
-if test $found_export_dynamic = no; then
- LDFLAGS="${old_ldflags}"
-fi
-
-AC_MSG_CHECKING(for varargs macros)
-AC_TRY_COMPILE([],[
-int foo (int i, int j);
-#define bar(...) foo (1, __VA_ARGS__)
-void main () {
- bar (2);
-}
-],have_iso_varargs=yes,have_iso_varargs=no)
-AC_MSG_RESULT($have_iso_varargs)
-G_HAVE_ISO_VARARGS=0
-if test "x$have_iso_varargs" = "xyes"; then
- G_HAVE_ISO_VARARGS=1
-fi
-AC_SUBST(G_HAVE_ISO_VARARGS)
-
-AC_CHECK_HEADERS(getopt.h sys/select.h sys/time.h sys/wait.h pwd.h iconv.h localcharset.h sys/types.h sys/resource.h)
-AC_CHECK_LIB([iconv], [locale_charset],[],[AC_CHECK_LIB([charset], [locale_charset],[LIBS+="-liconv -lcharset"])])
-AC_CHECK_HEADER(alloca.h, [HAVE_ALLOCA_H=1], [HAVE_ALLOCA_H=0])
-AC_SUBST(HAVE_ALLOCA_H)
-
-if test $ac_cv_sizeof_void_p = $ac_cv_sizeof_int; then
- GPOINTER_TO_INT="((gint) (ptr))"
- GPOINTER_TO_UINT="((guint) (ptr))"
- GINT_TO_POINTER="((gpointer) (v))"
- GUINT_TO_POINTER="((gpointer) (v))"
- GSIZE="int"
- GSIZE_FORMAT='"u"'
-elif test $ac_cv_sizeof_void_p = $ac_cv_sizeof_long; then
- GPOINTER_TO_INT="((gint)(long) (ptr))"
- GPOINTER_TO_UINT="((guint)(long) (ptr))"
- GINT_TO_POINTER="((gpointer)(glong) (v))"
- GUINT_TO_POINTER="((gpointer)(gulong) (v))"
- GSIZE="long"
- GSIZE_FORMAT='"lu"'
-elif test $ac_cv_sizeof_void_p = $ac_cv_sizeof_long_long; then
- GPOINTER_TO_INT="((gint)(long long) (ptr))"
- GPOINTER_TO_UINT="((guint)(unsigned long long) (ptr))"
- GINT_TO_POINTER="((gpointer)(long long) (v))"
- GUINT_TO_POINTER="((gpointer)(unsigned long long) (v))"
- GSIZE="long long"
- GSIZE_FORMAT='"I64u"'
-else
- AC_MSG_ERROR([unsupported pointer size])
-fi
-
-AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
-
-pkg_config_path=
-AC_ARG_WITH(crosspkgdir, [ --with-crosspkgdir=/path/to/pkg-config/dir Change pkg-config dir to custom dir],
- if test x$with_crosspkgdir = "x"; then
- if test -s $PKG_CONFIG_PATH; then
- pkg_config_path=$PKG_CONFIG_PATH
- fi
- else
- pkg_config_path=$with_crosspkgdir
- PKG_CONFIG_PATH=$pkg_config_path
- export PKG_CONFIG_PATH
- fi
-)
-
-AC_ARG_ENABLE(werror, [ --enable-werror Pass -Werror to the C compiler], werror_flag=$enableval, werror_flag=no)
-if test x$werror_flag = xyes; then
- WERROR_CFLAGS="-Werror"
-fi
-AC_SUBST([WERROR_CFLAGS])
-
-AC_SUBST(GPOINTER_TO_INT)
-AC_SUBST(GPOINTER_TO_UINT)
-AC_SUBST(GINT_TO_POINTER)
-AC_SUBST(GUINT_TO_POINTER)
-AC_SUBST(GSIZE)
-AC_SUBST(GSIZE_FORMAT)
-AC_SUBST(G_GUINT64_FORMAT)
-AC_SUBST(G_GINT64_FORMAT)
-AC_SUBST(G_GUINT32_FORMAT)
-AC_SUBST(G_GINT32_FORMAT)
-
-AC_OUTPUT([
-Makefile
-m4/Makefile
-src/Makefile
-src/eglib-config.h
-test/Makefile
-])
+++ /dev/null
-Makefile
-Makefile.in
-libtool.m4
-ltoptions.m4
-ltsugar.m4
-ltversion.m4
-lt~obsolete.m4
+++ /dev/null
-EXTRA_DIST = $(wildcard *.m4)
+++ /dev/null
-# iconv.m4 serial 11 (gettext-0.18.1)
-dnl Copyright (C) 2000-2002, 2007-2010 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl From Bruno Haible.
-
-AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
-[
- dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
- AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
- AC_REQUIRE([AC_LIB_RPATH])
-
- dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
- dnl accordingly.
- AC_LIB_LINKFLAGS_BODY([iconv])
-])
-
-AC_DEFUN([AM_ICONV_LINK],
-[
- dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
- dnl those with the standalone portable GNU libiconv installed).
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
-
- dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
- dnl accordingly.
- AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
-
- dnl Add $INCICONV to CPPFLAGS before performing the following checks,
- dnl because if the user has installed libiconv and not disabled its use
- dnl via --without-libiconv-prefix, he wants to use it. The first
- dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
- am_save_CPPFLAGS="$CPPFLAGS"
- AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
-
- AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [
- am_cv_func_iconv="no, consider installing GNU libiconv"
- am_cv_lib_iconv=no
- AC_TRY_LINK([#include <stdlib.h>
-#include <iconv.h>],
- [iconv_t cd = iconv_open("","");
- iconv(cd,NULL,NULL,NULL,NULL);
- iconv_close(cd);],
- [am_cv_func_iconv=yes])
- if test "$am_cv_func_iconv" != yes; then
- am_save_LIBS="$LIBS"
- LIBS="$LIBS $LIBICONV"
- AC_TRY_LINK([#include <stdlib.h>
-#include <iconv.h>],
- [iconv_t cd = iconv_open("","");
- iconv(cd,NULL,NULL,NULL,NULL);
- iconv_close(cd);],
- [am_cv_lib_iconv=yes]
- [am_cv_func_iconv=yes])
- LIBS="$am_save_LIBS"
- fi
- ])
- if test "$am_cv_func_iconv" = yes; then
- AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [
- dnl This tests against bugs in AIX 5.1, HP-UX 11.11, Solaris 10.
- am_save_LIBS="$LIBS"
- if test $am_cv_lib_iconv = yes; then
- LIBS="$LIBS $LIBICONV"
- fi
- AC_TRY_RUN([
-#include <iconv.h>
-#include <string.h>
-int main ()
-{
- /* Test against AIX 5.1 bug: Failures are not distinguishable from successful
- returns. */
- {
- iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
- if (cd_utf8_to_88591 != (iconv_t)(-1))
- {
- static const char input[] = "\342\202\254"; /* EURO SIGN */
- char buf[10];
- const char *inptr = input;
- size_t inbytesleft = strlen (input);
- char *outptr = buf;
- size_t outbytesleft = sizeof (buf);
- size_t res = iconv (cd_utf8_to_88591,
- (char **) &inptr, &inbytesleft,
- &outptr, &outbytesleft);
- if (res == 0)
- return 1;
- }
- }
- /* Test against Solaris 10 bug: Failures are not distinguishable from
- successful returns. */
- {
- iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
- if (cd_ascii_to_88591 != (iconv_t)(-1))
- {
- static const char input[] = "\263";
- char buf[10];
- const char *inptr = input;
- size_t inbytesleft = strlen (input);
- char *outptr = buf;
- size_t outbytesleft = sizeof (buf);
- size_t res = iconv (cd_ascii_to_88591,
- (char **) &inptr, &inbytesleft,
- &outptr, &outbytesleft);
- if (res == 0)
- return 1;
- }
- }
-#if 0 /* This bug could be worked around by the caller. */
- /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */
- {
- iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
- if (cd_88591_to_utf8 != (iconv_t)(-1))
- {
- static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
- char buf[50];
- const char *inptr = input;
- size_t inbytesleft = strlen (input);
- char *outptr = buf;
- size_t outbytesleft = sizeof (buf);
- size_t res = iconv (cd_88591_to_utf8,
- (char **) &inptr, &inbytesleft,
- &outptr, &outbytesleft);
- if ((int)res > 0)
- return 1;
- }
- }
-#endif
- /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
- provided. */
- if (/* Try standardized names. */
- iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1)
- /* Try IRIX, OSF/1 names. */
- && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1)
- /* Try AIX names. */
- && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1)
- /* Try HP-UX names. */
- && iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
- return 1;
- return 0;
-}], [am_cv_func_iconv_works=yes], [am_cv_func_iconv_works=no],
- [case "$host_os" in
- aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
- *) am_cv_func_iconv_works="guessing yes" ;;
- esac])
- LIBS="$am_save_LIBS"
- ])
- case "$am_cv_func_iconv_works" in
- *no) am_func_iconv=no am_cv_lib_iconv=no ;;
- *) am_func_iconv=yes ;;
- esac
- else
- am_func_iconv=no am_cv_lib_iconv=no
- fi
- if test "$am_func_iconv" = yes; then
- AC_DEFINE([HAVE_ICONV], [1],
- [Define if you have the iconv() function and it works.])
- fi
- if test "$am_cv_lib_iconv" = yes; then
- AC_MSG_CHECKING([how to link with libiconv])
- AC_MSG_RESULT([$LIBICONV])
- else
- dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
- dnl either.
- CPPFLAGS="$am_save_CPPFLAGS"
- LIBICONV=
- LTLIBICONV=
- fi
- AC_SUBST([LIBICONV])
- AC_SUBST([LTLIBICONV])
-])
-
-dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to
-dnl avoid warnings like
-dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required".
-dnl This is tricky because of the way 'aclocal' is implemented:
-dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN.
-dnl Otherwise aclocal's initial scan pass would miss the macro definition.
-dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions.
-dnl Otherwise aclocal would emit many "Use of uninitialized value $1"
-dnl warnings.
-m4_define([gl_iconv_AC_DEFUN],
- m4_version_prereq([2.64],
- [[AC_DEFUN_ONCE(
- [$1], [$2])]],
- [[AC_DEFUN(
- [$1], [$2])]]))
-gl_iconv_AC_DEFUN([AM_ICONV],
-[
- AM_ICONV_LINK
- if test "$am_cv_func_iconv" = yes; then
- AC_MSG_CHECKING([for iconv declaration])
- AC_CACHE_VAL([am_cv_proto_iconv], [
- AC_TRY_COMPILE([
-#include <stdlib.h>
-#include <iconv.h>
-extern
-#ifdef __cplusplus
-"C"
-#endif
-#if defined(__STDC__) || defined(__cplusplus)
-size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
-#else
-size_t iconv();
-#endif
-], [], [am_cv_proto_iconv_arg1=""], [am_cv_proto_iconv_arg1="const"])
- am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
- am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
- AC_MSG_RESULT([
- $am_cv_proto_iconv])
- AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1],
- [Define as const if the declaration of iconv() needs const.])
- fi
-])
+++ /dev/null
-# lib-ld.m4 serial 4 (gettext-0.18)
-dnl Copyright (C) 1996-2003, 2009-2010 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl Subroutines of libtool.m4,
-dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
-dnl with libtool.m4.
-
-dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
-AC_DEFUN([AC_LIB_PROG_LD_GNU],
-[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld],
-[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
-case `$LD -v 2>&1 </dev/null` in
-*GNU* | *'with BFD'*)
- acl_cv_prog_gnu_ld=yes ;;
-*)
- acl_cv_prog_gnu_ld=no ;;
-esac])
-with_gnu_ld=$acl_cv_prog_gnu_ld
-])
-
-dnl From libtool-1.4. Sets the variable LD.
-AC_DEFUN([AC_LIB_PROG_LD],
-[AC_ARG_WITH([gnu-ld],
-[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
-test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
-AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([AC_CANONICAL_HOST])dnl
-# Prepare PATH_SEPARATOR.
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conf$$.sh
-fi
-ac_prog=ld
-if test "$GCC" = yes; then
- # Check if gcc -print-prog-name=ld gives a path.
- AC_MSG_CHECKING([for ld used by GCC])
- case $host in
- *-*-mingw*)
- # gcc leaves a trailing carriage return which upsets mingw
- ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
- *)
- ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
- esac
- case $ac_prog in
- # Accept absolute paths.
- [[\\/]* | [A-Za-z]:[\\/]*)]
- [re_direlt='/[^/][^/]*/\.\./']
- # Canonicalize the path of ld
- ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
- while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
- ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
- done
- test -z "$LD" && LD="$ac_prog"
- ;;
- "")
- # If it fails, then pretend we aren't using GCC.
- ac_prog=ld
- ;;
- *)
- # If it is relative, then search for the first ld in PATH.
- with_gnu_ld=unknown
- ;;
- esac
-elif test "$with_gnu_ld" = yes; then
- AC_MSG_CHECKING([for GNU ld])
-else
- AC_MSG_CHECKING([for non-GNU ld])
-fi
-AC_CACHE_VAL([acl_cv_path_LD],
-[if test -z "$LD"; then
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
- for ac_dir in $PATH; do
- test -z "$ac_dir" && ac_dir=.
- if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
- acl_cv_path_LD="$ac_dir/$ac_prog"
- # Check to see if the program is GNU ld. I'd rather use --version,
- # but apparently some GNU ld's only accept -v.
- # Break only if it was the GNU/non-GNU ld that we prefer.
- case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
- *GNU* | *'with BFD'*)
- test "$with_gnu_ld" != no && break ;;
- *)
- test "$with_gnu_ld" != yes && break ;;
- esac
- fi
- done
- IFS="$ac_save_ifs"
-else
- acl_cv_path_LD="$LD" # Let the user override the test with a path.
-fi])
-LD="$acl_cv_path_LD"
-if test -n "$LD"; then
- AC_MSG_RESULT([$LD])
-else
- AC_MSG_RESULT([no])
-fi
-test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
-AC_LIB_PROG_LD_GNU
-])
+++ /dev/null
-# lib-link.m4 serial 21 (gettext-0.18)
-dnl Copyright (C) 2001-2010 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl From Bruno Haible.
-
-AC_PREREQ([2.54])
-
-dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
-dnl the libraries corresponding to explicit and implicit dependencies.
-dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
-dnl augments the CPPFLAGS variable.
-dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
-dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
-AC_DEFUN([AC_LIB_LINKFLAGS],
-[
- AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
- AC_REQUIRE([AC_LIB_RPATH])
- pushdef([Name],[translit([$1],[./-], [___])])
- pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
- [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
- AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
- AC_LIB_LINKFLAGS_BODY([$1], [$2])
- ac_cv_lib[]Name[]_libs="$LIB[]NAME"
- ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
- ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
- ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX"
- ])
- LIB[]NAME="$ac_cv_lib[]Name[]_libs"
- LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
- INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
- LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix"
- AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
- AC_SUBST([LIB]NAME)
- AC_SUBST([LTLIB]NAME)
- AC_SUBST([LIB]NAME[_PREFIX])
- dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
- dnl results of this search when this library appears as a dependency.
- HAVE_LIB[]NAME=yes
- popdef([NAME])
- popdef([Name])
-])
-
-dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message])
-dnl searches for libname and the libraries corresponding to explicit and
-dnl implicit dependencies, together with the specified include files and
-dnl the ability to compile and link the specified testcode. The missing-message
-dnl defaults to 'no' and may contain additional hints for the user.
-dnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME}
-dnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and
-dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
-dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
-dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
-dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
-AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
-[
- AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
- AC_REQUIRE([AC_LIB_RPATH])
- pushdef([Name],[translit([$1],[./-], [___])])
- pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
- [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
-
- dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
- dnl accordingly.
- AC_LIB_LINKFLAGS_BODY([$1], [$2])
-
- dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
- dnl because if the user has installed lib[]Name and not disabled its use
- dnl via --without-lib[]Name-prefix, he wants to use it.
- ac_save_CPPFLAGS="$CPPFLAGS"
- AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
-
- AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
- ac_save_LIBS="$LIBS"
- dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS,
- dnl because these -l options might require -L options that are present in
- dnl LIBS. -l options benefit only from the -L options listed before it.
- dnl Otherwise, add it to the front of LIBS, because it may be a static
- dnl library that depends on another static library that is present in LIBS.
- dnl Static libraries benefit only from the static libraries listed after
- dnl it.
- case " $LIB[]NAME" in
- *" -l"*) LIBS="$LIBS $LIB[]NAME" ;;
- *) LIBS="$LIB[]NAME $LIBS" ;;
- esac
- AC_TRY_LINK([$3], [$4],
- [ac_cv_lib[]Name=yes],
- [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])'])
- LIBS="$ac_save_LIBS"
- ])
- if test "$ac_cv_lib[]Name" = yes; then
- HAVE_LIB[]NAME=yes
- AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.])
- AC_MSG_CHECKING([how to link with lib[]$1])
- AC_MSG_RESULT([$LIB[]NAME])
- else
- HAVE_LIB[]NAME=no
- dnl If $LIB[]NAME didn't lead to a usable library, we don't need
- dnl $INC[]NAME either.
- CPPFLAGS="$ac_save_CPPFLAGS"
- LIB[]NAME=
- LTLIB[]NAME=
- LIB[]NAME[]_PREFIX=
- fi
- AC_SUBST([HAVE_LIB]NAME)
- AC_SUBST([LIB]NAME)
- AC_SUBST([LTLIB]NAME)
- AC_SUBST([LIB]NAME[_PREFIX])
- popdef([NAME])
- popdef([Name])
-])
-
-dnl Determine the platform dependent parameters needed to use rpath:
-dnl acl_libext,
-dnl acl_shlibext,
-dnl acl_hardcode_libdir_flag_spec,
-dnl acl_hardcode_libdir_separator,
-dnl acl_hardcode_direct,
-dnl acl_hardcode_minus_L.
-AC_DEFUN([AC_LIB_RPATH],
-[
- dnl Tell automake >= 1.10 to complain if config.rpath is missing.
- m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
- AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS
- AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
- AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
- AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [
- CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
- ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
- . ./conftest.sh
- rm -f ./conftest.sh
- acl_cv_rpath=done
- ])
- wl="$acl_cv_wl"
- acl_libext="$acl_cv_libext"
- acl_shlibext="$acl_cv_shlibext"
- acl_libname_spec="$acl_cv_libname_spec"
- acl_library_names_spec="$acl_cv_library_names_spec"
- acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
- acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
- acl_hardcode_direct="$acl_cv_hardcode_direct"
- acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
- dnl Determine whether the user wants rpath handling at all.
- AC_ARG_ENABLE([rpath],
- [ --disable-rpath do not hardcode runtime library paths],
- :, enable_rpath=yes)
-])
-
-dnl AC_LIB_FROMPACKAGE(name, package)
-dnl declares that libname comes from the given package. The configure file
-dnl will then not have a --with-libname-prefix option but a
-dnl --with-package-prefix option. Several libraries can come from the same
-dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar
-dnl macro call that searches for libname.
-AC_DEFUN([AC_LIB_FROMPACKAGE],
-[
- pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
- [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
- define([acl_frompackage_]NAME, [$2])
- popdef([NAME])
- pushdef([PACK],[$2])
- pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-],
- [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
- define([acl_libsinpackage_]PACKUP,
- m4_ifdef([acl_libsinpackage_]PACKUP, [acl_libsinpackage_]PACKUP[[, ]],)[lib$1])
- popdef([PACKUP])
- popdef([PACK])
-])
-
-dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
-dnl the libraries corresponding to explicit and implicit dependencies.
-dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
-dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
-dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
-AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
-[
- AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
- pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
- [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
- pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])])
- pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-],
- [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
- pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])])
- dnl Autoconf >= 2.61 supports dots in --with options.
- pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit(PACK,[.],[_])],PACK)])
- dnl By default, look in $includedir and $libdir.
- use_additional=yes
- AC_LIB_WITH_FINAL_PREFIX([
- eval additional_includedir=\"$includedir\"
- eval additional_libdir=\"$libdir\"
- ])
- AC_ARG_WITH(P_A_C_K[-prefix],
-[[ --with-]]P_A_C_K[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib
- --without-]]P_A_C_K[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]],
-[
- if test "X$withval" = "Xno"; then
- use_additional=no
- else
- if test "X$withval" = "X"; then
- AC_LIB_WITH_FINAL_PREFIX([
- eval additional_includedir=\"$includedir\"
- eval additional_libdir=\"$libdir\"
- ])
- else
- additional_includedir="$withval/include"
- additional_libdir="$withval/$acl_libdirstem"
- if test "$acl_libdirstem2" != "$acl_libdirstem" \
- && ! test -d "$withval/$acl_libdirstem"; then
- additional_libdir="$withval/$acl_libdirstem2"
- fi
- fi
- fi
-])
- dnl Search the library and its dependencies in $additional_libdir and
- dnl $LDFLAGS. Using breadth-first-seach.
- LIB[]NAME=
- LTLIB[]NAME=
- INC[]NAME=
- LIB[]NAME[]_PREFIX=
- dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been
- dnl computed. So it has to be reset here.
- HAVE_LIB[]NAME=
- rpathdirs=
- ltrpathdirs=
- names_already_handled=
- names_next_round='$1 $2'
- while test -n "$names_next_round"; do
- names_this_round="$names_next_round"
- names_next_round=
- for name in $names_this_round; do
- already_handled=
- for n in $names_already_handled; do
- if test "$n" = "$name"; then
- already_handled=yes
- break
- fi
- done
- if test -z "$already_handled"; then
- names_already_handled="$names_already_handled $name"
- dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
- dnl or AC_LIB_HAVE_LINKFLAGS call.
- uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
- eval value=\"\$HAVE_LIB$uppername\"
- if test -n "$value"; then
- if test "$value" = yes; then
- eval value=\"\$LIB$uppername\"
- test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
- eval value=\"\$LTLIB$uppername\"
- test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
- else
- dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
- dnl that this library doesn't exist. So just drop it.
- :
- fi
- else
- dnl Search the library lib$name in $additional_libdir and $LDFLAGS
- dnl and the already constructed $LIBNAME/$LTLIBNAME.
- found_dir=
- found_la=
- found_so=
- found_a=
- eval libname=\"$acl_libname_spec\" # typically: libname=lib$name
- if test -n "$acl_shlibext"; then
- shrext=".$acl_shlibext" # typically: shrext=.so
- else
- shrext=
- fi
- if test $use_additional = yes; then
- dir="$additional_libdir"
- dnl The same code as in the loop below:
- dnl First look for a shared library.
- if test -n "$acl_shlibext"; then
- if test -f "$dir/$libname$shrext"; then
- found_dir="$dir"
- found_so="$dir/$libname$shrext"
- else
- if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
- ver=`(cd "$dir" && \
- for f in "$libname$shrext".*; do echo "$f"; done \
- | sed -e "s,^$libname$shrext\\\\.,," \
- | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
- | sed 1q ) 2>/dev/null`
- if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
- found_dir="$dir"
- found_so="$dir/$libname$shrext.$ver"
- fi
- else
- eval library_names=\"$acl_library_names_spec\"
- for f in $library_names; do
- if test -f "$dir/$f"; then
- found_dir="$dir"
- found_so="$dir/$f"
- break
- fi
- done
- fi
- fi
- fi
- dnl Then look for a static library.
- if test "X$found_dir" = "X"; then
- if test -f "$dir/$libname.$acl_libext"; then
- found_dir="$dir"
- found_a="$dir/$libname.$acl_libext"
- fi
- fi
- if test "X$found_dir" != "X"; then
- if test -f "$dir/$libname.la"; then
- found_la="$dir/$libname.la"
- fi
- fi
- fi
- if test "X$found_dir" = "X"; then
- for x in $LDFLAGS $LTLIB[]NAME; do
- AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
- case "$x" in
- -L*)
- dir=`echo "X$x" | sed -e 's/^X-L//'`
- dnl First look for a shared library.
- if test -n "$acl_shlibext"; then
- if test -f "$dir/$libname$shrext"; then
- found_dir="$dir"
- found_so="$dir/$libname$shrext"
- else
- if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
- ver=`(cd "$dir" && \
- for f in "$libname$shrext".*; do echo "$f"; done \
- | sed -e "s,^$libname$shrext\\\\.,," \
- | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
- | sed 1q ) 2>/dev/null`
- if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
- found_dir="$dir"
- found_so="$dir/$libname$shrext.$ver"
- fi
- else
- eval library_names=\"$acl_library_names_spec\"
- for f in $library_names; do
- if test -f "$dir/$f"; then
- found_dir="$dir"
- found_so="$dir/$f"
- break
- fi
- done
- fi
- fi
- fi
- dnl Then look for a static library.
- if test "X$found_dir" = "X"; then
- if test -f "$dir/$libname.$acl_libext"; then
- found_dir="$dir"
- found_a="$dir/$libname.$acl_libext"
- fi
- fi
- if test "X$found_dir" != "X"; then
- if test -f "$dir/$libname.la"; then
- found_la="$dir/$libname.la"
- fi
- fi
- ;;
- esac
- if test "X$found_dir" != "X"; then
- break
- fi
- done
- fi
- if test "X$found_dir" != "X"; then
- dnl Found the library.
- LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
- if test "X$found_so" != "X"; then
- dnl Linking with a shared library. We attempt to hardcode its
- dnl directory into the executable's runpath, unless it's the
- dnl standard /usr/lib.
- if test "$enable_rpath" = no \
- || test "X$found_dir" = "X/usr/$acl_libdirstem" \
- || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then
- dnl No hardcoding is needed.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
- else
- dnl Use an explicit option to hardcode DIR into the resulting
- dnl binary.
- dnl Potentially add DIR to ltrpathdirs.
- dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
- haveit=
- for x in $ltrpathdirs; do
- if test "X$x" = "X$found_dir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- ltrpathdirs="$ltrpathdirs $found_dir"
- fi
- dnl The hardcoding into $LIBNAME is system dependent.
- if test "$acl_hardcode_direct" = yes; then
- dnl Using DIR/libNAME.so during linking hardcodes DIR into the
- dnl resulting binary.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
- else
- if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
- dnl Use an explicit option to hardcode DIR into the resulting
- dnl binary.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
- dnl Potentially add DIR to rpathdirs.
- dnl The rpathdirs will be appended to $LIBNAME at the end.
- haveit=
- for x in $rpathdirs; do
- if test "X$x" = "X$found_dir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- rpathdirs="$rpathdirs $found_dir"
- fi
- else
- dnl Rely on "-L$found_dir".
- dnl But don't add it if it's already contained in the LDFLAGS
- dnl or the already constructed $LIBNAME
- haveit=
- for x in $LDFLAGS $LIB[]NAME; do
- AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
- if test "X$x" = "X-L$found_dir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
- fi
- if test "$acl_hardcode_minus_L" != no; then
- dnl FIXME: Not sure whether we should use
- dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
- dnl here.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
- else
- dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH
- dnl here, because this doesn't fit in flags passed to the
- dnl compiler. So give up. No hardcoding. This affects only
- dnl very old systems.
- dnl FIXME: Not sure whether we should use
- dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
- dnl here.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
- fi
- fi
- fi
- fi
- else
- if test "X$found_a" != "X"; then
- dnl Linking with a static library.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
- else
- dnl We shouldn't come here, but anyway it's good to have a
- dnl fallback.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
- fi
- fi
- dnl Assume the include files are nearby.
- additional_includedir=
- case "$found_dir" in
- */$acl_libdirstem | */$acl_libdirstem/)
- basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
- if test "$name" = '$1'; then
- LIB[]NAME[]_PREFIX="$basedir"
- fi
- additional_includedir="$basedir/include"
- ;;
- */$acl_libdirstem2 | */$acl_libdirstem2/)
- basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
- if test "$name" = '$1'; then
- LIB[]NAME[]_PREFIX="$basedir"
- fi
- additional_includedir="$basedir/include"
- ;;
- esac
- if test "X$additional_includedir" != "X"; then
- dnl Potentially add $additional_includedir to $INCNAME.
- dnl But don't add it
- dnl 1. if it's the standard /usr/include,
- dnl 2. if it's /usr/local/include and we are using GCC on Linux,
- dnl 3. if it's already present in $CPPFLAGS or the already
- dnl constructed $INCNAME,
- dnl 4. if it doesn't exist as a directory.
- if test "X$additional_includedir" != "X/usr/include"; then
- haveit=
- if test "X$additional_includedir" = "X/usr/local/include"; then
- if test -n "$GCC"; then
- case $host_os in
- linux* | gnu* | k*bsd*-gnu) haveit=yes;;
- esac
- fi
- fi
- if test -z "$haveit"; then
- for x in $CPPFLAGS $INC[]NAME; do
- AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
- if test "X$x" = "X-I$additional_includedir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- if test -d "$additional_includedir"; then
- dnl Really add $additional_includedir to $INCNAME.
- INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
- fi
- fi
- fi
- fi
- fi
- dnl Look for dependencies.
- if test -n "$found_la"; then
- dnl Read the .la file. It defines the variables
- dnl dlname, library_names, old_library, dependency_libs, current,
- dnl age, revision, installed, dlopen, dlpreopen, libdir.
- save_libdir="$libdir"
- case "$found_la" in
- */* | *\\*) . "$found_la" ;;
- *) . "./$found_la" ;;
- esac
- libdir="$save_libdir"
- dnl We use only dependency_libs.
- for dep in $dependency_libs; do
- case "$dep" in
- -L*)
- additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
- dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
- dnl But don't add it
- dnl 1. if it's the standard /usr/lib,
- dnl 2. if it's /usr/local/lib and we are using GCC on Linux,
- dnl 3. if it's already present in $LDFLAGS or the already
- dnl constructed $LIBNAME,
- dnl 4. if it doesn't exist as a directory.
- if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \
- && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then
- haveit=
- if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \
- || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then
- if test -n "$GCC"; then
- case $host_os in
- linux* | gnu* | k*bsd*-gnu) haveit=yes;;
- esac
- fi
- fi
- if test -z "$haveit"; then
- haveit=
- for x in $LDFLAGS $LIB[]NAME; do
- AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
- if test "X$x" = "X-L$additional_libdir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- if test -d "$additional_libdir"; then
- dnl Really add $additional_libdir to $LIBNAME.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
- fi
- fi
- haveit=
- for x in $LDFLAGS $LTLIB[]NAME; do
- AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
- if test "X$x" = "X-L$additional_libdir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- if test -d "$additional_libdir"; then
- dnl Really add $additional_libdir to $LTLIBNAME.
- LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
- fi
- fi
- fi
- fi
- ;;
- -R*)
- dir=`echo "X$dep" | sed -e 's/^X-R//'`
- if test "$enable_rpath" != no; then
- dnl Potentially add DIR to rpathdirs.
- dnl The rpathdirs will be appended to $LIBNAME at the end.
- haveit=
- for x in $rpathdirs; do
- if test "X$x" = "X$dir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- rpathdirs="$rpathdirs $dir"
- fi
- dnl Potentially add DIR to ltrpathdirs.
- dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
- haveit=
- for x in $ltrpathdirs; do
- if test "X$x" = "X$dir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- ltrpathdirs="$ltrpathdirs $dir"
- fi
- fi
- ;;
- -l*)
- dnl Handle this in the next round.
- names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
- ;;
- *.la)
- dnl Handle this in the next round. Throw away the .la's
- dnl directory; it is already contained in a preceding -L
- dnl option.
- names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
- ;;
- *)
- dnl Most likely an immediate library name.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
- LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
- ;;
- esac
- done
- fi
- else
- dnl Didn't find the library; assume it is in the system directories
- dnl known to the linker and runtime loader. (All the system
- dnl directories known to the linker should also be known to the
- dnl runtime loader, otherwise the system is severely misconfigured.)
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
- LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
- fi
- fi
- fi
- done
- done
- if test "X$rpathdirs" != "X"; then
- if test -n "$acl_hardcode_libdir_separator"; then
- dnl Weird platform: only the last -rpath option counts, the user must
- dnl pass all path elements in one option. We can arrange that for a
- dnl single library, but not when more than one $LIBNAMEs are used.
- alldirs=
- for found_dir in $rpathdirs; do
- alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
- done
- dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl.
- acl_save_libdir="$libdir"
- libdir="$alldirs"
- eval flag=\"$acl_hardcode_libdir_flag_spec\"
- libdir="$acl_save_libdir"
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
- else
- dnl The -rpath options are cumulative.
- for found_dir in $rpathdirs; do
- acl_save_libdir="$libdir"
- libdir="$found_dir"
- eval flag=\"$acl_hardcode_libdir_flag_spec\"
- libdir="$acl_save_libdir"
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
- done
- fi
- fi
- if test "X$ltrpathdirs" != "X"; then
- dnl When using libtool, the option that works for both libraries and
- dnl executables is -R. The -R options are cumulative.
- for found_dir in $ltrpathdirs; do
- LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
- done
- fi
- popdef([P_A_C_K])
- popdef([PACKLIBS])
- popdef([PACKUP])
- popdef([PACK])
- popdef([NAME])
-])
-
-dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
-dnl unless already present in VAR.
-dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
-dnl contains two or three consecutive elements that belong together.
-AC_DEFUN([AC_LIB_APPENDTOVAR],
-[
- for element in [$2]; do
- haveit=
- for x in $[$1]; do
- AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
- if test "X$x" = "X$element"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- [$1]="${[$1]}${[$1]:+ }$element"
- fi
- done
-])
-
-dnl For those cases where a variable contains several -L and -l options
-dnl referring to unknown libraries and directories, this macro determines the
-dnl necessary additional linker options for the runtime path.
-dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
-dnl sets LDADDVAR to linker options needed together with LIBSVALUE.
-dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
-dnl otherwise linking without libtool is assumed.
-AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
-[
- AC_REQUIRE([AC_LIB_RPATH])
- AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
- $1=
- if test "$enable_rpath" != no; then
- if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
- dnl Use an explicit option to hardcode directories into the resulting
- dnl binary.
- rpathdirs=
- next=
- for opt in $2; do
- if test -n "$next"; then
- dir="$next"
- dnl No need to hardcode the standard /usr/lib.
- if test "X$dir" != "X/usr/$acl_libdirstem" \
- && test "X$dir" != "X/usr/$acl_libdirstem2"; then
- rpathdirs="$rpathdirs $dir"
- fi
- next=
- else
- case $opt in
- -L) next=yes ;;
- -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
- dnl No need to hardcode the standard /usr/lib.
- if test "X$dir" != "X/usr/$acl_libdirstem" \
- && test "X$dir" != "X/usr/$acl_libdirstem2"; then
- rpathdirs="$rpathdirs $dir"
- fi
- next= ;;
- *) next= ;;
- esac
- fi
- done
- if test "X$rpathdirs" != "X"; then
- if test -n ""$3""; then
- dnl libtool is used for linking. Use -R options.
- for dir in $rpathdirs; do
- $1="${$1}${$1:+ }-R$dir"
- done
- else
- dnl The linker is used for linking directly.
- if test -n "$acl_hardcode_libdir_separator"; then
- dnl Weird platform: only the last -rpath option counts, the user
- dnl must pass all path elements in one option.
- alldirs=
- for dir in $rpathdirs; do
- alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir"
- done
- acl_save_libdir="$libdir"
- libdir="$alldirs"
- eval flag=\"$acl_hardcode_libdir_flag_spec\"
- libdir="$acl_save_libdir"
- $1="$flag"
- else
- dnl The -rpath options are cumulative.
- for dir in $rpathdirs; do
- acl_save_libdir="$libdir"
- libdir="$dir"
- eval flag=\"$acl_hardcode_libdir_flag_spec\"
- libdir="$acl_save_libdir"
- $1="${$1}${$1:+ }$flag"
- done
- fi
- fi
- fi
- fi
- fi
- AC_SUBST([$1])
-])
+++ /dev/null
-# lib-prefix.m4 serial 7 (gettext-0.18)
-dnl Copyright (C) 2001-2005, 2008-2010 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl From Bruno Haible.
-
-dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
-dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
-dnl require excessive bracketing.
-ifdef([AC_HELP_STRING],
-[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
-[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
-
-dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
-dnl to access previously installed libraries. The basic assumption is that
-dnl a user will want packages to use other packages he previously installed
-dnl with the same --prefix option.
-dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
-dnl libraries, but is otherwise very convenient.
-AC_DEFUN([AC_LIB_PREFIX],
-[
- AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
- AC_REQUIRE([AC_PROG_CC])
- AC_REQUIRE([AC_CANONICAL_HOST])
- AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
- AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
- dnl By default, look in $includedir and $libdir.
- use_additional=yes
- AC_LIB_WITH_FINAL_PREFIX([
- eval additional_includedir=\"$includedir\"
- eval additional_libdir=\"$libdir\"
- ])
- AC_LIB_ARG_WITH([lib-prefix],
-[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
- --without-lib-prefix don't search for libraries in includedir and libdir],
-[
- if test "X$withval" = "Xno"; then
- use_additional=no
- else
- if test "X$withval" = "X"; then
- AC_LIB_WITH_FINAL_PREFIX([
- eval additional_includedir=\"$includedir\"
- eval additional_libdir=\"$libdir\"
- ])
- else
- additional_includedir="$withval/include"
- additional_libdir="$withval/$acl_libdirstem"
- fi
- fi
-])
- if test $use_additional = yes; then
- dnl Potentially add $additional_includedir to $CPPFLAGS.
- dnl But don't add it
- dnl 1. if it's the standard /usr/include,
- dnl 2. if it's already present in $CPPFLAGS,
- dnl 3. if it's /usr/local/include and we are using GCC on Linux,
- dnl 4. if it doesn't exist as a directory.
- if test "X$additional_includedir" != "X/usr/include"; then
- haveit=
- for x in $CPPFLAGS; do
- AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
- if test "X$x" = "X-I$additional_includedir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- if test "X$additional_includedir" = "X/usr/local/include"; then
- if test -n "$GCC"; then
- case $host_os in
- linux* | gnu* | k*bsd*-gnu) haveit=yes;;
- esac
- fi
- fi
- if test -z "$haveit"; then
- if test -d "$additional_includedir"; then
- dnl Really add $additional_includedir to $CPPFLAGS.
- CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
- fi
- fi
- fi
- fi
- dnl Potentially add $additional_libdir to $LDFLAGS.
- dnl But don't add it
- dnl 1. if it's the standard /usr/lib,
- dnl 2. if it's already present in $LDFLAGS,
- dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
- dnl 4. if it doesn't exist as a directory.
- if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
- haveit=
- for x in $LDFLAGS; do
- AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
- if test "X$x" = "X-L$additional_libdir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
- if test -n "$GCC"; then
- case $host_os in
- linux*) haveit=yes;;
- esac
- fi
- fi
- if test -z "$haveit"; then
- if test -d "$additional_libdir"; then
- dnl Really add $additional_libdir to $LDFLAGS.
- LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
- fi
- fi
- fi
- fi
- fi
-])
-
-dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
-dnl acl_final_exec_prefix, containing the values to which $prefix and
-dnl $exec_prefix will expand at the end of the configure script.
-AC_DEFUN([AC_LIB_PREPARE_PREFIX],
-[
- dnl Unfortunately, prefix and exec_prefix get only finally determined
- dnl at the end of configure.
- if test "X$prefix" = "XNONE"; then
- acl_final_prefix="$ac_default_prefix"
- else
- acl_final_prefix="$prefix"
- fi
- if test "X$exec_prefix" = "XNONE"; then
- acl_final_exec_prefix='${prefix}'
- else
- acl_final_exec_prefix="$exec_prefix"
- fi
- acl_save_prefix="$prefix"
- prefix="$acl_final_prefix"
- eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
- prefix="$acl_save_prefix"
-])
-
-dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
-dnl variables prefix and exec_prefix bound to the values they will have
-dnl at the end of the configure script.
-AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
-[
- acl_save_prefix="$prefix"
- prefix="$acl_final_prefix"
- acl_save_exec_prefix="$exec_prefix"
- exec_prefix="$acl_final_exec_prefix"
- $1
- exec_prefix="$acl_save_exec_prefix"
- prefix="$acl_save_prefix"
-])
-
-dnl AC_LIB_PREPARE_MULTILIB creates
-dnl - a variable acl_libdirstem, containing the basename of the libdir, either
-dnl "lib" or "lib64" or "lib/64",
-dnl - a variable acl_libdirstem2, as a secondary possible value for
-dnl acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or
-dnl "lib/amd64".
-AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
-[
- dnl There is no formal standard regarding lib and lib64.
- dnl On glibc systems, the current practice is that on a system supporting
- dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
- dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine
- dnl the compiler's default mode by looking at the compiler's library search
- dnl path. If at least one of its elements ends in /lib64 or points to a
- dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI.
- dnl Otherwise we use the default, namely "lib".
- dnl On Solaris systems, the current practice is that on a system supporting
- dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
- dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or
- dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib.
- AC_REQUIRE([AC_CANONICAL_HOST])
- acl_libdirstem=lib
- acl_libdirstem2=
- case "$host_os" in
- solaris*)
- dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment
- dnl <http://docs.sun.com/app/docs/doc/816-5138/dev-env?l=en&a=view>.
- dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link."
- dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the
- dnl symlink is missing, so we set acl_libdirstem2 too.
- AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit],
- [AC_EGREP_CPP([sixtyfour bits], [
-#ifdef _LP64
-sixtyfour bits
-#endif
- ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no])
- ])
- if test $gl_cv_solaris_64bit = yes; then
- acl_libdirstem=lib/64
- case "$host_cpu" in
- sparc*) acl_libdirstem2=lib/sparcv9 ;;
- i*86 | x86_64) acl_libdirstem2=lib/amd64 ;;
- esac
- fi
- ;;
- *)
- searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
- if test -n "$searchpath"; then
- acl_save_IFS="${IFS= }"; IFS=":"
- for searchdir in $searchpath; do
- if test -d "$searchdir"; then
- case "$searchdir" in
- */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
- */../ | */.. )
- # Better ignore directories of this form. They are misleading.
- ;;
- *) searchdir=`cd "$searchdir" && pwd`
- case "$searchdir" in
- */lib64 ) acl_libdirstem=lib64 ;;
- esac ;;
- esac
- fi
- done
- IFS="$acl_save_IFS"
- fi
- ;;
- esac
- test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem"
-])
+++ /dev/null
-/Makefile
-/Makefile.in
-/.libs
-/.deps
-/*.lo
-/*.la
-/*.o
-/semantic.cache
-/.project
-/.cproject
-/eglib-config.h
+++ /dev/null
-noinst_LTLIBRARIES = libeglib.la
-
-AM_CFLAGS = $(WERROR_CFLAGS)
-
-win_files = \
- eglib-config.hw \
- gdate-win32.c gdir-win32.c gfile-win32.c gmisc-win32.c \
- gmodule-win32.c gmodule-win32-internals.h gtimer-win32.c gunicode-win32.c
-
-unix_files = \
- gdate-unix.c gdir-unix.c gfile-unix.c gmisc-unix.c \
- gmodule-unix.c gtimer-unix.c
-
-if HOST_WIN32
-os_files = $(win_files)
-else
-os_files = $(unix_files)
-endif
-
-libeglib_la_SOURCES = \
- eglib-remap.h \
- sort.frag.h \
- glib.h \
- garray.c \
- gbytearray.c \
- gerror.c \
- ghashtable.c \
- giconv.c \
- gmem.c \
- gmodule.h \
- goutput.c \
- gqsort.c \
- gstr.c \
- gslist.c \
- gstring.c \
- gptrarray.c \
- glist.c \
- gqueue.c \
- gpath.c \
- gshell.c \
- gspawn.c \
- gfile.c \
- gfile-posix.c \
- gpattern.c \
- gmarkup.c \
- gutf8.c \
- gunicode.c \
- unicode-data.h \
- $(os_files)
-
-libeglib_la_CFLAGS = -g -Wall -D_FORTIFY_SOURCE=2
-
-AM_CPPFLAGS = -I$(srcdir)
-
-if HOST_WIN32
-libeglib_la_LIBADD = -lm $(LIBICONV) -lpsapi
-else
-if PLATFORM_ANDROID
-libeglib_la_LIBADD = -llog
-endif
-endif
-
-MAINTAINERCLEANFILES = Makefile.in
-
-EXTRA_DIST = eglib-config.h.in $(win_files) $(unix_files)
+++ /dev/null
-#ifndef __EGLIB_CONFIG_H
-#define __EGLIB_CONFIG_H
-
-/*
- * System-dependent settings
- */
-#define G_GNUC_PRETTY_FUNCTION @GNUC_PRETTY@
-#define G_GNUC_UNUSED @GNUC_UNUSED@
-#define G_BYTE_ORDER @ORDER@
-#define G_GNUC_NORETURN @GNUC_NORETURN@
-#define G_SEARCHPATH_SEPARATOR_S "@SEARCHSEP@"
-#define G_SEARCHPATH_SEPARATOR '@SEARCHSEP@'
-#define G_DIR_SEPARATOR '@PATHSEP@'
-#define G_DIR_SEPARATOR_S "@PATHSEP@"
-#define G_BREAKPOINT() @BREAKPOINT@
-#define G_OS_@OS@
-#define GPOINTER_TO_INT(ptr) @GPOINTER_TO_INT@
-#define GPOINTER_TO_UINT(ptr) @GPOINTER_TO_UINT@
-#define GINT_TO_POINTER(v) @GINT_TO_POINTER@
-#define GUINT_TO_POINTER(v) @GUINT_TO_POINTER@
-
-#if @HAVE_ALLOCA_H@ == 1
-#define G_HAVE_ALLOCA_H
-#endif
-
-typedef unsigned @GSIZE@ gsize;
-typedef signed @GSIZE@ gssize;
-
-#define G_GSIZE_FORMAT @GSIZE_FORMAT@
-
-#if @G_HAVE_ISO_VARARGS@ == 1
-#define G_HAVE_ISO_VARARGS
-#endif
-
-#if defined (HOST_WATCHOS)
-#undef G_BREAKPOINT
-#define G_BREAKPOINT()
-#endif
-
-typedef @PIDTYPE@ GPid;
-
-#endif
+++ /dev/null
-#ifndef __EGLIB_CONFIG_H
-#define __EGLIB_CONFIG_H
-
-/*
- * System-dependent settings
- */
-#define G_OS_WIN32 1
-
-#ifdef _MSC_VER
-
-#include <io.h>
-
-#define G_GNUC_PRETTY_FUNCTION __FUNCTION__
-#define G_GNUC_UNUSED
-#define G_BYTE_ORDER 1234
-#define G_GNUC_NORETURN
-#define G_BREAKPOINT() __debugbreak()
-#define MAXPATHLEN 242
-
-typedef uintptr_t gsize;
-typedef intptr_t gssize;
-typedef int pid_t;
-
-#define G_DIR_SEPARATOR '\\'
-#define G_DIR_SEPARATOR_S "\\"
-#define G_SEARCHPATH_SEPARATOR_S ";"
-#define G_SEARCHPATH_SEPARATOR ';'
-#define G_GSIZE_FORMAT "d"
-#define GPOINTER_TO_INT(ptr) ((gint)(intptr_t) (ptr))
-#define GPOINTER_TO_UINT(ptr) ((guint)(intptr_t) (ptr))
-#define GINT_TO_POINTER(v) ((gpointer)(intptr_t) (v))
-#define GUINT_TO_POINTER(v) ((gpointer)(intptr_t) (v))
-
-#define STDOUT_FILENO (int)(intptr_t)stdout
-#define STDERR_FILENO (int)(intptr_t)stderr
-
-/* FIXME: what should this be ?*/
-#define X_OK 4 /* This is really read */
-#define WNOHANG 1
-#define F_SETFD 1
-#define FD_CLOEXEC 1
-
-#undef inline
-#define inline __inline
-
-#define strtok_r strtok_s
-
-#undef G_HAVE_UNISTD_H
-#undef G_HAVE_SYS_TIME_H
-#undef G_HAVE_SYS_WAIT_H
-#undef G_HAVE_PWD_H
-#undef G_HAVE_STRNDUP
-#define G_HAVE_GETOPT_H 1
-
-/* disable the following warnings
- * C4100: The formal parameter is not referenced in the body of the function. The unreferenced parameter is ignored.
- * C4127: conditional expression is constant
-*/
-#pragma warning(disable:4100 4127)
-#endif
-
-typedef void * GPid;
-#endif
+++ /dev/null
-#define g_array_append monoeg_g_array_append
-#define g_array_append_vals monoeg_g_array_append_vals
-#define g_array_free monoeg_g_array_free
-#define g_array_insert_vals monoeg_g_array_insert_vals
-#define g_array_new monoeg_g_array_new
-#define g_array_remove_index monoeg_g_array_remove_index
-#define g_array_remove_index_fast monoeg_g_array_remove_index_fast
-#define g_array_set_size monoeg_g_array_set_size
-#define g_array_sized_new monoeg_g_array_sized_new
-#define g_ascii_strdown monoeg_g_ascii_strdown
-#define g_ascii_strncasecmp monoeg_g_ascii_strncasecmp
-#define g_ascii_tolower monoeg_g_ascii_tolower
-#define g_ascii_xdigit_value monoeg_g_ascii_xdigit_value
-#define g_build_path monoeg_g_build_path
-#define g_byte_array_append monoeg_g_byte_array_append
-#define g_byte_array_free monoeg_g_byte_array_free
-#define g_byte_array_new monoeg_g_byte_array_new
-#define g_byte_array_set_size monoeg_g_byte_array_set_size
-#define g_calloc monoeg_g_calloc
-#define g_clear_error monoeg_g_clear_error
-#define g_convert monoeg_g_convert
-#define g_convert_error_quark monoeg_g_convert_error_quark
-#define g_dir_close monoeg_g_dir_close
-#define g_dir_open monoeg_g_dir_open
-#define g_dir_read_name monoeg_g_dir_read_name
-#define g_dir_rewind monoeg_g_dir_rewind
-#define g_mkdir_with_parents monoeg_g_mkdir_with_parents
-#define g_direct_equal monoeg_g_direct_equal
-#define g_direct_hash monoeg_g_direct_hash
-#define g_ensure_directory_exists monoeg_g_ensure_directory_exists
-#define g_error_free monoeg_g_error_free
-#define g_error_new monoeg_g_error_new
-#define g_error_vnew monoeg_g_error_vnew
-#define g_file_error_quark monoeg_g_file_error_quark
-#define g_file_error_from_errno monoeg_g_file_error_from_errno
-#define g_file_get_contents monoeg_g_file_get_contents
-#define g_file_set_contents monoeg_g_file_set_contents
-#define g_file_open_tmp monoeg_g_file_open_tmp
-#define g_file_test monoeg_g_file_test
-#define g_filename_from_uri monoeg_g_filename_from_uri
-#define g_filename_from_utf8 monoeg_g_filename_from_utf8
-#define g_filename_to_uri monoeg_g_filename_to_uri
-#define g_find_program_in_path monoeg_g_find_program_in_path
-#define g_fprintf monoeg_g_fprintf
-#define g_free monoeg_g_free
-#define g_get_charset monoeg_g_get_charset
-#define g_get_current_dir monoeg_g_get_current_dir
-#define g_get_current_time monoeg_g_get_current_time
-#define g_get_home_dir monoeg_g_get_home_dir
-#define g_get_prgname monoeg_g_get_prgname
-#define g_get_tmp_dir monoeg_g_get_tmp_dir
-#define g_get_user_name monoeg_g_get_user_name
-#define g_getenv monoeg_g_getenv
-#define g_hasenv monoeg_g_hasenv
-#define g_hash_table_destroy monoeg_g_hash_table_destroy
-#define g_hash_table_find monoeg_g_hash_table_find
-#define g_hash_table_foreach monoeg_g_hash_table_foreach
-#define g_hash_table_foreach_remove monoeg_g_hash_table_foreach_remove
-#define g_hash_table_foreach_steal monoeg_g_hash_table_foreach_steal
-#define g_hash_table_get_keys monoeg_g_hash_table_get_keys
-#define g_hash_table_get_values monoeg_g_hash_table_get_values
-#define g_hash_table_insert_replace monoeg_g_hash_table_insert_replace
-#define g_hash_table_lookup monoeg_g_hash_table_lookup
-#define g_hash_table_lookup_extended monoeg_g_hash_table_lookup_extended
-#define g_hash_table_new monoeg_g_hash_table_new
-#define g_hash_table_new_full monoeg_g_hash_table_new_full
-#define g_hash_table_remove monoeg_g_hash_table_remove
-#define g_hash_table_steal monoeg_g_hash_table_steal
-#define g_hash_table_size monoeg_g_hash_table_size
-#define g_hash_table_print_stats monoeg_g_hash_table_print_stats
-#define g_hash_table_remove_all monoeg_g_hash_table_remove_all
-#define g_hash_table_iter_init monoeg_g_hash_table_iter_init
-#define g_hash_table_iter_next monoeg_g_hash_table_iter_next
-#define g_iconv monoeg_g_iconv
-#define g_iconv_close monoeg_g_iconv_close
-#define g_iconv_open monoeg_g_iconv_open
-#define g_int_equal monoeg_g_int_equal
-#define g_int_hash monoeg_g_int_hash
-#define g_list_alloc monoeg_g_list_alloc
-#define g_list_append monoeg_g_list_append
-#define g_list_concat monoeg_g_list_concat
-#define g_list_copy monoeg_g_list_copy
-#define g_list_delete_link monoeg_g_list_delete_link
-#define g_list_find monoeg_g_list_find
-#define g_list_find_custom monoeg_g_list_find_custom
-#define g_list_first monoeg_g_list_first
-#define g_list_foreach monoeg_g_list_foreach
-#define g_list_free monoeg_g_list_free
-#define g_list_free_1 monoeg_g_list_free_1
-#define g_list_index monoeg_g_list_index
-#define g_list_insert_before monoeg_g_list_insert_before
-#define g_list_insert_sorted monoeg_g_list_insert_sorted
-#define g_list_last monoeg_g_list_last
-#define g_list_length monoeg_g_list_length
-#define g_list_nth monoeg_g_list_nth
-#define g_list_nth_data monoeg_g_list_nth_data
-#define g_list_prepend monoeg_g_list_prepend
-#define g_list_remove monoeg_g_list_remove
-#define g_list_remove_all monoeg_g_list_remove_all
-#define g_list_remove_link monoeg_g_list_remove_link
-#define g_list_reverse monoeg_g_list_reverse
-#define g_list_sort monoeg_g_list_sort
-#define g_locale_from_utf8 monoeg_g_locale_from_utf8
-#define g_locale_to_utf8 monoeg_g_locale_to_utf8
-#define g_log monoeg_g_log
-#define g_log_set_always_fatal monoeg_g_log_set_always_fatal
-#define g_log_set_fatal_mask monoeg_g_log_set_fatal_mask
-#define g_logv monoeg_g_logv
-#define g_markup_parse_context_end_parse monoeg_g_markup_parse_context_end_parse
-#define g_markup_parse_context_free monoeg_g_markup_parse_context_free
-#define g_markup_parse_context_new monoeg_g_markup_parse_context_new
-#define g_markup_parse_context_parse monoeg_g_markup_parse_context_parse
-#define g_memdup monoeg_g_memdup
-#define g_mem_set_vtable monoeg_g_mem_set_vtable
-#define g_mkdtemp monoeg_g_mkdtemp
-#define g_module_build_path monoeg_g_module_build_path
-#define g_module_close monoeg_g_module_close
-#define g_module_error monoeg_g_module_error
-#define g_module_open monoeg_g_module_open
-#define g_module_symbol monoeg_g_module_symbol
-#define g_path_get_basename monoeg_g_path_get_basename
-#define g_path_get_dirname monoeg_g_path_get_dirname
-#define g_path_is_absolute monoeg_g_path_is_absolute
-#define g_pattern_match_string monoeg_g_pattern_match_string
-#define g_pattern_spec_free monoeg_g_pattern_spec_free
-#define g_pattern_spec_new monoeg_g_pattern_spec_new
-#define g_print monoeg_g_print
-#define g_printf monoeg_g_printf
-#define g_printerr monoeg_g_printerr
-#define g_propagate_error monoeg_g_propagate_error
-#define g_ptr_array_add monoeg_g_ptr_array_add
-#define g_ptr_array_foreach monoeg_g_ptr_array_foreach
-#define g_ptr_array_free monoeg_g_ptr_array_free
-#define g_ptr_array_new monoeg_g_ptr_array_new
-#define g_ptr_array_remove monoeg_g_ptr_array_remove
-#define g_ptr_array_remove_fast monoeg_g_ptr_array_remove_fast
-#define g_ptr_array_remove_index monoeg_g_ptr_array_remove_index
-#define g_ptr_array_remove_index_fast monoeg_g_ptr_array_remove_index_fast
-#define g_ptr_array_set_size monoeg_g_ptr_array_set_size
-#define g_ptr_array_sized_new monoeg_g_ptr_array_sized_new
-#define g_ptr_array_sort monoeg_g_ptr_array_sort
-#define g_ptr_array_sort_with_data monoeg_g_ptr_array_sort_with_data
-#define g_qsort_with_data monoeg_g_qsort_with_data
-#define g_queue_free monoeg_g_queue_free
-#define g_queue_is_empty monoeg_g_queue_is_empty
-#define g_queue_foreach monoeg_g_queue_foreach
-#define g_queue_new monoeg_g_queue_new
-#define g_queue_pop_head monoeg_g_queue_pop_head
-#define g_queue_push_head monoeg_g_queue_push_head
-#define g_queue_push_tail monoeg_g_queue_push_tail
-#define g_set_error monoeg_g_set_error
-#define g_set_prgname monoeg_g_set_prgname
-#define g_setenv monoeg_g_setenv
-#define g_shell_parse_argv monoeg_g_shell_parse_argv
-#define g_shell_quote monoeg_g_shell_quote
-#define g_shell_unquote monoeg_g_shell_unquote
-#define g_slist_alloc monoeg_g_slist_alloc
-#define g_slist_append monoeg_g_slist_append
-#define g_slist_concat monoeg_g_slist_concat
-#define g_slist_copy monoeg_g_slist_copy
-#define g_slist_delete_link monoeg_g_slist_delete_link
-#define g_slist_find monoeg_g_slist_find
-#define g_slist_find_custom monoeg_g_slist_find_custom
-#define g_slist_foreach monoeg_g_slist_foreach
-#define g_slist_free monoeg_g_slist_free
-#define g_slist_free_1 monoeg_g_slist_free_1
-#define g_slist_index monoeg_g_slist_index
-#define g_slist_insert_before monoeg_g_slist_insert_before
-#define g_slist_insert_sorted monoeg_g_slist_insert_sorted
-#define g_slist_last monoeg_g_slist_last
-#define g_slist_length monoeg_g_slist_length
-#define g_slist_nth monoeg_g_slist_nth
-#define g_slist_nth_data monoeg_g_slist_nth_data
-#define g_slist_prepend monoeg_g_slist_prepend
-#define g_slist_remove monoeg_g_slist_remove
-#define g_slist_remove_all monoeg_g_slist_remove_all
-#define g_slist_remove_link monoeg_g_slist_remove_link
-#define g_slist_reverse monoeg_g_slist_reverse
-#define g_slist_sort monoeg_g_slist_sort
-#define g_snprintf monoeg_g_snprintf
-#define g_spaced_primes_closest monoeg_g_spaced_primes_closest
-#define g_spawn_async_with_pipes monoeg_g_spawn_async_with_pipes
-#define g_spawn_command_line_sync monoeg_g_spawn_command_line_sync
-#define g_sprintf monoeg_g_sprintf
-#define g_stpcpy monoeg_g_stpcpy
-#define g_str_equal monoeg_g_str_equal
-#define g_str_has_prefix monoeg_g_str_has_prefix
-#define g_str_has_suffix monoeg_g_str_has_suffix
-#define g_str_hash monoeg_g_str_hash
-#define g_strchomp monoeg_g_strchomp
-#define g_strchug monoeg_g_strchug
-#define g_strconcat monoeg_g_strconcat
-#define g_strdelimit monoeg_g_strdelimit
-#define g_strdown monoeg_g_strdown
-#define g_strdup_printf monoeg_g_strdup_printf
-#define g_strdup_vprintf monoeg_g_strdup_vprintf
-#define g_strerror monoeg_g_strerror
-#define g_strescape monoeg_g_strescape
-#define g_strfreev monoeg_g_strfreev
-#define g_strdupv monoeg_g_strdupv
-#define g_string_append monoeg_g_string_append
-#define g_string_append_c monoeg_g_string_append_c
-#define g_string_append_len monoeg_g_string_append_len
-#define g_string_append_unichar monoeg_g_string_append_unichar
-#define g_string_append_printf monoeg_g_string_append_printf
-#define g_string_append_vprintf monoeg_g_string_append_vprintf
-#define g_string_erase monoeg_g_string_erase
-#define g_string_free monoeg_g_string_free
-#define g_string_insert monoeg_g_string_insert
-#define g_string_new monoeg_g_string_new
-#define g_string_new_len monoeg_g_string_new_len
-#define g_string_prepend monoeg_g_string_prepend
-#define g_string_printf monoeg_g_string_printf
-#define g_string_set_size monoeg_g_string_set_size
-#define g_string_sized_new monoeg_g_string_sized_new
-#define g_string_truncate monoeg_g_string_truncate
-#define g_strjoin monoeg_g_strjoin
-#define g_strjoinv monoeg_g_strjoinv
-#define g_strlcpy monoeg_g_strlcpy
-#define g_strndup monoeg_g_strndup
-#define g_strnfill monoeg_g_strnfill
-#define g_strreverse monoeg_g_strreverse
-#define g_strsplit monoeg_g_strsplit
-#define g_strsplit_set monoeg_g_strsplit_set
-#define g_strv_length monoeg_g_strv_length
-#define g_timer_destroy monoeg_g_timer_destroy
-#define g_timer_elapsed monoeg_g_timer_elapsed
-#define g_timer_new monoeg_g_timer_new
-#define g_timer_start monoeg_g_timer_start
-#define g_timer_stop monoeg_g_timer_stop
-#define g_trailingBytesForUTF8 monoeg_g_trailingBytesForUTF8
-#define g_ucs4_to_utf8 monoeg_g_ucs4_to_utf8
-#define g_ucs4_to_utf16 monoeg_g_ucs4_to_utf16
-#define g_unichar_case monoeg_g_unichar_case
-#define g_unichar_isxdigit monoeg_g_unichar_isxdigit
-#define g_unichar_tolower monoeg_g_unichar_tolower
-#define g_unichar_totitle monoeg_g_unichar_totitle
-#define g_unichar_toupper monoeg_g_unichar_toupper
-#define g_unichar_type monoeg_g_unichar_type
-#define g_unichar_xdigit_value monoeg_g_unichar_xdigit_value
-#define g_unsetenv monoeg_g_unsetenv
-#define g_usleep monoeg_g_usleep
-#define g_utf16_to_ucs4 monoeg_g_utf16_to_ucs4
-#define g_utf16_to_utf8 monoeg_g_utf16_to_utf8
-#define g_utf8_get_char monoeg_g_utf8_get_char
-#define g_utf8_offset_to_pointer monoeg_g_utf8_offset_to_pointer
-#define g_utf8_pointer_to_offset monoeg_g_utf8_pointer_to_offset
-#define g_utf8_strdown monoeg_g_utf8_strdown
-#define g_utf8_strlen monoeg_g_utf8_strlen
-#define g_utf8_strup monoeg_g_utf8_strup
-#define g_utf8_to_ucs4_fast monoeg_g_utf8_to_ucs4_fast
-#define g_utf8_to_utf16 monoeg_g_utf8_to_utf16
-#define g_utf8_validate monoeg_g_utf8_validate
-#define g_unichar_to_utf8 monoeg_g_unichar_to_utf8
-#define g_unichar_is_space monoeg_g_unichar_is_space
-#define g_unicode_break_type monoeg_g_unicode_break_type
-#define g_utf8_offset_to_pointer monoeg_g_utf8_offset_to_pointer
-#define g_utf8_pointer_to_offset monoeg_g_utf8_pointer_to_offset
-#define g_utf8_to_ucs4_fast monoeg_g_utf8_to_ucs4_fast
-#define g_vasprintf monoeg_g_vasprintf
-#define g_win32_getlocale monoeg_g_win32_getlocale
-#define g_assertion_message monoeg_assertion_message
-#define g_malloc monoeg_malloc
-#define g_malloc0 monoeg_malloc0
-#define g_ptr_array_grow monoeg_ptr_array_grow
-#define g_realloc monoeg_realloc
-#define g_try_malloc monoeg_try_malloc
-#define g_try_realloc monoeg_try_realloc
-#define g_strdup monoeg_strdup
-#define g_ucs4_to_utf16_len monoeg_ucs4_to_utf16_len
-#define g_utf16_to_ucs4_len monoeg_utf16_to_ucs4_len
-
-#define g_ascii_strcasecmp monoeg_ascii_strcasecmp
-#define g_ascii_strup monoeg_ascii_strup
-#define g_ascii_toupper monoeg_ascii_toupper
-#define g_unichar_break_type monoeg_unichar_break_type
-#define g_unichar_isspace monoeg_unichar_isspace
-#define g_unichar_to_utf16 monoeg_unichar_to_utf16
-#define g_utf8_find_prev_char monoeg_utf8_find_prev_char
-#define g_utf8_get_char_validated monoeg_utf8_get_char_validated
-#define g_utf8_prev_char monoeg_utf8_prev_char
-#define g_utf8_to_ucs4 monoeg_utf8_to_ucs4
-
-
-#define g_log_default_handler monoeg_log_default_handler
-#define g_log_set_default_handler monoeg_log_set_default_handler
-#define g_set_print_handler monoeg_set_print_handler
-#define g_set_printerr_handler monoeg_set_printerr_handler
+++ /dev/null
-/*
- * Arrays
- *
- * Author:
- * Chris Toshok (toshok@novell.com)
- *
- * (C) 2006 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.
- */
-
-#include <stdlib.h>
-#include <glib.h>
-
-#define INITIAL_CAPACITY 16
-
-#define element_offset(p,i) ((p)->array.data + (i) * (p)->element_size)
-#define element_length(p,i) ((i) * (p)->element_size)
-
-typedef struct {
- GArray array;
- gboolean clear_;
- guint element_size;
- gboolean zero_terminated;
- guint capacity;
-} GArrayPriv;
-
-static void
-ensure_capacity (GArrayPriv *priv, guint capacity)
-{
- guint new_capacity;
-
- if (capacity <= priv->capacity)
- return;
-
- new_capacity = (capacity + 63) & ~63;
-
- priv->array.data = g_realloc (priv->array.data, element_length (priv, new_capacity));
-
- if (priv->clear_) {
- memset (element_offset (priv, priv->capacity),
- 0,
- element_length (priv, new_capacity - priv->capacity));
- }
-
- priv->capacity = new_capacity;
-}
-
-GArray *
-g_array_new (gboolean zero_terminated,
- gboolean clear_,
- guint element_size)
-{
- GArrayPriv *rv = g_new0 (GArrayPriv, 1);
- rv->zero_terminated = zero_terminated;
- rv->clear_ = clear_;
- rv->element_size = element_size;
-
- ensure_capacity (rv, INITIAL_CAPACITY);
-
- return (GArray*)rv;
-}
-
-GArray *
-g_array_sized_new (gboolean zero_terminated,
- gboolean clear_,
- guint element_size,
- guint reserved_size)
-{
- GArrayPriv *rv = g_new0 (GArrayPriv, 1);
- rv->zero_terminated = zero_terminated;
- rv->clear_ = clear_;
- rv->element_size = element_size;
-
- ensure_capacity (rv, reserved_size);
-
- return (GArray*)rv;
-}
-
-gchar*
-g_array_free (GArray *array,
- gboolean free_segment)
-{
- gchar* rv = NULL;
-
- g_return_val_if_fail (array != NULL, NULL);
-
- if (free_segment)
- g_free (array->data);
- else
- rv = array->data;
-
- g_free (array);
-
- return rv;
-}
-
-GArray *
-g_array_append_vals (GArray *array,
- gconstpointer data,
- guint len)
-{
- GArrayPriv *priv = (GArrayPriv*)array;
-
- g_return_val_if_fail (array != NULL, NULL);
-
- ensure_capacity (priv, priv->array.len + len + (priv->zero_terminated ? 1 : 0));
-
- memmove (element_offset (priv, priv->array.len),
- data,
- element_length (priv, len));
-
- priv->array.len += len;
-
- if (priv->zero_terminated) {
- memset (element_offset (priv, priv->array.len),
- 0,
- priv->element_size);
- }
-
- return array;
-}
-
-GArray*
-g_array_insert_vals (GArray *array,
- guint index_,
- gconstpointer data,
- guint len)
-{
- GArrayPriv *priv = (GArrayPriv*)array;
- guint extra = (priv->zero_terminated ? 1 : 0);
-
- g_return_val_if_fail (array != NULL, NULL);
-
- ensure_capacity (priv, array->len + len + extra);
-
- /* first move the existing elements out of the way */
- memmove (element_offset (priv, index_ + len),
- element_offset (priv, index_),
- element_length (priv, array->len - index_));
-
- /* then copy the new elements into the array */
- memmove (element_offset (priv, index_),
- data,
- element_length (priv, len));
-
- array->len += len;
-
- if (priv->zero_terminated) {
- memset (element_offset (priv, priv->array.len),
- 0,
- priv->element_size);
- }
-
- return array;
-}
-
-GArray*
-g_array_remove_index (GArray *array,
- guint index_)
-{
- GArrayPriv *priv = (GArrayPriv*)array;
-
- g_return_val_if_fail (array != NULL, NULL);
-
- memmove (element_offset (priv, index_),
- element_offset (priv, index_ + 1),
- element_length (priv, array->len - index_));
-
- array->len --;
-
- if (priv->zero_terminated) {
- memset (element_offset (priv, priv->array.len),
- 0,
- priv->element_size);
- }
-
- return array;
-}
-
-GArray*
-g_array_remove_index_fast (GArray *array,
- guint index_)
-{
- GArrayPriv *priv = (GArrayPriv*)array;
-
- g_return_val_if_fail (array != NULL, NULL);
-
- memmove (element_offset (priv, index_),
- element_offset (priv, array->len - 1),
- element_length (priv, 1));
-
- array->len --;
-
- if (priv->zero_terminated) {
- memset (element_offset (priv, priv->array.len),
- 0,
- priv->element_size);
- }
-
- return array;
-}
-
-void
-g_array_set_size (GArray *array, gint length)
-{
- GArrayPriv *priv = (GArrayPriv*)array;
-
- g_return_if_fail (array != NULL);
- g_return_if_fail (length >= 0);
-
- if (length == priv->capacity)
- return; // nothing to be done
-
- if (length > priv->capacity) {
- // grow the array
- ensure_capacity (priv, length);
- }
-
- array->len = length;
-}
+++ /dev/null
-/*
- * Arrays
- *
- * Author:
- * Geoff Norton (gnorton@novell.com)
- *
- * (C) 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.
- */
-
-#include <stdlib.h>
-#include <glib.h>
-
-GByteArray *
-g_byte_array_new ()
-{
- return (GByteArray *) g_array_new (FALSE, TRUE, 1);
-}
-
-guint8*
-g_byte_array_free (GByteArray *array,
- gboolean free_segment)
-{
- return (guint8*) g_array_free ((GArray *)array, free_segment);
-}
-
-GByteArray *
-g_byte_array_append (GByteArray *array,
- const guint8 *data,
- guint len)
-{
- return (GByteArray *)g_array_append_vals ((GArray *)array, data, len);
-}
-
-void
-g_byte_array_set_size (GByteArray *array, gint length)
-{
- g_array_set_size ((GArray *)array, length);
-}
-
+++ /dev/null
-/*
- * gdate-unix.c: Date and time utility functions.
- *
- * Author:
- * Gonzalo Paniagua Javier (gonzalo@novell.com
- *
- * (C) 2006 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.
- */
-#include <stdio.h>
-#include <glib.h>
-#include <time.h>
-#include <errno.h>
-#include <sys/time.h>
-
-void
-g_get_current_time (GTimeVal *result)
-{
- struct timeval tv;
-
- g_return_if_fail (result != NULL);
- gettimeofday (&tv, NULL);
- result->tv_sec = tv.tv_sec;
- result->tv_usec = tv.tv_usec;
-}
-
-void
-g_usleep (gulong microseconds)
-{
- struct timespec req, rem;
-
- req.tv_sec = microseconds / 1000000;
- req.tv_nsec = (microseconds % 1000000) * 1000;
-
- while (nanosleep (&req, &rem) == -1 && errno == EINTR)
- req = rem;
-}
+++ /dev/null
-/*
- * gdate-win32.c: Date and time utility functions.
- *
- * Author:
- * Gonzalo Paniagua Javier (gonzalo@novell.com
- *
- * (C) 2006 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.
- */
-#include <stdio.h>
-#include <glib.h>
-
-#include <winsock2.h>
-
-void
-g_get_current_time (GTimeVal *result)
-{
- long int l;
-
- g_return_if_fail (result != NULL);
- l = GetTickCount();
-
- result->tv_sec = l / 1000;
- result->tv_usec = (l % 1000) * 1000;
-}
-
-void
-g_usleep (gulong microseconds)
-{
- Sleep (microseconds/1000);
-}
+++ /dev/null
-/*
- * Directory utility functions.
- *
- * Author:
- * Gonzalo Paniagua Javier (gonzalo@novell.com)
- *
- * (C) 2006 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.
- */
-#include <glib.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <dirent.h>
-
-struct _GDir {
- DIR *dir;
-#ifndef HAVE_REWINDDIR
- char *path;
-#endif
-};
-
-GDir *
-g_dir_open (const gchar *path, guint flags, GError **error)
-{
- GDir *dir;
-
- g_return_val_if_fail (path != NULL, NULL);
- g_return_val_if_fail (error == NULL || *error == NULL, NULL);
-
- (void) flags; /* this is not used */
- dir = g_new (GDir, 1);
- dir->dir = opendir (path);
- if (dir->dir == NULL) {
- if (error) {
- gint err = errno;
- *error = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), strerror (err));
- }
- g_free (dir);
- return NULL;
- }
-#ifndef HAVE_REWINDDIR
- dir->path = g_strdup (path);
-#endif
- return dir;
-}
-
-const gchar *
-g_dir_read_name (GDir *dir)
-{
- struct dirent *entry;
-
- g_return_val_if_fail (dir != NULL && dir->dir != NULL, NULL);
- do {
- entry = readdir (dir->dir);
- if (entry == NULL)
- return NULL;
- } while ((strcmp (entry->d_name, ".") == 0) || (strcmp (entry->d_name, "..") == 0));
-
- return entry->d_name;
-}
-
-void
-g_dir_rewind (GDir *dir)
-{
- g_return_if_fail (dir != NULL && dir->dir != NULL);
-#ifndef HAVE_REWINDDIR
- closedir (dir->dir);
- dir->dir = opendir (dir->path);
-#else
- rewinddir (dir->dir);
-#endif
-}
-
-void
-g_dir_close (GDir *dir)
-{
- g_return_if_fail (dir != NULL && dir->dir != 0);
- closedir (dir->dir);
-#ifndef HAVE_REWINDDIR
- g_free (dir->path);
-#endif
- dir->dir = NULL;
- g_free (dir);
-}
-
-int
-g_mkdir_with_parents (const gchar *pathname, int mode)
-{
- char *path, *d;
- int rv;
-
- if (!pathname || *pathname == '\0') {
- errno = EINVAL;
- return -1;
- }
-
- d = path = g_strdup (pathname);
- if (*d == '/')
- d++;
-
- while (TRUE) {
- if (*d == '/' || *d == '\0') {
- char orig = *d;
- *d = '\0';
- rv = mkdir (path, mode);
- if (rv == -1 && errno != EEXIST) {
- g_free (path);
- return -1;
- }
-
- *d++ = orig;
- while (orig == '/' && *d == '/')
- d++;
- if (orig == '\0')
- break;
- } else {
- d++;
- }
- }
-
- g_free (path);
-
- return 0;
-}
+++ /dev/null
-/*
- * Directory utility functions.
- *
- * Author:
- * Gonzalo Paniagua Javier (gonzalo@novell.com)
- *
- * (C) 2006 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.
- */
-#include <glib.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <io.h>
-
-#include <winsock2.h>
-
-struct _GDir {
- HANDLE handle;
- gchar* current;
- gchar* next;
-};
-
-GDir *
-g_dir_open (const gchar *path, guint flags, GError **error)
-{
- GDir *dir;
- gunichar2* path_utf16;
- gunichar2* path_utf16_search;
- WIN32_FIND_DATAW find_data;
-
- g_return_val_if_fail (path != NULL, NULL);
- g_return_val_if_fail (error == NULL || *error == NULL, NULL);
-
- dir = g_new0 (GDir, 1);
- path_utf16 = u8to16 (path);
- path_utf16_search = g_malloc ((wcslen((wchar_t *) path_utf16) + 3)*sizeof(gunichar2));
- wcscpy (path_utf16_search, path_utf16);
- wcscat (path_utf16_search, L"\\*");
-
- dir->handle = FindFirstFileW (path_utf16_search, &find_data);
- if (dir->handle == INVALID_HANDLE_VALUE) {
- if (error) {
- gint err = errno;
- *error = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), strerror (err));
- }
- g_free (path_utf16_search);
- g_free (path_utf16);
- g_free (dir);
- return NULL;
- }
- g_free (path_utf16_search);
- g_free (path_utf16);
-
- while ((wcscmp ((wchar_t *) find_data.cFileName, L".") == 0) || (wcscmp ((wchar_t *) find_data.cFileName, L"..") == 0)) {
- if (!FindNextFileW (dir->handle, &find_data)) {
- if (error) {
- gint err = errno;
- *error = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), strerror (err));
- }
- g_free (dir);
- return NULL;
- }
- }
-
- dir->current = NULL;
- dir->next = u16to8 (find_data.cFileName);
- return dir;
-}
-
-const gchar *
-g_dir_read_name (GDir *dir)
-{
- WIN32_FIND_DATAW find_data;
-
- g_return_val_if_fail (dir != NULL && dir->handle != 0, NULL);
-
- if (dir->current)
- g_free (dir->current);
- dir->current = NULL;
-
- dir->current = dir->next;
-
- if (!dir->current)
- return NULL;
-
- dir->next = NULL;
-
- do {
- if (!FindNextFileW (dir->handle, &find_data)) {
- dir->next = NULL;
- return dir->current;
- }
- } while ((wcscmp ((wchar_t *) find_data.cFileName, L".") == 0) || (wcscmp ((wchar_t *) find_data.cFileName, L"..") == 0));
-
- dir->next = u16to8 (find_data.cFileName);
- return dir->current;
-}
-
-void
-g_dir_rewind (GDir *dir)
-{
-}
-
-void
-g_dir_close (GDir *dir)
-{
- g_return_if_fail (dir != NULL && dir->handle != 0);
-
- if (dir->current)
- g_free (dir->current);
- dir->current = NULL;
- if (dir->next)
- g_free (dir->next);
- dir->next = NULL;
- FindClose (dir->handle);
- dir->handle = 0;
- g_free (dir);
-}
-
-
+++ /dev/null
-/*
- * gerror.c: Error support.
- *
- * Author:
- * Miguel de Icaza (miguel@novell.com)
- *
- * (C) 2006 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.
- */
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-#include <config.h>
-#include <glib.h>
-GError *
-g_error_new (gpointer domain, gint code, const char *format, ...)
-{
- va_list args;
- GError *err = g_new (GError, 1);
-
- err->domain = domain;
- err->code = code;
-
- va_start (args, format);
- if (g_vasprintf (&err->message, format, args) == -1)
- err->message = g_strdup_printf ("internal: invalid format string %s", format);
- va_end (args);
-
- return err;
-}
-
-static GError *
-g_error_vnew (gpointer domain, gint code, const char *format, va_list ap)
-{
- GError *err = g_new (GError, 1);
-
- err->domain = domain;
- err->code = code;
-
- if (g_vasprintf (&err->message, format, ap) == -1)
- err->message = g_strdup_printf ("internal: invalid format string %s", format);
-
- return err;
-}
-
-void
-g_clear_error (GError **error)
-{
- if (error && *error) {
- g_error_free (*error);
- *error = NULL;
- }
-}
-
-void
-g_error_free (GError *error)
-{
- g_return_if_fail (error != NULL);
-
- g_free (error->message);
- g_free (error);
-}
-
-void
-g_set_error (GError **err, gpointer domain, gint code, const gchar *format, ...)
-{
- va_list args;
-
- if (err) {
- va_start (args, format);
- *err = g_error_vnew (domain, code, format, args);
- va_end (args);
- }
-}
-
-void
-g_propagate_error (GError **dest, GError *src)
-{
- if (dest == NULL){
- if (src)
- g_error_free (src);
- } else {
- *dest = src;
- }
-}
+++ /dev/null
-/*
- * File utility functions.
- *
- * Author:
- * Gonzalo Paniagua Javier (gonzalo@novell.com)
- *
- * (C) 2006 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.
- */
-#include <config.h>
-#include <glib.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <fcntl.h>
-#include <errno.h>
-
-#ifdef _MSC_VER
-#include <direct.h>
-#endif
-#ifdef G_OS_WIN32
-int mkstemp (char *tmp_template);
-#endif
-
-#ifndef O_LARGEFILE
-#define OPEN_FLAGS (O_RDONLY)
-#else
-#define OPEN_FLAGS (O_RDONLY | O_LARGEFILE)
-#endif
-gboolean
-g_file_get_contents (const gchar *filename, gchar **contents, gsize *length, GError **error)
-{
- gchar *str;
- int fd;
- struct stat st;
- long offset;
- int nread;
-
- g_return_val_if_fail (filename != NULL, FALSE);
- g_return_val_if_fail (contents != NULL, FALSE);
- g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
-
- *contents = NULL;
- if (length)
- *length = 0;
-
- fd = open (filename, OPEN_FLAGS);
- if (fd == -1) {
- if (error != NULL) {
- int err = errno;
- *error = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), "Error opening file");
- }
- return FALSE;
- }
-
- if (fstat (fd, &st) != 0) {
- if (error != NULL) {
- int err = errno;
- *error = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), "Error in fstat()");
- }
- close (fd);
- return FALSE;
- }
-
- str = g_malloc (st.st_size + 1);
- offset = 0;
- do {
- nread = read (fd, str + offset, st.st_size - offset);
- if (nread > 0) {
- offset += nread;
- }
- } while ((nread > 0 && offset < st.st_size) || (nread == -1 && errno == EINTR));
-
- close (fd);
- str [st.st_size] = '\0';
- if (length) {
- *length = st.st_size;
- }
- *contents = str;
- return TRUE;
-}
-
-gint
-g_file_open_tmp (const gchar *tmpl, gchar **name_used, GError **error)
-{
- const static gchar *default_tmpl = ".XXXXXX";
- gchar *t;
- gint fd;
- size_t len;
-
- g_return_val_if_fail (error == NULL || *error == NULL, -1);
-
- if (tmpl == NULL)
- tmpl = default_tmpl;
-
- if (strchr (tmpl, G_DIR_SEPARATOR) != NULL) {
- if (error) {
- *error = g_error_new (G_LOG_DOMAIN, 24, "Template should not have any " G_DIR_SEPARATOR_S);
- }
- return -1;
- }
-
- len = strlen (tmpl);
- if (len < 6 || strcmp (tmpl + len - 6, "XXXXXX")) {
- if (error) {
- *error = g_error_new (G_LOG_DOMAIN, 24, "Template should end with XXXXXX");
- }
- return -1;
- }
-
- t = g_build_filename (g_get_tmp_dir (), tmpl, NULL);
-
- fd = mkstemp (t);
-
- if (fd == -1) {
- if (error) {
- int err = errno;
- *error = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), "Error in mkstemp()");
- }
- g_free (t);
- return -1;
- }
-
- if (name_used) {
- *name_used = t;
- } else {
- g_free (t);
- }
- return fd;
-}
-
-gchar *
-g_get_current_dir (void)
-{
- int s = 32;
- char *buffer = NULL, *r;
- gboolean fail;
-
- do {
- buffer = g_realloc (buffer, s);
- r = getcwd (buffer, s);
- fail = (r == NULL && errno == ERANGE);
- if (fail) {
- s <<= 1;
- }
- } while (fail);
-
- /* On amd64 sometimes the bottom 32-bits of r == the bottom 32-bits of buffer
- * but the top 32-bits of r have overflown to 0xffffffff (seriously wtf getcwd
- * so we return the buffer here since it has a pointer to the valid string
- */
- return buffer;
-}
+++ /dev/null
-/*
- * File utility functions.
- *
- * Author:
- * Gonzalo Paniagua Javier (gonzalo@novell.com)
- *
- * (C) 2006 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.
- */
-#include <config.h>
-#include <glib.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <fcntl.h>
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-gboolean
-g_file_test (const gchar *filename, GFileTest test)
-{
- struct stat st;
- gboolean have_stat;
-
- if (filename == NULL || test == 0)
- return FALSE;
-
- have_stat = FALSE;
-
- if ((test & G_FILE_TEST_EXISTS) != 0) {
- if (access (filename, F_OK) == 0)
- return TRUE;
- }
-
- if ((test & G_FILE_TEST_IS_EXECUTABLE) != 0) {
- if (access (filename, X_OK) == 0)
- return TRUE;
- }
- if ((test & G_FILE_TEST_IS_SYMLINK) != 0) {
- have_stat = (lstat (filename, &st) == 0);
- if (have_stat && S_ISLNK (st.st_mode))
- return TRUE;
- }
-
- if ((test & G_FILE_TEST_IS_REGULAR) != 0) {
- if (!have_stat)
- have_stat = (stat (filename, &st) == 0);
- if (have_stat && S_ISREG (st.st_mode))
- return TRUE;
- }
- if ((test & G_FILE_TEST_IS_DIR) != 0) {
- if (!have_stat)
- have_stat = (stat (filename, &st) == 0);
- if (have_stat && S_ISDIR (st.st_mode))
- return TRUE;
- }
- return FALSE;
-}
-
-gchar *
-g_mkdtemp (char *tmp_template)
-{
-#ifdef HAVE_MKDTEMP
- char *template_copy = g_strdup (tmp_template);
-
- return mkdtemp (template_copy);
-#else
- g_error("Function not supported");
-#endif
-}
+++ /dev/null
-/*
- * File utility functions.
- *
- * Author:
- * Gonzalo Paniagua Javier (gonzalo@novell.com)
- *
- * (C) 2006 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.
- */
-#include <config.h>
-#include <windows.h>
-#include <glib.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <direct.h>
-
-#ifdef G_OS_WIN32
-#include <io.h>
-#define open _open
-#ifndef S_ISREG
-#define S_ISREG(x) ((x & _S_IFMT) == _S_IFREG)
-#endif
-#ifndef S_ISDIR
-#define S_ISDIR(x) ((x & _S_IFMT) == _S_IFDIR)
-#endif
-#endif
-
-int mkstemp (char *tmp_template)
-{
- int fd;
- gunichar2* utf16_template;
-
- utf16_template = u8to16 (tmp_template);
-
- fd = -1;
- utf16_template = _wmktemp( utf16_template);
- if (utf16_template && *utf16_template) {
- /* FIXME: _O_TEMPORARY causes file to disappear on close causing a test to fail */
- fd = _wopen( utf16_template, _O_BINARY | _O_CREAT /*| _O_TEMPORARY*/ | _O_RDWR | _O_EXCL, _S_IREAD | _S_IWRITE);
- }
-
- /* FIXME: this will crash if utf16_template == NULL */
- sprintf (tmp_template + strlen (tmp_template) - 6, "%S", utf16_template + wcslen (utf16_template) - 6);
-
- g_free (utf16_template);
- return fd;
-}
-
-gchar *
-g_mkdtemp (char *tmp_template)
-{
- gunichar2* utf16_template;
-
- utf16_template = u8to16 (tmp_template);
-
- utf16_template = _wmktemp(utf16_template);
- if (utf16_template && *utf16_template) {
- if (_wmkdir (utf16_template) == 0){
- char *ret = u16to8 (utf16_template);
- g_free (utf16_template);
- return ret;
- }
- }
-
- g_free (utf16_template);
- return NULL;
-}
-
-#ifdef _MSC_VER
-#pragma warning(disable:4701)
-#endif
-
-gboolean
-g_file_test (const gchar *filename, GFileTest test)
-{
- gunichar2* utf16_filename = NULL;
- DWORD attr;
-
- if (filename == NULL || test == 0)
- return FALSE;
-
- utf16_filename = u8to16 (filename);
- attr = GetFileAttributesW (utf16_filename);
- g_free (utf16_filename);
-
- if (attr == INVALID_FILE_ATTRIBUTES)
- return FALSE;
-
- if ((test & G_FILE_TEST_EXISTS) != 0) {
- return TRUE;
- }
-
- if ((test & G_FILE_TEST_IS_EXECUTABLE) != 0) {
- size_t len = strlen (filename);
- if (len > 4 && strcmp (filename + len-3, "exe"))
- return TRUE;
-
- return FALSE;
- }
-
- if ((test & G_FILE_TEST_IS_REGULAR) != 0) {
- if (attr & (FILE_ATTRIBUTE_DEVICE|FILE_ATTRIBUTE_DIRECTORY))
- return FALSE;
- return TRUE;
- }
-
- if ((test & G_FILE_TEST_IS_DIR) != 0) {
- if (attr & FILE_ATTRIBUTE_DIRECTORY)
- return TRUE;
- }
-
- /* make this last in case it is OR'd with something else */
- if ((test & G_FILE_TEST_IS_SYMLINK) != 0) {
- return FALSE;
- }
-
- return FALSE;
-}
+++ /dev/null
-/*
- * File utility functions.
- *
- * Author:
- * Gonzalo Paniagua Javier (gonzalo@novell.com)
- *
- * (C) 2006 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.
- */
-
-#include <config.h>
-
-#include <glib.h>
-#include <stdio.h>
-#include <string.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <errno.h>
-
-static gpointer error_quark = "FileError";
-
-gpointer
-g_file_error_quark (void)
-{
- return error_quark;
-}
-
-GFileError
-g_file_error_from_errno (gint err_no)
-{
- switch (err_no) {
- case EEXIST:
- return G_FILE_ERROR_EXIST;
- case EISDIR:
- return G_FILE_ERROR_ISDIR;
- case EACCES:
- return G_FILE_ERROR_ACCES;
- case ENAMETOOLONG:
- return G_FILE_ERROR_NAMETOOLONG;
- case ENOENT:
- return G_FILE_ERROR_NOENT;
- case ENOTDIR:
- return G_FILE_ERROR_NOTDIR;
- case ENXIO:
- return G_FILE_ERROR_NXIO;
- case ENODEV:
- return G_FILE_ERROR_NODEV;
- case EROFS:
- return G_FILE_ERROR_ROFS;
-#ifdef ETXTBSY
- case ETXTBSY:
- return G_FILE_ERROR_TXTBSY;
-#endif
- case EFAULT:
- return G_FILE_ERROR_FAULT;
-#ifdef ELOOP
- case ELOOP:
- return G_FILE_ERROR_LOOP;
-#endif
- case ENOSPC:
- return G_FILE_ERROR_NOSPC;
- case ENOMEM:
- return G_FILE_ERROR_NOMEM;
- case EMFILE:
- return G_FILE_ERROR_MFILE;
- case ENFILE:
- return G_FILE_ERROR_NFILE;
- case EBADF:
- return G_FILE_ERROR_BADF;
- case EINVAL:
- return G_FILE_ERROR_INVAL;
- case EPIPE:
- return G_FILE_ERROR_PIPE;
- case EAGAIN:
- return G_FILE_ERROR_AGAIN;
- case EINTR:
- return G_FILE_ERROR_INTR;
- case EIO:
- return G_FILE_ERROR_IO;
- case EPERM:
- return G_FILE_ERROR_PERM;
- case ENOSYS:
- return G_FILE_ERROR_NOSYS;
- default:
- return G_FILE_ERROR_FAILED;
- }
-}
-
-#ifdef G_OS_WIN32
-#define TMP_FILE_FORMAT "%.*s%s.tmp"
-#else
-#define TMP_FILE_FORMAT "%.*s.%s~"
-#endif
-
-gboolean
-g_file_set_contents (const gchar *filename, const gchar *contents, gssize length, GError **err)
-{
- const char *name;
- char *path;
- FILE *fp;
-
- if (!(name = strrchr (filename, G_DIR_SEPARATOR)))
- name = filename;
- else
- name++;
-
- path = g_strdup_printf (TMP_FILE_FORMAT, name - filename, filename, name);
- if (!(fp = fopen (path, "wb"))) {
- g_set_error (err, G_FILE_ERROR, g_file_error_from_errno (errno), "%s", g_strerror (errno));
- g_free (path);
- return FALSE;
- }
-
- if (length < 0)
- length = strlen (contents);
-
- if (fwrite (contents, 1, length, fp) < length) {
- g_set_error (err, G_FILE_ERROR, g_file_error_from_errno (ferror (fp)), "%s", g_strerror (ferror (fp)));
- g_unlink (path);
- g_free (path);
- fclose (fp);
-
- return FALSE;
- }
-
- fclose (fp);
-
- if (g_rename (path, filename) != 0) {
- g_set_error (err, G_FILE_ERROR, g_file_error_from_errno (errno), "%s", g_strerror (errno));
- g_unlink (path);
- g_free (path);
- return FALSE;
- }
-
- g_free (path);
-
- return TRUE;
-}
+++ /dev/null
-/*
- * ghashtable.c: Hashtable implementation
- *
- * Author:
- * Miguel de Icaza (miguel@novell.com)
- *
- * (C) 2006 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.
- */
-#include <stdio.h>
-#include <math.h>
-#include <glib.h>
-
-typedef struct _Slot Slot;
-
-struct _Slot {
- gpointer key;
- gpointer value;
- Slot *next;
-};
-
-static gpointer KEYMARKER_REMOVED = &KEYMARKER_REMOVED;
-
-struct _GHashTable {
- GHashFunc hash_func;
- GEqualFunc key_equal_func;
-
- Slot **table;
- int table_size;
- int in_use;
- int threshold;
- int last_rehash;
- GDestroyNotify value_destroy_func, key_destroy_func;
-};
-
-typedef struct {
- GHashTable *ht;
- int slot_index;
- Slot *slot;
-} Iter;
-
-static const guint prime_tbl[] = {
- 11, 19, 37, 73, 109, 163, 251, 367, 557, 823, 1237,
- 1861, 2777, 4177, 6247, 9371, 14057, 21089, 31627,
- 47431, 71143, 106721, 160073, 240101, 360163,
- 540217, 810343, 1215497, 1823231, 2734867, 4102283,
- 6153409, 9230113, 13845163
-};
-
-static gboolean
-test_prime (int x)
-{
- if ((x & 1) != 0) {
- int n;
- for (n = 3; n< (int)sqrt (x); n += 2) {
- if ((x % n) == 0)
- return FALSE;
- }
- return TRUE;
- }
- // There is only one even prime - 2.
- return (x == 2);
-}
-
-static int
-calc_prime (int x)
-{
- int i;
-
- for (i = (x & (~1))-1; i< G_MAXINT32; i += 2) {
- if (test_prime (i))
- return i;
- }
- return x;
-}
-
-guint
-g_spaced_primes_closest (guint x)
-{
- int i;
-
- for (i = 0; i < G_N_ELEMENTS (prime_tbl); i++) {
- if (x <= prime_tbl [i])
- return prime_tbl [i];
- }
- return calc_prime (x);
-}
-
-GHashTable *
-g_hash_table_new (GHashFunc hash_func, GEqualFunc key_equal_func)
-{
- GHashTable *hash;
-
- if (hash_func == NULL)
- hash_func = g_direct_hash;
- if (key_equal_func == NULL)
- key_equal_func = g_direct_equal;
- hash = g_new0 (GHashTable, 1);
-
- hash->hash_func = hash_func;
- hash->key_equal_func = key_equal_func;
-
- hash->table_size = g_spaced_primes_closest (1);
- hash->table = g_new0 (Slot *, hash->table_size);
- hash->last_rehash = hash->table_size;
-
- return hash;
-}
-
-GHashTable *
-g_hash_table_new_full (GHashFunc hash_func, GEqualFunc key_equal_func,
- GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func)
-{
- GHashTable *hash = g_hash_table_new (hash_func, key_equal_func);
- if (hash == NULL)
- return NULL;
-
- hash->key_destroy_func = key_destroy_func;
- hash->value_destroy_func = value_destroy_func;
-
- return hash;
-}
-
-#if 0
-static void
-dump_hash_table (GHashTable *hash)
-{
- int i;
-
- for (i = 0; i < hash->table_size; i++) {
- Slot *s;
-
- for (s = hash->table [i]; s != NULL; s = s->next){
- guint hashcode = (*hash->hash_func) (s->key);
- guint slot = (hashcode) % hash->table_size;
- printf ("key %p hash %x on slot %d correct slot %d tb size %d\n", s->key, hashcode, i, slot, hash->table_size);
- }
- }
-}
-#endif
-
-#ifdef SANITY_CHECK
-static void
-sanity_check (GHashTable *hash)
-{
- int i;
-
- for (i = 0; i < hash->table_size; i++) {
- Slot *s;
-
- for (s = hash->table [i]; s != NULL; s = s->next){
- guint hashcode = (*hash->hash_func) (s->key);
- guint slot = (hashcode) % hash->table_size;
- if (slot != i) {
- dump_hashcode_func = 1;
- hashcode = (*hash->hash_func) (s->key);
- dump_hashcode_func = 0;
- g_error ("Key %p (bucket %d) on invalid bucket %d (hashcode %x) (tb size %d)", s->key, slot, i, hashcode, hash->table_size);
- }
- }
- }
-}
-#else
-
-#define sanity_check(HASH) do {}while(0)
-
-#endif
-
-static void
-do_rehash (GHashTable *hash)
-{
- int current_size, i;
- Slot **table;
-
- /* printf ("Resizing diff=%d slots=%d\n", hash->in_use - hash->last_rehash, hash->table_size); */
- hash->last_rehash = hash->table_size;
- current_size = hash->table_size;
- hash->table_size = g_spaced_primes_closest (hash->in_use);
- /* printf ("New size: %d\n", hash->table_size); */
- table = hash->table;
- hash->table = g_new0 (Slot *, hash->table_size);
-
- for (i = 0; i < current_size; i++){
- Slot *s, *next;
-
- for (s = table [i]; s != NULL; s = next){
- guint hashcode = ((*hash->hash_func) (s->key)) % hash->table_size;
- next = s->next;
-
- s->next = hash->table [hashcode];
- hash->table [hashcode] = s;
- }
- }
- g_free (table);
-}
-
-static void
-rehash (GHashTable *hash)
-{
- int diff = ABS (hash->last_rehash - hash->in_use);
-
- /* These are the factors to play with to change the rehashing strategy */
- /* I played with them with a large range, and could not really get */
- /* something that was too good, maybe the tests are not that great */
- if (!(diff * 0.75 > hash->table_size * 2))
- return;
- do_rehash (hash);
- sanity_check (hash);
-}
-
-void
-g_hash_table_insert_replace (GHashTable *hash, gpointer key, gpointer value, gboolean replace)
-{
- guint hashcode;
- Slot *s;
- GEqualFunc equal;
-
- g_return_if_fail (hash != NULL);
- sanity_check (hash);
-
- equal = hash->key_equal_func;
- if (hash->in_use >= hash->threshold)
- rehash (hash);
-
- hashcode = ((*hash->hash_func) (key)) % hash->table_size;
- for (s = hash->table [hashcode]; s != NULL; s = s->next){
- if ((*equal) (s->key, key)){
- if (replace){
- if (hash->key_destroy_func != NULL)
- (*hash->key_destroy_func)(s->key);
- s->key = key;
- }
- if (hash->value_destroy_func != NULL)
- (*hash->value_destroy_func) (s->value);
- s->value = value;
- sanity_check (hash);
- return;
- }
- }
- s = g_new (Slot, 1);
- s->key = key;
- s->value = value;
- s->next = hash->table [hashcode];
- hash->table [hashcode] = s;
- hash->in_use++;
- sanity_check (hash);
-}
-
-GList*
-g_hash_table_get_keys (GHashTable *hash)
-{
- GHashTableIter iter;
- GList *rv = NULL;
- gpointer key;
-
- g_hash_table_iter_init (&iter, hash);
-
- while (g_hash_table_iter_next (&iter, &key, NULL))
- rv = g_list_prepend (rv, key);
-
- return g_list_reverse (rv);
-}
-
-GList*
-g_hash_table_get_values (GHashTable *hash)
-{
- GHashTableIter iter;
- GList *rv = NULL;
- gpointer value;
-
- g_hash_table_iter_init (&iter, hash);
-
- while (g_hash_table_iter_next (&iter, NULL, &value))
- rv = g_list_prepend (rv, value);
-
- return g_list_reverse (rv);
-}
-
-
-guint
-g_hash_table_size (GHashTable *hash)
-{
- g_return_val_if_fail (hash != NULL, 0);
-
- return hash->in_use;
-}
-
-gpointer
-g_hash_table_lookup (GHashTable *hash, gconstpointer key)
-{
- gpointer orig_key, value;
-
- if (g_hash_table_lookup_extended (hash, key, &orig_key, &value))
- return value;
- else
- return NULL;
-}
-
-gboolean
-g_hash_table_lookup_extended (GHashTable *hash, gconstpointer key, gpointer *orig_key, gpointer *value)
-{
- GEqualFunc equal;
- Slot *s;
- guint hashcode;
-
- g_return_val_if_fail (hash != NULL, FALSE);
- sanity_check (hash);
- equal = hash->key_equal_func;
-
- hashcode = ((*hash->hash_func) (key)) % hash->table_size;
-
- for (s = hash->table [hashcode]; s != NULL; s = s->next){
- if ((*equal)(s->key, key)){
- if (orig_key)
- *orig_key = s->key;
- if (value)
- *value = s->value;
- return TRUE;
- }
- }
- return FALSE;
-}
-
-void
-g_hash_table_foreach (GHashTable *hash, GHFunc func, gpointer user_data)
-{
- int i;
-
- g_return_if_fail (hash != NULL);
- g_return_if_fail (func != NULL);
-
- for (i = 0; i < hash->table_size; i++){
- Slot *s;
-
- for (s = hash->table [i]; s != NULL; s = s->next)
- (*func)(s->key, s->value, user_data);
- }
-}
-
-gpointer
-g_hash_table_find (GHashTable *hash, GHRFunc predicate, gpointer user_data)
-{
- int i;
-
- g_return_val_if_fail (hash != NULL, NULL);
- g_return_val_if_fail (predicate != NULL, NULL);
-
- for (i = 0; i < hash->table_size; i++){
- Slot *s;
-
- for (s = hash->table [i]; s != NULL; s = s->next)
- if ((*predicate)(s->key, s->value, user_data))
- return s->value;
- }
- return NULL;
-}
-
-void
-g_hash_table_remove_all (GHashTable *hash)
-{
- int i;
-
- g_return_if_fail (hash != NULL);
-
- for (i = 0; i < hash->table_size; i++){
- Slot *s;
-
- while (hash->table [i]) {
- s = hash->table [i];
- g_hash_table_remove (hash, s->key);
- }
- }
-}
-
-gboolean
-g_hash_table_remove (GHashTable *hash, gconstpointer key)
-{
- GEqualFunc equal;
- Slot *s, *last;
- guint hashcode;
-
- g_return_val_if_fail (hash != NULL, FALSE);
- sanity_check (hash);
- equal = hash->key_equal_func;
-
- hashcode = ((*hash->hash_func)(key)) % hash->table_size;
- last = NULL;
- for (s = hash->table [hashcode]; s != NULL; s = s->next){
- if ((*equal)(s->key, key)){
- if (hash->key_destroy_func != NULL)
- (*hash->key_destroy_func)(s->key);
- if (hash->value_destroy_func != NULL)
- (*hash->value_destroy_func)(s->value);
- if (last == NULL)
- hash->table [hashcode] = s->next;
- else
- last->next = s->next;
- g_free (s);
- hash->in_use--;
- sanity_check (hash);
- return TRUE;
- }
- last = s;
- }
- sanity_check (hash);
- return FALSE;
-}
-
-guint
-g_hash_table_foreach_remove (GHashTable *hash, GHRFunc func, gpointer user_data)
-{
- int i;
- int count = 0;
-
- g_return_val_if_fail (hash != NULL, 0);
- g_return_val_if_fail (func != NULL, 0);
-
- sanity_check (hash);
- for (i = 0; i < hash->table_size; i++){
- Slot *s, *last;
-
- last = NULL;
- for (s = hash->table [i]; s != NULL; ){
- if ((*func)(s->key, s->value, user_data)){
- Slot *n;
-
- if (hash->key_destroy_func != NULL)
- (*hash->key_destroy_func)(s->key);
- if (hash->value_destroy_func != NULL)
- (*hash->value_destroy_func)(s->value);
- if (last == NULL){
- hash->table [i] = s->next;
- n = s->next;
- } else {
- last->next = s->next;
- n = last->next;
- }
- g_free (s);
- hash->in_use--;
- count++;
- s = n;
- } else {
- last = s;
- s = s->next;
- }
- }
- }
- sanity_check (hash);
- if (count > 0)
- rehash (hash);
- return count;
-}
-
-gboolean
-g_hash_table_steal (GHashTable *hash, gconstpointer key)
-{
- GEqualFunc equal;
- Slot *s, *last;
- guint hashcode;
-
- g_return_val_if_fail (hash != NULL, FALSE);
- sanity_check (hash);
- equal = hash->key_equal_func;
-
- hashcode = ((*hash->hash_func)(key)) % hash->table_size;
- last = NULL;
- for (s = hash->table [hashcode]; s != NULL; s = s->next){
- if ((*equal)(s->key, key)) {
- if (last == NULL)
- hash->table [hashcode] = s->next;
- else
- last->next = s->next;
- g_free (s);
- hash->in_use--;
- sanity_check (hash);
- return TRUE;
- }
- last = s;
- }
- sanity_check (hash);
- return FALSE;
-
-}
-
-guint
-g_hash_table_foreach_steal (GHashTable *hash, GHRFunc func, gpointer user_data)
-{
- int i;
- int count = 0;
-
- g_return_val_if_fail (hash != NULL, 0);
- g_return_val_if_fail (func != NULL, 0);
-
- sanity_check (hash);
- for (i = 0; i < hash->table_size; i++){
- Slot *s, *last;
-
- last = NULL;
- for (s = hash->table [i]; s != NULL; ){
- if ((*func)(s->key, s->value, user_data)){
- Slot *n;
-
- if (last == NULL){
- hash->table [i] = s->next;
- n = s->next;
- } else {
- last->next = s->next;
- n = last->next;
- }
- g_free (s);
- hash->in_use--;
- count++;
- s = n;
- } else {
- last = s;
- s = s->next;
- }
- }
- }
- sanity_check (hash);
- if (count > 0)
- rehash (hash);
- return count;
-}
-
-void
-g_hash_table_destroy (GHashTable *hash)
-{
- int i;
-
- g_return_if_fail (hash != NULL);
-
- for (i = 0; i < hash->table_size; i++){
- Slot *s, *next;
-
- for (s = hash->table [i]; s != NULL; s = next){
- next = s->next;
-
- if (hash->key_destroy_func != NULL)
- (*hash->key_destroy_func)(s->key);
- if (hash->value_destroy_func != NULL)
- (*hash->value_destroy_func)(s->value);
- g_free (s);
- }
- }
- g_free (hash->table);
-
- g_free (hash);
-}
-
-void
-g_hash_table_print_stats (GHashTable *table)
-{
- int i, max_chain_index, chain_size, max_chain_size;
- Slot *node;
-
- max_chain_size = 0;
- max_chain_index = -1;
- for (i = 0; i < table->table_size; i++) {
- chain_size = 0;
- for (node = table->table [i]; node; node = node->next)
- chain_size ++;
- if (chain_size > max_chain_size) {
- max_chain_size = chain_size;
- max_chain_index = i;
- }
- }
-
- printf ("Size: %d Table Size: %d Max Chain Length: %d at %d\n", table->in_use, table->table_size, max_chain_size, max_chain_index);
-}
-
-void
-g_hash_table_iter_init (GHashTableIter *it, GHashTable *hash_table)
-{
- Iter *iter = (Iter*)it;
-
- memset (iter, 0, sizeof (Iter));
- iter->ht = hash_table;
- iter->slot_index = -1;
-}
-
-gboolean g_hash_table_iter_next (GHashTableIter *it, gpointer *key, gpointer *value)
-{
- Iter *iter = (Iter*)it;
-
- GHashTable *hash = iter->ht;
-
- g_assert (iter->slot_index != -2);
- g_assert (sizeof (Iter) <= sizeof (GHashTableIter));
-
- if (!iter->slot) {
- while (TRUE) {
- iter->slot_index ++;
- if (iter->slot_index >= hash->table_size) {
- iter->slot_index = -2;
- return FALSE;
- }
- if (hash->table [iter->slot_index])
- break;
- }
- iter->slot = hash->table [iter->slot_index];
- }
-
- if (key)
- *key = iter->slot->key;
- if (value)
- *value = iter->slot->value;
- iter->slot = iter->slot->next;
-
- return TRUE;
-}
-
-gboolean
-g_direct_equal (gconstpointer v1, gconstpointer v2)
-{
- return v1 == v2;
-}
-
-guint
-g_direct_hash (gconstpointer v1)
-{
- return GPOINTER_TO_UINT (v1);
-}
-
-gboolean
-g_int_equal (gconstpointer v1, gconstpointer v2)
-{
- return *(gint *)v1 == *(gint *)v2;
-}
-
-guint
-g_int_hash (gconstpointer v1)
-{
- return *(guint *)v1;
-}
-
-gboolean
-g_str_equal (gconstpointer v1, gconstpointer v2)
-{
- return strcmp (v1, v2) == 0;
-}
-
-guint
-g_str_hash (gconstpointer v1)
-{
- guint hash = 0;
- char *p = (char *) v1;
-
- while (*p++)
- hash = (hash << 5) - (hash + *p);
-
- return hash;
-}
+++ /dev/null
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2011 Jeffrey Stedfast
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <glib.h>
-#include <string.h>
-#ifdef HAVE_ICONV_H
-#include <iconv.h>
-#endif
-#include <errno.h>
-
-#ifdef _MSC_VER
-#define FORCE_INLINE(RET_TYPE) __forceinline RET_TYPE
-#else
-#define FORCE_INLINE(RET_TYPE) inline RET_TYPE __attribute__((always_inline))
-#endif
-
-
-#define UNROLL_DECODE_UTF8 0
-#define UNROLL_ENCODE_UTF8 0
-
-typedef int (* Decoder) (char *inbuf, size_t inleft, gunichar *outchar);
-typedef int (* Encoder) (gunichar c, char *outbuf, size_t outleft);
-
-struct _GIConv {
- Decoder decode;
- Encoder encode;
- gunichar c;
-#ifdef HAVE_ICONV
- iconv_t cd;
-#endif
-};
-
-static int decode_utf32be (char *inbuf, size_t inleft, gunichar *outchar);
-static int encode_utf32be (gunichar c, char *outbuf, size_t outleft);
-
-static int decode_utf32le (char *inbuf, size_t inleft, gunichar *outchar);
-static int encode_utf32le (gunichar c, char *outbuf, size_t outleft);
-
-static int decode_utf16be (char *inbuf, size_t inleft, gunichar *outchar);
-static int encode_utf16be (gunichar c, char *outbuf, size_t outleft);
-
-static int decode_utf16le (char *inbuf, size_t inleft, gunichar *outchar);
-static int encode_utf16le (gunichar c, char *outbuf, size_t outleft);
-
-static FORCE_INLINE (int) decode_utf8 (char *inbuf, size_t inleft, gunichar *outchar);
-static int encode_utf8 (gunichar c, char *outbuf, size_t outleft);
-
-static int decode_latin1 (char *inbuf, size_t inleft, gunichar *outchar);
-static int encode_latin1 (gunichar c, char *outbuf, size_t outleft);
-
-#if G_BYTE_ORDER == G_LITTLE_ENDIAN
-#define decode_utf32 decode_utf32le
-#define encode_utf32 encode_utf32le
-#define decode_utf16 decode_utf16le
-#define encode_utf16 encode_utf16le
-#else
-#define decode_utf32 decode_utf32be
-#define encode_utf32 encode_utf32be
-#define decode_utf16 decode_utf16be
-#define encode_utf16 encode_utf16be
-#endif
-
-static struct {
- const char *name;
- Decoder decoder;
- Encoder encoder;
-} charsets[] = {
- { "ISO-8859-1", decode_latin1, encode_latin1 },
- { "ISO8859-1", decode_latin1, encode_latin1 },
- { "UTF-32BE", decode_utf32be, encode_utf32be },
- { "UTF-32LE", decode_utf32le, encode_utf32le },
- { "UTF-16BE", decode_utf16be, encode_utf16be },
- { "UTF-16LE", decode_utf16le, encode_utf16le },
- { "UTF-32", decode_utf32, encode_utf32 },
- { "UTF-16", decode_utf16, encode_utf16 },
- { "UTF-8", decode_utf8, encode_utf8 },
- { "US-ASCII", decode_latin1, encode_latin1 },
- { "Latin1", decode_latin1, encode_latin1 },
- { "ASCII", decode_latin1, encode_latin1 },
- { "UTF32", decode_utf32, encode_utf32 },
- { "UTF16", decode_utf16, encode_utf16 },
- { "UTF8", decode_utf8, encode_utf8 },
-};
-
-
-GIConv
-g_iconv_open (const char *to_charset, const char *from_charset)
-{
-#ifdef HAVE_ICONV
- iconv_t icd = (iconv_t) -1;
-#endif
- Decoder decoder = NULL;
- Encoder encoder = NULL;
- GIConv cd;
- guint i;
-
- if (!to_charset || !from_charset || !to_charset[0] || !from_charset[0]) {
- errno = EINVAL;
-
- return (GIConv) -1;
- }
-
- for (i = 0; i < G_N_ELEMENTS (charsets); i++) {
- if (!g_ascii_strcasecmp (charsets[i].name, from_charset))
- decoder = charsets[i].decoder;
-
- if (!g_ascii_strcasecmp (charsets[i].name, to_charset))
- encoder = charsets[i].encoder;
- }
-
- if (!encoder || !decoder) {
-#ifdef HAVE_ICONV
- if ((icd = iconv_open (to_charset, from_charset)) == (iconv_t) -1)
- return (GIConv) -1;
-#else
- errno = EINVAL;
-
- return (GIConv) -1;
-#endif
- }
-
- cd = (GIConv) g_malloc (sizeof (struct _GIConv));
- cd->decode = decoder;
- cd->encode = encoder;
- cd->c = -1;
-
-#ifdef HAVE_ICONV
- cd->cd = icd;
-#endif
-
- return cd;
-}
-
-int
-g_iconv_close (GIConv cd)
-{
-#ifdef HAVE_ICONV
- if (cd->cd != (iconv_t) -1)
- iconv_close (cd->cd);
-#endif
-
- g_free (cd);
-
- return 0;
-}
-
-gsize
-g_iconv (GIConv cd, gchar **inbytes, gsize *inbytesleft,
- gchar **outbytes, gsize *outbytesleft)
-{
- gsize inleft, outleft;
- char *inptr, *outptr;
- gunichar c;
- int rc = 0;
-
-#ifdef HAVE_ICONV
- if (cd->cd != (iconv_t) -1) {
- /* Note: gsize may have a different size than size_t, so we need to
- remap inbytesleft and outbytesleft to size_t's. */
- size_t *outleftptr, *inleftptr;
- size_t n_outleft, n_inleft;
-
- if (inbytesleft) {
- n_inleft = *inbytesleft;
- inleftptr = &n_inleft;
- } else {
- inleftptr = NULL;
- }
-
- if (outbytesleft) {
- n_outleft = *outbytesleft;
- outleftptr = &n_outleft;
- } else {
- outleftptr = NULL;
- }
-#if defined(__NetBSD__)
- return iconv (cd->cd, (const gchar **)inbytes, inleftptr, outbytes, outleftptr);
-#else
- return iconv (cd->cd, inbytes, inleftptr, outbytes, outleftptr);
-#endif
- }
-#endif
-
- if (outbytes == NULL || outbytesleft == NULL) {
- /* reset converter */
- cd->c = -1;
- return 0;
- }
-
- inleft = inbytesleft ? *inbytesleft : 0;
- inptr = inbytes ? *inbytes : NULL;
- outleft = *outbytesleft;
- outptr = *outbytes;
-
- if ((c = cd->c) != (gunichar) -1)
- goto encode;
-
- while (inleft > 0) {
- if ((rc = cd->decode (inptr, inleft, &c)) < 0)
- break;
-
- inleft -= rc;
- inptr += rc;
-
- encode:
- if ((rc = cd->encode (c, outptr, outleft)) < 0)
- break;
-
- c = (gunichar) -1;
- outleft -= rc;
- outptr += rc;
- }
-
- if (inbytesleft)
- *inbytesleft = inleft;
-
- if (inbytes)
- *inbytes = inptr;
-
- *outbytesleft = outleft;
- *outbytes = outptr;
- cd->c = c;
-
- return rc < 0 ? -1 : 0;
-}
-
-/*
- * Unicode encoders and decoders
- */
-
-static int
-decode_utf32be (char *inbuf, size_t inleft, gunichar *outchar)
-{
- unsigned char *inptr = (unsigned char *) inbuf;
- gunichar c;
-
- if (inleft < 4) {
- errno = EINVAL;
- return -1;
- }
-
- c = (inptr[0] << 24) | (inptr[1] << 16) | (inptr[2] << 8) | inptr[3];
-
- if (c >= 0xd800 && c < 0xe000) {
- errno = EILSEQ;
- return -1;
- } else if (c >= 0x110000) {
- errno = EILSEQ;
- return -1;
- }
-
- *outchar = c;
-
- return 4;
-}
-
-static int
-decode_utf32le (char *inbuf, size_t inleft, gunichar *outchar)
-{
- unsigned char *inptr = (unsigned char *) inbuf;
- gunichar c;
-
- if (inleft < 4) {
- errno = EINVAL;
- return -1;
- }
-
- c = (inptr[3] << 24) | (inptr[2] << 16) | (inptr[1] << 8) | inptr[0];
-
- if (c >= 0xd800 && c < 0xe000) {
- errno = EILSEQ;
- return -1;
- } else if (c >= 0x110000) {
- errno = EILSEQ;
- return -1;
- }
-
- *outchar = c;
-
- return 4;
-}
-
-static int
-encode_utf32be (gunichar c, char *outbuf, size_t outleft)
-{
- unsigned char *outptr = (unsigned char *) outbuf;
-
- if (outleft < 4) {
- errno = E2BIG;
- return -1;
- }
-
- outptr[0] = (c >> 24) & 0xff;
- outptr[1] = (c >> 16) & 0xff;
- outptr[2] = (c >> 8) & 0xff;
- outptr[3] = c & 0xff;
-
- return 4;
-}
-
-static int
-encode_utf32le (gunichar c, char *outbuf, size_t outleft)
-{
- unsigned char *outptr = (unsigned char *) outbuf;
-
- if (outleft < 4) {
- errno = E2BIG;
- return -1;
- }
-
- outptr[0] = c & 0xff;
- outptr[1] = (c >> 8) & 0xff;
- outptr[2] = (c >> 16) & 0xff;
- outptr[3] = (c >> 24) & 0xff;
-
- return 4;
-}
-
-static int
-decode_utf16be (char *inbuf, size_t inleft, gunichar *outchar)
-{
- unsigned char *inptr = (unsigned char *) inbuf;
- gunichar2 c;
- gunichar u;
-
- if (inleft < 2) {
- errno = EINVAL;
- return -1;
- }
-
- u = (inptr[0] << 8) | inptr[1];
-
- if (u < 0xd800) {
- /* 0x0000 -> 0xd7ff */
- *outchar = u;
- return 2;
- } else if (u < 0xdc00) {
- /* 0xd800 -> 0xdbff */
- if (inleft < 4) {
- errno = EINVAL;
- return -2;
- }
-
- c = (inptr[2] << 8) | inptr[3];
-
- if (c < 0xdc00 || c > 0xdfff) {
- errno = EILSEQ;
- return -2;
- }
-
- u = ((u - 0xd800) << 10) + (c - 0xdc00) + 0x0010000UL;
- *outchar = u;
-
- return 4;
- } else if (u < 0xe000) {
- /* 0xdc00 -> 0xdfff */
- errno = EILSEQ;
- return -1;
- } else {
- /* 0xe000 -> 0xffff */
- *outchar = u;
- return 2;
- }
-}
-
-static int
-decode_utf16le (char *inbuf, size_t inleft, gunichar *outchar)
-{
- unsigned char *inptr = (unsigned char *) inbuf;
- gunichar2 c;
- gunichar u;
-
- if (inleft < 2) {
- errno = EINVAL;
- return -1;
- }
-
- u = (inptr[1] << 8) | inptr[0];
-
- if (u < 0xd800) {
- /* 0x0000 -> 0xd7ff */
- *outchar = u;
- return 2;
- } else if (u < 0xdc00) {
- /* 0xd800 -> 0xdbff */
- if (inleft < 4) {
- errno = EINVAL;
- return -2;
- }
-
- c = (inptr[3] << 8) | inptr[2];
-
- if (c < 0xdc00 || c > 0xdfff) {
- errno = EILSEQ;
- return -2;
- }
-
- u = ((u - 0xd800) << 10) + (c - 0xdc00) + 0x0010000UL;
- *outchar = u;
-
- return 4;
- } else if (u < 0xe000) {
- /* 0xdc00 -> 0xdfff */
- errno = EILSEQ;
- return -1;
- } else {
- /* 0xe000 -> 0xffff */
- *outchar = u;
- return 2;
- }
-}
-
-static int
-encode_utf16be (gunichar c, char *outbuf, size_t outleft)
-{
- unsigned char *outptr = (unsigned char *) outbuf;
- gunichar2 ch;
- gunichar c2;
-
- if (c < 0x10000) {
- if (outleft < 2) {
- errno = E2BIG;
- return -1;
- }
-
- outptr[0] = (c >> 8) & 0xff;
- outptr[1] = c & 0xff;
-
- return 2;
- } else {
- if (outleft < 4) {
- errno = E2BIG;
- return -1;
- }
-
- c2 = c - 0x10000;
-
- ch = (gunichar2) ((c2 >> 10) + 0xd800);
- outptr[0] = (ch >> 8) & 0xff;
- outptr[1] = ch & 0xff;
-
- ch = (gunichar2) ((c2 & 0x3ff) + 0xdc00);
- outptr[2] = (ch >> 8) & 0xff;
- outptr[3] = ch & 0xff;
-
- return 4;
- }
-}
-
-static int
-encode_utf16le (gunichar c, char *outbuf, size_t outleft)
-{
- unsigned char *outptr = (unsigned char *) outbuf;
- gunichar2 ch;
- gunichar c2;
-
- if (c < 0x10000) {
- if (outleft < 2) {
- errno = E2BIG;
- return -1;
- }
-
- outptr[0] = c & 0xff;
- outptr[1] = (c >> 8) & 0xff;
-
- return 2;
- } else {
- if (outleft < 4) {
- errno = E2BIG;
- return -1;
- }
-
- c2 = c - 0x10000;
-
- ch = (gunichar2) ((c2 >> 10) + 0xd800);
- outptr[0] = ch & 0xff;
- outptr[1] = (ch >> 8) & 0xff;
-
- ch = (gunichar2) ((c2 & 0x3ff) + 0xdc00);
- outptr[2] = ch & 0xff;
- outptr[3] = (ch >> 8) & 0xff;
-
- return 4;
- }
-}
-
-static FORCE_INLINE (int)
-decode_utf8 (char *inbuf, size_t inleft, gunichar *outchar)
-{
- unsigned char *inptr = (unsigned char *) inbuf;
- gunichar u;
- int n, i;
-
- u = *inptr;
-
- if (u < 0x80) {
- /* simple ascii case */
- *outchar = u;
- return 1;
- } else if (u < 0xc2) {
- errno = EILSEQ;
- return -1;
- } else if (u < 0xe0) {
- u &= 0x1f;
- n = 2;
- } else if (u < 0xf0) {
- u &= 0x0f;
- n = 3;
- } else if (u < 0xf8) {
- u &= 0x07;
- n = 4;
- } else if (u < 0xfc) {
- u &= 0x03;
- n = 5;
- } else if (u < 0xfe) {
- u &= 0x01;
- n = 6;
- } else {
- errno = EILSEQ;
- return -1;
- }
-
- if (n > inleft) {
- errno = EINVAL;
- return -1;
- }
-
-#if UNROLL_DECODE_UTF8
- switch (n) {
- case 6: u = (u << 6) | (*++inptr ^ 0x80);
- case 5: u = (u << 6) | (*++inptr ^ 0x80);
- case 4: u = (u << 6) | (*++inptr ^ 0x80);
- case 3: u = (u << 6) | (*++inptr ^ 0x80);
- case 2: u = (u << 6) | (*++inptr ^ 0x80);
- }
-#else
- for (i = 1; i < n; i++)
- u = (u << 6) | (*++inptr ^ 0x80);
-#endif
-
- *outchar = u;
-
- return n;
-}
-
-static int
-encode_utf8 (gunichar c, char *outbuf, size_t outleft)
-{
- unsigned char *outptr = (unsigned char *) outbuf;
- int base, n, i;
-
- if (c < 0x80) {
- outptr[0] = c;
- return 1;
- } else if (c < 0x800) {
- base = 192;
- n = 2;
- } else if (c < 0x10000) {
- base = 224;
- n = 3;
- } else if (c < 0x200000) {
- base = 240;
- n = 4;
- } else if (c < 0x4000000) {
- base = 248;
- n = 5;
- } else {
- base = 252;
- n = 6;
- }
-
- if (outleft < n) {
- errno = E2BIG;
- return -1;
- }
-
-#if UNROLL_ENCODE_UTF8
- switch (n) {
- case 6: outptr[5] = (c & 0x3f) | 0x80; c >>= 6;
- case 5: outptr[4] = (c & 0x3f) | 0x80; c >>= 6;
- case 4: outptr[3] = (c & 0x3f) | 0x80; c >>= 6;
- case 3: outptr[2] = (c & 0x3f) | 0x80; c >>= 6;
- case 2: outptr[1] = (c & 0x3f) | 0x80; c >>= 6;
- case 1: outptr[0] = c | base;
- }
-#else
- for (i = n - 1; i > 0; i--) {
- outptr[i] = (c & 0x3f) | 0x80;
- c >>= 6;
- }
-
- outptr[0] = c | base;
-#endif
-
- return n;
-}
-
-static int
-decode_latin1 (char *inbuf, size_t inleft, gunichar *outchar)
-{
- *outchar = (unsigned char) *inbuf;
- return 1;
-}
-
-static int
-encode_latin1 (gunichar c, char *outbuf, size_t outleft)
-{
- if (outleft < 1) {
- errno = E2BIG;
- return -1;
- }
-
- if (c > 0xff) {
- errno = EILSEQ;
- return -1;
- }
-
- *outbuf = (char) c;
-
- return 1;
-}
-
-
-/*
- * Simple conversion API
- */
-
-static gpointer error_quark = "ConvertError";
-
-gpointer
-g_convert_error_quark (void)
-{
- return error_quark;
-}
-
-gchar *
-g_convert (const gchar *str, gssize len, const gchar *to_charset, const gchar *from_charset,
- gsize *bytes_read, gsize *bytes_written, GError **err)
-{
- gsize outsize, outused, outleft, inleft, grow, rc;
- char *result, *outbuf, *inbuf;
- gboolean flush = FALSE;
- gboolean done = FALSE;
- GIConv cd;
-
- g_return_val_if_fail (str != NULL, NULL);
- g_return_val_if_fail (to_charset != NULL, NULL);
- g_return_val_if_fail (from_charset != NULL, NULL);
-
- if ((cd = g_iconv_open (to_charset, from_charset)) == (GIConv) -1) {
- g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_NO_CONVERSION,
- "Conversion from %s to %s not supported.",
- from_charset, to_charset);
-
- if (bytes_written)
- *bytes_written = 0;
-
- if (bytes_read)
- *bytes_read = 0;
-
- return NULL;
- }
-
- inleft = len < 0 ? strlen (str) : len;
- inbuf = (char *) str;
-
- outleft = outsize = MAX (inleft, 8);
- outbuf = result = g_malloc (outsize + 4);
-
- do {
- if (!flush)
- rc = g_iconv (cd, &inbuf, &inleft, &outbuf, &outleft);
- else
- rc = g_iconv (cd, NULL, NULL, &outbuf, &outleft);
-
- if (rc == (gsize) -1) {
- switch (errno) {
- case E2BIG:
- /* grow our result buffer */
- grow = MAX (inleft, 8) << 1;
- outused = outbuf - result;
- outsize += grow;
- outleft += grow;
- result = g_realloc (result, outsize + 4);
- outbuf = result + outused;
- break;
- case EINVAL:
- /* incomplete input, stop converting and terminate here */
- if (flush)
- done = TRUE;
- else
- flush = TRUE;
- break;
- case EILSEQ:
- /* illegal sequence in the input */
- g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE, "%s", g_strerror (errno));
-
- if (bytes_read) {
- /* save offset of the illegal input sequence */
- *bytes_read = (inbuf - str);
- }
-
- if (bytes_written)
- *bytes_written = 0;
-
- g_iconv_close (cd);
- g_free (result);
- return NULL;
- default:
- /* unknown errno */
- g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED, "%s", g_strerror (errno));
-
- if (bytes_written)
- *bytes_written = 0;
-
- if (bytes_read)
- *bytes_read = 0;
-
- g_iconv_close (cd);
- g_free (result);
- return NULL;
- }
- } else if (flush) {
- /* input has been converted and output has been flushed */
- break;
- } else {
- /* input has been converted, need to flush the output */
- flush = TRUE;
- }
- } while (!done);
-
- g_iconv_close (cd);
-
- /* Note: not all charsets can be null-terminated with a single
- null byte. UCS2, for example, needs 2 null bytes and UCS4
- needs 4. I hope that 4 null bytes is enough to terminate all
- multibyte charsets? */
-
- /* null-terminate the result */
- memset (outbuf, 0, 4);
-
- if (bytes_written)
- *bytes_written = outbuf - result;
-
- if (bytes_read)
- *bytes_read = inbuf - str;
-
- return result;
-}
-
-
-/*
- * Unicode conversion
- */
-
-/**
- * An explanation of the conversion can be found at:
- * http://home.tiscali.nl/t876506/utf8tbl.html
- *
- **/
-gint
-g_unichar_to_utf8 (gunichar c, gchar *outbuf)
-{
- int base, n, i;
-
- if (c < 0x80) {
- base = 0;
- n = 1;
- } else if (c < 0x800) {
- base = 192;
- n = 2;
- } else if (c < 0x10000) {
- base = 224;
- n = 3;
- } else if (c < 0x200000) {
- base = 240;
- n = 4;
- } else if (c < 0x4000000) {
- base = 248;
- n = 5;
- } else if (c < 0x80000000) {
- base = 252;
- n = 6;
- } else {
- return -1;
- }
-
- if (outbuf != NULL) {
- for (i = n - 1; i > 0; i--) {
- /* mask off 6 bits worth and add 128 */
- outbuf[i] = (c & 0x3f) | 0x80;
- c >>= 6;
- }
-
- /* first character has a different base */
- outbuf[0] = c | base;
- }
-
- return n;
-}
-
-static FORCE_INLINE (int)
-g_unichar_to_utf16 (gunichar c, gunichar2 *outbuf)
-{
- gunichar c2;
-
- if (c < 0xd800) {
- if (outbuf)
- *outbuf = (gunichar2) c;
-
- return 1;
- } else if (c < 0xe000) {
- return -1;
- } else if (c < 0x10000) {
- if (outbuf)
- *outbuf = (gunichar2) c;
-
- return 1;
- } else if (c < 0x110000) {
- if (outbuf) {
- c2 = c - 0x10000;
-
- outbuf[0] = (gunichar2) ((c2 >> 10) + 0xd800);
- outbuf[1] = (gunichar2) ((c2 & 0x3ff) + 0xdc00);
- }
-
- return 2;
- } else {
- return -1;
- }
-}
-
-gunichar *
-g_utf8_to_ucs4_fast (const gchar *str, glong len, glong *items_written)
-{
- gunichar *outbuf, *outptr;
- char *inptr;
- glong n, i;
-
- g_return_val_if_fail (str != NULL, NULL);
-
- n = g_utf8_strlen (str, len);
-
- if (items_written)
- *items_written = n;
-
- outptr = outbuf = g_malloc ((n + 1) * sizeof (gunichar));
- inptr = (char *) str;
-
- for (i = 0; i < n; i++) {
- *outptr++ = g_utf8_get_char (inptr);
- inptr = g_utf8_next_char (inptr);
- }
-
- *outptr = 0;
-
- return outbuf;
-}
-
-static gunichar2 *
-eg_utf8_to_utf16_general (const gchar *str, glong len, glong *items_read, glong *items_written, gboolean include_nuls, GError **err)
-{
- gunichar2 *outbuf, *outptr;
- size_t outlen = 0;
- size_t inleft;
- char *inptr;
- gunichar c;
- int u, n;
-
- g_return_val_if_fail (str != NULL, NULL);
-
- if (len < 0) {
- if (include_nuls) {
- g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED, "Conversions with embedded nulls must pass the string length");
- return NULL;
- }
-
- len = strlen (str);
- }
-
- inptr = (char *) str;
- inleft = len;
-
- while (inleft > 0) {
- if ((n = decode_utf8 (inptr, inleft, &c)) < 0)
- goto error;
-
- if (c == 0 && !include_nuls)
- break;
-
- if ((u = g_unichar_to_utf16 (c, NULL)) < 0) {
- errno = EILSEQ;
- goto error;
- }
-
- outlen += u;
- inleft -= n;
- inptr += n;
- }
-
- if (items_read)
- *items_read = inptr - str;
-
- if (items_written)
- *items_written = outlen;
-
- outptr = outbuf = g_malloc ((outlen + 1) * sizeof (gunichar2));
- inptr = (char *) str;
- inleft = len;
-
- while (inleft > 0) {
- if ((n = decode_utf8 (inptr, inleft, &c)) < 0)
- break;
-
- if (c == 0 && !include_nuls)
- break;
-
- outptr += g_unichar_to_utf16 (c, outptr);
- inleft -= n;
- inptr += n;
- }
-
- *outptr = '\0';
-
- return outbuf;
-
- error:
- if (errno == EILSEQ) {
- g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
- "Illegal byte sequence encounted in the input.");
- } else if (items_read) {
- /* partial input is ok if we can let our caller know... */
- } else {
- g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_PARTIAL_INPUT,
- "Partial byte sequence encountered in the input.");
- }
-
- if (items_read)
- *items_read = inptr - str;
-
- if (items_written)
- *items_written = 0;
-
- return NULL;
-}
-
-gunichar2 *
-g_utf8_to_utf16 (const gchar *str, glong len, glong *items_read, glong *items_written, GError **err)
-{
- return eg_utf8_to_utf16_general (str, len, items_read, items_written, FALSE, err);
-}
-
-gunichar2 *
-eg_utf8_to_utf16_with_nuls (const gchar *str, glong len, glong *items_read, glong *items_written, GError **err)
-{
- return eg_utf8_to_utf16_general (str, len, items_read, items_written, TRUE, err);
-}
-
-gunichar *
-g_utf8_to_ucs4 (const gchar *str, glong len, glong *items_read, glong *items_written, GError **err)
-{
- gunichar *outbuf, *outptr;
- size_t outlen = 0;
- size_t inleft;
- char *inptr;
- gunichar c;
- int n;
-
- g_return_val_if_fail (str != NULL, NULL);
-
- if (len < 0)
- len = strlen (str);
-
- inptr = (char *) str;
- inleft = len;
-
- while (inleft > 0) {
- if ((n = decode_utf8 (inptr, inleft, &c)) < 0) {
- if (errno == EILSEQ) {
- g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
- "Illegal byte sequence encounted in the input.");
- } else if (items_read) {
- /* partial input is ok if we can let our caller know... */
- break;
- } else {
- g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_PARTIAL_INPUT,
- "Partial byte sequence encountered in the input.");
- }
-
- if (items_read)
- *items_read = inptr - str;
-
- if (items_written)
- *items_written = 0;
-
- return NULL;
- } else if (c == 0)
- break;
-
- outlen += 4;
- inleft -= n;
- inptr += n;
- }
-
- if (items_written)
- *items_written = outlen / 4;
-
- if (items_read)
- *items_read = inptr - str;
-
- outptr = outbuf = g_malloc (outlen + 4);
- inptr = (char *) str;
- inleft = len;
-
- while (inleft > 0) {
- if ((n = decode_utf8 (inptr, inleft, &c)) < 0)
- break;
- else if (c == 0)
- break;
-
- *outptr++ = c;
- inleft -= n;
- inptr += n;
- }
-
- *outptr = 0;
-
- return outbuf;
-}
-
-gchar *
-g_utf16_to_utf8 (const gunichar2 *str, glong len, glong *items_read, glong *items_written, GError **err)
-{
- char *inptr, *outbuf, *outptr;
- size_t outlen = 0;
- size_t inleft;
- gunichar c;
- int n;
-
- g_return_val_if_fail (str != NULL, NULL);
-
- if (len < 0) {
- len = 0;
- while (str[len])
- len++;
- }
-
- inptr = (char *) str;
- inleft = len * 2;
-
- while (inleft > 0) {
- if ((n = decode_utf16 (inptr, inleft, &c)) < 0) {
- if (n == -2 && inleft > 2) {
- /* This means that the first UTF-16 char was read, but second failed */
- inleft -= 2;
- inptr += 2;
- }
-
- if (errno == EILSEQ) {
- g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
- "Illegal byte sequence encounted in the input.");
- } else if (items_read) {
- /* partial input is ok if we can let our caller know... */
- break;
- } else {
- g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_PARTIAL_INPUT,
- "Partial byte sequence encountered in the input.");
- }
-
- if (items_read)
- *items_read = (inptr - (char *) str) / 2;
-
- if (items_written)
- *items_written = 0;
-
- return NULL;
- } else if (c == 0)
- break;
-
- outlen += g_unichar_to_utf8 (c, NULL);
- inleft -= n;
- inptr += n;
- }
-
- if (items_read)
- *items_read = (inptr - (char *) str) / 2;
-
- if (items_written)
- *items_written = outlen;
-
- outptr = outbuf = g_malloc (outlen + 1);
- inptr = (char *) str;
- inleft = len * 2;
-
- while (inleft > 0) {
- if ((n = decode_utf16 (inptr, inleft, &c)) < 0)
- break;
- else if (c == 0)
- break;
-
- outptr += g_unichar_to_utf8 (c, outptr);
- inleft -= n;
- inptr += n;
- }
-
- *outptr = '\0';
-
- return outbuf;
-}
-
-gunichar *
-g_utf16_to_ucs4 (const gunichar2 *str, glong len, glong *items_read, glong *items_written, GError **err)
-{
- gunichar *outbuf, *outptr;
- size_t outlen = 0;
- size_t inleft;
- char *inptr;
- gunichar c;
- int n;
-
- g_return_val_if_fail (str != NULL, NULL);
-
- if (len < 0) {
- len = 0;
- while (str[len])
- len++;
- }
-
- inptr = (char *) str;
- inleft = len * 2;
-
- while (inleft > 0) {
- if ((n = decode_utf16 (inptr, inleft, &c)) < 0) {
- if (n == -2 && inleft > 2) {
- /* This means that the first UTF-16 char was read, but second failed */
- inleft -= 2;
- inptr += 2;
- }
-
- if (errno == EILSEQ) {
- g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
- "Illegal byte sequence encounted in the input.");
- } else if (items_read) {
- /* partial input is ok if we can let our caller know... */
- break;
- } else {
- g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_PARTIAL_INPUT,
- "Partial byte sequence encountered in the input.");
- }
-
- if (items_read)
- *items_read = (inptr - (char *) str) / 2;
-
- if (items_written)
- *items_written = 0;
-
- return NULL;
- } else if (c == 0)
- break;
-
- outlen += 4;
- inleft -= n;
- inptr += n;
- }
-
- if (items_read)
- *items_read = (inptr - (char *) str) / 2;
-
- if (items_written)
- *items_written = outlen / 4;
-
- outptr = outbuf = g_malloc (outlen + 4);
- inptr = (char *) str;
- inleft = len * 2;
-
- while (inleft > 0) {
- if ((n = decode_utf16 (inptr, inleft, &c)) < 0)
- break;
- else if (c == 0)
- break;
-
- *outptr++ = c;
- inleft -= n;
- inptr += n;
- }
-
- *outptr = 0;
-
- return outbuf;
-}
-
-gchar *
-g_ucs4_to_utf8 (const gunichar *str, glong len, glong *items_read, glong *items_written, GError **err)
-{
- char *outbuf, *outptr;
- size_t outlen = 0;
- glong i;
- int n;
-
- g_return_val_if_fail (str != NULL, NULL);
-
- if (len < 0) {
- for (i = 0; str[i] != 0; i++) {
- if ((n = g_unichar_to_utf8 (str[i], NULL)) < 0) {
- g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
- "Illegal byte sequence encounted in the input.");
-
- if (items_written)
- *items_written = 0;
-
- if (items_read)
- *items_read = i;
-
- return NULL;
- }
-
- outlen += n;
- }
- } else {
- for (i = 0; i < len && str[i] != 0; i++) {
- if ((n = g_unichar_to_utf8 (str[i], NULL)) < 0) {
- g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
- "Illegal byte sequence encounted in the input.");
-
- if (items_written)
- *items_written = 0;
-
- if (items_read)
- *items_read = i;
-
- return NULL;
- }
-
- outlen += n;
- }
- }
-
- len = i;
-
- outptr = outbuf = g_malloc (outlen + 1);
- for (i = 0; i < len; i++)
- outptr += g_unichar_to_utf8 (str[i], outptr);
- *outptr = 0;
-
- if (items_written)
- *items_written = outlen;
-
- if (items_read)
- *items_read = i;
-
- return outbuf;
-}
-
-gunichar2 *
-g_ucs4_to_utf16 (const gunichar *str, glong len, glong *items_read, glong *items_written, GError **err)
-{
- gunichar2 *outbuf, *outptr;
- size_t outlen = 0;
- glong i;
- int n;
-
- g_return_val_if_fail (str != NULL, NULL);
-
- if (len < 0) {
- for (i = 0; str[i] != 0; i++) {
- if ((n = g_unichar_to_utf16 (str[i], NULL)) < 0) {
- g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
- "Illegal byte sequence encounted in the input.");
-
- if (items_written)
- *items_written = 0;
-
- if (items_read)
- *items_read = i;
-
- return NULL;
- }
-
- outlen += n;
- }
- } else {
- for (i = 0; i < len && str[i] != 0; i++) {
- if ((n = g_unichar_to_utf16 (str[i], NULL)) < 0) {
- g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
- "Illegal byte sequence encounted in the input.");
-
- if (items_written)
- *items_written = 0;
-
- if (items_read)
- *items_read = i;
-
- return NULL;
- }
-
- outlen += n;
- }
- }
-
- len = i;
-
- outptr = outbuf = g_malloc ((outlen + 1) * sizeof (gunichar2));
- for (i = 0; i < len; i++)
- outptr += g_unichar_to_utf16 (str[i], outptr);
- *outptr = 0;
-
- if (items_written)
- *items_written = outlen;
-
- if (items_read)
- *items_read = i;
-
- return outbuf;
-}
+++ /dev/null
-#ifndef __GLIB_H
-#define __GLIB_H
-#include <stdarg.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <stddef.h>
-#include <ctype.h>
-#include <limits.h>
-
-
-#ifdef _MSC_VER
-#pragma include_alias(<eglib-config.h>, <eglib-config.hw>)
-#endif
-
-#include <stdint.h>
-#include <inttypes.h>
-
-#include <eglib-config.h>
-#ifndef EGLIB_NO_REMAP
-#include <eglib-remap.h>
-#endif
-
-#ifdef G_HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-
-#ifdef WIN32
-/* For alloca */
-#include <malloc.h>
-#endif
-
-#ifndef offsetof
-# define offsetof(s_name,n_name) (size_t)(char *)&(((s_name*)0)->m_name)
-#endif
-
-#define __EGLIB_X11 1
-
-#ifdef __cplusplus
-#define G_BEGIN_DECLS extern "C" {
-#define G_END_DECLS }
-#else
-#define G_BEGIN_DECLS
-#define G_END_DECLS
-#endif
-
-G_BEGIN_DECLS
-
-/*
- * Basic data types
- */
-typedef int gint;
-typedef unsigned int guint;
-typedef short gshort;
-typedef unsigned short gushort;
-typedef long glong;
-typedef unsigned long gulong;
-typedef void * gpointer;
-typedef const void * gconstpointer;
-typedef char gchar;
-typedef unsigned char guchar;
-
-/* Types defined in terms of the stdint.h */
-typedef int8_t gint8;
-typedef uint8_t guint8;
-typedef int16_t gint16;
-typedef uint16_t guint16;
-typedef int32_t gint32;
-typedef uint32_t guint32;
-typedef int64_t gint64;
-typedef uint64_t guint64;
-typedef float gfloat;
-typedef double gdouble;
-typedef int32_t gboolean;
-
-typedef guint16 gunichar2;
-typedef guint32 gunichar;
-
-/*
- * Macros
- */
-#define G_N_ELEMENTS(s) (sizeof(s) / sizeof ((s) [0]))
-
-#define FALSE 0
-#define TRUE 1
-
-#define G_MINSHORT SHRT_MIN
-#define G_MAXSHORT SHRT_MAX
-#define G_MAXUSHORT USHRT_MAX
-#define G_MAXINT INT_MAX
-#define G_MININT INT_MIN
-#define G_MAXINT32 INT32_MAX
-#define G_MAXUINT32 UINT32_MAX
-#define G_MININT32 INT32_MIN
-#define G_MININT64 INT64_MIN
-#define G_MAXINT64 INT64_MAX
-#define G_MAXUINT64 UINT64_MAX
-
-#define G_LITTLE_ENDIAN 1234
-#define G_BIG_ENDIAN 4321
-#define G_STMT_START do
-#define G_STMT_END while (0)
-
-#define G_USEC_PER_SEC 1000000
-
-#ifndef ABS
-#define ABS(a) ((a) > 0 ? (a) : -(a))
-#endif
-
-#define G_STRUCT_OFFSET(p_type,field) offsetof(p_type,field)
-
-#define EGLIB_STRINGIFY(x) #x
-#define EGLIB_TOSTRING(x) EGLIB_STRINGIFY(x)
-#define G_STRLOC __FILE__ ":" EGLIB_TOSTRING(__LINE__) ":"
-
-#define G_CONST_RETURN const
-
-#define G_GUINT64_FORMAT PRIu64
-#define G_GINT64_FORMAT PRIi64
-#define G_GUINT32_FORMAT PRIu32
-#define G_GINT32_FORMAT PRIi32
-
-/*
- * Allocation
- */
-void g_free (void *ptr);
-gpointer g_realloc (gpointer obj, gsize size);
-gpointer g_malloc (gsize x);
-gpointer g_malloc0 (gsize x);
-gpointer g_calloc (gsize n, gsize x);
-gpointer g_try_malloc (gsize x);
-gpointer g_try_realloc (gpointer obj, gsize size);
-
-#define g_new(type,size) ((type *) g_malloc (sizeof (type) * (size)))
-#define g_new0(type,size) ((type *) g_malloc0 (sizeof (type)* (size)))
-#define g_newa(type,size) ((type *) alloca (sizeof (type) * (size)))
-
-#define g_memmove(dest,src,len) memmove (dest, src, len)
-#define g_renew(struct_type, mem, n_structs) g_realloc (mem, sizeof (struct_type) * n_structs)
-#define g_alloca(size) alloca (size)
-
-gpointer g_memdup (gconstpointer mem, guint byte_size);
-static inline gchar *g_strdup (const gchar *str) { if (str) { return (gchar*) g_memdup (str, (guint)strlen (str) + 1); } return NULL; }
-gchar **g_strdupv (gchar **str_array);
-
-typedef struct {
- gpointer (*malloc) (gsize n_bytes);
- gpointer (*realloc) (gpointer mem, gsize n_bytes);
- void (*free) (gpointer mem);
- gpointer (*calloc) (gsize n_blocks, gsize n_block_bytes);
-} GMemVTable;
-
-void g_mem_set_vtable (GMemVTable* vtable);
-
-struct _GMemChunk {
- guint alloc_size;
-};
-
-typedef struct _GMemChunk GMemChunk;
-/*
- * Misc.
- */
-
-gboolean g_hasenv(const gchar *variable);
-gchar * g_getenv(const gchar *variable);
-gboolean g_setenv(const gchar *variable, const gchar *value, gboolean overwrite);
-void g_unsetenv(const gchar *variable);
-
-gchar* g_win32_getlocale(void);
-
-/*
- * Precondition macros
- */
-#define g_warn_if_fail(x) G_STMT_START { if (!(x)) { g_warning ("%s:%d: assertion '%s' failed", __FILE__, __LINE__, #x); } } G_STMT_END
-#define g_return_if_fail(x) G_STMT_START { if (!(x)) { g_critical ("%s:%d: assertion '%s' failed", __FILE__, __LINE__, #x); return; } } G_STMT_END
-#define g_return_val_if_fail(x,e) G_STMT_START { if (!(x)) { g_critical ("%s:%d: assertion '%s' failed", __FILE__, __LINE__, #x); return (e); } } G_STMT_END
-
-/*
- * Errors
- */
-typedef struct {
- /* In the real glib, this is a GQuark, but we dont use/need that */
- gpointer domain;
- gint code;
- gchar *message;
-} GError;
-
-void g_clear_error (GError **error);
-void g_error_free (GError *error);
-GError *g_error_new (gpointer domain, gint code, const char *format, ...);
-void g_set_error (GError **err, gpointer domain, gint code, const gchar *format, ...);
-void g_propagate_error (GError **dest, GError *src);
-
-/*
- * Strings utility
- */
-gchar *g_strdup_printf (const gchar *format, ...);
-gchar *g_strdup_vprintf (const gchar *format, va_list args);
-gchar *g_strndup (const gchar *str, gsize n);
-const gchar *g_strerror (gint errnum);
-gchar *g_strndup (const gchar *str, gsize n);
-void g_strfreev (gchar **str_array);
-gchar *g_strconcat (const gchar *first, ...);
-gchar **g_strsplit (const gchar *string, const gchar *delimiter, gint max_tokens);
-gchar **g_strsplit_set (const gchar *string, const gchar *delimiter, gint max_tokens);
-gchar *g_strreverse (gchar *str);
-gboolean g_str_has_prefix (const gchar *str, const gchar *prefix);
-gboolean g_str_has_suffix (const gchar *str, const gchar *suffix);
-guint g_strv_length (gchar **str_array);
-gchar *g_strjoin (const gchar *separator, ...);
-gchar *g_strjoinv (const gchar *separator, gchar **str_array);
-gchar *g_strchug (gchar *str);
-gchar *g_strchomp (gchar *str);
-void g_strdown (gchar *string);
-gchar *g_strnfill (gsize length, gchar fill_char);
-
-gchar *g_strdelimit (gchar *string, const gchar *delimiters, gchar new_delimiter);
-gchar *g_strescape (const gchar *source, const gchar *exceptions);
-
-gchar *g_filename_to_uri (const gchar *filename, const gchar *hostname, GError **error);
-gchar *g_filename_from_uri (const gchar *uri, gchar **hostname, GError **error);
-
-gint g_printf (gchar const *format, ...);
-gint g_fprintf (FILE *file, gchar const *format, ...);
-gint g_sprintf (gchar *string, gchar const *format, ...);
-gint g_snprintf (gchar *string, gulong n, gchar const *format, ...);
-gint g_vasprintf (gchar **ret, const gchar *fmt, va_list ap);
-#define g_vprintf vprintf
-#define g_vfprintf vfprintf
-#define g_vsprintf vsprintf
-#define g_vsnprintf vsnprintf
-
-gsize g_strlcpy (gchar *dest, const gchar *src, gsize dest_size);
-gchar *g_stpcpy (gchar *dest, const char *src);
-
-
-gchar g_ascii_tolower (gchar c);
-gchar g_ascii_toupper (gchar c);
-gchar *g_ascii_strdown (const gchar *str, gssize len);
-gchar *g_ascii_strup (const gchar *str, gssize len);
-gint g_ascii_strncasecmp (const gchar *s1, const gchar *s2, gsize n);
-gint g_ascii_strcasecmp (const gchar *s1, const gchar *s2);
-gint g_ascii_xdigit_value (gchar c);
-#define g_ascii_isspace(c) (isspace (c) != 0)
-#define g_ascii_isalpha(c) (isalpha (c) != 0)
-#define g_ascii_isprint(c) (isprint (c) != 0)
-#define g_ascii_isxdigit(c) (isxdigit (c) != 0)
-
-/* FIXME: g_strcasecmp supports utf8 unicode stuff */
-#ifdef _MSC_VER
-#define g_strcasecmp stricmp
-#define g_strncasecmp strnicmp
-#define g_strstrip(a) g_strchug (g_strchomp (a))
-#else
-#define g_strcasecmp strcasecmp
-#define g_ascii_strtoull strtoull
-#define g_strncasecmp strncasecmp
-#define g_strstrip(a) g_strchug (g_strchomp (a))
-#endif
-#define g_ascii_strdup strdup
-
-
-#define G_STR_DELIMITERS "_-|> <."
-
-/*
- * String type
- */
-typedef struct {
- char *str;
- gsize len;
- gsize allocated_len;
-} GString;
-
-GString *g_string_new (const gchar *init);
-GString *g_string_new_len (const gchar *init, gssize len);
-GString *g_string_sized_new (gsize default_size);
-gchar *g_string_free (GString *string, gboolean free_segment);
-GString *g_string_append (GString *string, const gchar *val);
-void g_string_printf (GString *string, const gchar *format, ...);
-void g_string_append_printf (GString *string, const gchar *format, ...);
-void g_string_append_vprintf (GString *string, const gchar *format, va_list args);
-GString *g_string_append_unichar (GString *string, gunichar c);
-GString *g_string_append_c (GString *string, gchar c);
-GString *g_string_append (GString *string, const gchar *val);
-GString *g_string_append_len (GString *string, const gchar *val, gssize len);
-GString *g_string_truncate (GString *string, gsize len);
-GString *g_string_prepend (GString *string, const gchar *val);
-GString *g_string_insert (GString *string, gssize pos, const gchar *val);
-GString *g_string_set_size (GString *string, gsize len);
-GString *g_string_erase (GString *string, gssize pos, gssize len);
-
-#define g_string_sprintfa g_string_append_printf
-
-typedef void (*GFunc) (gpointer data, gpointer user_data);
-typedef gint (*GCompareFunc) (gconstpointer a, gconstpointer b);
-typedef gint (*GCompareDataFunc) (gconstpointer a, gconstpointer b, gpointer user_data);
-typedef void (*GHFunc) (gpointer key, gpointer value, gpointer user_data);
-typedef gboolean (*GHRFunc) (gpointer key, gpointer value, gpointer user_data);
-typedef void (*GDestroyNotify) (gpointer data);
-typedef guint (*GHashFunc) (gconstpointer key);
-typedef gboolean (*GEqualFunc) (gconstpointer a, gconstpointer b);
-typedef void (*GFreeFunc) (gpointer data);
-
-/*
- * Lists
- */
-typedef struct _GSList GSList;
-struct _GSList {
- gpointer data;
- GSList *next;
-};
-
-GSList *g_slist_alloc (void);
-GSList *g_slist_append (GSList *list,
- gpointer data);
-GSList *g_slist_prepend (GSList *list,
- gpointer data);
-void g_slist_free (GSList *list);
-void g_slist_free_1 (GSList *list);
-GSList *g_slist_copy (GSList *list);
-GSList *g_slist_concat (GSList *list1,
- GSList *list2);
-void g_slist_foreach (GSList *list,
- GFunc func,
- gpointer user_data);
-GSList *g_slist_last (GSList *list);
-GSList *g_slist_find (GSList *list,
- gconstpointer data);
-GSList *g_slist_find_custom (GSList *list,
- gconstpointer data,
- GCompareFunc func);
-GSList *g_slist_remove (GSList *list,
- gconstpointer data);
-GSList *g_slist_remove_all (GSList *list,
- gconstpointer data);
-GSList *g_slist_reverse (GSList *list);
-guint g_slist_length (GSList *list);
-GSList *g_slist_remove_link (GSList *list,
- GSList *link);
-GSList *g_slist_delete_link (GSList *list,
- GSList *link);
-GSList *g_slist_insert_sorted (GSList *list,
- gpointer data,
- GCompareFunc func);
-GSList *g_slist_insert_before (GSList *list,
- GSList *sibling,
- gpointer data);
-GSList *g_slist_sort (GSList *list,
- GCompareFunc func);
-gint g_slist_index (GSList *list,
- gconstpointer data);
-GSList *g_slist_nth (GSList *list,
- guint n);
-gpointer g_slist_nth_data (GSList *list,
- guint n);
-
-#define g_slist_next(slist) ((slist) ? (((GSList *) (slist))->next) : NULL)
-
-
-typedef struct _GList GList;
-struct _GList {
- gpointer data;
- GList *next;
- GList *prev;
-};
-
-#define g_list_next(list) ((list) ? (((GList *) (list))->next) : NULL)
-#define g_list_previous(list) ((list) ? (((GList *) (list))->prev) : NULL)
-
-GList *g_list_alloc (void);
-GList *g_list_append (GList *list,
- gpointer data);
-GList *g_list_prepend (GList *list,
- gpointer data);
-void g_list_free (GList *list);
-void g_list_free_1 (GList *list);
-GList *g_list_copy (GList *list);
-guint g_list_length (GList *list);
-gint g_list_index (GList *list,
- gconstpointer data);
-GList *g_list_nth (GList *list,
- guint n);
-gpointer g_list_nth_data (GList *list,
- guint n);
-GList *g_list_last (GList *list);
-GList *g_list_concat (GList *list1,
- GList *list2);
-void g_list_foreach (GList *list,
- GFunc func,
- gpointer user_data);
-GList *g_list_first (GList *list);
-GList *g_list_find (GList *list,
- gconstpointer data);
-GList *g_list_find_custom (GList *list,
- gconstpointer data,
- GCompareFunc func);
-GList *g_list_remove (GList *list,
- gconstpointer data);
-GList *g_list_remove_all (GList *list,
- gconstpointer data);
-GList *g_list_reverse (GList *list);
-GList *g_list_remove_link (GList *list,
- GList *link);
-GList *g_list_delete_link (GList *list,
- GList *link);
-GList *g_list_insert_sorted (GList *list,
- gpointer data,
- GCompareFunc func);
-GList *g_list_insert_before (GList *list,
- GList *sibling,
- gpointer data);
-GList *g_list_sort (GList *sort,
- GCompareFunc func);
-
-/*
- * Hashtables
- */
-typedef struct _GHashTable GHashTable;
-typedef struct _GHashTableIter GHashTableIter;
-
-/* Private, but needed for stack allocation */
-struct _GHashTableIter
-{
- gpointer dummy [8];
-};
-
-GHashTable *g_hash_table_new (GHashFunc hash_func, GEqualFunc key_equal_func);
-GHashTable *g_hash_table_new_full (GHashFunc hash_func, GEqualFunc key_equal_func,
- GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func);
-void g_hash_table_insert_replace (GHashTable *hash, gpointer key, gpointer value, gboolean replace);
-guint g_hash_table_size (GHashTable *hash);
-GList *g_hash_table_get_keys (GHashTable *hash);
-GList *g_hash_table_get_values (GHashTable *hash);
-gpointer g_hash_table_lookup (GHashTable *hash, gconstpointer key);
-gboolean g_hash_table_lookup_extended (GHashTable *hash, gconstpointer key, gpointer *orig_key, gpointer *value);
-void g_hash_table_foreach (GHashTable *hash, GHFunc func, gpointer user_data);
-gpointer g_hash_table_find (GHashTable *hash, GHRFunc predicate, gpointer user_data);
-gboolean g_hash_table_remove (GHashTable *hash, gconstpointer key);
-gboolean g_hash_table_steal (GHashTable *hash, gconstpointer key);
-void g_hash_table_remove_all (GHashTable *hash);
-guint g_hash_table_foreach_remove (GHashTable *hash, GHRFunc func, gpointer user_data);
-guint g_hash_table_foreach_steal (GHashTable *hash, GHRFunc func, gpointer user_data);
-void g_hash_table_destroy (GHashTable *hash);
-void g_hash_table_print_stats (GHashTable *table);
-
-void g_hash_table_iter_init (GHashTableIter *iter, GHashTable *hash_table);
-gboolean g_hash_table_iter_next (GHashTableIter *iter, gpointer *key, gpointer *value);
-
-guint g_spaced_primes_closest (guint x);
-
-#define g_hash_table_insert(h,k,v) g_hash_table_insert_replace ((h),(k),(v),FALSE)
-#define g_hash_table_replace(h,k,v) g_hash_table_insert_replace ((h),(k),(v),TRUE)
-
-gboolean g_direct_equal (gconstpointer v1, gconstpointer v2);
-guint g_direct_hash (gconstpointer v1);
-gboolean g_int_equal (gconstpointer v1, gconstpointer v2);
-guint g_int_hash (gconstpointer v1);
-gboolean g_str_equal (gconstpointer v1, gconstpointer v2);
-guint g_str_hash (gconstpointer v1);
-
-/*
- * ByteArray
- */
-
-typedef struct _GByteArray GByteArray;
-struct _GByteArray {
- guint8 *data;
- gint len;
-};
-
-GByteArray *g_byte_array_new (void);
-GByteArray* g_byte_array_append (GByteArray *array, const guint8 *data, guint len);
-guint8* g_byte_array_free (GByteArray *array, gboolean free_segment);
-void g_byte_array_set_size (GByteArray *array, gint length);
-
-/*
- * Array
- */
-
-typedef struct _GArray GArray;
-struct _GArray {
- gchar *data;
- gint len;
-};
-
-GArray *g_array_new (gboolean zero_terminated, gboolean clear_, guint element_size);
-GArray *g_array_sized_new (gboolean zero_terminated, gboolean clear_, guint element_size, guint reserved_size);
-gchar* g_array_free (GArray *array, gboolean free_segment);
-GArray *g_array_append_vals (GArray *array, gconstpointer data, guint len);
-GArray* g_array_insert_vals (GArray *array, guint index_, gconstpointer data, guint len);
-GArray* g_array_remove_index (GArray *array, guint index_);
-GArray* g_array_remove_index_fast (GArray *array, guint index_);
-void g_array_set_size (GArray *array, gint length);
-
-#define g_array_append_val(a,v) (g_array_append_vals((a),&(v),1))
-#define g_array_insert_val(a,i,v) (g_array_insert_vals((a),(i),&(v),1))
-#define g_array_index(a,t,i) *(t*)(((a)->data) + sizeof(t) * (i))
-
-/*
- * QSort
-*/
-
-void g_qsort_with_data (gpointer base, size_t nmemb, size_t size, GCompareDataFunc compare, gpointer user_data);
-
-/*
- * Pointer Array
- */
-
-typedef struct _GPtrArray GPtrArray;
-struct _GPtrArray {
- gpointer *pdata;
- guint len;
-};
-
-GPtrArray *g_ptr_array_new (void);
-GPtrArray *g_ptr_array_sized_new (guint reserved_size);
-void g_ptr_array_add (GPtrArray *array, gpointer data);
-gboolean g_ptr_array_remove (GPtrArray *array, gpointer data);
-gpointer g_ptr_array_remove_index (GPtrArray *array, guint index);
-gboolean g_ptr_array_remove_fast (GPtrArray *array, gpointer data);
-gpointer g_ptr_array_remove_index_fast (GPtrArray *array, guint index);
-void g_ptr_array_sort (GPtrArray *array, GCompareFunc compare_func);
-void g_ptr_array_sort_with_data (GPtrArray *array, GCompareDataFunc compare_func, gpointer user_data);
-void g_ptr_array_set_size (GPtrArray *array, gint length);
-gpointer *g_ptr_array_free (GPtrArray *array, gboolean free_seg);
-void g_ptr_array_foreach (GPtrArray *array, GFunc func, gpointer user_data);
-#define g_ptr_array_index(array,index) (array)->pdata[(index)]
-
-/*
- * Queues
- */
-typedef struct {
- GList *head;
- GList *tail;
- guint length;
-} GQueue;
-
-gpointer g_queue_pop_head (GQueue *queue);
-void g_queue_push_head (GQueue *queue,
- gpointer data);
-void g_queue_push_tail (GQueue *queue,
- gpointer data);
-gboolean g_queue_is_empty (GQueue *queue);
-GQueue *g_queue_new (void);
-void g_queue_free (GQueue *queue);
-void g_queue_foreach (GQueue *queue, GFunc func, gpointer user_data);
-
-/*
- * Messages
- */
-#ifndef G_LOG_DOMAIN
-#define G_LOG_DOMAIN ((gchar*) 0)
-#endif
-
-typedef enum {
- G_LOG_FLAG_RECURSION = 1 << 0,
- G_LOG_FLAG_FATAL = 1 << 1,
-
- G_LOG_LEVEL_ERROR = 1 << 2,
- G_LOG_LEVEL_CRITICAL = 1 << 3,
- G_LOG_LEVEL_WARNING = 1 << 4,
- G_LOG_LEVEL_MESSAGE = 1 << 5,
- G_LOG_LEVEL_INFO = 1 << 6,
- G_LOG_LEVEL_DEBUG = 1 << 7,
-
- G_LOG_LEVEL_MASK = ~(G_LOG_FLAG_RECURSION | G_LOG_FLAG_FATAL)
-} GLogLevelFlags;
-
-void g_print (const gchar *format, ...);
-void g_printerr (const gchar *format, ...);
-GLogLevelFlags g_log_set_always_fatal (GLogLevelFlags fatal_mask);
-GLogLevelFlags g_log_set_fatal_mask (const gchar *log_domain, GLogLevelFlags fatal_mask);
-void g_logv (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, va_list args);
-void g_log (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, ...);
-void g_assertion_message (const gchar *format, ...) G_GNUC_NORETURN;
-
-#ifdef HAVE_C99_SUPPORT
-/* The for (;;) tells gc thats g_error () doesn't return, avoiding warnings */
-#define g_error(format, ...) do { g_log (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format, __VA_ARGS__); for (;;); } while (0)
-#define g_critical(format, ...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, format, __VA_ARGS__)
-#define g_warning(format, ...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, format, __VA_ARGS__)
-#define g_message(format, ...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, format, __VA_ARGS__)
-#define g_debug(format, ...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format, __VA_ARGS__)
-#else /* HAVE_C99_SUPPORT */
-#define g_error(...) do { g_log (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, __VA_ARGS__); for (;;); } while (0)
-#define g_critical(...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, __VA_ARGS__)
-#define g_warning(...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, __VA_ARGS__)
-#define g_message(...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, __VA_ARGS__)
-#define g_debug(...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, __VA_ARGS__)
-#endif /* ndef HAVE_C99_SUPPORT */
-
-typedef void (*GLogFunc) (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data);
-typedef void (*GPrintFunc) (const gchar *string);
-
-void g_log_default_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer unused_data);
-GLogFunc g_log_set_default_handler (GLogFunc log_func, gpointer user_data);
-GPrintFunc g_set_print_handler (GPrintFunc func);
-GPrintFunc g_set_printerr_handler (GPrintFunc func);
-/*
- * Conversions
- */
-
-gpointer g_convert_error_quark(void);
-
-
-/*
- * Unicode Manipulation: most of this is not used by Mono by default, it is
- * only used if the old collation code is activated, so this is only the
- * bare minimum to build.
- */
-
-typedef enum {
- G_UNICODE_CONTROL,
- G_UNICODE_FORMAT,
- G_UNICODE_UNASSIGNED,
- G_UNICODE_PRIVATE_USE,
- G_UNICODE_SURROGATE,
- G_UNICODE_LOWERCASE_LETTER,
- G_UNICODE_MODIFIER_LETTER,
- G_UNICODE_OTHER_LETTER,
- G_UNICODE_TITLECASE_LETTER,
- G_UNICODE_UPPERCASE_LETTER,
- G_UNICODE_COMBINING_MARK,
- G_UNICODE_ENCLOSING_MARK,
- G_UNICODE_NON_SPACING_MARK,
- G_UNICODE_DECIMAL_NUMBER,
- G_UNICODE_LETTER_NUMBER,
- G_UNICODE_OTHER_NUMBER,
- G_UNICODE_CONNECT_PUNCTUATION,
- G_UNICODE_DASH_PUNCTUATION,
- G_UNICODE_CLOSE_PUNCTUATION,
- G_UNICODE_FINAL_PUNCTUATION,
- G_UNICODE_INITIAL_PUNCTUATION,
- G_UNICODE_OTHER_PUNCTUATION,
- G_UNICODE_OPEN_PUNCTUATION,
- G_UNICODE_CURRENCY_SYMBOL,
- G_UNICODE_MODIFIER_SYMBOL,
- G_UNICODE_MATH_SYMBOL,
- G_UNICODE_OTHER_SYMBOL,
- G_UNICODE_LINE_SEPARATOR,
- G_UNICODE_PARAGRAPH_SEPARATOR,
- G_UNICODE_SPACE_SEPARATOR
-} GUnicodeType;
-
-typedef enum {
- G_UNICODE_BREAK_MANDATORY,
- G_UNICODE_BREAK_CARRIAGE_RETURN,
- G_UNICODE_BREAK_LINE_FEED,
- G_UNICODE_BREAK_COMBINING_MARK,
- G_UNICODE_BREAK_SURROGATE,
- G_UNICODE_BREAK_ZERO_WIDTH_SPACE,
- G_UNICODE_BREAK_INSEPARABLE,
- G_UNICODE_BREAK_NON_BREAKING_GLUE,
- G_UNICODE_BREAK_CONTINGENT,
- G_UNICODE_BREAK_SPACE,
- G_UNICODE_BREAK_AFTER,
- G_UNICODE_BREAK_BEFORE,
- G_UNICODE_BREAK_BEFORE_AND_AFTER,
- G_UNICODE_BREAK_HYPHEN,
- G_UNICODE_BREAK_NON_STARTER,
- G_UNICODE_BREAK_OPEN_PUNCTUATION,
- G_UNICODE_BREAK_CLOSE_PUNCTUATION,
- G_UNICODE_BREAK_QUOTATION,
- G_UNICODE_BREAK_EXCLAMATION,
- G_UNICODE_BREAK_IDEOGRAPHIC,
- G_UNICODE_BREAK_NUMERIC,
- G_UNICODE_BREAK_INFIX_SEPARATOR,
- G_UNICODE_BREAK_SYMBOL,
- G_UNICODE_BREAK_ALPHABETIC,
- G_UNICODE_BREAK_PREFIX,
- G_UNICODE_BREAK_POSTFIX,
- G_UNICODE_BREAK_COMPLEX_CONTEXT,
- G_UNICODE_BREAK_AMBIGUOUS,
- G_UNICODE_BREAK_UNKNOWN,
- G_UNICODE_BREAK_NEXT_LINE,
- G_UNICODE_BREAK_WORD_JOINER,
- G_UNICODE_BREAK_HANGUL_L_JAMO,
- G_UNICODE_BREAK_HANGUL_V_JAMO,
- G_UNICODE_BREAK_HANGUL_T_JAMO,
- G_UNICODE_BREAK_HANGUL_LV_SYLLABLE,
- G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE
-} GUnicodeBreakType;
-
-gunichar g_unichar_toupper (gunichar c);
-gunichar g_unichar_tolower (gunichar c);
-gunichar g_unichar_totitle (gunichar c);
-GUnicodeType g_unichar_type (gunichar c);
-gboolean g_unichar_isspace (gunichar c);
-gboolean g_unichar_isxdigit (gunichar c);
-gint g_unichar_xdigit_value (gunichar c);
-GUnicodeBreakType g_unichar_break_type (gunichar c);
-
-#ifndef MAX
-#define MAX(a,b) (((a)>(b)) ? (a) : (b))
-#endif
-
-#ifndef MIN
-#define MIN(a,b) (((a)<(b)) ? (a) : (b))
-#endif
-
-#ifndef CLAMP
-#define CLAMP(a,low,high) (((a) < (low)) ? (low) : (((a) > (high)) ? (high) : (a)))
-#endif
-
-#if defined(__GNUC__) && (__GNUC__ > 2)
-#define G_LIKELY(expr) (__builtin_expect ((expr) != 0, 1))
-#define G_UNLIKELY(expr) (__builtin_expect ((expr) != 0, 0))
-#else
-#define G_LIKELY(x) (x)
-#define G_UNLIKELY(x) (x)
-#endif
-
-#if defined(_MSC_VER)
-#define eg_unreachable() __assume(0)
-#elif defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 5)))
-#define eg_unreachable() __builtin_unreachable()
-#else
-#define eg_unreachable()
-#endif
-
-#define g_assert(x) G_STMT_START { if (G_UNLIKELY (!(x))) g_assertion_message ("* Assertion at %s:%d, condition `%s' not met\n", __FILE__, __LINE__, #x); } G_STMT_END
-#define g_assert_not_reached() G_STMT_START { g_assertion_message ("* Assertion: should not be reached at %s:%d\n", __FILE__, __LINE__); eg_unreachable(); } G_STMT_END
-
-/*
- * Unicode conversion
- */
-
-#define G_CONVERT_ERROR g_convert_error_quark()
-
-typedef enum {
- G_CONVERT_ERROR_NO_CONVERSION,
- G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
- G_CONVERT_ERROR_FAILED,
- G_CONVERT_ERROR_PARTIAL_INPUT,
- G_CONVERT_ERROR_BAD_URI,
- G_CONVERT_ERROR_NOT_ABSOLUTE_PATH
-} GConvertError;
-
-gchar *g_utf8_strup (const gchar *str, gssize len);
-gchar *g_utf8_strdown (const gchar *str, gssize len);
-gint g_unichar_to_utf8 (gunichar c, gchar *outbuf);
-gunichar *g_utf8_to_ucs4_fast (const gchar *str, glong len, glong *items_written);
-gunichar *g_utf8_to_ucs4 (const gchar *str, glong len, glong *items_read, glong *items_written, GError **err);
-gunichar2 *g_utf8_to_utf16 (const gchar *str, glong len, glong *items_read, glong *items_written, GError **err);
-gunichar2 *eg_utf8_to_utf16_with_nuls (const gchar *str, glong len, glong *items_read, glong *items_written, GError **err);
-gchar *g_utf16_to_utf8 (const gunichar2 *str, glong len, glong *items_read, glong *items_written, GError **err);
-gunichar *g_utf16_to_ucs4 (const gunichar2 *str, glong len, glong *items_read, glong *items_written, GError **err);
-gchar *g_ucs4_to_utf8 (const gunichar *str, glong len, glong *items_read, glong *items_written, GError **err);
-gunichar2 *g_ucs4_to_utf16 (const gunichar *str, glong len, glong *items_read, glong *items_written, GError **err);
-
-#define u8to16(str) g_utf8_to_utf16(str, (glong)strlen(str), NULL, NULL, NULL)
-
-#ifdef G_OS_WIN32
-#define u16to8(str) g_utf16_to_utf8((gunichar2 *) (str), (glong)wcslen((wchar_t *) (str)), NULL, NULL, NULL)
-#else
-#define u16to8(str) g_utf16_to_utf8(str, (glong)strlen(str), NULL, NULL, NULL)
-#endif
-
-/*
- * Path
- */
-gchar *g_build_path (const gchar *separator, const gchar *first_element, ...);
-#define g_build_filename(x, ...) g_build_path(G_DIR_SEPARATOR_S, x, __VA_ARGS__)
-gchar *g_path_get_dirname (const gchar *filename);
-gchar *g_path_get_basename (const char *filename);
-gchar *g_find_program_in_path (const gchar *program);
-gchar *g_get_current_dir (void);
-gboolean g_path_is_absolute (const char *filename);
-
-const gchar *g_get_home_dir (void);
-const gchar *g_get_tmp_dir (void);
-const gchar *g_get_user_name (void);
-gchar *g_get_prgname (void);
-void g_set_prgname (const gchar *prgname);
-
-gboolean g_ensure_directory_exists (const gchar *filename);
-
-/*
- * Shell
- */
-
-gboolean g_shell_parse_argv (const gchar *command_line, gint *argcp, gchar ***argvp, GError **error);
-gchar *g_shell_unquote (const gchar *quoted_string, GError **error);
-gchar *g_shell_quote (const gchar *unquoted_string);
-
-/*
- * Spawn
- */
-typedef enum {
- G_SPAWN_LEAVE_DESCRIPTORS_OPEN = 1,
- G_SPAWN_DO_NOT_REAP_CHILD = 1 << 1,
- G_SPAWN_SEARCH_PATH = 1 << 2,
- G_SPAWN_STDOUT_TO_DEV_NULL = 1 << 3,
- G_SPAWN_STDERR_TO_DEV_NULL = 1 << 4,
- G_SPAWN_CHILD_INHERITS_STDIN = 1 << 5,
- G_SPAWN_FILE_AND_ARGV_ZERO = 1 << 6
-} GSpawnFlags;
-
-typedef void (*GSpawnChildSetupFunc) (gpointer user_data);
-
-gboolean g_spawn_command_line_sync (const gchar *command_line, gchar **standard_output, gchar **standard_error, gint *exit_status, GError **error);
-gboolean g_spawn_async_with_pipes (const gchar *working_directory, gchar **argv, gchar **envp, GSpawnFlags flags, GSpawnChildSetupFunc child_setup,
- gpointer user_data, GPid *child_pid, gint *standard_input, gint *standard_output, gint *standard_error, GError **error);
-
-int eg_getdtablesize (void);
-
-/*
- * Timer
- */
-typedef struct _GTimer GTimer;
-
-GTimer *g_timer_new (void);
-void g_timer_destroy (GTimer *timer);
-gdouble g_timer_elapsed (GTimer *timer, gulong *microseconds);
-void g_timer_stop (GTimer *timer);
-void g_timer_start (GTimer *timer);
-
-/*
- * Date and time
- */
-typedef struct {
- glong tv_sec;
- glong tv_usec;
-} GTimeVal;
-
-void g_get_current_time (GTimeVal *result);
-void g_usleep (gulong microseconds);
-
-/*
- * File
- */
-
-gpointer g_file_error_quark (void);
-
-#define G_FILE_ERROR g_file_error_quark ()
-
-typedef enum {
- G_FILE_ERROR_EXIST,
- G_FILE_ERROR_ISDIR,
- G_FILE_ERROR_ACCES,
- G_FILE_ERROR_NAMETOOLONG,
- G_FILE_ERROR_NOENT,
- G_FILE_ERROR_NOTDIR,
- G_FILE_ERROR_NXIO,
- G_FILE_ERROR_NODEV,
- G_FILE_ERROR_ROFS,
- G_FILE_ERROR_TXTBSY,
- G_FILE_ERROR_FAULT,
- G_FILE_ERROR_LOOP,
- G_FILE_ERROR_NOSPC,
- G_FILE_ERROR_NOMEM,
- G_FILE_ERROR_MFILE,
- G_FILE_ERROR_NFILE,
- G_FILE_ERROR_BADF,
- G_FILE_ERROR_INVAL,
- G_FILE_ERROR_PIPE,
- G_FILE_ERROR_AGAIN,
- G_FILE_ERROR_INTR,
- G_FILE_ERROR_IO,
- G_FILE_ERROR_PERM,
- G_FILE_ERROR_NOSYS,
- G_FILE_ERROR_FAILED
-} GFileError;
-
-typedef enum {
- G_FILE_TEST_IS_REGULAR = 1 << 0,
- G_FILE_TEST_IS_SYMLINK = 1 << 1,
- G_FILE_TEST_IS_DIR = 1 << 2,
- G_FILE_TEST_IS_EXECUTABLE = 1 << 3,
- G_FILE_TEST_EXISTS = 1 << 4
-} GFileTest;
-
-
-gboolean g_file_set_contents (const gchar *filename, const gchar *contents, gssize length, GError **error);
-gboolean g_file_get_contents (const gchar *filename, gchar **contents, gsize *length, GError **error);
-GFileError g_file_error_from_errno (gint err_no);
-gint g_file_open_tmp (const gchar *tmpl, gchar **name_used, GError **error);
-gboolean g_file_test (const gchar *filename, GFileTest test);
-
-#define g_open open
-#define g_rename rename
-#define g_stat stat
-#define g_unlink unlink
-#define g_fopen fopen
-#define g_lstat lstat
-#define g_rmdir rmdir
-#define g_mkstemp mkstemp
-#define g_ascii_isdigit isdigit
-#define g_ascii_strtod strtod
-#define g_ascii_isalnum isalnum
-
-gchar *g_mkdtemp (gchar *tmpl);
-
-/*
- * Pattern matching
- */
-typedef struct _GPatternSpec GPatternSpec;
-GPatternSpec * g_pattern_spec_new (const gchar *pattern);
-void g_pattern_spec_free (GPatternSpec *pspec);
-gboolean g_pattern_match_string (GPatternSpec *pspec, const gchar *string);
-
-/*
- * Directory
- */
-typedef struct _GDir GDir;
-GDir *g_dir_open (const gchar *path, guint flags, GError **error);
-const gchar *g_dir_read_name (GDir *dir);
-void g_dir_rewind (GDir *dir);
-void g_dir_close (GDir *dir);
-
-int g_mkdir_with_parents (const gchar *pathname, int mode);
-#define g_mkdir mkdir
-
-/*
- * GMarkup
- */
-typedef struct _GMarkupParseContext GMarkupParseContext;
-
-typedef enum
-{
- G_MARKUP_DO_NOT_USE_THIS_UNSUPPORTED_FLAG = 1 << 0,
- G_MARKUP_TREAT_CDATA_AS_TEXT = 1 << 1
-} GMarkupParseFlags;
-
-typedef struct {
- void (*start_element) (GMarkupParseContext *context,
- const gchar *element_name,
- const gchar **attribute_names,
- const gchar **attribute_values,
- gpointer user_data,
- GError **error);
-
- void (*end_element) (GMarkupParseContext *context,
- const gchar *element_name,
- gpointer user_data,
- GError **error);
-
- void (*text) (GMarkupParseContext *context,
- const gchar *text,
- gsize text_len,
- gpointer user_data,
- GError **error);
-
- void (*passthrough) (GMarkupParseContext *context,
- const gchar *passthrough_text,
- gsize text_len,
- gpointer user_data,
- GError **error);
- void (*error) (GMarkupParseContext *context,
- GError *error,
- gpointer user_data);
-} GMarkupParser;
-
-GMarkupParseContext *g_markup_parse_context_new (const GMarkupParser *parser,
- GMarkupParseFlags flags,
- gpointer user_data,
- GDestroyNotify user_data_dnotify);
-void g_markup_parse_context_free (GMarkupParseContext *context);
-gboolean g_markup_parse_context_parse (GMarkupParseContext *context,
- const gchar *text, gssize text_len,
- GError **error);
-gboolean g_markup_parse_context_end_parse (GMarkupParseContext *context,
- GError **error);
-
-/*
- * Character set conversion
- */
-typedef struct _GIConv *GIConv;
-
-gsize g_iconv (GIConv cd, gchar **inbytes, gsize *inbytesleft, gchar **outbytes, gsize *outbytesleft);
-GIConv g_iconv_open (const gchar *to_charset, const gchar *from_charset);
-int g_iconv_close (GIConv cd);
-
-gboolean g_get_charset (G_CONST_RETURN char **charset);
-gchar *g_locale_to_utf8 (const gchar *opsysstring, gssize len,
- gsize *bytes_read, gsize *bytes_written,
- GError **error);
-gchar *g_locale_from_utf8 (const gchar *utf8string, gssize len, gsize *bytes_read,
- gsize *bytes_written, GError **error);
-gchar *g_filename_from_utf8 (const gchar *utf8string, gssize len, gsize *bytes_read,
- gsize *bytes_written, GError **error);
-gchar *g_convert (const gchar *str, gssize len,
- const gchar *to_codeset, const gchar *from_codeset,
- gsize *bytes_read, gsize *bytes_written, GError **error);
-
-/*
- * Unicode manipulation
- */
-extern const guchar g_utf8_jump_table[256];
-
-gboolean g_utf8_validate (const gchar *str, gssize max_len, const gchar **end);
-gunichar g_utf8_get_char_validated (const gchar *str, gssize max_len);
-gchar *g_utf8_find_prev_char (const char *str, const char *p);
-gchar *g_utf8_prev_char (const char *str);
-#define g_utf8_next_char(p) ((p) + g_utf8_jump_table[(guchar)(*p)])
-gunichar g_utf8_get_char (const gchar *src);
-glong g_utf8_strlen (const gchar *str, gssize max);
-gchar *g_utf8_offset_to_pointer (const gchar *str, glong offset);
-glong g_utf8_pointer_to_offset (const gchar *str, const gchar *pos);
-
-/*
- * priorities
- */
-#define G_PRIORITY_DEFAULT 0
-#define G_PRIORITY_DEFAULT_IDLE 200
-
-#define GUINT16_SWAP_LE_BE_CONSTANT(x) ((((guint16) x) >> 8) | ((((guint16) x) << 8)))
-
-#define GUINT16_SWAP_LE_BE(x) ((guint16) (((guint16) x) >> 8) | ((((guint16)(x)) & 0xff) << 8))
-#define GUINT32_SWAP_LE_BE(x) ((guint32) \
- ( (((guint32) (x)) << 24)| \
- ((((guint32) (x)) & 0xff0000) >> 8) | \
- ((((guint32) (x)) & 0xff00) << 8) | \
- (((guint32) (x)) >> 24)) )
-
-#define GUINT64_SWAP_LE_BE(x) ((guint64) (((guint64)(GUINT32_SWAP_LE_BE(((guint64)x) & 0xffffffff))) << 32) | \
- GUINT32_SWAP_LE_BE(((guint64)x) >> 32))
-
-
-
-#if G_BYTE_ORDER == G_LITTLE_ENDIAN
-# define GUINT64_FROM_BE(x) GUINT64_SWAP_LE_BE(x)
-# define GUINT32_FROM_BE(x) GUINT32_SWAP_LE_BE(x)
-# define GUINT16_FROM_BE(x) GUINT16_SWAP_LE_BE(x)
-# define GUINT_FROM_BE(x) GUINT32_SWAP_LE_BE(x)
-# define GUINT64_FROM_LE(x) (x)
-# define GUINT32_FROM_LE(x) (x)
-# define GUINT16_FROM_LE(x) (x)
-# define GUINT_FROM_LE(x) (x)
-# define GUINT64_TO_BE(x) GUINT64_SWAP_LE_BE(x)
-# define GUINT32_TO_BE(x) GUINT32_SWAP_LE_BE(x)
-# define GUINT16_TO_BE(x) GUINT16_SWAP_LE_BE(x)
-# define GUINT_TO_BE(x) GUINT32_SWAP_LE_BE(x)
-# define GUINT64_TO_LE(x) (x)
-# define GUINT32_TO_LE(x) (x)
-# define GUINT16_TO_LE(x) (x)
-# define GUINT_TO_LE(x) (x)
-#else
-# define GUINT64_FROM_BE(x) (x)
-# define GUINT32_FROM_BE(x) (x)
-# define GUINT16_FROM_BE(x) (x)
-# define GUINT_FROM_BE(x) (x)
-# define GUINT64_FROM_LE(x) GUINT64_SWAP_LE_BE(x)
-# define GUINT32_FROM_LE(x) GUINT32_SWAP_LE_BE(x)
-# define GUINT16_FROM_LE(x) GUINT16_SWAP_LE_BE(x)
-# define GUINT_FROM_LE(x) GUINT32_SWAP_LE_BE(x)
-# define GUINT64_TO_BE(x) (x)
-# define GUINT32_TO_BE(x) (x)
-# define GUINT16_TO_BE(x) (x)
-# define GUINT_TO_BE(x) (x)
-# define GUINT64_TO_LE(x) GUINT64_SWAP_LE_BE(x)
-# define GUINT32_TO_LE(x) GUINT32_SWAP_LE_BE(x)
-# define GUINT16_TO_LE(x) GUINT16_SWAP_LE_BE(x)
-# define GUINT_TO_LE(x) GUINT32_SWAP_LE_BE(x)
-#endif
-
-#define GINT64_FROM_BE(x) (GUINT64_TO_BE (x))
-#define GINT32_FROM_BE(x) (GUINT32_TO_BE (x))
-#define GINT16_FROM_BE(x) (GUINT16_TO_BE (x))
-#define GINT64_FROM_LE(x) (GUINT64_TO_LE (x))
-#define GINT32_FROM_LE(x) (GUINT32_TO_LE (x))
-#define GINT16_FROM_LE(x) (GUINT16_TO_LE (x))
-
-#define _EGLIB_MAJOR 2
-#define _EGLIB_MIDDLE 4
-#define _EGLIB_MINOR 0
-
-#define GLIB_CHECK_VERSION(a,b,c) ((a < _EGLIB_MAJOR) || (a == _EGLIB_MAJOR && (b < _EGLIB_MIDDLE || (b == _EGLIB_MIDDLE && c <= _EGLIB_MINOR))))
-
-#define G_HAVE_API_SUPPORT(x) (x)
-#define G_UNSUPPORTED_API "%s:%d: '%s' not supported.", __FILE__, __LINE__
-#define g_unsupported_api(name) G_STMT_START { g_warning (G_UNSUPPORTED_API, name); } G_STMT_END
-
-G_END_DECLS
-
-#endif
-
-
-
+++ /dev/null
-/*
- * glist.c: Doubly-linked list implementation
- *
- * Authors:
- * Duncan Mak (duncan@novell.com)
- * Raja R Harinath (rharinath@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.
- *
- * (C) 2006 Novell, Inc.
- */
-#include <stdio.h>
-#include <glib.h>
-
-GList*
-g_list_alloc ()
-{
- return g_new0 (GList, 1);
-}
-
-static inline GList*
-new_node (GList *prev, gpointer data, GList *next)
-{
- GList *node = g_list_alloc ();
- node->data = data;
- node->prev = prev;
- node->next = next;
- if (prev)
- prev->next = node;
- if (next)
- next->prev = node;
- return node;
-}
-
-static inline GList*
-disconnect_node (GList *node)
-{
- if (node->next)
- node->next->prev = node->prev;
- if (node->prev)
- node->prev->next = node->next;
- return node;
-}
-
-GList *
-g_list_prepend (GList *list, gpointer data)
-{
- return new_node (list ? list->prev : NULL, data, list);
-}
-
-void
-g_list_free_1 (GList *list)
-{
- g_free (list);
-}
-
-void
-g_list_free (GList *list)
-{
- while (list){
- GList *next = list->next;
- g_list_free_1 (list);
- list = next;
- }
-}
-
-GList*
-g_list_append (GList *list, gpointer data)
-{
- GList *node = new_node (g_list_last (list), data, NULL);
- return list ? list : node;
-}
-
-GList *
-g_list_concat (GList *list1, GList *list2)
-{
- if (list1 && list2) {
- list2->prev = g_list_last (list1);
- list2->prev->next = list2;
- }
- return list1 ? list1 : list2;
-}
-
-guint
-g_list_length (GList *list)
-{
- guint length = 0;
-
- while (list) {
- length ++;
- list = list->next;
- }
-
- return length;
-}
-
-GList*
-g_list_remove (GList *list, gconstpointer data)
-{
- GList *current = g_list_find (list, data);
- if (!current)
- return list;
-
- if (current == list)
- list = list->next;
- g_list_free_1 (disconnect_node (current));
-
- return list;
-}
-
-GList*
-g_list_remove_all (GList *list, gconstpointer data)
-{
- GList *current = g_list_find (list, data);
-
- if (!current)
- return list;
-
- while (current) {
- if (current == list)
- list = list->next;
- g_list_free_1 (disconnect_node (current));
-
- current = g_list_find (list, data);
- }
-
- return list;
-}
-
-GList*
-g_list_remove_link (GList *list, GList *link)
-{
- if (list == link)
- list = list->next;
-
- disconnect_node (link);
- link->next = NULL;
- link->prev = NULL;
-
- return list;
-}
-
-GList*
-g_list_delete_link (GList *list, GList *link)
-{
- list = g_list_remove_link (list, link);
- g_list_free_1 (link);
-
- return list;
-}
-
-GList*
-g_list_find (GList *list, gconstpointer data)
-{
- while (list){
- if (list->data == data)
- return list;
-
- list = list->next;
- }
-
- return NULL;
-}
-
-GList*
-g_list_find_custom (GList *list, gconstpointer data, GCompareFunc func)
-{
- if (!func)
- return NULL;
-
- while (list) {
- if (func (list->data, data) == 0)
- return list;
-
- list = list->next;
- }
-
- return NULL;
-}
-
-GList*
-g_list_reverse (GList *list)
-{
- GList *reverse = NULL;
-
- while (list) {
- reverse = list;
- list = reverse->next;
-
- reverse->next = reverse->prev;
- reverse->prev = list;
- }
-
- return reverse;
-}
-
-GList*
-g_list_first (GList *list)
-{
- if (!list)
- return NULL;
-
- while (list->prev)
- list = list->prev;
-
- return list;
-}
-
-GList*
-g_list_last (GList *list)
-{
- if (!list)
- return NULL;
-
- while (list->next)
- list = list->next;
-
- return list;
-}
-
-GList*
-g_list_insert_sorted (GList *list, gpointer data, GCompareFunc func)
-{
- GList *prev = NULL;
- GList *current;
- GList *node;
-
- if (!func)
- return list;
-
- /* Invariant: !prev || func (prev->data, data) <= 0) */
- for (current = list; current; current = current->next) {
- if (func (current->data, data) > 0)
- break;
- prev = current;
- }
-
- node = new_node (prev, data, current);
- return list == current ? node : list;
-}
-
-GList*
-g_list_insert_before (GList *list, GList *sibling, gpointer data)
-{
- if (sibling) {
- GList *node = new_node (sibling->prev, data, sibling);
- return list == sibling ? node : list;
- }
- return g_list_append (list, data);
-}
-
-void
-g_list_foreach (GList *list, GFunc func, gpointer user_data)
-{
- while (list){
- (*func) (list->data, user_data);
- list = list->next;
- }
-}
-
-gint
-g_list_index (GList *list, gconstpointer data)
-{
- gint index = 0;
-
- while (list){
- if (list->data == data)
- return index;
-
- index ++;
- list = list->next;
- }
-
- return -1;
-}
-
-GList*
-g_list_nth (GList *list, guint n)
-{
- for (; list; list = list->next) {
- if (n == 0)
- break;
- n--;
- }
- return list;
-}
-
-gpointer
-g_list_nth_data (GList *list, guint n)
-{
- GList *node = g_list_nth (list, n);
- return node ? node->data : NULL;
-}
-
-GList*
-g_list_copy (GList *list)
-{
- GList *copy = NULL;
-
- if (list) {
- GList *tmp = new_node (NULL, list->data, NULL);
- copy = tmp;
-
- for (list = list->next; list; list = list->next)
- tmp = new_node (tmp, list->data, NULL);
- }
-
- return copy;
-}
-
-typedef GList list_node;
-#include "sort.frag.h"
-
-GList*
-g_list_sort (GList *list, GCompareFunc func)
-{
- GList *current;
- if (!list || !list->next)
- return list;
- list = do_sort (list, func);
-
- /* Fixup: do_sort doesn't update 'prev' pointers */
- list->prev = NULL;
- for (current = list; current->next; current = current->next)
- current->next->prev = current;
-
- return list;
-}
+++ /dev/null
-/*
- * gmakrup.c: Minimal XML markup reader.
- *
- * Unlike the GLib one, this can not be restarted with more text
- * as the Mono use does not require it.
- *
- * Actually, with further thought, I think that this could be made
- * to restart very easily. The pos == end condition would mean
- * "return to caller" and only at end parse this would be a fatal
- * error.
- *
- * Not that it matters to Mono, but it is very simple to change, there
- * is a tricky situation: there are a few places where we check p+n
- * in the source, and that would have to change to be progressive, instead
- * of depending on the string to be complete at that point, so we would
- * have to introduce extra states to cope with that.
- *
- * Author:
- * Miguel de Icaza (miguel@novell.com)
- *
- * (C) 2006 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.
- */
-#include <stdio.h>
-#include <ctype.h>
-#include <glib.h>
-
-#define set_error(msg, ...) do { if (error != NULL) *error = g_error_new (GINT_TO_POINTER (1), 1, msg, __VA_ARGS__); } while (0);
-
-typedef enum {
- START,
- START_ELEMENT,
- TEXT,
- FLUSH_TEXT,
- CLOSING_ELEMENT,
- COMMENT,
- SKIP_XML_DECLARATION
-} ParseState;
-
-struct _GMarkupParseContext {
- GMarkupParser parser;
- gpointer user_data;
- GDestroyNotify user_data_dnotify;
- ParseState state;
-
- /* Stores the name of the current element, so we can issue the end_element */
- GSList *level;
-
- GString *text;
-};
-
-GMarkupParseContext *
-g_markup_parse_context_new (const GMarkupParser *parser,
- GMarkupParseFlags flags,
- gpointer user_data,
- GDestroyNotify user_data_dnotify)
-{
- GMarkupParseContext *context = g_new0 (GMarkupParseContext, 1);
-
- context->parser = *parser;
- context->user_data = user_data;
- context->user_data_dnotify = user_data_dnotify;
-
- return context;
-}
-
-void
-g_markup_parse_context_free (GMarkupParseContext *context)
-{
- GSList *l;
-
- g_return_if_fail (context != NULL);
-
- if (context->user_data_dnotify != NULL)
- (context->user_data_dnotify) (context->user_data);
-
- if (context->text != NULL)
- g_string_free (context->text, TRUE);
- for (l = context->level; l; l = l->next)
- g_free (l->data);
- g_slist_free (context->level);
- g_free (context);
-}
-
-static gboolean
-my_isspace (char c)
-{
- if (c == ' ' || c == '\t' || c == '\r' || c == '\n' || c == '\v')
- return TRUE;
- return FALSE;
-}
-
-static gboolean
-my_isalnum (char c)
-{
- if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
- return TRUE;
- if (c >= '0' && c <= '9')
- return TRUE;
-
- return FALSE;
-}
-
-static gboolean
-my_isalpha (char c)
-{
- if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
- return TRUE;
- return FALSE;
-}
-
-static const char *
-skip_space (const char *p, const char *end)
-{
- for (; p < end && my_isspace (*p); p++)
- ;
- return p;
-}
-
-static const char *
-parse_value (const char *p, const char *end, char **value, GError **error)
-{
- const char *start;
- int l;
-
- if (*p != '"'){
- set_error ("%s", "Expected the attribute value to start with a quote");
- return end;
- }
- start = ++p;
- for (; p < end && *p != '"'; p++)
- ;
- if (p == end)
- return end;
- l = (int)(p - start);
- p++;
- *value = g_malloc (l + 1);
- if (*value == NULL)
- return end;
- strncpy (*value, start, l);
- (*value) [l] = 0;
- return p;
-}
-
-static const char *
-parse_name (const char *p, const char *end, char **value)
-{
- const char *start = p;
- int l;
-
- for (; p < end && my_isalnum (*p); p++)
- ;
- if (p == end)
- return end;
-
- l = (int)(p - start);
- *value = g_malloc (l + 1);
- if (*value == NULL)
- return end;
- strncpy (*value, start, l);
- (*value) [l] = 0;
- return p;
-}
-
-static const char *
-parse_attributes (const char *p, const char *end, char ***names, char ***values, GError **error, int *full_stop, int state)
-{
- int nnames = 0;
-
- while (TRUE){
- p = skip_space (p, end);
- if (p == end)
- return end;
-
- if (*p == '>'){
- *full_stop = 0;
- return p;
- }
- if (state == SKIP_XML_DECLARATION && *p == '?' && ((p+1) < end) && *(p+1) == '>'){
- *full_stop = 0;
- return p+1;
- }
-
- if (*p == '/' && ((p+1) < end && *(p+1) == '>')){
- *full_stop = 1;
- return p+1;
- } else {
- char *name, *value;
-
- p = parse_name (p, end, &name);
- if (p == end)
- return p;
-
- p = skip_space (p, end);
- if (p == end){
- g_free (name);
- return p;
- }
- if (*p != '='){
- set_error ("Expected an = after the attribute name `%s'", name);
- g_free (name);
- return end;
- }
- p++;
- p = skip_space (p, end);
- if (p == end){
- g_free (name);
- return end;
- }
-
- p = parse_value (p, end, &value, error);
- if (p == end){
- g_free (name);
- return p;
- }
-
- ++nnames;
- *names = g_realloc (*names, sizeof (char **) * (nnames+1));
- *values = g_realloc (*values, sizeof (char **) * (nnames+1));
- (*names) [nnames-1] = name;
- (*values) [nnames-1] = value;
- (*names) [nnames] = NULL;
- (*values) [nnames] = NULL;
- }
- }
-}
-
-static void
-destroy_parse_state (GMarkupParseContext *context)
-{
- GSList *p;
-
- for (p = context->level; p != NULL; p = p->next)
- g_free (p->data);
-
- g_slist_free (context->level);
- if (context->text != NULL)
- g_string_free (context->text, TRUE);
- context->text = NULL;
- context->level = NULL;
-}
-
-gboolean
-g_markup_parse_context_parse (GMarkupParseContext *context,
- const gchar *text, gssize text_len,
- GError **error)
-{
- const char *p, *end;
-
- g_return_val_if_fail (context != NULL, FALSE);
- g_return_val_if_fail (text != NULL, FALSE);
- g_return_val_if_fail (text_len >= 0, FALSE);
-
- end = text + text_len;
-
- for (p = text; p < end; p++){
- char c = *p;
-
- switch (context->state){
- case START:
- if (c == ' ' || c == '\t' || c == '\f' || c == '\n' || (c & 0x80))
- continue;
- if (c == '<'){
- if (p+1 < end && p [1] == '?'){
- context->state = SKIP_XML_DECLARATION;
- p++;
- } else
- context->state = START_ELEMENT;
- continue;
- }
- set_error ("%s", "Expected < to start the document");
- goto fail;
-
- case SKIP_XML_DECLARATION:
- case START_ELEMENT: {
- const char *element_start = p, *element_end;
- char *ename = NULL;
- int full_stop = 0, l;
- gchar **names = NULL, **values = NULL;
-
- for (; p < end && my_isspace (*p); p++)
- ;
- if (p == end){
- set_error ("%s", "Unfinished element");
- goto fail;
- }
-
- if (*p == '!' && (p+2 < end) && (p [1] == '-') && (p [2] == '-')){
- context->state = COMMENT;
- p += 2;
- break;
- }
-
- if (!my_isalpha (*p)){
- set_error ("%s", "Expected an element name");
- goto fail;
- }
-
- for (++p; p < end && (my_isalnum (*p) || (*p == '.')); p++)
- ;
- if (p == end){
- set_error ("%s", "Expected an element");
- goto fail;
- }
- element_end = p;
-
- for (; p < end && my_isspace (*p); p++)
- ;
- if (p == end){
- set_error ("%s", "Unfinished element");
- goto fail;
- }
- p = parse_attributes (p, end, &names, &values, error, &full_stop, context->state);
- if (p == end){
- if (names != NULL) {
- g_strfreev (names);
- g_strfreev (values);
- }
- /* Only set the error if parse_attributes did not */
- if (error != NULL && *error == NULL)
- set_error ("%s", "Unfinished sequence");
- goto fail;
- }
- l = (int)(element_end - element_start);
- ename = g_malloc (l + 1);
- if (ename == NULL)
- goto fail;
- strncpy (ename, element_start, l);
- ename [l] = 0;
-
- if (context->state == START_ELEMENT)
- if (context->parser.start_element != NULL)
- context->parser.start_element (context, ename,
- (const gchar **) names,
- (const gchar **) values,
- context->user_data, error);
-
- if (names != NULL){
- g_strfreev (names);
- g_strfreev (values);
- }
-
- if (error != NULL && *error != NULL){
- g_free (ename);
- goto fail;
- }
-
- if (full_stop){
- if (context->parser.end_element != NULL && context->state == START_ELEMENT){
- context->parser.end_element (context, ename, context->user_data, error);
- if (error != NULL && *error != NULL){
- g_free (ename);
- goto fail;
- }
- }
- g_free (ename);
- } else {
- context->level = g_slist_prepend (context->level, ename);
- }
-
- context->state = TEXT;
- break;
- } /* case START_ELEMENT */
-
- case TEXT: {
- if (c == '<'){
- context->state = FLUSH_TEXT;
- break;
- }
- if (context->parser.text != NULL){
- if (context->text == NULL)
- context->text = g_string_new ("");
- g_string_append_c (context->text, c);
- }
- break;
- }
-
- case COMMENT:
- if (*p != '-')
- break;
- if (p+2 < end && (p [1] == '-') && (p [2] == '>')){
- context->state = TEXT;
- p += 2;
- break;
- }
- break;
-
- case FLUSH_TEXT:
- if (context->parser.text != NULL && context->text != NULL){
- context->parser.text (context, context->text->str, context->text->len,
- context->user_data, error);
- if (error != NULL && *error != NULL)
- goto fail;
- }
-
- if (c == '/')
- context->state = CLOSING_ELEMENT;
- else {
- p--;
- context->state = START_ELEMENT;
- }
- break;
-
- case CLOSING_ELEMENT: {
- GSList *current = context->level;
- char *text;
-
- if (context->level == NULL){
- set_error ("%s", "Too many closing tags, not enough open tags");
- goto fail;
- }
-
- text = current->data;
- if (context->parser.end_element != NULL){
- context->parser.end_element (context, text, context->user_data, error);
- if (error != NULL && *error != NULL){
- g_free (text);
- goto fail;
- }
- }
- g_free (text);
-
- while (p < end && *p != '>')
- p++;
-
- context->level = context->level->next;
- g_slist_free_1 (current);
- context->state = TEXT;
- break;
- } /* case CLOSING_ELEMENT */
-
- } /* switch */
- }
-
-
- return TRUE;
- fail:
- if (context->parser.error && error != NULL && *error)
- context->parser.error (context, *error, context->user_data);
-
- destroy_parse_state (context);
- return FALSE;
-}
-
-gboolean
-g_markup_parse_context_end_parse (GMarkupParseContext *context, GError **error)
-{
- g_return_val_if_fail (context != NULL, FALSE);
-
- /*
- * In our case, we always signal errors during parse, not at the end
- * see the notes at the top of this file for details on how this
- * could be moved here
- */
- return TRUE;
-}
+++ /dev/null
-/*
- * gmem.c: memory utility functions
- *
- * Author:
- * Gonzalo Paniagua Javier (gonzalo@novell.com)
- *
- * (C) 2006 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.
- */
-#include <config.h>
-#include <stdio.h>
-#include <string.h>
-#include <glib.h>
-
-#if defined (ENABLE_OVERRIDABLE_ALLOCATORS)
-
-static GMemVTable sGMemVTable = { malloc, realloc, free, calloc };
-
-void
-g_mem_set_vtable (GMemVTable* vtable)
-{
- sGMemVTable.calloc = vtable->calloc ? vtable->calloc : calloc;
- sGMemVTable.realloc = vtable->realloc ? vtable->realloc : realloc;
- sGMemVTable.malloc = vtable->malloc ? vtable->malloc : malloc;
- sGMemVTable.free = vtable->free ? vtable->free : free;
-}
-
-#define G_FREE_INTERNAL sGMemVTable.free
-#define G_REALLOC_INTERNAL sGMemVTable.realloc
-#define G_CALLOC_INTERNAL sGMemVTable.calloc
-#define G_MALLOC_INTERNAL sGMemVTable.malloc
-#else
-
-void
-g_mem_set_vtable (GMemVTable* vtable)
-{
-}
-
-#define G_FREE_INTERNAL free
-#define G_REALLOC_INTERNAL realloc
-#define G_CALLOC_INTERNAL calloc
-#define G_MALLOC_INTERNAL malloc
-#endif
-void
-g_free (void *ptr)
-{
- if (ptr != NULL)
- G_FREE_INTERNAL (ptr);
-}
-
-gpointer
-g_memdup (gconstpointer mem, guint byte_size)
-{
- gpointer ptr;
-
- if (mem == NULL)
- return NULL;
-
- ptr = g_malloc (byte_size);
- if (ptr != NULL)
- memcpy (ptr, mem, byte_size);
-
- return ptr;
-}
-
-gpointer g_realloc (gpointer obj, gsize size)
-{
- gpointer ptr;
- if (!size) {
- g_free (obj);
- return 0;
- }
- ptr = G_REALLOC_INTERNAL (obj, size);
- if (ptr)
- return ptr;
- g_error ("Could not allocate %i bytes", size);
-}
-
-gpointer
-g_malloc (gsize x)
-{
- gpointer ptr;
- if (!x)
- return 0;
- ptr = G_MALLOC_INTERNAL (x);
- if (ptr)
- return ptr;
- g_error ("Could not allocate %i bytes", x);
-}
-
-gpointer g_calloc (gsize n, gsize x)
-{
- gpointer ptr;
- if (!x || !n)
- return 0;
- ptr = G_CALLOC_INTERNAL (n, x);
- if (ptr)
- return ptr;
- g_error ("Could not allocate %i (%i * %i) bytes", x*n, n, x);
-}
-gpointer g_malloc0 (gsize x)
-{
- return g_calloc (1,x);
-}
-
-gpointer g_try_malloc (gsize x)
-{
- if (x)
- return G_MALLOC_INTERNAL (x);
- return 0;
-}
-
-
-gpointer g_try_realloc (gpointer obj, gsize size)
-{
- if (!size) {
- G_FREE_INTERNAL (obj);
- return 0;
- }
- return G_REALLOC_INTERNAL (obj, size);
-}
+++ /dev/null
-/*
- * gmisc.c: Misc functions with no place to go (right now)
- *
- * Author:
- * Aaron Bockover (abockover@novell.com)
- *
- * (C) 2006 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.
- */
-
-#include <config.h>
-#include <stdlib.h>
-#include <glib.h>
-#include <pthread.h>
-
-#ifdef HAVE_PWD_H
-#include <pwd.h>
-#endif
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-static pthread_mutex_t env_lock = PTHREAD_MUTEX_INITIALIZER;
-
-/* MONO Comment
- *
- * As per the UNIX spec,
- * "The return value from getenv() may point to static data which may be overwritten by subsequent calls to getenv(), setenv(), or unsetenv()."
- * Source: Unix Manual Pages for getenv, IEEE Std 1003.1
- *
- * This means that using pointers returned from getenv may (and does) lead to many
- * pointers which refer to the same piece of memory. When one is freed, all will be freed.
- *
- * This is unsafe and an ergonomics risk to fix in the callers. While the caller could lock,
- * this introduces the risk for looping or exiting while inside of a lock. For this reason,
- * g_getenv does not mimic the behavior of POSIX getenv anymore.
- *
- * The memory address returned will be unique to the invocaton, and must be freed.
- * */
-gchar *
-g_getenv (const gchar *variable)
-{
- gchar *ret = NULL;
- pthread_mutex_lock (&env_lock);
- gchar *res = getenv(variable);
- if (res)
- ret = g_strdup(res);
- pthread_mutex_unlock (&env_lock);
-
- return ret;
-}
-
-/*
- * This function checks if the given variable is non-NULL
- * in the environment. It's useful because it removes memory
- * freeing requirements.
- *
- */
-gboolean
-g_hasenv (const gchar *variable)
-{
- pthread_mutex_lock (&env_lock);
- gchar *res = getenv(variable);
- gboolean not_null = (res != NULL);
- pthread_mutex_unlock (&env_lock);
-
- return not_null;
-}
-
-gboolean
-g_setenv(const gchar *variable, const gchar *value, gboolean overwrite)
-{
- gboolean res;
- pthread_mutex_lock (&env_lock);
- res = (setenv(variable, value, overwrite) == 0);
- pthread_mutex_unlock (&env_lock);
- return res;
-}
-
-void
-g_unsetenv(const gchar *variable)
-{
- pthread_mutex_lock (&env_lock);
- unsetenv(variable);
- pthread_mutex_unlock (&env_lock);
-}
-
-gchar*
-g_win32_getlocale(void)
-{
- return NULL;
-}
-
-gboolean
-g_path_is_absolute (const char *filename)
-{
- g_return_val_if_fail (filename != NULL, FALSE);
-
- return (*filename == '/');
-}
-
-static pthread_mutex_t pw_lock = PTHREAD_MUTEX_INITIALIZER;
-static const gchar *home_dir;
-static const gchar *user_name;
-
-static void
-get_pw_data (void)
-{
-#ifdef HAVE_GETPWUID_R
- struct passwd pw;
- struct passwd *result;
- char buf [4096];
-#endif
-
- if (user_name != NULL)
- return;
-
- pthread_mutex_lock (&pw_lock);
- if (user_name != NULL) {
- pthread_mutex_unlock (&pw_lock);
- return;
- }
-
- home_dir = g_getenv ("HOME");
- user_name = g_getenv ("USER");
-
-#ifdef HAVE_GETPWUID_R
- if (home_dir == NULL || user_name == NULL) {
- if (getpwuid_r (getuid (), &pw, buf, 4096, &result) == 0) {
- if (home_dir == NULL)
- home_dir = g_strdup (pw.pw_dir);
- if (user_name == NULL)
- user_name = g_strdup (pw.pw_name);
- }
- }
-#endif
-
- if (user_name == NULL)
- user_name = "somebody";
- if (home_dir == NULL)
- home_dir = "/";
-
- pthread_mutex_unlock (&pw_lock);
-}
-
-const gchar *
-g_get_home_dir (void)
-{
- get_pw_data ();
- return home_dir;
-}
-
-const char *
-g_get_user_name (void)
-{
- get_pw_data ();
- return user_name;
-}
-
-static const char *tmp_dir;
-
-static pthread_mutex_t tmp_lock = PTHREAD_MUTEX_INITIALIZER;
-
-const gchar *
-g_get_tmp_dir (void)
-{
- if (tmp_dir == NULL){
- pthread_mutex_lock (&tmp_lock);
- if (tmp_dir == NULL){
- tmp_dir = g_getenv ("TMPDIR");
- if (tmp_dir == NULL){
- tmp_dir = g_getenv ("TMP");
- if (tmp_dir == NULL){
- tmp_dir = g_getenv ("TEMP");
- if (tmp_dir == NULL)
- tmp_dir = "/tmp";
- }
- }
- }
- pthread_mutex_unlock (&tmp_lock);
- }
- return tmp_dir;
-}
-
+++ /dev/null
-/*
- * gmisc-win32-uwp.c: UWP misc support.
- *
- * Copyright 2016 Microsoft
- * Licensed under the MIT license. See LICENSE file in the project root for full license information.
-*/
-#include <config.h>
-#include <glib.h>
-
-#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#include <windows.h>
-#include <assert.h>
-
-gchar*
-g_win32_getlocale(void)
-{
- gunichar2 buf[19];
- gint ccBuf = GetLocaleInfoEx (LOCALE_NAME_USER_DEFAULT, LOCALE_SISO639LANGNAME, buf, 9);
- assert (ccBuf <= 9);
- if (ccBuf != 0) {
- buf[ccBuf - 1] = L'-';
- ccBuf = GetLocaleInfoEx (LOCALE_NAME_USER_DEFAULT, LOCALE_SISO3166CTRYNAME, buf + ccBuf, 9);
- assert (ccBuf <= 9);
- }
-
- // Check for GetLocaleInfoEx failure.
- if (ccBuf == 0)
- buf[0] = L'\0';
-
- return u16to8 (buf);
-}
-
-#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
-
-#ifdef _MSC_VER
-// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
-void __mono_win32_gmisc_win32_uwp_quiet_lnk4221(void) {}
-#endif
-#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
+++ /dev/null
-/*
- * gmisc.c: Misc functions with no place to go (right now)
- *
- * Author:
- * Aaron Bockover (abockover@novell.com)
- *
- * (C) 2006 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.
- */
-
-#include <config.h>
-
-#include <stdlib.h>
-#include <glib.h>
-
-#include <windows.h>
-#if _MSC_VER && G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
-#include <shlobj.h>
-#endif
-#include <direct.h>
-#include <io.h>
-#include <assert.h>
-
-gboolean
-g_hasenv (const gchar *variable)
-{
- return g_getenv (variable) != NULL;
-}
-
-gchar *
-g_getenv(const gchar *variable)
-{
- gunichar2 *var, *buffer;
- gchar* val = NULL;
- gint32 buffer_size = 1024;
- gint32 retval;
- var = u8to16(variable);
- buffer = g_malloc(buffer_size*sizeof(gunichar2));
- retval = GetEnvironmentVariableW (var, buffer, buffer_size);
- if (retval != 0) {
- if (retval > buffer_size) {
- g_free (buffer);
- buffer_size = retval;
- buffer = g_malloc(buffer_size*sizeof(gunichar2));
- retval = GetEnvironmentVariableW (var, buffer, buffer_size);
- }
- val = u16to8 (buffer);
- } else {
- if (GetLastError () != ERROR_ENVVAR_NOT_FOUND){
- val = g_malloc (1);
- *val = 0;
- }
- }
- g_free(var);
- g_free(buffer);
- return val;
-}
-
-gboolean
-g_setenv(const gchar *variable, const gchar *value, gboolean overwrite)
-{
- gunichar2 *var, *val;
- gboolean result;
- var = u8to16(variable);
- val = u8to16(value);
- result = (SetEnvironmentVariableW(var, val) != 0) ? TRUE : FALSE;
- g_free(var);
- g_free(val);
- return result;
-}
-
-void
-g_unsetenv(const gchar *variable)
-{
- gunichar2 *var;
- var = u8to16(variable);
- SetEnvironmentVariableW(var, L"");
- g_free(var);
-}
-
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
-gchar*
-g_win32_getlocale(void)
-{
- LCID lcid = GetThreadLocale();
- gchar buf[19];
- gint ccBuf = GetLocaleInfoA(lcid, LOCALE_SISO639LANGNAME, buf, 9);
- buf[ccBuf - 1] = '-';
- ccBuf += GetLocaleInfoA(lcid, LOCALE_SISO3166CTRYNAME, buf + ccBuf, 9);
- return g_strdup (buf);
-}
-#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
-
-gboolean
-g_path_is_absolute (const char *filename)
-{
- g_return_val_if_fail (filename != NULL, FALSE);
-
- if (filename[0] != '\0' && filename[1] != '\0') {
- if (filename[1] == ':' && filename[2] != '\0' &&
- (filename[2] == '\\' || filename[2] == '/'))
- return TRUE;
- /* UNC paths */
- else if (filename[0] == '\\' && filename[1] == '\\' &&
- filename[2] != '\0')
- return TRUE;
- }
-
- return FALSE;
-}
-
-#if _MSC_VER && G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
-static gchar*
-g_get_known_folder_path (void)
-{
- gchar *folder_path = NULL;
- PWSTR profile_path = NULL;
- HRESULT hr = SHGetKnownFolderPath (&FOLDERID_Profile, KF_FLAG_DEFAULT, NULL, &profile_path);
- if (SUCCEEDED(hr)) {
- folder_path = u16to8 (profile_path);
- CoTaskMemFree (profile_path);
- }
-
- return folder_path;
-}
-
-#else
-
-static inline gchar *
-g_get_known_folder_path (void)
-{
- return NULL;
-}
-#endif
-
-const gchar *
-g_get_home_dir (void)
-{
- gchar *home_dir = g_get_known_folder_path ();
-
- if (!home_dir) {
- home_dir = (gchar *) g_getenv ("USERPROFILE");
- }
-
- if (!home_dir) {
- const gchar *drive = g_getenv ("HOMEDRIVE");
- const gchar *path = g_getenv ("HOMEPATH");
-
- if (drive && path) {
- home_dir = g_malloc (strlen (drive) + strlen (path) + 1);
- if (home_dir) {
- sprintf (home_dir, "%s%s", drive, path);
- }
- }
- g_free (drive);
- g_free (path);
- }
-
- return home_dir;
-}
-
-const char *
-g_get_user_name (void)
-{
- const char * retName = g_getenv ("USER");
- if (!retName)
- retName = g_getenv ("USERNAME");
- return retName;
-}
-
-static const char *tmp_dir;
-
-const gchar *
-g_get_tmp_dir (void)
-{
- if (tmp_dir == NULL){
- if (tmp_dir == NULL){
- tmp_dir = g_getenv ("TMPDIR");
- if (tmp_dir == NULL){
- tmp_dir = g_getenv ("TMP");
- if (tmp_dir == NULL){
- tmp_dir = g_getenv ("TEMP");
- if (tmp_dir == NULL)
- tmp_dir = "C:\\temp";
- }
- }
- }
- }
- return tmp_dir;
-}
+++ /dev/null
-/*
- * gmodule.c: dl* functions, glib style
- *
- * Author:
- * Gonzalo Paniagua Javier (gonzalo@novell.com)
- * Jonathan Chambers (joncham@gmail.com)
- * Robert Jordan (robertj@gmx.net)
- *
- * (C) 2006 Novell, Inc.
- * (C) 2006 Jonathan Chambers
- *
- * 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.
- */
-#include <config.h>
-
-#include <glib.h>
-#include <gmodule.h>
-
-#if defined(G_OS_UNIX) && defined(HAVE_DLFCN_H)
-#include <dlfcn.h>
-
-/* For Linux and Solaris, need to add others as we port this */
-#define LIBPREFIX "lib"
-#define LIBSUFFIX ".so"
-
-struct _GModule {
- void *handle;
-};
-
-GModule *
-g_module_open (const gchar *file, GModuleFlags flags)
-{
- int f = 0;
- GModule *module;
- void *handle;
-
- flags &= G_MODULE_BIND_MASK;
- if ((flags & G_MODULE_BIND_LAZY) != 0)
- f |= RTLD_LAZY;
- if ((flags & G_MODULE_BIND_LOCAL) != 0)
- f |= RTLD_LOCAL;
-
- handle = dlopen (file, f);
- if (handle == NULL)
- return NULL;
-
- module = g_new (GModule,1);
- module->handle = handle;
-
- return module;
-}
-
-gboolean
-g_module_symbol (GModule *module, const gchar *symbol_name, gpointer *symbol)
-{
- if (symbol_name == NULL || symbol == NULL)
- return FALSE;
-
- if (module == NULL || module->handle == NULL)
- return FALSE;
-
- *symbol = dlsym (module->handle, symbol_name);
- return (*symbol != NULL);
-}
-
-const gchar *
-g_module_error (void)
-{
- return dlerror ();
-}
-
-gboolean
-g_module_close (GModule *module)
-{
- void *handle;
- if (module == NULL || module->handle == NULL)
- return FALSE;
-
- handle = module->handle;
- module->handle = NULL;
- g_free (module);
- return (0 == dlclose (handle));
-}
-
-#elif defined (G_OS_WIN32)
-#include <windows.h>
-#include <psapi.h>
-
-#define LIBSUFFIX ".dll"
-#define LIBPREFIX ""
-
-struct _GModule {
- HMODULE handle;
- int main_module;
-};
-
-GModule *
-g_module_open (const gchar *file, GModuleFlags flags)
-{
- GModule *module;
- module = g_malloc (sizeof (GModule));
- if (module == NULL)
- return NULL;
-
- if (file != NULL) {
- gunichar2 *file16;
- file16 = u8to16(file);
- module->main_module = FALSE;
- module->handle = LoadLibrary (file16);
- g_free(file16);
- if (!module->handle) {
- g_free (module);
- return NULL;
- }
-
- } else {
- module->main_module = TRUE;
- module->handle = GetModuleHandle (NULL);
- }
-
- return module;
-}
-
-static gpointer
-w32_find_symbol (const gchar *symbol_name)
-{
- HMODULE *modules;
- DWORD buffer_size = sizeof (HMODULE) * 1024;
- DWORD needed, i;
-
- modules = (HMODULE *) g_malloc (buffer_size);
-
- if (modules == NULL)
- return NULL;
-
- if (!EnumProcessModules (GetCurrentProcess (), modules,
- buffer_size, &needed)) {
- g_free (modules);
- return NULL;
- }
-
- /* check whether the supplied buffer was too small, realloc, retry */
- if (needed > buffer_size) {
- g_free (modules);
-
- buffer_size = needed;
- modules = (HMODULE *) g_malloc (buffer_size);
-
- if (modules == NULL)
- return NULL;
-
- if (!EnumProcessModules (GetCurrentProcess (), modules,
- buffer_size, &needed)) {
- g_free (modules);
- return NULL;
- }
- }
-
- for (i = 0; i < needed / sizeof (HANDLE); i++) {
- gpointer proc = (gpointer)(intptr_t)GetProcAddress (modules [i], symbol_name);
- if (proc != NULL) {
- g_free (modules);
- return proc;
- }
- }
-
- g_free (modules);
- return NULL;
-}
-
-gboolean
-g_module_symbol (GModule *module, const gchar *symbol_name, gpointer *symbol)
-{
- if (module == NULL || symbol_name == NULL || symbol == NULL)
- return FALSE;
-
- if (module->main_module) {
- *symbol = (gpointer)(intptr_t)GetProcAddress (module->handle, symbol_name);
- if (*symbol != NULL)
- return TRUE;
-
- *symbol = w32_find_symbol (symbol_name);
- return *symbol != NULL;
- } else {
- *symbol = (gpointer)(intptr_t)GetProcAddress (module->handle, symbol_name);
- return *symbol != NULL;
- }
-}
-
-const gchar *
-g_module_error (void)
-{
- gchar* ret = NULL;
- TCHAR* buf = NULL;
- DWORD code = GetLastError ();
-
- FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL,
- code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buf, 0, NULL);
-
- ret = u16to8 (buf);
- LocalFree(buf);
-
- return ret;
-}
-
-gboolean
-g_module_close (GModule *module)
-{
- HMODULE handle;
- int main_module;
-
- if (module == NULL || module->handle == NULL)
- return FALSE;
-
- handle = module->handle;
- main_module = module->main_module;
- module->handle = NULL;
- g_free (module);
- return (main_module ? 1 : (0 == FreeLibrary (handle)));
-}
-
-#else
-
-#define LIBSUFFIX ""
-#define LIBPREFIX ""
-
-GModule *
-g_module_open (const gchar *file, GModuleFlags flags)
-{
- g_error ("%s", "g_module_open not implemented on this platform");
- return NULL;
-}
-
-gboolean
-g_module_symbol (GModule *module, const gchar *symbol_name, gpointer *symbol)
-{
- g_error ("%s", "g_module_open not implemented on this platform");
- return FALSE;
-}
-
-const gchar *
-g_module_error (void)
-{
- g_error ("%s", "g_module_open not implemented on this platform");
- return NULL;
-}
-
-gboolean
-g_module_close (GModule *module)
-{
- g_error ("%s", "g_module_open not implemented on this platform");
- return FALSE;
-}
-#endif
-
-gchar *
-g_module_build_path (const gchar *directory, const gchar *module_name)
-{
- char *lib_prefix = "";
-
- if (module_name == NULL)
- return NULL;
-
- if (strncmp (module_name, "lib", 3) != 0)
- lib_prefix = LIBPREFIX;
-
- if (directory && *directory){
-
- return g_strdup_printf ("%s/%s%s" LIBSUFFIX, directory, lib_prefix, module_name);
- }
- return g_strdup_printf ("%s%s" LIBSUFFIX, lib_prefix, module_name);
-}
-
+++ /dev/null
-#ifndef __G_MODULE_WINDOWS_INTERNALS_H__
-#define __G_MODULE_WINDOWS_INTERNALS_H__
-
-#include <config.h>
-#include <glib.h>
-
-#ifdef G_OS_WIN32
-#include <gmodule.h>
-
-gpointer
-w32_find_symbol (const gchar *symbol_name);
-#endif /* G_OS_WIN32 */
-#endif /* __G_MODULE_WINDOWS_INTERNALS_H__ */
+++ /dev/null
-/*
- * gmodule-win32-uwp.c: UWP gmodule support.
- *
- * Copyright 2016 Microsoft
- * Licensed under the MIT license. See LICENSE file in the project root for full license information.
-*/
-#include <config.h>
-#include <glib.h>
-
-#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#include <windows.h>
-#include <gmodule-win32-internals.h>
-
-gpointer
-w32_find_symbol (const gchar *symbol_name)
-{
- g_unsupported_api ("EnumProcessModules");
- SetLastError (ERROR_NOT_SUPPORTED);
- return NULL;
-}
-
-const gchar *
-g_module_error (void)
-{
- gchar *ret = NULL;
- TCHAR buf [1024];
- DWORD code = GetLastError ();
-
- if (!FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
- code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buf, G_N_ELEMENTS (buf) - 1, NULL) )
- buf[0] = TEXT('\0');
-
- ret = u16to8 (buf);
- return ret;
-}
-
-#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
-
-#ifdef _MSC_VER
-// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
-void __mono_win32_gmodule_win32_uwp_quiet_lnk4221(void) {}
-#endif
-#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
+++ /dev/null
-/*
- * gmodule.c: dl* functions, glib style
- *
- * Author:
- * Gonzalo Paniagua Javier (gonzalo@novell.com)
- * Jonathan Chambers (joncham@gmail.com)
- * Robert Jordan (robertj@gmx.net)
- *
- * (C) 2006 Novell, Inc.
- * (C) 2006 Jonathan Chambers
- *
- * 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.
- */
-#include <config.h>
-#include <glib.h>
-#include <windows.h>
-#include <psapi.h>
-#include <gmodule-win32-internals.h>
-
-#define LIBSUFFIX ".dll"
-#define LIBPREFIX ""
-
-struct _GModule {
- HMODULE handle;
- int main_module;
-};
-
-GModule *
-g_module_open (const gchar *file, GModuleFlags flags)
-{
- GModule *module;
- module = g_malloc (sizeof (GModule));
- if (module == NULL)
- return NULL;
-
- if (file != NULL) {
- gunichar2 *file16;
- file16 = u8to16(file);
- module->main_module = FALSE;
- module->handle = LoadLibraryW (file16);
- g_free(file16);
- if (!module->handle) {
- g_free (module);
- return NULL;
- }
-
- } else {
- module->main_module = TRUE;
- module->handle = GetModuleHandle (NULL);
- }
-
- return module;
-}
-
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
-gpointer
-w32_find_symbol (const gchar *symbol_name)
-{
- HMODULE *modules;
- DWORD buffer_size = sizeof (HMODULE) * 1024;
- DWORD needed, i;
-
- modules = (HMODULE *) g_malloc (buffer_size);
-
- if (modules == NULL)
- return NULL;
-
- if (!EnumProcessModules (GetCurrentProcess (), modules,
- buffer_size, &needed)) {
- g_free (modules);
- return NULL;
- }
-
- /* check whether the supplied buffer was too small, realloc, retry */
- if (needed > buffer_size) {
- g_free (modules);
-
- buffer_size = needed;
- modules = (HMODULE *) g_malloc (buffer_size);
-
- if (modules == NULL)
- return NULL;
-
- if (!EnumProcessModules (GetCurrentProcess (), modules,
- buffer_size, &needed)) {
- g_free (modules);
- return NULL;
- }
- }
-
- for (i = 0; i < needed / sizeof (HANDLE); i++) {
- gpointer proc = (gpointer)(intptr_t)GetProcAddress (modules [i], symbol_name);
- if (proc != NULL) {
- g_free (modules);
- return proc;
- }
- }
-
- g_free (modules);
- return NULL;
-}
-#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
-
-gboolean
-g_module_symbol (GModule *module, const gchar *symbol_name, gpointer *symbol)
-{
- if (module == NULL || symbol_name == NULL || symbol == NULL)
- return FALSE;
-
- if (module->main_module) {
- *symbol = (gpointer)(intptr_t)GetProcAddress (module->handle, symbol_name);
- if (*symbol != NULL)
- return TRUE;
-
- *symbol = w32_find_symbol (symbol_name);
- return *symbol != NULL;
- } else {
- *symbol = (gpointer)(intptr_t)GetProcAddress (module->handle, symbol_name);
- return *symbol != NULL;
- }
-}
-
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
-const gchar *
-g_module_error (void)
-{
- gchar* ret = NULL;
- TCHAR* buf = NULL;
- DWORD code = GetLastError ();
-
- /* FIXME: buf must not be NULL! */
- FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL,
- code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buf, 0, NULL);
-
- ret = u16to8 (buf);
- LocalFree(buf);
-
- return ret;
-}
-#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
-
-gboolean
-g_module_close (GModule *module)
-{
- HMODULE handle;
- int main_module;
-
- if (module == NULL || module->handle == NULL)
- return FALSE;
-
- handle = module->handle;
- main_module = module->main_module;
- module->handle = NULL;
- g_free (module);
- return (main_module ? 1 : (0 == FreeLibrary (handle)));
-}
-
-gchar *
-g_module_build_path (const gchar *directory, const gchar *module_name)
-{
- char *lib_prefix = "";
-
- if (module_name == NULL)
- return NULL;
-
- if (strncmp (module_name, "lib", 3) != 0)
- lib_prefix = LIBPREFIX;
-
- if (directory && *directory){
-
- return g_strdup_printf ("%s/%s%s" LIBSUFFIX, directory, lib_prefix, module_name);
- }
- return g_strdup_printf ("%s%s" LIBSUFFIX, lib_prefix, module_name);
-}
+++ /dev/null
-#ifndef __GLIB_GMODULE_H
-#define __GLIB_GMODULE_H
-
-#include <glib.h>
-
-#define G_MODULE_IMPORT extern
-#ifdef G_OS_WIN32
-#define G_MODULE_EXPORT __declspec(dllexport)
-#else
-#define G_MODULE_EXPORT
-#endif
-
-G_BEGIN_DECLS
-
-/*
- * Modules
- */
-typedef enum {
- G_MODULE_BIND_LAZY = 0x01,
- G_MODULE_BIND_LOCAL = 0x02,
- G_MODULE_BIND_MASK = 0x03
-} GModuleFlags;
-typedef struct _GModule GModule;
-
-GModule *g_module_open (const gchar *file, GModuleFlags flags);
-gboolean g_module_symbol (GModule *module, const gchar *symbol_name,
- gpointer *symbol);
-const gchar *g_module_error (void);
-gboolean g_module_close (GModule *module);
-gchar * g_module_build_path (const gchar *directory, const gchar *module_name);
-
-extern char *gmodule_libprefix;
-extern char *gmodule_libsuffix;
-
-G_END_DECLS
-
-#endif
+++ /dev/null
-/*
- * Output and debugging functions
- *
- * Author:
- * Miguel de Icaza (miguel@novell.com)
- *
- * (C) 2006 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.
- */
-#include <config.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <glib.h>
-
-/* The current fatal levels, error is always fatal */
-static GLogLevelFlags fatal = G_LOG_LEVEL_ERROR;
-static GLogFunc default_log_func;
-static gpointer default_log_func_user_data;
-static GPrintFunc stdout_handler, stderr_handler;
-
-static void default_stdout_handler (const gchar *string);
-static void default_stderr_handler (const gchar *string);
-
-void
-g_print (const gchar *format, ...)
-{
- char *msg;
- va_list args;
-
- va_start (args, format);
- if (g_vasprintf (&msg, format, args) < 0) {
- va_end (args);
- return;
- }
- va_end (args);
-
- if (!stdout_handler)
- stdout_handler = default_stdout_handler;
-
- stdout_handler (msg);
- g_free (msg);
-}
-
-void
-g_printerr (const gchar *format, ...)
-{
- char *msg;
- va_list args;
-
- va_start (args, format);
- if (g_vasprintf (&msg, format, args) < 0) {
- va_end (args);
- return;
- }
- va_end (args);
-
- if (!stderr_handler)
- stderr_handler = default_stderr_handler;
-
- stderr_handler (msg);
- g_free (msg);
-}
-
-GLogLevelFlags
-g_log_set_always_fatal (GLogLevelFlags fatal_mask)
-{
- GLogLevelFlags old_fatal = fatal;
-
- fatal |= fatal_mask;
-
- return old_fatal;
-}
-
-GLogLevelFlags
-g_log_set_fatal_mask (const gchar *log_domain, GLogLevelFlags fatal_mask)
-{
- /*
- * Mono does not use a G_LOG_DOMAIN currently, so we just assume things are fatal
- * if we decide to set G_LOG_DOMAIN (we probably should) we should implement
- * this.
- */
- return fatal_mask;
-}
-
-void
-g_logv (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, va_list args)
-{
- char *msg;
-
- if (!default_log_func)
- default_log_func = g_log_default_handler;
-
- if (g_vasprintf (&msg, format, args) < 0)
- return;
-
- default_log_func (log_domain, log_level, msg, default_log_func_user_data);
- g_free (msg);
-}
-
-void
-g_log (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, ...)
-{
- va_list args;
-
- va_start (args, format);
- g_logv (log_domain, log_level, format, args);
- va_end (args);
-}
-
-void
-g_assertion_message (const gchar *format, ...)
-{
- va_list args;
-
- va_start (args, format);
- g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format, args);
- va_end (args);
- exit (0);
-}
-
-
-#if PLATFORM_ANDROID
-#include <android/log.h>
-
-static android_LogPriority
-to_android_priority (GLogLevelFlags log_level)
-{
- switch (log_level & G_LOG_LEVEL_MASK)
- {
- case G_LOG_LEVEL_ERROR: return ANDROID_LOG_FATAL;
- case G_LOG_LEVEL_CRITICAL: return ANDROID_LOG_ERROR;
- case G_LOG_LEVEL_WARNING: return ANDROID_LOG_WARN;
- case G_LOG_LEVEL_MESSAGE: return ANDROID_LOG_INFO;
- case G_LOG_LEVEL_INFO: return ANDROID_LOG_DEBUG;
- case G_LOG_LEVEL_DEBUG: return ANDROID_LOG_VERBOSE;
- }
- return ANDROID_LOG_UNKNOWN;
-}
-
-void
-g_log_default_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer unused_data)
-{
- __android_log_write (to_android_priority (log_level), log_domain, message);
- if (log_level & fatal)
- abort ();
-}
-
-static void
-default_stdout_handler (const gchar *message)
-{
- /* TODO: provide a proper app name */
- __android_log_write (ANDROID_LOG_ERROR, "mono", message);
-}
-
-static void
-default_stderr_handler (const gchar *message)
-{
- /* TODO: provide a proper app name */
- __android_log_write (ANDROID_LOG_ERROR, "mono", message);
-}
-
-
-#elif defined(HOST_IOS)
-#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;
-}
-
-void
-g_log_default_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer unused_data)
-{
- asl_log (NULL, NULL, to_asl_priority (log_level), "%s", message);
- if (log_level & fatal)
- abort ();
-}
-
-static void
-default_stdout_handler (const gchar *message)
-{
- asl_log (NULL, NULL, ASL_LEVEL_WARNING, "%s", message);
-}
-
-static void
-default_stderr_handler (const gchar *message)
-{
- asl_log (NULL, NULL, ASL_LEVEL_WARNING, "%s", message);
-}
-
-#else
-
-void
-g_log_default_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer unused_data)
-{
- FILE *target = stdout;
-
- fprintf (target, "%s%s%s\n",
- log_domain != NULL ? log_domain : "",
- log_domain != NULL ? ": " : "",
- message);
-
- if (log_level & fatal) {
- fflush (stdout);
- fflush (stderr);
- abort ();
- }
-}
-
-static void
-default_stdout_handler (const gchar *string)
-{
- fprintf (stdout, "%s", string);
-}
-
-static void
-default_stderr_handler (const gchar *string)
-{
- fprintf (stderr, "%s", string);
-}
-
-#endif
-
-GLogFunc
-g_log_set_default_handler (GLogFunc log_func, gpointer user_data)
-{
- GLogFunc old = default_log_func;
- default_log_func = log_func;
- default_log_func_user_data = user_data;
- return old;
-}
-
-GPrintFunc
-g_set_print_handler (GPrintFunc func)
-{
- GPrintFunc old = stdout_handler;
- stdout_handler = func;
- return old;
-}
-
-GPrintFunc
-g_set_printerr_handler (GPrintFunc func)
-{
- GPrintFunc old = stderr_handler;
- stderr_handler = func;
- return old;
-}
-
+++ /dev/null
-/*
- * Portable Utility Functions
- *
- * Author:
- * Miguel de Icaza (miguel@novell.com)
- *
- * (C) 2006 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.
- */
-#include <config.h>
-#include <stdio.h>
-#include <glib.h>
-#include <errno.h>
-#include <sys/stat.h>
-
-#ifdef G_OS_WIN32
-#include <direct.h>
-#endif
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-gchar *
-g_build_path (const gchar *separator, const gchar *first_element, ...)
-{
- const char *elem, *next, *endptr;
- gboolean trimmed;
- GString *path;
- va_list args;
- size_t slen;
-
- g_return_val_if_fail (separator != NULL, NULL);
-
- path = g_string_sized_new (48);
- slen = strlen (separator);
-
- va_start (args, first_element);
- for (elem = first_element; elem != NULL; elem = next) {
- /* trim any trailing separators from @elem */
- endptr = elem + strlen (elem);
- trimmed = FALSE;
-
- while (endptr >= elem + slen) {
- if (strncmp (endptr - slen, separator, slen) != 0)
- break;
-
- endptr -= slen;
- trimmed = TRUE;
- }
-
- /* append elem, not including any trailing separators */
- if (endptr > elem)
- g_string_append_len (path, elem, endptr - elem);
-
- /* get the next element */
- do {
- if (!(next = va_arg (args, char *)))
- break;
-
- /* remove leading separators */
- while (!strncmp (next, separator, slen))
- next += slen;
- } while (*next == '\0');
-
- if (next || trimmed)
- g_string_append_len (path, separator, slen);
- }
- va_end (args);
-
- return g_string_free (path, FALSE);
-}
-
-static gchar*
-strrchr_seperator (const gchar* filename)
-{
-#ifdef G_OS_WIN32
- char *p2;
-#endif
- char *p;
-
- p = strrchr (filename, G_DIR_SEPARATOR);
-#ifdef G_OS_WIN32
- p2 = strrchr (filename, '/');
- if (p2 > p)
- p = p2;
-#endif
-
- return p;
-}
-
-gchar *
-g_path_get_dirname (const gchar *filename)
-{
- char *p, *r;
- size_t count;
- g_return_val_if_fail (filename != NULL, NULL);
-
- p = strrchr_seperator (filename);
- if (p == NULL)
- return g_strdup (".");
- if (p == filename)
- return g_strdup ("/");
- count = p - filename;
- r = g_malloc (count + 1);
- strncpy (r, filename, count);
- r [count] = 0;
-
- return r;
-}
-
-gchar *
-g_path_get_basename (const char *filename)
-{
- char *r;
- g_return_val_if_fail (filename != NULL, NULL);
-
- /* Empty filename -> . */
- if (!*filename)
- return g_strdup (".");
-
- /* No separator -> filename */
- r = strrchr_seperator (filename);
- if (r == NULL)
- return g_strdup (filename);
-
- /* Trailing slash, remove component */
- if (r [1] == 0){
- char *copy = g_strdup (filename);
- copy [r-filename] = 0;
- r = strrchr_seperator (copy);
-
- if (r == NULL){
- g_free (copy);
- return g_strdup ("/");
- }
- r = g_strdup (&r[1]);
- g_free (copy);
- return r;
- }
-
- return g_strdup (&r[1]);
-}
-
-#ifndef HAVE_STRTOK_R
-// This is from BSD's strtok_r
-
-char *
-strtok_r(char *s, const char *delim, char **last)
-{
- char *spanp;
- int c, sc;
- char *tok;
-
- if (s == NULL && (s = *last) == NULL)
- return NULL;
-
- /*
- * Skip (span) leading delimiters (s += strspn(s, delim), sort of).
- */
-cont:
- c = *s++;
- for (spanp = (char *)delim; (sc = *spanp++) != 0; ){
- if (c == sc)
- goto cont;
- }
-
- if (c == 0){ /* no non-delimiter characters */
- *last = NULL;
- return NULL;
- }
- tok = s - 1;
-
- /*
- * Scan token (scan for delimiters: s += strcspn(s, delim), sort of).
- * Note that delim must have one NUL; we stop if we see that, too.
- */
- for (;;){
- c = *s++;
- spanp = (char *)delim;
- do {
- if ((sc = *spanp++) == c) {
- if (c == 0)
- s = NULL;
- else {
- char *w = s - 1;
- *w = '\0';
- }
- *last = s;
- return tok;
- }
- }
- while (sc != 0);
- }
- /* NOTREACHED */
-}
-#endif
-
-gchar *
-g_find_program_in_path (const gchar *program)
-{
- char *p;
- char *x, *l;
- gchar *curdir = NULL;
- char *save = NULL;
-#ifdef G_OS_WIN32
- char *program_exe;
- char *suffix_list[5] = {".exe",".cmd",".bat",".com",NULL};
- int listx;
- gboolean hasSuffix;
-#endif
-
- g_return_val_if_fail (program != NULL, NULL);
- x = p = g_strdup (g_getenv ("PATH"));
-
- if (x == NULL || *x == '\0') {
- curdir = g_get_current_dir ();
- x = curdir;
- }
-
-#ifdef G_OS_WIN32
- /* see if program already has a suffix */
- listx = 0;
- hasSuffix = FALSE;
- while (!hasSuffix && suffix_list[listx]) {
- hasSuffix = g_str_has_suffix(program,suffix_list[listx++]);
- }
-#endif
-
- while ((l = strtok_r (x, G_SEARCHPATH_SEPARATOR_S, &save)) != NULL){
- char *probe_path;
-
- x = NULL;
- probe_path = g_build_path (G_DIR_SEPARATOR_S, l, program, NULL);
- if (access (probe_path, X_OK) == 0){ /* FIXME: on windows this is just a read permissions test */
- g_free (curdir);
- g_free (p);
- return probe_path;
- }
- g_free (probe_path);
-
-#ifdef G_OS_WIN32
- /* check for program with a suffix attached */
- if (!hasSuffix) {
- listx = 0;
- while (suffix_list[listx]) {
- program_exe = g_strjoin(NULL,program,suffix_list[listx],NULL);
- probe_path = g_build_path (G_DIR_SEPARATOR_S, l, program_exe, NULL);
- if (access (probe_path, X_OK) == 0){ /* FIXME: on windows this is just a read permissions test */
- g_free (curdir);
- g_free (p);
- g_free (program_exe);
- return probe_path;
- }
- listx++;
- g_free (probe_path);
- g_free (program_exe);
- }
- }
-#endif
- }
- g_free (curdir);
- g_free (p);
- return NULL;
-}
-
-static char *name;
-
-void
-g_set_prgname (const gchar *prgname)
-{
- name = g_strdup (prgname);
-}
-
-gchar *
-g_get_prgname (void)
-{
- return name;
-}
-
-gboolean
-g_ensure_directory_exists (const gchar *filename)
-{
-#ifdef G_OS_WIN32
- gchar *dir_utf8 = g_path_get_dirname (filename);
- gunichar2 *p;
- gunichar2 *dir_utf16 = NULL;
- int retval;
-
- if (!dir_utf8 || !dir_utf8 [0])
- return FALSE;
-
- dir_utf16 = g_utf8_to_utf16 (dir_utf8, strlen (dir_utf8), NULL, NULL, NULL);
- g_free (dir_utf8);
-
- if (!dir_utf16)
- return FALSE;
-
- p = dir_utf16;
-
- /* make life easy and only use one directory seperator */
- while (*p != '\0')
- {
- if (*p == '/')
- *p = '\\';
- p++;
- }
-
- p = dir_utf16;
-
- /* get past C:\ )*/
- while (*p++ != '\\')
- {
- }
-
- while (1) {
- gboolean bRet = FALSE;
- p = wcschr (p, '\\');
- if (p)
- *p = '\0';
- retval = _wmkdir (dir_utf16);
- if (retval != 0 && errno != EEXIST) {
- g_free (dir_utf16);
- return FALSE;
- }
- if (!p)
- break;
- *p++ = '\\';
- }
-
- g_free (dir_utf16);
- return TRUE;
-#else
- char *p;
- gchar *dir = g_path_get_dirname (filename);
- int retval;
- struct stat sbuf;
-
- if (!dir || !dir [0]) {
- g_free (dir);
- return FALSE;
- }
-
- if (stat (dir, &sbuf) == 0 && S_ISDIR (sbuf.st_mode)) {
- g_free (dir);
- return TRUE;
- }
-
- p = dir;
- while (*p == '/')
- p++;
-
- while (1) {
- p = strchr (p, '/');
- if (p)
- *p = '\0';
- retval = mkdir (dir, 0777);
- if (retval != 0 && errno != EEXIST) {
- g_free (dir);
- return FALSE;
- }
- if (!p)
- break;
- *p++ = '/';
- }
-
- g_free (dir);
- return TRUE;
-#endif
-}
-
+++ /dev/null
-/*
- * Simple pattern matching
- *
- * Author:
- * Gonzalo Paniagua Javier (gonzalo@novell.com
- *
- * (C) 2006 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.
- */
-#include <glib.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#ifndef _MSC_VER
-#include <unistd.h>
-#endif
-
-typedef enum {
- MATCH_LITERAL,
- MATCH_ANYCHAR,
- MATCH_ANYTHING,
- MATCH_ANYTHING_END,
- MATCH_INVALID = -1
-} MatchType;
-
-typedef struct {
- MatchType type;
- gchar *str;
-} PData;
-
-struct _GPatternSpec {
- GSList *pattern;
-};
-
-static GSList *
-compile_pattern (const gchar *pattern)
-{
- GSList *list;
- size_t i, len;
- PData *data;
- gchar c;
- MatchType last = MATCH_INVALID;
- GString *str;
- gboolean free_str;
-
- if (pattern == NULL)
- return NULL;
-
- data = NULL;
- list = NULL;
- free_str = TRUE;
- str = g_string_new ("");
- for (i = 0, len = strlen (pattern); i < len; i++) {
- c = pattern [i];
- if (c == '*' || c == '?') {
- if (str->len > 0) {
- data = g_new0 (PData, 1);
- data->type = MATCH_LITERAL;
- data->str = g_string_free (str, FALSE);
- list = g_slist_append (list, data);
- str = g_string_new ("");
- }
-
- if (last == MATCH_ANYTHING && c == '*')
- continue;
-
- data = g_new0 (PData, 1);
- data->type = (c == '*') ? MATCH_ANYTHING : MATCH_ANYCHAR;
- list = g_slist_append (list, data);
- last = data->type;
- } else {
- g_string_append_c (str, c);
- last = MATCH_LITERAL;
- }
- }
-
- if (last == MATCH_ANYTHING && str->len == 0) {
- data->type = MATCH_ANYTHING_END;
- free_str = TRUE;
- } else if (str->len > 0) {
- data = g_new0 (PData, 1);
- data->type = MATCH_LITERAL;
- data->str = str->str;
- free_str = FALSE;
- list = g_slist_append (list, data);
- }
- g_string_free (str, free_str);
- return list;
-}
-
-#ifdef DEBUG_PATTERN
-static void
-print_pattern (gpointer data, gpointer user_data)
-{
- PData *d = (PData *) data;
-
- printf ("Type: %s", d->type == MATCH_LITERAL ? "literal" : d->type == MATCH_ANYCHAR ? "any char" : "anything");
- if (d->type == MATCH_LITERAL)
- printf (" String: %s", d->str);
- printf ("\n");
-}
-#endif
-
-GPatternSpec *
-g_pattern_spec_new (const gchar *pattern)
-{
- GPatternSpec *spec;
-
- g_return_val_if_fail (pattern != NULL, NULL);
- spec = g_new0 (GPatternSpec, 1);
- if (pattern) {
- spec->pattern = compile_pattern (pattern);
-#ifdef DEBUG_PATTERN
- g_slist_foreach (spec->pattern, print_pattern, NULL);
- printf ("\n");
-#endif
- }
- return spec;
-}
-
-static void
-free_pdata (gpointer data, gpointer user_data)
-{
- PData *d = (PData *) data;
-
- if (d->str)
- g_free (d->str);
- g_free (d);
-}
-
-void
-g_pattern_spec_free (GPatternSpec *pspec)
-{
- if (pspec) {
- g_slist_foreach (pspec->pattern, free_pdata, NULL);
- g_slist_free (pspec->pattern);
- pspec->pattern = NULL;
- }
- g_free (pspec);
-}
-
-static gboolean
-match_string (GSList *list, const gchar *str, size_t idx, size_t max)
-{
- size_t len;
-
- while (list && idx < max) {
- PData *data = (PData *) list->data;
-
- if (data->type == MATCH_ANYTHING_END)
- return TRUE;
-
- if (data->type == MATCH_LITERAL) {
- len = strlen (data->str);
- if (strncmp (&str [idx], data->str, len) != 0)
- return FALSE;
- idx += len;
- list = list->next;
- if (list) {
- /*
- * When recursing, we need this to avoid returning FALSE
- * because 'list' will not be NULL
- */
- data = (PData *) list->data;
- if (data->type == MATCH_ANYTHING_END)
- return TRUE;
- }
- } else if (data->type == MATCH_ANYCHAR) {
- idx++;
- list = list->next;
- } else if (data->type == MATCH_ANYTHING) {
- while (idx < max) {
- if (match_string (list->next, str, idx++, max))
- return TRUE;
- }
- return FALSE;
- } else {
- g_assert_not_reached ();
- }
- }
-
- return (list == NULL && idx >= max);
-}
-gboolean
-g_pattern_match_string (GPatternSpec *pspec, const gchar *string)
-{
- g_return_val_if_fail (pspec != NULL, FALSE);
- g_return_val_if_fail (string != NULL, FALSE);
-
- if (pspec->pattern == NULL)
- return FALSE;
- return match_string (pspec->pattern, string, 0, strlen (string));
-}
-
-
+++ /dev/null
-/*
- * Pointer Array
- *
- * Author:
- * Aaron Bockover (abockover@novell.com)
- * Gonzalo Paniagua Javier (gonzalo@novell.com)
- * Jeffrey Stedfast (fejj@novell.com)
- *
- * (C) 2006,2011 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.
- */
-
-#include <stdlib.h>
-#include <glib.h>
-
-typedef struct _GPtrArrayPriv {
- gpointer *pdata;
- guint len;
- guint size;
-} GPtrArrayPriv;
-
-static void
-g_ptr_array_grow(GPtrArrayPriv *array, guint length)
-{
- guint new_length = array->len + length;
-
- g_return_if_fail(array != NULL);
-
- if(new_length <= array->size) {
- return;
- }
-
- array->size = 1;
-
- while(array->size < new_length) {
- array->size <<= 1;
- }
-
- array->size = MAX(array->size, 16);
- array->pdata = g_realloc(array->pdata, array->size * sizeof(gpointer));
-}
-
-GPtrArray *
-g_ptr_array_new(void)
-{
- return g_ptr_array_sized_new(0);
-}
-
-GPtrArray *
-g_ptr_array_sized_new(guint reserved_size)
-{
- GPtrArrayPriv *array = g_new0(GPtrArrayPriv, 1);
-
- array->pdata = NULL;
- array->len = 0;
- array->size = 0;
-
- if(reserved_size > 0) {
- g_ptr_array_grow(array, reserved_size);
- }
-
- return (GPtrArray *)array;
-}
-
-gpointer *
-g_ptr_array_free(GPtrArray *array, gboolean free_seg)
-{
- gpointer *data = NULL;
-
- g_return_val_if_fail(array != NULL, NULL);
-
- if(free_seg) {
- g_free(array->pdata);
- } else {
- data = array->pdata;
- }
-
- g_free(array);
-
- return data;
-}
-
-void
-g_ptr_array_set_size(GPtrArray *array, gint length)
-{
- g_return_if_fail(array != NULL);
-
- if((size_t)length > array->len) {
- g_ptr_array_grow((GPtrArrayPriv *)array, length);
- memset(array->pdata + array->len, 0, (length - array->len)
- * sizeof(gpointer));
- }
-
- array->len = length;
-}
-
-void
-g_ptr_array_add(GPtrArray *array, gpointer data)
-{
- g_return_if_fail(array != NULL);
- g_ptr_array_grow((GPtrArrayPriv *)array, 1);
- array->pdata[array->len++] = data;
-}
-
-gpointer
-g_ptr_array_remove_index(GPtrArray *array, guint index)
-{
- gpointer removed_node;
-
- g_return_val_if_fail(array != NULL, NULL);
- g_return_val_if_fail(index < array->len, NULL);
-
- removed_node = array->pdata[index];
-
- if(index != array->len - 1) {
- g_memmove(array->pdata + index, array->pdata + index + 1,
- (array->len - index - 1) * sizeof(gpointer));
- }
-
- array->len--;
- array->pdata[array->len] = NULL;
-
- return removed_node;
-}
-
-gpointer
-g_ptr_array_remove_index_fast(GPtrArray *array, guint index)
-{
- gpointer removed_node;
-
- g_return_val_if_fail(array != NULL, NULL);
- g_return_val_if_fail(index < array->len, NULL);
-
- removed_node = array->pdata[index];
-
- if(index != array->len - 1) {
- g_memmove(array->pdata + index, array->pdata + array->len - 1,
- sizeof(gpointer));
- }
-
- array->len--;
- array->pdata[array->len] = NULL;
-
- return removed_node;
-}
-
-gboolean
-g_ptr_array_remove(GPtrArray *array, gpointer data)
-{
- guint i;
-
- g_return_val_if_fail(array != NULL, FALSE);
-
- for(i = 0; i < array->len; i++) {
- if(array->pdata[i] == data) {
- g_ptr_array_remove_index(array, i);
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-gboolean
-g_ptr_array_remove_fast(GPtrArray *array, gpointer data)
-{
- guint i;
-
- g_return_val_if_fail(array != NULL, FALSE);
-
- for(i = 0; i < array->len; i++) {
- if(array->pdata[i] == data) {
- array->len--;
- if (array->len > 0)
- array->pdata [i] = array->pdata [array->len];
- else
- array->pdata [i] = NULL;
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-void
-g_ptr_array_foreach(GPtrArray *array, GFunc func, gpointer user_data)
-{
- guint i;
-
- for(i = 0; i < array->len; i++) {
- func(g_ptr_array_index(array, i), user_data);
- }
-}
-
-void
-g_ptr_array_sort(GPtrArray *array, GCompareFunc compare)
-{
- g_return_if_fail(array != NULL);
- qsort(array->pdata, array->len, sizeof(gpointer), compare);
-}
-
-void
-g_ptr_array_sort_with_data (GPtrArray *array, GCompareDataFunc compare, gpointer user_data)
-{
- g_return_if_fail (array != NULL);
-
- g_qsort_with_data (array->pdata, array->len, sizeof (gpointer), compare, user_data);
-}
-
+++ /dev/null
-/*
- * QuickSort
- *
- * Author: Jeffrey Stedfast <fejj@novell.com>
- *
- * (C) 2011 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.
- */
-
-#include <stdlib.h>
-#include <glib.h>
-
-/* Any segment <= this threshold will be sorted using insertion
- * sort. OpenBSD seems to use a value of 7 so we'll go with that for
- * now... */
-#define MAX_THRESHOLD 7
-
-#define STACK_SIZE (8 * sizeof (size_t))
-
-typedef struct _QSortStack {
- char *array;
- size_t count;
-} QSortStack;
-
-#define QSORT_PUSH(sp, a, c) (sp->array = a, sp->count = c, sp++)
-#define QSORT_POP(sp, a, c) (sp--, a = sp->array, c = sp->count)
-
-#define SWAPTYPE(TYPE, a, b) { \
- long __n = size / sizeof (TYPE); \
- register TYPE *__a = (TYPE *) (a); \
- register TYPE *__b = (TYPE *) (b); \
- register TYPE t; \
- \
- do { \
- t = *__a; \
- *__a++ = *__b; \
- *__b++ = t; \
- } while (--__n > 0); \
-}
-
-#define SWAPBYTE(a, b) SWAPTYPE(char, (a), (b))
-#define SWAPLONG(a, b) SWAPTYPE(long, (a), (b))
-#define SWAP(a, b) if (swaplong) SWAPLONG((a), (b)) else SWAPBYTE((a), (b))
-
-/* check if we can swap by longs rather than bytes by making sure that
- * memory is properly aligned and that the element size is a multiple
- * of sizeof (long) */
-#define SWAP_INIT() swaplong = (((char *) base) - ((char *) 0)) % sizeof (long) == 0 && (size % sizeof (long)) == 0
-
-void
-g_qsort_with_data (gpointer base, size_t nmemb, size_t size, GCompareDataFunc compare, gpointer user_data)
-{
- QSortStack stack[STACK_SIZE], *sp;
- register char *i, *k, *mid;
- size_t n, n1, n2;
- char *lo, *hi;
- int swaplong;
-
- if (nmemb <= 1)
- return;
-
- SWAP_INIT ();
-
- /* initialize our stack */
- sp = stack;
- QSORT_PUSH (sp, base, nmemb);
-
- do {
- QSORT_POP (sp, lo, n);
-
- hi = lo + (n - 1) * size;
-
- if (n < MAX_THRESHOLD) {
- /* switch to insertion sort */
- for (i = lo + size; i <= hi; i += size)
- for (k = i; k > lo && compare (k - size, k, user_data) > 0; k -= size)
- SWAP (k - size, k);
-
- continue;
- }
-
- /* calculate the middle element */
- mid = lo + (n / 2) * size;
-
- /* once we re-order the lo, mid, and hi elements to be in
- * ascending order, we'll use mid as our pivot. */
- if (compare (mid, lo, user_data) < 0) {
- SWAP (mid, lo);
- }
-
- if (compare (hi, mid, user_data) < 0) {
- SWAP (mid, hi);
- if (compare (mid, lo, user_data) < 0) {
- SWAP (mid, lo);
- }
- }
-
- /* since we've already guaranteed that lo <= mid and mid <= hi,
- * we can skip comparing them again */
- i = lo + size;
- k = hi - size;
-
- do {
- /* find the first element with a value > pivot value */
- while (i < k && compare (i, mid, user_data) <= 0)
- i += size;
-
- /* find the last element with a value <= pivot value */
- while (k >= i && compare (mid, k, user_data) < 0)
- k -= size;
-
- if (k <= i)
- break;
-
- SWAP (i, k);
-
- /* make sure we keep track of our pivot element */
- if (mid == i) {
- mid = k;
- } else if (mid == k) {
- mid = i;
- }
-
- i += size;
- k -= size;
- } while (1);
-
- if (k != mid) {
- /* swap the pivot with the last element in the first partition */
- SWAP (mid, k);
- }
-
- /* calculate segment sizes */
- n2 = (hi - k) / size;
- n1 = (k - lo) / size;
-
- /* push our partitions onto the stack, largest first
- * (to make sure we don't run out of stack space) */
- if (n2 > n1) {
- if (n2 > 1) QSORT_PUSH (sp, k + size, n2);
- if (n1 > 1) QSORT_PUSH (sp, lo, n1);
- } else {
- if (n1 > 1) QSORT_PUSH (sp, lo, n1);
- if (n2 > 1) QSORT_PUSH (sp, k + size, n2);
- }
- } while (sp > stack);
-}
+++ /dev/null
-/*
- * gqueue.c: Queue
- *
- * Author:
- * Duncan Mak (duncan@novell.com)
- * Gonzalo Paniagua Javier (gonzalo@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.
- *
- * Copyright (c) 2006-2009 Novell, Inc.
- *
- */
-
-#include <stdio.h>
-#include <glib.h>
-
-gpointer
-g_queue_pop_head (GQueue *queue)
-{
- gpointer result;
- GList *old_head;
-
- if (!queue || queue->length == 0)
- return NULL;
-
- result = queue->head->data;
- old_head = queue->head;
- queue->head = old_head->next;
- g_list_free_1 (old_head);
-
- if (--queue->length)
- queue->head->prev = NULL;
- else
- queue->tail = NULL;
-
- return result;
-}
-
-gboolean
-g_queue_is_empty (GQueue *queue)
-{
- if (!queue)
- return TRUE;
-
- return queue->length == 0;
-}
-
-void
-g_queue_push_head (GQueue *queue, gpointer head)
-{
- if (!queue)
- return;
-
- queue->head = g_list_prepend (queue->head, head);
-
- if (!queue->tail)
- queue->tail = queue->head;
-
- queue->length ++;
-}
-
-void
-g_queue_push_tail (GQueue *queue, gpointer data)
-{
- if (!queue)
- return;
-
- queue->tail = g_list_append (queue->tail, data);
- if (queue->head == NULL)
- queue->head = queue->tail;
- else
- queue->tail = queue->tail->next;
- queue->length++;
-}
-
-GQueue *
-g_queue_new (void)
-{
- return g_new0 (GQueue, 1);
-}
-
-void
-g_queue_free (GQueue *queue)
-{
- if (!queue)
- return;
-
- g_list_free (queue->head);
- g_free (queue);
-}
-
-void
-g_queue_foreach (GQueue *queue, GFunc func, gpointer user_data)
-{
- g_list_foreach (queue->head, func, user_data);
-}
+++ /dev/null
-/*
- * Shell utility functions.
- *
- * Author:
- * Gonzalo Paniagua Javier (gonzalo@novell.com
- *
- * (C) 2006 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.
- */
-#include <stdio.h>
-#include <glib.h>
-
-static int
-split_cmdline (const gchar *cmdline, GPtrArray *array, GError **error)
-{
- gchar *ptr;
- gchar c;
- gboolean escaped = FALSE, fresh = TRUE;
- gchar quote_char = '\0';
- GString *str;
-
- str = g_string_new ("");
- ptr = (gchar *) cmdline;
- while ((c = *ptr++) != '\0') {
- if (escaped) {
- /*
- * \CHAR is only special inside a double quote if CHAR is
- * one of: $`"\ and newline
- */
- if (quote_char == '\"'){
- if (!(c == '$' || c == '`' || c == '"' || c == '\\'))
- g_string_append_c (str, '\\');
- g_string_append_c (str, c);
- } else {
- if (!g_ascii_isspace (c))
- g_string_append_c (str, c);
- }
- escaped = FALSE;
- } else if (quote_char) {
- if (c == quote_char) {
- quote_char = '\0';
- if (fresh && (g_ascii_isspace (*ptr) || *ptr == '\0')){
- g_ptr_array_add (array, g_string_free (str, FALSE));
- str = g_string_new ("");
- }
- } else if (c == '\\'){
- escaped = TRUE;
- } else
- g_string_append_c (str, c);
- } else if (g_ascii_isspace (c)) {
- if (str->len > 0) {
- g_ptr_array_add (array, g_string_free (str, FALSE));
- str = g_string_new ("");
- }
- } else if (c == '\\') {
- escaped = TRUE;
- } else if (c == '\'' || c == '"') {
- fresh = str->len == 0;
- quote_char = c;
- } else {
- g_string_append_c (str, c);
- }
- }
-
- if (escaped) {
- if (error)
- *error = g_error_new (G_LOG_DOMAIN, 0, "Unfinished escape.");
- g_string_free (str, TRUE);
- return -1;
- }
-
- if (quote_char) {
- if (error)
- *error = g_error_new (G_LOG_DOMAIN, 0, "Unfinished quote.");
- g_string_free (str, TRUE);
- return -1;
- }
-
- if (str->len > 0) {
- g_ptr_array_add (array, g_string_free (str, FALSE));
- } else {
- g_string_free (str, TRUE);
- }
- g_ptr_array_add (array, NULL);
- return 0;
-}
-
-gboolean
-g_shell_parse_argv (const gchar *command_line, gint *argcp, gchar ***argvp, GError **error)
-{
- GPtrArray *array;
- gint argc;
- gchar **argv;
-
- g_return_val_if_fail (command_line, FALSE);
- g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
-
- array = g_ptr_array_new();
- if (split_cmdline (command_line, array, error)) {
- g_ptr_array_add (array, NULL);
- g_strfreev ((gchar **) array->pdata);
- g_ptr_array_free (array, FALSE);
- return FALSE;
- }
-
- argc = array->len;
- argv = (gchar **) array->pdata;
-
- if (argc == 1) {
- g_strfreev (argv);
- g_ptr_array_free (array, FALSE);
- return FALSE;
- }
-
- if (argcp) {
- *argcp = array->len - 1;
- }
-
- if (argvp) {
- *argvp = argv;
- } else {
- g_strfreev (argv);
- }
-
- g_ptr_array_free (array, FALSE);
- return TRUE;
-}
-
-gchar *
-g_shell_quote (const gchar *unquoted_string)
-{
- GString *result = g_string_new ("'");
- const gchar *p;
-
- for (p = unquoted_string; *p; p++){
- if (*p == '\'')
- g_string_append (result, "'\\'");
- g_string_append_c (result, *p);
- }
- g_string_append_c (result, '\'');
- return g_string_free (result, FALSE);
-}
-
-gchar *
-g_shell_unquote (const gchar *quoted_string, GError **error)
-{
- GString *result;
- const char *p;
- int do_unquote = 0;
-
- if (quoted_string == NULL)
- return NULL;
-
- /* Quickly try to determine if we need to unquote or not */
- for (p = quoted_string; *p; p++){
- if (*p == '\'' || *p == '"' || *p == '\\'){
- do_unquote = 1;
- break;
- }
- }
-
- if (!do_unquote)
- return g_strdup (quoted_string);
-
- /* We do need to unquote */
- result = g_string_new ("");
- for (p = quoted_string; *p; p++){
-
- if (*p == '\''){
- /* Process single quote, not even \ is processed by glib's version */
- for (p++; *p; p++){
- if (*p == '\'')
- break;
- g_string_append_c (result, *p);
- }
- if (!*p){
- g_set_error (error, 0, 0, "Open quote");
- return NULL;
- }
- } else if (*p == '"'){
- /* Process double quote, allows some escaping */
- for (p++; *p; p++){
- if (*p == '"')
- break;
- if (*p == '\\'){
- p++;
- if (*p == 0){
- g_set_error (error, 0, 0, "Open quote");
- return NULL;
- }
- switch (*p){
- case '$':
- case '"':
- case '\\':
- case '`':
- break;
- default:
- g_string_append_c (result, '\\');
- break;
- }
- }
- g_string_append_c (result, *p);
- }
- if (!*p){
- g_set_error (error, 0, 0, "Open quote");
- return NULL;
- }
- } else if (*p == '\\'){
- char c = *(++p);
- if (!(c == '$' || c == '"' || c == '\\' || c == '`' || c == '\'' || c == 0 ))
- g_string_append_c (result, '\\');
- if (c == 0)
- break;
- else
- g_string_append_c (result, c);
- } else
- g_string_append_c (result, *p);
- }
- return g_string_free (result, FALSE);
-}
-
-#if JOINT_TEST
-/*
- * This test is designed to be built with the 2 glib/eglib to compare
- */
-
-char *args [] = {
- "\\",
- "\"Foo'bar\"",
- "'foo'",
- "'fo\'b'",
- "'foo\"bar'",
- "'foo' dingus bar",
- "'foo' 'bar' 'baz'",
- "\"foo\" 'bar' \"baz\"",
- "\"f\\$\\\'",
- "\"\\",
- "\\\\",
- "'\\\\'",
- "\"f\\$\"\\\"\\\\", // /\\\"\\\\"
- "'f\\$'\\\"\\\\",
- "'f\\$\\\\'",
- NULL
-};
-
-
-int
-main ()
-{
- char **s = args;
- int i;
-
- while (*s){
- char *r1 = g_shell_unquote (*s, NULL);
- char *r2 = g2_shell_unquote (*s, NULL);
- char *ok = r1 == r2 ? "ok" : (r1 != NULL && r2 != NULL && strcmp (r1, r2) == 0) ? "ok" : "fail";
-
- printf ("%s [%s] -> [%s] - [%s]\n", ok, *s, r1, r2);
- s++;
- }
- return;
- char buffer [10];
- buffer [0] = '\"';
- buffer [1] = '\\';
- buffer [3] = '\"';
- buffer [4] = 0;
-
- for (i = 32; i < 255; i++){
- buffer [2] = i;
- printf ("%d [%s] -> [%s]\n", i, buffer, g_shell_unquote (buffer, NULL));
- }
-}
-#endif
+++ /dev/null
-/*
- * gslist.c: Singly-linked list implementation
- *
- * Authors:
- * Duncan Mak (duncan@novell.com)
- * Raja R Harinath (rharinath@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.
- *
- * (C) 2006 Novell, Inc.
- */
-
-#include <stdio.h>
-#include <glib.h>
-
-GSList*
-g_slist_alloc (void)
-{
- return g_new0 (GSList, 1);
-}
-
-void
-g_slist_free_1 (GSList *list)
-{
- g_free (list);
-}
-
-GSList*
-g_slist_append (GSList *list, gpointer data)
-{
- return g_slist_concat (list, g_slist_prepend (NULL, data));
-}
-
-/* This is also a list node constructor. */
-GSList*
-g_slist_prepend (GSList *list, gpointer data)
-{
- GSList *head = g_slist_alloc ();
- head->data = data;
- head->next = list;
-
- return head;
-}
-
-/*
- * Insert the given data in a new node after the current node.
- * Return new node.
- */
-static inline GSList *
-insert_after (GSList *list, gpointer data)
-{
- list->next = g_slist_prepend (list->next, data);
- return list->next;
-}
-
-/*
- * Return the node prior to the node containing 'data'.
- * If the list is empty, or the first node contains 'data', return NULL.
- * If no node contains 'data', return the last node.
- */
-static inline GSList*
-find_prev (GSList *list, gconstpointer data)
-{
- GSList *prev = NULL;
- while (list) {
- if (list->data == data)
- break;
- prev = list;
- list = list->next;
- }
- return prev;
-}
-
-/* like 'find_prev', but searches for node 'link' */
-static inline GSList*
-find_prev_link (GSList *list, GSList *link)
-{
- GSList *prev = NULL;
- while (list) {
- if (list == link)
- break;
- prev = list;
- list = list->next;
- }
- return prev;
-}
-
-GSList*
-g_slist_insert_before (GSList *list, GSList *sibling, gpointer data)
-{
- GSList *prev = find_prev_link (list, sibling);
-
- if (!prev)
- return g_slist_prepend (list, data);
-
- insert_after (prev, data);
- return list;
-}
-
-void
-g_slist_free (GSList *list)
-{
- while (list) {
- GSList *next = list->next;
- g_slist_free_1 (list);
- list = next;
- }
-}
-
-GSList*
-g_slist_copy (GSList *list)
-{
- GSList *copy, *tmp;
-
- if (!list)
- return NULL;
-
- copy = g_slist_prepend (NULL, list->data);
- tmp = copy;
-
- for (list = list->next; list; list = list->next)
- tmp = insert_after (tmp, list->data);
-
- return copy;
-}
-
-GSList*
-g_slist_concat (GSList *list1, GSList *list2)
-{
- if (!list1)
- return list2;
-
- g_slist_last (list1)->next = list2;
- return list1;
-}
-
-void
-g_slist_foreach (GSList *list, GFunc func, gpointer user_data)
-{
- while (list) {
- (*func) (list->data, user_data);
- list = list->next;
- }
-}
-
-GSList*
-g_slist_last (GSList *list)
-{
- if (!list)
- return NULL;
-
- while (list->next)
- list = list->next;
-
- return list;
-}
-
-GSList*
-g_slist_find (GSList *list, gconstpointer data)
-{
- for (; list; list = list->next)
- if (list->data == data)
- break;
- return list;
-}
-
-GSList *
-g_slist_find_custom (GSList *list, gconstpointer data, GCompareFunc func)
-{
- if (!func)
- return NULL;
-
- while (list) {
- if (func (list->data, data) == 0)
- return list;
-
- list = list->next;
- }
-
- return NULL;
-}
-
-guint
-g_slist_length (GSList *list)
-{
- guint length = 0;
-
- while (list) {
- length ++;
- list = list->next;
- }
-
- return length;
-}
-
-GSList*
-g_slist_remove (GSList *list, gconstpointer data)
-{
- GSList *prev = find_prev (list, data);
- GSList *current = prev ? prev->next : list;
-
- if (current) {
- if (prev)
- prev->next = current->next;
- else
- list = current->next;
- g_slist_free_1 (current);
- }
-
- return list;
-}
-
-GSList*
-g_slist_remove_all (GSList *list, gconstpointer data)
-{
- GSList *next = list;
- GSList *prev = NULL;
- GSList *current;
-
- while (next) {
- GSList *tmp_prev = find_prev (next, data);
- if (tmp_prev)
- prev = tmp_prev;
- current = prev ? prev->next : list;
-
- if (!current)
- break;
-
- next = current->next;
-
- if (prev)
- prev->next = next;
- else
- list = next;
- g_slist_free_1 (current);
- }
-
- return list;
-}
-
-GSList*
-g_slist_remove_link (GSList *list, GSList *link)
-{
- GSList *prev = find_prev_link (list, link);
- GSList *current = prev ? prev->next : list;
-
- if (current) {
- if (prev)
- prev->next = current->next;
- else
- list = current->next;
- current->next = NULL;
- }
-
- return list;
-}
-
-GSList*
-g_slist_delete_link (GSList *list, GSList *link)
-{
- list = g_slist_remove_link (list, link);
- g_slist_free_1 (link);
-
- return list;
-}
-
-GSList*
-g_slist_reverse (GSList *list)
-{
- GSList *prev = NULL;
- while (list){
- GSList *next = list->next;
- list->next = prev;
- prev = list;
- list = next;
- }
-
- return prev;
-}
-
-GSList*
-g_slist_insert_sorted (GSList *list, gpointer data, GCompareFunc func)
-{
- GSList *prev = NULL;
-
- if (!func)
- return list;
-
- if (!list || func (list->data, data) > 0)
- return g_slist_prepend (list, data);
-
- /* Invariant: func (prev->data, data) <= 0) */
- for (prev = list; prev->next; prev = prev->next)
- if (func (prev->next->data, data) > 0)
- break;
-
- /* ... && (prev->next == 0 || func (prev->next->data, data) > 0)) */
- insert_after (prev, data);
- return list;
-}
-
-gint
-g_slist_index (GSList *list, gconstpointer data)
-{
- gint index = 0;
-
- while (list) {
- if (list->data == data)
- return index;
-
- index++;
- list = list->next;
- }
-
- return -1;
-}
-
-GSList*
-g_slist_nth (GSList *list, guint n)
-{
- for (; list; list = list->next) {
- if (n == 0)
- break;
- n--;
- }
- return list;
-}
-
-gpointer
-g_slist_nth_data (GSList *list, guint n)
-{
- GSList *node = g_slist_nth (list, n);
- return node ? node->data : NULL;
-}
-
-typedef GSList list_node;
-#include "sort.frag.h"
-
-GSList*
-g_slist_sort (GSList *list, GCompareFunc func)
-{
- if (!list || !list->next)
- return list;
- return do_sort (list, func);
-}
+++ /dev/null
-/*
- * Spawning processes.
- *
- * Author:
- * Gonzalo Paniagua Javier (gonzalo@novell.com
- *
- * (C) 2006 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.
- */
-#include <config.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/types.h>
-
-#include <glib.h>
-
-#ifdef HAVE_UNISTD_H
-#ifndef __USE_GNU
-#define __USE_GNU
-#endif
-#include <unistd.h>
-#endif
-
-#ifdef HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
-
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-
-#ifdef HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
-
-#ifdef HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-
-#ifdef G_OS_WIN32
-#include <io.h>
-#include <winsock2.h>
-#define open _open
-#define close _close
-#define read _read
-#define write _write
-/* windows pipe api details: http://msdn2.microsoft.com/en-us/library/edze9h7e(VS.80).aspx */
-#define pipe(x) _pipe(x, 256, 0)
-#endif
-
-#define set_error(msg, ...) do { if (error != NULL) *error = g_error_new (G_LOG_DOMAIN, 1, msg, __VA_ARGS__); } while (0)
-#define set_error_cond(cond,msg, ...) do { if ((cond) && error != NULL) *error = g_error_new (G_LOG_DOMAIN, 1, msg, __VA_ARGS__); } while (0)
-#define set_error_status(status,msg, ...) do { if (error != NULL) *error = g_error_new (G_LOG_DOMAIN, status, msg, __VA_ARGS__); } while (0)
-#define NO_INTR(var,cmd) do { (var) = (cmd); } while ((var) == -1 && errno == EINTR)
-#define CLOSE_PIPE(p) do { close (p [0]); close (p [1]); } while (0)
-
-#if defined(__APPLE__)
-#if defined (TARGET_OSX)
-/* Apple defines this in crt_externs.h but doesn't provide that header for
- * arm-apple-darwin9. We'll manually define the symbol on Apple as it does
- * in fact exist on all implementations (so far)
- */
-gchar ***_NSGetEnviron(void);
-#define environ (*_NSGetEnviron())
-#else
-static char *mono_environ[1] = { NULL };
-#define environ mono_environ
-#endif /* defined (TARGET_OSX) */
-#elif defined(_MSC_VER)
-/* MS defines this in stdlib.h */
-#else
-extern char **environ;
-#endif
-
-#ifndef G_OS_WIN32
-static int
-safe_read (int fd, gchar *buffer, gint count, GError **error)
-{
- int res;
-
- NO_INTR (res, read (fd, buffer, count));
- set_error_cond (res == -1, "%s", "Error reading from pipe.");
- return res;
-}
-
-static int
-read_pipes (int outfd, gchar **out_str, int errfd, gchar **err_str, GError **error)
-{
- fd_set rfds;
- int res;
- gboolean out_closed;
- gboolean err_closed;
- GString *out = NULL;
- GString *err = NULL;
- gchar *buffer = NULL;
- gint nread;
-
- out_closed = (outfd < 0);
- err_closed = (errfd < 0);
- if (out_str) {
- *out_str = NULL;
- out = g_string_new ("");
- }
-
- if (err_str) {
- *err_str = NULL;
- err = g_string_new ("");
- }
-
- do {
- if (out_closed && err_closed)
- break;
-
-#ifdef _MSC_VER
-#pragma warning(push)
-#pragma warning(disable:4389)
-#endif
-
- FD_ZERO (&rfds);
- if (!out_closed && outfd >= 0)
- FD_SET (outfd, &rfds);
- if (!err_closed && errfd >= 0)
- FD_SET (errfd, &rfds);
-
-#ifdef _MSC_VER
-#pragma warning(pop)
-#endif
-
- res = select (MAX (outfd, errfd) + 1, &rfds, NULL, NULL, NULL);
- if (res > 0) {
- if (buffer == NULL)
- buffer = g_malloc (1024);
- if (!out_closed && FD_ISSET (outfd, &rfds)) {
- nread = safe_read (outfd, buffer, 1024, error);
- if (nread < 0) {
- close (errfd);
- close (outfd);
- return -1;
- }
- g_string_append_len (out, buffer, nread);
- if (nread <= 0) {
- out_closed = TRUE;
- close (outfd);
- }
- }
-
- if (!err_closed && FD_ISSET (errfd, &rfds)) {
- nread = safe_read (errfd, buffer, 1024, error);
- if (nread < 0) {
- close (errfd);
- close (outfd);
- return -1;
- }
- g_string_append_len (err, buffer, nread);
- if (nread <= 0) {
- err_closed = TRUE;
- close (errfd);
- }
- }
- }
- } while (res > 0 || (res == -1 && errno == EINTR));
-
- g_free (buffer);
- if (out_str)
- *out_str = g_string_free (out, FALSE);
-
- if (err_str)
- *err_str = g_string_free (err, FALSE);
-
- return 0;
-}
-
-static gboolean
-create_pipe (int *fds, GError **error)
-{
- if (pipe (fds) == -1) {
- set_error ("%s", "Error creating pipe.");
- return FALSE;
- }
- return TRUE;
-}
-#endif /* G_OS_WIN32 */
-
-static int
-write_all (int fd, const void *vbuf, size_t n)
-{
- const char *buf = (const char *) vbuf;
- size_t nwritten = 0;
- int w;
-
- do {
- do {
- w = write (fd, buf + nwritten, n - nwritten);
- } while (w == -1 && errno == EINTR);
-
- if (w == -1)
- return -1;
-
- nwritten += w;
- } while (nwritten < n);
-
- return nwritten;
-}
-
-#ifndef G_OS_WIN32
-int
-eg_getdtablesize (void)
-{
-#ifdef HAVE_GETRLIMIT
- struct rlimit limit;
- int res;
-
- res = getrlimit (RLIMIT_NOFILE, &limit);
- g_assert (res == 0);
- return limit.rlim_cur;
-#else
- return getdtablesize ();
-#endif
-}
-#else
-int
-eg_getdtablesize (void)
-{
- g_error ("Should not be called");
-}
-#endif
-
-gboolean
-g_spawn_command_line_sync (const gchar *command_line,
- gchar **standard_output,
- gchar **standard_error,
- gint *exit_status,
- GError **error)
-{
-#ifdef G_OS_WIN32
-#elif !defined (HAVE_FORK) || !defined (HAVE_EXECV)
- fprintf (stderr, "g_spawn_command_line_sync not supported on this platform\n");
- return FALSE;
-#else
- pid_t pid;
- gchar **argv;
- gint argc;
- int stdout_pipe [2] = { -1, -1 };
- int stderr_pipe [2] = { -1, -1 };
- int status;
- int res;
-
- if (!g_shell_parse_argv (command_line, &argc, &argv, error))
- return FALSE;
-
- if (standard_output && !create_pipe (stdout_pipe, error))
- return FALSE;
-
- if (standard_error && !create_pipe (stderr_pipe, error)) {
- if (standard_output) {
- CLOSE_PIPE (stdout_pipe);
- }
- return FALSE;
- }
-
- pid = fork ();
- if (pid == 0) {
- gint i;
-
- if (standard_output) {
- close (stdout_pipe [0]);
- dup2 (stdout_pipe [1], STDOUT_FILENO);
- }
-
- if (standard_error) {
- close (stderr_pipe [0]);
- dup2 (stderr_pipe [1], STDERR_FILENO);
- }
- for (i = eg_getdtablesize () - 1; i >= 3; i--)
- close (i);
-
- /* G_SPAWN_SEARCH_PATH is always enabled for g_spawn_command_line_sync */
- if (!g_path_is_absolute (argv [0])) {
- gchar *arg0;
-
- arg0 = g_find_program_in_path (argv [0]);
- if (arg0 == NULL) {
- exit (1);
- }
- //g_free (argv [0]);
- argv [0] = arg0;
- }
- execv (argv [0], argv);
- exit (1); /* TODO: What now? */
- }
-
- g_strfreev (argv);
- if (standard_output)
- close (stdout_pipe [1]);
-
- if (standard_error)
- close (stderr_pipe [1]);
-
- if (standard_output || standard_error) {
- res = read_pipes (stdout_pipe [0], standard_output, stderr_pipe [0], standard_error, error);
- if (res) {
- waitpid (pid, &status, WNOHANG); /* avoid zombie */
- return FALSE;
- }
- }
-
- NO_INTR (res, waitpid (pid, &status, 0));
-
- /* TODO: What if error? */
- if (WIFEXITED (status) && exit_status) {
- *exit_status = WEXITSTATUS (status);
- }
-#endif
- return TRUE;
-}
-
-/*
- * This is the only use we have in mono/metadata
-!g_spawn_async_with_pipes (NULL, (char**)addr_argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, &child_pid, &ch_in, &ch_out, NULL, NULL)
-*/
-gboolean
-g_spawn_async_with_pipes (const gchar *working_directory,
- gchar **argv,
- gchar **envp,
- GSpawnFlags flags,
- GSpawnChildSetupFunc child_setup,
- gpointer user_data,
- GPid *child_pid,
- gint *standard_input,
- gint *standard_output,
- gint *standard_error,
- GError **error)
-{
-#ifdef G_OS_WIN32
-#elif !defined (HAVE_FORK) || !defined (HAVE_EXECVE)
- fprintf (stderr, "g_spawn_async_with_pipes is not supported on this platform\n");
- return FALSE;
-#else
- pid_t pid;
- int info_pipe [2];
- int in_pipe [2] = { -1, -1 };
- int out_pipe [2] = { -1, -1 };
- int err_pipe [2] = { -1, -1 };
- int status;
-
- g_return_val_if_fail (argv != NULL, FALSE); /* Only mandatory arg */
-
- if (!create_pipe (info_pipe, error))
- return FALSE;
-
- if (standard_output && !create_pipe (out_pipe, error)) {
- CLOSE_PIPE (info_pipe);
- return FALSE;
- }
-
- if (standard_error && !create_pipe (err_pipe, error)) {
- CLOSE_PIPE (info_pipe);
- CLOSE_PIPE (out_pipe);
- return FALSE;
- }
-
- if (standard_input && !create_pipe (in_pipe, error)) {
- CLOSE_PIPE (info_pipe);
- CLOSE_PIPE (out_pipe);
- CLOSE_PIPE (err_pipe);
- return FALSE;
- }
-
- pid = fork ();
- if (pid == -1) {
- CLOSE_PIPE (info_pipe);
- CLOSE_PIPE (out_pipe);
- CLOSE_PIPE (err_pipe);
- CLOSE_PIPE (in_pipe);
- set_error ("%s", "Error in fork ()");
- return FALSE;
- }
-
- if (pid == 0) {
- /* No zombie left behind */
- if ((flags & G_SPAWN_DO_NOT_REAP_CHILD) == 0) {
- pid = fork ();
- }
-
- if (pid != 0) {
- exit (pid == -1 ? 1 : 0);
- } else {
- gint i;
- int fd;
- gchar *arg0;
- gchar **actual_args;
- gint unused;
-
- close (info_pipe [0]);
- close (in_pipe [1]);
- close (out_pipe [0]);
- close (err_pipe [0]);
-
- /* when exec* succeeds, we want to close this fd, which will return
- * a 0 read on the parent. We're not supposed to keep it open forever.
- * If exec fails, we still can write the error to it before closing.
- */
- fcntl (info_pipe [1], F_SETFD, FD_CLOEXEC);
-
- if ((flags & G_SPAWN_DO_NOT_REAP_CHILD) == 0) {
- pid = getpid ();
- NO_INTR (unused, write_all (info_pipe [1], &pid, sizeof (pid_t)));
- }
-
- if (working_directory && chdir (working_directory) == -1) {
- int err = errno;
- NO_INTR (unused, write_all (info_pipe [1], &err, sizeof (int)));
- exit (0);
- }
-
- if (standard_output) {
- dup2 (out_pipe [1], STDOUT_FILENO);
- } else if ((flags & G_SPAWN_STDOUT_TO_DEV_NULL) != 0) {
- fd = open ("/dev/null", O_WRONLY);
- dup2 (fd, STDOUT_FILENO);
- }
-
- if (standard_error) {
- dup2 (err_pipe [1], STDERR_FILENO);
- } else if ((flags & G_SPAWN_STDERR_TO_DEV_NULL) != 0) {
- fd = open ("/dev/null", O_WRONLY);
- dup2 (fd, STDERR_FILENO);
- }
-
- if (standard_input) {
- dup2 (in_pipe [0], STDIN_FILENO);
- } else if ((flags & G_SPAWN_CHILD_INHERITS_STDIN) == 0) {
- fd = open ("/dev/null", O_RDONLY);
- dup2 (fd, STDIN_FILENO);
- }
-
- if ((flags & G_SPAWN_LEAVE_DESCRIPTORS_OPEN) != 0) {
- for (i = eg_getdtablesize () - 1; i >= 3; i--)
- close (i);
- }
-
- actual_args = ((flags & G_SPAWN_FILE_AND_ARGV_ZERO) == 0) ? argv : argv + 1;
- if (envp == NULL)
- envp = environ;
-
- if (child_setup)
- child_setup (user_data);
-
- arg0 = argv [0];
- if (!g_path_is_absolute (arg0) || (flags & G_SPAWN_SEARCH_PATH) != 0) {
- arg0 = g_find_program_in_path (argv [0]);
- if (arg0 == NULL) {
- int err = ENOENT;
- write_all (info_pipe [1], &err, sizeof (int));
- exit (0);
- }
- }
-
- execve (arg0, actual_args, envp);
- write_all (info_pipe [1], &errno, sizeof (int));
- exit (0);
- }
- } else if ((flags & G_SPAWN_DO_NOT_REAP_CHILD) == 0) {
- int w;
- /* Wait for the first child if two are created */
- NO_INTR (w, waitpid (pid, &status, 0));
- if (status == 1 || w == -1) {
- CLOSE_PIPE (info_pipe);
- CLOSE_PIPE (out_pipe);
- CLOSE_PIPE (err_pipe);
- CLOSE_PIPE (in_pipe);
- set_error ("Error in fork (): %d", status);
- return FALSE;
- }
- }
- close (info_pipe [1]);
- close (in_pipe [0]);
- close (out_pipe [1]);
- close (err_pipe [1]);
-
- if ((flags & G_SPAWN_DO_NOT_REAP_CHILD) == 0) {
- int x;
- NO_INTR (x, read (info_pipe [0], &pid, sizeof (pid_t))); /* if we read < sizeof (pid_t)... */
- }
-
- if (child_pid) {
- *child_pid = pid;
- }
-
- if (read (info_pipe [0], &status, sizeof (int)) != 0) {
- close (info_pipe [0]);
- close (in_pipe [0]);
- close (out_pipe [1]);
- close (err_pipe [1]);
- set_error_status (status, "Error in exec (%d -> %s)", status, strerror (status));
- return FALSE;
- }
-
- close (info_pipe [0]);
- if (standard_input)
- *standard_input = in_pipe [1];
- if (standard_output)
- *standard_output = out_pipe [0];
- if (standard_error)
- *standard_error = err_pipe [0];
-#endif
- return TRUE;
-}
-
-
+++ /dev/null
-/*
- * gstr.c: String Utility Functions.
- *
- * Author:
- * Miguel de Icaza (miguel@novell.com)
- * Aaron Bockover (abockover@novell.com)
- *
- * (C) 2006 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.
- */
-#include <config.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <glib.h>
-
-#ifndef G_OS_WIN32
-#include <pthread.h>
-#endif
-
-#include <errno.h>
-
-/*
- * g_strndup and g_vasprintf need to allocate memory with g_malloc if
- * ENABLE_OVERRIDABLE_ALLOCATORS is defined so that it can be safely freed with g_free
- * rather than free.
- */
-
-/* This is not a macro, because I dont want to put _GNU_SOURCE in the glib.h header */
-gchar *
-g_strndup (const gchar *str, gsize n)
-{
-#if defined (HAVE_STRNDUP) && !defined (ENABLE_OVERRIDABLE_ALLOCATORS)
- return strndup (str, n);
-#else
- if (str) {
- char *retval = g_malloc(n+1);
- if (retval) {
- strncpy(retval, str, n)[n] = 0;
- }
- return retval;
- }
- return NULL;
-#endif
-}
-
-gint g_vasprintf (gchar **ret, const gchar *fmt, va_list ap)
-{
-#if defined (HAVE_VASPRINTF) && !defined (ENABLE_OVERRIDABLE_ALLOCATORS)
- return vasprintf (ret, fmt, ap);
-#else
- char *buf;
- int len;
- size_t buflen;
- va_list ap2;
-
-#if defined(_MSC_VER) || defined(__MINGW64_VERSION_MAJOR)
- ap2 = ap;
- len = _vscprintf(fmt, ap2); // NOTE MS specific extension ( :-( )
-#else
- va_copy(ap2, ap);
- len = vsnprintf(NULL, 0, fmt, ap2);
-#endif
-
- if (len >= 0 && (buf = g_malloc ((buflen = (size_t) (len + 1)))) != NULL) {
- len = vsnprintf(buf, buflen, fmt, ap);
- *ret = buf;
- } else {
- *ret = NULL;
- len = -1;
- }
-
- va_end(ap2);
- return len;
-#endif
-}
-
-void
-g_strfreev (gchar **str_array)
-{
- gchar **orig = str_array;
- if (str_array == NULL)
- return;
- while (*str_array != NULL){
- g_free (*str_array);
- str_array++;
- }
- g_free (orig);
-}
-
-gchar **
-g_strdupv (gchar **str_array)
-{
- guint length;
- gchar **ret;
- guint i;
-
- if (!str_array)
- return NULL;
-
- length = g_strv_length(str_array);
- ret = g_new0(gchar *, length + 1);
- for (i = 0; str_array[i]; i++) {
- ret[i] = g_strdup(str_array[i]);
- }
- ret[length] = NULL;
- return ret;
-}
-
-guint
-g_strv_length(gchar **str_array)
-{
- gint length = 0;
- g_return_val_if_fail(str_array != NULL, 0);
- for(length = 0; str_array[length] != NULL; length++);
- return length;
-}
-
-gboolean
-g_str_has_suffix(const gchar *str, const gchar *suffix)
-{
- size_t str_length;
- size_t suffix_length;
-
- g_return_val_if_fail(str != NULL, FALSE);
- g_return_val_if_fail(suffix != NULL, FALSE);
-
- str_length = strlen(str);
- suffix_length = strlen(suffix);
-
- return suffix_length <= str_length ?
- strncmp(str + str_length - suffix_length, suffix, suffix_length) == 0 :
- FALSE;
-}
-
-gboolean
-g_str_has_prefix(const gchar *str, const gchar *prefix)
-{
- size_t str_length;
- size_t prefix_length;
-
- g_return_val_if_fail(str != NULL, FALSE);
- g_return_val_if_fail(prefix != NULL, FALSE);
-
- str_length = strlen(str);
- prefix_length = strlen(prefix);
-
- return prefix_length <= str_length ?
- strncmp(str, prefix, prefix_length) == 0 :
- FALSE;
-}
-
-gchar *
-g_strdup_vprintf (const gchar *format, va_list args)
-{
- int n;
- char *ret;
-
- n = g_vasprintf (&ret, format, args);
- if (n == -1)
- return NULL;
-
- return ret;
-}
-
-gchar *
-g_strdup_printf (const gchar *format, ...)
-{
- gchar *ret;
- va_list args;
- int n;
-
- va_start (args, format);
- n = g_vasprintf (&ret, format, args);
- va_end (args);
- if (n == -1)
- return NULL;
-
- return ret;
-}
-
-
-/*
-Max error number we support. It's empirically found by looking at our target OS.
-
-Last this was checked was June-2017.
-
-Apple is at 106.
-Android is at 133.
-*/
-#define MONO_ERRNO_MAX 200
-#define str(s) #s
-
-#ifndef G_OS_WIN32
-static pthread_mutex_t strerror_lock = PTHREAD_MUTEX_INITIALIZER;
-#endif
-
-static char *error_messages [MONO_ERRNO_MAX];
-
-const gchar *
-g_strerror (gint errnum)
-{
- if (errnum < 0)
- errnum = -errnum;
- if (errnum >= MONO_ERRNO_MAX)
- return ("Error number higher than " str (MONO_ERRNO_MAX));
-
- if (!error_messages [errnum]) {
-#ifndef G_OS_WIN32
- pthread_mutex_lock (&strerror_lock);
-#endif
-
-#ifdef HAVE_STRERROR_R
- char tmp_buff [128]; //Quite arbitrary, should be large enough
- char *buff = tmp_buff;
- int buff_len = sizeof (tmp_buff);
- int r;
- buff [0] = 0;
-
- while ((r = strerror_r (errnum, buff, buff_len - 1))) {
- if (r != ERANGE) {
- buff = g_strdup_printf ("Invalid Error code '%d'", errnum);
- break;
- }
- if (buff == tmp_buff)
- buff = g_malloc (buff_len * 2);
- else
- buff = g_realloc (buff, buff_len * 2);
- buff_len *= 2;
- //Spec is not clean on whether size argument includes space for null terminator or not
- }
- if (!error_messages [errnum])
- error_messages [errnum] = g_strdup (buff);
- if (buff != tmp_buff)
- g_free (buff);
-#else
- if (!error_messages [errnum])
- error_messages [errnum] = g_strdup_printf ("Error code '%d'", errnum);
-#endif
-
-
-#ifndef G_OS_WIN32
- pthread_mutex_unlock (&strerror_lock);
-#endif
-
- }
- return error_messages [errnum];
-}
-
-gchar *
-g_strconcat (const gchar *first, ...)
-{
- va_list args;
- size_t total = 0;
- char *s, *ret;
- g_return_val_if_fail (first != NULL, NULL);
-
- total += strlen (first);
- va_start (args, first);
- for (s = va_arg (args, char *); s != NULL; s = va_arg(args, char *)){
- total += strlen (s);
- }
- va_end (args);
-
- ret = g_malloc (total + 1);
- if (ret == NULL)
- return NULL;
-
- ret [total] = 0;
- strcpy (ret, first);
- va_start (args, first);
- for (s = va_arg (args, char *); s != NULL; s = va_arg(args, char *)){
- strcat (ret, s);
- }
- va_end (args);
-
- return ret;
-}
-
-static void
-add_to_vector (gchar ***vector, int size, gchar *token)
-{
- *vector = *vector == NULL ?
- (gchar **)g_malloc(2 * sizeof(*vector)) :
- (gchar **)g_realloc(*vector, (size + 1) * sizeof(*vector));
-
- (*vector)[size - 1] = token;
-}
-
-gchar **
-g_strsplit (const gchar *string, const gchar *delimiter, gint max_tokens)
-{
- const gchar *c;
- gchar *token, **vector;
- gint size = 1;
-
- g_return_val_if_fail (string != NULL, NULL);
- g_return_val_if_fail (delimiter != NULL, NULL);
- g_return_val_if_fail (delimiter[0] != 0, NULL);
-
- if (strncmp (string, delimiter, strlen (delimiter)) == 0) {
- vector = (gchar **)g_malloc (2 * sizeof(vector));
- vector[0] = g_strdup ("");
- size++;
- string += strlen (delimiter);
- } else {
- vector = NULL;
- }
-
- while (*string && !(max_tokens > 0 && size >= max_tokens)) {
- c = string;
- if (strncmp (string, delimiter, strlen (delimiter)) == 0) {
- token = g_strdup ("");
- string += strlen (delimiter);
- } else {
- while (*string && strncmp (string, delimiter, strlen (delimiter)) != 0) {
- string++;
- }
-
- if (*string) {
- gsize toklen = (string - c);
- token = g_strndup (c, toklen);
-
- /* Need to leave a trailing empty
- * token if the delimiter is the last
- * part of the string
- */
- if (strcmp (string, delimiter) != 0) {
- string += strlen (delimiter);
- }
- } else {
- token = g_strdup (c);
- }
- }
-
- add_to_vector (&vector, size, token);
- size++;
- }
-
- if (*string) {
- if (strcmp (string, delimiter) == 0)
- add_to_vector (&vector, size, g_strdup (""));
- else {
- /* Add the rest of the string as the last element */
- add_to_vector (&vector, size, g_strdup (string));
- }
- size++;
- }
-
- if (vector == NULL) {
- vector = (gchar **) g_malloc (2 * sizeof (vector));
- vector [0] = NULL;
- } else if (size > 0) {
- vector[size - 1] = NULL;
- }
-
- return vector;
-}
-
-static gboolean
-charcmp (gchar testchar, const gchar *compare)
-{
- while(*compare) {
- if (*compare == testchar) {
- return TRUE;
- }
- compare++;
- }
-
- return FALSE;
-}
-
-gchar **
-g_strsplit_set (const gchar *string, const gchar *delimiter, gint max_tokens)
-{
- const gchar *c;
- gchar *token, **vector;
- gint size = 1;
-
- g_return_val_if_fail (string != NULL, NULL);
- g_return_val_if_fail (delimiter != NULL, NULL);
- g_return_val_if_fail (delimiter[0] != 0, NULL);
-
- if (charcmp (*string, delimiter)) {
- vector = (gchar **)g_malloc (2 * sizeof(vector));
- vector[0] = g_strdup ("");
- size++;
- string++;
- } else {
- vector = NULL;
- }
-
- c = string;
- while (*string && !(max_tokens > 0 && size >= max_tokens)) {
- if (charcmp (*string, delimiter)) {
- gsize toklen = (string - c);
- if (toklen == 0) {
- token = g_strdup ("");
- } else {
- token = g_strndup (c, toklen);
- }
-
- c = string + 1;
-
- add_to_vector (&vector, size, token);
- size++;
- }
-
- string++;
- }
-
- if (max_tokens > 0 && size >= max_tokens) {
- if (*string) {
- /* Add the rest of the string as the last element */
- add_to_vector (&vector, size, g_strdup (string));
- size++;
- }
- } else {
- if (*c) {
- /* Fill in the trailing last token */
- add_to_vector (&vector, size, g_strdup (c));
- size++;
- } else {
- /* Need to leave a trailing empty token if the
- * delimiter is the last part of the string
- */
- add_to_vector (&vector, size, g_strdup (""));
- size++;
- }
- }
-
- if (vector == NULL) {
- vector = (gchar **) g_malloc (2 * sizeof (vector));
- vector [0] = NULL;
- } else if (size > 0) {
- vector[size - 1] = NULL;
- }
-
- return vector;
-}
-
-gchar *
-g_strreverse (gchar *str)
-{
- size_t i, j;
- gchar c;
-
- if (str == NULL)
- return NULL;
-
- if (*str == 0)
- return str;
-
- for (i = 0, j = strlen (str) - 1; i < j; i++, j--) {
- c = str [i];
- str [i] = str [j];
- str [j] = c;
- }
-
- return str;
-}
-
-gchar *
-g_strjoin (const gchar *separator, ...)
-{
- va_list args;
- char *res, *s, *r;
- size_t len, slen;
-
- if (separator != NULL)
- slen = strlen (separator);
- else
- slen = 0;
-
- len = 0;
- va_start (args, separator);
- for (s = va_arg (args, char *); s != NULL; s = va_arg (args, char *)){
- len += strlen (s);
- len += slen;
- }
- va_end (args);
-
- if (len == 0)
- return g_strdup ("");
-
- /* Remove the last separator */
- if (slen > 0 && len > 0)
- len -= slen;
-
- res = g_malloc (len + 1);
- va_start (args, separator);
- s = va_arg (args, char *);
- r = g_stpcpy (res, s);
- for (s = va_arg (args, char *); s != NULL; s = va_arg (args, char *)){
- if (separator != NULL)
- r = g_stpcpy (r, separator);
- r = g_stpcpy (r, s);
- }
- va_end (args);
-
- return res;
-}
-
-gchar *
-g_strjoinv (const gchar *separator, gchar **str_array)
-{
- char *res, *r;
- size_t slen, len, i;
-
- if (separator != NULL)
- slen = strlen (separator);
- else
- slen = 0;
-
- len = 0;
- for (i = 0; str_array [i] != NULL; i++){
- len += strlen (str_array [i]);
- len += slen;
- }
-
- if (len == 0)
- return g_strdup ("");
-
- if (slen > 0 && len > 0)
- len -= slen;
-
- res = g_malloc (len + 1);
- r = g_stpcpy (res, str_array [0]);
- for (i = 1; str_array [i] != NULL; i++){
- if (separator != NULL)
- r = g_stpcpy (r, separator);
- r = g_stpcpy (r, str_array [i]);
- }
-
- return res;
-}
-
-gchar *
-g_strchug (gchar *str)
-{
- size_t len;
- gchar *tmp;
-
- if (str == NULL)
- return NULL;
-
- tmp = str;
- while (*tmp && isspace (*tmp)) tmp++;
- if (str != tmp) {
- len = strlen (str) - (tmp - str - 1);
- memmove (str, tmp, len);
- }
- return str;
-}
-
-gchar *
-g_strchomp (gchar *str)
-{
- gchar *tmp;
-
- if (str == NULL)
- return NULL;
-
- tmp = str + strlen (str) - 1;
- while (*tmp && isspace (*tmp)) tmp--;
- *(tmp + 1) = '\0';
- return str;
-}
-
-gint
-g_printf(gchar const *format, ...)
-{
- va_list args;
- gint ret;
-
- va_start(args, format);
- ret = vprintf(format, args);
- va_end(args);
-
- return ret;
-}
-
-gint
-g_fprintf(FILE *file, gchar const *format, ...)
-{
- va_list args;
- gint ret;
-
- va_start(args, format);
- ret = vfprintf(file, format, args);
- va_end(args);
-
- return ret;
-}
-
-gint
-g_sprintf(gchar *string, gchar const *format, ...)
-{
- va_list args;
- gint ret;
-
- va_start(args, format);
- ret = vsprintf(string, format, args);
- va_end(args);
-
- return ret;
-}
-
-gint
-g_snprintf(gchar *string, gulong n, gchar const *format, ...)
-{
- va_list args;
- gint ret;
-
- va_start(args, format);
- ret = vsnprintf(string, n, format, args);
- va_end(args);
-
- return ret;
-}
-
-static const char hx [] = { '0', '1', '2', '3', '4', '5', '6', '7',
- '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
-
-static gboolean
-char_needs_encoding (char c)
-{
- if (((unsigned char)c) >= 0x80)
- return TRUE;
-
- if ((c >= '@' && c <= 'Z') ||
- (c >= 'a' && c <= 'z') ||
- (c >= '&' && c < 0x3b) ||
- (c == '!') || (c == '$') || (c == '_') || (c == '=') || (c == '~'))
- return FALSE;
- return TRUE;
-}
-
-gchar *
-g_filename_to_uri (const gchar *filename, const gchar *hostname, GError **error)
-{
- size_t n;
- char *ret, *rp;
- const char *p;
-#ifdef G_OS_WIN32
- const char *uriPrefix = "file:///";
-#else
- const char *uriPrefix = "file://";
-#endif
-
- g_return_val_if_fail (filename != NULL, NULL);
-
- if (hostname != NULL)
- g_warning ("%s", "eglib: g_filename_to_uri: hostname not handled");
-
- if (!g_path_is_absolute (filename)){
- if (error != NULL)
- *error = g_error_new (NULL, 2, "Not an absolute filename");
-
- return NULL;
- }
-
- n = strlen (uriPrefix) + 1;
- for (p = filename; *p; p++){
-#ifdef G_OS_WIN32
- if (*p == '\\') {
- n++;
- continue;
- }
-#endif
- if (char_needs_encoding (*p))
- n += 3;
- else
- n++;
- }
- ret = g_malloc (n);
- strcpy (ret, uriPrefix);
- for (p = filename, rp = ret + strlen (ret); *p; p++){
-#ifdef G_OS_WIN32
- if (*p == '\\') {
- *rp++ = '/';
- continue;
- }
-#endif
- if (char_needs_encoding (*p)){
- *rp++ = '%';
- *rp++ = hx [((unsigned char)(*p)) >> 4];
- *rp++ = hx [((unsigned char)(*p)) & 0xf];
- } else
- *rp++ = *p;
- }
- *rp = 0;
- return ret;
-}
-
-static int
-decode (char p)
-{
- if (p >= '0' && p <= '9')
- return p - '0';
- if (p >= 'A' && p <= 'F')
- return p - 'A';
- if (p >= 'a' && p <= 'f')
- return p - 'a';
- g_assert_not_reached ();
- return 0;
-}
-
-gchar *
-g_filename_from_uri (const gchar *uri, gchar **hostname, GError **error)
-{
- const char *p;
- char *r, *result;
- int flen = 0;
-
- g_return_val_if_fail (uri != NULL, NULL);
-
- if (hostname != NULL)
- g_warning ("%s", "eglib: g_filename_from_uri: hostname not handled");
-
- if (strncmp (uri, "file:///", 8) != 0){
- if (error != NULL)
- *error = g_error_new (NULL, 2, "URI does not start with the file: scheme");
- return NULL;
- }
-
- for (p = uri + 8; *p; p++){
- if (*p == '%'){
- if (p [1] && p [2] && isxdigit (p [1]) && isxdigit (p [2])){
- p += 2;
- } else {
- if (error != NULL)
- *error = g_error_new (NULL, 2, "URI contains an invalid escape sequence");
- return NULL;
- }
- }
- flen++;
- }
-#ifndef G_OS_WIN32
- flen++;
-#endif
-
- result = g_malloc (flen + 1);
- result [flen] = 0;
-
-#ifndef G_OS_WIN32
- *result = '/';
- r = result + 1;
-#else
- r = result;
-#endif
-
- for (p = uri + 8; *p; p++){
- if (*p == '%'){
- *r++ = (char)((decode (p [1]) << 4) | decode (p [2]));
- p += 2;
- } else
- *r++ = *p;
- flen++;
- }
- return result;
-}
-
-void
-g_strdown (gchar *string)
-{
- g_return_if_fail (string != NULL);
-
- while (*string){
- *string = (gchar)tolower (*string);
- string++;
- }
-}
-
-gchar
-g_ascii_tolower (gchar c)
-{
- return c >= 'A' && c <= 'Z' ? c + ('a' - 'A') : c;
-}
-
-gchar *
-g_ascii_strdown (const gchar *str, gssize len)
-{
- char *ret;
- int i;
-
- g_return_val_if_fail (str != NULL, NULL);
-
- if (len == -1)
- len = strlen (str);
-
- ret = g_malloc (len + 1);
- for (i = 0; i < len; i++)
- ret [i] = (guchar) g_ascii_tolower (str [i]);
- ret [i] = 0;
-
- return ret;
-}
-
-gchar
-g_ascii_toupper (gchar c)
-{
- return c >= 'a' && c <= 'z' ? c + ('A' - 'a') : c;
-}
-
-gchar *
-g_ascii_strup (const gchar *str, gssize len)
-{
- char *ret;
- int i;
-
- g_return_val_if_fail (str != NULL, NULL);
-
- if (len == -1)
- len = strlen (str);
-
- ret = g_malloc (len + 1);
- for (i = 0; i < len; i++)
- ret [i] = (guchar) g_ascii_toupper (str [i]);
- ret [i] = 0;
-
- return ret;
-}
-
-gint
-g_ascii_strncasecmp (const gchar *s1, const gchar *s2, gsize n)
-{
- gsize i;
-
- g_return_val_if_fail (s1 != NULL, 0);
- g_return_val_if_fail (s2 != NULL, 0);
-
- for (i = 0; i < n; i++) {
- gchar c1 = g_ascii_tolower (*s1++);
- gchar c2 = g_ascii_tolower (*s2++);
-
- if (c1 != c2)
- return c1 - c2;
- }
-
- return 0;
-}
-
-gint
-g_ascii_strcasecmp (const gchar *s1, const gchar *s2)
-{
- const char *sp1 = s1;
- const char *sp2 = s2;
-
- g_return_val_if_fail (s1 != NULL, 0);
- g_return_val_if_fail (s2 != NULL, 0);
-
- while (*sp1 != '\0') {
- char c1 = g_ascii_tolower (*sp1++);
- char c2 = g_ascii_tolower (*sp2++);
-
- if (c1 != c2)
- return c1 - c2;
- }
-
- return (*sp1) - (*sp2);
-}
-
-gchar *
-g_strdelimit (gchar *string, const gchar *delimiters, gchar new_delimiter)
-{
- gchar *ptr;
-
- g_return_val_if_fail (string != NULL, NULL);
-
- if (delimiters == NULL)
- delimiters = G_STR_DELIMITERS;
-
- for (ptr = string; *ptr; ptr++) {
- if (strchr (delimiters, *ptr))
- *ptr = new_delimiter;
- }
-
- return string;
-}
-
-gsize
-g_strlcpy (gchar *dest, const gchar *src, gsize dest_size)
-{
-#ifdef HAVE_STRLCPY
- return strlcpy (dest, src, dest_size);
-#else
- gchar *d;
- const gchar *s;
- gchar c;
- gsize len;
-
- g_return_val_if_fail (src != NULL, 0);
- g_return_val_if_fail (dest != NULL, 0);
-
- len = dest_size;
- if (len == 0)
- return 0;
-
- s = src;
- d = dest;
- while (--len) {
- c = *s++;
- *d++ = c;
- if (c == '\0')
- return (dest_size - len - 1);
- }
-
- /* len is 0 i we get here */
- *d = '\0';
- /* we need to return the length of src here */
- while (*s++) ; /* instead of a plain strlen, we use 's' */
- return s - src - 1;
-#endif
-}
-
-gchar *
-g_stpcpy (gchar *dest, const char *src)
-{
- g_return_val_if_fail (dest != NULL, dest);
- g_return_val_if_fail (src != NULL, dest);
-
-#if HAVE_STPCPY
- return stpcpy (dest, src);
-#else
- while (*src)
- *dest++ = *src++;
-
- *dest = '\0';
-
- return dest;
-#endif
-}
-
-static const gchar escaped_dflt [256] = {
- 1, 1, 1, 1, 1, 1, 1, 1, 'b', 't', 'n', 1, 'f', 'r', 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 0, 0, '"', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '\\', 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
-};
-
-gchar *
-g_strescape (const gchar *source, const gchar *exceptions)
-{
- gchar escaped [256];
- const gchar *ptr;
- gchar c;
- gchar op;
- gchar *result;
- gchar *res_ptr;
-
- g_return_val_if_fail (source != NULL, NULL);
-
- memcpy (escaped, escaped_dflt, 256);
- if (exceptions != NULL) {
- for (ptr = exceptions; *ptr; ptr++)
- escaped [(int) *ptr] = 0;
- }
- result = g_malloc (strlen (source) * 4 + 1); /* Worst case: everything octal. */
- res_ptr = result;
- for (ptr = source; *ptr; ptr++) {
- c = *ptr;
- op = escaped [(int) c];
- if (op == 0) {
- *res_ptr++ = c;
- } else {
- *res_ptr++ = '\\';
- if (op != 1) {
- *res_ptr++ = op;
- } else {
- *res_ptr++ = '0' + ((c >> 6) & 3);
- *res_ptr++ = '0' + ((c >> 3) & 7);
- *res_ptr++ = '0' + (c & 7);
- }
- }
- }
- *res_ptr = '\0';
- return result;
-}
-
-gint
-g_ascii_xdigit_value (gchar c)
-{
- return ((isxdigit (c) == 0) ? -1 :
- ((c >= '0' && c <= '9') ? (c - '0') :
- ((c >= 'a' && c <= 'f') ? (c - 'a' + 10) :
- (c - 'A' + 10))));
-}
-
-gchar *
-g_strnfill (gsize length, gchar fill_char)
-{
- gchar *ret = g_new (gchar, length + 1);
-
- memset (ret, fill_char, length);
- ret [length] = 0;
- return ret;
-}
+++ /dev/null
-/*
- * String functions
- *
- * Author:
- * Miguel de Icaza (miguel@novell.com)
- * Aaron Bockover (abockover@novell.com)
- *
- * (C) 2006 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.
- */
-#include <stdio.h>
-#include <glib.h>
-
-#define GROW_IF_NECESSARY(s,l) { \
- if(s->len + l >= s->allocated_len) { \
- s->allocated_len = (s->allocated_len + l + 16) * 2; \
- s->str = g_realloc(s->str, s->allocated_len); \
- } \
-}
-
-GString *
-g_string_new_len (const gchar *init, gssize len)
-{
- GString *ret = g_new (GString, 1);
-
- if (init == NULL)
- ret->len = 0;
- else
- ret->len = len < 0 ? strlen(init) : len;
- ret->allocated_len = MAX(ret->len + 1, 16);
- ret->str = g_malloc(ret->allocated_len);
- if (init)
- memcpy(ret->str, init, ret->len);
- ret->str[ret->len] = 0;
-
- return ret;
-}
-
-GString *
-g_string_new (const gchar *init)
-{
- return g_string_new_len(init, -1);
-}
-
-GString *
-g_string_sized_new (gsize default_size)
-{
- GString *ret = g_new (GString, 1);
-
- ret->str = g_malloc (default_size);
- ret->str [0] = 0;
- ret->len = 0;
- ret->allocated_len = default_size;
-
- return ret;
-}
-
-gchar *
-g_string_free (GString *string, gboolean free_segment)
-{
- gchar *data;
-
- g_return_val_if_fail (string != NULL, NULL);
-
- data = string->str;
- g_free(string);
-
- if(!free_segment) {
- return data;
- }
-
- g_free(data);
- return NULL;
-}
-
-GString *
-g_string_append_len (GString *string, const gchar *val, gssize len)
-{
- g_return_val_if_fail(string != NULL, NULL);
- g_return_val_if_fail(val != NULL, string);
-
- if(len < 0) {
- len = strlen(val);
- }
-
- GROW_IF_NECESSARY(string, len);
- memcpy(string->str + string->len, val, len);
- string->len += len;
- string->str[string->len] = 0;
-
- return string;
-}
-
-GString *
-g_string_append (GString *string, const gchar *val)
-{
- g_return_val_if_fail(string != NULL, NULL);
- g_return_val_if_fail(val != NULL, string);
-
- return g_string_append_len(string, val, -1);
-}
-
-GString *
-g_string_append_c (GString *string, gchar c)
-{
- g_return_val_if_fail(string != NULL, NULL);
-
- GROW_IF_NECESSARY(string, 1);
-
- string->str[string->len] = c;
- string->str[string->len + 1] = 0;
- string->len++;
-
- return string;
-}
-
-GString *
-g_string_append_unichar (GString *string, gunichar c)
-{
- gchar utf8[6];
- gint len;
-
- g_return_val_if_fail (string != NULL, NULL);
-
- if ((len = g_unichar_to_utf8 (c, utf8)) <= 0)
- return string;
-
- return g_string_append_len (string, utf8, len);
-}
-
-GString *
-g_string_prepend (GString *string, const gchar *val)
-{
- gssize len;
-
- g_return_val_if_fail (string != NULL, string);
- g_return_val_if_fail (val != NULL, string);
-
- len = strlen (val);
-
- GROW_IF_NECESSARY(string, len);
- memmove(string->str + len, string->str, string->len + 1);
- memcpy(string->str, val, len);
-
- return string;
-}
-
-GString *
-g_string_insert (GString *string, gssize pos, const gchar *val)
-{
- gssize len;
-
- g_return_val_if_fail (string != NULL, string);
- g_return_val_if_fail (val != NULL, string);
- g_return_val_if_fail (pos <= string->len, string);
-
- len = strlen (val);
-
- GROW_IF_NECESSARY(string, len);
- memmove(string->str + pos + len, string->str + pos, string->len - pos - len + 1);
- memcpy(string->str + pos, val, len);
-
- return string;
-}
-
-void
-g_string_append_printf (GString *string, const gchar *format, ...)
-{
- char *ret;
- va_list args;
-
- g_return_if_fail (string != NULL);
- g_return_if_fail (format != NULL);
-
- va_start (args, format);
- ret = g_strdup_vprintf (format, args);
- va_end (args);
- g_string_append (string, ret);
-
- g_free (ret);
-}
-
-void
-g_string_append_vprintf (GString *string, const gchar *format, va_list args)
-{
- char *ret;
-
- g_return_if_fail (string != NULL);
- g_return_if_fail (format != NULL);
-
- ret = g_strdup_vprintf (format, args);
- g_string_append (string, ret);
- g_free (ret);
-}
-
-void
-g_string_printf (GString *string, const gchar *format, ...)
-{
- va_list args;
-
- g_return_if_fail (string != NULL);
- g_return_if_fail (format != NULL);
-
- g_free (string->str);
-
- va_start (args, format);
- string->str = g_strdup_vprintf (format, args);
- va_end (args);
-
- string->len = strlen (string->str);
- string->allocated_len = string->len+1;
-}
-
-GString *
-g_string_truncate (GString *string, gsize len)
-{
- g_return_val_if_fail (string != NULL, string);
-
- /* Silent return */
- if (len >= string->len)
- return string;
-
- string->len = len;
- string->str[len] = 0;
- return string;
-}
-
-GString *
-g_string_set_size (GString *string, gsize len)
-{
- g_return_val_if_fail (string != NULL, string);
-
- GROW_IF_NECESSARY(string, len);
-
- string->len = len;
- string->str[len] = 0;
- return string;
-}
-
-GString *
-g_string_erase (GString *string, gssize pos, gssize len)
-{
- g_return_val_if_fail (string != NULL, string);
-
- /* Silent return */
- if (pos >= string->len)
- return string;
-
- if (len == -1 || (pos + len) >= string->len) {
- string->str[pos] = 0;
- }
- else {
- memmove (string->str + pos, string->str + pos + len, string->len - (pos + len) + 1);
- string->len -= len;
- }
-
- return string;
-}
+++ /dev/null
-/*
- * Timer
- *
- * Author:
- * Gonzalo Paniagua Javier (gonzalo@novell.com
- *
- * (C) 2006 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.
- */
-#include <glib.h>
-#include <sys/time.h>
-
-struct _GTimer {
- struct timeval start;
- struct timeval stop;
-};
-
-GTimer *g_timer_new (void)
-{
- GTimer *timer;
-
- timer = g_new0 (GTimer, 1);
- g_timer_start (timer);
- return timer;
-}
-
-void
-g_timer_destroy (GTimer *timer)
-{
- g_return_if_fail (timer != NULL);
- g_free (timer);
-}
-
-void
-g_timer_start (GTimer *timer)
-{
- g_return_if_fail (timer != NULL);
- gettimeofday (&timer->start, NULL);
- memset (&timer->stop, 0, sizeof (struct timeval));
-}
-
-void
-g_timer_stop (GTimer *timer)
-{
- g_return_if_fail (timer != NULL);
- gettimeofday (&timer->stop, NULL);
-}
-
-gdouble
-g_timer_elapsed (GTimer *timer, gulong *microseconds)
-{
- struct timeval tv;
- gulong seconds;
- long usec;
- gdouble result;
-
- g_return_val_if_fail (timer != NULL, 0.0);
-
- if (timer->stop.tv_sec == 0 && timer->stop.tv_usec == 0) {
- gettimeofday (&tv, NULL);
- } else {
- tv = timer->stop;
- }
-
- usec = (tv.tv_usec) - (timer->start.tv_usec);
- seconds = tv.tv_sec - timer->start.tv_sec;
- if (microseconds) {
- if (usec < 0) {
- usec += 1000000;
- seconds--;
- }
- *microseconds = usec;
- }
- result = seconds * 1000000 + usec;
- return (result / 1000000);
-}
-
-
+++ /dev/null
-/*
- * Timer
- *
- * Author:
- * Gonzalo Paniagua Javier (gonzalo@novell.com
- *
- * (C) 2006 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.
- */
-#include <glib.h>
-#include <windows.h>
-
-struct _GTimer {
- guint64 start;
- guint64 stop;
-};
-
-GTimer *g_timer_new (void)
-{
- GTimer *timer;
-
- timer = g_new0 (GTimer, 1);
- g_timer_start (timer);
- return timer;
-}
-
-void
-g_timer_destroy (GTimer *timer)
-{
- g_return_if_fail (timer != NULL);
- g_free (timer);
-}
-
-void
-g_timer_start (GTimer *timer)
-{
- g_return_if_fail (timer != NULL);
-
- QueryPerformanceCounter ((LARGE_INTEGER*)&timer->start);
-}
-
-void
-g_timer_stop (GTimer *timer)
-{
- g_return_if_fail (timer != NULL);
-
- QueryPerformanceCounter ((LARGE_INTEGER*)&timer->stop);
-}
-
-gdouble
-g_timer_elapsed (GTimer *timer, gulong *microseconds)
-{
- static guint64 freq = 0;
- guint64 delta, stop;
-
- if (freq == 0) {
- if (!QueryPerformanceFrequency ((LARGE_INTEGER *)&freq))
- freq = 1;
- }
-
- if (timer->stop == 0) {
- QueryPerformanceCounter ((LARGE_INTEGER*)&stop);
- }
- else {
- stop = timer->stop;
- }
-
- delta = stop - timer->start;
-
- if (microseconds)
- *microseconds = (gulong) (delta * (1000000.0 / freq));
-
- return (gdouble) delta / (gdouble) freq;
-}
-
-
+++ /dev/null
-/*
- * gunicode-win32-uwp.c: UWP unicode support.
- *
- * Copyright 2016 Microsoft
- * Licensed under the MIT license. See LICENSE file in the project root for full license information.
-*/
-#include <config.h>
-#include <glib.h>
-
-#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#define CODESET 1
-#include <windows.h>
-
-extern const char *my_charset;
-static gboolean is_utf8;
-
-gboolean
-g_get_charset (G_CONST_RETURN char **charset)
-{
- if (my_charset == NULL) {
- static char buf [14];
- CPINFOEXA cp_info;
-
- GetCPInfoExA (CP_ACP, 0, &cp_info);
- sprintf (buf, "CP%u", cp_info.CodePage);
- my_charset = buf;
- is_utf8 = FALSE;
- }
-
- if (charset != NULL)
- *charset = my_charset;
-
- return is_utf8;
-}
-
-#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
-
-#ifdef _MSC_VER
-// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
-void __mono_win32_gunicode_win32_uwp_quiet_lnk4221(void) {}
-#endif
-#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
+++ /dev/null
-/*
- * gunicode-win32.c: Windows unicode support.
- *
- * Copyright 2016 Microsoft
- * Licensed under the MIT license. See LICENSE file in the project root for full license information.
-*/
-#include <config.h>
-#include <glib.h>
-
-#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
-#define CODESET 1
-#include <windows.h>
-
-extern const char *my_charset;
-static gboolean is_utf8;
-
-gboolean
-g_get_charset (G_CONST_RETURN char **charset)
-{
- if (my_charset == NULL) {
- static char buf [14];
- sprintf (buf, "CP%u", GetACP ());
- my_charset = buf;
- is_utf8 = FALSE;
- }
-
- if (charset != NULL)
- *charset = my_charset;
-
- return is_utf8;
-}
-
-#else /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
-
-#ifdef _MSC_VER
-// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
-void __mono_win32_mono_gunicode_win32_quiet_lnk4221(void) {}
-#endif
-#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+++ /dev/null
-/*
- * gunicode.c: Some Unicode routines
- *
- * Author:
- * Miguel de Icaza (miguel@novell.com)
- *
- * (C) 2006 Novell, Inc.
- *
- * utf8 validation code came from:
- * libxml2-2.6.26 licensed under the MIT X11 license
- *
- * Authors credit in libxml's string.c:
- * William Brack <wbrack@mmm.com.hk>
- * daniel@veillard.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.
- *
- */
-#include <config.h>
-#include <stdio.h>
-#include <glib.h>
-#include <unicode-data.h>
-#include <errno.h>
-
-#ifndef G_OS_WIN32
-# ifdef HAVE_LOCALCHARSET_H
-# include <localcharset.h>
-# endif
-#endif
-
-const char *my_charset;
-
-/*
- * Character set conversion
- */
-
-GUnicodeType
-g_unichar_type (gunichar c)
-{
- int i;
-
- guint16 cp = (guint16) c;
- for (i = 0; i < unicode_category_ranges_count; i++) {
- if (cp < unicode_category_ranges [i].start)
- continue;
- if (unicode_category_ranges [i].end <= cp)
- continue;
- return unicode_category [i] [cp - unicode_category_ranges [i].start];
- }
-
- /*
- // 3400-4DB5: OtherLetter
- // 4E00-9FC3: OtherLetter
- // AC00-D7A3: OtherLetter
- // D800-DFFF: OtherSurrogate
- // E000-F8FF: OtherPrivateUse
- // 20000-2A6D6 OtherLetter
- // F0000-FFFFD OtherPrivateUse
- // 100000-10FFFD OtherPrivateUse
- */
- if (0x3400 <= cp && cp < 0x4DB5)
- return G_UNICODE_OTHER_LETTER;
- if (0x4E00 <= cp && cp < 0x9FC3)
- return G_UNICODE_OTHER_LETTER;
- if (0xAC00<= cp && cp < 0xD7A3)
- return G_UNICODE_OTHER_LETTER;
- if (0xD800 <= cp && cp < 0xDFFF)
- return G_UNICODE_SURROGATE;
- if (0xE000 <= cp && cp < 0xF8FF)
- return G_UNICODE_PRIVATE_USE;
- /* since the argument is UTF-16, we cannot check beyond FFFF */
-
- /* It should match any of above */
- return 0;
-}
-
-GUnicodeBreakType
-g_unichar_break_type (gunichar c)
-{
- // MOONLIGHT_FIXME
- return G_UNICODE_BREAK_UNKNOWN;
-}
-
-gunichar
-g_unichar_case (gunichar c, gboolean upper)
-{
- gint8 i, i2;
- guint32 cp = (guint32) c, v;
-
- for (i = 0; i < simple_case_map_ranges_count; i++) {
- if (cp < simple_case_map_ranges [i].start)
- return c;
- if (simple_case_map_ranges [i].end <= cp)
- continue;
- if (c < 0x10000) {
- const guint16 *tab = upper ? simple_upper_case_mapping_lowarea [i] : simple_lower_case_mapping_lowarea [i];
- v = tab [cp - simple_case_map_ranges [i].start];
- } else {
- const guint32 *tab;
- i2 = (gint8)(i - (upper ? simple_upper_case_mapping_lowarea_table_count : simple_lower_case_mapping_lowarea_table_count));
- tab = upper ? simple_upper_case_mapping_higharea [i2] : simple_lower_case_mapping_higharea [i2];
- v = tab [cp - simple_case_map_ranges [i].start];
- }
- return v != 0 ? (gunichar) v : c;
- }
- return c;
-}
-
-gunichar
-g_unichar_toupper (gunichar c)
-{
- return g_unichar_case (c, TRUE);
-}
-
-gunichar
-g_unichar_tolower (gunichar c)
-{
- return g_unichar_case (c, FALSE);
-}
-
-gunichar
-g_unichar_totitle (gunichar c)
-{
- guint8 i;
- guint32 cp;
-
- cp = (guint32) c;
- for (i = 0; i < simple_titlecase_mapping_count; i++) {
- if (simple_titlecase_mapping [i].codepoint == cp)
- return simple_titlecase_mapping [i].title;
- if (simple_titlecase_mapping [i].codepoint > cp)
- /* it is ordered, hence no more match */
- break;
- }
- return g_unichar_toupper (c);
-}
-
-gboolean
-g_unichar_isxdigit (gunichar c)
-{
- return (g_unichar_xdigit_value (c) != -1);
-
-}
-
-gint
-g_unichar_xdigit_value (gunichar c)
-{
- if (c >= 0x30 && c <= 0x39) /*0-9*/
- return (c - 0x30);
- if (c >= 0x41 && c <= 0x46) /*A-F*/
- return (c - 0x37);
- if (c >= 0x61 && c <= 0x66) /*a-f*/
- return (c - 0x57);
- return -1;
-}
-
-gboolean
-g_unichar_isspace (gunichar c)
-{
- GUnicodeType type = g_unichar_type (c);
- if (type == G_UNICODE_LINE_SEPARATOR ||
- type == G_UNICODE_PARAGRAPH_SEPARATOR ||
- type == G_UNICODE_SPACE_SEPARATOR)
- return TRUE;
-
- return FALSE;
-}
-
-
-/*
- * This is broken, and assumes an UTF8 system, but will do for eglib's first user
- */
-gchar *
-g_filename_from_utf8 (const gchar *utf8string, gssize len, gsize *bytes_read, gsize *bytes_written, GError **error)
-{
- char *res;
-
- if (len == -1)
- len = strlen (utf8string);
-
- res = g_malloc (len + 1);
- g_strlcpy (res, utf8string, len + 1);
- return res;
-}
-
-#ifndef G_OS_WIN32
-static gboolean is_utf8;
-
-gboolean
-g_get_charset (G_CONST_RETURN char **charset)
-{
- if (my_charset == NULL) {
- /* These shouldn't be heap allocated */
-#if defined(HAVE_LOCALCHARSET_H)
- my_charset = locale_charset ();
-#else
- my_charset = "UTF-8";
-#endif
- is_utf8 = strcmp (my_charset, "UTF-8") == 0;
- }
-
- if (charset != NULL)
- *charset = my_charset;
-
- return is_utf8;
-}
-#endif /* G_OS_WIN32 */
-
-gchar *
-g_locale_to_utf8 (const gchar *opsysstring, gssize len, gsize *bytes_read, gsize *bytes_written, GError **error)
-{
- g_get_charset (NULL);
-
- return g_convert (opsysstring, len, "UTF-8", my_charset, bytes_read, bytes_written, error);
-}
-
-gchar *
-g_locale_from_utf8 (const gchar *utf8string, gssize len, gsize *bytes_read, gsize *bytes_written, GError **error)
-{
- g_get_charset (NULL);
-
- return g_convert (utf8string, len, my_charset, "UTF-8", bytes_read, bytes_written, error);
-}
+++ /dev/null
-/*
- * gutf8.c: UTF-8 conversion
- *
- * Author:
- * Atsushi Enomoto <atsushi@ximian.com>
- *
- * (C) 2006 Novell, Inc.
- * Copyright 2012 Xamarin Inc
- */
-
-#include <stdio.h>
-#include <glib.h>
-
-/*
- * Index into the table below with the first byte of a UTF-8 sequence to get
- * the number of bytes that are supposed to follow it to complete the sequence.
- *
- * Note that *legal* UTF-8 values can't have 4 or 5-bytes. The table is left
- * as-is for anyone who may want to do such conversion, which was allowed in
- * earlier algorithms.
-*/
-const guchar g_utf8_jump_table[256] = {
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
- 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, 4,4,4,4,4,4,4,4,5,5,5,5,6,6,1,1
-};
-
-static gchar *
-utf8_case_conv (const gchar *str, gssize len, gboolean upper)
-{
- gunichar *ustr;
- glong i, ulen;
- gchar *utf8;
-
- ustr = g_utf8_to_ucs4_fast (str, (glong) len, &ulen);
- for (i = 0; i < ulen; i++)
- ustr[i] = upper ? g_unichar_toupper (ustr[i]) : g_unichar_tolower (ustr[i]);
- utf8 = g_ucs4_to_utf8 (ustr, ulen, NULL, NULL, NULL);
- g_free (ustr);
-
- return utf8;
-}
-
-gchar *
-g_utf8_strup (const gchar *str, gssize len)
-{
- return utf8_case_conv (str, len, TRUE);
-}
-
-gchar *
-g_utf8_strdown (const gchar *str, gssize len)
-{
- return utf8_case_conv (str, len, FALSE);
-}
-
-static gboolean
-utf8_validate (const unsigned char *inptr, size_t len)
-{
- const unsigned char *ptr = inptr + len;
- unsigned char c;
-
- /* Everything falls through when TRUE... */
- switch (len) {
- default:
- return FALSE;
- case 4:
- if ((c = (*--ptr)) < 0x80 || c > 0xBF)
- return FALSE;
-
- if ((c == 0xBF || c == 0xBE) && ptr[-1] == 0xBF) {
- if (ptr[-2] == 0x8F || ptr[-2] == 0x9F ||
- ptr[-2] == 0xAF || ptr[-2] == 0xBF)
- return FALSE;
- }
- case 3:
- if ((c = (*--ptr)) < 0x80 || c > 0xBF)
- return FALSE;
- case 2:
- if ((c = (*--ptr)) < 0x80 || c > 0xBF)
- return FALSE;
-
- /* no fall-through in this inner switch */
- switch (*inptr) {
- case 0xE0: if (c < 0xA0) return FALSE; break;
- case 0xED: if (c > 0x9F) return FALSE; break;
- case 0xEF: if (c == 0xB7 && (ptr[1] > 0x8F && ptr[1] < 0xB0)) return FALSE;
- if (c == 0xBF && (ptr[1] == 0xBE || ptr[1] == 0xBF)) return FALSE;
- break;
- case 0xF0: if (c < 0x90) return FALSE; break;
- case 0xF4: if (c > 0x8F) return FALSE; break;
- default: if (c < 0x80) return FALSE; break;
- }
- case 1: if (*inptr >= 0x80 && *inptr < 0xC2) return FALSE;
- }
-
- if (*inptr > 0xF4)
- return FALSE;
-
- return TRUE;
-}
-
-/**
- * g_utf8_validate:
- * @str: a utf-8 encoded string
- * @max_len: max number of bytes to validate (or -1 to validate the entire null-terminated string)
- * @end: output parameter to mark the end of the valid input
- *
- * Checks @utf for being valid UTF-8. @str is assumed to be
- * null-terminated. This function is not super-strict, as it will
- * allow longer UTF-8 sequences than necessary. Note that Java is
- * capable of producing these sequences if provoked. Also note, this
- * routine checks for the 4-byte maximum size, but does not check for
- * 0x10ffff maximum value.
- *
- * Return value: %TRUE if @str is valid or %FALSE otherwise.
- **/
-gboolean
-g_utf8_validate (const gchar *str, gssize max_len, const gchar **end)
-{
- guchar *inptr = (guchar *) str;
- gboolean valid = TRUE;
- guint length, min;
- gssize n = 0;
-
- if (max_len == 0)
- return FALSE;
-
- if (max_len < 0) {
- while (*inptr != 0) {
- length = g_utf8_jump_table[*inptr];
- if (!utf8_validate (inptr, length)) {
- valid = FALSE;
- break;
- }
-
- inptr += length;
- }
- } else {
- while (n < max_len) {
- if (*inptr == 0) {
- /* Note: return FALSE if we encounter nul-byte
- * before max_len is reached. */
- valid = FALSE;
- break;
- }
-
- length = g_utf8_jump_table[*inptr];
- min = MIN (length, max_len - n);
-
- if (!utf8_validate (inptr, min)) {
- valid = FALSE;
- break;
- }
-
- if (min < length) {
- valid = FALSE;
- break;
- }
-
- inptr += length;
- n += length;
- }
- }
-
- if (end != NULL)
- *end = (gchar *) inptr;
-
- return valid;
-}
-
-gunichar
-g_utf8_get_char_validated (const gchar *str, gssize max_len)
-{
- unsigned char *inptr = (unsigned char *) str;
- gunichar u = *inptr;
- int n, i;
-
- if (max_len == 0)
- return -2;
-
- if (u < 0x80) {
- /* simple ascii case */
- return u;
- } else if (u < 0xc2) {
- return -1;
- } else if (u < 0xe0) {
- u &= 0x1f;
- n = 2;
- } else if (u < 0xf0) {
- u &= 0x0f;
- n = 3;
- } else if (u < 0xf8) {
- u &= 0x07;
- n = 4;
- } else if (u < 0xfc) {
- u &= 0x03;
- n = 5;
- } else if (u < 0xfe) {
- u &= 0x01;
- n = 6;
- } else {
- return -1;
- }
-
- if (max_len > 0) {
- if (!utf8_validate (inptr, MIN (max_len, n)))
- return -1;
-
- if (max_len < n)
- return -2;
- } else {
- if (!utf8_validate (inptr, n))
- return -1;
- }
-
- for (i = 1; i < n; i++)
- u = (u << 6) | (*++inptr ^ 0x80);
-
- return u;
-}
-
-glong
-g_utf8_strlen (const gchar *str, gssize max_len)
-{
- const guchar *inptr = (const guchar *) str;
- glong clen = 0, len = 0, n;
-
- if (max_len == 0)
- return 0;
-
- if (max_len < 0) {
- while (*inptr) {
- inptr += g_utf8_jump_table[*inptr];
- len++;
- }
- } else {
- while (len < max_len && *inptr) {
- n = g_utf8_jump_table[*inptr];
- if ((clen + n) > max_len)
- break;
-
- inptr += n;
- clen += n;
- len++;
- }
- }
-
- return len;
-}
-
-gunichar
-g_utf8_get_char (const gchar *src)
-{
- unsigned char *inptr = (unsigned char *) src;
- gunichar u = *inptr;
- int n, i;
-
- if (u < 0x80) {
- /* simple ascii case */
- return u;
- } else if (u < 0xe0) {
- u &= 0x1f;
- n = 2;
- } else if (u < 0xf0) {
- u &= 0x0f;
- n = 3;
- } else if (u < 0xf8) {
- u &= 0x07;
- n = 4;
- } else if (u < 0xfc) {
- u &= 0x03;
- n = 5;
- } else {
- u &= 0x01;
- n = 6;
- }
-
- for (i = 1; i < n; i++)
- u = (u << 6) | (*++inptr ^ 0x80);
-
- return u;
-}
-
-gchar *
-g_utf8_find_prev_char (const gchar *str, const gchar *p)
-{
- while (p > str) {
- p--;
- if ((*p & 0xc0) != 0xb0)
- return (gchar *)p;
- }
- return NULL;
-}
-
-gchar *
-g_utf8_prev_char (const gchar *str)
-{
- const gchar *p = str;
- do {
- p--;
- } while ((*p & 0xc0) == 0xb0);
-
- return (gchar *)p;
-}
-
-gchar *
-g_utf8_offset_to_pointer (const gchar *str, glong offset)
-{
- const gchar *p = str;
-
- if (offset > 0) {
- do {
- p = g_utf8_next_char (p);
- offset --;
- } while (offset > 0);
- }
- else if (offset < 0) {
- const gchar *jump = str;
- do {
- // since the minimum size of a character is 1
- // we know we can step back at least offset bytes
- jump = jump + offset;
-
- // if we land in the middle of a character
- // walk to the beginning
- while ((*jump & 0xc0) == 0xb0)
- jump --;
-
- // count how many characters we've actually walked
- // by going forward
- p = jump;
- do {
- p = g_utf8_next_char (p);
- offset ++;
- } while (p < jump);
-
- } while (offset < 0);
- }
-
- return (gchar *)p;
-}
-
-glong
-g_utf8_pointer_to_offset (const gchar *str, const gchar *pos)
-{
- const gchar *inptr, *inend;
- glong offset = 0;
- glong sign = 1;
-
- if (pos == str)
- return 0;
-
- if (str < pos) {
- inptr = str;
- inend = pos;
- } else {
- inptr = pos;
- inend = str;
- sign = -1;
- }
-
- do {
- inptr = g_utf8_next_char (inptr);
- offset++;
- } while (inptr < inend);
-
- return offset * sign;
-}
+++ /dev/null
-/*
- * sort.frag.h: Common implementation of linked-list sorting
- *
- * Author:
- * Raja R Harinath (rharinath@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.
- *
- * (C) 2006 Novell, Inc.
- */
-
-/*
- * This code requires a typedef named 'list_node' for the list node. It
- * is assumed that the list type is the type of a pointer to a list
- * node, and that the node has a field named 'next' that implements to
- * the linked list. No additional invariant is maintained (e.g. the
- * 'prev' pointer of a doubly-linked list node is _not_ updated). Any
- * invariant would require a post-processing pass to fix matters if
- * necessary.
- */
-typedef list_node *digit;
-
-/*
- * The maximum possible depth of the merge tree
- * = ceiling (log2 (maximum number of list nodes))
- * = ceiling (log2 (maximum possible memory size/size of each list node))
- * = number of bits in 'size_t' - floor (log2 (sizeof digit))
- * Also, each list in sort_info is at least 2 nodes long: we can reduce the depth by 1
- */
-#define FLOOR_LOG2(x) (((x)>=2) + ((x)>=4) + ((x)>=8) + ((x)>=16) + ((x)>=32) + ((x)>=64) + ((x)>=128))
-#define MAX_RANKS ((sizeof (size_t) * 8) - FLOOR_LOG2(sizeof (list_node)) - 1)
-
-struct sort_info
-{
- int min_rank, n_ranks;
- GCompareFunc func;
-
- /* Invariant: ranks[i] == NULL || length(ranks[i]) >= 2**(i+1) */
- list_node *ranks [MAX_RANKS]; /* ~ 128 bytes on 32bit, ~ 512 bytes on 64bit */
-};
-
-static inline void
-init_sort_info (struct sort_info *si, GCompareFunc func)
-{
- si->min_rank = si->n_ranks = 0;
- si->func = func;
- /* we don't need to initialize si->ranks, since we never lookup past si->n_ranks. */
-}
-
-static inline list_node *
-merge_lists (list_node *first, list_node *second, GCompareFunc func)
-{
- /* merge the two lists */
- list_node *list = NULL;
- list_node **pos = &list;
- while (first && second) {
- if (func (first->data, second->data) > 0) {
- *pos = second;
- second = second->next;
- } else {
- *pos = first;
- first = first->next;
- }
- pos = &((*pos)->next);
- }
- *pos = first ? first : second;
- return list;
-}
-
-/* Pre-condition: upto <= si->n_ranks, list == NULL || length(list) == 1 */
-static inline list_node *
-sweep_up (struct sort_info *si, list_node *list, int upto)
-{
-#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)
- /*
- * GCC incorrectly thinks we're writing below si->ranks array bounds.
- */
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Warray-bounds"
-#endif
-
- int i;
- for (i = si->min_rank; i < upto; ++i) {
- list = merge_lists (si->ranks [i], list, si->func);
- si->ranks [i] = NULL;
- }
- return list;
-
-#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)
-#pragma GCC diagnostic pop
-#endif
-}
-
-/*
- * The 'ranks' array essentially captures the recursion stack of a mergesort.
- * The merge tree is built in a bottom-up manner. The control loop for
- * updating the 'ranks' array is analogous to incrementing a binary integer,
- * and the O(n) time for counting upto n translates to O(n) merges when
- * inserting rank-0 lists. When we plug in the sizes of the lists involved in
- * those merges, we get the O(n log n) time for the sort.
- *
- * Inserting higher-ranked lists reduce the height of the merge tree, and also
- * eliminate a lot of redundant comparisons when merging two lists that would've
- * been part of the same run. Adding a rank-i list is analogous to incrementing
- * a binary integer by 2**i in one operation, thus sharing a similar speedup.
- *
- * When inserting higher-ranked lists, we choose to clear out the lower ranks
- * in the interests of keeping the sort stable, but this makes analysis harder.
- * Note that clearing the lower-ranked lists is O(length(list))-- thus it
- * shouldn't affect the O(n log n) behaviour. IOW, inserting one rank-i list
- * is equivalent to inserting 2**i rank-0 lists, thus even if we do i additional
- * merges in the clearing-out (taking at most 2**i time) we are still fine.
- */
-
-#define stringify2(x) #x
-#define stringify(x) stringify2(x)
-
-/* Pre-condition: 2**(rank+1) <= length(list) < 2**(rank+2) (therefore: length(list) >= 2) */
-static inline void
-insert_list (struct sort_info *si, list_node* list, int rank)
-{
-#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)
- /*
- * GCC incorrectly thinks we're writing below si->ranks array bounds.
- */
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Warray-bounds"
-#endif
-
- int i;
-
- if (rank > si->n_ranks) {
- if (rank > MAX_RANKS) {
- g_warning ("Rank '%d' should not exceed " stringify (MAX_RANKS), rank);
- rank = MAX_RANKS;
- }
- list = merge_lists (sweep_up (si, NULL, si->n_ranks), list, si->func);
- for (i = si->n_ranks; i < rank; ++i)
- si->ranks [i] = NULL;
- } else {
- if (rank)
- list = merge_lists (sweep_up (si, NULL, rank), list, si->func);
- for (i = rank; i < si->n_ranks && si->ranks [i]; ++i) {
- list = merge_lists (si->ranks [i], list, si->func);
- si->ranks [i] = NULL;
- }
- }
-
- if (i == MAX_RANKS) /* Will _never_ happen: so we can just devolve into quadratic ;-) */
- --i;
- if (i >= si->n_ranks)
- si->n_ranks = i + 1;
- si->min_rank = i;
- si->ranks [i] = list;
-
-#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)
-#pragma GCC diagnostic pop
-#endif
-}
-
-#undef stringify2
-#undef stringify
-#undef MAX_RANKS
-#undef FLOOR_LOG2
-
-/* A non-recursive mergesort */
-static inline digit
-do_sort (list_node* list, GCompareFunc func)
-{
- struct sort_info si;
-
- init_sort_info (&si, func);
-
- while (list && list->next) {
- list_node* next = list->next;
- list_node* tail = next->next;
-
- if (func (list->data, next->data) > 0) {
- next->next = list;
- next = list;
- list = list->next;
- }
- next->next = NULL;
-
- insert_list (&si, list, 0);
-
- list = tail;
- }
-
- return sweep_up (&si, list, si.n_ranks);
-}
+++ /dev/null
-/*
-This file is automatically generated by ucd.exe.
-The source for this generator should be in Mono repository
-(mcs/class/corlib/Mono.Globalization.Unicode directory).
-*/
-
-#ifndef __UNICODE_DATA_H
-#define __UNICODE_DATA_H
-
-#include <glib.h>
-
-
-/* ======== Structures ======== */
-typedef struct {
- guint32 codepoint;
- guint32 upper;
- guint32 title;
-} SimpleTitlecaseMapping;
-typedef struct {
- guint32 start;
- guint32 end;
-} CodePointRange;
-typedef struct {
- guint32 upper;
- guint32 lower;
-} SimpleCaseMapping;
-
-/* ======== Unicode Categories ======== */
-static const guint8 unicode_category_ranges_count = 11;
-static const CodePointRange unicode_category_ranges [] = {
-{0x000000, 0x003400},
-{0x004DC0, 0x004E00},
-{0x00A000, 0x00AA80},
-{0x00F900, 0x010000},
-{0x010000, 0x0104C0},
-{0x010800, 0x010A80},
-{0x012000, 0x012480},
-{0x01D000, 0x01D800},
-{0x01F000, 0x01F0C0},
-{0x02F800, 0x02FA40},
-{0x0E0000, 0x0E0200},
-{0, 0}};
-static const guint8 unicode_category_table0 [] = {
- /* ==== 0-3400 ==== */
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 29,21,21,21,23,21,21,21,22,18,21,25,21,17,21,21,
- 13,13,13,13,13,13,13,13,13,13,21,21,25,25,25,21,
- 21,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
- 9,9,9,9,9,9,9,9,9,9,9,22,21,18,24,16,
- 24,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,22,25,18,25,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 29,21,23,23,23,23,26,26,24,26,5,20,25,1,26,24,
- 26,25,15,15,24,5,26,21,24,15,5,19,15,15,15,21,
- 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
- 9,9,9,9,9,9,9,25,9,9,9,9,9,9,9,5,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,25,5,5,5,5,5,5,5,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,5,9,5,9,5,9,5,9,
- 5,9,5,9,5,9,5,9,5,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,9,5,9,5,9,5,5,
- 5,9,9,5,9,5,9,9,5,9,9,9,5,5,9,9,
- 9,9,5,9,9,5,9,9,9,5,5,5,9,9,5,9,
- 9,5,9,5,9,5,9,9,5,9,5,5,9,5,9,9,
- 5,9,9,9,5,9,5,9,9,5,5,7,9,5,5,5,
- 7,7,7,7,9,8,5,9,8,5,9,8,5,9,5,9,
- 5,9,5,9,5,9,5,9,5,9,5,9,5,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 5,9,8,5,9,5,9,9,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,5,5,5,5,5,5,9,9,5,9,9,5,
- 5,9,5,9,9,9,9,5,9,5,9,5,9,5,9,5,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,7,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
- 6,6,24,24,24,24,6,6,6,6,6,6,6,6,6,6,
- 6,6,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
- 6,6,6,6,6,24,24,24,24,24,24,24,6,24,6,24,
- 24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
- 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
- 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
- 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
- 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
- 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
- 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
- 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
- 9,5,9,5,6,24,9,5,0,0,6,5,5,5,21,0,
- 0,0,0,0,24,24,9,21,9,9,9,0,9,0,9,9,
- 5,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
- 9,9,0,9,9,9,9,9,9,9,9,9,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,9,
- 5,5,9,9,9,5,5,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 5,5,5,5,9,5,25,9,5,9,9,5,5,9,9,9,
- 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
- 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
- 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,26,12,12,12,12,12,11,11,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,9,5,9,5,9,5,9,5,9,5,9,5,9,5,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
- 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
- 9,9,9,9,9,9,9,0,0,6,21,21,21,21,21,21,
- 0,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,0,21,17,0,0,0,0,0,
- 0,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
- 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
- 12,12,12,12,12,12,12,12,12,12,12,12,12,12,17,12,
- 21,12,12,21,12,12,21,12,0,0,0,0,0,0,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,0,0,0,0,0,
- 7,7,7,21,21,0,0,0,0,0,0,0,0,0,0,0,
- 1,1,1,1,0,0,25,25,25,21,21,23,21,21,26,26,
- 12,12,12,12,12,12,12,12,12,12,12,21,0,0,21,21,
- 0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 6,7,7,7,7,7,7,7,7,7,7,12,12,12,12,12,
- 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,0,
- 13,13,13,13,13,13,13,13,13,13,21,21,21,21,7,7,
- 12,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,21,7,12,12,12,12,12,12,12,1,11,12,
- 12,12,12,12,12,6,6,12,12,26,12,12,12,12,7,7,
- 13,13,13,13,13,13,13,13,13,13,7,7,7,26,26,7,
- 21,21,21,21,21,21,21,21,21,21,21,21,21,21,0,1,
- 7,12,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
- 12,12,12,12,12,12,12,12,12,12,12,0,0,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,12,12,12,12,12,12,12,12,12,12,
- 12,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 13,13,13,13,13,13,13,13,13,13,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,12,12,12,12,12,
- 12,12,12,12,6,6,26,21,21,21,6,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,12,12,10,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,0,0,12,7,10,10,
- 10,12,12,12,12,12,12,12,12,10,10,10,10,12,0,0,
- 7,12,12,12,12,0,0,0,7,7,7,7,7,7,7,7,
- 7,7,12,12,21,21,13,13,13,13,13,13,13,13,13,13,
- 21,6,7,0,0,0,0,0,0,0,0,7,7,7,7,7,
- 0,12,10,10,0,7,7,7,7,7,7,7,7,0,0,7,
- 7,0,0,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,0,7,7,7,7,7,7,
- 7,0,7,0,0,0,7,7,7,7,0,0,12,7,10,10,
- 10,12,12,12,12,0,0,10,10,0,0,10,10,12,7,0,
- 0,0,0,0,0,0,0,10,0,0,0,0,7,7,0,7,
- 7,7,12,12,0,0,13,13,13,13,13,13,13,13,13,13,
- 7,7,23,23,15,15,15,15,15,15,26,0,0,0,0,0,
- 0,12,12,10,0,7,7,7,7,7,7,0,0,0,0,7,
- 7,0,0,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,0,7,7,7,7,7,7,
- 7,0,7,7,0,7,7,0,7,7,0,0,12,0,10,10,
- 10,12,12,0,0,0,0,12,12,0,0,12,12,12,0,0,
- 0,12,0,0,0,0,0,0,0,7,7,7,7,0,7,0,
- 0,0,0,0,0,0,13,13,13,13,13,13,13,13,13,13,
- 12,12,7,7,7,12,0,0,0,0,0,0,0,0,0,0,
- 0,12,12,10,0,7,7,7,7,7,7,7,7,7,0,7,
- 7,7,0,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,0,7,7,7,7,7,7,
- 7,0,7,7,0,7,7,7,7,7,0,0,12,7,10,10,
- 10,12,12,12,12,12,0,12,12,10,0,10,10,12,0,0,
- 7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 7,7,12,12,0,0,13,13,13,13,13,13,13,13,13,13,
- 0,23,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,12,10,10,0,7,7,7,7,7,7,7,7,0,0,7,
- 7,0,0,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,0,7,7,7,7,7,7,
- 7,0,7,7,0,7,7,7,7,7,0,0,12,7,10,12,
- 10,12,12,12,12,0,0,10,10,0,0,10,10,12,0,0,
- 0,0,0,0,0,0,12,10,0,0,0,0,7,7,0,7,
- 7,7,12,12,0,0,13,13,13,13,13,13,13,13,13,13,
- 26,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,12,7,0,7,7,7,7,7,7,0,0,0,7,7,
- 7,0,7,7,7,7,0,0,0,7,7,0,7,0,7,7,
- 0,0,0,7,7,0,0,0,7,7,7,0,0,0,7,7,
- 7,7,7,7,7,7,7,7,7,7,0,0,0,0,10,10,
- 12,10,10,0,0,0,10,10,10,0,10,10,10,12,0,0,
- 7,0,0,0,0,0,0,10,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,13,13,13,13,13,13,13,13,13,13,
- 15,15,15,26,26,26,26,26,26,23,26,0,0,0,0,0,
- 0,10,10,10,0,7,7,7,7,7,7,7,7,0,7,7,
- 7,0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,0,7,7,7,7,7,7,
- 7,7,7,7,0,7,7,7,7,7,0,0,0,7,12,12,
- 12,10,10,10,10,0,12,12,12,0,12,12,12,12,0,0,
- 0,0,0,0,0,12,12,0,7,7,0,0,0,0,0,0,
- 7,7,12,12,0,0,13,13,13,13,13,13,13,13,13,13,
- 0,0,0,0,0,0,0,0,15,15,15,15,15,15,15,26,
- 0,0,10,10,0,7,7,7,7,7,7,7,7,0,7,7,
- 7,0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,0,7,7,7,7,7,7,
- 7,7,7,7,0,7,7,7,7,7,0,0,12,7,10,12,
- 10,10,10,10,10,0,12,10,10,0,10,10,12,12,0,0,
- 0,0,0,0,0,10,10,0,0,0,0,0,0,0,7,0,
- 7,7,12,12,0,0,13,13,13,13,13,13,13,13,13,13,
- 0,26,26,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,10,10,0,7,7,7,7,7,7,7,7,0,7,7,
- 7,0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,0,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,0,0,0,7,10,10,
- 10,12,12,12,12,0,10,10,10,0,10,10,10,12,0,0,
- 0,0,0,0,0,0,0,10,0,0,0,0,0,0,0,0,
- 7,7,12,12,0,0,13,13,13,13,13,13,13,13,13,13,
- 15,15,15,15,15,15,0,0,0,26,7,7,7,7,7,7,
- 0,0,10,10,0,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,0,0,0,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,0,7,7,7,7,7,7,7,7,7,0,7,0,0,
- 7,7,7,7,7,7,7,0,0,0,12,0,0,0,0,10,
- 10,10,12,12,12,0,12,0,10,10,10,10,10,10,10,10,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,10,10,21,0,0,0,0,0,0,0,0,0,0,0,
- 0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,12,7,7,12,12,12,12,12,12,12,0,0,0,0,23,
- 7,7,7,7,7,7,6,12,12,12,12,12,12,12,12,21,
- 13,13,13,13,13,13,13,13,13,13,21,21,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,7,7,0,7,0,0,7,7,0,7,0,0,7,0,0,
- 0,0,0,0,7,7,7,7,0,7,7,7,7,7,7,7,
- 0,7,7,7,0,7,0,7,0,0,7,7,0,7,7,7,
- 7,12,7,7,12,12,12,12,12,12,0,12,12,7,0,0,
- 7,7,7,7,7,0,6,0,12,12,12,12,12,12,0,0,
- 13,13,13,13,13,13,13,13,13,13,0,0,7,7,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 7,26,26,26,21,21,21,21,21,21,21,21,21,21,21,21,
- 21,21,21,26,26,26,26,26,12,12,26,26,26,26,26,26,
- 13,13,13,13,13,13,13,13,13,13,15,15,15,15,15,15,
- 15,15,15,15,26,12,26,12,26,12,22,18,22,18,10,10,
- 7,7,7,7,7,7,7,7,0,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,0,
- 0,12,12,12,12,12,12,12,12,12,12,12,12,12,12,10,
- 12,12,12,12,12,21,12,12,7,7,7,7,0,0,0,0,
- 12,12,12,12,12,12,12,12,0,12,12,12,12,12,12,12,
- 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
- 12,12,12,12,12,12,12,12,12,12,12,12,12,0,26,26,
- 26,26,26,26,26,26,12,26,26,26,26,26,26,0,26,26,
- 21,21,21,21,21,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,10,10,12,12,12,
- 12,10,12,12,12,12,12,12,10,12,12,10,10,12,12,7,
- 13,13,13,13,13,13,13,13,13,13,21,21,21,21,21,21,
- 7,7,7,7,7,7,10,10,12,12,7,7,7,7,12,12,
- 12,7,10,10,10,7,7,10,10,10,10,10,10,10,7,7,
- 7,12,12,12,12,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,12,10,10,12,12,10,10,10,10,10,10,12,7,10,
- 13,13,13,13,13,13,13,13,13,13,0,0,0,0,26,26,
- 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
- 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
- 9,9,9,9,9,9,0,0,0,0,0,0,0,0,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,21,6,0,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,0,0,0,0,0,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,0,0,0,0,0,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,0,0,0,0,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,0,7,7,7,7,0,0,
- 7,7,7,7,7,7,7,0,7,0,7,7,7,7,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,0,7,7,7,7,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,0,7,7,7,7,0,0,7,7,7,7,7,7,7,0,
- 7,0,7,7,7,7,0,0,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,0,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,0,7,7,7,7,0,0,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,0,0,0,0,12,
- 26,21,21,21,21,21,21,21,21,15,15,15,15,15,15,15,
- 15,15,15,15,15,15,15,15,15,15,15,15,15,0,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 26,26,26,26,26,26,26,26,26,26,0,0,0,0,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,0,0,0,0,0,0,0,0,0,0,0,
- 0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,21,21,7,
- 7,7,7,7,7,7,7,0,0,0,0,0,0,0,0,0,
- 29,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,22,18,0,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,21,21,21,14,14,
- 14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,0,7,7,
- 7,7,12,12,12,0,0,0,0,0,0,0,0,0,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,12,12,12,21,21,0,0,0,0,0,0,0,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,12,12,0,0,0,0,0,0,0,0,0,0,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,0,7,7,
- 7,0,12,12,0,0,0,0,0,0,0,0,0,0,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,1,1,10,12,12,12,12,12,12,12,10,10,
- 10,10,10,10,10,10,12,10,10,12,12,12,12,12,12,12,
- 12,12,12,12,21,21,21,6,21,21,21,23,7,12,0,0,
- 13,13,13,13,13,13,13,13,13,13,0,0,0,0,0,0,
- 15,15,15,15,15,15,15,15,15,15,0,0,0,0,0,0,
- 21,21,21,21,21,21,17,21,21,21,21,12,12,12,29,0,
- 13,13,13,13,13,13,13,13,13,13,0,0,0,0,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,6,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,0,0,0,0,0,0,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,12,7,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,0,
- 12,12,12,10,10,10,10,12,12,10,10,10,0,0,0,0,
- 10,10,12,10,10,10,10,10,10,12,12,12,0,0,0,0,
- 26,0,0,0,21,21,13,13,13,13,13,13,13,13,13,13,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,
- 7,7,7,7,7,0,0,0,0,0,0,0,0,0,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,0,0,0,0,0,0,
- 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
- 10,7,7,7,7,7,7,7,10,10,0,0,0,0,0,0,
- 13,13,13,13,13,13,13,13,13,13,0,0,0,0,21,21,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,12,12,10,10,10,0,0,21,21,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 12,12,12,12,10,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,12,10,12,12,12,12,12,10,12,10,10,10,
- 10,10,12,10,10,7,7,7,7,7,7,7,0,0,0,0,
- 13,13,13,13,13,13,13,13,13,13,21,21,21,21,21,21,
- 21,26,26,26,26,26,26,26,26,26,26,12,12,12,12,12,
- 12,12,12,12,26,26,26,26,26,26,26,26,26,0,0,0,
- 12,12,10,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,10,12,12,12,12,10,10,12,12,10,0,0,0,7,7,
- 13,13,13,13,13,13,13,13,13,13,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,10,10,10,10,10,10,10,10,12,12,12,12,
- 12,12,12,12,10,10,12,12,0,0,0,21,21,21,21,21,
- 13,13,13,13,13,13,13,13,13,13,0,0,0,7,7,7,
- 13,13,13,13,13,13,13,13,13,13,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,6,6,6,6,6,6,21,21,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,
- 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
- 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
- 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
- 6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,6,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,
- 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
- 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
- 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
- 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
- 12,12,12,12,12,12,12,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,12,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,5,5,5,5,5,5,5,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 5,5,5,5,5,5,5,5,9,9,9,9,9,9,9,9,
- 5,5,5,5,5,5,0,0,9,9,9,9,9,9,0,0,
- 5,5,5,5,5,5,5,5,9,9,9,9,9,9,9,9,
- 5,5,5,5,5,5,5,5,9,9,9,9,9,9,9,9,
- 5,5,5,5,5,5,0,0,9,9,9,9,9,9,0,0,
- 5,5,5,5,5,5,5,5,0,9,0,9,0,9,0,9,
- 5,5,5,5,5,5,5,5,9,9,9,9,9,9,9,9,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,0,0,
- 5,5,5,5,5,5,5,5,8,8,8,8,8,8,8,8,
- 5,5,5,5,5,5,5,5,8,8,8,8,8,8,8,8,
- 5,5,5,5,5,5,5,5,8,8,8,8,8,8,8,8,
- 5,5,5,5,5,0,5,5,9,9,9,9,8,24,5,24,
- 24,24,5,5,5,0,5,5,9,9,9,9,8,24,24,24,
- 5,5,5,5,0,0,5,5,9,9,9,9,0,24,24,24,
- 5,5,5,5,5,5,5,5,9,9,9,9,9,24,24,24,
- 0,0,5,5,5,0,5,5,9,9,9,9,8,24,24,0,
- 29,29,29,29,29,29,29,29,29,29,29,1,1,1,1,1,
- 17,17,17,17,17,17,21,21,20,19,22,20,20,19,22,20,
- 21,21,21,21,21,21,21,21,27,28,1,1,1,1,1,29,
- 21,21,21,21,21,21,21,21,21,20,19,21,21,21,21,16,
- 16,21,21,21,25,22,18,21,21,21,21,21,21,21,21,21,
- 21,21,25,21,16,21,21,21,21,21,21,21,21,21,21,29,
- 1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,
- 15,5,0,0,15,15,15,15,15,15,25,25,25,22,18,5,
- 15,15,15,15,15,15,15,15,15,15,25,25,25,22,18,0,
- 6,6,6,6,6,0,0,0,0,0,0,0,0,0,0,0,
- 23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
- 23,23,23,23,23,23,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 12,12,12,12,12,12,12,12,12,12,12,12,12,11,11,11,
- 11,12,11,11,11,12,12,12,12,12,12,12,12,12,12,12,
- 12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 26,26,9,26,26,26,26,9,26,26,5,9,9,9,5,5,
- 9,9,9,5,26,9,26,26,26,9,9,9,9,9,26,26,
- 26,26,26,26,9,26,9,26,9,26,9,9,9,9,26,5,
- 9,9,9,9,5,7,7,7,7,5,26,26,5,5,9,9,
- 25,25,25,25,25,9,5,5,5,5,26,25,26,26,5,26,
- 0,0,0,15,15,15,15,15,15,15,15,15,15,15,15,15,
- 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
- 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
- 14,14,14,9,5,14,14,14,14,0,0,0,0,0,0,0,
- 25,25,25,25,25,26,26,26,26,26,25,25,26,26,26,26,
- 25,26,26,25,26,26,25,26,26,26,26,26,26,26,25,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,25,25,
- 26,26,25,26,25,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 26,26,26,26,26,26,26,26,25,25,25,25,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 25,25,26,26,26,26,26,26,26,22,18,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,25,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,25,25,25,25,
- 25,25,26,26,26,26,26,26,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 26,26,26,26,26,26,26,26,26,26,26,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
- 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
- 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
- 15,15,15,15,15,15,15,15,15,15,15,15,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,15,15,15,15,15,15,
- 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,25,26,26,26,26,26,26,26,26,
- 26,25,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,25,25,25,25,25,25,25,25,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,25,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,0,0,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,0,0,0,
- 26,26,26,26,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,26,26,26,26,0,26,26,26,26,0,0,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,0,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,0,26,0,26,
- 26,26,26,0,0,0,26,0,26,26,26,26,26,26,26,0,
- 0,26,26,26,26,26,26,26,22,18,22,18,22,18,22,18,
- 22,18,22,18,22,18,15,15,15,15,15,15,15,15,15,15,
- 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
- 15,15,15,15,26,0,0,0,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 0,26,26,26,26,26,26,26,26,26,26,26,26,26,26,0,
- 25,25,25,25,25,22,18,25,25,25,25,0,25,0,0,0,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,22,18,22,18,22,18,22,18,22,18,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,22,18,22,18,22,18,22,18,22,18,22,18,22,
- 18,22,18,22,18,22,18,22,18,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,22,18,22,18,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,22,18,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
- 25,25,25,25,25,26,26,25,25,25,25,25,25,0,0,0,
- 26,26,26,26,26,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
- 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
- 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,0,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0,
- 9,5,9,9,9,5,5,9,5,9,5,9,5,9,9,9,
- 0,5,9,5,5,9,5,5,5,5,5,5,5,6,0,0,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,5,26,26,26,26,26,26,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,21,21,21,21,15,21,21,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,0,0,0,0,0,0,0,0,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,0,0,0,0,0,0,0,0,0,6,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,0,0,0,0,0,0,0,0,0,
- 7,7,7,7,7,7,7,0,7,7,7,7,7,7,7,0,
- 7,7,7,7,7,7,7,0,7,7,7,7,7,7,7,0,
- 7,7,7,7,7,7,7,0,7,7,7,7,7,7,7,0,
- 7,7,7,7,7,7,7,0,7,7,7,7,7,7,7,0,
- 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
- 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
- 21,21,20,19,20,19,21,21,21,20,19,21,20,19,21,21,
- 21,21,21,21,21,21,21,17,21,21,17,21,20,19,21,21,
- 20,19,22,18,22,18,22,18,22,18,21,21,21,21,21,6,
- 21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,0,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,0,0,0,0,0,0,0,0,0,0,0,0,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 26,26,26,26,26,26,26,26,26,26,26,26,0,0,0,0,
- 29,21,21,21,26,6,7,14,22,18,22,18,22,18,22,18,
- 22,18,26,26,22,18,22,18,22,18,22,18,17,22,18,18,
- 26,14,14,14,14,14,14,14,14,14,12,12,12,12,12,12,
- 17,6,6,6,6,6,26,26,14,14,14,6,7,21,26,26,
- 0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,0,0,12,12,24,24,6,6,7,
- 17,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,21,6,6,6,7,
- 0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,
- 0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,
- 26,26,15,15,15,15,26,26,26,26,26,26,26,26,26,26,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,0,0,0,0,0,0,0,0,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,0,0,0,0,0,0,0,0,0,0,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,0,
- 15,15,15,15,15,15,15,15,15,15,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,0,0,0,0,0,0,0,0,0,0,0,0,
- 26,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 15,15,15,15,15,15,15,15,15,15,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,0,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 0};
-static const guint8 unicode_category_table1 [] = {
- /* ==== 4DC0-4E00 ==== */
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 0};
-static const guint8 unicode_category_table2 [] = {
- /* ==== A000-AA80 ==== */
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,6,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,0,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,6,21,21,21,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 13,13,13,13,13,13,13,13,13,13,7,7,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 0,0,9,5,9,5,9,5,9,5,9,5,9,5,7,12,
- 11,11,11,21,0,0,0,0,0,0,0,0,12,12,21,6,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
- 24,24,24,24,24,24,24,6,6,6,6,6,6,6,6,6,
- 24,24,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 5,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
- 6,5,5,5,5,5,5,5,5,9,5,9,5,9,9,5,
- 9,5,9,5,9,5,9,5,6,24,24,9,5,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,7,7,7,7,7,
- 7,7,12,7,7,7,12,7,7,7,7,12,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,10,10,12,12,10,26,26,26,26,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,21,21,21,21,0,0,0,0,0,0,0,0,
- 10,10,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,10,10,10,10,10,10,10,10,10,10,10,10,
- 10,10,10,10,12,0,0,0,0,0,0,0,0,0,21,21,
- 13,13,13,13,13,13,13,13,13,13,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 13,13,13,13,13,13,13,13,13,13,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,12,12,12,12,12,12,12,12,21,21,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,12,12,12,12,12,12,12,12,12,
- 12,12,10,10,0,0,0,0,0,0,0,0,0,0,0,21,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,12,12,12,12,12,12,10,
- 10,12,12,10,10,12,12,0,0,0,0,0,0,0,0,0,
- 7,7,7,12,7,7,7,7,7,7,7,7,12,10,0,0,
- 13,13,13,13,13,13,13,13,13,13,0,0,21,21,21,21,
- 0};
-static const guint8 unicode_category_table3 [] = {
- /* ==== F900-10000 ==== */
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,0,0,0,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 5,5,5,5,5,5,5,0,0,0,0,0,0,0,0,0,
- 0,0,0,5,5,5,5,5,0,0,0,0,0,7,12,7,
- 7,7,7,7,7,7,7,7,7,25,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,0,7,7,7,7,7,0,7,0,
- 7,7,0,7,7,0,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,22,18,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 0,0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,23,26,0,0,
- 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
- 21,21,21,21,21,21,21,22,18,21,0,0,0,0,0,0,
- 12,12,12,12,12,12,12,0,0,0,0,0,0,0,0,0,
- 21,17,17,16,16,22,18,22,18,22,18,22,18,22,18,22,
- 18,22,18,22,18,21,21,22,18,21,21,21,21,16,16,16,
- 21,21,21,0,21,21,21,21,17,22,18,22,18,22,18,21,
- 21,21,25,17,25,25,25,0,21,23,21,21,0,0,0,0,
- 7,7,7,7,7,0,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,1,
- 0,21,21,21,23,21,21,21,22,18,21,25,21,17,21,21,
- 13,13,13,13,13,13,13,13,13,13,21,21,25,25,25,21,
- 21,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
- 9,9,9,9,9,9,9,9,9,9,9,22,21,18,24,16,
- 24,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,22,25,18,25,22,
- 18,21,22,18,21,21,7,7,7,7,7,7,7,7,7,7,
- 6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,6,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,
- 0,0,7,7,7,7,7,7,0,0,7,7,7,7,7,7,
- 0,0,7,7,7,7,7,7,0,0,7,7,7,0,0,0,
- 23,23,25,24,26,23,23,0,26,25,25,25,25,26,26,0,
- 0,0,0,0,0,0,0,0,0,1,1,1,26,26,0};
-static const guint8 unicode_category_table4 [] = {
- /* ==== 10000-104C0 ==== */
- 7,7,7,7,7,7,7,7,7,7,7,7,0,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,0,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,0,7,7,0,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,0,0,0,0,0,
- 21,21,26,0,0,0,0,15,15,15,15,15,15,15,15,15,
- 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
- 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
- 15,15,15,15,0,0,0,26,26,26,26,26,26,26,26,26,
- 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
- 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
- 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
- 14,14,14,14,14,15,15,15,15,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,15,0,0,0,0,0,
- 26,26,26,26,26,26,26,26,26,26,26,26,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,12,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,
- 15,15,15,15,0,0,0,0,0,0,0,0,0,0,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,14,7,7,7,7,7,7,7,7,14,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,21,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,0,0,0,0,7,7,7,7,7,7,7,7,
- 21,14,14,14,14,14,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
- 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
- 9,9,9,9,9,9,9,9,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,
- 13,13,13,13,13,13,13,13,13,13,0};
-static const guint8 unicode_category_table5 [] = {
- /* ==== 10800-10A80 ==== */
- 7,7,7,7,7,7,0,0,7,0,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,0,7,7,0,0,0,7,0,0,7,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,15,15,15,15,0,0,0,0,0,21,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,0,0,0,0,0,21,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 7,12,12,12,0,12,12,0,0,0,0,0,12,12,12,12,
- 7,7,7,7,0,7,7,7,0,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,0,0,0,0,12,12,12,0,0,0,0,12,
- 15,15,15,15,15,15,15,15,0,0,0,0,0,0,0,0,
- 21,21,21,21,21,21,21,21,21,0};
-static const guint8 unicode_category_table6 [] = {
- /* ==== 12000-12480 ==== */
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
- 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
- 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
- 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
- 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
- 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
- 14,14,14,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 21,21,21,21,0};
-static const guint8 unicode_category_table7 [] = {
- /* ==== 1D000-1D800 ==== */
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,0,0,0,0,0,0,0,0,0,0,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,0,0,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,10,10,12,12,12,26,26,26,10,10,10,
- 10,10,10,1,1,1,1,1,1,1,1,12,12,12,12,12,
- 12,12,12,26,26,12,12,12,12,12,12,12,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,12,12,12,12,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,12,12,12,26,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,0,0,0,0,0,0,0,0,0,
- 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
- 15,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
- 9,9,9,9,9,9,9,9,9,9,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,9,9,9,9,9,9,9,9,9,9,9,9,
- 9,9,9,9,9,9,9,9,9,9,9,9,9,9,5,5,
- 5,5,5,5,5,0,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,9,9,9,9,9,9,9,9,
- 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
- 9,9,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,5,9,0,9,9,
- 0,0,9,0,0,9,9,0,0,9,9,9,9,0,9,9,
- 9,9,9,9,9,9,5,5,5,5,0,5,0,5,5,5,
- 5,5,5,5,0,5,5,5,5,5,5,5,5,5,5,5,
- 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
- 9,9,9,9,9,9,9,9,9,9,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,9,9,0,9,9,9,9,0,0,9,9,9,
- 9,9,9,9,9,0,9,9,9,9,9,9,9,0,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,9,9,0,9,9,9,9,0,
- 9,9,9,9,9,0,9,0,0,0,9,9,9,9,9,9,
- 9,0,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,5,9,9,9,9,
- 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
- 9,9,9,9,9,9,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
- 9,9,9,9,9,9,9,9,9,9,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,9,9,9,9,9,9,9,9,9,9,9,9,
- 9,9,9,9,9,9,9,9,9,9,9,9,9,9,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,9,9,9,9,9,9,9,9,
- 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
- 9,9,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,5,9,9,9,9,
- 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
- 9,9,9,9,9,9,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
- 9,9,9,9,9,9,9,9,9,9,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,0,0,9,9,9,9,9,9,9,9,
- 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
- 9,25,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,25,5,5,5,5,
- 5,5,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
- 9,9,9,9,9,9,9,9,9,9,9,25,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,25,5,5,5,5,5,5,9,9,9,9,
- 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
- 9,9,9,9,9,25,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,25,
- 5,5,5,5,5,5,9,9,9,9,9,9,9,9,9,9,
- 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,25,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,25,5,5,5,5,5,5,
- 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
- 9,9,9,9,9,9,9,9,9,25,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,25,5,5,5,5,5,5,9,5,0,0,13,13,
- 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
- 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
- 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
- 0};
-static const guint8 unicode_category_table8 [] = {
- /* ==== 1F000-1F0C0 ==== */
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,0,0,0,0,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
- 26,26,26,26,0};
-static const guint8 unicode_category_table9 [] = {
- /* ==== 2F800-2FA40 ==== */
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,0};
-static const guint8 unicode_category_table10 [] = {
- /* ==== E0000-E0200 ==== */
- 0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
- 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
- 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
- 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
- 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
- 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
- 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
- 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
- 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
- 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
- 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
- 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
- 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
- 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
- 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
- 0};
-static const guint8 *unicode_category [11] = {
- unicode_category_table0,
- unicode_category_table1,
- unicode_category_table2,
- unicode_category_table3,
- unicode_category_table4,
- unicode_category_table5,
- unicode_category_table6,
- unicode_category_table7,
- unicode_category_table8,
- unicode_category_table9,
- unicode_category_table10
-};
-
-static const guint8 simple_case_map_ranges_count = 9;
-static const CodePointRange simple_case_map_ranges [] = {
-{0x000040, 0x000600},
-{0x001000, 0x0010D0},
-{0x001D00, 0x002000},
-{0x002100, 0x0021C0},
-{0x002480, 0x002500},
-{0x002C00, 0x002D80},
-{0x00A640, 0x00A7C0},
-{0x00FF20, 0x00FF80},
-{0x010400, 0x010480},
-{0, 0}};
-static const guint16 simple_upper_case_mapping_lowarea_table0 [] = {
- /* ==== 40-600 ==== */
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F,
- 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0x39C,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,
- 0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0x178,
- 0,0x100,0,0x102,0,0x104,0,0x106,0,0x108,0,0x10A,0,0x10C,0,0x10E,
- 0,0x110,0,0x112,0,0x114,0,0x116,0,0x118,0,0x11A,0,0x11C,0,0x11E,
- 0,0x120,0,0x122,0,0x124,0,0x126,0,0x128,0,0x12A,0,0x12C,0,0x12E,
- 0,0x49,0,0x132,0,0x134,0,0x136,0,0,0x139,0,0x13B,0,0x13D,0,
- 0x13F,0,0x141,0,0x143,0,0x145,0,0x147,0,0,0x14A,0,0x14C,0,0x14E,
- 0,0x150,0,0x152,0,0x154,0,0x156,0,0x158,0,0x15A,0,0x15C,0,0x15E,
- 0,0x160,0,0x162,0,0x164,0,0x166,0,0x168,0,0x16A,0,0x16C,0,0x16E,
- 0,0x170,0,0x172,0,0x174,0,0x176,0,0,0x179,0,0x17B,0,0x17D,0x53,
- 0x243,0,0,0x182,0,0x184,0,0,0x187,0,0,0,0x18B,0,0,0,
- 0,0,0x191,0,0,0x1F6,0,0,0,0x198,0x23D,0,0,0,0x220,0,
- 0,0x1A0,0,0x1A2,0,0x1A4,0,0,0x1A7,0,0,0,0,0x1AC,0,0,
- 0x1AF,0,0,0,0x1B3,0,0x1B5,0,0,0x1B8,0,0,0,0x1BC,0,0x1F7,
- 0,0,0,0,0,0x1C4,0x1C4,0,0x1C7,0x1C7,0,0x1CA,0x1CA,0,0x1CD,0,
- 0x1CF,0,0x1D1,0,0x1D3,0,0x1D5,0,0x1D7,0,0x1D9,0,0x1DB,0x18E,0,0x1DE,
- 0,0x1E0,0,0x1E2,0,0x1E4,0,0x1E6,0,0x1E8,0,0x1EA,0,0x1EC,0,0x1EE,
- 0,0,0x1F1,0x1F1,0,0x1F4,0,0,0,0x1F8,0,0x1FA,0,0x1FC,0,0x1FE,
- 0,0x200,0,0x202,0,0x204,0,0x206,0,0x208,0,0x20A,0,0x20C,0,0x20E,
- 0,0x210,0,0x212,0,0x214,0,0x216,0,0x218,0,0x21A,0,0x21C,0,0x21E,
- 0,0,0,0x222,0,0x224,0,0x226,0,0x228,0,0x22A,0,0x22C,0,0x22E,
- 0,0x230,0,0x232,0,0,0,0,0,0,0,0,0x23B,0,0,0,
- 0,0,0x241,0,0,0,0,0x246,0,0x248,0,0x24A,0,0x24C,0,0x24E,
- 0x2C6F,0x2C6D,0,0x181,0x186,0,0x189,0x18A,0,0x18F,0,0x190,0,0,0,0,
- 0x193,0,0,0x194,0,0,0,0,0x197,0x196,0,0x2C62,0,0,0,0x19C,
- 0,0x2C6E,0x19D,0,0,0x19F,0,0,0,0,0,0,0,0x2C64,0,0,
- 0x1A6,0,0,0x1A9,0,0,0,0,0x1AE,0x244,0x1B1,0x1B2,0x245,0,0,0,
- 0,0,0x1B7,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0x399,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0x370,0,0x372,0,0,0,0x376,0,0,0,0x3FD,0x3FE,0x3FF,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0x386,0x388,0x389,0x38A,
- 0,0x391,0x392,0x393,0x394,0x395,0x396,0x397,0x398,0x399,0x39A,0x39B,0x39C,0x39D,0x39E,0x39F,
- 0x3A0,0x3A1,0x3A3,0x3A3,0x3A4,0x3A5,0x3A6,0x3A7,0x3A8,0x3A9,0x3AA,0x3AB,0x38C,0x38E,0x38F,0,
- 0x392,0x398,0,0,0,0x3A6,0x3A0,0x3CF,0,0x3D8,0,0x3DA,0,0x3DC,0,0x3DE,
- 0,0x3E0,0,0x3E2,0,0x3E4,0,0x3E6,0,0x3E8,0,0x3EA,0,0x3EC,0,0x3EE,
- 0x39A,0x3A1,0x3F9,0,0,0x395,0,0,0x3F7,0,0,0x3FA,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0x410,0x411,0x412,0x413,0x414,0x415,0x416,0x417,0x418,0x419,0x41A,0x41B,0x41C,0x41D,0x41E,0x41F,
- 0x420,0x421,0x422,0x423,0x424,0x425,0x426,0x427,0x428,0x429,0x42A,0x42B,0x42C,0x42D,0x42E,0x42F,
- 0x400,0x401,0x402,0x403,0x404,0x405,0x406,0x407,0x408,0x409,0x40A,0x40B,0x40C,0x40D,0x40E,0x40F,
- 0,0x460,0,0x462,0,0x464,0,0x466,0,0x468,0,0x46A,0,0x46C,0,0x46E,
- 0,0x470,0,0x472,0,0x474,0,0x476,0,0x478,0,0x47A,0,0x47C,0,0x47E,
- 0,0x480,0,0,0,0,0,0,0,0,0,0x48A,0,0x48C,0,0x48E,
- 0,0x490,0,0x492,0,0x494,0,0x496,0,0x498,0,0x49A,0,0x49C,0,0x49E,
- 0,0x4A0,0,0x4A2,0,0x4A4,0,0x4A6,0,0x4A8,0,0x4AA,0,0x4AC,0,0x4AE,
- 0,0x4B0,0,0x4B2,0,0x4B4,0,0x4B6,0,0x4B8,0,0x4BA,0,0x4BC,0,0x4BE,
- 0,0,0x4C1,0,0x4C3,0,0x4C5,0,0x4C7,0,0x4C9,0,0x4CB,0,0x4CD,0x4C0,
- 0,0x4D0,0,0x4D2,0,0x4D4,0,0x4D6,0,0x4D8,0,0x4DA,0,0x4DC,0,0x4DE,
- 0,0x4E0,0,0x4E2,0,0x4E4,0,0x4E6,0,0x4E8,0,0x4EA,0,0x4EC,0,0x4EE,
- 0,0x4F0,0,0x4F2,0,0x4F4,0,0x4F6,0,0x4F8,0,0x4FA,0,0x4FC,0,0x4FE,
- 0,0x500,0,0x502,0,0x504,0,0x506,0,0x508,0,0x50A,0,0x50C,0,0x50E,
- 0,0x510,0,0x512,0,0x514,0,0x516,0,0x518,0,0x51A,0,0x51C,0,0x51E,
- 0,0x520,0,0x522,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0x531,0x532,0x533,0x534,0x535,0x536,0x537,0x538,0x539,0x53A,0x53B,0x53C,0x53D,0x53E,0x53F,
- 0x540,0x541,0x542,0x543,0x544,0x545,0x546,0x547,0x548,0x549,0x54A,0x54B,0x54C,0x54D,0x54E,0x54F,
- 0x550,0x551,0x552,0x553,0x554,0x555,0x556,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0};
-static const guint16 simple_upper_case_mapping_lowarea_table1 [] = {
- /* ==== 1000-10D0 ==== */
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0};
-static const guint16 simple_upper_case_mapping_lowarea_table2 [] = {
- /* ==== 1D00-2000 ==== */
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0xA77D,0,0,0,0x2C63,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0x1E00,0,0x1E02,0,0x1E04,0,0x1E06,0,0x1E08,0,0x1E0A,0,0x1E0C,0,0x1E0E,
- 0,0x1E10,0,0x1E12,0,0x1E14,0,0x1E16,0,0x1E18,0,0x1E1A,0,0x1E1C,0,0x1E1E,
- 0,0x1E20,0,0x1E22,0,0x1E24,0,0x1E26,0,0x1E28,0,0x1E2A,0,0x1E2C,0,0x1E2E,
- 0,0x1E30,0,0x1E32,0,0x1E34,0,0x1E36,0,0x1E38,0,0x1E3A,0,0x1E3C,0,0x1E3E,
- 0,0x1E40,0,0x1E42,0,0x1E44,0,0x1E46,0,0x1E48,0,0x1E4A,0,0x1E4C,0,0x1E4E,
- 0,0x1E50,0,0x1E52,0,0x1E54,0,0x1E56,0,0x1E58,0,0x1E5A,0,0x1E5C,0,0x1E5E,
- 0,0x1E60,0,0x1E62,0,0x1E64,0,0x1E66,0,0x1E68,0,0x1E6A,0,0x1E6C,0,0x1E6E,
- 0,0x1E70,0,0x1E72,0,0x1E74,0,0x1E76,0,0x1E78,0,0x1E7A,0,0x1E7C,0,0x1E7E,
- 0,0x1E80,0,0x1E82,0,0x1E84,0,0x1E86,0,0x1E88,0,0x1E8A,0,0x1E8C,0,0x1E8E,
- 0,0x1E90,0,0x1E92,0,0x1E94,0,0,0,0,0,0x1E60,0,0,0,0,
- 0,0x1EA0,0,0x1EA2,0,0x1EA4,0,0x1EA6,0,0x1EA8,0,0x1EAA,0,0x1EAC,0,0x1EAE,
- 0,0x1EB0,0,0x1EB2,0,0x1EB4,0,0x1EB6,0,0x1EB8,0,0x1EBA,0,0x1EBC,0,0x1EBE,
- 0,0x1EC0,0,0x1EC2,0,0x1EC4,0,0x1EC6,0,0x1EC8,0,0x1ECA,0,0x1ECC,0,0x1ECE,
- 0,0x1ED0,0,0x1ED2,0,0x1ED4,0,0x1ED6,0,0x1ED8,0,0x1EDA,0,0x1EDC,0,0x1EDE,
- 0,0x1EE0,0,0x1EE2,0,0x1EE4,0,0x1EE6,0,0x1EE8,0,0x1EEA,0,0x1EEC,0,0x1EEE,
- 0,0x1EF0,0,0x1EF2,0,0x1EF4,0,0x1EF6,0,0x1EF8,0,0x1EFA,0,0x1EFC,0,0x1EFE,
- 0x1F08,0x1F09,0x1F0A,0x1F0B,0x1F0C,0x1F0D,0x1F0E,0x1F0F,0,0,0,0,0,0,0,0,
- 0x1F18,0x1F19,0x1F1A,0x1F1B,0x1F1C,0x1F1D,0,0,0,0,0,0,0,0,0,0,
-0x1F28,0x1F29,0x1F2A,0x1F2B,0x1F2C,0x1F2D,0x1F2E,0x1F2F,0,0,0,0,0,0,0,0,
- 0x1F38,0x1F39,0x1F3A,0x1F3B,0x1F3C,0x1F3D,0x1F3E,0x1F3F,0,0,0,0,0,0,0,0,
- 0x1F48,0x1F49,0x1F4A,0x1F4B,0x1F4C,0x1F4D,0,0,0,0,0,0,0,0,0,0,
-0,0x1F59,0,0x1F5B,0,0x1F5D,0,0x1F5F,0,0,0,0,0,0,0,0,
- 0x1F68,0x1F69,0x1F6A,0x1F6B,0x1F6C,0x1F6D,0x1F6E,0x1F6F,0,0,0,0,0,0,0,0,
- 0x1FBA,0x1FBB,0x1FC8,0x1FC9,0x1FCA,0x1FCB,0x1FDA,0x1FDB,0x1FF8,0x1FF9,0x1FEA,0x1FEB,0x1FFA,0x1FFB,0,0,
-0x1F88,0x1F89,0x1F8A,0x1F8B,0x1F8C,0x1F8D,0x1F8E,0x1F8F,0,0,0,0,0,0,0,0,
- 0x1F98,0x1F99,0x1F9A,0x1F9B,0x1F9C,0x1F9D,0x1F9E,0x1F9F,0,0,0,0,0,0,0,0,
- 0x1FA8,0x1FA9,0x1FAA,0x1FAB,0x1FAC,0x1FAD,0x1FAE,0x1FAF,0,0,0,0,0,0,0,0,
- 0x1FB8,0x1FB9,0,0x1FBC,0,0,0,0,0,0,0,0,0,0,0x399,0,
- 0,0,0,0x1FCC,0,0,0,0,0,0,0,0,0,0,0,0,
- 0x1FD8,0x1FD9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0x1FE8,0x1FE9,0,0,0,0x1FEC,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0x1FFC,0,0,0,0,0,0,0,0,0,0,0,0};
-static const guint16 simple_upper_case_mapping_lowarea_table3 [] = {
- /* ==== 2100-21C0 ==== */
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x2132,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0x2160,0x2161,0x2162,0x2163,0x2164,0x2165,0x2166,0x2167,0x2168,0x2169,0x216A,0x216B,0x216C,0x216D,0x216E,0x216F,
- 0,0,0,0,0x2183,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0};
-static const guint16 simple_upper_case_mapping_lowarea_table4 [] = {
- /* ==== 2480-2500 ==== */
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0x24B6,0x24B7,0x24B8,0x24B9,0x24BA,0x24BB,0x24BC,0x24BD,0x24BE,0x24BF,0x24C0,0x24C1,0x24C2,0x24C3,0x24C4,0x24C5,
- 0x24C6,0x24C7,0x24C8,0x24C9,0x24CA,0x24CB,0x24CC,0x24CD,0x24CE,0x24CF,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0};
-static const guint16 simple_upper_case_mapping_lowarea_table5 [] = {
- /* ==== 2C00-2D80 ==== */
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0x2C00,0x2C01,0x2C02,0x2C03,0x2C04,0x2C05,0x2C06,0x2C07,0x2C08,0x2C09,0x2C0A,0x2C0B,0x2C0C,0x2C0D,0x2C0E,0x2C0F,
- 0x2C10,0x2C11,0x2C12,0x2C13,0x2C14,0x2C15,0x2C16,0x2C17,0x2C18,0x2C19,0x2C1A,0x2C1B,0x2C1C,0x2C1D,0x2C1E,0x2C1F,
- 0x2C20,0x2C21,0x2C22,0x2C23,0x2C24,0x2C25,0x2C26,0x2C27,0x2C28,0x2C29,0x2C2A,0x2C2B,0x2C2C,0x2C2D,0x2C2E,0,
-0,0x2C60,0,0,0,0x23A,0x23E,0,0x2C67,0,0x2C69,0,0x2C6B,0,0,0,
- 0,0,0,0x2C72,0,0,0x2C75,0,0,0,0,0,0,0,0,0,
-0,0x2C80,0,0x2C82,0,0x2C84,0,0x2C86,0,0x2C88,0,0x2C8A,0,0x2C8C,0,0x2C8E,
- 0,0x2C90,0,0x2C92,0,0x2C94,0,0x2C96,0,0x2C98,0,0x2C9A,0,0x2C9C,0,0x2C9E,
- 0,0x2CA0,0,0x2CA2,0,0x2CA4,0,0x2CA6,0,0x2CA8,0,0x2CAA,0,0x2CAC,0,0x2CAE,
- 0,0x2CB0,0,0x2CB2,0,0x2CB4,0,0x2CB6,0,0x2CB8,0,0x2CBA,0,0x2CBC,0,0x2CBE,
- 0,0x2CC0,0,0x2CC2,0,0x2CC4,0,0x2CC6,0,0x2CC8,0,0x2CCA,0,0x2CCC,0,0x2CCE,
- 0,0x2CD0,0,0x2CD2,0,0x2CD4,0,0x2CD6,0,0x2CD8,0,0x2CDA,0,0x2CDC,0,0x2CDE,
- 0,0x2CE0,0,0x2CE2,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0x10A0,0x10A1,0x10A2,0x10A3,0x10A4,0x10A5,0x10A6,0x10A7,0x10A8,0x10A9,0x10AA,0x10AB,0x10AC,0x10AD,0x10AE,0x10AF,
- 0x10B0,0x10B1,0x10B2,0x10B3,0x10B4,0x10B5,0x10B6,0x10B7,0x10B8,0x10B9,0x10BA,0x10BB,0x10BC,0x10BD,0x10BE,0x10BF,
- 0x10C0,0x10C1,0x10C2,0x10C3,0x10C4,0x10C5,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0};
-static const guint16 simple_upper_case_mapping_lowarea_table6 [] = {
- /* ==== A640-A7C0 ==== */
- 0,0xA640,0,0xA642,0,0xA644,0,0xA646,0,0xA648,0,0xA64A,0,0xA64C,0,0xA64E,
- 0,0xA650,0,0xA652,0,0xA654,0,0xA656,0,0xA658,0,0xA65A,0,0xA65C,0,0xA65E,
- 0,0,0,0xA662,0,0xA664,0,0xA666,0,0xA668,0,0xA66A,0,0xA66C,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0xA680,0,0xA682,0,0xA684,0,0xA686,0,0xA688,0,0xA68A,0,0xA68C,0,0xA68E,
- 0,0xA690,0,0xA692,0,0xA694,0,0xA696,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0xA722,0,0xA724,0,0xA726,0,0xA728,0,0xA72A,0,0xA72C,0,0xA72E,
- 0,0,0,0xA732,0,0xA734,0,0xA736,0,0xA738,0,0xA73A,0,0xA73C,0,0xA73E,
- 0,0xA740,0,0xA742,0,0xA744,0,0xA746,0,0xA748,0,0xA74A,0,0xA74C,0,0xA74E,
- 0,0xA750,0,0xA752,0,0xA754,0,0xA756,0,0xA758,0,0xA75A,0,0xA75C,0,0xA75E,
- 0,0xA760,0,0xA762,0,0xA764,0,0xA766,0,0xA768,0,0xA76A,0,0xA76C,0,0xA76E,
- 0,0,0,0,0,0,0,0,0,0,0xA779,0,0xA77B,0,0,0xA77E,
- 0,0xA780,0,0xA782,0,0xA784,0,0xA786,0,0,0,0,0xA78B,0};
-static const guint16 simple_upper_case_mapping_lowarea_table7 [] = {
- /* ==== FF20-FF80 ==== */
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0xFF21,0xFF22,0xFF23,0xFF24,0xFF25,0xFF26,0xFF27,0xFF28,0xFF29,0xFF2A,0xFF2B,0xFF2C,0xFF2D,0xFF2E,0xFF2F,
- 0xFF30,0xFF31,0xFF32,0xFF33,0xFF34,0xFF35,0xFF36,0xFF37,0xFF38,0xFF39,0xFF3A,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0};
-static const guint16 *simple_upper_case_mapping_lowarea [] = {
- simple_upper_case_mapping_lowarea_table0,
- simple_upper_case_mapping_lowarea_table1,
- simple_upper_case_mapping_lowarea_table2,
- simple_upper_case_mapping_lowarea_table3,
- simple_upper_case_mapping_lowarea_table4,
- simple_upper_case_mapping_lowarea_table5,
- simple_upper_case_mapping_lowarea_table6,
- simple_upper_case_mapping_lowarea_table7};
-static const int simple_upper_case_mapping_lowarea_table_count = 8;
-
-static const guint32 simple_upper_case_mapping_higharea_table0 [] = {
- /* ==== 10400-10480 ==== */
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0x10400,0x10401,0x10402,0x10403,0x10404,0x10405,0x10406,0x10407,
- 0x10408,0x10409,0x1040A,0x1040B,0x1040C,0x1040D,0x1040E,0x1040F,0x10410,0x10411,0x10412,0x10413,0x10414,0x10415,0x10416,0x10417,
- 0x10418,0x10419,0x1041A,0x1041B,0x1041C,0x1041D,0x1041E,0x1041F,0x10420,0x10421,0x10422,0x10423,0x10424,0x10425,0x10426,0x10427,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0};
-static const guint32 *simple_upper_case_mapping_higharea [] = {
- simple_upper_case_mapping_higharea_table0};
-
-static const guint16 simple_lower_case_mapping_lowarea_table0 [] = {
- /* ==== 40-600 ==== */
- 0,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F,
- 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,
- 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0x101,0,0x103,0,0x105,0,0x107,0,0x109,0,0x10B,0,0x10D,0,0x10F,0,
- 0x111,0,0x113,0,0x115,0,0x117,0,0x119,0,0x11B,0,0x11D,0,0x11F,0,
- 0x121,0,0x123,0,0x125,0,0x127,0,0x129,0,0x12B,0,0x12D,0,0x12F,0,
- 0x69,0,0x133,0,0x135,0,0x137,0,0,0x13A,0,0x13C,0,0x13E,0,0x140,
- 0,0x142,0,0x144,0,0x146,0,0x148,0,0,0x14B,0,0x14D,0,0x14F,0,
- 0x151,0,0x153,0,0x155,0,0x157,0,0x159,0,0x15B,0,0x15D,0,0x15F,0,
- 0x161,0,0x163,0,0x165,0,0x167,0,0x169,0,0x16B,0,0x16D,0,0x16F,0,
- 0x171,0,0x173,0,0x175,0,0x177,0,0xFF,0x17A,0,0x17C,0,0x17E,0,0,
- 0,0x253,0x183,0,0x185,0,0x254,0x188,0,0x256,0x257,0x18C,0,0,0x1DD,0x259,
- 0x25B,0x192,0,0x260,0x263,0,0x269,0x268,0x199,0,0,0,0x26F,0x272,0,0x275,
- 0x1A1,0,0x1A3,0,0x1A5,0,0x280,0x1A8,0,0x283,0,0,0x1AD,0,0x288,0x1B0,
- 0,0x28A,0x28B,0x1B4,0,0x1B6,0,0x292,0x1B9,0,0,0,0x1BD,0,0,0,
- 0,0,0,0,0x1C6,0x1C6,0,0x1C9,0x1C9,0,0x1CC,0x1CC,0,0x1CE,0,0x1D0,
- 0,0x1D2,0,0x1D4,0,0x1D6,0,0x1D8,0,0x1DA,0,0x1DC,0,0,0x1DF,0,
- 0x1E1,0,0x1E3,0,0x1E5,0,0x1E7,0,0x1E9,0,0x1EB,0,0x1ED,0,0x1EF,0,
- 0,0x1F3,0x1F3,0,0x1F5,0,0x195,0x1BF,0x1F9,0,0x1FB,0,0x1FD,0,0x1FF,0,
- 0x201,0,0x203,0,0x205,0,0x207,0,0x209,0,0x20B,0,0x20D,0,0x20F,0,
- 0x211,0,0x213,0,0x215,0,0x217,0,0x219,0,0x21B,0,0x21D,0,0x21F,0,
- 0x19E,0,0x223,0,0x225,0,0x227,0,0x229,0,0x22B,0,0x22D,0,0x22F,0,
- 0x231,0,0x233,0,0,0,0,0,0,0,0x2C65,0x23C,0,0x19A,0x2C66,0,
- 0,0x242,0,0x180,0x289,0x28C,0x247,0,0x249,0,0x24B,0,0x24D,0,0x24F,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0x371,0,0x373,0,0,0,0x377,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0x3AC,0,0x3AD,0x3AE,0x3AF,0,0x3CC,0,0x3CD,0x3CE,
- 0,0x3B1,0x3B2,0x3B3,0x3B4,0x3B5,0x3B6,0x3B7,0x3B8,0x3B9,0x3BA,0x3BB,0x3BC,0x3BD,0x3BE,0x3BF,
- 0x3C0,0x3C1,0,0x3C3,0x3C4,0x3C5,0x3C6,0x3C7,0x3C8,0x3C9,0x3CA,0x3CB,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x3D7,
- 0,0,0,0,0,0,0,0,0x3D9,0,0x3DB,0,0x3DD,0,0x3DF,0,
- 0x3E1,0,0x3E3,0,0x3E5,0,0x3E7,0,0x3E9,0,0x3EB,0,0x3ED,0,0x3EF,0,
- 0,0,0,0,0x3B8,0,0,0x3F8,0,0x3F2,0x3FB,0,0,0x37B,0x37C,0x37D,
- 0x450,0x451,0x452,0x453,0x454,0x455,0x456,0x457,0x458,0x459,0x45A,0x45B,0x45C,0x45D,0x45E,0x45F,
- 0x430,0x431,0x432,0x433,0x434,0x435,0x436,0x437,0x438,0x439,0x43A,0x43B,0x43C,0x43D,0x43E,0x43F,
- 0x440,0x441,0x442,0x443,0x444,0x445,0x446,0x447,0x448,0x449,0x44A,0x44B,0x44C,0x44D,0x44E,0x44F,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0x461,0,0x463,0,0x465,0,0x467,0,0x469,0,0x46B,0,0x46D,0,0x46F,0,
- 0x471,0,0x473,0,0x475,0,0x477,0,0x479,0,0x47B,0,0x47D,0,0x47F,0,
- 0x481,0,0,0,0,0,0,0,0,0,0x48B,0,0x48D,0,0x48F,0,
- 0x491,0,0x493,0,0x495,0,0x497,0,0x499,0,0x49B,0,0x49D,0,0x49F,0,
- 0x4A1,0,0x4A3,0,0x4A5,0,0x4A7,0,0x4A9,0,0x4AB,0,0x4AD,0,0x4AF,0,
- 0x4B1,0,0x4B3,0,0x4B5,0,0x4B7,0,0x4B9,0,0x4BB,0,0x4BD,0,0x4BF,0,
- 0x4CF,0x4C2,0,0x4C4,0,0x4C6,0,0x4C8,0,0x4CA,0,0x4CC,0,0x4CE,0,0,
- 0x4D1,0,0x4D3,0,0x4D5,0,0x4D7,0,0x4D9,0,0x4DB,0,0x4DD,0,0x4DF,0,
- 0x4E1,0,0x4E3,0,0x4E5,0,0x4E7,0,0x4E9,0,0x4EB,0,0x4ED,0,0x4EF,0,
- 0x4F1,0,0x4F3,0,0x4F5,0,0x4F7,0,0x4F9,0,0x4FB,0,0x4FD,0,0x4FF,0,
- 0x501,0,0x503,0,0x505,0,0x507,0,0x509,0,0x50B,0,0x50D,0,0x50F,0,
- 0x511,0,0x513,0,0x515,0,0x517,0,0x519,0,0x51B,0,0x51D,0,0x51F,0,
- 0x521,0,0x523,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0x561,0x562,0x563,0x564,0x565,0x566,0x567,0x568,0x569,0x56A,0x56B,0x56C,0x56D,0x56E,0x56F,
- 0x570,0x571,0x572,0x573,0x574,0x575,0x576,0x577,0x578,0x579,0x57A,0x57B,0x57C,0x57D,0x57E,0x57F,
- 0x580,0x581,0x582,0x583,0x584,0x585,0x586,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0};
-static const guint16 simple_lower_case_mapping_lowarea_table1 [] = {
- /* ==== 1000-10D0 ==== */
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0x2D00,0x2D01,0x2D02,0x2D03,0x2D04,0x2D05,0x2D06,0x2D07,0x2D08,0x2D09,0x2D0A,0x2D0B,0x2D0C,0x2D0D,0x2D0E,0x2D0F,
- 0x2D10,0x2D11,0x2D12,0x2D13,0x2D14,0x2D15,0x2D16,0x2D17,0x2D18,0x2D19,0x2D1A,0x2D1B,0x2D1C,0x2D1D,0x2D1E,0x2D1F,
- 0x2D20,0x2D21,0x2D22,0x2D23,0x2D24,0x2D25,0};
-static const guint16 simple_lower_case_mapping_lowarea_table2 [] = {
- /* ==== 1D00-2000 ==== */
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0x1E01,0,0x1E03,0,0x1E05,0,0x1E07,0,0x1E09,0,0x1E0B,0,0x1E0D,0,0x1E0F,0,
- 0x1E11,0,0x1E13,0,0x1E15,0,0x1E17,0,0x1E19,0,0x1E1B,0,0x1E1D,0,0x1E1F,0,
- 0x1E21,0,0x1E23,0,0x1E25,0,0x1E27,0,0x1E29,0,0x1E2B,0,0x1E2D,0,0x1E2F,0,
- 0x1E31,0,0x1E33,0,0x1E35,0,0x1E37,0,0x1E39,0,0x1E3B,0,0x1E3D,0,0x1E3F,0,
- 0x1E41,0,0x1E43,0,0x1E45,0,0x1E47,0,0x1E49,0,0x1E4B,0,0x1E4D,0,0x1E4F,0,
- 0x1E51,0,0x1E53,0,0x1E55,0,0x1E57,0,0x1E59,0,0x1E5B,0,0x1E5D,0,0x1E5F,0,
- 0x1E61,0,0x1E63,0,0x1E65,0,0x1E67,0,0x1E69,0,0x1E6B,0,0x1E6D,0,0x1E6F,0,
- 0x1E71,0,0x1E73,0,0x1E75,0,0x1E77,0,0x1E79,0,0x1E7B,0,0x1E7D,0,0x1E7F,0,
- 0x1E81,0,0x1E83,0,0x1E85,0,0x1E87,0,0x1E89,0,0x1E8B,0,0x1E8D,0,0x1E8F,0,
- 0x1E91,0,0x1E93,0,0x1E95,0,0,0,0,0,0,0,0,0,0xDF,0,
- 0x1EA1,0,0x1EA3,0,0x1EA5,0,0x1EA7,0,0x1EA9,0,0x1EAB,0,0x1EAD,0,0x1EAF,0,
- 0x1EB1,0,0x1EB3,0,0x1EB5,0,0x1EB7,0,0x1EB9,0,0x1EBB,0,0x1EBD,0,0x1EBF,0,
- 0x1EC1,0,0x1EC3,0,0x1EC5,0,0x1EC7,0,0x1EC9,0,0x1ECB,0,0x1ECD,0,0x1ECF,0,
- 0x1ED1,0,0x1ED3,0,0x1ED5,0,0x1ED7,0,0x1ED9,0,0x1EDB,0,0x1EDD,0,0x1EDF,0,
- 0x1EE1,0,0x1EE3,0,0x1EE5,0,0x1EE7,0,0x1EE9,0,0x1EEB,0,0x1EED,0,0x1EEF,0,
- 0x1EF1,0,0x1EF3,0,0x1EF5,0,0x1EF7,0,0x1EF9,0,0x1EFB,0,0x1EFD,0,0x1EFF,0,
- 0,0,0,0,0,0,0,0,0x1F00,0x1F01,0x1F02,0x1F03,0x1F04,0x1F05,0x1F06,0x1F07,
- 0,0,0,0,0,0,0,0,0x1F10,0x1F11,0x1F12,0x1F13,0x1F14,0x1F15,0,0,
-0,0,0,0,0,0,0,0,0x1F20,0x1F21,0x1F22,0x1F23,0x1F24,0x1F25,0x1F26,0x1F27,
- 0,0,0,0,0,0,0,0,0x1F30,0x1F31,0x1F32,0x1F33,0x1F34,0x1F35,0x1F36,0x1F37,
- 0,0,0,0,0,0,0,0,0x1F40,0x1F41,0x1F42,0x1F43,0x1F44,0x1F45,0,0,
-0,0,0,0,0,0,0,0,0,0x1F51,0,0x1F53,0,0x1F55,0,0x1F57,
- 0,0,0,0,0,0,0,0,0x1F60,0x1F61,0x1F62,0x1F63,0x1F64,0x1F65,0x1F66,0x1F67,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0x1F80,0x1F81,0x1F82,0x1F83,0x1F84,0x1F85,0x1F86,0x1F87,
- 0,0,0,0,0,0,0,0,0x1F90,0x1F91,0x1F92,0x1F93,0x1F94,0x1F95,0x1F96,0x1F97,
- 0,0,0,0,0,0,0,0,0x1FA0,0x1FA1,0x1FA2,0x1FA3,0x1FA4,0x1FA5,0x1FA6,0x1FA7,
- 0,0,0,0,0,0,0,0,0x1FB0,0x1FB1,0x1F70,0x1F71,0x1FB3,0,0,0,
- 0,0,0,0,0,0,0,0,0x1F72,0x1F73,0x1F74,0x1F75,0x1FC3,0,0,0,
- 0,0,0,0,0,0,0,0,0x1FD0,0x1FD1,0x1F76,0x1F77,0,0,0,0,
- 0,0,0,0,0,0,0,0,0x1FE0,0x1FE1,0x1F7A,0x1F7B,0x1FE5,0,0,0,
- 0,0,0,0,0,0,0,0,0x1F78,0x1F79,0x1F7C,0x1F7D,0x1FF3,0,0,0};
-static const guint16 simple_lower_case_mapping_lowarea_table3 [] = {
- /* ==== 2100-21C0 ==== */
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0x3C9,0,0,0,0x6B,0xE5,0,0,0,0,
- 0,0,0x214E,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0x2170,0x2171,0x2172,0x2173,0x2174,0x2175,0x2176,0x2177,0x2178,0x2179,0x217A,0x217B,0x217C,0x217D,0x217E,0x217F,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0x2184,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0};
-static const guint16 simple_lower_case_mapping_lowarea_table4 [] = {
- /* ==== 2480-2500 ==== */
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0x24D0,0x24D1,0x24D2,0x24D3,0x24D4,0x24D5,0x24D6,0x24D7,0x24D8,0x24D9,
- 0x24DA,0x24DB,0x24DC,0x24DD,0x24DE,0x24DF,0x24E0,0x24E1,0x24E2,0x24E3,0x24E4,0x24E5,0x24E6,0x24E7,0x24E8,0x24E9,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0};
-static const guint16 simple_lower_case_mapping_lowarea_table5 [] = {
- /* ==== 2C00-2D80 ==== */
- 0x2C30,0x2C31,0x2C32,0x2C33,0x2C34,0x2C35,0x2C36,0x2C37,0x2C38,0x2C39,0x2C3A,0x2C3B,0x2C3C,0x2C3D,0x2C3E,0x2C3F,
- 0x2C40,0x2C41,0x2C42,0x2C43,0x2C44,0x2C45,0x2C46,0x2C47,0x2C48,0x2C49,0x2C4A,0x2C4B,0x2C4C,0x2C4D,0x2C4E,0x2C4F,
- 0x2C50,0x2C51,0x2C52,0x2C53,0x2C54,0x2C55,0x2C56,0x2C57,0x2C58,0x2C59,0x2C5A,0x2C5B,0x2C5C,0x2C5D,0x2C5E,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0x2C61,0,0x26B,0x1D7D,0x27D,0,0,0x2C68,0,0x2C6A,0,0x2C6C,0,0x251,0x271,0x250,
- 0,0,0x2C73,0,0,0x2C76,0,0,0,0,0,0,0,0,0,0,
-0x2C81,0,0x2C83,0,0x2C85,0,0x2C87,0,0x2C89,0,0x2C8B,0,0x2C8D,0,0x2C8F,0,
- 0x2C91,0,0x2C93,0,0x2C95,0,0x2C97,0,0x2C99,0,0x2C9B,0,0x2C9D,0,0x2C9F,0,
- 0x2CA1,0,0x2CA3,0,0x2CA5,0,0x2CA7,0,0x2CA9,0,0x2CAB,0,0x2CAD,0,0x2CAF,0,
- 0x2CB1,0,0x2CB3,0,0x2CB5,0,0x2CB7,0,0x2CB9,0,0x2CBB,0,0x2CBD,0,0x2CBF,0,
- 0x2CC1,0,0x2CC3,0,0x2CC5,0,0x2CC7,0,0x2CC9,0,0x2CCB,0,0x2CCD,0,0x2CCF,0,
- 0x2CD1,0,0x2CD3,0,0x2CD5,0,0x2CD7,0,0x2CD9,0,0x2CDB,0,0x2CDD,0,0x2CDF,0,
- 0x2CE1,0,0x2CE3,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0};
-static const guint16 simple_lower_case_mapping_lowarea_table6 [] = {
- /* ==== A640-A7C0 ==== */
- 0xA641,0,0xA643,0,0xA645,0,0xA647,0,0xA649,0,0xA64B,0,0xA64D,0,0xA64F,0,
- 0xA651,0,0xA653,0,0xA655,0,0xA657,0,0xA659,0,0xA65B,0,0xA65D,0,0xA65F,0,
- 0,0,0xA663,0,0xA665,0,0xA667,0,0xA669,0,0xA66B,0,0xA66D,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0xA681,0,0xA683,0,0xA685,0,0xA687,0,0xA689,0,0xA68B,0,0xA68D,0,0xA68F,0,
- 0xA691,0,0xA693,0,0xA695,0,0xA697,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0xA723,0,0xA725,0,0xA727,0,0xA729,0,0xA72B,0,0xA72D,0,0xA72F,0,
- 0,0,0xA733,0,0xA735,0,0xA737,0,0xA739,0,0xA73B,0,0xA73D,0,0xA73F,0,
- 0xA741,0,0xA743,0,0xA745,0,0xA747,0,0xA749,0,0xA74B,0,0xA74D,0,0xA74F,0,
- 0xA751,0,0xA753,0,0xA755,0,0xA757,0,0xA759,0,0xA75B,0,0xA75D,0,0xA75F,0,
- 0xA761,0,0xA763,0,0xA765,0,0xA767,0,0xA769,0,0xA76B,0,0xA76D,0,0xA76F,0,
- 0,0,0,0,0,0,0,0,0,0xA77A,0,0xA77C,0,0x1D79,0xA77F,0,
- 0xA781,0,0xA783,0,0xA785,0,0xA787,0,0,0,0,0xA78C,0,0};
-static const guint16 simple_lower_case_mapping_lowarea_table7 [] = {
- /* ==== FF20-FF80 ==== */
- 0,0xFF41,0xFF42,0xFF43,0xFF44,0xFF45,0xFF46,0xFF47,0xFF48,0xFF49,0xFF4A,0xFF4B,0xFF4C,0xFF4D,0xFF4E,0xFF4F,
- 0xFF50,0xFF51,0xFF52,0xFF53,0xFF54,0xFF55,0xFF56,0xFF57,0xFF58,0xFF59,0xFF5A,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0};
-static const guint16 *simple_lower_case_mapping_lowarea [] = {
- simple_lower_case_mapping_lowarea_table0,
- simple_lower_case_mapping_lowarea_table1,
- simple_lower_case_mapping_lowarea_table2,
- simple_lower_case_mapping_lowarea_table3,
- simple_lower_case_mapping_lowarea_table4,
- simple_lower_case_mapping_lowarea_table5,
- simple_lower_case_mapping_lowarea_table6,
- simple_lower_case_mapping_lowarea_table7};
-static const int simple_lower_case_mapping_lowarea_table_count = 8;
-
-static const guint32 simple_lower_case_mapping_higharea_table0 [] = {
- /* ==== 10400-10480 ==== */
- 0x10428,0x10429,0x1042A,0x1042B,0x1042C,0x1042D,0x1042E,0x1042F,0x10430,0x10431,0x10432,0x10433,0x10434,0x10435,0x10436,0x10437,
- 0x10438,0x10439,0x1043A,0x1043B,0x1043C,0x1043D,0x1043E,0x1043F,0x10440,0x10441,0x10442,0x10443,0x10444,0x10445,0x10446,0x10447,
- 0x10448,0x10449,0x1044A,0x1044B,0x1044C,0x1044D,0x1044E,0x1044F,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0};
-static const guint32 *simple_lower_case_mapping_higharea [] = {
- simple_lower_case_mapping_higharea_table0};
-
-
-static const SimpleTitlecaseMapping simple_titlecase_mapping [] = {
- {0x0001C4, 0x000000, 0x0001C5},
- {0x0001C5, 0x0001C4, 0x0001C5},
- {0x0001C6, 0x0001C4, 0x0001C5},
- {0x0001C7, 0x000000, 0x0001C8},
- {0x0001C8, 0x0001C7, 0x0001C8},
- {0x0001C9, 0x0001C7, 0x0001C8},
- {0x0001CA, 0x000000, 0x0001CB},
- {0x0001CB, 0x0001CA, 0x0001CB},
- {0x0001CC, 0x0001CA, 0x0001CB},
- {0x0001F1, 0x000000, 0x0001F2},
- {0x0001F2, 0x0001F1, 0x0001F2},
- {0x0001F3, 0x0001F1, 0x0001F2}
-};
-static const guint8 simple_titlecase_mapping_count = 12;
-
-#endif
-
+++ /dev/null
-/Makefile
-/Makefile.in
-/.libs
-/.deps
-/*.lo
-/*.la
-/*.o
-/semantic.cache
-/.project
-/.cproject
-/test-eglib
-/test-glib
+++ /dev/null
-EXTRA_DIST = UTF-8.txt UTF-16BE.txt UTF-16LE.txt UTF-32BE.txt UTF-32LE.txt
-
-SOURCES = \
- test.c \
- test.h \
- tests.h \
- driver.c \
- hashtable.c \
- string-util.c \
- string.c \
- slist.c \
- sizes.c \
- ptrarray.c \
- list.c \
- array.c \
- fake.c \
- path.c \
- queue.c \
- shell.c \
- spawn.c \
- timer.c \
- file.c \
- pattern.c \
- dir.c \
- markup.c \
- unicode.c \
- utf8.c \
- endian.c \
- module.c \
- memory.c
-
-test_eglib_SOURCES = $(SOURCES)
-
-test_eglib_CFLAGS = -Wall -DEGLIB_TESTS=1 -D_FORTIFY_SOURCE=2 -I$(srcdir)/../src -I../src -DDRIVER_NAME=\"EGlib\"
-test_eglib_LDADD = ../src/libeglib.la $(LIBICONV)
-
-run-eglib: all
- srcdir=`readlink -f $(srcdir)` ./test-eglib
-
-noinst_PROGRAMS = test-eglib
-
-run-both: run-eglib
-
-MAINTAINERCLEANFILES = Makefile.in
+++ /dev/null
-EGlib Unit Testing
-===============================================================================
-
- 1. Writing new tests
- 2. Using the test driver
-
-===============================================================================
-1. Writing new tests
-===============================================================================
-
-Tests are easy to write, but must be grouped in to logical cases. For instance,
-the GPtrArray group has a number of tests that cover the entire GPtrArray
-implementation.
-
-These logical case groups should be in a single C file, and must have
-three elements:
-
- #include <glib.h>
- #include "test.h"
-
- ...
- <define test implementations>
- ...
-
- static Test groupname_tests [] = {
- {"groupname_test1", groupname_test1},
- {"groupname_test1", groupname_test2},
- {NULL, NULL}
- };
-
- DEFINE_TEST_GROUP_INIT(groupname_tests_init, groupname_tests)
-
-A test implementation should look like:
-
- RESULT groupname_test1()
- {
- <perform the test>
-
- if(test_failed) {
- return FAILED("reason: %s", "this works like printf");
- }
-
- return OK; /* just NULL, but OK is cute */
- }
-
-Once a test group is written, it needs to be added to the groups table
-in tests.h:
-
- DEFINE_TEST_GROUP_INIT_H(groupname_tests_init) // same as in impl
-
- static Group test_groups [] = {
- ...
- {"groupname", groupname_tests_init}
- ...
- };
-
-===============================================================================
-2. Using the test driver
-===============================================================================
-
-When tests are written, they are rebuilt with make. Two programs will be
-built:
-
- test-eglib: the test driver and tests linked against eglib
- test-glib: the test driver and tests linked against system glib-2.0
-
-Each driver program works exactly the same. Running test-eglib will run
-the tests against eglib, and test-glib against glib-2.0.
-
-The test driver supports a few options to allow for performance measuring:
-
- --help show all options and available test groups
- --time time the overall run and report it, even if --quiet is set
- --quiet do not print test results, useful for timing
- --iterations N run all or specified test groups N times
-
-Run "test-eglib --help" for more details.
-
-Example: run the ptrarray test group 100000 times and only print the time
- it took to perform all iterations
-
- ./test-eglib -tqi 100000 ptrarray
-
-Example: show single iteration of test output for two groups
-
- ./test-eglib ptrarray hashtable
-
-Example: show test output of all available groups
-
- ./test-eglib
-
-The 'test-both' script can be used to run both test-eglib and test-glib
-with the same options back to back:
-
- $ ./test-both -tqi 100000 ptrarray
- EGlib Total Time: 1.1961s
- GLib Total Time: 0.955957s
-
-test-both also has a nice --speed-compare mode that shows comparison
-information about EGlib vs GLib. It can run all tests or specific tests
-with a configurable number of iterations. --speed-compare mode always runs
-the drivers with -qtni
-
-The syntax for --speed-compare is:
-
- ./test-both --speed-compare [ITERATIONS] [GROUPS...]
-
- $ ./test-both --speed-compare Runs all tests with default iterations
- $ ./test-both --speed-compare 500 Runs all tests with 500 iterations
- $ ./test-both --speed-compare ptrarray Runs ptrarray test with default
- iterations
-
-
+++ /dev/null
-
-UTF-8 encoded sample plain-text file
-‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-
-Markus Kuhn [ˈmaʳkʊs kuːn] <http://www.cl.cam.ac.uk/~mgk25/> — 2002-07-25
-
-
-The ASCII compatible UTF-8 encoding used in this plain-text file
-is defined in Unicode, ISO 10646-1, and RFC 2279.
-
-
-Using Unicode/UTF-8, you can write in emails and source code things such as
-
-Mathematics and sciences:
-
- ∮ E⋅da = Q, n → ∞, ∑ f(i) = ∏ g(i), ⎧⎡⎛┌─────┐⎞⎤⎫
- ⎪⎢⎜│a²+b³ ⎟⎥⎪
- ∀x∈ℝ: ⌈x⌉ = −⌊−x⌋, α ∧ ¬β = ¬(¬α ∨ β), ⎪⎢⎜│───── ⎟⎥⎪
- ⎪⎢⎜⎷ c₈ ⎟⎥⎪
- ℕ ⊆ ℕ₀ ⊂ ℤ ⊂ ℚ ⊂ ℝ ⊂ ℂ, ⎨⎢⎜ ⎟⎥⎬
- ⎪⎢⎜ ∞ ⎟⎥⎪
- ⊥ < a ≠ b ≡ c ≤ d ≪ ⊤ ⇒ (⟦A⟧ ⇔ ⟪B⟫), ⎪⎢⎜ ⎲ ⎟⎥⎪
- ⎪⎢⎜ ⎳aⁱ-bⁱ⎟⎥⎪
- 2H₂ + O₂ ⇌ 2H₂O, R = 4.7 kΩ, ⌀ 200 mm ⎩⎣⎝i=1 ⎠⎦⎭
-
-Linguistics and dictionaries:
-
- ði ıntəˈnæʃənəl fəˈnɛtık əsoʊsiˈeıʃn
- Y [ˈʏpsilɔn], Yen [jɛn], Yoga [ˈjoːgɑ]
-
-APL:
-
- ((V⍳V)=⍳⍴V)/V←,V ⌷←⍳→⍴∆∇⊃‾⍎⍕⌈
-
-Nicer typography in plain text files:
-
- ╔══════════════════════════════════════════╗
- ║ ║
- ║ • ‘single’ and “double” quotes ║
- ║ ║
- ║ • Curly apostrophes: “We’ve been here” ║
- ║ ║
- ║ • Latin-1 apostrophe and accents: '´` ║
- ║ ║
- ║ • ‚deutsche‘ „Anführungszeichen“ ║
- ║ ║
- ║ • †, ‡, ‰, •, 3–4, —, −5/+5, ™, … ║
- ║ ║
- ║ • ASCII safety test: 1lI|, 0OD, 8B ║
- ║ ╭─────────╮ ║
- ║ • the euro symbol: │ 14.95 € │ ║
- ║ ╰─────────╯ ║
- ╚══════════════════════════════════════════╝
-
-Combining characters:
-
- STARGΛ̊TE SG-1, a = v̇ = r̈, a⃑ ⊥ b⃑
-
-Greek (in Polytonic):
-
- The Greek anthem:
-
- Σὲ γνωρίζω ἀπὸ τὴν κόψη
- τοῦ σπαθιοῦ τὴν τρομερή,
- σὲ γνωρίζω ἀπὸ τὴν ὄψη
- ποὺ μὲ βία μετράει τὴ γῆ.
-
- ᾿Απ᾿ τὰ κόκκαλα βγαλμένη
- τῶν ῾Ελλήνων τὰ ἱερά
- καὶ σὰν πρῶτα ἀνδρειωμένη
- χαῖρε, ὦ χαῖρε, ᾿Ελευθεριά!
-
- From a speech of Demosthenes in the 4th century BC:
-
- Οὐχὶ ταὐτὰ παρίσταταί μοι γιγνώσκειν, ὦ ἄνδρες ᾿Αθηναῖοι,
- ὅταν τ᾿ εἰς τὰ πράγματα ἀποβλέψω καὶ ὅταν πρὸς τοὺς
- λόγους οὓς ἀκούω· τοὺς μὲν γὰρ λόγους περὶ τοῦ
- τιμωρήσασθαι Φίλιππον ὁρῶ γιγνομένους, τὰ δὲ πράγματ᾿
- εἰς τοῦτο προήκοντα, ὥσθ᾿ ὅπως μὴ πεισόμεθ᾿ αὐτοὶ
- πρότερον κακῶς σκέψασθαι δέον. οὐδέν οὖν ἄλλο μοι δοκοῦσιν
- οἱ τὰ τοιαῦτα λέγοντες ἢ τὴν ὑπόθεσιν, περὶ ἧς βουλεύεσθαι,
- οὐχὶ τὴν οὖσαν παριστάντες ὑμῖν ἁμαρτάνειν. ἐγὼ δέ, ὅτι μέν
- ποτ᾿ ἐξῆν τῇ πόλει καὶ τὰ αὑτῆς ἔχειν ἀσφαλῶς καὶ Φίλιππον
- τιμωρήσασθαι, καὶ μάλ᾿ ἀκριβῶς οἶδα· ἐπ᾿ ἐμοῦ γάρ, οὐ πάλαι
- γέγονεν ταῦτ᾿ ἀμφότερα· νῦν μέντοι πέπεισμαι τοῦθ᾿ ἱκανὸν
- προλαβεῖν ἡμῖν εἶναι τὴν πρώτην, ὅπως τοὺς συμμάχους
- σώσομεν. ἐὰν γὰρ τοῦτο βεβαίως ὑπάρξῃ, τότε καὶ περὶ τοῦ
- τίνα τιμωρήσεταί τις καὶ ὃν τρόπον ἐξέσται σκοπεῖν· πρὶν δὲ
- τὴν ἀρχὴν ὀρθῶς ὑποθέσθαι, μάταιον ἡγοῦμαι περὶ τῆς
- τελευτῆς ὁντινοῦν ποιεῖσθαι λόγον.
-
- Δημοσθένους, Γ´ ᾿Ολυνθιακὸς
-
-Georgian:
-
- From a Unicode conference invitation:
-
- გთხოვთ ახლავე გაიაროთ რეგისტრაცია Unicode-ის მეათე საერთაშორისო
- კონფერენციაზე დასასწრებად, რომელიც გაიმართება 10-12 მარტს,
- ქ. მაინცში, გერმანიაში. კონფერენცია შეჰკრებს ერთად მსოფლიოს
- ექსპერტებს ისეთ დარგებში როგორიცაა ინტერნეტი და Unicode-ი,
- ინტერნაციონალიზაცია და ლოკალიზაცია, Unicode-ის გამოყენება
- ოპერაციულ სისტემებსა, და გამოყენებით პროგრამებში, შრიფტებში,
- ტექსტების დამუშავებასა და მრავალენოვან კომპიუტერულ სისტემებში.
-
-Russian:
-
- From a Unicode conference invitation:
-
- Зарегистрируйтесь сейчас на Десятую Международную Конференцию по
- Unicode, которая состоится 10-12 марта 1997 года в Майнце в Германии.
- Конференция соберет широкий круг экспертов по вопросам глобального
- Интернета и Unicode, локализации и интернационализации, воплощению и
- применению Unicode в различных операционных системах и программных
- приложениях, шрифтах, верстке и многоязычных компьютерных системах.
-
-Thai (UCS Level 2):
-
- Excerpt from a poetry on The Romance of The Three Kingdoms (a Chinese
- classic 'San Gua'):
-
- [----------------------------|------------------------]
- ๏ แผ่นดินฮั่นเสื่อมโทรมแสนสังเวช พระปกเกศกองบู๊กู้ขึ้นใหม่
- สิบสองกษัตริย์ก่อนหน้าแลถัดไป สององค์ไซร้โง่เขลาเบาปัญญา
- ทรงนับถือขันทีเป็นที่พึ่ง บ้านเมืองจึงวิปริตเป็นนักหนา
- โฮจิ๋นเรียกทัพทั่วหัวเมืองมา หมายจะฆ่ามดชั่วตัวสำคัญ
- เหมือนขับไสไล่เสือจากเคหา รับหมาป่าเข้ามาเลยอาสัญ
- ฝ่ายอ้องอุ้นยุแยกให้แตกกัน ใช้สาวนั้นเป็นชนวนชื่นชวนใจ
- พลันลิฉุยกุยกีกลับก่อเหตุ ช่างอาเพศจริงหนาฟ้าร้องไห้
- ต้องรบราฆ่าฟันจนบรรลัย ฤๅหาใครค้ำชูกู้บรรลังก์ ฯ
-
- (The above is a two-column text. If combining characters are handled
- correctly, the lines of the second column should be aligned with the
- | character above.)
-
-Ethiopian:
-
- Proverbs in the Amharic language:
-
- ሰማይ አይታረስ ንጉሥ አይከሰስ።
- ብላ ካለኝ እንደአባቴ በቆመጠኝ።
- ጌጥ ያለቤቱ ቁምጥና ነው።
- ደሀ በሕልሙ ቅቤ ባይጠጣ ንጣት በገደለው።
- የአፍ ወለምታ በቅቤ አይታሽም።
- አይጥ በበላ ዳዋ ተመታ።
- ሲተረጉሙ ይደረግሙ።
- ቀስ በቀስ፥ ዕንቁላል በእግሩ ይሄዳል።
- ድር ቢያብር አንበሳ ያስር።
- ሰው እንደቤቱ እንጅ እንደ ጉረቤቱ አይተዳደርም።
- እግዜር የከፈተውን ጉሮሮ ሳይዘጋው አይድርም።
- የጎረቤት ሌባ፥ ቢያዩት ይስቅ ባያዩት ያጠልቅ።
- ሥራ ከመፍታት ልጄን ላፋታት።
- ዓባይ ማደሪያ የለው፥ ግንድ ይዞ ይዞራል።
- የእስላም አገሩ መካ የአሞራ አገሩ ዋርካ።
- ተንጋሎ ቢተፉ ተመልሶ ባፉ።
- ወዳጅህ ማር ቢሆን ጨርስህ አትላሰው።
- እግርህን በፍራሽህ ልክ ዘርጋ።
-
-Runes:
-
- ᚻᛖ ᚳᚹᚫᚦ ᚦᚫᛏ ᚻᛖ ᛒᚢᛞᛖ ᚩᚾ ᚦᚫᛗ ᛚᚪᚾᛞᛖ ᚾᚩᚱᚦᚹᛖᚪᚱᛞᚢᛗ ᚹᛁᚦ ᚦᚪ ᚹᛖᛥᚫ
-
- (Old English, which transcribed into Latin reads 'He cwaeth that he
- bude thaem lande northweardum with tha Westsae.' and means 'He said
- that he lived in the northern land near the Western Sea.')
-
-Braille:
-
- ⡌⠁⠧⠑ ⠼⠁⠒ ⡍⠜⠇⠑⠹⠰⠎ ⡣⠕⠌
-
- ⡍⠜⠇⠑⠹ ⠺⠁⠎ ⠙⠑⠁⠙⠒ ⠞⠕ ⠃⠑⠛⠔ ⠺⠊⠹⠲ ⡹⠻⠑ ⠊⠎ ⠝⠕ ⠙⠳⠃⠞
- ⠱⠁⠞⠑⠧⠻ ⠁⠃⠳⠞ ⠹⠁⠞⠲ ⡹⠑ ⠗⠑⠛⠊⠌⠻ ⠕⠋ ⠙⠊⠎ ⠃⠥⠗⠊⠁⠇ ⠺⠁⠎
- ⠎⠊⠛⠝⠫ ⠃⠹ ⠹⠑ ⠊⠇⠻⠛⠹⠍⠁⠝⠂ ⠹⠑ ⠊⠇⠻⠅⠂ ⠹⠑ ⠥⠝⠙⠻⠞⠁⠅⠻⠂
- ⠁⠝⠙ ⠹⠑ ⠡⠊⠑⠋ ⠍⠳⠗⠝⠻⠲ ⡎⠊⠗⠕⠕⠛⠑ ⠎⠊⠛⠝⠫ ⠊⠞⠲ ⡁⠝⠙
- ⡎⠊⠗⠕⠕⠛⠑⠰⠎ ⠝⠁⠍⠑ ⠺⠁⠎ ⠛⠕⠕⠙ ⠥⠏⠕⠝ ⠰⡡⠁⠝⠛⠑⠂ ⠋⠕⠗ ⠁⠝⠹⠹⠔⠛ ⠙⠑
- ⠡⠕⠎⠑ ⠞⠕ ⠏⠥⠞ ⠙⠊⠎ ⠙⠁⠝⠙ ⠞⠕⠲
-
- ⡕⠇⠙ ⡍⠜⠇⠑⠹ ⠺⠁⠎ ⠁⠎ ⠙⠑⠁⠙ ⠁⠎ ⠁ ⠙⠕⠕⠗⠤⠝⠁⠊⠇⠲
-
- ⡍⠔⠙⠖ ⡊ ⠙⠕⠝⠰⠞ ⠍⠑⠁⠝ ⠞⠕ ⠎⠁⠹ ⠹⠁⠞ ⡊ ⠅⠝⠪⠂ ⠕⠋ ⠍⠹
- ⠪⠝ ⠅⠝⠪⠇⠫⠛⠑⠂ ⠱⠁⠞ ⠹⠻⠑ ⠊⠎ ⠏⠜⠞⠊⠊⠥⠇⠜⠇⠹ ⠙⠑⠁⠙ ⠁⠃⠳⠞
- ⠁ ⠙⠕⠕⠗⠤⠝⠁⠊⠇⠲ ⡊ ⠍⠊⠣⠞ ⠙⠁⠧⠑ ⠃⠑⠲ ⠔⠊⠇⠔⠫⠂ ⠍⠹⠎⠑⠇⠋⠂ ⠞⠕
- ⠗⠑⠛⠜⠙ ⠁ ⠊⠕⠋⠋⠔⠤⠝⠁⠊⠇ ⠁⠎ ⠹⠑ ⠙⠑⠁⠙⠑⠌ ⠏⠊⠑⠊⠑ ⠕⠋ ⠊⠗⠕⠝⠍⠕⠝⠛⠻⠹
- ⠔ ⠹⠑ ⠞⠗⠁⠙⠑⠲ ⡃⠥⠞ ⠹⠑ ⠺⠊⠎⠙⠕⠍ ⠕⠋ ⠳⠗ ⠁⠝⠊⠑⠌⠕⠗⠎
- ⠊⠎ ⠔ ⠹⠑ ⠎⠊⠍⠊⠇⠑⠆ ⠁⠝⠙ ⠍⠹ ⠥⠝⠙⠁⠇⠇⠪⠫ ⠙⠁⠝⠙⠎
- ⠩⠁⠇⠇ ⠝⠕⠞ ⠙⠊⠌⠥⠗⠃ ⠊⠞⠂ ⠕⠗ ⠹⠑ ⡊⠳⠝⠞⠗⠹⠰⠎ ⠙⠕⠝⠑ ⠋⠕⠗⠲ ⡹⠳
- ⠺⠊⠇⠇ ⠹⠻⠑⠋⠕⠗⠑ ⠏⠻⠍⠊⠞ ⠍⠑ ⠞⠕ ⠗⠑⠏⠑⠁⠞⠂ ⠑⠍⠏⠙⠁⠞⠊⠊⠁⠇⠇⠹⠂ ⠹⠁⠞
- ⡍⠜⠇⠑⠹ ⠺⠁⠎ ⠁⠎ ⠙⠑⠁⠙ ⠁⠎ ⠁ ⠙⠕⠕⠗⠤⠝⠁⠊⠇⠲
-
- (The first couple of paragraphs of "A Christmas Carol" by Dickens)
-
-Compact font selection example text:
-
- ABCDEFGHIJKLMNOPQRSTUVWXYZ /0123456789
- abcdefghijklmnopqrstuvwxyz £©µÀÆÖÞßéöÿ
- –—‘“”„†•…‰™œŠŸž€ ΑΒΓΔΩαβγδω АБВГДабвгд
- ∀∂∈ℝ∧∪≡∞ ↑↗↨↻⇣ ┐┼╔╘░►☺♀ fi�⑀₂ἠḂӥẄɐː⍎אԱა
-
-Greetings in various languages:
-
- Hello world, Καλημέρα κόσμε, コンニチハ
-
-Box drawing alignment tests: █
- ▉
- ╔══╦══╗ ┌──┬──┐ ╭──┬──╮ ╭──┬──╮ ┏━━┳━━┓ ┎┒┏┑ ╷ ╻ ┏┯┓ ┌┰┐ ▊ ╱╲╱╲╳╳╳
- ║┌─╨─┐║ │╔═╧═╗│ │╒═╪═╕│ │╓─╁─╖│ ┃┌─╂─┐┃ ┗╃╄┙ ╶┼╴╺╋╸┠┼┨ ┝╋┥ ▋ ╲╱╲╱╳╳╳
- ║│╲ ╱│║ │║ ║│ ││ │ ││ │║ ┃ ║│ ┃│ ╿ │┃ ┍╅╆┓ ╵ ╹ ┗┷┛ └┸┘ ▌ ╱╲╱╲╳╳╳
- ╠╡ ╳ ╞╣ ├╢ ╟┤ ├┼─┼─┼┤ ├╫─╂─╫┤ ┣┿╾┼╼┿┫ ┕┛┖┚ ┌┄┄┐ ╎ ┏┅┅┓ ┋ ▍ ╲╱╲╱╳╳╳
- ║│╱ ╲│║ │║ ║│ ││ │ ││ │║ ┃ ║│ ┃│ ╽ │┃ ░░▒▒▓▓██ ┊ ┆ ╎ ╏ ┇ ┋ ▎
- ║└─╥─┘║ │╚═╤═╝│ │╘═╪═╛│ │╙─╀─╜│ ┃└─╂─┘┃ ░░▒▒▓▓██ ┊ ┆ ╎ ╏ ┇ ┋ ▏
- ╚══╩══╝ └──┴──┘ ╰──┴──╯ ╰──┴──╯ ┗━━┻━━┛ ▗▄▖▛▀▜ └╌╌┘ ╎ ┗╍╍┛ ┋ ▁▂▃▄▅▆▇█
- ▝▀▘▙▄▟
+++ /dev/null
-#include <stdio.h>
-#include <string.h>
-#include <glib.h>
-#include "test.h"
-
-/* example from glib documentation */
-RESULT
-test_array_big ()
-{
- GArray *garray;
- gint i;
-
- /* We create a new array to store gint values.
- We don't want it zero-terminated or cleared to 0's. */
- garray = g_array_new (FALSE, FALSE, sizeof (gint));
- for (i = 0; i < 10000; i++)
- g_array_append_val (garray, i);
-
- for (i = 0; i < 10000; i++)
- if (g_array_index (garray, gint, i) != i)
- return FAILED ("array value didn't match");
-
- g_array_free (garray, TRUE);
-
- return NULL;
-}
-
-RESULT
-test_array_index ()
-{
- GArray *array = g_array_new (FALSE, FALSE, sizeof (int));
- int v;
-
- v = 27;
- g_array_append_val (array, v);
-
- if (27 != g_array_index (array, int, 0))
- return FAILED ("");
-
- g_array_free (array, TRUE);
-
- return NULL;
-}
-
-RESULT
-test_array_append_zero_terminated ()
-{
- GArray *array = g_array_new (TRUE, FALSE, sizeof (int));
- int v;
-
- v = 27;
- g_array_append_val (array, v);
-
- if (27 != g_array_index (array, int, 0))
- return FAILED ("g_array_append_val failed");
-
- if (0 != g_array_index (array, int, 1))
- return FAILED ("zero_terminated didn't append a zero element");
-
- g_array_free (array, TRUE);
-
- return NULL;
-}
-
-RESULT
-test_array_append ()
-{
- GArray *array = g_array_new (FALSE, FALSE, sizeof (int));
- int v;
-
- if (0 != array->len)
- return FAILED ("initial array length not zero");
-
- v = 27;
-
- g_array_append_val (array, v);
-
- if (1 != array->len)
- return FAILED ("array append failed");
-
- g_array_free (array, TRUE);
-
- return NULL;
-}
-
-RESULT
-test_array_insert_val ()
-{
- GArray *array = g_array_new (FALSE, FALSE, sizeof (gpointer));
- gpointer ptr0, ptr1, ptr2, ptr3;
-
- g_array_insert_val (array, 0, array);
-
- if (array != g_array_index (array, gpointer, 0))
- return FAILED ("1 The value in the array is incorrect");
-
- g_array_insert_val (array, 1, array);
- if (array != g_array_index (array, gpointer, 1))
- return FAILED ("2 The value in the array is incorrect");
-
- g_array_insert_val (array, 2, array);
- if (array != g_array_index (array, gpointer, 2))
- return FAILED ("3 The value in the array is incorrect");
-
- g_array_free (array, TRUE);
- array = g_array_new (FALSE, FALSE, sizeof (gpointer));
- ptr0 = array;
- ptr1 = array + 1;
- ptr2 = array + 2;
- ptr3 = array + 3;
-
- g_array_insert_val (array, 0, ptr0);
- g_array_insert_val (array, 1, ptr1);
- g_array_insert_val (array, 2, ptr2);
- g_array_insert_val (array, 1, ptr3);
- if (ptr0 != g_array_index (array, gpointer, 0))
- return FAILED ("4 The value in the array is incorrect");
- if (ptr3 != g_array_index (array, gpointer, 1))
- return FAILED ("5 The value in the array is incorrect");
- if (ptr1 != g_array_index (array, gpointer, 2))
- return FAILED ("6 The value in the array is incorrect");
- if (ptr2 != g_array_index (array, gpointer, 3))
- return FAILED ("7 The value in the array is incorrect");
-
- g_array_free (array, TRUE);
- return NULL;
-}
-
-RESULT
-test_array_remove ()
-{
- GArray *array = g_array_new (FALSE, FALSE, sizeof (int));
- int v[] = {30, 29, 28, 27, 26, 25};
-
- g_array_append_vals (array, v, 6);
-
- if (6 != array->len)
- return FAILED ("append_vals fail");
-
- g_array_remove_index (array, 3);
-
- if (5 != array->len)
- return FAILED ("remove_index failed to update length");
-
- if (26 != g_array_index (array, int, 3))
- return FAILED ("remove_index failed to update the array");
-
- g_array_free (array, TRUE);
-
- return NULL;
-}
-
-static Test array_tests [] = {
- {"big", test_array_big},
- {"append", test_array_append},
- {"insert_val", test_array_insert_val},
- {"index", test_array_index},
- {"remove", test_array_remove},
- {"append_zero_term", test_array_append_zero_terminated},
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(array_tests_init, array_tests)
+++ /dev/null
-#include <config.h>
-#include <glib.h>
-#include <string.h>
-#include <stdio.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef G_OS_UNIX
-#include <pthread.h>
-#endif
-#include "test.h"
-
-/* This test is just to be used with valgrind */
-RESULT
-test_dir ()
-{
- GDir *dir;
- GError *error;
- const gchar *name;
-
- /*
- dir = g_dir_open (NULL, 0, NULL);
- */
- dir = g_dir_open ("", 0, NULL);
- if (dir != NULL)
- return FAILED ("1 Should be an error");
-
- dir = g_dir_open ("", 9, NULL);
- if (dir != NULL)
- return FAILED ("2 Should be an error");
-
- error = NULL;
- dir = g_dir_open (".ljasdslakjd", 9, &error);
- if (dir != NULL)
- return FAILED ("3 opendir should fail");
- if (error == NULL)
- return FAILED ("4 got no error");
- g_error_free (error);
- error = NULL;
- dir = g_dir_open (g_get_tmp_dir (), 9, &error);
- if (dir == NULL)
- return FAILED ("5 opendir should succeed");
- if (error != NULL)
- return FAILED ("6 got an error");
- name = NULL;
- name = g_dir_read_name (dir);
- if (name == NULL)
- return FAILED ("7 didn't read a file name");
- while ((name = g_dir_read_name (dir)) != NULL) {
- if (strcmp (name, ".") == 0)
- return FAILED (". directory found");
- if (strcmp (name, "..") == 0)
- return FAILED (".. directory found");
- }
- g_dir_close (dir);
- return OK;
-}
-
-static Test dir_tests [] = {
- {"g_dir_*", test_dir},
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(dir_tests_init, dir_tests)
-
-
+++ /dev/null
-/*
- * EGLib Unit Test Driver
- *
- * Author:
- * Aaron Bockover (abockover@novell.com)
- *
- * (C) 2006 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.
- */
-
-#include <config.h>
-#include "test.h"
-
-#ifndef DRIVER_EXTERNAL_TESTS
-#include "tests.h"
-#endif
-
-#include <stdio.h>
-#ifdef HAVE_GETOPT_H
-#include <getopt.h>
-#endif
-
-#if defined(HAVE_UNISTD_H)
-#include <unistd.h>
-#endif
-
-#ifndef DRIVER_NAME
-#define DRIVER_NAME "EGlib"
-#endif
-
-typedef struct _StringArray {
- gchar **strings;
- gint length;
-} StringArray;
-
-static StringArray *
-string_array_append(StringArray *array, gchar *string)
-{
- if(array == NULL) {
- array = g_new0(StringArray, 1);
- array->length = 1;
- array->strings = g_malloc(sizeof(gchar *) * 2);
- } else {
- array->length++;
- array->strings = g_realloc(array->strings, sizeof(gchar *)
- * (array->length + 1));
- }
-
- array->strings[array->length - 1] = string;
- array->strings[array->length] = NULL;
-
- return array;
-}
-
-gint global_passed = 0, global_tests = 0;
-
-static void
-string_array_free(StringArray *array)
-{
- g_free(array->strings);
- g_free(array);
-}
-
-static void print_help(char *s)
-{
- gint i;
-
- printf("Usage: %s [OPTION]... [TESTGROUP]...\n\n", s);
- printf("OPTIONS are:\n");
- printf(" -h, --help show this help\n");
- printf(" -t, --time time the tests\n");
- printf(" -i, --iterations number of times to run tests\n");
- printf(" -q, --quiet do not print test results; "
- "final time always prints\n");
- printf(" -n, --no-labels print final time without labels, "
- "nice for scripts\n");
- printf(" -d, --debug do not run tests, "
- "debug the driver itself for valgrind\n\n");
- printf("TESTGROUPS available:\n");
-
- for(i = 0; test_groups[i].name != NULL; i++) {
- if(test_groups[i].handler != fake_tests_init) {
- printf(" %s\n", test_groups[i].name);
- }
- }
-
- printf("\n");
-}
-
-#ifdef DRIVER_EXTERNAL_MAIN
-gint run_tests_main(gint argc, gchar **argv)
-#else
-gint main(gint argc, gchar **argv)
-#endif
-{
- gint i, j, c, iterations = 1;
- StringArray *tests_to_run = NULL;
- gdouble time_start;
- gboolean report_time = FALSE;
- gboolean quiet = FALSE;
- gboolean global_failure = FALSE;
- gboolean no_final_time_labels = FALSE;
- gboolean debug = FALSE;
-
-#if HAVE_GETOPT_H
- static struct option long_options [] = {
- {"help", no_argument, 0, 'h'},
- {"time", no_argument, 0, 't'},
- {"quiet", no_argument, 0, 'q'},
- {"iterations", required_argument, 0, 'i'},
- {"debug", no_argument, 0, 'd'},
- {"no-labels", no_argument, 0, 'n'},
- {0, 0, 0, 0}
- };
-
- while((c = getopt_long(argc, argv, "dhtqni:", long_options, NULL)) != -1) { switch(c) {
- case 'h':
- print_help(argv[0]);
- return 1;
- case 't':
- report_time = TRUE;
- break;
- case 'i':
- iterations = atoi(optarg);
- break;
- case 'q':
- quiet = TRUE;
- break;
- case 'n':
- no_final_time_labels = TRUE;
- break;
- case 'd':
- debug = TRUE;
- break;
- }
- }
-
- for(i = optind; i < argc; i++) {
- if(argv[i][0] == '-') {
- continue;
- }
-
- tests_to_run = string_array_append(tests_to_run, argv[i]);
- }
-#endif
-
- time_start = get_timestamp();
-
- for(j = 0; test_groups[j].name != NULL; j++) {
- gboolean run = TRUE;
- gchar *tests = NULL;
- gchar *group = NULL;
-
- if(tests_to_run != NULL) {
- gint k;
- run = FALSE;
-
- for(k = 0; k < tests_to_run->length; k++) {
- gchar *user = tests_to_run->strings[k];
- const gchar *table = test_groups[j].name;
- size_t user_len = strlen(user);
- size_t table_len = strlen(table);
-
- if(strncmp(user, table, table_len) == 0) {
- if(user_len > table_len && user[table_len] != ':') {
- break;
- }
-
- run = TRUE;
- group = tests_to_run->strings[k];
- break;
- }
- }
- }
-
- if(run) {
- gboolean passed;
- gchar **split = NULL;
-
- if(debug && test_groups[j].handler != fake_tests_init) {
- printf("Skipping %s, in driver debug mode\n",
- test_groups[j].name);
- continue;
- } else if(!debug && test_groups[j].handler == fake_tests_init) {
- continue;
- }
-
- if(group != NULL) {
- split = eg_strsplit(group, ":", -1);
- if(split != NULL) {
- gint m;
- for(m = 0; split[m] != NULL; m++) {
- if(m == 1) {
- tests = strdup(split[m]);
- break;
- }
- }
- eg_strfreev(split);
- }
- }
-
- passed = run_group(&(test_groups[j]),
- iterations, quiet, report_time, tests);
-
- if(tests != NULL) {
- g_free(tests);
- }
-
- if(!passed && !global_failure) {
- global_failure = TRUE;
- }
- }
- }
-
- if(!quiet) {
- gdouble pass_percentage = ((gdouble)global_passed / (gdouble)global_tests) * 100.0;
- printf("=============================\n");
- printf("Overall result: %s : %d / %d (%g%%)\n", global_failure ? "FAILED" : "OK", global_passed, global_tests, pass_percentage);
- }
-
- if(report_time) {
- gdouble duration = get_timestamp() - time_start;
- if(no_final_time_labels) {
- printf("%g\n", duration);
- } else {
- printf("%s Total Time: %g\n", DRIVER_NAME, duration);
- }
- }
-
- if(tests_to_run != NULL) {
- string_array_free(tests_to_run);
- }
-
- return global_tests - global_passed;
-}
-
-
+++ /dev/null
-#include "test.h"
-
-RESULT
-test_swap ()
-{
- guint32 a = 0xabcdef01, res32;
- guint64 b = (((guint64)a) << 32) | a, res64;
- guint64 b_expect = (((guint64)0x1efcdab) << 32) | 0x01efcdab;
- guint16 c = 0xabcd, res16;
-
- res32 = GUINT32_SWAP_LE_BE (a);
- if (res32 != 0x01efcdab)
- return FAILED ("GUINT32_SWAP_LE_BE returned 0x%x", res32);
- res32 = GUINT32_SWAP_LE_BE (1);
- if (res32 != 0x1000000)
- return FAILED ("GUINT32_SWAP_LE_BE returned 0x%x", res32);
-
- res64 = GUINT64_SWAP_LE_BE(b);
- if (res64 != b_expect)
- return FAILED ("GUINT64_SWAP_LE_BE returned 0x%llx (had=0x%llx)", res64, b);
- res16 = GUINT16_SWAP_LE_BE(c);
- if (res16 != 0xcdab)
- return FAILED ("GUINT16_SWAP_LE_BE returned 0x%x", (guint32) res16);
-
- return OK;
-}
-
-/*
- * test initialization
- */
-
-static Test endian_tests [] = {
- {"swap", test_swap},
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(endian_tests_init, endian_tests)
-
+++ /dev/null
-/*
- * Fake test allows debugging of the driver itself
- */
-
-#include "test.h"
-
-RESULT
-test_fake()
-{
- return OK;
-}
-
-static Test fake_tests [] = {
- {"fake", test_fake},
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(fake_tests_init, fake_tests)
-
+++ /dev/null
-#include <config.h>
-#include <glib.h>
-#include <string.h>
-#include <stdlib.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <stdio.h>
-#include "test.h"
-
-#ifdef G_OS_WIN32
-#include <io.h>
-#define close _close
-#endif
-
-RESULT
-test_file_get_contents ()
-{
- GError *error;
- gchar *content;
- gboolean ret;
- gsize length;
-#ifdef G_OS_WIN32
- const gchar *filename = "c:\\Windows\\system.ini";
-#else
- const gchar *filename = "/etc/hosts";
-#endif
-
- /*
- filename != NULL
- ret = g_file_get_contents (NULL, NULL, NULL, NULL);
- contents != NULL
- ret = g_file_get_contents ("", NULL, NULL, NULL);
- error no such file and fails for 'error' not being null too
- ret = g_file_get_contents ("", &content, NULL, &error);
- */
-
- error = NULL;
- ret = g_file_get_contents ("", &content, NULL, &error);
- if (ret)
- return FAILED ("HAH!");
- if (error == NULL)
- return FAILED ("Got nothing as error.");
- if (content != NULL)
- return FAILED ("Content is uninitialized");
-
- g_error_free (error);
- error = NULL;
- ret = g_file_get_contents (filename, &content, &length, &error);
- if (!ret)
- return FAILED ("The error is %d %s\n", error->code, error->message);
- if (error != NULL)
- return FAILED ("Got an error returning TRUE");
- if (content == NULL)
- return FAILED ("Content is NULL");
- if (strlen (content) != length)
- return FAILED ("length is %d but the string is %d", length, strlen (content));
- g_free (content);
-
- return OK;
-}
-
-RESULT
-test_open_tmp ()
-{
- GError *error;
- gint fd;
- gchar *name = GINT_TO_POINTER (-1);
-
- /*
- * Okay, this works, but creates a .xxx file in /tmp on every run. Disabled.
- * fd = g_file_open_tmp (NULL, NULL, NULL);
- * if (fd < 0)
- * return FAILED ("Default failed.");
- * close (fd);
- */
- error = NULL;
- fd = g_file_open_tmp ("invalidtemplate", NULL, &error);
- if (fd != -1)
- return FAILED ("The template was invalid and accepted");
- if (error == NULL)
- return FAILED ("No error returned.");
- g_error_free (error);
-
- error = NULL;
- fd = g_file_open_tmp ("i/nvalidtemplate", &name, &error);
- if (fd != -1)
- return FAILED ("The template was invalid and accepted");
- if (error == NULL)
- return FAILED ("No error returned.");
- if (name == NULL)
- return FAILED ("'name' is not reset");
- g_error_free (error);
-
- error = NULL;
- fd = g_file_open_tmp ("valid-XXXXXX", &name, &error);
- if (fd == -1)
- return FAILED ("This should be valid");
- if (error != NULL)
- return FAILED ("No error returned.");
- if (name == NULL)
- return FAILED ("No name returned.");
- close (fd);
- unlink (name);
- g_free (name);
- return OK;
-}
-
-RESULT
-test_file ()
-{
- gboolean res;
- const gchar *tmp;
- gchar *path;
-
-#ifndef G_OS_WIN32 /* FIXME */
- gchar *sympath;
- gint ignored G_GNUC_UNUSED;
-#endif
-
- res = g_file_test (NULL, 0);
- if (res)
- return FAILED ("Should return FALSE HERE");
-
- res = g_file_test ("file.c", 0);
- if (res)
- return FAILED ("Should return FALSE HERE");
-
- tmp = g_get_tmp_dir ();
- res = g_file_test (tmp, G_FILE_TEST_EXISTS);
- if (!res)
- return FAILED ("tmp does not exist.");
- res = g_file_test (tmp, G_FILE_TEST_IS_REGULAR);
- if (res)
- return FAILED ("tmp is regular");
-
- res = g_file_test (tmp, G_FILE_TEST_IS_DIR);
- if (!res)
- return FAILED ("tmp is not a directory");
- res = g_file_test (tmp, G_FILE_TEST_IS_EXECUTABLE);
- if (!res)
- return FAILED ("tmp is not a executable");
-
- res = g_file_test (tmp, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_SYMLINK);
- if (!res)
- return FAILED ("2 tmp does not exist.");
- res = g_file_test (tmp, G_FILE_TEST_IS_REGULAR | G_FILE_TEST_IS_SYMLINK);
- if (res)
- return FAILED ("2 tmp is regular");
-
- res = g_file_test (tmp, G_FILE_TEST_IS_DIR | G_FILE_TEST_IS_SYMLINK);
- if (!res)
- return FAILED ("2 tmp is not a directory");
- res = g_file_test (tmp, G_FILE_TEST_IS_EXECUTABLE | G_FILE_TEST_IS_SYMLINK);
- if (!res)
- return FAILED ("2 tmp is not a executable");
-
- close (g_file_open_tmp (NULL, &path, NULL)); /* create an empty file */
- res = g_file_test (path, G_FILE_TEST_EXISTS);
- if (!res)
- return FAILED ("3 %s should exist", path);
- res = g_file_test (path, G_FILE_TEST_IS_REGULAR);
- /* This is strange. Empty file is reported as not existing! */
- if (!res)
- return FAILED ("3 %s IS_REGULAR", path);
- res = g_file_test (path, G_FILE_TEST_IS_DIR);
- if (res)
- return FAILED ("3 %s should not be a directory", path);
- res = g_file_test (path, G_FILE_TEST_IS_EXECUTABLE);
- if (res)
- return FAILED ("3 %s should not be executable", path);
- res = g_file_test (path, G_FILE_TEST_IS_SYMLINK);
- if (res)
- return FAILED ("3 %s should not be a symlink", path);
-
-#ifndef G_OS_WIN32 /* FIXME */
- sympath = g_strconcat (path, "-link", NULL);
- ignored = symlink (path, sympath);
- res = g_file_test (sympath, G_FILE_TEST_EXISTS);
- if (!res)
- return FAILED ("4 %s should not exist", sympath);
- res = g_file_test (sympath, G_FILE_TEST_IS_REGULAR);
- if (!res)
- return FAILED ("4 %s should not be a regular file", sympath);
- res = g_file_test (sympath, G_FILE_TEST_IS_DIR);
- if (res)
- return FAILED ("4 %s should not be a directory", sympath);
- res = g_file_test (sympath, G_FILE_TEST_IS_EXECUTABLE);
- if (res)
- return FAILED ("4 %s should not be executable", sympath);
- res = g_file_test (sympath, G_FILE_TEST_IS_SYMLINK);
- if (!res)
- return FAILED ("4 %s should be a symlink", sympath);
-
- unlink (path);
-
- res = g_file_test (sympath, G_FILE_TEST_EXISTS);
- if (res)
- return FAILED ("5 %s should exist", sympath);
- res = g_file_test (sympath, G_FILE_TEST_IS_REGULAR);
- if (res)
- return FAILED ("5 %s should be a regular file", sympath);
- res = g_file_test (sympath, G_FILE_TEST_IS_DIR);
- if (res)
- return FAILED ("5 %s should not be a directory", sympath);
- res = g_file_test (sympath, G_FILE_TEST_IS_EXECUTABLE);
- if (res)
- return FAILED ("5 %s should not be executable", sympath);
- res = g_file_test (sympath, G_FILE_TEST_IS_SYMLINK);
- if (!res)
- return FAILED ("5 %s should be a symlink", sympath);
- unlink (sympath);
- g_free (sympath);
-#endif
- g_free (path);
- return OK;
-}
-
-static Test file_tests [] = {
- {"g_file_get_contents", test_file_get_contents},
- {"g_file_open_tmp", test_open_tmp},
- {"g_file_test", test_file},
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(file_tests_init, file_tests)
-
-
+++ /dev/null
-#include <stdio.h>
-#include <string.h>
-#include <glib.h>
-#include "test.h"
-
-int foreach_count = 0;
-int foreach_fail = 0;
-
-void foreach (gpointer key, gpointer value, gpointer user_data)
-{
- foreach_count++;
- if (GPOINTER_TO_INT (user_data) != 'a')
- foreach_fail = 1;
-}
-
-RESULT hash_t1 (void)
-{
- GHashTable *t = g_hash_table_new (g_str_hash, g_str_equal);
-
- foreach_count = 0;
- foreach_fail = 0;
- g_hash_table_insert (t, "hello", "world");
- g_hash_table_insert (t, "my", "god");
-
- g_hash_table_foreach (t, foreach, GINT_TO_POINTER('a'));
- if (foreach_count != 2)
- return FAILED ("did not find all keys, got %d expected 2", foreach_count);
- if (foreach_fail)
- return FAILED("failed to pass the user-data to foreach");
-
- if (!g_hash_table_remove (t, "my"))
- return FAILED ("did not find known key");
- if (g_hash_table_size (t) != 1)
- return FAILED ("unexpected size");
- g_hash_table_insert(t, "hello", "moon");
- if (strcmp (g_hash_table_lookup (t, "hello"), "moon") != 0)
- return FAILED ("did not replace world with moon");
-
- if (!g_hash_table_remove (t, "hello"))
- return FAILED ("did not find known key");
- if (g_hash_table_size (t) != 0)
- return FAILED ("unexpected size");
- g_hash_table_destroy (t);
-
- return OK;
-}
-
-RESULT hash_t2 (void)
-{
- return OK;
-}
-
-RESULT hash_default (void)
-{
- GHashTable *hash = g_hash_table_new (NULL, NULL);
-
- if (hash == NULL)
- return FAILED ("g_hash_table_new should return a valid hash");
-
- g_hash_table_destroy (hash);
- return NULL;
-}
-
-RESULT
-hash_null_lookup (void)
-{
- GHashTable *hash = g_hash_table_new (NULL, NULL);
- gpointer ok, ov;
-
- g_hash_table_insert (hash, NULL, GINT_TO_POINTER (1));
- g_hash_table_insert (hash, GINT_TO_POINTER(1), GINT_TO_POINTER(2));
-
- if (!g_hash_table_lookup_extended (hash, NULL, &ok, &ov))
- return FAILED ("Did not find the NULL");
- if (ok != NULL)
- return FAILED ("Incorrect key found");
- if (ov != GINT_TO_POINTER (1))
- return FAILED ("Got wrong value %p\n", ov);
-
- if (!g_hash_table_lookup_extended (hash, GINT_TO_POINTER(1), &ok, &ov))
- return FAILED ("Did not find the 1");
- if (ok != GINT_TO_POINTER(1))
- return FAILED ("Incorrect key found");
- if (ov != GINT_TO_POINTER (2))
- return FAILED ("Got wrong value %p\n", ov);
-
- g_hash_table_destroy (hash);
-
- return NULL;
-}
-
-static void
-counter (gpointer key, gpointer value, gpointer user_data)
-{
- int *counter = (int *) user_data;
-
- (*counter)++;
-}
-
-RESULT hash_grow (void)
-{
- GHashTable *hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
- int i, count = 0;
-
- for (i = 0; i < 1000; i++)
- g_hash_table_insert (hash, g_strdup_printf ("%d", i), g_strdup_printf ("x-%d", i));
-
- for (i = 0; i < 1000; i++){
- char buffer [30];
- gpointer value;
-
- sprintf (buffer, "%d", i);
-
- value = g_hash_table_lookup (hash, buffer);
- sprintf (buffer, "x-%d", i);
- if (strcmp (value, buffer) != 0){
- return FAILED ("Failed to lookup the key %d, the value was %s\n", i, value);
- }
- }
-
- if (g_hash_table_size (hash) != 1000)
- return FAILED ("Did not find 1000 elements on the hash, found %d\n", g_hash_table_size (hash));
-
- /* Now do the manual count, lets not trust the internals */
- g_hash_table_foreach (hash, counter, &count);
- if (count != 1000){
- return FAILED ("Foreach count is not 1000");
- }
-
- g_hash_table_destroy (hash);
- return NULL;
-}
-
-RESULT hash_iter (void)
-{
-#if !defined(GLIB_MAJOR_VERSION) || GLIB_CHECK_VERSION(2, 16, 0)
- GHashTable *hash = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, NULL);
- GHashTableIter iter;
- int i, sum, keys_sum, values_sum;
- gpointer key, value;
-
- sum = 0;
- for (i = 0; i < 1000; i++) {
- sum += i;
- g_hash_table_insert (hash, GUINT_TO_POINTER (i), GUINT_TO_POINTER (i));
- }
-
- keys_sum = values_sum = 0;
- g_hash_table_iter_init (&iter, hash);
- while (g_hash_table_iter_next (&iter, &key, &value)) {
- if (key != value)
- return FAILED ("key != value");
- keys_sum += GPOINTER_TO_UINT (key);
- values_sum += GPOINTER_TO_UINT (value);
- }
- if (keys_sum != sum || values_sum != sum)
- return FAILED ("Did not find all key-value pairs");
- g_hash_table_destroy (hash);
- return NULL;
-#else
- /* GHashTableIter was added in glib 2.16 */
- return NULL;
-#endif
-}
-
-static Test hashtable_tests [] = {
- {"t1", hash_t1},
- {"t2", hash_t2},
- {"grow", hash_grow},
- {"default", hash_default},
- {"null_lookup", hash_null_lookup},
- {"iter", hash_iter},
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(hashtable_tests_init, hashtable_tests)
-
+++ /dev/null
-#include <stdio.h>
-#include <string.h>
-#include <glib.h>
-#include "test.h"
-
-RESULT
-test_list_length ()
-{
- GList *list = g_list_prepend (NULL, "foo");
-
- if (g_list_length (list) != 1)
- return FAILED ("length failed. #1");
-
- list = g_list_prepend (list, "bar");
- if (g_list_length (list) != 2)
- return FAILED ("length failed. #2");
-
- list = g_list_append (list, "bar");
- if (g_list_length (list) != 3)
- return FAILED ("length failed. #3");
-
- g_list_free (list);
- return NULL;
-}
-
-RESULT
-test_list_nth ()
-{
- char *foo = "foo";
- char *bar = "bar";
- char *baz = "baz";
- GList *nth, *list;
- list = g_list_prepend (NULL, baz);
- list = g_list_prepend (list, bar);
- list = g_list_prepend (list, foo);
-
- nth = g_list_nth (list, 0);
- if (nth->data != foo)
- return FAILED ("nth failed. #0");
-
- nth = g_list_nth (list, 1);
- if (nth->data != bar)
- return FAILED ("nth failed. #1");
-
- nth = g_list_nth (list, 2);
- if (nth->data != baz)
- return FAILED ("nth failed. #2");
-
- nth = g_list_nth (list, 3);
- if (nth)
- return FAILED ("nth failed. #3: %s", nth->data);
-
- g_list_free (list);
- return OK;
-}
-
-RESULT
-test_list_index ()
-{
- int i;
- char *foo = "foo";
- char *bar = "bar";
- char *baz = "baz";
- GList *list;
- list = g_list_prepend (NULL, baz);
- list = g_list_prepend (list, bar);
- list = g_list_prepend (list, foo);
-
- i = g_list_index (list, foo);
- if (i != 0)
- return FAILED ("index failed. #0: %d", i);
-
- i = g_list_index (list, bar);
- if (i != 1)
- return FAILED ("index failed. #1: %d", i);
-
- i = g_list_index (list, baz);
- if (i != 2)
- return FAILED ("index failed. #2: %d", i);
-
- g_list_free (list);
- return OK;
-}
-
-RESULT
-test_list_append ()
-{
- GList *list = g_list_prepend (NULL, "first");
- if (g_list_length (list) != 1)
- return FAILED ("Prepend failed");
-
- list = g_list_append (list, "second");
-
- if (g_list_length (list) != 2)
- return FAILED ("Append failed");
-
- g_list_free (list);
- return OK;
-}
-
-RESULT
-test_list_last ()
-{
- GList *foo = g_list_prepend (NULL, "foo");
- GList *bar = g_list_prepend (NULL, "bar");
- GList *last;
-
- foo = g_list_concat (foo, bar);
- last = g_list_last (foo);
-
- if (last != bar)
- return FAILED ("last failed. #1");
-
- foo = g_list_concat (foo, g_list_prepend (NULL, "baz"));
- foo = g_list_concat (foo, g_list_prepend (NULL, "quux"));
-
- last = g_list_last (foo);
- if (strcmp ("quux", last->data))
- return FAILED ("last failed. #2");
-
- g_list_free (foo);
-
- return OK;
-}
-
-RESULT
-test_list_concat ()
-{
- GList *foo = g_list_prepend (NULL, "foo");
- GList *bar = g_list_prepend (NULL, "bar");
- GList *list = g_list_concat (foo, bar);
-
- if (g_list_length (list) != 2)
- return FAILED ("Concat failed. #1");
-
- if (strcmp (list->data, "foo"))
- return FAILED ("Concat failed. #2");
-
- if (strcmp (list->next->data, "bar"))
- return FAILED ("Concat failed. #3");
-
- if (g_list_first (list) != foo)
- return FAILED ("Concat failed. #4");
-
- if (g_list_last (list) != bar)
- return FAILED ("Concat failed. #5");
-
- g_list_free (list);
-
- return OK;
-}
-
-
-static gint
-compare (gconstpointer a, gconstpointer b)
-{
- char *foo = (char *) a;
- char *bar = (char *) b;
-
- if (strlen (foo) < strlen (bar))
- return -1;
-
- return 1;
-}
-
-RESULT
-test_list_insert_sorted ()
-{
- GList *list = g_list_prepend (NULL, "a");
- list = g_list_append (list, "aaa");
-
- /* insert at the middle */
- list = g_list_insert_sorted (list, "aa", compare);
- if (strcmp ("aa", list->next->data))
- return FAILED ("insert_sorted failed. #1");
-
- /* insert at the beginning */
- list = g_list_insert_sorted (list, "", compare);
- if (strcmp ("", list->data))
- return FAILED ("insert_sorted failed. #2");
-
- /* insert at the end */
- list = g_list_insert_sorted (list, "aaaa", compare);
- if (strcmp ("aaaa", g_list_last (list)->data))
- return FAILED ("insert_sorted failed. #3");
-
- g_list_free (list);
- return OK;
-}
-
-RESULT
-test_list_copy ()
-{
- int i, length;
- GList *list, *copy;
- list = g_list_prepend (NULL, "a");
- list = g_list_append (list, "aa");
- list = g_list_append (list, "aaa");
- list = g_list_append (list, "aaaa");
-
- length = g_list_length (list);
- copy = g_list_copy (list);
-
- for (i = 0; i < length; i++)
- if (strcmp (g_list_nth (list, i)->data,
- g_list_nth (copy, i)->data))
- return FAILED ("copy failed.");
-
- g_list_free (list);
- g_list_free (copy);
- return OK;
-}
-
-RESULT
-test_list_reverse ()
-{
- guint i, length;
- GList *list, *reverse;
- list = g_list_prepend (NULL, "a");
- list = g_list_append (list, "aa");
- list = g_list_append (list, "aaa");
- list = g_list_append (list, "aaaa");
-
- length = g_list_length (list);
- reverse = g_list_reverse (g_list_copy (list));
-
- if (g_list_length (reverse) != length)
- return FAILED ("reverse failed #1");
-
- for (i = 0; i < length; i++){
- guint j = length - i - 1;
- if (strcmp (g_list_nth (list, i)->data,
- g_list_nth (reverse, j)->data))
- return FAILED ("reverse failed. #2");
- }
-
- g_list_free (list);
- g_list_free (reverse);
- return OK;
-}
-
-RESULT
-test_list_remove ()
-{
- GList *list = g_list_prepend (NULL, "three");
- char *one = "one";
- list = g_list_prepend (list, "two");
- list = g_list_prepend (list, one);
-
- list = g_list_remove (list, one);
-
- if (g_list_length (list) != 2)
- return FAILED ("Remove failed");
-
- if (strcmp ("two", list->data) != 0)
- return FAILED ("Remove failed");
-
- g_list_free (list);
- return OK;
-}
-
-RESULT
-test_list_remove_link ()
-{
- GList *foo = g_list_prepend (NULL, "a");
- GList *bar = g_list_prepend (NULL, "b");
- GList *baz = g_list_prepend (NULL, "c");
- GList *list = foo;
-
- foo = g_list_concat (foo, bar);
- foo = g_list_concat (foo, baz);
-
- list = g_list_remove_link (list, bar);
-
- if (g_list_length (list) != 2)
- return FAILED ("remove_link failed #1");
-
- if (bar->next != NULL)
- return FAILED ("remove_link failed #2");
-
- g_list_free (list);
- g_list_free (bar);
- return OK;
-}
-
-RESULT
-test_list_insert_before ()
-{
- GList *foo, *bar, *baz;
-
- foo = g_list_prepend (NULL, "foo");
- foo = g_list_insert_before (foo, NULL, "bar");
- bar = g_list_last (foo);
-
- if (strcmp (bar->data, "bar"))
- return FAILED ("1");
-
- baz = g_list_insert_before (foo, bar, "baz");
- if (foo != baz)
- return FAILED ("2");
-
- if (strcmp (g_list_nth_data (foo, 1), "baz"))
- return FAILED ("3: %s", g_list_nth_data (foo, 1));
-
- g_list_free (foo);
- return OK;
-}
-
-#define N_ELEMS 101
-
-static int intcompare (gconstpointer p1, gconstpointer p2)
-{
- return GPOINTER_TO_INT (p1) - GPOINTER_TO_INT (p2);
-}
-
-static gboolean verify_sort (GList *list, int len)
-{
- int prev;
-
- if (list->prev)
- return FALSE;
-
- prev = GPOINTER_TO_INT (list->data);
- len--;
- for (list = list->next; list; list = list->next) {
- int curr = GPOINTER_TO_INT (list->data);
- if (prev > curr)
- return FALSE;
- prev = curr;
-
- if (!list->prev || list->prev->next != list)
- return FALSE;
-
- if (len == 0)
- return FALSE;
- len--;
- }
- return len == 0;
-}
-
-RESULT
-test_list_sort ()
-{
- int i, j, mul;
- GList *list = NULL;
-
- for (i = 0; i < N_ELEMS; ++i)
- list = g_list_prepend (list, GINT_TO_POINTER (i));
- list = g_list_sort (list, intcompare);
- if (!verify_sort (list, N_ELEMS))
- return FAILED ("decreasing list");
-
- g_list_free (list);
-
- list = NULL;
- for (i = 0; i < N_ELEMS; ++i)
- list = g_list_prepend (list, GINT_TO_POINTER (-i));
- list = g_list_sort (list, intcompare);
- if (!verify_sort (list, N_ELEMS))
- return FAILED ("increasing list");
-
- g_list_free (list);
-
- list = g_list_prepend (NULL, GINT_TO_POINTER (0));
- for (i = 1; i < N_ELEMS; ++i) {
- list = g_list_prepend (list, GINT_TO_POINTER (i));
- list = g_list_prepend (list, GINT_TO_POINTER (-i));
- }
- list = g_list_sort (list, intcompare);
- if (!verify_sort (list, 2*N_ELEMS-1))
- return FAILED ("alternating list");
-
- g_list_free (list);
-
- list = NULL;
- mul = 1;
- for (i = 1; i < N_ELEMS; ++i) {
- mul = -mul;
- for (j = 0; j < i; ++j)
- list = g_list_prepend (list, GINT_TO_POINTER (mul * j));
- }
- list = g_list_sort (list, intcompare);
- if (!verify_sort (list, (N_ELEMS*N_ELEMS - N_ELEMS)/2))
- return FAILED ("wavering list");
-
- g_list_free (list);
-
- return OK;
-}
-
-static gint
-find_custom (gconstpointer a, gconstpointer b)
-{
- return(strcmp (a, b));
-}
-
-RESULT
-test_list_find_custom ()
-{
- GList *list = NULL, *found;
- char *foo = "foo";
- char *bar = "bar";
- char *baz = "baz";
-
- list = g_list_prepend (list, baz);
- list = g_list_prepend (list, bar);
- list = g_list_prepend (list, foo);
-
- found = g_list_find_custom (list, baz, find_custom);
-
- if (found == NULL)
- return FAILED ("Find failed");
-
- g_list_free (list);
-
- return OK;
-}
-
-static Test list_tests [] = {
- { "length", test_list_length},
- { "nth", test_list_nth},
- { "index", test_list_index},
- { "last", test_list_last},
- { "append", test_list_append},
- { "concat", test_list_concat},
- {"insert_sorted", test_list_insert_sorted},
- {"insert_before", test_list_insert_before},
- { "copy", test_list_copy},
- { "reverse", test_list_reverse},
- { "remove", test_list_remove},
- { "remove_link", test_list_remove_link},
- { "remove_link", test_list_remove_link},
- { "sort", test_list_sort},
- { "find_custom", test_list_find_custom},
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(list_tests_init, list_tests)
+++ /dev/null
-#include <stdio.h>
-#include <string.h>
-#include <glib.h>
-#include "test.h"
-
-#define do_bad_test(s) do { char *r = markup_test (s); if (r == NULL) return FAILED ("Failed on test " # s); else g_free (r); } while (0)
-#define do_ok_test(s) do { char *r = markup_test (s); if (r != NULL) return FAILED ("Could not parse valid " # s); } while (0)
-
-static char *
-markup_test (const char *s)
-{
- GMarkupParser *parser = g_new0 (GMarkupParser, 1);
- GMarkupParseContext *context;
- GError *error = NULL;
-
- context = g_markup_parse_context_new (parser, 0, 0, 0);
-
- g_markup_parse_context_parse (context, s, strlen (s), &error);
- g_markup_parse_context_free (context);
-
- if (error != NULL){
- char *msg = g_strdup (error->message);
- g_error_free (error);
-
- g_free (parser);
- return msg;
- }
- g_free (parser);
- return NULL;
-}
-
-RESULT
-invalid_documents (void)
-{
- /* These should fail */
- do_bad_test ("<1>");
- do_bad_test ("<a<");
- do_bad_test ("</a>");
- do_bad_test ("<a b>");
- do_bad_test ("<a b=>");
- do_bad_test ("<a b=c>");
-
- return OK;
-}
-
-RESULT
-valid_documents (void)
-{
- /* These should fail */
- do_ok_test ("<a>");
- do_ok_test ("<a a=\"b\">");
-
- return OK;
-}
-
-/*
- * This is a test for the kind of files that the code in mono/domain.c
- * parses; This code comes from Mono
- */
-typedef struct {
- GSList *supported_runtimes;
- char *required_runtime;
- int configuration_count;
- int startup_count;
-} AppConfigInfo;
-
-static char *
-get_attribute_value (const gchar **attribute_names,
- const gchar **attribute_values,
- const char *att_name)
-{
- int n;
- for (n=0; attribute_names[n] != NULL; n++) {
- if (strcmp (attribute_names[n], att_name) == 0)
- return g_strdup (attribute_values[n]);
- }
- return NULL;
-}
-
-static void
-start_element (GMarkupParseContext *context,
- const gchar *element_name,
- const gchar **attribute_names,
- const gchar **attribute_values,
- gpointer user_data,
- GError **error)
-{
- AppConfigInfo* app_config = (AppConfigInfo*) user_data;
-
- if (strcmp (element_name, "configuration") == 0) {
- app_config->configuration_count++;
- return;
- }
- if (strcmp (element_name, "startup") == 0) {
- app_config->startup_count++;
- return;
- }
-
- if (app_config->configuration_count != 1 || app_config->startup_count != 1)
- return;
-
- if (strcmp (element_name, "requiredRuntime") == 0) {
- app_config->required_runtime = get_attribute_value (attribute_names, attribute_values, "version");
- } else if (strcmp (element_name, "supportedRuntime") == 0) {
- char *version = get_attribute_value (attribute_names, attribute_values, "version");
- app_config->supported_runtimes = g_slist_append (app_config->supported_runtimes, version);
- }
-}
-
-static void
-end_element (GMarkupParseContext *context,
- const gchar *element_name,
- gpointer user_data,
- GError **error)
-{
- AppConfigInfo* app_config = (AppConfigInfo*) user_data;
-
- if (strcmp (element_name, "configuration") == 0) {
- app_config->configuration_count--;
- } else if (strcmp (element_name, "startup") == 0) {
- app_config->startup_count--;
- }
-}
-
-static const GMarkupParser
-mono_parser = {
- start_element,
- end_element,
- NULL,
- NULL,
- NULL
-};
-
-AppConfigInfo *
-domain_test (char *text)
-{
- AppConfigInfo *app_config = g_new0 (AppConfigInfo, 1);
- GMarkupParseContext *context;
-
- context = g_markup_parse_context_new (&mono_parser, 0, app_config, NULL);
- if (g_markup_parse_context_parse (context, text, strlen (text), NULL)) {
- g_markup_parse_context_end_parse (context, NULL);
- }
- g_markup_parse_context_free (context);
-
- return app_config;
-}
-
-void
-domain_free (AppConfigInfo *info)
-{
- GSList *l;
- if (info->required_runtime)
- g_free (info->required_runtime);
- for (l = info->supported_runtimes; l != NULL; l = l->next){
- g_free (l->data);
- }
- g_slist_free (info->supported_runtimes);
- g_free (info);
-}
-
-RESULT
-mono_domain (void)
-{
- AppConfigInfo *info;
-
- info = domain_test ("<configuration><!--hello--><startup><!--world--><requiredRuntime version=\"v1\"><!--r--></requiredRuntime></startup></configuration>");
- if (info->required_runtime == NULL)
- return FAILED ("No required runtime section");
- if (strcmp (info->required_runtime, "v1") != 0)
- return FAILED ("Got a runtime version %s, expected v1", info->required_runtime);
- domain_free (info);
-
- info = domain_test ("<configuration><startup><requiredRuntime version=\"v1\"/><!--comment--></configuration><!--end-->");
- if (info->required_runtime == NULL)
- return FAILED ("No required runtime section on auto-close section");
- if (strcmp (info->required_runtime, "v1") != 0)
- return FAILED ("Got a runtime version %s, expected v1", info->required_runtime);
- domain_free (info);
-
- info = domain_test ("<!--start--><configuration><startup><supportedRuntime version=\"v1\"/><!--middle--><supportedRuntime version=\"v2\"/></startup></configuration>");
- if ((strcmp ((char*)info->supported_runtimes->data, "v1") == 0)){
- if (info->supported_runtimes->next == NULL)
- return FAILED ("Expected 2 supported runtimes");
-
- if ((strcmp ((char*)info->supported_runtimes->next->data, "v2") != 0))
- return FAILED ("Expected v1, v2, got %s", info->supported_runtimes->next->data);
- if (info->supported_runtimes->next->next != NULL)
- return FAILED ("Expected v1, v2, got more");
- } else
- return FAILED ("Expected `v1', got %s", info->supported_runtimes->data);
- domain_free (info);
-
- return NULL;
-}
-
-RESULT
-mcs_config (void)
-{
- return markup_test ("<configuration>\r\n <system.diagnostics>\r\n <trace autoflush=\"true\" indentsize=\"4\">\r\n <listeners>\r\n <add name=\"compilerLogListener\" type=\"System.Diagnostics.TextWriterTraceListener,System\"/> </listeners> </trace> </system.diagnostics> </configuration>");
-
-}
-
-RESULT
-xml_parse (void)
-{
- return markup_test ("<?xml version=\"1.0\" encoding=\"utf-8\"?><a></a>");
-}
-
-RESULT
-machine_config (void)
-{
- char *data;
- gsize size;
-
- if (g_file_get_contents ("../../data/net_1_1/machine.config", &data, &size, NULL)){
- return markup_test (data);
- }
- printf ("Ignoring this test\n");
- return NULL;
-}
-
-static Test markup_tests [] = {
- {"invalid_documents", invalid_documents},
- {"good_documents", valid_documents},
- {"mono_domain", mono_domain},
- {"mcs_config", mcs_config},
- {"xml_parse", xml_parse},
- {"machine_config", machine_config},
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(markup_tests_init, markup_tests)
-
+++ /dev/null
-
-#include <glib.h>
-#include "test.h"
-
-RESULT
-test_memory_zero_size_allocations ()
-{
- gpointer p;
-
- p = g_malloc (0);
- if (p)
- return FAILED ("Calling g_malloc with size zero should return NULL.");
-
- p = g_malloc0 (0);
- if (p)
- return FAILED ("Calling g_malloc0 with size zero should return NULL.");
-
- p = g_realloc (NULL, 0);
- if (p)
- return FAILED ("Calling g_realloc with size zero should return NULL.");
-
- p = g_new (int, 0);
- if (p)
- return FAILED ("Calling g_new with size zero should return NULL.");
-
- p = g_new0 (int, 0);
- if (p)
- return FAILED ("Calling g_new0 with size zero should return NULL.");
-
- return OK;
-}
-
-
-static Test memory_tests [] = {
- { "zero_size_allocations", test_memory_zero_size_allocations},
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(memory_tests_init, memory_tests)
-
+++ /dev/null
-#include <config.h>
-#include <glib.h>
-#include <gmodule.h>
-#include <string.h>
-#include <stdio.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include "test.h"
-
-#if defined (G_OS_WIN32)
-#define EXTERNAL_SYMBOL "GetProcAddress"
-#else
-#define EXTERNAL_SYMBOL "system"
-#endif
-
-void G_MODULE_EXPORT
-dummy_test_export ()
-{
-}
-
-/* test for g_module_open (NULL, ...) */
-RESULT
-test_module_symbol_null ()
-{
- gpointer proc = GINT_TO_POINTER (42);
-
- GModule *m = g_module_open (NULL, G_MODULE_BIND_LAZY);
-
- if (m == NULL)
- return FAILED ("bind to main module failed. #0");
-
- if (g_module_symbol (m, "__unlikely_\nexistent__", &proc))
- return FAILED ("non-existent symbol lookup failed. #1");
-
- if (proc)
- return FAILED ("non-existent symbol lookup failed. #2");
-
- if (!g_module_symbol (m, EXTERNAL_SYMBOL, &proc))
- return FAILED ("external lookup failed. #3");
-
- if (!proc)
- return FAILED ("external lookup failed. #4");
-
- if (!g_module_symbol (m, "dummy_test_export", &proc))
- return FAILED ("in-proc lookup failed. #5");
-
- if (!proc)
- return FAILED ("in-proc lookup failed. #6");
-
- if (!g_module_close (m))
- return FAILED ("close failed. #7");
-
- return OK;
-}
-
-static Test module_tests [] = {
- {"g_module_symbol_null", test_module_symbol_null},
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(module_tests_init, module_tests)
-
-
+++ /dev/null
-#include <config.h>
-#include <glib.h>
-#include <string.h>
-#include <stdio.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef G_OS_UNIX
-#include <pthread.h>
-#endif
-#include "test.h"
-
-#ifdef G_OS_WIN32
-#include <direct.h>
-#define chdir _chdir
-#endif
-
-/* This test is just to be used with valgrind */
-RESULT
-test_buildpath ()
-{
- char *s;
- char *buffer = "var/private";
- char *dir = "/";
-
- s = g_build_path ("/", "hola///", "//mundo", NULL);
- if (strcmp (s, "hola/mundo") != 0)
- return FAILED ("1 Got wrong result, got: %s", s);
- g_free (s);
-
- s = g_build_path ("/", "hola/", "/mundo", NULL);
- if (strcmp (s, "hola/mundo") != 0)
- return FAILED ("2 Got wrong result, got: %s", s);
- g_free (s);
-
- s = g_build_path ("/", "hola/", "mundo", NULL);
- if (strcmp (s, "hola/mundo") != 0)
- return FAILED ("3 Got wrong result, got: %s", s);
- g_free (s);
-
- s = g_build_path ("/", "hola", "/mundo", NULL);
- if (strcmp (s, "hola/mundo") != 0)
- return FAILED ("4 Got wrong result, got: %s", s);
- g_free (s);
-
- s = g_build_path ("/", "/hello", "world/", NULL);
- if (strcmp (s, "/hello/world/") != 0)
- return FAILED ("5 Got wrong result, got: %s", s);
- g_free (s);
-
- /* Now test multi-char-separators */
- s = g_build_path ("**", "hello", "world", NULL);
- if (strcmp (s, "hello**world") != 0)
- return FAILED ("6 Got wrong result, got: %s", s);
- g_free (s);
-
- s = g_build_path ("**", "hello**", "world", NULL);
- if (strcmp (s, "hello**world") != 0)
- return FAILED ("7 Got wrong result, got: %s", s);
- g_free (s);
-
- s = g_build_path ("**", "hello**", "**world", NULL);
- if (strcmp (s, "hello**world") != 0)
- return FAILED ("8 Got wrong result, got: %s", s);
- g_free (s);
-
- s = g_build_path ("**", "hello**", "**world", NULL);
- if (strcmp (s, "hello**world") != 0)
- return FAILED ("9 Got wrong result, got: %s", s);
- g_free (s);
-
- s = g_build_path ("1234567890", "hello", "world", NULL);
- if (strcmp (s, "hello1234567890world") != 0)
- return FAILED ("10 Got wrong result, got: %s", s);
- g_free (s);
-
- s = g_build_path ("1234567890", "hello1234567890", "1234567890world", NULL);
- if (strcmp (s, "hello1234567890world") != 0)
- return FAILED ("11 Got wrong result, got: %s", s);
- g_free (s);
-
- s = g_build_path ("1234567890", "hello12345678901234567890", "1234567890world", NULL);
- if (strcmp (s, "hello1234567890world") != 0)
- return FAILED ("12 Got wrong result, got: %s", s);
- g_free (s);
-
- /* Multiple */
- s = g_build_path ("/", "a", "b", "c", "d", NULL);
- if (strcmp (s, "a/b/c/d") != 0)
- return FAILED ("13 Got wrong result, got: %s", s);
- g_free (s);
-
- s = g_build_path ("/", "/a", "", "/c/", NULL);
- if (strcmp (s, "/a/c/") != 0)
- return FAILED ("14 Got wrong result, got: %s", s);
- g_free (s);
-
- /* Null */
- s = g_build_path ("/", NULL, NULL);
- if (s == NULL)
- return FAILED ("must get a non-NULL return");
- if (s [0] != 0)
- return FAILED ("must get an empty string");
-
- // This is to test the regression introduced by Levi for the Windows support
- // that code errouneously read below the allowed area (in this case dir [-1]).
- // and caused all kinds of random errors.
- dir = "//";
- dir++;
- s = g_build_filename (dir, buffer, NULL);
- if (s [0] != '/')
- return FAILED ("Must have a '/' at the start");
-
- g_free (s);
- return OK;
-}
-
-RESULT
-test_buildfname ()
-{
- char *s;
-
- s = g_build_filename ("a", "b", "c", "d", NULL);
-#ifdef G_OS_WIN32
- if (strcmp (s, "a\\b\\c\\d") != 0)
-#else
- if (strcmp (s, "a/b/c/d") != 0)
-#endif
- return FAILED ("1 Got wrong result, got: %s", s);
- g_free (s);
-
-#ifdef G_OS_WIN32
- s = g_build_filename ("C:\\", "a", NULL);
- if (strcmp (s, "C:\\a") != 0)
-#else
- s = g_build_filename ("/", "a", NULL);
- if (strcmp (s, "/a") != 0)
-#endif
- return FAILED ("1 Got wrong result, got: %s", s);
-
-#ifndef G_OS_WIN32
- s = g_build_filename ("/", "foo", "/bar", "tolo/", "/meo/", NULL);
- if (strcmp (s, "/foo/bar/tolo/meo/") != 0)
- return FAILED ("1 Got wrong result, got: %s", s);
-#endif
-
- return OK;
-}
-
-char *
-test_dirname ()
-{
- char *s;
-
-#ifdef G_OS_WIN32
- s = g_path_get_dirname ("c:\\home\\miguel");
- if (strcmp (s, "c:\\home") != 0)
- return FAILED ("Expected c:\\home, got %s", s);
- g_free (s);
-
- s = g_path_get_dirname ("c:/home/miguel");
- if (strcmp (s, "c:/home") != 0)
- return FAILED ("Expected c:/home, got %s", s);
- g_free (s);
-
- s = g_path_get_dirname ("c:\\home\\dingus\\");
- if (strcmp (s, "c:\\home\\dingus") != 0)
- return FAILED ("Expected c:\\home\\dingus, got %s", s);
- g_free (s);
-
- s = g_path_get_dirname ("dir.c");
- if (strcmp (s, ".") != 0)
- return FAILED ("Expected `.', got %s", s);
- g_free (s);
-
- s = g_path_get_dirname ("c:\\index.html");
- if (strcmp (s, "c:") != 0)
- return FAILED ("Expected [c:], got [%s]", s);
-#else
- s = g_path_get_dirname ("/home/miguel");
- if (strcmp (s, "/home") != 0)
- return FAILED ("Expected /home, got %s", s);
- g_free (s);
-
- s = g_path_get_dirname ("/home/dingus/");
- if (strcmp (s, "/home/dingus") != 0)
- return FAILED ("Expected /home/dingus, got %s", s);
- g_free (s);
-
- s = g_path_get_dirname ("dir.c");
- if (strcmp (s, ".") != 0)
- return FAILED ("Expected `.', got %s", s);
- g_free (s);
-
- s = g_path_get_dirname ("/index.html");
- if (strcmp (s, "/") != 0)
- return FAILED ("Expected [/], got [%s]", s);
-#endif
- return OK;
-}
-
-char *
-test_basename ()
-{
- char *s;
-
-#ifdef G_OS_WIN32
- s = g_path_get_basename ("");
- if (strcmp (s, ".") != 0)
- return FAILED ("Expected `.', got %s", s);
- g_free (s);
-
- s = g_path_get_basename ("c:\\home\\dingus\\");
- if (strcmp (s, "dingus") != 0)
- return FAILED ("1 Expected dingus, got %s", s);
- g_free (s);
-
- s = g_path_get_basename ("c:/home/dingus/");
- if (strcmp (s, "dingus") != 0)
- return FAILED ("1 Expected dingus, got %s", s);
- g_free (s);
-
- s = g_path_get_basename ("c:\\home\\dingus");
- if (strcmp (s, "dingus") != 0)
- return FAILED ("2 Expected dingus, got %s", s);
- g_free (s);
-
- s = g_path_get_basename ("c:/home/dingus");
- if (strcmp (s, "dingus") != 0)
- return FAILED ("2 Expected dingus, got %s", s);
- g_free (s);
-#else
- s = g_path_get_basename ("");
- if (strcmp (s, ".") != 0)
- return FAILED ("Expected `.', got %s", s);
- g_free (s);
-
- s = g_path_get_basename ("/home/dingus/");
- if (strcmp (s, "dingus") != 0)
- return FAILED ("1 Expected dingus, got %s", s);
- g_free (s);
-
- s = g_path_get_basename ("/home/dingus");
- if (strcmp (s, "dingus") != 0)
- return FAILED ("2 Expected dingus, got %s", s);
- g_free (s);
-#endif
- return OK;
-}
-
-gchar *
-test_ppath ()
-{
- char *s;
-#ifdef G_OS_WIN32
- const gchar *searchfor = "explorer.exe";
-#else
- const gchar *searchfor = "ls";
-#endif
- s = g_find_program_in_path (searchfor);
- if (s == NULL)
- return FAILED ("No %s on this system?", searchfor);
- g_free (s);
- return OK;
-}
-
-gchar *
-test_ppath2 ()
-{
- char *s;
- const char *path = g_getenv ("PATH");
-#ifdef G_OS_WIN32
- const gchar *searchfor = "test_eglib.exe";
-#else
- const gchar *searchfor = "test-glib";
-#endif
-
- g_setenv ("PATH", "", TRUE);
- s = g_find_program_in_path ("ls");
- if (s != NULL) {
- g_setenv ("PATH", path, TRUE);
- return FAILED ("Found something interesting here: %s", s);
- }
- g_free (s);
- s = g_find_program_in_path (searchfor);
- if (s == NULL) {
- g_setenv ("PATH", path, TRUE);
- return FAILED ("It should find '%s' in the current directory.", searchfor);
- }
- g_free (s);
- g_setenv ("PATH", path, TRUE);
- return OK;
-}
-
-#ifndef DISABLE_FILESYSTEM_TESTS
-gchar *
-test_cwd ()
-{
- char *dir = g_get_current_dir ();
-#ifdef G_OS_WIN32
- const gchar *newdir = "C:\\Windows";
-#else
- const gchar *newdir = "/bin";
-#endif
-
- if (dir == NULL)
- return FAILED ("No current directory?");
- g_free (dir);
-
- if (chdir (newdir) == -1)
- return FAILED ("No %s?", newdir);
-
- dir = g_get_current_dir ();
- if (strcmp (dir, newdir) != 0)
- return FAILED("Did not go to %s?", newdir);
- g_free (dir);
-
- return OK;
-}
-#else
-gchar *
-test_cwd ()
-{
- return OK;
-}
-#endif
-
-gchar *
-test_misc ()
-{
- const char *home = g_get_home_dir ();
- const char *tmp = g_get_tmp_dir ();
-
- if (home == NULL)
- return FAILED ("Where did my home go?");
-
- if (tmp == NULL)
- return FAILED ("Where did my /tmp go?");
-
- return OK;
-}
-
-static Test path_tests [] = {
- {"g_build_filename", test_buildfname},
- {"g_buildpath", test_buildpath},
- {"g_path_get_dirname", test_dirname},
- {"g_path_get_basename", test_basename},
- {"g_find_program_in_path", test_ppath},
- {"g_find_program_in_path2", test_ppath2},
- {"test_cwd", test_cwd },
- {"test_misc", test_misc },
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(path_tests_init, path_tests)
-
-
+++ /dev/null
-#include <config.h>
-#include <glib.h>
-#include <string.h>
-#include <stdlib.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <stdio.h>
-#include "test.h"
-
-#define MATCH(pat,string,error_if,msg) \
- spec = g_pattern_spec_new (pat); \
- res = g_pattern_match_string (spec, string); \
- if (res == error_if) \
- return FAILED (msg " returned %s", res ? "TRUE" : "FALSE"); \
- g_pattern_spec_free (spec);
-
-#define TEST_MATCH(pat,string,n) MATCH (pat, string, FALSE, "MATCH " #n)
-#define TEST_NO_MATCH(pat,string,n) MATCH (pat, string,TRUE, "NO_MATCH " #n)
-
-RESULT
-test_pattern_spec ()
-{
- GPatternSpec *spec;
- gboolean res;
-
- /* spec = g_pattern_spec_new (NULL); */
- TEST_MATCH ("*", "hola", 1);
- TEST_MATCH ("hola", "hola", 2);
- TEST_MATCH ("????", "hola", 3);
- TEST_MATCH ("???a", "hola", 4);
- TEST_MATCH ("h??a", "hola", 5);
- TEST_MATCH ("h??*", "hola", 6);
- TEST_MATCH ("h*", "hola", 7);
- TEST_MATCH ("*hola", "hola", 8);
- TEST_MATCH ("*l*", "hola", 9);
- TEST_MATCH ("h*??", "hola", 10);
- TEST_MATCH ("h*???", "hola", 11);
- TEST_MATCH ("?o??", "hola", 12);
- TEST_MATCH ("*h*o*l*a*", "hola", 13);
- TEST_MATCH ("h*o*l*a", "hola", 14);
- TEST_MATCH ("h?*?", "hola", 15);
-
- TEST_NO_MATCH ("", "hola", 1);
- TEST_NO_MATCH ("?????", "hola", 2);
- TEST_NO_MATCH ("???", "hola", 3);
- TEST_NO_MATCH ("*o", "hola", 4);
- TEST_NO_MATCH ("h", "hola", 5);
- TEST_NO_MATCH ("h*????", "hola", 6);
-
- return OK;
-}
-
-static Test pattern_tests [] = {
- {"g_pattern_spec*", test_pattern_spec},
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(pattern_tests_init, pattern_tests)
-
-
+++ /dev/null
-#include <stdio.h>
-#include <glib.h>
-#include "test.h"
-
-/* Redefine the private structure only to verify proper allocations */
-typedef struct _GPtrArrayPriv {
- gpointer *pdata;
- guint len;
- guint size;
-} GPtrArrayPriv;
-
-/* Don't add more than 32 items to this please */
-static const char *items [] = {
- "Apples", "Oranges", "Plumbs", "Goats", "Snorps", "Grapes",
- "Tickle", "Place", "Coffee", "Cookies", "Cake", "Cheese",
- "Tseng", "Holiday", "Avenue", "Smashing", "Water", "Toilet",
- NULL
-};
-
-static GPtrArray *ptrarray_alloc_and_fill(guint *item_count)
-{
- GPtrArray *array = g_ptr_array_new();
- gint i;
-
- for(i = 0; items[i] != NULL; i++) {
- g_ptr_array_add(array, (gpointer)items[i]);
- }
-
- if(item_count != NULL) {
- *item_count = i;
- }
-
- return array;
-}
-
-static guint guess_size(guint length)
-{
- guint size = 1;
-
- while(size < length) {
- size <<= 1;
- }
-
- return size;
-}
-
-RESULT ptrarray_alloc()
-{
- GPtrArrayPriv *array;
- guint i;
-
- array = (GPtrArrayPriv *)ptrarray_alloc_and_fill(&i);
-
- if(array->size != guess_size(array->len)) {
- return FAILED("Size should be %d, but it is %d",
- guess_size(array->len), array->size);
- }
-
- if(array->len != i) {
- return FAILED("Expected %d node(s) in the array", i);
- }
-
- g_ptr_array_free((GPtrArray *)array, TRUE);
-
- return OK;
-}
-
-RESULT ptrarray_for_iterate()
-{
- GPtrArray *array = ptrarray_alloc_and_fill(NULL);
- guint i;
-
- for(i = 0; i < array->len; i++) {
- char *item = (char *)g_ptr_array_index(array, i);
- if(item != items[i]) {
- return FAILED(
- "Expected item at %d to be %s, but it was %s",
- i, items[i], item);
- }
- }
-
- g_ptr_array_free(array, TRUE);
-
- return OK;
-}
-
-static gint foreach_iterate_index = 0;
-static char *foreach_iterate_error = NULL;
-
-void foreach_callback(gpointer data, gpointer user_data)
-{
- char *item = (char *)data;
- const char *item_cmp = items[foreach_iterate_index++];
-
- if(foreach_iterate_error != NULL) {
- return;
- }
-
- if(item != item_cmp) {
- foreach_iterate_error = FAILED(
- "Expected item at %d to be %s, but it was %s",
- foreach_iterate_index - 1, item_cmp, item);
- }
-}
-
-RESULT ptrarray_foreach_iterate()
-{
- GPtrArray *array = ptrarray_alloc_and_fill(NULL);
-
- foreach_iterate_index = 0;
- foreach_iterate_error = NULL;
-
- g_ptr_array_foreach(array, foreach_callback, array);
-
- g_ptr_array_free(array, TRUE);
-
- return foreach_iterate_error;
-}
-
-RESULT ptrarray_set_size()
-{
- GPtrArray *array = g_ptr_array_new();
- guint i, grow_length = 50;
-
- g_ptr_array_add(array, (gpointer)items[0]);
- g_ptr_array_add(array, (gpointer)items[1]);
- g_ptr_array_set_size(array, grow_length);
-
- if(array->len != grow_length) {
- return FAILED("Array length should be 50, it is %d", array->len);
- } else if(array->pdata[0] != items[0]) {
- return FAILED("Item 0 was overwritten, should be %s", items[0]);
- } else if(array->pdata[1] != items[1]) {
- return FAILED("Item 1 was overwritten, should be %s", items[1]);
- }
-
- for(i = 2; i < array->len; i++) {
- if(array->pdata[i] != NULL) {
- return FAILED("Item %d is not NULL, it is %p", i, array->pdata[i]);
- }
- }
-
- g_ptr_array_free(array, TRUE);
-
- return OK;
-}
-
-RESULT ptrarray_remove_index()
-{
- GPtrArray *array;
- guint i;
-
- array = ptrarray_alloc_and_fill(&i);
-
- g_ptr_array_remove_index(array, 0);
- if(array->pdata[0] != items[1]) {
- return FAILED("First item is not %s, it is %s", items[1],
- array->pdata[0]);
- }
-
- g_ptr_array_remove_index(array, array->len - 1);
-
- if(array->pdata[array->len - 1] != items[array->len]) {
- return FAILED("Last item is not %s, it is %s",
- items[array->len - 2], array->pdata[array->len - 1]);
- }
-
- g_ptr_array_free(array, TRUE);
-
- return OK;
-}
-
-RESULT ptrarray_remove_index_fast()
-{
- GPtrArray *array;
- guint i;
-
- array = ptrarray_alloc_and_fill(&i);
-
- g_ptr_array_remove_index_fast(array, 0);
- if(array->pdata[0] != items[array->len]) {
- return FAILED("First item is not %s, it is %s", items[array->len],
- array->pdata[0]);
- }
-
- g_ptr_array_remove_index_fast(array, array->len - 1);
- if(array->pdata[array->len - 1] != items[array->len - 1]) {
- return FAILED("Last item is not %s, it is %s",
- items[array->len - 1], array->pdata[array->len - 1]);
- }
-
- g_ptr_array_free(array, TRUE);
-
- return OK;
-}
-
-RESULT ptrarray_remove()
-{
- GPtrArray *array;
- guint i;
-
- array = ptrarray_alloc_and_fill(&i);
-
- g_ptr_array_remove(array, (gpointer)items[7]);
-
- if(!g_ptr_array_remove(array, (gpointer)items[4])) {
- return FAILED("Item %s not removed", items[4]);
- }
-
- if(g_ptr_array_remove(array, (gpointer)items[4])) {
- return FAILED("Item %s still in array after removal", items[4]);
- }
-
- if(array->pdata[array->len - 1] != items[array->len + 1]) {
- return FAILED("Last item in GPtrArray not correct");
- }
-
- g_ptr_array_free(array, TRUE);
-
- return OK;
-}
-
-static gint ptrarray_sort_compare(gconstpointer a, gconstpointer b)
-{
- gchar *stra = *(gchar **) a;
- gchar *strb = *(gchar **) b;
- return strcmp(stra, strb);
-}
-
-RESULT ptrarray_sort()
-{
- GPtrArray *array = g_ptr_array_new();
- guint i;
- gchar *letters [] = { "A", "B", "C", "D", "E" };
-
- g_ptr_array_add(array, letters[0]);
- g_ptr_array_add(array, letters[1]);
- g_ptr_array_add(array, letters[2]);
- g_ptr_array_add(array, letters[3]);
- g_ptr_array_add(array, letters[4]);
-
- g_ptr_array_sort(array, ptrarray_sort_compare);
-
- for(i = 0; i < array->len; i++) {
- if(array->pdata[i] != letters[i]) {
- return FAILED("Array out of order, expected %s got %s at position %d",
- letters [i], (gchar *) array->pdata [i], i);
- }
- }
-
- g_ptr_array_free(array, TRUE);
-
- return OK;
-}
-
-static gint ptrarray_sort_compare_with_data (gconstpointer a, gconstpointer b, gpointer user_data)
-{
- gchar *stra = *(gchar **) a;
- gchar *strb = *(gchar **) b;
-
- if (strcmp (user_data, "this is the data for qsort") != 0)
- fprintf (stderr, "oops at compare with_data\n");
-
- return strcmp(stra, strb);
-}
-
-RESULT ptrarray_sort_with_data ()
-{
- GPtrArray *array = g_ptr_array_new();
- guint i;
- gchar *letters [] = { "A", "B", "C", "D", "E" };
-
- g_ptr_array_add(array, letters[4]);
- g_ptr_array_add(array, letters[1]);
- g_ptr_array_add(array, letters[2]);
- g_ptr_array_add(array, letters[0]);
- g_ptr_array_add(array, letters[3]);
-
- g_ptr_array_sort_with_data(array, ptrarray_sort_compare_with_data, "this is the data for qsort");
-
- for(i = 0; i < array->len; i++) {
- if(array->pdata[i] != letters[i]) {
- return FAILED("Array out of order, expected %s got %s at position %d",
- letters [i], (gchar *) array->pdata [i], i);
- }
- }
-
- g_ptr_array_free(array, TRUE);
-
- return OK;
-}
-
-RESULT ptrarray_remove_fast()
-{
- GPtrArray *array = g_ptr_array_new();
- gchar *letters [] = { "A", "B", "C", "D", "E" };
-
- if (g_ptr_array_remove_fast (array, NULL))
- return FAILED ("Removing NULL succeeded");
-
- g_ptr_array_add(array, letters[0]);
- if (!g_ptr_array_remove_fast (array, letters[0]) || array->len != 0)
- return FAILED ("Removing last element failed");
-
- g_ptr_array_add(array, letters[0]);
- g_ptr_array_add(array, letters[1]);
- g_ptr_array_add(array, letters[2]);
- g_ptr_array_add(array, letters[3]);
- g_ptr_array_add(array, letters[4]);
-
- if (!g_ptr_array_remove_fast (array, letters[0]) || array->len != 4)
- return FAILED ("Removing first element failed");
-
- if (array->pdata [0] != letters [4])
- return FAILED ("First element wasn't replaced with last upon removal");
-
- if (g_ptr_array_remove_fast (array, letters[0]))
- return FAILED ("Succedeed removing a non-existing element");
-
- if (!g_ptr_array_remove_fast (array, letters[3]) || array->len != 3)
- return FAILED ("Failed removing \"D\"");
-
- if (!g_ptr_array_remove_fast (array, letters[1]) || array->len != 2)
- return FAILED ("Failed removing \"B\"");
-
- if (array->pdata [0] != letters [4] || array->pdata [1] != letters [2])
- return FAILED ("Last two elements are wrong");
- g_ptr_array_free(array, TRUE);
-
- return OK;
-}
-
-static Test ptrarray_tests [] = {
- {"alloc", ptrarray_alloc},
- {"for_iterate", ptrarray_for_iterate},
- {"foreach_iterate", ptrarray_foreach_iterate},
- {"set_size", ptrarray_set_size},
- {"remove_index", ptrarray_remove_index},
- {"remove_index_fast", ptrarray_remove_index_fast},
- {"remove", ptrarray_remove},
- {"sort", ptrarray_sort},
- {"remove_fast", ptrarray_remove_fast},
- {"sort_with_data", ptrarray_sort_with_data},
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(ptrarray_tests_init, ptrarray_tests)
-
-
+++ /dev/null
-#include <stdio.h>
-#include <string.h>
-#include <glib.h>
-#include "test.h"
-
-RESULT
-test_queue_push ()
-{
- GQueue *queue = g_queue_new ();
-
- g_queue_push_head (queue, "foo");
- g_queue_push_head (queue, "bar");
- g_queue_push_head (queue, "baz");
-
- if (queue->length != 3)
- return FAILED ("push failed");
-
- if (NULL != queue->head->prev)
- return FAILED ("HEAD: prev is wrong");
- if (strcmp ("baz", queue->head->data))
- return FAILED ("HEAD: First element is wrong");
- if (strcmp ("bar", queue->head->next->data))
- return FAILED ("HEAD: Second element is wrong");
- if (strcmp ("foo", queue->head->next->next->data))
- return FAILED ("HEAD: Third element is wrong");
- if (NULL != queue->head->next->next->next)
- return FAILED ("HEAD: End is wrong");
-
- if (NULL != queue->tail->next)
- return FAILED ("TAIL: next is wrong");
- if (strcmp ("foo", queue->tail->data))
- return FAILED ("TAIL: Third element is wrong");
- if (strcmp ("bar", queue->tail->prev->data))
- return FAILED ("TAIL: Second element is wrong");
- if (strcmp ("baz", queue->tail->prev->prev->data))
- return FAILED ("TAIL: First element is wrong");
- if (NULL != queue->tail->prev->prev->prev)
- return FAILED ("TAIL: End is wrong");
-
- g_queue_free (queue);
- return OK;
-}
-
-RESULT
-test_queue_push_tail ()
-{
- GQueue *queue = g_queue_new ();
-
- g_queue_push_tail (queue, "baz");
- g_queue_push_tail (queue, "bar");
- g_queue_push_tail (queue, "foo");
-
- if (queue->length != 3)
- return FAILED ("push failed");
-
- if (NULL != queue->head->prev)
- return FAILED ("HEAD: prev is wrong");
- if (strcmp ("baz", queue->head->data))
- return FAILED ("HEAD: First element is wrong");
- if (strcmp ("bar", queue->head->next->data))
- return FAILED ("HEAD: Second element is wrong");
- if (strcmp ("foo", queue->head->next->next->data))
- return FAILED ("HEAD: Third element is wrong");
- if (NULL != queue->head->next->next->next)
- return FAILED ("HEAD: End is wrong");
-
- if (NULL != queue->tail->next)
- return FAILED ("TAIL: next is wrong");
- if (strcmp ("foo", queue->tail->data))
- return FAILED ("TAIL: Third element is wrong");
- if (strcmp ("bar", queue->tail->prev->data))
- return FAILED ("TAIL: Second element is wrong");
- if (strcmp ("baz", queue->tail->prev->prev->data))
- return FAILED ("TAIL: First element is wrong");
- if (NULL != queue->tail->prev->prev->prev)
- return FAILED ("TAIL: End is wrong");
-
- g_queue_free (queue);
- return OK;
-}
-
-RESULT
-test_queue_pop ()
-{
- GQueue *queue = g_queue_new ();
- gpointer data;
-
- g_queue_push_head (queue, "foo");
- g_queue_push_head (queue, "bar");
- g_queue_push_head (queue, "baz");
-
- data = g_queue_pop_head (queue);
- if (strcmp ("baz", data))
- return FAILED ("expect baz.");
-
- data = g_queue_pop_head (queue);
- if (strcmp ("bar", data))
- return FAILED ("expect bar.");
-
- data = g_queue_pop_head (queue);
- if (strcmp ("foo", data))
- return FAILED ("expect foo.");
-
- if (g_queue_is_empty (queue) == FALSE)
- return FAILED ("expect is_empty.");
-
- if (queue->length != 0)
- return FAILED ("expect 0 length .");
-
- g_queue_push_head (queue, "foo");
- g_queue_push_head (queue, "bar");
- g_queue_push_head (queue, "baz");
-
- g_queue_pop_head (queue);
-
- if (NULL != queue->head->prev)
- return FAILED ("HEAD: prev is wrong");
- if (strcmp ("bar", queue->head->data))
- return FAILED ("HEAD: Second element is wrong");
- if (strcmp ("foo", queue->head->next->data))
- return FAILED ("HEAD: Third element is wrong");
- if (NULL != queue->head->next->next)
- return FAILED ("HEAD: End is wrong");
-
- if (NULL != queue->tail->next)
- return FAILED ("TAIL: next is wrong");
- if (strcmp ("foo", queue->tail->data))
- return FAILED ("TAIL: Second element is wrong");
- if (strcmp ("bar", queue->tail->prev->data))
- return FAILED ("TAIL: First element is wrong");
- if (NULL != queue->tail->prev->prev)
- return FAILED ("TAIL: End is wrong");
-
- g_queue_free (queue);
- return OK;
-}
-
-RESULT
-test_queue_new ()
-{
- GQueue *queue = g_queue_new ();
-
- if (queue->length != 0)
- return FAILED ("expect length == 0");
-
- if (queue->head != NULL)
- return FAILED ("expect head == NULL");
-
- if (queue->tail != NULL)
- return FAILED ("expect tail == NULL");
-
- g_queue_free (queue);
- return OK;
-}
-
-RESULT
-test_queue_is_empty ()
-{
- GQueue *queue = g_queue_new ();
-
- if (g_queue_is_empty (queue) == FALSE)
- return FAILED ("new queue should be empty");
-
- g_queue_push_head (queue, "foo");
-
- if (g_queue_is_empty (queue) == TRUE)
- return FAILED ("expected TRUE");
-
- g_queue_free (queue);
-
- return OK;
-}
-
-static Test queue_tests [] = {
- { "push", test_queue_push},
- {"push_tail", test_queue_push_tail},
- { "pop", test_queue_pop},
- { "new", test_queue_new},
- {"is_empty", test_queue_is_empty},
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(queue_tests_init, queue_tests)
-
+++ /dev/null
-#include <glib.h>
-#include <string.h>
-#include <stdio.h>
-#include "test.h"
-
-RESULT
-test_shell_argv1 ()
-{
- GError *error;
- gint argc;
- gchar **argv;
- gboolean ret;
-
- /* The next line prints a critical error and returns FALSE
- ret = g_shell_parse_argv (NULL, NULL, NULL, NULL);
- */
- ret = g_shell_parse_argv ("", NULL, NULL, NULL);
- if (ret)
- return FAILED ("1. It should return FALSE");
-
- ret = g_shell_parse_argv ("hola", NULL, NULL, NULL);
- if (!ret)
- return FAILED ("2. It should return TRUE");
-
- argc = 0;
- ret = g_shell_parse_argv ("hola", &argc, NULL, NULL);
- if (!ret)
- return FAILED ("3. It should return TRUE");
- if (argc != 1)
- return FAILED ("4. argc was %d", argc);
-
- argc = 0;
- ret = g_shell_parse_argv ("hola bola", &argc, NULL, NULL);
- if (!ret)
- return FAILED ("5. It should return TRUE");
- if (argc != 2)
- return FAILED ("6. argc was %d", argc);
-
- argc = 0;
- ret = g_shell_parse_argv ("hola bola", &argc, &argv, NULL);
- if (!ret)
- return FAILED ("7. It should return TRUE");
- if (argc != 2)
- return FAILED ("8. argc was %d", argc);
- if (strcmp (argv [0], "hola"))
- return FAILED ("9. argv[0] was %s", argv [0]);
- if (strcmp (argv [1], "bola"))
- return FAILED ("10. argv[1] was %s", argv [1]);
-
- g_strfreev (argv);
- argv = NULL;
- argc = 0;
- error = NULL;
- ret = g_shell_parse_argv ("hola 'bola'", &argc, &argv, &error);
- if (!ret)
- return FAILED ("11. It should return TRUE");
- if (argc != 2)
- return FAILED ("12. argc was %d expected 2", argc);
- if (strcmp (argv [0], "hola"))
- return FAILED ("13. argv[0] was %s", argv [0]);
- if (strcmp (argv [1], "bola"))
- return FAILED ("14. argv[1] was %s", argv [1]);
- if (error != NULL)
- return FAILED ("15. error is not null");
-
-
- g_strfreev (argv);
- argv = NULL;
- argc = 0;
- error = NULL;
- ret = g_shell_parse_argv ("hola '' 'bola'", &argc, &argv, &error);
- if (!ret)
- return FAILED ("16. It should return TRUE");
- if (argc != 3)
- return FAILED ("17. argc was %d expected 3", argc);
- if (strcmp (argv [0], "hola"))
- return FAILED ("18. argv[0] was %s", argv [0]);
- if (strcmp (argv [1], ""))
- return FAILED ("19. argv[2] was %s", argv [1]);
- if (strcmp (argv [2], "bola"))
- return FAILED ("19. argv[2] was %s", argv [2]);
- if (error != NULL)
- return FAILED ("20. error is not null");
-
- g_strfreev (argv);
- argv = NULL;
- argc = 0;
- error = NULL;
- ret = g_shell_parse_argv ("hola'' bola", &argc, &argv, &error);
- if (!ret)
- return FAILED ("21. It should return TRUE");
- if (argc != 2)
- return FAILED ("22. argc was %d expected 2", argc);
- if (strcmp (argv [0], "hola"))
- return FAILED ("23. argv[0] was %s", argv [0]);
- if (strcmp (argv [1], "bola"))
- return FAILED ("24. argv[2] was %s", argv [1]);
- if (error != NULL)
- return FAILED ("25. error is not null");
-
- return OK;
-}
-
-RESULT
-test_shell_argv2 ()
-{
- GError *error;
- gint argc;
- gchar **argv;
- gboolean ret;
-
- argv = NULL;
- argc = 0;
- error = NULL;
- ret = g_shell_parse_argv ("hola \"bola\"", &argc, &argv, &error);
- if (!ret)
- return FAILED ("1. It should return TRUE");
- if (argc != 2)
- return FAILED ("2. argc was %d expected 2", argc);
- if (strcmp (argv [0], "hola"))
- return FAILED ("3. argv[0] was %s", argv [0]);
- if (strcmp (argv [1], "bola"))
- return FAILED ("4. argv[1] was %s", argv [1]);
- if (error != NULL)
- return FAILED ("5. error is not null");
-
- g_strfreev (argv);
- argv = NULL;
- argc = 0;
- error = NULL;
- ret = g_shell_parse_argv ("hola \"\" \"bola \"", &argc, &argv, &error);
- if (!ret)
- return FAILED ("6. It should return TRUE");
- if (argc != 3)
- return FAILED ("7. argc was %d expected 3", argc);
- if (strcmp (argv [0], "hola"))
- return FAILED ("8. argv[0] was %s", argv [0]);
- if (strcmp (argv [1], ""))
- return FAILED ("9. argv[2] was %s", argv [1]);
- if (strcmp (argv [2], "bola "))
- return FAILED ("10. argv[2] was %s", argv [2]);
- if (error != NULL)
- return FAILED ("11. error is not null");
-
- g_strfreev (argv);
- argv = NULL;
- argc = 0;
- error = NULL;
- ret = g_shell_parse_argv ("hola\n\t \"\t\" \"bola \"", &argc, &argv, &error);
- if (!ret)
- return FAILED ("10. It should return TRUE");
- if (argc != 3)
- return FAILED ("11. argc was %d expected 3", argc);
- if (strcmp (argv [0], "hola"))
- return FAILED ("12. argv[0] was %s", argv [0]);
- if (strcmp (argv [1], "\t"))
- return FAILED ("13. argv[2] was %s", argv [1]);
- if (strcmp (argv [2], "bola "))
- return FAILED ("14. argv[2] was %s", argv [2]);
- if (error != NULL)
- return FAILED ("15. error is not null");
-
- g_strfreev (argv);
- argv = NULL;
- argc = 0;
- error = NULL;
- ret = g_shell_parse_argv ("hola\n\t \\\n \"\t\" \"bola \"", &argc, &argv, &error);
- if (!ret)
- return FAILED ("16. It should return TRUE");
- if (argc != 3)
- return FAILED ("17. argc was %d expected 3", argc);
- if (strcmp (argv [0], "hola"))
- return FAILED ("18. argv[0] was %s", argv [0]);
- if (strcmp (argv [1], "\t"))
- return FAILED ("19. argv[2] was %s", argv [1]);
- if (strcmp (argv [2], "bola "))
- return FAILED ("20. argv[2] was %s", argv [2]);
- if (error != NULL)
- return FAILED ("21. error is not null");
-
- g_strfreev (argv);
- return OK;
-}
-
-RESULT
-test_shell_argv3 ()
-{
- GError *error;
- gint argc;
- gchar **argv;
- gboolean ret;
-
- argv = NULL;
- argc = 0;
- error = NULL;
- ret = g_shell_parse_argv ("hola \"bola", &argc, &argv, &error);
- if (ret)
- return FAILED ("1. It should return FALSE");
- if (argc != 0)
- return FAILED ("2. argc was %d expected 0", argc);
- if (argv != NULL)
- return FAILED ("3. argv[0] was %s", argv [0]);
- if (error == NULL)
- return FAILED ("4. error is null");
-
- /* Text ended before matching quote was found for ". (The text was 'hola "bola') */
- g_error_free (error);
- error = NULL;
- ret = g_shell_parse_argv ("hola \\\"bola", &argc, &argv, &error);
- if (!ret)
- return FAILED ("5. It should return TRUE");
- if (argc != 2)
- return FAILED ("6. argc was %d expected 2", argc);
- if (strcmp (argv [0], "hola"))
- return FAILED ("18. argv[0] was %s", argv [0]);
- if (strcmp (argv [1], "\"bola"))
- return FAILED ("18. argv[1] was %s", argv [1]);
- if (error != NULL)
- return FAILED ("8. error is not null");
-
- g_strfreev (argv);
- argv = NULL;
- argc = 0;
- ret = g_shell_parse_argv ("hola \"\n\\'bola\"", &argc, &argv, &error);
- if (!ret)
- return FAILED ("9. It should return TRUE. %s", error->message);
- if (argc != 2)
- return FAILED ("10. argc was %d expected 2", argc);
- if (strcmp (argv [0], "hola"))
- return FAILED ("11. argv[0] was %s", argv [0]);
- if (strcmp (argv [1], "\n\\'bola"))
- return FAILED ("12. argv[1] was %s", argv [1]);
- if (error != NULL)
- return FAILED ("13. error is not null");
-
- g_strfreev (argv);
- argv = NULL;
- argc = 0;
- return OK;
-}
-
-// This was the 2.8 showstopper error
-RESULT
-test_shell_argv4 ()
-{
- GError *error;
- gint argc;
- gchar **argv;
- gboolean ret;
- char *str = "'/usr/bin/gnome-terminal' -e \"bash -c 'read -p \\\"Press any key to continue...\\\" -n1;'\"";
-
- argv = NULL;
- argc = 0;
- error = NULL;
- ret = g_shell_parse_argv (str, &argc, &argv, &error);
- if (!ret)
- return FAILED ("1. It should return TRUE");
- if (argc != 3)
- return FAILED ("2. argc was %d expected 3", argc);
- if (argv == NULL)
- return FAILED ("3. argv[0] was NULL");
- if (error != NULL)
- return FAILED ("4. error was set");
-
- if (strcmp (argv [0], "/usr/bin/gnome-terminal"))
- return FAILED ("5. Expected /usr/bin/gnome-terminal got %s", argv [0]);
- if (strcmp (argv [1], "-e"))
- return FAILED ("6. Expected -e, got: %s", argv [1]);
- if (strcmp (argv [2], "bash -c 'read -p \"Press any key to continue...\" -n1;'"))
- return FAILED ("7. Got unexpected result: %s\n", argv [2]);
-
- return OK;
-}
-
-// This is https://bugzilla.novell.com/show_bug.cgi?id=655896
-RESULT
-test_shell_argv5 ()
-{
- GError *error;
- gint argc;
- gchar **argv;
- gboolean ret;
- char *str = "echo \"foo\",\"bar\"";
-
- argv = NULL;
- argc = 0;
- error = NULL;
- ret = g_shell_parse_argv (str, &argc, &argv, &error);
- if (!ret)
- return FAILED ("1. It should return TRUE");
- if (argc != 2)
- return FAILED ("2. argc was %d expected 2", argc);
- if (argv == NULL)
- return FAILED ("3. argv[0] was NULL");
- if (error != NULL)
- return FAILED ("4. error was set");
-
- if (strcmp (argv [0], "echo"))
- return FAILED ("5. Expected echo got %s", argv [0]);
- if (strcmp (argv [1], "foo,bar"))
- return FAILED ("6. Expected foo,bar, got: %s", argv [1]);
-
- return OK;
-}
-
-RESULT
-test_quote ()
-{
- if (strcmp (g_shell_quote ("foo"), "'foo'"))
- return FAILED ("Should return 'foo'");
-
- if (strcmp (g_shell_quote ("foo'bar"), "'foo'\\''bar'"))
- return FAILED ("Should return 'foo'\\''bar'");
-
- if (strcmp (g_shell_quote ("foo bar"), "'foo bar'"))
- return FAILED ("Should return 'foo bar'");
- return OK;
-}
-
-static Test shell_tests [] = {
- {"test_shell_argv1", test_shell_argv1},
- {"test_shell_argv2", test_shell_argv2},
- {"test_shell_argv3", test_shell_argv3},
- {"test_shell_argv4", test_shell_argv4},
- {"test_shell_argv5", test_shell_argv5},
- {"g_shell_quote", test_quote},
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(shell_tests_init, shell_tests)
-
+++ /dev/null
-/*
- * Tests to ensure that our type definitions are correct
- *
- * These depend on -Werror, -Wall being set to catch the build error.
- */
-#include <stdio.h>
-#ifndef _MSC_VER
-#include <stdint.h>
-#endif
-#include <string.h>
-#include <glib.h>
-#include "test.h"
-
-RESULT
-test_formats ()
-{
- char buffer [1024];
- gsize a = 1;
-
- sprintf (buffer, "%" G_GSIZE_FORMAT, a);
-
- return NULL;
-}
-
-RESULT
-test_ptrconv ()
-{
- int iv, iv2;
- unsigned int uv, uv2;
- gpointer ptr;
-
- iv = G_MAXINT32;
- ptr = GINT_TO_POINTER (iv);
- iv2 = GPOINTER_TO_INT (ptr);
- if (iv != iv2)
- return FAILED ("int to pointer and back conversions fail %d != %d", iv, iv2);
-
- iv = G_MININT32;
- ptr = GINT_TO_POINTER (iv);
- iv2 = GPOINTER_TO_INT (ptr);
- if (iv != iv2)
- return FAILED ("int to pointer and back conversions fail %d != %d", iv, iv2);
-
- iv = 1;
- ptr = GINT_TO_POINTER (iv);
- iv2 = GPOINTER_TO_INT (ptr);
- if (iv != iv2)
- return FAILED ("int to pointer and back conversions fail %d != %d", iv, iv2);
-
- iv = -1;
- ptr = GINT_TO_POINTER (iv);
- iv2 = GPOINTER_TO_INT (ptr);
- if (iv != iv2)
- return FAILED ("int to pointer and back conversions fail %d != %d", iv, iv2);
-
- iv = 0;
- ptr = GINT_TO_POINTER (iv);
- iv2 = GPOINTER_TO_INT (ptr);
- if (iv != iv2)
- return FAILED ("int to pointer and back conversions fail %d != %d", iv, iv2);
-
- uv = 0;
- ptr = GUINT_TO_POINTER (uv);
- uv2 = GPOINTER_TO_UINT (ptr);
- if (uv != uv2)
- return FAILED ("uint to pointer and back conversions fail %u != %d", uv, uv2);
-
- uv = 1;
- ptr = GUINT_TO_POINTER (uv);
- uv2 = GPOINTER_TO_UINT (ptr);
- if (uv != uv2)
- return FAILED ("uint to pointer and back conversions fail %u != %d", uv, uv2);
-
- uv = UINT32_MAX;
- ptr = GUINT_TO_POINTER (uv);
- uv2 = GPOINTER_TO_UINT (ptr);
- if (uv != uv2)
- return FAILED ("uint to pointer and back conversions fail %u != %d", uv, uv2);
-
- return NULL;
-
-}
-
-typedef struct {
- int a;
- int b;
-} my_struct;
-
-RESULT
-test_offset ()
-{
- if (G_STRUCT_OFFSET (my_struct, a) != 0)
- return FAILED ("offset of a is not zero");
-
- if (G_STRUCT_OFFSET (my_struct, b) != 4 && G_STRUCT_OFFSET (my_struct, b) != 8)
- return FAILED ("offset of b is 4 or 8, macro might be busted");
-
- return OK;
-}
-
-static Test size_tests [] = {
- {"formats", test_formats},
- {"ptrconv", test_ptrconv},
- {"g_struct_offset", test_offset},
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(size_tests_init, size_tests)
+++ /dev/null
-#include <stdio.h>
-#include <string.h>
-#include <glib.h>
-#include "test.h"
-
-
-RESULT
-test_slist_nth ()
-{
- char *foo = "foo";
- char *bar = "bar";
- char *baz = "baz";
- GSList *nth, *list;
- list = g_slist_prepend (NULL, baz);
- list = g_slist_prepend (list, bar);
- list = g_slist_prepend (list, foo);
-
- nth = g_slist_nth (list, 0);
- if (nth->data != foo)
- return FAILED ("nth failed. #0");
-
- nth = g_slist_nth (list, 1);
- if (nth->data != bar)
- return FAILED ("nth failed. #1");
-
- nth = g_slist_nth (list, 2);
- if (nth->data != baz)
- return FAILED ("nth failed. #2");
-
- nth = g_slist_nth (list, 3);
- if (nth)
- return FAILED ("nth failed. #3: %s", nth->data);
-
- g_slist_free (list);
- return OK;
-}
-
-RESULT
-test_slist_index ()
-{
- int i;
- char *foo = "foo";
- char *bar = "bar";
- char *baz = "baz";
- GSList *list;
- list = g_slist_prepend (NULL, baz);
- list = g_slist_prepend (list, bar);
- list = g_slist_prepend (list, foo);
-
- i = g_slist_index (list, foo);
- if (i != 0)
- return FAILED ("index failed. #0: %d", i);
-
- i = g_slist_index (list, bar);
- if (i != 1)
- return FAILED ("index failed. #1: %d", i);
-
- i = g_slist_index (list, baz);
- if (i != 2)
- return FAILED ("index failed. #2: %d", i);
-
- g_slist_free (list);
- return OK;
-}
-
-RESULT
-test_slist_append ()
-{
- GSList *foo;
- GSList *list = g_slist_append (NULL, "first");
- if (g_slist_length (list) != 1)
- return FAILED ("append(null,...) failed");
-
- foo = g_slist_append (list, "second");
- if (foo != list)
- return FAILED ("changed list head on non-empty");
-
- if (g_slist_length (list) != 2)
- return FAILED ("Append failed");
-
- g_slist_free (list);
- return OK;
-}
-
-RESULT
-test_slist_concat ()
-{
- GSList *foo = g_slist_prepend (NULL, "foo");
- GSList *bar = g_slist_prepend (NULL, "bar");
-
- GSList *list = g_slist_concat (foo, bar);
-
- if (g_slist_length (list) != 2)
- return FAILED ("Concat failed.");
-
- g_slist_free (list);
- return OK;
-}
-
-RESULT
-test_slist_find ()
-{
- GSList *list = g_slist_prepend (NULL, "three");
- GSList *found;
- char *data;
-
- list = g_slist_prepend (list, "two");
- list = g_slist_prepend (list, "one");
-
- data = "four";
- list = g_slist_append (list, data);
-
- found = g_slist_find (list, data);
-
- if (found->data != data)
- return FAILED ("Find failed");
-
- g_slist_free (list);
- return OK;
-}
-
-static gint
-find_custom (gconstpointer a, gconstpointer b)
-{
- return(strcmp (a, b));
-}
-
-RESULT
-test_slist_find_custom ()
-{
- GSList *list = NULL, *found;
- char *foo = "foo";
- char *bar = "bar";
- char *baz = "baz";
-
- list = g_slist_prepend (list, baz);
- list = g_slist_prepend (list, bar);
- list = g_slist_prepend (list, foo);
-
- found = g_slist_find_custom (list, baz, find_custom);
-
- if (found == NULL)
- return FAILED ("Find failed");
-
- g_slist_free (list);
-
- return OK;
-}
-
-RESULT
-test_slist_remove ()
-{
- GSList *list = g_slist_prepend (NULL, "three");
- char *one = "one";
- list = g_slist_prepend (list, "two");
- list = g_slist_prepend (list, one);
-
- list = g_slist_remove (list, one);
-
- if (g_slist_length (list) != 2)
- return FAILED ("Remove failed");
-
- if (strcmp ("two", list->data) != 0)
- return FAILED ("Remove failed");
-
- g_slist_free (list);
- return OK;
-}
-
-RESULT
-test_slist_remove_link ()
-{
- GSList *foo = g_slist_prepend (NULL, "a");
- GSList *bar = g_slist_prepend (NULL, "b");
- GSList *baz = g_slist_prepend (NULL, "c");
- GSList *list = foo;
-
- foo = g_slist_concat (foo, bar);
- foo = g_slist_concat (foo, baz);
-
- list = g_slist_remove_link (list, bar);
-
- if (g_slist_length (list) != 2)
- return FAILED ("remove_link failed #1");
-
- if (bar->next != NULL)
- return FAILED ("remove_link failed #2");
-
- g_slist_free (list);
- g_slist_free (bar);
-
- return OK;
-}
-
-static gint
-compare (gconstpointer a, gconstpointer b)
-{
- char *foo = (char *) a;
- char *bar = (char *) b;
-
- if (strlen (foo) < strlen (bar))
- return -1;
-
- return 1;
-}
-
-RESULT
-test_slist_insert_sorted ()
-{
- GSList *list = g_slist_prepend (NULL, "a");
- list = g_slist_append (list, "aaa");
-
- /* insert at the middle */
- list = g_slist_insert_sorted (list, "aa", compare);
- if (strcmp ("aa", list->next->data))
- return FAILED("insert_sorted failed #1");
-
- /* insert at the beginning */
- list = g_slist_insert_sorted (list, "", compare);
- if (strcmp ("", list->data))
- return FAILED ("insert_sorted failed #2");
-
- /* insert at the end */
- list = g_slist_insert_sorted (list, "aaaa", compare);
- if (strcmp ("aaaa", g_slist_last (list)->data))
- return FAILED ("insert_sorted failed #3");
-
- g_slist_free (list);
- return OK;
-}
-
-RESULT
-test_slist_insert_before ()
-{
- GSList *foo, *bar, *baz;
-
- foo = g_slist_prepend (NULL, "foo");
- foo = g_slist_insert_before (foo, NULL, "bar");
- bar = g_slist_last (foo);
-
- if (strcmp (bar->data, "bar"))
- return FAILED ("1");
-
- baz = g_slist_insert_before (foo, bar, "baz");
- if (foo != baz)
- return FAILED ("2");
-
- if (strcmp (foo->next->data, "baz"))
- return FAILED ("3: %s", foo->next->data);
-
- g_slist_free (foo);
- return OK;
-}
-
-#define N_ELEMS 100
-
-static int intcompare (gconstpointer p1, gconstpointer p2)
-{
- return GPOINTER_TO_INT (p1) - GPOINTER_TO_INT (p2);
-}
-
-static gboolean verify_sort (GSList *list, int len)
-{
- int prev = GPOINTER_TO_INT (list->data);
- len--;
- for (list = list->next; list; list = list->next) {
- int curr = GPOINTER_TO_INT (list->data);
- if (prev > curr)
- return FALSE;
- prev = curr;
-
- if (len == 0)
- return FALSE;
- len--;
- }
- return len == 0;
-}
-
-RESULT
-test_slist_sort ()
-{
- int i, j, mul;
- GSList *list = NULL;
-
- for (i = 0; i < N_ELEMS; ++i)
- list = g_slist_prepend (list, GINT_TO_POINTER (i));
- list = g_slist_sort (list, intcompare);
- if (!verify_sort (list, N_ELEMS))
- return FAILED ("decreasing list");
-
- g_slist_free (list);
-
- list = NULL;
- for (i = 0; i < N_ELEMS; ++i)
- list = g_slist_prepend (list, GINT_TO_POINTER (-i));
- list = g_slist_sort (list, intcompare);
- if (!verify_sort (list, N_ELEMS))
- return FAILED ("increasing list");
-
- g_slist_free (list);
-
- list = g_slist_prepend (NULL, GINT_TO_POINTER (0));
- for (i = 1; i < N_ELEMS; ++i) {
- list = g_slist_prepend (list, GINT_TO_POINTER (-i));
- list = g_slist_prepend (list, GINT_TO_POINTER (i));
- }
- list = g_slist_sort (list, intcompare);
- if (!verify_sort (list, 2*N_ELEMS-1))
- return FAILED ("alternating list");
-
- g_slist_free (list);
-
- list = NULL;
- mul = 1;
- for (i = 1; i < N_ELEMS; ++i) {
- mul = -mul;
- for (j = 0; j < i; ++j)
- list = g_slist_prepend (list, GINT_TO_POINTER (mul * j));
- }
- list = g_slist_sort (list, intcompare);
- if (!verify_sort (list, (N_ELEMS*N_ELEMS - N_ELEMS)/2))
- return FAILED ("wavering list");
-
- g_slist_free (list);
-
- return OK;
-}
-
-static Test slist_tests [] = {
- {"nth", test_slist_nth},
- {"index", test_slist_index},
- {"append", test_slist_append},
- {"concat", test_slist_concat},
- {"find", test_slist_find},
- {"find_custom", test_slist_find_custom},
- {"remove", test_slist_remove},
- {"remove_link", test_slist_remove_link},
- {"insert_sorted", test_slist_insert_sorted},
- {"insert_before", test_slist_insert_before},
- {"sort", test_slist_sort},
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(slist_tests_init, slist_tests)
-
+++ /dev/null
-#include <config.h>
-#include <glib.h>
-#include <string.h>
-#include <stdio.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include "test.h"
-
-#ifdef G_OS_WIN32
-#include <io.h>
-#define read _read
-#define close _close
-#endif
-
-RESULT
-test_spawn_sync ()
-{
- gchar *out;
- gchar *err;
- gint status = -1;
- GError *error = NULL;
-
- if (!g_spawn_command_line_sync ("ls", &out, &err, &status, &error))
- return FAILED ("Error executing 'ls'");
-
- if (status != 0)
- return FAILED ("Status is %d", status);
-
- if (out == NULL || strlen (out) == 0)
- return FAILED ("Didn't get any output from ls!?");
-
- g_free (out);
- g_free (err);
- return OK;
-}
-
-RESULT
-test_spawn_async ()
-{
- /*
-gboolean
-g_spawn_async_with_pipes (const gchar *working_directory,
- gchar **argv,
- gchar **envp,
- GSpawnFlags flags,
- GSpawnChildSetupFunc child_setup,
- gpointer user_data,
- GPid *child_pid,
- gint *standard_input,
- gint *standard_output,
- gint *standard_error,
- GError **error) */
- char *argv [15];
- int stdout_fd = -1;
- char buffer [512];
- pid_t child_pid = 0;
-
- memset (argv, 0, 15 * sizeof (char *));
- argv [0] = "ls";
- if (!g_spawn_async_with_pipes (NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, &child_pid, NULL, &stdout_fd, NULL, NULL))
- return FAILED ("1 Failed to run ls");
- if (child_pid == 0)
- return FAILED ("2 child pid not returned");
- if (stdout_fd == -1)
- return FAILED ("3 out fd is -1");
-
- while (read (stdout_fd, buffer, 512) > 0);
- close (stdout_fd);
-
- return OK;
-}
-
-static Test spawn_tests [] = {
- {"g_shell_spawn_sync", test_spawn_sync},
- {"g_shell_spawn_async_with_pipes", test_spawn_async},
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(spawn_tests_init, spawn_tests)
-
-
+++ /dev/null
-#include <glib.h>
-#include <string.h>
-#include <stdio.h>
-#include "test.h"
-
-/* This test is just to be used with valgrind */
-RESULT
-test_strfreev ()
-{
- gchar **array = g_new (gchar *, 4);
- array [0] = g_strdup ("one");
- array [1] = g_strdup ("two");
- array [2] = g_strdup ("three");
- array [3] = NULL;
-
- g_strfreev (array);
- g_strfreev (NULL);
-
- return OK;
-}
-
-RESULT
-test_concat ()
-{
- gchar *x = g_strconcat ("Hello", ", ", "world", NULL);
- if (strcmp (x, "Hello, world") != 0)
- return FAILED("concat failed, got: %s", x);
- g_free (x);
- return OK;
-}
-
-RESULT
-test_split ()
-{
- const gchar *to_split = "Hello world, how are we doing today?";
- gint i;
- gchar **v;
-
- v= g_strsplit(to_split, " ", 0);
-
- if(v == NULL) {
- return FAILED("split failed, got NULL vector (1)");
- }
-
- for(i = 0; v[i] != NULL; i++);
- if(i != 7) {
- return FAILED("split failed, expected 7 tokens, got %d", i);
- }
-
- g_strfreev(v);
-
- v = g_strsplit(to_split, ":", -1);
- if(v == NULL) {
- return FAILED("split failed, got NULL vector (2)");
- }
-
- for(i = 0; v[i] != NULL; i++);
- if(i != 1) {
- return FAILED("split failed, expected 1 token, got %d", i);
- }
-
- if(strcmp(v[0], to_split) != 0) {
- return FAILED("expected vector[0] to be '%s' but it was '%s'",
- to_split, v[0]);
- }
- g_strfreev(v);
-
- v = g_strsplit ("", ":", 0);
- if (v == NULL)
- return FAILED ("g_strsplit returned NULL");
- g_strfreev (v);
-
- v = g_strsplit ("/home/miguel/dingus", "/", 0);
- if (v [0][0] != 0)
- return FAILED ("Got a non-empty first element");
- g_strfreev (v);
-
- v = g_strsplit ("appdomain1, Version=0.0.0.0, Culture=neutral", ",", 4);
- if (strcmp (v [0], "appdomain1") != 0)
- return FAILED ("Invalid value");
-
- if (strcmp (v [1], " Version=0.0.0.0") != 0)
- return FAILED ("Invalid value");
-
- if (strcmp (v [2], " Culture=neutral") != 0)
- return FAILED ("Invalid value");
-
- if (v [3] != NULL)
- return FAILED ("Expected only 3 elements");
-
- g_strfreev (v);
-
- v = g_strsplit ("abcXYdefXghiXYjklYmno", "XY", 4);
- if (strcmp (v [0], "abc") != 0)
- return FAILED ("Invalid value 0");
-
- if (strcmp (v [1], "defXghi") != 0)
- return FAILED ("Invalid value 1");
-
- if (strcmp (v [2], "jklYmno") != 0)
- return FAILED ("Invalid value 2");
-
- if (v [3] != NULL)
- return FAILED ("Expected only 3 elements (1)");
-
- g_strfreev (v);
-
- v = g_strsplit ("abcXYdefXghiXYjklYmno", "XY", 2);
- if (strcmp (v [0], "abc") != 0)
- return FAILED ("Invalid value 3");
-
- if (strcmp (v [1], "defXghiXYjklYmno") != 0)
- return FAILED ("Invalid value 4");
-
- if (v [2] != NULL)
- return FAILED ("Expected only 2 elements (2)");
-
- g_strfreev (v);
-
- v = g_strsplit ("abcXYdefXghiXYjklYmnoXY", "XY", 3);
- if (strcmp (v [0], "abc") != 0)
- return FAILED ("Invalid value 5");
-
- if (strcmp (v [1], "defXghi") != 0)
- return FAILED ("Invalid value 6");
-
- if (strcmp (v [2], "jklYmnoXY") != 0)
- return FAILED ("Invalid value 7");
-
- if (v [3] != NULL)
- return FAILED ("Expected only 3 elements (3)");
-
- g_strfreev (v);
-
- v = g_strsplit ("abcXYXYXYdefXY", "XY", -1);
- if (strcmp (v [0], "abc") != 0)
- return FAILED ("Invalid value 8");
-
- if (strcmp (v [1], "") != 0)
- return FAILED ("Invalid value 9");
-
- if (strcmp (v [2], "") != 0)
- return FAILED ("Invalid value 10");
-
- if (strcmp (v [3], "def") != 0)
- return FAILED ("Invalid value 11");
-
- if (strcmp (v [4], "") != 0)
- return FAILED ("Invalid value 12");
-
- if (v [5] != NULL)
- return FAILED ("Expected only 5 elements (4)");
-
- g_strfreev (v);
-
- v = g_strsplit ("XYXYXYabcXYdef", "XY", -1);
- if (strcmp (v [0], "") != 0)
- return FAILED ("Invalid value 13");
-
- if (strcmp (v [1], "") != 0)
- return FAILED ("Invalid value 14");
-
- if (strcmp (v [2], "") != 0)
- return FAILED ("Invalid value 15");
-
- if (strcmp (v [3], "abc") != 0)
- return FAILED ("Invalid value 16");
-
- if (strcmp (v [4], "def") != 0)
- return FAILED ("Invalid value 17");
-
- if (v [5] != NULL)
- return FAILED ("Expected only 5 elements (5)");
-
- g_strfreev (v);
-
- v = g_strsplit ("value=", "=", 2);
- if (strcmp (v [0], "value") != 0)
- return FAILED ("Invalid value 18; expected 'value', got '%s'", v [0]);
- if (strcmp (v [1], "") != 0)
- return FAILED ("Invalid value 19; expected '', got '%s'", v [1]);
- if (v [2] != NULL)
- return FAILED ("Expected only 2 elements (6)");
-
- g_strfreev (v);
-
- return OK;
-}
-
-RESULT
-test_split_set ()
-{
- gchar **v;
-
- v = g_strsplit_set ("abcXYdefXghiXYjklYmno", "XY", 6);
- if (strcmp (v [0], "abc") != 0)
- return FAILED ("Invalid value 0");
-
- if (strcmp (v [1], "") != 0)
- return FAILED ("Invalid value 1");
-
- if (strcmp (v [2], "def") != 0)
- return FAILED ("Invalid value 2");
-
- if (strcmp (v [3], "ghi") != 0)
- return FAILED ("Invalid value 3");
-
- if (strcmp (v [4], "") != 0)
- return FAILED ("Invalid value 4");
-
- if (strcmp (v [5], "jklYmno") != 0)
- return FAILED ("Invalid value 5");
-
- if (v [6] != NULL)
- return FAILED ("Expected only 6 elements (1)");
-
- g_strfreev (v);
-
- v = g_strsplit_set ("abcXYdefXghiXYjklYmno", "XY", 3);
- if (strcmp (v [0], "abc") != 0)
- return FAILED ("Invalid value 6");
-
- if (strcmp (v [1], "") != 0)
- return FAILED ("Invalid value 7");
-
- if (strcmp (v [2], "defXghiXYjklYmno") != 0)
- return FAILED ("Invalid value 8");
-
- if (v [3] != NULL)
- return FAILED ("Expected only 3 elements (2)");
-
- g_strfreev (v);
-
- v = g_strsplit_set ("abcXdefYghiXjklYmnoX", "XY", 5);
- if (strcmp (v [0], "abc") != 0)
- return FAILED ("Invalid value 9");
-
- if (strcmp (v [1], "def") != 0)
- return FAILED ("Invalid value 10");
-
- if (strcmp (v [2], "ghi") != 0)
- return FAILED ("Invalid value 11");
-
- if (strcmp (v [3], "jkl") != 0)
- return FAILED ("Invalid value 12");
-
- if (strcmp (v [4], "mnoX") != 0)
- return FAILED ("Invalid value 13");
-
- if (v [5] != NULL)
- return FAILED ("Expected only 5 elements (5)");
-
- g_strfreev (v);
-
- v = g_strsplit_set ("abcXYXdefXY", "XY", -1);
- if (strcmp (v [0], "abc") != 0)
- return FAILED ("Invalid value 14");
-
- if (strcmp (v [1], "") != 0)
- return FAILED ("Invalid value 15");
-
- if (strcmp (v [2], "") != 0)
- return FAILED ("Invalid value 16");
-
- if (strcmp (v [3], "def") != 0)
- return FAILED ("Invalid value 17");
-
- if (strcmp (v [4], "") != 0)
- return FAILED ("Invalid value 18");
-
- if (strcmp (v [5], "") != 0)
- return FAILED ("Invalid value 19");
-
- if (v [6] != NULL)
- return FAILED ("Expected only 6 elements (4)");
-
- g_strfreev (v);
-
- v = g_strsplit_set ("XYXabcXYdef", "XY", -1);
- if (strcmp (v [0], "") != 0)
- return FAILED ("Invalid value 20");
-
- if (strcmp (v [1], "") != 0)
- return FAILED ("Invalid value 21");
-
- if (strcmp (v [2], "") != 0)
- return FAILED ("Invalid value 22");
-
- if (strcmp (v [3], "abc") != 0)
- return FAILED ("Invalid value 23");
-
- if (strcmp (v [4], "") != 0)
- return FAILED ("Invalid value 24");
-
- if (strcmp (v [5], "def") != 0)
- return FAILED ("Invalid value 25");
-
- if (v [6] != NULL)
- return FAILED ("Expected only 6 elements (5)");
-
- g_strfreev (v);
-
- return OK;
-}
-
-RESULT
-test_strreverse ()
-{
- RESULT res = OK;
- gchar *a = g_strdup ("onetwothree");
- gchar *a_target = "eerhtowteno";
- gchar *b = g_strdup ("onetwothre");
- gchar *b_target = "erhtowteno";
- gchar *c = g_strdup ("");
- gchar *c_target = "";
-
- g_strreverse (a);
- if (strcmp (a, a_target)) {
- res = FAILED("strreverse failed. Expecting: '%s' and got '%s'\n", a, a_target);
- goto cleanup;
- }
-
- g_strreverse (b);
- if (strcmp (b, b_target)) {
- res = FAILED("strreverse failed. Expecting: '%s' and got '%s'\n", b, b_target);
- goto cleanup;
- }
-
- g_strreverse (c);
- if (strcmp (c, c_target)) {
- res = FAILED("strreverse failed. Expecting: '%s' and got '%s'\n", b, b_target);
- goto cleanup;
- }
-
-cleanup:
- g_free (c);
- g_free (b);
- g_free (a);
- return res;
-}
-
-RESULT
-test_strjoin ()
-{
- char *s;
-
- s = g_strjoin (NULL, "a", "b", NULL);
- if (strcmp (s, "ab") != 0)
- return FAILED ("Join of two strings with no separator fails");
- g_free (s);
-
- s = g_strjoin ("", "a", "b", NULL);
- if (strcmp (s, "ab") != 0)
- return FAILED ("Join of two strings with empty separator fails");
- g_free (s);
-
- s = g_strjoin ("-", "a", "b", NULL);
- if (strcmp (s, "a-b") != 0)
- return FAILED ("Join of two strings with separator fails");
- g_free (s);
-
- s = g_strjoin ("-", "aaaa", "bbbb", "cccc", "dddd", NULL);
- if (strcmp (s, "aaaa-bbbb-cccc-dddd") != 0)
- return FAILED ("Join of multiple strings fails");
- g_free (s);
-
- s = g_strjoin ("-", NULL);
- if (s == NULL || (strcmp (s, "") != 0))
- return FAILED ("Failed to join empty arguments");
- g_free (s);
-
- return OK;
-}
-
-RESULT
-test_strchug ()
-{
- char *str = g_strdup (" \t\n hola");
-
- g_strchug (str);
- if (strcmp ("hola", str)) {
- fprintf (stderr, "%s\n", str);
- g_free (str);
- return FAILED ("Failed.");
- }
- g_free (str);
- return OK;
-}
-
-RESULT
-test_strchomp ()
-{
- char *str = g_strdup ("hola \t");
-
- g_strchomp (str);
- if (strcmp ("hola", str)) {
- fprintf (stderr, "%s\n", str);
- g_free (str);
- return FAILED ("Failed.");
- }
- g_free (str);
- return OK;
-}
-
-RESULT
-test_strstrip ()
-{
- char *str = g_strdup (" \t hola ");
-
- g_strstrip (str);
- if (strcmp ("hola", str)) {
- fprintf (stderr, "%s\n", str);
- g_free (str);
- return FAILED ("Failed.");
- }
- g_free (str);
- return OK;
-}
-
-#define urit(so,j) do { s = g_filename_to_uri (so, NULL, NULL); if (strcmp (s, j) != 0) return FAILED("Got %s expected %s", s, j); g_free (s); } while (0);
-
-#define errit(so) do { s = g_filename_to_uri (so, NULL, NULL); if (s != NULL) return FAILED ("got %s, expected NULL", s); } while (0);
-
-RESULT
-test_filename_to_uri ()
-{
-#ifdef G_OS_WIN32
-#else
- char *s;
-
- urit ("/a", "file:///a");
- urit ("/home/miguel", "file:///home/miguel");
- urit ("/home/mig uel", "file:///home/mig%20uel");
- urit ("/\303\241", "file:///%C3%A1");
- urit ("/\303\241/octal", "file:///%C3%A1/octal");
- urit ("/%", "file:///%25");
- urit ("/\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040", "file:///%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20");
- urit ("/!$&'()*+,-./", "file:///!$&'()*+,-./");
- urit ("/\042\043\045", "file:///%22%23%25");
- urit ("/0123456789:=", "file:///0123456789:=");
- urit ("/\073\074\076\077", "file:///%3B%3C%3E%3F");
- urit ("/\133\134\135\136_\140\173\174\175", "file:///%5B%5C%5D%5E_%60%7B%7C%7D");
- urit ("/\173\174\175\176\177\200", "file:///%7B%7C%7D~%7F%80");
- urit ("/@ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", "file:///@ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
- errit ("a");
- errit ("./hola");
-#endif
-
- return OK;
-}
-
-#define fileit(so,j) do { s = g_filename_from_uri (so, NULL, NULL); if (strcmp (s, j) != 0) return FAILED("Got %s expected %s", s, j); g_free (s); } while (0);
-
-#define ferrit(so) do { s = g_filename_from_uri (so, NULL, NULL); if (s != NULL) return FAILED ("got %s, expected NULL", s); } while (0);
-
-RESULT
-test_filename_from_uri ()
-{
-#ifdef G_OS_WIN32
-#else
- char *s;
-
- fileit ("file:///a", "/a");
- fileit ("file:///%41", "/A");
- fileit ("file:///home/miguel", "/home/miguel");
- fileit ("file:///home/mig%20uel", "/home/mig uel");
- ferrit ("/a");
- ferrit ("a");
- ferrit ("file://a");
- ferrit ("file:a");
- ferrit ("file:///%");
- ferrit ("file:///%0");
- ferrit ("file:///%jj");
-#endif
-
- return OK;
-}
-
-RESULT
-test_ascii_xdigit_value ()
-{
- int i;
- gchar j;
-
- i = g_ascii_xdigit_value ('9' + 1);
- if (i != -1)
- return FAILED ("'9' + 1");
- i = g_ascii_xdigit_value ('0' - 1);
- if (i != -1)
- return FAILED ("'0' - 1");
- i = g_ascii_xdigit_value ('a' - 1);
- if (i != -1)
- return FAILED ("'a' - 1");
- i = g_ascii_xdigit_value ('f' + 1);
- if (i != -1)
- return FAILED ("'f' + 1");
- i = g_ascii_xdigit_value ('A' - 1);
- if (i != -1)
- return FAILED ("'A' - 1");
- i = g_ascii_xdigit_value ('F' + 1);
- if (i != -1)
- return FAILED ("'F' + 1");
-
- for (j = '0'; j < '9'; j++) {
- int c = g_ascii_xdigit_value (j);
- if (c != (j - '0'))
- return FAILED ("Digits %c -> %d", j, c);
- }
- for (j = 'a'; j < 'f'; j++) {
- int c = g_ascii_xdigit_value (j);
- if (c != (j - 'a' + 10))
- return FAILED ("Lower %c -> %d", j, c);
- }
- for (j = 'A'; j < 'F'; j++) {
- int c = g_ascii_xdigit_value (j);
- if (c != (j - 'A' + 10))
- return FAILED ("Upper %c -> %d", j, c);
- }
- return OK;
-}
-
-RESULT
-test_strdelimit ()
-{
- gchar *str;
-
- str = g_strdup (G_STR_DELIMITERS);
- str = g_strdelimit (str, NULL, 'a');
- if (0 != strcmp ("aaaaaaa", str))
- return FAILED ("All delimiters: '%s'", str);
- g_free (str);
- str = g_strdup ("hola");
- str = g_strdelimit (str, "ha", '+');
- if (0 != strcmp ("+ol+", str))
- return FAILED ("2 delimiters: '%s'", str);
- g_free (str);
- return OK;
-}
-
-#define NUMBERS "0123456789"
-
-RESULT
-test_strlcpy ()
-{
- const gchar *src = "onetwothree";
- gchar *dest;
- gsize i;
-
- dest = g_malloc (strlen (src) + 1);
- memset (dest, 0, strlen (src) + 1);
- i = g_strlcpy (dest, src, (gsize)-1);
- if (i != strlen (src))
- return FAILED ("Test1 got %d", i);
-
- if (0 != strcmp (dest, src))
- return FAILED ("Src and dest not equal");
-
- i = g_strlcpy (dest, src, 3);
- if (i != strlen (src))
- return FAILED ("Test1 got %d", i);
- if (0 != strcmp (dest, "on"))
- return FAILED ("Test2");
-
- i = g_strlcpy (dest, src, 1);
- if (i != strlen (src))
- return FAILED ("Test3 got %d", i);
- if (*dest != '\0')
- return FAILED ("Test4");
-
- i = g_strlcpy (dest, src, 12345);
- if (i != strlen (src))
- return FAILED ("Test4 got %d", i);
- if (0 != strcmp (dest, src))
- return FAILED ("Src and dest not equal 2");
- g_free (dest);
-
- /* This is a test for g_filename_from_utf8, even if it does not look like it */
- dest = g_filename_from_utf8 (NUMBERS, strlen (NUMBERS), NULL, NULL, NULL);
- if (0 != strcmp (dest, NUMBERS))
- return FAILED ("problem [%s] and [%s]", dest, NUMBERS);
- g_free (dest);
-
- return OK;
-}
-
-RESULT
-test_strescape ()
-{
- gchar *str;
-
- str = g_strescape ("abc", NULL);
- if (strcmp ("abc", str))
- return FAILED ("#1");
- str = g_strescape ("\t\b\f\n\r\\\"abc", NULL);
- if (strcmp ("\\t\\b\\f\\n\\r\\\\\\\"abc", str))
- return FAILED ("#2 %s", str);
- str = g_strescape ("\001abc", NULL);
- if (strcmp ("\\001abc", str))
- return FAILED ("#3 %s", str);
- str = g_strescape ("\001abc", "\001");
- if (strcmp ("\001abc", str))
- return FAILED ("#3 %s", str);
- return OK;
-}
-
-RESULT
-test_ascii_strncasecmp ()
-{
- int n;
-
- n = g_ascii_strncasecmp ("123", "123", 1);
- if (n != 0)
- return FAILED ("Should have been 0");
-
- n = g_ascii_strncasecmp ("423", "123", 1);
- if (n != 3)
- return FAILED ("Should have been 3, got %d", n);
-
- n = g_ascii_strncasecmp ("123", "423", 1);
- if (n != -3)
- return FAILED ("Should have been -3, got %d", n);
-
- n = g_ascii_strncasecmp ("1", "1", 10);
- if (n != 0)
- return FAILED ("Should have been 0, got %d", n);
- return OK;
-}
-
-RESULT
-test_ascii_strdown ()
-{
- const gchar *a = "~09+AaBcDeFzZ$0909EmPAbCdEEEEEZZZZAAA";
- const gchar *b = "~09+aabcdefzz$0909empabcdeeeeezzzzaaa";
- gchar *c;
- gint n, l;
-
- l = (gint)strlen (b);
- c = g_ascii_strdown (a, l);
- n = g_ascii_strncasecmp (b, c, l);
-
- if (n != 0) {
- g_free (c);
- return FAILED ("Should have been 0, got %d", n);
- }
-
- g_free (c);
- return OK;
-}
-
-RESULT
-test_strdupv ()
-{
- gchar **one;
- gchar **two;
- gint len;
-
- one = g_strdupv (NULL);
- if (one)
- return FAILED ("Should have been NULL");
-
- one = g_malloc (sizeof (gchar *));
- *one = NULL;
- two = g_strdupv (one);
- if (!two)
- FAILED ("Should have been not NULL");
- len = g_strv_length (two);
- if (len)
- FAILED ("Should have been 0");
- g_strfreev (two);
- g_strfreev (one);
- return NULL;
-}
-
-static Test strutil_tests [] = {
- {"g_strfreev", test_strfreev},
- {"g_strconcat", test_concat},
- {"g_strsplit", test_split},
- {"g_strsplit_set", test_split_set},
- {"g_strreverse", test_strreverse},
- {"g_strjoin", test_strjoin},
- {"g_strchug", test_strchug},
- {"g_strchomp", test_strchomp},
- {"g_strstrip", test_strstrip},
- {"g_filename_to_uri", test_filename_to_uri},
- {"g_filename_from_uri", test_filename_from_uri},
- {"g_ascii_xdigit_value", test_ascii_xdigit_value},
- {"g_strdelimit", test_strdelimit},
- {"g_strlcpy", test_strlcpy},
- {"g_strescape", test_strescape},
- {"g_ascii_strncasecmp", test_ascii_strncasecmp },
- {"g_ascii_strdown", test_ascii_strdown },
- {"g_strdupv", test_strdupv },
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(strutil_tests_init, strutil_tests)
-
-
+++ /dev/null
-#include <glib.h>
-#include <string.h>
-#include <stdio.h>
-#include "test.h"
-
-#define sfail(k,p) if (s->str [p] != k) { g_string_free (s,TRUE); return FAILED("Got %s, Failed at %d, expected '%c'", s->str, p, k);}
-
-RESULT
-test_append_speed()
-{
- GString *s = g_string_new("");
- gint i;
-
- for(i = 0; i < 1024; i++) {
- g_string_append(s, "x");
- }
-
- if(strlen (s->str) != 1024) {
- return FAILED("Incorrect string size, got: %s %d",
- s->str, strlen(s->str));
- }
-
- g_string_free (s, TRUE);
-
- return OK;
-}
-
-RESULT
-test_append_c_speed()
-{
- GString *s = g_string_new("");
- gint i;
-
- for(i = 0; i < 1024; i++) {
- g_string_append_c(s, 'x');
- }
-
- if(strlen(s->str) != 1024) {
- return FAILED("Incorrect string size, got: %s %d", s->str,
- strlen(s->str));
- }
-
- g_string_free(s, TRUE);
-
- return OK;
-}
-
-RESULT
-test_gstring ()
-{
- GString *s = g_string_new_len ("My stuff", 2);
- char *ret;
- int i;
-
- if (strcmp (s->str, "My") != 0)
- return "Expected only 'My' on the string";
- g_string_free (s, TRUE);
-
- s = g_string_new_len ("My\0\0Rest", 6);
- if (s->str [2] != 0)
- return "Null was not copied";
- if (strcmp (s->str+4, "Re") != 0){
- return "Did not find the 'Re' part";
- }
-
- g_string_append (s, "lalalalalalalalalalalalalalalalalalalalalalal");
- if (s->str [2] != 0)
- return "Null as not copied";
- if (strncmp (s->str+4, "Relala", 6) != 0){
- return FAILED("Did not copy correctly, got: %s", s->str+4);
- }
-
- g_string_free (s, TRUE);
-
- s = g_string_new ("");
- for (i = 0; i < 1024; i++){
- g_string_append_c (s, 'x');
- }
- if (strlen (s->str) != 1024){
- return FAILED("Incorrect string size, got: %s %d\n", s->str, strlen (s->str));
- }
- g_string_free (s, TRUE);
-
- s = g_string_new ("hola");
- g_string_sprintfa (s, "%s%d", ", bola", 5);
- if (strcmp (s->str, "hola, bola5") != 0){
- return FAILED("Incorrect data, got: %s\n", s->str);
- }
- g_string_free (s, TRUE);
-
- s = g_string_new ("Hola");
- g_string_printf (s, "Dingus");
-
- /* Test that it does not release it */
- ret = g_string_free (s, FALSE);
- g_free (ret);
-
- s = g_string_new_len ("H" "\000" "H", 3);
- g_string_append_len (s, "1" "\000" "2", 3);
- sfail ('H', 0);
- sfail ( 0, 1);
- sfail ('H', 2);
- sfail ('1', 3);
- sfail ( 0, 4);
- sfail ('2', 5);
- g_string_free (s, TRUE);
-
- return OK;
-}
-
-RESULT
-test_sized ()
-{
- GString *s = g_string_sized_new (20);
-
- if (s->str [0] != 0)
- return FAILED ("Expected an empty string");
- if (s->len != 0)
- return FAILED ("Expected an empty len");
-
- g_string_free (s, TRUE);
-
- return NULL;
-}
-
-RESULT
-test_truncate ()
-{
- GString *s = g_string_new ("0123456789");
- g_string_truncate (s, 3);
-
- if (strlen (s->str) != 3)
- return FAILED ("size of string should have been 3, instead it is [%s]\n", s->str);
- g_string_free (s, TRUE);
-
- s = g_string_new ("a");
- s = g_string_truncate (s, 10);
- if (strlen (s->str) != 1)
- return FAILED ("The size is not 1");
- g_string_truncate (s, (gsize)-1);
- if (strlen (s->str) != 1)
- return FAILED ("The size is not 1");
- g_string_truncate (s, 0);
- if (strlen (s->str) != 0)
- return FAILED ("The size is not 0");
-
- g_string_free (s, TRUE);
-
- return NULL;
-}
-
-RESULT
-test_prepend ()
-{
- GString *s = g_string_new ("dingus");
- g_string_prepend (s, "one");
-
- if (strcmp (s->str, "onedingus") != 0)
- return FAILED ("Failed, expected onedingus, got [%s]", s->str);
-
- g_string_free (s, TRUE);
-
- /* This is to force the code that where stuff does not fit in the allocated block */
- s = g_string_sized_new (1);
- g_string_prepend (s, "one");
- if (strcmp (s->str, "one") != 0)
- return FAILED ("Got erroneous result, expected [one] got [%s]", s->str);
- g_string_free (s, TRUE);
-
- /* This is to force the path where things fit */
- s = g_string_new ("123123123123123123123123");
- g_string_truncate (s, 1);
- if (strcmp (s->str, "1") != 0)
- return FAILED ("Expected [1] string, got [%s]", s->str);
-
- g_string_prepend (s, "pre");
- if (strcmp (s->str, "pre1") != 0)
- return FAILED ("Expected [pre1], got [%s]", s->str);
- g_string_free (s, TRUE);
-
- return NULL;
-}
-
-RESULT
-test_appendlen ()
-{
- GString *s = g_string_new ("");
-
- g_string_append_len (s, "boo\000x", 0);
- if (s->len != 0)
- return FAILED ("The length is not zero %d", s->len);
- g_string_append_len (s, "boo\000x", 5);
- if (s->len != 5)
- return FAILED ("The length is not five %d", s->len);
- g_string_append_len (s, "ha", -1);
- if (s->len != 7)
- return FAILED ("The length is not seven %d", s->len);
-
- g_string_free (s, TRUE);
-
- return NULL;
-}
-
-RESULT
-test_macros ()
-{
- char *s = g_strdup (G_STRLOC);
- char *p = strchr (s + 2, ':');
- int n;
-
- if (p == NULL)
- return FAILED ("Did not find a separator");
- n = atoi (p+1);
- if (n <= 0)
- return FAILED ("did not find a valid line number");
-
- *p = 0;
- if (strcmp (s + strlen(s) - 8 , "string.c") != 0)
- return FAILED ("This did not store the filename on G_STRLOC");
-
- g_free (s);
- return NULL;
-}
-
-static Test string_tests [] = {
- {"append-speed", test_append_speed},
- {"append_c-speed", test_append_c_speed},
- {"ctor+append", test_gstring },
- {"ctor+sized", test_sized },
- {"truncate", test_truncate },
- {"prepend", test_prepend },
- {"append_len", test_appendlen },
- {"macros", test_macros },
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(string_tests_init, string_tests)
+++ /dev/null
-#!/bin/sh
-
-for arg in $@; do
- if [ "x$arg" = "x--help" ]; then
- echo "Usage: $0 [OPTION]... [ITERATIONS] [TESTGROUP]..."
- echo ""
- echo "Works the same as test-eglib or test-glib with the following"
- echo "exception. Run test-eglib --help for details on normal testing"
- echo ""
- echo "If the first OPTION is --speed-compare, the following is"
- echo "applicable to this program:"
- echo ""
- echo " --speed-compare run drivers in -qtni mode and report"
- echo " speed comparison information"
- echo ""
- echo "After --speed-compare, the number of iterations "
- echo "(optional, default is 100000) can be specified, followed "
- echo "by specific tests to run (or none to run all)"
- echo ""
- echo "If --speed-compare is not the first argument, all arguments are"
- echo "passed on directly to each driver"
- echo ""
- exit 1
- fi
-done
-
-if [ ! -x "./test-glib" -o ! -x "./test-eglib" ]; then
- make
-fi
-
-if [ "x$1" = "x--speed-compare" ]; then
- ITERATIONS=100000
- if [ ! -z "$2" ]; then
- case $2 in
- *[0-9]*) ITERATIONS=$2; break;
- esac
- fi
-
- OPTIONS="-qnti $ITERATIONS"
-
- for arg in $@; do
- if [ "x$arg" = "x--speed-compare" ]; then
- continue;
- elif [ "$arg" = "$ITERATIONS" ]; then
- continue;
- fi
-
- OPTIONS="$OPTIONS $arg"
- done
-
- echo "Running tests with $OPTIONS..."
-
- GLIB=`./test-glib $OPTIONS`
- EGLIB=`./test-eglib $OPTIONS`
-
- # this blows
- FASTER_NAME=`echo "$GLIB GLib $EGLIB EGlib" | awk '{ if($1 < $3) print $2; else print $4 }'`
- FASTER_SPEED=`echo "$GLIB $EGLIB" | awk '{ if($1 < $2) print $1; else print $2 }'`
- SLOWER_NAME=`echo "$GLIB GLib $EGLIB EGlib" | awk '{ if($1 > $3) print $2; else print $4 }'`
- SLOWER_SPEED=`echo "$GLIB $EGLIB" | awk '{ if($1 > $2) print $1; else print $2 }'`
-
- FASTER_PERCENTAGE=`echo "$SLOWER_SPEED $FASTER_SPEED" | awk '{ print ($1 / $2) * 100 }'`
-
- echo "$FASTER_NAME $FASTER_SPEED"
- echo "$SLOWER_NAME $SLOWER_SPEED"
- echo "------------------------------------------------"
- echo "$FASTER_NAME is $FASTER_PERCENTAGE% faster than $SLOWER_NAME"
-
- exit 0;
-fi
-
-./test-eglib $@
-./test-glib $@
-
+++ /dev/null
-/*
- * EGLib Unit Group/Test Runners
- *
- * Author:
- * Aaron Bockover (abockover@novell.com)
- *
- * (C) 2006 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.
- */
-
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-
-#include <config.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdarg.h>
-#include <glib.h>
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#ifdef G_OS_WIN32
-#include <winsock2.h>
-#endif
-
-#include "test.h"
-
-extern gint global_passed, global_tests;
-static gchar *last_result = NULL;
-
-gboolean
-run_test(Test *test, gchar **result_out)
-{
- gchar *result;
-
- if((result = test->handler()) == NULL) {
- *result_out = NULL;
- return TRUE;
- } else {
- *result_out = result;
- return FALSE;
- }
-}
-
-gboolean
-run_group(Group *group, gint iterations, gboolean quiet,
- gboolean time, gchar *tests_to_run_s)
-{
- Test *tests = group->handler();
- gint i, j, passed = 0, total = 0;
- gdouble start_time_group, start_time_test;
- gchar **tests_to_run = NULL;
-
- if(!quiet) {
- if(iterations > 1) {
- printf("[%s] (%dx)\n", group->name, iterations);
- } else {
- printf("[%s]\n", group->name);
- }
- }
-
- if(tests_to_run_s != NULL) {
- tests_to_run = eg_strsplit(tests_to_run_s, ",", -1);
- }
-
- start_time_group = get_timestamp();
-
- for(i = 0; tests[i].name != NULL; i++) {
- gchar *result = "";
- gboolean iter_pass, run;
-
- iter_pass = FALSE;
- if(tests_to_run != NULL) {
- gint j;
- run = FALSE;
- for(j = 0; tests_to_run[j] != NULL; j++) {
- if(strcmp(tests_to_run[j], tests[i].name) == 0) {
- run = TRUE;
- break;
- }
- }
- } else {
- run = TRUE;
- }
-
- if(!run) {
- continue;
- }
-
- total++;
-
- if(!quiet) {
- printf(" %s: ", tests[i].name);
- }
-
- start_time_test = get_timestamp();
-
- for(j = 0; j < iterations; j++) {
- iter_pass = run_test(&(tests[i]), &result);
- if(!iter_pass) {
- break;
- }
- }
-
- if(iter_pass) {
- passed++;
- if(!quiet) {
- if(time) {
- printf("OK (%g)\n", get_timestamp() - start_time_test);
- } else {
- printf("OK\n");
- }
- }
- } else {
- if(!quiet) {
- printf("FAILED (%s)\n", result);
- }
-
- if(last_result == result) {
- last_result = NULL;
- g_free(result);
- }
- }
- }
-
- global_passed += passed;
- global_tests += total;
-
- if(!quiet) {
- gdouble pass_percentage = ((gdouble)passed / (gdouble)total) * 100.0;
- if(time) {
- printf(" %d / %d (%g%%, %g)\n", passed, total,
- pass_percentage, get_timestamp() - start_time_group);
- } else {
- printf(" %d / %d (%g%%)\n", passed, total, pass_percentage);
- }
- }
-
- if(tests_to_run != NULL) {
- eg_strfreev(tests_to_run);
- }
-
- return passed == total;
-}
-
-RESULT
-FAILED(const gchar *format, ...)
-{
- gchar *ret;
- va_list args;
- gint n;
-
-#if !defined(HAVE_VASPRINTF) && !defined(_EGLIB_MAJOR)
- /* We are linked against the real glib, no vasprintf */
- g_assert_not_reached ();
- return NULL;
-#else
- va_start(args, format);
- n = g_vasprintf(&ret, format, args);
- va_end(args);
-
- if(n == -1) {
- last_result = NULL;
- return NULL;
- }
-
- last_result = ret;
- return ret;
-#endif
-}
-
-gdouble
-get_timestamp()
-{
- /* FIXME: We should use g_get_current_time here */
- GTimeVal res;
- g_get_current_time (&res);
- return res.tv_sec + (1.e-6) * res.tv_usec;
-}
-
-/*
- * Duplicating code here from EGlib to avoid g_strsplit skew between
- * EGLib and GLib
- */
-
-gchar **
-eg_strsplit (const gchar *string, const gchar *delimiter, gint max_tokens)
-{
- gchar *string_c;
- gchar *strtok_save, **vector;
- gchar *token, *token_c;
- gint size = 1;
- size_t token_length;
-
- g_return_val_if_fail(string != NULL, NULL);
- g_return_val_if_fail(delimiter != NULL, NULL);
- g_return_val_if_fail(delimiter[0] != 0, NULL);
-
- token_length = strlen(string);
- string_c = (gchar *)g_malloc(token_length + 1);
- memcpy(string_c, string, token_length);
- string_c[token_length] = 0;
-
- vector = NULL;
- token = (gchar *)strtok_r(string_c, delimiter, &strtok_save);
-
- while(token != NULL) {
- token_length = strlen(token);
- token_c = (gchar *)g_malloc(token_length + 1);
- memcpy(token_c, token, token_length);
- token_c[token_length] = 0;
-
- vector = vector == NULL ?
- (gchar **)g_malloc(2 * sizeof(vector)) :
- (gchar **)g_realloc(vector, (size + 1) * sizeof(vector));
-
- vector[size - 1] = token_c;
- size++;
-
- if(max_tokens > 0 && size >= max_tokens) {
- if(size > max_tokens) {
- break;
- }
-
- token = strtok_save;
- } else {
- token = (gchar *)strtok_r(NULL, delimiter, &strtok_save);
- }
- }
-
- if(vector != NULL && size > 0) {
- vector[size - 1] = NULL;
- }
-
- g_free(string_c);
- string_c = NULL;
-
- return vector;
-}
-
-void
-eg_strfreev (gchar **str_array)
-{
- gchar **orig = str_array;
- if (str_array == NULL)
- return;
- while (*str_array != NULL){
- g_free (*str_array);
- str_array++;
- }
- g_free (orig);
-}
-
-
-
+++ /dev/null
-/*
- * EGLib Unit Group/Test Runners
- *
- * Author:
- * Aaron Bockover (abockover@novell.com)
- *
- * (C) 2006 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.
- */
-
-#ifndef _TEST_H
-#define _TEST_H
-
-#include <config.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
-#include <glib.h>
-
-#ifdef _MSC_VER
-/* disable the following warnings
- * C4100: The formal parameter is not referenced in the body of the function. The unreferenced parameter is ignored.
- * C4127: conditional expression is constant (test macros produce a lot of these)
-*/
-#pragma warning(disable:4100 4127)
-#endif
-
-typedef gchar * RESULT;
-
-typedef struct _Test Test;
-typedef struct _Group Group;
-
-typedef gchar * (* RunTestHandler)();
-typedef Test * (* LoadGroupHandler)();
-
-struct _Test {
- const gchar *name;
- RunTestHandler handler;
-};
-
-struct _Group {
- const gchar *name;
- LoadGroupHandler handler;
-};
-
-gboolean run_group(Group *group, gint iterations, gboolean quiet,
- gboolean time, gchar *tests);
-#undef FAILED
-RESULT FAILED(const gchar *format, ...);
-gdouble get_timestamp();
-gchar ** eg_strsplit (const gchar *string, const gchar *delimiter, gint max_tokens);
-void eg_strfreev (gchar **str_array);
-
-#define OK NULL
-
-#define DEFINE_TEST_GROUP_INIT(name, table) \
- Test * (name)() { return table; }
-
-#define DEFINE_TEST_GROUP_INIT_H(name) \
- Test * (name)();
-
-#endif /* _TEST_H */
-
-
+++ /dev/null
-#include "test.h"
-
-DEFINE_TEST_GROUP_INIT_H(string_tests_init);
-DEFINE_TEST_GROUP_INIT_H(strutil_tests_init);
-DEFINE_TEST_GROUP_INIT_H(slist_tests_init);
-DEFINE_TEST_GROUP_INIT_H(list_tests_init);
-DEFINE_TEST_GROUP_INIT_H(hashtable_tests_init);
-DEFINE_TEST_GROUP_INIT_H(ptrarray_tests_init);
-DEFINE_TEST_GROUP_INIT_H(size_tests_init);
-DEFINE_TEST_GROUP_INIT_H(fake_tests_init);
-DEFINE_TEST_GROUP_INIT_H(array_tests_init);
-DEFINE_TEST_GROUP_INIT_H(queue_tests_init);
-DEFINE_TEST_GROUP_INIT_H(path_tests_init);
-DEFINE_TEST_GROUP_INIT_H(shell_tests_init);
-DEFINE_TEST_GROUP_INIT_H(spawn_tests_init);
-DEFINE_TEST_GROUP_INIT_H(timer_tests_init);
-DEFINE_TEST_GROUP_INIT_H(file_tests_init);
-DEFINE_TEST_GROUP_INIT_H(pattern_tests_init);
-DEFINE_TEST_GROUP_INIT_H(dir_tests_init);
-DEFINE_TEST_GROUP_INIT_H(markup_tests_init);
-DEFINE_TEST_GROUP_INIT_H(unicode_tests_init);
-DEFINE_TEST_GROUP_INIT_H(utf8_tests_init);
-DEFINE_TEST_GROUP_INIT_H(endian_tests_init);
-DEFINE_TEST_GROUP_INIT_H(module_tests_init);
-DEFINE_TEST_GROUP_INIT_H(memory_tests_init);
-
-static Group test_groups [] = {
- {"string", string_tests_init},
- {"strutil", strutil_tests_init},
- {"ptrarray", ptrarray_tests_init},
- {"slist", slist_tests_init},
- {"list", list_tests_init},
- {"hashtable", hashtable_tests_init},
- {"sizes", size_tests_init},
- {"fake", fake_tests_init},
- {"array", array_tests_init},
- {"queue", queue_tests_init},
- {"path", path_tests_init},
- {"shell", shell_tests_init},
- {"markup", markup_tests_init},
-#if !DISABLE_PROCESS_TESTS
- {"spawn", spawn_tests_init},
- {"module", module_tests_init},
-#endif
-#if !DISABLE_FILESYSTEM_TESTS
- {"file", file_tests_init},
-#endif
- {"timer", timer_tests_init},
- {"pattern", pattern_tests_init},
- {"dir", dir_tests_init},
- {"unicode", unicode_tests_init},
- {"utf8", utf8_tests_init},
- {"endian", endian_tests_init},
- {"memory", memory_tests_init},
- {NULL, NULL}
-};
-
+++ /dev/null
-#include <config.h>
-#include <glib.h>
-#include <string.h>
-#include <math.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <stdlib.h>
-#include <stdio.h>
-
-#ifdef G_OS_WIN32
-#include <windows.h>
-#define sleep(t) Sleep((t) * 1000)
-#endif
-
-#include "test.h"
-
-RESULT
-test_timer ()
-{
- GTimer *timer;
- gdouble elapsed1, elapsed2;
- gulong usec = 0;
-
- timer = g_timer_new ();
- sleep (1);
- elapsed1 = g_timer_elapsed (timer, NULL);
- if ((elapsed1 + 0.1) < 1.0)
- return FAILED ("Elapsed time should be around 1s and was %f", elapsed1);
-
- g_timer_stop (timer);
- elapsed1 = g_timer_elapsed (timer, NULL);
- elapsed2 = g_timer_elapsed (timer, &usec);
- if (fabs (elapsed1 - elapsed2) > 0.000001)
- return FAILED ("The elapsed times are not equal %f - %f.", elapsed1, elapsed2);
-
- elapsed2 *= 1000000;
- while (elapsed2 > 1000000)
- elapsed2 -= 1000000;
-
- if (fabs (usec - elapsed2) > 100.0)
- return FAILED ("usecs are wrong.");
-
- g_timer_destroy (timer);
- return OK;
-}
-
-static Test timer_tests [] = {
- {"g_timer", test_timer},
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(timer_tests_init, timer_tests)
-
-
+++ /dev/null
-#include "test.h"
-
-/*
- * g_unichar_type
- */
-RESULT
-test_g_unichar_type ()
-{
- if (g_unichar_type ('A') != G_UNICODE_UPPERCASE_LETTER)
- return FAILED ("#1");
- if (g_unichar_type ('a') != G_UNICODE_LOWERCASE_LETTER)
- return FAILED ("#2");
- if (g_unichar_type ('1') != G_UNICODE_DECIMAL_NUMBER)
- return FAILED ("#3");
- if (g_unichar_type (0xA3) != G_UNICODE_CURRENCY_SYMBOL)
- return FAILED ("#4");
- return NULL;
-}
-
-/*
- * g_unichar_toupper
- */
-RESULT
-test_g_unichar_toupper ()
-{
- if (g_unichar_toupper (0) != 0)
- return FAILED ("#0");
- if (g_unichar_toupper ('a') != 'A')
- return FAILED ("#1");
- if (g_unichar_toupper ('1') != '1')
- return FAILED ("#2");
- if (g_unichar_toupper (0x1C4) != 0x1C4)
- return FAILED ("#3");
- if (g_unichar_toupper (0x1F2) != 0x1F1)
- return FAILED ("#4");
- if (g_unichar_toupper (0x1F3) != 0x1F1)
- return FAILED ("#5");
- if (g_unichar_toupper (0xFFFF) != 0xFFFF)
- return FAILED ("#6");
- if (g_unichar_toupper (0x10428) != 0x10400)
- return FAILED ("#7");
- return NULL;
-}
-
-/*
- * g_unichar_tolower
- */
-RESULT
-test_g_unichar_tolower ()
-{
- if (g_unichar_tolower (0) != 0)
- return FAILED ("#0");
- if (g_unichar_tolower ('A') != 'a')
- return FAILED ("#1");
- if (g_unichar_tolower ('1') != '1')
- return FAILED ("#2");
- if (g_unichar_tolower (0x1C5) != 0x1C6)
- return FAILED ("#3");
- if (g_unichar_tolower (0x1F1) != 0x1F3)
- return FAILED ("#4");
- if (g_unichar_tolower (0x1F2) != 0x1F3)
- return FAILED ("#5");
- if (g_unichar_tolower (0xFFFF) != 0xFFFF)
- return FAILED ("#6");
- return NULL;
-}
-
-/*
- * g_unichar_totitle
- */
-RESULT
-test_g_unichar_totitle ()
-{
- if (g_unichar_toupper (0) != 0)
- return FAILED ("#0");
- if (g_unichar_totitle ('a') != 'A')
- return FAILED ("#1");
- if (g_unichar_totitle ('1') != '1')
- return FAILED ("#2");
- if (g_unichar_totitle (0x1C4) != 0x1C5)
- return FAILED ("#3");
- if (g_unichar_totitle (0x1F2) != 0x1F2)
- return FAILED ("#4");
- if (g_unichar_totitle (0x1F3) != 0x1F2)
- return FAILED ("#5");
- if (g_unichar_toupper (0xFFFF) != 0xFFFF)
- return FAILED ("#6");
- return NULL;
-}
-
-static Test unicode_tests [] = {
- {"g_unichar_type", test_g_unichar_type},
- {"g_unichar_toupper", test_g_unichar_toupper},
- {"g_unichar_tolower", test_g_unichar_tolower},
- {"g_unichar_totitle", test_g_unichar_totitle},
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(unicode_tests_init, unicode_tests)
+++ /dev/null
-#include <stdlib.h>
-
-#include "test.h"
-
-/*
- * g_utf16_to_utf8
- */
-
-glong
-compare_strings_utf8_pos (const gchar *expected, const gchar *actual, glong size)
-{
- int i;
- for (i = 0; i < size; i++)
- if (expected [i] != actual [i])
- return i;
- return -1;
-}
-
-RESULT
-compare_strings_utf8_RESULT (const gchar *expected, const gchar *actual, glong size)
-{
- glong ret;
-
- ret = compare_strings_utf8_pos (expected, actual, size);
- if (ret < 0)
- return OK;
- return FAILED ("Incorrect output: expected '%s' but was '%s', differ at %d\n", expected, actual, ret);
-}
-
-void
-gchar_to_gunichar2 (gunichar2 ret[], const gchar *src)
-{
- int i;
-
- for (i = 0; src [i]; i++)
- ret [i] = src [i];
- ret [i] = 0;
-}
-
-RESULT
-compare_utf16_to_utf8_explicit (const gchar *expected, const gunichar2 *utf16, glong len_in, glong len_out, glong size_spec)
-{
- GError *error;
- gchar* ret;
- RESULT result;
- glong in_read, out_read;
-
- result = NULL;
-
- error = NULL;
- ret = g_utf16_to_utf8 (utf16, size_spec, &in_read, &out_read, &error);
- if (error) {
- result = FAILED ("The error is %d %s\n", (error)->code, (error)->message);
- g_error_free (error);
- if (ret)
- g_free (ret);
- return result;
- }
- if (in_read != len_in)
- result = FAILED ("Read size is incorrect: expected %d but was %d\n", len_in, in_read);
- else if (out_read != len_out)
- result = FAILED ("Converted size is incorrect: expected %d but was %d\n", len_out, out_read);
- else
- result = compare_strings_utf8_RESULT (expected, ret, len_out);
-
- g_free (ret);
- if (result)
- return result;
-
- return OK;
-}
-
-RESULT
-compare_utf16_to_utf8 (const gchar *expected, const gunichar2 *utf16, glong len_in, glong len_out)
-{
- RESULT result;
-
- result = compare_utf16_to_utf8_explicit (expected, utf16, len_in, len_out, -1);
- if (result != OK)
- return result;
- return compare_utf16_to_utf8_explicit (expected, utf16, len_in, len_out, len_in);
-}
-
-RESULT
-test_utf16_to_utf8 ()
-{
- const gchar *src0 = "", *src1 = "ABCDE", *src2 = "\xE5\xB9\xB4\x27", *src3 = "\xEF\xBC\xA1", *src4 = "\xEF\xBD\x81", *src5 = "\xF0\x90\x90\x80";
- gunichar2 str0 [] = {0}, str1 [6], str2 [] = {0x5E74, 39, 0}, str3 [] = {0xFF21, 0}, str4 [] = {0xFF41, 0}, str5 [] = {0xD801, 0xDC00, 0};
- RESULT result;
-
- gchar_to_gunichar2 (str1, src1);
-
- /* empty string */
- result = compare_utf16_to_utf8 (src0, str0, 0, 0);
- if (result != OK)
- return result;
-
- result = compare_utf16_to_utf8 (src1, str1, 5, 5);
- if (result != OK)
- return result;
- result = compare_utf16_to_utf8 (src2, str2, 2, 4);
- if (result != OK)
- return result;
- result = compare_utf16_to_utf8 (src3, str3, 1, 3);
- if (result != OK)
- return result;
- result = compare_utf16_to_utf8 (src4, str4, 1, 3);
- if (result != OK)
- return result;
- result = compare_utf16_to_utf8 (src5, str5, 2, 4);
- if (result != OK)
- return result;
-
- return OK;
-}
-
-/*
- * g_utf8_to_utf16
- */
-
-glong
-compare_strings_utf16_pos (const gunichar2 *expected, const gunichar2 *actual, glong size)
-{
- int i;
- for (i = 0; i < size; i++)
- if (expected [i] != actual [i])
- return i;
- return -1;
-}
-
-RESULT
-compare_strings_utf16_RESULT (const gunichar2 *expected, const gunichar2 *actual, glong size)
-{
- glong ret;
-
- ret = compare_strings_utf16_pos (expected, actual, size);
- if (ret < 0)
- return OK;
- return FAILED ("Incorrect output: expected '%s' but was '%s', differ at %d ('%c' x '%c')\n", expected, actual, ret, expected [ret], actual [ret]);
-}
-
-#if !defined(EGLIB_TESTS)
-#define eg_utf8_to_utf16_with_nuls g_utf8_to_utf16
-#endif
-
-RESULT
-compare_utf8_to_utf16_explicit (const gunichar2 *expected, const gchar *utf8, glong len_in, glong len_out, glong size_spec, gboolean include_nuls)
-{
- GError *error;
- gunichar2* ret;
- RESULT result;
- glong in_read, out_read;
-
- result = NULL;
-
- error = NULL;
- if (include_nuls)
- ret = eg_utf8_to_utf16_with_nuls (utf8, size_spec, &in_read, &out_read, &error);
- else
- ret = g_utf8_to_utf16 (utf8, size_spec, &in_read, &out_read, &error);
-
- if (error) {
- result = FAILED ("The error is %d %s\n", (error)->code, (error)->message);
- g_error_free (error);
- if (ret)
- g_free (ret);
- return result;
- }
- if (in_read != len_in)
- result = FAILED ("Read size is incorrect: expected %d but was %d\n", len_in, in_read);
- else if (out_read != len_out)
- result = FAILED ("Converted size is incorrect: expected %d but was %d\n", len_out, out_read);
- else
- result = compare_strings_utf16_RESULT (expected, ret, len_out);
-
- g_free (ret);
- if (result)
- return result;
-
- return OK;
-}
-
-RESULT
-compare_utf8_to_utf16_general (const gunichar2 *expected, const gchar *utf8, glong len_in, glong len_out, gboolean include_nuls)
-{
- RESULT result;
-
- result = compare_utf8_to_utf16_explicit (expected, utf8, len_in, len_out, -1, include_nuls);
- if (result != OK)
- return result;
- return compare_utf8_to_utf16_explicit (expected, utf8, len_in, len_out, len_in, include_nuls);
-}
-
-RESULT
-compare_utf8_to_utf16 (const gunichar2 *expected, const gchar *utf8, glong len_in, glong len_out)
-{
- return compare_utf8_to_utf16_general (expected, utf8, len_in, len_out, FALSE);
-}
-
-RESULT
-compare_utf8_to_utf16_with_nuls (const gunichar2 *expected, const gchar *utf8, glong len_in, glong len_out)
-{
- return compare_utf8_to_utf16_explicit (expected, utf8, len_in, len_out, len_in, TRUE);
-}
-
-
-RESULT
-test_utf8_seq ()
-{
- const gchar *src = "\xE5\xB9\xB4\x27";
- glong in_read, out_read;
- //gunichar2 expected [6];
- GError *error = NULL;
- gunichar2 *dst;
-
- //printf ("got: %s\n", src);
- dst = g_utf8_to_utf16 (src, (glong)strlen (src), &in_read, &out_read, &error);
- if (error != NULL){
- return error->message;
- }
-
- if (in_read != 4) {
- return FAILED ("in_read is expected to be 4 but was %d\n", in_read);
- }
- if (out_read != 2) {
- return FAILED ("out_read is expected to be 2 but was %d\n", out_read);
- }
- g_free (dst);
-
- return OK;
-}
-
-RESULT
-test_utf8_to_utf16 ()
-{
- const gchar *src0 = "", *src1 = "ABCDE", *src2 = "\xE5\xB9\xB4\x27", *src3 = "\xEF\xBC\xA1", *src4 = "\xEF\xBD\x81";
- gunichar2 str0 [] = {0}, str1 [6], str2 [] = {0x5E74, 39, 0}, str3 [] = {0xFF21, 0}, str4 [] = {0xFF41, 0};
- RESULT result;
-
- gchar_to_gunichar2 (str1, src1);
-
- /* empty string */
- result = compare_utf8_to_utf16 (str0, src0, 0, 0);
- if (result != OK)
- return result;
-
- result = compare_utf8_to_utf16 (str1, src1, 5, 5);
- if (result != OK)
- return result;
- result = compare_utf8_to_utf16 (str2, src2, 4, 2);
- if (result != OK)
- return result;
- result = compare_utf8_to_utf16 (str3, src3, 3, 1);
- if (result != OK)
- return result;
- result = compare_utf8_to_utf16 (str4, src4, 3, 1);
- if (result != OK)
- return result;
-
- return OK;
-}
-
-RESULT
-test_utf8_to_utf16_with_nuls ()
-{
- const gchar *src0 = "", *src1 = "AB\0DE", *src2 = "\xE5\xB9\xB4\x27", *src3 = "\xEF\xBC\xA1", *src4 = "\xEF\xBD\x81";
- gunichar2 str0 [] = {0}, str1 [] = {'A', 'B', 0, 'D', 'E', 0}, str2 [] = {0x5E74, 39, 0}, str3 [] = {0xFF21, 0}, str4 [] = {0xFF41, 0};
- RESULT result;
-
-#if !defined(EGLIB_TESTS)
- return OK;
-#endif
-
- /* implicit length is forbidden */
- if (eg_utf8_to_utf16_with_nuls (src1, -1, NULL, NULL, NULL) != NULL)
- return FAILED ("explicit nulls must fail with -1 length\n");
-
- /* empty string */
- result = compare_utf8_to_utf16_with_nuls (str0, src0, 0, 0);
- if (result != OK)
- return result;
-
- result = compare_utf8_to_utf16_with_nuls (str1, src1, 5, 5);
- if (result != OK)
- return result;
- result = compare_utf8_to_utf16_with_nuls (str2, src2, 4, 2);
- if (result != OK)
- return result;
- result = compare_utf8_to_utf16_with_nuls (str3, src3, 3, 1);
- if (result != OK)
- return result;
- result = compare_utf8_to_utf16_with_nuls (str4, src4, 3, 1);
- if (result != OK)
- return result;
-
- return OK;
-}
-
-typedef struct {
- char *content;
- size_t length;
-} convert_result_t;
-
-RESULT
-test_convert ()
-{
- static const char *charsets[] = { "UTF-8", "UTF-16LE", "UTF-16BE", "UTF-32LE", "UTF-32BE" };
- gsize length, converted_length, n;
- char *content, *converted, *path;
- convert_result_t **expected;
- GError *err = NULL;
- const char *srcdir;
- gboolean loaded;
- guint i, j, k;
- char c;
-
- if (!(srcdir = getenv ("srcdir")) && !(srcdir = getenv ("PWD")))
- return FAILED ("srcdir not defined!");
-
- expected = g_malloc (sizeof (convert_result_t *) * G_N_ELEMENTS (charsets));
-
- /* first load all our test samples... */
- for (i = 0; i < G_N_ELEMENTS (charsets); i++) {
- path = g_strdup_printf ("%s%c%s.txt", srcdir, G_DIR_SEPARATOR, charsets[i]);
- loaded = g_file_get_contents (path, &content, &length, &err);
- g_free (path);
-
- if (!loaded) {
- for (j = 0; j < i; j++) {
- g_free (expected[j]->content);
- g_free (expected[j]);
- }
-
- g_free (expected);
-
- return FAILED ("Failed to load content for %s: %s", charsets[i], err->message);
- }
-
- expected[i] = g_malloc (sizeof (convert_result_t));
- expected[i]->content = content;
- expected[i]->length = length;
- }
-
- /* test conversion from every charset to every other charset */
- for (i = 0; i < G_N_ELEMENTS (charsets); i++) {
- for (j = 0; j < G_N_ELEMENTS (charsets); j++) {
- converted = g_convert (expected[i]->content, expected[i]->length, charsets[j],
- charsets[i], NULL, &converted_length, NULL);
-
- if (converted == NULL) {
- for (k = 0; k < G_N_ELEMENTS (charsets); k++) {
- g_free (expected[k]->content);
- g_free (expected[k]);
- }
-
- g_free (expected);
-
- return FAILED ("Failed to convert from %s to %s: NULL", charsets[i], charsets[j]);
- }
-
- if (converted_length != expected[j]->length) {
- length = expected[j]->length;
-
- for (k = 0; k < G_N_ELEMENTS (charsets); k++) {
- g_free (expected[k]->content);
- g_free (expected[k]);
- }
-
- g_free (converted);
- g_free (expected);
-
- return FAILED ("Failed to convert from %s to %s: expected %u bytes, got %u",
- charsets[i], charsets[j], length, converted_length);
- }
-
- for (n = 0; n < converted_length; n++) {
- if (converted[n] != expected[j]->content[n]) {
- c = expected[j]->content[n];
-
- for (k = 0; k < G_N_ELEMENTS (charsets); k++) {
- g_free (expected[k]->content);
- g_free (expected[k]);
- }
-
- g_free (converted);
- g_free (expected);
-
- return FAILED ("Failed to convert from %s to %s: expected 0x%x at offset %u, got 0x%x",
- charsets[i], charsets[j], c, n, converted[n]);
- }
- }
-
- g_free (converted);
- }
- }
-
- for (k = 0; k < G_N_ELEMENTS (charsets); k++) {
- g_free (expected[k]->content);
- g_free (expected[k]);
- }
-
- g_free (expected);
-
- return OK;
-}
-
-
-RESULT
-test_xdigit ()
-{
- static char test_chars[] = {
- '0', '1', '2', '3', '4',
- '5', '6', '7', '8', '9',
- 'a', 'b', 'c', 'd', 'e', 'f', 'g',
- 'A', 'B', 'C', 'D', 'E', 'F', 'G'};
- static gint32 test_values[] = {
- 0, 1, 2, 3, 4,
- 5, 6, 7, 8, 9,
- 10, 11, 12, 13, 14, 15, -1,
- 10, 11, 12, 13, 14, 15, -1};
-
- int i =0;
-
- for (i = 0; i < sizeof(test_chars); i++)
- if (g_unichar_xdigit_value ((gunichar)test_chars[i]) != test_values[i])
- return FAILED("Incorrect value %d at index %d", test_values[i], i);
-
- return OK;
-}
-
-static RESULT
-ucs4_to_utf16_check_result (const gunichar2 *result_str, const gunichar2 *expected_str,
- glong result_items_read, glong expected_items_read,
- glong result_items_written, glong expected_items_written,
- GError* result_error, gboolean expect_error)
-{
- glong i;
- if (result_items_read != expected_items_read)
- return FAILED("Incorrect number of items read; expected %d, got %d", expected_items_read, result_items_read);
- if (result_items_written != expected_items_written)
- return FAILED("Incorrect number of items written; expected %d, got %d", expected_items_written, result_items_written);
- if (result_error && !expect_error)
- return FAILED("There should not be an error code.");
- if (!result_error && expect_error)
- return FAILED("Unexpected error object.");
- if (expect_error && result_str)
- return FAILED("NULL should be returned when an error occurs.");
- if (!expect_error && !result_str)
- return FAILED("When no error occurs NULL should not be returned.");
- for (i=0; i<expected_items_written;i++) {
- if (result_str [i] != expected_str [i])
- return FAILED("Incorrect value %d at index %d", result_str [i], i);
- }
- if (result_str && result_str[expected_items_written] != '\0')
- return FAILED("Null termination not found at the end of the string.");
-
- return OK;
-}
-
-RESULT
-test_ucs4_to_utf16 ()
-{
- static gunichar str1[12] = {'H','e','l','l','o',' ','W','o','r','l','d','\0'};
- static gunichar2 exp1[12] = {'H','e','l','l','o',' ','W','o','r','l','d','\0'};
- static gunichar str2[3] = {'h',0x80000000,'\0'};
- static gunichar2 exp2[2] = {'h','\0'};
- static gunichar str3[3] = {'h',0xDA00,'\0'};
- static gunichar str4[3] = {'h',0x10FFFF,'\0'};
- static gunichar2 exp4[4] = {'h',0xdbff,0xdfff,'\0'};
- static gunichar str5[7] = {0xD7FF,0xD800,0xDFFF,0xE000,0x110000,0x10FFFF,'\0'};
- static gunichar2 exp5[5] = {0xD7FF,0xE000,0xdbff,0xdfff,'\0'};
- static gunichar str6[2] = {0x10400, '\0'};
- static gunichar2 exp6[3] = {0xD801, 0xDC00, '\0'};
- static glong read_write[12] = {1,1,0,0,0,0,1,1,0,0,1,2};
- gunichar2* res;
- glong items_read, items_written, current_write_index;
- GError* err=0;
- RESULT check_result;
- glong i;
-
- res = g_ucs4_to_utf16 (str1, 12, &items_read, &items_written, &err);
- check_result = ucs4_to_utf16_check_result (res, exp1, items_read, 11, items_written, 11, err, FALSE);
- if (check_result) return check_result;
- g_free (res);
-
- items_read = items_written = 0;
- res = g_ucs4_to_utf16 (str2, 0, &items_read, &items_written, &err);
- check_result = ucs4_to_utf16_check_result (res, exp2, items_read, 0, items_written, 0, err, FALSE);
- if (check_result) return check_result;
- g_free (res);
-
- items_read = items_written = 0;
- res = g_ucs4_to_utf16 (str2, 1, &items_read, &items_written, &err);
- check_result = ucs4_to_utf16_check_result (res, exp2, items_read, 1, items_written, 1, err, FALSE);
- if (check_result) return check_result;
- g_free (res);
-
- items_read = items_written = 0;
- res = g_ucs4_to_utf16 (str2, 2, &items_read, &items_written, &err);
- check_result = ucs4_to_utf16_check_result (res, 0, items_read, 1, items_written, 0, err, TRUE);
- g_free (res);
- if (check_result) return check_result;
-
- items_read = items_written = 0;
- err = 0;
- res = g_ucs4_to_utf16 (str3, 2, &items_read, &items_written, &err);
- check_result = ucs4_to_utf16_check_result (res, 0, items_read, 1, items_written, 0, err, TRUE);
- if (check_result) return check_result;
- g_free (res);
-
- items_read = items_written = 0;
- err = 0;
- res = g_ucs4_to_utf16 (str4, 5, &items_read, &items_written, &err);
- check_result = ucs4_to_utf16_check_result (res, exp4, items_read, 2, items_written, 3, err, FALSE);
- if (check_result) return check_result;
- g_free (res);
-
- // This loop tests the bounds of the conversion algorithm
- current_write_index = 0;
- for (i=0;i<6;i++) {
- items_read = items_written = 0;
- err = 0;
- res = g_ucs4_to_utf16 (&str5[i], 1, &items_read, &items_written, &err);
- check_result = ucs4_to_utf16_check_result (res, &exp5[current_write_index],
- items_read, read_write[i*2], items_written, read_write[(i*2)+1], err, !read_write[(i*2)+1]);
- if (check_result) return check_result;
- g_free (res);
- current_write_index += items_written;
- }
-
- items_read = items_written = 0;
- err = 0;
- res = g_ucs4_to_utf16 (str6, 1, &items_read, &items_written, &err);
- check_result = ucs4_to_utf16_check_result (res, exp6, items_read, 1, items_written, 2, err, FALSE);
- if (check_result) return check_result;
- g_free (res);
-
- return OK;
-}
-
-static RESULT
-utf16_to_ucs4_check_result (const gunichar *result_str, const gunichar *expected_str,
- glong result_items_read, glong expected_items_read,
- glong result_items_written, glong expected_items_written,
- GError* result_error, gboolean expect_error)
-{
- glong i;
- if (result_items_read != expected_items_read)
- return FAILED("Incorrect number of items read; expected %d, got %d", expected_items_read, result_items_read);
- if (result_items_written != expected_items_written)
- return FAILED("Incorrect number of items written; expected %d, got %d", expected_items_written, result_items_written);
- if (result_error && !expect_error)
- return FAILED("There should not be an error code.");
- if (!result_error && expect_error)
- return FAILED("Unexpected error object.");
- if (expect_error && result_str)
- return FAILED("NULL should be returned when an error occurs.");
- if (!expect_error && !result_str)
- return FAILED("When no error occurs NULL should not be returned.");
- for (i=0; i<expected_items_written;i++) {
- if (result_str [i] != expected_str [i])
- return FAILED("Incorrect value %d at index %d", result_str [i], i);
- }
- if (result_str && result_str[expected_items_written] != '\0')
- return FAILED("Null termination not found at the end of the string.");
-
- return OK;
-}
-
-RESULT
-test_utf16_to_ucs4 ()
-{
- static gunichar2 str1[12] = {'H','e','l','l','o',' ','W','o','r','l','d','\0'};
- static gunichar exp1[12] = {'H','e','l','l','o',' ','W','o','r','l','d','\0'};
- static gunichar2 str2[7] = {'H', 0xD800, 0xDC01,0xD800,0xDBFF,'l','\0'};
- static gunichar exp2[3] = {'H',0x00010001,'\0'};
- static gunichar2 str3[4] = {'H', 0xDC00 ,'l','\0'};
- static gunichar exp3[2] = {'H','\0'};
- static gunichar2 str4[20] = {0xDC00,0xDFFF,0xDFF,0xD800,0xDBFF,0xD800,0xDC00,0xD800,0xDFFF,
- 0xD800,0xE000,0xDBFF,0xDBFF,0xDBFF,0xDC00,0xDBFF,0xDFFF,0xDBFF,0xE000,'\0'};
- static gunichar exp4[6] = {0xDFF,0x10000,0x103ff,0x10fc00,0x10FFFF,'\0'};
- static gunichar2 str5[3] = {0xD801, 0xDC00, 0};
- static gunichar exp5[2] = {0x10400, 0};
- static glong read_write[33] = {1,0,0,1,0,0,1,1,1,2,1,0,2,2,1,2,2,1,2,1,0,2,1,0,2,2,1,2,2,1,2,1,0};
- gunichar* res;
- glong items_read, items_written, current_read_index,current_write_index;
- GError* err=0;
- RESULT check_result;
- glong i;
-
- res = g_utf16_to_ucs4 (str1, 12, &items_read, &items_written, &err);
- check_result = utf16_to_ucs4_check_result (res, exp1, items_read, 11, items_written, 11, err, FALSE);
- if (check_result) return check_result;
- g_free (res);
-
- items_read = items_written = 0;
- res = g_utf16_to_ucs4 (str2, 0, &items_read, &items_written, &err);
- check_result = utf16_to_ucs4_check_result (res, exp2, items_read, 0, items_written, 0, err, FALSE);
- if (check_result) return check_result;
- g_free (res);
-
- items_read = items_written = 0;
- res = g_utf16_to_ucs4 (str2, 1, &items_read, &items_written, &err);
- check_result = utf16_to_ucs4_check_result (res, exp2, items_read, 1, items_written, 1, err, FALSE);
- if (check_result) return check_result;
- g_free (res);
-
- items_read = items_written = 0;
- res = g_utf16_to_ucs4 (str2, 2, &items_read, &items_written, &err);
- check_result = utf16_to_ucs4_check_result (res, exp2, items_read, 1, items_written, 1, err, FALSE);
- if (check_result) return check_result;
- g_free (res);
-
- items_read = items_written = 0;
- res = g_utf16_to_ucs4 (str2, 3, &items_read, &items_written, &err);
- check_result = utf16_to_ucs4_check_result (res, exp2, items_read, 3, items_written, 2, err, FALSE);
- if (check_result) return check_result;
- g_free (res);
-
- items_read = items_written = 0;
- res = g_utf16_to_ucs4 (str2, 4, &items_read, &items_written, &err);
- check_result = utf16_to_ucs4_check_result (res, exp2, items_read, 3, items_written, 2, err, FALSE);
- if (check_result) return check_result;
- g_free (res);
-
- items_read = items_written = 0;
- res = g_utf16_to_ucs4 (str2, 5, &items_read, &items_written, &err);
- check_result = utf16_to_ucs4_check_result (res, exp2, items_read, 4, items_written, 0, err, TRUE);
- if (check_result) return check_result;
- g_free (res);
-
- items_read = items_written = 0;
- err = 0;
- res = g_utf16_to_ucs4 (str3, 5, &items_read, &items_written, &err);
- check_result = utf16_to_ucs4_check_result (res, exp3, items_read, 1, items_written, 0, err, TRUE);
- if (check_result) return check_result;
- g_free (res);
-
- // This loop tests the bounds of the conversion algorithm
- current_read_index = current_write_index = 0;
- for (i=0;i<11;i++) {
- items_read = items_written = 0;
- err = 0;
- res = g_utf16_to_ucs4 (&str4[current_read_index], read_write[i*3], &items_read, &items_written, &err);
- check_result = utf16_to_ucs4_check_result (res, &exp4[current_write_index], items_read,
- read_write[(i*3)+1], items_written, read_write[(i*3)+2], err,
- !read_write[(i*3)+2]);
- if (check_result) return check_result;
- g_free (res);
- current_read_index += read_write[i*3];
- current_write_index += items_written;
- }
-
- items_read = items_written = 0;
- err = 0;
- res = g_utf16_to_ucs4 (str5, 2, &items_read, &items_written, &err);
- check_result = utf16_to_ucs4_check_result (res, exp5, items_read, 2, items_written, 1, err, FALSE);
- if (check_result) return check_result;
- g_free (res);
-
- return OK;
-}
-RESULT
-test_utf8_strlen ()
-{
- gchar word1 [] = {0xC2, 0x82,0x45,0xE1, 0x81, 0x83,0x58,0xF1, 0x82, 0x82, 0x82,'\0'};//Valid, len = 5
- gchar word2 [] = {0xF1, 0x82, 0x82, 0x82,0xC2, 0x82,0x45,0xE1, 0x81, 0x83,0x58,'\0'};//Valid, len = 5
- gchar word3 [] = {'h','e',0xC2, 0x82,0x45,'\0'}; //Valid, len = 4
- gchar word4 [] = {0x62,0xC2, 0x82,0x45,0xE1, 0x81, 0x83,0x58,'\0'}; //Valid, len = 5
-
- glong len = 0;
-
- //Test word1
- len = g_utf8_strlen (word1,-1);
- if (len != 5)
- return FAILED ("Word1 expected length of 5, but was %i", len);
- //Do tests with different values for max parameter.
- len = g_utf8_strlen (word1,1);
- if (len != 0)
- return FAILED ("Word1, max = 1, expected length of 0, but was %i", len);
- len = g_utf8_strlen (word1,2);
- if (len != 1)
- return FAILED ("Word1, max = 1, expected length of 1, but was %i", len);
- len = g_utf8_strlen (word1,3);
- if (len != 2)
- return FAILED ("Word1, max = 2, expected length of 2, but was %i", len);
-
- //Test word2
- len = g_utf8_strlen (word2,-1);
- if (len != 5)
- return FAILED ("Word2 expected length of 5, but was %i", len);
-
- //Test word3
- len = g_utf8_strlen (word3,-1);
- if (len != 4)
- return FAILED ("Word3 expected length of 4, but was %i", len);
-
- //Test word4
- len = g_utf8_strlen (word4,-1);
- if (len != 5)
- return FAILED ("Word4 expected length of 5, but was %i", len);
-
- //Test null case
- len = g_utf8_strlen(NULL,0);
- if (len != 0)
- return FAILED ("Expected passing null to result in a length of 0");
- return OK;
-}
-
-RESULT
-test_utf8_get_char()
-{
- gchar word1 [] = {0xC2, 0x82,0x45,0xE1, 0x81, 0x83,0x58,0xF1, 0x82, 0x82, 0x82,'\0'}; //Valid, len = 5
-
- gunichar value = g_utf8_get_char (&word1 [0]);
- if (value != 0x82UL)
- return FAILED ("Expected value of 0x82, but was %x", value);
- value = g_utf8_get_char (&word1 [2]);
- if (value != 0x45UL)
- return FAILED ("Expected value of 0x45, but was %x", value);
- value = g_utf8_get_char (&word1 [3]);
- if (value != 0x1043UL)
- return FAILED ("Expected value of 0x1043, but was %x", value);
- value = g_utf8_get_char (&word1 [6]);
- if (value != 0x58UL)
- return FAILED ("Expected value of 0x58, but was %x", value);
- value = g_utf8_get_char (&word1 [7]);
- if (value != 0x42082UL)
- return FAILED ("Expected value of 0x42082, but was %x", value);
-
- return OK;
-}
-
-RESULT
-test_utf8_next_char()
-{
- gchar word1 [] = {0xC2, 0x82,0x45,0xE1, 0x81, 0x83,0x58,0xF1, 0x82, 0x82, 0x82,'\0'}; //Valid, len = 5
- gchar word2 [] = {0xF1, 0x82, 0x82, 0x82,0xC2, 0x82,0x45,0xE1, 0x81, 0x83,0x58,'\0'}; //Valid, len = 5
- gchar word1ExpectedValues [] = {0xC2, 0x45,0xE1, 0x58, 0xF1};
- gchar word2ExpectedValues [] = {0xF1, 0xC2, 0x45, 0xE1, 0x58};
-
- gchar* ptr = word1;
- gint count = 0;
- //Test word1
- while (*ptr != 0) {
- if (count > 4)
- return FAILED ("Word1 has gone past its expected length");
- if (*ptr != word1ExpectedValues[count])
- return FAILED ("Word1 has an incorrect next_char at index %i", count);
- ptr = g_utf8_next_char (ptr);
- count++;
- }
-
- //Test word2
- count = 0;
- ptr = word2;
- while (*ptr != 0) {
- if (count > 4)
- return FAILED ("Word2 has gone past its expected length");
- if (*ptr != word2ExpectedValues[count])
- return FAILED ("Word2 has an incorrect next_char at index %i", count);
- ptr = g_utf8_next_char (ptr);
- count++;
- }
-
- return OK;
-}
-
-RESULT
-test_utf8_validate()
-{
- gchar invalidWord1 [] = {0xC3, 0x82, 0xC1,0x90,'\0'}; //Invalid, 1nd oct Can't be 0xC0 or 0xC1
- gchar invalidWord2 [] = {0xC1, 0x89, 0x60, '\0'}; //Invalid, 1st oct can not be 0xC1
- gchar invalidWord3 [] = {0xC2, 0x45,0xE1, 0x81, 0x83,0x58,'\0'}; //Invalid, oct after 0xC2 must be > 0x80
-
- gchar validWord1 [] = {0xC2, 0x82, 0xC3,0xA0,'\0'}; //Valid
- gchar validWord2 [] = {0xC2, 0x82,0x45,0xE1, 0x81, 0x83,0x58,0xF1, 0x82, 0x82, 0x82,'\0'}; //Valid
-
- const gchar* end;
- gboolean retVal = g_utf8_validate (invalidWord1, -1, &end);
- if (retVal != FALSE)
- return FAILED ("Expected invalidWord1 to be invalid");
- if (end != &invalidWord1 [2])
- return FAILED ("Expected end parameter to be pointing to invalidWord1[2]");
-
- end = NULL;
- retVal = g_utf8_validate (invalidWord2, -1, &end);
- if (retVal != FALSE)
- return FAILED ("Expected invalidWord2 to be invalid");
- if (end != &invalidWord2 [0])
- return FAILED ("Expected end parameter to be pointing to invalidWord2[0]");
-
- end = NULL;
- retVal = g_utf8_validate (invalidWord3, -1, &end);
- if (retVal != FALSE)
- return FAILED ("Expected invalidWord3 to be invalid");
- if (end != &invalidWord3 [0])
- return FAILED ("Expected end parameter to be pointing to invalidWord3[1]");
-
- end = NULL;
- retVal = g_utf8_validate (validWord1, -1, &end);
- if (retVal != TRUE)
- return FAILED ("Expected validWord1 to be valid");
- if (end != &validWord1 [4])
- return FAILED ("Expected end parameter to be pointing to validWord1[4]");
-
- end = NULL;
- retVal = g_utf8_validate (validWord2, -1, &end);
- if (retVal != TRUE)
- return FAILED ("Expected validWord2 to be valid");
- if (end != &validWord2 [11])
- return FAILED ("Expected end parameter to be pointing to validWord2[11]");
- return OK;
-}
-
-glong
-utf8_byteslen (const gchar *src)
-{
- int i = 0;
- do {
- if (src [i] == '\0')
- return i;
- i++;
- } while (TRUE);
-}
-
-RESULT
-test_utf8_strcase_each (const gchar *src, const gchar *expected, gboolean strup)
-{
- gchar *tmp;
- glong len, len2;
- RESULT r;
-
- len = utf8_byteslen (src);
- tmp = strup ? g_utf8_strup (src, len) : g_utf8_strdown (src, len);
- len2 = utf8_byteslen (tmp);
- r = compare_strings_utf8_RESULT (expected, tmp, len < len2 ? len2 : len);
- g_free (tmp);
- return r;
-}
-
-RESULT
-test_utf8_strup_each (const gchar *src, const gchar *expected)
-{
- return test_utf8_strcase_each (src, expected, TRUE);
-}
-
-RESULT
-test_utf8_strdown_each (const gchar *src, const gchar *expected)
-{
- return test_utf8_strcase_each (src, expected, FALSE);
-}
-
-/*
- * g_utf8_strup
- */
-RESULT
-test_utf8_strup ()
-{
- RESULT r;
-
- if ((r = test_utf8_strup_each ("aBc", "ABC")) != OK)
- return r;
- if ((r = test_utf8_strup_each ("x86-64", "X86-64")) != OK)
- return r;
- // U+3B1 U+392 -> U+391 U+392
- if ((r = test_utf8_strup_each ("\xCE\xB1\xCE\x92", "\xCE\x91\xCE\x92")) != OK)
- return r;
- // U+FF21 -> U+FF21
- if ((r = test_utf8_strup_each ("\xEF\xBC\xA1", "\xEF\xBC\xA1")) != OK)
- return r;
- // U+FF41 -> U+FF21
- if ((r = test_utf8_strup_each ("\xEF\xBD\x81", "\xEF\xBC\xA1")) != OK)
- return r;
- // U+10428 -> U+10400
- if ((r = test_utf8_strup_each ("\xF0\x90\x90\xA8", "\xF0\x90\x90\x80")) != OK)
- return r;
-
- return OK;
-}
-
-/*
- * g_utf8_strdown
- */
-RESULT
-test_utf8_strdown ()
-{
- RESULT r;
-
- if ((r = test_utf8_strdown_each ("aBc", "abc")) != OK)
- return r;
- if ((r = test_utf8_strdown_each ("X86-64", "x86-64")) != OK)
- return r;
- // U+391 U+3B2 -> U+3B1 U+3B2
- if ((r = test_utf8_strdown_each ("\xCE\x91\xCE\xB2", "\xCE\xB1\xCE\xB2")) != OK)
- return r;
-/*
- // U+FF41 -> U+FF41
- if ((r = test_utf8_strdown_each ("\xEF\xBC\x81", "\xEF\xBC\x81")) != OK)
- return r;
- // U+FF21 -> U+FF41
- if ((r = test_utf8_strdown_each ("\xEF\xBC\xA1", "\xEF\xBD\x81")) != OK)
- return r;
- // U+10400 -> U+10428
- if ((r = test_utf8_strdown_each ("\xF0\x90\x90\x80", "\xF0\x90\x90\xA8")) != OK)
- return r;
-*/
- return OK;
-}
-
-/*
- * test initialization
- */
-
-static Test utf8_tests [] = {
- {"g_utf16_to_utf8", test_utf16_to_utf8},
- {"g_utf8_to_utf16", test_utf8_to_utf16},
- {"g_utf8_to_utf16_with_nuls", test_utf8_to_utf16_with_nuls},
- {"g_utf8_seq", test_utf8_seq},
- {"g_convert", test_convert },
- {"g_unichar_xdigit_value", test_xdigit },
- {"g_ucs4_to_utf16", test_ucs4_to_utf16 },
- {"g_utf16_to_ucs4", test_utf16_to_ucs4 },
- {"g_utf8_strlen", test_utf8_strlen },
- {"g_utf8_get_char", test_utf8_get_char },
- {"g_utf8_next_char", test_utf8_next_char },
- {"g_utf8_validate", test_utf8_validate },
- {"g_utf8_strup", test_utf8_strup},
- {"g_utf8_strdown", test_utf8_strdown},
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(utf8_tests_init, utf8_tests)
-
-
+++ /dev/null
-#!/bin/bash
-
-# Author: Aaron Bockover
-# Licensed under MIT/X11
-# (C) 2006 Novell
-
-if [ "x$1" = "x--help" ]; then
- echo "Usage: $0 [--show-only-mono]"
- echo ""
- echo "This script prints a sorted list of GLib functions used in Mono"
- echo "that have not yet been implemented in EGlib."
- echo ""
- echo "If --show-only-mono is passed, then the script will print all"
- echo "GLib functions used in Mono, whether or not they have been"
- echo "implemented in EGlib yet."
- echo ""
- echo "This script relies on the MONO_CHECKOUT environment variable."
- echo "MONO_CHECKOUT should be set to the location of a mono checkout."
- echo ""
- exit 1
-fi
-
-IGNORE_FUNCTIONS="g_hash_table_lookup_node g_hash_table_foreach_remove_or_steal g_hash_table_resize"
-
-if [ -z $MONO_CHECKOUT ]; then
- if [ -e ../../mono.pc.in ]; then
- MONO_CHECKOUT=../..
- else
- MONO_CHECKOUT=~/cvs/mono/mono
- fi
-fi
-
-if [ ! -d $MONO_CHECKOUT ]; then
- echo "Cannot find mono checkout; set MONO_CHECKOUT"
- exit 1
-fi
-
-MONO_CHECKOUT="$MONO_CHECKOUT/mono"
-RESULTS_FILE=.results
-
-(for i in `find $MONO_CHECKOUT -iregex \.*.c$`; do
- grep -oP "[ \t\(\)]+g_[a-z_]+[ ]{0,1}\([A-Za-z_\&\*\,\(\) ]+\)" $i |
- awk 'BEGIN { FS="(" } { print $1 }' |
- sed -e 's/[^A-Za-z_]//g'
- done
-) > $RESULTS_FILE
-
-if [ ! "x$1" = "x--show-only-mono" ]; then
- IMPLEMENTED_FUNCTIONS=`grep -oP "g_[a-z_]+[ ]{0,1}" ../src/glib.h | awk 'BEGIN { FS="(" } { print $1 }'`
-
- rm -f $RESULTS_FILE.tmp
-
- for mono_function in `cat $RESULTS_FILE`; do
- matched="no"
- for implemented_function in $IMPLEMENTED_FUNCTIONS; do
- if [ "x$mono_function" = "x$implemented_function" ]; then
- matched="yes"
- break
- fi
- done
-
- for ignore_function in $IGNORE_FUNCTIONS; do
- if [ "x$ignore_function" = "x$mono_function" ]; then
- matched="yes"
- break
- fi
- done
-
- if [ "x$matched" = "xno" ]; then
- echo $mono_function >> $RESULTS_FILE.tmp
- fi
- done
-
- mv $RESULTS_FILE.tmp $RESULTS_FILE
-fi
-
-(for i in `cat $RESULTS_FILE | sort -u`; do
- echo "`grep -c $i $RESULTS_FILE` $i";
- done;
-) | sort -nr
-
-rm $RESULTS_FILE
-
+++ /dev/null
-/* config.h. Generated by configure. */
-/* config.h.in. Generated from configure.ac by autoheader. */
-
-#ifndef _MSC_VER
-#include "cygconfig.h"
-#else
-
-#ifndef HAVE_WINAPI_FAMILY_SUPPORT
-
-#define HAVE_WINAPI_FAMILY_SUPPORT
-
-/* WIN API Family support */
-#include <winapifamily.h>
-
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
- #define HAVE_CLASSIC_WINAPI_SUPPORT 1
- #define HAVE_UWP_WINAPI_SUPPORT 0
-#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
- #define HAVE_CLASSIC_WINAPI_SUPPORT 0
- #define HAVE_UWP_WINAPI_SUPPORT 1
-#ifndef HAVE_EXTERN_DEFINED_WINAPI_SUPPORT
- #error Unsupported WINAPI family
-#endif
-#else
- #define HAVE_CLASSIC_WINAPI_SUPPORT 0
- #define HAVE_UWP_WINAPI_SUPPORT 0
-#ifndef HAVE_EXTERN_DEFINED_WINAPI_SUPPORT
- #error Unsupported WINAPI family
-#endif
-#endif
-
-#endif
-
-/* Define to 1 if you have the <dlfcn.h> header file. */
-#define HAVE_DLFCN_H 1
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#define HAVE_INTTYPES_H 1
-
-/* Define to 1 if you have the <memory.h> header file. */
-#define HAVE_MEMORY_H 1
-
-/* Define to 1 if you have the <pwd.h> header file. */
-/* #undef HAVE_PWD_H 1 */
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#define HAVE_STDINT_H 1
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#define HAVE_STDLIB_H 1
-
-/* Define to 1 if you have the <strings.h> header file. */
-#define HAVE_STRINGS_H 1
-
-/* Define to 1 if you have the <string.h> header file. */
-#define HAVE_STRING_H 1
-
-/* Define to 1 if you have the `strlcpy' function. */
-/* #undef HAVE_STRLCPY */
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#define HAVE_SYS_STAT_H 1
-
-/* Define to 1 if you have the <sys/time.h> header file. */
-/* #undef HAVE_SYS_TIME_H */
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#define HAVE_SYS_TYPES_H 1
-
-/* Define to 1 if you have the <sys/wait.h> header file. */
-/* #undef HAVE_SYS_WAIT_H */
-
-/* Define to 1 if you have the <unistd.h> header file. */
-/* #undef HAVE_UNISTD_H */
-
-/* Name of package */
-#define PACKAGE "eglib"
-
-/* Define to the address where bug reports for this package should be sent. */
-#define PACKAGE_BUGREPORT ""
-
-/* Define to the full name of this package. */
-#define PACKAGE_NAME ""
-
-/* Define to the full name and version of this package. */
-#define PACKAGE_STRING ""
-
-/* Define to the one symbol short name of this package. */
-#define PACKAGE_TARNAME ""
-
-/* Define to the version of this package. */
-#define PACKAGE_VERSION ""
-
-/* The size of a `int', as computed by sizeof. */
-#define SIZEOF_INT 4
-
-/* The size of a `void *', as computed by sizeof. */
-#define SIZEOF_VOID_P 4
-
-/* Define to 1 if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
-/* Version number of package */
-#define VERSION "0.1"
-
-#define HAVE_STRTOK_R 1
-#endif
-Subproject commit 1cd7cc5a141a737ee717505923c08d28f5f63c3d
+Subproject commit 2563306d41f7f7fa30421c629d0f3b60b08b1169
-Subproject commit 4ae08e8dd6425fa0936aa43d95966539359b5081
+Subproject commit 47f82456814a05b077e31b58d66c1e4c640aac79
-Subproject commit c76ba7b410447fa37093150cb7bc772cba28a0ae
+Subproject commit 14e17dfbebf5651b5ce70c7fb317e388f8a3a271
-Subproject commit 7e70a4e9236104c350e7d9ca3505225755065569
+Subproject commit cb1b049c95227465c1791b857cb5ba86385d9f29
-Subproject commit 1d7d43603791e0236b56d076578657bee44fef6b
+Subproject commit 3aef9cdd6013fc0620a1817f0b11d8fb90ed2e0f
-Subproject commit 21e445c26c69ac3a2e1441befa02d0bd105ff849
+Subproject commit 305e0f60533d164676099c918fa4dd09c718017b
-Subproject commit dcb0a0534d5104eaf945d3d1f319dc33044b7bbe
+Subproject commit 80b86f340b7f6fb7afe84443214e1cbd7ff70620
/* pointer to a previously allocated heap */
/* object. */
-// Keep somewhat in sync with mono/metadata/profiler.h:enum MonoGCEvent
typedef enum {
GC_EVENT_START,
GC_EVENT_MARK_START,
This is equivalent to the value \[lq]100\[rq].
A value of zero for \f[I]FREQ\f[] effectively disables sampling.
.IP \[bu] 2
+\f[I]heapshot-on-shutdown\f[]: collect heap shot data when the runtime
+shuts down.
+.IP \[bu] 2
\f[I]maxframes=NUM\f[]: when a stack trace needs to be performed,
collect \f[I]NUM\f[] frames at the most.
The default is 32.
and time, then do according to \f[I]OUTSPEC\f[]:
.RS 2
.IP \[bu] 2
-if \f[I]OUTSPEC\f[] begins with a \f[I]|\f[] character, execute the
-rest as a program and feed the data to its standard input
+If \f[I]OUTSPEC\f[] begins with a \f[I]|\f[] character, execute the
+rest as a program and feed the data to its standard input.
.IP \[bu] 2
-if \f[I]OUTSPEC\f[] begins with a \f[I]-\f[] character, use the
-rest of OUTSPEC as the filename, but force overwrite any existing
-file by that name
+If \f[I]OUTSPEC\f[] begins with a \f[I]#\f[] character, parse the
+rest as a file descriptor number, and feed the data to this file
+descriptor.
.IP \[bu] 2
otherwise write the data the the named file: note that is a file by
-that name already exists, a warning is issued and profiling is
-disabled.
+that name already exists, it is truncated.
.RE
.IP \[bu] 2
\f[I]report\f[]: the profiling data is sent to mprof-report, which
.IP \[bu] 2
\f[I]coverage\f[]: collect code coverage data. This implies enabling
the \f[I]calls\f[] option.
-.IP \[bu] 2
-\f[I]onlycoverage\f[]: can only be used with \f[I]coverage\f[]. This
-disables most other events so that the profiler mostly only collects
-coverage data.
.RE
.SS Analyzing the profile data
.PP
Version min_mono_version;
#if __MonoCS__
- min_mono_version = new Version (5, 4);
+ min_mono_version = new Version (5, 5);
#else
min_mono_version = new Version (4, 9);
#endif
MCS_REFERENCES = $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE_DIRECTORY)/%.dll,$(LIB_REFS))
MCS_REFERENCES += $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE_DIRECTORY)/%.exe,$(EXE_REFS))
+ifdef KEYFILE
+LIB_MCS_FLAGS += /keyfile:$(KEYFILE)
+endif
+
ifndef NO_BUILD
all-local: $(the_lib) $(PROGRAM_config)
endif
LIB_MCS_FLAGS += $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE_DIRECTORY)/%.dll,$(LIB_REFS_FULL))
LIB_MCS_FLAGS += $(patsubst %,-r:%.dll, $(subst =,=$(topdir)/class/lib/$(PROFILE_DIRECTORY)/,$(LIB_REFS_ALIAS)))
+ifdef KEYFILE
+KEYFILE_MCS_FLAGS += /keyfile:$(KEYFILE)
+endif
+
ifndef LIBRARY_NAME
LIBRARY_NAME = $(LIBRARY)
endif
case "$(thisdir)" in *"Facades"*) config_file=Facades_$$config_file;; *"legacy"*) config_file=legacy_$$config_file;; esac; \
echo $(thisdir):$$config_file >> $(topdir)/../msvc/scripts/order; \
(echo $(is_boot); \
- echo $(USE_MCS_FLAGS) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS); \
+ echo $(USE_MCS_FLAGS) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) $(KEYFILE_MCS_FLAGS); \
echo $(LIBRARY_NAME); \
echo $(BUILT_SOURCES_cmdline); \
echo $(build_lib); \
ifndef NO_BUILD
$(build_lib): $(response) $(sn) $(BUILT_SOURCES) $(build_libdir)/.stamp $(GEN_RESOURCE_DEPS)
- $(LIBRARY_COMPILE) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) $(GEN_RESOURCE_FLAGS) -target:library -out:$@ $(BUILT_SOURCES_cmdline) @$(response)
+ $(LIBRARY_COMPILE) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) $(KEYFILE_MCS_FLAGS) $(GEN_RESOURCE_FLAGS) -target:library -out:$@ $(BUILT_SOURCES_cmdline) @$(response)
ifdef RESOURCE_STRINGS_FILES
$(Q) $(STRING_REPLACER) $(RESOURCE_STRINGS_FILES) $@
endif
NO_SIGN_ASSEMBLY = yes
NO_TEST = yes
NO_INSTALL = yes
-FRAMEWORK_VERSION = 4.0
+FRAMEWORK_VERSION = 4.5
# Compiler all using same bootstrap compiler
LIBRARY_COMPILE = $(BOOT_COMPILE)
run-test-local: run-test-lib
run-test-ondotnet-local: run-test-ondotnet-lib
-TEST_HARNESS_EXCLUDES = -exclude=$(PLATFORM_TEST_HARNESS_EXCLUDES)$(PROFILE_TEST_HARNESS_EXCLUDES)NotWorking,ValueAdd,CAS,InetAccess
+TEST_HARNESS_EXCLUDES = -exclude=$(PLATFORM_TEST_HARNESS_EXCLUDES)$(PROFILE_TEST_HARNESS_EXCLUDES)NotWorking,CAS
TEST_HARNESS_EXCLUDES_ONDOTNET = /exclude:$(PLATFORM_TEST_HARNESS_EXCLUDES)$(PROFILE_TEST_HARNESS_EXCLUDES)NotDotNet,CAS
NOSHADOW_FLAG =
<AssemblyName>Accessibility</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: AllowPartiallyTrustedCallers]
[assembly: AssemblyDelaySign (true)]
- [assembly: AssemblyKeyFile ("../msfinal.pub")]
[assembly: ImportedFromTypeLib ("Accessibility")]
include ../../build/rules.make
LIBRARY = Accessibility.dll
+KEYFILE = ../msfinal.pub
LIB_MCS_FLAGS =
NO_TEST = yes
[assembly: ComVisible (false)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../mono.pub")]
<AssemblyName>Commons.Xml.Relaxng</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../mono.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
LIBRARY = Commons.Xml.Relaxng.dll
LIB_REFS = System System.Xml
+KEYFILE = ../mono.pub
LIB_MCS_FLAGS = \
$(foreach r, $(OTHER_RES), /resource:$(r),$(notdir $(r)))
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:0618 -nowarn:219 -nowarn:169
[assembly: AssemblyVersion("2.6.0.0")]\r
\r
[assembly: AssemblyDelaySign(true)]\r
-[assembly: AssemblyKeyFile ("SharpZipLib.pub")]\r
LIBRARY_SNK = SharpZipLib.key
LIB_REFS = System System.Xml
+KEYFILE = SharpZipLib.pub
LIB_MCS_FLAGS =
NO_TEST = yes
EXTRA_DISTFILES = SharpZipLib.pub $(LIBRARY_SNK)
[assembly: ComVisible (false)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../msfinal.pub")]
[assembly: AssemblyTitle ("cscompmgd.dll")]
[assembly: AssemblyDefaultAlias ("cscompmgd.dll")]
<AssemblyName>cscompmgd</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
LIBRARY = Cscompmgd.dll
LIB_REFS = System
+KEYFILE = ../msfinal.pub
LIB_MCS_FLAGS =
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:0618 -nowarn:219 -nowarn:169
LIBRARY_NAME = cscompmgd.dll
[assembly: NeutralResourcesLanguage ("en-US")]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../msfinal.pub")]
[assembly: AssemblyTitle ("CustomMarshalers.dll")]
[assembly: AssemblyDescription ("CustomMarshalers.dll")]
<AssemblyName>CustomMarshalers</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
LIBRARY = CustomMarshalers.dll
LIB_REFS = System
+KEYFILE = ../msfinal.pub
LIB_MCS_FLAGS =
NO_TEST = yes
<AssemblyName>Microsoft.Win32.Primitives</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = Microsoft.Win32.Primitives.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>Microsoft.Win32.Registry.AccessControl</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = Microsoft.Win32.Registry.AccessControl.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>Microsoft.Win32.Registry</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = Microsoft.Win32.Registry.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.AppContext</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.AppContext.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Collections.Concurrent</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Collections.Concurrent.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
+++ /dev/null
-MCS_BUILD_DIR = ../../../build
-
-thisdir = class/Facades/System.Collections.Concurrent
-SUBDIRS =
-include $(MCS_BUILD_DIR)/rules.make
-
-LIBRARY_SUBDIR = Facades
-LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
-
-LIBRARY = System.Collections.Concurrent.dll
-
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
-LIB_REFS = System
-LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib
-
-PLATFORM_DEBUG_FLAGS =
-
-NO_TEST = yes
-
-include $(MCS_BUILD_DIR)/library.make
-
-
<AssemblyName>System.Collections.NonGeneric</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Collections.NonGeneric.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Collections.Specialized</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Collections.Specialized.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Collections</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Collections.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System System.Core
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.ComponentModel.Annotations</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.ComponentModel.Annotations.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System.ComponentModel.DataAnnotations
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.ComponentModel.EventBasedAsync</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.ComponentModel.EventBasedAsync.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.ComponentModel.Primitives</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.ComponentModel.Primitives.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.ComponentModel.TypeConverter</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.ComponentModel.TypeConverter.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.ComponentModel</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.ComponentModel.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Console</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Console.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Data.Common</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Data.Common.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System System.Data System.Xml
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Data.SqlClient</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Data.SqlClient.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System System.Data System.Xml
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Diagnostics.Contracts</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Diagnostics.Contracts.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_MCS_FLAGS = $(SIGN_FLAGS)
PLATFORM_DEBUG_FLAGS =
<AssemblyName>System.Diagnostics.Debug</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Diagnostics.Debug.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Diagnostics.FileVersionInfo</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Diagnostics.FileVersionInfo.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Diagnostics.Process</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Diagnostics.Process.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Diagnostics.StackTrace</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Diagnostics.StackTrace.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Diagnostics.TextWriterTraceListener</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Diagnostics.TextWriterTraceListener.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Diagnostics.Tools</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Diagnostics.Tools.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Diagnostics.TraceEvent</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Diagnostics.TraceEvent.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Diagnostics.TraceSource.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Diagnostics.Tracing</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Diagnostics.Tracing.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_MCS_FLAGS = $(SIGN_FLAGS)
PLATFORM_DEBUG_FLAGS =
<AssemblyName>System.Drawing.Primitives</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Drawing.Primitives.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS) $(EXTRA_LIB_MCS_FLAGS)
<AssemblyName>System.Dynamic.Runtime</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Dynamic.Runtime.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System.Core System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Globalization.Calendars</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Globalization.Calendars.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Globalization.Extensions</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Globalization.Extensions.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Globalization</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Globalization.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_MCS_FLAGS = $(SIGN_FLAGS)
PLATFORM_DEBUG_FLAGS =
<AssemblyName>System.IO.Compression.ZipFile</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.IO.Compression.ZipFile.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System System.IO.Compression.FileSystem
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.IO.FileSystem.AccessControl</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.IO.FileSystem.AccessControl.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.IO.FileSystem.DriveInfo</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.IO.FileSystem.DriveInfo.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.IO.FileSystem.Primitives</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.IO.FileSystem.Primitives.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.IO.FileSystem.Watcher</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.IO.FileSystem.Watcher.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.IO.FileSystem</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.IO.FileSystem.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.IO.IsolatedStorage</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.IO.IsolatedStorage.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.IO.MemoryMappedFiles</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.IO.MemoryMappedFiles.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System System.Core
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.IO.Pipes</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.IO.Pipes.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System System.Core
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.IO.UnmanagedMemoryStream</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.IO.UnmanagedMemoryStream.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.IO</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.IO.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Linq.Expressions</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Linq.Expressions.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System.Core
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Linq.Parallel</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Linq.Parallel.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System.Core
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Linq.Queryable</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Linq.Queryable.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System.Core
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Linq</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Linq.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System.Core
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Net.AuthenticationManager</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Net.AuthenticationManager.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Net.Cache</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Net.Cache.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Net.HttpListener</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Net.HttpListener.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Net.Mail</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Net.Mail.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Net.NameResolution</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Net.NameResolution.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Net.NetworkInformation</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Net.NetworkInformation.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
LIBRARY = System.Net.Ping.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Net.Primitives</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Net.Primitives.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Net.Requests</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Net.Requests.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Net.Security</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Net.Security.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Net.ServicePoint</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Net.ServicePoint.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Net.Sockets</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Net.Sockets.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Net.Utilities</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Net.Utilities.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Net.WebHeaderCollection</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Net.WebHeaderCollection.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Net.WebSockets.Client</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Net.WebSockets.Client.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Net.WebSockets</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Net.WebSockets.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.ObjectModel</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.ObjectModel.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
LIBRARY = System.Reflection.DispatchProxy.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS) /unsafe
<AssemblyName>System.Reflection.Emit.ILGeneration</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Reflection.Emit.ILGeneration.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_MCS_FLAGS = $(SIGN_FLAGS)
PLATFORM_DEBUG_FLAGS =
<AssemblyName>System.Reflection.Emit.Lightweight</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Reflection.Emit.Lightweight.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_MCS_FLAGS = $(SIGN_FLAGS)
PLATFORM_DEBUG_FLAGS =
<AssemblyName>System.Reflection.Emit</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Reflection.Emit.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_MCS_FLAGS = $(SIGN_FLAGS)
PLATFORM_DEBUG_FLAGS =
<AssemblyName>System.Reflection.Extensions</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Reflection.Extensions.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_MCS_FLAGS = $(SIGN_FLAGS)
PLATFORM_DEBUG_FLAGS =
<AssemblyName>System.Reflection.Primitives</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Reflection.Primitives.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_MCS_FLAGS = $(SIGN_FLAGS)
PLATFORM_DEBUG_FLAGS =
<AssemblyName>System.Reflection.TypeExtensions</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Reflection.TypeExtensions.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Reflection</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Reflection.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_MCS_FLAGS = $(SIGN_FLAGS)
PLATFORM_DEBUG_FLAGS =
<AssemblyName>System.Resources.ReaderWriter</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Resources.ReaderWriter.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Resources.ResourceManager</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Resources.ResourceManager.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_MCS_FLAGS = $(SIGN_FLAGS)
PLATFORM_DEBUG_FLAGS =
<AssemblyName>System.Runtime.CompilerServices.VisualC</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Runtime.CompilerServices.VisualC.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Runtime.Extensions</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Runtime.Extensions.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Runtime.Handles</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Runtime.Handles.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System System.Core
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Runtime.InteropServices.RuntimeInformation</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
RESX_RESOURCE_STRING = ../../../../external/corefx/src/System.Runtime.InteropServices.RuntimeInformation/src/Resources/Strings.resx
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699,436
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699,436
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS) /unsafe
<AssemblyName>System.Runtime.InteropServices.WindowsRuntime</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Runtime.InteropServices.WindowsRuntime.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_MCS_FLAGS = $(SIGN_FLAGS)
PLATFORM_DEBUG_FLAGS =
<AssemblyName>System.Runtime.InteropServices</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Runtime.InteropServices.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System System.Core
LIB_MCS_FLAGS = $(SIGN_FLAGS)
LIBRARY = System.Runtime.Loader.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS) /unsafe
<AssemblyName>System.Runtime.Numerics</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Runtime.Numerics.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System.Numerics
LIB_MCS_FLAGS = $(SIGN_FLAGS)
LIBRARY = System.Runtime.Serialization.Formatters.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Runtime.Serialization.Json</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Runtime.Serialization.Json.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System.Runtime.Serialization
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Runtime.Serialization.Primitives</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Runtime.Serialization.Primitives.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System.Runtime.Serialization
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Runtime.Serialization.Xml</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Runtime.Serialization.Xml.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System System.Runtime.Serialization System.Xml Facades/System.Runtime.Serialization.Primitives
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Runtime</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Runtime.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System System.ComponentModel.Composition System.Core
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Security.AccessControl</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Security.AccessControl.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Security.Claims</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Security.Claims.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Security.Cryptography.Algorithms</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Security.Cryptography.Algorithms.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System System.Core
LIB_MCS_FLAGS = $(SIGN_FLAGS)
LIBRARY = System.Security.Cryptography.Cng.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System System.Core
LIB_MCS_FLAGS = $(SIGN_FLAGS)
LIBRARY = System.Security.Cryptography.Csp.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Security.Cryptography.DeriveBytes</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Security.Cryptography.DeriveBytes.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Security.Cryptography.Encoding</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Security.Cryptography.Encoding.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Security.Cryptography.Encryption.Aes</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Security.Cryptography.Encryption.Aes.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Security.Cryptography.Encryption.ECDiffieHellman</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Security.Cryptography.Encryption.ECDiffieHellman.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System System.Core
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Security.Cryptography.Encryption.ECDsa</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Security.Cryptography.Encryption.ECDsa.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System System.Core
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Security.Cryptography.Encryption</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Security.Cryptography.Encryption.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Security.Cryptography.Hashing.Algorithms</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Security.Cryptography.Hashing.Algorithms.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Security.Cryptography.Hashing</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Security.Cryptography.Hashing.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
LIBRARY = System.Security.Cryptography.OpenSsl.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System.Core Facades/System.Security.Cryptography.Algorithms
LIB_MCS_FLAGS = $(SIGN_FLAGS)
LIBRARY = System.Security.Cryptography.Pkcs.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System System.Security
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Security.Cryptography.Primitives</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Security.Cryptography.Primitives.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Security.Cryptography.ProtectedData</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Security.Cryptography.ProtectedData.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System System.Security
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Security.Cryptography.RSA</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Security.Cryptography.RSA.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Security.Cryptography.RandomNumberGenerator</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Security.Cryptography.RandomNumberGenerator.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Security.Cryptography.X509Certificates</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Security.Cryptography.X509Certificates.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System System.Core
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Security.Principal.Windows</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Security.Principal.Windows.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Security.Principal</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Security.Principal.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_MCS_FLAGS = $(SIGN_FLAGS)
PLATFORM_DEBUG_FLAGS =
<AssemblyName>System.Security.SecureString</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Security.SecureString.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.ServiceModel.Duplex</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.ServiceModel.Duplex.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System.ServiceModel
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.ServiceModel.Http</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.ServiceModel.Http.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System.ServiceModel
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.ServiceModel.NetTcp</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.ServiceModel.NetTcp.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System.ServiceModel
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.ServiceModel.Primitives</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.ServiceModel.Primitives.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System System.ServiceModel System.Xml System.IdentityModel Facades/System.Security.Cryptography.X509Certificates
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.ServiceModel.Security</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.ServiceModel.Security.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System.ServiceModel
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.ServiceProcess.ServiceController</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.ServiceProcess.ServiceController.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
ifneq (2.1, $(FRAMEWORK_VERSION))
<AssemblyName>System.Text.Encoding.CodePages</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Text.Encoding.CodePages.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Text.Encoding.Extensions</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Text.Encoding.Extensions.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_MCS_FLAGS = $(SIGN_FLAGS)
PLATFORM_DEBUG_FLAGS =
<AssemblyName>System.Text.Encoding</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Text.Encoding.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_MCS_FLAGS = $(SIGN_FLAGS)
PLATFORM_DEBUG_FLAGS =
<AssemblyName>System.Text.RegularExpressions</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Text.RegularExpressions.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Threading.AccessControl</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Threading.AccessControl.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Threading.Overlapped</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Threading.Overlapped.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Threading.Tasks.Parallel</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Threading.Tasks.Parallel.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_MCS_FLAGS = $(SIGN_FLAGS)
PLATFORM_DEBUG_FLAGS =
<AssemblyName>System.Threading.Tasks</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Threading.Tasks.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System.Core
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Threading.Thread</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Threading.Thread.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Threading.ThreadPool</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Threading.ThreadPool.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Threading.Timer</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Threading.Timer.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System System.Core
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Threading</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Threading.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System System.Core
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.ValueTuple</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../Open.snk</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.ValueTuple.dll
-KEY_FILE = ../../Open.snk
-LIBRARY_SNK = $(KEY_FILE)
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../Open.snk
+LIBRARY_SNK = $(KEYFILE)
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS =
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Xml.ReaderWriter.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System.Xml
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Xml.XDocument</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Xml.XDocument.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System.Xml.Linq System.Xml
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Xml.XPath.XDocument</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Xml.XPath.XDocument.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System System.Xml System.Xml.Linq
LIB_MCS_FLAGS = $(SIGN_FLAGS)
LIBRARY = System.Xml.XPath.XmlDocument.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System System.Xml
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Xml.XPath</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Xml.XPath.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System System.Xml
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Xml.XmlDocument</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Xml.XmlDocument.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System System.Xml
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Xml.XmlSerializer</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Xml.XmlSerializer.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System.Xml
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>System.Xml.Xsl.Primitives</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = System.Xml.Xsl.Primitives.dll
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+KEYFILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System System.Xml
LIB_MCS_FLAGS = $(SIGN_FLAGS)
<AssemblyName>netstandard</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../Open.snk</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIBRARY = netstandard.dll
-KEY_FILE = ../../Open.snk
-LIBRARY_SNK = $(KEY_FILE)
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 /nowarn:618
+KEYFILE = ../../Open.snk
+LIBRARY_SNK = $(KEYFILE)
+SIGN_FLAGS = /delaysign /nowarn:1616,1699 /nowarn:618
LIB_REFS = System System.Xml System.Xml.Linq System.Runtime.Serialization System.Core System.Numerics System.Numerics.Vectors System.Net.Http System.Transactions \
System.IO.Compression System.Data System.ComponentModel.Composition System.IO.Compression.FileSystem Facades/System.Runtime.InteropServices.RuntimeInformation \
Facades/System.Security.Cryptography.Algorithms Facades/System.Globalization.Extensions Facades/System.Data.Common \
*/
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../../mono.pub")]
<AssemblyName>I18N.CJK</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../../mono.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
LIBRARY = I18N.CJK.dll
LIB_REFS = I18N
+KEYFILE = ../../mono.pub
LOCAL_MCS_FLAGS = /unsafe /resource:big5.table /resource:gb2312.table /resource:jis.table /resource:ks.table /resource:gb18030.table /define:DISABLE_UNSAFE
TEST_LIB_REFS = I18N
<AssemblyName>I18N</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../../mono.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
include ../../../build/rules.make
LIBRARY = I18N.dll
+KEYFILE = ../../mono.pub
LOCAL_MCS_FLAGS = /unsafe /define:DISABLE_UNSAFE
NO_TEST = yes
<AssemblyName>I18N.MidEast</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../../mono.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
LIBRARY = I18N.MidEast.dll
LIB_REFS = I18N
+KEYFILE = ../../mono.pub
LOCAL_MCS_FLAGS = /unsafe
TEST_LIB_REFS = I18N
<AssemblyName>I18N.Other</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../../mono.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
LIBRARY = I18N.Other.dll
LIB_REFS = I18N
+KEYFILE = ../../mono.pub
LOCAL_MCS_FLAGS = /unsafe
NO_TEST = yes
<AssemblyName>I18N.Rare</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../../mono.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
LIBRARY = I18N.Rare.dll
LIB_REFS = I18N
+KEYFILE = ../../mono.pub
LOCAL_MCS_FLAGS = /unsafe
NO_TEST = yes
<AssemblyName>I18N.West</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../../mono.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
LIBRARY = I18N.West.dll
LIB_REFS = I18N
+KEYFILE = ../../mono.pub
LOCAL_MCS_FLAGS = /unsafe
#NO_TEST = yes
[assembly: AssemblyVersion("1.0.0.0")]\r
\r
[assembly: AssemblyDelaySign (true)]\r
-[assembly: AssemblyKeyFile ("ibm.pub")]\r
<AssemblyName>IBM.Data.DB2</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>ibm.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
LIBRARY = IBM.Data.DB2.dll
LIB_REFS = System System.Xml System.Data
+KEYFILE = ibm.pub
LIB_MCS_FLAGS = /unsafe -warn:1
NO_TEST = yes
<AssemblyName>ICSharpCode.SharpZipLib</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>SharpZipLib.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: AssemblyVersion("4.84.0.0")]\r
\r
[assembly: AssemblyDelaySign(true)]\r
-[assembly: AssemblyKeyFile("SharpZipLib.pub")]\r
LIBRARY_SNK = SharpZipLib.key
LIB_REFS = System System.Xml
+KEYFILE = SharpZipLib.pub
LIB_MCS_FLAGS = -warn:1
NO_TEST = yes
EXTRA_DISTFILES = SharpZipLib.pub $(LIBRARY_SNK)
[assembly: ComVisible (false)]
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile("../msfinal.pub")]
[assembly: AssemblyFileVersion (XBuildConsts.FileVersion)]
LIBRARY = Microsoft.Build.Engine.dll
LIB_REFS = $(PARENT_PROFILE)System $(PARENT_PROFILE)System.Core $(PARENT_PROFILE)System.Xml $(XBUILD_FRAMEWORK) $(XBUILD_UTILITIES)
+KEYFILE = ../msfinal.pub
LIB_MCS_FLAGS =
TEST_MCS_FLAGS =
<AssemblyName>Microsoft.Build.Engine</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: Guid ("D8A9BA71-4724-481d-9CA7-0DA23A1D615C")]
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile("../msfinal.pub")]
[assembly: AssemblyFileVersion (XBuildConsts.FileVersion)]
LIBRARY = Microsoft.Build.Framework.dll
LIB_REFS = $(PARENT_PROFILE)System
+KEYFILE = ../msfinal.pub
LIB_MCS_FLAGS =
TEST_NUNITLITE_APP_CONFIG_RUNTIME=Test/test-config-file-$(PROFILE)
<AssemblyName>Microsoft.Build.Framework</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: Guid ("E3D4D3B9-944C-407b-A82E-B19719EA7FB3")]
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile("../msfinal.pub")]
[assembly: AssemblyFileVersion (XBuildConsts.FileVersion)]
LIB_REFS = $(PARENT_PROFILE)System $(PARENT_PROFILE)System.Core $(PARENT_PROFILE)System.Xml $(PARENT_PROFILE)System.Windows.Forms \
$(XBUILD_UTILITIES) $(XBUILD_FRAMEWORK) $(XBUILD_ENGINE) $(XBUILD_TASKS)
+KEYFILE = ../msfinal.pub
TEST_MCS_FLAGS =
TEST_LIB_REFS = $(PARENT_PROFILE)System.Xml $(XBUILD_ENGINE) $(XBUILD_FRAMEWORK) $(XBUILD_TASKS) $(XBUILD_UTILITIES) $(PARENT_PROFILE)System.Core
<AssemblyName>Microsoft.Build.Tasks.v4.0</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: ComVisible (false)]
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile("../msfinal.pub")]
[assembly: AssemblyFileVersion (XBuildConsts.FileVersion)]
LIBRARY_NAME = Microsoft.Build.Utilities$(NAME_SUFFIX).dll
LIB_REFS = $(PARENT_PROFILE)System $(PARENT_PROFILE)System.Core $(PARENT_PROFILE)System.Xml $(XBUILD_FRAMEWORK)
+KEYFILE = ../msfinal.pub
LIB_MCS_FLAGS =
TEST_RESX_RESOURCES = Test/Microsoft.Build.Utilities/Strings.resources
<AssemblyName>Microsoft.Build.Utilities.v4.0</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: ComVisible (false)]
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile("../msfinal.pub")]
[assembly: AssemblyFileVersion (XBuildConsts.FileVersion)]
[assembly: CompilationRelaxations (CompilationRelaxations.NoStringInterning)]
LIBRARY = Microsoft.Build.dll
LIB_REFS = $(PARENT_PROFILE)System $(PARENT_PROFILE)System.Core $(PARENT_PROFILE)System.Xml Microsoft.Build.Engine Microsoft.Build.Framework
+KEYFILE = ../msfinal.pub
LIB_MCS_FLAGS = \
/d:MICROSOFT_BUILD_DLL
<AssemblyName>Microsoft.Build</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[Test]
public void EndBuildWaitsForSubmissionCompletion ()
{
- // Windows does not have useful sleep or alternative, so skip it
- bool is_windows = true;
- switch (Environment.OSVersion.Platform) {
- case PlatformID.Unix:
- case PlatformID.MacOSX:
- is_windows = false;
- break;
- }
string project_xml = string.Format (@"<Project DefaultTargets='Wait1Sec' xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
<Target Name='Wait1Sec'>
<Exec Command='{0}' />
</Target>
-</Project>", is_windows ? "powershell -command \"Start-Sleep -s 1\"" : "/bin/sleep 1");
+</Project>", Environment.OSVersion.Platform == PlatformID.Win32NT ? "powershell -command \"Start-Sleep -s 1\"" : "/bin/sleep 1");
var xml = XmlReader.Create (new StringReader (project_xml));
var root = ProjectRootElement.Create (xml);
root.FullPath = "BuildSubmissionTest.EndBuildWaitsForSubmissionCompletion.proj";
var proj = new ProjectInstance (root);
var bm = new BuildManager ();
bm.BeginBuild (new BuildParameters ());
- DateTime waitDone = DateTime.MinValue;
- DateTime beforeExec = DateTime.UtcNow;
+ var waitDone = TimeSpan.MinValue;
+ var sw = System.Diagnostics.Stopwatch.StartNew ();
var sub = bm.PendBuildRequest (new BuildRequestData (proj, new string [] { "Wait1Sec" }));
- sub.ExecuteAsync (delegate { waitDone = DateTime.UtcNow; }, null);
+ sub.ExecuteAsync (cb => waitDone = sw.Elapsed, null);
bm.EndBuild ();
Assert.AreEqual (BuildResultCode.Success, sub.BuildResult.OverallResult, "#1");
- DateTime endBuildDone = DateTime.UtcNow;
- AssertHelper.GreaterOrEqual (endBuildDone - beforeExec, TimeSpan.FromSeconds (1), "#2");
- AssertHelper.GreaterOrEqual (waitDone, beforeExec, "#3");
+ var endBuildDone = sw.Elapsed;
+ AssertHelper.GreaterOrEqual (endBuildDone, TimeSpan.FromSeconds (1), "#2");
+ AssertHelper.GreaterOrEqual (waitDone, TimeSpan.FromSeconds (1), "#3");
AssertHelper.GreaterOrEqual (endBuildDone, waitDone, "#4");
+ AssertHelper.LessOrEqual (endBuildDone, TimeSpan.FromSeconds (2), "#5");
+ AssertHelper.LessOrEqual (waitDone, TimeSpan.FromSeconds (2), "#6");
}
[Test]
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../msfinal.pub")]
[assembly: SecurityCritical]
LIBRARY = Microsoft.CSharp.dll
LIB_REFS = System.Core System
+KEYFILE = ../msfinal.pub
LIB_MCS_FLAGS =
RESX_RESOURCE_STRING = ../../../external/corefx/src/Microsoft.CSharp/src/Resources/Strings.resx
<AssemblyName>Microsoft.CSharp</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\EXPRExtensions.cs" />\r
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\ExprFactory.cs" />\r
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\EXPRFLAG.cs" />\r
- <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\FileRecord.cs" />\r
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\FundamentalTypes.cs" />\r
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\GlobalSymbolContext.cs" />\r
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\GroupToArgsBinder.cs" />\r
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\GroupToArgsBinderResult.cs" />\r
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\ImplicitConversion.cs" />\r
- <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\InputFile.cs" />\r
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\LangCompiler.cs" />\r
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\MemberLookup.cs" />\r
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\MemberLookupResults.cs" />\r
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\Return.cs" />\r
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\Statement.cs" />\r
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\Temporary.cs" />\r
- <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\TypeArguments.cs" />\r
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\TypeOf.cs" />\r
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\UnaryOperator.cs" />\r
- <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\UnboundAnonymousFunction.cs" />\r
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\UserDefinedConversion.cs" />\r
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\UserDefinedLogicalOperator.cs" />\r
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\Visitors\ExpressionTreeRewriter.cs" />\r
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/EXPRExtensions.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExprFactory.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/EXPRFLAG.cs
-../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/FileRecord.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/FundamentalTypes.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/GlobalSymbolContext.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/GroupToArgsBinder.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/GroupToArgsBinderResult.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ImplicitConversion.cs
-../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/InputFile.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/LangCompiler.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/MemberLookup.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/MemberLookupResults.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Return.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Statement.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Temporary.cs
-../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/TypeArguments.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/TypeOf.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/UnaryOperator.cs
-../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/UnboundAnonymousFunction.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/UserDefinedConversion.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/UserDefinedLogicalOperator.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Visitors/ExpressionTreeRewriter.cs
public const string BindPropertyFailedMethodGroup = "The name '{0}' is bound to a method and cannot be used like a property";
public const string BindPropertyFailedEvent = "The event '{0}' can only appear on the left hand side of +";
public const string BindInvokeFailedNonDelegate = "Cannot invoke a non-delegate type";
- public const string BindImplicitConversionRequireOneArgument = "Implicit conversion takes exactly one argument";
- public const string BindExplicitConversionRequireOneArgument = "Explicit conversion takes exactly one argument";
public const string BindBinaryAssignmentRequireTwoArguments = "Binary operators cannot be invoked with one argument";
public const string BindBinaryAssignmentFailedNullReference = "Cannot perform member assignment on a null reference";
public const string NullReferenceOnMemberException = "Cannot perform runtime binding on a null reference";
public const string BindCallToConditionalMethod = "Cannot dynamically invoke method '{0}' because it has a Conditional attribute";
public const string BindToVoidMethodButExpectResult = "Cannot implicitly convert type 'void' to 'object'";
public const string BadBinaryOps = "Operator '{0}' cannot be applied to operands of type '{1}' and '{2}'";
- public const string IntDivByZero = "Division by constant zero";
public const string BadIndexLHS = "Cannot apply indexing with [] to an expression of type '{0}'";
public const string BadIndexCount = "Wrong number of indices inside []; expected '{0}'";
public const string BadUnaryOp = "Operator '{0}' cannot be applied to operand of type '{1}'";
public const string AssgReadonlyProp = "Property or indexer '{0}' cannot be assigned to -- it is read only";
public const string AbstractBaseCall = "Cannot call an abstract base member: '{0}'";
public const string RefProperty = "A property or indexer may not be passed as an out or ref parameter";
- public const string ManagedAddr = "Cannot take the address of, get the size of, or declare a pointer to a managed type ('{0}')";
- public const string FixedNotNeeded = "You cannot use the fixed statement to take the address of an already fixed expression";
public const string UnsafeNeeded = "Dynamic calls cannot be used in conjunction with pointers";
public const string BadBoolOp = "In order to be applicable as a short circuit operator a user-defined logical operator ('{0}') must have the same return type as the type of its 2 parameters";
public const string MustHaveOpTF = "The type ('{0}') must contain declarations of operator true and operator false";
- public const string CheckedOverflow = "The operation overflows at compile time in checked mode";
public const string ConstOutOfRangeChecked = "Constant value '{0}' cannot be converted to a '{1}' (use 'unchecked' syntax to override)";
public const string AmbigMember = "Ambiguity between '{0}' and '{1}'";
public const string SizeofUnsafe = "'{0}' does not have a predefined size, therefore sizeof can only be used in an unsafe context (consider using System.Runtime.InteropServices.Marshal.SizeOf)";
- public const string FieldInitRefNonstatic = "A field initializer cannot reference the non-static field, method, or property '{0}'";
public const string CallingFinalizeDepracated = "Destructors and object.Finalize cannot be called directly. Consider calling IDisposable.Dispose if available.";
public const string CallingBaseFinalizeDeprecated = "Do not directly call your base class Finalize method. It is called automatically from your destructor.";
- public const string BadCastInFixed = "The right hand side of a fixed statement assignment may not be a cast expression";
public const string NoImplicitConvCast = "Cannot implicitly convert type '{0}' to '{1}'. An explicit conversion exists (are you missing a cast?)";
public const string InaccessibleGetter = "The property or indexer '{0}' cannot be used in this context because the get accessor is inaccessible";
public const string InaccessibleSetter = "The property or indexer '{0}' cannot be used in this context because the set accessor is inaccessible";
public const string MethGrpToNonDel = "Cannot convert method group '{0}' to non-delegate type '{1}'. Did you intend to invoke the method?";
public const string RefConstraintNotSatisfied = "The type '{2}' must be a reference type in order to use it as parameter '{1}' in the generic type or method '{0}'";
public const string ValConstraintNotSatisfied = "The type '{2}' must be a non-nullable value type in order to use it as parameter '{1}' in the generic type or method '{0}'";
- public const string CircularConstraint = "Circular constraint dependency involving '{0}' and '{1}'";
- public const string BaseConstraintConflict = "Type parameter '{0}' inherits conflicting constraints '{1}' and '{2}'";
- public const string ConWithValCon = "Type parameter '{1}' has the 'struct' constraint so '{1}' cannot be used as a constraint for '{0}'";
public const string AmbigUDConv = "Ambiguous user defined conversions '{0}' and '{1}' when converting from '{2}' to '{3}'";
public const string PredefinedTypeNotFound = "Predefined type '{0}' is not defined or imported";
- public const string PredefinedTypeBadType = "Predefined type '{0}' is declared incorrectly";
public const string BindToBogus = "'{0}' is not supported by the language";
public const string CantCallSpecialMethod = "'{0}': cannot explicitly call operator or accessor";
public const string BogusType = "'{0}' is a type not supported by the language";
public const string MissingPredefinedMember = "Missing compiler required member '{0}.{1}'";
public const string LiteralDoubleCast = "Literal of type double cannot be implicitly converted to type '{1}'; use an '{0}' suffix to create a literal of this type";
- public const string UnifyingInterfaceInstantiations = "'{0}' cannot implement both '{1}' and '{2}' because they may unify for some type parameter substitutions";
public const string ConvertToStaticClass = "Cannot convert to static type '{0}'";
public const string GenericArgIsStaticClass = "'{0}': static types cannot be used as type arguments";
public const string PartialMethodToDelegate = "Cannot create delegate from method '{0}' because it is a partial method without an implementing declaration";
public const string RefReadonlyStatic2 = "Fields of static readonly field '{0}' cannot be passed ref or out (except in a static constructor)";
public const string AssgReadonlyLocalCause = "Cannot assign to '{0}' because it is a '{1}'";
public const string RefReadonlyLocalCause = "Cannot pass '{0}' as a ref or out argument because it is a '{1}'";
- public const string ThisStructNotInAnonMeth = "Anonymous methods, lambda expressions, and query expressions inside structs cannot access instance members of 'this'. Consider copying 'this' to a local variable outside the anonymous method, lambda expression or query expression and using the local instead.";
public const string DelegateOnNullable = "Cannot bind delegate to '{0}' because it is a member of 'System.Nullable<T>'";
public const string BadCtorArgCount = "'{0}' does not contain a constructor that takes '{1}' arguments";
public const string BadExtensionArgTypes = "'{0}' does not contain a definition for '{1}' and the best extension method overload '{2}' has some invalid arguments";
public const string BadNamedArgumentForDelegateInvoke = "The delegate '{0}' does not have a parameter named '{1}'";
public const string DuplicateNamedArgument = "Named argument '{0}' cannot be specified multiple times";
public const string NamedArgumentUsedInPositional = "Named argument '{0}' specifies a parameter for which a positional argument has already been given";
+ public const string TypeArgumentRequiredForStaticCall = "The first argument to dynamically-bound static call must be a Type";
}
*/
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile("../msfinal.pub")]
-
LIBRARY = Microsoft.VisualC.dll
LIB_REFS = System
-LIB_MCS_FLAGS =
+KEYFILE = ../msfinal.pub
+
NO_TEST = yes
include ../../build/library.make
<AssemblyName>Microsoft.VisualC</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: AssemblyTitle ("Microsoft.Web.Infrastructure")]
[assembly: AssemblyDescription ("")]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile("../winfx.pub")]
LIBRARY = Microsoft.Web.Infrastructure.dll
LIB_REFS = System System.Configuration System.Web
+KEYFILE = ../winfx.pub
LIB_MCS_FLAGS =
EXTRA_DISTFILES = $(RESOURCE_FILES)
<AssemblyName>Microsoft.Web.Infrastructure</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../winfx.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>Mono.Btls.Interface</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../mono.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
// documentation for more information on this.
//
[assembly: AssemblyDelaySign(true)]
-[assembly: AssemblyKeyFile("c5.pub")]
-
[assembly: CLSCompliant(true)]
LIBRARY = Mono.C5.dll
LIBRARY_SNK = c5.snk
LIB_REFS = System
+KEYFILE = c5.pub
LIB_MCS_FLAGS = -nowarn:169,219,414,1030,3001,3005,3006
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:0618 -nowarn:219 -nowarn:169
<AssemblyName>Mono.C5</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>c5.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
//[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../mono.pub")]
[assembly: ComVisible (false)]
LIBRARY = Mono.CSharp.dll
LIB_REFS = System.Core System.Xml System
+KEYFILE = ../mono.pub
LIB_MCS_FLAGS =
ifdef AOT_FRIENDLY_PROFILE
<AssemblyName>Mono.CSharp</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../mono.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AppDesignerFolder>Properties</AppDesignerFolder>\r
<RootNamespace>Mono.CSharp</RootNamespace>\r
<AssemblyName>Mono.CSharp</AssemblyName>\r
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
+ <TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
<FileUpgradeFlags>\r
</FileUpgradeFlags>\r
<Compile Include="..\Mono.CompilerServices.SymbolWriter\SourceMethodBuilder.cs">\r
<Link>SourceMethodBuilder.cs</Link>\r
</Compile>\r
+ <Compile Include="..\..\mcs\tuples.cs">\r
+ <Link>tuples.cs</Link>\r
+ </Compile>\r
</ItemGroup>\r
<ItemGroup>\r
<Folder Include="Properties\" />\r
<PropertyGroup>\r
<PreBuildEvent>"$(ProjectDir)..\..\jay\jay" -cvt < "$(ProjectDir)..\..\jay\skeleton.cs" "$(ProjectDir)..\..\mcs\cs-parser.jay" > "$(ProjectDir)cs-parser.cs"</PreBuildEvent>\r
</PropertyGroup>\r
-</Project>
+</Project>\r
object res = Evaluator.Evaluate ("attr.GetType().Name;");
Assert.AreEqual ("A", res);
}
+
+ [Test]
+ public void EnumType ()
+ {
+ Evaluator.Run ("public class TestClass { private TestEnum _te; public string Get() { return _te.ToString(); } } public enum TestEnum { First, Second }");
+ }
}
}
\ No newline at end of file
*/
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../mono.pub")]
include ../../build/rules.make
LIBRARY = Mono.Cairo.dll
+KEYFILE = ../mono.pub
#LIB_MCS_FLAGS = -d:CAIRO_1_2
NO_TEST = yes
<AssemblyName>Mono.Cairo</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../mono.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>Mono.Cecil.Mdb</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../mono.snk</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<AssemblyName>Mono.Cecil</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../mono.snk</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../mono.pub")]
LIBRARY = Mono.CodeContracts.dll
LIB_REFS = System System.Core Mono.Cecil Mono.Cecil.Mdb
+KEYFILE = ../mono.pub
LIB_MCS_FLAGS = -nowarn:618
TEST_MCS_FLAGS =
<AssemblyName>Mono.CodeContracts</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../mono.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
*/
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../mono.pub")]
LIBRARY = Mono.CompilerServices.SymbolWriter.dll
LIB_REFS = System
+KEYFILE = ../mono.pub
LIB_MCS_FLAGS =
NO_TEST = yes
<AssemblyName>Mono.CompilerServices.SymbolWriter</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../mono.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
#endif
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../mono.pub")]
LIBRARY = Mono.Data.Sqlite.dll
LIB_REFS = System System.Data System.Transactions System.Xml
+KEYFILE = ../mono.pub
LIB_MCS_FLAGS = /unsafe \
$(RESOURCES:%=-resource:%) -d:SQLITE_STANDARD
<AssemblyName>Mono.Data.Sqlite</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../mono.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
*/
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../mono.pub")]
LIBRARY = Mono.Data.Tds.dll
LIB_REFS = System System.Xml Mono.Security
+KEYFILE = ../mono.pub
LIB_MCS_FLAGS =
TEST_MCS_FLAGS =
<AssemblyName>Mono.Data.Tds</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../mono.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
LIBRARY_SNK = ../mono.snk
LIB_REFS = System Mono.Cecil System.Core
-LIB_MCS_FLAGS = /unsafe -D:MONO_DATACONVERTER_STATIC_METHODS -keyfile:$(LIBRARY_SNK) /publicsign
+LIB_MCS_FLAGS = /unsafe -D:MONO_DATACONVERTER_STATIC_METHODS /publicsign
+KEYFILE = $(LIBRARY_SNK)
TEST_MCS_FLAGS =
TEST_LIB_REFS = Mono.Cecil System System.Core
<AssemblyName>Mono.Debugger.Soft</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../mono.snk</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
[assembly: AssemblyCopyright("(c) 2003 Various Authors")]
[assembly: AssemblyDelaySign(true)]
-[assembly: AssemblyKeyFile("../mono.pub")]
LIBRARY = Mono.Http.dll
LIB_REFS = System System.Xml System.Web ICSharpCode.SharpZipLib Mono.Security
+KEYFILE = ../mono.pub
LIB_MCS_FLAGS = -nowarn:618
NO_TEST = yes
<AssemblyName>Mono.Http</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../mono.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
*/
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../mono.pub")]
LIBRARY = Mono.Management.dll
LIB_REFS = System Mono.Posix
+KEYFILE = ../mono.pub
LIB_MCS_FLAGS =
NO_TEST = yes
<AssemblyName>Mono.Management</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../mono.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: CLSCompliant (false)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile("../mono.pub")]
[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
[assembly: CompilationRelaxations (CompilationRelaxations.NoStringInterning)]
LIBRARY = Mono.Messaging.RabbitMQ.dll
LIB_REFS = System System.Messaging Mono.Messaging RabbitMQ.Client
+KEYFILE = ../mono.pub
LIB_MCS_FLAGS = -nowarn:618
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:0618 -nowarn:219 -nowarn:169
<AssemblyName>Mono.Messaging.RabbitMQ</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../mono.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile("../mono.pub")]
[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
[assembly: CompilationRelaxations (CompilationRelaxations.NoStringInterning)]
LIBRARY = Mono.Messaging.dll
LIB_REFS = System System.Configuration
+KEYFILE = ../mono.pub
LIB_MCS_FLAGS =
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:0618 -nowarn:219 -nowarn:169
<AssemblyName>Mono.Messaging</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../mono.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../mono.pub")]
NO_INSTALL = yes
LIB_REFS = System
+KEYFILE = ../mono.pub
LIB_MCS_FLAGS =
TEST_MCS_FLAGS =
TEST_LIB_REFS = Mono.Posix System System.Core
<AssemblyName>Mono.Options</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../mono.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: AssemblyVersion (Consts.FxVersion)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../mono.pub")]
SUBDIRS =
include ../../build/rules.make
+LIB_REFS = System.Core System
+LIB_MCS_FLAGS = -d:INSIDE_MONO_PARALLEL
+KEYFILE = ../mono.pub
+
LIBRARY = Mono.Parallel.dll
include ../../build/library.make
TEST_MCS_FLAGS =
TEST_LIB_REFS = System.Core
-
-LIB_REFS += System.Core System
-LIB_MCS_FLAGS += -d:INSIDE_MONO_PARALLEL
<AssemblyName>Mono.Parallel</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../mono.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
#if !MONO_POSIX_NETSTANDARD_BUILD
// We are using ../Open.snk for MONO_POSIX_NETSTANDARD_BUILD
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../mono.pub")]
#endif
/*
* TODO:
# Don't warn about [Obsolete] members, as there are now *lots* of [Obsolete]
# members, generating volumes of output.
LIB_REFS = System
+KEYFILE = ../mono.pub
LIB_MCS_FLAGS = /unsafe /nowarn:0618,612
TEST_MCS_FLAGS = /unsafe /nowarn:0219,0618
TEST_LIB_REFS = Mono.Posix System
<AssemblyName>Mono.Posix</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../mono.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
LIBRARY_SNK = ../mono.snk
LIB_REFS = System System.Core
-LIB_MCS_FLAGS = /unsafe /keyfile:$(LIBRARY_SNK) /publicsign
+KEYFILE = $(LIBRARY_SNK)
+LIB_MCS_FLAGS = /unsafe /publicsign
NO_TEST = yes
<AssemblyName>Mono.Profiler.Log</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../mono.snk</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<Compile Include="Mono.Profiler.Log\LogEventVisitor.cs" />\r
<Compile Include="Mono.Profiler.Log\LogException.cs" />\r
<Compile Include="Mono.Profiler.Log\LogProcessor.cs" />\r
+ <Compile Include="Mono.Profiler.Log\LogProfiler.cs" />\r
<Compile Include="Mono.Profiler.Log\LogReader.cs" />\r
- <Compile Include="Mono.Profiler.Log\LogRuntimeProfiler.cs" />\r
<Compile Include="Mono.Profiler.Log\LogStream.cs" />\r
<Compile Include="Mono.Profiler.Log\LogStreamHeader.cs" />\r </ItemGroup>\r
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
Mono.Profiler.Log/LogEvents.cs
Mono.Profiler.Log/LogException.cs
Mono.Profiler.Log/LogProcessor.cs
+Mono.Profiler.Log/LogProfiler.cs
Mono.Profiler.Log/LogReader.cs
-Mono.Profiler.Log/LogRuntimeProfiler.cs
Mono.Profiler.Log/LogStream.cs
Mono.Profiler.Log/LogStreamHeader.cs
Heap = 6,
Sample = 7,
Runtime = 8,
- Coverage = 9,
Meta = 10,
AllocationNoBacktrace = 0 << 4,
RuntimeJitHelper = 1 << 4,
- CoverageAssembly = 0 << 4,
- CoverageMethod = 1 << 4,
- CoverageStatement = 2 << 4,
- CoverageClass = 3 << 4,
-
MetaSynchronizationPoint = 0 << 4,
}
// mono/metadata/profiler.h : MonoProfilerGCEvent
public enum LogGCEvent {
- Begin = 0,
- MarkBegin = 1,
- MarkEnd = 2,
- ReclaimBegin = 3,
- ReclaimEnd = 4,
- End = 5,
PreStopWorld = 6,
+ PreStopWorldLocked = 10,
PostStopWorld = 7,
+ Begin = 0,
+ End = 5,
PreStartWorld = 8,
PostStartWorld = 9,
- PreStopWorldLocked = 10,
PostStartWorldUnlocked = 11,
}
WorldStop = 1,
WorldStart = 2,
}
+
+ // mono/metadata/profiler.h : MonoProfilerSampleMode
+ public enum LogSampleMode {
+ None = 0,
+ Process = 1,
+ Real = 2,
+ }
+
+ // mono/profiler/log.h : MonoProfilerHeapshotMode
+ public enum LogHeapshotMode {
+ None = 0,
+ EveryMajor = 1,
+ OnDemand = 2,
+ Milliseconds = 3,
+ Collections = 4,
+ }
}
{
}
- public virtual void Visit (AssemblyCoverageEvent ev)
- {
- }
-
- public virtual void Visit (ClassCoverageEvent ev)
- {
- }
-
- public virtual void Visit (MethodCoverageEvent ev)
- {
- }
-
- public virtual void Visit (StatementCoverageEvent ev)
- {
- }
-
public virtual void Visit (SynchronizationPointEvent ev)
{
}
}
}
- public sealed class AssemblyCoverageEvent : LogEvent {
-
- public string AssemblyName { get; internal set; }
-
- public Guid Guid { get; internal set; }
-
- public string FileName { get; internal set; }
-
- public long NumberOfMethods { get; internal set; }
-
- public long FullyCovered { get; internal set; }
-
- public long PartiallyCovered { get; internal set; }
-
- internal override void Accept (LogEventVisitor visitor)
- {
- visitor.Visit (this);
- }
- }
-
- public sealed class ClassCoverageEvent : LogEvent {
-
- public string AssemblyName { get; internal set; }
-
- public string ClassName { get; internal set; }
-
- public long NumberOfMethods { get; internal set; }
-
- public long FullyCovered { get; internal set; }
-
- public long PartiallyCovered { get; internal set; }
-
- internal override void Accept (LogEventVisitor visitor)
- {
- visitor.Visit (this);
- }
- }
-
- public sealed class MethodCoverageEvent : LogEvent {
-
- public string AssemblyName { get; internal set; }
-
- public string ClassName { get; internal set; }
-
- public string MethodName { get; internal set; }
-
- public string MethodSignature { get; internal set; }
-
- public string FileName { get; internal set; }
-
- public ulong MetadataToken { get; internal set; }
-
- public long MethodId { get; internal set; }
-
- public long NumberOfStatements { get; internal set; }
-
- internal override void Accept (LogEventVisitor visitor)
- {
- visitor.Visit (this);
- }
- }
-
- public sealed class StatementCoverageEvent : LogEvent {
-
- public long MethodId { get; internal set; }
-
- public long RelativeILOffset { get; internal set; }
-
- public ulong Counter { get; internal set; }
-
- public long Line { get; internal set; }
-
- public long Column { get; internal set; }
-
- internal override void Accept (LogEventVisitor visitor)
- {
- visitor.Visit (this);
- }
- }
-
public sealed class SynchronizationPointEvent : LogEvent {
public LogSynchronizationPoint Type { get; internal set; }
default:
throw new LogException ($"Invalid extended event type ({extType}).");
}
- case LogEventType.Coverage:
- switch (extType) {
- case LogEventType.CoverageAssembly:
- return new AssemblyCoverageEvent {
- AssemblyName = Reader.ReadCString (),
- Guid = Guid.Parse (Reader.ReadCString ()),
- FileName = Reader.ReadCString (),
- NumberOfMethods = (long) Reader.ReadULeb128 (),
- FullyCovered = (long) Reader.ReadULeb128 (),
- PartiallyCovered = (long) Reader.ReadULeb128 (),
- };
- case LogEventType.CoverageMethod:
- return new MethodCoverageEvent {
- AssemblyName = Reader.ReadCString (),
- ClassName = Reader.ReadCString (),
- MethodName = Reader.ReadCString (),
- MethodSignature = Reader.ReadCString (),
- FileName = Reader.ReadCString (),
- MetadataToken = Reader.ReadULeb128 (),
- MethodId = (long) Reader.ReadULeb128 (),
- NumberOfStatements = (long) Reader.ReadULeb128 (),
- };
- case LogEventType.CoverageStatement:
- return new StatementCoverageEvent {
- MethodId = (long) Reader.ReadULeb128 (),
- RelativeILOffset = (long) Reader.ReadULeb128 (),
- Counter = Reader.ReadULeb128 (),
- Line = (long) Reader.ReadULeb128 (),
- Column = (long) Reader.ReadULeb128 (),
- };
- case LogEventType.CoverageClass:
- return new ClassCoverageEvent {
- AssemblyName = Reader.ReadCString (),
- ClassName = Reader.ReadCString (),
- NumberOfMethods = (long) Reader.ReadULeb128 (),
- FullyCovered = (long) Reader.ReadULeb128 (),
- PartiallyCovered = (long) Reader.ReadULeb128 (),
- };
- default:
- throw new LogException ($"Invalid extended event type ({extType}).");
- }
case LogEventType.Meta:
switch (extType) {
case LogEventType.MetaSynchronizationPoint:
long ReadObject ()
{
- return Reader.ReadSLeb128 () + _bufferHeader.ObjectBase;
+ return Reader.ReadSLeb128 () + _bufferHeader.ObjectBase << 3;
}
long ReadMethod ()
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Security;
+
+namespace Mono.Profiler.Log {
+
+ public static class LogProfiler {
+
+ static bool? _attached;
+
+ public static bool IsAttached {
+ get {
+ if (_attached != null)
+ return (bool) _attached;
+
+ try {
+ GetMaxStackTraceFrames ();
+ return (bool) (_attached = true);
+ } catch (Exception e) when (e is MissingMethodException || e is SecurityException) {
+ return (bool) (_attached = false);
+ }
+ }
+ }
+
+ [MethodImpl (MethodImplOptions.InternalCall)]
+ extern static int GetMaxStackTraceFrames ();
+
+ public static int MaxStackTraceFrames {
+ get { return GetMaxStackTraceFrames (); }
+ }
+
+ [MethodImpl (MethodImplOptions.InternalCall)]
+ extern static int GetStackTraceFrames ();
+
+ [MethodImpl (MethodImplOptions.InternalCall)]
+ extern static void SetStackTraceFrames (int value);
+
+ public static int StackTraceFrames {
+ get { return GetStackTraceFrames (); }
+ set {
+ var max = MaxStackTraceFrames;
+
+ if (value < 0 || value > max)
+ throw new ArgumentOutOfRangeException (nameof (value), value, $"Value must be between 0 and {max}.");
+
+ SetStackTraceFrames (value);
+ }
+ }
+
+ [MethodImpl (MethodImplOptions.InternalCall)]
+ extern static LogHeapshotMode GetHeapshotMode ();
+
+ [MethodImpl (MethodImplOptions.InternalCall)]
+ extern static void SetHeapshotMode (LogHeapshotMode value);
+
+ public static LogHeapshotMode HeapshotMode {
+ get { return GetHeapshotMode (); }
+ set {
+ if (!Enum.IsDefined (typeof (LogHeapshotMode), value))
+ throw new ArgumentException ("Invalid heapshot mode.", nameof (value));
+
+ SetHeapshotMode (value);
+ }
+ }
+
+ [MethodImpl (MethodImplOptions.InternalCall)]
+ extern static int GetHeapshotMillisecondsFrequency ();
+
+ [MethodImpl (MethodImplOptions.InternalCall)]
+ extern static void SetHeapshotMillisecondsFrequency (int value);
+
+ public static int HeapshotMillisecondsFrequency {
+ get { return GetHeapshotMillisecondsFrequency (); }
+ set {
+ if (value < 0)
+ throw new ArgumentOutOfRangeException (nameof (value), value, "Value must be non-negative.");
+
+ SetHeapshotMillisecondsFrequency (value);
+ }
+ }
+
+ [MethodImpl (MethodImplOptions.InternalCall)]
+ extern static int GetHeapshotCollectionsFrequency ();
+
+ [MethodImpl (MethodImplOptions.InternalCall)]
+ extern static void SetHeapshotCollectionsFrequency (int value);
+
+ public static int HeapshotCollectionsFrequency {
+ get { return GetHeapshotCollectionsFrequency (); }
+ set {
+ if (value < 0)
+ throw new ArgumentOutOfRangeException (nameof (value), value, "Value must be non-negative.");
+
+ SetHeapshotCollectionsFrequency (value);
+ }
+ }
+
+ [MethodImpl (MethodImplOptions.InternalCall)]
+ extern static int GetCallDepth ();
+
+ [MethodImpl (MethodImplOptions.InternalCall)]
+ extern static void SetCallDepth (int value);
+
+ public static int CallDepth {
+ get { return GetCallDepth (); }
+ set {
+ if (value < 0)
+ throw new ArgumentOutOfRangeException (nameof (value), value, "Value must be non-negative.");
+
+ SetCallDepth (value);
+ }
+ }
+
+ [MethodImpl (MethodImplOptions.InternalCall)]
+ extern static void GetSampleMode (out LogSampleMode mode, out int frequency);
+
+ [MethodImpl (MethodImplOptions.InternalCall)]
+ extern static bool SetSampleMode (LogSampleMode value, int frequency);
+
+ public static LogSampleMode SampleMode {
+ get {
+ GetSampleMode (out var mode, out var _);
+
+ return mode;
+ }
+ }
+
+ public static int SampleFrequency {
+ get {
+ GetSampleMode (out var _, out var frequency);
+
+ return frequency;
+ }
+ }
+
+ public static bool SetSampleParameters (LogSampleMode mode, int frequency)
+ {
+ if (!Enum.IsDefined (typeof (LogSampleMode), mode))
+ throw new ArgumentException ("Invalid sample mode.", nameof (mode));
+
+ if (frequency < 1)
+ throw new ArgumentOutOfRangeException (nameof (frequency), frequency, "Frequency must be positive.");
+
+ return SetSampleMode (mode, frequency);
+ }
+
+ [MethodImpl (MethodImplOptions.InternalCall)]
+ extern static bool GetExceptionEvents ();
+
+ [MethodImpl (MethodImplOptions.InternalCall)]
+ extern static void SetExceptionEvents (bool value);
+
+ public static bool ExceptionEventsEnabled {
+ get { return GetExceptionEvents (); }
+ set { SetExceptionEvents (value); }
+ }
+
+ [MethodImpl (MethodImplOptions.InternalCall)]
+ extern static bool GetMonitorEvents ();
+
+ [MethodImpl (MethodImplOptions.InternalCall)]
+ extern static void SetMonitorEvents (bool value);
+
+ public static bool MonitorEventsEnabled {
+ get { return GetMonitorEvents (); }
+ set { SetMonitorEvents (value); }
+ }
+
+ [MethodImpl (MethodImplOptions.InternalCall)]
+ extern static bool GetGCEvents ();
+
+ [MethodImpl (MethodImplOptions.InternalCall)]
+ extern static void SetGCEvents (bool value);
+
+ public static bool GCEventsEnabled {
+ get { return GetGCEvents (); }
+ set { SetGCEvents (value); }
+ }
+
+ [MethodImpl (MethodImplOptions.InternalCall)]
+ extern static bool GetGCAllocationEvents ();
+
+ [MethodImpl (MethodImplOptions.InternalCall)]
+ extern static void SetGCAllocationEvents (bool value);
+
+ public static bool GCAllocationEventsEnabled {
+ get { return GetGCAllocationEvents (); }
+ set { SetGCAllocationEvents (value); }
+ }
+
+ [MethodImpl (MethodImplOptions.InternalCall)]
+ extern static bool GetGCMoveEvents ();
+
+ [MethodImpl (MethodImplOptions.InternalCall)]
+ extern static void SetGCMoveEvents (bool value);
+
+ public static bool GCMoveEventsEnabled {
+ get { return GetGCMoveEvents (); }
+ set { SetGCMoveEvents (value); }
+ }
+
+ [MethodImpl (MethodImplOptions.InternalCall)]
+ extern static bool GetGCRootEvents ();
+
+ [MethodImpl (MethodImplOptions.InternalCall)]
+ extern static void SetGCRootEvents (bool value);
+
+ public static bool GCRootEventsEnabled {
+ get { return GetGCRootEvents (); }
+ set { SetGCRootEvents (value); }
+ }
+
+ [MethodImpl (MethodImplOptions.InternalCall)]
+ extern static bool GetGCHandleEvents ();
+
+ [MethodImpl (MethodImplOptions.InternalCall)]
+ extern static void SetGCHandleEvents (bool value);
+
+ public static bool GCHandleEventsEnabled {
+ get { return GetGCHandleEvents (); }
+ set { SetGCHandleEvents (value); }
+ }
+
+ [MethodImpl (MethodImplOptions.InternalCall)]
+ extern static bool GetGCFinalizationEvents ();
+
+ [MethodImpl (MethodImplOptions.InternalCall)]
+ extern static void SetGCFinalizationEvents (bool value);
+
+ public static bool GCFinalizationEventsEnabled {
+ get { return GetGCFinalizationEvents (); }
+ set { SetGCFinalizationEvents (value); }
+ }
+
+ [MethodImpl (MethodImplOptions.InternalCall)]
+ extern static bool GetCounterEvents ();
+
+ [MethodImpl (MethodImplOptions.InternalCall)]
+ extern static void SetCounterEvents (bool value);
+
+ public static bool CounterEventsEnabled {
+ get { return GetCounterEvents (); }
+ set { SetCounterEvents (value); }
+ }
+
+ [MethodImpl (MethodImplOptions.InternalCall)]
+ extern static bool GetJitEvents ();
+
+ [MethodImpl (MethodImplOptions.InternalCall)]
+ extern static void SetJitEvents (bool value);
+
+ public static bool JitEventsEnabled {
+ get { return GetJitEvents (); }
+ set { SetJitEvents (value); }
+ }
+ }
+}
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Runtime.InteropServices;
-
-namespace Mono.Profiler.Log {
-
- public static class LogRuntimeProfiler {
-
- // TODO: Runtime profiler interface.
- }
-}
LIBRARY = Mono.Reactive.Testing.dll
LIB_REFS = System System.Core System.Reactive.Interfaces System.Reactive.Core System.Reactive.Linq System.Reactive.PlatformServices System.Reactive.Providers System.Reactive.Runtime.Remoting System.Reactive.Experimental System.Reactive.Windows.Forms System.Reactive.Windows.Threading System.Reactive.Observable.Aliases System.Windows.Forms WindowsBase nunitlite
LIB_MCS_FLAGS = \
- @more_build_args \
-d:NUNIT -d:MONO -d:DESKTOPCLR
# NO_PERF is required to disable ObservableMultipleTest.Catch_TailRecursive2 which blocked test execution.
# disabled -d:HAS_WINFORMS
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:0618
-EXTRA_DISTFILES = more_build_args
+EXTRA_DISTFILES =
VALID_PROFILE := $(filter net_4_x, $(PROFILE))
ifndef VALID_PROFILE
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../mono.pub")]
include ../../build/rules.make
LIBRARY = Mono.Security.Win32.dll
+KEYFILE = ../mono.pub
LIB_MCS_FLAGS = /unsafe
EXTRA_DISTFILES = README
<AssemblyName>Mono.Security.Win32</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../mono.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: NeutralResourcesLanguage ("en-US")]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../mono.pub")]
[assembly: InternalsVisibleTo ("System, PublicKey=" + AssemblyRef.FrameworkPublicKeyFull2)]
LIBRARY = Mono.Security.dll
LOCAL_MCS_FLAGS =
LIB_REFS = bare/System
+KEYFILE = ../mono.pub
LIB_MCS_FLAGS = -unsafe -nowarn:1030,3009
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:169,219,618,672
<AssemblyName>Mono.Security</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../mono.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: ComVisible (false)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile("../mono.pub")]
LIBRARY = Mono.ServiceModel.IdentitySelectors.dll
LIB_REFS = System System.Xml System.Configuration System.Security System.Transactions System.Web System.Web.Services Mono.Security
+KEYFILE = ../mono.pub
LIB_MCS_FLAGS = \
/nowarn:414,169,67,3005,436 \
/unsafe \
[assembly: ComVisible (false)]
[assembly: NeutralResourcesLanguage ("en-US")]
[assembly: AssemblyDelaySign(true)]
-[assembly: AssemblyKeyFile("../mono.pub")]
[assembly: CLSCompliant(true)]
LIBRARY = Mono.Simd.dll
LIB_REFS = System.Core
+KEYFILE = ../mono.pub
LIB_MCS_FLAGS = /unsafe
NO_TEST = yes
<AssemblyName>Mono.Simd</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../mono.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
*/
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../mono.pub")]
LIBRARY = Mono.Tasklets.dll
+KEYFILE = ../mono.pub
LIB_MCS_FLAGS =
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
<AssemblyName>Mono.Tasklets</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../mono.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
[assembly: AssemblyDelaySign(true)]
-[assembly: AssemblyKeyFile("../mono.snk")]
LIBRARY = Mono.WebBrowser.dll
LIB_REFS = System
+KEYFILE = ../mono.snk
LIB_MCS_FLAGS = -warn:1
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
<AssemblyName>Mono.WebBrowser</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../mono.snk</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: ComVisible (false)]
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile("../mono.pub")]
[assembly: AssemblyFileVersion (XBuildConsts.FileVersion)]
LIBRARY = Mono.XBuild.Tasks.dll
LIB_REFS = $(PARENT_PROFILE)System $(PARENT_PROFILE)System.Xml
+KEYFILE = ../mono.pub
LIB_MCS_FLAGS =
TEST_NUNITLITE_APP_CONFIG_RUNTIME=Test/test-config-file-$(PROFILE)
<AssemblyName>Mono.XBuild.Tasks</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../mono.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: AllowPartiallyTrustedCallers]
[assembly: AssemblyDelaySign(true)]
-[assembly: AssemblyKeyFile("../ecma.pub")]
endif
LIB_REFS = System System.Xml
+KEYFILE = ../ecma.pub
LIB_MCS_FLAGS = $(SCARY_LIB) /unsafe
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
LIBRARY = Novell.Directory.Ldap.dll
LIB_REFS = System Mono.Security
+KEYFILE = ../mono.pub
LIB_MCS_FLAGS = -warn:1 -nowarn:612
RESOURCE_DEFS = ResultCodeMessages,Novell.Directory.Ldap.Utilclass/ResultCodeMessages.txt
<AssemblyName>Novell.Directory.Ldap</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../mono.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: AssemblyVersion (Consts.FxVersion)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../mono.pub")]
*/
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../mono.pub")]
LIBRARY = PEAPI.dll
LIB_REFS = System
+KEYFILE = ../mono.pub
LIB_MCS_FLAGS = -nowarn:414,618
NO_TEST = yes
<AssemblyName>PEAPI</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../mono.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>RabbitMQ.Client.Apigen</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
//[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile("../../../msfinal.pub")]
[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
[assembly: CompilationRelaxations (CompilationRelaxations.NoStringInterning)]
LIBRARY = RabbitMQ.Client.dll
LIB_REFS = System System.Xml
+KEYFILE = ../../../msfinal.pub
LIB_MCS_FLAGS = -nowarn:618
NO_TEST = yes
<AssemblyName>RabbitMQ.Client</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../../../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>SMDiagnostics</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
RESOURCE_DEFS = Microsoft.Internal.Strings,src/ComponentModel/Strings.resx
endif
+KEYFILE = ../ecma.pub
LIB_MCS_FLAGS = -d:CLR40 -d:USE_ECMA_KEY,FEATURE_REFLECTIONCONTEXT,FEATURE_REFLECTIONFILEIO,FEATURE_SERIALIZATION,FEATURE_SLIMLOCK -nowarn:219,414 -nowarn:436
<AssemblyName>System.ComponentModel.Composition</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../ecma.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../ecma.pub")]
[assembly: SecurityCritical]
[assembly: AllowPartiallyTrustedCallers]
[assembly: NeutralResourcesLanguage ("en-US")]
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../winfx.pub")]
[assembly: ComVisible (false)]
[assembly: AllowPartiallyTrustedCallers]
LIBRARY = System.ComponentModel.DataAnnotations.dll
LIB_REFS = System System.Core System.Data System.Xml
+KEYFILE = ../winfx.pub
LIB_MCS_FLAGS = -nowarn:414
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
<AssemblyName>System.ComponentModel.DataAnnotations</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../winfx.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: ComVisible (false)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../msfinal.pub")]
[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
[assembly: ComCompatibleVersion (1, 0, 3300, 0)]
LIBRARY = System.Configuration.Install.dll
LIB_REFS = System System.Xml
+KEYFILE = ../msfinal.pub
LIB_MCS_FLAGS =
NO_TEST = yes
<AssemblyName>System.Configuration.Install</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: AllowPartiallyTrustedCallers]
[assembly: AssemblyDelaySign (true)]
- [assembly: AssemblyKeyFile ("../msfinal.pub")]
[assembly: InternalsVisibleTo ("System.Web, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
LOCAL_MCS_FLAGS =
LIB_REFS = secxml/System bare/System.Xml System.Security
+KEYFILE = ../msfinal.pub
LIB_MCS_FLAGS = -nowarn:618
TEST_MCS_FLAGS =
TEST_LIB_REFS = System.Xml System
<AssemblyName>System.Configuration</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
endif
ifneq (basic, $(PROFILE))
-CLR_PROFILE := $(filter 2.0 4.0 4.5, $(FRAMEWORK_VERSION))
-endif
-
-ifdef CLR_PROFILE
+ifneq (2.1, $(FRAMEWORK_VERSION))
LIB_REFS += Mono.Posix
endif
+endif
CC_PROFILE := $(filter monotouch% xammac, $(PROFILE))
ifdef CC_PROFILE
<AssemblyName>System.Core</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
namespace System.Security.Cryptography.X509Certificates
{
- public static class RSACertificateExtensions
+#if SYSTEM_SECURITY_DLL
+ internal
+#else
+ public
+#endif
+ static class RSACertificateExtensions
{
public static RSA GetRSAPrivateKey(this X509Certificate2 certificate)
{
[assembly: NeutralResourcesLanguage ("en-US")]
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../ecma.pub")]
[assembly: ComVisible (false)]
[assembly: AllowPartiallyTrustedCallers]
TXT_RESOURCE_STRINGS = ../referencesource/System.Data.DataSetExtensions/System.Data.DataSetExtensions.txt
LIB_REFS = System.Core System System.Data System.Xml
+KEYFILE = ../ecma.pub
LIB_MCS_FLAGS = -nowarn:436
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -doc:$(test_lib:.dll=.xml) -nowarn:219 -nowarn:169 $(NUNIT_RESOURCE_FILES:%=/resource:%)
<AssemblyName>System.Data.DataSetExtensions</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../ecma.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../ecma.pub")]
[assembly: ComVisible (false)]
LIBRARY = System.Data.Entity.dll
LIB_REFS = System System.Core System.Data System.Xml System.Xml.Linq System.Transactions System.Runtime.Serialization System.ComponentModel.DataAnnotations System.Configuration
+KEYFILE = ../ecma.pub
LIB_MCS_FLAGS = -warn:2
TXT_RESOURCE_STRINGS = ../referencesource/System.Data.Entity/System.Data.Entity.txt
<AssemblyName>System.Data.Entity</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../ecma.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
LIBRARY = System.Data.Linq.dll
LIB_REFS = System System.Core System.Xml System.Data System.Runtime.Serialization
+KEYFILE = ../ecma.pub
LIB_MCS_FLAGS = \
/resource:./src/DbLinq/Schema/Dbml/DbmlSchema.xsd,DbLinq.Schema.Dbml.DbmlSchema.xsd \
/d:MONO_STRICT /d:MONO_DEPLOY -warn:1
<AssemblyName>System.Data.Linq</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../ecma.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: NeutralResourcesLanguage ("en-US")]\r
[assembly: CLSCompliant (true)]\r
[assembly: AssemblyDelaySign (true)]\r
-[assembly: AssemblyKeyFile ("../ecma.pub")]\r
#endif\r
\r
[assembly: ComVisible (false)]\r
LIBRARY = System.Data.Linq.dll
LIB_REFS = System System.Core System.Data System.Transactions System.Xml
+KEYFILE = ../ecma.pub
LIB_MCS_FLAGS =
NO_TEST = yes
-ifeq (2.0, $(FRAMEWORK_VERSION))
-# This is a .NET 3.5 only assembly, but built during the 2.0 build
-LIB_MCS_FLAGS += -d:NET_3_5
-endif
-
include ../../build/library.make
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
- [assembly: AssemblyKeyFile ("../ecma.pub")]
[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
[assembly: AllowPartiallyTrustedCallers]
LIBRARY = System.Data.OracleClient.dll
LIB_REFS = System System.Xml System.Data System.EnterpriseServices System.Drawing
+KEYFILE = ../ecma.pub
LIB_MCS_FLAGS =
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) /nowarn:618
<AssemblyName>System.Data.OracleClient</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../ecma.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
using System.Runtime.Versioning;
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../ecma.pub")]
[assembly: System.Security.SecurityCritical]
[assembly: ComVisible(false)]
RESOURCE_DEFS = System.Data.Services.Client,Client/System.Data.Services.Client.txt
LIB_REFS = System System.Core System.Xml.Linq System.Data System.Xml
+KEYFILE = ../ecma.pub
LIB_MCS_FLAGS = \
-d:NET_3_5 \
-warn:2
<AssemblyName>System.Data.Services.Client</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../ecma.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: NeutralResourcesLanguage ("en-US")]\r
\r
[assembly: AssemblyDelaySign (true)]\r
-[assembly: AssemblyKeyFile ("../ecma.pub")]\r
\r
[assembly: ComVisible (false)]\r
[assembly: CLSCompliant (true)]\r
LIBRARY = System.Data.Services.dll
LIB_REFS = System System.Core System.ServiceModel System.ServiceModel.Web System.Data.Services.Client
+KEYFILE = ../ecma.pub
LIB_MCS_FLAGS = -d:NET_3_5
ifeq (4, $(FRAMEWORK_VERSION_MAJOR))
<AssemblyName>System.Data.Services</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../ecma.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: AllowPartiallyTrustedCallers]
[assembly: AssemblyDelaySign (true)]
- [assembly: AssemblyKeyFile("../ecma.pub")]
[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
[assembly: InternalsVisibleTo ("System.Data.DataSetExtensions, PublicKey=" + AssemblyRef.FrameworkPublicKeyFull)]
LIBRARY = System.Data.dll
LIB_REFS = System System.Xml System.Core System.Numerics
+KEYFILE = ../ecma.pub
LIB_MCS_FLAGS = \
-nowarn:219,414,649 \
-d:COREFX \
<AssemblyName>System.Data</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../ecma.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>System.Deployment</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
[assembly: ComVisible (false)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile("../msfinal.pub")]
[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
[assembly: ComCompatibleVersion (1, 0, 3300, 0)]
LIBRARY = System.Design.dll
LIB_REFS = System System.Xml plainweb/System.Web System.Windows.Forms System.Drawing Accessibility System.Data System.Configuration
+KEYFILE = ../msfinal.pub
LIB_MCS_FLAGS = -nowarn:436 -nowarn:612,618,649,67,672
TEST_LIB_REFS = System System.Drawing System.Windows.Forms
$(the_libdir_base)plaindesign/System.Design.dll:
$(MAKE) intermediate=plaindesign/ $(the_libdir_base)plaindesign/System.Design.dll
+
endif
<AssemblyName>System.Design</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>System.Design</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
- [assembly: AssemblyKeyFile ("../msfinal.pub")]
[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
[assembly: AllowPartiallyTrustedCallers]
LIBRARY = System.DirectoryServices.Protocols.dll
LIB_REFS = System System.DirectoryServices System.Xml
+KEYFILE = ../msfinal.pub
LIB_MCS_FLAGS =
NO_TEST = yes
<AssemblyName>System.DirectoryServices.Protocols</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
- [assembly: AssemblyKeyFile ("../msfinal.pub")]
[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
[assembly: AllowPartiallyTrustedCallers]
LIBRARY = System.DirectoryServices.dll
LIB_REFS = System Novell.Directory.Ldap
+KEYFILE = ../msfinal.pub
LIB_MCS_FLAGS =
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:0618 -nowarn:219 -nowarn:169
<AssemblyName>System.DirectoryServices</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
namespace MonoTests.System.DirectoryServices \r
{\r
[TestFixture]\r
- [Category ("InetAccess")]\r
public class DirectoryServicesDirectoryEntryTest\r
{\r
#region Fields\r
{\r
de = null;\r
configuration = new TestConfiguration ();\r
+\r
+ if (String.IsNullOrEmpty (configuration.ConnectionString))\r
+ Assert.Ignore ("No configuration");\r
}\r
\r
\r
namespace MonoTests.System.DirectoryServices \r
{\r
[TestFixture]\r
- [Category ("InetAccess")]\r
public class DirectoryServicesDirectorySearcherTest\r
{\r
#region Fields\r
{\r
de = null; \r
configuration = new TestConfiguration ();\r
+\r
+ if (String.IsNullOrEmpty (configuration.ConnectionString))\r
+ Assert.Ignore ("No configuration");\r
}\r
\r
\r
namespace MonoTests.System.DirectoryServices \r
{\r
[TestFixture]\r
- [Category ("InetAccess")]\r
public class DirectoryServicesSearchResultTest\r
{\r
#region Fields\r
{\r
de = null;\r
configuration = new TestConfiguration ();\r
+\r
+ if (String.IsNullOrEmpty (configuration.ConnectionString))\r
+ Assert.Ignore ("No configuration");\r
}\r
\r
\r
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile("../msfinal.pub")]
[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
[assembly: CompilationRelaxations (CompilationRelaxations.NoStringInterning)]
LIBRARY = System.Drawing.Design.dll
LIB_REFS = System System.Drawing System.Windows.Forms
+KEYFILE = ../msfinal.pub
LIB_MCS_FLAGS =
NO_TEST = yes
<AssemblyName>System.Drawing.Design</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: ComCompatibleVersion (1, 0, 3300, 0)]
[assembly: AllowPartiallyTrustedCallers]
- [assembly: CLSCompliant (true)]
- [assembly: AssemblyDelaySign (true)]
-#if !MOBILE
- [assembly: AssemblyKeyFile("../msfinal.pub")]
-#endif
+[assembly: CLSCompliant (true)]
+[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
[assembly: CompilationRelaxations (CompilationRelaxations.NoStringInterning)]
LIBRARY = System.Drawing.dll
LIB_REFS = System
+KEYFILE = ../msfinal.pub
LIB_MCS_FLAGS = /unsafe \
-resource:Assembly/Mono.ico,Mono.ico -resource:Assembly/Information.ico,Information.ico \
-resource:Assembly/Error.ico,Error.ico -resource:Assembly/Warning.ico,Warning.ico \
RESX_RESOURCE_STRING = ../../../external/corefx/src/System.Drawing.Common/src/Resources/Strings.resx
-MOBILE_LIKE := $(filter winaot orbis unreal, $(PROFILE))
-
-ifdef MOBILE_LIKE
-LIB_MCS_FLAGS += /keyfile:../msfinal.pub
-else
+ifndef MOBILE_PROFILE
LIB_MCS_FLAGS += -d:FEATURE_TYPECONVERTER,SUPPORTS_WINDOWS_COLORS
endif
<AssemblyName>System.Drawing</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
<ItemGroup>\r
<Compile Include="..\..\..\external\corefx\src\System.Drawing.Common\src\AssemblyRef.cs" />\r
- <Compile Include="..\..\..\external\corefx\src\System.Drawing.Common\src\misc\ClientUtils.cs" />\r
<Compile Include="..\..\..\external\corefx\src\System.Drawing.Common\src\misc\HandleCollector.cs" />\r
<Compile Include="..\..\..\external\corefx\src\System.Drawing.Common\src\System\Drawing\BitmapSuffixInSameAssemblyAttribute.cs" />\r
<Compile Include="..\..\..\external\corefx\src\System.Drawing.Common\src\System\Drawing\BitmapSuffixInSatelliteAssemblyAttribute.cs" />\r
<Compile Include="..\..\..\external\corefx\src\System.Drawing.Common\src\System\Drawing\Brush.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Drawing.Common\src\System\Drawing\ClientUtils.cs" />\r
<Compile Include="..\..\..\external\corefx\src\System.Drawing.Common\src\System\Drawing\DashCap.cs" />\r
<Compile Include="..\..\..\external\corefx\src\System.Drawing.Common\src\System\Drawing\Design\CategoryNameCollection.cs" />\r
<Compile Include="..\..\..\external\corefx\src\System.Drawing.Common\src\System\Drawing\Design\IPropertyValueUIService.cs" />\r
Assembly/AssemblyInfo.cs
../../build/common/Consts.cs
../../build/common/Locale.cs
-../../../external/corefx/src/System.Drawing.Common/src/misc/ClientUtils.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/ClientUtils.cs
../../../external/corefx/src/System.Drawing.Common/src/misc/HandleCollector.cs
../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Gdiplus.cs
../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/NativeMethods.cs
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../ecma.pub")]
[assembly: SecurityCritical]
LIBRARY = System.Dynamic.dll
LIB_REFS = System.Core System
+KEYFILE = ../ecma.pub
LIB_MCS_FLAGS = -unsafe -d:CODEPLEX_40 -nowarn:414,169
# This is a .NET 4.0+ only assembly
<AssemblyName>System.Dynamic</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../ecma.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile("../msfinal.pub")]
[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
LIBRARY = System.EnterpriseServices.dll
LIB_REFS = System.Transactions
+KEYFILE = ../msfinal.pub
LIB_MCS_FLAGS = /nowarn:0168 /nowarn:0162
NO_TEST = yes
<AssemblyName>System.EnterpriseServices</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../ecma.pub")]
LIBRARY = System.IO.Compression.FileSystem.dll
LIB_REFS = System System.IO.Compression
+KEYFILE = ../ecma.pub
LIB_MCS_FLAGS = -unsafe
TEST_MCS_FLAGS =
TEST_LIB_REFS = System System.Core System.IO.Compression
<AssemblyName>System.IO.Compression.FileSystem</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../ecma.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../ecma.pub")]
LIBRARY = System.IO.Compression.dll
LIB_REFS = System
+KEYFILE = ../ecma.pub
LIB_MCS_FLAGS =
TEST_MCS_FLAGS =
TEST_LIB_REFS = System System.Core
<AssemblyName>System.IO.Compression</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../ecma.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: NeutralResourcesLanguage ("en-US")]
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../ecma.pub")]
[assembly: ComVisible (false)]
LIBRARY = System.IdentityModel.Selectors.dll
LIB_REFS = System System.Xml System.Security System.Runtime.Serialization System.IdentityModel
+KEYFILE = ../ecma.pub
LIB_MCS_FLAGS = /d:NET_3_0
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
<AssemblyName>System.IdentityModel.Selectors</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../ecma.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: NeutralResourcesLanguage ("en-US")]
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../ecma.pub")]
[assembly: ComVisible (false)]
[assembly: ComCompatibleVersion (1, 0, 3300, 0)]
LIBRARY = System.IdentityModel.dll
LIB_REFS = System System.Xml System.Security $(MONO_SECURITY) System.Runtime.Serialization
+KEYFILE = ../ecma.pub
LIB_MCS_FLAGS = \
/d:NET_3_0 \
$(OTHER_LIB_MCS_FLAGS)
<AssemblyName>System.IdentityModel</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../ecma.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
LIBRARY = System.Interactive.Async.dll
LIB_REFS = System System.Core
-LIB_MCS_FLAGS = @more_build_args
+KEYFILE = ../reactive.pub
+LIB_MCS_FLAGS = -d:SIGNED -delaysign
ifeq (2.1, $(FRAMEWORK_VERSION))
LIB_MCS_FLAGS += -d:NO_TASK_DELAY -d:HAS_AWAIT
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
-EXTRA_DISTFILES = more_build_args
+EXTRA_DISTFILES =
INSTALL_PROFILE := $(filter net_4_x, $(PROFILE))
ifndef INSTALL_PROFILE
+++ /dev/null
--d:SIGNED
--delaysign
--keyfile:../reactive.pub
LIBRARY = System.Interactive.Providers.dll
LIB_REFS = System System.Core System.Interactive
-LIB_MCS_FLAGS = @more_build_args
+KEYFILE = ../reactive.pub
+LIB_MCS_FLAGS = -d:SIGNED -delaysign
ifeq (2.1, $(FRAMEWORK_VERSION))
LIB_MCS_FLAGS += -d:NO_TASK_DELAY -d:HAS_AWAIT
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
-EXTRA_DISTFILES = more_build_args
+EXTRA_DISTFILES =
INSTALL_PROFILE := $(filter net_4_x, $(PROFILE))
ifndef INSTALL_PROFILE
+++ /dev/null
--d:SIGNED
--delaysign
--keyfile:../reactive.pub
LIBRARY = System.Interactive.dll
LIB_REFS = System System.Core
-LIB_MCS_FLAGS = @more_build_args
+KEYFILE = ../reactive.pub
+LIB_MCS_FLAGS = -d:SIGNED -delaysign
ifeq (2.1, $(FRAMEWORK_VERSION))
LIB_MCS_FLAGS += -d:NO_TASK_DELAY -d:HAS_AWAIT
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
-EXTRA_DISTFILES = more_build_args
+EXTRA_DISTFILES =
INSTALL_PROFILE := $(filter net_4_x, $(PROFILE))
ifndef INSTALL_PROFILE
+++ /dev/null
--d:SIGNED
--delaysign
--keyfile:../reactive.pub
<AssemblyName>System.Json.Microsoft</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../winfx.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
[assembly: NeutralResourcesLanguage ("en-US")]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../winfx.pub")]
[assembly: ComVisible (false)]
LIBRARY = System.Json.dll
LIB_REFS = System System.Xml System.Core
+KEYFILE = ../winfx.pub
LIB_MCS_FLAGS =
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
<AssemblyName>System.Json</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../winfx.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile("../msfinal.pub")]
[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
[assembly: CompilationRelaxations (CompilationRelaxations.NoStringInterning)]
LIBRARY = System.Management.dll
LIB_REFS = System System.Configuration.Install
+KEYFILE = ../msfinal.pub
LIB_MCS_FLAGS =
NO_TEST = yes
<AssemblyName>System.Management</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile("../msfinal.pub")]
[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
[assembly: CompilationRelaxations (CompilationRelaxations.NoStringInterning)]
LIB_REFS += System.Drawing
endif
+KEYFILE = ../msfinal.pub
LIB_MCS_FLAGS = /resource:System.Messaging/MessageQueue.resx
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:0618 -nowarn:219 -nowarn:169
TEST_LIB_REFS = nunit.mocks
<AssemblyName>System.Messaging</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>System.Net.Http.Formatting</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../winfx.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../msfinal.pub")]
[assembly: ComVisible (false)]
LIBRARY = System.Net.Http.WebRequest.dll
LIB_REFS = System.Net.Http System
+KEYFILE = ../msfinal.pub
LIB_MCS_FLAGS =
TEST_MCS_FLAGS =
<AssemblyName>System.Net.Http.WebRequest</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile("../msfinal.pub")]
[assembly: SecurityCritical]
LIBRARY = System.Net.Http.WinHttpHandler.dll
LIB_REFS = System System.Net.Http
+KEYFILE = ../msfinal.pub
LIB_MCS_FLAGS =
NO_TEST = yes
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../msfinal.pub")]
[assembly: ComVisible (false)]
LIBRARY = System.Net.Http.dll
LIB_REFS = System.Core System
+KEYFILE = ../msfinal.pub
LIB_MCS_FLAGS = $(EXTRA_LIB_MCS_FLAGS)
ifeq (monodroid,$(PROFILE))
LIB_MCS_FLAGS += -d:XAMARIN_MODERN
<AssemblyName>System.Net.Http</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
wrequest.ResendContentFactory = content.CopyTo;
- var stream = await wrequest.GetRequestStreamAsync ().ConfigureAwait (false);
- await request.Content.CopyToAsync (stream).ConfigureAwait (false);
+ using (var stream = await wrequest.GetRequestStreamAsync ().ConfigureAwait (false)) {
+ await request.Content.CopyToAsync (stream).ConfigureAwait (false);
+ }
} else if (HttpMethod.Post.Equals (request.Method) || HttpMethod.Put.Equals (request.Method) || HttpMethod.Delete.Equals (request.Method)) {
// Explicitly set this to make sure we're sending a "Content-Length: 0" header.
// This fixes the issue that's been reported on the forums:
<AssemblyName>System.Net</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile("../msfinal.pub")]
[assembly: SecurityCritical]
LIBRARY = System.Numerics.Vectors.dll
LIB_REFS = System System.Numerics
+KEYFILE = ../msfinal.pub
LIB_MCS_FLAGS = -unsafe
RESX_RESOURCE_STRING = ../../../external/corefx/src/System.Numerics.Vectors/src/Resources/Strings.resx
<AssemblyName>System.Numerics.Vectors</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../ecma.pub")]
[assembly: SecurityCritical]
LIBRARY = System.Numerics.dll
LIB_REFS = System
+KEYFILE = ../ecma.pub
LIB_MCS_FLAGS = /unsafe
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
XTEST_LIB_REFS = System Facades/System.Threading.Tasks Facades/System.Runtime.InteropServices.RuntimeInformation System.Core System.Numerics.Vectors Microsoft.CSharp
<AssemblyName>System.Numerics</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../ecma.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
<ItemGroup>\r
<Compile Include="..\..\..\external\corefx\src\Common\src\System\Globalization\FormatProvider.Number.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\Common\src\System\MathF.netstandard.cs" />\r
<Compile Include="..\..\..\external\corefx\src\Common\src\System\Numerics\Hashing\HashHelpers.cs" />\r
- <Compile Include="..\..\..\external\corefx\src\System.Numerics.Vectors\src\System\MathF.cs" />\r
<Compile Include="..\..\..\external\corefx\src\System.Numerics.Vectors\src\System\Numerics\JitIntrinsicAttribute.cs" />\r
<Compile Include="..\..\..\external\corefx\src\System.Numerics.Vectors\src\System\Numerics\Matrix3x2.cs" />\r
<Compile Include="..\..\..\external\corefx\src\System.Numerics.Vectors\src\System\Numerics\Matrix4x4.cs" />\r
../../../external/corefx/src/System.Runtime.Numerics/src/System/Numerics/Complex.cs
../../../external/corefx/src/System.Runtime.Numerics/src/System/Numerics/NumericsHelpers.cs
-../../../external/corefx/src/System.Numerics.Vectors/src/System/MathF.cs
+../../../external/corefx/src/Common/src/System/MathF.netstandard.cs
../../../external/corefx/src/System.Numerics.Vectors/src/System/Numerics/JitIntrinsicAttribute.cs
../../../external/corefx/src/System.Numerics.Vectors/src/System/Numerics/Matrix3x2.cs
-../../../external/corefx/src/Common/tests/System/AssertExtensions.cs
+../../../external/corefx/src/CoreFx.Private.TestUtilities/src/System/AssertExtensions.cs
../../../external/corefx/src/Common/tests/System/PlatformDetection.cs
+../../../external/corefx/src/Common/src/System/MathF.netstandard.cs
# ../../../external/corefx/src/System.Runtime.Numerics/tests/*.cs
../../../external/corefx/src/System.Runtime.Numerics/tests/BigInteger/*.cs
LIBRARY = System.Reactive.Core.dll
LIB_REFS = System System.Core System.Reactive.Interfaces
-LIB_MCS_FLAGS = \
- @more_build_args
+KEYFILE = ../reactive.pub
+LIB_MCS_FLAGS = -d:SIGNED -delaysign -resource:Strings_Core.resources,System.Reactive.Strings_Core.resources
ifeq (true, $(GENERATE_RESOURCES))
LIB_MCS_FLAGS += /define:GENERATING_RESOURCES
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
-EXTRA_DISTFILES = more_build_args $(RESX_RESOURCES:.resources=.resx) $(PREBUILT)
+EXTRA_DISTFILES = $(RESX_RESOURCES:.resources=.resx) $(PREBUILT)
INSTALL_PROFILE := $(filter net_4_x, $(PROFILE))
ifndef INSTALL_PROFILE
<AssemblyName>System.Reactive.Core</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../reactive.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugType>full</DebugType>\r
<NoWarn>1699</NoWarn>\r
<Optimize>false</Optimize>\r
- <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+ <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;SIGNED;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
<DebugType>pdbonly</DebugType>\r
<NoWarn>1699</NoWarn>\r
<Optimize>true</Optimize>\r
- <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+ <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;SIGNED;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
+++ /dev/null
--d:SIGNED
--delaysign
--keyfile:../reactive.pub
--resource:Strings_Core.resources,System.Reactive.Strings_Core.resources
LIBRARY = System.Reactive.Debugger.dll
LIB_REFS = System System.Core System.Reactive.Interfaces System.Reactive.Core System.Reactive.Linq
-LIB_MCS_FLAGS = @more_build_args
+KEYFILE = ../reactive.pub
+LIB_MCS_FLAGS = -d:SIGNED -delaysign
ifeq (2.1, $(FRAMEWORK_VERSION))
LIB_MCS_FLAGS += -d:NO_TASK_DELAY -d:HAS_AWAIT
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
-EXTRA_DISTFILES = more_build_args
+EXTRA_DISTFILES =
INSTALL_PROFILE := $(filter net_4_x, $(PROFILE))
ifndef INSTALL_PROFILE
<AssemblyName>System.Reactive.Debugger</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../reactive.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugType>full</DebugType>\r
<NoWarn>1699</NoWarn>\r
<Optimize>false</Optimize>\r
- <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+ <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;SIGNED;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
<DebugType>pdbonly</DebugType>\r
<NoWarn>1699</NoWarn>\r
<Optimize>true</Optimize>\r
- <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+ <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;SIGNED;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
+++ /dev/null
--d:SIGNED
--delaysign
--keyfile:../reactive.pub
LIBRARY = System.Reactive.Experimental.dll
LIB_REFS = System System.Core System.Reactive.Interfaces System.Reactive.Core System.Reactive.Linq
-LIB_MCS_FLAGS = @more_build_args
+KEYFILE = ../reactive.pub
+LIB_MCS_FLAGS = -d:SIGNED -delaysign
ifeq (2.1, $(FRAMEWORK_VERSION))
LIB_MCS_FLAGS += -d:NO_TASK_DELAY -d:HAS_AWAIT
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
-EXTRA_DISTFILES = more_build_args
+EXTRA_DISTFILES =
INSTALL_PROFILE := $(filter net_4_x, $(PROFILE))
ifndef INSTALL_PROFILE
<AssemblyName>System.Reactive.Experimental</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../reactive.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugType>full</DebugType>\r
<NoWarn>1699</NoWarn>\r
<Optimize>false</Optimize>\r
- <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+ <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;SIGNED;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
<DebugType>pdbonly</DebugType>\r
<NoWarn>1699</NoWarn>\r
<Optimize>true</Optimize>\r
- <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+ <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;SIGNED;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
+++ /dev/null
--d:SIGNED
--delaysign
--keyfile:../reactive.pub
LIBRARY = System.Reactive.Interfaces.dll
LIB_REFS = System System.Core
-LIB_MCS_FLAGS = @more_build_args
+KEYFILE = ../reactive.pub
+LIB_MCS_FLAGS = -d:SIGNED -delaysign
ifeq (2.1, $(FRAMEWORK_VERSION))
LIB_MCS_FLAGS += -d:NO_TASK_DELAY -d:HAS_AWAIT
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
-EXTRA_DISTFILES = more_build_args
+EXTRA_DISTFILES =
INSTALL_PROFILE := $(filter net_4_x, $(PROFILE))
ifndef INSTALL_PROFILE
<AssemblyName>System.Reactive.Interfaces</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../reactive.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugType>full</DebugType>\r
<NoWarn>1699</NoWarn>\r
<Optimize>false</Optimize>\r
- <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+ <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;SIGNED;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
<DebugType>pdbonly</DebugType>\r
<NoWarn>1699</NoWarn>\r
<Optimize>true</Optimize>\r
- <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+ <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;SIGNED;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
+++ /dev/null
--d:SIGNED
--delaysign
--keyfile:../reactive.pub
LIBRARY = System.Reactive.Linq.dll
LIB_REFS = System System.Core System.Reactive.Interfaces System.Reactive.Core
-LIB_MCS_FLAGS = \
- @more_build_args
+KEYFILE = ../reactive.pub
+LIB_MCS_FLAGS = -d:SIGNED -delaysign -resource:Strings_Linq.resources,System.Reactive.Strings_Linq.resources
ifeq (true, $(GENERATE_RESOURCES))
LIB_MCS_FLAGS += /define:GENERATING_RESOURCES
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
-EXTRA_DISTFILES = more_build_args $(RESX_RESOURCES:.resources=.resx) $(PREBUILT)
+EXTRA_DISTFILES = $(RESX_RESOURCES:.resources=.resx) $(PREBUILT)
INSTALL_PROFILE := $(filter net_4_x, $(PROFILE))
ifndef INSTALL_PROFILE
<AssemblyName>System.Reactive.Linq</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../reactive.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugType>full</DebugType>\r
<NoWarn>1699</NoWarn>\r
<Optimize>false</Optimize>\r
- <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+ <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;SIGNED;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
<DebugType>pdbonly</DebugType>\r
<NoWarn>1699</NoWarn>\r
<Optimize>true</Optimize>\r
- <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+ <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;SIGNED;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
+++ /dev/null
--d:SIGNED
--delaysign
--keyfile:../reactive.pub
--resource:Strings_Linq.resources,System.Reactive.Strings_Linq.resources
LIBRARY = System.Reactive.Observable.Aliases.dll
LIB_REFS = System System.Core System.Reactive.Interfaces System.Reactive.Core System.Reactive.Linq System.Reactive.Providers
-LIB_MCS_FLAGS = \
- @more_build_args
+KEYFILE = ../reactive.pub
+LIB_MCS_FLAGS = -d:SIGNED -delaysign
ifeq (true, $(GENERATE_RESOURCES))
LIB_MCS_FLAGS += /define:GENERATING_RESOURCES
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
-EXTRA_DISTFILES = more_build_args $(RESX_RESOURCES:.resources=.resx) $(PREBUILT)
+EXTRA_DISTFILES = $(RESX_RESOURCES:.resources=.resx) $(PREBUILT)
INSTALL_PROFILE := $(filter net_4_x, $(PROFILE))
ifndef INSTALL_PROFILE
<AssemblyName>System.Reactive.Observable.Aliases</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../reactive.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugType>full</DebugType>\r
<NoWarn>1699</NoWarn>\r
<Optimize>false</Optimize>\r
- <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+ <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;SIGNED;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
<DebugType>pdbonly</DebugType>\r
<NoWarn>1699</NoWarn>\r
<Optimize>true</Optimize>\r
- <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+ <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;SIGNED;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
+++ /dev/null
--d:SIGNED
--delaysign
--keyfile:../reactive.pub
LIBRARY = System.Reactive.PlatformServices.dll
LIB_REFS = System System.Core System.Reactive.Interfaces System.Reactive.Core System.Reactive.Linq
-LIB_MCS_FLAGS = \
- @more_build_args
+KEYFILE = ../reactive.pub
+LIB_MCS_FLAGS = -d:SIGNED -delaysign -resource:Strings_PlatformServices.resources,System.Reactive.Strings_PlatformServices.resources
ifeq (true, $(GENERATE_RESOURCES))
LIB_MCS_FLAGS += /define:GENERATING_RESOURCES
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
TEST_LIB_REFS = Mono.Reactive.Tests
-EXTRA_DISTFILES = more_build_args $(RESX_RESOURCES:.resources=.resx) $(PREBUILT)
+EXTRA_DISTFILES = $(RESX_RESOURCES:.resources=.resx) $(PREBUILT)
INSTALL_PROFILE := $(filter net_4_x, $(PROFILE))
ifndef INSTALL_PROFILE
<AssemblyName>System.Reactive.PlatformServices</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../reactive.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugType>full</DebugType>\r
<NoWarn>1699</NoWarn>\r
<Optimize>false</Optimize>\r
- <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+ <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;SIGNED;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
<DebugType>pdbonly</DebugType>\r
<NoWarn>1699</NoWarn>\r
<Optimize>true</Optimize>\r
- <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+ <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;SIGNED;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
+++ /dev/null
--d:SIGNED
--delaysign
--keyfile:../reactive.pub
--resource:Strings_PlatformServices.resources,System.Reactive.Strings_PlatformServices.resources
LIBRARY = System.Reactive.Providers.dll
LIB_REFS = System System.Core System.Reactive.Interfaces System.Reactive.Core System.Reactive.Linq
-LIB_MCS_FLAGS = \
- @more_build_args
+KEYFILE = ../reactive.pub
+LIB_MCS_FLAGS = -d:SIGNED -delaysign -resource:Strings_Providers.resources,System.Reactive.Strings_Providers.resources
ifeq (true, $(GENERATE_RESOURCES))
LIB_MCS_FLAGS += /define:GENERATING_RESOURCES
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
-EXTRA_DISTFILES = more_build_args $(RESX_RESOURCES:.resources=.resx) $(PREBUILT)
+EXTRA_DISTFILES = $(RESX_RESOURCES:.resources=.resx) $(PREBUILT)
INSTALL_PROFILE := $(filter net_4_x, $(PROFILE))
ifndef INSTALL_PROFILE
<AssemblyName>System.Reactive.Providers</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../reactive.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugType>full</DebugType>\r
<NoWarn>1699</NoWarn>\r
<Optimize>false</Optimize>\r
- <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+ <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;SIGNED;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
<DebugType>pdbonly</DebugType>\r
<NoWarn>1699</NoWarn>\r
<Optimize>true</Optimize>\r
- <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+ <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;SIGNED;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
+++ /dev/null
--d:SIGNED
--delaysign
--keyfile:../reactive.pub
--resource:Strings_Providers.resources,System.Reactive.Strings_Providers.resources
LIBRARY = System.Reactive.Runtime.Remoting.dll
LIB_REFS = System System.Core System.Reactive.Interfaces System.Reactive.Core System.Reactive.Linq
-LIB_MCS_FLAGS = \
- @more_build_args
+KEYFILE = ../reactive.pub
+LIB_MCS_FLAGS = -d:SIGNED -delaysign
ifeq (2.1, $(FRAMEWORK_VERSION))
LIB_MCS_FLAGS += -d:NO_TASK_DELAY
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
-EXTRA_DISTFILES = more_build_args
+EXTRA_DISTFILES =
INSTALL_PROFILE := $(filter net_4_x, $(PROFILE))
ifndef INSTALL_PROFILE
<AssemblyName>System.Reactive.Runtime.Remoting</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../reactive.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugType>full</DebugType>\r
<NoWarn>1699</NoWarn>\r
<Optimize>false</Optimize>\r
- <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+ <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;SIGNED;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
<DebugType>pdbonly</DebugType>\r
<NoWarn>1699</NoWarn>\r
<Optimize>true</Optimize>\r
- <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+ <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;SIGNED;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
+++ /dev/null
--d:SIGNED
--delaysign
--keyfile:../reactive.pub
LIBRARY = System.Reactive.Windows.Forms.dll
LIB_REFS = System System.Core System.Reactive.Interfaces System.Reactive.Core System.Reactive.Linq System.Windows.Forms
-LIB_MCS_FLAGS = \
- @more_build_args
+KEYFILE = ../reactive.pub
+LIB_MCS_FLAGS = -d:SIGNED -delaysign
ifeq (2.1, $(FRAMEWORK_VERSION))
LIB_MCS_FLAGS += -d:NO_TASK_DELAY -d:HAS_AWAIT
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
-EXTRA_DISTFILES = more_build_args
+EXTRA_DISTFILES =
INSTALL_PROFILE := $(filter net_4_x, $(PROFILE))
ifndef INSTALL_PROFILE
<AssemblyName>System.Reactive.Windows.Forms</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../reactive.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugType>full</DebugType>\r
<NoWarn>1699</NoWarn>\r
<Optimize>false</Optimize>\r
- <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+ <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;SIGNED;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
<DebugType>pdbonly</DebugType>\r
<NoWarn>1699</NoWarn>\r
<Optimize>true</Optimize>\r
- <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+ <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;SIGNED;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
+++ /dev/null
--d:SIGNED
--delaysign
--keyfile:../reactive.pub
LIBRARY = System.Reactive.Windows.Threading.dll
LIB_REFS = System System.Core System.Reactive.Interfaces System.Reactive.Core System.Reactive.Linq WindowsBase
-LIB_MCS_FLAGS = \
- @more_build_args
+KEYFILE = ../reactive.pub
+LIB_MCS_FLAGS = -d:SIGNED -delaysign -resource:Strings_WindowsThreading.resources,System.Reactive.Strings_WindowsThreading.resources
ifeq (true, $(GENERATE_RESOURCES))
LIB_MCS_FLAGS += /define:GENERATING_RESOURCES
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
-EXTRA_DISTFILES = more_build_args $(RESX_RESOURCES:.resources=.resx) $(PREBUILT)
+EXTRA_DISTFILES = $(RESX_RESOURCES:.resources=.resx) $(PREBUILT)
INSTALL_PROFILE := $(filter net_4_x, $(PROFILE))
ifndef INSTALL_PROFILE
<AssemblyName>System.Reactive.Windows.Threading</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../reactive.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugType>full</DebugType>\r
<NoWarn>1699</NoWarn>\r
<Optimize>false</Optimize>\r
- <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+ <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;SIGNED;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
<DebugType>pdbonly</DebugType>\r
<NoWarn>1699</NoWarn>\r
<Optimize>true</Optimize>\r
- <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT;SIGNED</DefineConstants>\r
+ <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;SIGNED;HAS_EDI;PREFERASYNC;PREFER_ASYNC;HAS_AWAIT</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
+++ /dev/null
--d:SIGNED
--delaysign
--keyfile:../reactive.pub
--resource:Strings_WindowsThreading.resources,System.Reactive.Strings_WindowsThreading.resources
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile("../msfinal.pub")]
[assembly: SecurityCritical]
LIBRARY = System.Reflection.Context.dll
LIB_REFS = System
+KEYFILE = ../msfinal.pub
LIB_MCS_FLAGS =
NO_TEST = yes
<AssemblyName>System.Reflection.Context</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: ComVisible (false)]
-[assembly: AssemblyKeyFile ("../msfinal.pub")]
[assembly: AllowPartiallyTrustedCallers]
[assembly: SecurityRules (SecurityRuleSet.Level2, SkipVerificationInFullTrust=true)]
LIBRARY = System.Runtime.Caching.dll
LIB_REFS = System System.Data System.Configuration System.Core
+KEYFILE = ../msfinal.pub
LIB_MCS_FLAGS = -nowarn:414
RESX_RESOURCE_STRING = \
<AssemblyName>System.Runtime.Caching</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: NeutralResourcesLanguage ("en-US")]
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
-#if MOBILE
-[assembly: AssemblyKeyFile ("../silverlight.pub")]
-#else
-[assembly: AssemblyKeyFile ("../winfx.pub")]
+#if !MOBILE
[assembly: AllowPartiallyTrustedCallers]
[assembly: ComCompatibleVersion (1, 0, 3300, 0)]
#endif
LIB_REFS = System System.Xml System.Core System.Xml.Linq System.Transactions System.ServiceModel.Internals System.Runtime.Serialization
LIB_MCS_FLAGS =
+ifdef MOBILE_PROFILE
+KEYFILE = ../silverlight.pub
+else
+KEYFILE = ../winfx.pub
+endif
+
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
EXTRA_DISTFILES = $(RESOURCE_FILES)
-VALID_PROFILE := $(filter 2.0 4.0 4.5, $(FRAMEWORK_VERSION))
-ifndef VALID_PROFILE
+ifneq (4.5, $(FRAMEWORK_VERSION))
LIBRARY_NAME = dummy-System.Runtime.DurableInstancing.dll
NO_INSTALL = yes
NO_SIGN_ASSEMBLY = yes
<AssemblyName>System.Runtime.DurableInstancing</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../winfx.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: ComCompatibleVersion (1, 0, 3300, 0)]
[assembly: AssemblyDelaySign (true)]
- [assembly: AssemblyKeyFile("../ecma.pub")]
[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
[assembly: CLSCompliant (false)]
LIBRARY = System.Runtime.Remoting.dll
LIB_REFS = System System.Xml System.Runtime.Serialization.Formatters.Soap
+KEYFILE = ../ecma.pub
LIB_MCS_FLAGS =
ifndef NO_SYSTEM_WEB_DEPENDENCY
<AssemblyName>System.Runtime.Remoting</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../ecma.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
}
[Test]
- [Ignore ("https://bugzilla.xamarin.com/show_bug.cgi?id=36634")]
public void Bug609381 ()
{
string portName = "ipc" + Guid.NewGuid ().ToString ("N");
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
- [assembly: AssemblyKeyFile ("../msfinal.pub")]
[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
[assembly: ComVisible (true)]
LIBRARY = System.Runtime.Serialization.Formatters.Soap.dll
LIB_REFS = System.Xml
+KEYFILE = ../msfinal.pub
LIB_MCS_FLAGS =
TEST_LIB_REFS = System
<AssemblyName>System.Runtime.Serialization.Formatters.Soap</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>System.Runtime.Serialization</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: NeutralResourcesLanguage ("en-US")]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../msfinal.pub")]
[assembly: AssemblyDefaultAlias ("System.Security.dll")]
[assembly: AssemblyDescription ("System.Security.dll")]
LIBRARY = System.Security.dll
LIB_REFS = secxml/System bare/System.Xml $(MONO_SECURITY)
-LIB_MCS_FLAGS = -nowarn:618 \
- -d:SECURITY_DEP \
- -nowarn:414
+KEYFILE = ../msfinal.pub
+LIB_MCS_FLAGS = \
+ -nowarn:414,618 \
+ -d:SECURITY_DEP,SYSTEM_SECURITY_DLL
LOCAL_MCS_FLAGS =
+++ /dev/null
-//
-// XmlCanonicalizer.cs - C14N implementation for XML Signature
-// http://www.w3.org/TR/xml-c14n
-//
-// Author:
-// Aleksey Sanin (aleksey@aleksey.com)
-//
-// (C) 2003 Aleksey Sanin (aleksey@aleksey.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.IO;
-using System.Text;
-using System.Xml;
-
-namespace Mono.Xml {
-
- internal class XmlCanonicalizer {
-
- private enum XmlCanonicalizerState
- {
- BeforeDocElement,
- InsideDocElement,
- AfterDocElement
- }
-
- // c14n parameters
- private bool comments;
- private bool exclusive;
- string inclusiveNamespacesPrefixList;
-
- // input/output
- private XmlNodeList xnl;
- private StringBuilder res;
-
- // namespaces rendering stack
- private XmlCanonicalizerState state;
- private ArrayList visibleNamespaces;
- private int prevVisibleNamespacesStart;
- private int prevVisibleNamespacesEnd;
- private Hashtable propagatedNss;
-
- public XmlCanonicalizer (bool withComments, bool excC14N, Hashtable propagatedNamespaces)
- {
- res = new StringBuilder ();
- comments = withComments;
- exclusive = excC14N;
- propagatedNss = propagatedNamespaces;
- }
-
- void Initialize ()
- {
- state = XmlCanonicalizerState.BeforeDocElement;
- visibleNamespaces = new ArrayList ();
- prevVisibleNamespacesStart = 0;
- prevVisibleNamespacesEnd = 0;
- res.Length = 0;
- }
-
- public Stream Canonicalize (XmlDocument doc)
- {
- if (doc == null)
- throw new ArgumentNullException ("doc");
- Initialize ();
-
- FillMissingPrefixes (doc, new XmlNamespaceManager (doc.NameTable), new ArrayList ());
- WriteDocumentNode (doc);
-
- UTF8Encoding utf8 = new UTF8Encoding ();
- byte[] data = utf8.GetBytes (res.ToString ());
- return new MemoryStream (data);
- }
-
- public Stream Canonicalize (XmlNodeList nodes)
- {
- xnl = nodes;
- if (nodes == null || nodes.Count < 1)
- return new MemoryStream ();
- XmlNode n = nodes [0];
- return Canonicalize (n.NodeType == XmlNodeType.Document ? n as XmlDocument : n.OwnerDocument);
- }
-
- // See xml-enc-c14n specification
- public string InclusiveNamespacesPrefixList {
- get { return inclusiveNamespacesPrefixList; }
- set { inclusiveNamespacesPrefixList = value; }
- }
-
- XmlAttribute CreateXmlns (XmlNode n)
- {
- XmlAttribute a = n.Prefix.Length == 0 ?
- n.OwnerDocument.CreateAttribute ("xmlns", "http://www.w3.org/2000/xmlns/") :
- n.OwnerDocument.CreateAttribute ("xmlns", n.Prefix, "http://www.w3.org/2000/xmlns/");
- a.Value = n.NamespaceURI;
- return a;
- }
-
- // Note that this must be done *before* filtering nodes out
- // by context node list.
- private void FillMissingPrefixes (XmlNode n, XmlNamespaceManager nsmgr, ArrayList tmpList)
- {
- if (n.Prefix.Length == 0 && propagatedNss != null) {
- foreach (DictionaryEntry de in propagatedNss)
- if ((string) de.Value == n.NamespaceURI) {
- n.Prefix = (string) de.Key;
- break;
- }
- }
-
- if (n.NodeType == XmlNodeType.Element && ((XmlElement) n).HasAttributes) {
- foreach (XmlAttribute a in n.Attributes)
- if (a.NamespaceURI == "http://www.w3.org/2000/xmlns/")
- nsmgr.AddNamespace (a.Prefix.Length == 0 ? String.Empty : a.LocalName, a.Value);
- nsmgr.PushScope ();
- }
-
- if (n.NamespaceURI.Length > 0 && nsmgr.LookupPrefix (n.NamespaceURI) == null)
- tmpList.Add (CreateXmlns (n));
-
- if (n.NodeType == XmlNodeType.Element && ((XmlElement) n).HasAttributes) {
- foreach (XmlAttribute a in n.Attributes)
- if (a.NamespaceURI.Length > 0 && nsmgr.LookupNamespace (a.Prefix) == null)
- tmpList.Add (CreateXmlns (a));
- }
-
- foreach (XmlAttribute a in tmpList)
- ((XmlElement) n).SetAttributeNode (a);
- tmpList.Clear ();
-
- if (n.HasChildNodes) {
- for (XmlNode c = n.FirstChild; c != null; c = c.NextSibling)
- if (c.NodeType == XmlNodeType.Element)
- FillMissingPrefixes (c, nsmgr, tmpList);
- }
- nsmgr.PopScope ();
- }
-
- private void WriteNode (XmlNode node)
- {
- // Console.WriteLine ("C14N Debug: node=" + node.Name);
-
- bool visible = IsNodeVisible (node);
- switch (node.NodeType) {
- case XmlNodeType.Document:
- case XmlNodeType.DocumentFragment:
- WriteDocumentNode (node);
- break;
- case XmlNodeType.Element:
- WriteElementNode (node, visible);
- break;
- case XmlNodeType.CDATA:
- case XmlNodeType.SignificantWhitespace:
- case XmlNodeType.Text:
- // CDATA sections are processed as text nodes
- WriteTextNode (node, visible);
- break;
- case XmlNodeType.Whitespace:
- if (state == XmlCanonicalizerState.InsideDocElement)
- WriteTextNode (node, visible);
- break;
- case XmlNodeType.Comment:
- WriteCommentNode (node, visible);
- break;
- case XmlNodeType.ProcessingInstruction:
- WriteProcessingInstructionNode (node, visible);
- break;
- case XmlNodeType.EntityReference:
- for (int i = 0; i < node.ChildNodes.Count; i++)
- WriteNode (node.ChildNodes [i]);
- break;
- case XmlNodeType.Attribute:
- throw new XmlException ("Attribute node is impossible here", null);
- case XmlNodeType.EndElement:
- throw new XmlException ("EndElement node is impossible here", null);
- case XmlNodeType.EndEntity:
- throw new XmlException ("EndEntity node is impossible here", null);
- case XmlNodeType.DocumentType:
- case XmlNodeType.Entity:
- case XmlNodeType.Notation:
- case XmlNodeType.XmlDeclaration:
- // just do nothing
- break;
- }
- }
-
- private void WriteDocumentNode (XmlNode node)
- {
- state = XmlCanonicalizerState.BeforeDocElement;
- for (XmlNode child = node.FirstChild; child != null; child = child.NextSibling)
- WriteNode (child);
- }
-
- // Element Nodes
- // If the element is not in the node-set, then the result is obtained
- // by processing the namespace axis, then the attribute axis, then
- // processing the child nodes of the element that are in the node-set
- // (in document order). If the element is inthe node-set, then the result
- // is an open angle bracket (<), the element QName, the result of
- // processing the namespace axis, the result of processing the attribute
- // axis, a close angle bracket (>), the result of processing the child
- // nodes of the element that are in the node-set (in document order), an
- // open angle bracket, a forward slash (/), the element QName, and a close
- // angle bracket.
- private void WriteElementNode (XmlNode node, bool visible)
- {
- // Console.WriteLine ("Debug: element node");
-
- // remember current state
- int savedPrevVisibleNamespacesStart = prevVisibleNamespacesStart;
- int savedPrevVisibleNamespacesEnd = prevVisibleNamespacesEnd;
- int savedVisibleNamespacesSize = visibleNamespaces.Count;
- XmlCanonicalizerState s = state;
- if (visible && state == XmlCanonicalizerState.BeforeDocElement)
- state = XmlCanonicalizerState.InsideDocElement;
-
- // write start tag
- if (visible) {
- res.Append ("<");
- res.Append (node.Name);
- }
-
- // this is odd but you can select namespaces
- // and attributes even if node itself is not visible
- WriteNamespacesAxis (node, visible);
- WriteAttributesAxis (node);
-
- if (visible)
- res.Append (">");
-
- // write children
- for (XmlNode child = node.FirstChild; child != null; child = child.NextSibling)
- WriteNode (child);
-
- // write end tag
- if (visible) {
- res.Append ("</");
- res.Append (node.Name);
- res.Append (">");
- }
-
- // restore state
- if (visible && s == XmlCanonicalizerState.BeforeDocElement)
- state = XmlCanonicalizerState.AfterDocElement;
- prevVisibleNamespacesStart = savedPrevVisibleNamespacesStart;
- prevVisibleNamespacesEnd = savedPrevVisibleNamespacesEnd;
- if (visibleNamespaces.Count > savedVisibleNamespacesSize) {
- visibleNamespaces.RemoveRange (savedVisibleNamespacesSize,
- visibleNamespaces.Count - savedVisibleNamespacesSize);
- }
- }
-
- // Namespace Axis
- // Consider a list L containing only namespace nodes in the
- // axis and in the node-set in lexicographic order (ascending). To begin
- // processing L, if the first node is not the default namespace node (a node
- // with no namespace URI and no local name), then generate a space followed
- // by xmlns="" if and only if the following conditions are met:
- // - the element E that owns the axis is in the node-set
- // - The nearest ancestor element of E in the node-set has a default
- // namespace node in the node-set (default namespace nodes always
- // have non-empty values in XPath)
- // The latter condition eliminates unnecessary occurrences of xmlns="" in
- // the canonical form since an element only receives an xmlns="" if its
- // default namespace is empty and if it has an immediate parent in the
- // canonical form that has a non-empty default namespace. To finish
- // processing L, simply process every namespace node in L, except omit
- // namespace node with local name xml, which defines the xml prefix,
- // if its string value is http://www.w3.org/XML/1998/namespace.
- private void WriteNamespacesAxis (XmlNode node, bool visible)
- {
- // Console.WriteLine ("Debug: namespaces");
-
- XmlDocument doc = node.OwnerDocument;
- bool has_empty_namespace = false;
- ArrayList list = new ArrayList ();
- for (XmlNode cur = node; cur != null && cur != doc; cur = cur.ParentNode) {
- foreach (XmlAttribute attribute in cur.Attributes) {
- if (!IsNamespaceNode (attribute))
- continue;
-
- // get namespace prefix
- string prefix = string.Empty;
- if (attribute.Prefix == "xmlns")
- prefix = attribute.LocalName;
-
- // check if it is "xml" namespace
- if (prefix == "xml" && attribute.Value == "http://www.w3.org/XML/1998/namespace")
- continue;
-
- // make sure that this is an active namespace
- // for our node
- string ns = node.GetNamespaceOfPrefix (prefix);
- if (ns != attribute.Value)
- continue;
-
- // check that it is selected with XPath
- if (!IsNodeVisible (attribute))
- continue;
-
- // check that we have not rendered it yet
- bool rendered = IsNamespaceRendered (prefix, attribute.Value);
-
- // For exc-c14n, only visibly utilized
- // namespaces are written.
- if (exclusive && !IsVisiblyUtilized (node as XmlElement, attribute))
- continue;
-
- // add to the visible namespaces stack
- if (visible)
- visibleNamespaces.Add (attribute);
-
- if (!rendered)
- list.Add (attribute);
-
- if (prefix == string.Empty)
- has_empty_namespace = true;
- }
- }
-
- // add empty namespace if needed
- if (visible && !has_empty_namespace && !IsNamespaceRendered (string.Empty, string.Empty) && node.NamespaceURI == String.Empty)
- res.Append (" xmlns=\"\"");
-
- list.Sort (new XmlDsigC14NTransformNamespacesComparer ());
- foreach (object obj in list) {
- XmlNode attribute = (obj as XmlNode);
- if (attribute != null) {
- res.Append (" ");
- res.Append (attribute.Name);
- res.Append ("=\"");
- res.Append (attribute.Value);
- res.Append ("\"");
- }
- }
-
- // move the rendered namespaces stack
- if (visible) {
- prevVisibleNamespacesStart = prevVisibleNamespacesEnd;
- prevVisibleNamespacesEnd = visibleNamespaces.Count;
- }
- }
-
- // Attribute Axis
- // In lexicographic order (ascending), process each node that
- // is in the element's attribute axis and in the node-set.
- //
- // The processing of an element node E MUST be modified slightly
- // when an XPath node-set is given as input and the element's
- // parent is omitted from the node-set.
- private void WriteAttributesAxis (XmlNode node)
- {
- // Console.WriteLine ("Debug: attributes");
-
- ArrayList list = new ArrayList ();
- foreach (XmlNode attribute in node.Attributes) {
- if (!IsNamespaceNode (attribute) && IsNodeVisible (attribute))
- list.Add (attribute);
- }
-
- // Add attributes from "xml" namespace for "inclusive" c14n only:
- //
- // The method for processing the attribute axis of an element E
- // in the node-set is enhanced. All element nodes along E's
- // ancestor axis are examined for nearest occurrences of
- // attributes in the xml namespace, such as xml:lang and
- // xml:space (whether or not they are in the node-set).
- // From this list of attributes, remove any that are in E's
- // attribute axis (whether or not they are in the node-set).
- // Then, lexicographically merge this attribute list with the
- // nodes of E's attribute axis that are in the node-set. The
- // result of visiting the attribute axis is computed by
- // processing the attribute nodes in this merged attribute list.
- if (!exclusive && node.ParentNode != null && node.ParentNode.ParentNode != null && !IsNodeVisible (node.ParentNode.ParentNode)) {
- // if we have whole document then the node.ParentNode.ParentNode
- // is always visible
- for (XmlNode cur = node.ParentNode; cur != null; cur = cur.ParentNode) {
- if (cur.Attributes == null)
- continue;
- foreach (XmlNode attribute in cur.Attributes) {
- // we are looking for "xml:*" attributes
- if (attribute.Prefix != "xml")
- continue;
-
- // exclude ones that are in the node's attributes axis
- if (node.Attributes.GetNamedItem (attribute.LocalName, attribute.NamespaceURI) != null)
- continue;
-
- // finally check that we don't have the same attribute in our list
- bool found = false;
- foreach (object obj in list) {
- XmlNode n = (obj as XmlNode);
- if (n.Prefix == "xml" && n.LocalName == attribute.LocalName) {
- found = true;
- break;
- }
- }
-
- if (found)
- continue;
-
- // now we can add this attribute to our list
- list.Add (attribute);
- }
- }
- }
-
- // sort namespaces and write results
- list.Sort (new XmlDsigC14NTransformAttributesComparer ());
- foreach (object obj in list) {
- XmlNode attribute = (obj as XmlNode);
- if (attribute != null) {
- res.Append (" ");
- res.Append (attribute.Name);
- res.Append ("=\"");
- res.Append (NormalizeString (attribute.Value, XmlNodeType.Attribute));
- res.Append ("\"");
- }
- }
- }
-
- // Text Nodes
- // the string value, except all ampersands are replaced
- // by &, all open angle brackets (<) are replaced by <, all closing
- // angle brackets (>) are replaced by >, and all #xD characters are
- // replaced by 
.
- private void WriteTextNode (XmlNode node, bool visible)
- {
- // Console.WriteLine ("Debug: text node");
- if (visible)
- res.Append (NormalizeString (node.Value, node.NodeType));
-// res.Append (NormalizeString (node.Value, XmlNodeType.Text));
- }
-
- // Comment Nodes
- // Nothing if generating canonical XML without comments. For
- // canonical XML with comments, generate the opening comment
- // symbol (<!--), the string value of the node, and the
- // closing comment symbol (-->). Also, a trailing #xA is rendered
- // after the closing comment symbol for comment children of the
- // root node with a lesser document order than the document
- // element, and a leading #xA is rendered before the opening
- // comment symbol of comment children of the root node with a
- // greater document order than the document element. (Comment
- // children of the root node represent comments outside of the
- // top-level document element and outside of the document type
- // declaration).
- private void WriteCommentNode (XmlNode node, bool visible)
- {
- // Console.WriteLine ("Debug: comment node");
- if (visible && comments) {
- if (state == XmlCanonicalizerState.AfterDocElement)
- res.Append ("\x0A<!--");
- else
- res.Append ("<!--");
-
- res.Append (NormalizeString (node.Value, XmlNodeType.Comment));
-
- if (state == XmlCanonicalizerState.BeforeDocElement)
- res.Append ("-->\x0A");
- else
- res.Append ("-->");
- }
- }
-
- // Processing Instruction (PI) Nodes-
- // The opening PI symbol (<?), the PI target name of the node,
- // a leading space and the string value if it is not empty, and
- // the closing PI symbol (?>). If the string value is empty,
- // then the leading space is not added. Also, a trailing #xA is
- // rendered after the closing PI symbol for PI children of the
- // root node with a lesser document order than the document
- // element, and a leading #xA is rendered before the opening PI
- // symbol of PI children of the root node with a greater document
- // order than the document element.
- private void WriteProcessingInstructionNode (XmlNode node, bool visible)
- {
- // Console.WriteLine ("Debug: PI node");
-
- if (visible) {
- if (state == XmlCanonicalizerState.AfterDocElement)
- res.Append ("\x0A<?");
- else
- res.Append ("<?");
-
- res.Append (node.Name);
- if (node.Value.Length > 0) {
- res.Append (" ");
- res.Append (NormalizeString (node.Value, XmlNodeType.ProcessingInstruction));
- }
-
- if (state == XmlCanonicalizerState.BeforeDocElement)
- res.Append ("?>\x0A");
- else
- res.Append ("?>");
- }
- }
-
- // determines whether the node is in the node-set or not.
- private bool IsNodeVisible (XmlNode node)
- {
- // if node list is empty then we process whole document
- if (xnl == null)
- return true;
-
- // walk thru the list
- foreach (XmlNode xn in xnl) {
- if (node.Equals (xn))
- return true;
- }
-
- return false;
- }
-
- // This method assumes that the namespace node is *not*
- // rendered yet.
- private bool IsVisiblyUtilized (XmlElement owner, XmlAttribute ns)
- {
- if (owner == null)
- return false;
-
- string prefix = ns.LocalName == "xmlns" ? String.Empty : ns.LocalName;
- if (owner.Prefix == prefix && owner.NamespaceURI == ns.Value)
- return true;
- if (!owner.HasAttributes)
- return false;
- foreach (XmlAttribute a in owner.Attributes) {
- if (a.Prefix == String.Empty)
- continue;
- if (a.Prefix != prefix || a.NamespaceURI != ns.Value)
- continue;
- if (IsNodeVisible (a))
- return true;
- }
- return false;
- }
-
- private bool IsNamespaceRendered (string prefix, string uri)
- {
- // if the default namespace xmlns="" is not re-defined yet
- // then we do not want to print it out
- bool IsEmptyNs = prefix == string.Empty && uri == string.Empty;
- int start = (IsEmptyNs) ? 0 : prevVisibleNamespacesStart;
- for (int i = visibleNamespaces.Count - 1; i >= start; i--) {
- XmlNode node = (visibleNamespaces[i] as XmlNode);
- if (node != null) {
- // get namespace prefix
- string p = string.Empty;
- if (node.Prefix == "xmlns")
- p = node.LocalName;
- if (p == prefix)
- return node.Value == uri;
- }
- }
-
- return IsEmptyNs;
- }
-
- private bool IsNamespaceNode (XmlNode node)
- {
- if (node == null || node.NodeType != XmlNodeType.Attribute)
- return false;
- return node.NamespaceURI == "http://www.w3.org/2000/xmlns/";
- }
-
- private bool IsTextNode (XmlNodeType type)
- {
- switch (type) {
- case XmlNodeType.Text:
- case XmlNodeType.CDATA:
- case XmlNodeType.SignificantWhitespace:
- case XmlNodeType.Whitespace:
- return true;
- }
- return false;
- }
-
- private string NormalizeString (string input, XmlNodeType type)
- {
- StringBuilder sb = new StringBuilder ();
- for (int i = 0; i < input.Length; i++) {
- char ch = input[i];
- if (ch == '<' && (type == XmlNodeType.Attribute || IsTextNode (type)))
- sb.Append ("<");
- else if (ch == '>' && IsTextNode (type))
- sb.Append (">");
- else if (ch == '&' && (type == XmlNodeType.Attribute || IsTextNode (type)))
- sb.Append ("&");
- else if (ch == '\"' && type == XmlNodeType.Attribute)
- sb.Append (""");
- else if (ch == '\x09' && type == XmlNodeType.Attribute)
- sb.Append ("	");
- else if (ch == '\x0A' && type == XmlNodeType.Attribute)
- sb.Append ("
");
- else if (ch == '\x0D')
- sb.Append ("
");
- else
- sb.Append (ch);
- }
-
- return sb.ToString ();
- }
- }
-
- internal class XmlDsigC14NTransformAttributesComparer : IComparer
- {
- public int Compare (object x, object y)
- {
- XmlNode n1 = (x as XmlNode);
- XmlNode n2 = (y as XmlNode);
-
- // simple cases
- if (n1 == n2)
- return 0;
- else if (n1 == null)
- return -1;
- else if (n2 == null)
- return 1;
- else if (n1.Prefix == n2.Prefix)
- return string.CompareOrdinal (n1.LocalName, n2.LocalName);
-
- // Attributes in the default namespace are first
- // because the default namespace is not applied to
- // unqualified attributes
- if (n1.Prefix == string.Empty)
- return -1;
- else if (n2.Prefix == string.Empty)
- return 1;
-
- int ret = string.Compare (n1.NamespaceURI, n2.NamespaceURI);
- if (ret == 0)
- ret = string.Compare (n1.LocalName, n2.LocalName);
- return ret;
- }
- }
-
- internal class XmlDsigC14NTransformNamespacesComparer : IComparer
- {
- public int Compare (object x, object y)
- {
- XmlNode n1 = (x as XmlNode);
- XmlNode n2 = (y as XmlNode);
-
- // simple cases
- if (n1 == n2)
- return 0;
- else if (n1 == null)
- return -1;
- else if (n2 == null)
- return 1;
- else if (n1.Prefix == string.Empty)
- return -1;
- else if (n2.Prefix == string.Empty)
- return 1;
-
- return string.Compare (n1.LocalName, n2.LocalName);
- }
- }
-}
-
<SchemaVersion>2.0</SchemaVersion>\r
<ProjectGuid>{3ED36717-A9D1-4289-8949-9B7F39766DEB}</ProjectGuid>\r
<OutputType>Library</OutputType>\r
- <NoWarn>1699,618,414</NoWarn>\r
+ <NoWarn>1699,414,618</NoWarn>\r
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Windows_NT'">win32</HostPlatform>\r
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Unix' and $([System.IO.File]::Exists('/usr/lib/libc.dylib'))">darwin</HostPlatform>\r
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Unix'">linux</HostPlatform>\r
<AssemblyName>System.Security</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
- <NoWarn>1699,618,414</NoWarn>\r
+ <NoWarn>1699,414,618</NoWarn>\r
<Optimize>false</Optimize>\r
- <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;SECURITY_DEP</DefineConstants>\r
+ <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;SECURITY_DEP;SYSTEM_SECURITY_DLL</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
<DebugType>pdbonly</DebugType>\r
- <NoWarn>1699,618,414</NoWarn>\r
+ <NoWarn>1699,414,618</NoWarn>\r
<Optimize>true</Optimize>\r
- <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;SECURITY_DEP</DefineConstants>\r
+ <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;SECURITY_DEP;SYSTEM_SECURITY_DLL</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
</PropertyGroup>\r
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
<ItemGroup>\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\AncestralNamespaceContextManager.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\AttributeSortOrder.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\C14NAncestralNamespaceContextManager.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\CanonicalizationDispatcher.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\CanonicalXml.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\CanonicalXmlAttribute.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\CanonicalXmlCDataSection.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\CanonicalXmlComment.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\CanonicalXmlDocument.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\CanonicalXmlElement.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\CanonicalXmlEntityReference.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\CanonicalXmlNodeList.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\CanonicalXmlProcessingInstruction.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\CanonicalXmlSignificantWhitespace.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\CanonicalXmlText.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\CanonicalXmlWhitespace.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\CertUsageType.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\CryptoHelpers.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\DocPosition.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\DSASignatureDescription.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\ExcAncestralNamespaceContextManager.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\ExcCanonicalXml.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\ICanonicalizableNode.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\MyXmlDocument.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\NamespaceFrame.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\NamespaceSortOrder.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\Reference.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\ReferenceTargetType.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\RSAPKCS1SHA1SignatureDescription.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\RSAPKCS1SHA256SignatureDescription.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\RSAPKCS1SHA384SignatureDescription.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\RSAPKCS1SHA512SignatureDescription.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\RSAPKCS1SignatureDescription.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\SignedXmlDebugLog.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\Transform.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\TransformChain.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\Utils.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\XmlDecryptionTransform.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\XmlDsigBase64Transform.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\XmlDsigC14NTransform.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\XmlDsigC14NWithCommentsTransform.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\XmlDsigEnvelopedSignatureTransform.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\XmlDsigExcC14NTransform.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\XmlDsigExcC14NWithCommentsTransform.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\XmlDsigXPathTransform.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\XmlDsigXsltTransform.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\XmlLicenseTransform.cs" />\r
<Compile Include="..\..\build\common\Consts.cs" />\r
<Compile Include="..\..\build\common\Locale.cs" />\r
<Compile Include="..\..\build\common\MonoTODOAttribute.cs" />\r
+ <Compile Include="..\System.Core\System.Security.Cryptography.X509Certificates\RSACertificateExtensions.cs" />\r
<Compile Include="Assembly\AssemblyInfo.cs" />\r
<Compile Include="corefx\SR.cs" />\r
<Compile Include="Mono.Security.Cryptography\ManagedProtection.cs" />\r
<Compile Include="Mono.Security.Cryptography\NativeDapiProtection.cs" />\r
- <Compile Include="Mono.Xml\XmlCanonicalizer.cs" />\r
<Compile Include="System.Security.Cryptography.Pkcs\AlgorithmIdentifier.cs" />\r
<Compile Include="System.Security.Cryptography.Pkcs\CmsRecipient.cs" />\r
<Compile Include="System.Security.Cryptography.Pkcs\CmsRecipientCollection.cs" />\r
<Compile Include="System.Security.Cryptography.Xml\KeyInfoX509Data.cs" />\r
<Compile Include="System.Security.Cryptography.Xml\KeyReference.cs" />\r
<Compile Include="System.Security.Cryptography.Xml\Manifest.cs" />\r
- <Compile Include="System.Security.Cryptography.Xml\Reference.cs" />\r
<Compile Include="System.Security.Cryptography.Xml\ReferenceList.cs" />\r
<Compile Include="System.Security.Cryptography.Xml\RSAKeyValue.cs" />\r
<Compile Include="System.Security.Cryptography.Xml\Signature.cs" />\r
<Compile Include="System.Security.Cryptography.Xml\SignedInfo.cs" />\r
<Compile Include="System.Security.Cryptography.Xml\SignedXml.cs" />\r
<Compile Include="System.Security.Cryptography.Xml\SymmetricKeyWrap.cs" />\r
- <Compile Include="System.Security.Cryptography.Xml\Transform.cs" />\r
- <Compile Include="System.Security.Cryptography.Xml\TransformChain.cs" />\r
<Compile Include="System.Security.Cryptography.Xml\X509IssuerSerial.cs" />\r
- <Compile Include="System.Security.Cryptography.Xml\XmlDecryptionTransform.cs" />\r
- <Compile Include="System.Security.Cryptography.Xml\XmlDsigBase64Transform.cs" />\r
- <Compile Include="System.Security.Cryptography.Xml\XmlDsigC14NTransform.cs" />\r
- <Compile Include="System.Security.Cryptography.Xml\XmlDsigC14NWithCommentsTransform.cs" />\r
- <Compile Include="System.Security.Cryptography.Xml\XmlDsigEnvelopedSignatureTransform.cs" />\r
- <Compile Include="System.Security.Cryptography.Xml\XmlDsigExcC14NTransform.cs" />\r
- <Compile Include="System.Security.Cryptography.Xml\XmlDsigExcC14NWithCommentsTransform.cs" />\r
- <Compile Include="System.Security.Cryptography.Xml\XmlDsigNodeList.cs" />\r
- <Compile Include="System.Security.Cryptography.Xml\XmlDsigXPathTransform.cs" />\r
- <Compile Include="System.Security.Cryptography.Xml\XmlDsigXsltTransform.cs" />\r
<Compile Include="System.Security.Cryptography.Xml\XmlEncryption.cs" />\r
- <Compile Include="System.Security.Cryptography.Xml\XmlLicenseTransform.cs" />\r
<Compile Include="System.Security.Cryptography.Xml\XmlSignature.cs" />\r
- <Compile Include="System.Security.Cryptography.Xml\XmlSignatureStreamReader.cs" />\r
<Compile Include="System.Security.Cryptography\CryptographicAttribute.cs" />\r
<Compile Include="System.Security.Cryptography\CryptographicAttributeCollection.cs" />\r
<Compile Include="System.Security.Cryptography\CryptographicAttributeEnumerator.cs" />\r
foreach (XmlNode xn in ((XmlElement) n).GetElementsByTagName (XmlSignature.ElementNames.Transform, XmlSignature.NamespaceURI)) {
Transform t = null;
switch (((XmlElement) xn).Attributes [XmlSignature.AttributeNames.Algorithm].Value) {
- case XmlSignature.AlgorithmNamespaces.XmlDsigBase64Transform:
+ case SignedXml.XmlDsigBase64TransformUrl:
t = new XmlDsigBase64Transform ();
break;
- case XmlSignature.AlgorithmNamespaces.XmlDsigC14NTransform:
+ case SignedXml.XmlDsigC14NTransformUrl:
t = new XmlDsigC14NTransform ();
break;
- case XmlSignature.AlgorithmNamespaces.XmlDsigC14NWithCommentsTransform:
+ case SignedXml.XmlDsigC14NWithCommentsTransformUrl:
t = new XmlDsigC14NWithCommentsTransform ();
break;
- case XmlSignature.AlgorithmNamespaces.XmlDsigEnvelopedSignatureTransform:
+ case SignedXml.XmlDsigEnvelopedSignatureTransformUrl:
t = new XmlDsigEnvelopedSignatureTransform ();
break;
- case XmlSignature.AlgorithmNamespaces.XmlDsigXPathTransform:
+ case SignedXml.XmlDsigXPathTransformUrl:
t = new XmlDsigXPathTransform ();
break;
- case XmlSignature.AlgorithmNamespaces.XmlDsigXsltTransform:
+ case SignedXml.XmlDsigXsltTransformUrl:
t = new XmlDsigXsltTransform ();
break;
- case XmlSignature.AlgorithmNamespaces.XmlDsigExcC14NTransform:
+ case SignedXml.XmlDsigExcC14NTransformUrl:
t = new XmlDsigExcC14NTransform ();
break;
- case XmlSignature.AlgorithmNamespaces.XmlDsigExcC14NWithCommentsTransform:
+ case SignedXml.XmlDsigExcC14NWithCommentsTransformUrl:
t = new XmlDsigExcC14NWithCommentsTransform ();
break;
- case XmlSignature.AlgorithmNamespaces.XmlDecryptionTransform:
+ case SignedXml.XmlDecryptionTransformUrl:
t = new XmlDecryptionTransform ();
break;
default:
+++ /dev/null
-//
-// Reference.cs - Reference implementation for XML Signature
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004-2005 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.IO;
-using System.Runtime.InteropServices;
-using System.Xml;
-
-namespace System.Security.Cryptography.Xml {
-
- // http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/Overview.html#sec-Reference
- public class Reference {
-
- private TransformChain chain;
- private string digestMethod;
- private byte[] digestValue;
- private string id;
- private string uri;
- private string type;
- private Stream stream;
- private XmlElement element;
-
- public Reference ()
- {
- chain = new TransformChain ();
- digestMethod = XmlSignature.NamespaceURI + "sha1";
- }
-
- [MonoTODO ("There is no description about how it is used.")]
- public Reference (Stream stream) : this ()
- {
- this.stream = stream;
- }
-
- public Reference (string uri) : this ()
- {
- this.uri = uri;
- }
-
- // default to SHA1
- public string DigestMethod {
- get { return digestMethod; }
- set {
- element = null;
- digestMethod = value;
- }
- }
-
- public byte[] DigestValue {
- get { return digestValue; }
- set {
- element = null;
- digestValue = value;
- }
- }
-
- public string Id {
- get { return id; }
- set {
- element = null;
- id = value;
- }
- }
-
- public TransformChain TransformChain {
- get { return chain; }
- [ComVisible (false)]
- set { chain = value; }
- }
-
- public string Type {
- get { return type; }
- set {
- element = null;
- type = value;
- }
- }
-
- public string Uri {
- get { return uri; }
- set {
- element = null;
- uri = value;
- }
- }
-
- public void AddTransform (Transform transform)
- {
- chain.Add (transform);
- }
-
- public XmlElement GetXml ()
- {
- if (element != null)
- return element;
-
- if (digestMethod == null)
- throw new CryptographicException ("DigestMethod");
- if (digestValue == null)
- throw new NullReferenceException ("DigestValue");
-
- XmlDocument document = new XmlDocument ();
- XmlElement xel = document.CreateElement (XmlSignature.ElementNames.Reference, XmlSignature.NamespaceURI);
- if (id != null)
- xel.SetAttribute (XmlSignature.AttributeNames.Id, id);
- if (uri != null)
- xel.SetAttribute (XmlSignature.AttributeNames.URI, uri);
- if (type != null)
- xel.SetAttribute (XmlSignature.AttributeNames.Type, type);
-
- if (chain.Count > 0) {
- XmlElement ts = document.CreateElement (XmlSignature.ElementNames.Transforms, XmlSignature.NamespaceURI);
- foreach (Transform t in chain) {
- XmlNode xn = t.GetXml ();
- XmlNode newNode = document.ImportNode (xn, true);
- ts.AppendChild (newNode);
- }
- xel.AppendChild (ts);
- }
-
- XmlElement dm = document.CreateElement (XmlSignature.ElementNames.DigestMethod, XmlSignature.NamespaceURI);
- dm.SetAttribute (XmlSignature.AttributeNames.Algorithm, digestMethod);
- xel.AppendChild (dm);
-
- XmlElement dv = document.CreateElement (XmlSignature.ElementNames.DigestValue, XmlSignature.NamespaceURI);
- dv.InnerText = Convert.ToBase64String (digestValue);
- xel.AppendChild (dv);
-
- return xel;
- }
-
- // note: we do NOT return null -on purpose- if attribute isn't found
- private string GetAttribute (XmlElement xel, string attribute)
- {
- XmlAttribute xa = xel.Attributes [attribute];
- return ((xa != null) ? xa.InnerText : null);
- }
-
- public void LoadXml (XmlElement value)
- {
- if (value == null)
- throw new ArgumentNullException ("value");
-
- if ((value.LocalName != XmlSignature.ElementNames.Reference) || (value.NamespaceURI != XmlSignature.NamespaceURI))
- throw new CryptographicException ();
-
- id = GetAttribute (value, XmlSignature.AttributeNames.Id);
- uri = GetAttribute (value, XmlSignature.AttributeNames.URI);
- type = GetAttribute (value, XmlSignature.AttributeNames.Type);
- // Note: order is important for validations
- XmlNodeList xnl = value.GetElementsByTagName (XmlSignature.ElementNames.Transform, XmlSignature.NamespaceURI);
- if ((xnl != null) && (xnl.Count > 0)) {
- Transform t = null;
- foreach (XmlNode xn in xnl) {
- string a = GetAttribute ((XmlElement)xn, XmlSignature.AttributeNames.Algorithm);
-/* This code is useful for debugging in VS.NET because using CryptoConfig
- (from MS mscorlib) would throw InvalidCastException because it's
- Transform would come from MS System.Security.dll not Mono's.
- switch (a) {
- case "http://www.w3.org/2000/09/xmldsig#base64":
- t = new XmlDsigBase64Transform ();
- break;
- case "http://www.w3.org/TR/2001/REC-xml-c14n-20010315":
- t = new XmlDsigC14NTransform ();
- break;
- case "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments":
- t = new XmlDsigC14NWithCommentsTransform ();
- break;
- case "http://www.w3.org/2000/09/xmldsig#enveloped-signature":
- t = new XmlDsigEnvelopedSignatureTransform ();
- break;
- case "http://www.w3.org/TR/1999/REC-xpath-19991116":
- t = new XmlDsigXPathTransform ();
- break;
- case "http://www.w3.org/TR/1999/REC-xslt-19991116":
- t = new XmlDsigXsltTransform ();
- break;
- case "http://www.w3.org/2002/07/decrypt#XML":
- t = new XmlDecryptionTransform ();
- break;
- default:
- throw new NotSupportedException ();
- }
-*/
- t = (Transform) CryptoConfig.CreateFromName (a);
- if (t == null)
- throw new CryptographicException ("Unknown transform {0}.", a);
-
- if (xn.ChildNodes.Count > 0) {
- t.LoadInnerXml (xn.ChildNodes);
- }
- AddTransform (t);
- }
- }
- // get DigestMethod
- DigestMethod = XmlSignature.GetAttributeFromElement (value, XmlSignature.AttributeNames.Algorithm, XmlSignature.ElementNames.DigestMethod);
- // get DigestValue
- XmlElement dig = XmlSignature.GetChildElement (value, XmlSignature.ElementNames.DigestValue, XmlSignature.NamespaceURI);
- if (dig != null)
- DigestValue = Convert.FromBase64String (dig.InnerText);
- element = value;
- }
- }
-}
namespace System.Security.Cryptography.Xml {
public class SignedXml {
-
- public const string XmlDsigCanonicalizationUrl = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315";
- public const string XmlDsigCanonicalizationWithCommentsUrl = XmlDsigCanonicalizationUrl + "#WithComments";
- public const string XmlDsigDSAUrl = XmlDsigNamespaceUrl + "dsa-sha1";
- public const string XmlDsigHMACSHA1Url = XmlDsigNamespaceUrl + "hmac-sha1";
- public const string XmlDsigMinimalCanonicalizationUrl = XmlDsigNamespaceUrl + "minimal";
- public const string XmlDsigNamespaceUrl = "http://www.w3.org/2000/09/xmldsig#";
- public const string XmlDsigRSASHA1Url = XmlDsigNamespaceUrl + "rsa-sha1";
- public const string XmlDsigSHA1Url = XmlDsigNamespaceUrl + "sha1";
-
- public const string XmlDecryptionTransformUrl = "http://www.w3.org/2002/07/decrypt#XML";
- public const string XmlDsigBase64TransformUrl = XmlDsigNamespaceUrl + "base64";
- public const string XmlDsigC14NTransformUrl = XmlDsigCanonicalizationUrl;
- public const string XmlDsigC14NWithCommentsTransformUrl = XmlDsigCanonicalizationWithCommentsUrl;
- public const string XmlDsigEnvelopedSignatureTransformUrl = XmlDsigNamespaceUrl + "enveloped-signature";
- public const string XmlDsigExcC14NTransformUrl = "http://www.w3.org/2001/10/xml-exc-c14n#";
- public const string XmlDsigExcC14NWithCommentsTransformUrl = XmlDsigExcC14NTransformUrl + "WithComments";
- public const string XmlDsigXPathTransformUrl = "http://www.w3.org/TR/1999/REC-xpath-19991116";
- public const string XmlDsigXsltTransformUrl = "http://www.w3.org/TR/1999/REC-xslt-19991116";
- public const string XmlLicenseTransformUrl = "urn:mpeg:mpeg21:2003:01-REL-R-NS:licenseTransform";
+ public const string XmlDsigNamespaceUrl = "http://www.w3.org/2000/09/xmldsig#";
+ public const string XmlDsigMinimalCanonicalizationUrl = "http://www.w3.org/2000/09/xmldsig#minimal";
+ public const string XmlDsigCanonicalizationUrl = XmlDsigC14NTransformUrl;
+ public const string XmlDsigCanonicalizationWithCommentsUrl = XmlDsigC14NWithCommentsTransformUrl;
+
+ public const string XmlDsigSHA1Url = "http://www.w3.org/2000/09/xmldsig#sha1";
+ public const string XmlDsigDSAUrl = "http://www.w3.org/2000/09/xmldsig#dsa-sha1";
+ public const string XmlDsigRSASHA1Url = "http://www.w3.org/2000/09/xmldsig#rsa-sha1";
+ public const string XmlDsigHMACSHA1Url = "http://www.w3.org/2000/09/xmldsig#hmac-sha1";
+
+ public const string XmlDsigSHA256Url = "http://www.w3.org/2001/04/xmlenc#sha256";
+ public const string XmlDsigRSASHA256Url = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256";
+
+ // Yes, SHA384 is in the xmldsig-more namespace even though all the other SHA variants are in xmlenc. That's the standard.
+ public const string XmlDsigSHA384Url = "http://www.w3.org/2001/04/xmldsig-more#sha384";
+ public const string XmlDsigRSASHA384Url = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha384";
+
+ public const string XmlDsigSHA512Url = "http://www.w3.org/2001/04/xmlenc#sha512";
+ public const string XmlDsigRSASHA512Url = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha512";
+
+ public const string XmlDsigC14NTransformUrl = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315";
+ public const string XmlDsigC14NWithCommentsTransformUrl = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments";
+ public const string XmlDsigExcC14NTransformUrl = "http://www.w3.org/2001/10/xml-exc-c14n#";
+ public const string XmlDsigExcC14NWithCommentsTransformUrl = "http://www.w3.org/2001/10/xml-exc-c14n#WithComments";
+ public const string XmlDsigBase64TransformUrl = "http://www.w3.org/2000/09/xmldsig#base64";
+ public const string XmlDsigXPathTransformUrl = "http://www.w3.org/TR/1999/REC-xpath-19991116";
+ public const string XmlDsigXsltTransformUrl = "http://www.w3.org/TR/1999/REC-xslt-19991116";
+ public const string XmlDsigEnvelopedSignatureTransformUrl = "http://www.w3.org/2000/09/xmldsig#enveloped-signature";
+ public const string XmlDecryptionTransformUrl = "http://www.w3.org/2002/07/decrypt#XML";
+ public const string XmlLicenseTransformUrl = "urn:mpeg:mpeg21:2003:01-REL-R-NS:licenseTransform";
private EncryptedXml encryptedXml;
private XmlElement signatureElement;
private Hashtable hashes;
// FIXME: enable it after CAS implementation
- private XmlResolver xmlResolver = new XmlUrlResolver ();
+ internal XmlResolver _xmlResolver = new XmlUrlResolver ();
+ private bool _bResolverSet = true;
+ internal XmlElement _context;
private ArrayList manifests;
private IEnumerator _x509Enumerator;
m_signature = new Signature ();
m_signature.SignedInfo = new SignedInfo ();
hashes = new Hashtable (2); // 98% SHA1 for now
+ _context = null;
}
public SignedXml (XmlDocument document) : this ()
if (document == null)
throw new ArgumentNullException ("document");
envdoc = document;
+ _context = document.DocumentElement;
}
public SignedXml (XmlElement elem) : this ()
if (elem == null)
throw new ArgumentNullException ("elem");
envdoc = new XmlDocument ();
+ _context = elem;
envdoc.LoadXml (elem.OuterXml);
}
set { m_strSigningKeyName = value; }
}
+ public XmlResolver Resolver
+ {
+ // This property only has a setter. The rationale for this is that we don't have a good value
+ // to return when it has not been explicitely set, as we are using XmlSecureResolver by default
+ set
+ {
+ _xmlResolver = value;
+ _bResolverSet = true;
+ }
+ }
+
+ internal bool ResolverSet
+ {
+ get { return _bResolverSet; }
+ }
+
public void AddObject (DataObject dataObject)
{
m_signature.AddObject (dataObject);
FixupNamespaceNodes (xel, doc.DocumentElement, false);
}
}
- else if (xmlResolver != null) {
+ else if (_xmlResolver != null) {
// TODO: need testing
- Stream s = (Stream) xmlResolver.GetEntity (new Uri (r.Uri), null, typeof (Stream));
+ Stream s = (Stream) _xmlResolver.GetEntity (new Uri (r.Uri), null, typeof (Stream));
doc.Load (s);
}
else if (r.Uri [0] == '#') {
objectName = r.Uri.Substring (1);
}
- else if (xmlResolver != null) {
+ else if (_xmlResolver != null) {
// TODO: test but doc says that Resolver = null -> no access
try {
// no way to know if valid without throwing an exception
Uri uri = new Uri (r.Uri);
- s = (Stream) xmlResolver.GetEntity (uri, null, typeof (Stream));
+ s = (Stream) _xmlResolver.GetEntity (uri, null, typeof (Stream));
}
catch {
// may still be a local file (and maybe not xml)
signatureElement = value;
m_signature.LoadXml (value);
+
+ if (_context == null) {
+ _context = value;
+ }
+
// Need to give the EncryptedXml object to the
// XmlDecryptionTransform to give it a fighting
// chance at decrypting the document.
}
}
}
-
- [ComVisible (false)]
- public XmlResolver Resolver {
- set { xmlResolver = value; }
- }
}
}
+++ /dev/null
-//
-// Transform.cs - Transform implementation for XML Signature
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-// Atsushi Enomoto <atsushi@ximian.com>
-// Tim Coleman <tim@timcoleman.com>
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) Tim Coleman, 2004
-// Copyright (C) 2004-2006 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.Collections;
-using System.IO;
-using System.Runtime.InteropServices;
-using System.Security;
-using System.Security.Policy;
-using System.Xml;
-
-namespace System.Security.Cryptography.Xml {
-
- public abstract class Transform {
-
- private string algo;
- private XmlResolver xmlResolver;
- private Hashtable propagated_namespaces = new Hashtable ();
-
- protected Transform ()
- {
- if (SecurityManager.SecurityEnabled) {
- xmlResolver = new XmlSecureResolver (new XmlUrlResolver (), (Evidence) new Evidence ());
- } else {
- xmlResolver = new XmlUrlResolver ();
- }
- }
-
- #region Properties
-
- public string Algorithm {
- get { return algo; }
- set { algo = value; }
- }
-
- public abstract Type[] InputTypes {
- get;
- }
-
- public abstract Type[] OutputTypes {
- get;
- }
-
- [ComVisible(false)]
- public XmlResolver Resolver {
- set { xmlResolver = value; }
- }
-
- [MonoTODO]
- [ComVisible (false)]
- public XmlElement Context {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
- }
-
- [ComVisible (false)]
- public Hashtable PropagatedNamespaces {
- get { return propagated_namespaces; }
- }
-
- #endregion // Properties
-
- #region Methods
- [ComVisible (false)]
- public virtual byte[] GetDigestedOutput (HashAlgorithm hash)
- {
- // no null check, MS throws a NullReferenceException here
- return hash.ComputeHash ((Stream) GetOutput (typeof (Stream)));
- }
-
- protected abstract XmlNodeList GetInnerXml ();
-
- public abstract object GetOutput ();
-
- public abstract object GetOutput (Type type);
-
- public XmlElement GetXml ()
- {
- XmlDocument document = new XmlDocument ();
- document.XmlResolver = GetResolver ();
- XmlElement xel = document.CreateElement (XmlSignature.ElementNames.Transform, XmlSignature.NamespaceURI);
- xel.SetAttribute (XmlSignature.AttributeNames.Algorithm, algo);
- XmlNodeList xnl = this.GetInnerXml ();
- if (xnl != null) {
- foreach (XmlNode xn in xnl) {
- XmlNode importedNode = document.ImportNode (xn, true);
- xel.AppendChild (importedNode);
- }
- }
- return xel;
- }
-
- public abstract void LoadInnerXml (XmlNodeList nodeList);
-
- public abstract void LoadInput (object obj);
-
- internal XmlResolver GetResolver ()
- {
- return xmlResolver;
- }
-
- #endregion // Methods
- }
-}
+++ /dev/null
-//
-// TransformChain.cs - TransformChain implementation for XML Signature
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.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.Collections;
-
-namespace System.Security.Cryptography.Xml {
-
- public class TransformChain {
-
- private ArrayList chain;
-
- public TransformChain()
- {
- chain = new ArrayList ();
- }
-
- public int Count {
- get { return chain.Count; }
- }
-
- public Transform this [int index] {
- get { return (Transform) chain [index]; }
- }
-
- public void Add (Transform transform)
- {
- chain.Add (transform);
- }
-
- public IEnumerator GetEnumerator ()
- {
- return chain.GetEnumerator ();
- }
- }
-}
+++ /dev/null
-//
-// XmlDecryptionTransform.cs - XmlDecryptionTransform implementation for XML Encryption
-//
-// Author:
-// Tim Coleman (tim@timcoleman.com)
-//
-// Copyright (C) Tim Coleman, 2004
-
-//
-// 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.Collections;
-using System.IO;
-using System.Xml;
-
-namespace System.Security.Cryptography.Xml {
-
- public class XmlDecryptionTransform : Transform {
-
- #region Fields
-
- EncryptedXml encryptedXml;
- Type[] inputTypes;
- Type[] outputTypes;
- object inputObj;
- ArrayList exceptUris;
-
- const string NamespaceUri = "http://www.w3.org/2002/07/decrypt#";
-
- #endregion // Fields
-
- #region Constructors
-
- public XmlDecryptionTransform ()
- {
- Algorithm = XmlSignature.AlgorithmNamespaces.XmlDecryptionTransform;
- encryptedXml = new EncryptedXml ();
- exceptUris = new ArrayList ();
- }
-
- #endregion // Constructors
-
- #region Properties
-
- public EncryptedXml EncryptedXml {
- get { return encryptedXml; }
- set { encryptedXml = value; }
- }
-
- public override Type[] InputTypes {
- get {
- if (inputTypes == null)
- inputTypes = new Type [2] {typeof (System.IO.Stream), typeof (System.Xml.XmlDocument)};
-
- return inputTypes;
- }
- }
-
- public override Type[] OutputTypes {
- get {
- if (outputTypes == null)
- outputTypes = new Type [1] {typeof (System.Xml.XmlDocument)};
-
- return outputTypes;
- }
- }
-
- #endregion // Properties
-
- #region Methods
-
- public void AddExceptUri (string uri)
- {
- exceptUris.Add (uri);
- }
-
- private void ClearExceptUris ()
- {
- exceptUris.Clear ();
- }
-
- [MonoTODO ("Verify")]
- protected override XmlNodeList GetInnerXml ()
- {
- XmlDocument doc = new XmlDocument ();
- doc.AppendChild (doc.CreateElement ("DecryptionTransform"));
-
- foreach (object o in exceptUris) {
- XmlElement element = doc.CreateElement ("Except", NamespaceUri);
- element.Attributes.Append (doc.CreateAttribute ("URI", NamespaceUri));
- element.Attributes ["URI", NamespaceUri].Value = (string) o;
- doc.DocumentElement.AppendChild (element);
- }
-
- return doc.GetElementsByTagName ("Except", NamespaceUri);
- }
-
- [MonoTODO ("Verify processing of ExceptURIs")]
- public override object GetOutput ()
- {
- XmlDocument document;
- if (inputObj is Stream) {
- document = new XmlDocument ();
- document.PreserveWhitespace = true;
- document.XmlResolver = GetResolver ();
- document.Load (new XmlSignatureStreamReader (
- new StreamReader (inputObj as Stream)));
- }
- else if (inputObj is XmlDocument) {
- document = inputObj as XmlDocument;
- }
- else
- throw new NullReferenceException ();
-
- XmlNodeList nodes = document.GetElementsByTagName ("EncryptedData", EncryptedXml.XmlEncNamespaceUrl);
- foreach (XmlNode node in nodes) {
- if (node == document.DocumentElement && exceptUris.Contains ("#xpointer(/)"))
- break;
-
- // Need to exclude based on ExceptURI. Only accept #id references.
- foreach (string uri in exceptUris)
- if (IsTargetElement ((XmlElement) node, uri.Substring (1)))
- break;
-
- EncryptedData encryptedData = new EncryptedData ();
- encryptedData.LoadXml ((XmlElement) node);
- SymmetricAlgorithm symAlg = EncryptedXml.GetDecryptionKey (encryptedData, encryptedData.EncryptionMethod.KeyAlgorithm);
- EncryptedXml.ReplaceData ((XmlElement) node, EncryptedXml.DecryptData (encryptedData, symAlg));
- }
-
- return document;
- }
-
- public override object GetOutput (Type type)
- {
- if (type == typeof (Stream))
- return GetOutput ();
- throw new ArgumentException ("type");
- }
-
- [MonoTODO ("verify")]
- protected virtual bool IsTargetElement (XmlElement inputElement, string idValue)
- {
- if ((inputElement == null) || (idValue == null))
- return false;
- return (inputElement.Attributes ["id"].Value == idValue);
- }
-
- [MonoTODO ("This doesn't seem to work in .NET")]
- public override void LoadInnerXml (XmlNodeList nodeList)
- {
- if (nodeList == null)
- throw new NullReferenceException ();
-
- ClearExceptUris ();
- foreach (XmlNode node in nodeList) {
- XmlElement element = node as XmlElement;
- if (element.NamespaceURI.Equals (NamespaceUri) && element.LocalName.Equals ("Except")) {
- string uri = element.Attributes ["URI", NamespaceUri].Value;
- if (!uri.StartsWith ("#"))
- throw new CryptographicException ("A Uri attribute is required for a CipherReference element.");
- AddExceptUri (uri);
- }
- }
- }
-
- public override void LoadInput (object obj)
- {
- inputObj = obj;
- }
-
- #endregion // Methods
- }
-}
-
+++ /dev/null
-//
-// XmlDsigBase64Transform.cs - Base64 Transform implementation for XML Signature
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-// (C) 2004 Novell (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.IO;
-using System.Security.Cryptography;
-using System.Text;
-using System.Xml;
-
-namespace System.Security.Cryptography.Xml {
-
- // http://www.w3.org/2000/09/xmldsig#base64
- public class XmlDsigBase64Transform : Transform {
-
- private CryptoStream cs;
- private Type[] input;
- private Type[] output;
-
- public XmlDsigBase64Transform ()
- {
- Algorithm = XmlSignature.AlgorithmNamespaces.XmlDsigBase64Transform;
- }
-
- public override Type[] InputTypes {
- get {
- if (input == null) {
- input = new Type [3];
- input[0] = typeof (System.IO.Stream);
- input[1] = typeof (System.Xml.XmlDocument);
- input[2] = typeof (System.Xml.XmlNodeList);
- }
- return input;
- }
- }
-
- public override Type[] OutputTypes {
- get {
- if (output == null) {
- output = new Type [1];
- output[0] = typeof (System.IO.Stream);
- }
- return output;
- }
- }
-
- protected override XmlNodeList GetInnerXml ()
- {
- return null; // THIS IS DOCUMENTED AS SUCH
- }
-
- public override object GetOutput ()
- {
- return (object) cs;
- }
-
- public override object GetOutput (Type type)
- {
- if (type != typeof (System.IO.Stream))
- throw new ArgumentException ("type");
- return GetOutput ();
- }
-
- public override void LoadInnerXml (XmlNodeList nodeList)
- {
- // documented as not changing the state of the transform
- }
-
- public override void LoadInput (object obj)
- {
- XmlNodeList xnl = null;
- Stream stream = null;
-
- if (obj is Stream)
- stream = (obj as Stream);
- else if (obj is XmlDocument)
- xnl = (obj as XmlDocument).SelectNodes ("//.");
- else if (obj is XmlNodeList)
- xnl = (XmlNodeList) obj;
-
- if (xnl != null) {
- stream = new MemoryStream ();
- StreamWriter sw = new StreamWriter (stream);
- foreach (XmlNode xn in xnl) {
- switch (xn.NodeType) {
- case XmlNodeType.Attribute:
- case XmlNodeType.Text:
- case XmlNodeType.CDATA:
- case XmlNodeType.SignificantWhitespace:
- case XmlNodeType.Whitespace:
- sw.Write (xn.Value);
- break;
- }
- }
- sw.Flush ();
- // ready to be re-used
- stream.Position = 0;
- }
-
- if (stream != null)
- cs = new CryptoStream (stream, new FromBase64Transform (), CryptoStreamMode.Read);
- // note: there is no default are other types won't throw an exception
- }
- }
-}
+++ /dev/null
-//
-// XmlDsigC14NTransform.cs - C14N Transform implementation for XML Signature
-// http://www.w3.org/TR/xml-c14n
-//
-// Authors:
-// Sebastien Pouliot <sebastien@ximian.com>
-// Aleksey Sanin (aleksey@aleksey.com)
-// Tim Coleman (tim@timcoleman.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-// (C) 2003 Aleksey Sanin (aleksey@aleksey.com)
-// Copyright (C) Tim Coleman, 2004
-// Copyright (C) 2004-2005 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.Collections;
-using System.IO;
-using System.Runtime.InteropServices;
-using System.Text;
-using System.Xml;
-
-using Mono.Xml;
-
-namespace System.Security.Cryptography.Xml {
-
- public class XmlDsigC14NTransform : Transform {
- private Type[] input;
- private Type[] output;
- private XmlCanonicalizer canonicalizer;
- private Stream s;
-
- public XmlDsigC14NTransform () : this (false)
- {
- }
-
- public XmlDsigC14NTransform (bool includeComments)
- {
- if (includeComments)
- Algorithm = XmlSignature.AlgorithmNamespaces.XmlDsigC14NWithCommentsTransform;
- else
- Algorithm = XmlSignature.AlgorithmNamespaces.XmlDsigC14NTransform;
- canonicalizer = new XmlCanonicalizer (includeComments, false, PropagatedNamespaces);
- }
-
- public override Type[] InputTypes {
- get {
- if (input == null) {
- input = new Type [3];
- input[0] = typeof (System.IO.Stream);
- input[1] = typeof (System.Xml.XmlDocument);
- input[2] = typeof (System.Xml.XmlNodeList);
- }
- return input;
- }
- }
-
- public override Type[] OutputTypes {
- get {
- if (output == null) {
- output = new Type [1];
- output[0] = typeof (System.IO.Stream);
- }
- return output;
- }
- }
-
- protected override XmlNodeList GetInnerXml ()
- {
- return null; // THIS IS DOCUMENTED AS SUCH
- }
-
- [ComVisible (false)]
- public override byte[] GetDigestedOutput (HashAlgorithm hash)
- {
- // no null check, MS throws a NullReferenceException here
- return hash.ComputeHash ((Stream) GetOutput ());
- }
-
- public override object GetOutput ()
- {
- return (object) s;
- }
-
- public override object GetOutput (Type type)
- {
- if (type == typeof (Stream))
- return GetOutput ();
- throw new ArgumentException ("type");
- }
-
- public override void LoadInnerXml (XmlNodeList nodeList)
- {
- // documented as not changing the state of the transform
- }
-
- public override void LoadInput (object obj)
- {
- // possible input: Stream, XmlDocument, and XmlNodeList
- Stream stream = (obj as Stream);
- if (stream != null) {
- XmlDocument doc = new XmlDocument ();
- doc.PreserveWhitespace = true; // REALLY IMPORTANT
- doc.XmlResolver = GetResolver ();
- doc.Load (new XmlSignatureStreamReader (new StreamReader (stream)));
-// doc.Load ((Stream) obj);
- s = canonicalizer.Canonicalize (doc);
- return;
- }
-
- XmlDocument xd = (obj as XmlDocument);
- if (xd != null) {
- s = canonicalizer.Canonicalize (xd);
- return;
- }
-
- XmlNodeList nl = (obj as XmlNodeList);
- if (nl != null) {
- s = canonicalizer.Canonicalize (nl);
- }
- else
- throw new ArgumentException ("obj");
- }
- }
-}
-
+++ /dev/null
-//
-// XmlDsigC14NWithCommentsTransform.cs -
-// C14N with comments Transform implementation for XML Signature
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.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.
-//
-
-namespace System.Security.Cryptography.Xml {
-
- public class XmlDsigC14NWithCommentsTransform : XmlDsigC14NTransform {
-
- public XmlDsigC14NWithCommentsTransform() : base (true)
- {
- }
- }
-}
+++ /dev/null
-//
-// XmlDsigEnvelopedSignatureTransform.cs -
-// Enveloped Signature Transform implementation for XML Signature
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-// Atsushi Enomoto (atsushi@ximian.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-// (C) 2004 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.
-//
-
-using System.Collections;
-using System.IO;
-using System.Xml;
-
-namespace System.Security.Cryptography.Xml {
-
- public class XmlDsigEnvelopedSignatureTransform : Transform {
-
- private Type[] input;
- private Type[] output;
- private bool comments;
- private object inputObj;
-
- public XmlDsigEnvelopedSignatureTransform ()
- : this (false)
- {
- }
-
- public XmlDsigEnvelopedSignatureTransform (bool includeComments)
- {
- Algorithm = XmlSignature.AlgorithmNamespaces.XmlDsigEnvelopedSignatureTransform;
- comments = includeComments;
- }
-
- public override Type[] InputTypes {
- get {
- if (input == null) {
- input = new Type [3];
- input[0] = typeof (System.IO.Stream);
- input[1] = typeof (System.Xml.XmlDocument);
- input[2] = typeof (System.Xml.XmlNodeList);
- }
- return input;
- }
- }
-
- public override Type[] OutputTypes {
- get {
- if (output == null) {
- output = new Type [2];
- output [0] = typeof (System.Xml.XmlDocument);
- output [1] = typeof (System.Xml.XmlNodeList);
- }
- return output;
- }
- }
-
- protected override XmlNodeList GetInnerXml ()
- {
- return null; // THIS IS DOCUMENTED AS SUCH
- }
-
- // NOTE: This method never supports the requirements written
- // in xmldsig spec that says its input is canonicalized before
- // transforming. This method just removes Signature element.
- // Canonicalization is done in SignedXml.
- public override object GetOutput ()
- {
- XmlDocument doc = null;
-
- // possible input: Stream, XmlDocument, and XmlNodeList
- if (inputObj is Stream) {
- doc = new XmlDocument ();
- doc.PreserveWhitespace = true;
- doc.XmlResolver = GetResolver ();
- doc.Load (new XmlSignatureStreamReader (
- new StreamReader (inputObj as Stream)));
- return GetOutputFromNode (doc, GetNamespaceManager (doc), true);
- }
- else if (inputObj is XmlDocument) {
- doc = inputObj as XmlDocument;
- return GetOutputFromNode (doc, GetNamespaceManager (doc), true);
- }
- else if (inputObj is XmlNodeList) {
- ArrayList al = new ArrayList ();
- XmlNodeList nl = (XmlNodeList) inputObj;
- if (nl.Count > 0) {
- XmlNamespaceManager m = GetNamespaceManager (nl.Item (0));
- ArrayList tmp = new ArrayList ();
- foreach (XmlNode n in nl)
- tmp.Add (n);
- foreach (XmlNode n in tmp)
- if (n.SelectNodes ("ancestor-or-self::dsig:Signature", m).Count == 0)
- al.Add (GetOutputFromNode (n, m, false));
- }
- return new XmlDsigNodeList (al);
- }
- // Note that it is unexpected behavior with related to InputTypes (MS.NET accepts XmlElement)
- else if (inputObj is XmlElement) {
- XmlElement el = inputObj as XmlElement;
- XmlNamespaceManager m = GetNamespaceManager (el);
- if (el.SelectNodes ("ancestor-or-self::dsig:Signature", m).Count == 0)
- return GetOutputFromNode (el, m, true);
- }
-
- throw new NullReferenceException ();
- }
-
- private XmlNamespaceManager GetNamespaceManager (XmlNode n)
- {
- XmlDocument doc = ((n is XmlDocument) ? (n as XmlDocument) : n.OwnerDocument);
- XmlNamespaceManager nsmgr = new XmlNamespaceManager (doc.NameTable);
- nsmgr.AddNamespace ("dsig", XmlSignature.NamespaceURI);
- return nsmgr;
- }
-
- private XmlNode GetOutputFromNode (XmlNode input, XmlNamespaceManager nsmgr, bool remove)
- {
- if (remove) {
- XmlNodeList nl = input.SelectNodes ("descendant-or-self::dsig:Signature", nsmgr);
- ArrayList al = new ArrayList ();
- foreach (XmlNode n in nl)
- al.Add (n);
- foreach (XmlNode n in al)
- n.ParentNode.RemoveChild (n);
- }
- return input;
- }
-
- public override object GetOutput (Type type)
- {
- if (type == typeof (Stream))
- return GetOutput ();
- throw new ArgumentException ("type");
- }
-
- public override void LoadInnerXml (XmlNodeList nodeList)
- {
- // NO CHANGE
- }
-
- public override void LoadInput (object obj)
- {
- inputObj = obj;
- }
- }
-}
+++ /dev/null
-//
-// XmlDsigExcC14NTransform.cs - ExcC14N Transform implementation for XML Signature
-// http://www.w3.org/TR/xml-c14n
-//
-// Authors:
-// Sebastien Pouliot <sebastien@ximian.com>
-// Aleksey Sanin (aleksey@aleksey.com)
-// Tim Coleman (tim@timcoleman.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-// (C) 2003 Aleksey Sanin (aleksey@aleksey.com)
-// Copyright (C) Tim Coleman, 2004
-// Copyright (C) 2004-2005 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.Collections;
-using System.IO;
-using System.Runtime.InteropServices;
-using System.Text;
-using System.Xml;
-
-using Mono.Xml;
-
-namespace System.Security.Cryptography.Xml {
-
- public class XmlDsigExcC14NTransform : Transform {
- private Type[] input;
- private Type[] output;
- private XmlCanonicalizer canonicalizer;
- private Stream s;
- private string inclusiveNamespacesPrefixList;
-
- public XmlDsigExcC14NTransform ()
- : this (false, null)
- {
- }
-
- public XmlDsigExcC14NTransform (bool includeComments)
- : this (includeComments, null)
- {
- }
-
- public XmlDsigExcC14NTransform (string inclusiveNamespacesPrefixList)
- : this (false, inclusiveNamespacesPrefixList)
- {
- }
-
- public XmlDsigExcC14NTransform (bool includeComments, string inclusiveNamespacesPrefixList)
- {
- if (includeComments)
- Algorithm = XmlSignature.AlgorithmNamespaces.XmlDsigExcC14NWithCommentsTransform;
- else
- Algorithm = XmlSignature.AlgorithmNamespaces.XmlDsigExcC14NTransform;
- this.inclusiveNamespacesPrefixList = inclusiveNamespacesPrefixList;
- canonicalizer = new XmlCanonicalizer (includeComments, true, PropagatedNamespaces);
- }
-
- public string InclusiveNamespacesPrefixList {
- get { return inclusiveNamespacesPrefixList; }
- set { inclusiveNamespacesPrefixList = value; }
- }
-
- public override Type[] InputTypes {
- get {
- if (input == null) {
- input = new Type [3];
- input[0] = typeof (System.IO.Stream);
- input[1] = typeof (System.Xml.XmlDocument);
- input[2] = typeof (System.Xml.XmlNodeList);
- }
- return input;
- }
- }
-
- public override Type[] OutputTypes {
- get {
- if (output == null) {
- output = new Type [1];
- output[0] = typeof (System.IO.Stream);
- }
- return output;
- }
- }
-
- protected override XmlNodeList GetInnerXml ()
- {
- return null; // THIS IS DOCUMENTED AS SUCH
- }
-
- public override byte[] GetDigestedOutput (HashAlgorithm hash)
- {
- // no null check, MS throws a NullReferenceException here
- return hash.ComputeHash ((Stream) GetOutput ());
- }
-
- public override object GetOutput ()
- {
- return (object) s;
- }
-
- public override object GetOutput (Type type)
- {
- if (type == typeof (Stream))
- return GetOutput ();
- throw new ArgumentException ("type");
- }
-
- public override void LoadInnerXml (XmlNodeList nodeList)
- {
- // documented as not changing the state of the transform
- }
-
- public override void LoadInput (object obj)
- {
- canonicalizer.InclusiveNamespacesPrefixList = InclusiveNamespacesPrefixList;
- // possible input: Stream, XmlDocument, and XmlNodeList
- Stream stream = (obj as Stream);
- if (stream != null) {
- XmlDocument doc = new XmlDocument ();
- doc.PreserveWhitespace = true; // REALLY IMPORTANT
- doc.XmlResolver = GetResolver ();
- doc.Load (new XmlSignatureStreamReader (new StreamReader (stream)));
-// doc.Load ((Stream) obj);
- s = canonicalizer.Canonicalize (doc);
- return;
- }
-
- XmlDocument xd = (obj as XmlDocument);
- if (xd != null) {
- s = canonicalizer.Canonicalize (xd);
- return;
- }
-
- XmlNodeList nl = (obj as XmlNodeList);
- if (nl != null) {
- s = canonicalizer.Canonicalize (nl);
- }
- else
- throw new ArgumentException ("obj");
- }
- }
-}
-
+++ /dev/null
-//
-// XmlDsigExcC14NWithCommentsTransform.cs - XmlDsigExcC14NWithCommentsTransform implementation for XML Encryption
-//
-// Author:
-// Tim Coleman (tim@timcoleman.com)
-//
-// Copyright (C) Tim Coleman, 2004
-
-//
-// 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.
-//
-
-
-namespace System.Security.Cryptography.Xml {
- public class XmlDsigExcC14NWithCommentsTransform : XmlDsigExcC14NTransform {
-
- #region Constructors
-
- public XmlDsigExcC14NWithCommentsTransform ()
- : base (true)
- {
- }
-
- public XmlDsigExcC14NWithCommentsTransform (string inclusiveNamespacesPrefixList)
- : base (true, inclusiveNamespacesPrefixList)
- {
- }
-
- #endregion // Constructors
- }
-}
-
+++ /dev/null
-//\r
-// XmlDsigNodeList.cs - derived node list class for dsig\r
-//\r
-// Author:\r
-// Atsushi Enomoto <atsushi@ximian.com>\r
-//\r
-// (C)2004 Novell Inc.\r
-//\r
-// This class is mostly copied from System.Xml/XmlNodeArrayList.cs\r
-//\r
-
-//
-// 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.
-//
-\r
-using System;\r
-using System.Collections;\r
-using System.Xml;\r
-\r
-namespace System.Security.Cryptography.Xml\r
-{\r
- // Copied from XmlNodeArrayList.cs\r
- internal class XmlDsigNodeList : XmlNodeList\r
- {\r
- ArrayList _rgNodes;\r
-\r
- public XmlDsigNodeList (ArrayList rgNodes)\r
- {\r
- _rgNodes = rgNodes;\r
- }\r
-\r
- public override int Count { get { return _rgNodes.Count; } }\r
-\r
- public override IEnumerator GetEnumerator ()\r
- {\r
- return _rgNodes.GetEnumerator ();\r
- }\r
-\r
- public override XmlNode Item (int index)\r
- {\r
- // Return null if index is out of range. by DOM design.\r
- if (index < 0 || _rgNodes.Count <= index)\r
- return null;\r
-\r
- return (XmlNode) _rgNodes [index];\r
- }\r
- }\r
-}\r
+++ /dev/null
-//
-// XmlDsigXPathTransform.cs -
-// XmlDsigXPathTransform implementation for XML Signature
-// http://www.w3.org/TR/1999/REC-xpath-19991116
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-// Atsushi Enomoto <atsushi@ximian.com>
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004-2005 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.Collections;
-using System.IO;
-using System.Text;
-using System.Xml;
-using System.Xml.XPath;
-using System.Xml.Xsl;
-
-namespace System.Security.Cryptography.Xml
-{
-
- // www.w3.org/TR/xmldsig-core/
- // see Section 6.6.3 of the XMLDSIG specification
- public class XmlDsigXPathTransform : Transform
- {
-
- private Type [] input;
- private Type [] output;
- private XmlNodeList xpath;
- private XmlDocument doc;
- private XsltContext ctx;
-
- public XmlDsigXPathTransform ()
- {
- Algorithm = XmlSignature.AlgorithmNamespaces.XmlDsigXPathTransform;
- }
-
- public override Type [] InputTypes {
- get {
- if (input == null) {
- input = new Type [3];
- input [0] = typeof (System.IO.Stream);
- input [1] = typeof (System.Xml.XmlDocument);
- input [2] = typeof (System.Xml.XmlNodeList);
- }
- return input;
- }
- }
-
- public override Type[] OutputTypes {
- get {
- if (output == null) {
- // this way the result is cached if called multiple time
- output = new Type [1];
- output [0] = typeof (System.Xml.XmlNodeList);
- }
- return output;
- }
- }
-
- protected override XmlNodeList GetInnerXml ()
- {
- if (xpath == null) {
- // default value
- XmlDocument xpdoc = new XmlDocument ();
- xpdoc.LoadXml ("<XPath xmlns=\"" + XmlSignature.NamespaceURI + "\"></XPath>");
- xpath = xpdoc.ChildNodes;
- }
- return xpath;
- }
-
- [MonoTODO ("Evaluation of extension function here() results in different from MS.NET (is MS.NET really correct??).")]
- public override object GetOutput ()
- {
- if ((xpath == null) || (doc == null))
- return new XmlDsigNodeList (new ArrayList ());
- // evaluate every time since input or xpath might have changed.
- string x = null;
- for (int i = 0; i < xpath.Count; i++) {
- switch (xpath [i].NodeType) {
- case XmlNodeType.Text:
- case XmlNodeType.CDATA:
- case XmlNodeType.Element:
- x += xpath [i].InnerText;
- break;
- }
- }
-
- ctx = new XmlDsigXPathContext (doc);
- foreach (XmlNode n in xpath) {
- XPathNavigator nav = n.CreateNavigator ();
- XPathNodeIterator iter = nav.Select ("namespace::*");
- while (iter.MoveNext ())
- if (iter.Current.LocalName != "xml")
- ctx.AddNamespace (iter.Current.LocalName, iter.Current.Value);
- }
- return EvaluateMatch (doc, x);
- }
-
- public override object GetOutput (Type type)
- {
- if (type != typeof (XmlNodeList))
- throw new ArgumentException ("type");
- return GetOutput ();
- }
-
- private XmlDsigNodeList EvaluateMatch (XmlNode n, string xpath)
- {
- ArrayList al = new ArrayList ();
- // Strictly to say, document node is explicitly
- // excluded by W3C spec (context node is initialized
- // to the document root and XPath expression is
- // "//. | //@* | //namespace::*)
- XPathNavigator nav = n.CreateNavigator ();
- XPathExpression exp = nav.Compile (xpath);
- exp.SetContext (ctx);
- EvaluateMatch (n, exp, al);
- return new XmlDsigNodeList (al);
- }
-
- private void EvaluateMatch (XmlNode n, XPathExpression exp, ArrayList al)
- {
- if (NodeMatches (n, exp))
- al.Add (n);
- if (n.Attributes != null)
- for (int i = 0; i < n.Attributes.Count; i++)
- if (NodeMatches (n.Attributes [i], exp))
- al.Add (n.Attributes [i]);
- for (int i = 0; i < n.ChildNodes.Count; i++)
- EvaluateMatch (n.ChildNodes [i], exp, al);
- }
-
- private bool NodeMatches (XmlNode n, XPathExpression exp)
- {
- // This looks waste of memory since it creates
- // XPathNavigator every time, but even if we use
- // XPathNodeIterator.Current, it also clones every time.
- object ret = n.CreateNavigator ().Evaluate (exp);
- if (ret is bool)
- return (bool) ret;
- if (ret is double) {
- double d = (double) ret;
- return !(d == 0.0 || Double.IsNaN (d));
- }
- if (ret is string)
- return ((string) ret).Length > 0;
- if (ret is XPathNodeIterator) {
- XPathNodeIterator retiter = (XPathNodeIterator) ret;
- return retiter.Count > 0;
- }
- return false;
- }
-
- public override void LoadInnerXml (XmlNodeList nodeList)
- {
- if (nodeList == null)
- throw new CryptographicException ("nodeList");
- xpath = nodeList;
- }
-
- public override void LoadInput (object obj)
- {
- // possible input: Stream, XmlDocument, and XmlNodeList
- if (obj is Stream) {
- doc = new XmlDocument ();
- doc.PreserveWhitespace = true;
- doc.XmlResolver = GetResolver ();
- doc.Load (new XmlSignatureStreamReader (
- new StreamReader ((Stream) obj)));
- }
- else if (obj is XmlDocument) {
- doc = (obj as XmlDocument);
- }
- else if (obj is XmlNodeList) {
- doc = new XmlDocument ();
- doc.XmlResolver = GetResolver ();
- foreach (XmlNode xn in (obj as XmlNodeList)) {
- XmlNode importedNode = doc.ImportNode (xn, true);
- doc.AppendChild (importedNode);
- }
- }
- }
-
- // Internal classes to support XPath extension function here()
-
- internal class XmlDsigXPathContext : XsltContext
- {
- XmlDsigXPathFunctionHere here;
- public XmlDsigXPathContext (XmlNode node)
- {
- here = new XmlDsigXPathFunctionHere (node);
- }
-
- public override IXsltContextFunction ResolveFunction (
- string prefix, string name, XPathResultType [] argType)
- {
- // Here MS.NET incorrectly allows arbitrary
- // name e.g. "heretic()".
- if (name == "here" &&
- prefix == String.Empty &&
- argType.Length == 0)
- return here;
- else
- return null; // ????
- }
-
- public override bool Whitespace {
- get { return true; }
- }
-
- public override bool PreserveWhitespace (XPathNavigator node)
- {
- return true;
- }
-
- public override int CompareDocument (string s1, string s2)
- {
- return String.Compare (s1, s2);
- }
-
- public override IXsltContextVariable ResolveVariable (string prefix, string name)
- {
- throw new InvalidOperationException ();
- }
- }
-
- internal class XmlDsigXPathFunctionHere : IXsltContextFunction
- {
- // Static
-
- static XPathResultType [] types;
- static XmlDsigXPathFunctionHere ()
- {
- types = new XPathResultType [0];
- }
-
- // Instance
-
- XPathNodeIterator xpathNode;
-
- public XmlDsigXPathFunctionHere (XmlNode node)
- {
- xpathNode = node.CreateNavigator ().Select (".");
- }
-
- public XPathResultType [] ArgTypes {
- get { return types; }
- }
-
- public int Maxargs { get { return 0; } }
-
- public int Minargs { get { return 0; } }
-
- public XPathResultType ReturnType {
- get { return XPathResultType.NodeSet; }
- }
-
- public object Invoke (XsltContext ctx, object [] args, XPathNavigator docContext)
- {
- if (args.Length != 0)
- throw new ArgumentException ("Not allowed arguments for function here().", "args");
-
- return xpathNode.Clone ();
- }
- }
- }
-}
+++ /dev/null
-//
-// XmlDsigEnvelopedSignatureTransform.cs -
-// Enveloped Signature Transform implementation for XML Signature
-// http://www.w3.org/TR/1999/REC-xslt-19991116
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-// Atsushi Enomoto (atsushi@ximian.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-// (C) 2004 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.
-//
-
-using System.IO;
-using System.Xml;
-using System.Xml.Xsl;
-
-namespace System.Security.Cryptography.Xml
-{
-
- public class XmlDsigXsltTransform : Transform
- {
-
- private Type [] input;
- private Type [] output;
- private bool comments;
- private XmlNodeList xnl;
- private XmlDocument inputDoc;
-
- public XmlDsigXsltTransform () : this (false)
- {
- }
-
- public XmlDsigXsltTransform (bool includeComments)
- {
- comments = includeComments;
- Algorithm = XmlSignature.AlgorithmNamespaces.XmlDsigXsltTransform;
- }
-
- public override Type [] InputTypes {
- get {
- if (input == null) {
- input = new Type [3];
- input [0] = typeof (System.IO.Stream);
- input [1] = typeof (System.Xml.XmlDocument);
- input [2] = typeof (System.Xml.XmlNodeList);
- }
- return input;
- }
- }
-
- public override Type [] OutputTypes {
- get {
- if (output == null) {
- output = new Type [1];
- output [0] = typeof (System.IO.Stream);
- }
- return output;
- }
- }
-
- protected override XmlNodeList GetInnerXml ()
- {
- return xnl;
- }
-
- public override object GetOutput ()
- {
- if (xnl == null)
- throw new ArgumentNullException ("LoadInnerXml before transformation.");
-
- XmlResolver resolver = GetResolver ();
-
- XslTransform xsl = new XslTransform ();
- XmlDocument doc = new XmlDocument ();
- doc.XmlResolver = resolver;
- foreach (XmlNode n in xnl)
- doc.AppendChild (doc.ImportNode (n, true));
- xsl.Load (doc, resolver);
-
- if (inputDoc == null)
- throw new ArgumentNullException ("LoadInput before transformation.");
-
- MemoryStream stream = new MemoryStream ();
- // only possible output: Stream
- xsl.XmlResolver = resolver;
- xsl.Transform (inputDoc, null, stream);
-
- stream.Seek (0, SeekOrigin.Begin);
- return stream;
- }
-
- public override object GetOutput (Type type)
- {
- if (type != typeof (Stream))
- throw new ArgumentException ("type");
- return GetOutput ();
- }
-
- public override void LoadInnerXml (XmlNodeList nodeList)
- {
- if (nodeList == null)
- throw new CryptographicException ("nodeList");
- xnl = nodeList;
- }
-
- public override void LoadInput (object obj)
- {
- // possible input: Stream, XmlDocument, and XmlNodeList
- Stream s = (obj as Stream);
- if (s != null) {
- inputDoc = new XmlDocument ();
- inputDoc.XmlResolver = GetResolver ();
-// inputDoc.Load (obj as Stream);
- inputDoc.Load (new XmlSignatureStreamReader (new StreamReader (s)));
- return;
- }
-
- XmlDocument xd = (obj as XmlDocument);
- if (xd != null) {
- inputDoc = xd;
- return;
- }
-
- XmlNodeList nl = (obj as XmlNodeList);
- if (nl != null) {
- inputDoc = new XmlDocument ();
- inputDoc.XmlResolver = GetResolver ();
- for (int i = 0; i < nl.Count; i++)
- inputDoc.AppendChild (inputDoc.ImportNode (nl [i], true));
- }
- }
- }
-}
+++ /dev/null
-//
-// System.Security.Cryptography.Xml.XmlLicenseTransform class
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// Copyright (C) 2005 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.Xml;
-
-namespace System.Security.Cryptography.Xml {
-
- public class XmlLicenseTransform : Transform {
-
- private IRelDecryptor _decryptor;
- private Type[] inputTypes;
- private Type[] outputTypes;
-
- public XmlLicenseTransform ()
- {
- Algorithm = XmlSignature.AlgorithmNamespaces.XmlLicenseTransform;
- }
-
- public IRelDecryptor Decryptor {
- get { return _decryptor; }
- set { _decryptor = value; }
- }
-
- public override Type[] InputTypes {
- get {
- if (inputTypes == null)
- inputTypes = new Type [1] { typeof (XmlDocument) };
-
- return inputTypes;
- }
- }
-
- public override Type[] OutputTypes {
- get {
- if (outputTypes == null)
- outputTypes = new Type [1] {typeof (XmlDocument)};
-
- return outputTypes;
- }
- }
-
- [MonoTODO]
- protected override XmlNodeList GetInnerXml ()
- {
- return null;
- }
-
- [MonoTODO]
- public override object GetOutput ()
- {
- return null;
- }
-
- public override object GetOutput (Type type)
- {
- if (type != typeof (XmlDocument))
- throw new ArgumentException ("type");
- return GetOutput ();
- }
-
- public override void LoadInnerXml (XmlNodeList nodeList)
- {
- // documented as not supported
- }
-
- [MonoTODO]
- public override void LoadInput (object obj)
- {
- if (_decryptor == null)
- throw new CryptographicException (Locale.GetText ("missing decryptor"));
- // TODO: check for <issuer> element
- // TODO: check for <license> element
- }
- }
-}
public AttributeNames () {}
}
- public class AlgorithmNamespaces {
- public const string XmlDsigBase64Transform = "http://www.w3.org/2000/09/xmldsig#base64";
- public const string XmlDsigC14NTransform = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315";
- public const string XmlDsigC14NWithCommentsTransform = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments";
- public const string XmlDsigEnvelopedSignatureTransform = "http://www.w3.org/2000/09/xmldsig#enveloped-signature";
- public const string XmlDsigXPathTransform = "http://www.w3.org/TR/1999/REC-xpath-19991116";
- public const string XmlDsigXsltTransform = "http://www.w3.org/TR/1999/REC-xslt-19991116";
- public const string XmlDsigExcC14NTransform = "http://www.w3.org/2001/10/xml-exc-c14n#";
- public const string XmlDsigExcC14NWithCommentsTransform = "http://www.w3.org/2001/10/xml-exc-c14n#WithComments";
- public const string XmlDecryptionTransform = "http://www.w3.org/2002/07/decrypt#XML";
- public const string XmlLicenseTransform = "urn:mpeg:mpeg21:2003:01-REL-R-NS:licenseTransform";
- }
-
public class Uri {
public const string Manifest = "http://www.w3.org/2000/09/xmldsig#Manifest";
}
+++ /dev/null
-//
-// XmlSignatureStreamReader.cs: Wrap TextReader and eliminate \r
-//
-// Author:
-// Atsushi Enomoto (atsushi@ximian.com)
-//
-// (C) 2005 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.
-//
-//
-// Use it to distinguish 
 and \r. \r is removed, while 
 is not.
-//
-//
-
-using System;
-using System.IO;
-using System.Runtime.InteropServices;
-
-namespace System.Security.Cryptography.Xml
-{
- internal class XmlSignatureStreamReader : TextReader
- {
- TextReader source;
- int cache = int.MinValue;
-
- public XmlSignatureStreamReader (TextReader input)
- {
- source =input;
- }
-
- public override void Close ()
- {
- source.Close ();
- }
-
- public override int Peek ()
- {
- // If source TextReader does not support Peek(),
- // it does not support too. Or it just returns EOF.
- if (source.Peek () == -1)
- return -1;
-
- if (cache != int.MinValue)
- return cache;
- cache = source.Read ();
- if (cache != '\r')
- return cache;
- // cache must be '\r' here.
- if (source.Peek () != '\n')
- return '\r';
- // Now Peek() returns '\n', so clear cache.
- cache = int.MinValue;
- return '\n';
- }
-
- public override int Read ()
- {
- if (cache != int.MinValue) {
- int ret = cache;
- cache = int.MinValue;
- return ret;
- }
- int i = source.Read ();
- if (i != '\r')
- return i;
- // read one more char (after '\r')
- cache = source.Read ();
- if (cache != '\n')
- return '\r';
- cache = int.MinValue;
- return '\n';
- }
-
- public override int ReadBlock (
- [In, Out] char [] buffer, int index, int count)
- {
- char [] tmp = new char [count];
- source.ReadBlock (tmp, 0, count);
- int j = index;
- for (int i = 0; i < count; j++) {
- if (tmp [i] == '\r') {
- if (++i < tmp.Length && tmp [i] == '\n')
- buffer [j] = tmp [i++];
- else
- buffer [j] = '\r';
- }
- else
- buffer [j] = tmp [i];
- }
- while (j < count) {
- int d = Read ();
- if (d < 0)
- break;
- buffer [j++] = (char) d;
- }
- return j;
- }
-
- // I have no idea what to do here, but I don't think it
- // makes sense.
- public override string ReadLine ()
- {
- return source.ReadLine ();
- }
-
- public override string ReadToEnd ()
- {
- return source.ReadToEnd ().Replace ("\r\n", "\n");
- }
- }
-}
../../build/common/Locale.cs
Mono.Security.Cryptography/ManagedProtection.cs
Mono.Security.Cryptography/NativeDapiProtection.cs
-Mono.Xml/XmlCanonicalizer.cs
System.Security.Cryptography/CryptographicAttribute.cs
System.Security.Cryptography/CryptographicAttributeCollection.cs
System.Security.Cryptography/CryptographicAttributeEnumerator.cs
System.Security.Cryptography.Pkcs/SubjectIdentifierOrKey.cs
System.Security.Cryptography.Pkcs/SubjectIdentifierOrKeyType.cs
System.Security.Cryptography.Pkcs/SubjectIdentifierType.cs
+../System.Core/System.Security.Cryptography.X509Certificates/RSACertificateExtensions.cs
System.Security.Cryptography.X509Certificates/X509Certificate2UI.cs
System.Security.Cryptography.X509Certificates/X509SelectionFlag.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/AncestralNamespaceContextManager.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/AttributeSortOrder.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/C14NAncestralNamespaceContextManager.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/CanonicalizationDispatcher.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/CanonicalXml.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/CanonicalXmlAttribute.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/CanonicalXmlCDataSection.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/CanonicalXmlComment.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/CanonicalXmlDocument.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/CanonicalXmlElement.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/CanonicalXmlEntityReference.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/CanonicalXmlNodeList.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/CanonicalXmlProcessingInstruction.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/CanonicalXmlSignificantWhitespace.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/CanonicalXmlText.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/CanonicalXmlWhitespace.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/CertUsageType.cs
System.Security.Cryptography.Xml/CipherData.cs
System.Security.Cryptography.Xml/CipherReference.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/CryptoHelpers.cs
System.Security.Cryptography.Xml/DataObject.cs
System.Security.Cryptography.Xml/DataReference.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/DocPosition.cs
System.Security.Cryptography.Xml/DSAKeyValue.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/DSASignatureDescription.cs
System.Security.Cryptography.Xml/EncryptedData.cs
System.Security.Cryptography.Xml/EncryptedKey.cs
System.Security.Cryptography.Xml/EncryptedReference.cs
System.Security.Cryptography.Xml/EncryptionMethod.cs
System.Security.Cryptography.Xml/EncryptionProperties.cs
System.Security.Cryptography.Xml/EncryptionProperty.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/ExcAncestralNamespaceContextManager.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/ExcCanonicalXml.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/ICanonicalizableNode.cs
System.Security.Cryptography.Xml/IRelDecryptor.cs
System.Security.Cryptography.Xml/KeyInfoClause.cs
System.Security.Cryptography.Xml/KeyInfo.cs
System.Security.Cryptography.Xml/KeyInfoX509Data.cs
System.Security.Cryptography.Xml/KeyReference.cs
System.Security.Cryptography.Xml/Manifest.cs
-System.Security.Cryptography.Xml/Reference.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/MyXmlDocument.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/NamespaceFrame.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/NamespaceSortOrder.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/Reference.cs
System.Security.Cryptography.Xml/ReferenceList.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/ReferenceTargetType.cs
System.Security.Cryptography.Xml/RSAKeyValue.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/RSAPKCS1SHA1SignatureDescription.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/RSAPKCS1SHA256SignatureDescription.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/RSAPKCS1SHA384SignatureDescription.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/RSAPKCS1SHA512SignatureDescription.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/RSAPKCS1SignatureDescription.cs
System.Security.Cryptography.Xml/Signature.cs
System.Security.Cryptography.Xml/SignedInfo.cs
System.Security.Cryptography.Xml/SignedXml.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/SignedXmlDebugLog.cs
System.Security.Cryptography.Xml/SymmetricKeyWrap.cs
-System.Security.Cryptography.Xml/TransformChain.cs
-System.Security.Cryptography.Xml/Transform.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/Transform.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/TransformChain.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/Utils.cs
System.Security.Cryptography.Xml/X509IssuerSerial.cs
-System.Security.Cryptography.Xml/XmlDecryptionTransform.cs
-System.Security.Cryptography.Xml/XmlDsigBase64Transform.cs
-System.Security.Cryptography.Xml/XmlDsigC14NTransform.cs
-System.Security.Cryptography.Xml/XmlDsigC14NWithCommentsTransform.cs
-System.Security.Cryptography.Xml/XmlDsigEnvelopedSignatureTransform.cs
-System.Security.Cryptography.Xml/XmlDsigExcC14NTransform.cs
-System.Security.Cryptography.Xml/XmlDsigExcC14NWithCommentsTransform.cs
-System.Security.Cryptography.Xml/XmlDsigNodeList.cs
-System.Security.Cryptography.Xml/XmlDsigXPathTransform.cs
-System.Security.Cryptography.Xml/XmlDsigXsltTransform.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/XmlDecryptionTransform.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/XmlDsigBase64Transform.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/XmlDsigC14NTransform.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/XmlDsigC14NWithCommentsTransform.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/XmlDsigEnvelopedSignatureTransform.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/XmlDsigExcC14NTransform.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/XmlDsigExcC14NWithCommentsTransform.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/XmlDsigXPathTransform.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/XmlDsigXsltTransform.cs
System.Security.Cryptography.Xml/XmlEncryption.cs
-System.Security.Cryptography.Xml/XmlLicenseTransform.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/XmlLicenseTransform.cs
System.Security.Cryptography.Xml/XmlSignature.cs
-System.Security.Cryptography.Xml/XmlSignatureStreamReader.cs
../../build/common/MonoTODOAttribute.cs
System.Security.Permissions/DataProtectionPermission.cs
System.Security.Permissions/DataProtectionPermissionAttribute.cs
{
Assert.IsNull (reference.Uri, "Uri (null)");
Assert.IsNotNull (reference.TransformChain, "TransformChain");
- Assert.AreEqual ("System.Security.Cryptography.Xml.Reference", reference.ToString (), "ToString()");
// test uri constructor
string uri = "uri";
reference = new Reference (uri);
- Assert.AreEqual ("http://www.w3.org/2000/09/xmldsig#sha1", reference.DigestMethod, "DigestMethod");
+ Assert.AreEqual (SignedXml.XmlDsigSHA256Url, reference.DigestMethod, "DigestMethod");
Assert.IsNull (reference.DigestValue, "DigestValue");
Assert.IsNull (reference.Id, "Id");
Assert.IsNull (reference.Type, "Type");
}
[Test]
- [Category ("NotDotNet")]
- // MS throws a NullReferenceException (reported as FDBK25886) but only when executed in NUnit
- // http://lab.msdn.microsoft.com/ProductFeedback/viewfeedback.aspx?feedbackid=3596d1e3-362b-40bd-bca9-2e8be75261ff
public void AddAllTransforms ()
{
- // adding an empty hash value
- byte[] hash = new byte [20];
- reference.DigestValue = hash;
- XmlElement xel = reference.GetXml ();
- // this is the minimal Reference (DigestValue)!
- Assert.IsNotNull (xel, "GetXml");
+ reference.DigestMethod = SignedXml.XmlDsigSHA1Url;
+ reference.DigestValue = new byte [20];
reference.AddTransform (new XmlDsigBase64Transform ());
reference.AddTransform (new XmlDsigC14NTransform ());
reference.AddTransform (new XmlDsigXPathTransform ());
reference.AddTransform (new XmlDsigXsltTransform ());
- // MS's results
- string test1 = "<Reference xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><Transforms><Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#base64\" /><Transform Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\" /><Transform Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments\" /><Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#enveloped-signature\" /><Transform Algorithm=\"http://www.w3.org/TR/1999/REC-xpath-19991116\"><XPath></XPath></Transform><Transform Algorithm=\"http://www.w3.org/TR/1999/REC-xslt-19991116\" /></Transforms><DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><DigestValue>AAAAAAAAAAAAAAAAAAAAAAAAAAA=</DigestValue></Reference>";
- // Mono's result (xml is equivalent but not identical)
- string test2 = test1.Replace ("<XPath></XPath>", "<XPath xmlns=\"http://www.w3.org/2000/09/xmldsig#\" />");
- string result = reference.GetXml().OuterXml;
- Assert.IsTrue (((result == test1) || (result == test2)), result);
- // however this value cannot be loaded as it's missing some transform (xslt) parameters
+ const string expected = "<Reference xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><Transforms><Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#base64\" /><Transform Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\" /><Transform Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments\" /><Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#enveloped-signature\" /><Transform Algorithm=\"http://www.w3.org/TR/1999/REC-xpath-19991116\"><XPath /></Transform><Transform Algorithm=\"http://www.w3.org/TR/1999/REC-xslt-19991116\" /></Transforms><DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><DigestValue>AAAAAAAAAAAAAAAAAAAAAAAAAAA=</DigestValue></Reference>";
+ Assert.That (reference.GetXml ().OuterXml, Is.EqualTo (expected), "OuterXml");
// can we add them again ?
reference.AddTransform (new XmlDsigBase64Transform ());
signedXml.SignedInfo.CanonicalizationMethod = SignedXml.XmlDsigExcC14NTransformUrl;
Reference reference = new Reference ();
+ reference.DigestMethod = SignedXml.XmlDsigSHA1Url;
reference.Uri = "";
XmlDsigEnvelopedSignatureTransform env = new XmlDsigEnvelopedSignatureTransform ();
}
[Test]
- [Category ("NotDotNet")]
// see LoadInputAsXmlNodeList2 description
public void LoadInputAsXmlNodeList ()
{
transform.LoadInput (doc.ChildNodes);
Stream s = (Stream) transform.GetOutput ();
string output = Stream2String (s);
- Assert.AreEqual ("<Test></Test>", output, "XmlChildNodes");
+ Assert.AreEqual ("<Test xmlns=\"http://www.go-mono.com/\"></Test>", output, "XmlChildNodes");
}
[Test]
- [Category ("NotDotNet")]
// MS has a bug that those namespace declaration nodes in
// the node-set are written to output. Related spec section is:
// http://www.w3.org/TR/2001/REC-xml-c14n-20010315#ProcessingModel
transform.LoadInput (doc.SelectNodes ("//*"));
Stream s = (Stream) transform.GetOutput ();
string output = Stream2String (s);
- string expected = @"<Test><Toto></Toto></Test>";
+ string expected = "<Test xmlns=\"http://www.go-mono.com/\"><Toto></Toto></Test>";
Assert.AreEqual (expected, output, "XmlChildNodes");
}
Assert.AreEqual (xml, output);
}
- [Test]
- public void PrefixlessNamespaceOutput ()
- {
- XmlDocument doc = new XmlDocument ();
- doc.AppendChild (doc.CreateElement ("foo", "urn:foo"));
- doc.DocumentElement.AppendChild (doc.CreateElement ("bar", "urn:bar"));
- Assert.AreEqual (String.Empty, doc.DocumentElement.GetAttribute ("xmlns"), "#1");
- XmlDsigC14NTransform t = new XmlDsigC14NTransform ();
- t.LoadInput (doc);
- Stream s = t.GetOutput () as Stream;
- Assert.AreEqual (new StreamReader (s, Encoding.UTF8).ReadToEnd (), "<foo xmlns=\"urn:foo\"><bar xmlns=\"urn:bar\"></bar></foo>");
- Assert.AreEqual ("urn:foo", doc.DocumentElement.GetAttribute ("xmlns"), "#2");
- }
-
[Test]
[Ignore ("find out how PropagatedNamespaces returns non-null instance on .NET")]
public void PropagatedNamespaces ()
}
[Test]
- [Category ("NotDotNet")]
// see LoadInputAsXmlNodeList2 description
public void LoadInputAsXmlNodeList ()
{
transform.LoadInput (doc.ChildNodes);
Stream s = (Stream) transform.GetOutput ();
string output = Stream2String (s);
- Assert.AreEqual ("<Test></Test>", output, "XmlChildNodes");
+ Assert.AreEqual ("<Test xmlns=\"http://www.go-mono.com/\"></Test>", output, "XmlChildNodes");
}
[Test]
- [Category ("NotDotNet")]
// MS has a bug that those namespace declaration nodes in
// the node-set are written to output. Related spec section is:
// http://www.w3.org/TR/2001/REC-xml-c14n-20010315#ProcessingModel
transform.LoadInput (doc.SelectNodes ("//*"));
Stream s = (Stream) transform.GetOutput ();
string output = Stream2String (s);
- string expected = @"<Test><Toto></Toto></Test>";
+ string expected = "<Test xmlns=\"http://www.go-mono.com/\"><Toto></Toto></Test>";
Assert.AreEqual (expected, output, "XmlChildNodes");
}
public const string Cryptography_Xml_InvalidReference = "Malformed reference element.";
public const string Cryptography_Xml_InvalidSignatureLength = "The length of the signature with a MAC should be less than the hash output length.";
public const string Cryptography_Xml_InvalidSignatureLength2 = "The length in bits of the signature with a MAC should be a multiple of 8.";
+ public const string Cryptography_Xml_InvalidX509IssuerSerialNumber = "X509 issuer serial number is invalid.";
public const string Cryptography_Xml_KeyInfoRequired = "A KeyInfo element is required to check the signature.";
public const string Cryptography_Xml_KW_BadKeySize = "The length of the encrypted data in Key Wrap is either 32, 40 or 48 bytes.";
public const string Cryptography_Xml_LoadKeyFailed = "Signing key is not loaded.";
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile("../winfx.pub")]
-
[assembly: ComVisible (false)]
[assembly: InternalsVisibleTo ("System.ServiceModel, PublicKey=00000000000000000400000000000000")]
LIBRARY = System.ServiceModel.Activation.dll
LIB_REFS = System.Core System plainservice/System.ServiceModel
+KEYFILE = ../winfx.pub
LIB_MCS_FLAGS =
TEST_MCS_FLAGS =
<AssemblyName>System.ServiceModel.Activation</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../winfx.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: ComVisible (false)]
[assembly: AssemblyDelaySign (true)]
-#if MOBILE
-[assembly: AssemblyKeyFile ("../silverlight.pub")]
-#else
-[assembly: AssemblyKeyFile("../winfx.pub")]
-#endif
LIB_MCS_FLAGS += -d:NET_3_5 -d:NET_3_0
endif
+ifdef MOBILE_PROFILE
+KEYFILE = ../silverlight.pub
+else
+KEYFILE = ../winfx.pub
+endif
+
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
EXTRA_DISTFILES = $(RESOURCE_FILES)
<AssemblyName>System.ServiceModel.Discovery</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../winfx.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>System.ServiceModel.Internals</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: ComVisible (false)]
[assembly: AssemblyDelaySign (true)]
-#if MOBILE
-[assembly: AssemblyKeyFile ("../silverlight.pub")]
-#else
-[assembly: AssemblyKeyFile("../winfx.pub")]
-#endif
LIB_MCS_FLAGS += -d:NET_3_5 -d:NET_3_0
endif
+ifdef MOBILE_PROFILE
+KEYFILE = ../silverlight.pub
+else
+KEYFILE = ../winfx.pub
+endif
+
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
EXTRA_DISTFILES = $(RESOURCE_FILES)
<AssemblyName>System.ServiceModel.Routing</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../winfx.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: ComVisible (false)]
[assembly: AssemblyDelaySign (true)]
-#if MOBILE
[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyKeyFile ("../silverlight.pub")]
-#else
-[assembly: AssemblyInformationalVersion ("3.5.594.0")]
-[assembly: AssemblyKeyFile("../winfx.pub")]
-#endif
#if MOBILE
[assembly: InternalsVisibleTo ("System.Json, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
endif
endif
+ifdef MOBILE_PROFILE
+KEYFILE = ../silverlight.pub
+else
+KEYFILE = ../winfx.pub
+endif
+
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
EXTRA_DISTFILES = $(RESOURCE_FILES) \
<AssemblyName>System.ServiceModel.Web</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../winfx.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>System.ServiceModel</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>System.ServiceModel</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
get { return behaviors; }
}
- [MonoTODO]
public KeyedCollection<Type,IEndpointBehavior> EndpointBehaviors {
- get { throw new NotImplementedException (); }
+ get { return behaviors; }
}
public ContractDescription Contract {
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile("../msfinal.pub")]
[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
[assembly: CompilationRelaxations (CompilationRelaxations.NoStringInterning)]
LIBRARY = System.ServiceProcess.dll
LIB_REFS = System System.Configuration.Install System.Windows.Forms
+KEYFILE = ../msfinal.pub
LIB_MCS_FLAGS = /nowarn:0618
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
<AssemblyName>System.ServiceProcess</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../ecma.pub")]
[assembly: ComVisible (false)]
LIBRARY = System.Threading.Tasks.Dataflow.dll
-include ../../build/library.make
-
LIB_REFS += System.Core System
+KEYFILE = ../ecma.pub
LIB_MCS_FLAGS += -d:CONCURRENT_COLLECTIONS
+include ../../build/library.make
+
TEST_MCS_FLAGS =
TEST_LIB_REFS = System.Core System
<AssemblyName>System.Threading.Tasks.Dataflow</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../ecma.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
- [assembly: AssemblyKeyFile("../ecma.pub")]
[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
[assembly: BestFitMapping (false)]
include ../../build/rules.make
LIBRARY = System.Transactions.dll
+KEYFILE = ../ecma.pub
ifdef MOBILE_PROFILE
LIB_REFS = System
LIB_MCS_FLAGS = /define:MOBILE
<AssemblyName>System.Transactions</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../ecma.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: NeutralResourcesLanguage ("en-US")]
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../winfx.pub")]
[assembly: ComVisible (false)]
[assembly: AllowPartiallyTrustedCallers]
LIBRARY = System.Web.Abstractions.dll
LIB_REFS = System System.Core System.Web
+KEYFILE = ../winfx.pub
LIB_MCS_FLAGS =
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
<AssemblyName>System.Web.Abstractions</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../winfx.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: ComVisible (false)]
-[assembly: AssemblyKeyFile ("../winfx.pub")]
[assembly: InternalsVisibleTo ("System.Web, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
[assembly: AllowPartiallyTrustedCallers]
LIBRARY = System.Web.ApplicationServices.dll
LIB_REFS = System System.Configuration
+KEYFILE = ../winfx.pub
LIB_MCS_FLAGS = -d:SYSTEM_WEB_APPLICATIONSERVICES
EXTRA_DISTFILES = $(RESOURCE_FILES)
<AssemblyName>System.Web.ApplicationServices</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../winfx.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: NeutralResourcesLanguage ("en-US")]
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../winfx.pub")]
[assembly: ComVisible (false)]
[assembly: ComCompatibleVersion (1, 0, 3300, 0)]
LIBRARY = System.Web.DynamicData.dll
LIB_REFS = System System.Core System.ComponentModel.DataAnnotations System.Data System.Data.Linq System.Drawing System.Web System.Web.Extensions System.Web.Abstractions System.Web.Routing
+KEYFILE = ../winfx.pub
LIB_MCS_FLAGS =
ifeq (4, $(FRAMEWORK_VERSION_MAJOR))
<AssemblyName>System.Web.DynamicData</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../winfx.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
//[assembly: AssemblyFileVersion ("1.0.0.0")]
#if !TARGET_DOTNET
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../winfx.pub")]
#endif
#if !(TARGET_DOTNET)
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
- [assembly: AssemblyKeyFile ("../winfx.pub")]
#endif
[assembly: ComVisible (false)]
LIBRARY = System.Web.Extensions.Design.dll
LIB_REFS = System System.Design System.Drawing System.Windows.Forms
+KEYFILE = ../winfx.pub
LIB_MCS_FLAGS = -define:NET_3_5
include ../../build/library.make
<AssemblyName>System.Web.Extensions.Design</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../winfx.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
#if !(TARGET_DOTNET)
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
- [assembly: AssemblyKeyFile ("../winfx.pub")]
#endif
endif
LIB_REFS = System System.Core System.Drawing System.Data System.Data.Linq System.Xml System.Web System.Web.Services System.Configuration System.EnterpriseServices System.ServiceModel
+KEYFILE = ../winfx.pub
LIB_MCS_FLAGS = \
-unsafe \
-define:NET_3_5 -nowarn:436 \
<AssemblyName>System.Web.Extensions</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../winfx.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>System.Web.Http.SelfHost</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../winfx.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<AssemblyName>System.Web.Http.WebHost</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../winfx.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
System.Web.Http.Properties.CommonWebApiResources,../../../external/aspnetwebstack/src/Common/CommonWebApiResources.resx \
System.Web.Http.Properties.SRResources,../../../external/aspnetwebstack/src/System.Web.Http/Properties/SRResources.resx
-
-
LIB_REFS = System.Core System System.Xml System.Net.Http System.ComponentModel.DataAnnotations System.Net.Http.Formatting System.Runtime.Caching System.Runtime.Serialization System.Data.Linq
-LIB_MCS_FLAGS = -d:ASPNETMVC -keyfile:../winfx.pub -delaysign
+KEYFILE = ../winfx.pub
+LIB_MCS_FLAGS = -d:ASPNETMVC -delaysign
include ../../build/library.make
<AssemblyName>System.Web.Http</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../winfx.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<AssemblyName>System.Web.Mobile</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
RESX_DIST = Mvc/Resources/MvcResources.resx
LIB_REFS = Microsoft.Web.Infrastructure System System.Core System.Configuration System.Data System.Xml System.Web System.Web.Abstractions System.Web.Routing System.Web.Extensions System.ComponentModel.DataAnnotations System.Data.Linq System.Runtime.Caching System.Web.Razor System.Web.WebPages.Razor System.Web.WebPages
+KEYFILE = ../winfx.pub
LIB_MCS_FLAGS = \
/warn:1 \
- /keyfile:../winfx.pub \
/d:MONO \
/delaysign
<AssemblyName>System.Web.Mvc</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../winfx.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
System.Web.Razor.Resources.RazorResources,../../../external/aspnetwebstack/src/System.Web.Razor/Resources/RazorResources.resx
LIB_REFS = System System.Core
+KEYFILE = ../winfx.pub
LIB_MCS_FLAGS = \
/warn:1 \
- /keyfile:../winfx.pub -delaysign \
- /d:ASPNETWEBPAGES
+ -delaysign \
+ /d:ASPNETWEBPAGES
include ../../build/library.make
-
<AssemblyName>System.Web.Razor</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../winfx.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<AssemblyName>System.Web.RegularExpressions</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
[assembly: NeutralResourcesLanguage ("en-US")]
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../winfx.pub")]
[assembly: ComVisible (false)]
[assembly: AllowPartiallyTrustedCallers]
LIBRARY = System.Web.Routing.dll
LIB_REFS = System System.Core System.Web System.Web.Abstractions
+KEYFILE = ../winfx.pub
LIB_MCS_FLAGS =
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
<AssemblyName>System.Web.Routing</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../winfx.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
- [assembly: AssemblyKeyFile("../msfinal.pub")]
[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
[assembly: CompilationRelaxations (CompilationRelaxations.NoStringInterning)]
include ../../build/rules.make
LIBRARY = System.Web.Services.dll
+KEYFILE = ../msfinal.pub
ifdef MOBILE_PROFILE
LIB_REFS = System System.Xml
LIB_MCS_FLAGS = \
<AssemblyName>System.Web.Services</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
WebRequest request = GetWebRequest (uri);
request.Method = "POST";
WebHeaderCollection headers = request.Headers;
- if (!message.IsSoap12)
- headers.Add ("SOAPAction", "\"" + message.Action + "\"");
request.ContentType = message.ContentType + "; charset=utf-8";
+ if (!message.IsSoap12) {
+ headers.Add ("SOAPAction", "\"" + message.Action + "\"");
+ } else {
+ request.ContentType += "; action=\"" + message.Action + "\"";
+ }
return request;
}
public class DiscoveryClientProtocolTest {
[Test] // Covers #36116
- [Category ("InetAccess")]
+ [Category ("NotWorking")]
public void ReadWriteTest ()
{
string directory = Path.Combine (Path.GetTempPath (), Path.GetRandomFileName ());
LIB_REFS = System System.Core System.Configuration System.Web Microsoft.Web.Infrastructure
+KEYFILE=../winfx.pub
LIB_MCS_FLAGS = \
- /warn:1 \
- /keyfile:../winfx.pub -delaysign \
- /d:ASPNETWEBPAGES
+ /warn:1 \
+ -delaysign \
+ /d:ASPNETWEBPAGES
include ../../build/library.make
<AssemblyName>System.Web.WebPages.Deployment</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../winfx.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
System.Web.WebPages.Razor.Resources.RazorWebResources,../../../external/aspnetwebstack/src/System.Web.WebPages.Razor/Resources/RazorWebResources.resx
LIB_REFS = System System.Core System.Configuration System.Web System.Web.WebPages System.Web.Razor
+KEYFILE = ../winfx.pub
LIB_MCS_FLAGS = \
- /warn:1 \
- /keyfile:../winfx.pub \
- /delaysign \
+ /warn:1 \
+ /delaysign \
/d:ASPNETWEBPAGES
include ../../build/library.make
<AssemblyName>System.Web.WebPages.Razor</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../winfx.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
LIB_REFS = Microsoft.CSharp Microsoft.Web.Infrastructure System System.ComponentModel.DataAnnotations System.Configuration System.Core System.Data.Linq System.Web System.Web.WebPages.Deployment System.Web.Razor System.Xml System.Xml.Linq
+KEYFILE=../winfx.pub
LIB_MCS_FLAGS = \
- /warn:1 \
- /keyfile:../winfx.pub \
- /delaysign \
+ /warn:1 \
+ /delaysign \
/d:ASPNETWEBPAGES
EXTRA_DISTFILES = $(RESX_DIST)
<AssemblyName>System.Web.WebPages</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../winfx.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
[assembly: TagPrefix("System.Web.UI.WebControls", "asp")]
#if !(TARGET_DOTNET)
[assembly: AssemblyDelaySign(true)]
-[assembly: AssemblyKeyFile("../msfinal.pub")]
[assembly: AssemblyFileVersion (Consts.FxVersion)]
[assembly: CompilationRelaxations (CompilationRelaxations.NoStringInterning)]
LIB_REFS = System System.Core System.Drawing System.Data System.Xml System.EnterpriseServices System.Runtime.Serialization.Formatters.Soap \
System.ComponentModel.DataAnnotations System.Web.ApplicationServices System.Configuration Mono.Data.Sqlite
+KEYFILE = ../msfinal.pub
LIB_MCS_FLAGS = \
-unsafe \
-nowarn:612,618 \
<AssemblyName>System.Web</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>System.Web</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
-debug:full \
-r:System.Web.dll
-VALID_PROFILE := $(filter 4.0, $(FRAMEWORK_VERSION))
+VALID_PROFILE := $(filter 4.5, $(FRAMEWORK_VERSION))
ifndef VALID_PROFILE
all:
-debug:full \
-r:System.Web.dll
-VALID_PROFILE := $(filter 4.0, $(FRAMEWORK_VERSION))
+VALID_PROFILE := $(filter 4.5, $(FRAMEWORK_VERSION))
ifndef VALID_PROFILE
all:
-debug:full \
-r:System.Web.dll
-VALID_PROFILE := $(filter 4.0, $(FRAMEWORK_VERSION))
+VALID_PROFILE := $(filter 4.5, $(FRAMEWORK_VERSION))
ifndef VALID_PROFILE
all:
-debug:full \
-r:System.Web.dll
-VALID_PROFILE := $(filter 4.0, $(FRAMEWORK_VERSION))
+VALID_PROFILE := $(filter 4.5, $(FRAMEWORK_VERSION))
ifndef VALID_PROFILE
all:
-debug:full \
-r:System.Web.dll
-VALID_PROFILE := $(filter 4.0, $(FRAMEWORK_VERSION))
+VALID_PROFILE := $(filter 4.5, $(FRAMEWORK_VERSION))
ifndef VALID_PROFILE
all:
-debug:full \
-r:System.Web.dll
-VALID_PROFILE := $(filter 4.0, $(FRAMEWORK_VERSION))
+VALID_PROFILE := $(filter 4.5, $(FRAMEWORK_VERSION))
ifndef VALID_PROFILE
all:
-debug:full \
-r:System.Web.dll
-VALID_PROFILE := $(filter 4.0, $(FRAMEWORK_VERSION))
+VALID_PROFILE := $(filter 4.5, $(FRAMEWORK_VERSION))
ifndef VALID_PROFILE
all:
-debug:full \
-r:System.Web.dll
-VALID_PROFILE := $(filter 4.0, $(FRAMEWORK_VERSION))
+VALID_PROFILE := $(filter 4.5, $(FRAMEWORK_VERSION))
ifndef VALID_PROFILE
all:
-debug:full \
-r:System.Web.dll
-VALID_PROFILE := $(filter 4.0, $(FRAMEWORK_VERSION))
+VALID_PROFILE := $(filter 4.5, $(FRAMEWORK_VERSION))
ifndef VALID_PROFILE
all:
-debug:full \
-r:System.Web.dll
-VALID_PROFILE := $(filter 4.0, $(FRAMEWORK_VERSION))
+VALID_PROFILE := $(filter 4.5, $(FRAMEWORK_VERSION))
ifndef VALID_PROFILE
all:
-debug:full \
-r:System.Web.dll
-VALID_PROFILE := $(filter 4.0, $(FRAMEWORK_VERSION))
+VALID_PROFILE := $(filter 4.5, $(FRAMEWORK_VERSION))
ifndef VALID_PROFILE
all:
-debug:full \
-r:System.Web.dll
-VALID_PROFILE := $(filter 4.0, $(FRAMEWORK_VERSION))
+VALID_PROFILE := $(filter 4.5, $(FRAMEWORK_VERSION))
ifndef VALID_PROFILE
all:
-debug:full \
-r:System.Web.dll
-VALID_PROFILE := $(filter 4.0, $(FRAMEWORK_VERSION))
+VALID_PROFILE := $(filter 4.5, $(FRAMEWORK_VERSION))
ifndef VALID_PROFILE
all:
-debug:full \
-r:System.Web.dll
-VALID_PROFILE := $(filter 4.0, $(FRAMEWORK_VERSION))
+VALID_PROFILE := $(filter 4.5, $(FRAMEWORK_VERSION))
ifndef VALID_PROFILE
all:
-debug:full \
-r:System.Web.dll
-VALID_PROFILE := $(filter 4.0, $(FRAMEWORK_VERSION))
+VALID_PROFILE := $(filter 4.5, $(FRAMEWORK_VERSION))
ifndef VALID_PROFILE
all:
-debug:full \
-r:System.Web.dll
-VALID_PROFILE := $(filter 4.0, $(FRAMEWORK_VERSION))
+VALID_PROFILE := $(filter 4.5, $(FRAMEWORK_VERSION))
ifndef VALID_PROFILE
all:
-debug:full \
-r:System.Web.dll
-VALID_PROFILE := $(filter 4.0, $(FRAMEWORK_VERSION))
+VALID_PROFILE := $(filter 4.5, $(FRAMEWORK_VERSION))
ifndef VALID_PROFILE
all:
-debug:full \
-r:System.Web.dll
-VALID_PROFILE := $(filter 4.0, $(FRAMEWORK_VERSION))
+VALID_PROFILE := $(filter 4.5, $(FRAMEWORK_VERSION))
ifndef VALID_PROFILE
all:
-debug:full \
-r:System.Web.dll
-VALID_PROFILE := $(filter 4.0, $(FRAMEWORK_VERSION))
+VALID_PROFILE := $(filter 4.5, $(FRAMEWORK_VERSION))
ifndef VALID_PROFILE
all:
[assembly: NeutralResourcesLanguage ("en-US")]
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../winfx.pub")]
[assembly: SecurityRules (SecurityRuleSet.Level1)]
LIBRARY = System.Windows.Forms.DataVisualization.dll
LIB_REFS = System System.Drawing System.Windows.Forms System.Core System.Data System.Xml
+KEYFILE = ../winfx.pub
LIB_MCS_FLAGS = -nowarn:67
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
<AssemblyName>System.Windows.Forms.DataVisualization</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../winfx.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: AllowPartiallyTrustedCallers]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile("../ecma.pub")]
[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
[assembly: CompilationRelaxations (CompilationRelaxations.NoStringInterning)]
LIBRARY = System.Windows.Forms.dll
LIB_REFS = System System.Xml System.Drawing Accessibility System.Data Mono.Posix Mono.WebBrowser System.Configuration System.Runtime.Serialization.Formatters.Soap
+KEYFILE = ../ecma.pub
LIB_MCS_FLAGS = /unsafe \
@System.Windows.Forms.dll.resources \
-nowarn:618,612,809
include ../../build/library.make
-TEST_HARNESS_EXCLUDES = -exclude=Interactive,NotWorking,ValueAdd,CAS,InetAccess
+TEST_HARNESS_EXCLUDES = -exclude=Interactive,NotWorking,CAS
TEST_HARNESS_EXCLUDES_ONDOTNET = -exclude=Interactive,NotDotNet,CAS
$(the_lib): $(RESOURCES)
<AssemblyName>System.Windows.Forms</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../ecma.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../msfinal.pub")]
LIBRARY = System.Windows.dll
LIB_REFS = System
+KEYFILE = ../msfinal.pub
LIB_MCS_FLAGS =
PLATFORM_DEBUG_FLAGS =
<AssemblyName>System.Windows</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>System.Workflow.Activities</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../winfx.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<AssemblyName>System.Workflow.ComponentModel</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../winfx.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<AssemblyName>System.Workflow.Runtime</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
<DelaySign>true</DelaySign>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../winfx.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<AssemblyName>System.Xml</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>System.Xml</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>System.Xaml</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>System.Xml.Linq</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../ecma.pub")]
LIBRARY = System.Xml.Serialization.dll
LIB_REFS = System.Xml System.ServiceModel
+KEYFILE = ../ecma.pub
LIB_MCS_FLAGS =
PLATFORM_DEBUG_FLAGS =
<AssemblyName>System.Xml.Serialization</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../ecma.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
GCHandle handle;
IntPtr context;
- IntPtr connectionId;
+
SslReadFunc readFunc;
SslWriteFunc writeFunc;
: base (parent, serverMode, targetHost, enabledProtocols,
serverCertificate, clientCertificates, askForClientCert)
{
- handle = GCHandle.Alloc (this);
- connectionId = GCHandle.ToIntPtr (handle);
+ handle = GCHandle.Alloc (this, GCHandleType.Weak);
readFunc = NativeReadCallback;
writeFunc = NativeWriteCallback;
var result = SSLSetIOFuncs (Handle, readFunc, writeFunc);
CheckStatusAndThrow (result);
- result = SSLSetConnection (Handle, connectionId);
+ result = SSLSetConnection (Handle, GCHandle.ToIntPtr (handle));
CheckStatusAndThrow (result);
if ((EnabledProtocols & SSA.SslProtocols.Tls) != 0)
[Mono.Util.MonoPInvokeCallback (typeof (SslReadFunc))]
static SslStatus NativeReadCallback (IntPtr ptr, IntPtr data, ref IntPtr dataLength)
{
- var handle = GCHandle.FromIntPtr (ptr);
- if (!handle.IsAllocated)
- return SslStatus.Internal;
+ AppleTlsContext context = null;
+ try {
+ var weakHandle = GCHandle.FromIntPtr (ptr);
+ if (!weakHandle.IsAllocated)
+ return SslStatus.Internal;
- var context = (AppleTlsContext) handle.Target;
- if (context.disposed)
- return SslStatus.ClosedAbort;
+ context = (AppleTlsContext) weakHandle.Target;
+ if (context == null || context.disposed)
+ return SslStatus.ClosedAbort;
- try {
return context.NativeReadCallback (data, ref dataLength);
} catch (Exception ex) {
- if (context.lastException == null)
+ if (context != null && context.lastException == null)
context.lastException = ex;
return SslStatus.Internal;
}
[Mono.Util.MonoPInvokeCallback (typeof (SslWriteFunc))]
static SslStatus NativeWriteCallback (IntPtr ptr, IntPtr data, ref IntPtr dataLength)
{
- var handle = GCHandle.FromIntPtr (ptr);
- if (!handle.IsAllocated)
- return SslStatus.Internal;
+ AppleTlsContext context = null;
+ try {
+ var weakHandle = GCHandle.FromIntPtr (ptr);
+ if (!weakHandle.IsAllocated)
+ return SslStatus.Internal;
- var context = (AppleTlsContext) handle.Target;
- if (context.disposed)
- return SslStatus.ClosedAbort;
+ context = (AppleTlsContext) weakHandle.Target;
+ if (context == null || context.disposed)
+ return SslStatus.ClosedAbort;
- try {
return context.NativeWriteCallback (data, ref dataLength);
} catch (Exception ex) {
- if (context.lastException == null)
+ if (context != null && context.lastException == null)
context.lastException = ex;
return SslStatus.Internal;
}
return PKCS8.PrivateKeyInfo.DecodeRSA (bytes);
}
set {
+ if (nativePrivateKey != null)
+ nativePrivateKey.Dispose ();
nativePrivateKey = null;
FallbackImpl.PrivateKey = value;
}
x509 = null;
}
if (nativePrivateKey != null) {
+ nativePrivateKey.Dispose ();
nativePrivateKey = null;
}
subjectName = null;
ChainValidationHelper.Create (provider, ref settings, this);
#else
+ status = WebExceptionStatus.SecureChannelFailure;
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
#endif
}
case 13882: /* ERROR_IPSEC_IKE_MM_LIMIT */ return "IPSEC IKE mm limit";
case 13883: /* ERROR_IPSEC_IKE_NEGOTIATION_DISABLED */ return "IPSEC IKE negotiation disabled";
case 13884: /* ERROR_IPSEC_IKE_NEG_STATUS_END */ return "IPSEC IKE neg status end";
+ case 100001: /* WSAENXIO */ return "Device not configured";
#endif // MOBILE
default:
return string.Format ("mono-io-layer-error ({0})", error);
<AssemblyName>System</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>System</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>System</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
#region DuplicateAndClose
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ static extern bool Duplicate_internal(IntPtr handle, int targetProcessId, out IntPtr duplicateHandle, out MonoIOError error);
+
[MonoLimitation ("We do not support passing sockets across processes, we merely allow this API to pass the socket across AppDomains")]
public SocketInformation DuplicateAndClose (int targetProcessId)
{
(is_blocking ? 0 : SocketInformationOptions.NonBlocking) |
(useOverlappedIO ? SocketInformationOptions.UseOnlyOverlappedIO : 0);
- MonoIOError error;
IntPtr duplicateHandle;
- if (!MonoIO.DuplicateHandle (System.Diagnostics.Process.GetCurrentProcess ().Handle, Handle, new IntPtr (targetProcessId), out duplicateHandle, 0, 0, 0x00000002 /* DUPLICATE_SAME_ACCESS */, out error))
+ if (!Duplicate_internal (Handle, targetProcessId, out duplicateHandle, out MonoIOError error))
throw MonoIO.GetException (error);
si.ProtocolInformation = Mono.DataConverter.Pack ("iiiil", (int)addressFamily, (int)socketType, (int)protocolType, is_bound ? 1 : 0, (long)duplicateHandle);
}
}
#else
+#pragma warning disable 618
ConfigurationSettings.GetConfig ("system.net/authenticationModules");
+#pragma warning restore 618
#endif
}
}
try {
IPAddress newAddress = IPAddress.Parse(h_addrlist[i]);
+#pragma warning disable 618
if( (Socket.SupportsIPv6 && newAddress.AddressFamily == AddressFamily.InterNetworkV6) ||
(Socket.SupportsIPv4 && newAddress.AddressFamily == AddressFamily.InterNetwork) )
addrlist.Add(newAddress);
+#pragma warning restore 618
} catch (ArgumentNullException) {
/* Ignore this, as the
* internal call might have
if (hostNameOrAddress.Length > 0 && IPAddress.TryParse (hostNameOrAddress, out addr))
return GetHostEntry (addr);
+#pragma warning disable 618
return GetHostByName (hostNameOrAddress);
+#pragma warning restore 618
}
public static IPHostEntry GetHostEntry (IPAddress address)
addr = IPAddress.Any;
else if (IPAddress.TryParse(host, out addr) == false){
try {
+#pragma warning disable 618
IPHostEntry iphost = Dns.GetHostByName(host);
+#pragma warning restore 618
if (iphost != null)
addr = iphost.AddressList[0];
else
internal FtpWebRequest (Uri uri)
{
this.requestUri = uri;
+#pragma warning disable 618
this.proxy = GlobalProxySelection.Select;
+#pragma warning restore 618
}
static Exception GetMustImplement ()
{
defaultMaxResponseHeadersLength = 64 * 1024;
#if !MOBILE
+#pragma warning disable 618
NetConfig config = ConfigurationSettings.GetConfig ("system.net/settings") as NetConfig;
+#pragma warning restore 618
if (config != null) {
int x = config.MaxResponseHeadersLength;
if (x != -1)
[Test]
[EnvironmentPermission (SecurityAction.Deny, Read = "USERNAME")]
- [Category ("InetAccess")]
public void AsyncRead ()
{
message = "AsyncRead";
[Test]
[EnvironmentPermission (SecurityAction.Deny, Read = "USERNAME")]
- [Category ("InetAccess")]
public void AsyncWrite ()
{
message = "AsyncWrite";
[Test]
[EnvironmentPermission (SecurityAction.Deny, Read = "USERNAME")]
- [Category ("InetAccess")]
public void AsyncAccept ()
{
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 16279);
[Test]
[EnvironmentPermission (SecurityAction.Deny, Read = "USERNAME")]
- [Category ("InetAccess")]
public void AsyncConnect ()
{
message = "AsyncConnect";
[Test]
[EnvironmentPermission (SecurityAction.Deny, Read = "USERNAME")]
- [Category ("InetAccess")]
public void AsyncReceive ()
{
message = "AsyncReceive";
[Test]
[EnvironmentPermission (SecurityAction.Deny, Read = "USERNAME")]
- [Category ("InetAccess")]
public void AsyncReceiveFrom ()
{
message = "AsyncReceiveFrom";
[Test]
[EnvironmentPermission (SecurityAction.Deny, Read = "USERNAME")]
- [Category ("InetAccess")]
public void AsyncSend ()
{
message = "AsyncSend";
[Test]
[EnvironmentPermission (SecurityAction.Deny, Read = "USERNAME")]
- [Category ("InetAccess")]
public void AsyncSendTo ()
{
message = "AsyncSendTo";
}
[Test]
- [Category ("InetAccess")]
+ [Category ("NotWorking")]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
}
// async tests (for stack propagation)
-/* Oops - not yet implemented in Mono
private void ConnectCallback (IAsyncResult ar)
{
TcpClient c = (TcpClient)ar.AsyncState;
[Test]
[EnvironmentPermission (SecurityAction.Deny, Read = "USERNAME")]
- [Category ("InetAccess")]
public void AsyncConnect_StringIntAsyncCallbackObject ()
{
TcpClient s = new TcpClient ();
[Test]
[EnvironmentPermission (SecurityAction.Deny, Read = "USERNAME")]
- [Category ("InetAccess")]
public void AsyncConnect_IPAddressIntAsyncCallbackObject ()
{
IPHostEntry host = Dns.Resolve ("www.google.com");
[Test]
[EnvironmentPermission (SecurityAction.Deny, Read = "USERNAME")]
- [Category ("InetAccess")]
public void AsyncConnect_IPAddressArrayIntAsyncCallbackObject ()
{
IPHostEntry host = Dns.Resolve ("www.google.com");
Assert.Ignore ("Timeout");
Assert.IsNull (message, message);
}
-*/
}
}
}
[Test]
- [Category("InetAccess")]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
}
[Test]
- //[Category("InetAccess")]
[Category ("NotWorking")] // Disabled until a server that meets requirements is found
public void Cookies1 ()
{
}\r
\r
[Test, ExpectedException (typeof (InvalidOperationException))]\r
- [Category ("InetAccess")]\r
+ [Category ("NotWorking")]\r
public void MaxServicePointManagers ()\r
{\r
Assert.AreEqual (0, ServicePointManager.MaxServicePoints, "#1");\r
-//\r
-// ServicePointTest.cs - NUnit Test Cases for System.Net.ServicePoint\r
-//\r
-// Authors:\r
-// Lawrence Pit (loz@cable.a2000.nl)\r
-// Martin Willemoes Hansen (mwh@sysrq.dk)\r
-//\r
-// (C) 2003 Martin Willemoes Hansen\r
-//\r
-\r
-using NUnit.Framework;\r
-using System;\r
-using System.Collections;\r
-using System.IO;\r
-using System.Net;\r
-using System.Reflection;\r
-using System.Threading;\r
-\r
-namespace MonoTests.System.Net\r
-{\r
-\r
-[TestFixture]\r
-public class ServicePointTest\r
-{\r
- static private int max;\r
-\r
-#if !FEATURE_NO_BSD_SOCKETS\r
- [SetUp]\r
- public void SaveMax () {\r
- max = ServicePointManager.MaxServicePoints;\r
- ServicePointManager.MaxServicePoints = 0;\r
- }\r
-\r
- [TearDown]\r
- public void RestoreMax () {\r
- ServicePointManager.MaxServicePoints = max;\r
- }\r
-#endif\r
-\r
- [Test]\r
- [Category ("InetAccess")]\r
- public void All ()\r
- {\r
- ServicePoint p = ServicePointManager.FindServicePoint (new Uri ("mailto:xx@yyy.com"));\r
- //WriteServicePoint ("A servicepoint that isn't really", p); \r
- \r
- ServicePointManager.MaxServicePoints = 2;\r
- ServicePoint google = ServicePointManager.FindServicePoint (new Uri ("http://www.google.com"));\r
- try { \r
- ServicePoint slashdot = ServicePointManager.FindServicePoint (new Uri ("http://www.slashdot.org"));\r
- Assert.Fail ("#1");\r
- } catch (InvalidOperationException) { }\r
- ServicePointManager.MaxServicePoints = 0;\r
- \r
- //WriteServicePoint ("google before getting a webrequest", google);\r
- \r
- HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://www.google.com");\r
- HttpWebResponse res = (HttpWebResponse) req.GetResponse (); \r
- \r
-#if FOUND_SOME_OTHER_URL\r
- // URL is no longer found, disabled the test until a more reliable URL is found :P\r
- //WriteServicePoint ("google after getting a response", google);\r
- ServicePoint google2 = ServicePointManager.FindServicePoint (new Uri ("http://www.google.com/dilbert.html"));\r
- Assert.AreEqual (google, google2, "#equals");\r
- res.Close ();\r
-#endif\r
- \r
- // in both instances property CurrentConnections is 0 according to ms.net.\r
- // let's see what it says when we do async operations...\r
- \r
- HttpWebRequest req2 = (HttpWebRequest) WebRequest.Create ("http://www.google.com");\r
- req2.Method = "PUT";\r
- IAsyncResult async = req2.BeginGetRequestStream (null, null);\r
- //WriteServicePoint ("after async BeginGetRequestStream", google);\r
- // CurrentConnections: 1\r
- Stream stream2 = req2.EndGetRequestStream (async);\r
- //WriteServicePoint ("after async EndGetRequestStream", google);\r
- // CurrentConnections: 1\r
- stream2.Close ();\r
- \r
- req2 = (HttpWebRequest) WebRequest.Create ("http://www.google.com");\r
- async = req2.BeginGetResponse (null, null);\r
- //WriteServicePoint ("after async BeginGetResponse", google);\r
- // CurrentConnections: 2\r
- WebResponse res2 = req2.EndGetResponse (async);\r
- //WriteServicePoint ("after async EndGetResponse", google);\r
- // CurrentConnections: 0 \r
- // curious that after you get the webresponse object CurrentConnections is set to 0.\r
- // you'd think that you'd still be connected until you close the webresponse..\r
- //Console.WriteLine ("ContentLength: " + res2.ContentLength);\r
- res2.Close ();\r
- \r
- ServicePoint sp2;\r
-#if FOUND_SOME_OTHER_URL\r
- // unless of course some buffering is taking place.. let's check\r
- Uri uri2 = new Uri ("http://freedesktop.org/Software/pkgconfig/releases/pkgconfig-0.15.0.tar.gz");\r
- sp2 = ServicePointManager.FindServicePoint (uri2);\r
- req2 = (HttpWebRequest) WebRequest.Create (uri2);\r
- async = req2.BeginGetResponse (null, null);\r
- //WriteServicePoint ("Large file: after async BeginGetResponse", sp2);\r
- // CurrentConnections: 1\r
- res2 = req2.EndGetResponse (async);\r
- //WriteServicePoint ("Large file: after async EndGetResponse", sp2);\r
- // CurrentConnections: 1\r
- // and so it shows\r
- //Console.WriteLine ("ContentLength: " + res2.ContentLength);\r
- res2.Close ();\r
-#endif\r
- \r
- \r
- // what's the limit of the cache?\r
- req2 = (HttpWebRequest) WebRequest.Create ("http://www.apache.org/");\r
- res2 = req2.GetResponse ();\r
- sp2 = ServicePointManager.FindServicePoint (new Uri("http://www.apache.org/"));\r
- //WriteServicePoint ("apache", sp2);\r
- //Console.WriteLine ("ContentLength: " + res2.ContentLength);\r
- // CurrentConnections: 1\r
- res2.Close ();\r
- // curious other effect: address is actually the full Uri of the previous request\r
- // anyways, buffer is probably 4096 bytes\r
- }\r
-\r
- // try getting the stream to 5 web response objects \r
- // while ConnectionLimit equals 2\r
-\r
- [Test]\r
- [Category ("InetAccess")]\r
- public void ConnectionLimit ()\r
- { \r
- // the default is already 2, just in case it isn't..\r
- ServicePointManager.DefaultConnectionLimit = 5;\r
- \r
- Uri uri = new Uri ("http://www.go-mono.com/");\r
- ServicePoint sp = ServicePointManager.FindServicePoint (uri); \r
- WebResponse [] res = new WebResponse [5];\r
- for (int i = 0; i < 5; i++) {\r
- //Console.WriteLine ("GOT1 : " + i);\r
- HttpWebRequest req = (HttpWebRequest) WebRequest.Create (uri);\r
- //Console.WriteLine ("GOT2 : " + i);\r
- res [i] = req.GetResponse ();\r
- //WriteServicePoint ("after getting " + (i + 1) + " web response objects", sp);\r
- }\r
- \r
- for (int i = 0; i < 5; i++) {\r
- Stream stream = res [i].GetResponseStream();\r
- //Console.WriteLine ("Reading stream: " + i + " : " + stream);\r
- int len = 0;\r
- while (stream.ReadByte () != -1)\r
- len++;\r
- //Console.WriteLine ("Finished reading: " + len + " bytes");\r
- }\r
- \r
- for (int i = 0; i < 5; i++) {\r
- res [i].Close ();\r
- }\r
- }\r
-\r
- [Test]\r
- [Category ("InetAccess")]\r
- [Category ("AndroidNotWorking")] // #A1 fails\r
- public void EndPointBind ()\r
- {\r
- Uri uri = new Uri ("http://www.go-mono.com/");\r
- ServicePoint sp = ServicePointManager.FindServicePoint (uri);\r
-\r
- HttpWebRequest req = (HttpWebRequest) WebRequest.Create (uri);\r
-\r
- bool called = false;\r
- sp.BindIPEndPointDelegate = delegate {\r
- Assert.IsTrue (!called);\r
- called = true;\r
- return null;\r
- };\r
- req.GetResponse ().Close ();\r
-\r
- Assert.IsTrue (called, "#A1");\r
-\r
- req = (HttpWebRequest) WebRequest.Create (uri);\r
- called = false;\r
- sp.BindIPEndPointDelegate = delegate(ServicePoint point, IPEndPoint remote, int times) {\r
- Assert.IsTrue (times < 5);\r
- called = true;\r
- return new IPEndPoint(IPAddress.Parse("0.0.0.0"), 12345 + times);\r
- };\r
- req.GetResponse ().Close ();\r
-\r
- Assert.IsTrue (called, "#A2");\r
- }\r
-\r
- public static void GetRequestStreamCallback (IAsyncResult asynchronousResult)\r
- {\r
- }\r
-\r
- [Test] //Covers #19823\r
-#if FEATURE_NO_BSD_SOCKETS\r
- // This test uses HttpWebRequest\r
- [ExpectedException (typeof (PlatformNotSupportedException))]\r
-#endif\r
- public void CloseConnectionGroupConcurency ()\r
- {\r
- // Try with multiple service points\r
- for (var i = 0; i < 10; i++) {\r
- Uri targetUri = new Uri ("http://" + i + ".mono-project.com");\r
- var req = (HttpWebRequest) HttpWebRequest.Create (targetUri);\r
- req.ContentType = "application/x-www-form-urlencoded";\r
- req.Method = "POST";\r
- req.ConnectionGroupName = "" + i;\r
- req.ServicePoint.MaxIdleTime = 1;\r
-\r
- req.BeginGetRequestStream (new AsyncCallback (GetRequestStreamCallback), req);\r
- Thread.Sleep (1);\r
- req.ServicePoint.CloseConnectionGroup (req.ConnectionGroupName);\r
- }\r
- }\r
-\r
-\r
- [Test]\r
- [Category ("RequiresBSDSockets")] // Tests internals, so it doesn't make sense to assert that PlatformNotSupportedExceptions are thrown.\r
- public void DnsRefreshTimeout ()\r
- {\r
- const int dnsRefreshTimeout = 2000;\r
-\r
- ServicePoint sp;\r
- IPHostEntry host0, host1, host2;\r
- Uri uri;\r
- PropertyInfo hostEntryProperty;\r
-\r
- ServicePointManager.DnsRefreshTimeout = dnsRefreshTimeout;\r
-\r
- uri = new Uri ("http://localhost/");\r
- sp = ServicePointManager.FindServicePoint (uri);\r
-\r
- hostEntryProperty = typeof (ServicePoint).GetProperty ("HostEntry", BindingFlags.NonPublic | BindingFlags.Instance);\r
-\r
- host0 = hostEntryProperty.GetValue (sp, null) as IPHostEntry;\r
- host1 = hostEntryProperty.GetValue (sp, null) as IPHostEntry;\r
-\r
- Assert.AreSame (host0, host1, "HostEntry should result in the same IPHostEntry object.");\r
-\r
- Thread.Sleep (dnsRefreshTimeout * 2);\r
- host2 = hostEntryProperty.GetValue (sp, null) as IPHostEntry;\r
-\r
- Assert.AreNotSame(host0, host2, "HostEntry should result in a new IPHostEntry " +\r
- "object when DnsRefreshTimeout is reached.");\r
- }\r
-\r
-// Debug code not used now, but could be useful later\r
-/*\r
- private void WriteServicePoint (string label, ServicePoint sp)\r
- {\r
- Console.WriteLine ("\n" + label);\r
- Console.WriteLine ("Address: " + sp.Address);\r
- Console.WriteLine ("ConnectionLimit: " + sp.ConnectionLimit);\r
- Console.WriteLine ("ConnectionName: " + sp.ConnectionName);\r
- Console.WriteLine ("CurrentConnections: " + sp.CurrentConnections);\r
- Console.WriteLine ("IdleSince: " + sp.IdleSince);\r
- Console.WriteLine ("MaxIdletime: " + sp.MaxIdleTime);\r
- Console.WriteLine ("ProtocolVersion: " + sp.ProtocolVersion);\r
- Console.WriteLine ("SupportsPipelining: " + sp.SupportsPipelining); \r
- }\r
-*/\r
-}\r
-}\r
-\r
+//
+// ServicePointTest.cs - NUnit Test Cases for System.Net.ServicePoint
+//
+// Authors:
+// Lawrence Pit (loz@cable.a2000.nl)
+// Martin Willemoes Hansen (mwh@sysrq.dk)
+//
+// (C) 2003 Martin Willemoes Hansen
+//
+
+using NUnit.Framework;
+using System;
+using System.Collections;
+using System.IO;
+using System.Net;
+using System.Reflection;
+using System.Threading;
+
+namespace MonoTests.System.Net
+{
+
+[TestFixture]
+public class ServicePointTest
+{
+ static private int max;
+
+#if !FEATURE_NO_BSD_SOCKETS
+ [SetUp]
+ public void SaveMax () {
+ max = ServicePointManager.MaxServicePoints;
+ ServicePointManager.MaxServicePoints = 0;
+ }
+
+ [TearDown]
+ public void RestoreMax () {
+ ServicePointManager.MaxServicePoints = max;
+ }
+#endif
+
+ [Test]
+ [Category ("NotWorking")]
+ public void All ()
+ {
+ ServicePoint p = ServicePointManager.FindServicePoint (new Uri ("mailto:xx@yyy.com"));
+ //WriteServicePoint ("A servicepoint that isn't really", p);
+
+ ServicePointManager.MaxServicePoints = 2;
+ ServicePoint google = ServicePointManager.FindServicePoint (new Uri ("http://www.google.com"));
+ try {
+ ServicePoint slashdot = ServicePointManager.FindServicePoint (new Uri ("http://www.slashdot.org"));
+ Assert.Fail ("#1");
+ } catch (InvalidOperationException) { }
+ ServicePointManager.MaxServicePoints = 0;
+
+ //WriteServicePoint ("google before getting a webrequest", google);
+
+ HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://www.google.com");
+ HttpWebResponse res = (HttpWebResponse) req.GetResponse ();
+
+#if FOUND_SOME_OTHER_URL
+ // URL is no longer found, disabled the test until a more reliable URL is found :P
+ //WriteServicePoint ("google after getting a response", google);
+ ServicePoint google2 = ServicePointManager.FindServicePoint (new Uri ("http://www.google.com/dilbert.html"));
+ Assert.AreEqual (google, google2, "#equals");
+ res.Close ();
+#endif
+
+ // in both instances property CurrentConnections is 0 according to ms.net.
+ // let's see what it says when we do async operations...
+
+ HttpWebRequest req2 = (HttpWebRequest) WebRequest.Create ("http://www.google.com");
+ req2.Method = "PUT";
+ IAsyncResult async = req2.BeginGetRequestStream (null, null);
+ //WriteServicePoint ("after async BeginGetRequestStream", google);
+ // CurrentConnections: 1
+ Stream stream2 = req2.EndGetRequestStream (async);
+ //WriteServicePoint ("after async EndGetRequestStream", google);
+ // CurrentConnections: 1
+ stream2.Close ();
+
+ req2 = (HttpWebRequest) WebRequest.Create ("http://www.google.com");
+ async = req2.BeginGetResponse (null, null);
+ //WriteServicePoint ("after async BeginGetResponse", google);
+ // CurrentConnections: 2
+ WebResponse res2 = req2.EndGetResponse (async);
+ //WriteServicePoint ("after async EndGetResponse", google);
+ // CurrentConnections: 0
+ // curious that after you get the webresponse object CurrentConnections is set to 0.
+ // you'd think that you'd still be connected until you close the webresponse..
+ //Console.WriteLine ("ContentLength: " + res2.ContentLength);
+ res2.Close ();
+
+ ServicePoint sp2;
+#if FOUND_SOME_OTHER_URL
+ // unless of course some buffering is taking place.. let's check
+ Uri uri2 = new Uri ("http://freedesktop.org/Software/pkgconfig/releases/pkgconfig-0.15.0.tar.gz");
+ sp2 = ServicePointManager.FindServicePoint (uri2);
+ req2 = (HttpWebRequest) WebRequest.Create (uri2);
+ async = req2.BeginGetResponse (null, null);
+ //WriteServicePoint ("Large file: after async BeginGetResponse", sp2);
+ // CurrentConnections: 1
+ res2 = req2.EndGetResponse (async);
+ //WriteServicePoint ("Large file: after async EndGetResponse", sp2);
+ // CurrentConnections: 1
+ // and so it shows
+ //Console.WriteLine ("ContentLength: " + res2.ContentLength);
+ res2.Close ();
+#endif
+
+
+ // what's the limit of the cache?
+ req2 = (HttpWebRequest) WebRequest.Create ("http://www.apache.org/");
+ res2 = req2.GetResponse ();
+ sp2 = ServicePointManager.FindServicePoint (new Uri("http://www.apache.org/"));
+ //WriteServicePoint ("apache", sp2);
+ //Console.WriteLine ("ContentLength: " + res2.ContentLength);
+ // CurrentConnections: 1
+ res2.Close ();
+ // curious other effect: address is actually the full Uri of the previous request
+ // anyways, buffer is probably 4096 bytes
+ }
+
+ // try getting the stream to 5 web response objects
+ // while ConnectionLimit equals 2
+
+ [Test]
+ [Category ("NotWorking")]
+ public void ConnectionLimit ()
+ {
+ // the default is already 2, just in case it isn't..
+ ServicePointManager.DefaultConnectionLimit = 5;
+
+ Uri uri = new Uri ("http://www.go-mono.com/");
+ ServicePoint sp = ServicePointManager.FindServicePoint (uri);
+ WebResponse [] res = new WebResponse [5];
+ for (int i = 0; i < 5; i++) {
+ //Console.WriteLine ("GOT1 : " + i);
+ HttpWebRequest req = (HttpWebRequest) WebRequest.Create (uri);
+ //Console.WriteLine ("GOT2 : " + i);
+ res [i] = req.GetResponse ();
+ //WriteServicePoint ("after getting " + (i + 1) + " web response objects", sp);
+ }
+
+ for (int i = 0; i < 5; i++) {
+ Stream stream = res [i].GetResponseStream();
+ //Console.WriteLine ("Reading stream: " + i + " : " + stream);
+ int len = 0;
+ while (stream.ReadByte () != -1)
+ len++;
+ //Console.WriteLine ("Finished reading: " + len + " bytes");
+ }
+
+ for (int i = 0; i < 5; i++) {
+ res [i].Close ();
+ }
+ }
+
+ [Test]
+ [Category ("NotWorking")] // #A1 fails
+ public void EndPointBind ()
+ {
+ Uri uri = new Uri ("http://www.go-mono.com/");
+ ServicePoint sp = ServicePointManager.FindServicePoint (uri);
+
+ HttpWebRequest req = (HttpWebRequest) WebRequest.Create (uri);
+
+ bool called = false;
+ sp.BindIPEndPointDelegate = delegate {
+ Assert.IsTrue (!called);
+ called = true;
+ return null;
+ };
+ req.GetResponse ().Close ();
+
+ Assert.IsTrue (called, "#A1");
+
+ req = (HttpWebRequest) WebRequest.Create (uri);
+ called = false;
+ sp.BindIPEndPointDelegate = delegate(ServicePoint point, IPEndPoint remote, int times) {
+ Assert.IsTrue (times < 5);
+ called = true;
+ return new IPEndPoint(IPAddress.Parse("0.0.0.0"), 12345 + times);
+ };
+ req.GetResponse ().Close ();
+
+ Assert.IsTrue (called, "#A2");
+ }
+
+ public static void GetRequestStreamCallback (IAsyncResult asynchronousResult)
+ {
+ }
+
+ [Test] //Covers #19823
+#if FEATURE_NO_BSD_SOCKETS
+ // This test uses HttpWebRequest
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
+ public void CloseConnectionGroupConcurency ()
+ {
+ // Try with multiple service points
+ for (var i = 0; i < 10; i++) {
+ Uri targetUri = new Uri ("http://" + i + ".mono-project.com");
+ var req = (HttpWebRequest) HttpWebRequest.Create (targetUri);
+ req.ContentType = "application/x-www-form-urlencoded";
+ req.Method = "POST";
+ req.ConnectionGroupName = "" + i;
+ req.ServicePoint.MaxIdleTime = 1;
+
+ req.BeginGetRequestStream (new AsyncCallback (GetRequestStreamCallback), req);
+ Thread.Sleep (1);
+ req.ServicePoint.CloseConnectionGroup (req.ConnectionGroupName);
+ }
+ }
+
+
+ [Test]
+ [Category ("RequiresBSDSockets")] // Tests internals, so it doesn't make sense to assert that PlatformNotSupportedExceptions are thrown.
+ public void DnsRefreshTimeout ()
+ {
+ const int dnsRefreshTimeout = 2000;
+
+ ServicePoint sp;
+ IPHostEntry host0, host1, host2;
+ Uri uri;
+ PropertyInfo hostEntryProperty;
+
+ ServicePointManager.DnsRefreshTimeout = dnsRefreshTimeout;
+
+ uri = new Uri ("http://localhost/");
+ sp = ServicePointManager.FindServicePoint (uri);
+
+ hostEntryProperty = typeof (ServicePoint).GetProperty ("HostEntry", BindingFlags.NonPublic | BindingFlags.Instance);
+
+ host0 = hostEntryProperty.GetValue (sp, null) as IPHostEntry;
+ host1 = hostEntryProperty.GetValue (sp, null) as IPHostEntry;
+
+ Assert.AreSame (host0, host1, "HostEntry should result in the same IPHostEntry object.");
+
+ Thread.Sleep (dnsRefreshTimeout * 2);
+ host2 = hostEntryProperty.GetValue (sp, null) as IPHostEntry;
+
+ Assert.AreNotSame(host0, host2, "HostEntry should result in a new IPHostEntry " +
+ "object when DnsRefreshTimeout is reached.");
+ }
+
+// Debug code not used now, but could be useful later
+/*
+ private void WriteServicePoint (string label, ServicePoint sp)
+ {
+ Console.WriteLine ("\n" + label);
+ Console.WriteLine ("Address: " + sp.Address);
+ Console.WriteLine ("ConnectionLimit: " + sp.ConnectionLimit);
+ Console.WriteLine ("ConnectionName: " + sp.ConnectionName);
+ Console.WriteLine ("CurrentConnections: " + sp.CurrentConnections);
+ Console.WriteLine ("IdleSince: " + sp.IdleSince);
+ Console.WriteLine ("MaxIdletime: " + sp.MaxIdleTime);
+ Console.WriteLine ("ProtocolVersion: " + sp.ProtocolVersion);
+ Console.WriteLine ("SupportsPipelining: " + sp.SupportsPipelining);
+ }
+*/
+}
+}
+
}
[Test]
- [Category ("InetAccess")]
public void DownloadTwice ()
{
WebClient wc = new WebClient();
}
[Test]
- [Category("InetAccess")]
public void DownloadFileTaskAsync ()
{
WebClient wc = new WebClient ();
}
[Test]
- [Category("InetAccess")]
- [Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
+ [Category ("NotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
public void Cancellation ()
{
WebClient wc = new WebClient ();
}
[Test]
- [Category("InetAccess")]
- [Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
+ [Category ("NotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
public void DownloadMultiple ()
{
WebClient wc = new WebClient ();
}
[Test]
- [Category("InetAccess")]
- [Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
+ [Category ("NotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
public void DownloadMultiple2 ()
{
WebClient wc = new WebClient ();
}
[Test]
- [Category("InetAccess")]
- [Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
+ [Category ("NotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
public void DownloadMultiple3 ()
{
WebClient wc = new WebClient ();
}
[Test]
- [Category ("InetAccess")]
public void Build_Cert1_X509RevocationMode_Online ()
{
X509Chain c = new X509Chain ();
[assembly: AssemblyCopyright("(c) 2003 Various Authors")]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../winfx.pub")]
LIBRARY = SystemWebTestShim.dll
LIB_REFS = System.Web System
+KEYFILE = ../winfx.pub
LIB_MCS_FLAGS =
NO_INSTALL = yes
<AssemblyName>SystemWebTestShim</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../winfx.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: AssemblyVersion (Consts.FxVersion)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../mono.pub")]
LIBRARY = WebMatrix.Data.dll
LIB_REFS = System System.Data System.Core System.Configuration
+KEYFILE = ../mono.pub
LIB_MCS_FLAGS =
TEST_MCS_FLAGS =
TEST_LIB_REFS = System System.Core System.Data Mono.Data.Sqlite Microsoft.CSharp
<AssemblyName>WebMatrix.Data</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../mono.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
[assembly: NeutralResourcesLanguage ("en")]
[assembly: CLSCompliant (true)]
[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../winfx3.pub")]
[assembly: ComVisible (false)]
[assembly: AllowPartiallyTrustedCallers]
LIBRARY = WindowsBase.dll
LIB_REFS = System System.Xml
+KEYFILE = ../winfx3.pub
LIB_MCS_FLAGS = -unsafe -nowarn:67,618
TEST_MCS_FLAGS = -unsafe
TEST_LIB_REFS = WindowsBase System System.Xml System.Core System.IO.Compression
-ifeq (2.0, $(FRAMEWORK_VERSION))
-LIB_MCS_FLAGS += -d:NET_3_0
-endif
ifeq (4, $(FRAMEWORK_VERSION_MAJOR))
LIB_REFS += System.Xaml
TEST_LIB_REFS += System.Xaml
//
using System;
+using System.Diagnostics;
+using System.Globalization;
using System.Windows.Markup;
namespace System.Windows.Converters {
{
public override bool CanConvertFromString (string value, IValueSerializerContext context)
{
- throw new NotImplementedException ();
+ return true;
}
public override bool CanConvertToString (object value, IValueSerializerContext context)
{
- throw new NotImplementedException ();
+ return value is Size;
}
public override object ConvertFromString (string value, IValueSerializerContext context)
{
- throw new NotImplementedException ();
+ if (value == null)
+ throw new ArgumentNullException ("value");
+ return Size.Parse (value);
}
public override string ConvertToString (object value, IValueSerializerContext context)
{
- throw new NotImplementedException ();
+ if (value is Size size)
+ return size.ToString (CultureInfo.InvariantCulture);
+ return base.ConvertToString (value, context);
}
}
//
using System;
+using System.Globalization;
using System.Windows.Markup;
namespace System.Windows.Media.Converters {
{
public override bool CanConvertFromString (string value, IValueSerializerContext context)
{
- throw new NotImplementedException ();
+ return true;
}
public override bool CanConvertToString (object value, IValueSerializerContext context)
{
- throw new NotImplementedException ();
+ return value is Matrix;
}
public override object ConvertFromString (string value, IValueSerializerContext context)
{
- throw new NotImplementedException ();
+ if (value == null)
+ throw new NotSupportedException ("value != null");
+ return Matrix.Parse (value);
}
public override string ConvertToString (object value, IValueSerializerContext context)
{
- throw new NotImplementedException ();
+ if (value is Matrix matrix)
+ return matrix.ToString (CultureInfo.InvariantCulture);
+ return base.ConvertToString (value, context);
}
}
using System;
using System.ComponentModel;
+using System.Globalization;
using System.Windows.Markup;
using System.Windows.Media.Converters;
using System.Windows.Threading;
public override int GetHashCode ()
{
- throw new NotImplementedException ();
+ unchecked
+ {
+ var hashCode = _m11.GetHashCode ();
+ hashCode = (hashCode * 397) ^ _m12.GetHashCode ();
+ hashCode = (hashCode * 397) ^ _m21.GetHashCode ();
+ hashCode = (hashCode * 397) ^ _m22.GetHashCode ();
+ hashCode = (hashCode * 397) ^ _offsetX.GetHashCode ();
+ hashCode = (hashCode * 397) ^ _offsetY.GetHashCode ();
+ return hashCode;
+ }
}
public void Invert ()
public static Matrix Parse (string source)
{
- throw new NotImplementedException ();
+ if (source == null)
+ throw new ArgumentNullException ("source");
+ Matrix value;
+ if (source.Trim () == "Identity")
+ {
+ value = Identity;
+ }
+ else
+ {
+ var parts = source.Split (',');
+ if (parts.Length != 6)
+ throw new FormatException (string.Format ("Invalid Matrix format: {0}", source));
+ double m11;
+ double m12;
+ double m21;
+ double m22;
+ double offsetX;
+ double offsetY;
+ if (double.TryParse (parts[0], NumberStyles.Float, CultureInfo.InvariantCulture, out m11)
+ && double.TryParse (parts[1], NumberStyles.Float, CultureInfo.InvariantCulture, out m12)
+ && double.TryParse (parts[2], NumberStyles.Float, CultureInfo.InvariantCulture, out m21)
+ && double.TryParse (parts[3], NumberStyles.Float, CultureInfo.InvariantCulture, out m22)
+ && double.TryParse (parts[4], NumberStyles.Float, CultureInfo.InvariantCulture, out offsetX)
+ && double.TryParse (parts[5], NumberStyles.Float, CultureInfo.InvariantCulture, out offsetY))
+ {
+ value = new Matrix (m11, m12, m21, m22, offsetX, offsetY);
+ }
+ else
+ {
+ throw new FormatException (string.Format ("Invalid Matrix format: {0}", source));
+ }
+ }
+ return value;
}
public void Prepend (Matrix matrix)
string IFormattable.ToString (string format,
IFormatProvider provider)
{
- throw new NotImplementedException ();
+ return ToString (provider);
}
public override string ToString ()
{
- if (IsIdentity)
- return "Identity";
- else
- return string.Format ("{0},{1},{2},{3},{4},{5}",
- _m11, _m12, _m21, _m22, _offsetX, _offsetY);
+ return ToString (null);
}
public string ToString (IFormatProvider provider)
{
- throw new NotImplementedException ();
+ return IsIdentity
+ ? "Identity"
+ : string.Concat (_m11, ",", _m12, ",", _m21, ",", _m22, ",", _offsetX, ",", _offsetY);
}
public Point Transform (Point point)
{
public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType)
{
- throw new NotImplementedException ();
+ return sourceType == typeof (string);
}
public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType)
{
- throw new NotImplementedException ();
+ return destinationType == typeof (string);
}
public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value)
{
- throw new NotImplementedException ();
+ if (!(value is string))
+ throw new NotSupportedException ("MatrixConverter only supports converting from strings");
+ return Matrix.Parse ((string)value);
}
public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
- throw new NotImplementedException ();
+ return ((Matrix)value).ToString (culture);
}
}
using System;
using System.ComponentModel;
+using System.Globalization;
using System.Windows.Converters;
using System.Windows.Markup;
public override int GetHashCode ()
{
- throw new NotImplementedException ();
+ unchecked
+ {
+ return (_width.GetHashCode () * 397) ^ _height.GetHashCode ();
+ }
}
public static Size Parse (string source)
{
- throw new NotImplementedException ();
+ if (source == null)
+ throw new ArgumentNullException ("source");
+ Size value;
+ if (source.Trim () == "Empty")
+ {
+ value = Empty;
+ }
+ else
+ {
+ var parts = source.Split (',');
+ if (parts.Length != 2)
+ throw new FormatException (string.Format ("Invalid Size format: {0}", source));
+ double width;
+ double height;
+ if (double.TryParse (parts[0], NumberStyles.Float, CultureInfo.InvariantCulture, out width)
+ && double.TryParse (parts[1], NumberStyles.Float, CultureInfo.InvariantCulture, out height))
+ {
+ value = new Size (width, height);
+ }
+ else
+ {
+ throw new FormatException (string.Format ("Invalid Size format: {0}", source));
+ }
+ }
+ return value;
}
public override string ToString ()
{
- if (IsEmpty)
- return "Empty";
- return String.Format ("{0},{1}", _width, _height);
+ return ConvertToString (null);
}
public string ToString (IFormatProvider provider)
{
- throw new NotImplementedException ();
+ return ConvertToString (provider);
}
string IFormattable.ToString (string format, IFormatProvider provider)
{
- throw new NotImplementedException ();
+ return ConvertToString (provider);
+ }
+
+ private string ConvertToString (IFormatProvider provider)
+ {
+ return IsEmpty ? "Empty" : string.Concat (_width, ",", _height);
}
public bool IsEmpty {
--- /dev/null
+using NUnit.Framework;
+using System;
+using System.Windows.Media;
+
+namespace MonoTests.System.Windows.Media {
+
+ [TestFixture]
+ public class MatrixConverterTest {
+ const double DELTA = 0.000000001d;
+
+ void CheckMatrix (Matrix expected, Matrix actual)
+ {
+ Assert.AreEqual (expected.M11, actual.M11, DELTA);
+ Assert.AreEqual (expected.M12, actual.M12, DELTA);
+ Assert.AreEqual (expected.M21, actual.M21, DELTA);
+ Assert.AreEqual (expected.M22, actual.M22, DELTA);
+ Assert.AreEqual (expected.OffsetX, actual.OffsetX, DELTA);
+ Assert.AreEqual (expected.OffsetY, actual.OffsetY, DELTA);
+ }
+
+ [Test]
+ public void CanConvertFrom ()
+ {
+ var conv = new MatrixConverter ();
+ Assert.IsTrue (conv.CanConvertFrom (typeof (string)));
+ Assert.IsFalse (conv.CanConvertFrom (typeof (Matrix)));
+ }
+
+ [Test]
+ public void CanConvertTo ()
+ {
+ var conv = new MatrixConverter ();
+ Assert.IsTrue (conv.CanConvertTo (typeof (string)));
+ Assert.IsFalse (conv.CanConvertTo (typeof (Matrix)));
+ }
+
+ [Test]
+ public void ConvertFrom ()
+ {
+ var conv = new MatrixConverter ();
+ object obj = conv.ConvertFrom ("1, 2, 3, 4, 5, 6");
+ Assert.AreEqual (typeof (Matrix), obj.GetType ());
+ CheckMatrix (new Matrix (1, 2, 3, 4, 5, 6), (Matrix)obj);
+ }
+
+ [Test]
+ [ExpectedException (typeof (NotSupportedException))]
+ public void ConvertFromInvalidType ()
+ {
+ var conv = new MatrixConverter ();
+ conv.ConvertFrom (new Matrix (10, 20, 30, 40, 50, 60));
+ }
+
+ [Test]
+ public void ConvertTo ()
+ {
+ var conv = new MatrixConverter ();
+ var matrix = new Matrix (1, 2, 3, 4, 5, 6);
+ object obj = conv.ConvertTo (matrix, typeof (string));
+ Assert.AreEqual (typeof (string), obj.GetType ());
+ Assert.AreEqual ("1,2,3,4,5,6", (string)obj);
+ }
+ }
+}
\ No newline at end of file
}
[Test]
- [Category ("NotWorking")]
public void Parse ()
{
CheckMatrix (Matrix.Identity, Matrix.Parse ("Identity"));
--- /dev/null
+using NUnit.Framework;
+using System;
+using System.Windows.Media.Converters;
+using System.Windows.Media;
+
+namespace MonoTests.System.Windows.Media {
+
+ [TestFixture]
+ public class MatrixValueSerializerTest {
+ const double DELTA = 0.000000001d;
+
+ void CheckMatrix (Matrix expected, Matrix actual)
+ {
+ Assert.AreEqual (expected.M11, actual.M11, DELTA);
+ Assert.AreEqual (expected.M12, actual.M12, DELTA);
+ Assert.AreEqual (expected.M21, actual.M21, DELTA);
+ Assert.AreEqual (expected.M22, actual.M22, DELTA);
+ Assert.AreEqual (expected.OffsetX, actual.OffsetX, DELTA);
+ Assert.AreEqual (expected.OffsetY, actual.OffsetY, DELTA);
+ }
+
+ [Test]
+ public void CanConvertFromString ()
+ {
+ var serializer = new MatrixValueSerializer ();
+ Assert.IsTrue (serializer.CanConvertFromString ("", null));
+ }
+
+ [Test]
+ public void CanConvertToString ()
+ {
+ var serializer = new MatrixValueSerializer ();
+ Assert.IsTrue (serializer.CanConvertToString (new Matrix (1, 2, 3, 4, 5 ,6), null));
+ Assert.IsFalse (serializer.CanConvertToString ("", null));
+ }
+
+ [Test]
+ public void ConvertFromString ()
+ {
+ var serializer = new MatrixValueSerializer ();
+ object obj = serializer.ConvertFromString ("1, 2, 3, 4, 5 ,6", null);
+ Assert.AreEqual (typeof (Matrix), obj.GetType ());
+ CheckMatrix (new Matrix (1, 2, 3, 4, 5, 6), (Matrix)obj);
+ }
+
+ [Test]
+ public void RoundTripConvert()
+ {
+ var serializer = new MatrixValueSerializer ();
+ var matrix = new Matrix (1.1, 2.2, 3.3, 4.4, 5.5, 6.6);
+ var obj = serializer.ConvertFromString (serializer.ConvertToString (matrix, null), null);
+ CheckMatrix (matrix, (Matrix)obj);
+ }
+
+ [Test]
+ [ExpectedException (typeof (FormatException))]
+ public void ConvertFromStringShouldThrowExceptionWhenStringHasInvalidFormat ()
+ {
+ var serializer = new MatrixValueSerializer ();
+ serializer.ConvertFromString ("a,b,c,d,e,f", null);
+ }
+
+ [Test]
+ [ExpectedException (typeof (NotSupportedException))]
+ public void ConvertFromStringShouldThrowExceptionWhenStringIsNull ()
+ {
+ var serializer = new MatrixValueSerializer ();
+ serializer.ConvertFromString (null, null);
+ }
+
+ [Test]
+ [ExpectedException (typeof (NotSupportedException))]
+ public void ConvertToStringShouldThrowExceptionWhenInvalidType ()
+ {
+ var serializer = new MatrixValueSerializer ();
+ serializer.ConvertToString (10, null);
+ }
+ }
+}
\ No newline at end of file
}
[Test]
- [Category ("NotWorking")]
public void ConvertFrom ()
{
SizeConverter r = new SizeConverter ();
}
[Test]
- [Category ("NotWorking")]
[ExpectedException (typeof (ArgumentException))]
public void ConvertFrom_negative ()
{
}
[Test]
- [Category ("NotWorking")]
public void ConvertTo ()
{
SizeConverter r = new SizeConverter ();
}
[Test]
- [Category ("NotWorking")]
- public void Parse ()
+ public void ParseWithoutWhiteSpaces ()
{
- Assert.AreEqual (new Size (1, 2), Size.Parse ("1, 2"));
+ Assert.AreEqual (new Size (1, 2), Size.Parse ("1,2"));
+ }
+
+ [Test]
+ public void ParseWithWhiteSpaces ()
+ {
+ Assert.AreEqual (new Size (1, 2), Size.Parse (" 1, 2 "));
+ }
+
+ [Test]
+ public void ParseValueWithFloatingPoint ()
+ {
+ Assert.AreEqual (new Size (1.234, 5.678), Size.Parse ("1.234,5.678"));
+ }
+ [Test]
+ public void ParseEmpty ()
+ {
+ Assert.AreEqual (Size.Empty, Size.Parse ("Empty"));
+ }
+
+ [Test]
+ public void ParseEmptyWithWhiteSpaces ()
+ {
+ Assert.AreEqual (Size.Empty, Size.Parse (" Empty "));
}
[Test]
[Test]
public void ToStringTest ()
{
- Assert.AreEqual ("1,2", (new Size (1, 2)).ToString());
+ Assert.AreEqual ("1,2", (new Size (1, 2)).ToString ());
}
[Test]
--- /dev/null
+using System;
+using System.Windows;
+using System.Windows.Converters;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows {
+
+ [TestFixture]
+ public class SizeValueSerializerTest
+ {
+ [Test]
+ public void CanConvertFromString ()
+ {
+ var serializer = new SizeValueSerializer ();
+ Assert.IsTrue (serializer.CanConvertFromString ("", null));
+ }
+
+ [Test]
+ public void CanConvertToString ()
+ {
+ var serializer = new SizeValueSerializer ();
+ Assert.IsTrue (serializer.CanConvertToString (new Size (0, 0), null));
+ Assert.IsFalse (serializer.CanConvertToString ("", null));
+ }
+
+ [Test]
+ public void ConvertFromString ()
+ {
+ var serializer = new SizeValueSerializer ();
+ object obj = serializer.ConvertFromString ("3,4", null);
+ Assert.AreEqual (typeof (Size), obj.GetType ());
+ Assert.AreEqual (new Size (3, 4), obj);
+ }
+
+ [Test]
+ public void RoundTripConvert()
+ {
+ var serializer = new SizeValueSerializer ();
+ var size = new Size (1.234, 5.678);
+ var obj = serializer.ConvertFromString (serializer.ConvertToString (size, null), null);
+ Assert.AreEqual (size, obj);
+ }
+
+ [Test]
+ [ExpectedException (typeof (FormatException))]
+ public void ConvertFromStringShouldThrowExceptionWhenStringHasInvalidFormat ()
+ {
+ var serializer = new SizeValueSerializer ();
+ serializer.ConvertFromString ("a,b", null);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void ConvertFromStringShouldThrowExceptionWhenStringIsNull ()
+ {
+ var serializer = new SizeValueSerializer ();
+ serializer.ConvertFromString (null, null);
+ }
+
+ [Test]
+ [ExpectedException (typeof (NotSupportedException))]
+ public void ConvertToStringShouldThrowExceptionWhenInvalidType ()
+ {
+ var serializer = new SizeValueSerializer ();
+ serializer.ConvertToString (10, null);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void ConvertToStringShouldThrowExceptionWhenHeightOrWidthIsNegative ()
+ {
+ var serializer = new SizeValueSerializer ();
+ var result = serializer.ConvertFromString ("-1,-4", null);
+ }
+ }
+
+}
<AssemblyName>WindowsBase</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../winfx3.pub</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
System.Windows/RectConverterTest.cs
System.Windows/SizeTest.cs
System.Windows/SizeConverterTest.cs
+System.Windows/SizeValueSerializerTest.cs
System.Windows/VectorTest.cs
System.Windows/VectorConverterTest.cs
System.Windows.Markup/ConstructorArgumentAttributeTest.cs
System.Windows.Markup/MarkupExtensionReturnTypeAttributeTest.cs
System.Windows.Markup/ValueSerializerTest.cs
System.Windows.Media/MatrixTest.cs
+System.Windows.Media/MatrixConverterTest.cs
+System.Windows.Media/MatrixValueSerializerTest.cs
System.Windows.Threading/DispatcherTest.cs
System.Windows.Threading/DispatcherTimerTest.cs
</type>
<!-- appdomain.c: ves_icall_System_AppDomain_GetAssemblies -->
- <type fullname="System.Reflection.Assembly" preserve="fields">
- <method name="MonoDebugger_GetMethodToken" feature="sre" />
- <method name="GetNamespaces" feature="sre" />
- </type>
+ <type fullname="System.Reflection.Assembly" preserve="fields"/>
+
<type fullname="System.Reflection.AssemblyName" preserve="fields" />
<type fullname="System.Reflection.ConstructorInfo" preserve="fields" />
TEST_LIB_REFS = System.Core System
+XTEST_LIB_REFS = System System.Core Facades/System.Threading.Tasks Facades/System.Runtime.InteropServices.RuntimeInformation
+
ifndef AOT_FRIENDLY_PROFILE
ifneq ($(PROFILE),testing_aot_hybrid)
TEST_LIB_REFS += Mono.Posix
public ParameterBuilder DefineParameter (int iSequence, ParameterAttributes attributes, string strParamName)
{
- if (iSequence < 1 || iSequence > GetParametersCount ())
+ // The 0th ParameterBuilder does not correspond to an
+ // actual parameter, but .NETFramework lets you define
+ // it anyway. It is not useful.
+ if (iSequence < 0 || iSequence > GetParametersCount ())
throw new ArgumentOutOfRangeException ("iSequence");
if (type.is_created)
throw not_after_created ();
[MethodImplAttribute(MethodImplOptions.InternalCall)]
static extern byte[] GetBlob(Assembly asmb, ConstructorInfo con, object[] constructorArgs, PropertyInfo[] namedProperties, object[] propertyValues, FieldInfo[] namedFields, object[] fieldValues);
- internal CustomAttributeBuilder( ConstructorInfo con, byte[] cdata) {
+ internal CustomAttributeBuilder( ConstructorInfo con, byte[] binaryAttribute) {
+ if (con == null)
+ throw new ArgumentNullException ("con");
+ if (binaryAttribute == null)
+ throw new ArgumentNullException ("binaryAttribute");
ctor = con;
- data = (byte[])cdata.Clone ();
+ data = (byte[])binaryAttribute.Clone ();
/* should we check that the user supplied data is correct? */
}
return _tb.InternalResolve ();
}
+ internal override Type RuntimeResolve () {
+ return _tb.RuntimeResolve ();
+ }
public override Assembly Assembly {
get {
public void SetCustomAttribute (CustomAttributeBuilder customBuilder) {
RejectIfCreated ();
+ if (customBuilder == null)
+ throw new ArgumentNullException ("customBuilder");
+
string attrname = customBuilder.Ctor.ReflectedType.FullName;
if (attrname == "System.Runtime.InteropServices.FieldOffsetAttribute") {
byte[] data = customBuilder.Data;
public void SetOffset( int iOffset) {
RejectIfCreated ();
+ if (iOffset < 0)
+ throw new ArgumentException ("Negative field offset is not allowed");
offset = iOffset;
}
internal override Type InternalResolve ()
{
if (mbuilder != null)
- return MethodBase.GetMethodFromHandle (mbuilder.MethodHandleInternal).GetGenericArguments () [index];
+ return MethodBase.GetMethodFromHandle (mbuilder.MethodHandleInternal, mbuilder.TypeBuilder.InternalResolve ().TypeHandle).GetGenericArguments () [index];
return tbuilder.InternalResolve ().GetGenericArguments () [index];
}
make_room (6);
ll_emit (opcode);
int token = token_gen.GetToken (cls, opcode != OpCodes.Ldtoken);
- if (cls is TypeBuilderInstantiation || cls is SymbolType || cls is TypeBuilder || cls is GenericTypeParameterBuilder)
+ if (cls is TypeBuilderInstantiation || cls is SymbolType || cls is TypeBuilder || cls is GenericTypeParameterBuilder || cls is EnumBuilder)
add_token_fixup (cls);
emit_int (token);
}
//
// Extension: Mono allows position == 0 for the return attribute
//
- if ((position < 0) || (position > parameters.Length))
+ if ((position < 0) || parameters == null || (position > parameters.Length))
throw new ArgumentOutOfRangeException ("position");
ParameterBuilder pb = new ParameterBuilder (this, position, attributes, strParamName);
if (data == null)
throw new ArgumentNullException ("data");
- FieldBuilder fb = DefineUninitializedData (name, data.Length,
- attributes | FieldAttributes.HasFieldRVA);
+ var maskedAttributes = attributes & ~FieldAttributes.ReservedMask;
+ FieldBuilder fb = DefineDataImpl (name, data.Length, maskedAttributes | FieldAttributes.HasFieldRVA);
fb.SetRVAData (data);
return fb;
}
public FieldBuilder DefineUninitializedData (string name, int size, FieldAttributes attributes)
+ {
+ return DefineDataImpl (name, size, attributes & ~FieldAttributes.ReservedMask);
+ }
+
+ private FieldBuilder DefineDataImpl (string name, int size, FieldAttributes attributes)
{
if (name == null)
throw new ArgumentNullException ("name");
+ if (name == String.Empty)
+ throw new ArgumentException ("name cannot be empty", "name");
if (global_type_created != null)
throw new InvalidOperationException ("global fields already created");
- if ((size <= 0) || (size > 0x3f0000))
- throw new ArgumentException ("size", "Data size must be > 0 and < 0x3f0000");
+ if ((size <= 0) || (size >= 0x3f0000))
+ throw new ArgumentException ("Data size must be > 0 and < 0x3f0000", null as string);
CreateGlobalType ();
static int typespec_tokengen = 0x1bffffff;
static int memberref_tokengen = 0x0affffff;
static int methoddef_tokengen = 0x06ffffff;
- Dictionary<MemberInfo, int> inst_tokens = new Dictionary<MemberInfo, int> ();
- Dictionary<MemberInfo, int> inst_tokens_open = new Dictionary<MemberInfo, int> ();
+ Dictionary<MemberInfo, int> inst_tokens, inst_tokens_open;
//
// Assign a pseudo token to the various TypeBuilderInst objects, so the runtime
// still encounter these objects, it will resolve them by calling their
// RuntimeResolve () methods.
//
- int GetPseudoToken (MemberInfo member, bool create_open_instance) {
+ int GetPseudoToken (MemberInfo member, bool create_open_instance)
+ {
int token;
-
- if (create_open_instance) {
- if (inst_tokens_open.TryGetValue (member, out token))
- return token;
- } else {
- if (inst_tokens.TryGetValue (member, out token))
- return token;
+ var dict = create_open_instance ? inst_tokens_open : inst_tokens;
+ if (dict == null) {
+ dict = new Dictionary<MemberInfo, int> (ReferenceEqualityComparer<MemberInfo>.Instance);
+ if (create_open_instance)
+ inst_tokens_open = dict;
+ else
+ inst_tokens = dict;
+ } else if (dict.TryGetValue (member, out token)) {
+ return token;
}
+
// Count backwards to avoid collisions with the tokens
// allocated by the runtime
if (member is TypeBuilderInstantiation || member is SymbolType)
token = typedef_tokengen --;
else
token = typeref_tokengen --;
+ } else if (member is EnumBuilder) {
+ token = GetPseudoToken ((member as EnumBuilder).GetTypeBuilder(), create_open_instance);
+ dict[member] = token;
+ // n.b. don't register with the runtime, the TypeBuilder already did it.
+ return token;
} else if (member is ConstructorBuilder) {
if (member.Module == this && !(member as ConstructorBuilder).TypeBuilder.ContainsGenericParameters)
token = methoddef_tokengen --;
token = typespec_tokengen --;
} else
throw new NotImplementedException ();
- if (create_open_instance)
- inst_tokens_open [member] = token;
- else
- inst_tokens [member] = token;
+
+ dict [member] = token;
RegisterToken (member, token);
return token;
}
}
internal int GetToken (MemberInfo member, bool create_open_instance) {
- if (member is TypeBuilderInstantiation || member is FieldOnTypeBuilderInst || member is ConstructorOnTypeBuilderInst || member is MethodOnTypeBuilderInst || member is SymbolType || member is FieldBuilder || member is TypeBuilder || member is ConstructorBuilder || member is MethodBuilder || member is GenericTypeParameterBuilder)
+ if (member is TypeBuilderInstantiation || member is FieldOnTypeBuilderInst || member is ConstructorOnTypeBuilderInst || member is MethodOnTypeBuilderInst || member is SymbolType || member is FieldBuilder || member is TypeBuilder || member is ConstructorBuilder || member is MethodBuilder || member is GenericTypeParameterBuilder ||
+ member is EnumBuilder)
return GetPseudoToken (member, create_open_instance);
return getToken (this, member, create_open_instance);
}
finished = (member as FieldBuilder).RuntimeResolve ();
} else if (member is TypeBuilder) {
finished = (member as TypeBuilder).RuntimeResolve ();
+ } else if (member is EnumBuilder) {
+ finished = (member as EnumBuilder).RuntimeResolve ();
} else if (member is ConstructorBuilder) {
finished = (member as ConstructorBuilder).RuntimeResolve ();
} else if (member is MethodBuilder) {
//
// Fixup the pseudo tokens assigned to the various SRE objects
//
- void FixupTokens () {
+ void FixupTokens ()
+ {
var token_map = new Dictionary<int, int> ();
var member_map = new Dictionary<int, MemberInfo> ();
- FixupTokens (token_map, member_map, inst_tokens, false);
- FixupTokens (token_map, member_map, inst_tokens_open, true);
+ if (inst_tokens != null)
+ FixupTokens (token_map, member_map, inst_tokens, false);
+ if (inst_tokens_open != null)
+ FixupTokens (token_map, member_map, inst_tokens_open, true);
// Replace the tokens in the IL stream
if (types != null) {
#else
public static bool IsComObject (object o)
{
- throw new PlatformNotSupportedException ();
+ return false;
}
#endif
public override int GetHashCode ()
{
- /* same implementation as CoreCLR */
- return GetType ().GetHashCode ();
+ MethodInfo m;
+
+ m = Method;
+
+ return (m != null ? m.GetHashCode () : GetType ().GetHashCode ()) ^ (m_target != null ? m_target.GetHashCode () : 0);
}
protected virtual MethodInfo GetMethodImpl ()
}
[Test]
- [Category ("NotDotNet")] // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=341439
public void DefineParameter_Position_Zero ()
{
+ // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=341439
+ // https://msdn.microsoft.com/en-us/library/system.reflection.emit.constructorbuilder.defineparameter(v=vs.110).aspx
+ // "If you specify 0 (zero) for iSequence, this method returns
+ // a ParameterBuilder instead of throwing an exception. There
+ // is nothing useful that you can do with this
+ // ParameterBuilder."
+
ConstructorBuilder cb = genClass.DefineConstructor (
0, 0, new Type [2] { typeof (int), typeof (int) });
- try {
- cb.DefineParameter (0, ParameterAttributes.In, "param1");
- Assert.Fail ("#1");
- } catch (ArgumentOutOfRangeException ex) {
- // Specified argument was out of the range of valid values
- Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#2");
- Assert.IsNull (ex.ActualValue, "#3");
- Assert.IsNull (ex.InnerException, "#4");
- Assert.IsNotNull (ex.Message, "#5");
- Assert.IsNotNull (ex.ParamName, "#6");
- }
+ var pb = cb.DefineParameter (0, ParameterAttributes.In, "param1");
+ Assert.IsNotNull (pb);
}
[Test]
Assert.IsNull (enumBuilder.DeclaringType, "#3");
Assert.IsNull (enumBuilder.ReflectedType, "#4");
Assert.AreEqual (_enumType, enumBuilder.UnderlyingSystemType, "#5");
- }
-
- [Test]
- [Category ("ValueAdd")]
- public void TestEnumBuilder_NotInMono ()
- {
- // If we decide to fix this (I dont see why we should),
- // move to the routine above
-
- EnumBuilder enumBuilder = GenerateEnum ();
Assert.IsFalse (enumBuilder.IsSerializable);
}
[Test]
[ExpectedException (typeof (NotSupportedException))]
- [Category ("ValueAdd")]
public void TestFindMembersIncomplete ()
{
EnumBuilder enumBuilder = GenerateEnum ();
[Test]
[ExpectedException (typeof (NotSupportedException))]
- [Category ("ValueAdd")]
public void TestGetConstructorIncomplete ()
{
EnumBuilder enumBuilder = GenerateEnum ();
Assert.Fail ("Expected CreateInstance of a broken type to throw TLE");
}
+ [Test]
+ public void TestEnumBuilderTokenUsable () {
+ // Regression test for https://bugzilla.xamarin.com/show_bug.cgi?id=58361
+ // Create an EnumBuilder and use it in an ILGenerator that consumes its token.
+ var modBuilder = GenerateModule ();
+ EnumBuilder enumBuilder = GenerateEnum (modBuilder);
+
+ var tb = modBuilder.DefineType ("Foo", TypeAttributes.Public);
+
+ var cb = tb.DefineConstructor (MethodAttributes.Public, CallingConventions.Standard,
+ Type.EmptyTypes);
+
+ var ilg = cb.GetILGenerator ();
+
+ ilg.Emit (OpCodes.Ldtoken, enumBuilder);
+ ilg.Emit (OpCodes.Pop);
+ ilg.Emit (OpCodes.Ret);
+
+ var t = tb.CreateType ();
+ enumBuilder.CreateType ();
+
+ var ci = t.GetConstructor (Type.EmptyTypes);
+ var x = ci.Invoke (null);
+ Assert.IsNotNull (x);
+ }
+
+ [Test]
+ public void TestEnumBuilderTokenUsableCrossAssembly () {
+ // Regression test for https://bugzilla.xamarin.com/show_bug.cgi?id=58361
+ // Create an EnumBuilder and use it in an ILGenerator that consumes its token in a different assembly.
+ var modBuilder = GenerateModule ();
+ var modBuilder2 = GenerateModule ();
+ EnumBuilder enumBuilder = GenerateEnum (modBuilder2);
+
+ // N.B. "tb" is in modBuilder but enumBuilder is in modBuilder2
+ var tb = modBuilder.DefineType ("Foo", TypeAttributes.Public);
+
+ var cb = tb.DefineConstructor (MethodAttributes.Public, CallingConventions.Standard,
+ Type.EmptyTypes);
+
+ var ilg = cb.GetILGenerator ();
+
+ ilg.Emit (OpCodes.Ldtoken, enumBuilder);
+ ilg.Emit (OpCodes.Pop);
+ ilg.Emit (OpCodes.Ret);
+
+ var t = tb.CreateType ();
+ enumBuilder.CreateType ();
+
+ var ci = t.GetConstructor (Type.EmptyTypes);
+ var x = ci.Invoke (null);
+ Assert.IsNotNull (x);
+ }
+
+
private static void VerifyType (Type type)
{
Assert.IsNotNull (type.Assembly, "#V1");
Assert.AreEqual (TypeAttributes.Public, gparam.Attributes, "#1");
}
+
+ [Test]
+ public void ActionConstructorInfoTest ()
+ {
+ // Regression test for https://bugzilla.xamarin.com/show_bug.cgi?id=58454
+ //
+ // Need to check that GenericTypeParameterBuilderTest:InternalResolve() passes the declaring type to GetMethodFromHandle()
+ //
+ /* Want to generate:
+
+ public class Store<TState> {
+ public Action<TSelection> Subscribe<TSelection> (TState state) {
+ return new Action<TSelection> (Foo<TSelection>);
+ }
+ public static void Foo<X> (X x) { }
+ }
+
+ ... and then: new Store<string>().Subscribe<int>("x");
+ */
+
+ SetUp (AssemblyBuilderAccess.Run);
+
+ var tb = module.DefineType ("Store");
+ var tparsStore = tb.DefineGenericParameters ("TState");
+
+ tb.DefineDefaultConstructor (MethodAttributes.Public);
+
+ var methFoo = tb.DefineMethod ("Foo", MethodAttributes.Public | MethodAttributes.Static);
+ var tparsFoo = methFoo.DefineGenericParameters ("X");
+ methFoo.SetReturnType (typeof(void));
+ methFoo.SetParameters (tparsFoo[0]);
+ methFoo.GetILGenerator().Emit (OpCodes.Ret);
+
+ var methSub = tb.DefineMethod ("Subscribe", MethodAttributes.Public | MethodAttributes.Static);
+ var tparsSub = methSub.DefineGenericParameters ("TSelection");
+ var actOfSel = typeof(Action<>).MakeGenericType (tparsSub[0]); // Action<TSelection>
+ methSub.SetReturnType (actOfSel);
+ methSub.SetParameters (tparsStore[0]); // TState
+ var ilg = methSub.GetILGenerator ();
+ ilg.Emit (OpCodes.Ldnull); // instance == null
+ ilg.Emit (OpCodes.Ldftn, methFoo.MakeGenericMethod (tparsSub[0])); // ldftn void class Store`1<!TState>::Foo<!!0> (!!0)
+ var aaa = TypeBuilder.GetConstructor (actOfSel, typeof(Action<>).GetConstructors()[0]);
+ ilg.Emit (OpCodes.Newobj, aaa); // new Action<TSelection> (Foo<TSelection>);
+ ilg.Emit (OpCodes.Ret);
+
+ var tgen = tb.CreateType (); // TState`1
+
+ var t = tgen.MakeGenericType(typeof(string));
+ var x = t.GetConstructor(Type.EmptyTypes).Invoke (null); // x = new Store<string> ()
+ var mgen = t.GetMethod("Subscribe");
+ var m = mgen.MakeGenericMethod (typeof (int)); // Action<int> Store<string>.Subscribe<int> (string)
+ var y = m.Invoke (x, new object[] {"hello"}); // x.Subscribte<int> ("hello")
+ Assert.IsNotNull (y);
+ }
+
}
}
--- /dev/null
+using System;
+using System.IO;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Runtime.InteropServices;
+using System.Configuration.Assemblies;
+using NUnit.Framework;
+
+namespace MonoTests.System.Reflection.Emit
+{
+
+[TestFixture]
+public class SaveTest
+{
+ // strongname generated using "sn -k unit.snk"
+ static byte[] strongName = {
+ 0x07, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x52, 0x53, 0x41, 0x32,
+ 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x7F, 0x7C, 0xEA, 0x4A,
+ 0x28, 0x33, 0xD8, 0x3C, 0x86, 0x90, 0x86, 0x91, 0x11, 0xBB, 0x30, 0x0D,
+ 0x3D, 0x69, 0x04, 0x4C, 0x48, 0xF5, 0x4F, 0xE7, 0x64, 0xA5, 0x82, 0x72,
+ 0x5A, 0x92, 0xC4, 0x3D, 0xC5, 0x90, 0x93, 0x41, 0xC9, 0x1D, 0x34, 0x16,
+ 0x72, 0x2B, 0x85, 0xC1, 0xF3, 0x99, 0x62, 0x07, 0x32, 0x98, 0xB7, 0xE4,
+ 0xFA, 0x75, 0x81, 0x8D, 0x08, 0xB9, 0xFD, 0xDB, 0x00, 0x25, 0x30, 0xC4,
+ 0x89, 0x13, 0xB6, 0x43, 0xE8, 0xCC, 0xBE, 0x03, 0x2E, 0x1A, 0x6A, 0x4D,
+ 0x36, 0xB1, 0xEB, 0x49, 0x26, 0x6C, 0xAB, 0xC4, 0x29, 0xD7, 0x8F, 0x25,
+ 0x11, 0xA4, 0x7C, 0x81, 0x61, 0x97, 0xCB, 0x44, 0x2D, 0x80, 0x49, 0x93,
+ 0x48, 0xA7, 0xC9, 0xAB, 0xDB, 0xCF, 0xA3, 0x34, 0xCB, 0x6B, 0x86, 0xE0,
+ 0x4D, 0x27, 0xFC, 0xA7, 0x4F, 0x36, 0xCA, 0x13, 0x42, 0xD3, 0x83, 0xC4,
+ 0x06, 0x6E, 0x12, 0xE0, 0xA1, 0x3D, 0x9F, 0xA9, 0xEC, 0xD1, 0xC6, 0x08,
+ 0x1B, 0x3D, 0xF5, 0xDB, 0x4C, 0xD4, 0xF0, 0x2C, 0xAA, 0xFC, 0xBA, 0x18,
+ 0x6F, 0x48, 0x7E, 0xB9, 0x47, 0x68, 0x2E, 0xF6, 0x1E, 0x67, 0x1C, 0x7E,
+ 0x0A, 0xCE, 0x10, 0x07, 0xC0, 0x0C, 0xAD, 0x5E, 0xC1, 0x53, 0x70, 0xD5,
+ 0xE7, 0x25, 0xCA, 0x37, 0x5E, 0x49, 0x59, 0xD0, 0x67, 0x2A, 0xBE, 0x92,
+ 0x36, 0x86, 0x8A, 0xBF, 0x3E, 0x17, 0x04, 0xFB, 0x1F, 0x46, 0xC8, 0x10,
+ 0x5C, 0x93, 0x02, 0x43, 0x14, 0x96, 0x6A, 0xD9, 0x87, 0x17, 0x62, 0x7D,
+ 0x3A, 0x45, 0xBE, 0x35, 0xDE, 0x75, 0x0B, 0x2A, 0xCE, 0x7D, 0xF3, 0x19,
+ 0x85, 0x4B, 0x0D, 0x6F, 0x8D, 0x15, 0xA3, 0x60, 0x61, 0x28, 0x55, 0x46,
+ 0xCE, 0x78, 0x31, 0x04, 0x18, 0x3C, 0x56, 0x4A, 0x3F, 0xA4, 0xC9, 0xB1,
+ 0x41, 0xED, 0x22, 0x80, 0xA1, 0xB3, 0xE2, 0xC7, 0x1B, 0x62, 0x85, 0xE4,
+ 0x81, 0x39, 0xCB, 0x1F, 0x95, 0xCC, 0x61, 0x61, 0xDF, 0xDE, 0xF3, 0x05,
+ 0x68, 0xB9, 0x7D, 0x4F, 0xFF, 0xF3, 0xC0, 0x0A, 0x25, 0x62, 0xD9, 0x8A,
+ 0x8A, 0x9E, 0x99, 0x0B, 0xFB, 0x85, 0x27, 0x8D, 0xF6, 0xD4, 0xE1, 0xB9,
+ 0xDE, 0xB4, 0x16, 0xBD, 0xDF, 0x6A, 0x25, 0x9C, 0xAC, 0xCD, 0x91, 0xF7,
+ 0xCB, 0xC1, 0x81, 0x22, 0x0D, 0xF4, 0x7E, 0xEC, 0x0C, 0x84, 0x13, 0x5A,
+ 0x74, 0x59, 0x3F, 0x3E, 0x61, 0x00, 0xD6, 0xB5, 0x4A, 0xA1, 0x04, 0xB5,
+ 0xA7, 0x1C, 0x29, 0xD0, 0xE1, 0x11, 0x19, 0xD7, 0x80, 0x5C, 0xEE, 0x08,
+ 0x15, 0xEB, 0xC9, 0xA8, 0x98, 0xF5, 0xA0, 0xF0, 0x92, 0x2A, 0xB0, 0xD3,
+ 0xC7, 0x8C, 0x8D, 0xBB, 0x88, 0x96, 0x4F, 0x18, 0xF0, 0x8A, 0xF9, 0x31,
+ 0x9E, 0x44, 0x94, 0x75, 0x6F, 0x78, 0x04, 0x10, 0xEC, 0xF3, 0xB0, 0xCE,
+ 0xA0, 0xBE, 0x7B, 0x25, 0xE1, 0xF7, 0x8A, 0xA8, 0xD4, 0x63, 0xC2, 0x65,
+ 0x47, 0xCC, 0x5C, 0xED, 0x7D, 0x8B, 0x07, 0x4D, 0x76, 0x29, 0x53, 0xAC,
+ 0x27, 0x8F, 0x5D, 0x78, 0x56, 0xFA, 0x99, 0x45, 0xA2, 0xCC, 0x65, 0xC4,
+ 0x54, 0x13, 0x9F, 0x38, 0x41, 0x7A, 0x61, 0x0E, 0x0D, 0x34, 0xBC, 0x11,
+ 0xAF, 0xE2, 0xF1, 0x8B, 0xFA, 0x2B, 0x54, 0x6C, 0xA3, 0x6C, 0x09, 0x1F,
+ 0x0B, 0x43, 0x9B, 0x07, 0x95, 0x83, 0x3F, 0x97, 0x99, 0x89, 0xF5, 0x51,
+ 0x41, 0xF6, 0x8E, 0x5D, 0xEF, 0x6D, 0x24, 0x71, 0x41, 0x7A, 0xAF, 0xBE,
+ 0x81, 0x71, 0xAB, 0x76, 0x2F, 0x1A, 0x5A, 0xBA, 0xF3, 0xA6, 0x65, 0x7A,
+ 0x80, 0x50, 0xCE, 0x23, 0xC3, 0xC7, 0x53, 0xB0, 0x7C, 0x97, 0x77, 0x27,
+ 0x70, 0x98, 0xAE, 0xB5, 0x24, 0x66, 0xE1, 0x60, 0x39, 0x41, 0xDA, 0x54,
+ 0x01, 0x64, 0xFB, 0x10, 0x33, 0xCE, 0x8B, 0xBE, 0x27, 0xD4, 0x21, 0x57,
+ 0xCC, 0x0F, 0x1A, 0xC1, 0x3D, 0xF3, 0xCC, 0x39, 0xF0, 0x2F, 0xAE, 0xF1,
+ 0xC0, 0xCD, 0x3B, 0x23, 0x87, 0x49, 0x7E, 0x40, 0x32, 0x6A, 0xD3, 0x96,
+ 0x4A, 0xE5, 0x5E, 0x6E, 0x26, 0xFD, 0x8A, 0xCF, 0x7E, 0xFC, 0x37, 0xDE,
+ 0x39, 0x0C, 0x53, 0x81, 0x75, 0x08, 0xAF, 0x6B, 0x39, 0x6C, 0xFB, 0xC9,
+ 0x79, 0xC0, 0x9B, 0x5F, 0x34, 0x86, 0xB2, 0xDE, 0xC4, 0x19, 0x84, 0x5F,
+ 0x0E, 0xED, 0x9B, 0xB8, 0xD3, 0x17, 0xDA, 0x78 };
+
+ [Test]
+ public void Save () {
+ // FIXME: Temp dir etc.
+
+ //
+ // Create a test assembly, write it to disk, then read it back
+ //
+ AssemblyName aname = new AssemblyName ("h");
+ // AssemblyName properties
+ aname.ProcessorArchitecture = ProcessorArchitecture.X86;
+ aname.Version = new Version (1, 2, 3, 4);
+ aname.CultureInfo = new CultureInfo ("en");
+ aname.Flags = AssemblyNameFlags.Retargetable;
+ aname.HashAlgorithm = AssemblyHashAlgorithm.SHA256;
+ var ab = AppDomain.CurrentDomain.DefineDynamicAssembly (aname, AssemblyBuilderAccess.RunAndSave);
+
+ string strongfile = "strongname.snk";
+ using (FileStream fs = File.OpenWrite (strongfile)) {
+ fs.Write (strongName, 0, strongName.Length);
+ fs.Close ();
+ }
+ ab.SetCustomAttribute (new CustomAttributeBuilder (typeof (AssemblyKeyFileAttribute).GetConstructor (new Type [] { typeof (string) }), new object [] { strongfile }));
+ ab.SetCustomAttribute (new CustomAttributeBuilder (typeof (AssemblyDelaySignAttribute).GetConstructor (new Type [] { typeof (bool) }), new object [] { true }));
+
+ var cattrb = new CustomAttributeBuilder (typeof (AttributeUsageAttribute).GetConstructor (new Type [] { typeof (AttributeTargets) }), new object [] { AttributeTargets.Class },
+ new PropertyInfo[] { typeof (AttributeUsageAttribute).GetProperty ("AllowMultiple") },
+ new object[] { true },
+ new FieldInfo [0], new object [0]);
+ ab.SetCustomAttribute (cattrb);
+
+ var moduleb = ab.DefineDynamicModule ("h.exe", "h.exe");
+ moduleb.SetCustomAttribute (cattrb);
+
+ TypeBuilder iface1 = moduleb.DefineType ("iface1", TypeAttributes.Public|TypeAttributes.Interface, typeof (object));
+ iface1.CreateType ();
+
+ // Interfaces, attributes, class size, packing size
+ TypeBuilder tb1 = moduleb.DefineType ("type1", TypeAttributes.Public|TypeAttributes.SequentialLayout, typeof (object), PackingSize.Size2, 16);
+ tb1.AddInterfaceImplementation (iface1);
+ tb1.AddInterfaceImplementation (typeof (IComparable));
+ tb1.SetCustomAttribute (cattrb);
+ tb1.CreateType ();
+
+ // Nested type
+ TypeBuilder tb_nested = tb1.DefineNestedType ("type_nested", TypeAttributes.NestedPublic, typeof (object));
+ tb_nested.CreateType ();
+
+ // Generics
+ TypeBuilder tbg = moduleb.DefineType ("gtype1", TypeAttributes.Public, typeof (object));
+ var gparams = tbg.DefineGenericParameters ("K", "T");
+ // Constraints
+ gparams [0].SetBaseTypeConstraint (null);
+ gparams [0].SetInterfaceConstraints (new Type [] { typeof (IComparable) });
+ gparams [0].SetCustomAttribute (cattrb);
+ gparams [1].SetBaseTypeConstraint (tbg);
+ // Type param
+ tbg.DefineField ("field_gparam", tbg.GetGenericArguments () [0], FieldAttributes.Public|FieldAttributes.Static);
+ // Open type
+ tbg.DefineField ("field_open", typeof (List<>).MakeGenericType (new Type [] { tbg.GetGenericArguments () [1] }), FieldAttributes.Public|FieldAttributes.Static);
+ tbg.CreateType ();
+
+ TypeBuilder tbg2 = moduleb.DefineType ("gtype2", TypeAttributes.Public, typeof (object));
+ tbg2.DefineGenericParameters ("K", "T");
+ tbg2.CreateType ();
+
+ TypeBuilder tb3 = moduleb.DefineType ("type3", TypeAttributes.Public, typeof (object));
+ // Nested type
+ tb3.DefineField ("field_nested", tb_nested, FieldAttributes.Public|FieldAttributes.Static);
+ // Nested type ref
+ tb3.DefineField ("field_nested_ref", typeof (TimeZoneInfo.AdjustmentRule), FieldAttributes.Public|FieldAttributes.Static);
+ // Primitive types
+ tb3.DefineField ("field_int", typeof (int), FieldAttributes.Public|FieldAttributes.Static);
+ // Typeref array
+ tb3.DefineField ("field_array_typeref", typeof (object[]), FieldAttributes.Public|FieldAttributes.Static);
+ // Type szarray
+ tb3.DefineField ("field_szarray", tb1.MakeArrayType (), FieldAttributes.Public|FieldAttributes.Static);
+ // Multi-dim non szarray
+ tb3.DefineField ("field_non_szarray", Array.CreateInstance (typeof (int), new int [] { 10 }, new int [] { 1 }).GetType (), FieldAttributes.Public|FieldAttributes.Static);
+ // Multi-dim array
+ tb3.DefineField ("field_multi_dim_array", Array.CreateInstance (typeof (int), new int [] { 10, 10 }, new int [] { 1, 1 }).GetType (), FieldAttributes.Public|FieldAttributes.Static);
+ // Type pointer
+ tb3.DefineField ("field_pointer", tb1.MakePointerType (), FieldAttributes.Public|FieldAttributes.Static);
+ // Generic instance
+ tb3.DefineField ("field_ginst", typeof (List<int>), FieldAttributes.Public|FieldAttributes.Static);
+ // Generic instance of tbuilder
+ tb3.DefineField ("field_ginst_tbuilder", tbg2.MakeGenericType (new Type [] { typeof (int), typeof (string) }), FieldAttributes.Public|FieldAttributes.Static);
+ tb3.CreateType ();
+
+ // Fields
+ TypeBuilder tb_fields = moduleb.DefineType ("type4", TypeAttributes.Public, typeof (object));
+ // Field with a constant
+ tb_fields.DefineField ("field_int", typeof (int), FieldAttributes.Public|FieldAttributes.Static|FieldAttributes.HasDefault).SetConstant (42);
+ // Field with an offset
+ tb_fields.DefineField ("field_offset", typeof (int), FieldAttributes.Public|FieldAttributes.Static).SetOffset (64);
+ // Modreq/modopt
+ tb_fields.DefineField ("field_modopt", typeof (int), new Type [] { typeof (int) }, new Type [] { typeof (uint) }, FieldAttributes.Public|FieldAttributes.Static);
+ // Marshal
+ var fb = tb_fields.DefineField ("field_marshal1", typeof (int), FieldAttributes.Public);
+ fb.SetCustomAttribute (new CustomAttributeBuilder (typeof (MarshalAsAttribute).GetConstructor (new Type [] { typeof (UnmanagedType) }), new object [] { UnmanagedType.U4 }));
+ fb = tb_fields.DefineField ("field_marshal_byval_array", typeof (int), FieldAttributes.Public);
+ fb.SetCustomAttribute (new CustomAttributeBuilder (typeof (MarshalAsAttribute).GetConstructor (new Type [] { typeof (UnmanagedType) }), new object [] { UnmanagedType.ByValArray },
+ new FieldInfo[] { typeof (MarshalAsAttribute).GetField ("SizeConst") },
+ new object[] { 16 }));
+ fb = tb_fields.DefineField ("field_marshal_byval_tstr", typeof (int), FieldAttributes.Public);
+ fb.SetCustomAttribute (new CustomAttributeBuilder (typeof (MarshalAsAttribute).GetConstructor (new Type [] { typeof (UnmanagedType) }), new object [] { UnmanagedType.ByValTStr },
+ new FieldInfo[] { typeof (MarshalAsAttribute).GetField ("SizeConst") },
+ new object[] { 16 }));
+#if false
+ fb = tb_fields.DefineField ("field_marshal_custom", typeof (int), FieldAttributes.Public);
+ fb.SetCustomAttribute (new CustomAttributeBuilder (typeof (MarshalAsAttribute).GetConstructor (new Type [] { typeof (UnmanagedType) }), new object [] { UnmanagedType.CustomMarshaler },
+ new FieldInfo[] { typeof (MarshalAsAttribute).GetField ("MarshalTypeRef"),
+ typeof (MarshalAsAttribute).GetField ("MarshalCookie") },
+ new object [] { typeof (object), "Cookie" }));
+#endif
+ // Cattr
+ fb = tb_fields.DefineField ("field_cattr", typeof (int), FieldAttributes.Public|FieldAttributes.Static);
+ fb.SetCustomAttribute (cattrb);
+ tb_fields.CreateType ();
+
+ // Data
+ moduleb.DefineUninitializedData ("data1", 16, FieldAttributes.Public);
+ moduleb.DefineInitializedData ("data2", new byte[] { 1, 2, 3, 4, 5, 6 }, FieldAttributes.Public);
+
+ // Methods and signatures
+ TypeBuilder tb5 = moduleb.DefineType ("type_methods", TypeAttributes.Public, typeof (object));
+ // .ctor
+ var cmods_req_1 = new Type [] { typeof (object) };
+ var cmods_opt_1 = new Type [] { typeof (int) };
+ var ctorb = tb5.DefineConstructor (MethodAttributes.Public, CallingConventions.VarArgs, new Type [] { typeof (int), typeof (object) }, new Type[][] { cmods_req_1, null }, new Type [][] { cmods_opt_1, null });
+ ctorb.SetImplementationFlags (MethodImplAttributes.NoInlining);
+ ctorb.GetILGenerator ().Emit (OpCodes.Ret);
+ // Parameters
+ var paramb = ctorb.DefineParameter (1, ParameterAttributes.None, "param1");
+ paramb.SetConstant (16);
+ paramb.SetCustomAttribute (cattrb);
+ paramb = ctorb.DefineParameter (2, ParameterAttributes.Out, "param2");
+ //paramb.SetCustomAttribute (new CustomAttributeBuilder (typeof (MarshalAsAttribute).GetConstructor (new Type [] { typeof (UnmanagedType) }), new object [] { UnmanagedType.U4 }));
+ // .cctor
+ var ctorb2 = tb5.DefineConstructor (MethodAttributes.Public|MethodAttributes.Static, CallingConventions.Standard, new Type [] { typeof (int), typeof (object) });
+ ctorb2.GetILGenerator ().Emit (OpCodes.Ret);
+ // method
+ var mb = tb5.DefineMethod ("method1", MethodAttributes.Public, CallingConventions.Standard, typeof (int), cmods_req_1, cmods_opt_1, new Type [] { typeof (int), typeof (object) }, new Type [][] { cmods_req_1, null }, new Type [][] { cmods_opt_1, null });
+ mb.SetImplementationFlags (MethodImplAttributes.NoInlining);
+ mb.GetILGenerator ().Emit (OpCodes.Ret);
+ gparams = mb.DefineGenericParameters ("K", "T");
+ // Constraints
+ gparams [0].SetBaseTypeConstraint (null);
+ gparams [0].SetInterfaceConstraints (new Type [] { typeof (IComparable) });
+ paramb = mb.DefineParameter (1, ParameterAttributes.None, "param1");
+ paramb.SetConstant (16);
+ paramb = mb.DefineParameter (2, ParameterAttributes.Out, "param2");
+ //paramb.SetCustomAttribute (new CustomAttributeBuilder (typeof (MarshalAsAttribute).GetConstructor (new Type [] { typeof (UnmanagedType) }), new object [] { UnmanagedType.U4 }));
+ // return value
+ paramb = mb.DefineParameter (0, ParameterAttributes.None, "ret");
+ //paramb.SetCustomAttribute (new CustomAttributeBuilder (typeof (MarshalAsAttribute).GetConstructor (new Type [] { typeof (UnmanagedType) }), new object [] { UnmanagedType.U4 }));
+ paramb.SetCustomAttribute (cattrb);
+ // override method
+ tb5.AddInterfaceImplementation (typeof (IComparable));
+ mb = tb5.DefineMethod ("method_override", MethodAttributes.Public|MethodAttributes.Virtual, CallingConventions.Standard|CallingConventions.HasThis, typeof (int), new Type [] { typeof (object) });
+ mb.GetILGenerator ().Emit (OpCodes.Ret);
+ tb5.DefineMethodOverride (mb, typeof (IComparable).GetMethod ("CompareTo"));
+ tb5.CreateType ();
+
+ // Properties
+ TypeBuilder tb_properties = moduleb.DefineType ("type_properties", TypeAttributes.Public, typeof (object));
+ var mb_get = tb_properties.DefineMethod ("get_method1", MethodAttributes.Public, CallingConventions.Standard, typeof (int), new Type [] { });
+ mb_get.GetILGenerator ().Emit (OpCodes.Ret);
+ var mb_set = tb_properties.DefineMethod ("set_method1", MethodAttributes.Public, CallingConventions.Standard, typeof (int), new Type [] { });
+ mb_set.GetILGenerator ().Emit (OpCodes.Ret);
+ var mb_other = tb_properties.DefineMethod ("other_method1", MethodAttributes.Public, CallingConventions.Standard, typeof (int), new Type [] { });
+ mb_other.GetILGenerator ().Emit (OpCodes.Ret);
+ var propertyb = tb_properties.DefineProperty ("AProperty", PropertyAttributes.HasDefault, typeof (int), new Type[] { typeof (object) });
+ propertyb.SetCustomAttribute (cattrb);
+ propertyb.SetConstant (1);
+ propertyb.SetGetMethod (mb_get);
+ propertyb.SetSetMethod (mb_set);
+ propertyb.AddOtherMethod (mb_other);
+ tb_properties.CreateType ();
+
+ // Events
+ TypeBuilder tb_events = moduleb.DefineType ("type_events", TypeAttributes.Public, typeof (object));
+ var mb_add = tb_events.DefineMethod ("add_method1", MethodAttributes.Public, CallingConventions.Standard, typeof (int), new Type [] { });
+ mb_add.GetILGenerator ().Emit (OpCodes.Ret);
+ var mb_raise = tb_events.DefineMethod ("raise_method1", MethodAttributes.Public, CallingConventions.Standard, typeof (int), new Type [] { });
+ mb_raise.GetILGenerator ().Emit (OpCodes.Ret);
+ var mb_remove = tb_events.DefineMethod ("remove_method1", MethodAttributes.Public, CallingConventions.Standard, typeof (int), new Type [] { });
+ mb_remove.GetILGenerator ().Emit (OpCodes.Ret);
+ var eventb = tb_events.DefineEvent ("Event1", EventAttributes.SpecialName, typeof (int));
+ eventb.SetCustomAttribute (cattrb);
+ eventb.SetAddOnMethod (mb_add);
+ eventb.SetRaiseMethod (mb_raise);
+ eventb.SetRemoveOnMethod (mb_remove);
+ tb_events.CreateType ();
+
+ ab.Save ("h.exe");
+
+ // Read the assembly and check data
+ Assembly a = Assembly.LoadFrom ("h.exe");
+ Assert.IsTrue (a != ab);
+ CheckAssembly (a);
+ }
+
+ void CheckCattr (ICustomAttributeProvider obj) {
+ var cattrs = obj.GetCustomAttributes (typeof (AttributeUsageAttribute), false);
+ Assert.AreEqual (1, cattrs.Length);
+ var cattr = (AttributeUsageAttribute)cattrs [0];
+ Assert.AreEqual (AttributeTargets.Class, cattr.ValidOn);
+ Assert.IsTrue (cattr.AllowMultiple);
+ }
+
+ void CheckAssembly (Assembly a) {
+ // AssemblyName properties
+ var aname = a.GetName (false);
+ Assert.AreEqual (new Version (1, 2, 3, 4), aname.Version);
+ Assert.AreEqual ("en", aname.CultureInfo.Name);
+ Assert.IsTrue ((aname.Flags & AssemblyNameFlags.Retargetable) > 0);
+ //Assert.AreEqual (AssemblyHashAlgorithm.SHA256, aname.HashAlgorithm);
+ CheckCattr (a);
+
+ var iface1 = a.GetType ("iface1");
+ var gtype2 = a.GetType ("gtype2");
+
+ var type1 = a.GetType ("type1");
+ Assert.IsNotNull (type1);
+
+ // Type attributes
+ Assert.AreEqual (TypeAttributes.Public|TypeAttributes.SequentialLayout, type1.Attributes);
+ // Interfaces
+ Assert.AreEqual (2, type1.GetInterfaces ().Length);
+ Assert.AreEqual (iface1, type1.GetInterfaces () [0]);
+ Assert.AreEqual (typeof (IComparable), type1.GetInterfaces () [1]);
+ CheckCattr (type1);
+ // FIXME: Class size/packing size
+
+ // Nested types
+ var type_nested = a.GetType ("type1/type_nested");
+ Assert.IsNotNull (type_nested);
+
+ // Generics
+ var gtype1 = a.GetType ("gtype1");
+ Assert.IsTrue (gtype1.IsGenericTypeDefinition);
+ // Generic parameters
+ var gparams = gtype1.GetGenericArguments ();
+ Assert.AreEqual (2, gparams.Length);
+ Assert.AreEqual ("K", gparams [0].Name);
+ Assert.AreEqual ("T", gparams [1].Name);
+ var constraints = gparams [0].GetGenericParameterConstraints ();
+ Assert.AreEqual (2, constraints.Length);
+ Assert.AreEqual (typeof (object), constraints [0]);
+ Assert.AreEqual (typeof (IComparable), constraints [1]);
+ CheckCattr (gparams [0]);
+ constraints = gparams [1].GetGenericParameterConstraints ();
+ Assert.AreEqual (1, constraints.Length);
+ Assert.AreEqual (gtype1, constraints [0]);
+ // Type param encoding
+ var field = gtype1.GetField ("field_gparam");
+ Assert.AreEqual (gparams [0], field.FieldType);
+ field = gtype1.GetField ("field_open");
+ Assert.AreEqual (typeof (List<>).MakeGenericType (new Type [] { gparams [1] }), field.FieldType);
+
+ // Type encoding
+ var t = a.GetType ("type3");
+ Assert.AreEqual (type_nested, t.GetField ("field_nested").FieldType);
+ Assert.AreEqual (typeof (TimeZoneInfo.AdjustmentRule), t.GetField ("field_nested_ref").FieldType);
+ Assert.AreEqual (typeof (int), t.GetField ("field_int").FieldType);
+ Assert.AreEqual (typeof (object[]), t.GetField ("field_array_typeref").FieldType);
+ Assert.AreEqual (type1.MakeArrayType (), t.GetField ("field_szarray").FieldType);
+ var arraytype1 = Array.CreateInstance (typeof (int), new int [] { 10 }, new int [] { 1 }).GetType ();
+ // FIXME:
+ //Assert.AreEqual (arraytype1, t.GetField ("field_non_szarray").FieldType);
+ arraytype1 = Array.CreateInstance (typeof (int), new int [] { 10, 10 }, new int [] { 1, 1 }).GetType ();
+ Assert.AreEqual (arraytype1, t.GetField ("field_multi_dim_array").FieldType);
+ Assert.AreEqual (type1.MakePointerType (), t.GetField ("field_pointer").FieldType);
+ Assert.AreEqual (typeof (List<int>), t.GetField ("field_ginst").FieldType);
+ var ginsttype = gtype2.MakeGenericType (new Type [] { typeof (int), typeof (string) });
+ Assert.AreEqual (ginsttype, t.GetField ("field_ginst_tbuilder").FieldType);
+
+ // Field properties
+ var type4 = a.GetType ("type4");
+ // FIXME: constant
+ field = type4.GetField ("field_int");
+ // FIXME: field offset
+ field = type4.GetField ("field_offset");
+ //var attrs = field.GetCustomAttributes (typeof (FieldOffsetAttribute), true);
+ field = type4.GetField ("field_modopt");
+ var cmods = field.GetRequiredCustomModifiers ();
+ Assert.AreEqual (1, cmods.Length);
+ Assert.AreEqual (typeof (int), cmods [0]);
+ cmods = field.GetOptionalCustomModifiers ();
+ Assert.AreEqual (1, cmods.Length);
+ Assert.AreEqual (typeof (uint), cmods [0]);
+ // FIXME: marshal
+ // Simple marshal
+ field = type4.GetField ("field_marshal1");
+ var attrs = field.GetCustomAttributes (typeof (MarshalAsAttribute), true);
+ Assert.AreEqual (1, attrs.Length);
+ var marshal = attrs [0] as MarshalAsAttribute;
+ Assert.AreEqual (UnmanagedType.U4, marshal.Value);
+ // ByValArray
+ field = type4.GetField ("field_marshal_byval_array");
+ attrs = field.GetCustomAttributes (typeof (MarshalAsAttribute), true);
+ Assert.AreEqual (1, attrs.Length);
+ marshal = attrs [0] as MarshalAsAttribute;
+ Assert.AreEqual (UnmanagedType.ByValArray, marshal.Value);
+ Assert.AreEqual (16, marshal.SizeConst);
+ // ByValTStr
+ field = type4.GetField ("field_marshal_byval_tstr");
+ attrs = field.GetCustomAttributes (typeof (MarshalAsAttribute), true);
+ Assert.AreEqual (1, attrs.Length);
+ marshal = attrs [0] as MarshalAsAttribute;
+ Assert.AreEqual (UnmanagedType.ByValTStr, marshal.Value);
+ Assert.AreEqual (16, marshal.SizeConst);
+#if false
+ // Custom marshaler
+ field = type4.GetField ("field_marshal_custom");
+ attrs = field.GetCustomAttributes (typeof (MarshalAsAttribute), true);
+ Assert.AreEqual (1, attrs.Length);
+ marshal = attrs [0] as MarshalAsAttribute;
+ Assert.AreEqual (UnmanagedType.CustomMarshaler, marshal.Value);
+ Assert.AreEqual (typeof (object), marshal.MarshalTypeRef);
+ Assert.AreEqual ("Cookie", marshal.MarshalCookie);
+#endif
+ field = type4.GetField ("field_cattr");
+ CheckCattr (field);
+
+ // Global fields
+ field = a.ManifestModule.GetField ("data1");
+ Assert.IsNotNull (field);
+ field = a.ManifestModule.GetField ("data2");
+ Assert.IsNotNull (field);
+
+ // Methods and signatures
+ var type_methods = a.GetType ("type_methods");
+ var ctors = type_methods.GetConstructors (BindingFlags.Public|BindingFlags.Static|BindingFlags.Instance);
+ Assert.AreEqual (2, ctors.Length);
+ // .ctor
+ var ctor = type_methods.GetConstructor (new Type[] { typeof (int), typeof (object) });
+ Assert.IsNotNull (ctor);
+ Assert.AreEqual (MethodImplAttributes.NoInlining|MethodImplAttributes.IL, ctor.GetMethodImplementationFlags ());
+ //Assert.AreEqual (CallingConventions.VarArgs, ctor.CallingConvention);
+ // .cctor
+ ctors = type_methods.GetConstructors (BindingFlags.Public|BindingFlags.Static);
+ Assert.AreEqual (1, ctors.Length);
+ // parameters
+ ctor = type_methods.GetConstructor (new Type[] { typeof (int), typeof (object) });
+ Assert.IsNotNull (ctor);
+ var parameters = ctor.GetParameters ();
+ Assert.AreEqual (2, parameters.Length);
+ Assert.AreEqual ("param1", parameters [0].Name);
+ Assert.AreEqual (typeof (int), parameters [0].ParameterType);
+ Assert.AreEqual (ParameterAttributes.HasDefault, parameters [0].Attributes);
+ Assert.AreEqual (16, parameters [0].RawDefaultValue);
+ CheckCattr (parameters [0]);
+ cmods = parameters [0].GetRequiredCustomModifiers ();
+ Assert.AreEqual (1, cmods.Length);
+ Assert.AreEqual (typeof (object), cmods [0]);
+ cmods = parameters [0].GetOptionalCustomModifiers ();
+ Assert.AreEqual (1, cmods.Length);
+ Assert.AreEqual (typeof (int), cmods [0]);
+ Assert.AreEqual ("param2", parameters [1].Name);
+#if false
+ Assert.AreEqual (ParameterAttributes.Out|ParameterAttributes.HasFieldMarshal, parameters [1].Attributes);
+ Assert.AreEqual (typeof (object), parameters [1].ParameterType);
+ attrs = parameters [1].GetCustomAttributes (typeof (MarshalAsAttribute), true);
+ Assert.AreEqual (1, attrs.Length);
+ marshal = attrs [0] as MarshalAsAttribute;
+ Assert.AreEqual (UnmanagedType.U4, marshal.Value);
+#endif
+ // methods
+ var method = type_methods.GetMethod ("method1");
+ Assert.IsNotNull (method);
+ Assert.AreEqual (typeof (int), method.ReturnType);
+ Assert.AreEqual (MethodImplAttributes.NoInlining|MethodImplAttributes.IL, method.GetMethodImplementationFlags ());
+ gparams = gtype1.GetGenericArguments ();
+ Assert.AreEqual (2, gparams.Length);
+ Assert.AreEqual ("K", gparams [0].Name);
+ Assert.AreEqual ("T", gparams [1].Name);
+ constraints = gparams [0].GetGenericParameterConstraints ();
+ Assert.AreEqual (2, constraints.Length);
+ Assert.AreEqual (typeof (object), constraints [0]);
+ Assert.AreEqual (typeof (IComparable), constraints [1]);
+ parameters = method.GetParameters ();
+ // method parameters
+ Assert.AreEqual (2, parameters.Length);
+ Assert.AreEqual ("param1", parameters [0].Name);
+ Assert.AreEqual (typeof (int), parameters [0].ParameterType);
+ Assert.AreEqual (ParameterAttributes.HasDefault, parameters [0].Attributes);
+ Assert.AreEqual (16, parameters [0].RawDefaultValue);
+ cmods = parameters [0].GetRequiredCustomModifiers ();
+ Assert.AreEqual (1, cmods.Length);
+ Assert.AreEqual (typeof (object), cmods [0]);
+ cmods = parameters [0].GetOptionalCustomModifiers ();
+ Assert.AreEqual (1, cmods.Length);
+ Assert.AreEqual (typeof (int), cmods [0]);
+ Assert.AreEqual ("param2", parameters [1].Name);
+#if false
+ Assert.AreEqual (ParameterAttributes.Out|ParameterAttributes.HasFieldMarshal, parameters [1].Attributes);
+ Assert.AreEqual (typeof (object), parameters [1].ParameterType);
+ attrs = parameters [1].GetCustomAttributes (typeof (MarshalAsAttribute), true);
+ Assert.AreEqual (1, attrs.Length);
+ marshal = attrs [0] as MarshalAsAttribute;
+ Assert.AreEqual (UnmanagedType.U4, marshal.Value);
+#endif
+ // return type
+ var rparam = method.ReturnParameter;
+ cmods = rparam.GetRequiredCustomModifiers ();
+ Assert.AreEqual (1, cmods.Length);
+ Assert.AreEqual (typeof (object), cmods [0]);
+ cmods = rparam.GetOptionalCustomModifiers ();
+ Assert.AreEqual (1, cmods.Length);
+ Assert.AreEqual (typeof (int), cmods [0]);
+#if false
+ attrs = rparam.GetCustomAttributes (typeof (MarshalAsAttribute), true);
+ Assert.AreEqual (1, attrs.Length);
+ marshal = attrs [0] as MarshalAsAttribute;
+ Assert.AreEqual (UnmanagedType.U4, marshal.Value);
+#endif
+ CheckCattr (rparam);
+
+ // Properties
+ var type_props = a.GetType ("type_properties");
+ var prop = type_props.GetProperty ("AProperty");
+ Assert.IsNotNull (prop);
+ Assert.AreEqual (PropertyAttributes.HasDefault, prop.Attributes);
+ var getter = prop.GetGetMethod ();
+ Assert.IsNotNull (getter);
+ Assert.AreEqual ("get_method1", getter.Name);
+ var setter = prop.GetSetMethod ();
+ Assert.IsNotNull (setter);
+ Assert.AreEqual ("set_method1", setter.Name);
+ CheckCattr (prop);
+
+ // Events
+ var type_events = a.GetType ("type_events");
+ var ev = type_events.GetEvent ("Event1");
+ Assert.IsNotNull (ev);
+ var m = ev.AddMethod;
+ Assert.IsNotNull (m);
+ Assert.AreEqual ("add_method1", m.Name);
+ m = ev.RemoveMethod;
+ Assert.IsNotNull (m);
+ Assert.AreEqual ("remove_method1", m.Name);
+ m = ev.RaiseMethod;
+ Assert.IsNotNull (m);
+ Assert.AreEqual ("raise_method1", m.Name);
+ Assert.AreEqual (EventAttributes.SpecialName, ev.Attributes);
+ CheckCattr (ev);
+ }
+}
+}
}
}
+ [Test]
+ public void TestEnumWithLateUnderlyingField ()
+ {
+ TypeBuilder enumToCreate = module.DefineType (genTypeName (), TypeAttributes.Public, typeof (Enum));
+ enumToCreate.DefineField ("value__", typeof (Int32),
+ FieldAttributes.Public | FieldAttributes.SpecialName | FieldAttributes.RTSpecialName);
+
+ TypeBuilder enumToCreate2 = module.DefineType (genTypeName (), TypeAttributes.Public, typeof (Enum));
+
+ TypeBuilder ivTypeBld = module.DefineType (genTypeName (), TypeAttributes.Public);
+
+ ConstructorBuilder ivCtor = ivTypeBld.DefineConstructor (MethodAttributes.Public, CallingConventions.Standard, Type.EmptyTypes);
+
+ ILGenerator ctorIL = ivCtor.GetILGenerator ();
+
+ ctorIL.Emit (OpCodes.Ldtoken, typeof (Object));
+ ctorIL.Emit (OpCodes.Pop);
+ ctorIL.Emit (OpCodes.Ldtoken, enumToCreate);
+ ctorIL.Emit (OpCodes.Pop);
+ ctorIL.Emit (OpCodes.Ldtoken, enumToCreate2);
+ ctorIL.Emit (OpCodes.Pop);
+ ctorIL.Emit (OpCodes.Ret);
+
+ var ivType = ivTypeBld.CreateType ();
+
+ enumToCreate2.DefineField ("value__", typeof (Int32), FieldAttributes.Public | FieldAttributes.SpecialName | FieldAttributes.RTSpecialName);
+
+ FieldBuilder fb = enumToCreate2.DefineField ("A", enumToCreate, FieldAttributes.Public | FieldAttributes.Static | FieldAttributes.Literal);
+ fb.SetConstant (0);
+
+ enumToCreate.CreateType ();
+ enumToCreate2.CreateType ();
+ }
+
[Test]
public void TestIsAbstract ()
{
assembly.Save (ASSEMBLY_NAME + ".dll");
}
+
+ [Test]
+ public void TwoAssembliesMidFlightTest () {
+ // Check that one AssemblyBuilder can refer to a TypeBuilder from another AssemblyBuilder.
+ // Regression test for https://bugzilla.xamarin.com/show_bug.cgi?id=58421
+ var name2 = "MonoTests.System.Reflection.Emit.TypeBuilderTest2";
+ var assemblyName2 = new AssemblyName (name2);
+ var assembly2 =
+ Thread.GetDomain ().DefineDynamicAssembly (
+ assemblyName2, AssemblyBuilderAccess.RunAndSave, tempDir);
+
+ var module2 = assembly2.DefineDynamicModule (name2, name2 + ".dll");
+
+ var tb = module.DefineType ("Foo", TypeAttributes.Public);
+ var tb2 = module2.DefineType ("Foo2", TypeAttributes.Public);
+
+ var cb = tb.DefineConstructor (MethodAttributes.Public, CallingConventions.Standard,
+ Type.EmptyTypes);
+
+ var ilg = cb.GetILGenerator ();
+
+ ilg.Emit (OpCodes.Ldtoken, tb2); // N.B. type from the other AssemblyBuilder
+ ilg.Emit (OpCodes.Pop);
+ ilg.Emit (OpCodes.Ret);
+
+ var t = tb.CreateType ();
+ tb2.CreateType ();
+
+ var ci = t.GetConstructor (Type.EmptyTypes);
+ var x = ci.Invoke (null);
+ assembly.Save (ASSEMBLY_NAME + ".dll");
+ assembly2.Save (name2 + ".dll");
+ }
+
}
}
[Test]
public void GetGenericMethodDefinitionOverInflatedMethodOnGTD () {
+ var s = new List<int> () { 1, 2, 3 }.ConvertAll ( i => i.ToString () );
+ Assert.AreEqual (3, s.Count);
var l = typeof (List<>);
var m = l.GetMethod ("ConvertAll");
var infl = m.MakeGenericMethod (typeof (int));
var res = m.GetGenericMethodDefinition ();
Assert.AreEqual (m, res, "#1");
+ Assert.AreEqual (1, infl.GetGenericArguments().Length, "#2");
}
[Test]
<AssemblyName>mscorlib</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
</PropertyGroup>\r
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
<ItemGroup>\r
+ <Compile Include="..\..\..\external\corefx\src\Common\src\System\Collections\Generic\ReferenceEqualityComparer.cs" />\r
<Compile Include="..\..\..\external\corefx\src\System.Collections.Concurrent\src\System\Collections\Concurrent\CDSCollectionETWBCLProvider.cs" />\r
<Compile Include="..\..\..\external\corefx\src\System.Collections.Concurrent\src\System\Collections\Concurrent\ConcurrentDictionary.cs" />\r
<Compile Include="..\..\..\external\corefx\src\System.Collections.Concurrent\src\System\Collections\Concurrent\ConcurrentQueue.cs" />\r
corefx/SR.cs
+../../../external/corefx/src/Common/src/System/Collections/Generic/ReferenceEqualityComparer.cs
+
../../../external/corefx/src/System.Collections/src/System/Collections/Generic/CollectionExtensions.cs
../../../external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/CDSCollectionETWBCLProvider.cs
System.Reflection.Emit/PropertyBuilderTest.cs
System.Reflection.Emit/SignatureHelperTest.cs
System.Reflection.Emit/TypeBuilderTest.cs
+System.Reflection.Emit/SaveTest.cs
System.Reflection/ModuleTest.cs
System.Reflection/StrongNameKeyPairTest.cs
System/ResolveEventArgsTest.cs
--- /dev/null
+../../../external/corefx/src/CoreFx.Private.TestUtilities/src/System/AssertExtensions.cs
+../../../external/corefx/src/Common/tests/System/PlatformDetection.cs
+
+../../../external/corefx/src/System.Reflection.Emit/tests/Utilities.cs
+
+#TODO: audit the commented out tests and fix or disable
+
+#../../../external/corefx/src/System.Reflection.Emit/tests/AssemblyBuilderTests.cs
+# ../../../external/corefx/src/System.Reflection.Emit/tests/
+
+../../../external/corefx/src/System.Reflection.Emit/tests/ConstructorBuilder/ConstructorBuilderDefineParameter.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/ConstructorBuilder/ConstructorBuilderGetILGenerator.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/ConstructorBuilder/ConstructorBuilderInitLocals.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/ConstructorBuilder/ConstructorBuilderSetCustomAttribute.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/ConstructorBuilder/ConstructorBuilderSetImplementationFlags.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/ConstructorBuilder/ConstructorBuilderToString.cs
+
+#../../../external/corefx/src/System.Reflection.Emit/tests/EnumBuilder/EnumBuilder.Methods.Tests.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/EnumBuilder/EnumBuilder.Properties.Tests.cs
+
+../../../external/corefx/src/System.Reflection.Emit/tests/EventBuilder/EventBuilderAddOtherMethod.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/EventBuilder/EventBuilderSetAddOnMethod.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/EventBuilder/EventBuilderSetCustomAttribute.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/EventBuilder/EventBuilderSetRaiseMethod.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/EventBuilder/EventBuilderSetRemoveOnMethod.cs
+
+../../../external/corefx/src/System.Reflection.Emit/tests/FieldBuilder/FieldBuilderGetValue.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/FieldBuilder/FieldBuilderSetConstant.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/FieldBuilder/FieldBuilderSetCustomAttribute.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/FieldBuilder/FieldBuilderSetOffset.cs
+
+../../../external/corefx/src/System.Reflection.Emit/tests/GenericTypeParameterBuilder/GenericTyepParameterBuilderSetBaseTypeConstraint.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/GenericTypeParameterBuilder/GenericTypeParameterBuilderGUID.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/GenericTypeParameterBuilder/GenericTypeParameterBuilderMakeArrayType.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/GenericTypeParameterBuilder/GenericTypeParameterBuilderMakeByRefType.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/GenericTypeParameterBuilder/GenericTypeParameterBuilderMakeGenericType.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/GenericTypeParameterBuilder/GenericTypeParameterBuilderMakePointerType.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/GenericTypeParameterBuilder/GenericTypeParameterBuilderSetCustomAttribute.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/GenericTypeParameterBuilder/GenericTypeParameterBuilderSetGenericParameterAttributes.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/GenericTypeParameterBuilder/GenericTypeParameterBuilderSetInterfaceConstraints.cs
+
+../../../external/corefx/src/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderContainsGenericParameters.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderDefineGenericParameters.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderDefineParameter.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderEquals.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderGetGenericArguments.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderGetGenericMethodDefinition.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderGetHashCode.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderGetILGenerator.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderInitLocals.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderIsGenericMethod.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderMakeGenericMethod.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderReturnParameter.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderSetCustomAttribute.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderSetImplementationFlags.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderSetParameters.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderSetReturnType.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderSetSignature.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderToString.cs
+
+../../../external/corefx/src/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderCreateGlobalFunctions.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderDefineEnum.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderDefineInitializedData.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderDefineType.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderDefineUninitializedData.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderGetArrayMethod.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderSetCustomAttribute.cs
+
+#../../../external/corefx/src/System.Reflection.Emit/tests/PropertyBuilder/PropertyBuilderAddOtherMethod.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/PropertyBuilder/PropertyBuilderAttributes.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/PropertyBuilder/PropertyBuilderCanRead.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/PropertyBuilder/PropertyBuilderCanWrite.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/PropertyBuilder/PropertyBuilderDeclaringType.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/PropertyBuilder/PropertyBuilderGetIndexParameters.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/PropertyBuilder/PropertyBuilderGetValue.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/PropertyBuilder/PropertyBuilderSetConstant.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/PropertyBuilder/PropertyBuilderSetCustomAttribute.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/PropertyBuilder/PropertyBuilderSetGetMethod.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/PropertyBuilder/PropertyBuilderSetSetMethod.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/PropertyBuilder/PropertyBuilderSetValue.cs
+
+#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderAddInterfaceImplementaion.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderAssemblyQualifiedName.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderCreateType.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderCreateTypeInfo.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDeclaringMethod.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineConstructor.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineDefaultConstructor.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineEvent.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineField.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineGenericParameters.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineMethod.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineMethodOverride.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineNestedType.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineProperty.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineTypeInitializer.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderGUID.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderGenericParameterAttributes.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderGenericParameterPosition.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderGetConstructor.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderGetElementType.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderGetField.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderGetGenericTypeDefinition.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderGetMethod.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderIsGenericParameter.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderIsGenericType.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderIsGenericTypeDefinition.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderMakeArrayType.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderMakeByRefType.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderMakeGenericType.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderMakePointerType.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderName.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderNamespace.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderPackingSize.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderSetCustomAttribute.cs
+#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderSetParent.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderSize.cs
+../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderToString.cs
+
System.Reflection.Emit/PropertyBuilderTest.cs
System.Reflection.Emit/SignatureHelperTest.cs
System.Reflection.Emit/TypeBuilderTest.cs
+System.Reflection.Emit/SaveTest.cs
System.Runtime.Remoting/ContextTest.cs
System.Runtime.Remoting/RemotingConfigurationTest.cs
System.Runtime.Remoting/RemotingServicesTest.cs
<AssemblyName>Mono.Cecil</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../mono.snk</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
[assembly:AssemblyVersion("1.0.0.0")]
[assembly:AssemblyDelaySign(true)]
-[assembly:AssemblyKeyFile("../../class/mono.snk")]
LIBRARY = monodoc.dll
LIBRARY_PACKAGE = monodoc
+KEYFILE = ../../class/mono.snk
# Remove a bunch of "obsolete"-type warning for Lucene.NET
# also activate legacy mode to compile old monodoc.dll api
LOCAL_MCS_FLAGS = /nowarn:618,612,672,809,414,649 /define:LEGACY_MODE
<AssemblyName>monodoc</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+ <SignAssembly>true</SignAssembly>\r
+ <AssemblyOriginatorKeyFile>../../class/mono.snk</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
Contract.EndContractBlock();
if( _size > 0) {
+#if MONO
+ ArraySortHelper<T>.Sort(_items, 0, _size, comparison);
+#else
IComparer<T> comparer = new Array.FunctorComparer<T>(comparison);
Array.Sort(_items, 0, _size, comparer);
+#endif
}
}
// Copy over the details we need to save.
m_Exception = exception;
#if MONO
- var count = exception.captured_traces == null ? 0 : exception.captured_traces.Length;
+ var traces = exception.captured_traces;
+ var count = traces == null ? 0 : traces.Length;
var stack_traces = new System.Diagnostics.StackTrace [count + 1];
if (count != 0)
- Array.Copy (exception.captured_traces, 0, stack_traces, 0, count);
+ Array.Copy (traces, 0, stack_traces, 0, count);
stack_traces [count] = new System.Diagnostics.StackTrace (exception, 0, true);
m_stackTrace = stack_traces;
public static class NetworkHelpers
{
+ static Random rndPort = new Random ();
+
public static int FindFreePort ()
{
- TcpListener l = new TcpListener(IPAddress.Loopback, 0);
- l.Start();
- int port = ((IPEndPoint)l.LocalEndpoint).Port;
- l.Stop();
- return port;
+ return LocalEphemeralEndPoint ().Port;
}
+
public static IPEndPoint LocalEphemeralEndPoint ()
{
- return new IPEndPoint (IPAddress.Loopback, FindFreePort());
+ while (true) {
+ var ep = new IPEndPoint (IPAddress.Loopback, rndPort.Next (10000, 60000));
+ var socket = new Socket (ep.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
+
+ try {
+ socket.Bind (ep);
+ socket.Close ();
+ return ep;
+ } catch (SocketException) { }
+ }
}
}
}
Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
}
+ public static void LessOrEqual(long arg1, long arg2, string message = null, params object[] args)
+ {
+ Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
+ }
+
+ public static void LessOrEqual(System.DateTime arg1, System.DateTime arg2, string message = null, params object[] args)
+ {
+ Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
+ }
+
+ public static void LessOrEqual(System.TimeSpan arg1, System.TimeSpan arg2, string message = null, params object[] args)
+ {
+ Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
+ }
+
public static void IsNotInstanceOfType(System.Type expected, object actual, string message, params object[] args )
{
Assert.IsFalse (actual.GetType ().IsInstanceOfType (expected), message, args);
CS7069-lib.dll \
CS8009-lib.dll \
CSFriendAssembly-lib.dll \
- dlls/first/CS1703-lib.dll dlls/first/CS1704-lib.dll \
- dlls/second/CS1703-lib.dll dlls/second/CS1704-lib.dll
+ dlls/first/CS1704-lib.dll \
+ dlls/second/CS1704-lib.dll
-include $(mcs_topdir)/build/config.make
-// CS1525: Unexpected symbol `public', expecting `:', `;', or `{'
+// CS1525: Unexpected symbol `public', expecting `:', `;', `{', or `=>'
// Line: 5
class TorrentEditor {
--- /dev/null
+// CS1621: The yield statement cannot be used inside anonymous method blocks
+// Line: 12
+
+using System;
+using System.Collections;
+
+public class Test
+{
+ public IEnumerator Foo ()
+ {
+ Call (() => {
+ yield break;
+ });
+
+ yield break;
+ }
+
+ void Call (Action a)
+ {
+ }
+}
\ No newline at end of file
// CS1703: An assembly `System' with the same identity has already been imported. Consider removing one of the references
// Line: 0
-// Compiler options: -r:../class/lib/build/System.dll
+// Compiler options: -r:../../external/binary-reference-assemblies/v2.0/System.dll
+++ /dev/null
-// CS1703: An assembly `CS1703-lib' with the same identity has already been imported. Consider removing one of the references
-// Line: 0
-// Compiler options: -r:dlls/first/CS1703-lib.dll -r:dlls/second/CS1703-lib.dll
-
+++ /dev/null
-[assembly:System.Reflection.AssemblyVersionAttribute ("1.1.1.0")]
-
-public class A
-{
-}
+++ /dev/null
-[assembly:System.Reflection.AssemblyVersionAttribute ("1.2.1.0")]
-
-public class A
-{
-}
<AssemblyName>ilasm</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
{
GetFieldExpression (ec).EmitAssign (ec, source, leave_copy, false);
}
+
+ public void EmitAssignFromStack (EmitContext ec)
+ {
+ GetFieldExpression (ec).EmitAssignFromStack (ec);
+ }
}
public class HoistedParameter : HoistedVariable
Emit (ec, false, false);
}
+ public void EmitPrepare (EmitContext ec)
+ {
+ foreach (var a in args) {
+ a.Expr.EmitPrepare (ec);
+ }
+ }
+
//
// if `dup_args' is true or any of arguments contains await.
// A copy of all arguments will be returned to the caller
var tupleLiteralElements = (source as TupleLiteral)?.Elements;
for (int i = 0; i < targetType.Arity; ++i) {
- var elementType = srcTypeArgument [i];
-
if (tupleLiteralElements != null) {
if (!ImplicitStandardConversionExists (tupleLiteralElements[i].Expr, targetTypeArgument [i])) {
return false;
// Was added earlier in the case of body being eof for full ast
}
- method_body_expression_block
+ method_body
{
Method method = (Method) $1;
method.Block = (ToplevelBlock) $3;
}
;
-method_body_expression_block
- : method_body
- | expression_block
- ;
-
method_body
: block
+ | expression_block
| SEMICOLON { $$ = null; }
;
+destructor_body
+ : method_body
+ ;
+
+constructor_body
+ : block_prepared
+ | SEMICOLON { current_block = null; $$ = null; }
+ | ARROW
+ {
+ if (lang_version < LanguageVersion.V_7) {
+ FeatureIsNotAvailable (GetLocation ($1), "expression body constructor");
+ }
+
+ ++lexer.parsing_block;
+ }
+ expression SEMICOLON
+ {
+ lexer.parsing_block = 0;
+ current_block.AddStatement (new ContextualReturn ((Expression) $3));
+ var b = end_block (GetLocation ($4));
+ b.IsCompilerGenerated = true;
+ $$ = b;
+ current_block = null;
+ }
+ ;
+
expression_block
: ARROW
{
: opt_attributes opt_modifiers operator_declarator
{
}
- method_body_expression_block
+ method_body
{
OperatorDeclaration decl = (OperatorDeclaration) $3;
if (decl != null) {
}
;
-constructor_body
- : block_prepared
- | SEMICOLON { current_block = null; $$ = null; }
- ;
-
opt_constructor_initializer
: /* Empty */
| constructor_initializer
current_local_parameters = ParametersCompiled.EmptyReadOnlyParameters;
}
- IDENTIFIER OPEN_PARENS CLOSE_PARENS method_body
+ IDENTIFIER OPEN_PARENS CLOSE_PARENS destructor_body
{
var lt = (LocatedToken) $5;
if (lt.Value != current_container.MemberName.Name){
}
| additive_expression IS pattern_type_expr opt_identifier
{
- var is_expr = new Is ((Expression) $1, (Expression) $3, GetLocation ($2));
+ var is_expr = new Is ((Expression) $1, ((FullNamedExpression) $3), GetLocation ($2));
if ($4 != null) {
if (lang_version < LanguageVersion.V_7)
FeatureIsNotAvailable (GetLocation ($4), "pattern matching");
lbag.AddLocation ($$, GetLocation ($3));
}
*/
+
+ | CASE pattern_type_expr IDENTIFIER COLON
+ {
+ if (lang_version < LanguageVersion.V_7)
+ FeatureIsNotAvailable (GetLocation ($1), "pattern matching");
+
+// $$ = new SwitchLabel ((FullNamedExpression) $2), GetLocation ($1)) {
+// PatternMatching = true
+// };
+
+ throw new NotImplementedException ("type pattern matching");
+ }
| DEFAULT_COLON
{
$$ = new SwitchLabel (null, GetLocation ($1));
public override void FlowAnalysis (FlowAnalysisContext fc)
{
- expr.FlowAnalysis (fc);
+ orig_expr.FlowAnalysis (fc);
+ }
+
+ public override void FlowAnalysisConditional (FlowAnalysisContext fc)
+ {
+ orig_expr.FlowAnalysisConditional (fc);
}
public override SLE.Expression MakeExpression (BuilderContext ctx)
throw new NotSupportedException ();
}
+ public override void EmitPrepare (EmitContext ec)
+ {
+ InstanceExpression?.EmitPrepare (ec);
+ }
+
public void EmitCall (EmitContext ec, Arguments arguments, bool statement)
{
var call = new CallEmitter ();
using System.Reflection;
#endif
-namespace Mono.CSharp {
+namespace Mono.CSharp
+{
public class EnumMember : Const
{
+#if !STATIC
+ class MemberTypeDelegator : TypeDelegator
+ {
+ Type underlyingType;
+
+ public MemberTypeDelegator (Type delegatingType, Type underlyingType)
+ : base (delegatingType)
+ {
+ this.underlyingType = underlyingType;
+ }
+
+ public override Type GetEnumUnderlyingType ()
+ {
+ return underlyingType;
+ }
+
+ public override Type UnderlyingSystemType {
+ get {
+ return underlyingType;
+ }
+ }
+ }
+#endif
+
class EnumTypeExpr : TypeExpr
{
public override TypeSpec ResolveAsType (IMemberContext ec, bool allowUnboundTypeArguments)
if (!ResolveMemberType ())
return false;
+ MetaType ftype = MemberType.GetMetaInfo ();
+#if !STATIC
+ //
+ // Workaround for .net SRE limitation which cannot define field of unbaked enum type
+ // which is how all enums are declared
+ //
+ ftype = new MemberTypeDelegator (ftype, ((Enum)Parent).UnderlyingType.GetMetaInfo ());
+#endif
+
const FieldAttributes attr = FieldAttributes.Public | FieldAttributes.Static | FieldAttributes.Literal;
- FieldBuilder = Parent.TypeBuilder.DefineField (Name, MemberType.GetMetaInfo (), attr);
+ FieldBuilder = Parent.TypeBuilder.DefineField (Name, ftype, attr);
spec = new ConstSpec (Parent.Definition, this, MemberType, FieldBuilder, ModFlags, initializer);
Parent.MemberCache.AddMember (spec);
ec.Emit (OpCodes.Dup);
no_value_label = ec.DefineLabel ();
ec.Emit (OpCodes.Brfalse_S, no_value_label);
+
+ if (Variable.HoistedVariant != null)
+ ec.EmitThis ();
+
expr_unwrap.Emit (ec);
} else {
+ if (Variable?.HoistedVariant != null)
+ ec.EmitThis ();
+
expr.Emit (ec);
// Only to make verifier happy
value_on_stack = false;
}
- //
- // It's ok to have variable builder create out of order. It simplified emit
- // of statements like while (condition) { }
- //
- if (!Variable.Created)
- Variable.CreateBuilder (ec);
-
- Variable.EmitAssign (ec);
+ if (Variable.HoistedVariant != null) {
+ Variable.HoistedVariant.EmitAssignFromStack (ec);
- if (expr_unwrap != null) {
- ec.MarkLabel (no_value_label);
- } else if (!value_on_stack) {
- Variable.Emit (ec);
+ if (expr_unwrap != null) {
+ ec.MarkLabel (no_value_label);
+ } else if (!value_on_stack) {
+ Variable.HoistedVariant.Emit (ec);
+ }
+ } else {
+ //
+ // It's ok to have variable builder created out of order. It simplifies emit
+ // of statements like while (condition) { }
+ //
+ if (!Variable.Created)
+ Variable.CreateBuilder (ec);
+
+ Variable.EmitAssign (ec);
+
+ if (expr_unwrap != null) {
+ ec.MarkLabel (no_value_label);
+ } else if (!value_on_stack) {
+ Variable.Emit (ec);
+ }
}
}
}
public void AddressOf (EmitContext ec, AddressOp mode)
{
- Variable.CreateBuilder (ec);
+ if (!Variable.Created)
+ Variable.CreateBuilder (ec);
if (Initializer != null) {
lvr.EmitAssign (ec, Initializer, false, false);
{
throw new NotImplementedException ();
}
+
+ public override void EmitPrepare (EmitContext ec)
+ {
+ Variable.CreateBuilder (ec);
+ }
}
//
else
mg.EmitCall (ec, arguments, false);
}
-
+
+ public override void EmitPrepare (EmitContext ec)
+ {
+ mg.EmitPrepare (ec);
+
+ arguments?.EmitPrepare (ec);
+ }
+
public override void EmitStatement (EmitContext ec)
{
if (mg.IsConditionallyExcluded)
return null;
}
- if ((an.Flags & AssemblyNameFlags.PublicKey) == (loaded_name.Flags & AssemblyNameFlags.PublicKey)) {
- compiler.Report.SymbolRelatedToPreviousError (entry.Item2);
- compiler.Report.SymbolRelatedToPreviousError (fileName);
- compiler.Report.Error (1703,
- "An assembly `{0}' with the same identity has already been imported. Consider removing one of the references",
- an.Name);
- return null;
+ AssemblyComparisonResult result;
+ if ((an.Flags & AssemblyNameFlags.PublicKey) == (loaded_name.Flags & AssemblyNameFlags.PublicKey) &&
+ (domain.CompareAssemblyIdentity (an.FullName, false, loaded_name.FullName, false, out result))) {
+
+ //
+ // Roslyn is much more lenient than native compiler here
+ //
+ switch (result) {
+ case AssemblyComparisonResult.EquivalentFXUnified:
+ case AssemblyComparisonResult.EquivalentUnified:
+ compiler.Report.SymbolRelatedToPreviousError (entry.Item2);
+ compiler.Report.SymbolRelatedToPreviousError (fileName);
+ compiler.Report.Error (1703,
+ "An assembly `{0}' with the same identity has already been imported. Consider removing one of the references",
+ an.Name);
+ return null;
+ }
}
}
protected override void CloneTo (CloneContext clonectx, Statement target)
{
- throw new NotSupportedException ();
}
protected override bool DoResolve (BlockContext bc)
<AssemblyName>mcs</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
if (new_implementation) {
MemberFilter filter;
- if (mi.Parameters.Count > 1) {
- var indexer_params = mi.Name [0] == 'g' ? mi.Parameters : IndexerSpec.CreateParametersFromSetter (mi, mi.Parameters.Count - 1);
- filter = new MemberFilter (MemberCache.IndexerNameAlias, 0, MemberKind.Indexer, indexer_params, null);
+ bool getter = mi.Name [0] == 'g';
+ if (mi.Parameters.Count > (getter ? 0 : 1)) {
+ var indexer_params = getter ? mi.Parameters : IndexerSpec.CreateParametersFromSetter (mi, mi.Parameters.Count - 1);
+ var ptype = getter ? mi.ReturnType : mi.Parameters.Types [mi.Parameters.Count - 1];
+ filter = new MemberFilter (MemberCache.IndexerNameAlias, 0, MemberKind.Indexer, indexer_params, ptype);
} else {
var pname = mi.Name.Substring (4);
- filter = MemberFilter.Property (pname, null);
+ var ptype = getter ? mi.ReturnType : mi.Parameters.Types [0];
+ filter = MemberFilter.Property (pname, ptype);
}
var prop = MemberCache.FindMember (container.CurrentType, filter, BindingRestriction.DeclaredOnly | BindingRestriction.InstanceOnly);
<AssemblyName>nunit.util</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../nunit.snk</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<AssemblyName>nunit-console</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>nunit-console-runner</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../nunit.snk</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<AssemblyName>nunit.core</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../nunit.snk</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<AssemblyName>nunit.core.interfaces</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../nunit.snk</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<AssemblyName>nunit.core.extensions</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../nunit.snk</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<AssemblyName>nunit.framework.extensions</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../nunit.snk</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<AssemblyName>nunit.framework</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../nunit.snk</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<AssemblyName>nunit.mocks</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../nunit.snk</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
--- /dev/null
+interface IA
+{
+ int Prop { get; }
+ int this [int arg] { get; }
+}
+
+abstract class B : IA
+{
+ public long Prop => 4;
+
+ int IA.Prop => 1;
+
+ public long this [int arg] => 2;
+
+ int IA.this [int arg] => 4;
+}
+
+class C : B, IA
+{
+ public static void Main ()
+ {
+ }
+
+ public new string Prop {
+ get { return ""; }
+ }
+
+ public new string this [int arg] => "2";
+}
\ No newline at end of file
--- /dev/null
+class X
+{
+ void Test (string arg)
+ {
+ while (Call (out string s))
+ {
+ arg = s.ToString ();
+ }
+ }
+
+ static bool Call (out string s)
+ {
+ s = "";
+ return true;
+ }
+
+ public static void Main ()
+ {
+ Call (out string s);
+ }
+}
\ No newline at end of file
--- /dev/null
+// Introduced in C#7
+
+class VV
+{
+ VV () => Test ();
+
+ ~VV () => Test ();
+
+ void Test ()
+ {
+ }
+
+ public static void Main ()
+ {
+ }
+}
\ No newline at end of file
--- /dev/null
+using System.Collections.Generic;
+
+class Expr
+{
+ public int Field;
+ public Expr Next;
+}
+
+static class X
+{
+ public static IEnumerable<int> Test (this Expr expr)
+ {
+ var exprCur = expr;
+ while (exprCur != null)
+ {
+ if (exprCur is Expr list)
+ {
+ yield return list.Field;
+ exprCur = list.Next;
+ }
+ else
+ {
+ yield return 2;
+ yield break;
+ }
+ }
+ }
+
+ public static void Main ()
+ {
+ }
+}
\ No newline at end of file
--- /dev/null
+using System.Collections.Generic;
+
+class Expr
+{
+ public int Field;
+}
+
+static class X
+{
+ public static IEnumerable<int> Test (Expr expr)
+ {
+ object exprCur = expr;
+ if (exprCur is Expr list) {
+ yield return list.Field;
+ }
+ }
+
+ public static IEnumerable<string> Test2 (int? expr)
+ {
+ int? exprCur = expr;
+ while (exprCur != null) {
+ if (exprCur is int list) {
+ yield return list.ToString ();
+ }
+ }
+ }
+
+ public static void Main ()
+ {
+ Test (null);
+ Test2 (3);
+ }
+}
\ No newline at end of file
</method>
</type>
</test>
+ <test name="test-947.cs">
+ <type name="B">
+ <method name="Int64 get_Prop()" attrs="2182">
+ <size>10</size>
+ </method>
+ <method name="Int32 IA.get_Prop()" attrs="2529">
+ <size>9</size>
+ </method>
+ <method name="Int64 get_Item(Int32)" attrs="2182">
+ <size>10</size>
+ </method>
+ <method name="Int32 IA.get_Item(Int32)" attrs="2529">
+ <size>9</size>
+ </method>
+ <method name="Void .ctor()" attrs="6276">
+ <size>7</size>
+ </method>
+ </type>
+ <type name="C">
+ <method name="Void Main()" attrs="150">
+ <size>2</size>
+ </method>
+ <method name="System.String get_Prop()" attrs="2182">
+ <size>14</size>
+ </method>
+ <method name="System.String get_Item(Int32)" attrs="2182">
+ <size>13</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
<test name="test-95.cs">
<type name="X">
<method name="Int32 Main()" attrs="150">
</method>
</type>
</test>
+ <test name="test-decl-expr-05.cs">
+ <type name="X">
+ <method name="Void Test(System.String)" attrs="129">
+ <size>29</size>
+ </method>
+ <method name="Boolean Call(System.String ByRef)" attrs="145">
+ <size>17</size>
+ </method>
+ <method name="Void Main()" attrs="150">
+ <size>10</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
<test name="test-dictinit-01.cs">
<type name="Program">
<method name="Int32 Main()" attrs="145">
</method>
</type>
</test>
+ <test name="test-expression-bodied-04.cs">
+ <type name="VV">
+ <method name="Void Finalize()" attrs="196">
+ <size>19</size>
+ </method>
+ <method name="Void Test()" attrs="129">
+ <size>2</size>
+ </method>
+ <method name="Void Main()" attrs="150">
+ <size>2</size>
+ </method>
+ <method name="Void .ctor()" attrs="6273">
+ <size>13</size>
+ </method>
+ </type>
+ </test>
<test name="test-externalias-01.cs">
<type name="Test">
<method name="Int32 Main()" attrs="150">
</method>
</type>
</test>
+ <test name="test-pattern-08.cs">
+ <type name="Expr">
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ <type name="X">
+ <method name="System.Collections.Generic.IEnumerable`1[System.Int32] Test(Expr)" attrs="150">
+ <size>30</size>
+ </method>
+ <method name="Void Main()" attrs="150">
+ <size>2</size>
+ </method>
+ </type>
+ <type name="X+<Test>c__Iterator0">
+ <method name="Boolean MoveNext()" attrs="486">
+ <size>184</size>
+ </method>
+ <method name="Int32 System.Collections.Generic.IEnumerator<int>.get_Current()" attrs="2529">
+ <size>14</size>
+ </method>
+ <method name="System.Object System.Collections.IEnumerator.get_Current()" attrs="2529">
+ <size>19</size>
+ </method>
+ <method name="Void Dispose()" attrs="486">
+ <size>15</size>
+ </method>
+ <method name="Void Reset()" attrs="486">
+ <size>6</size>
+ </method>
+ <method name="System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">
+ <size>14</size>
+ </method>
+ <method name="System.Collections.Generic.IEnumerator`1[System.Int32] System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">
+ <size>40</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
+ <test name="test-pattern-09.cs">
+ <type name="Expr">
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ <type name="X">
+ <method name="System.Collections.Generic.IEnumerable`1[System.Int32] Test(Expr)" attrs="150">
+ <size>30</size>
+ </method>
+ <method name="System.Collections.Generic.IEnumerable`1[System.String] Test2(System.Nullable`1[System.Int32])" attrs="150">
+ <size>30</size>
+ </method>
+ <method name="Void Main()" attrs="150">
+ <size>21</size>
+ </method>
+ </type>
+ <type name="X+<Test>c__Iterator0">
+ <method name="Boolean MoveNext()" attrs="486">
+ <size>124</size>
+ </method>
+ <method name="Int32 System.Collections.Generic.IEnumerator<int>.get_Current()" attrs="2529">
+ <size>14</size>
+ </method>
+ <method name="System.Object System.Collections.IEnumerator.get_Current()" attrs="2529">
+ <size>19</size>
+ </method>
+ <method name="Void Dispose()" attrs="486">
+ <size>15</size>
+ </method>
+ <method name="Void Reset()" attrs="486">
+ <size>6</size>
+ </method>
+ <method name="System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">
+ <size>14</size>
+ </method>
+ <method name="System.Collections.Generic.IEnumerator`1[System.Int32] System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">
+ <size>40</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ <type name="X+<Test2>c__Iterator1">
+ <method name="Boolean MoveNext()" attrs="486">
+ <size>161</size>
+ </method>
+ <method name="System.String System.Collections.Generic.IEnumerator<string>.get_Current()" attrs="2529">
+ <size>14</size>
+ </method>
+ <method name="System.Object System.Collections.IEnumerator.get_Current()" attrs="2529">
+ <size>14</size>
+ </method>
+ <method name="Void Dispose()" attrs="486">
+ <size>15</size>
+ </method>
+ <method name="Void Reset()" attrs="486">
+ <size>6</size>
+ </method>
+ <method name="System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">
+ <size>14</size>
+ </method>
+ <method name="System.Collections.Generic.IEnumerator`1[System.String] System.Collections.Generic.IEnumerable<string>.GetEnumerator()" attrs="481">
+ <size>40</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
<test name="test-pragma-unrecognized.cs">
<type name="C">
<method name="Void Main()" attrs="150">
build_SUBDIRS = resgen gacutil security culevel cil-stringreplacer commoncryptogenerator resx2sr linker
net_4_5_SUBDIRS = gacutil
+net_4_x_SUBDIRS = gacutil
net_4_5_PARALLEL_SUBDIRS = $(net_4_5_dirs)
+net_4_x_PARALLEL_SUBDIRS = $(net_4_5_dirs)
SUBDIRS = $(build_SUBDIRS) $(net_4_5_dirs)
<AssemblyName>al</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>browsercaps-updater</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>cccheck</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>ccrewrite</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>mono-cil-strip</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>compiler-tester</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>mono-api-info</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>csharp</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AppDesignerFolder>Properties</AppDesignerFolder>\r
<RootNamespace>csharp</RootNamespace>\r
<AssemblyName>csharp</AssemblyName>\r
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
+ <TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
<FileUpgradeFlags>\r
</FileUpgradeFlags>\r
<SchemaVersion>2.0</SchemaVersion>\r
<ProjectGuid>{ED867AC1-079C-4B5E-ADF9-E7722053B360}</ProjectGuid>\r
<OutputType>Exe</OutputType>\r
- <NoWarn>1699,1699</NoWarn>\r
+ <NoWarn>1699</NoWarn>\r
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Windows_NT'">win32</HostPlatform>\r
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Unix' and $([System.IO.File]::Exists('/usr/lib/libc.dylib'))">darwin</HostPlatform>\r
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Unix'">linux</HostPlatform>\r
<AssemblyName>culevel</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
- <NoWarn>1699,1699</NoWarn>\r
+ <NoWarn>1699</NoWarn>\r
<Optimize>false</Optimize>\r
- <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS</DefineConstants>\r
+ <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
<DebugType>pdbonly</DebugType>\r
- <NoWarn>1699,1699</NoWarn>\r
+ <NoWarn>1699</NoWarn>\r
<Optimize>true</Optimize>\r
- <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS</DefineConstants>\r
+ <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
<AssemblyName>disco</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>dtd2rng</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>dtd2xsd</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>gacutil</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>genxs</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>ictool</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>ikdasm</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>installutil</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>installvst</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>lc</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>linkeranalyzer</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<SchemaVersion>2.0</SchemaVersion>\r
<ProjectGuid>{FA920637-C202-4E75-AC0F-1A8DBD631DF1}</ProjectGuid>\r
<OutputType>Exe</OutputType>\r
- <NoWarn>1699,1699</NoWarn>\r
+ <NoWarn>1699</NoWarn>\r
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Windows_NT'">win32</HostPlatform>\r
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Unix' and $([System.IO.File]::Exists('/usr/lib/libc.dylib'))">darwin</HostPlatform>\r
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Unix'">linux</HostPlatform>\r
<AssemblyName>monolinker</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
- <NoWarn>1699,1699</NoWarn>\r
+ <NoWarn>1699</NoWarn>\r
<Optimize>false</Optimize>\r
- <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS</DefineConstants>\r
+ <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
<DebugType>pdbonly</DebugType>\r
- <NoWarn>1699,1699</NoWarn>\r
+ <NoWarn>1699</NoWarn>\r
<Optimize>true</Optimize>\r
- <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS</DefineConstants>\r
+ <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
<AssemblyName>macpack</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>mconfig</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>mdb2ppdb</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>mdbrebase</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
DIFF_QUIET = diff --brief -Z
endif
+ifdef MCS_MODE
+DIFF = echo "WARNING: running in mcs mode, tests are specific to roslyn and would fail. Skipping diff check."
+DIFF_QUIET = $(DIFF)
+endif
+
dist-local: dist-default dist-tests
dist-tests:
<AssemblyName>mdoc</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>mkbundle</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>mod</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
change.Append (paramSourceType);
}
change.Append (" ");
- if (paramSourceName != paramTargetName) {
+ if (!State.IgnoreParameterNameChanges && paramSourceName != paramTargetName) {
change.AppendModified (paramSourceName, paramTargetName, true);
} else {
change.Append (paramSourceName);
}
change.Append (")");
-
- // Ignore any parameter name changes if requested.
- if (State.IgnoreParameterNameChanges && !change.Breaking) {
- change.AnyChange = false;
- change.HasIgnoredChanges = true;
- }
}
void RenderVTable (MethodAttributes source, MethodAttributes target, ApiChange change)
<AssemblyName>mono-api-html</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>mono-configuration-crypto</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>Mono.Configuration.Crypto</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>mono-service</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../class/mono.snk</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<AssemblyName>mono-shlib-cop</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
exit 1; \
fi
+ifdef MCS_MODE
+CHECK_DIFF = @echo "WARNING: running in mcs mode, tests are specific to roslyn and would fail. Skipping diff check."
+endif
+
PREPARE_OUTDIR = @\
rm -rf $(OUT_DIR); \
mkdir -p $(OUT_DIR); \
$(MONO) $(LIB_PATH)/$(PROGRAM) store-symbols $(MSYM_DIR) $(OUT_DIR); \
$(MONO) $(LIB_PATH)/$(PROGRAM) store-symbols $(MSYM_DIR) $(LIB_PATH);
-check: test-local
+check: run-test
AOT_SUPPORTED = $(shell $(MONO) --aot 2>&1 | grep -q "AOT compilation is not supported" && echo 0 || echo 1)
-test-local: test-without-aot test-with-aot test-with-aot-msym
+run-test-local: run-test-without-aot run-test-with-aot run-test-with-aot-msym
-test-without-aot: OUT_DIR = Test/without_aot
-test-without-aot: all
+run-test-without-aot: OUT_DIR = Test/without_aot
+run-test-without-aot: all
@echo "Checking $(TEST_EXE) without AOT in $(OUT_DIR)"
$(PREPARE_OUTDIR)
$(COMPILE)
$(CHECK_DIFF)
-test-with-aot: OUT_DIR = Test/with_aot
-test-with-aot: all
+run-test-with-aot: OUT_DIR = Test/with_aot
+run-test-with-aot: all
ifeq ($(AOT_SUPPORTED), 1)
@echo "Checking $(TEST_EXE) with AOT in $(OUT_DIR)"
$(PREPARE_OUTDIR)
$(CHECK_DIFF)
endif
-test-with-aot-msym: OUT_DIR = Test/with_aot_msym
-test-with-aot-msym: all
+run-test-with-aot-msym: OUT_DIR = Test/with_aot_msym
+run-test-with-aot-msym: all
ifeq ($(AOT_SUPPORTED), 1)
@echo "Checking $(TEST_EXE) with AOT (using .msym) in $(OUT_DIR)"
$(PREPARE_OUTDIR)
<AssemblyName>mono-symbolicate</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>mono-xmltool</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>xsd</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>monop</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>nunitreport</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>pdb2mdb</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<SchemaVersion>2.0</SchemaVersion>\r
<ProjectGuid>{647DC12E-A4EE-424A-9EC7-CE6643EE2EF7}</ProjectGuid>\r
<OutputType>Exe</OutputType>\r
- <NoWarn>1699,1699</NoWarn>\r
+ <NoWarn>1699</NoWarn>\r
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Windows_NT'">win32</HostPlatform>\r
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Unix' and $([System.IO.File]::Exists('/usr/lib/libc.dylib'))">darwin</HostPlatform>\r
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Unix'">linux</HostPlatform>\r
<AssemblyName>resgen</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
- <NoWarn>1699,1699</NoWarn>\r
+ <NoWarn>1699</NoWarn>\r
<Optimize>false</Optimize>\r
- <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS</DefineConstants>\r
+ <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
<DebugType>pdbonly</DebugType>\r
- <NoWarn>1699,1699</NoWarn>\r
+ <NoWarn>1699</NoWarn>\r
<Optimize>true</Optimize>\r
- <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS</DefineConstants>\r
+ <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
<AssemblyName>sgen</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>soapsuds</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>sqlmetal</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<SignAssembly>true</SignAssembly>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
<AssemblyOriginatorKeyFile>../../class/System.Data.Linq/src/DbMetal/../DbLinq.snk</AssemblyOriginatorKeyFile>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<AssemblyName>sqlsharp</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>svcutil</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
<AssemblyName>wsdl</AssemblyName>\r
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+\r
</PropertyGroup>\r
- \r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
XBUILD_DIR=.
include $(XBUILD_DIR)/xbuild_test.make
-ifeq (4.0, $(FRAMEWORK_VERSION))
-install-local: xbuild-net4-fail
-else
install-local: install-extras
-endif
PORTABLE_TARGETS_SRC:=data/Portable/Targets
PCL5_FX_SRC:=data/Portable/Frameworks/v5.0
export MSBuildExtensionsPath=$(XBUILD_DATA_DIR)
export XBUILD_FRAMEWORK_FOLDERS_PATH= $(topdir)/class/Microsoft.Build/xbuild-testing
-ifeq (4.0, $(FRAMEWORK_VERSION))
-NO_TEST=true
-else
test-local: copy-targets Test/test-config-file-$(PROFILE)
clean-local: clean-targets clean-test-config
-endif
-
-xbuild-net4-fail:
- @echo "The net_4_0 profile contains reference assemblies only and cannot be installed/tested as an xbuild toolset"
- @exit 1
Test/test-config-file-$(PROFILE): $(XBUILD_DATA_DIR)/xbuild.exe.config_test.in
sed -e 's/@ASM_VERSION@/$(XBUILD_ASSEMBLY_VERSION)/g' $(XBUILD_DATA_DIR)/xbuild.exe.config_test.in > Test/test-config-file-$(PROFILE)
endif
if CROSS_COMPILING
-SUBDIRS = $(btls_dirs) arch utils cil metadata $(sgen_dirs) mini dis profiler
+SUBDIRS = $(btls_dirs) eglib arch utils cil metadata $(sgen_dirs) mini dis profiler
else
if INSTALL_MONOTOUCH
-SUBDIRS = $(btls_dirs) arch utils metadata $(sgen_dirs) mini profiler
+SUBDIRS = $(btls_dirs) eglib arch utils metadata $(sgen_dirs) mini profiler
monotouch-do-build:
@list='$(SUBDIRS)'; for subdir in $$list; do \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$target); \
done;
else
-SUBDIRS = $(btls_dirs) arch utils cil metadata $(sgen_dirs) mini dis tests unit-tests benchmark profiler
+SUBDIRS = $(btls_dirs) eglib arch utils cil metadata $(sgen_dirs) mini dis tests unit-tests benchmark profiler
endif
endif
-DIST_SUBDIRS = btls arch utils cil metadata $(sgen_dirs) mini dis tests unit-tests benchmark profiler
+DIST_SUBDIRS = btls eglib arch utils cil metadata $(sgen_dirs) mini dis tests unit-tests benchmark profiler
enable_language(C)
enable_language(CXX)
+find_program(CCACHE_PROGRAM ccache)
+if(CCACHE_PROGRAM)
+ set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
+endif()
+
# FIXME: cmake's asm detection is broken when using xcrun.
set (CMAKE_ASM_COMPILER "${CMAKE_C_COMPILER}")
set (CMAKE_ASM_COMPILER_ARG1 "${CMAKE_C_COMPILER_ARG1}")
set (CMAKE_MACOSX_RPATH 1)
set (MONO_BTLS 1)
+set(BUILD_SHARED_LIBS_SAVED "${BUILD_SHARED_LIBS}")
+set(BUILD_SHARED_LIBS OFF)
add_subdirectory (${BTLS_ROOT} boringssl)
+set(BUILD_SHARED_LIBS "${BUILD_SHARED_LIBS_SAVED}")
include_directories (
${SRC_DIR}
CMAKE_VERBOSE=$(if $(V),VERBOSE=1,)
+if NINJA
+NINJA_ARGS = -G Ninja
+BUILDFILE = build.ninja
+else
+NINJA_ARGS =
+BUILDFILE = Makefile
+endif
+
CMAKE_ARGS = -D CMAKE_INSTALL_PREFIX:PATH=$(prefix) -D BTLS_ROOT:PATH=$(BTLS_ROOT) \
- -D SRC_DIR:PATH=$(abs_top_srcdir)/mono/btls -D BTLS_CFLAGS:STRING="$(BTLS_CFLAGS)"
+ -D SRC_DIR:PATH=$(abs_top_srcdir)/mono/btls -D BTLS_CFLAGS:STRING="$(BTLS_CFLAGS)" $(NINJA_ARGS)
all-local: build-shared/libmono-btls-shared$(libsuffix)
-build-shared/Makefile:
+build-shared/$(BUILDFILE):
-mkdir -p build-shared
(cd build-shared && CC="$(CC)" CXX="$(CXX)" $(CMAKE) $(CMAKE_ARGS) $(BTLS_CMAKE_ARGS) -DBUILD_SHARED_LIBS=1 $(abs_top_srcdir)/mono/btls)
-build-shared/libmono-btls-shared$(libsuffix): build-shared/Makefile $(MONO_BTLS_SOURCES_FILES)
+if NINJA
+build-shared/libmono-btls-shared$(libsuffix): build-shared/$(BUILDFILE) $(MONO_BTLS_SOURCES_FILES)
+ ninja -C build-shared $(CMAKE_VERBOSE)
+else
+build-shared/libmono-btls-shared$(libsuffix): build-shared/$(BUILDFILE) $(MONO_BTLS_SOURCES_FILES)
$(MAKE) -C build-shared $(CMAKE_VERBOSE)
+endif
clean-local:
-rm -rf build-shared
+++ /dev/null
-#!/bin/sh
-
-DIR=$1; shift
-FILELIST=$1; shift
-LOFILELIST=$1 ; shift
-TARGET=$1; shift
-STATIC=$1; shift
-AR=$1; shift
-RANLIB=$1; shift
-
-HEADER="# Generated by Martin's tool $0, not libtool"
-
-test -f $TARGET && exit 0
-
-rm -f $FILELIST
-rm -f $LOFILELIST
-
-while [ "$1" != "--" ]; do
- file=$1; shift
- filename=`basename $file`
- LOFILE=$file.lo
- echo "$HEADER" > $LOFILE
- if [ "$STATIC" = "static" ]; then
- echo "non_pic_object='$filename'" >> $LOFILE
- else
- echo "pic_object='$filename'" >> $LOFILE
- fi
- echo "$DIR/$file " >> $FILELIST
- echo "$DIR/$LOFILE " >> $LOFILELIST
-done
-
-(cd $DIR && $AR cr $TARGET `cat $FILELIST` && $RANLIB $TARGET)
-
g_free (meth_str);
return ret;
} else {
- char *meth_str = get_method_core (m, decl, FALSE, container);
- char *ret = g_strdup_printf ("Could not decode method override %s due to %s", meth_str, mono_error_get_message (&error));
+ if (!mono_error_ok (&error)) {
+ char *meth_str = get_method_core (m, decl, FALSE, container);
+ char *ret = g_strdup_printf ("Could not decode method override %s due to %s", meth_str, mono_error_get_message (&error));
- mono_error_cleanup (&error);
- g_free (meth_str);
- return ret;
+ mono_error_cleanup (&error);
+ g_free (meth_str);
+ return ret;
+ } else {
+ return get_method_core (m, decl, FALSE, container);
+ }
}
}
}
--- /dev/null
+/Makefile
+/Makefile.in
+/.libs
+/.deps
+/*.lo
+/*.la
+/*.o
+/semantic.cache
+/.project
+/.cproject
+/eglib-config.h
--- /dev/null
+noinst_LTLIBRARIES = libeglib.la
+
+AM_CFLAGS = $(WERROR_CFLAGS)
+
+win_files = \
+ eglib-config.hw \
+ gdate-win32.c gdir-win32.c gfile-win32.c gmisc-win32.c \
+ gmodule-win32.c gmodule-win32-internals.h gtimer-win32.c gunicode-win32.c
+
+unix_files = \
+ gdate-unix.c gdir-unix.c gfile-unix.c gmisc-unix.c \
+ gmodule-unix.c gtimer-unix.c
+
+if HOST_WIN32
+os_files = $(win_files)
+else
+os_files = $(unix_files)
+endif
+
+libeglib_la_SOURCES = \
+ eglib-remap.h \
+ sort.frag.h \
+ glib.h \
+ garray.c \
+ gbytearray.c \
+ gerror.c \
+ ghashtable.c \
+ giconv.c \
+ gmem.c \
+ gmodule.h \
+ goutput.c \
+ gqsort.c \
+ gstr.c \
+ gslist.c \
+ gstring.c \
+ gptrarray.c \
+ glist.c \
+ gqueue.c \
+ gpath.c \
+ gshell.c \
+ gspawn.c \
+ gfile.c \
+ gfile-posix.c \
+ gpattern.c \
+ gmarkup.c \
+ gutf8.c \
+ gunicode.c \
+ unicode-data.h \
+ $(os_files)
+
+libeglib_la_CFLAGS = -g -Wall -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE
+
+AM_CPPFLAGS = -I$(srcdir)
+
+if HOST_WIN32
+libeglib_la_LIBADD = -lm $(LIBICONV) -lpsapi
+else
+if PLATFORM_ANDROID
+libeglib_la_LIBADD = -llog
+endif
+endif
+
+MAINTAINERCLEANFILES = Makefile.in
+
+EXTRA_DIST = eglib-config.h.in $(win_files) $(unix_files)
--- /dev/null
+#ifndef __EGLIB_CONFIG_H
+#define __EGLIB_CONFIG_H
+
+/*
+ * System-dependent settings
+ */
+#define G_GNUC_PRETTY_FUNCTION @GNUC_PRETTY@
+#define G_GNUC_UNUSED @GNUC_UNUSED@
+#define G_BYTE_ORDER @ORDER@
+#define G_GNUC_NORETURN @GNUC_NORETURN@
+#define G_SEARCHPATH_SEPARATOR_S "@SEARCHSEP@"
+#define G_SEARCHPATH_SEPARATOR '@SEARCHSEP@'
+#define G_DIR_SEPARATOR '@PATHSEP@'
+#define G_DIR_SEPARATOR_S "@PATHSEP@"
+#define G_BREAKPOINT() @BREAKPOINT@
+#define G_OS_@OS@
+#define GPOINTER_TO_INT(ptr) @GPOINTER_TO_INT@
+#define GPOINTER_TO_UINT(ptr) @GPOINTER_TO_UINT@
+#define GINT_TO_POINTER(v) @GINT_TO_POINTER@
+#define GUINT_TO_POINTER(v) @GUINT_TO_POINTER@
+
+#if @HAVE_ALLOCA_H@ == 1
+#define G_HAVE_ALLOCA_H
+#endif
+
+typedef unsigned @GSIZE@ gsize;
+typedef signed @GSIZE@ gssize;
+
+#define G_GSIZE_FORMAT @GSIZE_FORMAT@
+
+#if @G_HAVE_ISO_VARARGS@ == 1
+#define G_HAVE_ISO_VARARGS
+#endif
+
+#if defined (HOST_WATCHOS)
+#undef G_BREAKPOINT
+#define G_BREAKPOINT()
+#endif
+
+typedef @PIDTYPE@ GPid;
+
+#endif
--- /dev/null
+#ifndef __EGLIB_CONFIG_H
+#define __EGLIB_CONFIG_H
+
+/*
+ * System-dependent settings
+ */
+#define G_OS_WIN32 1
+
+#ifdef _MSC_VER
+
+#include <io.h>
+
+#define G_GNUC_PRETTY_FUNCTION __FUNCTION__
+#define G_GNUC_UNUSED
+#define G_BYTE_ORDER 1234
+#define G_GNUC_NORETURN
+#define G_BREAKPOINT() __debugbreak()
+#define MAXPATHLEN 242
+
+typedef uintptr_t gsize;
+typedef intptr_t gssize;
+typedef int pid_t;
+
+#define G_DIR_SEPARATOR '\\'
+#define G_DIR_SEPARATOR_S "\\"
+#define G_SEARCHPATH_SEPARATOR_S ";"
+#define G_SEARCHPATH_SEPARATOR ';'
+#define G_GSIZE_FORMAT "d"
+#define GPOINTER_TO_INT(ptr) ((gint)(intptr_t) (ptr))
+#define GPOINTER_TO_UINT(ptr) ((guint)(intptr_t) (ptr))
+#define GINT_TO_POINTER(v) ((gpointer)(intptr_t) (v))
+#define GUINT_TO_POINTER(v) ((gpointer)(intptr_t) (v))
+
+#define STDOUT_FILENO (int)(intptr_t)stdout
+#define STDERR_FILENO (int)(intptr_t)stderr
+
+/* FIXME: what should this be ?*/
+#define X_OK 4 /* This is really read */
+#define WNOHANG 1
+#define F_SETFD 1
+#define FD_CLOEXEC 1
+
+#undef inline
+#define inline __inline
+
+#define strtok_r strtok_s
+
+#undef G_HAVE_UNISTD_H
+#undef G_HAVE_SYS_TIME_H
+#undef G_HAVE_SYS_WAIT_H
+#undef G_HAVE_PWD_H
+#undef G_HAVE_STRNDUP
+#define G_HAVE_GETOPT_H 1
+
+/* disable the following warnings
+ * C4100: The formal parameter is not referenced in the body of the function. The unreferenced parameter is ignored.
+ * C4127: conditional expression is constant
+*/
+#pragma warning(disable:4100 4127)
+#endif
+
+typedef void * GPid;
+#endif
--- /dev/null
+#define g_array_append monoeg_g_array_append
+#define g_array_append_vals monoeg_g_array_append_vals
+#define g_array_free monoeg_g_array_free
+#define g_array_insert_vals monoeg_g_array_insert_vals
+#define g_array_new monoeg_g_array_new
+#define g_array_remove_index monoeg_g_array_remove_index
+#define g_array_remove_index_fast monoeg_g_array_remove_index_fast
+#define g_array_set_size monoeg_g_array_set_size
+#define g_array_sized_new monoeg_g_array_sized_new
+#define g_ascii_strdown monoeg_g_ascii_strdown
+#define g_ascii_strncasecmp monoeg_g_ascii_strncasecmp
+#define g_ascii_tolower monoeg_g_ascii_tolower
+#define g_ascii_xdigit_value monoeg_g_ascii_xdigit_value
+#define g_build_path monoeg_g_build_path
+#define g_byte_array_append monoeg_g_byte_array_append
+#define g_byte_array_free monoeg_g_byte_array_free
+#define g_byte_array_new monoeg_g_byte_array_new
+#define g_byte_array_set_size monoeg_g_byte_array_set_size
+#define g_calloc monoeg_g_calloc
+#define g_clear_error monoeg_g_clear_error
+#define g_convert monoeg_g_convert
+#define g_convert_error_quark monoeg_g_convert_error_quark
+#define g_dir_close monoeg_g_dir_close
+#define g_dir_open monoeg_g_dir_open
+#define g_dir_read_name monoeg_g_dir_read_name
+#define g_dir_rewind monoeg_g_dir_rewind
+#define g_mkdir_with_parents monoeg_g_mkdir_with_parents
+#define g_direct_equal monoeg_g_direct_equal
+#define g_direct_hash monoeg_g_direct_hash
+#define g_ensure_directory_exists monoeg_g_ensure_directory_exists
+#define g_error_free monoeg_g_error_free
+#define g_error_new monoeg_g_error_new
+#define g_error_vnew monoeg_g_error_vnew
+#define g_file_error_quark monoeg_g_file_error_quark
+#define g_file_error_from_errno monoeg_g_file_error_from_errno
+#define g_file_get_contents monoeg_g_file_get_contents
+#define g_file_set_contents monoeg_g_file_set_contents
+#define g_file_open_tmp monoeg_g_file_open_tmp
+#define g_file_test monoeg_g_file_test
+#define g_filename_from_uri monoeg_g_filename_from_uri
+#define g_filename_from_utf8 monoeg_g_filename_from_utf8
+#define g_filename_to_uri monoeg_g_filename_to_uri
+#define g_find_program_in_path monoeg_g_find_program_in_path
+#define g_fprintf monoeg_g_fprintf
+#define g_free monoeg_g_free
+#define g_get_charset monoeg_g_get_charset
+#define g_get_current_dir monoeg_g_get_current_dir
+#define g_get_current_time monoeg_g_get_current_time
+#define g_get_home_dir monoeg_g_get_home_dir
+#define g_get_prgname monoeg_g_get_prgname
+#define g_get_tmp_dir monoeg_g_get_tmp_dir
+#define g_get_user_name monoeg_g_get_user_name
+#define g_getenv monoeg_g_getenv
+#define g_hasenv monoeg_g_hasenv
+#define g_hash_table_destroy monoeg_g_hash_table_destroy
+#define g_hash_table_find monoeg_g_hash_table_find
+#define g_hash_table_foreach monoeg_g_hash_table_foreach
+#define g_hash_table_foreach_remove monoeg_g_hash_table_foreach_remove
+#define g_hash_table_foreach_steal monoeg_g_hash_table_foreach_steal
+#define g_hash_table_get_keys monoeg_g_hash_table_get_keys
+#define g_hash_table_get_values monoeg_g_hash_table_get_values
+#define g_hash_table_insert_replace monoeg_g_hash_table_insert_replace
+#define g_hash_table_lookup monoeg_g_hash_table_lookup
+#define g_hash_table_lookup_extended monoeg_g_hash_table_lookup_extended
+#define g_hash_table_new monoeg_g_hash_table_new
+#define g_hash_table_new_full monoeg_g_hash_table_new_full
+#define g_hash_table_remove monoeg_g_hash_table_remove
+#define g_hash_table_steal monoeg_g_hash_table_steal
+#define g_hash_table_size monoeg_g_hash_table_size
+#define g_hash_table_print_stats monoeg_g_hash_table_print_stats
+#define g_hash_table_remove_all monoeg_g_hash_table_remove_all
+#define g_hash_table_iter_init monoeg_g_hash_table_iter_init
+#define g_hash_table_iter_next monoeg_g_hash_table_iter_next
+#define g_iconv monoeg_g_iconv
+#define g_iconv_close monoeg_g_iconv_close
+#define g_iconv_open monoeg_g_iconv_open
+#define g_int_equal monoeg_g_int_equal
+#define g_int_hash monoeg_g_int_hash
+#define g_list_alloc monoeg_g_list_alloc
+#define g_list_append monoeg_g_list_append
+#define g_list_concat monoeg_g_list_concat
+#define g_list_copy monoeg_g_list_copy
+#define g_list_delete_link monoeg_g_list_delete_link
+#define g_list_find monoeg_g_list_find
+#define g_list_find_custom monoeg_g_list_find_custom
+#define g_list_first monoeg_g_list_first
+#define g_list_foreach monoeg_g_list_foreach
+#define g_list_free monoeg_g_list_free
+#define g_list_free_1 monoeg_g_list_free_1
+#define g_list_index monoeg_g_list_index
+#define g_list_insert_before monoeg_g_list_insert_before
+#define g_list_insert_sorted monoeg_g_list_insert_sorted
+#define g_list_last monoeg_g_list_last
+#define g_list_length monoeg_g_list_length
+#define g_list_nth monoeg_g_list_nth
+#define g_list_nth_data monoeg_g_list_nth_data
+#define g_list_prepend monoeg_g_list_prepend
+#define g_list_remove monoeg_g_list_remove
+#define g_list_remove_all monoeg_g_list_remove_all
+#define g_list_remove_link monoeg_g_list_remove_link
+#define g_list_reverse monoeg_g_list_reverse
+#define g_list_sort monoeg_g_list_sort
+#define g_locale_from_utf8 monoeg_g_locale_from_utf8
+#define g_locale_to_utf8 monoeg_g_locale_to_utf8
+#define g_log monoeg_g_log
+#define g_log_set_always_fatal monoeg_g_log_set_always_fatal
+#define g_log_set_fatal_mask monoeg_g_log_set_fatal_mask
+#define g_logv monoeg_g_logv
+#define g_markup_parse_context_end_parse monoeg_g_markup_parse_context_end_parse
+#define g_markup_parse_context_free monoeg_g_markup_parse_context_free
+#define g_markup_parse_context_new monoeg_g_markup_parse_context_new
+#define g_markup_parse_context_parse monoeg_g_markup_parse_context_parse
+#define g_memdup monoeg_g_memdup
+#define g_mem_set_vtable monoeg_g_mem_set_vtable
+#define g_mkdtemp monoeg_g_mkdtemp
+#define g_module_build_path monoeg_g_module_build_path
+#define g_module_close monoeg_g_module_close
+#define g_module_error monoeg_g_module_error
+#define g_module_open monoeg_g_module_open
+#define g_module_symbol monoeg_g_module_symbol
+#define g_path_get_basename monoeg_g_path_get_basename
+#define g_path_get_dirname monoeg_g_path_get_dirname
+#define g_path_is_absolute monoeg_g_path_is_absolute
+#define g_pattern_match_string monoeg_g_pattern_match_string
+#define g_pattern_spec_free monoeg_g_pattern_spec_free
+#define g_pattern_spec_new monoeg_g_pattern_spec_new
+#define g_print monoeg_g_print
+#define g_printf monoeg_g_printf
+#define g_printerr monoeg_g_printerr
+#define g_propagate_error monoeg_g_propagate_error
+#define g_ptr_array_add monoeg_g_ptr_array_add
+#define g_ptr_array_foreach monoeg_g_ptr_array_foreach
+#define g_ptr_array_free monoeg_g_ptr_array_free
+#define g_ptr_array_new monoeg_g_ptr_array_new
+#define g_ptr_array_remove monoeg_g_ptr_array_remove
+#define g_ptr_array_remove_fast monoeg_g_ptr_array_remove_fast
+#define g_ptr_array_remove_index monoeg_g_ptr_array_remove_index
+#define g_ptr_array_remove_index_fast monoeg_g_ptr_array_remove_index_fast
+#define g_ptr_array_set_size monoeg_g_ptr_array_set_size
+#define g_ptr_array_sized_new monoeg_g_ptr_array_sized_new
+#define g_ptr_array_sort monoeg_g_ptr_array_sort
+#define g_ptr_array_sort_with_data monoeg_g_ptr_array_sort_with_data
+#define g_qsort_with_data monoeg_g_qsort_with_data
+#define g_queue_free monoeg_g_queue_free
+#define g_queue_is_empty monoeg_g_queue_is_empty
+#define g_queue_foreach monoeg_g_queue_foreach
+#define g_queue_new monoeg_g_queue_new
+#define g_queue_pop_head monoeg_g_queue_pop_head
+#define g_queue_push_head monoeg_g_queue_push_head
+#define g_queue_push_tail monoeg_g_queue_push_tail
+#define g_set_error monoeg_g_set_error
+#define g_set_prgname monoeg_g_set_prgname
+#define g_setenv monoeg_g_setenv
+#define g_shell_parse_argv monoeg_g_shell_parse_argv
+#define g_shell_quote monoeg_g_shell_quote
+#define g_shell_unquote monoeg_g_shell_unquote
+#define g_slist_alloc monoeg_g_slist_alloc
+#define g_slist_append monoeg_g_slist_append
+#define g_slist_concat monoeg_g_slist_concat
+#define g_slist_copy monoeg_g_slist_copy
+#define g_slist_delete_link monoeg_g_slist_delete_link
+#define g_slist_find monoeg_g_slist_find
+#define g_slist_find_custom monoeg_g_slist_find_custom
+#define g_slist_foreach monoeg_g_slist_foreach
+#define g_slist_free monoeg_g_slist_free
+#define g_slist_free_1 monoeg_g_slist_free_1
+#define g_slist_index monoeg_g_slist_index
+#define g_slist_insert_before monoeg_g_slist_insert_before
+#define g_slist_insert_sorted monoeg_g_slist_insert_sorted
+#define g_slist_last monoeg_g_slist_last
+#define g_slist_length monoeg_g_slist_length
+#define g_slist_nth monoeg_g_slist_nth
+#define g_slist_nth_data monoeg_g_slist_nth_data
+#define g_slist_prepend monoeg_g_slist_prepend
+#define g_slist_remove monoeg_g_slist_remove
+#define g_slist_remove_all monoeg_g_slist_remove_all
+#define g_slist_remove_link monoeg_g_slist_remove_link
+#define g_slist_reverse monoeg_g_slist_reverse
+#define g_slist_sort monoeg_g_slist_sort
+#define g_snprintf monoeg_g_snprintf
+#define g_spaced_primes_closest monoeg_g_spaced_primes_closest
+#define g_spawn_async_with_pipes monoeg_g_spawn_async_with_pipes
+#define g_spawn_command_line_sync monoeg_g_spawn_command_line_sync
+#define g_sprintf monoeg_g_sprintf
+#define g_stpcpy monoeg_g_stpcpy
+#define g_str_equal monoeg_g_str_equal
+#define g_str_has_prefix monoeg_g_str_has_prefix
+#define g_str_has_suffix monoeg_g_str_has_suffix
+#define g_str_hash monoeg_g_str_hash
+#define g_strchomp monoeg_g_strchomp
+#define g_strchug monoeg_g_strchug
+#define g_strconcat monoeg_g_strconcat
+#define g_strdelimit monoeg_g_strdelimit
+#define g_strdown monoeg_g_strdown
+#define g_strdup_printf monoeg_g_strdup_printf
+#define g_strdup_vprintf monoeg_g_strdup_vprintf
+#define g_strerror monoeg_g_strerror
+#define g_strescape monoeg_g_strescape
+#define g_strfreev monoeg_g_strfreev
+#define g_strdupv monoeg_g_strdupv
+#define g_string_append monoeg_g_string_append
+#define g_string_append_c monoeg_g_string_append_c
+#define g_string_append_len monoeg_g_string_append_len
+#define g_string_append_unichar monoeg_g_string_append_unichar
+#define g_string_append_printf monoeg_g_string_append_printf
+#define g_string_append_vprintf monoeg_g_string_append_vprintf
+#define g_string_erase monoeg_g_string_erase
+#define g_string_free monoeg_g_string_free
+#define g_string_insert monoeg_g_string_insert
+#define g_string_new monoeg_g_string_new
+#define g_string_new_len monoeg_g_string_new_len
+#define g_string_prepend monoeg_g_string_prepend
+#define g_string_printf monoeg_g_string_printf
+#define g_string_set_size monoeg_g_string_set_size
+#define g_string_sized_new monoeg_g_string_sized_new
+#define g_string_truncate monoeg_g_string_truncate
+#define g_strjoin monoeg_g_strjoin
+#define g_strjoinv monoeg_g_strjoinv
+#define g_strlcpy monoeg_g_strlcpy
+#define g_strndup monoeg_g_strndup
+#define g_strnfill monoeg_g_strnfill
+#define g_strreverse monoeg_g_strreverse
+#define g_strsplit monoeg_g_strsplit
+#define g_strsplit_set monoeg_g_strsplit_set
+#define g_strv_length monoeg_g_strv_length
+#define g_timer_destroy monoeg_g_timer_destroy
+#define g_timer_elapsed monoeg_g_timer_elapsed
+#define g_timer_new monoeg_g_timer_new
+#define g_timer_start monoeg_g_timer_start
+#define g_timer_stop monoeg_g_timer_stop
+#define g_trailingBytesForUTF8 monoeg_g_trailingBytesForUTF8
+#define g_ucs4_to_utf8 monoeg_g_ucs4_to_utf8
+#define g_ucs4_to_utf16 monoeg_g_ucs4_to_utf16
+#define g_unichar_case monoeg_g_unichar_case
+#define g_unichar_isxdigit monoeg_g_unichar_isxdigit
+#define g_unichar_tolower monoeg_g_unichar_tolower
+#define g_unichar_totitle monoeg_g_unichar_totitle
+#define g_unichar_toupper monoeg_g_unichar_toupper
+#define g_unichar_type monoeg_g_unichar_type
+#define g_unichar_xdigit_value monoeg_g_unichar_xdigit_value
+#define g_unsetenv monoeg_g_unsetenv
+#define g_usleep monoeg_g_usleep
+#define g_utf16_to_ucs4 monoeg_g_utf16_to_ucs4
+#define g_utf16_to_utf8 monoeg_g_utf16_to_utf8
+#define g_utf8_get_char monoeg_g_utf8_get_char
+#define g_utf8_offset_to_pointer monoeg_g_utf8_offset_to_pointer
+#define g_utf8_pointer_to_offset monoeg_g_utf8_pointer_to_offset
+#define g_utf8_strdown monoeg_g_utf8_strdown
+#define g_utf8_strlen monoeg_g_utf8_strlen
+#define g_utf8_strup monoeg_g_utf8_strup
+#define g_utf8_to_ucs4_fast monoeg_g_utf8_to_ucs4_fast
+#define g_utf8_to_utf16 monoeg_g_utf8_to_utf16
+#define g_utf8_validate monoeg_g_utf8_validate
+#define g_unichar_to_utf8 monoeg_g_unichar_to_utf8
+#define g_unichar_is_space monoeg_g_unichar_is_space
+#define g_unicode_break_type monoeg_g_unicode_break_type
+#define g_utf8_offset_to_pointer monoeg_g_utf8_offset_to_pointer
+#define g_utf8_pointer_to_offset monoeg_g_utf8_pointer_to_offset
+#define g_utf8_to_ucs4_fast monoeg_g_utf8_to_ucs4_fast
+#define g_vasprintf monoeg_g_vasprintf
+#define g_win32_getlocale monoeg_g_win32_getlocale
+#define g_assertion_message monoeg_assertion_message
+#define g_malloc monoeg_malloc
+#define g_malloc0 monoeg_malloc0
+#define g_ptr_array_grow monoeg_ptr_array_grow
+#define g_realloc monoeg_realloc
+#define g_try_malloc monoeg_try_malloc
+#define g_try_realloc monoeg_try_realloc
+#define g_strdup monoeg_strdup
+#define g_ucs4_to_utf16_len monoeg_ucs4_to_utf16_len
+#define g_utf16_to_ucs4_len monoeg_utf16_to_ucs4_len
+
+#define g_ascii_strcasecmp monoeg_ascii_strcasecmp
+#define g_ascii_strup monoeg_ascii_strup
+#define g_ascii_toupper monoeg_ascii_toupper
+#define g_unichar_break_type monoeg_unichar_break_type
+#define g_unichar_isspace monoeg_unichar_isspace
+#define g_unichar_to_utf16 monoeg_unichar_to_utf16
+#define g_utf8_find_prev_char monoeg_utf8_find_prev_char
+#define g_utf8_get_char_validated monoeg_utf8_get_char_validated
+#define g_utf8_prev_char monoeg_utf8_prev_char
+#define g_utf8_to_ucs4 monoeg_utf8_to_ucs4
+
+
+#define g_log_default_handler monoeg_log_default_handler
+#define g_log_set_default_handler monoeg_log_set_default_handler
+#define g_set_print_handler monoeg_set_print_handler
+#define g_set_printerr_handler monoeg_set_printerr_handler
--- /dev/null
+/*
+ * Arrays
+ *
+ * Author:
+ * Chris Toshok (toshok@novell.com)
+ *
+ * (C) 2006 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.
+ */
+
+#include <stdlib.h>
+#include <glib.h>
+
+#define INITIAL_CAPACITY 16
+
+#define element_offset(p,i) ((p)->array.data + (i) * (p)->element_size)
+#define element_length(p,i) ((i) * (p)->element_size)
+
+typedef struct {
+ GArray array;
+ gboolean clear_;
+ guint element_size;
+ gboolean zero_terminated;
+ guint capacity;
+} GArrayPriv;
+
+static void
+ensure_capacity (GArrayPriv *priv, guint capacity)
+{
+ guint new_capacity;
+
+ if (capacity <= priv->capacity)
+ return;
+
+ new_capacity = (capacity + 63) & ~63;
+
+ priv->array.data = g_realloc (priv->array.data, element_length (priv, new_capacity));
+
+ if (priv->clear_) {
+ memset (element_offset (priv, priv->capacity),
+ 0,
+ element_length (priv, new_capacity - priv->capacity));
+ }
+
+ priv->capacity = new_capacity;
+}
+
+GArray *
+g_array_new (gboolean zero_terminated,
+ gboolean clear_,
+ guint element_size)
+{
+ GArrayPriv *rv = g_new0 (GArrayPriv, 1);
+ rv->zero_terminated = zero_terminated;
+ rv->clear_ = clear_;
+ rv->element_size = element_size;
+
+ ensure_capacity (rv, INITIAL_CAPACITY);
+
+ return (GArray*)rv;
+}
+
+GArray *
+g_array_sized_new (gboolean zero_terminated,
+ gboolean clear_,
+ guint element_size,
+ guint reserved_size)
+{
+ GArrayPriv *rv = g_new0 (GArrayPriv, 1);
+ rv->zero_terminated = zero_terminated;
+ rv->clear_ = clear_;
+ rv->element_size = element_size;
+
+ ensure_capacity (rv, reserved_size);
+
+ return (GArray*)rv;
+}
+
+gchar*
+g_array_free (GArray *array,
+ gboolean free_segment)
+{
+ gchar* rv = NULL;
+
+ g_return_val_if_fail (array != NULL, NULL);
+
+ if (free_segment)
+ g_free (array->data);
+ else
+ rv = array->data;
+
+ g_free (array);
+
+ return rv;
+}
+
+GArray *
+g_array_append_vals (GArray *array,
+ gconstpointer data,
+ guint len)
+{
+ GArrayPriv *priv = (GArrayPriv*)array;
+
+ g_return_val_if_fail (array != NULL, NULL);
+
+ ensure_capacity (priv, priv->array.len + len + (priv->zero_terminated ? 1 : 0));
+
+ memmove (element_offset (priv, priv->array.len),
+ data,
+ element_length (priv, len));
+
+ priv->array.len += len;
+
+ if (priv->zero_terminated) {
+ memset (element_offset (priv, priv->array.len),
+ 0,
+ priv->element_size);
+ }
+
+ return array;
+}
+
+GArray*
+g_array_insert_vals (GArray *array,
+ guint index_,
+ gconstpointer data,
+ guint len)
+{
+ GArrayPriv *priv = (GArrayPriv*)array;
+ guint extra = (priv->zero_terminated ? 1 : 0);
+
+ g_return_val_if_fail (array != NULL, NULL);
+
+ ensure_capacity (priv, array->len + len + extra);
+
+ /* first move the existing elements out of the way */
+ memmove (element_offset (priv, index_ + len),
+ element_offset (priv, index_),
+ element_length (priv, array->len - index_));
+
+ /* then copy the new elements into the array */
+ memmove (element_offset (priv, index_),
+ data,
+ element_length (priv, len));
+
+ array->len += len;
+
+ if (priv->zero_terminated) {
+ memset (element_offset (priv, priv->array.len),
+ 0,
+ priv->element_size);
+ }
+
+ return array;
+}
+
+GArray*
+g_array_remove_index (GArray *array,
+ guint index_)
+{
+ GArrayPriv *priv = (GArrayPriv*)array;
+
+ g_return_val_if_fail (array != NULL, NULL);
+
+ memmove (element_offset (priv, index_),
+ element_offset (priv, index_ + 1),
+ element_length (priv, array->len - index_));
+
+ array->len --;
+
+ if (priv->zero_terminated) {
+ memset (element_offset (priv, priv->array.len),
+ 0,
+ priv->element_size);
+ }
+
+ return array;
+}
+
+GArray*
+g_array_remove_index_fast (GArray *array,
+ guint index_)
+{
+ GArrayPriv *priv = (GArrayPriv*)array;
+
+ g_return_val_if_fail (array != NULL, NULL);
+
+ memmove (element_offset (priv, index_),
+ element_offset (priv, array->len - 1),
+ element_length (priv, 1));
+
+ array->len --;
+
+ if (priv->zero_terminated) {
+ memset (element_offset (priv, priv->array.len),
+ 0,
+ priv->element_size);
+ }
+
+ return array;
+}
+
+void
+g_array_set_size (GArray *array, gint length)
+{
+ GArrayPriv *priv = (GArrayPriv*)array;
+
+ g_return_if_fail (array != NULL);
+ g_return_if_fail (length >= 0);
+
+ if (length == priv->capacity)
+ return; // nothing to be done
+
+ if (length > priv->capacity) {
+ // grow the array
+ ensure_capacity (priv, length);
+ }
+
+ array->len = length;
+}
--- /dev/null
+/*
+ * Arrays
+ *
+ * Author:
+ * Geoff Norton (gnorton@novell.com)
+ *
+ * (C) 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.
+ */
+
+#include <stdlib.h>
+#include <glib.h>
+
+GByteArray *
+g_byte_array_new ()
+{
+ return (GByteArray *) g_array_new (FALSE, TRUE, 1);
+}
+
+guint8*
+g_byte_array_free (GByteArray *array,
+ gboolean free_segment)
+{
+ return (guint8*) g_array_free ((GArray *)array, free_segment);
+}
+
+GByteArray *
+g_byte_array_append (GByteArray *array,
+ const guint8 *data,
+ guint len)
+{
+ return (GByteArray *)g_array_append_vals ((GArray *)array, data, len);
+}
+
+void
+g_byte_array_set_size (GByteArray *array, gint length)
+{
+ g_array_set_size ((GArray *)array, length);
+}
+
--- /dev/null
+/*
+ * gdate-unix.c: Date and time utility functions.
+ *
+ * Author:
+ * Gonzalo Paniagua Javier (gonzalo@novell.com
+ *
+ * (C) 2006 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.
+ */
+#include <stdio.h>
+#include <glib.h>
+#include <time.h>
+#include <errno.h>
+#include <sys/time.h>
+
+void
+g_get_current_time (GTimeVal *result)
+{
+ struct timeval tv;
+
+ g_return_if_fail (result != NULL);
+ gettimeofday (&tv, NULL);
+ result->tv_sec = tv.tv_sec;
+ result->tv_usec = tv.tv_usec;
+}
+
+void
+g_usleep (gulong microseconds)
+{
+ struct timespec req, rem;
+
+ req.tv_sec = microseconds / 1000000;
+ req.tv_nsec = (microseconds % 1000000) * 1000;
+
+ while (nanosleep (&req, &rem) == -1 && errno == EINTR)
+ req = rem;
+}
--- /dev/null
+/*
+ * gdate-win32.c: Date and time utility functions.
+ *
+ * Author:
+ * Gonzalo Paniagua Javier (gonzalo@novell.com
+ *
+ * (C) 2006 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.
+ */
+#include <stdio.h>
+#include <glib.h>
+
+#include <winsock2.h>
+
+void
+g_get_current_time (GTimeVal *result)
+{
+ long int l;
+
+ g_return_if_fail (result != NULL);
+ l = GetTickCount();
+
+ result->tv_sec = l / 1000;
+ result->tv_usec = (l % 1000) * 1000;
+}
+
+void
+g_usleep (gulong microseconds)
+{
+ Sleep (microseconds/1000);
+}
--- /dev/null
+/*
+ * Directory utility functions.
+ *
+ * Author:
+ * Gonzalo Paniagua Javier (gonzalo@novell.com)
+ *
+ * (C) 2006 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.
+ */
+#include <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <dirent.h>
+
+struct _GDir {
+ DIR *dir;
+#ifndef HAVE_REWINDDIR
+ char *path;
+#endif
+};
+
+GDir *
+g_dir_open (const gchar *path, guint flags, GError **error)
+{
+ GDir *dir;
+
+ g_return_val_if_fail (path != NULL, NULL);
+ g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+ (void) flags; /* this is not used */
+ dir = g_new (GDir, 1);
+ dir->dir = opendir (path);
+ if (dir->dir == NULL) {
+ if (error) {
+ gint err = errno;
+ *error = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), strerror (err));
+ }
+ g_free (dir);
+ return NULL;
+ }
+#ifndef HAVE_REWINDDIR
+ dir->path = g_strdup (path);
+#endif
+ return dir;
+}
+
+const gchar *
+g_dir_read_name (GDir *dir)
+{
+ struct dirent *entry;
+
+ g_return_val_if_fail (dir != NULL && dir->dir != NULL, NULL);
+ do {
+ entry = readdir (dir->dir);
+ if (entry == NULL)
+ return NULL;
+ } while ((strcmp (entry->d_name, ".") == 0) || (strcmp (entry->d_name, "..") == 0));
+
+ return entry->d_name;
+}
+
+void
+g_dir_rewind (GDir *dir)
+{
+ g_return_if_fail (dir != NULL && dir->dir != NULL);
+#ifndef HAVE_REWINDDIR
+ closedir (dir->dir);
+ dir->dir = opendir (dir->path);
+#else
+ rewinddir (dir->dir);
+#endif
+}
+
+void
+g_dir_close (GDir *dir)
+{
+ g_return_if_fail (dir != NULL && dir->dir != 0);
+ closedir (dir->dir);
+#ifndef HAVE_REWINDDIR
+ g_free (dir->path);
+#endif
+ dir->dir = NULL;
+ g_free (dir);
+}
+
+int
+g_mkdir_with_parents (const gchar *pathname, int mode)
+{
+ char *path, *d;
+ int rv;
+
+ if (!pathname || *pathname == '\0') {
+ errno = EINVAL;
+ return -1;
+ }
+
+ d = path = g_strdup (pathname);
+ if (*d == '/')
+ d++;
+
+ while (TRUE) {
+ if (*d == '/' || *d == '\0') {
+ char orig = *d;
+ *d = '\0';
+ rv = mkdir (path, mode);
+ if (rv == -1 && errno != EEXIST) {
+ g_free (path);
+ return -1;
+ }
+
+ *d++ = orig;
+ while (orig == '/' && *d == '/')
+ d++;
+ if (orig == '\0')
+ break;
+ } else {
+ d++;
+ }
+ }
+
+ g_free (path);
+
+ return 0;
+}
--- /dev/null
+/*
+ * Directory utility functions.
+ *
+ * Author:
+ * Gonzalo Paniagua Javier (gonzalo@novell.com)
+ *
+ * (C) 2006 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.
+ */
+#include <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <io.h>
+
+#include <winsock2.h>
+
+struct _GDir {
+ HANDLE handle;
+ gchar* current;
+ gchar* next;
+};
+
+GDir *
+g_dir_open (const gchar *path, guint flags, GError **error)
+{
+ GDir *dir;
+ gunichar2* path_utf16;
+ gunichar2* path_utf16_search;
+ WIN32_FIND_DATAW find_data;
+
+ g_return_val_if_fail (path != NULL, NULL);
+ g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+ dir = g_new0 (GDir, 1);
+ path_utf16 = u8to16 (path);
+ path_utf16_search = g_malloc ((wcslen((wchar_t *) path_utf16) + 3)*sizeof(gunichar2));
+ wcscpy (path_utf16_search, path_utf16);
+ wcscat (path_utf16_search, L"\\*");
+
+ dir->handle = FindFirstFileW (path_utf16_search, &find_data);
+ if (dir->handle == INVALID_HANDLE_VALUE) {
+ if (error) {
+ gint err = errno;
+ *error = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), strerror (err));
+ }
+ g_free (path_utf16_search);
+ g_free (path_utf16);
+ g_free (dir);
+ return NULL;
+ }
+ g_free (path_utf16_search);
+ g_free (path_utf16);
+
+ while ((wcscmp ((wchar_t *) find_data.cFileName, L".") == 0) || (wcscmp ((wchar_t *) find_data.cFileName, L"..") == 0)) {
+ if (!FindNextFileW (dir->handle, &find_data)) {
+ if (error) {
+ gint err = errno;
+ *error = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), strerror (err));
+ }
+ g_free (dir);
+ return NULL;
+ }
+ }
+
+ dir->current = NULL;
+ dir->next = u16to8 (find_data.cFileName);
+ return dir;
+}
+
+const gchar *
+g_dir_read_name (GDir *dir)
+{
+ WIN32_FIND_DATAW find_data;
+
+ g_return_val_if_fail (dir != NULL && dir->handle != 0, NULL);
+
+ if (dir->current)
+ g_free (dir->current);
+ dir->current = NULL;
+
+ dir->current = dir->next;
+
+ if (!dir->current)
+ return NULL;
+
+ dir->next = NULL;
+
+ do {
+ if (!FindNextFileW (dir->handle, &find_data)) {
+ dir->next = NULL;
+ return dir->current;
+ }
+ } while ((wcscmp ((wchar_t *) find_data.cFileName, L".") == 0) || (wcscmp ((wchar_t *) find_data.cFileName, L"..") == 0));
+
+ dir->next = u16to8 (find_data.cFileName);
+ return dir->current;
+}
+
+void
+g_dir_rewind (GDir *dir)
+{
+}
+
+void
+g_dir_close (GDir *dir)
+{
+ g_return_if_fail (dir != NULL && dir->handle != 0);
+
+ if (dir->current)
+ g_free (dir->current);
+ dir->current = NULL;
+ if (dir->next)
+ g_free (dir->next);
+ dir->next = NULL;
+ FindClose (dir->handle);
+ dir->handle = 0;
+ g_free (dir);
+}
+
+
--- /dev/null
+/*
+ * gerror.c: Error support.
+ *
+ * Author:
+ * Miguel de Icaza (miguel@novell.com)
+ *
+ * (C) 2006 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.
+ */
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+#include <config.h>
+#include <glib.h>
+GError *
+g_error_new (gpointer domain, gint code, const char *format, ...)
+{
+ va_list args;
+ GError *err = g_new (GError, 1);
+
+ err->domain = domain;
+ err->code = code;
+
+ va_start (args, format);
+ if (g_vasprintf (&err->message, format, args) == -1)
+ err->message = g_strdup_printf ("internal: invalid format string %s", format);
+ va_end (args);
+
+ return err;
+}
+
+static GError *
+g_error_vnew (gpointer domain, gint code, const char *format, va_list ap)
+{
+ GError *err = g_new (GError, 1);
+
+ err->domain = domain;
+ err->code = code;
+
+ if (g_vasprintf (&err->message, format, ap) == -1)
+ err->message = g_strdup_printf ("internal: invalid format string %s", format);
+
+ return err;
+}
+
+void
+g_clear_error (GError **error)
+{
+ if (error && *error) {
+ g_error_free (*error);
+ *error = NULL;
+ }
+}
+
+void
+g_error_free (GError *error)
+{
+ g_return_if_fail (error != NULL);
+
+ g_free (error->message);
+ g_free (error);
+}
+
+void
+g_set_error (GError **err, gpointer domain, gint code, const gchar *format, ...)
+{
+ va_list args;
+
+ if (err) {
+ va_start (args, format);
+ *err = g_error_vnew (domain, code, format, args);
+ va_end (args);
+ }
+}
+
+void
+g_propagate_error (GError **dest, GError *src)
+{
+ if (dest == NULL){
+ if (src)
+ g_error_free (src);
+ } else {
+ *dest = src;
+ }
+}
--- /dev/null
+/*
+ * File utility functions.
+ *
+ * Author:
+ * Gonzalo Paniagua Javier (gonzalo@novell.com)
+ *
+ * (C) 2006 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.
+ */
+#include <config.h>
+#include <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <fcntl.h>
+#include <errno.h>
+
+#ifdef _MSC_VER
+#include <direct.h>
+#endif
+#ifdef G_OS_WIN32
+int mkstemp (char *tmp_template);
+#endif
+
+#ifndef O_LARGEFILE
+#define OPEN_FLAGS (O_RDONLY)
+#else
+#define OPEN_FLAGS (O_RDONLY | O_LARGEFILE)
+#endif
+gboolean
+g_file_get_contents (const gchar *filename, gchar **contents, gsize *length, GError **error)
+{
+ gchar *str;
+ int fd;
+ struct stat st;
+ long offset;
+ int nread;
+
+ g_return_val_if_fail (filename != NULL, FALSE);
+ g_return_val_if_fail (contents != NULL, FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ *contents = NULL;
+ if (length)
+ *length = 0;
+
+ fd = open (filename, OPEN_FLAGS);
+ if (fd == -1) {
+ if (error != NULL) {
+ int err = errno;
+ *error = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), "Error opening file");
+ }
+ return FALSE;
+ }
+
+ if (fstat (fd, &st) != 0) {
+ if (error != NULL) {
+ int err = errno;
+ *error = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), "Error in fstat()");
+ }
+ close (fd);
+ return FALSE;
+ }
+
+ str = g_malloc (st.st_size + 1);
+ offset = 0;
+ do {
+ nread = read (fd, str + offset, st.st_size - offset);
+ if (nread > 0) {
+ offset += nread;
+ }
+ } while ((nread > 0 && offset < st.st_size) || (nread == -1 && errno == EINTR));
+
+ close (fd);
+ str [st.st_size] = '\0';
+ if (length) {
+ *length = st.st_size;
+ }
+ *contents = str;
+ return TRUE;
+}
+
+gint
+g_file_open_tmp (const gchar *tmpl, gchar **name_used, GError **error)
+{
+ const static gchar *default_tmpl = ".XXXXXX";
+ gchar *t;
+ gint fd;
+ size_t len;
+
+ g_return_val_if_fail (error == NULL || *error == NULL, -1);
+
+ if (tmpl == NULL)
+ tmpl = default_tmpl;
+
+ if (strchr (tmpl, G_DIR_SEPARATOR) != NULL) {
+ if (error) {
+ *error = g_error_new (G_LOG_DOMAIN, 24, "Template should not have any " G_DIR_SEPARATOR_S);
+ }
+ return -1;
+ }
+
+ len = strlen (tmpl);
+ if (len < 6 || strcmp (tmpl + len - 6, "XXXXXX")) {
+ if (error) {
+ *error = g_error_new (G_LOG_DOMAIN, 24, "Template should end with XXXXXX");
+ }
+ return -1;
+ }
+
+ t = g_build_filename (g_get_tmp_dir (), tmpl, NULL);
+
+ fd = mkstemp (t);
+
+ if (fd == -1) {
+ if (error) {
+ int err = errno;
+ *error = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), "Error in mkstemp()");
+ }
+ g_free (t);
+ return -1;
+ }
+
+ if (name_used) {
+ *name_used = t;
+ } else {
+ g_free (t);
+ }
+ return fd;
+}
+
+gchar *
+g_get_current_dir (void)
+{
+ int s = 32;
+ char *buffer = NULL, *r;
+ gboolean fail;
+
+ do {
+ buffer = g_realloc (buffer, s);
+ r = getcwd (buffer, s);
+ fail = (r == NULL && errno == ERANGE);
+ if (fail) {
+ s <<= 1;
+ }
+ } while (fail);
+
+ /* On amd64 sometimes the bottom 32-bits of r == the bottom 32-bits of buffer
+ * but the top 32-bits of r have overflown to 0xffffffff (seriously wtf getcwd
+ * so we return the buffer here since it has a pointer to the valid string
+ */
+ return buffer;
+}
--- /dev/null
+/*
+ * File utility functions.
+ *
+ * Author:
+ * Gonzalo Paniagua Javier (gonzalo@novell.com)
+ *
+ * (C) 2006 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.
+ */
+#include <config.h>
+#include <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <fcntl.h>
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+gboolean
+g_file_test (const gchar *filename, GFileTest test)
+{
+ struct stat st;
+ gboolean have_stat;
+
+ if (filename == NULL || test == 0)
+ return FALSE;
+
+ have_stat = FALSE;
+
+ if ((test & G_FILE_TEST_EXISTS) != 0) {
+ if (access (filename, F_OK) == 0)
+ return TRUE;
+ }
+
+ if ((test & G_FILE_TEST_IS_EXECUTABLE) != 0) {
+ if (access (filename, X_OK) == 0)
+ return TRUE;
+ }
+ if ((test & G_FILE_TEST_IS_SYMLINK) != 0) {
+ have_stat = (lstat (filename, &st) == 0);
+ if (have_stat && S_ISLNK (st.st_mode))
+ return TRUE;
+ }
+
+ if ((test & G_FILE_TEST_IS_REGULAR) != 0) {
+ if (!have_stat)
+ have_stat = (stat (filename, &st) == 0);
+ if (have_stat && S_ISREG (st.st_mode))
+ return TRUE;
+ }
+ if ((test & G_FILE_TEST_IS_DIR) != 0) {
+ if (!have_stat)
+ have_stat = (stat (filename, &st) == 0);
+ if (have_stat && S_ISDIR (st.st_mode))
+ return TRUE;
+ }
+ return FALSE;
+}
+
+gchar *
+g_mkdtemp (char *tmp_template)
+{
+#ifdef HAVE_MKDTEMP
+ char *template_copy = g_strdup (tmp_template);
+
+ return mkdtemp (template_copy);
+#else
+ g_error("Function not supported");
+#endif
+}
--- /dev/null
+/*
+ * File utility functions.
+ *
+ * Author:
+ * Gonzalo Paniagua Javier (gonzalo@novell.com)
+ *
+ * (C) 2006 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.
+ */
+#include <config.h>
+#include <windows.h>
+#include <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <direct.h>
+
+#ifdef G_OS_WIN32
+#include <io.h>
+#define open _open
+#ifndef S_ISREG
+#define S_ISREG(x) ((x & _S_IFMT) == _S_IFREG)
+#endif
+#ifndef S_ISDIR
+#define S_ISDIR(x) ((x & _S_IFMT) == _S_IFDIR)
+#endif
+#endif
+
+int mkstemp (char *tmp_template)
+{
+ int fd;
+ gunichar2* utf16_template;
+
+ utf16_template = u8to16 (tmp_template);
+
+ fd = -1;
+ utf16_template = _wmktemp( utf16_template);
+ if (utf16_template && *utf16_template) {
+ /* FIXME: _O_TEMPORARY causes file to disappear on close causing a test to fail */
+ fd = _wopen( utf16_template, _O_BINARY | _O_CREAT /*| _O_TEMPORARY*/ | _O_RDWR | _O_EXCL, _S_IREAD | _S_IWRITE);
+ }
+
+ /* FIXME: this will crash if utf16_template == NULL */
+ sprintf (tmp_template + strlen (tmp_template) - 6, "%S", utf16_template + wcslen (utf16_template) - 6);
+
+ g_free (utf16_template);
+ return fd;
+}
+
+gchar *
+g_mkdtemp (char *tmp_template)
+{
+ gunichar2* utf16_template;
+
+ utf16_template = u8to16 (tmp_template);
+
+ utf16_template = _wmktemp(utf16_template);
+ if (utf16_template && *utf16_template) {
+ if (_wmkdir (utf16_template) == 0){
+ char *ret = u16to8 (utf16_template);
+ g_free (utf16_template);
+ return ret;
+ }
+ }
+
+ g_free (utf16_template);
+ return NULL;
+}
+
+#ifdef _MSC_VER
+#pragma warning(disable:4701)
+#endif
+
+gboolean
+g_file_test (const gchar *filename, GFileTest test)
+{
+ gunichar2* utf16_filename = NULL;
+ DWORD attr;
+
+ if (filename == NULL || test == 0)
+ return FALSE;
+
+ utf16_filename = u8to16 (filename);
+ attr = GetFileAttributesW (utf16_filename);
+ g_free (utf16_filename);
+
+ if (attr == INVALID_FILE_ATTRIBUTES)
+ return FALSE;
+
+ if ((test & G_FILE_TEST_EXISTS) != 0) {
+ return TRUE;
+ }
+
+ if ((test & G_FILE_TEST_IS_EXECUTABLE) != 0) {
+ size_t len = strlen (filename);
+ if (len > 4 && strcmp (filename + len-3, "exe"))
+ return TRUE;
+
+ return FALSE;
+ }
+
+ if ((test & G_FILE_TEST_IS_REGULAR) != 0) {
+ if (attr & (FILE_ATTRIBUTE_DEVICE|FILE_ATTRIBUTE_DIRECTORY))
+ return FALSE;
+ return TRUE;
+ }
+
+ if ((test & G_FILE_TEST_IS_DIR) != 0) {
+ if (attr & FILE_ATTRIBUTE_DIRECTORY)
+ return TRUE;
+ }
+
+ /* make this last in case it is OR'd with something else */
+ if ((test & G_FILE_TEST_IS_SYMLINK) != 0) {
+ return FALSE;
+ }
+
+ return FALSE;
+}
--- /dev/null
+/*
+ * File utility functions.
+ *
+ * Author:
+ * Gonzalo Paniagua Javier (gonzalo@novell.com)
+ *
+ * (C) 2006 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.
+ */
+
+#include <config.h>
+
+#include <glib.h>
+#include <stdio.h>
+#include <string.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <errno.h>
+
+static gpointer error_quark = "FileError";
+
+gpointer
+g_file_error_quark (void)
+{
+ return error_quark;
+}
+
+GFileError
+g_file_error_from_errno (gint err_no)
+{
+ switch (err_no) {
+ case EEXIST:
+ return G_FILE_ERROR_EXIST;
+ case EISDIR:
+ return G_FILE_ERROR_ISDIR;
+ case EACCES:
+ return G_FILE_ERROR_ACCES;
+ case ENAMETOOLONG:
+ return G_FILE_ERROR_NAMETOOLONG;
+ case ENOENT:
+ return G_FILE_ERROR_NOENT;
+ case ENOTDIR:
+ return G_FILE_ERROR_NOTDIR;
+ case ENXIO:
+ return G_FILE_ERROR_NXIO;
+ case ENODEV:
+ return G_FILE_ERROR_NODEV;
+ case EROFS:
+ return G_FILE_ERROR_ROFS;
+#ifdef ETXTBSY
+ case ETXTBSY:
+ return G_FILE_ERROR_TXTBSY;
+#endif
+ case EFAULT:
+ return G_FILE_ERROR_FAULT;
+#ifdef ELOOP
+ case ELOOP:
+ return G_FILE_ERROR_LOOP;
+#endif
+ case ENOSPC:
+ return G_FILE_ERROR_NOSPC;
+ case ENOMEM:
+ return G_FILE_ERROR_NOMEM;
+ case EMFILE:
+ return G_FILE_ERROR_MFILE;
+ case ENFILE:
+ return G_FILE_ERROR_NFILE;
+ case EBADF:
+ return G_FILE_ERROR_BADF;
+ case EINVAL:
+ return G_FILE_ERROR_INVAL;
+ case EPIPE:
+ return G_FILE_ERROR_PIPE;
+ case EAGAIN:
+ return G_FILE_ERROR_AGAIN;
+ case EINTR:
+ return G_FILE_ERROR_INTR;
+ case EIO:
+ return G_FILE_ERROR_IO;
+ case EPERM:
+ return G_FILE_ERROR_PERM;
+ case ENOSYS:
+ return G_FILE_ERROR_NOSYS;
+ default:
+ return G_FILE_ERROR_FAILED;
+ }
+}
+
+#ifdef G_OS_WIN32
+#define TMP_FILE_FORMAT "%.*s%s.tmp"
+#else
+#define TMP_FILE_FORMAT "%.*s.%s~"
+#endif
+
+gboolean
+g_file_set_contents (const gchar *filename, const gchar *contents, gssize length, GError **err)
+{
+ const char *name;
+ char *path;
+ FILE *fp;
+
+ if (!(name = strrchr (filename, G_DIR_SEPARATOR)))
+ name = filename;
+ else
+ name++;
+
+ path = g_strdup_printf (TMP_FILE_FORMAT, name - filename, filename, name);
+ if (!(fp = fopen (path, "wb"))) {
+ g_set_error (err, G_FILE_ERROR, g_file_error_from_errno (errno), "%s", g_strerror (errno));
+ g_free (path);
+ return FALSE;
+ }
+
+ if (length < 0)
+ length = strlen (contents);
+
+ if (fwrite (contents, 1, length, fp) < length) {
+ g_set_error (err, G_FILE_ERROR, g_file_error_from_errno (ferror (fp)), "%s", g_strerror (ferror (fp)));
+ g_unlink (path);
+ g_free (path);
+ fclose (fp);
+
+ return FALSE;
+ }
+
+ fclose (fp);
+
+ if (g_rename (path, filename) != 0) {
+ g_set_error (err, G_FILE_ERROR, g_file_error_from_errno (errno), "%s", g_strerror (errno));
+ g_unlink (path);
+ g_free (path);
+ return FALSE;
+ }
+
+ g_free (path);
+
+ return TRUE;
+}
--- /dev/null
+/*
+ * ghashtable.c: Hashtable implementation
+ *
+ * Author:
+ * Miguel de Icaza (miguel@novell.com)
+ *
+ * (C) 2006 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.
+ */
+#include <stdio.h>
+#include <math.h>
+#include <glib.h>
+
+typedef struct _Slot Slot;
+
+struct _Slot {
+ gpointer key;
+ gpointer value;
+ Slot *next;
+};
+
+static gpointer KEYMARKER_REMOVED = &KEYMARKER_REMOVED;
+
+struct _GHashTable {
+ GHashFunc hash_func;
+ GEqualFunc key_equal_func;
+
+ Slot **table;
+ int table_size;
+ int in_use;
+ int threshold;
+ int last_rehash;
+ GDestroyNotify value_destroy_func, key_destroy_func;
+};
+
+typedef struct {
+ GHashTable *ht;
+ int slot_index;
+ Slot *slot;
+} Iter;
+
+static const guint prime_tbl[] = {
+ 11, 19, 37, 73, 109, 163, 251, 367, 557, 823, 1237,
+ 1861, 2777, 4177, 6247, 9371, 14057, 21089, 31627,
+ 47431, 71143, 106721, 160073, 240101, 360163,
+ 540217, 810343, 1215497, 1823231, 2734867, 4102283,
+ 6153409, 9230113, 13845163
+};
+
+static gboolean
+test_prime (int x)
+{
+ if ((x & 1) != 0) {
+ int n;
+ for (n = 3; n< (int)sqrt (x); n += 2) {
+ if ((x % n) == 0)
+ return FALSE;
+ }
+ return TRUE;
+ }
+ // There is only one even prime - 2.
+ return (x == 2);
+}
+
+static int
+calc_prime (int x)
+{
+ int i;
+
+ for (i = (x & (~1))-1; i< G_MAXINT32; i += 2) {
+ if (test_prime (i))
+ return i;
+ }
+ return x;
+}
+
+guint
+g_spaced_primes_closest (guint x)
+{
+ int i;
+
+ for (i = 0; i < G_N_ELEMENTS (prime_tbl); i++) {
+ if (x <= prime_tbl [i])
+ return prime_tbl [i];
+ }
+ return calc_prime (x);
+}
+
+GHashTable *
+g_hash_table_new (GHashFunc hash_func, GEqualFunc key_equal_func)
+{
+ GHashTable *hash;
+
+ if (hash_func == NULL)
+ hash_func = g_direct_hash;
+ if (key_equal_func == NULL)
+ key_equal_func = g_direct_equal;
+ hash = g_new0 (GHashTable, 1);
+
+ hash->hash_func = hash_func;
+ hash->key_equal_func = key_equal_func;
+
+ hash->table_size = g_spaced_primes_closest (1);
+ hash->table = g_new0 (Slot *, hash->table_size);
+ hash->last_rehash = hash->table_size;
+
+ return hash;
+}
+
+GHashTable *
+g_hash_table_new_full (GHashFunc hash_func, GEqualFunc key_equal_func,
+ GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func)
+{
+ GHashTable *hash = g_hash_table_new (hash_func, key_equal_func);
+ if (hash == NULL)
+ return NULL;
+
+ hash->key_destroy_func = key_destroy_func;
+ hash->value_destroy_func = value_destroy_func;
+
+ return hash;
+}
+
+#if 0
+static void
+dump_hash_table (GHashTable *hash)
+{
+ int i;
+
+ for (i = 0; i < hash->table_size; i++) {
+ Slot *s;
+
+ for (s = hash->table [i]; s != NULL; s = s->next){
+ guint hashcode = (*hash->hash_func) (s->key);
+ guint slot = (hashcode) % hash->table_size;
+ printf ("key %p hash %x on slot %d correct slot %d tb size %d\n", s->key, hashcode, i, slot, hash->table_size);
+ }
+ }
+}
+#endif
+
+#ifdef SANITY_CHECK
+static void
+sanity_check (GHashTable *hash)
+{
+ int i;
+
+ for (i = 0; i < hash->table_size; i++) {
+ Slot *s;
+
+ for (s = hash->table [i]; s != NULL; s = s->next){
+ guint hashcode = (*hash->hash_func) (s->key);
+ guint slot = (hashcode) % hash->table_size;
+ if (slot != i) {
+ dump_hashcode_func = 1;
+ hashcode = (*hash->hash_func) (s->key);
+ dump_hashcode_func = 0;
+ g_error ("Key %p (bucket %d) on invalid bucket %d (hashcode %x) (tb size %d)", s->key, slot, i, hashcode, hash->table_size);
+ }
+ }
+ }
+}
+#else
+
+#define sanity_check(HASH) do {}while(0)
+
+#endif
+
+static void
+do_rehash (GHashTable *hash)
+{
+ int current_size, i;
+ Slot **table;
+
+ /* printf ("Resizing diff=%d slots=%d\n", hash->in_use - hash->last_rehash, hash->table_size); */
+ hash->last_rehash = hash->table_size;
+ current_size = hash->table_size;
+ hash->table_size = g_spaced_primes_closest (hash->in_use);
+ /* printf ("New size: %d\n", hash->table_size); */
+ table = hash->table;
+ hash->table = g_new0 (Slot *, hash->table_size);
+
+ for (i = 0; i < current_size; i++){
+ Slot *s, *next;
+
+ for (s = table [i]; s != NULL; s = next){
+ guint hashcode = ((*hash->hash_func) (s->key)) % hash->table_size;
+ next = s->next;
+
+ s->next = hash->table [hashcode];
+ hash->table [hashcode] = s;
+ }
+ }
+ g_free (table);
+}
+
+static void
+rehash (GHashTable *hash)
+{
+ int diff = ABS (hash->last_rehash - hash->in_use);
+
+ /* These are the factors to play with to change the rehashing strategy */
+ /* I played with them with a large range, and could not really get */
+ /* something that was too good, maybe the tests are not that great */
+ if (!(diff * 0.75 > hash->table_size * 2))
+ return;
+ do_rehash (hash);
+ sanity_check (hash);
+}
+
+void
+g_hash_table_insert_replace (GHashTable *hash, gpointer key, gpointer value, gboolean replace)
+{
+ guint hashcode;
+ Slot *s;
+ GEqualFunc equal;
+
+ g_return_if_fail (hash != NULL);
+ sanity_check (hash);
+
+ equal = hash->key_equal_func;
+ if (hash->in_use >= hash->threshold)
+ rehash (hash);
+
+ hashcode = ((*hash->hash_func) (key)) % hash->table_size;
+ for (s = hash->table [hashcode]; s != NULL; s = s->next){
+ if ((*equal) (s->key, key)){
+ if (replace){
+ if (hash->key_destroy_func != NULL)
+ (*hash->key_destroy_func)(s->key);
+ s->key = key;
+ }
+ if (hash->value_destroy_func != NULL)
+ (*hash->value_destroy_func) (s->value);
+ s->value = value;
+ sanity_check (hash);
+ return;
+ }
+ }
+ s = g_new (Slot, 1);
+ s->key = key;
+ s->value = value;
+ s->next = hash->table [hashcode];
+ hash->table [hashcode] = s;
+ hash->in_use++;
+ sanity_check (hash);
+}
+
+GList*
+g_hash_table_get_keys (GHashTable *hash)
+{
+ GHashTableIter iter;
+ GList *rv = NULL;
+ gpointer key;
+
+ g_hash_table_iter_init (&iter, hash);
+
+ while (g_hash_table_iter_next (&iter, &key, NULL))
+ rv = g_list_prepend (rv, key);
+
+ return g_list_reverse (rv);
+}
+
+GList*
+g_hash_table_get_values (GHashTable *hash)
+{
+ GHashTableIter iter;
+ GList *rv = NULL;
+ gpointer value;
+
+ g_hash_table_iter_init (&iter, hash);
+
+ while (g_hash_table_iter_next (&iter, NULL, &value))
+ rv = g_list_prepend (rv, value);
+
+ return g_list_reverse (rv);
+}
+
+
+guint
+g_hash_table_size (GHashTable *hash)
+{
+ g_return_val_if_fail (hash != NULL, 0);
+
+ return hash->in_use;
+}
+
+gpointer
+g_hash_table_lookup (GHashTable *hash, gconstpointer key)
+{
+ gpointer orig_key, value;
+
+ if (g_hash_table_lookup_extended (hash, key, &orig_key, &value))
+ return value;
+ else
+ return NULL;
+}
+
+gboolean
+g_hash_table_lookup_extended (GHashTable *hash, gconstpointer key, gpointer *orig_key, gpointer *value)
+{
+ GEqualFunc equal;
+ Slot *s;
+ guint hashcode;
+
+ g_return_val_if_fail (hash != NULL, FALSE);
+ sanity_check (hash);
+ equal = hash->key_equal_func;
+
+ hashcode = ((*hash->hash_func) (key)) % hash->table_size;
+
+ for (s = hash->table [hashcode]; s != NULL; s = s->next){
+ if ((*equal)(s->key, key)){
+ if (orig_key)
+ *orig_key = s->key;
+ if (value)
+ *value = s->value;
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+void
+g_hash_table_foreach (GHashTable *hash, GHFunc func, gpointer user_data)
+{
+ int i;
+
+ g_return_if_fail (hash != NULL);
+ g_return_if_fail (func != NULL);
+
+ for (i = 0; i < hash->table_size; i++){
+ Slot *s;
+
+ for (s = hash->table [i]; s != NULL; s = s->next)
+ (*func)(s->key, s->value, user_data);
+ }
+}
+
+gpointer
+g_hash_table_find (GHashTable *hash, GHRFunc predicate, gpointer user_data)
+{
+ int i;
+
+ g_return_val_if_fail (hash != NULL, NULL);
+ g_return_val_if_fail (predicate != NULL, NULL);
+
+ for (i = 0; i < hash->table_size; i++){
+ Slot *s;
+
+ for (s = hash->table [i]; s != NULL; s = s->next)
+ if ((*predicate)(s->key, s->value, user_data))
+ return s->value;
+ }
+ return NULL;
+}
+
+void
+g_hash_table_remove_all (GHashTable *hash)
+{
+ int i;
+
+ g_return_if_fail (hash != NULL);
+
+ for (i = 0; i < hash->table_size; i++){
+ Slot *s;
+
+ while (hash->table [i]) {
+ s = hash->table [i];
+ g_hash_table_remove (hash, s->key);
+ }
+ }
+}
+
+gboolean
+g_hash_table_remove (GHashTable *hash, gconstpointer key)
+{
+ GEqualFunc equal;
+ Slot *s, *last;
+ guint hashcode;
+
+ g_return_val_if_fail (hash != NULL, FALSE);
+ sanity_check (hash);
+ equal = hash->key_equal_func;
+
+ hashcode = ((*hash->hash_func)(key)) % hash->table_size;
+ last = NULL;
+ for (s = hash->table [hashcode]; s != NULL; s = s->next){
+ if ((*equal)(s->key, key)){
+ if (hash->key_destroy_func != NULL)
+ (*hash->key_destroy_func)(s->key);
+ if (hash->value_destroy_func != NULL)
+ (*hash->value_destroy_func)(s->value);
+ if (last == NULL)
+ hash->table [hashcode] = s->next;
+ else
+ last->next = s->next;
+ g_free (s);
+ hash->in_use--;
+ sanity_check (hash);
+ return TRUE;
+ }
+ last = s;
+ }
+ sanity_check (hash);
+ return FALSE;
+}
+
+guint
+g_hash_table_foreach_remove (GHashTable *hash, GHRFunc func, gpointer user_data)
+{
+ int i;
+ int count = 0;
+
+ g_return_val_if_fail (hash != NULL, 0);
+ g_return_val_if_fail (func != NULL, 0);
+
+ sanity_check (hash);
+ for (i = 0; i < hash->table_size; i++){
+ Slot *s, *last;
+
+ last = NULL;
+ for (s = hash->table [i]; s != NULL; ){
+ if ((*func)(s->key, s->value, user_data)){
+ Slot *n;
+
+ if (hash->key_destroy_func != NULL)
+ (*hash->key_destroy_func)(s->key);
+ if (hash->value_destroy_func != NULL)
+ (*hash->value_destroy_func)(s->value);
+ if (last == NULL){
+ hash->table [i] = s->next;
+ n = s->next;
+ } else {
+ last->next = s->next;
+ n = last->next;
+ }
+ g_free (s);
+ hash->in_use--;
+ count++;
+ s = n;
+ } else {
+ last = s;
+ s = s->next;
+ }
+ }
+ }
+ sanity_check (hash);
+ if (count > 0)
+ rehash (hash);
+ return count;
+}
+
+gboolean
+g_hash_table_steal (GHashTable *hash, gconstpointer key)
+{
+ GEqualFunc equal;
+ Slot *s, *last;
+ guint hashcode;
+
+ g_return_val_if_fail (hash != NULL, FALSE);
+ sanity_check (hash);
+ equal = hash->key_equal_func;
+
+ hashcode = ((*hash->hash_func)(key)) % hash->table_size;
+ last = NULL;
+ for (s = hash->table [hashcode]; s != NULL; s = s->next){
+ if ((*equal)(s->key, key)) {
+ if (last == NULL)
+ hash->table [hashcode] = s->next;
+ else
+ last->next = s->next;
+ g_free (s);
+ hash->in_use--;
+ sanity_check (hash);
+ return TRUE;
+ }
+ last = s;
+ }
+ sanity_check (hash);
+ return FALSE;
+
+}
+
+guint
+g_hash_table_foreach_steal (GHashTable *hash, GHRFunc func, gpointer user_data)
+{
+ int i;
+ int count = 0;
+
+ g_return_val_if_fail (hash != NULL, 0);
+ g_return_val_if_fail (func != NULL, 0);
+
+ sanity_check (hash);
+ for (i = 0; i < hash->table_size; i++){
+ Slot *s, *last;
+
+ last = NULL;
+ for (s = hash->table [i]; s != NULL; ){
+ if ((*func)(s->key, s->value, user_data)){
+ Slot *n;
+
+ if (last == NULL){
+ hash->table [i] = s->next;
+ n = s->next;
+ } else {
+ last->next = s->next;
+ n = last->next;
+ }
+ g_free (s);
+ hash->in_use--;
+ count++;
+ s = n;
+ } else {
+ last = s;
+ s = s->next;
+ }
+ }
+ }
+ sanity_check (hash);
+ if (count > 0)
+ rehash (hash);
+ return count;
+}
+
+void
+g_hash_table_destroy (GHashTable *hash)
+{
+ int i;
+
+ g_return_if_fail (hash != NULL);
+
+ for (i = 0; i < hash->table_size; i++){
+ Slot *s, *next;
+
+ for (s = hash->table [i]; s != NULL; s = next){
+ next = s->next;
+
+ if (hash->key_destroy_func != NULL)
+ (*hash->key_destroy_func)(s->key);
+ if (hash->value_destroy_func != NULL)
+ (*hash->value_destroy_func)(s->value);
+ g_free (s);
+ }
+ }
+ g_free (hash->table);
+
+ g_free (hash);
+}
+
+void
+g_hash_table_print_stats (GHashTable *table)
+{
+ int i, max_chain_index, chain_size, max_chain_size;
+ Slot *node;
+
+ max_chain_size = 0;
+ max_chain_index = -1;
+ for (i = 0; i < table->table_size; i++) {
+ chain_size = 0;
+ for (node = table->table [i]; node; node = node->next)
+ chain_size ++;
+ if (chain_size > max_chain_size) {
+ max_chain_size = chain_size;
+ max_chain_index = i;
+ }
+ }
+
+ printf ("Size: %d Table Size: %d Max Chain Length: %d at %d\n", table->in_use, table->table_size, max_chain_size, max_chain_index);
+}
+
+void
+g_hash_table_iter_init (GHashTableIter *it, GHashTable *hash_table)
+{
+ Iter *iter = (Iter*)it;
+
+ memset (iter, 0, sizeof (Iter));
+ iter->ht = hash_table;
+ iter->slot_index = -1;
+}
+
+gboolean g_hash_table_iter_next (GHashTableIter *it, gpointer *key, gpointer *value)
+{
+ Iter *iter = (Iter*)it;
+
+ GHashTable *hash = iter->ht;
+
+ g_assert (iter->slot_index != -2);
+ g_assert (sizeof (Iter) <= sizeof (GHashTableIter));
+
+ if (!iter->slot) {
+ while (TRUE) {
+ iter->slot_index ++;
+ if (iter->slot_index >= hash->table_size) {
+ iter->slot_index = -2;
+ return FALSE;
+ }
+ if (hash->table [iter->slot_index])
+ break;
+ }
+ iter->slot = hash->table [iter->slot_index];
+ }
+
+ if (key)
+ *key = iter->slot->key;
+ if (value)
+ *value = iter->slot->value;
+ iter->slot = iter->slot->next;
+
+ return TRUE;
+}
+
+gboolean
+g_direct_equal (gconstpointer v1, gconstpointer v2)
+{
+ return v1 == v2;
+}
+
+guint
+g_direct_hash (gconstpointer v1)
+{
+ return GPOINTER_TO_UINT (v1);
+}
+
+gboolean
+g_int_equal (gconstpointer v1, gconstpointer v2)
+{
+ return *(gint *)v1 == *(gint *)v2;
+}
+
+guint
+g_int_hash (gconstpointer v1)
+{
+ return *(guint *)v1;
+}
+
+gboolean
+g_str_equal (gconstpointer v1, gconstpointer v2)
+{
+ return strcmp (v1, v2) == 0;
+}
+
+guint
+g_str_hash (gconstpointer v1)
+{
+ guint hash = 0;
+ char *p = (char *) v1;
+
+ while (*p++)
+ hash = (hash << 5) - (hash + *p);
+
+ return hash;
+}
--- /dev/null
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2011 Jeffrey Stedfast
+ *
+ * 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib.h>
+#include <string.h>
+#ifdef HAVE_ICONV_H
+#include <iconv.h>
+#endif
+#include <errno.h>
+
+#ifdef _MSC_VER
+#define FORCE_INLINE(RET_TYPE) __forceinline RET_TYPE
+#else
+#define FORCE_INLINE(RET_TYPE) inline RET_TYPE __attribute__((always_inline))
+#endif
+
+
+#define UNROLL_DECODE_UTF8 0
+#define UNROLL_ENCODE_UTF8 0
+
+typedef int (* Decoder) (char *inbuf, size_t inleft, gunichar *outchar);
+typedef int (* Encoder) (gunichar c, char *outbuf, size_t outleft);
+
+struct _GIConv {
+ Decoder decode;
+ Encoder encode;
+ gunichar c;
+#ifdef HAVE_ICONV
+ iconv_t cd;
+#endif
+};
+
+static int decode_utf32be (char *inbuf, size_t inleft, gunichar *outchar);
+static int encode_utf32be (gunichar c, char *outbuf, size_t outleft);
+
+static int decode_utf32le (char *inbuf, size_t inleft, gunichar *outchar);
+static int encode_utf32le (gunichar c, char *outbuf, size_t outleft);
+
+static int decode_utf16be (char *inbuf, size_t inleft, gunichar *outchar);
+static int encode_utf16be (gunichar c, char *outbuf, size_t outleft);
+
+static int decode_utf16le (char *inbuf, size_t inleft, gunichar *outchar);
+static int encode_utf16le (gunichar c, char *outbuf, size_t outleft);
+
+static FORCE_INLINE (int) decode_utf8 (char *inbuf, size_t inleft, gunichar *outchar);
+static int encode_utf8 (gunichar c, char *outbuf, size_t outleft);
+
+static int decode_latin1 (char *inbuf, size_t inleft, gunichar *outchar);
+static int encode_latin1 (gunichar c, char *outbuf, size_t outleft);
+
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+#define decode_utf32 decode_utf32le
+#define encode_utf32 encode_utf32le
+#define decode_utf16 decode_utf16le
+#define encode_utf16 encode_utf16le
+#else
+#define decode_utf32 decode_utf32be
+#define encode_utf32 encode_utf32be
+#define decode_utf16 decode_utf16be
+#define encode_utf16 encode_utf16be
+#endif
+
+static struct {
+ const char *name;
+ Decoder decoder;
+ Encoder encoder;
+} charsets[] = {
+ { "ISO-8859-1", decode_latin1, encode_latin1 },
+ { "ISO8859-1", decode_latin1, encode_latin1 },
+ { "UTF-32BE", decode_utf32be, encode_utf32be },
+ { "UTF-32LE", decode_utf32le, encode_utf32le },
+ { "UTF-16BE", decode_utf16be, encode_utf16be },
+ { "UTF-16LE", decode_utf16le, encode_utf16le },
+ { "UTF-32", decode_utf32, encode_utf32 },
+ { "UTF-16", decode_utf16, encode_utf16 },
+ { "UTF-8", decode_utf8, encode_utf8 },
+ { "US-ASCII", decode_latin1, encode_latin1 },
+ { "Latin1", decode_latin1, encode_latin1 },
+ { "ASCII", decode_latin1, encode_latin1 },
+ { "UTF32", decode_utf32, encode_utf32 },
+ { "UTF16", decode_utf16, encode_utf16 },
+ { "UTF8", decode_utf8, encode_utf8 },
+};
+
+
+GIConv
+g_iconv_open (const char *to_charset, const char *from_charset)
+{
+#ifdef HAVE_ICONV
+ iconv_t icd = (iconv_t) -1;
+#endif
+ Decoder decoder = NULL;
+ Encoder encoder = NULL;
+ GIConv cd;
+ guint i;
+
+ if (!to_charset || !from_charset || !to_charset[0] || !from_charset[0]) {
+ errno = EINVAL;
+
+ return (GIConv) -1;
+ }
+
+ for (i = 0; i < G_N_ELEMENTS (charsets); i++) {
+ if (!g_ascii_strcasecmp (charsets[i].name, from_charset))
+ decoder = charsets[i].decoder;
+
+ if (!g_ascii_strcasecmp (charsets[i].name, to_charset))
+ encoder = charsets[i].encoder;
+ }
+
+ if (!encoder || !decoder) {
+#ifdef HAVE_ICONV
+ if ((icd = iconv_open (to_charset, from_charset)) == (iconv_t) -1)
+ return (GIConv) -1;
+#else
+ errno = EINVAL;
+
+ return (GIConv) -1;
+#endif
+ }
+
+ cd = (GIConv) g_malloc (sizeof (struct _GIConv));
+ cd->decode = decoder;
+ cd->encode = encoder;
+ cd->c = -1;
+
+#ifdef HAVE_ICONV
+ cd->cd = icd;
+#endif
+
+ return cd;
+}
+
+int
+g_iconv_close (GIConv cd)
+{
+#ifdef HAVE_ICONV
+ if (cd->cd != (iconv_t) -1)
+ iconv_close (cd->cd);
+#endif
+
+ g_free (cd);
+
+ return 0;
+}
+
+gsize
+g_iconv (GIConv cd, gchar **inbytes, gsize *inbytesleft,
+ gchar **outbytes, gsize *outbytesleft)
+{
+ gsize inleft, outleft;
+ char *inptr, *outptr;
+ gunichar c;
+ int rc = 0;
+
+#ifdef HAVE_ICONV
+ if (cd->cd != (iconv_t) -1) {
+ /* Note: gsize may have a different size than size_t, so we need to
+ remap inbytesleft and outbytesleft to size_t's. */
+ size_t *outleftptr, *inleftptr;
+ size_t n_outleft, n_inleft;
+
+ if (inbytesleft) {
+ n_inleft = *inbytesleft;
+ inleftptr = &n_inleft;
+ } else {
+ inleftptr = NULL;
+ }
+
+ if (outbytesleft) {
+ n_outleft = *outbytesleft;
+ outleftptr = &n_outleft;
+ } else {
+ outleftptr = NULL;
+ }
+#if defined(__NetBSD__)
+ return iconv (cd->cd, (const gchar **)inbytes, inleftptr, outbytes, outleftptr);
+#else
+ return iconv (cd->cd, inbytes, inleftptr, outbytes, outleftptr);
+#endif
+ }
+#endif
+
+ if (outbytes == NULL || outbytesleft == NULL) {
+ /* reset converter */
+ cd->c = -1;
+ return 0;
+ }
+
+ inleft = inbytesleft ? *inbytesleft : 0;
+ inptr = inbytes ? *inbytes : NULL;
+ outleft = *outbytesleft;
+ outptr = *outbytes;
+
+ if ((c = cd->c) != (gunichar) -1)
+ goto encode;
+
+ while (inleft > 0) {
+ if ((rc = cd->decode (inptr, inleft, &c)) < 0)
+ break;
+
+ inleft -= rc;
+ inptr += rc;
+
+ encode:
+ if ((rc = cd->encode (c, outptr, outleft)) < 0)
+ break;
+
+ c = (gunichar) -1;
+ outleft -= rc;
+ outptr += rc;
+ }
+
+ if (inbytesleft)
+ *inbytesleft = inleft;
+
+ if (inbytes)
+ *inbytes = inptr;
+
+ *outbytesleft = outleft;
+ *outbytes = outptr;
+ cd->c = c;
+
+ return rc < 0 ? -1 : 0;
+}
+
+/*
+ * Unicode encoders and decoders
+ */
+
+static int
+decode_utf32be (char *inbuf, size_t inleft, gunichar *outchar)
+{
+ unsigned char *inptr = (unsigned char *) inbuf;
+ gunichar c;
+
+ if (inleft < 4) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ c = (inptr[0] << 24) | (inptr[1] << 16) | (inptr[2] << 8) | inptr[3];
+
+ if (c >= 0xd800 && c < 0xe000) {
+ errno = EILSEQ;
+ return -1;
+ } else if (c >= 0x110000) {
+ errno = EILSEQ;
+ return -1;
+ }
+
+ *outchar = c;
+
+ return 4;
+}
+
+static int
+decode_utf32le (char *inbuf, size_t inleft, gunichar *outchar)
+{
+ unsigned char *inptr = (unsigned char *) inbuf;
+ gunichar c;
+
+ if (inleft < 4) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ c = (inptr[3] << 24) | (inptr[2] << 16) | (inptr[1] << 8) | inptr[0];
+
+ if (c >= 0xd800 && c < 0xe000) {
+ errno = EILSEQ;
+ return -1;
+ } else if (c >= 0x110000) {
+ errno = EILSEQ;
+ return -1;
+ }
+
+ *outchar = c;
+
+ return 4;
+}
+
+static int
+encode_utf32be (gunichar c, char *outbuf, size_t outleft)
+{
+ unsigned char *outptr = (unsigned char *) outbuf;
+
+ if (outleft < 4) {
+ errno = E2BIG;
+ return -1;
+ }
+
+ outptr[0] = (c >> 24) & 0xff;
+ outptr[1] = (c >> 16) & 0xff;
+ outptr[2] = (c >> 8) & 0xff;
+ outptr[3] = c & 0xff;
+
+ return 4;
+}
+
+static int
+encode_utf32le (gunichar c, char *outbuf, size_t outleft)
+{
+ unsigned char *outptr = (unsigned char *) outbuf;
+
+ if (outleft < 4) {
+ errno = E2BIG;
+ return -1;
+ }
+
+ outptr[0] = c & 0xff;
+ outptr[1] = (c >> 8) & 0xff;
+ outptr[2] = (c >> 16) & 0xff;
+ outptr[3] = (c >> 24) & 0xff;
+
+ return 4;
+}
+
+static int
+decode_utf16be (char *inbuf, size_t inleft, gunichar *outchar)
+{
+ unsigned char *inptr = (unsigned char *) inbuf;
+ gunichar2 c;
+ gunichar u;
+
+ if (inleft < 2) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ u = (inptr[0] << 8) | inptr[1];
+
+ if (u < 0xd800) {
+ /* 0x0000 -> 0xd7ff */
+ *outchar = u;
+ return 2;
+ } else if (u < 0xdc00) {
+ /* 0xd800 -> 0xdbff */
+ if (inleft < 4) {
+ errno = EINVAL;
+ return -2;
+ }
+
+ c = (inptr[2] << 8) | inptr[3];
+
+ if (c < 0xdc00 || c > 0xdfff) {
+ errno = EILSEQ;
+ return -2;
+ }
+
+ u = ((u - 0xd800) << 10) + (c - 0xdc00) + 0x0010000UL;
+ *outchar = u;
+
+ return 4;
+ } else if (u < 0xe000) {
+ /* 0xdc00 -> 0xdfff */
+ errno = EILSEQ;
+ return -1;
+ } else {
+ /* 0xe000 -> 0xffff */
+ *outchar = u;
+ return 2;
+ }
+}
+
+static int
+decode_utf16le (char *inbuf, size_t inleft, gunichar *outchar)
+{
+ unsigned char *inptr = (unsigned char *) inbuf;
+ gunichar2 c;
+ gunichar u;
+
+ if (inleft < 2) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ u = (inptr[1] << 8) | inptr[0];
+
+ if (u < 0xd800) {
+ /* 0x0000 -> 0xd7ff */
+ *outchar = u;
+ return 2;
+ } else if (u < 0xdc00) {
+ /* 0xd800 -> 0xdbff */
+ if (inleft < 4) {
+ errno = EINVAL;
+ return -2;
+ }
+
+ c = (inptr[3] << 8) | inptr[2];
+
+ if (c < 0xdc00 || c > 0xdfff) {
+ errno = EILSEQ;
+ return -2;
+ }
+
+ u = ((u - 0xd800) << 10) + (c - 0xdc00) + 0x0010000UL;
+ *outchar = u;
+
+ return 4;
+ } else if (u < 0xe000) {
+ /* 0xdc00 -> 0xdfff */
+ errno = EILSEQ;
+ return -1;
+ } else {
+ /* 0xe000 -> 0xffff */
+ *outchar = u;
+ return 2;
+ }
+}
+
+static int
+encode_utf16be (gunichar c, char *outbuf, size_t outleft)
+{
+ unsigned char *outptr = (unsigned char *) outbuf;
+ gunichar2 ch;
+ gunichar c2;
+
+ if (c < 0x10000) {
+ if (outleft < 2) {
+ errno = E2BIG;
+ return -1;
+ }
+
+ outptr[0] = (c >> 8) & 0xff;
+ outptr[1] = c & 0xff;
+
+ return 2;
+ } else {
+ if (outleft < 4) {
+ errno = E2BIG;
+ return -1;
+ }
+
+ c2 = c - 0x10000;
+
+ ch = (gunichar2) ((c2 >> 10) + 0xd800);
+ outptr[0] = (ch >> 8) & 0xff;
+ outptr[1] = ch & 0xff;
+
+ ch = (gunichar2) ((c2 & 0x3ff) + 0xdc00);
+ outptr[2] = (ch >> 8) & 0xff;
+ outptr[3] = ch & 0xff;
+
+ return 4;
+ }
+}
+
+static int
+encode_utf16le (gunichar c, char *outbuf, size_t outleft)
+{
+ unsigned char *outptr = (unsigned char *) outbuf;
+ gunichar2 ch;
+ gunichar c2;
+
+ if (c < 0x10000) {
+ if (outleft < 2) {
+ errno = E2BIG;
+ return -1;
+ }
+
+ outptr[0] = c & 0xff;
+ outptr[1] = (c >> 8) & 0xff;
+
+ return 2;
+ } else {
+ if (outleft < 4) {
+ errno = E2BIG;
+ return -1;
+ }
+
+ c2 = c - 0x10000;
+
+ ch = (gunichar2) ((c2 >> 10) + 0xd800);
+ outptr[0] = ch & 0xff;
+ outptr[1] = (ch >> 8) & 0xff;
+
+ ch = (gunichar2) ((c2 & 0x3ff) + 0xdc00);
+ outptr[2] = ch & 0xff;
+ outptr[3] = (ch >> 8) & 0xff;
+
+ return 4;
+ }
+}
+
+static FORCE_INLINE (int)
+decode_utf8 (char *inbuf, size_t inleft, gunichar *outchar)
+{
+ unsigned char *inptr = (unsigned char *) inbuf;
+ gunichar u;
+ int n, i;
+
+ u = *inptr;
+
+ if (u < 0x80) {
+ /* simple ascii case */
+ *outchar = u;
+ return 1;
+ } else if (u < 0xc2) {
+ errno = EILSEQ;
+ return -1;
+ } else if (u < 0xe0) {
+ u &= 0x1f;
+ n = 2;
+ } else if (u < 0xf0) {
+ u &= 0x0f;
+ n = 3;
+ } else if (u < 0xf8) {
+ u &= 0x07;
+ n = 4;
+ } else if (u < 0xfc) {
+ u &= 0x03;
+ n = 5;
+ } else if (u < 0xfe) {
+ u &= 0x01;
+ n = 6;
+ } else {
+ errno = EILSEQ;
+ return -1;
+ }
+
+ if (n > inleft) {
+ errno = EINVAL;
+ return -1;
+ }
+
+#if UNROLL_DECODE_UTF8
+ switch (n) {
+ case 6: u = (u << 6) | (*++inptr ^ 0x80);
+ case 5: u = (u << 6) | (*++inptr ^ 0x80);
+ case 4: u = (u << 6) | (*++inptr ^ 0x80);
+ case 3: u = (u << 6) | (*++inptr ^ 0x80);
+ case 2: u = (u << 6) | (*++inptr ^ 0x80);
+ }
+#else
+ for (i = 1; i < n; i++)
+ u = (u << 6) | (*++inptr ^ 0x80);
+#endif
+
+ *outchar = u;
+
+ return n;
+}
+
+static int
+encode_utf8 (gunichar c, char *outbuf, size_t outleft)
+{
+ unsigned char *outptr = (unsigned char *) outbuf;
+ int base, n, i;
+
+ if (c < 0x80) {
+ outptr[0] = c;
+ return 1;
+ } else if (c < 0x800) {
+ base = 192;
+ n = 2;
+ } else if (c < 0x10000) {
+ base = 224;
+ n = 3;
+ } else if (c < 0x200000) {
+ base = 240;
+ n = 4;
+ } else if (c < 0x4000000) {
+ base = 248;
+ n = 5;
+ } else {
+ base = 252;
+ n = 6;
+ }
+
+ if (outleft < n) {
+ errno = E2BIG;
+ return -1;
+ }
+
+#if UNROLL_ENCODE_UTF8
+ switch (n) {
+ case 6: outptr[5] = (c & 0x3f) | 0x80; c >>= 6;
+ case 5: outptr[4] = (c & 0x3f) | 0x80; c >>= 6;
+ case 4: outptr[3] = (c & 0x3f) | 0x80; c >>= 6;
+ case 3: outptr[2] = (c & 0x3f) | 0x80; c >>= 6;
+ case 2: outptr[1] = (c & 0x3f) | 0x80; c >>= 6;
+ case 1: outptr[0] = c | base;
+ }
+#else
+ for (i = n - 1; i > 0; i--) {
+ outptr[i] = (c & 0x3f) | 0x80;
+ c >>= 6;
+ }
+
+ outptr[0] = c | base;
+#endif
+
+ return n;
+}
+
+static int
+decode_latin1 (char *inbuf, size_t inleft, gunichar *outchar)
+{
+ *outchar = (unsigned char) *inbuf;
+ return 1;
+}
+
+static int
+encode_latin1 (gunichar c, char *outbuf, size_t outleft)
+{
+ if (outleft < 1) {
+ errno = E2BIG;
+ return -1;
+ }
+
+ if (c > 0xff) {
+ errno = EILSEQ;
+ return -1;
+ }
+
+ *outbuf = (char) c;
+
+ return 1;
+}
+
+
+/*
+ * Simple conversion API
+ */
+
+static gpointer error_quark = "ConvertError";
+
+gpointer
+g_convert_error_quark (void)
+{
+ return error_quark;
+}
+
+gchar *
+g_convert (const gchar *str, gssize len, const gchar *to_charset, const gchar *from_charset,
+ gsize *bytes_read, gsize *bytes_written, GError **err)
+{
+ gsize outsize, outused, outleft, inleft, grow, rc;
+ char *result, *outbuf, *inbuf;
+ gboolean flush = FALSE;
+ gboolean done = FALSE;
+ GIConv cd;
+
+ g_return_val_if_fail (str != NULL, NULL);
+ g_return_val_if_fail (to_charset != NULL, NULL);
+ g_return_val_if_fail (from_charset != NULL, NULL);
+
+ if ((cd = g_iconv_open (to_charset, from_charset)) == (GIConv) -1) {
+ g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_NO_CONVERSION,
+ "Conversion from %s to %s not supported.",
+ from_charset, to_charset);
+
+ if (bytes_written)
+ *bytes_written = 0;
+
+ if (bytes_read)
+ *bytes_read = 0;
+
+ return NULL;
+ }
+
+ inleft = len < 0 ? strlen (str) : len;
+ inbuf = (char *) str;
+
+ outleft = outsize = MAX (inleft, 8);
+ outbuf = result = g_malloc (outsize + 4);
+
+ do {
+ if (!flush)
+ rc = g_iconv (cd, &inbuf, &inleft, &outbuf, &outleft);
+ else
+ rc = g_iconv (cd, NULL, NULL, &outbuf, &outleft);
+
+ if (rc == (gsize) -1) {
+ switch (errno) {
+ case E2BIG:
+ /* grow our result buffer */
+ grow = MAX (inleft, 8) << 1;
+ outused = outbuf - result;
+ outsize += grow;
+ outleft += grow;
+ result = g_realloc (result, outsize + 4);
+ outbuf = result + outused;
+ break;
+ case EINVAL:
+ /* incomplete input, stop converting and terminate here */
+ if (flush)
+ done = TRUE;
+ else
+ flush = TRUE;
+ break;
+ case EILSEQ:
+ /* illegal sequence in the input */
+ g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE, "%s", g_strerror (errno));
+
+ if (bytes_read) {
+ /* save offset of the illegal input sequence */
+ *bytes_read = (inbuf - str);
+ }
+
+ if (bytes_written)
+ *bytes_written = 0;
+
+ g_iconv_close (cd);
+ g_free (result);
+ return NULL;
+ default:
+ /* unknown errno */
+ g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED, "%s", g_strerror (errno));
+
+ if (bytes_written)
+ *bytes_written = 0;
+
+ if (bytes_read)
+ *bytes_read = 0;
+
+ g_iconv_close (cd);
+ g_free (result);
+ return NULL;
+ }
+ } else if (flush) {
+ /* input has been converted and output has been flushed */
+ break;
+ } else {
+ /* input has been converted, need to flush the output */
+ flush = TRUE;
+ }
+ } while (!done);
+
+ g_iconv_close (cd);
+
+ /* Note: not all charsets can be null-terminated with a single
+ null byte. UCS2, for example, needs 2 null bytes and UCS4
+ needs 4. I hope that 4 null bytes is enough to terminate all
+ multibyte charsets? */
+
+ /* null-terminate the result */
+ memset (outbuf, 0, 4);
+
+ if (bytes_written)
+ *bytes_written = outbuf - result;
+
+ if (bytes_read)
+ *bytes_read = inbuf - str;
+
+ return result;
+}
+
+
+/*
+ * Unicode conversion
+ */
+
+/**
+ * An explanation of the conversion can be found at:
+ * http://home.tiscali.nl/t876506/utf8tbl.html
+ *
+ **/
+gint
+g_unichar_to_utf8 (gunichar c, gchar *outbuf)
+{
+ int base, n, i;
+
+ if (c < 0x80) {
+ base = 0;
+ n = 1;
+ } else if (c < 0x800) {
+ base = 192;
+ n = 2;
+ } else if (c < 0x10000) {
+ base = 224;
+ n = 3;
+ } else if (c < 0x200000) {
+ base = 240;
+ n = 4;
+ } else if (c < 0x4000000) {
+ base = 248;
+ n = 5;
+ } else if (c < 0x80000000) {
+ base = 252;
+ n = 6;
+ } else {
+ return -1;
+ }
+
+ if (outbuf != NULL) {
+ for (i = n - 1; i > 0; i--) {
+ /* mask off 6 bits worth and add 128 */
+ outbuf[i] = (c & 0x3f) | 0x80;
+ c >>= 6;
+ }
+
+ /* first character has a different base */
+ outbuf[0] = c | base;
+ }
+
+ return n;
+}
+
+static FORCE_INLINE (int)
+g_unichar_to_utf16 (gunichar c, gunichar2 *outbuf)
+{
+ gunichar c2;
+
+ if (c < 0xd800) {
+ if (outbuf)
+ *outbuf = (gunichar2) c;
+
+ return 1;
+ } else if (c < 0xe000) {
+ return -1;
+ } else if (c < 0x10000) {
+ if (outbuf)
+ *outbuf = (gunichar2) c;
+
+ return 1;
+ } else if (c < 0x110000) {
+ if (outbuf) {
+ c2 = c - 0x10000;
+
+ outbuf[0] = (gunichar2) ((c2 >> 10) + 0xd800);
+ outbuf[1] = (gunichar2) ((c2 & 0x3ff) + 0xdc00);
+ }
+
+ return 2;
+ } else {
+ return -1;
+ }
+}
+
+gunichar *
+g_utf8_to_ucs4_fast (const gchar *str, glong len, glong *items_written)
+{
+ gunichar *outbuf, *outptr;
+ char *inptr;
+ glong n, i;
+
+ g_return_val_if_fail (str != NULL, NULL);
+
+ n = g_utf8_strlen (str, len);
+
+ if (items_written)
+ *items_written = n;
+
+ outptr = outbuf = g_malloc ((n + 1) * sizeof (gunichar));
+ inptr = (char *) str;
+
+ for (i = 0; i < n; i++) {
+ *outptr++ = g_utf8_get_char (inptr);
+ inptr = g_utf8_next_char (inptr);
+ }
+
+ *outptr = 0;
+
+ return outbuf;
+}
+
+static gunichar2 *
+eg_utf8_to_utf16_general (const gchar *str, glong len, glong *items_read, glong *items_written, gboolean include_nuls, GError **err)
+{
+ gunichar2 *outbuf, *outptr;
+ size_t outlen = 0;
+ size_t inleft;
+ char *inptr;
+ gunichar c;
+ int u, n;
+
+ g_return_val_if_fail (str != NULL, NULL);
+
+ if (len < 0) {
+ if (include_nuls) {
+ g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED, "Conversions with embedded nulls must pass the string length");
+ return NULL;
+ }
+
+ len = strlen (str);
+ }
+
+ inptr = (char *) str;
+ inleft = len;
+
+ while (inleft > 0) {
+ if ((n = decode_utf8 (inptr, inleft, &c)) < 0)
+ goto error;
+
+ if (c == 0 && !include_nuls)
+ break;
+
+ if ((u = g_unichar_to_utf16 (c, NULL)) < 0) {
+ errno = EILSEQ;
+ goto error;
+ }
+
+ outlen += u;
+ inleft -= n;
+ inptr += n;
+ }
+
+ if (items_read)
+ *items_read = inptr - str;
+
+ if (items_written)
+ *items_written = outlen;
+
+ outptr = outbuf = g_malloc ((outlen + 1) * sizeof (gunichar2));
+ inptr = (char *) str;
+ inleft = len;
+
+ while (inleft > 0) {
+ if ((n = decode_utf8 (inptr, inleft, &c)) < 0)
+ break;
+
+ if (c == 0 && !include_nuls)
+ break;
+
+ outptr += g_unichar_to_utf16 (c, outptr);
+ inleft -= n;
+ inptr += n;
+ }
+
+ *outptr = '\0';
+
+ return outbuf;
+
+ error:
+ if (errno == EILSEQ) {
+ g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ "Illegal byte sequence encounted in the input.");
+ } else if (items_read) {
+ /* partial input is ok if we can let our caller know... */
+ } else {
+ g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_PARTIAL_INPUT,
+ "Partial byte sequence encountered in the input.");
+ }
+
+ if (items_read)
+ *items_read = inptr - str;
+
+ if (items_written)
+ *items_written = 0;
+
+ return NULL;
+}
+
+gunichar2 *
+g_utf8_to_utf16 (const gchar *str, glong len, glong *items_read, glong *items_written, GError **err)
+{
+ return eg_utf8_to_utf16_general (str, len, items_read, items_written, FALSE, err);
+}
+
+gunichar2 *
+eg_utf8_to_utf16_with_nuls (const gchar *str, glong len, glong *items_read, glong *items_written, GError **err)
+{
+ return eg_utf8_to_utf16_general (str, len, items_read, items_written, TRUE, err);
+}
+
+gunichar *
+g_utf8_to_ucs4 (const gchar *str, glong len, glong *items_read, glong *items_written, GError **err)
+{
+ gunichar *outbuf, *outptr;
+ size_t outlen = 0;
+ size_t inleft;
+ char *inptr;
+ gunichar c;
+ int n;
+
+ g_return_val_if_fail (str != NULL, NULL);
+
+ if (len < 0)
+ len = strlen (str);
+
+ inptr = (char *) str;
+ inleft = len;
+
+ while (inleft > 0) {
+ if ((n = decode_utf8 (inptr, inleft, &c)) < 0) {
+ if (errno == EILSEQ) {
+ g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ "Illegal byte sequence encounted in the input.");
+ } else if (items_read) {
+ /* partial input is ok if we can let our caller know... */
+ break;
+ } else {
+ g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_PARTIAL_INPUT,
+ "Partial byte sequence encountered in the input.");
+ }
+
+ if (items_read)
+ *items_read = inptr - str;
+
+ if (items_written)
+ *items_written = 0;
+
+ return NULL;
+ } else if (c == 0)
+ break;
+
+ outlen += 4;
+ inleft -= n;
+ inptr += n;
+ }
+
+ if (items_written)
+ *items_written = outlen / 4;
+
+ if (items_read)
+ *items_read = inptr - str;
+
+ outptr = outbuf = g_malloc (outlen + 4);
+ inptr = (char *) str;
+ inleft = len;
+
+ while (inleft > 0) {
+ if ((n = decode_utf8 (inptr, inleft, &c)) < 0)
+ break;
+ else if (c == 0)
+ break;
+
+ *outptr++ = c;
+ inleft -= n;
+ inptr += n;
+ }
+
+ *outptr = 0;
+
+ return outbuf;
+}
+
+gchar *
+g_utf16_to_utf8 (const gunichar2 *str, glong len, glong *items_read, glong *items_written, GError **err)
+{
+ char *inptr, *outbuf, *outptr;
+ size_t outlen = 0;
+ size_t inleft;
+ gunichar c;
+ int n;
+
+ g_return_val_if_fail (str != NULL, NULL);
+
+ if (len < 0) {
+ len = 0;
+ while (str[len])
+ len++;
+ }
+
+ inptr = (char *) str;
+ inleft = len * 2;
+
+ while (inleft > 0) {
+ if ((n = decode_utf16 (inptr, inleft, &c)) < 0) {
+ if (n == -2 && inleft > 2) {
+ /* This means that the first UTF-16 char was read, but second failed */
+ inleft -= 2;
+ inptr += 2;
+ }
+
+ if (errno == EILSEQ) {
+ g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ "Illegal byte sequence encounted in the input.");
+ } else if (items_read) {
+ /* partial input is ok if we can let our caller know... */
+ break;
+ } else {
+ g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_PARTIAL_INPUT,
+ "Partial byte sequence encountered in the input.");
+ }
+
+ if (items_read)
+ *items_read = (inptr - (char *) str) / 2;
+
+ if (items_written)
+ *items_written = 0;
+
+ return NULL;
+ } else if (c == 0)
+ break;
+
+ outlen += g_unichar_to_utf8 (c, NULL);
+ inleft -= n;
+ inptr += n;
+ }
+
+ if (items_read)
+ *items_read = (inptr - (char *) str) / 2;
+
+ if (items_written)
+ *items_written = outlen;
+
+ outptr = outbuf = g_malloc (outlen + 1);
+ inptr = (char *) str;
+ inleft = len * 2;
+
+ while (inleft > 0) {
+ if ((n = decode_utf16 (inptr, inleft, &c)) < 0)
+ break;
+ else if (c == 0)
+ break;
+
+ outptr += g_unichar_to_utf8 (c, outptr);
+ inleft -= n;
+ inptr += n;
+ }
+
+ *outptr = '\0';
+
+ return outbuf;
+}
+
+gunichar *
+g_utf16_to_ucs4 (const gunichar2 *str, glong len, glong *items_read, glong *items_written, GError **err)
+{
+ gunichar *outbuf, *outptr;
+ size_t outlen = 0;
+ size_t inleft;
+ char *inptr;
+ gunichar c;
+ int n;
+
+ g_return_val_if_fail (str != NULL, NULL);
+
+ if (len < 0) {
+ len = 0;
+ while (str[len])
+ len++;
+ }
+
+ inptr = (char *) str;
+ inleft = len * 2;
+
+ while (inleft > 0) {
+ if ((n = decode_utf16 (inptr, inleft, &c)) < 0) {
+ if (n == -2 && inleft > 2) {
+ /* This means that the first UTF-16 char was read, but second failed */
+ inleft -= 2;
+ inptr += 2;
+ }
+
+ if (errno == EILSEQ) {
+ g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ "Illegal byte sequence encounted in the input.");
+ } else if (items_read) {
+ /* partial input is ok if we can let our caller know... */
+ break;
+ } else {
+ g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_PARTIAL_INPUT,
+ "Partial byte sequence encountered in the input.");
+ }
+
+ if (items_read)
+ *items_read = (inptr - (char *) str) / 2;
+
+ if (items_written)
+ *items_written = 0;
+
+ return NULL;
+ } else if (c == 0)
+ break;
+
+ outlen += 4;
+ inleft -= n;
+ inptr += n;
+ }
+
+ if (items_read)
+ *items_read = (inptr - (char *) str) / 2;
+
+ if (items_written)
+ *items_written = outlen / 4;
+
+ outptr = outbuf = g_malloc (outlen + 4);
+ inptr = (char *) str;
+ inleft = len * 2;
+
+ while (inleft > 0) {
+ if ((n = decode_utf16 (inptr, inleft, &c)) < 0)
+ break;
+ else if (c == 0)
+ break;
+
+ *outptr++ = c;
+ inleft -= n;
+ inptr += n;
+ }
+
+ *outptr = 0;
+
+ return outbuf;
+}
+
+gchar *
+g_ucs4_to_utf8 (const gunichar *str, glong len, glong *items_read, glong *items_written, GError **err)
+{
+ char *outbuf, *outptr;
+ size_t outlen = 0;
+ glong i;
+ int n;
+
+ g_return_val_if_fail (str != NULL, NULL);
+
+ if (len < 0) {
+ for (i = 0; str[i] != 0; i++) {
+ if ((n = g_unichar_to_utf8 (str[i], NULL)) < 0) {
+ g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ "Illegal byte sequence encounted in the input.");
+
+ if (items_written)
+ *items_written = 0;
+
+ if (items_read)
+ *items_read = i;
+
+ return NULL;
+ }
+
+ outlen += n;
+ }
+ } else {
+ for (i = 0; i < len && str[i] != 0; i++) {
+ if ((n = g_unichar_to_utf8 (str[i], NULL)) < 0) {
+ g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ "Illegal byte sequence encounted in the input.");
+
+ if (items_written)
+ *items_written = 0;
+
+ if (items_read)
+ *items_read = i;
+
+ return NULL;
+ }
+
+ outlen += n;
+ }
+ }
+
+ len = i;
+
+ outptr = outbuf = g_malloc (outlen + 1);
+ for (i = 0; i < len; i++)
+ outptr += g_unichar_to_utf8 (str[i], outptr);
+ *outptr = 0;
+
+ if (items_written)
+ *items_written = outlen;
+
+ if (items_read)
+ *items_read = i;
+
+ return outbuf;
+}
+
+gunichar2 *
+g_ucs4_to_utf16 (const gunichar *str, glong len, glong *items_read, glong *items_written, GError **err)
+{
+ gunichar2 *outbuf, *outptr;
+ size_t outlen = 0;
+ glong i;
+ int n;
+
+ g_return_val_if_fail (str != NULL, NULL);
+
+ if (len < 0) {
+ for (i = 0; str[i] != 0; i++) {
+ if ((n = g_unichar_to_utf16 (str[i], NULL)) < 0) {
+ g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ "Illegal byte sequence encounted in the input.");
+
+ if (items_written)
+ *items_written = 0;
+
+ if (items_read)
+ *items_read = i;
+
+ return NULL;
+ }
+
+ outlen += n;
+ }
+ } else {
+ for (i = 0; i < len && str[i] != 0; i++) {
+ if ((n = g_unichar_to_utf16 (str[i], NULL)) < 0) {
+ g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ "Illegal byte sequence encounted in the input.");
+
+ if (items_written)
+ *items_written = 0;
+
+ if (items_read)
+ *items_read = i;
+
+ return NULL;
+ }
+
+ outlen += n;
+ }
+ }
+
+ len = i;
+
+ outptr = outbuf = g_malloc ((outlen + 1) * sizeof (gunichar2));
+ for (i = 0; i < len; i++)
+ outptr += g_unichar_to_utf16 (str[i], outptr);
+ *outptr = 0;
+
+ if (items_written)
+ *items_written = outlen;
+
+ if (items_read)
+ *items_read = i;
+
+ return outbuf;
+}
--- /dev/null
+#ifndef __GLIB_H
+#define __GLIB_H
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <stddef.h>
+#include <ctype.h>
+#include <limits.h>
+
+
+#ifdef _MSC_VER
+#pragma include_alias(<eglib-config.h>, <eglib-config.hw>)
+#endif
+
+#include <stdint.h>
+#include <inttypes.h>
+
+#include <eglib-config.h>
+#ifndef EGLIB_NO_REMAP
+#include <eglib-remap.h>
+#endif
+
+#ifdef G_HAVE_ALLOCA_H
+#include <alloca.h>
+#endif
+
+#ifdef WIN32
+/* For alloca */
+#include <malloc.h>
+#endif
+
+#ifndef offsetof
+# define offsetof(s_name,n_name) (size_t)(char *)&(((s_name*)0)->m_name)
+#endif
+
+#define __EGLIB_X11 1
+
+#ifdef __cplusplus
+#define G_BEGIN_DECLS extern "C" {
+#define G_END_DECLS }
+#else
+#define G_BEGIN_DECLS
+#define G_END_DECLS
+#endif
+
+G_BEGIN_DECLS
+
+/*
+ * Basic data types
+ */
+typedef int gint;
+typedef unsigned int guint;
+typedef short gshort;
+typedef unsigned short gushort;
+typedef long glong;
+typedef unsigned long gulong;
+typedef void * gpointer;
+typedef const void * gconstpointer;
+typedef char gchar;
+typedef unsigned char guchar;
+
+/* Types defined in terms of the stdint.h */
+typedef int8_t gint8;
+typedef uint8_t guint8;
+typedef int16_t gint16;
+typedef uint16_t guint16;
+typedef int32_t gint32;
+typedef uint32_t guint32;
+typedef int64_t gint64;
+typedef uint64_t guint64;
+typedef float gfloat;
+typedef double gdouble;
+typedef int32_t gboolean;
+
+typedef guint16 gunichar2;
+typedef guint32 gunichar;
+
+/*
+ * Macros
+ */
+#define G_N_ELEMENTS(s) (sizeof(s) / sizeof ((s) [0]))
+
+#define FALSE 0
+#define TRUE 1
+
+#define G_MINSHORT SHRT_MIN
+#define G_MAXSHORT SHRT_MAX
+#define G_MAXUSHORT USHRT_MAX
+#define G_MAXINT INT_MAX
+#define G_MININT INT_MIN
+#define G_MAXINT32 INT32_MAX
+#define G_MAXUINT32 UINT32_MAX
+#define G_MININT32 INT32_MIN
+#define G_MININT64 INT64_MIN
+#define G_MAXINT64 INT64_MAX
+#define G_MAXUINT64 UINT64_MAX
+
+#define G_LITTLE_ENDIAN 1234
+#define G_BIG_ENDIAN 4321
+#define G_STMT_START do
+#define G_STMT_END while (0)
+
+#define G_USEC_PER_SEC 1000000
+
+#ifndef ABS
+#define ABS(a) ((a) > 0 ? (a) : -(a))
+#endif
+
+#define G_STRUCT_OFFSET(p_type,field) offsetof(p_type,field)
+
+#define EGLIB_STRINGIFY(x) #x
+#define EGLIB_TOSTRING(x) EGLIB_STRINGIFY(x)
+#define G_STRLOC __FILE__ ":" EGLIB_TOSTRING(__LINE__) ":"
+
+#define G_CONST_RETURN const
+
+#define G_GUINT64_FORMAT PRIu64
+#define G_GINT64_FORMAT PRIi64
+#define G_GUINT32_FORMAT PRIu32
+#define G_GINT32_FORMAT PRIi32
+
+/*
+ * Allocation
+ */
+void g_free (void *ptr);
+gpointer g_realloc (gpointer obj, gsize size);
+gpointer g_malloc (gsize x);
+gpointer g_malloc0 (gsize x);
+gpointer g_calloc (gsize n, gsize x);
+gpointer g_try_malloc (gsize x);
+gpointer g_try_realloc (gpointer obj, gsize size);
+
+#define g_new(type,size) ((type *) g_malloc (sizeof (type) * (size)))
+#define g_new0(type,size) ((type *) g_malloc0 (sizeof (type)* (size)))
+#define g_newa(type,size) ((type *) alloca (sizeof (type) * (size)))
+
+#define g_memmove(dest,src,len) memmove (dest, src, len)
+#define g_renew(struct_type, mem, n_structs) g_realloc (mem, sizeof (struct_type) * n_structs)
+#define g_alloca(size) alloca (size)
+
+gpointer g_memdup (gconstpointer mem, guint byte_size);
+static inline gchar *g_strdup (const gchar *str) { if (str) { return (gchar*) g_memdup (str, (guint)strlen (str) + 1); } return NULL; }
+gchar **g_strdupv (gchar **str_array);
+
+typedef struct {
+ gpointer (*malloc) (gsize n_bytes);
+ gpointer (*realloc) (gpointer mem, gsize n_bytes);
+ void (*free) (gpointer mem);
+ gpointer (*calloc) (gsize n_blocks, gsize n_block_bytes);
+} GMemVTable;
+
+void g_mem_set_vtable (GMemVTable* vtable);
+
+struct _GMemChunk {
+ guint alloc_size;
+};
+
+typedef struct _GMemChunk GMemChunk;
+/*
+ * Misc.
+ */
+
+gboolean g_hasenv(const gchar *variable);
+gchar * g_getenv(const gchar *variable);
+gboolean g_setenv(const gchar *variable, const gchar *value, gboolean overwrite);
+void g_unsetenv(const gchar *variable);
+
+gchar* g_win32_getlocale(void);
+
+/*
+ * Precondition macros
+ */
+#define g_warn_if_fail(x) G_STMT_START { if (!(x)) { g_warning ("%s:%d: assertion '%s' failed", __FILE__, __LINE__, #x); } } G_STMT_END
+#define g_return_if_fail(x) G_STMT_START { if (!(x)) { g_critical ("%s:%d: assertion '%s' failed", __FILE__, __LINE__, #x); return; } } G_STMT_END
+#define g_return_val_if_fail(x,e) G_STMT_START { if (!(x)) { g_critical ("%s:%d: assertion '%s' failed", __FILE__, __LINE__, #x); return (e); } } G_STMT_END
+
+/*
+ * Errors
+ */
+typedef struct {
+ /* In the real glib, this is a GQuark, but we dont use/need that */
+ gpointer domain;
+ gint code;
+ gchar *message;
+} GError;
+
+void g_clear_error (GError **error);
+void g_error_free (GError *error);
+GError *g_error_new (gpointer domain, gint code, const char *format, ...);
+void g_set_error (GError **err, gpointer domain, gint code, const gchar *format, ...);
+void g_propagate_error (GError **dest, GError *src);
+
+/*
+ * Strings utility
+ */
+gchar *g_strdup_printf (const gchar *format, ...);
+gchar *g_strdup_vprintf (const gchar *format, va_list args);
+gchar *g_strndup (const gchar *str, gsize n);
+const gchar *g_strerror (gint errnum);
+gchar *g_strndup (const gchar *str, gsize n);
+void g_strfreev (gchar **str_array);
+gchar *g_strconcat (const gchar *first, ...);
+gchar **g_strsplit (const gchar *string, const gchar *delimiter, gint max_tokens);
+gchar **g_strsplit_set (const gchar *string, const gchar *delimiter, gint max_tokens);
+gchar *g_strreverse (gchar *str);
+gboolean g_str_has_prefix (const gchar *str, const gchar *prefix);
+gboolean g_str_has_suffix (const gchar *str, const gchar *suffix);
+guint g_strv_length (gchar **str_array);
+gchar *g_strjoin (const gchar *separator, ...);
+gchar *g_strjoinv (const gchar *separator, gchar **str_array);
+gchar *g_strchug (gchar *str);
+gchar *g_strchomp (gchar *str);
+void g_strdown (gchar *string);
+gchar *g_strnfill (gsize length, gchar fill_char);
+
+gchar *g_strdelimit (gchar *string, const gchar *delimiters, gchar new_delimiter);
+gchar *g_strescape (const gchar *source, const gchar *exceptions);
+
+gchar *g_filename_to_uri (const gchar *filename, const gchar *hostname, GError **error);
+gchar *g_filename_from_uri (const gchar *uri, gchar **hostname, GError **error);
+
+gint g_printf (gchar const *format, ...);
+gint g_fprintf (FILE *file, gchar const *format, ...);
+gint g_sprintf (gchar *string, gchar const *format, ...);
+gint g_snprintf (gchar *string, gulong n, gchar const *format, ...);
+gint g_vasprintf (gchar **ret, const gchar *fmt, va_list ap);
+#define g_vprintf vprintf
+#define g_vfprintf vfprintf
+#define g_vsprintf vsprintf
+#define g_vsnprintf vsnprintf
+
+gsize g_strlcpy (gchar *dest, const gchar *src, gsize dest_size);
+gchar *g_stpcpy (gchar *dest, const char *src);
+
+
+gchar g_ascii_tolower (gchar c);
+gchar g_ascii_toupper (gchar c);
+gchar *g_ascii_strdown (const gchar *str, gssize len);
+gchar *g_ascii_strup (const gchar *str, gssize len);
+gint g_ascii_strncasecmp (const gchar *s1, const gchar *s2, gsize n);
+gint g_ascii_strcasecmp (const gchar *s1, const gchar *s2);
+gint g_ascii_xdigit_value (gchar c);
+#define g_ascii_isspace(c) (isspace (c) != 0)
+#define g_ascii_isalpha(c) (isalpha (c) != 0)
+#define g_ascii_isprint(c) (isprint (c) != 0)
+#define g_ascii_isxdigit(c) (isxdigit (c) != 0)
+
+/* FIXME: g_strcasecmp supports utf8 unicode stuff */
+#ifdef _MSC_VER
+#define g_strcasecmp stricmp
+#define g_strncasecmp strnicmp
+#define g_strstrip(a) g_strchug (g_strchomp (a))
+#else
+#define g_strcasecmp strcasecmp
+#define g_ascii_strtoull strtoull
+#define g_strncasecmp strncasecmp
+#define g_strstrip(a) g_strchug (g_strchomp (a))
+#endif
+#define g_ascii_strdup strdup
+
+
+#define G_STR_DELIMITERS "_-|> <."
+
+/*
+ * String type
+ */
+typedef struct {
+ char *str;
+ gsize len;
+ gsize allocated_len;
+} GString;
+
+GString *g_string_new (const gchar *init);
+GString *g_string_new_len (const gchar *init, gssize len);
+GString *g_string_sized_new (gsize default_size);
+gchar *g_string_free (GString *string, gboolean free_segment);
+GString *g_string_append (GString *string, const gchar *val);
+void g_string_printf (GString *string, const gchar *format, ...);
+void g_string_append_printf (GString *string, const gchar *format, ...);
+void g_string_append_vprintf (GString *string, const gchar *format, va_list args);
+GString *g_string_append_unichar (GString *string, gunichar c);
+GString *g_string_append_c (GString *string, gchar c);
+GString *g_string_append (GString *string, const gchar *val);
+GString *g_string_append_len (GString *string, const gchar *val, gssize len);
+GString *g_string_truncate (GString *string, gsize len);
+GString *g_string_prepend (GString *string, const gchar *val);
+GString *g_string_insert (GString *string, gssize pos, const gchar *val);
+GString *g_string_set_size (GString *string, gsize len);
+GString *g_string_erase (GString *string, gssize pos, gssize len);
+
+#define g_string_sprintfa g_string_append_printf
+
+typedef void (*GFunc) (gpointer data, gpointer user_data);
+typedef gint (*GCompareFunc) (gconstpointer a, gconstpointer b);
+typedef gint (*GCompareDataFunc) (gconstpointer a, gconstpointer b, gpointer user_data);
+typedef void (*GHFunc) (gpointer key, gpointer value, gpointer user_data);
+typedef gboolean (*GHRFunc) (gpointer key, gpointer value, gpointer user_data);
+typedef void (*GDestroyNotify) (gpointer data);
+typedef guint (*GHashFunc) (gconstpointer key);
+typedef gboolean (*GEqualFunc) (gconstpointer a, gconstpointer b);
+typedef void (*GFreeFunc) (gpointer data);
+
+/*
+ * Lists
+ */
+typedef struct _GSList GSList;
+struct _GSList {
+ gpointer data;
+ GSList *next;
+};
+
+GSList *g_slist_alloc (void);
+GSList *g_slist_append (GSList *list,
+ gpointer data);
+GSList *g_slist_prepend (GSList *list,
+ gpointer data);
+void g_slist_free (GSList *list);
+void g_slist_free_1 (GSList *list);
+GSList *g_slist_copy (GSList *list);
+GSList *g_slist_concat (GSList *list1,
+ GSList *list2);
+void g_slist_foreach (GSList *list,
+ GFunc func,
+ gpointer user_data);
+GSList *g_slist_last (GSList *list);
+GSList *g_slist_find (GSList *list,
+ gconstpointer data);
+GSList *g_slist_find_custom (GSList *list,
+ gconstpointer data,
+ GCompareFunc func);
+GSList *g_slist_remove (GSList *list,
+ gconstpointer data);
+GSList *g_slist_remove_all (GSList *list,
+ gconstpointer data);
+GSList *g_slist_reverse (GSList *list);
+guint g_slist_length (GSList *list);
+GSList *g_slist_remove_link (GSList *list,
+ GSList *link);
+GSList *g_slist_delete_link (GSList *list,
+ GSList *link);
+GSList *g_slist_insert_sorted (GSList *list,
+ gpointer data,
+ GCompareFunc func);
+GSList *g_slist_insert_before (GSList *list,
+ GSList *sibling,
+ gpointer data);
+GSList *g_slist_sort (GSList *list,
+ GCompareFunc func);
+gint g_slist_index (GSList *list,
+ gconstpointer data);
+GSList *g_slist_nth (GSList *list,
+ guint n);
+gpointer g_slist_nth_data (GSList *list,
+ guint n);
+
+#define g_slist_next(slist) ((slist) ? (((GSList *) (slist))->next) : NULL)
+
+
+typedef struct _GList GList;
+struct _GList {
+ gpointer data;
+ GList *next;
+ GList *prev;
+};
+
+#define g_list_next(list) ((list) ? (((GList *) (list))->next) : NULL)
+#define g_list_previous(list) ((list) ? (((GList *) (list))->prev) : NULL)
+
+GList *g_list_alloc (void);
+GList *g_list_append (GList *list,
+ gpointer data);
+GList *g_list_prepend (GList *list,
+ gpointer data);
+void g_list_free (GList *list);
+void g_list_free_1 (GList *list);
+GList *g_list_copy (GList *list);
+guint g_list_length (GList *list);
+gint g_list_index (GList *list,
+ gconstpointer data);
+GList *g_list_nth (GList *list,
+ guint n);
+gpointer g_list_nth_data (GList *list,
+ guint n);
+GList *g_list_last (GList *list);
+GList *g_list_concat (GList *list1,
+ GList *list2);
+void g_list_foreach (GList *list,
+ GFunc func,
+ gpointer user_data);
+GList *g_list_first (GList *list);
+GList *g_list_find (GList *list,
+ gconstpointer data);
+GList *g_list_find_custom (GList *list,
+ gconstpointer data,
+ GCompareFunc func);
+GList *g_list_remove (GList *list,
+ gconstpointer data);
+GList *g_list_remove_all (GList *list,
+ gconstpointer data);
+GList *g_list_reverse (GList *list);
+GList *g_list_remove_link (GList *list,
+ GList *link);
+GList *g_list_delete_link (GList *list,
+ GList *link);
+GList *g_list_insert_sorted (GList *list,
+ gpointer data,
+ GCompareFunc func);
+GList *g_list_insert_before (GList *list,
+ GList *sibling,
+ gpointer data);
+GList *g_list_sort (GList *sort,
+ GCompareFunc func);
+
+/*
+ * Hashtables
+ */
+typedef struct _GHashTable GHashTable;
+typedef struct _GHashTableIter GHashTableIter;
+
+/* Private, but needed for stack allocation */
+struct _GHashTableIter
+{
+ gpointer dummy [8];
+};
+
+GHashTable *g_hash_table_new (GHashFunc hash_func, GEqualFunc key_equal_func);
+GHashTable *g_hash_table_new_full (GHashFunc hash_func, GEqualFunc key_equal_func,
+ GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func);
+void g_hash_table_insert_replace (GHashTable *hash, gpointer key, gpointer value, gboolean replace);
+guint g_hash_table_size (GHashTable *hash);
+GList *g_hash_table_get_keys (GHashTable *hash);
+GList *g_hash_table_get_values (GHashTable *hash);
+gpointer g_hash_table_lookup (GHashTable *hash, gconstpointer key);
+gboolean g_hash_table_lookup_extended (GHashTable *hash, gconstpointer key, gpointer *orig_key, gpointer *value);
+void g_hash_table_foreach (GHashTable *hash, GHFunc func, gpointer user_data);
+gpointer g_hash_table_find (GHashTable *hash, GHRFunc predicate, gpointer user_data);
+gboolean g_hash_table_remove (GHashTable *hash, gconstpointer key);
+gboolean g_hash_table_steal (GHashTable *hash, gconstpointer key);
+void g_hash_table_remove_all (GHashTable *hash);
+guint g_hash_table_foreach_remove (GHashTable *hash, GHRFunc func, gpointer user_data);
+guint g_hash_table_foreach_steal (GHashTable *hash, GHRFunc func, gpointer user_data);
+void g_hash_table_destroy (GHashTable *hash);
+void g_hash_table_print_stats (GHashTable *table);
+
+void g_hash_table_iter_init (GHashTableIter *iter, GHashTable *hash_table);
+gboolean g_hash_table_iter_next (GHashTableIter *iter, gpointer *key, gpointer *value);
+
+guint g_spaced_primes_closest (guint x);
+
+#define g_hash_table_insert(h,k,v) g_hash_table_insert_replace ((h),(k),(v),FALSE)
+#define g_hash_table_replace(h,k,v) g_hash_table_insert_replace ((h),(k),(v),TRUE)
+
+gboolean g_direct_equal (gconstpointer v1, gconstpointer v2);
+guint g_direct_hash (gconstpointer v1);
+gboolean g_int_equal (gconstpointer v1, gconstpointer v2);
+guint g_int_hash (gconstpointer v1);
+gboolean g_str_equal (gconstpointer v1, gconstpointer v2);
+guint g_str_hash (gconstpointer v1);
+
+/*
+ * ByteArray
+ */
+
+typedef struct _GByteArray GByteArray;
+struct _GByteArray {
+ guint8 *data;
+ gint len;
+};
+
+GByteArray *g_byte_array_new (void);
+GByteArray* g_byte_array_append (GByteArray *array, const guint8 *data, guint len);
+guint8* g_byte_array_free (GByteArray *array, gboolean free_segment);
+void g_byte_array_set_size (GByteArray *array, gint length);
+
+/*
+ * Array
+ */
+
+typedef struct _GArray GArray;
+struct _GArray {
+ gchar *data;
+ gint len;
+};
+
+GArray *g_array_new (gboolean zero_terminated, gboolean clear_, guint element_size);
+GArray *g_array_sized_new (gboolean zero_terminated, gboolean clear_, guint element_size, guint reserved_size);
+gchar* g_array_free (GArray *array, gboolean free_segment);
+GArray *g_array_append_vals (GArray *array, gconstpointer data, guint len);
+GArray* g_array_insert_vals (GArray *array, guint index_, gconstpointer data, guint len);
+GArray* g_array_remove_index (GArray *array, guint index_);
+GArray* g_array_remove_index_fast (GArray *array, guint index_);
+void g_array_set_size (GArray *array, gint length);
+
+#define g_array_append_val(a,v) (g_array_append_vals((a),&(v),1))
+#define g_array_insert_val(a,i,v) (g_array_insert_vals((a),(i),&(v),1))
+#define g_array_index(a,t,i) *(t*)(((a)->data) + sizeof(t) * (i))
+
+/*
+ * QSort
+*/
+
+void g_qsort_with_data (gpointer base, size_t nmemb, size_t size, GCompareDataFunc compare, gpointer user_data);
+
+/*
+ * Pointer Array
+ */
+
+typedef struct _GPtrArray GPtrArray;
+struct _GPtrArray {
+ gpointer *pdata;
+ guint len;
+};
+
+GPtrArray *g_ptr_array_new (void);
+GPtrArray *g_ptr_array_sized_new (guint reserved_size);
+void g_ptr_array_add (GPtrArray *array, gpointer data);
+gboolean g_ptr_array_remove (GPtrArray *array, gpointer data);
+gpointer g_ptr_array_remove_index (GPtrArray *array, guint index);
+gboolean g_ptr_array_remove_fast (GPtrArray *array, gpointer data);
+gpointer g_ptr_array_remove_index_fast (GPtrArray *array, guint index);
+void g_ptr_array_sort (GPtrArray *array, GCompareFunc compare_func);
+void g_ptr_array_sort_with_data (GPtrArray *array, GCompareDataFunc compare_func, gpointer user_data);
+void g_ptr_array_set_size (GPtrArray *array, gint length);
+gpointer *g_ptr_array_free (GPtrArray *array, gboolean free_seg);
+void g_ptr_array_foreach (GPtrArray *array, GFunc func, gpointer user_data);
+#define g_ptr_array_index(array,index) (array)->pdata[(index)]
+
+/*
+ * Queues
+ */
+typedef struct {
+ GList *head;
+ GList *tail;
+ guint length;
+} GQueue;
+
+gpointer g_queue_pop_head (GQueue *queue);
+void g_queue_push_head (GQueue *queue,
+ gpointer data);
+void g_queue_push_tail (GQueue *queue,
+ gpointer data);
+gboolean g_queue_is_empty (GQueue *queue);
+GQueue *g_queue_new (void);
+void g_queue_free (GQueue *queue);
+void g_queue_foreach (GQueue *queue, GFunc func, gpointer user_data);
+
+/*
+ * Messages
+ */
+#ifndef G_LOG_DOMAIN
+#define G_LOG_DOMAIN ((gchar*) 0)
+#endif
+
+typedef enum {
+ G_LOG_FLAG_RECURSION = 1 << 0,
+ G_LOG_FLAG_FATAL = 1 << 1,
+
+ G_LOG_LEVEL_ERROR = 1 << 2,
+ G_LOG_LEVEL_CRITICAL = 1 << 3,
+ G_LOG_LEVEL_WARNING = 1 << 4,
+ G_LOG_LEVEL_MESSAGE = 1 << 5,
+ G_LOG_LEVEL_INFO = 1 << 6,
+ G_LOG_LEVEL_DEBUG = 1 << 7,
+
+ G_LOG_LEVEL_MASK = ~(G_LOG_FLAG_RECURSION | G_LOG_FLAG_FATAL)
+} GLogLevelFlags;
+
+void g_print (const gchar *format, ...);
+void g_printerr (const gchar *format, ...);
+GLogLevelFlags g_log_set_always_fatal (GLogLevelFlags fatal_mask);
+GLogLevelFlags g_log_set_fatal_mask (const gchar *log_domain, GLogLevelFlags fatal_mask);
+void g_logv (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, va_list args);
+void g_log (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, ...);
+void g_assertion_message (const gchar *format, ...) G_GNUC_NORETURN;
+
+#ifdef HAVE_C99_SUPPORT
+/* The for (;;) tells gc thats g_error () doesn't return, avoiding warnings */
+#define g_error(format, ...) do { g_log (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format, __VA_ARGS__); for (;;); } while (0)
+#define g_critical(format, ...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, format, __VA_ARGS__)
+#define g_warning(format, ...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, format, __VA_ARGS__)
+#define g_message(format, ...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, format, __VA_ARGS__)
+#define g_debug(format, ...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format, __VA_ARGS__)
+#else /* HAVE_C99_SUPPORT */
+#define g_error(...) do { g_log (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, __VA_ARGS__); for (;;); } while (0)
+#define g_critical(...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, __VA_ARGS__)
+#define g_warning(...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, __VA_ARGS__)
+#define g_message(...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, __VA_ARGS__)
+#define g_debug(...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, __VA_ARGS__)
+#endif /* ndef HAVE_C99_SUPPORT */
+
+typedef void (*GLogFunc) (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data);
+typedef void (*GPrintFunc) (const gchar *string);
+
+void g_log_default_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer unused_data);
+GLogFunc g_log_set_default_handler (GLogFunc log_func, gpointer user_data);
+GPrintFunc g_set_print_handler (GPrintFunc func);
+GPrintFunc g_set_printerr_handler (GPrintFunc func);
+/*
+ * Conversions
+ */
+
+gpointer g_convert_error_quark(void);
+
+
+/*
+ * Unicode Manipulation: most of this is not used by Mono by default, it is
+ * only used if the old collation code is activated, so this is only the
+ * bare minimum to build.
+ */
+
+typedef enum {
+ G_UNICODE_CONTROL,
+ G_UNICODE_FORMAT,
+ G_UNICODE_UNASSIGNED,
+ G_UNICODE_PRIVATE_USE,
+ G_UNICODE_SURROGATE,
+ G_UNICODE_LOWERCASE_LETTER,
+ G_UNICODE_MODIFIER_LETTER,
+ G_UNICODE_OTHER_LETTER,
+ G_UNICODE_TITLECASE_LETTER,
+ G_UNICODE_UPPERCASE_LETTER,
+ G_UNICODE_COMBINING_MARK,
+ G_UNICODE_ENCLOSING_MARK,
+ G_UNICODE_NON_SPACING_MARK,
+ G_UNICODE_DECIMAL_NUMBER,
+ G_UNICODE_LETTER_NUMBER,
+ G_UNICODE_OTHER_NUMBER,
+ G_UNICODE_CONNECT_PUNCTUATION,
+ G_UNICODE_DASH_PUNCTUATION,
+ G_UNICODE_CLOSE_PUNCTUATION,
+ G_UNICODE_FINAL_PUNCTUATION,
+ G_UNICODE_INITIAL_PUNCTUATION,
+ G_UNICODE_OTHER_PUNCTUATION,
+ G_UNICODE_OPEN_PUNCTUATION,
+ G_UNICODE_CURRENCY_SYMBOL,
+ G_UNICODE_MODIFIER_SYMBOL,
+ G_UNICODE_MATH_SYMBOL,
+ G_UNICODE_OTHER_SYMBOL,
+ G_UNICODE_LINE_SEPARATOR,
+ G_UNICODE_PARAGRAPH_SEPARATOR,
+ G_UNICODE_SPACE_SEPARATOR
+} GUnicodeType;
+
+typedef enum {
+ G_UNICODE_BREAK_MANDATORY,
+ G_UNICODE_BREAK_CARRIAGE_RETURN,
+ G_UNICODE_BREAK_LINE_FEED,
+ G_UNICODE_BREAK_COMBINING_MARK,
+ G_UNICODE_BREAK_SURROGATE,
+ G_UNICODE_BREAK_ZERO_WIDTH_SPACE,
+ G_UNICODE_BREAK_INSEPARABLE,
+ G_UNICODE_BREAK_NON_BREAKING_GLUE,
+ G_UNICODE_BREAK_CONTINGENT,
+ G_UNICODE_BREAK_SPACE,
+ G_UNICODE_BREAK_AFTER,
+ G_UNICODE_BREAK_BEFORE,
+ G_UNICODE_BREAK_BEFORE_AND_AFTER,
+ G_UNICODE_BREAK_HYPHEN,
+ G_UNICODE_BREAK_NON_STARTER,
+ G_UNICODE_BREAK_OPEN_PUNCTUATION,
+ G_UNICODE_BREAK_CLOSE_PUNCTUATION,
+ G_UNICODE_BREAK_QUOTATION,
+ G_UNICODE_BREAK_EXCLAMATION,
+ G_UNICODE_BREAK_IDEOGRAPHIC,
+ G_UNICODE_BREAK_NUMERIC,
+ G_UNICODE_BREAK_INFIX_SEPARATOR,
+ G_UNICODE_BREAK_SYMBOL,
+ G_UNICODE_BREAK_ALPHABETIC,
+ G_UNICODE_BREAK_PREFIX,
+ G_UNICODE_BREAK_POSTFIX,
+ G_UNICODE_BREAK_COMPLEX_CONTEXT,
+ G_UNICODE_BREAK_AMBIGUOUS,
+ G_UNICODE_BREAK_UNKNOWN,
+ G_UNICODE_BREAK_NEXT_LINE,
+ G_UNICODE_BREAK_WORD_JOINER,
+ G_UNICODE_BREAK_HANGUL_L_JAMO,
+ G_UNICODE_BREAK_HANGUL_V_JAMO,
+ G_UNICODE_BREAK_HANGUL_T_JAMO,
+ G_UNICODE_BREAK_HANGUL_LV_SYLLABLE,
+ G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE
+} GUnicodeBreakType;
+
+gunichar g_unichar_toupper (gunichar c);
+gunichar g_unichar_tolower (gunichar c);
+gunichar g_unichar_totitle (gunichar c);
+GUnicodeType g_unichar_type (gunichar c);
+gboolean g_unichar_isspace (gunichar c);
+gboolean g_unichar_isxdigit (gunichar c);
+gint g_unichar_xdigit_value (gunichar c);
+GUnicodeBreakType g_unichar_break_type (gunichar c);
+
+#ifndef MAX
+#define MAX(a,b) (((a)>(b)) ? (a) : (b))
+#endif
+
+#ifndef MIN
+#define MIN(a,b) (((a)<(b)) ? (a) : (b))
+#endif
+
+#ifndef CLAMP
+#define CLAMP(a,low,high) (((a) < (low)) ? (low) : (((a) > (high)) ? (high) : (a)))
+#endif
+
+#if defined(__GNUC__) && (__GNUC__ > 2)
+#define G_LIKELY(expr) (__builtin_expect ((expr) != 0, 1))
+#define G_UNLIKELY(expr) (__builtin_expect ((expr) != 0, 0))
+#else
+#define G_LIKELY(x) (x)
+#define G_UNLIKELY(x) (x)
+#endif
+
+#if defined(_MSC_VER)
+#define eg_unreachable() __assume(0)
+#elif defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 5)))
+#define eg_unreachable() __builtin_unreachable()
+#else
+#define eg_unreachable()
+#endif
+
+#define g_assert(x) G_STMT_START { if (G_UNLIKELY (!(x))) g_assertion_message ("* Assertion at %s:%d, condition `%s' not met\n", __FILE__, __LINE__, #x); } G_STMT_END
+#define g_assert_not_reached() G_STMT_START { g_assertion_message ("* Assertion: should not be reached at %s:%d\n", __FILE__, __LINE__); eg_unreachable(); } G_STMT_END
+
+/*
+ * Unicode conversion
+ */
+
+#define G_CONVERT_ERROR g_convert_error_quark()
+
+typedef enum {
+ G_CONVERT_ERROR_NO_CONVERSION,
+ G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ G_CONVERT_ERROR_FAILED,
+ G_CONVERT_ERROR_PARTIAL_INPUT,
+ G_CONVERT_ERROR_BAD_URI,
+ G_CONVERT_ERROR_NOT_ABSOLUTE_PATH
+} GConvertError;
+
+gchar *g_utf8_strup (const gchar *str, gssize len);
+gchar *g_utf8_strdown (const gchar *str, gssize len);
+gint g_unichar_to_utf8 (gunichar c, gchar *outbuf);
+gunichar *g_utf8_to_ucs4_fast (const gchar *str, glong len, glong *items_written);
+gunichar *g_utf8_to_ucs4 (const gchar *str, glong len, glong *items_read, glong *items_written, GError **err);
+gunichar2 *g_utf8_to_utf16 (const gchar *str, glong len, glong *items_read, glong *items_written, GError **err);
+gunichar2 *eg_utf8_to_utf16_with_nuls (const gchar *str, glong len, glong *items_read, glong *items_written, GError **err);
+gchar *g_utf16_to_utf8 (const gunichar2 *str, glong len, glong *items_read, glong *items_written, GError **err);
+gunichar *g_utf16_to_ucs4 (const gunichar2 *str, glong len, glong *items_read, glong *items_written, GError **err);
+gchar *g_ucs4_to_utf8 (const gunichar *str, glong len, glong *items_read, glong *items_written, GError **err);
+gunichar2 *g_ucs4_to_utf16 (const gunichar *str, glong len, glong *items_read, glong *items_written, GError **err);
+
+#define u8to16(str) g_utf8_to_utf16(str, (glong)strlen(str), NULL, NULL, NULL)
+
+#ifdef G_OS_WIN32
+#define u16to8(str) g_utf16_to_utf8((gunichar2 *) (str), (glong)wcslen((wchar_t *) (str)), NULL, NULL, NULL)
+#else
+#define u16to8(str) g_utf16_to_utf8(str, (glong)strlen(str), NULL, NULL, NULL)
+#endif
+
+/*
+ * Path
+ */
+gchar *g_build_path (const gchar *separator, const gchar *first_element, ...);
+#define g_build_filename(x, ...) g_build_path(G_DIR_SEPARATOR_S, x, __VA_ARGS__)
+gchar *g_path_get_dirname (const gchar *filename);
+gchar *g_path_get_basename (const char *filename);
+gchar *g_find_program_in_path (const gchar *program);
+gchar *g_get_current_dir (void);
+gboolean g_path_is_absolute (const char *filename);
+
+const gchar *g_get_home_dir (void);
+const gchar *g_get_tmp_dir (void);
+const gchar *g_get_user_name (void);
+gchar *g_get_prgname (void);
+void g_set_prgname (const gchar *prgname);
+
+gboolean g_ensure_directory_exists (const gchar *filename);
+
+/*
+ * Shell
+ */
+
+gboolean g_shell_parse_argv (const gchar *command_line, gint *argcp, gchar ***argvp, GError **error);
+gchar *g_shell_unquote (const gchar *quoted_string, GError **error);
+gchar *g_shell_quote (const gchar *unquoted_string);
+
+/*
+ * Spawn
+ */
+typedef enum {
+ G_SPAWN_LEAVE_DESCRIPTORS_OPEN = 1,
+ G_SPAWN_DO_NOT_REAP_CHILD = 1 << 1,
+ G_SPAWN_SEARCH_PATH = 1 << 2,
+ G_SPAWN_STDOUT_TO_DEV_NULL = 1 << 3,
+ G_SPAWN_STDERR_TO_DEV_NULL = 1 << 4,
+ G_SPAWN_CHILD_INHERITS_STDIN = 1 << 5,
+ G_SPAWN_FILE_AND_ARGV_ZERO = 1 << 6
+} GSpawnFlags;
+
+typedef void (*GSpawnChildSetupFunc) (gpointer user_data);
+
+gboolean g_spawn_command_line_sync (const gchar *command_line, gchar **standard_output, gchar **standard_error, gint *exit_status, GError **error);
+gboolean g_spawn_async_with_pipes (const gchar *working_directory, gchar **argv, gchar **envp, GSpawnFlags flags, GSpawnChildSetupFunc child_setup,
+ gpointer user_data, GPid *child_pid, gint *standard_input, gint *standard_output, gint *standard_error, GError **error);
+
+int eg_getdtablesize (void);
+
+/*
+ * Timer
+ */
+typedef struct _GTimer GTimer;
+
+GTimer *g_timer_new (void);
+void g_timer_destroy (GTimer *timer);
+gdouble g_timer_elapsed (GTimer *timer, gulong *microseconds);
+void g_timer_stop (GTimer *timer);
+void g_timer_start (GTimer *timer);
+
+/*
+ * Date and time
+ */
+typedef struct {
+ glong tv_sec;
+ glong tv_usec;
+} GTimeVal;
+
+void g_get_current_time (GTimeVal *result);
+void g_usleep (gulong microseconds);
+
+/*
+ * File
+ */
+
+gpointer g_file_error_quark (void);
+
+#define G_FILE_ERROR g_file_error_quark ()
+
+typedef enum {
+ G_FILE_ERROR_EXIST,
+ G_FILE_ERROR_ISDIR,
+ G_FILE_ERROR_ACCES,
+ G_FILE_ERROR_NAMETOOLONG,
+ G_FILE_ERROR_NOENT,
+ G_FILE_ERROR_NOTDIR,
+ G_FILE_ERROR_NXIO,
+ G_FILE_ERROR_NODEV,
+ G_FILE_ERROR_ROFS,
+ G_FILE_ERROR_TXTBSY,
+ G_FILE_ERROR_FAULT,
+ G_FILE_ERROR_LOOP,
+ G_FILE_ERROR_NOSPC,
+ G_FILE_ERROR_NOMEM,
+ G_FILE_ERROR_MFILE,
+ G_FILE_ERROR_NFILE,
+ G_FILE_ERROR_BADF,
+ G_FILE_ERROR_INVAL,
+ G_FILE_ERROR_PIPE,
+ G_FILE_ERROR_AGAIN,
+ G_FILE_ERROR_INTR,
+ G_FILE_ERROR_IO,
+ G_FILE_ERROR_PERM,
+ G_FILE_ERROR_NOSYS,
+ G_FILE_ERROR_FAILED
+} GFileError;
+
+typedef enum {
+ G_FILE_TEST_IS_REGULAR = 1 << 0,
+ G_FILE_TEST_IS_SYMLINK = 1 << 1,
+ G_FILE_TEST_IS_DIR = 1 << 2,
+ G_FILE_TEST_IS_EXECUTABLE = 1 << 3,
+ G_FILE_TEST_EXISTS = 1 << 4
+} GFileTest;
+
+
+gboolean g_file_set_contents (const gchar *filename, const gchar *contents, gssize length, GError **error);
+gboolean g_file_get_contents (const gchar *filename, gchar **contents, gsize *length, GError **error);
+GFileError g_file_error_from_errno (gint err_no);
+gint g_file_open_tmp (const gchar *tmpl, gchar **name_used, GError **error);
+gboolean g_file_test (const gchar *filename, GFileTest test);
+
+#define g_open open
+#define g_rename rename
+#define g_stat stat
+#define g_unlink unlink
+#define g_fopen fopen
+#define g_lstat lstat
+#define g_rmdir rmdir
+#define g_mkstemp mkstemp
+#define g_ascii_isdigit isdigit
+#define g_ascii_strtod strtod
+#define g_ascii_isalnum isalnum
+
+gchar *g_mkdtemp (gchar *tmpl);
+
+/*
+ * Pattern matching
+ */
+typedef struct _GPatternSpec GPatternSpec;
+GPatternSpec * g_pattern_spec_new (const gchar *pattern);
+void g_pattern_spec_free (GPatternSpec *pspec);
+gboolean g_pattern_match_string (GPatternSpec *pspec, const gchar *string);
+
+/*
+ * Directory
+ */
+typedef struct _GDir GDir;
+GDir *g_dir_open (const gchar *path, guint flags, GError **error);
+const gchar *g_dir_read_name (GDir *dir);
+void g_dir_rewind (GDir *dir);
+void g_dir_close (GDir *dir);
+
+int g_mkdir_with_parents (const gchar *pathname, int mode);
+#define g_mkdir mkdir
+
+/*
+ * GMarkup
+ */
+typedef struct _GMarkupParseContext GMarkupParseContext;
+
+typedef enum
+{
+ G_MARKUP_DO_NOT_USE_THIS_UNSUPPORTED_FLAG = 1 << 0,
+ G_MARKUP_TREAT_CDATA_AS_TEXT = 1 << 1
+} GMarkupParseFlags;
+
+typedef struct {
+ void (*start_element) (GMarkupParseContext *context,
+ const gchar *element_name,
+ const gchar **attribute_names,
+ const gchar **attribute_values,
+ gpointer user_data,
+ GError **error);
+
+ void (*end_element) (GMarkupParseContext *context,
+ const gchar *element_name,
+ gpointer user_data,
+ GError **error);
+
+ void (*text) (GMarkupParseContext *context,
+ const gchar *text,
+ gsize text_len,
+ gpointer user_data,
+ GError **error);
+
+ void (*passthrough) (GMarkupParseContext *context,
+ const gchar *passthrough_text,
+ gsize text_len,
+ gpointer user_data,
+ GError **error);
+ void (*error) (GMarkupParseContext *context,
+ GError *error,
+ gpointer user_data);
+} GMarkupParser;
+
+GMarkupParseContext *g_markup_parse_context_new (const GMarkupParser *parser,
+ GMarkupParseFlags flags,
+ gpointer user_data,
+ GDestroyNotify user_data_dnotify);
+void g_markup_parse_context_free (GMarkupParseContext *context);
+gboolean g_markup_parse_context_parse (GMarkupParseContext *context,
+ const gchar *text, gssize text_len,
+ GError **error);
+gboolean g_markup_parse_context_end_parse (GMarkupParseContext *context,
+ GError **error);
+
+/*
+ * Character set conversion
+ */
+typedef struct _GIConv *GIConv;
+
+gsize g_iconv (GIConv cd, gchar **inbytes, gsize *inbytesleft, gchar **outbytes, gsize *outbytesleft);
+GIConv g_iconv_open (const gchar *to_charset, const gchar *from_charset);
+int g_iconv_close (GIConv cd);
+
+gboolean g_get_charset (G_CONST_RETURN char **charset);
+gchar *g_locale_to_utf8 (const gchar *opsysstring, gssize len,
+ gsize *bytes_read, gsize *bytes_written,
+ GError **error);
+gchar *g_locale_from_utf8 (const gchar *utf8string, gssize len, gsize *bytes_read,
+ gsize *bytes_written, GError **error);
+gchar *g_filename_from_utf8 (const gchar *utf8string, gssize len, gsize *bytes_read,
+ gsize *bytes_written, GError **error);
+gchar *g_convert (const gchar *str, gssize len,
+ const gchar *to_codeset, const gchar *from_codeset,
+ gsize *bytes_read, gsize *bytes_written, GError **error);
+
+/*
+ * Unicode manipulation
+ */
+extern const guchar g_utf8_jump_table[256];
+
+gboolean g_utf8_validate (const gchar *str, gssize max_len, const gchar **end);
+gunichar g_utf8_get_char_validated (const gchar *str, gssize max_len);
+gchar *g_utf8_find_prev_char (const char *str, const char *p);
+gchar *g_utf8_prev_char (const char *str);
+#define g_utf8_next_char(p) ((p) + g_utf8_jump_table[(guchar)(*p)])
+gunichar g_utf8_get_char (const gchar *src);
+glong g_utf8_strlen (const gchar *str, gssize max);
+gchar *g_utf8_offset_to_pointer (const gchar *str, glong offset);
+glong g_utf8_pointer_to_offset (const gchar *str, const gchar *pos);
+
+/*
+ * priorities
+ */
+#define G_PRIORITY_DEFAULT 0
+#define G_PRIORITY_DEFAULT_IDLE 200
+
+#define GUINT16_SWAP_LE_BE_CONSTANT(x) ((((guint16) x) >> 8) | ((((guint16) x) << 8)))
+
+#define GUINT16_SWAP_LE_BE(x) ((guint16) (((guint16) x) >> 8) | ((((guint16)(x)) & 0xff) << 8))
+#define GUINT32_SWAP_LE_BE(x) ((guint32) \
+ ( (((guint32) (x)) << 24)| \
+ ((((guint32) (x)) & 0xff0000) >> 8) | \
+ ((((guint32) (x)) & 0xff00) << 8) | \
+ (((guint32) (x)) >> 24)) )
+
+#define GUINT64_SWAP_LE_BE(x) ((guint64) (((guint64)(GUINT32_SWAP_LE_BE(((guint64)x) & 0xffffffff))) << 32) | \
+ GUINT32_SWAP_LE_BE(((guint64)x) >> 32))
+
+
+
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+# define GUINT64_FROM_BE(x) GUINT64_SWAP_LE_BE(x)
+# define GUINT32_FROM_BE(x) GUINT32_SWAP_LE_BE(x)
+# define GUINT16_FROM_BE(x) GUINT16_SWAP_LE_BE(x)
+# define GUINT_FROM_BE(x) GUINT32_SWAP_LE_BE(x)
+# define GUINT64_FROM_LE(x) (x)
+# define GUINT32_FROM_LE(x) (x)
+# define GUINT16_FROM_LE(x) (x)
+# define GUINT_FROM_LE(x) (x)
+# define GUINT64_TO_BE(x) GUINT64_SWAP_LE_BE(x)
+# define GUINT32_TO_BE(x) GUINT32_SWAP_LE_BE(x)
+# define GUINT16_TO_BE(x) GUINT16_SWAP_LE_BE(x)
+# define GUINT_TO_BE(x) GUINT32_SWAP_LE_BE(x)
+# define GUINT64_TO_LE(x) (x)
+# define GUINT32_TO_LE(x) (x)
+# define GUINT16_TO_LE(x) (x)
+# define GUINT_TO_LE(x) (x)
+#else
+# define GUINT64_FROM_BE(x) (x)
+# define GUINT32_FROM_BE(x) (x)
+# define GUINT16_FROM_BE(x) (x)
+# define GUINT_FROM_BE(x) (x)
+# define GUINT64_FROM_LE(x) GUINT64_SWAP_LE_BE(x)
+# define GUINT32_FROM_LE(x) GUINT32_SWAP_LE_BE(x)
+# define GUINT16_FROM_LE(x) GUINT16_SWAP_LE_BE(x)
+# define GUINT_FROM_LE(x) GUINT32_SWAP_LE_BE(x)
+# define GUINT64_TO_BE(x) (x)
+# define GUINT32_TO_BE(x) (x)
+# define GUINT16_TO_BE(x) (x)
+# define GUINT_TO_BE(x) (x)
+# define GUINT64_TO_LE(x) GUINT64_SWAP_LE_BE(x)
+# define GUINT32_TO_LE(x) GUINT32_SWAP_LE_BE(x)
+# define GUINT16_TO_LE(x) GUINT16_SWAP_LE_BE(x)
+# define GUINT_TO_LE(x) GUINT32_SWAP_LE_BE(x)
+#endif
+
+#define GINT64_FROM_BE(x) (GUINT64_TO_BE (x))
+#define GINT32_FROM_BE(x) (GUINT32_TO_BE (x))
+#define GINT16_FROM_BE(x) (GUINT16_TO_BE (x))
+#define GINT64_FROM_LE(x) (GUINT64_TO_LE (x))
+#define GINT32_FROM_LE(x) (GUINT32_TO_LE (x))
+#define GINT16_FROM_LE(x) (GUINT16_TO_LE (x))
+
+#define _EGLIB_MAJOR 2
+#define _EGLIB_MIDDLE 4
+#define _EGLIB_MINOR 0
+
+#define GLIB_CHECK_VERSION(a,b,c) ((a < _EGLIB_MAJOR) || (a == _EGLIB_MAJOR && (b < _EGLIB_MIDDLE || (b == _EGLIB_MIDDLE && c <= _EGLIB_MINOR))))
+
+#define G_HAVE_API_SUPPORT(x) (x)
+#define G_UNSUPPORTED_API "%s:%d: '%s' not supported.", __FILE__, __LINE__
+#define g_unsupported_api(name) G_STMT_START { g_warning (G_UNSUPPORTED_API, name); } G_STMT_END
+
+G_END_DECLS
+
+#endif
+
+
+
--- /dev/null
+/*
+ * glist.c: Doubly-linked list implementation
+ *
+ * Authors:
+ * Duncan Mak (duncan@novell.com)
+ * Raja R Harinath (rharinath@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.
+ *
+ * (C) 2006 Novell, Inc.
+ */
+#include <stdio.h>
+#include <glib.h>
+
+GList*
+g_list_alloc ()
+{
+ return g_new0 (GList, 1);
+}
+
+static inline GList*
+new_node (GList *prev, gpointer data, GList *next)
+{
+ GList *node = g_list_alloc ();
+ node->data = data;
+ node->prev = prev;
+ node->next = next;
+ if (prev)
+ prev->next = node;
+ if (next)
+ next->prev = node;
+ return node;
+}
+
+static inline GList*
+disconnect_node (GList *node)
+{
+ if (node->next)
+ node->next->prev = node->prev;
+ if (node->prev)
+ node->prev->next = node->next;
+ return node;
+}
+
+GList *
+g_list_prepend (GList *list, gpointer data)
+{
+ return new_node (list ? list->prev : NULL, data, list);
+}
+
+void
+g_list_free_1 (GList *list)
+{
+ g_free (list);
+}
+
+void
+g_list_free (GList *list)
+{
+ while (list){
+ GList *next = list->next;
+ g_list_free_1 (list);
+ list = next;
+ }
+}
+
+GList*
+g_list_append (GList *list, gpointer data)
+{
+ GList *node = new_node (g_list_last (list), data, NULL);
+ return list ? list : node;
+}
+
+GList *
+g_list_concat (GList *list1, GList *list2)
+{
+ if (list1 && list2) {
+ list2->prev = g_list_last (list1);
+ list2->prev->next = list2;
+ }
+ return list1 ? list1 : list2;
+}
+
+guint
+g_list_length (GList *list)
+{
+ guint length = 0;
+
+ while (list) {
+ length ++;
+ list = list->next;
+ }
+
+ return length;
+}
+
+GList*
+g_list_remove (GList *list, gconstpointer data)
+{
+ GList *current = g_list_find (list, data);
+ if (!current)
+ return list;
+
+ if (current == list)
+ list = list->next;
+ g_list_free_1 (disconnect_node (current));
+
+ return list;
+}
+
+GList*
+g_list_remove_all (GList *list, gconstpointer data)
+{
+ GList *current = g_list_find (list, data);
+
+ if (!current)
+ return list;
+
+ while (current) {
+ if (current == list)
+ list = list->next;
+ g_list_free_1 (disconnect_node (current));
+
+ current = g_list_find (list, data);
+ }
+
+ return list;
+}
+
+GList*
+g_list_remove_link (GList *list, GList *link)
+{
+ if (list == link)
+ list = list->next;
+
+ disconnect_node (link);
+ link->next = NULL;
+ link->prev = NULL;
+
+ return list;
+}
+
+GList*
+g_list_delete_link (GList *list, GList *link)
+{
+ list = g_list_remove_link (list, link);
+ g_list_free_1 (link);
+
+ return list;
+}
+
+GList*
+g_list_find (GList *list, gconstpointer data)
+{
+ while (list){
+ if (list->data == data)
+ return list;
+
+ list = list->next;
+ }
+
+ return NULL;
+}
+
+GList*
+g_list_find_custom (GList *list, gconstpointer data, GCompareFunc func)
+{
+ if (!func)
+ return NULL;
+
+ while (list) {
+ if (func (list->data, data) == 0)
+ return list;
+
+ list = list->next;
+ }
+
+ return NULL;
+}
+
+GList*
+g_list_reverse (GList *list)
+{
+ GList *reverse = NULL;
+
+ while (list) {
+ reverse = list;
+ list = reverse->next;
+
+ reverse->next = reverse->prev;
+ reverse->prev = list;
+ }
+
+ return reverse;
+}
+
+GList*
+g_list_first (GList *list)
+{
+ if (!list)
+ return NULL;
+
+ while (list->prev)
+ list = list->prev;
+
+ return list;
+}
+
+GList*
+g_list_last (GList *list)
+{
+ if (!list)
+ return NULL;
+
+ while (list->next)
+ list = list->next;
+
+ return list;
+}
+
+GList*
+g_list_insert_sorted (GList *list, gpointer data, GCompareFunc func)
+{
+ GList *prev = NULL;
+ GList *current;
+ GList *node;
+
+ if (!func)
+ return list;
+
+ /* Invariant: !prev || func (prev->data, data) <= 0) */
+ for (current = list; current; current = current->next) {
+ if (func (current->data, data) > 0)
+ break;
+ prev = current;
+ }
+
+ node = new_node (prev, data, current);
+ return list == current ? node : list;
+}
+
+GList*
+g_list_insert_before (GList *list, GList *sibling, gpointer data)
+{
+ if (sibling) {
+ GList *node = new_node (sibling->prev, data, sibling);
+ return list == sibling ? node : list;
+ }
+ return g_list_append (list, data);
+}
+
+void
+g_list_foreach (GList *list, GFunc func, gpointer user_data)
+{
+ while (list){
+ (*func) (list->data, user_data);
+ list = list->next;
+ }
+}
+
+gint
+g_list_index (GList *list, gconstpointer data)
+{
+ gint index = 0;
+
+ while (list){
+ if (list->data == data)
+ return index;
+
+ index ++;
+ list = list->next;
+ }
+
+ return -1;
+}
+
+GList*
+g_list_nth (GList *list, guint n)
+{
+ for (; list; list = list->next) {
+ if (n == 0)
+ break;
+ n--;
+ }
+ return list;
+}
+
+gpointer
+g_list_nth_data (GList *list, guint n)
+{
+ GList *node = g_list_nth (list, n);
+ return node ? node->data : NULL;
+}
+
+GList*
+g_list_copy (GList *list)
+{
+ GList *copy = NULL;
+
+ if (list) {
+ GList *tmp = new_node (NULL, list->data, NULL);
+ copy = tmp;
+
+ for (list = list->next; list; list = list->next)
+ tmp = new_node (tmp, list->data, NULL);
+ }
+
+ return copy;
+}
+
+typedef GList list_node;
+#include "sort.frag.h"
+
+GList*
+g_list_sort (GList *list, GCompareFunc func)
+{
+ GList *current;
+ if (!list || !list->next)
+ return list;
+ list = do_sort (list, func);
+
+ /* Fixup: do_sort doesn't update 'prev' pointers */
+ list->prev = NULL;
+ for (current = list; current->next; current = current->next)
+ current->next->prev = current;
+
+ return list;
+}
--- /dev/null
+/*
+ * gmakrup.c: Minimal XML markup reader.
+ *
+ * Unlike the GLib one, this can not be restarted with more text
+ * as the Mono use does not require it.
+ *
+ * Actually, with further thought, I think that this could be made
+ * to restart very easily. The pos == end condition would mean
+ * "return to caller" and only at end parse this would be a fatal
+ * error.
+ *
+ * Not that it matters to Mono, but it is very simple to change, there
+ * is a tricky situation: there are a few places where we check p+n
+ * in the source, and that would have to change to be progressive, instead
+ * of depending on the string to be complete at that point, so we would
+ * have to introduce extra states to cope with that.
+ *
+ * Author:
+ * Miguel de Icaza (miguel@novell.com)
+ *
+ * (C) 2006 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.
+ */
+#include <stdio.h>
+#include <ctype.h>
+#include <glib.h>
+
+#define set_error(msg, ...) do { if (error != NULL) *error = g_error_new (GINT_TO_POINTER (1), 1, msg, __VA_ARGS__); } while (0);
+
+typedef enum {
+ START,
+ START_ELEMENT,
+ TEXT,
+ FLUSH_TEXT,
+ CLOSING_ELEMENT,
+ COMMENT,
+ SKIP_XML_DECLARATION
+} ParseState;
+
+struct _GMarkupParseContext {
+ GMarkupParser parser;
+ gpointer user_data;
+ GDestroyNotify user_data_dnotify;
+ ParseState state;
+
+ /* Stores the name of the current element, so we can issue the end_element */
+ GSList *level;
+
+ GString *text;
+};
+
+GMarkupParseContext *
+g_markup_parse_context_new (const GMarkupParser *parser,
+ GMarkupParseFlags flags,
+ gpointer user_data,
+ GDestroyNotify user_data_dnotify)
+{
+ GMarkupParseContext *context = g_new0 (GMarkupParseContext, 1);
+
+ context->parser = *parser;
+ context->user_data = user_data;
+ context->user_data_dnotify = user_data_dnotify;
+
+ return context;
+}
+
+void
+g_markup_parse_context_free (GMarkupParseContext *context)
+{
+ GSList *l;
+
+ g_return_if_fail (context != NULL);
+
+ if (context->user_data_dnotify != NULL)
+ (context->user_data_dnotify) (context->user_data);
+
+ if (context->text != NULL)
+ g_string_free (context->text, TRUE);
+ for (l = context->level; l; l = l->next)
+ g_free (l->data);
+ g_slist_free (context->level);
+ g_free (context);
+}
+
+static gboolean
+my_isspace (char c)
+{
+ if (c == ' ' || c == '\t' || c == '\r' || c == '\n' || c == '\v')
+ return TRUE;
+ return FALSE;
+}
+
+static gboolean
+my_isalnum (char c)
+{
+ if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
+ return TRUE;
+ if (c >= '0' && c <= '9')
+ return TRUE;
+
+ return FALSE;
+}
+
+static gboolean
+my_isalpha (char c)
+{
+ if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
+ return TRUE;
+ return FALSE;
+}
+
+static const char *
+skip_space (const char *p, const char *end)
+{
+ for (; p < end && my_isspace (*p); p++)
+ ;
+ return p;
+}
+
+static const char *
+parse_value (const char *p, const char *end, char **value, GError **error)
+{
+ const char *start;
+ int l;
+
+ if (*p != '"'){
+ set_error ("%s", "Expected the attribute value to start with a quote");
+ return end;
+ }
+ start = ++p;
+ for (; p < end && *p != '"'; p++)
+ ;
+ if (p == end)
+ return end;
+ l = (int)(p - start);
+ p++;
+ *value = g_malloc (l + 1);
+ if (*value == NULL)
+ return end;
+ strncpy (*value, start, l);
+ (*value) [l] = 0;
+ return p;
+}
+
+static const char *
+parse_name (const char *p, const char *end, char **value)
+{
+ const char *start = p;
+ int l;
+
+ for (; p < end && my_isalnum (*p); p++)
+ ;
+ if (p == end)
+ return end;
+
+ l = (int)(p - start);
+ *value = g_malloc (l + 1);
+ if (*value == NULL)
+ return end;
+ strncpy (*value, start, l);
+ (*value) [l] = 0;
+ return p;
+}
+
+static const char *
+parse_attributes (const char *p, const char *end, char ***names, char ***values, GError **error, int *full_stop, int state)
+{
+ int nnames = 0;
+
+ while (TRUE){
+ p = skip_space (p, end);
+ if (p == end)
+ return end;
+
+ if (*p == '>'){
+ *full_stop = 0;
+ return p;
+ }
+ if (state == SKIP_XML_DECLARATION && *p == '?' && ((p+1) < end) && *(p+1) == '>'){
+ *full_stop = 0;
+ return p+1;
+ }
+
+ if (*p == '/' && ((p+1) < end && *(p+1) == '>')){
+ *full_stop = 1;
+ return p+1;
+ } else {
+ char *name, *value;
+
+ p = parse_name (p, end, &name);
+ if (p == end)
+ return p;
+
+ p = skip_space (p, end);
+ if (p == end){
+ g_free (name);
+ return p;
+ }
+ if (*p != '='){
+ set_error ("Expected an = after the attribute name `%s'", name);
+ g_free (name);
+ return end;
+ }
+ p++;
+ p = skip_space (p, end);
+ if (p == end){
+ g_free (name);
+ return end;
+ }
+
+ p = parse_value (p, end, &value, error);
+ if (p == end){
+ g_free (name);
+ return p;
+ }
+
+ ++nnames;
+ *names = g_realloc (*names, sizeof (char **) * (nnames+1));
+ *values = g_realloc (*values, sizeof (char **) * (nnames+1));
+ (*names) [nnames-1] = name;
+ (*values) [nnames-1] = value;
+ (*names) [nnames] = NULL;
+ (*values) [nnames] = NULL;
+ }
+ }
+}
+
+static void
+destroy_parse_state (GMarkupParseContext *context)
+{
+ GSList *p;
+
+ for (p = context->level; p != NULL; p = p->next)
+ g_free (p->data);
+
+ g_slist_free (context->level);
+ if (context->text != NULL)
+ g_string_free (context->text, TRUE);
+ context->text = NULL;
+ context->level = NULL;
+}
+
+gboolean
+g_markup_parse_context_parse (GMarkupParseContext *context,
+ const gchar *text, gssize text_len,
+ GError **error)
+{
+ const char *p, *end;
+
+ g_return_val_if_fail (context != NULL, FALSE);
+ g_return_val_if_fail (text != NULL, FALSE);
+ g_return_val_if_fail (text_len >= 0, FALSE);
+
+ end = text + text_len;
+
+ for (p = text; p < end; p++){
+ char c = *p;
+
+ switch (context->state){
+ case START:
+ if (c == ' ' || c == '\t' || c == '\f' || c == '\n' || (c & 0x80))
+ continue;
+ if (c == '<'){
+ if (p+1 < end && p [1] == '?'){
+ context->state = SKIP_XML_DECLARATION;
+ p++;
+ } else
+ context->state = START_ELEMENT;
+ continue;
+ }
+ set_error ("%s", "Expected < to start the document");
+ goto fail;
+
+ case SKIP_XML_DECLARATION:
+ case START_ELEMENT: {
+ const char *element_start = p, *element_end;
+ char *ename = NULL;
+ int full_stop = 0, l;
+ gchar **names = NULL, **values = NULL;
+
+ for (; p < end && my_isspace (*p); p++)
+ ;
+ if (p == end){
+ set_error ("%s", "Unfinished element");
+ goto fail;
+ }
+
+ if (*p == '!' && (p+2 < end) && (p [1] == '-') && (p [2] == '-')){
+ context->state = COMMENT;
+ p += 2;
+ break;
+ }
+
+ if (!my_isalpha (*p)){
+ set_error ("%s", "Expected an element name");
+ goto fail;
+ }
+
+ for (++p; p < end && (my_isalnum (*p) || (*p == '.')); p++)
+ ;
+ if (p == end){
+ set_error ("%s", "Expected an element");
+ goto fail;
+ }
+ element_end = p;
+
+ for (; p < end && my_isspace (*p); p++)
+ ;
+ if (p == end){
+ set_error ("%s", "Unfinished element");
+ goto fail;
+ }
+ p = parse_attributes (p, end, &names, &values, error, &full_stop, context->state);
+ if (p == end){
+ if (names != NULL) {
+ g_strfreev (names);
+ g_strfreev (values);
+ }
+ /* Only set the error if parse_attributes did not */
+ if (error != NULL && *error == NULL)
+ set_error ("%s", "Unfinished sequence");
+ goto fail;
+ }
+ l = (int)(element_end - element_start);
+ ename = g_malloc (l + 1);
+ if (ename == NULL)
+ goto fail;
+ strncpy (ename, element_start, l);
+ ename [l] = 0;
+
+ if (context->state == START_ELEMENT)
+ if (context->parser.start_element != NULL)
+ context->parser.start_element (context, ename,
+ (const gchar **) names,
+ (const gchar **) values,
+ context->user_data, error);
+
+ if (names != NULL){
+ g_strfreev (names);
+ g_strfreev (values);
+ }
+
+ if (error != NULL && *error != NULL){
+ g_free (ename);
+ goto fail;
+ }
+
+ if (full_stop){
+ if (context->parser.end_element != NULL && context->state == START_ELEMENT){
+ context->parser.end_element (context, ename, context->user_data, error);
+ if (error != NULL && *error != NULL){
+ g_free (ename);
+ goto fail;
+ }
+ }
+ g_free (ename);
+ } else {
+ context->level = g_slist_prepend (context->level, ename);
+ }
+
+ context->state = TEXT;
+ break;
+ } /* case START_ELEMENT */
+
+ case TEXT: {
+ if (c == '<'){
+ context->state = FLUSH_TEXT;
+ break;
+ }
+ if (context->parser.text != NULL){
+ if (context->text == NULL)
+ context->text = g_string_new ("");
+ g_string_append_c (context->text, c);
+ }
+ break;
+ }
+
+ case COMMENT:
+ if (*p != '-')
+ break;
+ if (p+2 < end && (p [1] == '-') && (p [2] == '>')){
+ context->state = TEXT;
+ p += 2;
+ break;
+ }
+ break;
+
+ case FLUSH_TEXT:
+ if (context->parser.text != NULL && context->text != NULL){
+ context->parser.text (context, context->text->str, context->text->len,
+ context->user_data, error);
+ if (error != NULL && *error != NULL)
+ goto fail;
+ }
+
+ if (c == '/')
+ context->state = CLOSING_ELEMENT;
+ else {
+ p--;
+ context->state = START_ELEMENT;
+ }
+ break;
+
+ case CLOSING_ELEMENT: {
+ GSList *current = context->level;
+ char *text;
+
+ if (context->level == NULL){
+ set_error ("%s", "Too many closing tags, not enough open tags");
+ goto fail;
+ }
+
+ text = current->data;
+ if (context->parser.end_element != NULL){
+ context->parser.end_element (context, text, context->user_data, error);
+ if (error != NULL && *error != NULL){
+ g_free (text);
+ goto fail;
+ }
+ }
+ g_free (text);
+
+ while (p < end && *p != '>')
+ p++;
+
+ context->level = context->level->next;
+ g_slist_free_1 (current);
+ context->state = TEXT;
+ break;
+ } /* case CLOSING_ELEMENT */
+
+ } /* switch */
+ }
+
+
+ return TRUE;
+ fail:
+ if (context->parser.error && error != NULL && *error)
+ context->parser.error (context, *error, context->user_data);
+
+ destroy_parse_state (context);
+ return FALSE;
+}
+
+gboolean
+g_markup_parse_context_end_parse (GMarkupParseContext *context, GError **error)
+{
+ g_return_val_if_fail (context != NULL, FALSE);
+
+ /*
+ * In our case, we always signal errors during parse, not at the end
+ * see the notes at the top of this file for details on how this
+ * could be moved here
+ */
+ return TRUE;
+}
--- /dev/null
+/*
+ * gmem.c: memory utility functions
+ *
+ * Author:
+ * Gonzalo Paniagua Javier (gonzalo@novell.com)
+ *
+ * (C) 2006 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.
+ */
+#include <config.h>
+#include <stdio.h>
+#include <string.h>
+#include <glib.h>
+
+#if defined (ENABLE_OVERRIDABLE_ALLOCATORS)
+
+static GMemVTable sGMemVTable = { malloc, realloc, free, calloc };
+
+void
+g_mem_set_vtable (GMemVTable* vtable)
+{
+ sGMemVTable.calloc = vtable->calloc ? vtable->calloc : calloc;
+ sGMemVTable.realloc = vtable->realloc ? vtable->realloc : realloc;
+ sGMemVTable.malloc = vtable->malloc ? vtable->malloc : malloc;
+ sGMemVTable.free = vtable->free ? vtable->free : free;
+}
+
+#define G_FREE_INTERNAL sGMemVTable.free
+#define G_REALLOC_INTERNAL sGMemVTable.realloc
+#define G_CALLOC_INTERNAL sGMemVTable.calloc
+#define G_MALLOC_INTERNAL sGMemVTable.malloc
+#else
+
+void
+g_mem_set_vtable (GMemVTable* vtable)
+{
+}
+
+#define G_FREE_INTERNAL free
+#define G_REALLOC_INTERNAL realloc
+#define G_CALLOC_INTERNAL calloc
+#define G_MALLOC_INTERNAL malloc
+#endif
+void
+g_free (void *ptr)
+{
+ if (ptr != NULL)
+ G_FREE_INTERNAL (ptr);
+}
+
+gpointer
+g_memdup (gconstpointer mem, guint byte_size)
+{
+ gpointer ptr;
+
+ if (mem == NULL)
+ return NULL;
+
+ ptr = g_malloc (byte_size);
+ if (ptr != NULL)
+ memcpy (ptr, mem, byte_size);
+
+ return ptr;
+}
+
+gpointer g_realloc (gpointer obj, gsize size)
+{
+ gpointer ptr;
+ if (!size) {
+ g_free (obj);
+ return 0;
+ }
+ ptr = G_REALLOC_INTERNAL (obj, size);
+ if (ptr)
+ return ptr;
+ g_error ("Could not allocate %i bytes", size);
+}
+
+gpointer
+g_malloc (gsize x)
+{
+ gpointer ptr;
+ if (!x)
+ return 0;
+ ptr = G_MALLOC_INTERNAL (x);
+ if (ptr)
+ return ptr;
+ g_error ("Could not allocate %i bytes", x);
+}
+
+gpointer g_calloc (gsize n, gsize x)
+{
+ gpointer ptr;
+ if (!x || !n)
+ return 0;
+ ptr = G_CALLOC_INTERNAL (n, x);
+ if (ptr)
+ return ptr;
+ g_error ("Could not allocate %i (%i * %i) bytes", x*n, n, x);
+}
+gpointer g_malloc0 (gsize x)
+{
+ return g_calloc (1,x);
+}
+
+gpointer g_try_malloc (gsize x)
+{
+ if (x)
+ return G_MALLOC_INTERNAL (x);
+ return 0;
+}
+
+
+gpointer g_try_realloc (gpointer obj, gsize size)
+{
+ if (!size) {
+ G_FREE_INTERNAL (obj);
+ return 0;
+ }
+ return G_REALLOC_INTERNAL (obj, size);
+}
--- /dev/null
+/*
+ * gmisc.c: Misc functions with no place to go (right now)
+ *
+ * Author:
+ * Aaron Bockover (abockover@novell.com)
+ *
+ * (C) 2006 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.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <glib.h>
+#include <pthread.h>
+
+#ifdef HAVE_PWD_H
+#include <pwd.h>
+#endif
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+static pthread_mutex_t env_lock = PTHREAD_MUTEX_INITIALIZER;
+
+/* MONO Comment
+ *
+ * As per the UNIX spec,
+ * "The return value from getenv() may point to static data which may be overwritten by subsequent calls to getenv(), setenv(), or unsetenv()."
+ * Source: Unix Manual Pages for getenv, IEEE Std 1003.1
+ *
+ * This means that using pointers returned from getenv may (and does) lead to many
+ * pointers which refer to the same piece of memory. When one is freed, all will be freed.
+ *
+ * This is unsafe and an ergonomics risk to fix in the callers. While the caller could lock,
+ * this introduces the risk for looping or exiting while inside of a lock. For this reason,
+ * g_getenv does not mimic the behavior of POSIX getenv anymore.
+ *
+ * The memory address returned will be unique to the invocaton, and must be freed.
+ * */
+gchar *
+g_getenv (const gchar *variable)
+{
+ gchar *ret = NULL;
+ pthread_mutex_lock (&env_lock);
+ gchar *res = getenv(variable);
+ if (res)
+ ret = g_strdup(res);
+ pthread_mutex_unlock (&env_lock);
+
+ return ret;
+}
+
+/*
+ * This function checks if the given variable is non-NULL
+ * in the environment. It's useful because it removes memory
+ * freeing requirements.
+ *
+ */
+gboolean
+g_hasenv (const gchar *variable)
+{
+ pthread_mutex_lock (&env_lock);
+ gchar *res = getenv(variable);
+ gboolean not_null = (res != NULL);
+ pthread_mutex_unlock (&env_lock);
+
+ return not_null;
+}
+
+gboolean
+g_setenv(const gchar *variable, const gchar *value, gboolean overwrite)
+{
+ gboolean res;
+ pthread_mutex_lock (&env_lock);
+ res = (setenv(variable, value, overwrite) == 0);
+ pthread_mutex_unlock (&env_lock);
+ return res;
+}
+
+void
+g_unsetenv(const gchar *variable)
+{
+ pthread_mutex_lock (&env_lock);
+ unsetenv(variable);
+ pthread_mutex_unlock (&env_lock);
+}
+
+gchar*
+g_win32_getlocale(void)
+{
+ return NULL;
+}
+
+gboolean
+g_path_is_absolute (const char *filename)
+{
+ g_return_val_if_fail (filename != NULL, FALSE);
+
+ return (*filename == '/');
+}
+
+static pthread_mutex_t pw_lock = PTHREAD_MUTEX_INITIALIZER;
+static const gchar *home_dir;
+static const gchar *user_name;
+
+static void
+get_pw_data (void)
+{
+#ifdef HAVE_GETPWUID_R
+ struct passwd pw;
+ struct passwd *result;
+ char buf [4096];
+#endif
+
+ if (user_name != NULL)
+ return;
+
+ pthread_mutex_lock (&pw_lock);
+ if (user_name != NULL) {
+ pthread_mutex_unlock (&pw_lock);
+ return;
+ }
+
+ home_dir = g_getenv ("HOME");
+ user_name = g_getenv ("USER");
+
+#ifdef HAVE_GETPWUID_R
+ if (home_dir == NULL || user_name == NULL) {
+ if (getpwuid_r (getuid (), &pw, buf, 4096, &result) == 0) {
+ if (home_dir == NULL)
+ home_dir = g_strdup (pw.pw_dir);
+ if (user_name == NULL)
+ user_name = g_strdup (pw.pw_name);
+ }
+ }
+#endif
+
+ if (user_name == NULL)
+ user_name = "somebody";
+ if (home_dir == NULL)
+ home_dir = "/";
+
+ pthread_mutex_unlock (&pw_lock);
+}
+
+const gchar *
+g_get_home_dir (void)
+{
+ get_pw_data ();
+ return home_dir;
+}
+
+const char *
+g_get_user_name (void)
+{
+ get_pw_data ();
+ return user_name;
+}
+
+static const char *tmp_dir;
+
+static pthread_mutex_t tmp_lock = PTHREAD_MUTEX_INITIALIZER;
+
+const gchar *
+g_get_tmp_dir (void)
+{
+ if (tmp_dir == NULL){
+ pthread_mutex_lock (&tmp_lock);
+ if (tmp_dir == NULL){
+ tmp_dir = g_getenv ("TMPDIR");
+ if (tmp_dir == NULL){
+ tmp_dir = g_getenv ("TMP");
+ if (tmp_dir == NULL){
+ tmp_dir = g_getenv ("TEMP");
+ if (tmp_dir == NULL)
+ tmp_dir = "/tmp";
+ }
+ }
+ }
+ pthread_mutex_unlock (&tmp_lock);
+ }
+ return tmp_dir;
+}
+
--- /dev/null
+/*
+ * gmisc-win32-uwp.c: UWP misc support.
+ *
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+*/
+#include <config.h>
+#include <glib.h>
+
+#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
+#include <windows.h>
+#include <assert.h>
+
+gchar*
+g_win32_getlocale(void)
+{
+ gunichar2 buf[19];
+ gint ccBuf = GetLocaleInfoEx (LOCALE_NAME_USER_DEFAULT, LOCALE_SISO639LANGNAME, buf, 9);
+ assert (ccBuf <= 9);
+ if (ccBuf != 0) {
+ buf[ccBuf - 1] = L'-';
+ ccBuf = GetLocaleInfoEx (LOCALE_NAME_USER_DEFAULT, LOCALE_SISO3166CTRYNAME, buf + ccBuf, 9);
+ assert (ccBuf <= 9);
+ }
+
+ // Check for GetLocaleInfoEx failure.
+ if (ccBuf == 0)
+ buf[0] = L'\0';
+
+ return u16to8 (buf);
+}
+
+#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
+
+#ifdef _MSC_VER
+// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
+void __mono_win32_gmisc_win32_uwp_quiet_lnk4221(void) {}
+#endif
+#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
--- /dev/null
+/*
+ * gmisc.c: Misc functions with no place to go (right now)
+ *
+ * Author:
+ * Aaron Bockover (abockover@novell.com)
+ *
+ * (C) 2006 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.
+ */
+
+#include <config.h>
+
+#include <stdlib.h>
+#include <glib.h>
+
+#include <windows.h>
+#if _MSC_VER && G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+#include <shlobj.h>
+#endif
+#include <direct.h>
+#include <io.h>
+#include <assert.h>
+
+gboolean
+g_hasenv (const gchar *variable)
+{
+ return g_getenv (variable) != NULL;
+}
+
+gchar *
+g_getenv(const gchar *variable)
+{
+ gunichar2 *var, *buffer;
+ gchar* val = NULL;
+ gint32 buffer_size = 1024;
+ gint32 retval;
+ var = u8to16(variable);
+ buffer = g_malloc(buffer_size*sizeof(gunichar2));
+ retval = GetEnvironmentVariableW (var, buffer, buffer_size);
+ if (retval != 0) {
+ if (retval > buffer_size) {
+ g_free (buffer);
+ buffer_size = retval;
+ buffer = g_malloc(buffer_size*sizeof(gunichar2));
+ retval = GetEnvironmentVariableW (var, buffer, buffer_size);
+ }
+ val = u16to8 (buffer);
+ } else {
+ if (GetLastError () != ERROR_ENVVAR_NOT_FOUND){
+ val = g_malloc (1);
+ *val = 0;
+ }
+ }
+ g_free(var);
+ g_free(buffer);
+ return val;
+}
+
+gboolean
+g_setenv(const gchar *variable, const gchar *value, gboolean overwrite)
+{
+ gunichar2 *var, *val;
+ gboolean result;
+ var = u8to16(variable);
+ val = u8to16(value);
+ result = (SetEnvironmentVariableW(var, val) != 0) ? TRUE : FALSE;
+ g_free(var);
+ g_free(val);
+ return result;
+}
+
+void
+g_unsetenv(const gchar *variable)
+{
+ gunichar2 *var;
+ var = u8to16(variable);
+ SetEnvironmentVariableW(var, L"");
+ g_free(var);
+}
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+gchar*
+g_win32_getlocale(void)
+{
+ LCID lcid = GetThreadLocale();
+ gchar buf[19];
+ gint ccBuf = GetLocaleInfoA(lcid, LOCALE_SISO639LANGNAME, buf, 9);
+ buf[ccBuf - 1] = '-';
+ ccBuf += GetLocaleInfoA(lcid, LOCALE_SISO3166CTRYNAME, buf + ccBuf, 9);
+ return g_strdup (buf);
+}
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
+gboolean
+g_path_is_absolute (const char *filename)
+{
+ g_return_val_if_fail (filename != NULL, FALSE);
+
+ if (filename[0] != '\0' && filename[1] != '\0') {
+ if (filename[1] == ':' && filename[2] != '\0' &&
+ (filename[2] == '\\' || filename[2] == '/'))
+ return TRUE;
+ /* UNC paths */
+ else if (filename[0] == '\\' && filename[1] == '\\' &&
+ filename[2] != '\0')
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+#if _MSC_VER && G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+static gchar*
+g_get_known_folder_path (void)
+{
+ gchar *folder_path = NULL;
+ PWSTR profile_path = NULL;
+ HRESULT hr = SHGetKnownFolderPath (&FOLDERID_Profile, KF_FLAG_DEFAULT, NULL, &profile_path);
+ if (SUCCEEDED(hr)) {
+ folder_path = u16to8 (profile_path);
+ CoTaskMemFree (profile_path);
+ }
+
+ return folder_path;
+}
+
+#else
+
+static inline gchar *
+g_get_known_folder_path (void)
+{
+ return NULL;
+}
+#endif
+
+const gchar *
+g_get_home_dir (void)
+{
+ gchar *home_dir = g_get_known_folder_path ();
+
+ if (!home_dir) {
+ home_dir = (gchar *) g_getenv ("USERPROFILE");
+ }
+
+ if (!home_dir) {
+ const gchar *drive = g_getenv ("HOMEDRIVE");
+ const gchar *path = g_getenv ("HOMEPATH");
+
+ if (drive && path) {
+ home_dir = g_malloc (strlen (drive) + strlen (path) + 1);
+ if (home_dir) {
+ sprintf (home_dir, "%s%s", drive, path);
+ }
+ }
+ g_free (drive);
+ g_free (path);
+ }
+
+ return home_dir;
+}
+
+const char *
+g_get_user_name (void)
+{
+ const char * retName = g_getenv ("USER");
+ if (!retName)
+ retName = g_getenv ("USERNAME");
+ return retName;
+}
+
+static const char *tmp_dir;
+
+const gchar *
+g_get_tmp_dir (void)
+{
+ if (tmp_dir == NULL){
+ if (tmp_dir == NULL){
+ tmp_dir = g_getenv ("TMPDIR");
+ if (tmp_dir == NULL){
+ tmp_dir = g_getenv ("TMP");
+ if (tmp_dir == NULL){
+ tmp_dir = g_getenv ("TEMP");
+ if (tmp_dir == NULL)
+ tmp_dir = "C:\\temp";
+ }
+ }
+ }
+ }
+ return tmp_dir;
+}
--- /dev/null
+/*
+ * gmodule.c: dl* functions, glib style
+ *
+ * Author:
+ * Gonzalo Paniagua Javier (gonzalo@novell.com)
+ * Jonathan Chambers (joncham@gmail.com)
+ * Robert Jordan (robertj@gmx.net)
+ *
+ * (C) 2006 Novell, Inc.
+ * (C) 2006 Jonathan Chambers
+ *
+ * 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.
+ */
+#include <config.h>
+
+#include <glib.h>
+#include <gmodule.h>
+
+#if defined(G_OS_UNIX) && defined(HAVE_DLFCN_H)
+#include <dlfcn.h>
+
+/* For Linux and Solaris, need to add others as we port this */
+#define LIBPREFIX "lib"
+#define LIBSUFFIX ".so"
+
+struct _GModule {
+ void *handle;
+};
+
+GModule *
+g_module_open (const gchar *file, GModuleFlags flags)
+{
+ int f = 0;
+ GModule *module;
+ void *handle;
+
+ flags &= G_MODULE_BIND_MASK;
+ if ((flags & G_MODULE_BIND_LAZY) != 0)
+ f |= RTLD_LAZY;
+ if ((flags & G_MODULE_BIND_LOCAL) != 0)
+ f |= RTLD_LOCAL;
+
+ handle = dlopen (file, f);
+ if (handle == NULL)
+ return NULL;
+
+ module = g_new (GModule,1);
+ module->handle = handle;
+
+ return module;
+}
+
+gboolean
+g_module_symbol (GModule *module, const gchar *symbol_name, gpointer *symbol)
+{
+ if (symbol_name == NULL || symbol == NULL)
+ return FALSE;
+
+ if (module == NULL || module->handle == NULL)
+ return FALSE;
+
+ *symbol = dlsym (module->handle, symbol_name);
+ return (*symbol != NULL);
+}
+
+const gchar *
+g_module_error (void)
+{
+ return dlerror ();
+}
+
+gboolean
+g_module_close (GModule *module)
+{
+ void *handle;
+ if (module == NULL || module->handle == NULL)
+ return FALSE;
+
+ handle = module->handle;
+ module->handle = NULL;
+ g_free (module);
+ return (0 == dlclose (handle));
+}
+
+#elif defined (G_OS_WIN32)
+#include <windows.h>
+#include <psapi.h>
+
+#define LIBSUFFIX ".dll"
+#define LIBPREFIX ""
+
+struct _GModule {
+ HMODULE handle;
+ int main_module;
+};
+
+GModule *
+g_module_open (const gchar *file, GModuleFlags flags)
+{
+ GModule *module;
+ module = g_malloc (sizeof (GModule));
+ if (module == NULL)
+ return NULL;
+
+ if (file != NULL) {
+ gunichar2 *file16;
+ file16 = u8to16(file);
+ module->main_module = FALSE;
+ module->handle = LoadLibrary (file16);
+ g_free(file16);
+ if (!module->handle) {
+ g_free (module);
+ return NULL;
+ }
+
+ } else {
+ module->main_module = TRUE;
+ module->handle = GetModuleHandle (NULL);
+ }
+
+ return module;
+}
+
+static gpointer
+w32_find_symbol (const gchar *symbol_name)
+{
+ HMODULE *modules;
+ DWORD buffer_size = sizeof (HMODULE) * 1024;
+ DWORD needed, i;
+
+ modules = (HMODULE *) g_malloc (buffer_size);
+
+ if (modules == NULL)
+ return NULL;
+
+ if (!EnumProcessModules (GetCurrentProcess (), modules,
+ buffer_size, &needed)) {
+ g_free (modules);
+ return NULL;
+ }
+
+ /* check whether the supplied buffer was too small, realloc, retry */
+ if (needed > buffer_size) {
+ g_free (modules);
+
+ buffer_size = needed;
+ modules = (HMODULE *) g_malloc (buffer_size);
+
+ if (modules == NULL)
+ return NULL;
+
+ if (!EnumProcessModules (GetCurrentProcess (), modules,
+ buffer_size, &needed)) {
+ g_free (modules);
+ return NULL;
+ }
+ }
+
+ for (i = 0; i < needed / sizeof (HANDLE); i++) {
+ gpointer proc = (gpointer)(intptr_t)GetProcAddress (modules [i], symbol_name);
+ if (proc != NULL) {
+ g_free (modules);
+ return proc;
+ }
+ }
+
+ g_free (modules);
+ return NULL;
+}
+
+gboolean
+g_module_symbol (GModule *module, const gchar *symbol_name, gpointer *symbol)
+{
+ if (module == NULL || symbol_name == NULL || symbol == NULL)
+ return FALSE;
+
+ if (module->main_module) {
+ *symbol = (gpointer)(intptr_t)GetProcAddress (module->handle, symbol_name);
+ if (*symbol != NULL)
+ return TRUE;
+
+ *symbol = w32_find_symbol (symbol_name);
+ return *symbol != NULL;
+ } else {
+ *symbol = (gpointer)(intptr_t)GetProcAddress (module->handle, symbol_name);
+ return *symbol != NULL;
+ }
+}
+
+const gchar *
+g_module_error (void)
+{
+ gchar* ret = NULL;
+ TCHAR* buf = NULL;
+ DWORD code = GetLastError ();
+
+ FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL,
+ code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buf, 0, NULL);
+
+ ret = u16to8 (buf);
+ LocalFree(buf);
+
+ return ret;
+}
+
+gboolean
+g_module_close (GModule *module)
+{
+ HMODULE handle;
+ int main_module;
+
+ if (module == NULL || module->handle == NULL)
+ return FALSE;
+
+ handle = module->handle;
+ main_module = module->main_module;
+ module->handle = NULL;
+ g_free (module);
+ return (main_module ? 1 : (0 == FreeLibrary (handle)));
+}
+
+#else
+
+#define LIBSUFFIX ""
+#define LIBPREFIX ""
+
+GModule *
+g_module_open (const gchar *file, GModuleFlags flags)
+{
+ g_error ("%s", "g_module_open not implemented on this platform");
+ return NULL;
+}
+
+gboolean
+g_module_symbol (GModule *module, const gchar *symbol_name, gpointer *symbol)
+{
+ g_error ("%s", "g_module_open not implemented on this platform");
+ return FALSE;
+}
+
+const gchar *
+g_module_error (void)
+{
+ g_error ("%s", "g_module_open not implemented on this platform");
+ return NULL;
+}
+
+gboolean
+g_module_close (GModule *module)
+{
+ g_error ("%s", "g_module_open not implemented on this platform");
+ return FALSE;
+}
+#endif
+
+gchar *
+g_module_build_path (const gchar *directory, const gchar *module_name)
+{
+ char *lib_prefix = "";
+
+ if (module_name == NULL)
+ return NULL;
+
+ if (strncmp (module_name, "lib", 3) != 0)
+ lib_prefix = LIBPREFIX;
+
+ if (directory && *directory){
+
+ return g_strdup_printf ("%s/%s%s" LIBSUFFIX, directory, lib_prefix, module_name);
+ }
+ return g_strdup_printf ("%s%s" LIBSUFFIX, lib_prefix, module_name);
+}
+
--- /dev/null
+#ifndef __G_MODULE_WINDOWS_INTERNALS_H__
+#define __G_MODULE_WINDOWS_INTERNALS_H__
+
+#include <config.h>
+#include <glib.h>
+
+#ifdef G_OS_WIN32
+#include <gmodule.h>
+
+gpointer
+w32_find_symbol (const gchar *symbol_name);
+#endif /* G_OS_WIN32 */
+#endif /* __G_MODULE_WINDOWS_INTERNALS_H__ */
--- /dev/null
+/*
+ * gmodule-win32-uwp.c: UWP gmodule support.
+ *
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+*/
+#include <config.h>
+#include <glib.h>
+
+#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
+#include <windows.h>
+#include <gmodule-win32-internals.h>
+
+gpointer
+w32_find_symbol (const gchar *symbol_name)
+{
+ g_unsupported_api ("EnumProcessModules");
+ SetLastError (ERROR_NOT_SUPPORTED);
+ return NULL;
+}
+
+const gchar *
+g_module_error (void)
+{
+ gchar *ret = NULL;
+ TCHAR buf [1024];
+ DWORD code = GetLastError ();
+
+ if (!FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
+ code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buf, G_N_ELEMENTS (buf) - 1, NULL) )
+ buf[0] = TEXT('\0');
+
+ ret = u16to8 (buf);
+ return ret;
+}
+
+#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
+
+#ifdef _MSC_VER
+// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
+void __mono_win32_gmodule_win32_uwp_quiet_lnk4221(void) {}
+#endif
+#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
--- /dev/null
+/*
+ * gmodule.c: dl* functions, glib style
+ *
+ * Author:
+ * Gonzalo Paniagua Javier (gonzalo@novell.com)
+ * Jonathan Chambers (joncham@gmail.com)
+ * Robert Jordan (robertj@gmx.net)
+ *
+ * (C) 2006 Novell, Inc.
+ * (C) 2006 Jonathan Chambers
+ *
+ * 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.
+ */
+#include <config.h>
+#include <glib.h>
+#include <windows.h>
+#include <psapi.h>
+#include <gmodule-win32-internals.h>
+
+#define LIBSUFFIX ".dll"
+#define LIBPREFIX ""
+
+struct _GModule {
+ HMODULE handle;
+ int main_module;
+};
+
+GModule *
+g_module_open (const gchar *file, GModuleFlags flags)
+{
+ GModule *module;
+ module = g_malloc (sizeof (GModule));
+ if (module == NULL)
+ return NULL;
+
+ if (file != NULL) {
+ gunichar2 *file16;
+ file16 = u8to16(file);
+ module->main_module = FALSE;
+ module->handle = LoadLibraryW (file16);
+ g_free(file16);
+ if (!module->handle) {
+ g_free (module);
+ return NULL;
+ }
+
+ } else {
+ module->main_module = TRUE;
+ module->handle = GetModuleHandle (NULL);
+ }
+
+ return module;
+}
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+gpointer
+w32_find_symbol (const gchar *symbol_name)
+{
+ HMODULE *modules;
+ DWORD buffer_size = sizeof (HMODULE) * 1024;
+ DWORD needed, i;
+
+ modules = (HMODULE *) g_malloc (buffer_size);
+
+ if (modules == NULL)
+ return NULL;
+
+ if (!EnumProcessModules (GetCurrentProcess (), modules,
+ buffer_size, &needed)) {
+ g_free (modules);
+ return NULL;
+ }
+
+ /* check whether the supplied buffer was too small, realloc, retry */
+ if (needed > buffer_size) {
+ g_free (modules);
+
+ buffer_size = needed;
+ modules = (HMODULE *) g_malloc (buffer_size);
+
+ if (modules == NULL)
+ return NULL;
+
+ if (!EnumProcessModules (GetCurrentProcess (), modules,
+ buffer_size, &needed)) {
+ g_free (modules);
+ return NULL;
+ }
+ }
+
+ for (i = 0; i < needed / sizeof (HANDLE); i++) {
+ gpointer proc = (gpointer)(intptr_t)GetProcAddress (modules [i], symbol_name);
+ if (proc != NULL) {
+ g_free (modules);
+ return proc;
+ }
+ }
+
+ g_free (modules);
+ return NULL;
+}
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
+gboolean
+g_module_symbol (GModule *module, const gchar *symbol_name, gpointer *symbol)
+{
+ if (module == NULL || symbol_name == NULL || symbol == NULL)
+ return FALSE;
+
+ if (module->main_module) {
+ *symbol = (gpointer)(intptr_t)GetProcAddress (module->handle, symbol_name);
+ if (*symbol != NULL)
+ return TRUE;
+
+ *symbol = w32_find_symbol (symbol_name);
+ return *symbol != NULL;
+ } else {
+ *symbol = (gpointer)(intptr_t)GetProcAddress (module->handle, symbol_name);
+ return *symbol != NULL;
+ }
+}
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+const gchar *
+g_module_error (void)
+{
+ gchar* ret = NULL;
+ TCHAR* buf = NULL;
+ DWORD code = GetLastError ();
+
+ /* FIXME: buf must not be NULL! */
+ FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL,
+ code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buf, 0, NULL);
+
+ ret = u16to8 (buf);
+ LocalFree(buf);
+
+ return ret;
+}
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
+gboolean
+g_module_close (GModule *module)
+{
+ HMODULE handle;
+ int main_module;
+
+ if (module == NULL || module->handle == NULL)
+ return FALSE;
+
+ handle = module->handle;
+ main_module = module->main_module;
+ module->handle = NULL;
+ g_free (module);
+ return (main_module ? 1 : (0 == FreeLibrary (handle)));
+}
+
+gchar *
+g_module_build_path (const gchar *directory, const gchar *module_name)
+{
+ char *lib_prefix = "";
+
+ if (module_name == NULL)
+ return NULL;
+
+ if (strncmp (module_name, "lib", 3) != 0)
+ lib_prefix = LIBPREFIX;
+
+ if (directory && *directory){
+
+ return g_strdup_printf ("%s/%s%s" LIBSUFFIX, directory, lib_prefix, module_name);
+ }
+ return g_strdup_printf ("%s%s" LIBSUFFIX, lib_prefix, module_name);
+}
--- /dev/null
+#ifndef __GLIB_GMODULE_H
+#define __GLIB_GMODULE_H
+
+#include <glib.h>
+
+#define G_MODULE_IMPORT extern
+#ifdef G_OS_WIN32
+#define G_MODULE_EXPORT __declspec(dllexport)
+#else
+#define G_MODULE_EXPORT
+#endif
+
+G_BEGIN_DECLS
+
+/*
+ * Modules
+ */
+typedef enum {
+ G_MODULE_BIND_LAZY = 0x01,
+ G_MODULE_BIND_LOCAL = 0x02,
+ G_MODULE_BIND_MASK = 0x03
+} GModuleFlags;
+typedef struct _GModule GModule;
+
+GModule *g_module_open (const gchar *file, GModuleFlags flags);
+gboolean g_module_symbol (GModule *module, const gchar *symbol_name,
+ gpointer *symbol);
+const gchar *g_module_error (void);
+gboolean g_module_close (GModule *module);
+gchar * g_module_build_path (const gchar *directory, const gchar *module_name);
+
+extern char *gmodule_libprefix;
+extern char *gmodule_libsuffix;
+
+G_END_DECLS
+
+#endif
--- /dev/null
+/*
+ * Output and debugging functions
+ *
+ * Author:
+ * Miguel de Icaza (miguel@novell.com)
+ *
+ * (C) 2006 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.
+ */
+#include <config.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <glib.h>
+
+/* The current fatal levels, error is always fatal */
+static GLogLevelFlags fatal = G_LOG_LEVEL_ERROR;
+static GLogFunc default_log_func;
+static gpointer default_log_func_user_data;
+static GPrintFunc stdout_handler, stderr_handler;
+
+static void default_stdout_handler (const gchar *string);
+static void default_stderr_handler (const gchar *string);
+
+void
+g_print (const gchar *format, ...)
+{
+ char *msg;
+ va_list args;
+
+ va_start (args, format);
+ if (g_vasprintf (&msg, format, args) < 0) {
+ va_end (args);
+ return;
+ }
+ va_end (args);
+
+ if (!stdout_handler)
+ stdout_handler = default_stdout_handler;
+
+ stdout_handler (msg);
+ g_free (msg);
+}
+
+void
+g_printerr (const gchar *format, ...)
+{
+ char *msg;
+ va_list args;
+
+ va_start (args, format);
+ if (g_vasprintf (&msg, format, args) < 0) {
+ va_end (args);
+ return;
+ }
+ va_end (args);
+
+ if (!stderr_handler)
+ stderr_handler = default_stderr_handler;
+
+ stderr_handler (msg);
+ g_free (msg);
+}
+
+GLogLevelFlags
+g_log_set_always_fatal (GLogLevelFlags fatal_mask)
+{
+ GLogLevelFlags old_fatal = fatal;
+
+ fatal |= fatal_mask;
+
+ return old_fatal;
+}
+
+GLogLevelFlags
+g_log_set_fatal_mask (const gchar *log_domain, GLogLevelFlags fatal_mask)
+{
+ /*
+ * Mono does not use a G_LOG_DOMAIN currently, so we just assume things are fatal
+ * if we decide to set G_LOG_DOMAIN (we probably should) we should implement
+ * this.
+ */
+ return fatal_mask;
+}
+
+void
+g_logv (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, va_list args)
+{
+ char *msg;
+
+ if (!default_log_func)
+ default_log_func = g_log_default_handler;
+
+ if (g_vasprintf (&msg, format, args) < 0)
+ return;
+
+ default_log_func (log_domain, log_level, msg, default_log_func_user_data);
+ g_free (msg);
+}
+
+void
+g_log (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, ...)
+{
+ va_list args;
+
+ va_start (args, format);
+ g_logv (log_domain, log_level, format, args);
+ va_end (args);
+}
+
+void
+g_assertion_message (const gchar *format, ...)
+{
+ va_list args;
+
+ va_start (args, format);
+ g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format, args);
+ va_end (args);
+ exit (0);
+}
+
+#if PLATFORM_ANDROID
+#include <android/log.h>
+
+static android_LogPriority
+to_android_priority (GLogLevelFlags log_level)
+{
+ switch (log_level & G_LOG_LEVEL_MASK)
+ {
+ case G_LOG_LEVEL_ERROR: return ANDROID_LOG_FATAL;
+ case G_LOG_LEVEL_CRITICAL: return ANDROID_LOG_ERROR;
+ case G_LOG_LEVEL_WARNING: return ANDROID_LOG_WARN;
+ case G_LOG_LEVEL_MESSAGE: return ANDROID_LOG_INFO;
+ case G_LOG_LEVEL_INFO: return ANDROID_LOG_DEBUG;
+ case G_LOG_LEVEL_DEBUG: return ANDROID_LOG_VERBOSE;
+ }
+ return ANDROID_LOG_UNKNOWN;
+}
+
+void
+g_log_default_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer unused_data)
+{
+ __android_log_write (to_android_priority (log_level), log_domain, message);
+ if (log_level & fatal)
+ abort ();
+}
+
+static void
+default_stdout_handler (const gchar *message)
+{
+ /* TODO: provide a proper app name */
+ __android_log_write (ANDROID_LOG_ERROR, "mono", message);
+}
+
+static void
+default_stderr_handler (const gchar *message)
+{
+ /* TODO: provide a proper app name */
+ __android_log_write (ANDROID_LOG_ERROR, "mono", message);
+}
+
+
+#elif defined(HOST_IOS)
+#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;
+}
+
+void
+g_log_default_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer unused_data)
+{
+ asl_log (NULL, NULL, to_asl_priority (log_level), "%s", message);
+ if (log_level & fatal)
+ abort ();
+}
+
+static void
+default_stdout_handler (const gchar *message)
+{
+ asl_log (NULL, NULL, ASL_LEVEL_WARNING, "%s", message);
+}
+
+static void
+default_stderr_handler (const gchar *message)
+{
+ asl_log (NULL, NULL, ASL_LEVEL_WARNING, "%s", message);
+}
+
+#else
+
+void
+g_log_default_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer unused_data)
+{
+ FILE *target = stdout;
+
+ fprintf (target, "%s%s%s\n",
+ log_domain != NULL ? log_domain : "",
+ log_domain != NULL ? ": " : "",
+ message);
+
+ if (log_level & fatal) {
+ fflush (stdout);
+ fflush (stderr);
+ abort ();
+ }
+}
+
+static void
+default_stdout_handler (const gchar *string)
+{
+ fprintf (stdout, "%s", string);
+}
+
+static void
+default_stderr_handler (const gchar *string)
+{
+ fprintf (stderr, "%s", string);
+}
+
+#endif
+
+GLogFunc
+g_log_set_default_handler (GLogFunc log_func, gpointer user_data)
+{
+ GLogFunc old = default_log_func;
+ default_log_func = log_func;
+ default_log_func_user_data = user_data;
+ return old;
+}
+
+GPrintFunc
+g_set_print_handler (GPrintFunc func)
+{
+ GPrintFunc old = stdout_handler;
+ stdout_handler = func;
+ return old;
+}
+
+GPrintFunc
+g_set_printerr_handler (GPrintFunc func)
+{
+ GPrintFunc old = stderr_handler;
+ stderr_handler = func;
+ return old;
+}
+
--- /dev/null
+/*
+ * Portable Utility Functions
+ *
+ * Author:
+ * Miguel de Icaza (miguel@novell.com)
+ *
+ * (C) 2006 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.
+ */
+#include <config.h>
+#include <stdio.h>
+#include <glib.h>
+#include <errno.h>
+#include <sys/stat.h>
+
+#ifdef G_OS_WIN32
+#include <direct.h>
+#endif
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+gchar *
+g_build_path (const gchar *separator, const gchar *first_element, ...)
+{
+ const char *elem, *next, *endptr;
+ gboolean trimmed;
+ GString *path;
+ va_list args;
+ size_t slen;
+
+ g_return_val_if_fail (separator != NULL, NULL);
+
+ path = g_string_sized_new (48);
+ slen = strlen (separator);
+
+ va_start (args, first_element);
+ for (elem = first_element; elem != NULL; elem = next) {
+ /* trim any trailing separators from @elem */
+ endptr = elem + strlen (elem);
+ trimmed = FALSE;
+
+ while (endptr >= elem + slen) {
+ if (strncmp (endptr - slen, separator, slen) != 0)
+ break;
+
+ endptr -= slen;
+ trimmed = TRUE;
+ }
+
+ /* append elem, not including any trailing separators */
+ if (endptr > elem)
+ g_string_append_len (path, elem, endptr - elem);
+
+ /* get the next element */
+ do {
+ if (!(next = va_arg (args, char *)))
+ break;
+
+ /* remove leading separators */
+ while (!strncmp (next, separator, slen))
+ next += slen;
+ } while (*next == '\0');
+
+ if (next || trimmed)
+ g_string_append_len (path, separator, slen);
+ }
+ va_end (args);
+
+ return g_string_free (path, FALSE);
+}
+
+static gchar*
+strrchr_seperator (const gchar* filename)
+{
+#ifdef G_OS_WIN32
+ char *p2;
+#endif
+ char *p;
+
+ p = strrchr (filename, G_DIR_SEPARATOR);
+#ifdef G_OS_WIN32
+ p2 = strrchr (filename, '/');
+ if (p2 > p)
+ p = p2;
+#endif
+
+ return p;
+}
+
+gchar *
+g_path_get_dirname (const gchar *filename)
+{
+ char *p, *r;
+ size_t count;
+ g_return_val_if_fail (filename != NULL, NULL);
+
+ p = strrchr_seperator (filename);
+ if (p == NULL)
+ return g_strdup (".");
+ if (p == filename)
+ return g_strdup ("/");
+ count = p - filename;
+ r = g_malloc (count + 1);
+ strncpy (r, filename, count);
+ r [count] = 0;
+
+ return r;
+}
+
+gchar *
+g_path_get_basename (const char *filename)
+{
+ char *r;
+ g_return_val_if_fail (filename != NULL, NULL);
+
+ /* Empty filename -> . */
+ if (!*filename)
+ return g_strdup (".");
+
+ /* No separator -> filename */
+ r = strrchr_seperator (filename);
+ if (r == NULL)
+ return g_strdup (filename);
+
+ /* Trailing slash, remove component */
+ if (r [1] == 0){
+ char *copy = g_strdup (filename);
+ copy [r-filename] = 0;
+ r = strrchr_seperator (copy);
+
+ if (r == NULL){
+ g_free (copy);
+ return g_strdup ("/");
+ }
+ r = g_strdup (&r[1]);
+ g_free (copy);
+ return r;
+ }
+
+ return g_strdup (&r[1]);
+}
+
+#ifndef HAVE_STRTOK_R
+// This is from BSD's strtok_r
+
+char *
+strtok_r(char *s, const char *delim, char **last)
+{
+ char *spanp;
+ int c, sc;
+ char *tok;
+
+ if (s == NULL && (s = *last) == NULL)
+ return NULL;
+
+ /*
+ * Skip (span) leading delimiters (s += strspn(s, delim), sort of).
+ */
+cont:
+ c = *s++;
+ for (spanp = (char *)delim; (sc = *spanp++) != 0; ){
+ if (c == sc)
+ goto cont;
+ }
+
+ if (c == 0){ /* no non-delimiter characters */
+ *last = NULL;
+ return NULL;
+ }
+ tok = s - 1;
+
+ /*
+ * Scan token (scan for delimiters: s += strcspn(s, delim), sort of).
+ * Note that delim must have one NUL; we stop if we see that, too.
+ */
+ for (;;){
+ c = *s++;
+ spanp = (char *)delim;
+ do {
+ if ((sc = *spanp++) == c) {
+ if (c == 0)
+ s = NULL;
+ else {
+ char *w = s - 1;
+ *w = '\0';
+ }
+ *last = s;
+ return tok;
+ }
+ }
+ while (sc != 0);
+ }
+ /* NOTREACHED */
+}
+#endif
+
+gchar *
+g_find_program_in_path (const gchar *program)
+{
+ char *p;
+ char *x, *l;
+ gchar *curdir = NULL;
+ char *save = NULL;
+#ifdef G_OS_WIN32
+ char *program_exe;
+ char *suffix_list[5] = {".exe",".cmd",".bat",".com",NULL};
+ int listx;
+ gboolean hasSuffix;
+#endif
+
+ g_return_val_if_fail (program != NULL, NULL);
+ x = p = g_strdup (g_getenv ("PATH"));
+
+ if (x == NULL || *x == '\0') {
+ curdir = g_get_current_dir ();
+ x = curdir;
+ }
+
+#ifdef G_OS_WIN32
+ /* see if program already has a suffix */
+ listx = 0;
+ hasSuffix = FALSE;
+ while (!hasSuffix && suffix_list[listx]) {
+ hasSuffix = g_str_has_suffix(program,suffix_list[listx++]);
+ }
+#endif
+
+ while ((l = strtok_r (x, G_SEARCHPATH_SEPARATOR_S, &save)) != NULL){
+ char *probe_path;
+
+ x = NULL;
+ probe_path = g_build_path (G_DIR_SEPARATOR_S, l, program, NULL);
+ if (access (probe_path, X_OK) == 0){ /* FIXME: on windows this is just a read permissions test */
+ g_free (curdir);
+ g_free (p);
+ return probe_path;
+ }
+ g_free (probe_path);
+
+#ifdef G_OS_WIN32
+ /* check for program with a suffix attached */
+ if (!hasSuffix) {
+ listx = 0;
+ while (suffix_list[listx]) {
+ program_exe = g_strjoin(NULL,program,suffix_list[listx],NULL);
+ probe_path = g_build_path (G_DIR_SEPARATOR_S, l, program_exe, NULL);
+ if (access (probe_path, X_OK) == 0){ /* FIXME: on windows this is just a read permissions test */
+ g_free (curdir);
+ g_free (p);
+ g_free (program_exe);
+ return probe_path;
+ }
+ listx++;
+ g_free (probe_path);
+ g_free (program_exe);
+ }
+ }
+#endif
+ }
+ g_free (curdir);
+ g_free (p);
+ return NULL;
+}
+
+static char *name;
+
+void
+g_set_prgname (const gchar *prgname)
+{
+ name = g_strdup (prgname);
+}
+
+gchar *
+g_get_prgname (void)
+{
+ return name;
+}
+
+gboolean
+g_ensure_directory_exists (const gchar *filename)
+{
+#ifdef G_OS_WIN32
+ gchar *dir_utf8 = g_path_get_dirname (filename);
+ gunichar2 *p;
+ gunichar2 *dir_utf16 = NULL;
+ int retval;
+
+ if (!dir_utf8 || !dir_utf8 [0])
+ return FALSE;
+
+ dir_utf16 = g_utf8_to_utf16 (dir_utf8, strlen (dir_utf8), NULL, NULL, NULL);
+ g_free (dir_utf8);
+
+ if (!dir_utf16)
+ return FALSE;
+
+ p = dir_utf16;
+
+ /* make life easy and only use one directory seperator */
+ while (*p != '\0')
+ {
+ if (*p == '/')
+ *p = '\\';
+ p++;
+ }
+
+ p = dir_utf16;
+
+ /* get past C:\ )*/
+ while (*p++ != '\\')
+ {
+ }
+
+ while (1) {
+ gboolean bRet = FALSE;
+ p = wcschr (p, '\\');
+ if (p)
+ *p = '\0';
+ retval = _wmkdir (dir_utf16);
+ if (retval != 0 && errno != EEXIST) {
+ g_free (dir_utf16);
+ return FALSE;
+ }
+ if (!p)
+ break;
+ *p++ = '\\';
+ }
+
+ g_free (dir_utf16);
+ return TRUE;
+#else
+ char *p;
+ gchar *dir = g_path_get_dirname (filename);
+ int retval;
+ struct stat sbuf;
+
+ if (!dir || !dir [0]) {
+ g_free (dir);
+ return FALSE;
+ }
+
+ if (stat (dir, &sbuf) == 0 && S_ISDIR (sbuf.st_mode)) {
+ g_free (dir);
+ return TRUE;
+ }
+
+ p = dir;
+ while (*p == '/')
+ p++;
+
+ while (1) {
+ p = strchr (p, '/');
+ if (p)
+ *p = '\0';
+ retval = mkdir (dir, 0777);
+ if (retval != 0 && errno != EEXIST) {
+ g_free (dir);
+ return FALSE;
+ }
+ if (!p)
+ break;
+ *p++ = '/';
+ }
+
+ g_free (dir);
+ return TRUE;
+#endif
+}
+
--- /dev/null
+/*
+ * Simple pattern matching
+ *
+ * Author:
+ * Gonzalo Paniagua Javier (gonzalo@novell.com
+ *
+ * (C) 2006 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.
+ */
+#include <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#ifndef _MSC_VER
+#include <unistd.h>
+#endif
+
+typedef enum {
+ MATCH_LITERAL,
+ MATCH_ANYCHAR,
+ MATCH_ANYTHING,
+ MATCH_ANYTHING_END,
+ MATCH_INVALID = -1
+} MatchType;
+
+typedef struct {
+ MatchType type;
+ gchar *str;
+} PData;
+
+struct _GPatternSpec {
+ GSList *pattern;
+};
+
+static GSList *
+compile_pattern (const gchar *pattern)
+{
+ GSList *list;
+ size_t i, len;
+ PData *data;
+ gchar c;
+ MatchType last = MATCH_INVALID;
+ GString *str;
+ gboolean free_str;
+
+ if (pattern == NULL)
+ return NULL;
+
+ data = NULL;
+ list = NULL;
+ free_str = TRUE;
+ str = g_string_new ("");
+ for (i = 0, len = strlen (pattern); i < len; i++) {
+ c = pattern [i];
+ if (c == '*' || c == '?') {
+ if (str->len > 0) {
+ data = g_new0 (PData, 1);
+ data->type = MATCH_LITERAL;
+ data->str = g_string_free (str, FALSE);
+ list = g_slist_append (list, data);
+ str = g_string_new ("");
+ }
+
+ if (last == MATCH_ANYTHING && c == '*')
+ continue;
+
+ data = g_new0 (PData, 1);
+ data->type = (c == '*') ? MATCH_ANYTHING : MATCH_ANYCHAR;
+ list = g_slist_append (list, data);
+ last = data->type;
+ } else {
+ g_string_append_c (str, c);
+ last = MATCH_LITERAL;
+ }
+ }
+
+ if (last == MATCH_ANYTHING && str->len == 0) {
+ data->type = MATCH_ANYTHING_END;
+ free_str = TRUE;
+ } else if (str->len > 0) {
+ data = g_new0 (PData, 1);
+ data->type = MATCH_LITERAL;
+ data->str = str->str;
+ free_str = FALSE;
+ list = g_slist_append (list, data);
+ }
+ g_string_free (str, free_str);
+ return list;
+}
+
+#ifdef DEBUG_PATTERN
+static void
+print_pattern (gpointer data, gpointer user_data)
+{
+ PData *d = (PData *) data;
+
+ printf ("Type: %s", d->type == MATCH_LITERAL ? "literal" : d->type == MATCH_ANYCHAR ? "any char" : "anything");
+ if (d->type == MATCH_LITERAL)
+ printf (" String: %s", d->str);
+ printf ("\n");
+}
+#endif
+
+GPatternSpec *
+g_pattern_spec_new (const gchar *pattern)
+{
+ GPatternSpec *spec;
+
+ g_return_val_if_fail (pattern != NULL, NULL);
+ spec = g_new0 (GPatternSpec, 1);
+ if (pattern) {
+ spec->pattern = compile_pattern (pattern);
+#ifdef DEBUG_PATTERN
+ g_slist_foreach (spec->pattern, print_pattern, NULL);
+ printf ("\n");
+#endif
+ }
+ return spec;
+}
+
+static void
+free_pdata (gpointer data, gpointer user_data)
+{
+ PData *d = (PData *) data;
+
+ if (d->str)
+ g_free (d->str);
+ g_free (d);
+}
+
+void
+g_pattern_spec_free (GPatternSpec *pspec)
+{
+ if (pspec) {
+ g_slist_foreach (pspec->pattern, free_pdata, NULL);
+ g_slist_free (pspec->pattern);
+ pspec->pattern = NULL;
+ }
+ g_free (pspec);
+}
+
+static gboolean
+match_string (GSList *list, const gchar *str, size_t idx, size_t max)
+{
+ size_t len;
+
+ while (list && idx < max) {
+ PData *data = (PData *) list->data;
+
+ if (data->type == MATCH_ANYTHING_END)
+ return TRUE;
+
+ if (data->type == MATCH_LITERAL) {
+ len = strlen (data->str);
+ if (strncmp (&str [idx], data->str, len) != 0)
+ return FALSE;
+ idx += len;
+ list = list->next;
+ if (list) {
+ /*
+ * When recursing, we need this to avoid returning FALSE
+ * because 'list' will not be NULL
+ */
+ data = (PData *) list->data;
+ if (data->type == MATCH_ANYTHING_END)
+ return TRUE;
+ }
+ } else if (data->type == MATCH_ANYCHAR) {
+ idx++;
+ list = list->next;
+ } else if (data->type == MATCH_ANYTHING) {
+ while (idx < max) {
+ if (match_string (list->next, str, idx++, max))
+ return TRUE;
+ }
+ return FALSE;
+ } else {
+ g_assert_not_reached ();
+ }
+ }
+
+ return (list == NULL && idx >= max);
+}
+gboolean
+g_pattern_match_string (GPatternSpec *pspec, const gchar *string)
+{
+ g_return_val_if_fail (pspec != NULL, FALSE);
+ g_return_val_if_fail (string != NULL, FALSE);
+
+ if (pspec->pattern == NULL)
+ return FALSE;
+ return match_string (pspec->pattern, string, 0, strlen (string));
+}
+
+
--- /dev/null
+/*
+ * Pointer Array
+ *
+ * Author:
+ * Aaron Bockover (abockover@novell.com)
+ * Gonzalo Paniagua Javier (gonzalo@novell.com)
+ * Jeffrey Stedfast (fejj@novell.com)
+ *
+ * (C) 2006,2011 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.
+ */
+
+#include <stdlib.h>
+#include <glib.h>
+
+typedef struct _GPtrArrayPriv {
+ gpointer *pdata;
+ guint len;
+ guint size;
+} GPtrArrayPriv;
+
+static void
+g_ptr_array_grow(GPtrArrayPriv *array, guint length)
+{
+ guint new_length = array->len + length;
+
+ g_return_if_fail(array != NULL);
+
+ if(new_length <= array->size) {
+ return;
+ }
+
+ array->size = 1;
+
+ while(array->size < new_length) {
+ array->size <<= 1;
+ }
+
+ array->size = MAX(array->size, 16);
+ array->pdata = g_realloc(array->pdata, array->size * sizeof(gpointer));
+}
+
+GPtrArray *
+g_ptr_array_new(void)
+{
+ return g_ptr_array_sized_new(0);
+}
+
+GPtrArray *
+g_ptr_array_sized_new(guint reserved_size)
+{
+ GPtrArrayPriv *array = g_new0(GPtrArrayPriv, 1);
+
+ array->pdata = NULL;
+ array->len = 0;
+ array->size = 0;
+
+ if(reserved_size > 0) {
+ g_ptr_array_grow(array, reserved_size);
+ }
+
+ return (GPtrArray *)array;
+}
+
+gpointer *
+g_ptr_array_free(GPtrArray *array, gboolean free_seg)
+{
+ gpointer *data = NULL;
+
+ g_return_val_if_fail(array != NULL, NULL);
+
+ if(free_seg) {
+ g_free(array->pdata);
+ } else {
+ data = array->pdata;
+ }
+
+ g_free(array);
+
+ return data;
+}
+
+void
+g_ptr_array_set_size(GPtrArray *array, gint length)
+{
+ g_return_if_fail(array != NULL);
+
+ if((size_t)length > array->len) {
+ g_ptr_array_grow((GPtrArrayPriv *)array, length);
+ memset(array->pdata + array->len, 0, (length - array->len)
+ * sizeof(gpointer));
+ }
+
+ array->len = length;
+}
+
+void
+g_ptr_array_add(GPtrArray *array, gpointer data)
+{
+ g_return_if_fail(array != NULL);
+ g_ptr_array_grow((GPtrArrayPriv *)array, 1);
+ array->pdata[array->len++] = data;
+}
+
+gpointer
+g_ptr_array_remove_index(GPtrArray *array, guint index)
+{
+ gpointer removed_node;
+
+ g_return_val_if_fail(array != NULL, NULL);
+ g_return_val_if_fail(index < array->len, NULL);
+
+ removed_node = array->pdata[index];
+
+ if(index != array->len - 1) {
+ g_memmove(array->pdata + index, array->pdata + index + 1,
+ (array->len - index - 1) * sizeof(gpointer));
+ }
+
+ array->len--;
+ array->pdata[array->len] = NULL;
+
+ return removed_node;
+}
+
+gpointer
+g_ptr_array_remove_index_fast(GPtrArray *array, guint index)
+{
+ gpointer removed_node;
+
+ g_return_val_if_fail(array != NULL, NULL);
+ g_return_val_if_fail(index < array->len, NULL);
+
+ removed_node = array->pdata[index];
+
+ if(index != array->len - 1) {
+ g_memmove(array->pdata + index, array->pdata + array->len - 1,
+ sizeof(gpointer));
+ }
+
+ array->len--;
+ array->pdata[array->len] = NULL;
+
+ return removed_node;
+}
+
+gboolean
+g_ptr_array_remove(GPtrArray *array, gpointer data)
+{
+ guint i;
+
+ g_return_val_if_fail(array != NULL, FALSE);
+
+ for(i = 0; i < array->len; i++) {
+ if(array->pdata[i] == data) {
+ g_ptr_array_remove_index(array, i);
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+gboolean
+g_ptr_array_remove_fast(GPtrArray *array, gpointer data)
+{
+ guint i;
+
+ g_return_val_if_fail(array != NULL, FALSE);
+
+ for(i = 0; i < array->len; i++) {
+ if(array->pdata[i] == data) {
+ array->len--;
+ if (array->len > 0)
+ array->pdata [i] = array->pdata [array->len];
+ else
+ array->pdata [i] = NULL;
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+void
+g_ptr_array_foreach(GPtrArray *array, GFunc func, gpointer user_data)
+{
+ guint i;
+
+ for(i = 0; i < array->len; i++) {
+ func(g_ptr_array_index(array, i), user_data);
+ }
+}
+
+void
+g_ptr_array_sort(GPtrArray *array, GCompareFunc compare)
+{
+ g_return_if_fail(array != NULL);
+ qsort(array->pdata, array->len, sizeof(gpointer), compare);
+}
+
+void
+g_ptr_array_sort_with_data (GPtrArray *array, GCompareDataFunc compare, gpointer user_data)
+{
+ g_return_if_fail (array != NULL);
+
+ g_qsort_with_data (array->pdata, array->len, sizeof (gpointer), compare, user_data);
+}
+
--- /dev/null
+/*
+ * QuickSort
+ *
+ * Author: Jeffrey Stedfast <fejj@novell.com>
+ *
+ * (C) 2011 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.
+ */
+
+#include <stdlib.h>
+#include <glib.h>
+
+/* Any segment <= this threshold will be sorted using insertion
+ * sort. OpenBSD seems to use a value of 7 so we'll go with that for
+ * now... */
+#define MAX_THRESHOLD 7
+
+#define STACK_SIZE (8 * sizeof (size_t))
+
+typedef struct _QSortStack {
+ char *array;
+ size_t count;
+} QSortStack;
+
+#define QSORT_PUSH(sp, a, c) (sp->array = a, sp->count = c, sp++)
+#define QSORT_POP(sp, a, c) (sp--, a = sp->array, c = sp->count)
+
+#define SWAPTYPE(TYPE, a, b) { \
+ long __n = size / sizeof (TYPE); \
+ register TYPE *__a = (TYPE *) (a); \
+ register TYPE *__b = (TYPE *) (b); \
+ register TYPE t; \
+ \
+ do { \
+ t = *__a; \
+ *__a++ = *__b; \
+ *__b++ = t; \
+ } while (--__n > 0); \
+}
+
+#define SWAPBYTE(a, b) SWAPTYPE(char, (a), (b))
+#define SWAPLONG(a, b) SWAPTYPE(long, (a), (b))
+#define SWAP(a, b) if (swaplong) SWAPLONG((a), (b)) else SWAPBYTE((a), (b))
+
+/* check if we can swap by longs rather than bytes by making sure that
+ * memory is properly aligned and that the element size is a multiple
+ * of sizeof (long) */
+#define SWAP_INIT() swaplong = (((char *) base) - ((char *) 0)) % sizeof (long) == 0 && (size % sizeof (long)) == 0
+
+void
+g_qsort_with_data (gpointer base, size_t nmemb, size_t size, GCompareDataFunc compare, gpointer user_data)
+{
+ QSortStack stack[STACK_SIZE], *sp;
+ register char *i, *k, *mid;
+ size_t n, n1, n2;
+ char *lo, *hi;
+ int swaplong;
+
+ if (nmemb <= 1)
+ return;
+
+ SWAP_INIT ();
+
+ /* initialize our stack */
+ sp = stack;
+ QSORT_PUSH (sp, base, nmemb);
+
+ do {
+ QSORT_POP (sp, lo, n);
+
+ hi = lo + (n - 1) * size;
+
+ if (n < MAX_THRESHOLD) {
+ /* switch to insertion sort */
+ for (i = lo + size; i <= hi; i += size)
+ for (k = i; k > lo && compare (k - size, k, user_data) > 0; k -= size)
+ SWAP (k - size, k);
+
+ continue;
+ }
+
+ /* calculate the middle element */
+ mid = lo + (n / 2) * size;
+
+ /* once we re-order the lo, mid, and hi elements to be in
+ * ascending order, we'll use mid as our pivot. */
+ if (compare (mid, lo, user_data) < 0) {
+ SWAP (mid, lo);
+ }
+
+ if (compare (hi, mid, user_data) < 0) {
+ SWAP (mid, hi);
+ if (compare (mid, lo, user_data) < 0) {
+ SWAP (mid, lo);
+ }
+ }
+
+ /* since we've already guaranteed that lo <= mid and mid <= hi,
+ * we can skip comparing them again */
+ i = lo + size;
+ k = hi - size;
+
+ do {
+ /* find the first element with a value > pivot value */
+ while (i < k && compare (i, mid, user_data) <= 0)
+ i += size;
+
+ /* find the last element with a value <= pivot value */
+ while (k >= i && compare (mid, k, user_data) < 0)
+ k -= size;
+
+ if (k <= i)
+ break;
+
+ SWAP (i, k);
+
+ /* make sure we keep track of our pivot element */
+ if (mid == i) {
+ mid = k;
+ } else if (mid == k) {
+ mid = i;
+ }
+
+ i += size;
+ k -= size;
+ } while (1);
+
+ if (k != mid) {
+ /* swap the pivot with the last element in the first partition */
+ SWAP (mid, k);
+ }
+
+ /* calculate segment sizes */
+ n2 = (hi - k) / size;
+ n1 = (k - lo) / size;
+
+ /* push our partitions onto the stack, largest first
+ * (to make sure we don't run out of stack space) */
+ if (n2 > n1) {
+ if (n2 > 1) QSORT_PUSH (sp, k + size, n2);
+ if (n1 > 1) QSORT_PUSH (sp, lo, n1);
+ } else {
+ if (n1 > 1) QSORT_PUSH (sp, lo, n1);
+ if (n2 > 1) QSORT_PUSH (sp, k + size, n2);
+ }
+ } while (sp > stack);
+}
--- /dev/null
+/*
+ * gqueue.c: Queue
+ *
+ * Author:
+ * Duncan Mak (duncan@novell.com)
+ * Gonzalo Paniagua Javier (gonzalo@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.
+ *
+ * Copyright (c) 2006-2009 Novell, Inc.
+ *
+ */
+
+#include <stdio.h>
+#include <glib.h>
+
+gpointer
+g_queue_pop_head (GQueue *queue)
+{
+ gpointer result;
+ GList *old_head;
+
+ if (!queue || queue->length == 0)
+ return NULL;
+
+ result = queue->head->data;
+ old_head = queue->head;
+ queue->head = old_head->next;
+ g_list_free_1 (old_head);
+
+ if (--queue->length)
+ queue->head->prev = NULL;
+ else
+ queue->tail = NULL;
+
+ return result;
+}
+
+gboolean
+g_queue_is_empty (GQueue *queue)
+{
+ if (!queue)
+ return TRUE;
+
+ return queue->length == 0;
+}
+
+void
+g_queue_push_head (GQueue *queue, gpointer head)
+{
+ if (!queue)
+ return;
+
+ queue->head = g_list_prepend (queue->head, head);
+
+ if (!queue->tail)
+ queue->tail = queue->head;
+
+ queue->length ++;
+}
+
+void
+g_queue_push_tail (GQueue *queue, gpointer data)
+{
+ if (!queue)
+ return;
+
+ queue->tail = g_list_append (queue->tail, data);
+ if (queue->head == NULL)
+ queue->head = queue->tail;
+ else
+ queue->tail = queue->tail->next;
+ queue->length++;
+}
+
+GQueue *
+g_queue_new (void)
+{
+ return g_new0 (GQueue, 1);
+}
+
+void
+g_queue_free (GQueue *queue)
+{
+ if (!queue)
+ return;
+
+ g_list_free (queue->head);
+ g_free (queue);
+}
+
+void
+g_queue_foreach (GQueue *queue, GFunc func, gpointer user_data)
+{
+ g_list_foreach (queue->head, func, user_data);
+}
--- /dev/null
+/*
+ * Shell utility functions.
+ *
+ * Author:
+ * Gonzalo Paniagua Javier (gonzalo@novell.com
+ *
+ * (C) 2006 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.
+ */
+#include <stdio.h>
+#include <glib.h>
+
+static int
+split_cmdline (const gchar *cmdline, GPtrArray *array, GError **error)
+{
+ gchar *ptr;
+ gchar c;
+ gboolean escaped = FALSE, fresh = TRUE;
+ gchar quote_char = '\0';
+ GString *str;
+
+ str = g_string_new ("");
+ ptr = (gchar *) cmdline;
+ while ((c = *ptr++) != '\0') {
+ if (escaped) {
+ /*
+ * \CHAR is only special inside a double quote if CHAR is
+ * one of: $`"\ and newline
+ */
+ if (quote_char == '\"'){
+ if (!(c == '$' || c == '`' || c == '"' || c == '\\'))
+ g_string_append_c (str, '\\');
+ g_string_append_c (str, c);
+ } else {
+ if (!g_ascii_isspace (c))
+ g_string_append_c (str, c);
+ }
+ escaped = FALSE;
+ } else if (quote_char) {
+ if (c == quote_char) {
+ quote_char = '\0';
+ if (fresh && (g_ascii_isspace (*ptr) || *ptr == '\0')){
+ g_ptr_array_add (array, g_string_free (str, FALSE));
+ str = g_string_new ("");
+ }
+ } else if (c == '\\'){
+ escaped = TRUE;
+ } else
+ g_string_append_c (str, c);
+ } else if (g_ascii_isspace (c)) {
+ if (str->len > 0) {
+ g_ptr_array_add (array, g_string_free (str, FALSE));
+ str = g_string_new ("");
+ }
+ } else if (c == '\\') {
+ escaped = TRUE;
+ } else if (c == '\'' || c == '"') {
+ fresh = str->len == 0;
+ quote_char = c;
+ } else {
+ g_string_append_c (str, c);
+ }
+ }
+
+ if (escaped) {
+ if (error)
+ *error = g_error_new (G_LOG_DOMAIN, 0, "Unfinished escape.");
+ g_string_free (str, TRUE);
+ return -1;
+ }
+
+ if (quote_char) {
+ if (error)
+ *error = g_error_new (G_LOG_DOMAIN, 0, "Unfinished quote.");
+ g_string_free (str, TRUE);
+ return -1;
+ }
+
+ if (str->len > 0) {
+ g_ptr_array_add (array, g_string_free (str, FALSE));
+ } else {
+ g_string_free (str, TRUE);
+ }
+ g_ptr_array_add (array, NULL);
+ return 0;
+}
+
+gboolean
+g_shell_parse_argv (const gchar *command_line, gint *argcp, gchar ***argvp, GError **error)
+{
+ GPtrArray *array;
+ gint argc;
+ gchar **argv;
+
+ g_return_val_if_fail (command_line, FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ array = g_ptr_array_new();
+ if (split_cmdline (command_line, array, error)) {
+ g_ptr_array_add (array, NULL);
+ g_strfreev ((gchar **) array->pdata);
+ g_ptr_array_free (array, FALSE);
+ return FALSE;
+ }
+
+ argc = array->len;
+ argv = (gchar **) array->pdata;
+
+ if (argc == 1) {
+ g_strfreev (argv);
+ g_ptr_array_free (array, FALSE);
+ return FALSE;
+ }
+
+ if (argcp) {
+ *argcp = array->len - 1;
+ }
+
+ if (argvp) {
+ *argvp = argv;
+ } else {
+ g_strfreev (argv);
+ }
+
+ g_ptr_array_free (array, FALSE);
+ return TRUE;
+}
+
+gchar *
+g_shell_quote (const gchar *unquoted_string)
+{
+ GString *result = g_string_new ("'");
+ const gchar *p;
+
+ for (p = unquoted_string; *p; p++){
+ if (*p == '\'')
+ g_string_append (result, "'\\'");
+ g_string_append_c (result, *p);
+ }
+ g_string_append_c (result, '\'');
+ return g_string_free (result, FALSE);
+}
+
+gchar *
+g_shell_unquote (const gchar *quoted_string, GError **error)
+{
+ GString *result;
+ const char *p;
+ int do_unquote = 0;
+
+ if (quoted_string == NULL)
+ return NULL;
+
+ /* Quickly try to determine if we need to unquote or not */
+ for (p = quoted_string; *p; p++){
+ if (*p == '\'' || *p == '"' || *p == '\\'){
+ do_unquote = 1;
+ break;
+ }
+ }
+
+ if (!do_unquote)
+ return g_strdup (quoted_string);
+
+ /* We do need to unquote */
+ result = g_string_new ("");
+ for (p = quoted_string; *p; p++){
+
+ if (*p == '\''){
+ /* Process single quote, not even \ is processed by glib's version */
+ for (p++; *p; p++){
+ if (*p == '\'')
+ break;
+ g_string_append_c (result, *p);
+ }
+ if (!*p){
+ g_set_error (error, 0, 0, "Open quote");
+ return NULL;
+ }
+ } else if (*p == '"'){
+ /* Process double quote, allows some escaping */
+ for (p++; *p; p++){
+ if (*p == '"')
+ break;
+ if (*p == '\\'){
+ p++;
+ if (*p == 0){
+ g_set_error (error, 0, 0, "Open quote");
+ return NULL;
+ }
+ switch (*p){
+ case '$':
+ case '"':
+ case '\\':
+ case '`':
+ break;
+ default:
+ g_string_append_c (result, '\\');
+ break;
+ }
+ }
+ g_string_append_c (result, *p);
+ }
+ if (!*p){
+ g_set_error (error, 0, 0, "Open quote");
+ return NULL;
+ }
+ } else if (*p == '\\'){
+ char c = *(++p);
+ if (!(c == '$' || c == '"' || c == '\\' || c == '`' || c == '\'' || c == 0 ))
+ g_string_append_c (result, '\\');
+ if (c == 0)
+ break;
+ else
+ g_string_append_c (result, c);
+ } else
+ g_string_append_c (result, *p);
+ }
+ return g_string_free (result, FALSE);
+}
+
+#if JOINT_TEST
+/*
+ * This test is designed to be built with the 2 glib/eglib to compare
+ */
+
+char *args [] = {
+ "\\",
+ "\"Foo'bar\"",
+ "'foo'",
+ "'fo\'b'",
+ "'foo\"bar'",
+ "'foo' dingus bar",
+ "'foo' 'bar' 'baz'",
+ "\"foo\" 'bar' \"baz\"",
+ "\"f\\$\\\'",
+ "\"\\",
+ "\\\\",
+ "'\\\\'",
+ "\"f\\$\"\\\"\\\\", // /\\\"\\\\"
+ "'f\\$'\\\"\\\\",
+ "'f\\$\\\\'",
+ NULL
+};
+
+
+int
+main ()
+{
+ char **s = args;
+ int i;
+
+ while (*s){
+ char *r1 = g_shell_unquote (*s, NULL);
+ char *r2 = g2_shell_unquote (*s, NULL);
+ char *ok = r1 == r2 ? "ok" : (r1 != NULL && r2 != NULL && strcmp (r1, r2) == 0) ? "ok" : "fail";
+
+ printf ("%s [%s] -> [%s] - [%s]\n", ok, *s, r1, r2);
+ s++;
+ }
+ return;
+ char buffer [10];
+ buffer [0] = '\"';
+ buffer [1] = '\\';
+ buffer [3] = '\"';
+ buffer [4] = 0;
+
+ for (i = 32; i < 255; i++){
+ buffer [2] = i;
+ printf ("%d [%s] -> [%s]\n", i, buffer, g_shell_unquote (buffer, NULL));
+ }
+}
+#endif
--- /dev/null
+/*
+ * gslist.c: Singly-linked list implementation
+ *
+ * Authors:
+ * Duncan Mak (duncan@novell.com)
+ * Raja R Harinath (rharinath@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.
+ *
+ * (C) 2006 Novell, Inc.
+ */
+
+#include <stdio.h>
+#include <glib.h>
+
+GSList*
+g_slist_alloc (void)
+{
+ return g_new0 (GSList, 1);
+}
+
+void
+g_slist_free_1 (GSList *list)
+{
+ g_free (list);
+}
+
+GSList*
+g_slist_append (GSList *list, gpointer data)
+{
+ return g_slist_concat (list, g_slist_prepend (NULL, data));
+}
+
+/* This is also a list node constructor. */
+GSList*
+g_slist_prepend (GSList *list, gpointer data)
+{
+ GSList *head = g_slist_alloc ();
+ head->data = data;
+ head->next = list;
+
+ return head;
+}
+
+/*
+ * Insert the given data in a new node after the current node.
+ * Return new node.
+ */
+static inline GSList *
+insert_after (GSList *list, gpointer data)
+{
+ list->next = g_slist_prepend (list->next, data);
+ return list->next;
+}
+
+/*
+ * Return the node prior to the node containing 'data'.
+ * If the list is empty, or the first node contains 'data', return NULL.
+ * If no node contains 'data', return the last node.
+ */
+static inline GSList*
+find_prev (GSList *list, gconstpointer data)
+{
+ GSList *prev = NULL;
+ while (list) {
+ if (list->data == data)
+ break;
+ prev = list;
+ list = list->next;
+ }
+ return prev;
+}
+
+/* like 'find_prev', but searches for node 'link' */
+static inline GSList*
+find_prev_link (GSList *list, GSList *link)
+{
+ GSList *prev = NULL;
+ while (list) {
+ if (list == link)
+ break;
+ prev = list;
+ list = list->next;
+ }
+ return prev;
+}
+
+GSList*
+g_slist_insert_before (GSList *list, GSList *sibling, gpointer data)
+{
+ GSList *prev = find_prev_link (list, sibling);
+
+ if (!prev)
+ return g_slist_prepend (list, data);
+
+ insert_after (prev, data);
+ return list;
+}
+
+void
+g_slist_free (GSList *list)
+{
+ while (list) {
+ GSList *next = list->next;
+ g_slist_free_1 (list);
+ list = next;
+ }
+}
+
+GSList*
+g_slist_copy (GSList *list)
+{
+ GSList *copy, *tmp;
+
+ if (!list)
+ return NULL;
+
+ copy = g_slist_prepend (NULL, list->data);
+ tmp = copy;
+
+ for (list = list->next; list; list = list->next)
+ tmp = insert_after (tmp, list->data);
+
+ return copy;
+}
+
+GSList*
+g_slist_concat (GSList *list1, GSList *list2)
+{
+ if (!list1)
+ return list2;
+
+ g_slist_last (list1)->next = list2;
+ return list1;
+}
+
+void
+g_slist_foreach (GSList *list, GFunc func, gpointer user_data)
+{
+ while (list) {
+ (*func) (list->data, user_data);
+ list = list->next;
+ }
+}
+
+GSList*
+g_slist_last (GSList *list)
+{
+ if (!list)
+ return NULL;
+
+ while (list->next)
+ list = list->next;
+
+ return list;
+}
+
+GSList*
+g_slist_find (GSList *list, gconstpointer data)
+{
+ for (; list; list = list->next)
+ if (list->data == data)
+ break;
+ return list;
+}
+
+GSList *
+g_slist_find_custom (GSList *list, gconstpointer data, GCompareFunc func)
+{
+ if (!func)
+ return NULL;
+
+ while (list) {
+ if (func (list->data, data) == 0)
+ return list;
+
+ list = list->next;
+ }
+
+ return NULL;
+}
+
+guint
+g_slist_length (GSList *list)
+{
+ guint length = 0;
+
+ while (list) {
+ length ++;
+ list = list->next;
+ }
+
+ return length;
+}
+
+GSList*
+g_slist_remove (GSList *list, gconstpointer data)
+{
+ GSList *prev = find_prev (list, data);
+ GSList *current = prev ? prev->next : list;
+
+ if (current) {
+ if (prev)
+ prev->next = current->next;
+ else
+ list = current->next;
+ g_slist_free_1 (current);
+ }
+
+ return list;
+}
+
+GSList*
+g_slist_remove_all (GSList *list, gconstpointer data)
+{
+ GSList *next = list;
+ GSList *prev = NULL;
+ GSList *current;
+
+ while (next) {
+ GSList *tmp_prev = find_prev (next, data);
+ if (tmp_prev)
+ prev = tmp_prev;
+ current = prev ? prev->next : list;
+
+ if (!current)
+ break;
+
+ next = current->next;
+
+ if (prev)
+ prev->next = next;
+ else
+ list = next;
+ g_slist_free_1 (current);
+ }
+
+ return list;
+}
+
+GSList*
+g_slist_remove_link (GSList *list, GSList *link)
+{
+ GSList *prev = find_prev_link (list, link);
+ GSList *current = prev ? prev->next : list;
+
+ if (current) {
+ if (prev)
+ prev->next = current->next;
+ else
+ list = current->next;
+ current->next = NULL;
+ }
+
+ return list;
+}
+
+GSList*
+g_slist_delete_link (GSList *list, GSList *link)
+{
+ list = g_slist_remove_link (list, link);
+ g_slist_free_1 (link);
+
+ return list;
+}
+
+GSList*
+g_slist_reverse (GSList *list)
+{
+ GSList *prev = NULL;
+ while (list){
+ GSList *next = list->next;
+ list->next = prev;
+ prev = list;
+ list = next;
+ }
+
+ return prev;
+}
+
+GSList*
+g_slist_insert_sorted (GSList *list, gpointer data, GCompareFunc func)
+{
+ GSList *prev = NULL;
+
+ if (!func)
+ return list;
+
+ if (!list || func (list->data, data) > 0)
+ return g_slist_prepend (list, data);
+
+ /* Invariant: func (prev->data, data) <= 0) */
+ for (prev = list; prev->next; prev = prev->next)
+ if (func (prev->next->data, data) > 0)
+ break;
+
+ /* ... && (prev->next == 0 || func (prev->next->data, data) > 0)) */
+ insert_after (prev, data);
+ return list;
+}
+
+gint
+g_slist_index (GSList *list, gconstpointer data)
+{
+ gint index = 0;
+
+ while (list) {
+ if (list->data == data)
+ return index;
+
+ index++;
+ list = list->next;
+ }
+
+ return -1;
+}
+
+GSList*
+g_slist_nth (GSList *list, guint n)
+{
+ for (; list; list = list->next) {
+ if (n == 0)
+ break;
+ n--;
+ }
+ return list;
+}
+
+gpointer
+g_slist_nth_data (GSList *list, guint n)
+{
+ GSList *node = g_slist_nth (list, n);
+ return node ? node->data : NULL;
+}
+
+typedef GSList list_node;
+#include "sort.frag.h"
+
+GSList*
+g_slist_sort (GSList *list, GCompareFunc func)
+{
+ if (!list || !list->next)
+ return list;
+ return do_sort (list, func);
+}
--- /dev/null
+/*
+ * Spawning processes.
+ *
+ * Author:
+ * Gonzalo Paniagua Javier (gonzalo@novell.com
+ *
+ * (C) 2006 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.
+ */
+#include <config.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/types.h>
+
+#include <glib.h>
+
+#ifdef HAVE_UNISTD_H
+#ifndef __USE_GNU
+#define __USE_GNU
+#endif
+#include <unistd.h>
+#endif
+
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+
+#ifdef HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#ifdef G_OS_WIN32
+#include <io.h>
+#include <winsock2.h>
+#define open _open
+#define close _close
+#define read _read
+#define write _write
+/* windows pipe api details: http://msdn2.microsoft.com/en-us/library/edze9h7e(VS.80).aspx */
+#define pipe(x) _pipe(x, 256, 0)
+#endif
+
+#define set_error(msg, ...) do { if (error != NULL) *error = g_error_new (G_LOG_DOMAIN, 1, msg, __VA_ARGS__); } while (0)
+#define set_error_cond(cond,msg, ...) do { if ((cond) && error != NULL) *error = g_error_new (G_LOG_DOMAIN, 1, msg, __VA_ARGS__); } while (0)
+#define set_error_status(status,msg, ...) do { if (error != NULL) *error = g_error_new (G_LOG_DOMAIN, status, msg, __VA_ARGS__); } while (0)
+#define NO_INTR(var,cmd) do { (var) = (cmd); } while ((var) == -1 && errno == EINTR)
+#define CLOSE_PIPE(p) do { close (p [0]); close (p [1]); } while (0)
+
+#if defined(__APPLE__)
+#if defined (TARGET_OSX)
+/* Apple defines this in crt_externs.h but doesn't provide that header for
+ * arm-apple-darwin9. We'll manually define the symbol on Apple as it does
+ * in fact exist on all implementations (so far)
+ */
+gchar ***_NSGetEnviron(void);
+#define environ (*_NSGetEnviron())
+#else
+static char *mono_environ[1] = { NULL };
+#define environ mono_environ
+#endif /* defined (TARGET_OSX) */
+#elif defined(_MSC_VER)
+/* MS defines this in stdlib.h */
+#else
+extern char **environ;
+#endif
+
+#ifndef G_OS_WIN32
+static int
+safe_read (int fd, gchar *buffer, gint count, GError **error)
+{
+ int res;
+
+ NO_INTR (res, read (fd, buffer, count));
+ set_error_cond (res == -1, "%s", "Error reading from pipe.");
+ return res;
+}
+
+static int
+read_pipes (int outfd, gchar **out_str, int errfd, gchar **err_str, GError **error)
+{
+ fd_set rfds;
+ int res;
+ gboolean out_closed;
+ gboolean err_closed;
+ GString *out = NULL;
+ GString *err = NULL;
+ gchar *buffer = NULL;
+ gint nread;
+
+ out_closed = (outfd < 0);
+ err_closed = (errfd < 0);
+ if (out_str) {
+ *out_str = NULL;
+ out = g_string_new ("");
+ }
+
+ if (err_str) {
+ *err_str = NULL;
+ err = g_string_new ("");
+ }
+
+ do {
+ if (out_closed && err_closed)
+ break;
+
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4389)
+#endif
+
+ FD_ZERO (&rfds);
+ if (!out_closed && outfd >= 0)
+ FD_SET (outfd, &rfds);
+ if (!err_closed && errfd >= 0)
+ FD_SET (errfd, &rfds);
+
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
+ res = select (MAX (outfd, errfd) + 1, &rfds, NULL, NULL, NULL);
+ if (res > 0) {
+ if (buffer == NULL)
+ buffer = g_malloc (1024);
+ if (!out_closed && FD_ISSET (outfd, &rfds)) {
+ nread = safe_read (outfd, buffer, 1024, error);
+ if (nread < 0) {
+ close (errfd);
+ close (outfd);
+ return -1;
+ }
+ g_string_append_len (out, buffer, nread);
+ if (nread <= 0) {
+ out_closed = TRUE;
+ close (outfd);
+ }
+ }
+
+ if (!err_closed && FD_ISSET (errfd, &rfds)) {
+ nread = safe_read (errfd, buffer, 1024, error);
+ if (nread < 0) {
+ close (errfd);
+ close (outfd);
+ return -1;
+ }
+ g_string_append_len (err, buffer, nread);
+ if (nread <= 0) {
+ err_closed = TRUE;
+ close (errfd);
+ }
+ }
+ }
+ } while (res > 0 || (res == -1 && errno == EINTR));
+
+ g_free (buffer);
+ if (out_str)
+ *out_str = g_string_free (out, FALSE);
+
+ if (err_str)
+ *err_str = g_string_free (err, FALSE);
+
+ return 0;
+}
+
+static gboolean
+create_pipe (int *fds, GError **error)
+{
+ if (pipe (fds) == -1) {
+ set_error ("%s", "Error creating pipe.");
+ return FALSE;
+ }
+ return TRUE;
+}
+#endif /* G_OS_WIN32 */
+
+static int
+write_all (int fd, const void *vbuf, size_t n)
+{
+ const char *buf = (const char *) vbuf;
+ size_t nwritten = 0;
+ int w;
+
+ do {
+ do {
+ w = write (fd, buf + nwritten, n - nwritten);
+ } while (w == -1 && errno == EINTR);
+
+ if (w == -1)
+ return -1;
+
+ nwritten += w;
+ } while (nwritten < n);
+
+ return nwritten;
+}
+
+#ifndef G_OS_WIN32
+int
+eg_getdtablesize (void)
+{
+#ifdef HAVE_GETRLIMIT
+ struct rlimit limit;
+ int res;
+
+ res = getrlimit (RLIMIT_NOFILE, &limit);
+ g_assert (res == 0);
+ return limit.rlim_cur;
+#else
+ return getdtablesize ();
+#endif
+}
+#else
+int
+eg_getdtablesize (void)
+{
+ g_error ("Should not be called");
+}
+#endif
+
+gboolean
+g_spawn_command_line_sync (const gchar *command_line,
+ gchar **standard_output,
+ gchar **standard_error,
+ gint *exit_status,
+ GError **error)
+{
+#ifdef G_OS_WIN32
+#elif !defined (HAVE_FORK) || !defined (HAVE_EXECV)
+ fprintf (stderr, "g_spawn_command_line_sync not supported on this platform\n");
+ return FALSE;
+#else
+ pid_t pid;
+ gchar **argv;
+ gint argc;
+ int stdout_pipe [2] = { -1, -1 };
+ int stderr_pipe [2] = { -1, -1 };
+ int status;
+ int res;
+
+ if (!g_shell_parse_argv (command_line, &argc, &argv, error))
+ return FALSE;
+
+ if (standard_output && !create_pipe (stdout_pipe, error))
+ return FALSE;
+
+ if (standard_error && !create_pipe (stderr_pipe, error)) {
+ if (standard_output) {
+ CLOSE_PIPE (stdout_pipe);
+ }
+ return FALSE;
+ }
+
+ pid = fork ();
+ if (pid == 0) {
+ gint i;
+
+ if (standard_output) {
+ close (stdout_pipe [0]);
+ dup2 (stdout_pipe [1], STDOUT_FILENO);
+ }
+
+ if (standard_error) {
+ close (stderr_pipe [0]);
+ dup2 (stderr_pipe [1], STDERR_FILENO);
+ }
+ for (i = eg_getdtablesize () - 1; i >= 3; i--)
+ close (i);
+
+ /* G_SPAWN_SEARCH_PATH is always enabled for g_spawn_command_line_sync */
+ if (!g_path_is_absolute (argv [0])) {
+ gchar *arg0;
+
+ arg0 = g_find_program_in_path (argv [0]);
+ if (arg0 == NULL) {
+ exit (1);
+ }
+ //g_free (argv [0]);
+ argv [0] = arg0;
+ }
+ execv (argv [0], argv);
+ exit (1); /* TODO: What now? */
+ }
+
+ g_strfreev (argv);
+ if (standard_output)
+ close (stdout_pipe [1]);
+
+ if (standard_error)
+ close (stderr_pipe [1]);
+
+ if (standard_output || standard_error) {
+ res = read_pipes (stdout_pipe [0], standard_output, stderr_pipe [0], standard_error, error);
+ if (res) {
+ waitpid (pid, &status, WNOHANG); /* avoid zombie */
+ return FALSE;
+ }
+ }
+
+ NO_INTR (res, waitpid (pid, &status, 0));
+
+ /* TODO: What if error? */
+ if (WIFEXITED (status) && exit_status) {
+ *exit_status = WEXITSTATUS (status);
+ }
+#endif
+ return TRUE;
+}
+
+/*
+ * This is the only use we have in mono/metadata
+!g_spawn_async_with_pipes (NULL, (char**)addr_argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, &child_pid, &ch_in, &ch_out, NULL, NULL)
+*/
+gboolean
+g_spawn_async_with_pipes (const gchar *working_directory,
+ gchar **argv,
+ gchar **envp,
+ GSpawnFlags flags,
+ GSpawnChildSetupFunc child_setup,
+ gpointer user_data,
+ GPid *child_pid,
+ gint *standard_input,
+ gint *standard_output,
+ gint *standard_error,
+ GError **error)
+{
+#ifdef G_OS_WIN32
+#elif !defined (HAVE_FORK) || !defined (HAVE_EXECVE)
+ fprintf (stderr, "g_spawn_async_with_pipes is not supported on this platform\n");
+ return FALSE;
+#else
+ pid_t pid;
+ int info_pipe [2];
+ int in_pipe [2] = { -1, -1 };
+ int out_pipe [2] = { -1, -1 };
+ int err_pipe [2] = { -1, -1 };
+ int status;
+
+ g_return_val_if_fail (argv != NULL, FALSE); /* Only mandatory arg */
+
+ if (!create_pipe (info_pipe, error))
+ return FALSE;
+
+ if (standard_output && !create_pipe (out_pipe, error)) {
+ CLOSE_PIPE (info_pipe);
+ return FALSE;
+ }
+
+ if (standard_error && !create_pipe (err_pipe, error)) {
+ CLOSE_PIPE (info_pipe);
+ CLOSE_PIPE (out_pipe);
+ return FALSE;
+ }
+
+ if (standard_input && !create_pipe (in_pipe, error)) {
+ CLOSE_PIPE (info_pipe);
+ CLOSE_PIPE (out_pipe);
+ CLOSE_PIPE (err_pipe);
+ return FALSE;
+ }
+
+ pid = fork ();
+ if (pid == -1) {
+ CLOSE_PIPE (info_pipe);
+ CLOSE_PIPE (out_pipe);
+ CLOSE_PIPE (err_pipe);
+ CLOSE_PIPE (in_pipe);
+ set_error ("%s", "Error in fork ()");
+ return FALSE;
+ }
+
+ if (pid == 0) {
+ /* No zombie left behind */
+ if ((flags & G_SPAWN_DO_NOT_REAP_CHILD) == 0) {
+ pid = fork ();
+ }
+
+ if (pid != 0) {
+ exit (pid == -1 ? 1 : 0);
+ } else {
+ gint i;
+ int fd;
+ gchar *arg0;
+ gchar **actual_args;
+ gint unused;
+
+ close (info_pipe [0]);
+ close (in_pipe [1]);
+ close (out_pipe [0]);
+ close (err_pipe [0]);
+
+ /* when exec* succeeds, we want to close this fd, which will return
+ * a 0 read on the parent. We're not supposed to keep it open forever.
+ * If exec fails, we still can write the error to it before closing.
+ */
+ fcntl (info_pipe [1], F_SETFD, FD_CLOEXEC);
+
+ if ((flags & G_SPAWN_DO_NOT_REAP_CHILD) == 0) {
+ pid = getpid ();
+ NO_INTR (unused, write_all (info_pipe [1], &pid, sizeof (pid_t)));
+ }
+
+ if (working_directory && chdir (working_directory) == -1) {
+ int err = errno;
+ NO_INTR (unused, write_all (info_pipe [1], &err, sizeof (int)));
+ exit (0);
+ }
+
+ if (standard_output) {
+ dup2 (out_pipe [1], STDOUT_FILENO);
+ } else if ((flags & G_SPAWN_STDOUT_TO_DEV_NULL) != 0) {
+ fd = open ("/dev/null", O_WRONLY);
+ dup2 (fd, STDOUT_FILENO);
+ }
+
+ if (standard_error) {
+ dup2 (err_pipe [1], STDERR_FILENO);
+ } else if ((flags & G_SPAWN_STDERR_TO_DEV_NULL) != 0) {
+ fd = open ("/dev/null", O_WRONLY);
+ dup2 (fd, STDERR_FILENO);
+ }
+
+ if (standard_input) {
+ dup2 (in_pipe [0], STDIN_FILENO);
+ } else if ((flags & G_SPAWN_CHILD_INHERITS_STDIN) == 0) {
+ fd = open ("/dev/null", O_RDONLY);
+ dup2 (fd, STDIN_FILENO);
+ }
+
+ if ((flags & G_SPAWN_LEAVE_DESCRIPTORS_OPEN) != 0) {
+ for (i = eg_getdtablesize () - 1; i >= 3; i--)
+ close (i);
+ }
+
+ actual_args = ((flags & G_SPAWN_FILE_AND_ARGV_ZERO) == 0) ? argv : argv + 1;
+ if (envp == NULL)
+ envp = environ;
+
+ if (child_setup)
+ child_setup (user_data);
+
+ arg0 = argv [0];
+ if (!g_path_is_absolute (arg0) || (flags & G_SPAWN_SEARCH_PATH) != 0) {
+ arg0 = g_find_program_in_path (argv [0]);
+ if (arg0 == NULL) {
+ int err = ENOENT;
+ write_all (info_pipe [1], &err, sizeof (int));
+ exit (0);
+ }
+ }
+
+ execve (arg0, actual_args, envp);
+ write_all (info_pipe [1], &errno, sizeof (int));
+ exit (0);
+ }
+ } else if ((flags & G_SPAWN_DO_NOT_REAP_CHILD) == 0) {
+ int w;
+ /* Wait for the first child if two are created */
+ NO_INTR (w, waitpid (pid, &status, 0));
+ if (status == 1 || w == -1) {
+ CLOSE_PIPE (info_pipe);
+ CLOSE_PIPE (out_pipe);
+ CLOSE_PIPE (err_pipe);
+ CLOSE_PIPE (in_pipe);
+ set_error ("Error in fork (): %d", status);
+ return FALSE;
+ }
+ }
+ close (info_pipe [1]);
+ close (in_pipe [0]);
+ close (out_pipe [1]);
+ close (err_pipe [1]);
+
+ if ((flags & G_SPAWN_DO_NOT_REAP_CHILD) == 0) {
+ int x;
+ NO_INTR (x, read (info_pipe [0], &pid, sizeof (pid_t))); /* if we read < sizeof (pid_t)... */
+ }
+
+ if (child_pid) {
+ *child_pid = pid;
+ }
+
+ if (read (info_pipe [0], &status, sizeof (int)) != 0) {
+ close (info_pipe [0]);
+ close (in_pipe [0]);
+ close (out_pipe [1]);
+ close (err_pipe [1]);
+ set_error_status (status, "Error in exec (%d -> %s)", status, strerror (status));
+ return FALSE;
+ }
+
+ close (info_pipe [0]);
+ if (standard_input)
+ *standard_input = in_pipe [1];
+ if (standard_output)
+ *standard_output = out_pipe [0];
+ if (standard_error)
+ *standard_error = err_pipe [0];
+#endif
+ return TRUE;
+}
+
+
--- /dev/null
+/*
+ * gstr.c: String Utility Functions.
+ *
+ * Author:
+ * Miguel de Icaza (miguel@novell.com)
+ * Aaron Bockover (abockover@novell.com)
+ *
+ * (C) 2006 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.
+ */
+#include <config.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <glib.h>
+
+#ifndef G_OS_WIN32
+#include <pthread.h>
+#endif
+
+#include <errno.h>
+
+/*
+ * Linux knows two different versions of strerror_r () that can only be distinguished
+ * by using feature test macros. Please check the man pages for more details.
+ */
+#if defined (_POSIX_C_SOURCE) && defined (_GNU_SOURCE)
+#if (_POSIX_C_SOURCE >= 200112L) && !_GNU_SOURCE
+#define USE_STRERROR_R_XSI
+#endif
+#endif
+
+/*
+ * g_strndup and g_vasprintf need to allocate memory with g_malloc if
+ * ENABLE_OVERRIDABLE_ALLOCATORS is defined so that it can be safely freed with g_free
+ * rather than free.
+ */
+
+/* This is not a macro, because I dont want to put _GNU_SOURCE in the glib.h header */
+gchar *
+g_strndup (const gchar *str, gsize n)
+{
+#if defined (HAVE_STRNDUP) && !defined (ENABLE_OVERRIDABLE_ALLOCATORS)
+ return strndup (str, n);
+#else
+ if (str) {
+ char *retval = g_malloc(n+1);
+ if (retval) {
+ strncpy(retval, str, n)[n] = 0;
+ }
+ return retval;
+ }
+ return NULL;
+#endif
+}
+
+gint g_vasprintf (gchar **ret, const gchar *fmt, va_list ap)
+{
+#if defined (HAVE_VASPRINTF) && !defined (ENABLE_OVERRIDABLE_ALLOCATORS)
+ return vasprintf (ret, fmt, ap);
+#else
+ char *buf;
+ int len;
+ size_t buflen;
+ va_list ap2;
+
+#if defined(_MSC_VER) || defined(__MINGW64_VERSION_MAJOR)
+ ap2 = ap;
+ len = _vscprintf(fmt, ap2); // NOTE MS specific extension ( :-( )
+#else
+ va_copy(ap2, ap);
+ len = vsnprintf(NULL, 0, fmt, ap2);
+#endif
+
+ if (len >= 0 && (buf = g_malloc ((buflen = (size_t) (len + 1)))) != NULL) {
+ len = vsnprintf(buf, buflen, fmt, ap);
+ *ret = buf;
+ } else {
+ *ret = NULL;
+ len = -1;
+ }
+
+ va_end(ap2);
+ return len;
+#endif
+}
+
+void
+g_strfreev (gchar **str_array)
+{
+ gchar **orig = str_array;
+ if (str_array == NULL)
+ return;
+ while (*str_array != NULL){
+ g_free (*str_array);
+ str_array++;
+ }
+ g_free (orig);
+}
+
+gchar **
+g_strdupv (gchar **str_array)
+{
+ guint length;
+ gchar **ret;
+ guint i;
+
+ if (!str_array)
+ return NULL;
+
+ length = g_strv_length(str_array);
+ ret = g_new0(gchar *, length + 1);
+ for (i = 0; str_array[i]; i++) {
+ ret[i] = g_strdup(str_array[i]);
+ }
+ ret[length] = NULL;
+ return ret;
+}
+
+guint
+g_strv_length(gchar **str_array)
+{
+ gint length = 0;
+ g_return_val_if_fail(str_array != NULL, 0);
+ for(length = 0; str_array[length] != NULL; length++);
+ return length;
+}
+
+gboolean
+g_str_has_suffix(const gchar *str, const gchar *suffix)
+{
+ size_t str_length;
+ size_t suffix_length;
+
+ g_return_val_if_fail(str != NULL, FALSE);
+ g_return_val_if_fail(suffix != NULL, FALSE);
+
+ str_length = strlen(str);
+ suffix_length = strlen(suffix);
+
+ return suffix_length <= str_length ?
+ strncmp(str + str_length - suffix_length, suffix, suffix_length) == 0 :
+ FALSE;
+}
+
+gboolean
+g_str_has_prefix(const gchar *str, const gchar *prefix)
+{
+ size_t str_length;
+ size_t prefix_length;
+
+ g_return_val_if_fail(str != NULL, FALSE);
+ g_return_val_if_fail(prefix != NULL, FALSE);
+
+ str_length = strlen(str);
+ prefix_length = strlen(prefix);
+
+ return prefix_length <= str_length ?
+ strncmp(str, prefix, prefix_length) == 0 :
+ FALSE;
+}
+
+gchar *
+g_strdup_vprintf (const gchar *format, va_list args)
+{
+ int n;
+ char *ret;
+
+ n = g_vasprintf (&ret, format, args);
+ if (n == -1)
+ return NULL;
+
+ return ret;
+}
+
+gchar *
+g_strdup_printf (const gchar *format, ...)
+{
+ gchar *ret;
+ va_list args;
+ int n;
+
+ va_start (args, format);
+ n = g_vasprintf (&ret, format, args);
+ va_end (args);
+ if (n == -1)
+ return NULL;
+
+ return ret;
+}
+
+
+/*
+Max error number we support. It's empirically found by looking at our target OS.
+
+Last this was checked was June-2017.
+
+Apple is at 106.
+Android is at 133.
+*/
+#define MONO_ERRNO_MAX 200
+#define str(s) #s
+
+#ifndef G_OS_WIN32
+static pthread_mutex_t strerror_lock = PTHREAD_MUTEX_INITIALIZER;
+#endif
+
+static char *error_messages [MONO_ERRNO_MAX];
+
+const gchar *
+g_strerror (gint errnum)
+{
+ if (errnum < 0)
+ errnum = -errnum;
+ if (errnum >= MONO_ERRNO_MAX)
+ return ("Error number higher than " str (MONO_ERRNO_MAX));
+
+ if (!error_messages [errnum]) {
+#ifndef G_OS_WIN32
+ pthread_mutex_lock (&strerror_lock);
+#endif
+
+#ifdef HAVE_STRERROR_R
+ char tmp_buff [128]; //Quite arbitrary, should be large enough
+ char *buff = tmp_buff;
+ size_t buff_len = sizeof (tmp_buff);
+ buff [0] = 0;
+
+#ifdef USE_STRERROR_R_XSI
+ int r;
+ while ((r = strerror_r (errnum, buff, buff_len - 1))) {
+ if (r != ERANGE) {
+ buff = g_strdup_printf ("Invalid Error code '%d'", errnum);
+ break;
+ }
+ if (buff == tmp_buff)
+ buff = g_malloc (buff_len * 2);
+ else
+ buff = g_realloc (buff, buff_len * 2);
+ buff_len *= 2;
+ //Spec is not clean on whether size argument includes space for null terminator or not
+ }
+ if (!error_messages [errnum])
+ error_messages [errnum] = g_strdup (buff);
+ if (buff != tmp_buff)
+ g_free (buff);
+#else /* USE_STRERROR_R_XSI */
+ buff = strerror_r (errnum, buff, buff_len);
+ if (!error_messages [errnum])
+ error_messages [errnum] = g_strdup (buff);
+#endif /* USE_STRERROR_R_XSI */
+
+#else /* HAVE_STRERROR_R */
+ if (!error_messages [errnum])
+ error_messages [errnum] = g_strdup_printf ("Error code '%d'", errnum);
+#endif /* HAVE_STRERROR_R */
+
+
+#ifndef G_OS_WIN32
+ pthread_mutex_unlock (&strerror_lock);
+#endif
+
+ }
+ return error_messages [errnum];
+}
+
+gchar *
+g_strconcat (const gchar *first, ...)
+{
+ va_list args;
+ size_t total = 0;
+ char *s, *ret;
+ g_return_val_if_fail (first != NULL, NULL);
+
+ total += strlen (first);
+ va_start (args, first);
+ for (s = va_arg (args, char *); s != NULL; s = va_arg(args, char *)){
+ total += strlen (s);
+ }
+ va_end (args);
+
+ ret = g_malloc (total + 1);
+ if (ret == NULL)
+ return NULL;
+
+ ret [total] = 0;
+ strcpy (ret, first);
+ va_start (args, first);
+ for (s = va_arg (args, char *); s != NULL; s = va_arg(args, char *)){
+ strcat (ret, s);
+ }
+ va_end (args);
+
+ return ret;
+}
+
+static void
+add_to_vector (gchar ***vector, int size, gchar *token)
+{
+ *vector = *vector == NULL ?
+ (gchar **)g_malloc(2 * sizeof(*vector)) :
+ (gchar **)g_realloc(*vector, (size + 1) * sizeof(*vector));
+
+ (*vector)[size - 1] = token;
+}
+
+gchar **
+g_strsplit (const gchar *string, const gchar *delimiter, gint max_tokens)
+{
+ const gchar *c;
+ gchar *token, **vector;
+ gint size = 1;
+
+ g_return_val_if_fail (string != NULL, NULL);
+ g_return_val_if_fail (delimiter != NULL, NULL);
+ g_return_val_if_fail (delimiter[0] != 0, NULL);
+
+ if (strncmp (string, delimiter, strlen (delimiter)) == 0) {
+ vector = (gchar **)g_malloc (2 * sizeof(vector));
+ vector[0] = g_strdup ("");
+ size++;
+ string += strlen (delimiter);
+ } else {
+ vector = NULL;
+ }
+
+ while (*string && !(max_tokens > 0 && size >= max_tokens)) {
+ c = string;
+ if (strncmp (string, delimiter, strlen (delimiter)) == 0) {
+ token = g_strdup ("");
+ string += strlen (delimiter);
+ } else {
+ while (*string && strncmp (string, delimiter, strlen (delimiter)) != 0) {
+ string++;
+ }
+
+ if (*string) {
+ gsize toklen = (string - c);
+ token = g_strndup (c, toklen);
+
+ /* Need to leave a trailing empty
+ * token if the delimiter is the last
+ * part of the string
+ */
+ if (strcmp (string, delimiter) != 0) {
+ string += strlen (delimiter);
+ }
+ } else {
+ token = g_strdup (c);
+ }
+ }
+
+ add_to_vector (&vector, size, token);
+ size++;
+ }
+
+ if (*string) {
+ if (strcmp (string, delimiter) == 0)
+ add_to_vector (&vector, size, g_strdup (""));
+ else {
+ /* Add the rest of the string as the last element */
+ add_to_vector (&vector, size, g_strdup (string));
+ }
+ size++;
+ }
+
+ if (vector == NULL) {
+ vector = (gchar **) g_malloc (2 * sizeof (vector));
+ vector [0] = NULL;
+ } else if (size > 0) {
+ vector[size - 1] = NULL;
+ }
+
+ return vector;
+}
+
+static gboolean
+charcmp (gchar testchar, const gchar *compare)
+{
+ while(*compare) {
+ if (*compare == testchar) {
+ return TRUE;
+ }
+ compare++;
+ }
+
+ return FALSE;
+}
+
+gchar **
+g_strsplit_set (const gchar *string, const gchar *delimiter, gint max_tokens)
+{
+ const gchar *c;
+ gchar *token, **vector;
+ gint size = 1;
+
+ g_return_val_if_fail (string != NULL, NULL);
+ g_return_val_if_fail (delimiter != NULL, NULL);
+ g_return_val_if_fail (delimiter[0] != 0, NULL);
+
+ if (charcmp (*string, delimiter)) {
+ vector = (gchar **)g_malloc (2 * sizeof(vector));
+ vector[0] = g_strdup ("");
+ size++;
+ string++;
+ } else {
+ vector = NULL;
+ }
+
+ c = string;
+ while (*string && !(max_tokens > 0 && size >= max_tokens)) {
+ if (charcmp (*string, delimiter)) {
+ gsize toklen = (string - c);
+ if (toklen == 0) {
+ token = g_strdup ("");
+ } else {
+ token = g_strndup (c, toklen);
+ }
+
+ c = string + 1;
+
+ add_to_vector (&vector, size, token);
+ size++;
+ }
+
+ string++;
+ }
+
+ if (max_tokens > 0 && size >= max_tokens) {
+ if (*string) {
+ /* Add the rest of the string as the last element */
+ add_to_vector (&vector, size, g_strdup (string));
+ size++;
+ }
+ } else {
+ if (*c) {
+ /* Fill in the trailing last token */
+ add_to_vector (&vector, size, g_strdup (c));
+ size++;
+ } else {
+ /* Need to leave a trailing empty token if the
+ * delimiter is the last part of the string
+ */
+ add_to_vector (&vector, size, g_strdup (""));
+ size++;
+ }
+ }
+
+ if (vector == NULL) {
+ vector = (gchar **) g_malloc (2 * sizeof (vector));
+ vector [0] = NULL;
+ } else if (size > 0) {
+ vector[size - 1] = NULL;
+ }
+
+ return vector;
+}
+
+gchar *
+g_strreverse (gchar *str)
+{
+ size_t i, j;
+ gchar c;
+
+ if (str == NULL)
+ return NULL;
+
+ if (*str == 0)
+ return str;
+
+ for (i = 0, j = strlen (str) - 1; i < j; i++, j--) {
+ c = str [i];
+ str [i] = str [j];
+ str [j] = c;
+ }
+
+ return str;
+}
+
+gchar *
+g_strjoin (const gchar *separator, ...)
+{
+ va_list args;
+ char *res, *s, *r;
+ size_t len, slen;
+
+ if (separator != NULL)
+ slen = strlen (separator);
+ else
+ slen = 0;
+
+ len = 0;
+ va_start (args, separator);
+ for (s = va_arg (args, char *); s != NULL; s = va_arg (args, char *)){
+ len += strlen (s);
+ len += slen;
+ }
+ va_end (args);
+
+ if (len == 0)
+ return g_strdup ("");
+
+ /* Remove the last separator */
+ if (slen > 0 && len > 0)
+ len -= slen;
+
+ res = g_malloc (len + 1);
+ va_start (args, separator);
+ s = va_arg (args, char *);
+ r = g_stpcpy (res, s);
+ for (s = va_arg (args, char *); s != NULL; s = va_arg (args, char *)){
+ if (separator != NULL)
+ r = g_stpcpy (r, separator);
+ r = g_stpcpy (r, s);
+ }
+ va_end (args);
+
+ return res;
+}
+
+gchar *
+g_strjoinv (const gchar *separator, gchar **str_array)
+{
+ char *res, *r;
+ size_t slen, len, i;
+
+ if (separator != NULL)
+ slen = strlen (separator);
+ else
+ slen = 0;
+
+ len = 0;
+ for (i = 0; str_array [i] != NULL; i++){
+ len += strlen (str_array [i]);
+ len += slen;
+ }
+
+ if (len == 0)
+ return g_strdup ("");
+
+ if (slen > 0 && len > 0)
+ len -= slen;
+
+ res = g_malloc (len + 1);
+ r = g_stpcpy (res, str_array [0]);
+ for (i = 1; str_array [i] != NULL; i++){
+ if (separator != NULL)
+ r = g_stpcpy (r, separator);
+ r = g_stpcpy (r, str_array [i]);
+ }
+
+ return res;
+}
+
+gchar *
+g_strchug (gchar *str)
+{
+ size_t len;
+ gchar *tmp;
+
+ if (str == NULL)
+ return NULL;
+
+ tmp = str;
+ while (*tmp && isspace (*tmp)) tmp++;
+ if (str != tmp) {
+ len = strlen (str) - (tmp - str - 1);
+ memmove (str, tmp, len);
+ }
+ return str;
+}
+
+gchar *
+g_strchomp (gchar *str)
+{
+ gchar *tmp;
+
+ if (str == NULL)
+ return NULL;
+
+ tmp = str + strlen (str) - 1;
+ while (*tmp && isspace (*tmp)) tmp--;
+ *(tmp + 1) = '\0';
+ return str;
+}
+
+gint
+g_printf(gchar const *format, ...)
+{
+ va_list args;
+ gint ret;
+
+ va_start(args, format);
+ ret = vprintf(format, args);
+ va_end(args);
+
+ return ret;
+}
+
+gint
+g_fprintf(FILE *file, gchar const *format, ...)
+{
+ va_list args;
+ gint ret;
+
+ va_start(args, format);
+ ret = vfprintf(file, format, args);
+ va_end(args);
+
+ return ret;
+}
+
+gint
+g_sprintf(gchar *string, gchar const *format, ...)
+{
+ va_list args;
+ gint ret;
+
+ va_start(args, format);
+ ret = vsprintf(string, format, args);
+ va_end(args);
+
+ return ret;
+}
+
+gint
+g_snprintf(gchar *string, gulong n, gchar const *format, ...)
+{
+ va_list args;
+ gint ret;
+
+ va_start(args, format);
+ ret = vsnprintf(string, n, format, args);
+ va_end(args);
+
+ return ret;
+}
+
+static const char hx [] = { '0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
+
+static gboolean
+char_needs_encoding (char c)
+{
+ if (((unsigned char)c) >= 0x80)
+ return TRUE;
+
+ if ((c >= '@' && c <= 'Z') ||
+ (c >= 'a' && c <= 'z') ||
+ (c >= '&' && c < 0x3b) ||
+ (c == '!') || (c == '$') || (c == '_') || (c == '=') || (c == '~'))
+ return FALSE;
+ return TRUE;
+}
+
+gchar *
+g_filename_to_uri (const gchar *filename, const gchar *hostname, GError **error)
+{
+ size_t n;
+ char *ret, *rp;
+ const char *p;
+#ifdef G_OS_WIN32
+ const char *uriPrefix = "file:///";
+#else
+ const char *uriPrefix = "file://";
+#endif
+
+ g_return_val_if_fail (filename != NULL, NULL);
+
+ if (hostname != NULL)
+ g_warning ("%s", "eglib: g_filename_to_uri: hostname not handled");
+
+ if (!g_path_is_absolute (filename)){
+ if (error != NULL)
+ *error = g_error_new (NULL, 2, "Not an absolute filename");
+
+ return NULL;
+ }
+
+ n = strlen (uriPrefix) + 1;
+ for (p = filename; *p; p++){
+#ifdef G_OS_WIN32
+ if (*p == '\\') {
+ n++;
+ continue;
+ }
+#endif
+ if (char_needs_encoding (*p))
+ n += 3;
+ else
+ n++;
+ }
+ ret = g_malloc (n);
+ strcpy (ret, uriPrefix);
+ for (p = filename, rp = ret + strlen (ret); *p; p++){
+#ifdef G_OS_WIN32
+ if (*p == '\\') {
+ *rp++ = '/';
+ continue;
+ }
+#endif
+ if (char_needs_encoding (*p)){
+ *rp++ = '%';
+ *rp++ = hx [((unsigned char)(*p)) >> 4];
+ *rp++ = hx [((unsigned char)(*p)) & 0xf];
+ } else
+ *rp++ = *p;
+ }
+ *rp = 0;
+ return ret;
+}
+
+static int
+decode (char p)
+{
+ if (p >= '0' && p <= '9')
+ return p - '0';
+ if (p >= 'A' && p <= 'F')
+ return p - 'A';
+ if (p >= 'a' && p <= 'f')
+ return p - 'a';
+ g_assert_not_reached ();
+ return 0;
+}
+
+gchar *
+g_filename_from_uri (const gchar *uri, gchar **hostname, GError **error)
+{
+ const char *p;
+ char *r, *result;
+ int flen = 0;
+
+ g_return_val_if_fail (uri != NULL, NULL);
+
+ if (hostname != NULL)
+ g_warning ("%s", "eglib: g_filename_from_uri: hostname not handled");
+
+ if (strncmp (uri, "file:///", 8) != 0){
+ if (error != NULL)
+ *error = g_error_new (NULL, 2, "URI does not start with the file: scheme");
+ return NULL;
+ }
+
+ for (p = uri + 8; *p; p++){
+ if (*p == '%'){
+ if (p [1] && p [2] && isxdigit (p [1]) && isxdigit (p [2])){
+ p += 2;
+ } else {
+ if (error != NULL)
+ *error = g_error_new (NULL, 2, "URI contains an invalid escape sequence");
+ return NULL;
+ }
+ }
+ flen++;
+ }
+#ifndef G_OS_WIN32
+ flen++;
+#endif
+
+ result = g_malloc (flen + 1);
+ result [flen] = 0;
+
+#ifndef G_OS_WIN32
+ *result = '/';
+ r = result + 1;
+#else
+ r = result;
+#endif
+
+ for (p = uri + 8; *p; p++){
+ if (*p == '%'){
+ *r++ = (char)((decode (p [1]) << 4) | decode (p [2]));
+ p += 2;
+ } else
+ *r++ = *p;
+ flen++;
+ }
+ return result;
+}
+
+void
+g_strdown (gchar *string)
+{
+ g_return_if_fail (string != NULL);
+
+ while (*string){
+ *string = (gchar)tolower (*string);
+ string++;
+ }
+}
+
+gchar
+g_ascii_tolower (gchar c)
+{
+ return c >= 'A' && c <= 'Z' ? c + ('a' - 'A') : c;
+}
+
+gchar *
+g_ascii_strdown (const gchar *str, gssize len)
+{
+ char *ret;
+ int i;
+
+ g_return_val_if_fail (str != NULL, NULL);
+
+ if (len == -1)
+ len = strlen (str);
+
+ ret = g_malloc (len + 1);
+ for (i = 0; i < len; i++)
+ ret [i] = (guchar) g_ascii_tolower (str [i]);
+ ret [i] = 0;
+
+ return ret;
+}
+
+gchar
+g_ascii_toupper (gchar c)
+{
+ return c >= 'a' && c <= 'z' ? c + ('A' - 'a') : c;
+}
+
+gchar *
+g_ascii_strup (const gchar *str, gssize len)
+{
+ char *ret;
+ int i;
+
+ g_return_val_if_fail (str != NULL, NULL);
+
+ if (len == -1)
+ len = strlen (str);
+
+ ret = g_malloc (len + 1);
+ for (i = 0; i < len; i++)
+ ret [i] = (guchar) g_ascii_toupper (str [i]);
+ ret [i] = 0;
+
+ return ret;
+}
+
+gint
+g_ascii_strncasecmp (const gchar *s1, const gchar *s2, gsize n)
+{
+ gsize i;
+
+ g_return_val_if_fail (s1 != NULL, 0);
+ g_return_val_if_fail (s2 != NULL, 0);
+
+ for (i = 0; i < n; i++) {
+ gchar c1 = g_ascii_tolower (*s1++);
+ gchar c2 = g_ascii_tolower (*s2++);
+
+ if (c1 != c2)
+ return c1 - c2;
+ }
+
+ return 0;
+}
+
+gint
+g_ascii_strcasecmp (const gchar *s1, const gchar *s2)
+{
+ const char *sp1 = s1;
+ const char *sp2 = s2;
+
+ g_return_val_if_fail (s1 != NULL, 0);
+ g_return_val_if_fail (s2 != NULL, 0);
+
+ while (*sp1 != '\0') {
+ char c1 = g_ascii_tolower (*sp1++);
+ char c2 = g_ascii_tolower (*sp2++);
+
+ if (c1 != c2)
+ return c1 - c2;
+ }
+
+ return (*sp1) - (*sp2);
+}
+
+gchar *
+g_strdelimit (gchar *string, const gchar *delimiters, gchar new_delimiter)
+{
+ gchar *ptr;
+
+ g_return_val_if_fail (string != NULL, NULL);
+
+ if (delimiters == NULL)
+ delimiters = G_STR_DELIMITERS;
+
+ for (ptr = string; *ptr; ptr++) {
+ if (strchr (delimiters, *ptr))
+ *ptr = new_delimiter;
+ }
+
+ return string;
+}
+
+gsize
+g_strlcpy (gchar *dest, const gchar *src, gsize dest_size)
+{
+#ifdef HAVE_STRLCPY
+ return strlcpy (dest, src, dest_size);
+#else
+ gchar *d;
+ const gchar *s;
+ gchar c;
+ gsize len;
+
+ g_return_val_if_fail (src != NULL, 0);
+ g_return_val_if_fail (dest != NULL, 0);
+
+ len = dest_size;
+ if (len == 0)
+ return 0;
+
+ s = src;
+ d = dest;
+ while (--len) {
+ c = *s++;
+ *d++ = c;
+ if (c == '\0')
+ return (dest_size - len - 1);
+ }
+
+ /* len is 0 i we get here */
+ *d = '\0';
+ /* we need to return the length of src here */
+ while (*s++) ; /* instead of a plain strlen, we use 's' */
+ return s - src - 1;
+#endif
+}
+
+gchar *
+g_stpcpy (gchar *dest, const char *src)
+{
+ g_return_val_if_fail (dest != NULL, dest);
+ g_return_val_if_fail (src != NULL, dest);
+
+#if HAVE_STPCPY
+ return stpcpy (dest, src);
+#else
+ while (*src)
+ *dest++ = *src++;
+
+ *dest = '\0';
+
+ return dest;
+#endif
+}
+
+static const gchar escaped_dflt [256] = {
+ 1, 1, 1, 1, 1, 1, 1, 1, 'b', 't', 'n', 1, 'f', 'r', 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 0, '"', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '\\', 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
+};
+
+gchar *
+g_strescape (const gchar *source, const gchar *exceptions)
+{
+ gchar escaped [256];
+ const gchar *ptr;
+ gchar c;
+ gchar op;
+ gchar *result;
+ gchar *res_ptr;
+
+ g_return_val_if_fail (source != NULL, NULL);
+
+ memcpy (escaped, escaped_dflt, 256);
+ if (exceptions != NULL) {
+ for (ptr = exceptions; *ptr; ptr++)
+ escaped [(int) *ptr] = 0;
+ }
+ result = g_malloc (strlen (source) * 4 + 1); /* Worst case: everything octal. */
+ res_ptr = result;
+ for (ptr = source; *ptr; ptr++) {
+ c = *ptr;
+ op = escaped [(int) c];
+ if (op == 0) {
+ *res_ptr++ = c;
+ } else {
+ *res_ptr++ = '\\';
+ if (op != 1) {
+ *res_ptr++ = op;
+ } else {
+ *res_ptr++ = '0' + ((c >> 6) & 3);
+ *res_ptr++ = '0' + ((c >> 3) & 7);
+ *res_ptr++ = '0' + (c & 7);
+ }
+ }
+ }
+ *res_ptr = '\0';
+ return result;
+}
+
+gint
+g_ascii_xdigit_value (gchar c)
+{
+ return ((isxdigit (c) == 0) ? -1 :
+ ((c >= '0' && c <= '9') ? (c - '0') :
+ ((c >= 'a' && c <= 'f') ? (c - 'a' + 10) :
+ (c - 'A' + 10))));
+}
+
+gchar *
+g_strnfill (gsize length, gchar fill_char)
+{
+ gchar *ret = g_new (gchar, length + 1);
+
+ memset (ret, fill_char, length);
+ ret [length] = 0;
+ return ret;
+}
--- /dev/null
+/*
+ * String functions
+ *
+ * Author:
+ * Miguel de Icaza (miguel@novell.com)
+ * Aaron Bockover (abockover@novell.com)
+ *
+ * (C) 2006 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.
+ */
+#include <stdio.h>
+#include <glib.h>
+
+#define GROW_IF_NECESSARY(s,l) { \
+ if(s->len + l >= s->allocated_len) { \
+ s->allocated_len = (s->allocated_len + l + 16) * 2; \
+ s->str = g_realloc(s->str, s->allocated_len); \
+ } \
+}
+
+GString *
+g_string_new_len (const gchar *init, gssize len)
+{
+ GString *ret = g_new (GString, 1);
+
+ if (init == NULL)
+ ret->len = 0;
+ else
+ ret->len = len < 0 ? strlen(init) : len;
+ ret->allocated_len = MAX(ret->len + 1, 16);
+ ret->str = g_malloc(ret->allocated_len);
+ if (init)
+ memcpy(ret->str, init, ret->len);
+ ret->str[ret->len] = 0;
+
+ return ret;
+}
+
+GString *
+g_string_new (const gchar *init)
+{
+ return g_string_new_len(init, -1);
+}
+
+GString *
+g_string_sized_new (gsize default_size)
+{
+ GString *ret = g_new (GString, 1);
+
+ ret->str = g_malloc (default_size);
+ ret->str [0] = 0;
+ ret->len = 0;
+ ret->allocated_len = default_size;
+
+ return ret;
+}
+
+gchar *
+g_string_free (GString *string, gboolean free_segment)
+{
+ gchar *data;
+
+ g_return_val_if_fail (string != NULL, NULL);
+
+ data = string->str;
+ g_free(string);
+
+ if(!free_segment) {
+ return data;
+ }
+
+ g_free(data);
+ return NULL;
+}
+
+GString *
+g_string_append_len (GString *string, const gchar *val, gssize len)
+{
+ g_return_val_if_fail(string != NULL, NULL);
+ g_return_val_if_fail(val != NULL, string);
+
+ if(len < 0) {
+ len = strlen(val);
+ }
+
+ GROW_IF_NECESSARY(string, len);
+ memcpy(string->str + string->len, val, len);
+ string->len += len;
+ string->str[string->len] = 0;
+
+ return string;
+}
+
+GString *
+g_string_append (GString *string, const gchar *val)
+{
+ g_return_val_if_fail(string != NULL, NULL);
+ g_return_val_if_fail(val != NULL, string);
+
+ return g_string_append_len(string, val, -1);
+}
+
+GString *
+g_string_append_c (GString *string, gchar c)
+{
+ g_return_val_if_fail(string != NULL, NULL);
+
+ GROW_IF_NECESSARY(string, 1);
+
+ string->str[string->len] = c;
+ string->str[string->len + 1] = 0;
+ string->len++;
+
+ return string;
+}
+
+GString *
+g_string_append_unichar (GString *string, gunichar c)
+{
+ gchar utf8[6];
+ gint len;
+
+ g_return_val_if_fail (string != NULL, NULL);
+
+ if ((len = g_unichar_to_utf8 (c, utf8)) <= 0)
+ return string;
+
+ return g_string_append_len (string, utf8, len);
+}
+
+GString *
+g_string_prepend (GString *string, const gchar *val)
+{
+ gssize len;
+
+ g_return_val_if_fail (string != NULL, string);
+ g_return_val_if_fail (val != NULL, string);
+
+ len = strlen (val);
+
+ GROW_IF_NECESSARY(string, len);
+ memmove(string->str + len, string->str, string->len + 1);
+ memcpy(string->str, val, len);
+
+ return string;
+}
+
+GString *
+g_string_insert (GString *string, gssize pos, const gchar *val)
+{
+ gssize len;
+
+ g_return_val_if_fail (string != NULL, string);
+ g_return_val_if_fail (val != NULL, string);
+ g_return_val_if_fail (pos <= string->len, string);
+
+ len = strlen (val);
+
+ GROW_IF_NECESSARY(string, len);
+ memmove(string->str + pos + len, string->str + pos, string->len - pos - len + 1);
+ memcpy(string->str + pos, val, len);
+
+ return string;
+}
+
+void
+g_string_append_printf (GString *string, const gchar *format, ...)
+{
+ char *ret;
+ va_list args;
+
+ g_return_if_fail (string != NULL);
+ g_return_if_fail (format != NULL);
+
+ va_start (args, format);
+ ret = g_strdup_vprintf (format, args);
+ va_end (args);
+ g_string_append (string, ret);
+
+ g_free (ret);
+}
+
+void
+g_string_append_vprintf (GString *string, const gchar *format, va_list args)
+{
+ char *ret;
+
+ g_return_if_fail (string != NULL);
+ g_return_if_fail (format != NULL);
+
+ ret = g_strdup_vprintf (format, args);
+ g_string_append (string, ret);
+ g_free (ret);
+}
+
+void
+g_string_printf (GString *string, const gchar *format, ...)
+{
+ va_list args;
+
+ g_return_if_fail (string != NULL);
+ g_return_if_fail (format != NULL);
+
+ g_free (string->str);
+
+ va_start (args, format);
+ string->str = g_strdup_vprintf (format, args);
+ va_end (args);
+
+ string->len = strlen (string->str);
+ string->allocated_len = string->len+1;
+}
+
+GString *
+g_string_truncate (GString *string, gsize len)
+{
+ g_return_val_if_fail (string != NULL, string);
+
+ /* Silent return */
+ if (len >= string->len)
+ return string;
+
+ string->len = len;
+ string->str[len] = 0;
+ return string;
+}
+
+GString *
+g_string_set_size (GString *string, gsize len)
+{
+ g_return_val_if_fail (string != NULL, string);
+
+ GROW_IF_NECESSARY(string, len);
+
+ string->len = len;
+ string->str[len] = 0;
+ return string;
+}
+
+GString *
+g_string_erase (GString *string, gssize pos, gssize len)
+{
+ g_return_val_if_fail (string != NULL, string);
+
+ /* Silent return */
+ if (pos >= string->len)
+ return string;
+
+ if (len == -1 || (pos + len) >= string->len) {
+ string->str[pos] = 0;
+ }
+ else {
+ memmove (string->str + pos, string->str + pos + len, string->len - (pos + len) + 1);
+ string->len -= len;
+ }
+
+ return string;
+}
--- /dev/null
+/*
+ * Timer
+ *
+ * Author:
+ * Gonzalo Paniagua Javier (gonzalo@novell.com
+ *
+ * (C) 2006 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.
+ */
+#include <glib.h>
+#include <sys/time.h>
+
+struct _GTimer {
+ struct timeval start;
+ struct timeval stop;
+};
+
+GTimer *g_timer_new (void)
+{
+ GTimer *timer;
+
+ timer = g_new0 (GTimer, 1);
+ g_timer_start (timer);
+ return timer;
+}
+
+void
+g_timer_destroy (GTimer *timer)
+{
+ g_return_if_fail (timer != NULL);
+ g_free (timer);
+}
+
+void
+g_timer_start (GTimer *timer)
+{
+ g_return_if_fail (timer != NULL);
+ gettimeofday (&timer->start, NULL);
+ memset (&timer->stop, 0, sizeof (struct timeval));
+}
+
+void
+g_timer_stop (GTimer *timer)
+{
+ g_return_if_fail (timer != NULL);
+ gettimeofday (&timer->stop, NULL);
+}
+
+gdouble
+g_timer_elapsed (GTimer *timer, gulong *microseconds)
+{
+ struct timeval tv;
+ gulong seconds;
+ long usec;
+ gdouble result;
+
+ g_return_val_if_fail (timer != NULL, 0.0);
+
+ if (timer->stop.tv_sec == 0 && timer->stop.tv_usec == 0) {
+ gettimeofday (&tv, NULL);
+ } else {
+ tv = timer->stop;
+ }
+
+ usec = (tv.tv_usec) - (timer->start.tv_usec);
+ seconds = tv.tv_sec - timer->start.tv_sec;
+ if (microseconds) {
+ if (usec < 0) {
+ usec += 1000000;
+ seconds--;
+ }
+ *microseconds = usec;
+ }
+ result = seconds * 1000000 + usec;
+ return (result / 1000000);
+}
+
+
--- /dev/null
+/*
+ * Timer
+ *
+ * Author:
+ * Gonzalo Paniagua Javier (gonzalo@novell.com
+ *
+ * (C) 2006 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.
+ */
+#include <glib.h>
+#include <windows.h>
+
+struct _GTimer {
+ guint64 start;
+ guint64 stop;
+};
+
+GTimer *g_timer_new (void)
+{
+ GTimer *timer;
+
+ timer = g_new0 (GTimer, 1);
+ g_timer_start (timer);
+ return timer;
+}
+
+void
+g_timer_destroy (GTimer *timer)
+{
+ g_return_if_fail (timer != NULL);
+ g_free (timer);
+}
+
+void
+g_timer_start (GTimer *timer)
+{
+ g_return_if_fail (timer != NULL);
+
+ QueryPerformanceCounter ((LARGE_INTEGER*)&timer->start);
+}
+
+void
+g_timer_stop (GTimer *timer)
+{
+ g_return_if_fail (timer != NULL);
+
+ QueryPerformanceCounter ((LARGE_INTEGER*)&timer->stop);
+}
+
+gdouble
+g_timer_elapsed (GTimer *timer, gulong *microseconds)
+{
+ static guint64 freq = 0;
+ guint64 delta, stop;
+
+ if (freq == 0) {
+ if (!QueryPerformanceFrequency ((LARGE_INTEGER *)&freq))
+ freq = 1;
+ }
+
+ if (timer->stop == 0) {
+ QueryPerformanceCounter ((LARGE_INTEGER*)&stop);
+ }
+ else {
+ stop = timer->stop;
+ }
+
+ delta = stop - timer->start;
+
+ if (microseconds)
+ *microseconds = (gulong) (delta * (1000000.0 / freq));
+
+ return (gdouble) delta / (gdouble) freq;
+}
+
+
--- /dev/null
+/*
+ * gunicode-win32-uwp.c: UWP unicode support.
+ *
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+*/
+#include <config.h>
+#include <glib.h>
+
+#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
+#define CODESET 1
+#include <windows.h>
+
+extern const char *my_charset;
+static gboolean is_utf8;
+
+gboolean
+g_get_charset (G_CONST_RETURN char **charset)
+{
+ if (my_charset == NULL) {
+ static char buf [14];
+ CPINFOEXA cp_info;
+
+ GetCPInfoExA (CP_ACP, 0, &cp_info);
+ sprintf (buf, "CP%u", cp_info.CodePage);
+ my_charset = buf;
+ is_utf8 = FALSE;
+ }
+
+ if (charset != NULL)
+ *charset = my_charset;
+
+ return is_utf8;
+}
+
+#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
+
+#ifdef _MSC_VER
+// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
+void __mono_win32_gunicode_win32_uwp_quiet_lnk4221(void) {}
+#endif
+#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
--- /dev/null
+/*
+ * gunicode-win32.c: Windows unicode support.
+ *
+ * Copyright 2016 Microsoft
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+*/
+#include <config.h>
+#include <glib.h>
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
+#define CODESET 1
+#include <windows.h>
+
+extern const char *my_charset;
+static gboolean is_utf8;
+
+gboolean
+g_get_charset (G_CONST_RETURN char **charset)
+{
+ if (my_charset == NULL) {
+ static char buf [14];
+ sprintf (buf, "CP%u", GetACP ());
+ my_charset = buf;
+ is_utf8 = FALSE;
+ }
+
+ if (charset != NULL)
+ *charset = my_charset;
+
+ return is_utf8;
+}
+
+#else /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
+#ifdef _MSC_VER
+// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
+void __mono_win32_mono_gunicode_win32_quiet_lnk4221(void) {}
+#endif
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
--- /dev/null
+/*
+ * gunicode.c: Some Unicode routines
+ *
+ * Author:
+ * Miguel de Icaza (miguel@novell.com)
+ *
+ * (C) 2006 Novell, Inc.
+ *
+ * utf8 validation code came from:
+ * libxml2-2.6.26 licensed under the MIT X11 license
+ *
+ * Authors credit in libxml's string.c:
+ * William Brack <wbrack@mmm.com.hk>
+ * daniel@veillard.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.
+ *
+ */
+#include <config.h>
+#include <stdio.h>
+#include <glib.h>
+#include <unicode-data.h>
+#include <errno.h>
+
+#ifndef G_OS_WIN32
+# ifdef HAVE_LOCALCHARSET_H
+# include <localcharset.h>
+# endif
+#endif
+
+const char *my_charset;
+
+/*
+ * Character set conversion
+ */
+
+GUnicodeType
+g_unichar_type (gunichar c)
+{
+ int i;
+
+ guint16 cp = (guint16) c;
+ for (i = 0; i < unicode_category_ranges_count; i++) {
+ if (cp < unicode_category_ranges [i].start)
+ continue;
+ if (unicode_category_ranges [i].end <= cp)
+ continue;
+ return unicode_category [i] [cp - unicode_category_ranges [i].start];
+ }
+
+ /*
+ // 3400-4DB5: OtherLetter
+ // 4E00-9FC3: OtherLetter
+ // AC00-D7A3: OtherLetter
+ // D800-DFFF: OtherSurrogate
+ // E000-F8FF: OtherPrivateUse
+ // 20000-2A6D6 OtherLetter
+ // F0000-FFFFD OtherPrivateUse
+ // 100000-10FFFD OtherPrivateUse
+ */
+ if (0x3400 <= cp && cp < 0x4DB5)
+ return G_UNICODE_OTHER_LETTER;
+ if (0x4E00 <= cp && cp < 0x9FC3)
+ return G_UNICODE_OTHER_LETTER;
+ if (0xAC00<= cp && cp < 0xD7A3)
+ return G_UNICODE_OTHER_LETTER;
+ if (0xD800 <= cp && cp < 0xDFFF)
+ return G_UNICODE_SURROGATE;
+ if (0xE000 <= cp && cp < 0xF8FF)
+ return G_UNICODE_PRIVATE_USE;
+ /* since the argument is UTF-16, we cannot check beyond FFFF */
+
+ /* It should match any of above */
+ return 0;
+}
+
+GUnicodeBreakType
+g_unichar_break_type (gunichar c)
+{
+ // MOONLIGHT_FIXME
+ return G_UNICODE_BREAK_UNKNOWN;
+}
+
+gunichar
+g_unichar_case (gunichar c, gboolean upper)
+{
+ gint8 i, i2;
+ guint32 cp = (guint32) c, v;
+
+ for (i = 0; i < simple_case_map_ranges_count; i++) {
+ if (cp < simple_case_map_ranges [i].start)
+ return c;
+ if (simple_case_map_ranges [i].end <= cp)
+ continue;
+ if (c < 0x10000) {
+ const guint16 *tab = upper ? simple_upper_case_mapping_lowarea [i] : simple_lower_case_mapping_lowarea [i];
+ v = tab [cp - simple_case_map_ranges [i].start];
+ } else {
+ const guint32 *tab;
+ i2 = (gint8)(i - (upper ? simple_upper_case_mapping_lowarea_table_count : simple_lower_case_mapping_lowarea_table_count));
+ tab = upper ? simple_upper_case_mapping_higharea [i2] : simple_lower_case_mapping_higharea [i2];
+ v = tab [cp - simple_case_map_ranges [i].start];
+ }
+ return v != 0 ? (gunichar) v : c;
+ }
+ return c;
+}
+
+gunichar
+g_unichar_toupper (gunichar c)
+{
+ return g_unichar_case (c, TRUE);
+}
+
+gunichar
+g_unichar_tolower (gunichar c)
+{
+ return g_unichar_case (c, FALSE);
+}
+
+gunichar
+g_unichar_totitle (gunichar c)
+{
+ guint8 i;
+ guint32 cp;
+
+ cp = (guint32) c;
+ for (i = 0; i < simple_titlecase_mapping_count; i++) {
+ if (simple_titlecase_mapping [i].codepoint == cp)
+ return simple_titlecase_mapping [i].title;
+ if (simple_titlecase_mapping [i].codepoint > cp)
+ /* it is ordered, hence no more match */
+ break;
+ }
+ return g_unichar_toupper (c);
+}
+
+gboolean
+g_unichar_isxdigit (gunichar c)
+{
+ return (g_unichar_xdigit_value (c) != -1);
+
+}
+
+gint
+g_unichar_xdigit_value (gunichar c)
+{
+ if (c >= 0x30 && c <= 0x39) /*0-9*/
+ return (c - 0x30);
+ if (c >= 0x41 && c <= 0x46) /*A-F*/
+ return (c - 0x37);
+ if (c >= 0x61 && c <= 0x66) /*a-f*/
+ return (c - 0x57);
+ return -1;
+}
+
+gboolean
+g_unichar_isspace (gunichar c)
+{
+ GUnicodeType type = g_unichar_type (c);
+ if (type == G_UNICODE_LINE_SEPARATOR ||
+ type == G_UNICODE_PARAGRAPH_SEPARATOR ||
+ type == G_UNICODE_SPACE_SEPARATOR)
+ return TRUE;
+
+ return FALSE;
+}
+
+
+/*
+ * This is broken, and assumes an UTF8 system, but will do for eglib's first user
+ */
+gchar *
+g_filename_from_utf8 (const gchar *utf8string, gssize len, gsize *bytes_read, gsize *bytes_written, GError **error)
+{
+ char *res;
+
+ if (len == -1)
+ len = strlen (utf8string);
+
+ res = g_malloc (len + 1);
+ g_strlcpy (res, utf8string, len + 1);
+ return res;
+}
+
+#ifndef G_OS_WIN32
+static gboolean is_utf8;
+
+gboolean
+g_get_charset (G_CONST_RETURN char **charset)
+{
+ if (my_charset == NULL) {
+ /* These shouldn't be heap allocated */
+#if defined(HAVE_LOCALCHARSET_H)
+ my_charset = locale_charset ();
+#else
+ my_charset = "UTF-8";
+#endif
+ is_utf8 = strcmp (my_charset, "UTF-8") == 0;
+ }
+
+ if (charset != NULL)
+ *charset = my_charset;
+
+ return is_utf8;
+}
+#endif /* G_OS_WIN32 */
+
+gchar *
+g_locale_to_utf8 (const gchar *opsysstring, gssize len, gsize *bytes_read, gsize *bytes_written, GError **error)
+{
+ g_get_charset (NULL);
+
+ return g_convert (opsysstring, len, "UTF-8", my_charset, bytes_read, bytes_written, error);
+}
+
+gchar *
+g_locale_from_utf8 (const gchar *utf8string, gssize len, gsize *bytes_read, gsize *bytes_written, GError **error)
+{
+ g_get_charset (NULL);
+
+ return g_convert (utf8string, len, my_charset, "UTF-8", bytes_read, bytes_written, error);
+}
--- /dev/null
+/*
+ * gutf8.c: UTF-8 conversion
+ *
+ * Author:
+ * Atsushi Enomoto <atsushi@ximian.com>
+ *
+ * (C) 2006 Novell, Inc.
+ * Copyright 2012 Xamarin Inc
+ */
+
+#include <stdio.h>
+#include <glib.h>
+
+/*
+ * Index into the table below with the first byte of a UTF-8 sequence to get
+ * the number of bytes that are supposed to follow it to complete the sequence.
+ *
+ * Note that *legal* UTF-8 values can't have 4 or 5-bytes. The table is left
+ * as-is for anyone who may want to do such conversion, which was allowed in
+ * earlier algorithms.
+*/
+const guchar g_utf8_jump_table[256] = {
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
+ 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, 4,4,4,4,4,4,4,4,5,5,5,5,6,6,1,1
+};
+
+static gchar *
+utf8_case_conv (const gchar *str, gssize len, gboolean upper)
+{
+ gunichar *ustr;
+ glong i, ulen;
+ gchar *utf8;
+
+ ustr = g_utf8_to_ucs4_fast (str, (glong) len, &ulen);
+ for (i = 0; i < ulen; i++)
+ ustr[i] = upper ? g_unichar_toupper (ustr[i]) : g_unichar_tolower (ustr[i]);
+ utf8 = g_ucs4_to_utf8 (ustr, ulen, NULL, NULL, NULL);
+ g_free (ustr);
+
+ return utf8;
+}
+
+gchar *
+g_utf8_strup (const gchar *str, gssize len)
+{
+ return utf8_case_conv (str, len, TRUE);
+}
+
+gchar *
+g_utf8_strdown (const gchar *str, gssize len)
+{
+ return utf8_case_conv (str, len, FALSE);
+}
+
+static gboolean
+utf8_validate (const unsigned char *inptr, size_t len)
+{
+ const unsigned char *ptr = inptr + len;
+ unsigned char c;
+
+ /* Everything falls through when TRUE... */
+ switch (len) {
+ default:
+ return FALSE;
+ case 4:
+ if ((c = (*--ptr)) < 0x80 || c > 0xBF)
+ return FALSE;
+
+ if ((c == 0xBF || c == 0xBE) && ptr[-1] == 0xBF) {
+ if (ptr[-2] == 0x8F || ptr[-2] == 0x9F ||
+ ptr[-2] == 0xAF || ptr[-2] == 0xBF)
+ return FALSE;
+ }
+ case 3:
+ if ((c = (*--ptr)) < 0x80 || c > 0xBF)
+ return FALSE;
+ case 2:
+ if ((c = (*--ptr)) < 0x80 || c > 0xBF)
+ return FALSE;
+
+ /* no fall-through in this inner switch */
+ switch (*inptr) {
+ case 0xE0: if (c < 0xA0) return FALSE; break;
+ case 0xED: if (c > 0x9F) return FALSE; break;
+ case 0xEF: if (c == 0xB7 && (ptr[1] > 0x8F && ptr[1] < 0xB0)) return FALSE;
+ if (c == 0xBF && (ptr[1] == 0xBE || ptr[1] == 0xBF)) return FALSE;
+ break;
+ case 0xF0: if (c < 0x90) return FALSE; break;
+ case 0xF4: if (c > 0x8F) return FALSE; break;
+ default: if (c < 0x80) return FALSE; break;
+ }
+ case 1: if (*inptr >= 0x80 && *inptr < 0xC2) return FALSE;
+ }
+
+ if (*inptr > 0xF4)
+ return FALSE;
+
+ return TRUE;
+}
+
+/**
+ * g_utf8_validate:
+ * @str: a utf-8 encoded string
+ * @max_len: max number of bytes to validate (or -1 to validate the entire null-terminated string)
+ * @end: output parameter to mark the end of the valid input
+ *
+ * Checks @utf for being valid UTF-8. @str is assumed to be
+ * null-terminated. This function is not super-strict, as it will
+ * allow longer UTF-8 sequences than necessary. Note that Java is
+ * capable of producing these sequences if provoked. Also note, this
+ * routine checks for the 4-byte maximum size, but does not check for
+ * 0x10ffff maximum value.
+ *
+ * Return value: %TRUE if @str is valid or %FALSE otherwise.
+ **/
+gboolean
+g_utf8_validate (const gchar *str, gssize max_len, const gchar **end)
+{
+ guchar *inptr = (guchar *) str;
+ gboolean valid = TRUE;
+ guint length, min;
+ gssize n = 0;
+
+ if (max_len == 0)
+ return FALSE;
+
+ if (max_len < 0) {
+ while (*inptr != 0) {
+ length = g_utf8_jump_table[*inptr];
+ if (!utf8_validate (inptr, length)) {
+ valid = FALSE;
+ break;
+ }
+
+ inptr += length;
+ }
+ } else {
+ while (n < max_len) {
+ if (*inptr == 0) {
+ /* Note: return FALSE if we encounter nul-byte
+ * before max_len is reached. */
+ valid = FALSE;
+ break;
+ }
+
+ length = g_utf8_jump_table[*inptr];
+ min = MIN (length, max_len - n);
+
+ if (!utf8_validate (inptr, min)) {
+ valid = FALSE;
+ break;
+ }
+
+ if (min < length) {
+ valid = FALSE;
+ break;
+ }
+
+ inptr += length;
+ n += length;
+ }
+ }
+
+ if (end != NULL)
+ *end = (gchar *) inptr;
+
+ return valid;
+}
+
+gunichar
+g_utf8_get_char_validated (const gchar *str, gssize max_len)
+{
+ unsigned char *inptr = (unsigned char *) str;
+ gunichar u = *inptr;
+ int n, i;
+
+ if (max_len == 0)
+ return -2;
+
+ if (u < 0x80) {
+ /* simple ascii case */
+ return u;
+ } else if (u < 0xc2) {
+ return -1;
+ } else if (u < 0xe0) {
+ u &= 0x1f;
+ n = 2;
+ } else if (u < 0xf0) {
+ u &= 0x0f;
+ n = 3;
+ } else if (u < 0xf8) {
+ u &= 0x07;
+ n = 4;
+ } else if (u < 0xfc) {
+ u &= 0x03;
+ n = 5;
+ } else if (u < 0xfe) {
+ u &= 0x01;
+ n = 6;
+ } else {
+ return -1;
+ }
+
+ if (max_len > 0) {
+ if (!utf8_validate (inptr, MIN (max_len, n)))
+ return -1;
+
+ if (max_len < n)
+ return -2;
+ } else {
+ if (!utf8_validate (inptr, n))
+ return -1;
+ }
+
+ for (i = 1; i < n; i++)
+ u = (u << 6) | (*++inptr ^ 0x80);
+
+ return u;
+}
+
+glong
+g_utf8_strlen (const gchar *str, gssize max_len)
+{
+ const guchar *inptr = (const guchar *) str;
+ glong clen = 0, len = 0, n;
+
+ if (max_len == 0)
+ return 0;
+
+ if (max_len < 0) {
+ while (*inptr) {
+ inptr += g_utf8_jump_table[*inptr];
+ len++;
+ }
+ } else {
+ while (len < max_len && *inptr) {
+ n = g_utf8_jump_table[*inptr];
+ if ((clen + n) > max_len)
+ break;
+
+ inptr += n;
+ clen += n;
+ len++;
+ }
+ }
+
+ return len;
+}
+
+gunichar
+g_utf8_get_char (const gchar *src)
+{
+ unsigned char *inptr = (unsigned char *) src;
+ gunichar u = *inptr;
+ int n, i;
+
+ if (u < 0x80) {
+ /* simple ascii case */
+ return u;
+ } else if (u < 0xe0) {
+ u &= 0x1f;
+ n = 2;
+ } else if (u < 0xf0) {
+ u &= 0x0f;
+ n = 3;
+ } else if (u < 0xf8) {
+ u &= 0x07;
+ n = 4;
+ } else if (u < 0xfc) {
+ u &= 0x03;
+ n = 5;
+ } else {
+ u &= 0x01;
+ n = 6;
+ }
+
+ for (i = 1; i < n; i++)
+ u = (u << 6) | (*++inptr ^ 0x80);
+
+ return u;
+}
+
+gchar *
+g_utf8_find_prev_char (const gchar *str, const gchar *p)
+{
+ while (p > str) {
+ p--;
+ if ((*p & 0xc0) != 0xb0)
+ return (gchar *)p;
+ }
+ return NULL;
+}
+
+gchar *
+g_utf8_prev_char (const gchar *str)
+{
+ const gchar *p = str;
+ do {
+ p--;
+ } while ((*p & 0xc0) == 0xb0);
+
+ return (gchar *)p;
+}
+
+gchar *
+g_utf8_offset_to_pointer (const gchar *str, glong offset)
+{
+ const gchar *p = str;
+
+ if (offset > 0) {
+ do {
+ p = g_utf8_next_char (p);
+ offset --;
+ } while (offset > 0);
+ }
+ else if (offset < 0) {
+ const gchar *jump = str;
+ do {
+ // since the minimum size of a character is 1
+ // we know we can step back at least offset bytes
+ jump = jump + offset;
+
+ // if we land in the middle of a character
+ // walk to the beginning
+ while ((*jump & 0xc0) == 0xb0)
+ jump --;
+
+ // count how many characters we've actually walked
+ // by going forward
+ p = jump;
+ do {
+ p = g_utf8_next_char (p);
+ offset ++;
+ } while (p < jump);
+
+ } while (offset < 0);
+ }
+
+ return (gchar *)p;
+}
+
+glong
+g_utf8_pointer_to_offset (const gchar *str, const gchar *pos)
+{
+ const gchar *inptr, *inend;
+ glong offset = 0;
+ glong sign = 1;
+
+ if (pos == str)
+ return 0;
+
+ if (str < pos) {
+ inptr = str;
+ inend = pos;
+ } else {
+ inptr = pos;
+ inend = str;
+ sign = -1;
+ }
+
+ do {
+ inptr = g_utf8_next_char (inptr);
+ offset++;
+ } while (inptr < inend);
+
+ return offset * sign;
+}
--- /dev/null
+/*
+ * sort.frag.h: Common implementation of linked-list sorting
+ *
+ * Author:
+ * Raja R Harinath (rharinath@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.
+ *
+ * (C) 2006 Novell, Inc.
+ */
+
+/*
+ * This code requires a typedef named 'list_node' for the list node. It
+ * is assumed that the list type is the type of a pointer to a list
+ * node, and that the node has a field named 'next' that implements to
+ * the linked list. No additional invariant is maintained (e.g. the
+ * 'prev' pointer of a doubly-linked list node is _not_ updated). Any
+ * invariant would require a post-processing pass to fix matters if
+ * necessary.
+ */
+typedef list_node *digit;
+
+/*
+ * The maximum possible depth of the merge tree
+ * = ceiling (log2 (maximum number of list nodes))
+ * = ceiling (log2 (maximum possible memory size/size of each list node))
+ * = number of bits in 'size_t' - floor (log2 (sizeof digit))
+ * Also, each list in sort_info is at least 2 nodes long: we can reduce the depth by 1
+ */
+#define FLOOR_LOG2(x) (((x)>=2) + ((x)>=4) + ((x)>=8) + ((x)>=16) + ((x)>=32) + ((x)>=64) + ((x)>=128))
+#define MAX_RANKS ((sizeof (size_t) * 8) - FLOOR_LOG2(sizeof (list_node)) - 1)
+
+struct sort_info
+{
+ int min_rank, n_ranks;
+ GCompareFunc func;
+
+ /* Invariant: ranks[i] == NULL || length(ranks[i]) >= 2**(i+1) */
+ list_node *ranks [MAX_RANKS]; /* ~ 128 bytes on 32bit, ~ 512 bytes on 64bit */
+};
+
+static inline void
+init_sort_info (struct sort_info *si, GCompareFunc func)
+{
+ si->min_rank = si->n_ranks = 0;
+ si->func = func;
+ /* we don't need to initialize si->ranks, since we never lookup past si->n_ranks. */
+}
+
+static inline list_node *
+merge_lists (list_node *first, list_node *second, GCompareFunc func)
+{
+ /* merge the two lists */
+ list_node *list = NULL;
+ list_node **pos = &list;
+ while (first && second) {
+ if (func (first->data, second->data) > 0) {
+ *pos = second;
+ second = second->next;
+ } else {
+ *pos = first;
+ first = first->next;
+ }
+ pos = &((*pos)->next);
+ }
+ *pos = first ? first : second;
+ return list;
+}
+
+/* Pre-condition: upto <= si->n_ranks, list == NULL || length(list) == 1 */
+static inline list_node *
+sweep_up (struct sort_info *si, list_node *list, int upto)
+{
+#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)
+ /*
+ * GCC incorrectly thinks we're writing below si->ranks array bounds.
+ */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Warray-bounds"
+#endif
+
+ int i;
+ for (i = si->min_rank; i < upto; ++i) {
+ list = merge_lists (si->ranks [i], list, si->func);
+ si->ranks [i] = NULL;
+ }
+ return list;
+
+#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)
+#pragma GCC diagnostic pop
+#endif
+}
+
+/*
+ * The 'ranks' array essentially captures the recursion stack of a mergesort.
+ * The merge tree is built in a bottom-up manner. The control loop for
+ * updating the 'ranks' array is analogous to incrementing a binary integer,
+ * and the O(n) time for counting upto n translates to O(n) merges when
+ * inserting rank-0 lists. When we plug in the sizes of the lists involved in
+ * those merges, we get the O(n log n) time for the sort.
+ *
+ * Inserting higher-ranked lists reduce the height of the merge tree, and also
+ * eliminate a lot of redundant comparisons when merging two lists that would've
+ * been part of the same run. Adding a rank-i list is analogous to incrementing
+ * a binary integer by 2**i in one operation, thus sharing a similar speedup.
+ *
+ * When inserting higher-ranked lists, we choose to clear out the lower ranks
+ * in the interests of keeping the sort stable, but this makes analysis harder.
+ * Note that clearing the lower-ranked lists is O(length(list))-- thus it
+ * shouldn't affect the O(n log n) behaviour. IOW, inserting one rank-i list
+ * is equivalent to inserting 2**i rank-0 lists, thus even if we do i additional
+ * merges in the clearing-out (taking at most 2**i time) we are still fine.
+ */
+
+#define stringify2(x) #x
+#define stringify(x) stringify2(x)
+
+/* Pre-condition: 2**(rank+1) <= length(list) < 2**(rank+2) (therefore: length(list) >= 2) */
+static inline void
+insert_list (struct sort_info *si, list_node* list, int rank)
+{
+#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)
+ /*
+ * GCC incorrectly thinks we're writing below si->ranks array bounds.
+ */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Warray-bounds"
+#endif
+
+ int i;
+
+ if (rank > si->n_ranks) {
+ if (rank > MAX_RANKS) {
+ g_warning ("Rank '%d' should not exceed " stringify (MAX_RANKS), rank);
+ rank = MAX_RANKS;
+ }
+ list = merge_lists (sweep_up (si, NULL, si->n_ranks), list, si->func);
+ for (i = si->n_ranks; i < rank; ++i)
+ si->ranks [i] = NULL;
+ } else {
+ if (rank)
+ list = merge_lists (sweep_up (si, NULL, rank), list, si->func);
+ for (i = rank; i < si->n_ranks && si->ranks [i]; ++i) {
+ list = merge_lists (si->ranks [i], list, si->func);
+ si->ranks [i] = NULL;
+ }
+ }
+
+ if (i == MAX_RANKS) /* Will _never_ happen: so we can just devolve into quadratic ;-) */
+ --i;
+ if (i >= si->n_ranks)
+ si->n_ranks = i + 1;
+ si->min_rank = i;
+ si->ranks [i] = list;
+
+#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)
+#pragma GCC diagnostic pop
+#endif
+}
+
+#undef stringify2
+#undef stringify
+#undef MAX_RANKS
+#undef FLOOR_LOG2
+
+/* A non-recursive mergesort */
+static inline digit
+do_sort (list_node* list, GCompareFunc func)
+{
+ struct sort_info si;
+
+ init_sort_info (&si, func);
+
+ while (list && list->next) {
+ list_node* next = list->next;
+ list_node* tail = next->next;
+
+ if (func (list->data, next->data) > 0) {
+ next->next = list;
+ next = list;
+ list = list->next;
+ }
+ next->next = NULL;
+
+ insert_list (&si, list, 0);
+
+ list = tail;
+ }
+
+ return sweep_up (&si, list, si.n_ranks);
+}
--- /dev/null
+/Makefile
+/Makefile.in
+/.libs
+/.deps
+/*.lo
+/*.la
+/*.o
+/semantic.cache
+/.project
+/.cproject
+/test-eglib
+/test-glib
--- /dev/null
+EXTRA_DIST = UTF-8.txt UTF-16BE.txt UTF-16LE.txt UTF-32BE.txt UTF-32LE.txt
+
+SOURCES = \
+ test.c \
+ test.h \
+ tests.h \
+ driver.c \
+ hashtable.c \
+ string-util.c \
+ string.c \
+ slist.c \
+ sizes.c \
+ ptrarray.c \
+ list.c \
+ array.c \
+ fake.c \
+ path.c \
+ queue.c \
+ shell.c \
+ spawn.c \
+ timer.c \
+ file.c \
+ pattern.c \
+ dir.c \
+ markup.c \
+ unicode.c \
+ utf8.c \
+ endian.c \
+ module.c \
+ memory.c
+
+test_eglib_SOURCES = $(SOURCES)
+
+test_eglib_CFLAGS = -Wall -DEGLIB_TESTS=1 -D_FORTIFY_SOURCE=2 -I$(srcdir)/../src -I../src -DDRIVER_NAME=\"EGlib\"
+test_eglib_LDADD = ../src/libeglib.la $(LIBICONV)
+
+run-eglib: all
+ srcdir=`readlink -f $(srcdir)` ./test-eglib
+
+noinst_PROGRAMS = test-eglib
+
+run-both: run-eglib
+
+MAINTAINERCLEANFILES = Makefile.in
--- /dev/null
+EGlib Unit Testing
+===============================================================================
+
+ 1. Writing new tests
+ 2. Using the test driver
+
+===============================================================================
+1. Writing new tests
+===============================================================================
+
+Tests are easy to write, but must be grouped in to logical cases. For instance,
+the GPtrArray group has a number of tests that cover the entire GPtrArray
+implementation.
+
+These logical case groups should be in a single C file, and must have
+three elements:
+
+ #include <glib.h>
+ #include "test.h"
+
+ ...
+ <define test implementations>
+ ...
+
+ static Test groupname_tests [] = {
+ {"groupname_test1", groupname_test1},
+ {"groupname_test1", groupname_test2},
+ {NULL, NULL}
+ };
+
+ DEFINE_TEST_GROUP_INIT(groupname_tests_init, groupname_tests)
+
+A test implementation should look like:
+
+ RESULT groupname_test1()
+ {
+ <perform the test>
+
+ if(test_failed) {
+ return FAILED("reason: %s", "this works like printf");
+ }
+
+ return OK; /* just NULL, but OK is cute */
+ }
+
+Once a test group is written, it needs to be added to the groups table
+in tests.h:
+
+ DEFINE_TEST_GROUP_INIT_H(groupname_tests_init) // same as in impl
+
+ static Group test_groups [] = {
+ ...
+ {"groupname", groupname_tests_init}
+ ...
+ };
+
+===============================================================================
+2. Using the test driver
+===============================================================================
+
+When tests are written, they are rebuilt with make. Two programs will be
+built:
+
+ test-eglib: the test driver and tests linked against eglib
+ test-glib: the test driver and tests linked against system glib-2.0
+
+Each driver program works exactly the same. Running test-eglib will run
+the tests against eglib, and test-glib against glib-2.0.
+
+The test driver supports a few options to allow for performance measuring:
+
+ --help show all options and available test groups
+ --time time the overall run and report it, even if --quiet is set
+ --quiet do not print test results, useful for timing
+ --iterations N run all or specified test groups N times
+
+Run "test-eglib --help" for more details.
+
+Example: run the ptrarray test group 100000 times and only print the time
+ it took to perform all iterations
+
+ ./test-eglib -tqi 100000 ptrarray
+
+Example: show single iteration of test output for two groups
+
+ ./test-eglib ptrarray hashtable
+
+Example: show test output of all available groups
+
+ ./test-eglib
+
+The 'test-both' script can be used to run both test-eglib and test-glib
+with the same options back to back:
+
+ $ ./test-both -tqi 100000 ptrarray
+ EGlib Total Time: 1.1961s
+ GLib Total Time: 0.955957s
+
+test-both also has a nice --speed-compare mode that shows comparison
+information about EGlib vs GLib. It can run all tests or specific tests
+with a configurable number of iterations. --speed-compare mode always runs
+the drivers with -qtni
+
+The syntax for --speed-compare is:
+
+ ./test-both --speed-compare [ITERATIONS] [GROUPS...]
+
+ $ ./test-both --speed-compare Runs all tests with default iterations
+ $ ./test-both --speed-compare 500 Runs all tests with 500 iterations
+ $ ./test-both --speed-compare ptrarray Runs ptrarray test with default
+ iterations
+
+
--- /dev/null
+
+UTF-8 encoded sample plain-text file
+‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
+
+Markus Kuhn [ˈmaʳkʊs kuːn] <http://www.cl.cam.ac.uk/~mgk25/> — 2002-07-25
+
+
+The ASCII compatible UTF-8 encoding used in this plain-text file
+is defined in Unicode, ISO 10646-1, and RFC 2279.
+
+
+Using Unicode/UTF-8, you can write in emails and source code things such as
+
+Mathematics and sciences:
+
+ ∮ E⋅da = Q, n → ∞, ∑ f(i) = ∏ g(i), ⎧⎡⎛┌─────┐⎞⎤⎫
+ ⎪⎢⎜│a²+b³ ⎟⎥⎪
+ ∀x∈ℝ: ⌈x⌉ = −⌊−x⌋, α ∧ ¬β = ¬(¬α ∨ β), ⎪⎢⎜│───── ⎟⎥⎪
+ ⎪⎢⎜⎷ c₈ ⎟⎥⎪
+ ℕ ⊆ ℕ₀ ⊂ ℤ ⊂ ℚ ⊂ ℝ ⊂ ℂ, ⎨⎢⎜ ⎟⎥⎬
+ ⎪⎢⎜ ∞ ⎟⎥⎪
+ ⊥ < a ≠ b ≡ c ≤ d ≪ ⊤ ⇒ (⟦A⟧ ⇔ ⟪B⟫), ⎪⎢⎜ ⎲ ⎟⎥⎪
+ ⎪⎢⎜ ⎳aⁱ-bⁱ⎟⎥⎪
+ 2H₂ + O₂ ⇌ 2H₂O, R = 4.7 kΩ, ⌀ 200 mm ⎩⎣⎝i=1 ⎠⎦⎭
+
+Linguistics and dictionaries:
+
+ ði ıntəˈnæʃənəl fəˈnɛtık əsoʊsiˈeıʃn
+ Y [ˈʏpsilɔn], Yen [jɛn], Yoga [ˈjoːgɑ]
+
+APL:
+
+ ((V⍳V)=⍳⍴V)/V←,V ⌷←⍳→⍴∆∇⊃‾⍎⍕⌈
+
+Nicer typography in plain text files:
+
+ ╔══════════════════════════════════════════╗
+ ║ ║
+ ║ • ‘single’ and “double” quotes ║
+ ║ ║
+ ║ • Curly apostrophes: “We’ve been here” ║
+ ║ ║
+ ║ • Latin-1 apostrophe and accents: '´` ║
+ ║ ║
+ ║ • ‚deutsche‘ „Anführungszeichen“ ║
+ ║ ║
+ ║ • †, ‡, ‰, •, 3–4, —, −5/+5, ™, … ║
+ ║ ║
+ ║ • ASCII safety test: 1lI|, 0OD, 8B ║
+ ║ ╭─────────╮ ║
+ ║ • the euro symbol: │ 14.95 € │ ║
+ ║ ╰─────────╯ ║
+ ╚══════════════════════════════════════════╝
+
+Combining characters:
+
+ STARGΛ̊TE SG-1, a = v̇ = r̈, a⃑ ⊥ b⃑
+
+Greek (in Polytonic):
+
+ The Greek anthem:
+
+ Σὲ γνωρίζω ἀπὸ τὴν κόψη
+ τοῦ σπαθιοῦ τὴν τρομερή,
+ σὲ γνωρίζω ἀπὸ τὴν ὄψη
+ ποὺ μὲ βία μετράει τὴ γῆ.
+
+ ᾿Απ᾿ τὰ κόκκαλα βγαλμένη
+ τῶν ῾Ελλήνων τὰ ἱερά
+ καὶ σὰν πρῶτα ἀνδρειωμένη
+ χαῖρε, ὦ χαῖρε, ᾿Ελευθεριά!
+
+ From a speech of Demosthenes in the 4th century BC:
+
+ Οὐχὶ ταὐτὰ παρίσταταί μοι γιγνώσκειν, ὦ ἄνδρες ᾿Αθηναῖοι,
+ ὅταν τ᾿ εἰς τὰ πράγματα ἀποβλέψω καὶ ὅταν πρὸς τοὺς
+ λόγους οὓς ἀκούω· τοὺς μὲν γὰρ λόγους περὶ τοῦ
+ τιμωρήσασθαι Φίλιππον ὁρῶ γιγνομένους, τὰ δὲ πράγματ᾿
+ εἰς τοῦτο προήκοντα, ὥσθ᾿ ὅπως μὴ πεισόμεθ᾿ αὐτοὶ
+ πρότερον κακῶς σκέψασθαι δέον. οὐδέν οὖν ἄλλο μοι δοκοῦσιν
+ οἱ τὰ τοιαῦτα λέγοντες ἢ τὴν ὑπόθεσιν, περὶ ἧς βουλεύεσθαι,
+ οὐχὶ τὴν οὖσαν παριστάντες ὑμῖν ἁμαρτάνειν. ἐγὼ δέ, ὅτι μέν
+ ποτ᾿ ἐξῆν τῇ πόλει καὶ τὰ αὑτῆς ἔχειν ἀσφαλῶς καὶ Φίλιππον
+ τιμωρήσασθαι, καὶ μάλ᾿ ἀκριβῶς οἶδα· ἐπ᾿ ἐμοῦ γάρ, οὐ πάλαι
+ γέγονεν ταῦτ᾿ ἀμφότερα· νῦν μέντοι πέπεισμαι τοῦθ᾿ ἱκανὸν
+ προλαβεῖν ἡμῖν εἶναι τὴν πρώτην, ὅπως τοὺς συμμάχους
+ σώσομεν. ἐὰν γὰρ τοῦτο βεβαίως ὑπάρξῃ, τότε καὶ περὶ τοῦ
+ τίνα τιμωρήσεταί τις καὶ ὃν τρόπον ἐξέσται σκοπεῖν· πρὶν δὲ
+ τὴν ἀρχὴν ὀρθῶς ὑποθέσθαι, μάταιον ἡγοῦμαι περὶ τῆς
+ τελευτῆς ὁντινοῦν ποιεῖσθαι λόγον.
+
+ Δημοσθένους, Γ´ ᾿Ολυνθιακὸς
+
+Georgian:
+
+ From a Unicode conference invitation:
+
+ გთხოვთ ახლავე გაიაროთ რეგისტრაცია Unicode-ის მეათე საერთაშორისო
+ კონფერენციაზე დასასწრებად, რომელიც გაიმართება 10-12 მარტს,
+ ქ. მაინცში, გერმანიაში. კონფერენცია შეჰკრებს ერთად მსოფლიოს
+ ექსპერტებს ისეთ დარგებში როგორიცაა ინტერნეტი და Unicode-ი,
+ ინტერნაციონალიზაცია და ლოკალიზაცია, Unicode-ის გამოყენება
+ ოპერაციულ სისტემებსა, და გამოყენებით პროგრამებში, შრიფტებში,
+ ტექსტების დამუშავებასა და მრავალენოვან კომპიუტერულ სისტემებში.
+
+Russian:
+
+ From a Unicode conference invitation:
+
+ Зарегистрируйтесь сейчас на Десятую Международную Конференцию по
+ Unicode, которая состоится 10-12 марта 1997 года в Майнце в Германии.
+ Конференция соберет широкий круг экспертов по вопросам глобального
+ Интернета и Unicode, локализации и интернационализации, воплощению и
+ применению Unicode в различных операционных системах и программных
+ приложениях, шрифтах, верстке и многоязычных компьютерных системах.
+
+Thai (UCS Level 2):
+
+ Excerpt from a poetry on The Romance of The Three Kingdoms (a Chinese
+ classic 'San Gua'):
+
+ [----------------------------|------------------------]
+ ๏ แผ่นดินฮั่นเสื่อมโทรมแสนสังเวช พระปกเกศกองบู๊กู้ขึ้นใหม่
+ สิบสองกษัตริย์ก่อนหน้าแลถัดไป สององค์ไซร้โง่เขลาเบาปัญญา
+ ทรงนับถือขันทีเป็นที่พึ่ง บ้านเมืองจึงวิปริตเป็นนักหนา
+ โฮจิ๋นเรียกทัพทั่วหัวเมืองมา หมายจะฆ่ามดชั่วตัวสำคัญ
+ เหมือนขับไสไล่เสือจากเคหา รับหมาป่าเข้ามาเลยอาสัญ
+ ฝ่ายอ้องอุ้นยุแยกให้แตกกัน ใช้สาวนั้นเป็นชนวนชื่นชวนใจ
+ พลันลิฉุยกุยกีกลับก่อเหตุ ช่างอาเพศจริงหนาฟ้าร้องไห้
+ ต้องรบราฆ่าฟันจนบรรลัย ฤๅหาใครค้ำชูกู้บรรลังก์ ฯ
+
+ (The above is a two-column text. If combining characters are handled
+ correctly, the lines of the second column should be aligned with the
+ | character above.)
+
+Ethiopian:
+
+ Proverbs in the Amharic language:
+
+ ሰማይ አይታረስ ንጉሥ አይከሰስ።
+ ብላ ካለኝ እንደአባቴ በቆመጠኝ።
+ ጌጥ ያለቤቱ ቁምጥና ነው።
+ ደሀ በሕልሙ ቅቤ ባይጠጣ ንጣት በገደለው።
+ የአፍ ወለምታ በቅቤ አይታሽም።
+ አይጥ በበላ ዳዋ ተመታ።
+ ሲተረጉሙ ይደረግሙ።
+ ቀስ በቀስ፥ ዕንቁላል በእግሩ ይሄዳል።
+ ድር ቢያብር አንበሳ ያስር።
+ ሰው እንደቤቱ እንጅ እንደ ጉረቤቱ አይተዳደርም።
+ እግዜር የከፈተውን ጉሮሮ ሳይዘጋው አይድርም።
+ የጎረቤት ሌባ፥ ቢያዩት ይስቅ ባያዩት ያጠልቅ።
+ ሥራ ከመፍታት ልጄን ላፋታት።
+ ዓባይ ማደሪያ የለው፥ ግንድ ይዞ ይዞራል።
+ የእስላም አገሩ መካ የአሞራ አገሩ ዋርካ።
+ ተንጋሎ ቢተፉ ተመልሶ ባፉ።
+ ወዳጅህ ማር ቢሆን ጨርስህ አትላሰው።
+ እግርህን በፍራሽህ ልክ ዘርጋ።
+
+Runes:
+
+ ᚻᛖ ᚳᚹᚫᚦ ᚦᚫᛏ ᚻᛖ ᛒᚢᛞᛖ ᚩᚾ ᚦᚫᛗ ᛚᚪᚾᛞᛖ ᚾᚩᚱᚦᚹᛖᚪᚱᛞᚢᛗ ᚹᛁᚦ ᚦᚪ ᚹᛖᛥᚫ
+
+ (Old English, which transcribed into Latin reads 'He cwaeth that he
+ bude thaem lande northweardum with tha Westsae.' and means 'He said
+ that he lived in the northern land near the Western Sea.')
+
+Braille:
+
+ ⡌⠁⠧⠑ ⠼⠁⠒ ⡍⠜⠇⠑⠹⠰⠎ ⡣⠕⠌
+
+ ⡍⠜⠇⠑⠹ ⠺⠁⠎ ⠙⠑⠁⠙⠒ ⠞⠕ ⠃⠑⠛⠔ ⠺⠊⠹⠲ ⡹⠻⠑ ⠊⠎ ⠝⠕ ⠙⠳⠃⠞
+ ⠱⠁⠞⠑⠧⠻ ⠁⠃⠳⠞ ⠹⠁⠞⠲ ⡹⠑ ⠗⠑⠛⠊⠌⠻ ⠕⠋ ⠙⠊⠎ ⠃⠥⠗⠊⠁⠇ ⠺⠁⠎
+ ⠎⠊⠛⠝⠫ ⠃⠹ ⠹⠑ ⠊⠇⠻⠛⠹⠍⠁⠝⠂ ⠹⠑ ⠊⠇⠻⠅⠂ ⠹⠑ ⠥⠝⠙⠻⠞⠁⠅⠻⠂
+ ⠁⠝⠙ ⠹⠑ ⠡⠊⠑⠋ ⠍⠳⠗⠝⠻⠲ ⡎⠊⠗⠕⠕⠛⠑ ⠎⠊⠛⠝⠫ ⠊⠞⠲ ⡁⠝⠙
+ ⡎⠊⠗⠕⠕⠛⠑⠰⠎ ⠝⠁⠍⠑ ⠺⠁⠎ ⠛⠕⠕⠙ ⠥⠏⠕⠝ ⠰⡡⠁⠝⠛⠑⠂ ⠋⠕⠗ ⠁⠝⠹⠹⠔⠛ ⠙⠑
+ ⠡⠕⠎⠑ ⠞⠕ ⠏⠥⠞ ⠙⠊⠎ ⠙⠁⠝⠙ ⠞⠕⠲
+
+ ⡕⠇⠙ ⡍⠜⠇⠑⠹ ⠺⠁⠎ ⠁⠎ ⠙⠑⠁⠙ ⠁⠎ ⠁ ⠙⠕⠕⠗⠤⠝⠁⠊⠇⠲
+
+ ⡍⠔⠙⠖ ⡊ ⠙⠕⠝⠰⠞ ⠍⠑⠁⠝ ⠞⠕ ⠎⠁⠹ ⠹⠁⠞ ⡊ ⠅⠝⠪⠂ ⠕⠋ ⠍⠹
+ ⠪⠝ ⠅⠝⠪⠇⠫⠛⠑⠂ ⠱⠁⠞ ⠹⠻⠑ ⠊⠎ ⠏⠜⠞⠊⠊⠥⠇⠜⠇⠹ ⠙⠑⠁⠙ ⠁⠃⠳⠞
+ ⠁ ⠙⠕⠕⠗⠤⠝⠁⠊⠇⠲ ⡊ ⠍⠊⠣⠞ ⠙⠁⠧⠑ ⠃⠑⠲ ⠔⠊⠇⠔⠫⠂ ⠍⠹⠎⠑⠇⠋⠂ ⠞⠕
+ ⠗⠑⠛⠜⠙ ⠁ ⠊⠕⠋⠋⠔⠤⠝⠁⠊⠇ ⠁⠎ ⠹⠑ ⠙⠑⠁⠙⠑⠌ ⠏⠊⠑⠊⠑ ⠕⠋ ⠊⠗⠕⠝⠍⠕⠝⠛⠻⠹
+ ⠔ ⠹⠑ ⠞⠗⠁⠙⠑⠲ ⡃⠥⠞ ⠹⠑ ⠺⠊⠎⠙⠕⠍ ⠕⠋ ⠳⠗ ⠁⠝⠊⠑⠌⠕⠗⠎
+ ⠊⠎ ⠔ ⠹⠑ ⠎⠊⠍⠊⠇⠑⠆ ⠁⠝⠙ ⠍⠹ ⠥⠝⠙⠁⠇⠇⠪⠫ ⠙⠁⠝⠙⠎
+ ⠩⠁⠇⠇ ⠝⠕⠞ ⠙⠊⠌⠥⠗⠃ ⠊⠞⠂ ⠕⠗ ⠹⠑ ⡊⠳⠝⠞⠗⠹⠰⠎ ⠙⠕⠝⠑ ⠋⠕⠗⠲ ⡹⠳
+ ⠺⠊⠇⠇ ⠹⠻⠑⠋⠕⠗⠑ ⠏⠻⠍⠊⠞ ⠍⠑ ⠞⠕ ⠗⠑⠏⠑⠁⠞⠂ ⠑⠍⠏⠙⠁⠞⠊⠊⠁⠇⠇⠹⠂ ⠹⠁⠞
+ ⡍⠜⠇⠑⠹ ⠺⠁⠎ ⠁⠎ ⠙⠑⠁⠙ ⠁⠎ ⠁ ⠙⠕⠕⠗⠤⠝⠁⠊⠇⠲
+
+ (The first couple of paragraphs of "A Christmas Carol" by Dickens)
+
+Compact font selection example text:
+
+ ABCDEFGHIJKLMNOPQRSTUVWXYZ /0123456789
+ abcdefghijklmnopqrstuvwxyz £©µÀÆÖÞßéöÿ
+ –—‘“”„†•…‰™œŠŸž€ ΑΒΓΔΩαβγδω АБВГДабвгд
+ ∀∂∈ℝ∧∪≡∞ ↑↗↨↻⇣ ┐┼╔╘░►☺♀ fi�⑀₂ἠḂӥẄɐː⍎אԱა
+
+Greetings in various languages:
+
+ Hello world, Καλημέρα κόσμε, コンニチハ
+
+Box drawing alignment tests: █
+ ▉
+ ╔══╦══╗ ┌──┬──┐ ╭──┬──╮ ╭──┬──╮ ┏━━┳━━┓ ┎┒┏┑ ╷ ╻ ┏┯┓ ┌┰┐ ▊ ╱╲╱╲╳╳╳
+ ║┌─╨─┐║ │╔═╧═╗│ │╒═╪═╕│ │╓─╁─╖│ ┃┌─╂─┐┃ ┗╃╄┙ ╶┼╴╺╋╸┠┼┨ ┝╋┥ ▋ ╲╱╲╱╳╳╳
+ ║│╲ ╱│║ │║ ║│ ││ │ ││ │║ ┃ ║│ ┃│ ╿ │┃ ┍╅╆┓ ╵ ╹ ┗┷┛ └┸┘ ▌ ╱╲╱╲╳╳╳
+ ╠╡ ╳ ╞╣ ├╢ ╟┤ ├┼─┼─┼┤ ├╫─╂─╫┤ ┣┿╾┼╼┿┫ ┕┛┖┚ ┌┄┄┐ ╎ ┏┅┅┓ ┋ ▍ ╲╱╲╱╳╳╳
+ ║│╱ ╲│║ │║ ║│ ││ │ ││ │║ ┃ ║│ ┃│ ╽ │┃ ░░▒▒▓▓██ ┊ ┆ ╎ ╏ ┇ ┋ ▎
+ ║└─╥─┘║ │╚═╤═╝│ │╘═╪═╛│ │╙─╀─╜│ ┃└─╂─┘┃ ░░▒▒▓▓██ ┊ ┆ ╎ ╏ ┇ ┋ ▏
+ ╚══╩══╝ └──┴──┘ ╰──┴──╯ ╰──┴──╯ ┗━━┻━━┛ ▗▄▖▛▀▜ └╌╌┘ ╎ ┗╍╍┛ ┋ ▁▂▃▄▅▆▇█
+ ▝▀▘▙▄▟
--- /dev/null
+#include <stdio.h>
+#include <string.h>
+#include <glib.h>
+#include "test.h"
+
+/* example from glib documentation */
+RESULT
+test_array_big ()
+{
+ GArray *garray;
+ gint i;
+
+ /* We create a new array to store gint values.
+ We don't want it zero-terminated or cleared to 0's. */
+ garray = g_array_new (FALSE, FALSE, sizeof (gint));
+ for (i = 0; i < 10000; i++)
+ g_array_append_val (garray, i);
+
+ for (i = 0; i < 10000; i++)
+ if (g_array_index (garray, gint, i) != i)
+ return FAILED ("array value didn't match");
+
+ g_array_free (garray, TRUE);
+
+ return NULL;
+}
+
+RESULT
+test_array_index ()
+{
+ GArray *array = g_array_new (FALSE, FALSE, sizeof (int));
+ int v;
+
+ v = 27;
+ g_array_append_val (array, v);
+
+ if (27 != g_array_index (array, int, 0))
+ return FAILED ("");
+
+ g_array_free (array, TRUE);
+
+ return NULL;
+}
+
+RESULT
+test_array_append_zero_terminated ()
+{
+ GArray *array = g_array_new (TRUE, FALSE, sizeof (int));
+ int v;
+
+ v = 27;
+ g_array_append_val (array, v);
+
+ if (27 != g_array_index (array, int, 0))
+ return FAILED ("g_array_append_val failed");
+
+ if (0 != g_array_index (array, int, 1))
+ return FAILED ("zero_terminated didn't append a zero element");
+
+ g_array_free (array, TRUE);
+
+ return NULL;
+}
+
+RESULT
+test_array_append ()
+{
+ GArray *array = g_array_new (FALSE, FALSE, sizeof (int));
+ int v;
+
+ if (0 != array->len)
+ return FAILED ("initial array length not zero");
+
+ v = 27;
+
+ g_array_append_val (array, v);
+
+ if (1 != array->len)
+ return FAILED ("array append failed");
+
+ g_array_free (array, TRUE);
+
+ return NULL;
+}
+
+RESULT
+test_array_insert_val ()
+{
+ GArray *array = g_array_new (FALSE, FALSE, sizeof (gpointer));
+ gpointer ptr0, ptr1, ptr2, ptr3;
+
+ g_array_insert_val (array, 0, array);
+
+ if (array != g_array_index (array, gpointer, 0))
+ return FAILED ("1 The value in the array is incorrect");
+
+ g_array_insert_val (array, 1, array);
+ if (array != g_array_index (array, gpointer, 1))
+ return FAILED ("2 The value in the array is incorrect");
+
+ g_array_insert_val (array, 2, array);
+ if (array != g_array_index (array, gpointer, 2))
+ return FAILED ("3 The value in the array is incorrect");
+
+ g_array_free (array, TRUE);
+ array = g_array_new (FALSE, FALSE, sizeof (gpointer));
+ ptr0 = array;
+ ptr1 = array + 1;
+ ptr2 = array + 2;
+ ptr3 = array + 3;
+
+ g_array_insert_val (array, 0, ptr0);
+ g_array_insert_val (array, 1, ptr1);
+ g_array_insert_val (array, 2, ptr2);
+ g_array_insert_val (array, 1, ptr3);
+ if (ptr0 != g_array_index (array, gpointer, 0))
+ return FAILED ("4 The value in the array is incorrect");
+ if (ptr3 != g_array_index (array, gpointer, 1))
+ return FAILED ("5 The value in the array is incorrect");
+ if (ptr1 != g_array_index (array, gpointer, 2))
+ return FAILED ("6 The value in the array is incorrect");
+ if (ptr2 != g_array_index (array, gpointer, 3))
+ return FAILED ("7 The value in the array is incorrect");
+
+ g_array_free (array, TRUE);
+ return NULL;
+}
+
+RESULT
+test_array_remove ()
+{
+ GArray *array = g_array_new (FALSE, FALSE, sizeof (int));
+ int v[] = {30, 29, 28, 27, 26, 25};
+
+ g_array_append_vals (array, v, 6);
+
+ if (6 != array->len)
+ return FAILED ("append_vals fail");
+
+ g_array_remove_index (array, 3);
+
+ if (5 != array->len)
+ return FAILED ("remove_index failed to update length");
+
+ if (26 != g_array_index (array, int, 3))
+ return FAILED ("remove_index failed to update the array");
+
+ g_array_free (array, TRUE);
+
+ return NULL;
+}
+
+static Test array_tests [] = {
+ {"big", test_array_big},
+ {"append", test_array_append},
+ {"insert_val", test_array_insert_val},
+ {"index", test_array_index},
+ {"remove", test_array_remove},
+ {"append_zero_term", test_array_append_zero_terminated},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(array_tests_init, array_tests)
--- /dev/null
+#include <config.h>
+#include <glib.h>
+#include <string.h>
+#include <stdio.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef G_OS_UNIX
+#include <pthread.h>
+#endif
+#include "test.h"
+
+/* This test is just to be used with valgrind */
+RESULT
+test_dir ()
+{
+ GDir *dir;
+ GError *error;
+ const gchar *name;
+
+ /*
+ dir = g_dir_open (NULL, 0, NULL);
+ */
+ dir = g_dir_open ("", 0, NULL);
+ if (dir != NULL)
+ return FAILED ("1 Should be an error");
+
+ dir = g_dir_open ("", 9, NULL);
+ if (dir != NULL)
+ return FAILED ("2 Should be an error");
+
+ error = NULL;
+ dir = g_dir_open (".ljasdslakjd", 9, &error);
+ if (dir != NULL)
+ return FAILED ("3 opendir should fail");
+ if (error == NULL)
+ return FAILED ("4 got no error");
+ g_error_free (error);
+ error = NULL;
+ dir = g_dir_open (g_get_tmp_dir (), 9, &error);
+ if (dir == NULL)
+ return FAILED ("5 opendir should succeed");
+ if (error != NULL)
+ return FAILED ("6 got an error");
+ name = NULL;
+ name = g_dir_read_name (dir);
+ if (name == NULL)
+ return FAILED ("7 didn't read a file name");
+ while ((name = g_dir_read_name (dir)) != NULL) {
+ if (strcmp (name, ".") == 0)
+ return FAILED (". directory found");
+ if (strcmp (name, "..") == 0)
+ return FAILED (".. directory found");
+ }
+ g_dir_close (dir);
+ return OK;
+}
+
+static Test dir_tests [] = {
+ {"g_dir_*", test_dir},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(dir_tests_init, dir_tests)
+
+
--- /dev/null
+/*
+ * EGLib Unit Test Driver
+ *
+ * Author:
+ * Aaron Bockover (abockover@novell.com)
+ *
+ * (C) 2006 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.
+ */
+
+#include <config.h>
+#include "test.h"
+
+#ifndef DRIVER_EXTERNAL_TESTS
+#include "tests.h"
+#endif
+
+#include <stdio.h>
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif
+
+#if defined(HAVE_UNISTD_H)
+#include <unistd.h>
+#endif
+
+#ifndef DRIVER_NAME
+#define DRIVER_NAME "EGlib"
+#endif
+
+typedef struct _StringArray {
+ gchar **strings;
+ gint length;
+} StringArray;
+
+static StringArray *
+string_array_append(StringArray *array, gchar *string)
+{
+ if(array == NULL) {
+ array = g_new0(StringArray, 1);
+ array->length = 1;
+ array->strings = g_malloc(sizeof(gchar *) * 2);
+ } else {
+ array->length++;
+ array->strings = g_realloc(array->strings, sizeof(gchar *)
+ * (array->length + 1));
+ }
+
+ array->strings[array->length - 1] = string;
+ array->strings[array->length] = NULL;
+
+ return array;
+}
+
+gint global_passed = 0, global_tests = 0;
+
+static void
+string_array_free(StringArray *array)
+{
+ g_free(array->strings);
+ g_free(array);
+}
+
+static void print_help(char *s)
+{
+ gint i;
+
+ printf("Usage: %s [OPTION]... [TESTGROUP]...\n\n", s);
+ printf("OPTIONS are:\n");
+ printf(" -h, --help show this help\n");
+ printf(" -t, --time time the tests\n");
+ printf(" -i, --iterations number of times to run tests\n");
+ printf(" -q, --quiet do not print test results; "
+ "final time always prints\n");
+ printf(" -n, --no-labels print final time without labels, "
+ "nice for scripts\n");
+ printf(" -d, --debug do not run tests, "
+ "debug the driver itself for valgrind\n\n");
+ printf("TESTGROUPS available:\n");
+
+ for(i = 0; test_groups[i].name != NULL; i++) {
+ if(test_groups[i].handler != fake_tests_init) {
+ printf(" %s\n", test_groups[i].name);
+ }
+ }
+
+ printf("\n");
+}
+
+#ifdef DRIVER_EXTERNAL_MAIN
+gint run_tests_main(gint argc, gchar **argv)
+#else
+gint main(gint argc, gchar **argv)
+#endif
+{
+ gint i, j, c, iterations = 1;
+ StringArray *tests_to_run = NULL;
+ gdouble time_start;
+ gboolean report_time = FALSE;
+ gboolean quiet = FALSE;
+ gboolean global_failure = FALSE;
+ gboolean no_final_time_labels = FALSE;
+ gboolean debug = FALSE;
+
+#if HAVE_GETOPT_H
+ static struct option long_options [] = {
+ {"help", no_argument, 0, 'h'},
+ {"time", no_argument, 0, 't'},
+ {"quiet", no_argument, 0, 'q'},
+ {"iterations", required_argument, 0, 'i'},
+ {"debug", no_argument, 0, 'd'},
+ {"no-labels", no_argument, 0, 'n'},
+ {0, 0, 0, 0}
+ };
+
+ while((c = getopt_long(argc, argv, "dhtqni:", long_options, NULL)) != -1) { switch(c) {
+ case 'h':
+ print_help(argv[0]);
+ return 1;
+ case 't':
+ report_time = TRUE;
+ break;
+ case 'i':
+ iterations = atoi(optarg);
+ break;
+ case 'q':
+ quiet = TRUE;
+ break;
+ case 'n':
+ no_final_time_labels = TRUE;
+ break;
+ case 'd':
+ debug = TRUE;
+ break;
+ }
+ }
+
+ for(i = optind; i < argc; i++) {
+ if(argv[i][0] == '-') {
+ continue;
+ }
+
+ tests_to_run = string_array_append(tests_to_run, argv[i]);
+ }
+#endif
+
+ time_start = get_timestamp();
+
+ for(j = 0; test_groups[j].name != NULL; j++) {
+ gboolean run = TRUE;
+ gchar *tests = NULL;
+ gchar *group = NULL;
+
+ if(tests_to_run != NULL) {
+ gint k;
+ run = FALSE;
+
+ for(k = 0; k < tests_to_run->length; k++) {
+ gchar *user = tests_to_run->strings[k];
+ const gchar *table = test_groups[j].name;
+ size_t user_len = strlen(user);
+ size_t table_len = strlen(table);
+
+ if(strncmp(user, table, table_len) == 0) {
+ if(user_len > table_len && user[table_len] != ':') {
+ break;
+ }
+
+ run = TRUE;
+ group = tests_to_run->strings[k];
+ break;
+ }
+ }
+ }
+
+ if(run) {
+ gboolean passed;
+ gchar **split = NULL;
+
+ if(debug && test_groups[j].handler != fake_tests_init) {
+ printf("Skipping %s, in driver debug mode\n",
+ test_groups[j].name);
+ continue;
+ } else if(!debug && test_groups[j].handler == fake_tests_init) {
+ continue;
+ }
+
+ if(group != NULL) {
+ split = eg_strsplit(group, ":", -1);
+ if(split != NULL) {
+ gint m;
+ for(m = 0; split[m] != NULL; m++) {
+ if(m == 1) {
+ tests = strdup(split[m]);
+ break;
+ }
+ }
+ eg_strfreev(split);
+ }
+ }
+
+ passed = run_group(&(test_groups[j]),
+ iterations, quiet, report_time, tests);
+
+ if(tests != NULL) {
+ g_free(tests);
+ }
+
+ if(!passed && !global_failure) {
+ global_failure = TRUE;
+ }
+ }
+ }
+
+ if(!quiet) {
+ gdouble pass_percentage = ((gdouble)global_passed / (gdouble)global_tests) * 100.0;
+ printf("=============================\n");
+ printf("Overall result: %s : %d / %d (%g%%)\n", global_failure ? "FAILED" : "OK", global_passed, global_tests, pass_percentage);
+ }
+
+ if(report_time) {
+ gdouble duration = get_timestamp() - time_start;
+ if(no_final_time_labels) {
+ printf("%g\n", duration);
+ } else {
+ printf("%s Total Time: %g\n", DRIVER_NAME, duration);
+ }
+ }
+
+ if(tests_to_run != NULL) {
+ string_array_free(tests_to_run);
+ }
+
+ return global_tests - global_passed;
+}
+
+
--- /dev/null
+#include "test.h"
+
+RESULT
+test_swap ()
+{
+ guint32 a = 0xabcdef01, res32;
+ guint64 b = (((guint64)a) << 32) | a, res64;
+ guint64 b_expect = (((guint64)0x1efcdab) << 32) | 0x01efcdab;
+ guint16 c = 0xabcd, res16;
+
+ res32 = GUINT32_SWAP_LE_BE (a);
+ if (res32 != 0x01efcdab)
+ return FAILED ("GUINT32_SWAP_LE_BE returned 0x%x", res32);
+ res32 = GUINT32_SWAP_LE_BE (1);
+ if (res32 != 0x1000000)
+ return FAILED ("GUINT32_SWAP_LE_BE returned 0x%x", res32);
+
+ res64 = GUINT64_SWAP_LE_BE(b);
+ if (res64 != b_expect)
+ return FAILED ("GUINT64_SWAP_LE_BE returned 0x%llx (had=0x%llx)", res64, b);
+ res16 = GUINT16_SWAP_LE_BE(c);
+ if (res16 != 0xcdab)
+ return FAILED ("GUINT16_SWAP_LE_BE returned 0x%x", (guint32) res16);
+
+ return OK;
+}
+
+/*
+ * test initialization
+ */
+
+static Test endian_tests [] = {
+ {"swap", test_swap},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(endian_tests_init, endian_tests)
+
--- /dev/null
+/*
+ * Fake test allows debugging of the driver itself
+ */
+
+#include "test.h"
+
+RESULT
+test_fake()
+{
+ return OK;
+}
+
+static Test fake_tests [] = {
+ {"fake", test_fake},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(fake_tests_init, fake_tests)
+
--- /dev/null
+#include <config.h>
+#include <glib.h>
+#include <string.h>
+#include <stdlib.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <stdio.h>
+#include "test.h"
+
+#ifdef G_OS_WIN32
+#include <io.h>
+#define close _close
+#endif
+
+RESULT
+test_file_get_contents ()
+{
+ GError *error;
+ gchar *content;
+ gboolean ret;
+ gsize length;
+#ifdef G_OS_WIN32
+ const gchar *filename = "c:\\Windows\\system.ini";
+#else
+ const gchar *filename = "/etc/hosts";
+#endif
+
+ /*
+ filename != NULL
+ ret = g_file_get_contents (NULL, NULL, NULL, NULL);
+ contents != NULL
+ ret = g_file_get_contents ("", NULL, NULL, NULL);
+ error no such file and fails for 'error' not being null too
+ ret = g_file_get_contents ("", &content, NULL, &error);
+ */
+
+ error = NULL;
+ ret = g_file_get_contents ("", &content, NULL, &error);
+ if (ret)
+ return FAILED ("HAH!");
+ if (error == NULL)
+ return FAILED ("Got nothing as error.");
+ if (content != NULL)
+ return FAILED ("Content is uninitialized");
+
+ g_error_free (error);
+ error = NULL;
+ ret = g_file_get_contents (filename, &content, &length, &error);
+ if (!ret)
+ return FAILED ("The error is %d %s\n", error->code, error->message);
+ if (error != NULL)
+ return FAILED ("Got an error returning TRUE");
+ if (content == NULL)
+ return FAILED ("Content is NULL");
+ if (strlen (content) != length)
+ return FAILED ("length is %d but the string is %d", length, strlen (content));
+ g_free (content);
+
+ return OK;
+}
+
+RESULT
+test_open_tmp ()
+{
+ GError *error;
+ gint fd;
+ gchar *name = GINT_TO_POINTER (-1);
+
+ /*
+ * Okay, this works, but creates a .xxx file in /tmp on every run. Disabled.
+ * fd = g_file_open_tmp (NULL, NULL, NULL);
+ * if (fd < 0)
+ * return FAILED ("Default failed.");
+ * close (fd);
+ */
+ error = NULL;
+ fd = g_file_open_tmp ("invalidtemplate", NULL, &error);
+ if (fd != -1)
+ return FAILED ("The template was invalid and accepted");
+ if (error == NULL)
+ return FAILED ("No error returned.");
+ g_error_free (error);
+
+ error = NULL;
+ fd = g_file_open_tmp ("i/nvalidtemplate", &name, &error);
+ if (fd != -1)
+ return FAILED ("The template was invalid and accepted");
+ if (error == NULL)
+ return FAILED ("No error returned.");
+ if (name == NULL)
+ return FAILED ("'name' is not reset");
+ g_error_free (error);
+
+ error = NULL;
+ fd = g_file_open_tmp ("valid-XXXXXX", &name, &error);
+ if (fd == -1)
+ return FAILED ("This should be valid");
+ if (error != NULL)
+ return FAILED ("No error returned.");
+ if (name == NULL)
+ return FAILED ("No name returned.");
+ close (fd);
+ unlink (name);
+ g_free (name);
+ return OK;
+}
+
+RESULT
+test_file ()
+{
+ gboolean res;
+ const gchar *tmp;
+ gchar *path;
+
+#ifndef G_OS_WIN32 /* FIXME */
+ gchar *sympath;
+ gint ignored G_GNUC_UNUSED;
+#endif
+
+ res = g_file_test (NULL, 0);
+ if (res)
+ return FAILED ("Should return FALSE HERE");
+
+ res = g_file_test ("file.c", 0);
+ if (res)
+ return FAILED ("Should return FALSE HERE");
+
+ tmp = g_get_tmp_dir ();
+ res = g_file_test (tmp, G_FILE_TEST_EXISTS);
+ if (!res)
+ return FAILED ("tmp does not exist.");
+ res = g_file_test (tmp, G_FILE_TEST_IS_REGULAR);
+ if (res)
+ return FAILED ("tmp is regular");
+
+ res = g_file_test (tmp, G_FILE_TEST_IS_DIR);
+ if (!res)
+ return FAILED ("tmp is not a directory");
+ res = g_file_test (tmp, G_FILE_TEST_IS_EXECUTABLE);
+ if (!res)
+ return FAILED ("tmp is not a executable");
+
+ res = g_file_test (tmp, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_SYMLINK);
+ if (!res)
+ return FAILED ("2 tmp does not exist.");
+ res = g_file_test (tmp, G_FILE_TEST_IS_REGULAR | G_FILE_TEST_IS_SYMLINK);
+ if (res)
+ return FAILED ("2 tmp is regular");
+
+ res = g_file_test (tmp, G_FILE_TEST_IS_DIR | G_FILE_TEST_IS_SYMLINK);
+ if (!res)
+ return FAILED ("2 tmp is not a directory");
+ res = g_file_test (tmp, G_FILE_TEST_IS_EXECUTABLE | G_FILE_TEST_IS_SYMLINK);
+ if (!res)
+ return FAILED ("2 tmp is not a executable");
+
+ close (g_file_open_tmp (NULL, &path, NULL)); /* create an empty file */
+ res = g_file_test (path, G_FILE_TEST_EXISTS);
+ if (!res)
+ return FAILED ("3 %s should exist", path);
+ res = g_file_test (path, G_FILE_TEST_IS_REGULAR);
+ /* This is strange. Empty file is reported as not existing! */
+ if (!res)
+ return FAILED ("3 %s IS_REGULAR", path);
+ res = g_file_test (path, G_FILE_TEST_IS_DIR);
+ if (res)
+ return FAILED ("3 %s should not be a directory", path);
+ res = g_file_test (path, G_FILE_TEST_IS_EXECUTABLE);
+ if (res)
+ return FAILED ("3 %s should not be executable", path);
+ res = g_file_test (path, G_FILE_TEST_IS_SYMLINK);
+ if (res)
+ return FAILED ("3 %s should not be a symlink", path);
+
+#ifndef G_OS_WIN32 /* FIXME */
+ sympath = g_strconcat (path, "-link", NULL);
+ ignored = symlink (path, sympath);
+ res = g_file_test (sympath, G_FILE_TEST_EXISTS);
+ if (!res)
+ return FAILED ("4 %s should not exist", sympath);
+ res = g_file_test (sympath, G_FILE_TEST_IS_REGULAR);
+ if (!res)
+ return FAILED ("4 %s should not be a regular file", sympath);
+ res = g_file_test (sympath, G_FILE_TEST_IS_DIR);
+ if (res)
+ return FAILED ("4 %s should not be a directory", sympath);
+ res = g_file_test (sympath, G_FILE_TEST_IS_EXECUTABLE);
+ if (res)
+ return FAILED ("4 %s should not be executable", sympath);
+ res = g_file_test (sympath, G_FILE_TEST_IS_SYMLINK);
+ if (!res)
+ return FAILED ("4 %s should be a symlink", sympath);
+
+ unlink (path);
+
+ res = g_file_test (sympath, G_FILE_TEST_EXISTS);
+ if (res)
+ return FAILED ("5 %s should exist", sympath);
+ res = g_file_test (sympath, G_FILE_TEST_IS_REGULAR);
+ if (res)
+ return FAILED ("5 %s should be a regular file", sympath);
+ res = g_file_test (sympath, G_FILE_TEST_IS_DIR);
+ if (res)
+ return FAILED ("5 %s should not be a directory", sympath);
+ res = g_file_test (sympath, G_FILE_TEST_IS_EXECUTABLE);
+ if (res)
+ return FAILED ("5 %s should not be executable", sympath);
+ res = g_file_test (sympath, G_FILE_TEST_IS_SYMLINK);
+ if (!res)
+ return FAILED ("5 %s should be a symlink", sympath);
+ unlink (sympath);
+ g_free (sympath);
+#endif
+ g_free (path);
+ return OK;
+}
+
+static Test file_tests [] = {
+ {"g_file_get_contents", test_file_get_contents},
+ {"g_file_open_tmp", test_open_tmp},
+ {"g_file_test", test_file},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(file_tests_init, file_tests)
+
+
--- /dev/null
+#include <stdio.h>
+#include <string.h>
+#include <glib.h>
+#include "test.h"
+
+int foreach_count = 0;
+int foreach_fail = 0;
+
+void foreach (gpointer key, gpointer value, gpointer user_data)
+{
+ foreach_count++;
+ if (GPOINTER_TO_INT (user_data) != 'a')
+ foreach_fail = 1;
+}
+
+RESULT hash_t1 (void)
+{
+ GHashTable *t = g_hash_table_new (g_str_hash, g_str_equal);
+
+ foreach_count = 0;
+ foreach_fail = 0;
+ g_hash_table_insert (t, "hello", "world");
+ g_hash_table_insert (t, "my", "god");
+
+ g_hash_table_foreach (t, foreach, GINT_TO_POINTER('a'));
+ if (foreach_count != 2)
+ return FAILED ("did not find all keys, got %d expected 2", foreach_count);
+ if (foreach_fail)
+ return FAILED("failed to pass the user-data to foreach");
+
+ if (!g_hash_table_remove (t, "my"))
+ return FAILED ("did not find known key");
+ if (g_hash_table_size (t) != 1)
+ return FAILED ("unexpected size");
+ g_hash_table_insert(t, "hello", "moon");
+ if (strcmp (g_hash_table_lookup (t, "hello"), "moon") != 0)
+ return FAILED ("did not replace world with moon");
+
+ if (!g_hash_table_remove (t, "hello"))
+ return FAILED ("did not find known key");
+ if (g_hash_table_size (t) != 0)
+ return FAILED ("unexpected size");
+ g_hash_table_destroy (t);
+
+ return OK;
+}
+
+RESULT hash_t2 (void)
+{
+ return OK;
+}
+
+RESULT hash_default (void)
+{
+ GHashTable *hash = g_hash_table_new (NULL, NULL);
+
+ if (hash == NULL)
+ return FAILED ("g_hash_table_new should return a valid hash");
+
+ g_hash_table_destroy (hash);
+ return NULL;
+}
+
+RESULT
+hash_null_lookup (void)
+{
+ GHashTable *hash = g_hash_table_new (NULL, NULL);
+ gpointer ok, ov;
+
+ g_hash_table_insert (hash, NULL, GINT_TO_POINTER (1));
+ g_hash_table_insert (hash, GINT_TO_POINTER(1), GINT_TO_POINTER(2));
+
+ if (!g_hash_table_lookup_extended (hash, NULL, &ok, &ov))
+ return FAILED ("Did not find the NULL");
+ if (ok != NULL)
+ return FAILED ("Incorrect key found");
+ if (ov != GINT_TO_POINTER (1))
+ return FAILED ("Got wrong value %p\n", ov);
+
+ if (!g_hash_table_lookup_extended (hash, GINT_TO_POINTER(1), &ok, &ov))
+ return FAILED ("Did not find the 1");
+ if (ok != GINT_TO_POINTER(1))
+ return FAILED ("Incorrect key found");
+ if (ov != GINT_TO_POINTER (2))
+ return FAILED ("Got wrong value %p\n", ov);
+
+ g_hash_table_destroy (hash);
+
+ return NULL;
+}
+
+static void
+counter (gpointer key, gpointer value, gpointer user_data)
+{
+ int *counter = (int *) user_data;
+
+ (*counter)++;
+}
+
+RESULT hash_grow (void)
+{
+ GHashTable *hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+ int i, count = 0;
+
+ for (i = 0; i < 1000; i++)
+ g_hash_table_insert (hash, g_strdup_printf ("%d", i), g_strdup_printf ("x-%d", i));
+
+ for (i = 0; i < 1000; i++){
+ char buffer [30];
+ gpointer value;
+
+ sprintf (buffer, "%d", i);
+
+ value = g_hash_table_lookup (hash, buffer);
+ sprintf (buffer, "x-%d", i);
+ if (strcmp (value, buffer) != 0){
+ return FAILED ("Failed to lookup the key %d, the value was %s\n", i, value);
+ }
+ }
+
+ if (g_hash_table_size (hash) != 1000)
+ return FAILED ("Did not find 1000 elements on the hash, found %d\n", g_hash_table_size (hash));
+
+ /* Now do the manual count, lets not trust the internals */
+ g_hash_table_foreach (hash, counter, &count);
+ if (count != 1000){
+ return FAILED ("Foreach count is not 1000");
+ }
+
+ g_hash_table_destroy (hash);
+ return NULL;
+}
+
+RESULT hash_iter (void)
+{
+#if !defined(GLIB_MAJOR_VERSION) || GLIB_CHECK_VERSION(2, 16, 0)
+ GHashTable *hash = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, NULL);
+ GHashTableIter iter;
+ int i, sum, keys_sum, values_sum;
+ gpointer key, value;
+
+ sum = 0;
+ for (i = 0; i < 1000; i++) {
+ sum += i;
+ g_hash_table_insert (hash, GUINT_TO_POINTER (i), GUINT_TO_POINTER (i));
+ }
+
+ keys_sum = values_sum = 0;
+ g_hash_table_iter_init (&iter, hash);
+ while (g_hash_table_iter_next (&iter, &key, &value)) {
+ if (key != value)
+ return FAILED ("key != value");
+ keys_sum += GPOINTER_TO_UINT (key);
+ values_sum += GPOINTER_TO_UINT (value);
+ }
+ if (keys_sum != sum || values_sum != sum)
+ return FAILED ("Did not find all key-value pairs");
+ g_hash_table_destroy (hash);
+ return NULL;
+#else
+ /* GHashTableIter was added in glib 2.16 */
+ return NULL;
+#endif
+}
+
+static Test hashtable_tests [] = {
+ {"t1", hash_t1},
+ {"t2", hash_t2},
+ {"grow", hash_grow},
+ {"default", hash_default},
+ {"null_lookup", hash_null_lookup},
+ {"iter", hash_iter},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(hashtable_tests_init, hashtable_tests)
+
--- /dev/null
+#include <stdio.h>
+#include <string.h>
+#include <glib.h>
+#include "test.h"
+
+RESULT
+test_list_length ()
+{
+ GList *list = g_list_prepend (NULL, "foo");
+
+ if (g_list_length (list) != 1)
+ return FAILED ("length failed. #1");
+
+ list = g_list_prepend (list, "bar");
+ if (g_list_length (list) != 2)
+ return FAILED ("length failed. #2");
+
+ list = g_list_append (list, "bar");
+ if (g_list_length (list) != 3)
+ return FAILED ("length failed. #3");
+
+ g_list_free (list);
+ return NULL;
+}
+
+RESULT
+test_list_nth ()
+{
+ char *foo = "foo";
+ char *bar = "bar";
+ char *baz = "baz";
+ GList *nth, *list;
+ list = g_list_prepend (NULL, baz);
+ list = g_list_prepend (list, bar);
+ list = g_list_prepend (list, foo);
+
+ nth = g_list_nth (list, 0);
+ if (nth->data != foo)
+ return FAILED ("nth failed. #0");
+
+ nth = g_list_nth (list, 1);
+ if (nth->data != bar)
+ return FAILED ("nth failed. #1");
+
+ nth = g_list_nth (list, 2);
+ if (nth->data != baz)
+ return FAILED ("nth failed. #2");
+
+ nth = g_list_nth (list, 3);
+ if (nth)
+ return FAILED ("nth failed. #3: %s", nth->data);
+
+ g_list_free (list);
+ return OK;
+}
+
+RESULT
+test_list_index ()
+{
+ int i;
+ char *foo = "foo";
+ char *bar = "bar";
+ char *baz = "baz";
+ GList *list;
+ list = g_list_prepend (NULL, baz);
+ list = g_list_prepend (list, bar);
+ list = g_list_prepend (list, foo);
+
+ i = g_list_index (list, foo);
+ if (i != 0)
+ return FAILED ("index failed. #0: %d", i);
+
+ i = g_list_index (list, bar);
+ if (i != 1)
+ return FAILED ("index failed. #1: %d", i);
+
+ i = g_list_index (list, baz);
+ if (i != 2)
+ return FAILED ("index failed. #2: %d", i);
+
+ g_list_free (list);
+ return OK;
+}
+
+RESULT
+test_list_append ()
+{
+ GList *list = g_list_prepend (NULL, "first");
+ if (g_list_length (list) != 1)
+ return FAILED ("Prepend failed");
+
+ list = g_list_append (list, "second");
+
+ if (g_list_length (list) != 2)
+ return FAILED ("Append failed");
+
+ g_list_free (list);
+ return OK;
+}
+
+RESULT
+test_list_last ()
+{
+ GList *foo = g_list_prepend (NULL, "foo");
+ GList *bar = g_list_prepend (NULL, "bar");
+ GList *last;
+
+ foo = g_list_concat (foo, bar);
+ last = g_list_last (foo);
+
+ if (last != bar)
+ return FAILED ("last failed. #1");
+
+ foo = g_list_concat (foo, g_list_prepend (NULL, "baz"));
+ foo = g_list_concat (foo, g_list_prepend (NULL, "quux"));
+
+ last = g_list_last (foo);
+ if (strcmp ("quux", last->data))
+ return FAILED ("last failed. #2");
+
+ g_list_free (foo);
+
+ return OK;
+}
+
+RESULT
+test_list_concat ()
+{
+ GList *foo = g_list_prepend (NULL, "foo");
+ GList *bar = g_list_prepend (NULL, "bar");
+ GList *list = g_list_concat (foo, bar);
+
+ if (g_list_length (list) != 2)
+ return FAILED ("Concat failed. #1");
+
+ if (strcmp (list->data, "foo"))
+ return FAILED ("Concat failed. #2");
+
+ if (strcmp (list->next->data, "bar"))
+ return FAILED ("Concat failed. #3");
+
+ if (g_list_first (list) != foo)
+ return FAILED ("Concat failed. #4");
+
+ if (g_list_last (list) != bar)
+ return FAILED ("Concat failed. #5");
+
+ g_list_free (list);
+
+ return OK;
+}
+
+
+static gint
+compare (gconstpointer a, gconstpointer b)
+{
+ char *foo = (char *) a;
+ char *bar = (char *) b;
+
+ if (strlen (foo) < strlen (bar))
+ return -1;
+
+ return 1;
+}
+
+RESULT
+test_list_insert_sorted ()
+{
+ GList *list = g_list_prepend (NULL, "a");
+ list = g_list_append (list, "aaa");
+
+ /* insert at the middle */
+ list = g_list_insert_sorted (list, "aa", compare);
+ if (strcmp ("aa", list->next->data))
+ return FAILED ("insert_sorted failed. #1");
+
+ /* insert at the beginning */
+ list = g_list_insert_sorted (list, "", compare);
+ if (strcmp ("", list->data))
+ return FAILED ("insert_sorted failed. #2");
+
+ /* insert at the end */
+ list = g_list_insert_sorted (list, "aaaa", compare);
+ if (strcmp ("aaaa", g_list_last (list)->data))
+ return FAILED ("insert_sorted failed. #3");
+
+ g_list_free (list);
+ return OK;
+}
+
+RESULT
+test_list_copy ()
+{
+ int i, length;
+ GList *list, *copy;
+ list = g_list_prepend (NULL, "a");
+ list = g_list_append (list, "aa");
+ list = g_list_append (list, "aaa");
+ list = g_list_append (list, "aaaa");
+
+ length = g_list_length (list);
+ copy = g_list_copy (list);
+
+ for (i = 0; i < length; i++)
+ if (strcmp (g_list_nth (list, i)->data,
+ g_list_nth (copy, i)->data))
+ return FAILED ("copy failed.");
+
+ g_list_free (list);
+ g_list_free (copy);
+ return OK;
+}
+
+RESULT
+test_list_reverse ()
+{
+ guint i, length;
+ GList *list, *reverse;
+ list = g_list_prepend (NULL, "a");
+ list = g_list_append (list, "aa");
+ list = g_list_append (list, "aaa");
+ list = g_list_append (list, "aaaa");
+
+ length = g_list_length (list);
+ reverse = g_list_reverse (g_list_copy (list));
+
+ if (g_list_length (reverse) != length)
+ return FAILED ("reverse failed #1");
+
+ for (i = 0; i < length; i++){
+ guint j = length - i - 1;
+ if (strcmp (g_list_nth (list, i)->data,
+ g_list_nth (reverse, j)->data))
+ return FAILED ("reverse failed. #2");
+ }
+
+ g_list_free (list);
+ g_list_free (reverse);
+ return OK;
+}
+
+RESULT
+test_list_remove ()
+{
+ GList *list = g_list_prepend (NULL, "three");
+ char *one = "one";
+ list = g_list_prepend (list, "two");
+ list = g_list_prepend (list, one);
+
+ list = g_list_remove (list, one);
+
+ if (g_list_length (list) != 2)
+ return FAILED ("Remove failed");
+
+ if (strcmp ("two", list->data) != 0)
+ return FAILED ("Remove failed");
+
+ g_list_free (list);
+ return OK;
+}
+
+RESULT
+test_list_remove_link ()
+{
+ GList *foo = g_list_prepend (NULL, "a");
+ GList *bar = g_list_prepend (NULL, "b");
+ GList *baz = g_list_prepend (NULL, "c");
+ GList *list = foo;
+
+ foo = g_list_concat (foo, bar);
+ foo = g_list_concat (foo, baz);
+
+ list = g_list_remove_link (list, bar);
+
+ if (g_list_length (list) != 2)
+ return FAILED ("remove_link failed #1");
+
+ if (bar->next != NULL)
+ return FAILED ("remove_link failed #2");
+
+ g_list_free (list);
+ g_list_free (bar);
+ return OK;
+}
+
+RESULT
+test_list_insert_before ()
+{
+ GList *foo, *bar, *baz;
+
+ foo = g_list_prepend (NULL, "foo");
+ foo = g_list_insert_before (foo, NULL, "bar");
+ bar = g_list_last (foo);
+
+ if (strcmp (bar->data, "bar"))
+ return FAILED ("1");
+
+ baz = g_list_insert_before (foo, bar, "baz");
+ if (foo != baz)
+ return FAILED ("2");
+
+ if (strcmp (g_list_nth_data (foo, 1), "baz"))
+ return FAILED ("3: %s", g_list_nth_data (foo, 1));
+
+ g_list_free (foo);
+ return OK;
+}
+
+#define N_ELEMS 101
+
+static int intcompare (gconstpointer p1, gconstpointer p2)
+{
+ return GPOINTER_TO_INT (p1) - GPOINTER_TO_INT (p2);
+}
+
+static gboolean verify_sort (GList *list, int len)
+{
+ int prev;
+
+ if (list->prev)
+ return FALSE;
+
+ prev = GPOINTER_TO_INT (list->data);
+ len--;
+ for (list = list->next; list; list = list->next) {
+ int curr = GPOINTER_TO_INT (list->data);
+ if (prev > curr)
+ return FALSE;
+ prev = curr;
+
+ if (!list->prev || list->prev->next != list)
+ return FALSE;
+
+ if (len == 0)
+ return FALSE;
+ len--;
+ }
+ return len == 0;
+}
+
+RESULT
+test_list_sort ()
+{
+ int i, j, mul;
+ GList *list = NULL;
+
+ for (i = 0; i < N_ELEMS; ++i)
+ list = g_list_prepend (list, GINT_TO_POINTER (i));
+ list = g_list_sort (list, intcompare);
+ if (!verify_sort (list, N_ELEMS))
+ return FAILED ("decreasing list");
+
+ g_list_free (list);
+
+ list = NULL;
+ for (i = 0; i < N_ELEMS; ++i)
+ list = g_list_prepend (list, GINT_TO_POINTER (-i));
+ list = g_list_sort (list, intcompare);
+ if (!verify_sort (list, N_ELEMS))
+ return FAILED ("increasing list");
+
+ g_list_free (list);
+
+ list = g_list_prepend (NULL, GINT_TO_POINTER (0));
+ for (i = 1; i < N_ELEMS; ++i) {
+ list = g_list_prepend (list, GINT_TO_POINTER (i));
+ list = g_list_prepend (list, GINT_TO_POINTER (-i));
+ }
+ list = g_list_sort (list, intcompare);
+ if (!verify_sort (list, 2*N_ELEMS-1))
+ return FAILED ("alternating list");
+
+ g_list_free (list);
+
+ list = NULL;
+ mul = 1;
+ for (i = 1; i < N_ELEMS; ++i) {
+ mul = -mul;
+ for (j = 0; j < i; ++j)
+ list = g_list_prepend (list, GINT_TO_POINTER (mul * j));
+ }
+ list = g_list_sort (list, intcompare);
+ if (!verify_sort (list, (N_ELEMS*N_ELEMS - N_ELEMS)/2))
+ return FAILED ("wavering list");
+
+ g_list_free (list);
+
+ return OK;
+}
+
+static gint
+find_custom (gconstpointer a, gconstpointer b)
+{
+ return(strcmp (a, b));
+}
+
+RESULT
+test_list_find_custom ()
+{
+ GList *list = NULL, *found;
+ char *foo = "foo";
+ char *bar = "bar";
+ char *baz = "baz";
+
+ list = g_list_prepend (list, baz);
+ list = g_list_prepend (list, bar);
+ list = g_list_prepend (list, foo);
+
+ found = g_list_find_custom (list, baz, find_custom);
+
+ if (found == NULL)
+ return FAILED ("Find failed");
+
+ g_list_free (list);
+
+ return OK;
+}
+
+static Test list_tests [] = {
+ { "length", test_list_length},
+ { "nth", test_list_nth},
+ { "index", test_list_index},
+ { "last", test_list_last},
+ { "append", test_list_append},
+ { "concat", test_list_concat},
+ {"insert_sorted", test_list_insert_sorted},
+ {"insert_before", test_list_insert_before},
+ { "copy", test_list_copy},
+ { "reverse", test_list_reverse},
+ { "remove", test_list_remove},
+ { "remove_link", test_list_remove_link},
+ { "remove_link", test_list_remove_link},
+ { "sort", test_list_sort},
+ { "find_custom", test_list_find_custom},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(list_tests_init, list_tests)
--- /dev/null
+#include <stdio.h>
+#include <string.h>
+#include <glib.h>
+#include "test.h"
+
+#define do_bad_test(s) do { char *r = markup_test (s); if (r == NULL) return FAILED ("Failed on test " # s); else g_free (r); } while (0)
+#define do_ok_test(s) do { char *r = markup_test (s); if (r != NULL) return FAILED ("Could not parse valid " # s); } while (0)
+
+static char *
+markup_test (const char *s)
+{
+ GMarkupParser *parser = g_new0 (GMarkupParser, 1);
+ GMarkupParseContext *context;
+ GError *error = NULL;
+
+ context = g_markup_parse_context_new (parser, 0, 0, 0);
+
+ g_markup_parse_context_parse (context, s, strlen (s), &error);
+ g_markup_parse_context_free (context);
+
+ if (error != NULL){
+ char *msg = g_strdup (error->message);
+ g_error_free (error);
+
+ g_free (parser);
+ return msg;
+ }
+ g_free (parser);
+ return NULL;
+}
+
+RESULT
+invalid_documents (void)
+{
+ /* These should fail */
+ do_bad_test ("<1>");
+ do_bad_test ("<a<");
+ do_bad_test ("</a>");
+ do_bad_test ("<a b>");
+ do_bad_test ("<a b=>");
+ do_bad_test ("<a b=c>");
+
+ return OK;
+}
+
+RESULT
+valid_documents (void)
+{
+ /* These should fail */
+ do_ok_test ("<a>");
+ do_ok_test ("<a a=\"b\">");
+
+ return OK;
+}
+
+/*
+ * This is a test for the kind of files that the code in mono/domain.c
+ * parses; This code comes from Mono
+ */
+typedef struct {
+ GSList *supported_runtimes;
+ char *required_runtime;
+ int configuration_count;
+ int startup_count;
+} AppConfigInfo;
+
+static char *
+get_attribute_value (const gchar **attribute_names,
+ const gchar **attribute_values,
+ const char *att_name)
+{
+ int n;
+ for (n=0; attribute_names[n] != NULL; n++) {
+ if (strcmp (attribute_names[n], att_name) == 0)
+ return g_strdup (attribute_values[n]);
+ }
+ return NULL;
+}
+
+static void
+start_element (GMarkupParseContext *context,
+ const gchar *element_name,
+ const gchar **attribute_names,
+ const gchar **attribute_values,
+ gpointer user_data,
+ GError **error)
+{
+ AppConfigInfo* app_config = (AppConfigInfo*) user_data;
+
+ if (strcmp (element_name, "configuration") == 0) {
+ app_config->configuration_count++;
+ return;
+ }
+ if (strcmp (element_name, "startup") == 0) {
+ app_config->startup_count++;
+ return;
+ }
+
+ if (app_config->configuration_count != 1 || app_config->startup_count != 1)
+ return;
+
+ if (strcmp (element_name, "requiredRuntime") == 0) {
+ app_config->required_runtime = get_attribute_value (attribute_names, attribute_values, "version");
+ } else if (strcmp (element_name, "supportedRuntime") == 0) {
+ char *version = get_attribute_value (attribute_names, attribute_values, "version");
+ app_config->supported_runtimes = g_slist_append (app_config->supported_runtimes, version);
+ }
+}
+
+static void
+end_element (GMarkupParseContext *context,
+ const gchar *element_name,
+ gpointer user_data,
+ GError **error)
+{
+ AppConfigInfo* app_config = (AppConfigInfo*) user_data;
+
+ if (strcmp (element_name, "configuration") == 0) {
+ app_config->configuration_count--;
+ } else if (strcmp (element_name, "startup") == 0) {
+ app_config->startup_count--;
+ }
+}
+
+static const GMarkupParser
+mono_parser = {
+ start_element,
+ end_element,
+ NULL,
+ NULL,
+ NULL
+};
+
+AppConfigInfo *
+domain_test (char *text)
+{
+ AppConfigInfo *app_config = g_new0 (AppConfigInfo, 1);
+ GMarkupParseContext *context;
+
+ context = g_markup_parse_context_new (&mono_parser, 0, app_config, NULL);
+ if (g_markup_parse_context_parse (context, text, strlen (text), NULL)) {
+ g_markup_parse_context_end_parse (context, NULL);
+ }
+ g_markup_parse_context_free (context);
+
+ return app_config;
+}
+
+void
+domain_free (AppConfigInfo *info)
+{
+ GSList *l;
+ if (info->required_runtime)
+ g_free (info->required_runtime);
+ for (l = info->supported_runtimes; l != NULL; l = l->next){
+ g_free (l->data);
+ }
+ g_slist_free (info->supported_runtimes);
+ g_free (info);
+}
+
+RESULT
+mono_domain (void)
+{
+ AppConfigInfo *info;
+
+ info = domain_test ("<configuration><!--hello--><startup><!--world--><requiredRuntime version=\"v1\"><!--r--></requiredRuntime></startup></configuration>");
+ if (info->required_runtime == NULL)
+ return FAILED ("No required runtime section");
+ if (strcmp (info->required_runtime, "v1") != 0)
+ return FAILED ("Got a runtime version %s, expected v1", info->required_runtime);
+ domain_free (info);
+
+ info = domain_test ("<configuration><startup><requiredRuntime version=\"v1\"/><!--comment--></configuration><!--end-->");
+ if (info->required_runtime == NULL)
+ return FAILED ("No required runtime section on auto-close section");
+ if (strcmp (info->required_runtime, "v1") != 0)
+ return FAILED ("Got a runtime version %s, expected v1", info->required_runtime);
+ domain_free (info);
+
+ info = domain_test ("<!--start--><configuration><startup><supportedRuntime version=\"v1\"/><!--middle--><supportedRuntime version=\"v2\"/></startup></configuration>");
+ if ((strcmp ((char*)info->supported_runtimes->data, "v1") == 0)){
+ if (info->supported_runtimes->next == NULL)
+ return FAILED ("Expected 2 supported runtimes");
+
+ if ((strcmp ((char*)info->supported_runtimes->next->data, "v2") != 0))
+ return FAILED ("Expected v1, v2, got %s", info->supported_runtimes->next->data);
+ if (info->supported_runtimes->next->next != NULL)
+ return FAILED ("Expected v1, v2, got more");
+ } else
+ return FAILED ("Expected `v1', got %s", info->supported_runtimes->data);
+ domain_free (info);
+
+ return NULL;
+}
+
+RESULT
+mcs_config (void)
+{
+ return markup_test ("<configuration>\r\n <system.diagnostics>\r\n <trace autoflush=\"true\" indentsize=\"4\">\r\n <listeners>\r\n <add name=\"compilerLogListener\" type=\"System.Diagnostics.TextWriterTraceListener,System\"/> </listeners> </trace> </system.diagnostics> </configuration>");
+
+}
+
+RESULT
+xml_parse (void)
+{
+ return markup_test ("<?xml version=\"1.0\" encoding=\"utf-8\"?><a></a>");
+}
+
+RESULT
+machine_config (void)
+{
+ char *data;
+ gsize size;
+
+ if (g_file_get_contents ("../../data/net_1_1/machine.config", &data, &size, NULL)){
+ return markup_test (data);
+ }
+ printf ("Ignoring this test\n");
+ return NULL;
+}
+
+static Test markup_tests [] = {
+ {"invalid_documents", invalid_documents},
+ {"good_documents", valid_documents},
+ {"mono_domain", mono_domain},
+ {"mcs_config", mcs_config},
+ {"xml_parse", xml_parse},
+ {"machine_config", machine_config},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(markup_tests_init, markup_tests)
+
--- /dev/null
+
+#include <glib.h>
+#include "test.h"
+
+RESULT
+test_memory_zero_size_allocations ()
+{
+ gpointer p;
+
+ p = g_malloc (0);
+ if (p)
+ return FAILED ("Calling g_malloc with size zero should return NULL.");
+
+ p = g_malloc0 (0);
+ if (p)
+ return FAILED ("Calling g_malloc0 with size zero should return NULL.");
+
+ p = g_realloc (NULL, 0);
+ if (p)
+ return FAILED ("Calling g_realloc with size zero should return NULL.");
+
+ p = g_new (int, 0);
+ if (p)
+ return FAILED ("Calling g_new with size zero should return NULL.");
+
+ p = g_new0 (int, 0);
+ if (p)
+ return FAILED ("Calling g_new0 with size zero should return NULL.");
+
+ return OK;
+}
+
+
+static Test memory_tests [] = {
+ { "zero_size_allocations", test_memory_zero_size_allocations},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(memory_tests_init, memory_tests)
+
--- /dev/null
+#include <config.h>
+#include <glib.h>
+#include <gmodule.h>
+#include <string.h>
+#include <stdio.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include "test.h"
+
+#if defined (G_OS_WIN32)
+#define EXTERNAL_SYMBOL "GetProcAddress"
+#else
+#define EXTERNAL_SYMBOL "system"
+#endif
+
+void G_MODULE_EXPORT
+dummy_test_export ()
+{
+}
+
+/* test for g_module_open (NULL, ...) */
+RESULT
+test_module_symbol_null ()
+{
+ gpointer proc = GINT_TO_POINTER (42);
+
+ GModule *m = g_module_open (NULL, G_MODULE_BIND_LAZY);
+
+ if (m == NULL)
+ return FAILED ("bind to main module failed. #0");
+
+ if (g_module_symbol (m, "__unlikely_\nexistent__", &proc))
+ return FAILED ("non-existent symbol lookup failed. #1");
+
+ if (proc)
+ return FAILED ("non-existent symbol lookup failed. #2");
+
+ if (!g_module_symbol (m, EXTERNAL_SYMBOL, &proc))
+ return FAILED ("external lookup failed. #3");
+
+ if (!proc)
+ return FAILED ("external lookup failed. #4");
+
+ if (!g_module_symbol (m, "dummy_test_export", &proc))
+ return FAILED ("in-proc lookup failed. #5");
+
+ if (!proc)
+ return FAILED ("in-proc lookup failed. #6");
+
+ if (!g_module_close (m))
+ return FAILED ("close failed. #7");
+
+ return OK;
+}
+
+static Test module_tests [] = {
+ {"g_module_symbol_null", test_module_symbol_null},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(module_tests_init, module_tests)
+
+
--- /dev/null
+#include <config.h>
+#include <glib.h>
+#include <string.h>
+#include <stdio.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef G_OS_UNIX
+#include <pthread.h>
+#endif
+#include "test.h"
+
+#ifdef G_OS_WIN32
+#include <direct.h>
+#define chdir _chdir
+#endif
+
+/* This test is just to be used with valgrind */
+RESULT
+test_buildpath ()
+{
+ char *s;
+ char *buffer = "var/private";
+ char *dir = "/";
+
+ s = g_build_path ("/", "hola///", "//mundo", NULL);
+ if (strcmp (s, "hola/mundo") != 0)
+ return FAILED ("1 Got wrong result, got: %s", s);
+ g_free (s);
+
+ s = g_build_path ("/", "hola/", "/mundo", NULL);
+ if (strcmp (s, "hola/mundo") != 0)
+ return FAILED ("2 Got wrong result, got: %s", s);
+ g_free (s);
+
+ s = g_build_path ("/", "hola/", "mundo", NULL);
+ if (strcmp (s, "hola/mundo") != 0)
+ return FAILED ("3 Got wrong result, got: %s", s);
+ g_free (s);
+
+ s = g_build_path ("/", "hola", "/mundo", NULL);
+ if (strcmp (s, "hola/mundo") != 0)
+ return FAILED ("4 Got wrong result, got: %s", s);
+ g_free (s);
+
+ s = g_build_path ("/", "/hello", "world/", NULL);
+ if (strcmp (s, "/hello/world/") != 0)
+ return FAILED ("5 Got wrong result, got: %s", s);
+ g_free (s);
+
+ /* Now test multi-char-separators */
+ s = g_build_path ("**", "hello", "world", NULL);
+ if (strcmp (s, "hello**world") != 0)
+ return FAILED ("6 Got wrong result, got: %s", s);
+ g_free (s);
+
+ s = g_build_path ("**", "hello**", "world", NULL);
+ if (strcmp (s, "hello**world") != 0)
+ return FAILED ("7 Got wrong result, got: %s", s);
+ g_free (s);
+
+ s = g_build_path ("**", "hello**", "**world", NULL);
+ if (strcmp (s, "hello**world") != 0)
+ return FAILED ("8 Got wrong result, got: %s", s);
+ g_free (s);
+
+ s = g_build_path ("**", "hello**", "**world", NULL);
+ if (strcmp (s, "hello**world") != 0)
+ return FAILED ("9 Got wrong result, got: %s", s);
+ g_free (s);
+
+ s = g_build_path ("1234567890", "hello", "world", NULL);
+ if (strcmp (s, "hello1234567890world") != 0)
+ return FAILED ("10 Got wrong result, got: %s", s);
+ g_free (s);
+
+ s = g_build_path ("1234567890", "hello1234567890", "1234567890world", NULL);
+ if (strcmp (s, "hello1234567890world") != 0)
+ return FAILED ("11 Got wrong result, got: %s", s);
+ g_free (s);
+
+ s = g_build_path ("1234567890", "hello12345678901234567890", "1234567890world", NULL);
+ if (strcmp (s, "hello1234567890world") != 0)
+ return FAILED ("12 Got wrong result, got: %s", s);
+ g_free (s);
+
+ /* Multiple */
+ s = g_build_path ("/", "a", "b", "c", "d", NULL);
+ if (strcmp (s, "a/b/c/d") != 0)
+ return FAILED ("13 Got wrong result, got: %s", s);
+ g_free (s);
+
+ s = g_build_path ("/", "/a", "", "/c/", NULL);
+ if (strcmp (s, "/a/c/") != 0)
+ return FAILED ("14 Got wrong result, got: %s", s);
+ g_free (s);
+
+ /* Null */
+ s = g_build_path ("/", NULL, NULL);
+ if (s == NULL)
+ return FAILED ("must get a non-NULL return");
+ if (s [0] != 0)
+ return FAILED ("must get an empty string");
+
+ // This is to test the regression introduced by Levi for the Windows support
+ // that code errouneously read below the allowed area (in this case dir [-1]).
+ // and caused all kinds of random errors.
+ dir = "//";
+ dir++;
+ s = g_build_filename (dir, buffer, NULL);
+ if (s [0] != '/')
+ return FAILED ("Must have a '/' at the start");
+
+ g_free (s);
+ return OK;
+}
+
+RESULT
+test_buildfname ()
+{
+ char *s;
+
+ s = g_build_filename ("a", "b", "c", "d", NULL);
+#ifdef G_OS_WIN32
+ if (strcmp (s, "a\\b\\c\\d") != 0)
+#else
+ if (strcmp (s, "a/b/c/d") != 0)
+#endif
+ return FAILED ("1 Got wrong result, got: %s", s);
+ g_free (s);
+
+#ifdef G_OS_WIN32
+ s = g_build_filename ("C:\\", "a", NULL);
+ if (strcmp (s, "C:\\a") != 0)
+#else
+ s = g_build_filename ("/", "a", NULL);
+ if (strcmp (s, "/a") != 0)
+#endif
+ return FAILED ("1 Got wrong result, got: %s", s);
+
+#ifndef G_OS_WIN32
+ s = g_build_filename ("/", "foo", "/bar", "tolo/", "/meo/", NULL);
+ if (strcmp (s, "/foo/bar/tolo/meo/") != 0)
+ return FAILED ("1 Got wrong result, got: %s", s);
+#endif
+
+ return OK;
+}
+
+char *
+test_dirname ()
+{
+ char *s;
+
+#ifdef G_OS_WIN32
+ s = g_path_get_dirname ("c:\\home\\miguel");
+ if (strcmp (s, "c:\\home") != 0)
+ return FAILED ("Expected c:\\home, got %s", s);
+ g_free (s);
+
+ s = g_path_get_dirname ("c:/home/miguel");
+ if (strcmp (s, "c:/home") != 0)
+ return FAILED ("Expected c:/home, got %s", s);
+ g_free (s);
+
+ s = g_path_get_dirname ("c:\\home\\dingus\\");
+ if (strcmp (s, "c:\\home\\dingus") != 0)
+ return FAILED ("Expected c:\\home\\dingus, got %s", s);
+ g_free (s);
+
+ s = g_path_get_dirname ("dir.c");
+ if (strcmp (s, ".") != 0)
+ return FAILED ("Expected `.', got %s", s);
+ g_free (s);
+
+ s = g_path_get_dirname ("c:\\index.html");
+ if (strcmp (s, "c:") != 0)
+ return FAILED ("Expected [c:], got [%s]", s);
+#else
+ s = g_path_get_dirname ("/home/miguel");
+ if (strcmp (s, "/home") != 0)
+ return FAILED ("Expected /home, got %s", s);
+ g_free (s);
+
+ s = g_path_get_dirname ("/home/dingus/");
+ if (strcmp (s, "/home/dingus") != 0)
+ return FAILED ("Expected /home/dingus, got %s", s);
+ g_free (s);
+
+ s = g_path_get_dirname ("dir.c");
+ if (strcmp (s, ".") != 0)
+ return FAILED ("Expected `.', got %s", s);
+ g_free (s);
+
+ s = g_path_get_dirname ("/index.html");
+ if (strcmp (s, "/") != 0)
+ return FAILED ("Expected [/], got [%s]", s);
+#endif
+ return OK;
+}
+
+char *
+test_basename ()
+{
+ char *s;
+
+#ifdef G_OS_WIN32
+ s = g_path_get_basename ("");
+ if (strcmp (s, ".") != 0)
+ return FAILED ("Expected `.', got %s", s);
+ g_free (s);
+
+ s = g_path_get_basename ("c:\\home\\dingus\\");
+ if (strcmp (s, "dingus") != 0)
+ return FAILED ("1 Expected dingus, got %s", s);
+ g_free (s);
+
+ s = g_path_get_basename ("c:/home/dingus/");
+ if (strcmp (s, "dingus") != 0)
+ return FAILED ("1 Expected dingus, got %s", s);
+ g_free (s);
+
+ s = g_path_get_basename ("c:\\home\\dingus");
+ if (strcmp (s, "dingus") != 0)
+ return FAILED ("2 Expected dingus, got %s", s);
+ g_free (s);
+
+ s = g_path_get_basename ("c:/home/dingus");
+ if (strcmp (s, "dingus") != 0)
+ return FAILED ("2 Expected dingus, got %s", s);
+ g_free (s);
+#else
+ s = g_path_get_basename ("");
+ if (strcmp (s, ".") != 0)
+ return FAILED ("Expected `.', got %s", s);
+ g_free (s);
+
+ s = g_path_get_basename ("/home/dingus/");
+ if (strcmp (s, "dingus") != 0)
+ return FAILED ("1 Expected dingus, got %s", s);
+ g_free (s);
+
+ s = g_path_get_basename ("/home/dingus");
+ if (strcmp (s, "dingus") != 0)
+ return FAILED ("2 Expected dingus, got %s", s);
+ g_free (s);
+#endif
+ return OK;
+}
+
+gchar *
+test_ppath ()
+{
+ char *s;
+#ifdef G_OS_WIN32
+ const gchar *searchfor = "explorer.exe";
+#else
+ const gchar *searchfor = "ls";
+#endif
+ s = g_find_program_in_path (searchfor);
+ if (s == NULL)
+ return FAILED ("No %s on this system?", searchfor);
+ g_free (s);
+ return OK;
+}
+
+gchar *
+test_ppath2 ()
+{
+ char *s;
+ const char *path = g_getenv ("PATH");
+#ifdef G_OS_WIN32
+ const gchar *searchfor = "test_eglib.exe";
+#else
+ const gchar *searchfor = "test-glib";
+#endif
+
+ g_setenv ("PATH", "", TRUE);
+ s = g_find_program_in_path ("ls");
+ if (s != NULL) {
+ g_setenv ("PATH", path, TRUE);
+ return FAILED ("Found something interesting here: %s", s);
+ }
+ g_free (s);
+ s = g_find_program_in_path (searchfor);
+ if (s == NULL) {
+ g_setenv ("PATH", path, TRUE);
+ return FAILED ("It should find '%s' in the current directory.", searchfor);
+ }
+ g_free (s);
+ g_setenv ("PATH", path, TRUE);
+ return OK;
+}
+
+#ifndef DISABLE_FILESYSTEM_TESTS
+gchar *
+test_cwd ()
+{
+ char *dir = g_get_current_dir ();
+#ifdef G_OS_WIN32
+ const gchar *newdir = "C:\\Windows";
+#else
+ const gchar *newdir = "/bin";
+#endif
+
+ if (dir == NULL)
+ return FAILED ("No current directory?");
+ g_free (dir);
+
+ if (chdir (newdir) == -1)
+ return FAILED ("No %s?", newdir);
+
+ dir = g_get_current_dir ();
+ if (strcmp (dir, newdir) != 0)
+ return FAILED("Did not go to %s?", newdir);
+ g_free (dir);
+
+ return OK;
+}
+#else
+gchar *
+test_cwd ()
+{
+ return OK;
+}
+#endif
+
+gchar *
+test_misc ()
+{
+ const char *home = g_get_home_dir ();
+ const char *tmp = g_get_tmp_dir ();
+
+ if (home == NULL)
+ return FAILED ("Where did my home go?");
+
+ if (tmp == NULL)
+ return FAILED ("Where did my /tmp go?");
+
+ return OK;
+}
+
+static Test path_tests [] = {
+ {"g_build_filename", test_buildfname},
+ {"g_buildpath", test_buildpath},
+ {"g_path_get_dirname", test_dirname},
+ {"g_path_get_basename", test_basename},
+ {"g_find_program_in_path", test_ppath},
+ {"g_find_program_in_path2", test_ppath2},
+ {"test_cwd", test_cwd },
+ {"test_misc", test_misc },
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(path_tests_init, path_tests)
+
+
--- /dev/null
+#include <config.h>
+#include <glib.h>
+#include <string.h>
+#include <stdlib.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <stdio.h>
+#include "test.h"
+
+#define MATCH(pat,string,error_if,msg) \
+ spec = g_pattern_spec_new (pat); \
+ res = g_pattern_match_string (spec, string); \
+ if (res == error_if) \
+ return FAILED (msg " returned %s", res ? "TRUE" : "FALSE"); \
+ g_pattern_spec_free (spec);
+
+#define TEST_MATCH(pat,string,n) MATCH (pat, string, FALSE, "MATCH " #n)
+#define TEST_NO_MATCH(pat,string,n) MATCH (pat, string,TRUE, "NO_MATCH " #n)
+
+RESULT
+test_pattern_spec ()
+{
+ GPatternSpec *spec;
+ gboolean res;
+
+ /* spec = g_pattern_spec_new (NULL); */
+ TEST_MATCH ("*", "hola", 1);
+ TEST_MATCH ("hola", "hola", 2);
+ TEST_MATCH ("????", "hola", 3);
+ TEST_MATCH ("???a", "hola", 4);
+ TEST_MATCH ("h??a", "hola", 5);
+ TEST_MATCH ("h??*", "hola", 6);
+ TEST_MATCH ("h*", "hola", 7);
+ TEST_MATCH ("*hola", "hola", 8);
+ TEST_MATCH ("*l*", "hola", 9);
+ TEST_MATCH ("h*??", "hola", 10);
+ TEST_MATCH ("h*???", "hola", 11);
+ TEST_MATCH ("?o??", "hola", 12);
+ TEST_MATCH ("*h*o*l*a*", "hola", 13);
+ TEST_MATCH ("h*o*l*a", "hola", 14);
+ TEST_MATCH ("h?*?", "hola", 15);
+
+ TEST_NO_MATCH ("", "hola", 1);
+ TEST_NO_MATCH ("?????", "hola", 2);
+ TEST_NO_MATCH ("???", "hola", 3);
+ TEST_NO_MATCH ("*o", "hola", 4);
+ TEST_NO_MATCH ("h", "hola", 5);
+ TEST_NO_MATCH ("h*????", "hola", 6);
+
+ return OK;
+}
+
+static Test pattern_tests [] = {
+ {"g_pattern_spec*", test_pattern_spec},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(pattern_tests_init, pattern_tests)
+
+
--- /dev/null
+#include <stdio.h>
+#include <glib.h>
+#include "test.h"
+
+/* Redefine the private structure only to verify proper allocations */
+typedef struct _GPtrArrayPriv {
+ gpointer *pdata;
+ guint len;
+ guint size;
+} GPtrArrayPriv;
+
+/* Don't add more than 32 items to this please */
+static const char *items [] = {
+ "Apples", "Oranges", "Plumbs", "Goats", "Snorps", "Grapes",
+ "Tickle", "Place", "Coffee", "Cookies", "Cake", "Cheese",
+ "Tseng", "Holiday", "Avenue", "Smashing", "Water", "Toilet",
+ NULL
+};
+
+static GPtrArray *ptrarray_alloc_and_fill(guint *item_count)
+{
+ GPtrArray *array = g_ptr_array_new();
+ gint i;
+
+ for(i = 0; items[i] != NULL; i++) {
+ g_ptr_array_add(array, (gpointer)items[i]);
+ }
+
+ if(item_count != NULL) {
+ *item_count = i;
+ }
+
+ return array;
+}
+
+static guint guess_size(guint length)
+{
+ guint size = 1;
+
+ while(size < length) {
+ size <<= 1;
+ }
+
+ return size;
+}
+
+RESULT ptrarray_alloc()
+{
+ GPtrArrayPriv *array;
+ guint i;
+
+ array = (GPtrArrayPriv *)ptrarray_alloc_and_fill(&i);
+
+ if(array->size != guess_size(array->len)) {
+ return FAILED("Size should be %d, but it is %d",
+ guess_size(array->len), array->size);
+ }
+
+ if(array->len != i) {
+ return FAILED("Expected %d node(s) in the array", i);
+ }
+
+ g_ptr_array_free((GPtrArray *)array, TRUE);
+
+ return OK;
+}
+
+RESULT ptrarray_for_iterate()
+{
+ GPtrArray *array = ptrarray_alloc_and_fill(NULL);
+ guint i;
+
+ for(i = 0; i < array->len; i++) {
+ char *item = (char *)g_ptr_array_index(array, i);
+ if(item != items[i]) {
+ return FAILED(
+ "Expected item at %d to be %s, but it was %s",
+ i, items[i], item);
+ }
+ }
+
+ g_ptr_array_free(array, TRUE);
+
+ return OK;
+}
+
+static gint foreach_iterate_index = 0;
+static char *foreach_iterate_error = NULL;
+
+void foreach_callback(gpointer data, gpointer user_data)
+{
+ char *item = (char *)data;
+ const char *item_cmp = items[foreach_iterate_index++];
+
+ if(foreach_iterate_error != NULL) {
+ return;
+ }
+
+ if(item != item_cmp) {
+ foreach_iterate_error = FAILED(
+ "Expected item at %d to be %s, but it was %s",
+ foreach_iterate_index - 1, item_cmp, item);
+ }
+}
+
+RESULT ptrarray_foreach_iterate()
+{
+ GPtrArray *array = ptrarray_alloc_and_fill(NULL);
+
+ foreach_iterate_index = 0;
+ foreach_iterate_error = NULL;
+
+ g_ptr_array_foreach(array, foreach_callback, array);
+
+ g_ptr_array_free(array, TRUE);
+
+ return foreach_iterate_error;
+}
+
+RESULT ptrarray_set_size()
+{
+ GPtrArray *array = g_ptr_array_new();
+ guint i, grow_length = 50;
+
+ g_ptr_array_add(array, (gpointer)items[0]);
+ g_ptr_array_add(array, (gpointer)items[1]);
+ g_ptr_array_set_size(array, grow_length);
+
+ if(array->len != grow_length) {
+ return FAILED("Array length should be 50, it is %d", array->len);
+ } else if(array->pdata[0] != items[0]) {
+ return FAILED("Item 0 was overwritten, should be %s", items[0]);
+ } else if(array->pdata[1] != items[1]) {
+ return FAILED("Item 1 was overwritten, should be %s", items[1]);
+ }
+
+ for(i = 2; i < array->len; i++) {
+ if(array->pdata[i] != NULL) {
+ return FAILED("Item %d is not NULL, it is %p", i, array->pdata[i]);
+ }
+ }
+
+ g_ptr_array_free(array, TRUE);
+
+ return OK;
+}
+
+RESULT ptrarray_remove_index()
+{
+ GPtrArray *array;
+ guint i;
+
+ array = ptrarray_alloc_and_fill(&i);
+
+ g_ptr_array_remove_index(array, 0);
+ if(array->pdata[0] != items[1]) {
+ return FAILED("First item is not %s, it is %s", items[1],
+ array->pdata[0]);
+ }
+
+ g_ptr_array_remove_index(array, array->len - 1);
+
+ if(array->pdata[array->len - 1] != items[array->len]) {
+ return FAILED("Last item is not %s, it is %s",
+ items[array->len - 2], array->pdata[array->len - 1]);
+ }
+
+ g_ptr_array_free(array, TRUE);
+
+ return OK;
+}
+
+RESULT ptrarray_remove_index_fast()
+{
+ GPtrArray *array;
+ guint i;
+
+ array = ptrarray_alloc_and_fill(&i);
+
+ g_ptr_array_remove_index_fast(array, 0);
+ if(array->pdata[0] != items[array->len]) {
+ return FAILED("First item is not %s, it is %s", items[array->len],
+ array->pdata[0]);
+ }
+
+ g_ptr_array_remove_index_fast(array, array->len - 1);
+ if(array->pdata[array->len - 1] != items[array->len - 1]) {
+ return FAILED("Last item is not %s, it is %s",
+ items[array->len - 1], array->pdata[array->len - 1]);
+ }
+
+ g_ptr_array_free(array, TRUE);
+
+ return OK;
+}
+
+RESULT ptrarray_remove()
+{
+ GPtrArray *array;
+ guint i;
+
+ array = ptrarray_alloc_and_fill(&i);
+
+ g_ptr_array_remove(array, (gpointer)items[7]);
+
+ if(!g_ptr_array_remove(array, (gpointer)items[4])) {
+ return FAILED("Item %s not removed", items[4]);
+ }
+
+ if(g_ptr_array_remove(array, (gpointer)items[4])) {
+ return FAILED("Item %s still in array after removal", items[4]);
+ }
+
+ if(array->pdata[array->len - 1] != items[array->len + 1]) {
+ return FAILED("Last item in GPtrArray not correct");
+ }
+
+ g_ptr_array_free(array, TRUE);
+
+ return OK;
+}
+
+static gint ptrarray_sort_compare(gconstpointer a, gconstpointer b)
+{
+ gchar *stra = *(gchar **) a;
+ gchar *strb = *(gchar **) b;
+ return strcmp(stra, strb);
+}
+
+RESULT ptrarray_sort()
+{
+ GPtrArray *array = g_ptr_array_new();
+ guint i;
+ gchar *letters [] = { "A", "B", "C", "D", "E" };
+
+ g_ptr_array_add(array, letters[0]);
+ g_ptr_array_add(array, letters[1]);
+ g_ptr_array_add(array, letters[2]);
+ g_ptr_array_add(array, letters[3]);
+ g_ptr_array_add(array, letters[4]);
+
+ g_ptr_array_sort(array, ptrarray_sort_compare);
+
+ for(i = 0; i < array->len; i++) {
+ if(array->pdata[i] != letters[i]) {
+ return FAILED("Array out of order, expected %s got %s at position %d",
+ letters [i], (gchar *) array->pdata [i], i);
+ }
+ }
+
+ g_ptr_array_free(array, TRUE);
+
+ return OK;
+}
+
+static gint ptrarray_sort_compare_with_data (gconstpointer a, gconstpointer b, gpointer user_data)
+{
+ gchar *stra = *(gchar **) a;
+ gchar *strb = *(gchar **) b;
+
+ if (strcmp (user_data, "this is the data for qsort") != 0)
+ fprintf (stderr, "oops at compare with_data\n");
+
+ return strcmp(stra, strb);
+}
+
+RESULT ptrarray_sort_with_data ()
+{
+ GPtrArray *array = g_ptr_array_new();
+ guint i;
+ gchar *letters [] = { "A", "B", "C", "D", "E" };
+
+ g_ptr_array_add(array, letters[4]);
+ g_ptr_array_add(array, letters[1]);
+ g_ptr_array_add(array, letters[2]);
+ g_ptr_array_add(array, letters[0]);
+ g_ptr_array_add(array, letters[3]);
+
+ g_ptr_array_sort_with_data(array, ptrarray_sort_compare_with_data, "this is the data for qsort");
+
+ for(i = 0; i < array->len; i++) {
+ if(array->pdata[i] != letters[i]) {
+ return FAILED("Array out of order, expected %s got %s at position %d",
+ letters [i], (gchar *) array->pdata [i], i);
+ }
+ }
+
+ g_ptr_array_free(array, TRUE);
+
+ return OK;
+}
+
+RESULT ptrarray_remove_fast()
+{
+ GPtrArray *array = g_ptr_array_new();
+ gchar *letters [] = { "A", "B", "C", "D", "E" };
+
+ if (g_ptr_array_remove_fast (array, NULL))
+ return FAILED ("Removing NULL succeeded");
+
+ g_ptr_array_add(array, letters[0]);
+ if (!g_ptr_array_remove_fast (array, letters[0]) || array->len != 0)
+ return FAILED ("Removing last element failed");
+
+ g_ptr_array_add(array, letters[0]);
+ g_ptr_array_add(array, letters[1]);
+ g_ptr_array_add(array, letters[2]);
+ g_ptr_array_add(array, letters[3]);
+ g_ptr_array_add(array, letters[4]);
+
+ if (!g_ptr_array_remove_fast (array, letters[0]) || array->len != 4)
+ return FAILED ("Removing first element failed");
+
+ if (array->pdata [0] != letters [4])
+ return FAILED ("First element wasn't replaced with last upon removal");
+
+ if (g_ptr_array_remove_fast (array, letters[0]))
+ return FAILED ("Succedeed removing a non-existing element");
+
+ if (!g_ptr_array_remove_fast (array, letters[3]) || array->len != 3)
+ return FAILED ("Failed removing \"D\"");
+
+ if (!g_ptr_array_remove_fast (array, letters[1]) || array->len != 2)
+ return FAILED ("Failed removing \"B\"");
+
+ if (array->pdata [0] != letters [4] || array->pdata [1] != letters [2])
+ return FAILED ("Last two elements are wrong");
+ g_ptr_array_free(array, TRUE);
+
+ return OK;
+}
+
+static Test ptrarray_tests [] = {
+ {"alloc", ptrarray_alloc},
+ {"for_iterate", ptrarray_for_iterate},
+ {"foreach_iterate", ptrarray_foreach_iterate},
+ {"set_size", ptrarray_set_size},
+ {"remove_index", ptrarray_remove_index},
+ {"remove_index_fast", ptrarray_remove_index_fast},
+ {"remove", ptrarray_remove},
+ {"sort", ptrarray_sort},
+ {"remove_fast", ptrarray_remove_fast},
+ {"sort_with_data", ptrarray_sort_with_data},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(ptrarray_tests_init, ptrarray_tests)
+
+
--- /dev/null
+#include <stdio.h>
+#include <string.h>
+#include <glib.h>
+#include "test.h"
+
+RESULT
+test_queue_push ()
+{
+ GQueue *queue = g_queue_new ();
+
+ g_queue_push_head (queue, "foo");
+ g_queue_push_head (queue, "bar");
+ g_queue_push_head (queue, "baz");
+
+ if (queue->length != 3)
+ return FAILED ("push failed");
+
+ if (NULL != queue->head->prev)
+ return FAILED ("HEAD: prev is wrong");
+ if (strcmp ("baz", queue->head->data))
+ return FAILED ("HEAD: First element is wrong");
+ if (strcmp ("bar", queue->head->next->data))
+ return FAILED ("HEAD: Second element is wrong");
+ if (strcmp ("foo", queue->head->next->next->data))
+ return FAILED ("HEAD: Third element is wrong");
+ if (NULL != queue->head->next->next->next)
+ return FAILED ("HEAD: End is wrong");
+
+ if (NULL != queue->tail->next)
+ return FAILED ("TAIL: next is wrong");
+ if (strcmp ("foo", queue->tail->data))
+ return FAILED ("TAIL: Third element is wrong");
+ if (strcmp ("bar", queue->tail->prev->data))
+ return FAILED ("TAIL: Second element is wrong");
+ if (strcmp ("baz", queue->tail->prev->prev->data))
+ return FAILED ("TAIL: First element is wrong");
+ if (NULL != queue->tail->prev->prev->prev)
+ return FAILED ("TAIL: End is wrong");
+
+ g_queue_free (queue);
+ return OK;
+}
+
+RESULT
+test_queue_push_tail ()
+{
+ GQueue *queue = g_queue_new ();
+
+ g_queue_push_tail (queue, "baz");
+ g_queue_push_tail (queue, "bar");
+ g_queue_push_tail (queue, "foo");
+
+ if (queue->length != 3)
+ return FAILED ("push failed");
+
+ if (NULL != queue->head->prev)
+ return FAILED ("HEAD: prev is wrong");
+ if (strcmp ("baz", queue->head->data))
+ return FAILED ("HEAD: First element is wrong");
+ if (strcmp ("bar", queue->head->next->data))
+ return FAILED ("HEAD: Second element is wrong");
+ if (strcmp ("foo", queue->head->next->next->data))
+ return FAILED ("HEAD: Third element is wrong");
+ if (NULL != queue->head->next->next->next)
+ return FAILED ("HEAD: End is wrong");
+
+ if (NULL != queue->tail->next)
+ return FAILED ("TAIL: next is wrong");
+ if (strcmp ("foo", queue->tail->data))
+ return FAILED ("TAIL: Third element is wrong");
+ if (strcmp ("bar", queue->tail->prev->data))
+ return FAILED ("TAIL: Second element is wrong");
+ if (strcmp ("baz", queue->tail->prev->prev->data))
+ return FAILED ("TAIL: First element is wrong");
+ if (NULL != queue->tail->prev->prev->prev)
+ return FAILED ("TAIL: End is wrong");
+
+ g_queue_free (queue);
+ return OK;
+}
+
+RESULT
+test_queue_pop ()
+{
+ GQueue *queue = g_queue_new ();
+ gpointer data;
+
+ g_queue_push_head (queue, "foo");
+ g_queue_push_head (queue, "bar");
+ g_queue_push_head (queue, "baz");
+
+ data = g_queue_pop_head (queue);
+ if (strcmp ("baz", data))
+ return FAILED ("expect baz.");
+
+ data = g_queue_pop_head (queue);
+ if (strcmp ("bar", data))
+ return FAILED ("expect bar.");
+
+ data = g_queue_pop_head (queue);
+ if (strcmp ("foo", data))
+ return FAILED ("expect foo.");
+
+ if (g_queue_is_empty (queue) == FALSE)
+ return FAILED ("expect is_empty.");
+
+ if (queue->length != 0)
+ return FAILED ("expect 0 length .");
+
+ g_queue_push_head (queue, "foo");
+ g_queue_push_head (queue, "bar");
+ g_queue_push_head (queue, "baz");
+
+ g_queue_pop_head (queue);
+
+ if (NULL != queue->head->prev)
+ return FAILED ("HEAD: prev is wrong");
+ if (strcmp ("bar", queue->head->data))
+ return FAILED ("HEAD: Second element is wrong");
+ if (strcmp ("foo", queue->head->next->data))
+ return FAILED ("HEAD: Third element is wrong");
+ if (NULL != queue->head->next->next)
+ return FAILED ("HEAD: End is wrong");
+
+ if (NULL != queue->tail->next)
+ return FAILED ("TAIL: next is wrong");
+ if (strcmp ("foo", queue->tail->data))
+ return FAILED ("TAIL: Second element is wrong");
+ if (strcmp ("bar", queue->tail->prev->data))
+ return FAILED ("TAIL: First element is wrong");
+ if (NULL != queue->tail->prev->prev)
+ return FAILED ("TAIL: End is wrong");
+
+ g_queue_free (queue);
+ return OK;
+}
+
+RESULT
+test_queue_new ()
+{
+ GQueue *queue = g_queue_new ();
+
+ if (queue->length != 0)
+ return FAILED ("expect length == 0");
+
+ if (queue->head != NULL)
+ return FAILED ("expect head == NULL");
+
+ if (queue->tail != NULL)
+ return FAILED ("expect tail == NULL");
+
+ g_queue_free (queue);
+ return OK;
+}
+
+RESULT
+test_queue_is_empty ()
+{
+ GQueue *queue = g_queue_new ();
+
+ if (g_queue_is_empty (queue) == FALSE)
+ return FAILED ("new queue should be empty");
+
+ g_queue_push_head (queue, "foo");
+
+ if (g_queue_is_empty (queue) == TRUE)
+ return FAILED ("expected TRUE");
+
+ g_queue_free (queue);
+
+ return OK;
+}
+
+static Test queue_tests [] = {
+ { "push", test_queue_push},
+ {"push_tail", test_queue_push_tail},
+ { "pop", test_queue_pop},
+ { "new", test_queue_new},
+ {"is_empty", test_queue_is_empty},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(queue_tests_init, queue_tests)
+
--- /dev/null
+#include <glib.h>
+#include <string.h>
+#include <stdio.h>
+#include "test.h"
+
+RESULT
+test_shell_argv1 ()
+{
+ GError *error;
+ gint argc;
+ gchar **argv;
+ gboolean ret;
+
+ /* The next line prints a critical error and returns FALSE
+ ret = g_shell_parse_argv (NULL, NULL, NULL, NULL);
+ */
+ ret = g_shell_parse_argv ("", NULL, NULL, NULL);
+ if (ret)
+ return FAILED ("1. It should return FALSE");
+
+ ret = g_shell_parse_argv ("hola", NULL, NULL, NULL);
+ if (!ret)
+ return FAILED ("2. It should return TRUE");
+
+ argc = 0;
+ ret = g_shell_parse_argv ("hola", &argc, NULL, NULL);
+ if (!ret)
+ return FAILED ("3. It should return TRUE");
+ if (argc != 1)
+ return FAILED ("4. argc was %d", argc);
+
+ argc = 0;
+ ret = g_shell_parse_argv ("hola bola", &argc, NULL, NULL);
+ if (!ret)
+ return FAILED ("5. It should return TRUE");
+ if (argc != 2)
+ return FAILED ("6. argc was %d", argc);
+
+ argc = 0;
+ ret = g_shell_parse_argv ("hola bola", &argc, &argv, NULL);
+ if (!ret)
+ return FAILED ("7. It should return TRUE");
+ if (argc != 2)
+ return FAILED ("8. argc was %d", argc);
+ if (strcmp (argv [0], "hola"))
+ return FAILED ("9. argv[0] was %s", argv [0]);
+ if (strcmp (argv [1], "bola"))
+ return FAILED ("10. argv[1] was %s", argv [1]);
+
+ g_strfreev (argv);
+ argv = NULL;
+ argc = 0;
+ error = NULL;
+ ret = g_shell_parse_argv ("hola 'bola'", &argc, &argv, &error);
+ if (!ret)
+ return FAILED ("11. It should return TRUE");
+ if (argc != 2)
+ return FAILED ("12. argc was %d expected 2", argc);
+ if (strcmp (argv [0], "hola"))
+ return FAILED ("13. argv[0] was %s", argv [0]);
+ if (strcmp (argv [1], "bola"))
+ return FAILED ("14. argv[1] was %s", argv [1]);
+ if (error != NULL)
+ return FAILED ("15. error is not null");
+
+
+ g_strfreev (argv);
+ argv = NULL;
+ argc = 0;
+ error = NULL;
+ ret = g_shell_parse_argv ("hola '' 'bola'", &argc, &argv, &error);
+ if (!ret)
+ return FAILED ("16. It should return TRUE");
+ if (argc != 3)
+ return FAILED ("17. argc was %d expected 3", argc);
+ if (strcmp (argv [0], "hola"))
+ return FAILED ("18. argv[0] was %s", argv [0]);
+ if (strcmp (argv [1], ""))
+ return FAILED ("19. argv[2] was %s", argv [1]);
+ if (strcmp (argv [2], "bola"))
+ return FAILED ("19. argv[2] was %s", argv [2]);
+ if (error != NULL)
+ return FAILED ("20. error is not null");
+
+ g_strfreev (argv);
+ argv = NULL;
+ argc = 0;
+ error = NULL;
+ ret = g_shell_parse_argv ("hola'' bola", &argc, &argv, &error);
+ if (!ret)
+ return FAILED ("21. It should return TRUE");
+ if (argc != 2)
+ return FAILED ("22. argc was %d expected 2", argc);
+ if (strcmp (argv [0], "hola"))
+ return FAILED ("23. argv[0] was %s", argv [0]);
+ if (strcmp (argv [1], "bola"))
+ return FAILED ("24. argv[2] was %s", argv [1]);
+ if (error != NULL)
+ return FAILED ("25. error is not null");
+
+ return OK;
+}
+
+RESULT
+test_shell_argv2 ()
+{
+ GError *error;
+ gint argc;
+ gchar **argv;
+ gboolean ret;
+
+ argv = NULL;
+ argc = 0;
+ error = NULL;
+ ret = g_shell_parse_argv ("hola \"bola\"", &argc, &argv, &error);
+ if (!ret)
+ return FAILED ("1. It should return TRUE");
+ if (argc != 2)
+ return FAILED ("2. argc was %d expected 2", argc);
+ if (strcmp (argv [0], "hola"))
+ return FAILED ("3. argv[0] was %s", argv [0]);
+ if (strcmp (argv [1], "bola"))
+ return FAILED ("4. argv[1] was %s", argv [1]);
+ if (error != NULL)
+ return FAILED ("5. error is not null");
+
+ g_strfreev (argv);
+ argv = NULL;
+ argc = 0;
+ error = NULL;
+ ret = g_shell_parse_argv ("hola \"\" \"bola \"", &argc, &argv, &error);
+ if (!ret)
+ return FAILED ("6. It should return TRUE");
+ if (argc != 3)
+ return FAILED ("7. argc was %d expected 3", argc);
+ if (strcmp (argv [0], "hola"))
+ return FAILED ("8. argv[0] was %s", argv [0]);
+ if (strcmp (argv [1], ""))
+ return FAILED ("9. argv[2] was %s", argv [1]);
+ if (strcmp (argv [2], "bola "))
+ return FAILED ("10. argv[2] was %s", argv [2]);
+ if (error != NULL)
+ return FAILED ("11. error is not null");
+
+ g_strfreev (argv);
+ argv = NULL;
+ argc = 0;
+ error = NULL;
+ ret = g_shell_parse_argv ("hola\n\t \"\t\" \"bola \"", &argc, &argv, &error);
+ if (!ret)
+ return FAILED ("10. It should return TRUE");
+ if (argc != 3)
+ return FAILED ("11. argc was %d expected 3", argc);
+ if (strcmp (argv [0], "hola"))
+ return FAILED ("12. argv[0] was %s", argv [0]);
+ if (strcmp (argv [1], "\t"))
+ return FAILED ("13. argv[2] was %s", argv [1]);
+ if (strcmp (argv [2], "bola "))
+ return FAILED ("14. argv[2] was %s", argv [2]);
+ if (error != NULL)
+ return FAILED ("15. error is not null");
+
+ g_strfreev (argv);
+ argv = NULL;
+ argc = 0;
+ error = NULL;
+ ret = g_shell_parse_argv ("hola\n\t \\\n \"\t\" \"bola \"", &argc, &argv, &error);
+ if (!ret)
+ return FAILED ("16. It should return TRUE");
+ if (argc != 3)
+ return FAILED ("17. argc was %d expected 3", argc);
+ if (strcmp (argv [0], "hola"))
+ return FAILED ("18. argv[0] was %s", argv [0]);
+ if (strcmp (argv [1], "\t"))
+ return FAILED ("19. argv[2] was %s", argv [1]);
+ if (strcmp (argv [2], "bola "))
+ return FAILED ("20. argv[2] was %s", argv [2]);
+ if (error != NULL)
+ return FAILED ("21. error is not null");
+
+ g_strfreev (argv);
+ return OK;
+}
+
+RESULT
+test_shell_argv3 ()
+{
+ GError *error;
+ gint argc;
+ gchar **argv;
+ gboolean ret;
+
+ argv = NULL;
+ argc = 0;
+ error = NULL;
+ ret = g_shell_parse_argv ("hola \"bola", &argc, &argv, &error);
+ if (ret)
+ return FAILED ("1. It should return FALSE");
+ if (argc != 0)
+ return FAILED ("2. argc was %d expected 0", argc);
+ if (argv != NULL)
+ return FAILED ("3. argv[0] was %s", argv [0]);
+ if (error == NULL)
+ return FAILED ("4. error is null");
+
+ /* Text ended before matching quote was found for ". (The text was 'hola "bola') */
+ g_error_free (error);
+ error = NULL;
+ ret = g_shell_parse_argv ("hola \\\"bola", &argc, &argv, &error);
+ if (!ret)
+ return FAILED ("5. It should return TRUE");
+ if (argc != 2)
+ return FAILED ("6. argc was %d expected 2", argc);
+ if (strcmp (argv [0], "hola"))
+ return FAILED ("18. argv[0] was %s", argv [0]);
+ if (strcmp (argv [1], "\"bola"))
+ return FAILED ("18. argv[1] was %s", argv [1]);
+ if (error != NULL)
+ return FAILED ("8. error is not null");
+
+ g_strfreev (argv);
+ argv = NULL;
+ argc = 0;
+ ret = g_shell_parse_argv ("hola \"\n\\'bola\"", &argc, &argv, &error);
+ if (!ret)
+ return FAILED ("9. It should return TRUE. %s", error->message);
+ if (argc != 2)
+ return FAILED ("10. argc was %d expected 2", argc);
+ if (strcmp (argv [0], "hola"))
+ return FAILED ("11. argv[0] was %s", argv [0]);
+ if (strcmp (argv [1], "\n\\'bola"))
+ return FAILED ("12. argv[1] was %s", argv [1]);
+ if (error != NULL)
+ return FAILED ("13. error is not null");
+
+ g_strfreev (argv);
+ argv = NULL;
+ argc = 0;
+ return OK;
+}
+
+// This was the 2.8 showstopper error
+RESULT
+test_shell_argv4 ()
+{
+ GError *error;
+ gint argc;
+ gchar **argv;
+ gboolean ret;
+ char *str = "'/usr/bin/gnome-terminal' -e \"bash -c 'read -p \\\"Press any key to continue...\\\" -n1;'\"";
+
+ argv = NULL;
+ argc = 0;
+ error = NULL;
+ ret = g_shell_parse_argv (str, &argc, &argv, &error);
+ if (!ret)
+ return FAILED ("1. It should return TRUE");
+ if (argc != 3)
+ return FAILED ("2. argc was %d expected 3", argc);
+ if (argv == NULL)
+ return FAILED ("3. argv[0] was NULL");
+ if (error != NULL)
+ return FAILED ("4. error was set");
+
+ if (strcmp (argv [0], "/usr/bin/gnome-terminal"))
+ return FAILED ("5. Expected /usr/bin/gnome-terminal got %s", argv [0]);
+ if (strcmp (argv [1], "-e"))
+ return FAILED ("6. Expected -e, got: %s", argv [1]);
+ if (strcmp (argv [2], "bash -c 'read -p \"Press any key to continue...\" -n1;'"))
+ return FAILED ("7. Got unexpected result: %s\n", argv [2]);
+
+ return OK;
+}
+
+// This is https://bugzilla.novell.com/show_bug.cgi?id=655896
+RESULT
+test_shell_argv5 ()
+{
+ GError *error;
+ gint argc;
+ gchar **argv;
+ gboolean ret;
+ char *str = "echo \"foo\",\"bar\"";
+
+ argv = NULL;
+ argc = 0;
+ error = NULL;
+ ret = g_shell_parse_argv (str, &argc, &argv, &error);
+ if (!ret)
+ return FAILED ("1. It should return TRUE");
+ if (argc != 2)
+ return FAILED ("2. argc was %d expected 2", argc);
+ if (argv == NULL)
+ return FAILED ("3. argv[0] was NULL");
+ if (error != NULL)
+ return FAILED ("4. error was set");
+
+ if (strcmp (argv [0], "echo"))
+ return FAILED ("5. Expected echo got %s", argv [0]);
+ if (strcmp (argv [1], "foo,bar"))
+ return FAILED ("6. Expected foo,bar, got: %s", argv [1]);
+
+ return OK;
+}
+
+RESULT
+test_quote ()
+{
+ if (strcmp (g_shell_quote ("foo"), "'foo'"))
+ return FAILED ("Should return 'foo'");
+
+ if (strcmp (g_shell_quote ("foo'bar"), "'foo'\\''bar'"))
+ return FAILED ("Should return 'foo'\\''bar'");
+
+ if (strcmp (g_shell_quote ("foo bar"), "'foo bar'"))
+ return FAILED ("Should return 'foo bar'");
+ return OK;
+}
+
+static Test shell_tests [] = {
+ {"test_shell_argv1", test_shell_argv1},
+ {"test_shell_argv2", test_shell_argv2},
+ {"test_shell_argv3", test_shell_argv3},
+ {"test_shell_argv4", test_shell_argv4},
+ {"test_shell_argv5", test_shell_argv5},
+ {"g_shell_quote", test_quote},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(shell_tests_init, shell_tests)
+
--- /dev/null
+/*
+ * Tests to ensure that our type definitions are correct
+ *
+ * These depend on -Werror, -Wall being set to catch the build error.
+ */
+#include <stdio.h>
+#ifndef _MSC_VER
+#include <stdint.h>
+#endif
+#include <string.h>
+#include <glib.h>
+#include "test.h"
+
+RESULT
+test_formats ()
+{
+ char buffer [1024];
+ gsize a = 1;
+
+ sprintf (buffer, "%" G_GSIZE_FORMAT, a);
+
+ return NULL;
+}
+
+RESULT
+test_ptrconv ()
+{
+ int iv, iv2;
+ unsigned int uv, uv2;
+ gpointer ptr;
+
+ iv = G_MAXINT32;
+ ptr = GINT_TO_POINTER (iv);
+ iv2 = GPOINTER_TO_INT (ptr);
+ if (iv != iv2)
+ return FAILED ("int to pointer and back conversions fail %d != %d", iv, iv2);
+
+ iv = G_MININT32;
+ ptr = GINT_TO_POINTER (iv);
+ iv2 = GPOINTER_TO_INT (ptr);
+ if (iv != iv2)
+ return FAILED ("int to pointer and back conversions fail %d != %d", iv, iv2);
+
+ iv = 1;
+ ptr = GINT_TO_POINTER (iv);
+ iv2 = GPOINTER_TO_INT (ptr);
+ if (iv != iv2)
+ return FAILED ("int to pointer and back conversions fail %d != %d", iv, iv2);
+
+ iv = -1;
+ ptr = GINT_TO_POINTER (iv);
+ iv2 = GPOINTER_TO_INT (ptr);
+ if (iv != iv2)
+ return FAILED ("int to pointer and back conversions fail %d != %d", iv, iv2);
+
+ iv = 0;
+ ptr = GINT_TO_POINTER (iv);
+ iv2 = GPOINTER_TO_INT (ptr);
+ if (iv != iv2)
+ return FAILED ("int to pointer and back conversions fail %d != %d", iv, iv2);
+
+ uv = 0;
+ ptr = GUINT_TO_POINTER (uv);
+ uv2 = GPOINTER_TO_UINT (ptr);
+ if (uv != uv2)
+ return FAILED ("uint to pointer and back conversions fail %u != %d", uv, uv2);
+
+ uv = 1;
+ ptr = GUINT_TO_POINTER (uv);
+ uv2 = GPOINTER_TO_UINT (ptr);
+ if (uv != uv2)
+ return FAILED ("uint to pointer and back conversions fail %u != %d", uv, uv2);
+
+ uv = UINT32_MAX;
+ ptr = GUINT_TO_POINTER (uv);
+ uv2 = GPOINTER_TO_UINT (ptr);
+ if (uv != uv2)
+ return FAILED ("uint to pointer and back conversions fail %u != %d", uv, uv2);
+
+ return NULL;
+
+}
+
+typedef struct {
+ int a;
+ int b;
+} my_struct;
+
+RESULT
+test_offset ()
+{
+ if (G_STRUCT_OFFSET (my_struct, a) != 0)
+ return FAILED ("offset of a is not zero");
+
+ if (G_STRUCT_OFFSET (my_struct, b) != 4 && G_STRUCT_OFFSET (my_struct, b) != 8)
+ return FAILED ("offset of b is 4 or 8, macro might be busted");
+
+ return OK;
+}
+
+static Test size_tests [] = {
+ {"formats", test_formats},
+ {"ptrconv", test_ptrconv},
+ {"g_struct_offset", test_offset},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(size_tests_init, size_tests)
--- /dev/null
+#include <stdio.h>
+#include <string.h>
+#include <glib.h>
+#include "test.h"
+
+
+RESULT
+test_slist_nth ()
+{
+ char *foo = "foo";
+ char *bar = "bar";
+ char *baz = "baz";
+ GSList *nth, *list;
+ list = g_slist_prepend (NULL, baz);
+ list = g_slist_prepend (list, bar);
+ list = g_slist_prepend (list, foo);
+
+ nth = g_slist_nth (list, 0);
+ if (nth->data != foo)
+ return FAILED ("nth failed. #0");
+
+ nth = g_slist_nth (list, 1);
+ if (nth->data != bar)
+ return FAILED ("nth failed. #1");
+
+ nth = g_slist_nth (list, 2);
+ if (nth->data != baz)
+ return FAILED ("nth failed. #2");
+
+ nth = g_slist_nth (list, 3);
+ if (nth)
+ return FAILED ("nth failed. #3: %s", nth->data);
+
+ g_slist_free (list);
+ return OK;
+}
+
+RESULT
+test_slist_index ()
+{
+ int i;
+ char *foo = "foo";
+ char *bar = "bar";
+ char *baz = "baz";
+ GSList *list;
+ list = g_slist_prepend (NULL, baz);
+ list = g_slist_prepend (list, bar);
+ list = g_slist_prepend (list, foo);
+
+ i = g_slist_index (list, foo);
+ if (i != 0)
+ return FAILED ("index failed. #0: %d", i);
+
+ i = g_slist_index (list, bar);
+ if (i != 1)
+ return FAILED ("index failed. #1: %d", i);
+
+ i = g_slist_index (list, baz);
+ if (i != 2)
+ return FAILED ("index failed. #2: %d", i);
+
+ g_slist_free (list);
+ return OK;
+}
+
+RESULT
+test_slist_append ()
+{
+ GSList *foo;
+ GSList *list = g_slist_append (NULL, "first");
+ if (g_slist_length (list) != 1)
+ return FAILED ("append(null,...) failed");
+
+ foo = g_slist_append (list, "second");
+ if (foo != list)
+ return FAILED ("changed list head on non-empty");
+
+ if (g_slist_length (list) != 2)
+ return FAILED ("Append failed");
+
+ g_slist_free (list);
+ return OK;
+}
+
+RESULT
+test_slist_concat ()
+{
+ GSList *foo = g_slist_prepend (NULL, "foo");
+ GSList *bar = g_slist_prepend (NULL, "bar");
+
+ GSList *list = g_slist_concat (foo, bar);
+
+ if (g_slist_length (list) != 2)
+ return FAILED ("Concat failed.");
+
+ g_slist_free (list);
+ return OK;
+}
+
+RESULT
+test_slist_find ()
+{
+ GSList *list = g_slist_prepend (NULL, "three");
+ GSList *found;
+ char *data;
+
+ list = g_slist_prepend (list, "two");
+ list = g_slist_prepend (list, "one");
+
+ data = "four";
+ list = g_slist_append (list, data);
+
+ found = g_slist_find (list, data);
+
+ if (found->data != data)
+ return FAILED ("Find failed");
+
+ g_slist_free (list);
+ return OK;
+}
+
+static gint
+find_custom (gconstpointer a, gconstpointer b)
+{
+ return(strcmp (a, b));
+}
+
+RESULT
+test_slist_find_custom ()
+{
+ GSList *list = NULL, *found;
+ char *foo = "foo";
+ char *bar = "bar";
+ char *baz = "baz";
+
+ list = g_slist_prepend (list, baz);
+ list = g_slist_prepend (list, bar);
+ list = g_slist_prepend (list, foo);
+
+ found = g_slist_find_custom (list, baz, find_custom);
+
+ if (found == NULL)
+ return FAILED ("Find failed");
+
+ g_slist_free (list);
+
+ return OK;
+}
+
+RESULT
+test_slist_remove ()
+{
+ GSList *list = g_slist_prepend (NULL, "three");
+ char *one = "one";
+ list = g_slist_prepend (list, "two");
+ list = g_slist_prepend (list, one);
+
+ list = g_slist_remove (list, one);
+
+ if (g_slist_length (list) != 2)
+ return FAILED ("Remove failed");
+
+ if (strcmp ("two", list->data) != 0)
+ return FAILED ("Remove failed");
+
+ g_slist_free (list);
+ return OK;
+}
+
+RESULT
+test_slist_remove_link ()
+{
+ GSList *foo = g_slist_prepend (NULL, "a");
+ GSList *bar = g_slist_prepend (NULL, "b");
+ GSList *baz = g_slist_prepend (NULL, "c");
+ GSList *list = foo;
+
+ foo = g_slist_concat (foo, bar);
+ foo = g_slist_concat (foo, baz);
+
+ list = g_slist_remove_link (list, bar);
+
+ if (g_slist_length (list) != 2)
+ return FAILED ("remove_link failed #1");
+
+ if (bar->next != NULL)
+ return FAILED ("remove_link failed #2");
+
+ g_slist_free (list);
+ g_slist_free (bar);
+
+ return OK;
+}
+
+static gint
+compare (gconstpointer a, gconstpointer b)
+{
+ char *foo = (char *) a;
+ char *bar = (char *) b;
+
+ if (strlen (foo) < strlen (bar))
+ return -1;
+
+ return 1;
+}
+
+RESULT
+test_slist_insert_sorted ()
+{
+ GSList *list = g_slist_prepend (NULL, "a");
+ list = g_slist_append (list, "aaa");
+
+ /* insert at the middle */
+ list = g_slist_insert_sorted (list, "aa", compare);
+ if (strcmp ("aa", list->next->data))
+ return FAILED("insert_sorted failed #1");
+
+ /* insert at the beginning */
+ list = g_slist_insert_sorted (list, "", compare);
+ if (strcmp ("", list->data))
+ return FAILED ("insert_sorted failed #2");
+
+ /* insert at the end */
+ list = g_slist_insert_sorted (list, "aaaa", compare);
+ if (strcmp ("aaaa", g_slist_last (list)->data))
+ return FAILED ("insert_sorted failed #3");
+
+ g_slist_free (list);
+ return OK;
+}
+
+RESULT
+test_slist_insert_before ()
+{
+ GSList *foo, *bar, *baz;
+
+ foo = g_slist_prepend (NULL, "foo");
+ foo = g_slist_insert_before (foo, NULL, "bar");
+ bar = g_slist_last (foo);
+
+ if (strcmp (bar->data, "bar"))
+ return FAILED ("1");
+
+ baz = g_slist_insert_before (foo, bar, "baz");
+ if (foo != baz)
+ return FAILED ("2");
+
+ if (strcmp (foo->next->data, "baz"))
+ return FAILED ("3: %s", foo->next->data);
+
+ g_slist_free (foo);
+ return OK;
+}
+
+#define N_ELEMS 100
+
+static int intcompare (gconstpointer p1, gconstpointer p2)
+{
+ return GPOINTER_TO_INT (p1) - GPOINTER_TO_INT (p2);
+}
+
+static gboolean verify_sort (GSList *list, int len)
+{
+ int prev = GPOINTER_TO_INT (list->data);
+ len--;
+ for (list = list->next; list; list = list->next) {
+ int curr = GPOINTER_TO_INT (list->data);
+ if (prev > curr)
+ return FALSE;
+ prev = curr;
+
+ if (len == 0)
+ return FALSE;
+ len--;
+ }
+ return len == 0;
+}
+
+RESULT
+test_slist_sort ()
+{
+ int i, j, mul;
+ GSList *list = NULL;
+
+ for (i = 0; i < N_ELEMS; ++i)
+ list = g_slist_prepend (list, GINT_TO_POINTER (i));
+ list = g_slist_sort (list, intcompare);
+ if (!verify_sort (list, N_ELEMS))
+ return FAILED ("decreasing list");
+
+ g_slist_free (list);
+
+ list = NULL;
+ for (i = 0; i < N_ELEMS; ++i)
+ list = g_slist_prepend (list, GINT_TO_POINTER (-i));
+ list = g_slist_sort (list, intcompare);
+ if (!verify_sort (list, N_ELEMS))
+ return FAILED ("increasing list");
+
+ g_slist_free (list);
+
+ list = g_slist_prepend (NULL, GINT_TO_POINTER (0));
+ for (i = 1; i < N_ELEMS; ++i) {
+ list = g_slist_prepend (list, GINT_TO_POINTER (-i));
+ list = g_slist_prepend (list, GINT_TO_POINTER (i));
+ }
+ list = g_slist_sort (list, intcompare);
+ if (!verify_sort (list, 2*N_ELEMS-1))
+ return FAILED ("alternating list");
+
+ g_slist_free (list);
+
+ list = NULL;
+ mul = 1;
+ for (i = 1; i < N_ELEMS; ++i) {
+ mul = -mul;
+ for (j = 0; j < i; ++j)
+ list = g_slist_prepend (list, GINT_TO_POINTER (mul * j));
+ }
+ list = g_slist_sort (list, intcompare);
+ if (!verify_sort (list, (N_ELEMS*N_ELEMS - N_ELEMS)/2))
+ return FAILED ("wavering list");
+
+ g_slist_free (list);
+
+ return OK;
+}
+
+static Test slist_tests [] = {
+ {"nth", test_slist_nth},
+ {"index", test_slist_index},
+ {"append", test_slist_append},
+ {"concat", test_slist_concat},
+ {"find", test_slist_find},
+ {"find_custom", test_slist_find_custom},
+ {"remove", test_slist_remove},
+ {"remove_link", test_slist_remove_link},
+ {"insert_sorted", test_slist_insert_sorted},
+ {"insert_before", test_slist_insert_before},
+ {"sort", test_slist_sort},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(slist_tests_init, slist_tests)
+
--- /dev/null
+#include <config.h>
+#include <glib.h>
+#include <string.h>
+#include <stdio.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include "test.h"
+
+#ifdef G_OS_WIN32
+#include <io.h>
+#define read _read
+#define close _close
+#endif
+
+RESULT
+test_spawn_sync ()
+{
+ gchar *out;
+ gchar *err;
+ gint status = -1;
+ GError *error = NULL;
+
+ if (!g_spawn_command_line_sync ("ls", &out, &err, &status, &error))
+ return FAILED ("Error executing 'ls'");
+
+ if (status != 0)
+ return FAILED ("Status is %d", status);
+
+ if (out == NULL || strlen (out) == 0)
+ return FAILED ("Didn't get any output from ls!?");
+
+ g_free (out);
+ g_free (err);
+ return OK;
+}
+
+RESULT
+test_spawn_async ()
+{
+ /*
+gboolean
+g_spawn_async_with_pipes (const gchar *working_directory,
+ gchar **argv,
+ gchar **envp,
+ GSpawnFlags flags,
+ GSpawnChildSetupFunc child_setup,
+ gpointer user_data,
+ GPid *child_pid,
+ gint *standard_input,
+ gint *standard_output,
+ gint *standard_error,
+ GError **error) */
+ char *argv [15];
+ int stdout_fd = -1;
+ char buffer [512];
+ pid_t child_pid = 0;
+
+ memset (argv, 0, 15 * sizeof (char *));
+ argv [0] = "ls";
+ if (!g_spawn_async_with_pipes (NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, &child_pid, NULL, &stdout_fd, NULL, NULL))
+ return FAILED ("1 Failed to run ls");
+ if (child_pid == 0)
+ return FAILED ("2 child pid not returned");
+ if (stdout_fd == -1)
+ return FAILED ("3 out fd is -1");
+
+ while (read (stdout_fd, buffer, 512) > 0);
+ close (stdout_fd);
+
+ return OK;
+}
+
+static Test spawn_tests [] = {
+ {"g_shell_spawn_sync", test_spawn_sync},
+ {"g_shell_spawn_async_with_pipes", test_spawn_async},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(spawn_tests_init, spawn_tests)
+
+
--- /dev/null
+#include <glib.h>
+#include <string.h>
+#include <stdio.h>
+#include "test.h"
+
+/* This test is just to be used with valgrind */
+RESULT
+test_strfreev ()
+{
+ gchar **array = g_new (gchar *, 4);
+ array [0] = g_strdup ("one");
+ array [1] = g_strdup ("two");
+ array [2] = g_strdup ("three");
+ array [3] = NULL;
+
+ g_strfreev (array);
+ g_strfreev (NULL);
+
+ return OK;
+}
+
+RESULT
+test_concat ()
+{
+ gchar *x = g_strconcat ("Hello", ", ", "world", NULL);
+ if (strcmp (x, "Hello, world") != 0)
+ return FAILED("concat failed, got: %s", x);
+ g_free (x);
+ return OK;
+}
+
+RESULT
+test_split ()
+{
+ const gchar *to_split = "Hello world, how are we doing today?";
+ gint i;
+ gchar **v;
+
+ v= g_strsplit(to_split, " ", 0);
+
+ if(v == NULL) {
+ return FAILED("split failed, got NULL vector (1)");
+ }
+
+ for(i = 0; v[i] != NULL; i++);
+ if(i != 7) {
+ return FAILED("split failed, expected 7 tokens, got %d", i);
+ }
+
+ g_strfreev(v);
+
+ v = g_strsplit(to_split, ":", -1);
+ if(v == NULL) {
+ return FAILED("split failed, got NULL vector (2)");
+ }
+
+ for(i = 0; v[i] != NULL; i++);
+ if(i != 1) {
+ return FAILED("split failed, expected 1 token, got %d", i);
+ }
+
+ if(strcmp(v[0], to_split) != 0) {
+ return FAILED("expected vector[0] to be '%s' but it was '%s'",
+ to_split, v[0]);
+ }
+ g_strfreev(v);
+
+ v = g_strsplit ("", ":", 0);
+ if (v == NULL)
+ return FAILED ("g_strsplit returned NULL");
+ g_strfreev (v);
+
+ v = g_strsplit ("/home/miguel/dingus", "/", 0);
+ if (v [0][0] != 0)
+ return FAILED ("Got a non-empty first element");
+ g_strfreev (v);
+
+ v = g_strsplit ("appdomain1, Version=0.0.0.0, Culture=neutral", ",", 4);
+ if (strcmp (v [0], "appdomain1") != 0)
+ return FAILED ("Invalid value");
+
+ if (strcmp (v [1], " Version=0.0.0.0") != 0)
+ return FAILED ("Invalid value");
+
+ if (strcmp (v [2], " Culture=neutral") != 0)
+ return FAILED ("Invalid value");
+
+ if (v [3] != NULL)
+ return FAILED ("Expected only 3 elements");
+
+ g_strfreev (v);
+
+ v = g_strsplit ("abcXYdefXghiXYjklYmno", "XY", 4);
+ if (strcmp (v [0], "abc") != 0)
+ return FAILED ("Invalid value 0");
+
+ if (strcmp (v [1], "defXghi") != 0)
+ return FAILED ("Invalid value 1");
+
+ if (strcmp (v [2], "jklYmno") != 0)
+ return FAILED ("Invalid value 2");
+
+ if (v [3] != NULL)
+ return FAILED ("Expected only 3 elements (1)");
+
+ g_strfreev (v);
+
+ v = g_strsplit ("abcXYdefXghiXYjklYmno", "XY", 2);
+ if (strcmp (v [0], "abc") != 0)
+ return FAILED ("Invalid value 3");
+
+ if (strcmp (v [1], "defXghiXYjklYmno") != 0)
+ return FAILED ("Invalid value 4");
+
+ if (v [2] != NULL)
+ return FAILED ("Expected only 2 elements (2)");
+
+ g_strfreev (v);
+
+ v = g_strsplit ("abcXYdefXghiXYjklYmnoXY", "XY", 3);
+ if (strcmp (v [0], "abc") != 0)
+ return FAILED ("Invalid value 5");
+
+ if (strcmp (v [1], "defXghi") != 0)
+ return FAILED ("Invalid value 6");
+
+ if (strcmp (v [2], "jklYmnoXY") != 0)
+ return FAILED ("Invalid value 7");
+
+ if (v [3] != NULL)
+ return FAILED ("Expected only 3 elements (3)");
+
+ g_strfreev (v);
+
+ v = g_strsplit ("abcXYXYXYdefXY", "XY", -1);
+ if (strcmp (v [0], "abc") != 0)
+ return FAILED ("Invalid value 8");
+
+ if (strcmp (v [1], "") != 0)
+ return FAILED ("Invalid value 9");
+
+ if (strcmp (v [2], "") != 0)
+ return FAILED ("Invalid value 10");
+
+ if (strcmp (v [3], "def") != 0)
+ return FAILED ("Invalid value 11");
+
+ if (strcmp (v [4], "") != 0)
+ return FAILED ("Invalid value 12");
+
+ if (v [5] != NULL)
+ return FAILED ("Expected only 5 elements (4)");
+
+ g_strfreev (v);
+
+ v = g_strsplit ("XYXYXYabcXYdef", "XY", -1);
+ if (strcmp (v [0], "") != 0)
+ return FAILED ("Invalid value 13");
+
+ if (strcmp (v [1], "") != 0)
+ return FAILED ("Invalid value 14");
+
+ if (strcmp (v [2], "") != 0)
+ return FAILED ("Invalid value 15");
+
+ if (strcmp (v [3], "abc") != 0)
+ return FAILED ("Invalid value 16");
+
+ if (strcmp (v [4], "def") != 0)
+ return FAILED ("Invalid value 17");
+
+ if (v [5] != NULL)
+ return FAILED ("Expected only 5 elements (5)");
+
+ g_strfreev (v);
+
+ v = g_strsplit ("value=", "=", 2);
+ if (strcmp (v [0], "value") != 0)
+ return FAILED ("Invalid value 18; expected 'value', got '%s'", v [0]);
+ if (strcmp (v [1], "") != 0)
+ return FAILED ("Invalid value 19; expected '', got '%s'", v [1]);
+ if (v [2] != NULL)
+ return FAILED ("Expected only 2 elements (6)");
+
+ g_strfreev (v);
+
+ return OK;
+}
+
+RESULT
+test_split_set ()
+{
+ gchar **v;
+
+ v = g_strsplit_set ("abcXYdefXghiXYjklYmno", "XY", 6);
+ if (strcmp (v [0], "abc") != 0)
+ return FAILED ("Invalid value 0");
+
+ if (strcmp (v [1], "") != 0)
+ return FAILED ("Invalid value 1");
+
+ if (strcmp (v [2], "def") != 0)
+ return FAILED ("Invalid value 2");
+
+ if (strcmp (v [3], "ghi") != 0)
+ return FAILED ("Invalid value 3");
+
+ if (strcmp (v [4], "") != 0)
+ return FAILED ("Invalid value 4");
+
+ if (strcmp (v [5], "jklYmno") != 0)
+ return FAILED ("Invalid value 5");
+
+ if (v [6] != NULL)
+ return FAILED ("Expected only 6 elements (1)");
+
+ g_strfreev (v);
+
+ v = g_strsplit_set ("abcXYdefXghiXYjklYmno", "XY", 3);
+ if (strcmp (v [0], "abc") != 0)
+ return FAILED ("Invalid value 6");
+
+ if (strcmp (v [1], "") != 0)
+ return FAILED ("Invalid value 7");
+
+ if (strcmp (v [2], "defXghiXYjklYmno") != 0)
+ return FAILED ("Invalid value 8");
+
+ if (v [3] != NULL)
+ return FAILED ("Expected only 3 elements (2)");
+
+ g_strfreev (v);
+
+ v = g_strsplit_set ("abcXdefYghiXjklYmnoX", "XY", 5);
+ if (strcmp (v [0], "abc") != 0)
+ return FAILED ("Invalid value 9");
+
+ if (strcmp (v [1], "def") != 0)
+ return FAILED ("Invalid value 10");
+
+ if (strcmp (v [2], "ghi") != 0)
+ return FAILED ("Invalid value 11");
+
+ if (strcmp (v [3], "jkl") != 0)
+ return FAILED ("Invalid value 12");
+
+ if (strcmp (v [4], "mnoX") != 0)
+ return FAILED ("Invalid value 13");
+
+ if (v [5] != NULL)
+ return FAILED ("Expected only 5 elements (5)");
+
+ g_strfreev (v);
+
+ v = g_strsplit_set ("abcXYXdefXY", "XY", -1);
+ if (strcmp (v [0], "abc") != 0)
+ return FAILED ("Invalid value 14");
+
+ if (strcmp (v [1], "") != 0)
+ return FAILED ("Invalid value 15");
+
+ if (strcmp (v [2], "") != 0)
+ return FAILED ("Invalid value 16");
+
+ if (strcmp (v [3], "def") != 0)
+ return FAILED ("Invalid value 17");
+
+ if (strcmp (v [4], "") != 0)
+ return FAILED ("Invalid value 18");
+
+ if (strcmp (v [5], "") != 0)
+ return FAILED ("Invalid value 19");
+
+ if (v [6] != NULL)
+ return FAILED ("Expected only 6 elements (4)");
+
+ g_strfreev (v);
+
+ v = g_strsplit_set ("XYXabcXYdef", "XY", -1);
+ if (strcmp (v [0], "") != 0)
+ return FAILED ("Invalid value 20");
+
+ if (strcmp (v [1], "") != 0)
+ return FAILED ("Invalid value 21");
+
+ if (strcmp (v [2], "") != 0)
+ return FAILED ("Invalid value 22");
+
+ if (strcmp (v [3], "abc") != 0)
+ return FAILED ("Invalid value 23");
+
+ if (strcmp (v [4], "") != 0)
+ return FAILED ("Invalid value 24");
+
+ if (strcmp (v [5], "def") != 0)
+ return FAILED ("Invalid value 25");
+
+ if (v [6] != NULL)
+ return FAILED ("Expected only 6 elements (5)");
+
+ g_strfreev (v);
+
+ return OK;
+}
+
+RESULT
+test_strreverse ()
+{
+ RESULT res = OK;
+ gchar *a = g_strdup ("onetwothree");
+ gchar *a_target = "eerhtowteno";
+ gchar *b = g_strdup ("onetwothre");
+ gchar *b_target = "erhtowteno";
+ gchar *c = g_strdup ("");
+ gchar *c_target = "";
+
+ g_strreverse (a);
+ if (strcmp (a, a_target)) {
+ res = FAILED("strreverse failed. Expecting: '%s' and got '%s'\n", a, a_target);
+ goto cleanup;
+ }
+
+ g_strreverse (b);
+ if (strcmp (b, b_target)) {
+ res = FAILED("strreverse failed. Expecting: '%s' and got '%s'\n", b, b_target);
+ goto cleanup;
+ }
+
+ g_strreverse (c);
+ if (strcmp (c, c_target)) {
+ res = FAILED("strreverse failed. Expecting: '%s' and got '%s'\n", b, b_target);
+ goto cleanup;
+ }
+
+cleanup:
+ g_free (c);
+ g_free (b);
+ g_free (a);
+ return res;
+}
+
+RESULT
+test_strjoin ()
+{
+ char *s;
+
+ s = g_strjoin (NULL, "a", "b", NULL);
+ if (strcmp (s, "ab") != 0)
+ return FAILED ("Join of two strings with no separator fails");
+ g_free (s);
+
+ s = g_strjoin ("", "a", "b", NULL);
+ if (strcmp (s, "ab") != 0)
+ return FAILED ("Join of two strings with empty separator fails");
+ g_free (s);
+
+ s = g_strjoin ("-", "a", "b", NULL);
+ if (strcmp (s, "a-b") != 0)
+ return FAILED ("Join of two strings with separator fails");
+ g_free (s);
+
+ s = g_strjoin ("-", "aaaa", "bbbb", "cccc", "dddd", NULL);
+ if (strcmp (s, "aaaa-bbbb-cccc-dddd") != 0)
+ return FAILED ("Join of multiple strings fails");
+ g_free (s);
+
+ s = g_strjoin ("-", NULL);
+ if (s == NULL || (strcmp (s, "") != 0))
+ return FAILED ("Failed to join empty arguments");
+ g_free (s);
+
+ return OK;
+}
+
+RESULT
+test_strchug ()
+{
+ char *str = g_strdup (" \t\n hola");
+
+ g_strchug (str);
+ if (strcmp ("hola", str)) {
+ fprintf (stderr, "%s\n", str);
+ g_free (str);
+ return FAILED ("Failed.");
+ }
+ g_free (str);
+ return OK;
+}
+
+RESULT
+test_strchomp ()
+{
+ char *str = g_strdup ("hola \t");
+
+ g_strchomp (str);
+ if (strcmp ("hola", str)) {
+ fprintf (stderr, "%s\n", str);
+ g_free (str);
+ return FAILED ("Failed.");
+ }
+ g_free (str);
+ return OK;
+}
+
+RESULT
+test_strstrip ()
+{
+ char *str = g_strdup (" \t hola ");
+
+ g_strstrip (str);
+ if (strcmp ("hola", str)) {
+ fprintf (stderr, "%s\n", str);
+ g_free (str);
+ return FAILED ("Failed.");
+ }
+ g_free (str);
+ return OK;
+}
+
+#define urit(so,j) do { s = g_filename_to_uri (so, NULL, NULL); if (strcmp (s, j) != 0) return FAILED("Got %s expected %s", s, j); g_free (s); } while (0);
+
+#define errit(so) do { s = g_filename_to_uri (so, NULL, NULL); if (s != NULL) return FAILED ("got %s, expected NULL", s); } while (0);
+
+RESULT
+test_filename_to_uri ()
+{
+#ifdef G_OS_WIN32
+#else
+ char *s;
+
+ urit ("/a", "file:///a");
+ urit ("/home/miguel", "file:///home/miguel");
+ urit ("/home/mig uel", "file:///home/mig%20uel");
+ urit ("/\303\241", "file:///%C3%A1");
+ urit ("/\303\241/octal", "file:///%C3%A1/octal");
+ urit ("/%", "file:///%25");
+ urit ("/\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040", "file:///%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20");
+ urit ("/!$&'()*+,-./", "file:///!$&'()*+,-./");
+ urit ("/\042\043\045", "file:///%22%23%25");
+ urit ("/0123456789:=", "file:///0123456789:=");
+ urit ("/\073\074\076\077", "file:///%3B%3C%3E%3F");
+ urit ("/\133\134\135\136_\140\173\174\175", "file:///%5B%5C%5D%5E_%60%7B%7C%7D");
+ urit ("/\173\174\175\176\177\200", "file:///%7B%7C%7D~%7F%80");
+ urit ("/@ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", "file:///@ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
+ errit ("a");
+ errit ("./hola");
+#endif
+
+ return OK;
+}
+
+#define fileit(so,j) do { s = g_filename_from_uri (so, NULL, NULL); if (strcmp (s, j) != 0) return FAILED("Got %s expected %s", s, j); g_free (s); } while (0);
+
+#define ferrit(so) do { s = g_filename_from_uri (so, NULL, NULL); if (s != NULL) return FAILED ("got %s, expected NULL", s); } while (0);
+
+RESULT
+test_filename_from_uri ()
+{
+#ifdef G_OS_WIN32
+#else
+ char *s;
+
+ fileit ("file:///a", "/a");
+ fileit ("file:///%41", "/A");
+ fileit ("file:///home/miguel", "/home/miguel");
+ fileit ("file:///home/mig%20uel", "/home/mig uel");
+ ferrit ("/a");
+ ferrit ("a");
+ ferrit ("file://a");
+ ferrit ("file:a");
+ ferrit ("file:///%");
+ ferrit ("file:///%0");
+ ferrit ("file:///%jj");
+#endif
+
+ return OK;
+}
+
+RESULT
+test_ascii_xdigit_value ()
+{
+ int i;
+ gchar j;
+
+ i = g_ascii_xdigit_value ('9' + 1);
+ if (i != -1)
+ return FAILED ("'9' + 1");
+ i = g_ascii_xdigit_value ('0' - 1);
+ if (i != -1)
+ return FAILED ("'0' - 1");
+ i = g_ascii_xdigit_value ('a' - 1);
+ if (i != -1)
+ return FAILED ("'a' - 1");
+ i = g_ascii_xdigit_value ('f' + 1);
+ if (i != -1)
+ return FAILED ("'f' + 1");
+ i = g_ascii_xdigit_value ('A' - 1);
+ if (i != -1)
+ return FAILED ("'A' - 1");
+ i = g_ascii_xdigit_value ('F' + 1);
+ if (i != -1)
+ return FAILED ("'F' + 1");
+
+ for (j = '0'; j < '9'; j++) {
+ int c = g_ascii_xdigit_value (j);
+ if (c != (j - '0'))
+ return FAILED ("Digits %c -> %d", j, c);
+ }
+ for (j = 'a'; j < 'f'; j++) {
+ int c = g_ascii_xdigit_value (j);
+ if (c != (j - 'a' + 10))
+ return FAILED ("Lower %c -> %d", j, c);
+ }
+ for (j = 'A'; j < 'F'; j++) {
+ int c = g_ascii_xdigit_value (j);
+ if (c != (j - 'A' + 10))
+ return FAILED ("Upper %c -> %d", j, c);
+ }
+ return OK;
+}
+
+RESULT
+test_strdelimit ()
+{
+ gchar *str;
+
+ str = g_strdup (G_STR_DELIMITERS);
+ str = g_strdelimit (str, NULL, 'a');
+ if (0 != strcmp ("aaaaaaa", str))
+ return FAILED ("All delimiters: '%s'", str);
+ g_free (str);
+ str = g_strdup ("hola");
+ str = g_strdelimit (str, "ha", '+');
+ if (0 != strcmp ("+ol+", str))
+ return FAILED ("2 delimiters: '%s'", str);
+ g_free (str);
+ return OK;
+}
+
+#define NUMBERS "0123456789"
+
+RESULT
+test_strlcpy ()
+{
+ const gchar *src = "onetwothree";
+ gchar *dest;
+ gsize i;
+
+ dest = g_malloc (strlen (src) + 1);
+ memset (dest, 0, strlen (src) + 1);
+ i = g_strlcpy (dest, src, (gsize)-1);
+ if (i != strlen (src))
+ return FAILED ("Test1 got %d", i);
+
+ if (0 != strcmp (dest, src))
+ return FAILED ("Src and dest not equal");
+
+ i = g_strlcpy (dest, src, 3);
+ if (i != strlen (src))
+ return FAILED ("Test1 got %d", i);
+ if (0 != strcmp (dest, "on"))
+ return FAILED ("Test2");
+
+ i = g_strlcpy (dest, src, 1);
+ if (i != strlen (src))
+ return FAILED ("Test3 got %d", i);
+ if (*dest != '\0')
+ return FAILED ("Test4");
+
+ i = g_strlcpy (dest, src, 12345);
+ if (i != strlen (src))
+ return FAILED ("Test4 got %d", i);
+ if (0 != strcmp (dest, src))
+ return FAILED ("Src and dest not equal 2");
+ g_free (dest);
+
+ /* This is a test for g_filename_from_utf8, even if it does not look like it */
+ dest = g_filename_from_utf8 (NUMBERS, strlen (NUMBERS), NULL, NULL, NULL);
+ if (0 != strcmp (dest, NUMBERS))
+ return FAILED ("problem [%s] and [%s]", dest, NUMBERS);
+ g_free (dest);
+
+ return OK;
+}
+
+RESULT
+test_strescape ()
+{
+ gchar *str;
+
+ str = g_strescape ("abc", NULL);
+ if (strcmp ("abc", str))
+ return FAILED ("#1");
+ str = g_strescape ("\t\b\f\n\r\\\"abc", NULL);
+ if (strcmp ("\\t\\b\\f\\n\\r\\\\\\\"abc", str))
+ return FAILED ("#2 %s", str);
+ str = g_strescape ("\001abc", NULL);
+ if (strcmp ("\\001abc", str))
+ return FAILED ("#3 %s", str);
+ str = g_strescape ("\001abc", "\001");
+ if (strcmp ("\001abc", str))
+ return FAILED ("#3 %s", str);
+ return OK;
+}
+
+RESULT
+test_ascii_strncasecmp ()
+{
+ int n;
+
+ n = g_ascii_strncasecmp ("123", "123", 1);
+ if (n != 0)
+ return FAILED ("Should have been 0");
+
+ n = g_ascii_strncasecmp ("423", "123", 1);
+ if (n != 3)
+ return FAILED ("Should have been 3, got %d", n);
+
+ n = g_ascii_strncasecmp ("123", "423", 1);
+ if (n != -3)
+ return FAILED ("Should have been -3, got %d", n);
+
+ n = g_ascii_strncasecmp ("1", "1", 10);
+ if (n != 0)
+ return FAILED ("Should have been 0, got %d", n);
+ return OK;
+}
+
+RESULT
+test_ascii_strdown ()
+{
+ const gchar *a = "~09+AaBcDeFzZ$0909EmPAbCdEEEEEZZZZAAA";
+ const gchar *b = "~09+aabcdefzz$0909empabcdeeeeezzzzaaa";
+ gchar *c;
+ gint n, l;
+
+ l = (gint)strlen (b);
+ c = g_ascii_strdown (a, l);
+ n = g_ascii_strncasecmp (b, c, l);
+
+ if (n != 0) {
+ g_free (c);
+ return FAILED ("Should have been 0, got %d", n);
+ }
+
+ g_free (c);
+ return OK;
+}
+
+RESULT
+test_strdupv ()
+{
+ gchar **one;
+ gchar **two;
+ gint len;
+
+ one = g_strdupv (NULL);
+ if (one)
+ return FAILED ("Should have been NULL");
+
+ one = g_malloc (sizeof (gchar *));
+ *one = NULL;
+ two = g_strdupv (one);
+ if (!two)
+ FAILED ("Should have been not NULL");
+ len = g_strv_length (two);
+ if (len)
+ FAILED ("Should have been 0");
+ g_strfreev (two);
+ g_strfreev (one);
+ return NULL;
+}
+
+static Test strutil_tests [] = {
+ {"g_strfreev", test_strfreev},
+ {"g_strconcat", test_concat},
+ {"g_strsplit", test_split},
+ {"g_strsplit_set", test_split_set},
+ {"g_strreverse", test_strreverse},
+ {"g_strjoin", test_strjoin},
+ {"g_strchug", test_strchug},
+ {"g_strchomp", test_strchomp},
+ {"g_strstrip", test_strstrip},
+ {"g_filename_to_uri", test_filename_to_uri},
+ {"g_filename_from_uri", test_filename_from_uri},
+ {"g_ascii_xdigit_value", test_ascii_xdigit_value},
+ {"g_strdelimit", test_strdelimit},
+ {"g_strlcpy", test_strlcpy},
+ {"g_strescape", test_strescape},
+ {"g_ascii_strncasecmp", test_ascii_strncasecmp },
+ {"g_ascii_strdown", test_ascii_strdown },
+ {"g_strdupv", test_strdupv },
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(strutil_tests_init, strutil_tests)
+
+
--- /dev/null
+#include <glib.h>
+#include <string.h>
+#include <stdio.h>
+#include "test.h"
+
+#define sfail(k,p) if (s->str [p] != k) { g_string_free (s,TRUE); return FAILED("Got %s, Failed at %d, expected '%c'", s->str, p, k);}
+
+RESULT
+test_append_speed()
+{
+ GString *s = g_string_new("");
+ gint i;
+
+ for(i = 0; i < 1024; i++) {
+ g_string_append(s, "x");
+ }
+
+ if(strlen (s->str) != 1024) {
+ return FAILED("Incorrect string size, got: %s %d",
+ s->str, strlen(s->str));
+ }
+
+ g_string_free (s, TRUE);
+
+ return OK;
+}
+
+RESULT
+test_append_c_speed()
+{
+ GString *s = g_string_new("");
+ gint i;
+
+ for(i = 0; i < 1024; i++) {
+ g_string_append_c(s, 'x');
+ }
+
+ if(strlen(s->str) != 1024) {
+ return FAILED("Incorrect string size, got: %s %d", s->str,
+ strlen(s->str));
+ }
+
+ g_string_free(s, TRUE);
+
+ return OK;
+}
+
+RESULT
+test_gstring ()
+{
+ GString *s = g_string_new_len ("My stuff", 2);
+ char *ret;
+ int i;
+
+ if (strcmp (s->str, "My") != 0)
+ return "Expected only 'My' on the string";
+ g_string_free (s, TRUE);
+
+ s = g_string_new_len ("My\0\0Rest", 6);
+ if (s->str [2] != 0)
+ return "Null was not copied";
+ if (strcmp (s->str+4, "Re") != 0){
+ return "Did not find the 'Re' part";
+ }
+
+ g_string_append (s, "lalalalalalalalalalalalalalalalalalalalalalal");
+ if (s->str [2] != 0)
+ return "Null as not copied";
+ if (strncmp (s->str+4, "Relala", 6) != 0){
+ return FAILED("Did not copy correctly, got: %s", s->str+4);
+ }
+
+ g_string_free (s, TRUE);
+
+ s = g_string_new ("");
+ for (i = 0; i < 1024; i++){
+ g_string_append_c (s, 'x');
+ }
+ if (strlen (s->str) != 1024){
+ return FAILED("Incorrect string size, got: %s %d\n", s->str, strlen (s->str));
+ }
+ g_string_free (s, TRUE);
+
+ s = g_string_new ("hola");
+ g_string_sprintfa (s, "%s%d", ", bola", 5);
+ if (strcmp (s->str, "hola, bola5") != 0){
+ return FAILED("Incorrect data, got: %s\n", s->str);
+ }
+ g_string_free (s, TRUE);
+
+ s = g_string_new ("Hola");
+ g_string_printf (s, "Dingus");
+
+ /* Test that it does not release it */
+ ret = g_string_free (s, FALSE);
+ g_free (ret);
+
+ s = g_string_new_len ("H" "\000" "H", 3);
+ g_string_append_len (s, "1" "\000" "2", 3);
+ sfail ('H', 0);
+ sfail ( 0, 1);
+ sfail ('H', 2);
+ sfail ('1', 3);
+ sfail ( 0, 4);
+ sfail ('2', 5);
+ g_string_free (s, TRUE);
+
+ return OK;
+}
+
+RESULT
+test_sized ()
+{
+ GString *s = g_string_sized_new (20);
+
+ if (s->str [0] != 0)
+ return FAILED ("Expected an empty string");
+ if (s->len != 0)
+ return FAILED ("Expected an empty len");
+
+ g_string_free (s, TRUE);
+
+ return NULL;
+}
+
+RESULT
+test_truncate ()
+{
+ GString *s = g_string_new ("0123456789");
+ g_string_truncate (s, 3);
+
+ if (strlen (s->str) != 3)
+ return FAILED ("size of string should have been 3, instead it is [%s]\n", s->str);
+ g_string_free (s, TRUE);
+
+ s = g_string_new ("a");
+ s = g_string_truncate (s, 10);
+ if (strlen (s->str) != 1)
+ return FAILED ("The size is not 1");
+ g_string_truncate (s, (gsize)-1);
+ if (strlen (s->str) != 1)
+ return FAILED ("The size is not 1");
+ g_string_truncate (s, 0);
+ if (strlen (s->str) != 0)
+ return FAILED ("The size is not 0");
+
+ g_string_free (s, TRUE);
+
+ return NULL;
+}
+
+RESULT
+test_prepend ()
+{
+ GString *s = g_string_new ("dingus");
+ g_string_prepend (s, "one");
+
+ if (strcmp (s->str, "onedingus") != 0)
+ return FAILED ("Failed, expected onedingus, got [%s]", s->str);
+
+ g_string_free (s, TRUE);
+
+ /* This is to force the code that where stuff does not fit in the allocated block */
+ s = g_string_sized_new (1);
+ g_string_prepend (s, "one");
+ if (strcmp (s->str, "one") != 0)
+ return FAILED ("Got erroneous result, expected [one] got [%s]", s->str);
+ g_string_free (s, TRUE);
+
+ /* This is to force the path where things fit */
+ s = g_string_new ("123123123123123123123123");
+ g_string_truncate (s, 1);
+ if (strcmp (s->str, "1") != 0)
+ return FAILED ("Expected [1] string, got [%s]", s->str);
+
+ g_string_prepend (s, "pre");
+ if (strcmp (s->str, "pre1") != 0)
+ return FAILED ("Expected [pre1], got [%s]", s->str);
+ g_string_free (s, TRUE);
+
+ return NULL;
+}
+
+RESULT
+test_appendlen ()
+{
+ GString *s = g_string_new ("");
+
+ g_string_append_len (s, "boo\000x", 0);
+ if (s->len != 0)
+ return FAILED ("The length is not zero %d", s->len);
+ g_string_append_len (s, "boo\000x", 5);
+ if (s->len != 5)
+ return FAILED ("The length is not five %d", s->len);
+ g_string_append_len (s, "ha", -1);
+ if (s->len != 7)
+ return FAILED ("The length is not seven %d", s->len);
+
+ g_string_free (s, TRUE);
+
+ return NULL;
+}
+
+RESULT
+test_macros ()
+{
+ char *s = g_strdup (G_STRLOC);
+ char *p = strchr (s + 2, ':');
+ int n;
+
+ if (p == NULL)
+ return FAILED ("Did not find a separator");
+ n = atoi (p+1);
+ if (n <= 0)
+ return FAILED ("did not find a valid line number");
+
+ *p = 0;
+ if (strcmp (s + strlen(s) - 8 , "string.c") != 0)
+ return FAILED ("This did not store the filename on G_STRLOC");
+
+ g_free (s);
+ return NULL;
+}
+
+static Test string_tests [] = {
+ {"append-speed", test_append_speed},
+ {"append_c-speed", test_append_c_speed},
+ {"ctor+append", test_gstring },
+ {"ctor+sized", test_sized },
+ {"truncate", test_truncate },
+ {"prepend", test_prepend },
+ {"append_len", test_appendlen },
+ {"macros", test_macros },
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(string_tests_init, string_tests)
--- /dev/null
+#!/bin/sh
+
+for arg in $@; do
+ if [ "x$arg" = "x--help" ]; then
+ echo "Usage: $0 [OPTION]... [ITERATIONS] [TESTGROUP]..."
+ echo ""
+ echo "Works the same as test-eglib or test-glib with the following"
+ echo "exception. Run test-eglib --help for details on normal testing"
+ echo ""
+ echo "If the first OPTION is --speed-compare, the following is"
+ echo "applicable to this program:"
+ echo ""
+ echo " --speed-compare run drivers in -qtni mode and report"
+ echo " speed comparison information"
+ echo ""
+ echo "After --speed-compare, the number of iterations "
+ echo "(optional, default is 100000) can be specified, followed "
+ echo "by specific tests to run (or none to run all)"
+ echo ""
+ echo "If --speed-compare is not the first argument, all arguments are"
+ echo "passed on directly to each driver"
+ echo ""
+ exit 1
+ fi
+done
+
+if [ ! -x "./test-glib" -o ! -x "./test-eglib" ]; then
+ make
+fi
+
+if [ "x$1" = "x--speed-compare" ]; then
+ ITERATIONS=100000
+ if [ ! -z "$2" ]; then
+ case $2 in
+ *[0-9]*) ITERATIONS=$2; break;
+ esac
+ fi
+
+ OPTIONS="-qnti $ITERATIONS"
+
+ for arg in $@; do
+ if [ "x$arg" = "x--speed-compare" ]; then
+ continue;
+ elif [ "$arg" = "$ITERATIONS" ]; then
+ continue;
+ fi
+
+ OPTIONS="$OPTIONS $arg"
+ done
+
+ echo "Running tests with $OPTIONS..."
+
+ GLIB=`./test-glib $OPTIONS`
+ EGLIB=`./test-eglib $OPTIONS`
+
+ # this blows
+ FASTER_NAME=`echo "$GLIB GLib $EGLIB EGlib" | awk '{ if($1 < $3) print $2; else print $4 }'`
+ FASTER_SPEED=`echo "$GLIB $EGLIB" | awk '{ if($1 < $2) print $1; else print $2 }'`
+ SLOWER_NAME=`echo "$GLIB GLib $EGLIB EGlib" | awk '{ if($1 > $3) print $2; else print $4 }'`
+ SLOWER_SPEED=`echo "$GLIB $EGLIB" | awk '{ if($1 > $2) print $1; else print $2 }'`
+
+ FASTER_PERCENTAGE=`echo "$SLOWER_SPEED $FASTER_SPEED" | awk '{ print ($1 / $2) * 100 }'`
+
+ echo "$FASTER_NAME $FASTER_SPEED"
+ echo "$SLOWER_NAME $SLOWER_SPEED"
+ echo "------------------------------------------------"
+ echo "$FASTER_NAME is $FASTER_PERCENTAGE% faster than $SLOWER_NAME"
+
+ exit 0;
+fi
+
+./test-eglib $@
+./test-glib $@
+
--- /dev/null
+/*
+ * EGLib Unit Group/Test Runners
+ *
+ * Author:
+ * Aaron Bockover (abockover@novell.com)
+ *
+ * (C) 2006 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.
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
+#include <config.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdarg.h>
+#include <glib.h>
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#ifdef G_OS_WIN32
+#include <winsock2.h>
+#endif
+
+#include "test.h"
+
+extern gint global_passed, global_tests;
+static gchar *last_result = NULL;
+
+gboolean
+run_test(Test *test, gchar **result_out)
+{
+ gchar *result;
+
+ if((result = test->handler()) == NULL) {
+ *result_out = NULL;
+ return TRUE;
+ } else {
+ *result_out = result;
+ return FALSE;
+ }
+}
+
+gboolean
+run_group(Group *group, gint iterations, gboolean quiet,
+ gboolean time, gchar *tests_to_run_s)
+{
+ Test *tests = group->handler();
+ gint i, j, passed = 0, total = 0;
+ gdouble start_time_group, start_time_test;
+ gchar **tests_to_run = NULL;
+
+ if(!quiet) {
+ if(iterations > 1) {
+ printf("[%s] (%dx)\n", group->name, iterations);
+ } else {
+ printf("[%s]\n", group->name);
+ }
+ }
+
+ if(tests_to_run_s != NULL) {
+ tests_to_run = eg_strsplit(tests_to_run_s, ",", -1);
+ }
+
+ start_time_group = get_timestamp();
+
+ for(i = 0; tests[i].name != NULL; i++) {
+ gchar *result = "";
+ gboolean iter_pass, run;
+
+ iter_pass = FALSE;
+ if(tests_to_run != NULL) {
+ gint j;
+ run = FALSE;
+ for(j = 0; tests_to_run[j] != NULL; j++) {
+ if(strcmp(tests_to_run[j], tests[i].name) == 0) {
+ run = TRUE;
+ break;
+ }
+ }
+ } else {
+ run = TRUE;
+ }
+
+ if(!run) {
+ continue;
+ }
+
+ total++;
+
+ if(!quiet) {
+ printf(" %s: ", tests[i].name);
+ }
+
+ start_time_test = get_timestamp();
+
+ for(j = 0; j < iterations; j++) {
+ iter_pass = run_test(&(tests[i]), &result);
+ if(!iter_pass) {
+ break;
+ }
+ }
+
+ if(iter_pass) {
+ passed++;
+ if(!quiet) {
+ if(time) {
+ printf("OK (%g)\n", get_timestamp() - start_time_test);
+ } else {
+ printf("OK\n");
+ }
+ }
+ } else {
+ if(!quiet) {
+ printf("FAILED (%s)\n", result);
+ }
+
+ if(last_result == result) {
+ last_result = NULL;
+ g_free(result);
+ }
+ }
+ }
+
+ global_passed += passed;
+ global_tests += total;
+
+ if(!quiet) {
+ gdouble pass_percentage = ((gdouble)passed / (gdouble)total) * 100.0;
+ if(time) {
+ printf(" %d / %d (%g%%, %g)\n", passed, total,
+ pass_percentage, get_timestamp() - start_time_group);
+ } else {
+ printf(" %d / %d (%g%%)\n", passed, total, pass_percentage);
+ }
+ }
+
+ if(tests_to_run != NULL) {
+ eg_strfreev(tests_to_run);
+ }
+
+ return passed == total;
+}
+
+RESULT
+FAILED(const gchar *format, ...)
+{
+ gchar *ret;
+ va_list args;
+ gint n;
+
+#if !defined(HAVE_VASPRINTF) && !defined(_EGLIB_MAJOR)
+ /* We are linked against the real glib, no vasprintf */
+ g_assert_not_reached ();
+ return NULL;
+#else
+ va_start(args, format);
+ n = g_vasprintf(&ret, format, args);
+ va_end(args);
+
+ if(n == -1) {
+ last_result = NULL;
+ return NULL;
+ }
+
+ last_result = ret;
+ return ret;
+#endif
+}
+
+gdouble
+get_timestamp()
+{
+ /* FIXME: We should use g_get_current_time here */
+ GTimeVal res;
+ g_get_current_time (&res);
+ return res.tv_sec + (1.e-6) * res.tv_usec;
+}
+
+/*
+ * Duplicating code here from EGlib to avoid g_strsplit skew between
+ * EGLib and GLib
+ */
+
+gchar **
+eg_strsplit (const gchar *string, const gchar *delimiter, gint max_tokens)
+{
+ gchar *string_c;
+ gchar *strtok_save, **vector;
+ gchar *token, *token_c;
+ gint size = 1;
+ size_t token_length;
+
+ g_return_val_if_fail(string != NULL, NULL);
+ g_return_val_if_fail(delimiter != NULL, NULL);
+ g_return_val_if_fail(delimiter[0] != 0, NULL);
+
+ token_length = strlen(string);
+ string_c = (gchar *)g_malloc(token_length + 1);
+ memcpy(string_c, string, token_length);
+ string_c[token_length] = 0;
+
+ vector = NULL;
+ token = (gchar *)strtok_r(string_c, delimiter, &strtok_save);
+
+ while(token != NULL) {
+ token_length = strlen(token);
+ token_c = (gchar *)g_malloc(token_length + 1);
+ memcpy(token_c, token, token_length);
+ token_c[token_length] = 0;
+
+ vector = vector == NULL ?
+ (gchar **)g_malloc(2 * sizeof(vector)) :
+ (gchar **)g_realloc(vector, (size + 1) * sizeof(vector));
+
+ vector[size - 1] = token_c;
+ size++;
+
+ if(max_tokens > 0 && size >= max_tokens) {
+ if(size > max_tokens) {
+ break;
+ }
+
+ token = strtok_save;
+ } else {
+ token = (gchar *)strtok_r(NULL, delimiter, &strtok_save);
+ }
+ }
+
+ if(vector != NULL && size > 0) {
+ vector[size - 1] = NULL;
+ }
+
+ g_free(string_c);
+ string_c = NULL;
+
+ return vector;
+}
+
+void
+eg_strfreev (gchar **str_array)
+{
+ gchar **orig = str_array;
+ if (str_array == NULL)
+ return;
+ while (*str_array != NULL){
+ g_free (*str_array);
+ str_array++;
+ }
+ g_free (orig);
+}
+
+
+
--- /dev/null
+/*
+ * EGLib Unit Group/Test Runners
+ *
+ * Author:
+ * Aaron Bockover (abockover@novell.com)
+ *
+ * (C) 2006 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.
+ */
+
+#ifndef _TEST_H
+#define _TEST_H
+
+#include <config.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+#include <glib.h>
+
+#ifdef _MSC_VER
+/* disable the following warnings
+ * C4100: The formal parameter is not referenced in the body of the function. The unreferenced parameter is ignored.
+ * C4127: conditional expression is constant (test macros produce a lot of these)
+*/
+#pragma warning(disable:4100 4127)
+#endif
+
+typedef gchar * RESULT;
+
+typedef struct _Test Test;
+typedef struct _Group Group;
+
+typedef gchar * (* RunTestHandler)();
+typedef Test * (* LoadGroupHandler)();
+
+struct _Test {
+ const gchar *name;
+ RunTestHandler handler;
+};
+
+struct _Group {
+ const gchar *name;
+ LoadGroupHandler handler;
+};
+
+gboolean run_group(Group *group, gint iterations, gboolean quiet,
+ gboolean time, gchar *tests);
+#undef FAILED
+RESULT FAILED(const gchar *format, ...);
+gdouble get_timestamp();
+gchar ** eg_strsplit (const gchar *string, const gchar *delimiter, gint max_tokens);
+void eg_strfreev (gchar **str_array);
+
+#define OK NULL
+
+#define DEFINE_TEST_GROUP_INIT(name, table) \
+ Test * (name)() { return table; }
+
+#define DEFINE_TEST_GROUP_INIT_H(name) \
+ Test * (name)();
+
+#endif /* _TEST_H */
+
+
--- /dev/null
+#include "test.h"
+
+DEFINE_TEST_GROUP_INIT_H(string_tests_init);
+DEFINE_TEST_GROUP_INIT_H(strutil_tests_init);
+DEFINE_TEST_GROUP_INIT_H(slist_tests_init);
+DEFINE_TEST_GROUP_INIT_H(list_tests_init);
+DEFINE_TEST_GROUP_INIT_H(hashtable_tests_init);
+DEFINE_TEST_GROUP_INIT_H(ptrarray_tests_init);
+DEFINE_TEST_GROUP_INIT_H(size_tests_init);
+DEFINE_TEST_GROUP_INIT_H(fake_tests_init);
+DEFINE_TEST_GROUP_INIT_H(array_tests_init);
+DEFINE_TEST_GROUP_INIT_H(queue_tests_init);
+DEFINE_TEST_GROUP_INIT_H(path_tests_init);
+DEFINE_TEST_GROUP_INIT_H(shell_tests_init);
+DEFINE_TEST_GROUP_INIT_H(spawn_tests_init);
+DEFINE_TEST_GROUP_INIT_H(timer_tests_init);
+DEFINE_TEST_GROUP_INIT_H(file_tests_init);
+DEFINE_TEST_GROUP_INIT_H(pattern_tests_init);
+DEFINE_TEST_GROUP_INIT_H(dir_tests_init);
+DEFINE_TEST_GROUP_INIT_H(markup_tests_init);
+DEFINE_TEST_GROUP_INIT_H(unicode_tests_init);
+DEFINE_TEST_GROUP_INIT_H(utf8_tests_init);
+DEFINE_TEST_GROUP_INIT_H(endian_tests_init);
+DEFINE_TEST_GROUP_INIT_H(module_tests_init);
+DEFINE_TEST_GROUP_INIT_H(memory_tests_init);
+
+static Group test_groups [] = {
+ {"string", string_tests_init},
+ {"strutil", strutil_tests_init},
+ {"ptrarray", ptrarray_tests_init},
+ {"slist", slist_tests_init},
+ {"list", list_tests_init},
+ {"hashtable", hashtable_tests_init},
+ {"sizes", size_tests_init},
+ {"fake", fake_tests_init},
+ {"array", array_tests_init},
+ {"queue", queue_tests_init},
+ {"path", path_tests_init},
+ {"shell", shell_tests_init},
+ {"markup", markup_tests_init},
+#if !DISABLE_PROCESS_TESTS
+ {"spawn", spawn_tests_init},
+ {"module", module_tests_init},
+#endif
+#if !DISABLE_FILESYSTEM_TESTS
+ {"file", file_tests_init},
+#endif
+ {"timer", timer_tests_init},
+ {"pattern", pattern_tests_init},
+ {"dir", dir_tests_init},
+ {"unicode", unicode_tests_init},
+ {"utf8", utf8_tests_init},
+ {"endian", endian_tests_init},
+ {"memory", memory_tests_init},
+ {NULL, NULL}
+};
+
--- /dev/null
+#include <config.h>
+#include <glib.h>
+#include <string.h>
+#include <math.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <stdlib.h>
+#include <stdio.h>
+
+#ifdef G_OS_WIN32
+#include <windows.h>
+#define sleep(t) Sleep((t) * 1000)
+#endif
+
+#include "test.h"
+
+RESULT
+test_timer ()
+{
+ GTimer *timer;
+ gdouble elapsed1, elapsed2;
+ gulong usec = 0;
+
+ timer = g_timer_new ();
+ sleep (1);
+ elapsed1 = g_timer_elapsed (timer, NULL);
+ if ((elapsed1 + 0.1) < 1.0)
+ return FAILED ("Elapsed time should be around 1s and was %f", elapsed1);
+
+ g_timer_stop (timer);
+ elapsed1 = g_timer_elapsed (timer, NULL);
+ elapsed2 = g_timer_elapsed (timer, &usec);
+ if (fabs (elapsed1 - elapsed2) > 0.000001)
+ return FAILED ("The elapsed times are not equal %f - %f.", elapsed1, elapsed2);
+
+ elapsed2 *= 1000000;
+ while (elapsed2 > 1000000)
+ elapsed2 -= 1000000;
+
+ if (fabs (usec - elapsed2) > 100.0)
+ return FAILED ("usecs are wrong.");
+
+ g_timer_destroy (timer);
+ return OK;
+}
+
+static Test timer_tests [] = {
+ {"g_timer", test_timer},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(timer_tests_init, timer_tests)
+
+
--- /dev/null
+#include "test.h"
+
+/*
+ * g_unichar_type
+ */
+RESULT
+test_g_unichar_type ()
+{
+ if (g_unichar_type ('A') != G_UNICODE_UPPERCASE_LETTER)
+ return FAILED ("#1");
+ if (g_unichar_type ('a') != G_UNICODE_LOWERCASE_LETTER)
+ return FAILED ("#2");
+ if (g_unichar_type ('1') != G_UNICODE_DECIMAL_NUMBER)
+ return FAILED ("#3");
+ if (g_unichar_type (0xA3) != G_UNICODE_CURRENCY_SYMBOL)
+ return FAILED ("#4");
+ return NULL;
+}
+
+/*
+ * g_unichar_toupper
+ */
+RESULT
+test_g_unichar_toupper ()
+{
+ if (g_unichar_toupper (0) != 0)
+ return FAILED ("#0");
+ if (g_unichar_toupper ('a') != 'A')
+ return FAILED ("#1");
+ if (g_unichar_toupper ('1') != '1')
+ return FAILED ("#2");
+ if (g_unichar_toupper (0x1C4) != 0x1C4)
+ return FAILED ("#3");
+ if (g_unichar_toupper (0x1F2) != 0x1F1)
+ return FAILED ("#4");
+ if (g_unichar_toupper (0x1F3) != 0x1F1)
+ return FAILED ("#5");
+ if (g_unichar_toupper (0xFFFF) != 0xFFFF)
+ return FAILED ("#6");
+ if (g_unichar_toupper (0x10428) != 0x10400)
+ return FAILED ("#7");
+ return NULL;
+}
+
+/*
+ * g_unichar_tolower
+ */
+RESULT
+test_g_unichar_tolower ()
+{
+ if (g_unichar_tolower (0) != 0)
+ return FAILED ("#0");
+ if (g_unichar_tolower ('A') != 'a')
+ return FAILED ("#1");
+ if (g_unichar_tolower ('1') != '1')
+ return FAILED ("#2");
+ if (g_unichar_tolower (0x1C5) != 0x1C6)
+ return FAILED ("#3");
+ if (g_unichar_tolower (0x1F1) != 0x1F3)
+ return FAILED ("#4");
+ if (g_unichar_tolower (0x1F2) != 0x1F3)
+ return FAILED ("#5");
+ if (g_unichar_tolower (0xFFFF) != 0xFFFF)
+ return FAILED ("#6");
+ return NULL;
+}
+
+/*
+ * g_unichar_totitle
+ */
+RESULT
+test_g_unichar_totitle ()
+{
+ if (g_unichar_toupper (0) != 0)
+ return FAILED ("#0");
+ if (g_unichar_totitle ('a') != 'A')
+ return FAILED ("#1");
+ if (g_unichar_totitle ('1') != '1')
+ return FAILED ("#2");
+ if (g_unichar_totitle (0x1C4) != 0x1C5)
+ return FAILED ("#3");
+ if (g_unichar_totitle (0x1F2) != 0x1F2)
+ return FAILED ("#4");
+ if (g_unichar_totitle (0x1F3) != 0x1F2)
+ return FAILED ("#5");
+ if (g_unichar_toupper (0xFFFF) != 0xFFFF)
+ return FAILED ("#6");
+ return NULL;
+}
+
+static Test unicode_tests [] = {
+ {"g_unichar_type", test_g_unichar_type},
+ {"g_unichar_toupper", test_g_unichar_toupper},
+ {"g_unichar_tolower", test_g_unichar_tolower},
+ {"g_unichar_totitle", test_g_unichar_totitle},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(unicode_tests_init, unicode_tests)
--- /dev/null
+#include <stdlib.h>
+
+#include "test.h"
+
+/*
+ * g_utf16_to_utf8
+ */
+
+glong
+compare_strings_utf8_pos (const gchar *expected, const gchar *actual, glong size)
+{
+ int i;
+ for (i = 0; i < size; i++)
+ if (expected [i] != actual [i])
+ return i;
+ return -1;
+}
+
+RESULT
+compare_strings_utf8_RESULT (const gchar *expected, const gchar *actual, glong size)
+{
+ glong ret;
+
+ ret = compare_strings_utf8_pos (expected, actual, size);
+ if (ret < 0)
+ return OK;
+ return FAILED ("Incorrect output: expected '%s' but was '%s', differ at %d\n", expected, actual, ret);
+}
+
+void
+gchar_to_gunichar2 (gunichar2 ret[], const gchar *src)
+{
+ int i;
+
+ for (i = 0; src [i]; i++)
+ ret [i] = src [i];
+ ret [i] = 0;
+}
+
+RESULT
+compare_utf16_to_utf8_explicit (const gchar *expected, const gunichar2 *utf16, glong len_in, glong len_out, glong size_spec)
+{
+ GError *error;
+ gchar* ret;
+ RESULT result;
+ glong in_read, out_read;
+
+ result = NULL;
+
+ error = NULL;
+ ret = g_utf16_to_utf8 (utf16, size_spec, &in_read, &out_read, &error);
+ if (error) {
+ result = FAILED ("The error is %d %s\n", (error)->code, (error)->message);
+ g_error_free (error);
+ if (ret)
+ g_free (ret);
+ return result;
+ }
+ if (in_read != len_in)
+ result = FAILED ("Read size is incorrect: expected %d but was %d\n", len_in, in_read);
+ else if (out_read != len_out)
+ result = FAILED ("Converted size is incorrect: expected %d but was %d\n", len_out, out_read);
+ else
+ result = compare_strings_utf8_RESULT (expected, ret, len_out);
+
+ g_free (ret);
+ if (result)
+ return result;
+
+ return OK;
+}
+
+RESULT
+compare_utf16_to_utf8 (const gchar *expected, const gunichar2 *utf16, glong len_in, glong len_out)
+{
+ RESULT result;
+
+ result = compare_utf16_to_utf8_explicit (expected, utf16, len_in, len_out, -1);
+ if (result != OK)
+ return result;
+ return compare_utf16_to_utf8_explicit (expected, utf16, len_in, len_out, len_in);
+}
+
+RESULT
+test_utf16_to_utf8 ()
+{
+ const gchar *src0 = "", *src1 = "ABCDE", *src2 = "\xE5\xB9\xB4\x27", *src3 = "\xEF\xBC\xA1", *src4 = "\xEF\xBD\x81", *src5 = "\xF0\x90\x90\x80";
+ gunichar2 str0 [] = {0}, str1 [6], str2 [] = {0x5E74, 39, 0}, str3 [] = {0xFF21, 0}, str4 [] = {0xFF41, 0}, str5 [] = {0xD801, 0xDC00, 0};
+ RESULT result;
+
+ gchar_to_gunichar2 (str1, src1);
+
+ /* empty string */
+ result = compare_utf16_to_utf8 (src0, str0, 0, 0);
+ if (result != OK)
+ return result;
+
+ result = compare_utf16_to_utf8 (src1, str1, 5, 5);
+ if (result != OK)
+ return result;
+ result = compare_utf16_to_utf8 (src2, str2, 2, 4);
+ if (result != OK)
+ return result;
+ result = compare_utf16_to_utf8 (src3, str3, 1, 3);
+ if (result != OK)
+ return result;
+ result = compare_utf16_to_utf8 (src4, str4, 1, 3);
+ if (result != OK)
+ return result;
+ result = compare_utf16_to_utf8 (src5, str5, 2, 4);
+ if (result != OK)
+ return result;
+
+ return OK;
+}
+
+/*
+ * g_utf8_to_utf16
+ */
+
+glong
+compare_strings_utf16_pos (const gunichar2 *expected, const gunichar2 *actual, glong size)
+{
+ int i;
+ for (i = 0; i < size; i++)
+ if (expected [i] != actual [i])
+ return i;
+ return -1;
+}
+
+RESULT
+compare_strings_utf16_RESULT (const gunichar2 *expected, const gunichar2 *actual, glong size)
+{
+ glong ret;
+
+ ret = compare_strings_utf16_pos (expected, actual, size);
+ if (ret < 0)
+ return OK;
+ return FAILED ("Incorrect output: expected '%s' but was '%s', differ at %d ('%c' x '%c')\n", expected, actual, ret, expected [ret], actual [ret]);
+}
+
+#if !defined(EGLIB_TESTS)
+#define eg_utf8_to_utf16_with_nuls g_utf8_to_utf16
+#endif
+
+RESULT
+compare_utf8_to_utf16_explicit (const gunichar2 *expected, const gchar *utf8, glong len_in, glong len_out, glong size_spec, gboolean include_nuls)
+{
+ GError *error;
+ gunichar2* ret;
+ RESULT result;
+ glong in_read, out_read;
+
+ result = NULL;
+
+ error = NULL;
+ if (include_nuls)
+ ret = eg_utf8_to_utf16_with_nuls (utf8, size_spec, &in_read, &out_read, &error);
+ else
+ ret = g_utf8_to_utf16 (utf8, size_spec, &in_read, &out_read, &error);
+
+ if (error) {
+ result = FAILED ("The error is %d %s\n", (error)->code, (error)->message);
+ g_error_free (error);
+ if (ret)
+ g_free (ret);
+ return result;
+ }
+ if (in_read != len_in)
+ result = FAILED ("Read size is incorrect: expected %d but was %d\n", len_in, in_read);
+ else if (out_read != len_out)
+ result = FAILED ("Converted size is incorrect: expected %d but was %d\n", len_out, out_read);
+ else
+ result = compare_strings_utf16_RESULT (expected, ret, len_out);
+
+ g_free (ret);
+ if (result)
+ return result;
+
+ return OK;
+}
+
+RESULT
+compare_utf8_to_utf16_general (const gunichar2 *expected, const gchar *utf8, glong len_in, glong len_out, gboolean include_nuls)
+{
+ RESULT result;
+
+ result = compare_utf8_to_utf16_explicit (expected, utf8, len_in, len_out, -1, include_nuls);
+ if (result != OK)
+ return result;
+ return compare_utf8_to_utf16_explicit (expected, utf8, len_in, len_out, len_in, include_nuls);
+}
+
+RESULT
+compare_utf8_to_utf16 (const gunichar2 *expected, const gchar *utf8, glong len_in, glong len_out)
+{
+ return compare_utf8_to_utf16_general (expected, utf8, len_in, len_out, FALSE);
+}
+
+RESULT
+compare_utf8_to_utf16_with_nuls (const gunichar2 *expected, const gchar *utf8, glong len_in, glong len_out)
+{
+ return compare_utf8_to_utf16_explicit (expected, utf8, len_in, len_out, len_in, TRUE);
+}
+
+
+RESULT
+test_utf8_seq ()
+{
+ const gchar *src = "\xE5\xB9\xB4\x27";
+ glong in_read, out_read;
+ //gunichar2 expected [6];
+ GError *error = NULL;
+ gunichar2 *dst;
+
+ //printf ("got: %s\n", src);
+ dst = g_utf8_to_utf16 (src, (glong)strlen (src), &in_read, &out_read, &error);
+ if (error != NULL){
+ return error->message;
+ }
+
+ if (in_read != 4) {
+ return FAILED ("in_read is expected to be 4 but was %d\n", in_read);
+ }
+ if (out_read != 2) {
+ return FAILED ("out_read is expected to be 2 but was %d\n", out_read);
+ }
+ g_free (dst);
+
+ return OK;
+}
+
+RESULT
+test_utf8_to_utf16 ()
+{
+ const gchar *src0 = "", *src1 = "ABCDE", *src2 = "\xE5\xB9\xB4\x27", *src3 = "\xEF\xBC\xA1", *src4 = "\xEF\xBD\x81";
+ gunichar2 str0 [] = {0}, str1 [6], str2 [] = {0x5E74, 39, 0}, str3 [] = {0xFF21, 0}, str4 [] = {0xFF41, 0};
+ RESULT result;
+
+ gchar_to_gunichar2 (str1, src1);
+
+ /* empty string */
+ result = compare_utf8_to_utf16 (str0, src0, 0, 0);
+ if (result != OK)
+ return result;
+
+ result = compare_utf8_to_utf16 (str1, src1, 5, 5);
+ if (result != OK)
+ return result;
+ result = compare_utf8_to_utf16 (str2, src2, 4, 2);
+ if (result != OK)
+ return result;
+ result = compare_utf8_to_utf16 (str3, src3, 3, 1);
+ if (result != OK)
+ return result;
+ result = compare_utf8_to_utf16 (str4, src4, 3, 1);
+ if (result != OK)
+ return result;
+
+ return OK;
+}
+
+RESULT
+test_utf8_to_utf16_with_nuls ()
+{
+ const gchar *src0 = "", *src1 = "AB\0DE", *src2 = "\xE5\xB9\xB4\x27", *src3 = "\xEF\xBC\xA1", *src4 = "\xEF\xBD\x81";
+ gunichar2 str0 [] = {0}, str1 [] = {'A', 'B', 0, 'D', 'E', 0}, str2 [] = {0x5E74, 39, 0}, str3 [] = {0xFF21, 0}, str4 [] = {0xFF41, 0};
+ RESULT result;
+
+#if !defined(EGLIB_TESTS)
+ return OK;
+#endif
+
+ /* implicit length is forbidden */
+ if (eg_utf8_to_utf16_with_nuls (src1, -1, NULL, NULL, NULL) != NULL)
+ return FAILED ("explicit nulls must fail with -1 length\n");
+
+ /* empty string */
+ result = compare_utf8_to_utf16_with_nuls (str0, src0, 0, 0);
+ if (result != OK)
+ return result;
+
+ result = compare_utf8_to_utf16_with_nuls (str1, src1, 5, 5);
+ if (result != OK)
+ return result;
+ result = compare_utf8_to_utf16_with_nuls (str2, src2, 4, 2);
+ if (result != OK)
+ return result;
+ result = compare_utf8_to_utf16_with_nuls (str3, src3, 3, 1);
+ if (result != OK)
+ return result;
+ result = compare_utf8_to_utf16_with_nuls (str4, src4, 3, 1);
+ if (result != OK)
+ return result;
+
+ return OK;
+}
+
+typedef struct {
+ char *content;
+ size_t length;
+} convert_result_t;
+
+RESULT
+test_convert ()
+{
+ static const char *charsets[] = { "UTF-8", "UTF-16LE", "UTF-16BE", "UTF-32LE", "UTF-32BE" };
+ gsize length, converted_length, n;
+ char *content, *converted, *path;
+ convert_result_t **expected;
+ GError *err = NULL;
+ const char *srcdir;
+ gboolean loaded;
+ guint i, j, k;
+ char c;
+
+ if (!(srcdir = getenv ("srcdir")) && !(srcdir = getenv ("PWD")))
+ return FAILED ("srcdir not defined!");
+
+ expected = g_malloc (sizeof (convert_result_t *) * G_N_ELEMENTS (charsets));
+
+ /* first load all our test samples... */
+ for (i = 0; i < G_N_ELEMENTS (charsets); i++) {
+ path = g_strdup_printf ("%s%c%s.txt", srcdir, G_DIR_SEPARATOR, charsets[i]);
+ loaded = g_file_get_contents (path, &content, &length, &err);
+ g_free (path);
+
+ if (!loaded) {
+ for (j = 0; j < i; j++) {
+ g_free (expected[j]->content);
+ g_free (expected[j]);
+ }
+
+ g_free (expected);
+
+ return FAILED ("Failed to load content for %s: %s", charsets[i], err->message);
+ }
+
+ expected[i] = g_malloc (sizeof (convert_result_t));
+ expected[i]->content = content;
+ expected[i]->length = length;
+ }
+
+ /* test conversion from every charset to every other charset */
+ for (i = 0; i < G_N_ELEMENTS (charsets); i++) {
+ for (j = 0; j < G_N_ELEMENTS (charsets); j++) {
+ converted = g_convert (expected[i]->content, expected[i]->length, charsets[j],
+ charsets[i], NULL, &converted_length, NULL);
+
+ if (converted == NULL) {
+ for (k = 0; k < G_N_ELEMENTS (charsets); k++) {
+ g_free (expected[k]->content);
+ g_free (expected[k]);
+ }
+
+ g_free (expected);
+
+ return FAILED ("Failed to convert from %s to %s: NULL", charsets[i], charsets[j]);
+ }
+
+ if (converted_length != expected[j]->length) {
+ length = expected[j]->length;
+
+ for (k = 0; k < G_N_ELEMENTS (charsets); k++) {
+ g_free (expected[k]->content);
+ g_free (expected[k]);
+ }
+
+ g_free (converted);
+ g_free (expected);
+
+ return FAILED ("Failed to convert from %s to %s: expected %u bytes, got %u",
+ charsets[i], charsets[j], length, converted_length);
+ }
+
+ for (n = 0; n < converted_length; n++) {
+ if (converted[n] != expected[j]->content[n]) {
+ c = expected[j]->content[n];
+
+ for (k = 0; k < G_N_ELEMENTS (charsets); k++) {
+ g_free (expected[k]->content);
+ g_free (expected[k]);
+ }
+
+ g_free (converted);
+ g_free (expected);
+
+ return FAILED ("Failed to convert from %s to %s: expected 0x%x at offset %u, got 0x%x",
+ charsets[i], charsets[j], c, n, converted[n]);
+ }
+ }
+
+ g_free (converted);
+ }
+ }
+
+ for (k = 0; k < G_N_ELEMENTS (charsets); k++) {
+ g_free (expected[k]->content);
+ g_free (expected[k]);
+ }
+
+ g_free (expected);
+
+ return OK;
+}
+
+
+RESULT
+test_xdigit ()
+{
+ static char test_chars[] = {
+ '0', '1', '2', '3', '4',
+ '5', '6', '7', '8', '9',
+ 'a', 'b', 'c', 'd', 'e', 'f', 'g',
+ 'A', 'B', 'C', 'D', 'E', 'F', 'G'};
+ static gint32 test_values[] = {
+ 0, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9,
+ 10, 11, 12, 13, 14, 15, -1,
+ 10, 11, 12, 13, 14, 15, -1};
+
+ int i =0;
+
+ for (i = 0; i < sizeof(test_chars); i++)
+ if (g_unichar_xdigit_value ((gunichar)test_chars[i]) != test_values[i])
+ return FAILED("Incorrect value %d at index %d", test_values[i], i);
+
+ return OK;
+}
+
+static RESULT
+ucs4_to_utf16_check_result (const gunichar2 *result_str, const gunichar2 *expected_str,
+ glong result_items_read, glong expected_items_read,
+ glong result_items_written, glong expected_items_written,
+ GError* result_error, gboolean expect_error)
+{
+ glong i;
+ if (result_items_read != expected_items_read)
+ return FAILED("Incorrect number of items read; expected %d, got %d", expected_items_read, result_items_read);
+ if (result_items_written != expected_items_written)
+ return FAILED("Incorrect number of items written; expected %d, got %d", expected_items_written, result_items_written);
+ if (result_error && !expect_error)
+ return FAILED("There should not be an error code.");
+ if (!result_error && expect_error)
+ return FAILED("Unexpected error object.");
+ if (expect_error && result_str)
+ return FAILED("NULL should be returned when an error occurs.");
+ if (!expect_error && !result_str)
+ return FAILED("When no error occurs NULL should not be returned.");
+ for (i=0; i<expected_items_written;i++) {
+ if (result_str [i] != expected_str [i])
+ return FAILED("Incorrect value %d at index %d", result_str [i], i);
+ }
+ if (result_str && result_str[expected_items_written] != '\0')
+ return FAILED("Null termination not found at the end of the string.");
+
+ return OK;
+}
+
+RESULT
+test_ucs4_to_utf16 ()
+{
+ static gunichar str1[12] = {'H','e','l','l','o',' ','W','o','r','l','d','\0'};
+ static gunichar2 exp1[12] = {'H','e','l','l','o',' ','W','o','r','l','d','\0'};
+ static gunichar str2[3] = {'h',0x80000000,'\0'};
+ static gunichar2 exp2[2] = {'h','\0'};
+ static gunichar str3[3] = {'h',0xDA00,'\0'};
+ static gunichar str4[3] = {'h',0x10FFFF,'\0'};
+ static gunichar2 exp4[4] = {'h',0xdbff,0xdfff,'\0'};
+ static gunichar str5[7] = {0xD7FF,0xD800,0xDFFF,0xE000,0x110000,0x10FFFF,'\0'};
+ static gunichar2 exp5[5] = {0xD7FF,0xE000,0xdbff,0xdfff,'\0'};
+ static gunichar str6[2] = {0x10400, '\0'};
+ static gunichar2 exp6[3] = {0xD801, 0xDC00, '\0'};
+ static glong read_write[12] = {1,1,0,0,0,0,1,1,0,0,1,2};
+ gunichar2* res;
+ glong items_read, items_written, current_write_index;
+ GError* err=0;
+ RESULT check_result;
+ glong i;
+
+ res = g_ucs4_to_utf16 (str1, 12, &items_read, &items_written, &err);
+ check_result = ucs4_to_utf16_check_result (res, exp1, items_read, 11, items_written, 11, err, FALSE);
+ if (check_result) return check_result;
+ g_free (res);
+
+ items_read = items_written = 0;
+ res = g_ucs4_to_utf16 (str2, 0, &items_read, &items_written, &err);
+ check_result = ucs4_to_utf16_check_result (res, exp2, items_read, 0, items_written, 0, err, FALSE);
+ if (check_result) return check_result;
+ g_free (res);
+
+ items_read = items_written = 0;
+ res = g_ucs4_to_utf16 (str2, 1, &items_read, &items_written, &err);
+ check_result = ucs4_to_utf16_check_result (res, exp2, items_read, 1, items_written, 1, err, FALSE);
+ if (check_result) return check_result;
+ g_free (res);
+
+ items_read = items_written = 0;
+ res = g_ucs4_to_utf16 (str2, 2, &items_read, &items_written, &err);
+ check_result = ucs4_to_utf16_check_result (res, 0, items_read, 1, items_written, 0, err, TRUE);
+ g_free (res);
+ if (check_result) return check_result;
+
+ items_read = items_written = 0;
+ err = 0;
+ res = g_ucs4_to_utf16 (str3, 2, &items_read, &items_written, &err);
+ check_result = ucs4_to_utf16_check_result (res, 0, items_read, 1, items_written, 0, err, TRUE);
+ if (check_result) return check_result;
+ g_free (res);
+
+ items_read = items_written = 0;
+ err = 0;
+ res = g_ucs4_to_utf16 (str4, 5, &items_read, &items_written, &err);
+ check_result = ucs4_to_utf16_check_result (res, exp4, items_read, 2, items_written, 3, err, FALSE);
+ if (check_result) return check_result;
+ g_free (res);
+
+ // This loop tests the bounds of the conversion algorithm
+ current_write_index = 0;
+ for (i=0;i<6;i++) {
+ items_read = items_written = 0;
+ err = 0;
+ res = g_ucs4_to_utf16 (&str5[i], 1, &items_read, &items_written, &err);
+ check_result = ucs4_to_utf16_check_result (res, &exp5[current_write_index],
+ items_read, read_write[i*2], items_written, read_write[(i*2)+1], err, !read_write[(i*2)+1]);
+ if (check_result) return check_result;
+ g_free (res);
+ current_write_index += items_written;
+ }
+
+ items_read = items_written = 0;
+ err = 0;
+ res = g_ucs4_to_utf16 (str6, 1, &items_read, &items_written, &err);
+ check_result = ucs4_to_utf16_check_result (res, exp6, items_read, 1, items_written, 2, err, FALSE);
+ if (check_result) return check_result;
+ g_free (res);
+
+ return OK;
+}
+
+static RESULT
+utf16_to_ucs4_check_result (const gunichar *result_str, const gunichar *expected_str,
+ glong result_items_read, glong expected_items_read,
+ glong result_items_written, glong expected_items_written,
+ GError* result_error, gboolean expect_error)
+{
+ glong i;
+ if (result_items_read != expected_items_read)
+ return FAILED("Incorrect number of items read; expected %d, got %d", expected_items_read, result_items_read);
+ if (result_items_written != expected_items_written)
+ return FAILED("Incorrect number of items written; expected %d, got %d", expected_items_written, result_items_written);
+ if (result_error && !expect_error)
+ return FAILED("There should not be an error code.");
+ if (!result_error && expect_error)
+ return FAILED("Unexpected error object.");
+ if (expect_error && result_str)
+ return FAILED("NULL should be returned when an error occurs.");
+ if (!expect_error && !result_str)
+ return FAILED("When no error occurs NULL should not be returned.");
+ for (i=0; i<expected_items_written;i++) {
+ if (result_str [i] != expected_str [i])
+ return FAILED("Incorrect value %d at index %d", result_str [i], i);
+ }
+ if (result_str && result_str[expected_items_written] != '\0')
+ return FAILED("Null termination not found at the end of the string.");
+
+ return OK;
+}
+
+RESULT
+test_utf16_to_ucs4 ()
+{
+ static gunichar2 str1[12] = {'H','e','l','l','o',' ','W','o','r','l','d','\0'};
+ static gunichar exp1[12] = {'H','e','l','l','o',' ','W','o','r','l','d','\0'};
+ static gunichar2 str2[7] = {'H', 0xD800, 0xDC01,0xD800,0xDBFF,'l','\0'};
+ static gunichar exp2[3] = {'H',0x00010001,'\0'};
+ static gunichar2 str3[4] = {'H', 0xDC00 ,'l','\0'};
+ static gunichar exp3[2] = {'H','\0'};
+ static gunichar2 str4[20] = {0xDC00,0xDFFF,0xDFF,0xD800,0xDBFF,0xD800,0xDC00,0xD800,0xDFFF,
+ 0xD800,0xE000,0xDBFF,0xDBFF,0xDBFF,0xDC00,0xDBFF,0xDFFF,0xDBFF,0xE000,'\0'};
+ static gunichar exp4[6] = {0xDFF,0x10000,0x103ff,0x10fc00,0x10FFFF,'\0'};
+ static gunichar2 str5[3] = {0xD801, 0xDC00, 0};
+ static gunichar exp5[2] = {0x10400, 0};
+ static glong read_write[33] = {1,0,0,1,0,0,1,1,1,2,1,0,2,2,1,2,2,1,2,1,0,2,1,0,2,2,1,2,2,1,2,1,0};
+ gunichar* res;
+ glong items_read, items_written, current_read_index,current_write_index;
+ GError* err=0;
+ RESULT check_result;
+ glong i;
+
+ res = g_utf16_to_ucs4 (str1, 12, &items_read, &items_written, &err);
+ check_result = utf16_to_ucs4_check_result (res, exp1, items_read, 11, items_written, 11, err, FALSE);
+ if (check_result) return check_result;
+ g_free (res);
+
+ items_read = items_written = 0;
+ res = g_utf16_to_ucs4 (str2, 0, &items_read, &items_written, &err);
+ check_result = utf16_to_ucs4_check_result (res, exp2, items_read, 0, items_written, 0, err, FALSE);
+ if (check_result) return check_result;
+ g_free (res);
+
+ items_read = items_written = 0;
+ res = g_utf16_to_ucs4 (str2, 1, &items_read, &items_written, &err);
+ check_result = utf16_to_ucs4_check_result (res, exp2, items_read, 1, items_written, 1, err, FALSE);
+ if (check_result) return check_result;
+ g_free (res);
+
+ items_read = items_written = 0;
+ res = g_utf16_to_ucs4 (str2, 2, &items_read, &items_written, &err);
+ check_result = utf16_to_ucs4_check_result (res, exp2, items_read, 1, items_written, 1, err, FALSE);
+ if (check_result) return check_result;
+ g_free (res);
+
+ items_read = items_written = 0;
+ res = g_utf16_to_ucs4 (str2, 3, &items_read, &items_written, &err);
+ check_result = utf16_to_ucs4_check_result (res, exp2, items_read, 3, items_written, 2, err, FALSE);
+ if (check_result) return check_result;
+ g_free (res);
+
+ items_read = items_written = 0;
+ res = g_utf16_to_ucs4 (str2, 4, &items_read, &items_written, &err);
+ check_result = utf16_to_ucs4_check_result (res, exp2, items_read, 3, items_written, 2, err, FALSE);
+ if (check_result) return check_result;
+ g_free (res);
+
+ items_read = items_written = 0;
+ res = g_utf16_to_ucs4 (str2, 5, &items_read, &items_written, &err);
+ check_result = utf16_to_ucs4_check_result (res, exp2, items_read, 4, items_written, 0, err, TRUE);
+ if (check_result) return check_result;
+ g_free (res);
+
+ items_read = items_written = 0;
+ err = 0;
+ res = g_utf16_to_ucs4 (str3, 5, &items_read, &items_written, &err);
+ check_result = utf16_to_ucs4_check_result (res, exp3, items_read, 1, items_written, 0, err, TRUE);
+ if (check_result) return check_result;
+ g_free (res);
+
+ // This loop tests the bounds of the conversion algorithm
+ current_read_index = current_write_index = 0;
+ for (i=0;i<11;i++) {
+ items_read = items_written = 0;
+ err = 0;
+ res = g_utf16_to_ucs4 (&str4[current_read_index], read_write[i*3], &items_read, &items_written, &err);
+ check_result = utf16_to_ucs4_check_result (res, &exp4[current_write_index], items_read,
+ read_write[(i*3)+1], items_written, read_write[(i*3)+2], err,
+ !read_write[(i*3)+2]);
+ if (check_result) return check_result;
+ g_free (res);
+ current_read_index += read_write[i*3];
+ current_write_index += items_written;
+ }
+
+ items_read = items_written = 0;
+ err = 0;
+ res = g_utf16_to_ucs4 (str5, 2, &items_read, &items_written, &err);
+ check_result = utf16_to_ucs4_check_result (res, exp5, items_read, 2, items_written, 1, err, FALSE);
+ if (check_result) return check_result;
+ g_free (res);
+
+ return OK;
+}
+RESULT
+test_utf8_strlen ()
+{
+ gchar word1 [] = {0xC2, 0x82,0x45,0xE1, 0x81, 0x83,0x58,0xF1, 0x82, 0x82, 0x82,'\0'};//Valid, len = 5
+ gchar word2 [] = {0xF1, 0x82, 0x82, 0x82,0xC2, 0x82,0x45,0xE1, 0x81, 0x83,0x58,'\0'};//Valid, len = 5
+ gchar word3 [] = {'h','e',0xC2, 0x82,0x45,'\0'}; //Valid, len = 4
+ gchar word4 [] = {0x62,0xC2, 0x82,0x45,0xE1, 0x81, 0x83,0x58,'\0'}; //Valid, len = 5
+
+ glong len = 0;
+
+ //Test word1
+ len = g_utf8_strlen (word1,-1);
+ if (len != 5)
+ return FAILED ("Word1 expected length of 5, but was %i", len);
+ //Do tests with different values for max parameter.
+ len = g_utf8_strlen (word1,1);
+ if (len != 0)
+ return FAILED ("Word1, max = 1, expected length of 0, but was %i", len);
+ len = g_utf8_strlen (word1,2);
+ if (len != 1)
+ return FAILED ("Word1, max = 1, expected length of 1, but was %i", len);
+ len = g_utf8_strlen (word1,3);
+ if (len != 2)
+ return FAILED ("Word1, max = 2, expected length of 2, but was %i", len);
+
+ //Test word2
+ len = g_utf8_strlen (word2,-1);
+ if (len != 5)
+ return FAILED ("Word2 expected length of 5, but was %i", len);
+
+ //Test word3
+ len = g_utf8_strlen (word3,-1);
+ if (len != 4)
+ return FAILED ("Word3 expected length of 4, but was %i", len);
+
+ //Test word4
+ len = g_utf8_strlen (word4,-1);
+ if (len != 5)
+ return FAILED ("Word4 expected length of 5, but was %i", len);
+
+ //Test null case
+ len = g_utf8_strlen(NULL,0);
+ if (len != 0)
+ return FAILED ("Expected passing null to result in a length of 0");
+ return OK;
+}
+
+RESULT
+test_utf8_get_char()
+{
+ gchar word1 [] = {0xC2, 0x82,0x45,0xE1, 0x81, 0x83,0x58,0xF1, 0x82, 0x82, 0x82,'\0'}; //Valid, len = 5
+
+ gunichar value = g_utf8_get_char (&word1 [0]);
+ if (value != 0x82UL)
+ return FAILED ("Expected value of 0x82, but was %x", value);
+ value = g_utf8_get_char (&word1 [2]);
+ if (value != 0x45UL)
+ return FAILED ("Expected value of 0x45, but was %x", value);
+ value = g_utf8_get_char (&word1 [3]);
+ if (value != 0x1043UL)
+ return FAILED ("Expected value of 0x1043, but was %x", value);
+ value = g_utf8_get_char (&word1 [6]);
+ if (value != 0x58UL)
+ return FAILED ("Expected value of 0x58, but was %x", value);
+ value = g_utf8_get_char (&word1 [7]);
+ if (value != 0x42082UL)
+ return FAILED ("Expected value of 0x42082, but was %x", value);
+
+ return OK;
+}
+
+RESULT
+test_utf8_next_char()
+{
+ gchar word1 [] = {0xC2, 0x82,0x45,0xE1, 0x81, 0x83,0x58,0xF1, 0x82, 0x82, 0x82,'\0'}; //Valid, len = 5
+ gchar word2 [] = {0xF1, 0x82, 0x82, 0x82,0xC2, 0x82,0x45,0xE1, 0x81, 0x83,0x58,'\0'}; //Valid, len = 5
+ gchar word1ExpectedValues [] = {0xC2, 0x45,0xE1, 0x58, 0xF1};
+ gchar word2ExpectedValues [] = {0xF1, 0xC2, 0x45, 0xE1, 0x58};
+
+ gchar* ptr = word1;
+ gint count = 0;
+ //Test word1
+ while (*ptr != 0) {
+ if (count > 4)
+ return FAILED ("Word1 has gone past its expected length");
+ if (*ptr != word1ExpectedValues[count])
+ return FAILED ("Word1 has an incorrect next_char at index %i", count);
+ ptr = g_utf8_next_char (ptr);
+ count++;
+ }
+
+ //Test word2
+ count = 0;
+ ptr = word2;
+ while (*ptr != 0) {
+ if (count > 4)
+ return FAILED ("Word2 has gone past its expected length");
+ if (*ptr != word2ExpectedValues[count])
+ return FAILED ("Word2 has an incorrect next_char at index %i", count);
+ ptr = g_utf8_next_char (ptr);
+ count++;
+ }
+
+ return OK;
+}
+
+RESULT
+test_utf8_validate()
+{
+ gchar invalidWord1 [] = {0xC3, 0x82, 0xC1,0x90,'\0'}; //Invalid, 1nd oct Can't be 0xC0 or 0xC1
+ gchar invalidWord2 [] = {0xC1, 0x89, 0x60, '\0'}; //Invalid, 1st oct can not be 0xC1
+ gchar invalidWord3 [] = {0xC2, 0x45,0xE1, 0x81, 0x83,0x58,'\0'}; //Invalid, oct after 0xC2 must be > 0x80
+
+ gchar validWord1 [] = {0xC2, 0x82, 0xC3,0xA0,'\0'}; //Valid
+ gchar validWord2 [] = {0xC2, 0x82,0x45,0xE1, 0x81, 0x83,0x58,0xF1, 0x82, 0x82, 0x82,'\0'}; //Valid
+
+ const gchar* end;
+ gboolean retVal = g_utf8_validate (invalidWord1, -1, &end);
+ if (retVal != FALSE)
+ return FAILED ("Expected invalidWord1 to be invalid");
+ if (end != &invalidWord1 [2])
+ return FAILED ("Expected end parameter to be pointing to invalidWord1[2]");
+
+ end = NULL;
+ retVal = g_utf8_validate (invalidWord2, -1, &end);
+ if (retVal != FALSE)
+ return FAILED ("Expected invalidWord2 to be invalid");
+ if (end != &invalidWord2 [0])
+ return FAILED ("Expected end parameter to be pointing to invalidWord2[0]");
+
+ end = NULL;
+ retVal = g_utf8_validate (invalidWord3, -1, &end);
+ if (retVal != FALSE)
+ return FAILED ("Expected invalidWord3 to be invalid");
+ if (end != &invalidWord3 [0])
+ return FAILED ("Expected end parameter to be pointing to invalidWord3[1]");
+
+ end = NULL;
+ retVal = g_utf8_validate (validWord1, -1, &end);
+ if (retVal != TRUE)
+ return FAILED ("Expected validWord1 to be valid");
+ if (end != &validWord1 [4])
+ return FAILED ("Expected end parameter to be pointing to validWord1[4]");
+
+ end = NULL;
+ retVal = g_utf8_validate (validWord2, -1, &end);
+ if (retVal != TRUE)
+ return FAILED ("Expected validWord2 to be valid");
+ if (end != &validWord2 [11])
+ return FAILED ("Expected end parameter to be pointing to validWord2[11]");
+ return OK;
+}
+
+glong
+utf8_byteslen (const gchar *src)
+{
+ int i = 0;
+ do {
+ if (src [i] == '\0')
+ return i;
+ i++;
+ } while (TRUE);
+}
+
+RESULT
+test_utf8_strcase_each (const gchar *src, const gchar *expected, gboolean strup)
+{
+ gchar *tmp;
+ glong len, len2;
+ RESULT r;
+
+ len = utf8_byteslen (src);
+ tmp = strup ? g_utf8_strup (src, len) : g_utf8_strdown (src, len);
+ len2 = utf8_byteslen (tmp);
+ r = compare_strings_utf8_RESULT (expected, tmp, len < len2 ? len2 : len);
+ g_free (tmp);
+ return r;
+}
+
+RESULT
+test_utf8_strup_each (const gchar *src, const gchar *expected)
+{
+ return test_utf8_strcase_each (src, expected, TRUE);
+}
+
+RESULT
+test_utf8_strdown_each (const gchar *src, const gchar *expected)
+{
+ return test_utf8_strcase_each (src, expected, FALSE);
+}
+
+/*
+ * g_utf8_strup
+ */
+RESULT
+test_utf8_strup ()
+{
+ RESULT r;
+
+ if ((r = test_utf8_strup_each ("aBc", "ABC")) != OK)
+ return r;
+ if ((r = test_utf8_strup_each ("x86-64", "X86-64")) != OK)
+ return r;
+ // U+3B1 U+392 -> U+391 U+392
+ if ((r = test_utf8_strup_each ("\xCE\xB1\xCE\x92", "\xCE\x91\xCE\x92")) != OK)
+ return r;
+ // U+FF21 -> U+FF21
+ if ((r = test_utf8_strup_each ("\xEF\xBC\xA1", "\xEF\xBC\xA1")) != OK)
+ return r;
+ // U+FF41 -> U+FF21
+ if ((r = test_utf8_strup_each ("\xEF\xBD\x81", "\xEF\xBC\xA1")) != OK)
+ return r;
+ // U+10428 -> U+10400
+ if ((r = test_utf8_strup_each ("\xF0\x90\x90\xA8", "\xF0\x90\x90\x80")) != OK)
+ return r;
+
+ return OK;
+}
+
+/*
+ * g_utf8_strdown
+ */
+RESULT
+test_utf8_strdown ()
+{
+ RESULT r;
+
+ if ((r = test_utf8_strdown_each ("aBc", "abc")) != OK)
+ return r;
+ if ((r = test_utf8_strdown_each ("X86-64", "x86-64")) != OK)
+ return r;
+ // U+391 U+3B2 -> U+3B1 U+3B2
+ if ((r = test_utf8_strdown_each ("\xCE\x91\xCE\xB2", "\xCE\xB1\xCE\xB2")) != OK)
+ return r;
+/*
+ // U+FF41 -> U+FF41
+ if ((r = test_utf8_strdown_each ("\xEF\xBC\x81", "\xEF\xBC\x81")) != OK)
+ return r;
+ // U+FF21 -> U+FF41
+ if ((r = test_utf8_strdown_each ("\xEF\xBC\xA1", "\xEF\xBD\x81")) != OK)
+ return r;
+ // U+10400 -> U+10428
+ if ((r = test_utf8_strdown_each ("\xF0\x90\x90\x80", "\xF0\x90\x90\xA8")) != OK)
+ return r;
+*/
+ return OK;
+}
+
+/*
+ * test initialization
+ */
+
+static Test utf8_tests [] = {
+ {"g_utf16_to_utf8", test_utf16_to_utf8},
+ {"g_utf8_to_utf16", test_utf8_to_utf16},
+ {"g_utf8_to_utf16_with_nuls", test_utf8_to_utf16_with_nuls},
+ {"g_utf8_seq", test_utf8_seq},
+ {"g_convert", test_convert },
+ {"g_unichar_xdigit_value", test_xdigit },
+ {"g_ucs4_to_utf16", test_ucs4_to_utf16 },
+ {"g_utf16_to_ucs4", test_utf16_to_ucs4 },
+ {"g_utf8_strlen", test_utf8_strlen },
+ {"g_utf8_get_char", test_utf8_get_char },
+ {"g_utf8_next_char", test_utf8_next_char },
+ {"g_utf8_validate", test_utf8_validate },
+ {"g_utf8_strup", test_utf8_strup},
+ {"g_utf8_strdown", test_utf8_strdown},
+ {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(utf8_tests_init, utf8_tests)
+
+
--- /dev/null
+#!/bin/bash
+
+# Author: Aaron Bockover
+# Licensed under MIT/X11
+# (C) 2006 Novell
+
+if [ "x$1" = "x--help" ]; then
+ echo "Usage: $0 [--show-only-mono]"
+ echo ""
+ echo "This script prints a sorted list of GLib functions used in Mono"
+ echo "that have not yet been implemented in EGlib."
+ echo ""
+ echo "If --show-only-mono is passed, then the script will print all"
+ echo "GLib functions used in Mono, whether or not they have been"
+ echo "implemented in EGlib yet."
+ echo ""
+ echo "This script relies on the MONO_CHECKOUT environment variable."
+ echo "MONO_CHECKOUT should be set to the location of a mono checkout."
+ echo ""
+ exit 1
+fi
+
+IGNORE_FUNCTIONS="g_hash_table_lookup_node g_hash_table_foreach_remove_or_steal g_hash_table_resize"
+
+if [ -z $MONO_CHECKOUT ]; then
+ if [ -e ../../mono.pc.in ]; then
+ MONO_CHECKOUT=../..
+ else
+ MONO_CHECKOUT=~/cvs/mono/mono
+ fi
+fi
+
+if [ ! -d $MONO_CHECKOUT ]; then
+ echo "Cannot find mono checkout; set MONO_CHECKOUT"
+ exit 1
+fi
+
+MONO_CHECKOUT="$MONO_CHECKOUT/mono"
+RESULTS_FILE=.results
+
+(for i in `find $MONO_CHECKOUT -iregex \.*.c$`; do
+ grep -oP "[ \t\(\)]+g_[a-z_]+[ ]{0,1}\([A-Za-z_\&\*\,\(\) ]+\)" $i |
+ awk 'BEGIN { FS="(" } { print $1 }' |
+ sed -e 's/[^A-Za-z_]//g'
+ done
+) > $RESULTS_FILE
+
+if [ ! "x$1" = "x--show-only-mono" ]; then
+ IMPLEMENTED_FUNCTIONS=`grep -oP "g_[a-z_]+[ ]{0,1}" ../src/glib.h | awk 'BEGIN { FS="(" } { print $1 }'`
+
+ rm -f $RESULTS_FILE.tmp
+
+ for mono_function in `cat $RESULTS_FILE`; do
+ matched="no"
+ for implemented_function in $IMPLEMENTED_FUNCTIONS; do
+ if [ "x$mono_function" = "x$implemented_function" ]; then
+ matched="yes"
+ break
+ fi
+ done
+
+ for ignore_function in $IGNORE_FUNCTIONS; do
+ if [ "x$ignore_function" = "x$mono_function" ]; then
+ matched="yes"
+ break
+ fi
+ done
+
+ if [ "x$matched" = "xno" ]; then
+ echo $mono_function >> $RESULTS_FILE.tmp
+ fi
+ done
+
+ mv $RESULTS_FILE.tmp $RESULTS_FILE
+fi
+
+(for i in `cat $RESULTS_FILE | sort -u`; do
+ echo "`grep -c $i $RESULTS_FILE` $i";
+ done;
+) | sort -nr
+
+rm $RESULTS_FILE
+
--- /dev/null
+/*
+This file is automatically generated by ucd.exe.
+The source for this generator should be in Mono repository
+(mcs/class/corlib/Mono.Globalization.Unicode directory).
+*/
+
+#ifndef __UNICODE_DATA_H
+#define __UNICODE_DATA_H
+
+#include <glib.h>
+
+
+/* ======== Structures ======== */
+typedef struct {
+ guint32 codepoint;
+ guint32 upper;
+ guint32 title;
+} SimpleTitlecaseMapping;
+typedef struct {
+ guint32 start;
+ guint32 end;
+} CodePointRange;
+typedef struct {
+ guint32 upper;
+ guint32 lower;
+} SimpleCaseMapping;
+
+/* ======== Unicode Categories ======== */
+static const guint8 unicode_category_ranges_count = 11;
+static const CodePointRange unicode_category_ranges [] = {
+{0x000000, 0x003400},
+{0x004DC0, 0x004E00},
+{0x00A000, 0x00AA80},
+{0x00F900, 0x010000},
+{0x010000, 0x0104C0},
+{0x010800, 0x010A80},
+{0x012000, 0x012480},
+{0x01D000, 0x01D800},
+{0x01F000, 0x01F0C0},
+{0x02F800, 0x02FA40},
+{0x0E0000, 0x0E0200},
+{0, 0}};
+static const guint8 unicode_category_table0 [] = {
+ /* ==== 0-3400 ==== */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 29,21,21,21,23,21,21,21,22,18,21,25,21,17,21,21,
+ 13,13,13,13,13,13,13,13,13,13,21,21,25,25,25,21,
+ 21,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+ 9,9,9,9,9,9,9,9,9,9,9,22,21,18,24,16,
+ 24,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,22,25,18,25,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 29,21,23,23,23,23,26,26,24,26,5,20,25,1,26,24,
+ 26,25,15,15,24,5,26,21,24,15,5,19,15,15,15,21,
+ 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+ 9,9,9,9,9,9,9,25,9,9,9,9,9,9,9,5,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,25,5,5,5,5,5,5,5,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,5,9,5,9,5,9,5,9,
+ 5,9,5,9,5,9,5,9,5,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,9,5,9,5,9,5,5,
+ 5,9,9,5,9,5,9,9,5,9,9,9,5,5,9,9,
+ 9,9,5,9,9,5,9,9,9,5,5,5,9,9,5,9,
+ 9,5,9,5,9,5,9,9,5,9,5,5,9,5,9,9,
+ 5,9,9,9,5,9,5,9,9,5,5,7,9,5,5,5,
+ 7,7,7,7,9,8,5,9,8,5,9,8,5,9,5,9,
+ 5,9,5,9,5,9,5,9,5,9,5,9,5,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 5,9,8,5,9,5,9,9,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,5,5,5,5,5,5,9,9,5,9,9,5,
+ 5,9,5,9,9,9,9,5,9,5,9,5,9,5,9,5,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,7,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
+ 6,6,24,24,24,24,6,6,6,6,6,6,6,6,6,6,
+ 6,6,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
+ 6,6,6,6,6,24,24,24,24,24,24,24,6,24,6,24,
+ 24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 9,5,9,5,6,24,9,5,0,0,6,5,5,5,21,0,
+ 0,0,0,0,24,24,9,21,9,9,9,0,9,0,9,9,
+ 5,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+ 9,9,0,9,9,9,9,9,9,9,9,9,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,9,
+ 5,5,9,9,9,5,5,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 5,5,5,5,9,5,25,9,5,9,9,5,5,9,9,9,
+ 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+ 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+ 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,26,12,12,12,12,12,11,11,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,9,5,9,5,9,5,9,5,9,5,9,5,9,5,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+ 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+ 9,9,9,9,9,9,9,0,0,6,21,21,21,21,21,21,
+ 0,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,0,21,17,0,0,0,0,0,
+ 0,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,17,12,
+ 21,12,12,21,12,12,21,12,0,0,0,0,0,0,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,0,0,0,0,0,
+ 7,7,7,21,21,0,0,0,0,0,0,0,0,0,0,0,
+ 1,1,1,1,0,0,25,25,25,21,21,23,21,21,26,26,
+ 12,12,12,12,12,12,12,12,12,12,12,21,0,0,21,21,
+ 0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 6,7,7,7,7,7,7,7,7,7,7,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,0,
+ 13,13,13,13,13,13,13,13,13,13,21,21,21,21,7,7,
+ 12,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,21,7,12,12,12,12,12,12,12,1,11,12,
+ 12,12,12,12,12,6,6,12,12,26,12,12,12,12,7,7,
+ 13,13,13,13,13,13,13,13,13,13,7,7,7,26,26,7,
+ 21,21,21,21,21,21,21,21,21,21,21,21,21,21,0,1,
+ 7,12,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,0,0,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,12,12,12,12,12,12,12,12,12,12,
+ 12,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 13,13,13,13,13,13,13,13,13,13,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,12,12,12,12,12,
+ 12,12,12,12,6,6,26,21,21,21,6,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,12,12,10,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,0,0,12,7,10,10,
+ 10,12,12,12,12,12,12,12,12,10,10,10,10,12,0,0,
+ 7,12,12,12,12,0,0,0,7,7,7,7,7,7,7,7,
+ 7,7,12,12,21,21,13,13,13,13,13,13,13,13,13,13,
+ 21,6,7,0,0,0,0,0,0,0,0,7,7,7,7,7,
+ 0,12,10,10,0,7,7,7,7,7,7,7,7,0,0,7,
+ 7,0,0,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,0,7,7,7,7,7,7,
+ 7,0,7,0,0,0,7,7,7,7,0,0,12,7,10,10,
+ 10,12,12,12,12,0,0,10,10,0,0,10,10,12,7,0,
+ 0,0,0,0,0,0,0,10,0,0,0,0,7,7,0,7,
+ 7,7,12,12,0,0,13,13,13,13,13,13,13,13,13,13,
+ 7,7,23,23,15,15,15,15,15,15,26,0,0,0,0,0,
+ 0,12,12,10,0,7,7,7,7,7,7,0,0,0,0,7,
+ 7,0,0,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,0,7,7,7,7,7,7,
+ 7,0,7,7,0,7,7,0,7,7,0,0,12,0,10,10,
+ 10,12,12,0,0,0,0,12,12,0,0,12,12,12,0,0,
+ 0,12,0,0,0,0,0,0,0,7,7,7,7,0,7,0,
+ 0,0,0,0,0,0,13,13,13,13,13,13,13,13,13,13,
+ 12,12,7,7,7,12,0,0,0,0,0,0,0,0,0,0,
+ 0,12,12,10,0,7,7,7,7,7,7,7,7,7,0,7,
+ 7,7,0,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,0,7,7,7,7,7,7,
+ 7,0,7,7,0,7,7,7,7,7,0,0,12,7,10,10,
+ 10,12,12,12,12,12,0,12,12,10,0,10,10,12,0,0,
+ 7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 7,7,12,12,0,0,13,13,13,13,13,13,13,13,13,13,
+ 0,23,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,12,10,10,0,7,7,7,7,7,7,7,7,0,0,7,
+ 7,0,0,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,0,7,7,7,7,7,7,
+ 7,0,7,7,0,7,7,7,7,7,0,0,12,7,10,12,
+ 10,12,12,12,12,0,0,10,10,0,0,10,10,12,0,0,
+ 0,0,0,0,0,0,12,10,0,0,0,0,7,7,0,7,
+ 7,7,12,12,0,0,13,13,13,13,13,13,13,13,13,13,
+ 26,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,12,7,0,7,7,7,7,7,7,0,0,0,7,7,
+ 7,0,7,7,7,7,0,0,0,7,7,0,7,0,7,7,
+ 0,0,0,7,7,0,0,0,7,7,7,0,0,0,7,7,
+ 7,7,7,7,7,7,7,7,7,7,0,0,0,0,10,10,
+ 12,10,10,0,0,0,10,10,10,0,10,10,10,12,0,0,
+ 7,0,0,0,0,0,0,10,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,13,13,13,13,13,13,13,13,13,13,
+ 15,15,15,26,26,26,26,26,26,23,26,0,0,0,0,0,
+ 0,10,10,10,0,7,7,7,7,7,7,7,7,0,7,7,
+ 7,0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,0,7,7,7,7,7,7,
+ 7,7,7,7,0,7,7,7,7,7,0,0,0,7,12,12,
+ 12,10,10,10,10,0,12,12,12,0,12,12,12,12,0,0,
+ 0,0,0,0,0,12,12,0,7,7,0,0,0,0,0,0,
+ 7,7,12,12,0,0,13,13,13,13,13,13,13,13,13,13,
+ 0,0,0,0,0,0,0,0,15,15,15,15,15,15,15,26,
+ 0,0,10,10,0,7,7,7,7,7,7,7,7,0,7,7,
+ 7,0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,0,7,7,7,7,7,7,
+ 7,7,7,7,0,7,7,7,7,7,0,0,12,7,10,12,
+ 10,10,10,10,10,0,12,10,10,0,10,10,12,12,0,0,
+ 0,0,0,0,0,10,10,0,0,0,0,0,0,0,7,0,
+ 7,7,12,12,0,0,13,13,13,13,13,13,13,13,13,13,
+ 0,26,26,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,10,10,0,7,7,7,7,7,7,7,7,0,7,7,
+ 7,0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,0,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,0,0,0,7,10,10,
+ 10,12,12,12,12,0,10,10,10,0,10,10,10,12,0,0,
+ 0,0,0,0,0,0,0,10,0,0,0,0,0,0,0,0,
+ 7,7,12,12,0,0,13,13,13,13,13,13,13,13,13,13,
+ 15,15,15,15,15,15,0,0,0,26,7,7,7,7,7,7,
+ 0,0,10,10,0,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,0,0,0,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,0,7,7,7,7,7,7,7,7,7,0,7,0,0,
+ 7,7,7,7,7,7,7,0,0,0,12,0,0,0,0,10,
+ 10,10,12,12,12,0,12,0,10,10,10,10,10,10,10,10,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,10,10,21,0,0,0,0,0,0,0,0,0,0,0,
+ 0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,12,7,7,12,12,12,12,12,12,12,0,0,0,0,23,
+ 7,7,7,7,7,7,6,12,12,12,12,12,12,12,12,21,
+ 13,13,13,13,13,13,13,13,13,13,21,21,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,7,7,0,7,0,0,7,7,0,7,0,0,7,0,0,
+ 0,0,0,0,7,7,7,7,0,7,7,7,7,7,7,7,
+ 0,7,7,7,0,7,0,7,0,0,7,7,0,7,7,7,
+ 7,12,7,7,12,12,12,12,12,12,0,12,12,7,0,0,
+ 7,7,7,7,7,0,6,0,12,12,12,12,12,12,0,0,
+ 13,13,13,13,13,13,13,13,13,13,0,0,7,7,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 7,26,26,26,21,21,21,21,21,21,21,21,21,21,21,21,
+ 21,21,21,26,26,26,26,26,12,12,26,26,26,26,26,26,
+ 13,13,13,13,13,13,13,13,13,13,15,15,15,15,15,15,
+ 15,15,15,15,26,12,26,12,26,12,22,18,22,18,10,10,
+ 7,7,7,7,7,7,7,7,0,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,0,
+ 0,12,12,12,12,12,12,12,12,12,12,12,12,12,12,10,
+ 12,12,12,12,12,21,12,12,7,7,7,7,0,0,0,0,
+ 12,12,12,12,12,12,12,12,0,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,0,26,26,
+ 26,26,26,26,26,26,12,26,26,26,26,26,26,0,26,26,
+ 21,21,21,21,21,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,10,10,12,12,12,
+ 12,10,12,12,12,12,12,12,10,12,12,10,10,12,12,7,
+ 13,13,13,13,13,13,13,13,13,13,21,21,21,21,21,21,
+ 7,7,7,7,7,7,10,10,12,12,7,7,7,7,12,12,
+ 12,7,10,10,10,7,7,10,10,10,10,10,10,10,7,7,
+ 7,12,12,12,12,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,12,10,10,12,12,10,10,10,10,10,10,12,7,10,
+ 13,13,13,13,13,13,13,13,13,13,0,0,0,0,26,26,
+ 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+ 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+ 9,9,9,9,9,9,0,0,0,0,0,0,0,0,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,21,6,0,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,0,0,0,0,0,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,0,0,0,0,0,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,0,0,0,0,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,0,7,7,7,7,0,0,
+ 7,7,7,7,7,7,7,0,7,0,7,7,7,7,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,0,7,7,7,7,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,0,7,7,7,7,0,0,7,7,7,7,7,7,7,0,
+ 7,0,7,7,7,7,0,0,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,0,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,0,7,7,7,7,0,0,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,0,0,0,0,12,
+ 26,21,21,21,21,21,21,21,21,15,15,15,15,15,15,15,
+ 15,15,15,15,15,15,15,15,15,15,15,15,15,0,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 26,26,26,26,26,26,26,26,26,26,0,0,0,0,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,0,0,0,0,0,0,0,0,0,0,0,
+ 0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,21,21,7,
+ 7,7,7,7,7,7,7,0,0,0,0,0,0,0,0,0,
+ 29,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,22,18,0,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,21,21,21,14,14,
+ 14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,0,7,7,
+ 7,7,12,12,12,0,0,0,0,0,0,0,0,0,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,12,12,12,21,21,0,0,0,0,0,0,0,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,12,12,0,0,0,0,0,0,0,0,0,0,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,0,7,7,
+ 7,0,12,12,0,0,0,0,0,0,0,0,0,0,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,1,1,10,12,12,12,12,12,12,12,10,10,
+ 10,10,10,10,10,10,12,10,10,12,12,12,12,12,12,12,
+ 12,12,12,12,21,21,21,6,21,21,21,23,7,12,0,0,
+ 13,13,13,13,13,13,13,13,13,13,0,0,0,0,0,0,
+ 15,15,15,15,15,15,15,15,15,15,0,0,0,0,0,0,
+ 21,21,21,21,21,21,17,21,21,21,21,12,12,12,29,0,
+ 13,13,13,13,13,13,13,13,13,13,0,0,0,0,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,6,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,0,0,0,0,0,0,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,12,7,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,0,
+ 12,12,12,10,10,10,10,12,12,10,10,10,0,0,0,0,
+ 10,10,12,10,10,10,10,10,10,12,12,12,0,0,0,0,
+ 26,0,0,0,21,21,13,13,13,13,13,13,13,13,13,13,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,
+ 7,7,7,7,7,0,0,0,0,0,0,0,0,0,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,0,0,0,0,0,0,
+ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
+ 10,7,7,7,7,7,7,7,10,10,0,0,0,0,0,0,
+ 13,13,13,13,13,13,13,13,13,13,0,0,0,0,21,21,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,12,12,10,10,10,0,0,21,21,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 12,12,12,12,10,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,12,10,12,12,12,12,12,10,12,10,10,10,
+ 10,10,12,10,10,7,7,7,7,7,7,7,0,0,0,0,
+ 13,13,13,13,13,13,13,13,13,13,21,21,21,21,21,21,
+ 21,26,26,26,26,26,26,26,26,26,26,12,12,12,12,12,
+ 12,12,12,12,26,26,26,26,26,26,26,26,26,0,0,0,
+ 12,12,10,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,10,12,12,12,12,10,10,12,12,10,0,0,0,7,7,
+ 13,13,13,13,13,13,13,13,13,13,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,10,10,10,10,10,10,10,10,12,12,12,12,
+ 12,12,12,12,10,10,12,12,0,0,0,21,21,21,21,21,
+ 13,13,13,13,13,13,13,13,13,13,0,0,0,7,7,7,
+ 13,13,13,13,13,13,13,13,13,13,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,6,6,6,6,6,6,21,21,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,
+ 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
+ 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
+ 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
+ 6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,6,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,
+ 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
+ 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,12,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,5,5,5,5,5,5,5,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 5,5,5,5,5,5,5,5,9,9,9,9,9,9,9,9,
+ 5,5,5,5,5,5,0,0,9,9,9,9,9,9,0,0,
+ 5,5,5,5,5,5,5,5,9,9,9,9,9,9,9,9,
+ 5,5,5,5,5,5,5,5,9,9,9,9,9,9,9,9,
+ 5,5,5,5,5,5,0,0,9,9,9,9,9,9,0,0,
+ 5,5,5,5,5,5,5,5,0,9,0,9,0,9,0,9,
+ 5,5,5,5,5,5,5,5,9,9,9,9,9,9,9,9,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,0,0,
+ 5,5,5,5,5,5,5,5,8,8,8,8,8,8,8,8,
+ 5,5,5,5,5,5,5,5,8,8,8,8,8,8,8,8,
+ 5,5,5,5,5,5,5,5,8,8,8,8,8,8,8,8,
+ 5,5,5,5,5,0,5,5,9,9,9,9,8,24,5,24,
+ 24,24,5,5,5,0,5,5,9,9,9,9,8,24,24,24,
+ 5,5,5,5,0,0,5,5,9,9,9,9,0,24,24,24,
+ 5,5,5,5,5,5,5,5,9,9,9,9,9,24,24,24,
+ 0,0,5,5,5,0,5,5,9,9,9,9,8,24,24,0,
+ 29,29,29,29,29,29,29,29,29,29,29,1,1,1,1,1,
+ 17,17,17,17,17,17,21,21,20,19,22,20,20,19,22,20,
+ 21,21,21,21,21,21,21,21,27,28,1,1,1,1,1,29,
+ 21,21,21,21,21,21,21,21,21,20,19,21,21,21,21,16,
+ 16,21,21,21,25,22,18,21,21,21,21,21,21,21,21,21,
+ 21,21,25,21,16,21,21,21,21,21,21,21,21,21,21,29,
+ 1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,
+ 15,5,0,0,15,15,15,15,15,15,25,25,25,22,18,5,
+ 15,15,15,15,15,15,15,15,15,15,25,25,25,22,18,0,
+ 6,6,6,6,6,0,0,0,0,0,0,0,0,0,0,0,
+ 23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
+ 23,23,23,23,23,23,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,11,11,11,
+ 11,12,11,11,11,12,12,12,12,12,12,12,12,12,12,12,
+ 12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 26,26,9,26,26,26,26,9,26,26,5,9,9,9,5,5,
+ 9,9,9,5,26,9,26,26,26,9,9,9,9,9,26,26,
+ 26,26,26,26,9,26,9,26,9,26,9,9,9,9,26,5,
+ 9,9,9,9,5,7,7,7,7,5,26,26,5,5,9,9,
+ 25,25,25,25,25,9,5,5,5,5,26,25,26,26,5,26,
+ 0,0,0,15,15,15,15,15,15,15,15,15,15,15,15,15,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,9,5,14,14,14,14,0,0,0,0,0,0,0,
+ 25,25,25,25,25,26,26,26,26,26,25,25,26,26,26,26,
+ 25,26,26,25,26,26,25,26,26,26,26,26,26,26,25,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,25,25,
+ 26,26,25,26,25,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 26,26,26,26,26,26,26,26,25,25,25,25,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 25,25,26,26,26,26,26,26,26,22,18,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,25,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,25,25,25,25,
+ 25,25,26,26,26,26,26,26,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 26,26,26,26,26,26,26,26,26,26,26,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
+ 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
+ 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
+ 15,15,15,15,15,15,15,15,15,15,15,15,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,15,15,15,15,15,15,
+ 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,25,26,26,26,26,26,26,26,26,
+ 26,25,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,25,25,25,25,25,25,25,25,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,25,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,0,0,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,0,0,0,
+ 26,26,26,26,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,26,26,26,26,0,26,26,26,26,0,0,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,0,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,0,26,0,26,
+ 26,26,26,0,0,0,26,0,26,26,26,26,26,26,26,0,
+ 0,26,26,26,26,26,26,26,22,18,22,18,22,18,22,18,
+ 22,18,22,18,22,18,15,15,15,15,15,15,15,15,15,15,
+ 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
+ 15,15,15,15,26,0,0,0,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 0,26,26,26,26,26,26,26,26,26,26,26,26,26,26,0,
+ 25,25,25,25,25,22,18,25,25,25,25,0,25,0,0,0,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,22,18,22,18,22,18,22,18,22,18,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,22,18,22,18,22,18,22,18,22,18,22,18,22,
+ 18,22,18,22,18,22,18,22,18,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,22,18,22,18,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,22,18,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+ 25,25,25,25,25,26,26,25,25,25,25,25,25,0,0,0,
+ 26,26,26,26,26,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+ 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+ 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,0,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0,
+ 9,5,9,9,9,5,5,9,5,9,5,9,5,9,9,9,
+ 0,5,9,5,5,9,5,5,5,5,5,5,5,6,0,0,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,5,26,26,26,26,26,26,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,21,21,21,21,15,21,21,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,0,0,0,0,0,0,0,0,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,0,0,0,0,0,0,0,0,0,6,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,0,0,0,0,0,0,0,0,0,
+ 7,7,7,7,7,7,7,0,7,7,7,7,7,7,7,0,
+ 7,7,7,7,7,7,7,0,7,7,7,7,7,7,7,0,
+ 7,7,7,7,7,7,7,0,7,7,7,7,7,7,7,0,
+ 7,7,7,7,7,7,7,0,7,7,7,7,7,7,7,0,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 21,21,20,19,20,19,21,21,21,20,19,21,20,19,21,21,
+ 21,21,21,21,21,21,21,17,21,21,17,21,20,19,21,21,
+ 20,19,22,18,22,18,22,18,22,18,21,21,21,21,21,6,
+ 21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,0,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,0,0,0,0,0,0,0,0,0,0,0,0,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 26,26,26,26,26,26,26,26,26,26,26,26,0,0,0,0,
+ 29,21,21,21,26,6,7,14,22,18,22,18,22,18,22,18,
+ 22,18,26,26,22,18,22,18,22,18,22,18,17,22,18,18,
+ 26,14,14,14,14,14,14,14,14,14,12,12,12,12,12,12,
+ 17,6,6,6,6,6,26,26,14,14,14,6,7,21,26,26,
+ 0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,0,0,12,12,24,24,6,6,7,
+ 17,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,21,6,6,6,7,
+ 0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,
+ 0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,
+ 26,26,15,15,15,15,26,26,26,26,26,26,26,26,26,26,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,0,0,0,0,0,0,0,0,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,0,0,0,0,0,0,0,0,0,0,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,0,
+ 15,15,15,15,15,15,15,15,15,15,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,0,0,0,0,0,0,0,0,0,0,0,0,
+ 26,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 15,15,15,15,15,15,15,15,15,15,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,0,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 0};
+static const guint8 unicode_category_table1 [] = {
+ /* ==== 4DC0-4E00 ==== */
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 0};
+static const guint8 unicode_category_table2 [] = {
+ /* ==== A000-AA80 ==== */
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,6,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,0,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,6,21,21,21,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 13,13,13,13,13,13,13,13,13,13,7,7,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 0,0,9,5,9,5,9,5,9,5,9,5,9,5,7,12,
+ 11,11,11,21,0,0,0,0,0,0,0,0,12,12,21,6,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
+ 24,24,24,24,24,24,24,6,6,6,6,6,6,6,6,6,
+ 24,24,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 5,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 9,5,9,5,9,5,9,5,9,5,9,5,9,5,9,5,
+ 6,5,5,5,5,5,5,5,5,9,5,9,5,9,9,5,
+ 9,5,9,5,9,5,9,5,6,24,24,9,5,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,7,7,7,7,7,
+ 7,7,12,7,7,7,12,7,7,7,7,12,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,10,10,12,12,10,26,26,26,26,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,21,21,21,21,0,0,0,0,0,0,0,0,
+ 10,10,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,10,10,10,10,10,10,10,10,10,10,10,10,
+ 10,10,10,10,12,0,0,0,0,0,0,0,0,0,21,21,
+ 13,13,13,13,13,13,13,13,13,13,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 13,13,13,13,13,13,13,13,13,13,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,12,12,12,12,12,12,12,12,21,21,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,12,12,12,12,12,12,12,12,12,
+ 12,12,10,10,0,0,0,0,0,0,0,0,0,0,0,21,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,12,12,12,12,12,12,10,
+ 10,12,12,10,10,12,12,0,0,0,0,0,0,0,0,0,
+ 7,7,7,12,7,7,7,7,7,7,7,7,12,10,0,0,
+ 13,13,13,13,13,13,13,13,13,13,0,0,21,21,21,21,
+ 0};
+static const guint8 unicode_category_table3 [] = {
+ /* ==== F900-10000 ==== */
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,0,0,0,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 5,5,5,5,5,5,5,0,0,0,0,0,0,0,0,0,
+ 0,0,0,5,5,5,5,5,0,0,0,0,0,7,12,7,
+ 7,7,7,7,7,7,7,7,7,25,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,0,7,7,7,7,7,0,7,0,
+ 7,7,0,7,7,0,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,22,18,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 0,0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,23,26,0,0,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 21,21,21,21,21,21,21,22,18,21,0,0,0,0,0,0,
+ 12,12,12,12,12,12,12,0,0,0,0,0,0,0,0,0,
+ 21,17,17,16,16,22,18,22,18,22,18,22,18,22,18,22,
+ 18,22,18,22,18,21,21,22,18,21,21,21,21,16,16,16,
+ 21,21,21,0,21,21,21,21,17,22,18,22,18,22,18,21,
+ 21,21,25,17,25,25,25,0,21,23,21,21,0,0,0,0,
+ 7,7,7,7,7,0,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,1,
+ 0,21,21,21,23,21,21,21,22,18,21,25,21,17,21,21,
+ 13,13,13,13,13,13,13,13,13,13,21,21,25,25,25,21,
+ 21,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+ 9,9,9,9,9,9,9,9,9,9,9,22,21,18,24,16,
+ 24,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,22,25,18,25,22,
+ 18,21,22,18,21,21,7,7,7,7,7,7,7,7,7,7,
+ 6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,6,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,
+ 0,0,7,7,7,7,7,7,0,0,7,7,7,7,7,7,
+ 0,0,7,7,7,7,7,7,0,0,7,7,7,0,0,0,
+ 23,23,25,24,26,23,23,0,26,25,25,25,25,26,26,0,
+ 0,0,0,0,0,0,0,0,0,1,1,1,26,26,0};
+static const guint8 unicode_category_table4 [] = {
+ /* ==== 10000-104C0 ==== */
+ 7,7,7,7,7,7,7,7,7,7,7,7,0,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,0,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,0,7,7,0,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,0,0,0,0,0,
+ 21,21,26,0,0,0,0,15,15,15,15,15,15,15,15,15,
+ 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
+ 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
+ 15,15,15,15,0,0,0,26,26,26,26,26,26,26,26,26,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,15,15,15,15,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,15,0,0,0,0,0,
+ 26,26,26,26,26,26,26,26,26,26,26,26,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,12,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,
+ 15,15,15,15,0,0,0,0,0,0,0,0,0,0,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,14,7,7,7,7,7,7,7,7,14,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,21,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,0,0,0,0,7,7,7,7,7,7,7,7,
+ 21,14,14,14,14,14,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+ 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+ 9,9,9,9,9,9,9,9,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,
+ 13,13,13,13,13,13,13,13,13,13,0};
+static const guint8 unicode_category_table5 [] = {
+ /* ==== 10800-10A80 ==== */
+ 7,7,7,7,7,7,0,0,7,0,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,0,7,7,0,0,0,7,0,0,7,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,15,15,15,15,0,0,0,0,0,21,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,0,0,0,0,0,21,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 7,12,12,12,0,12,12,0,0,0,0,0,12,12,12,12,
+ 7,7,7,7,0,7,7,7,0,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,0,0,0,0,12,12,12,0,0,0,0,12,
+ 15,15,15,15,15,15,15,15,0,0,0,0,0,0,0,0,
+ 21,21,21,21,21,21,21,21,21,0};
+static const guint8 unicode_category_table6 [] = {
+ /* ==== 12000-12480 ==== */
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 21,21,21,21,0};
+static const guint8 unicode_category_table7 [] = {
+ /* ==== 1D000-1D800 ==== */
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,0,0,0,0,0,0,0,0,0,0,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,0,0,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,10,10,12,12,12,26,26,26,10,10,10,
+ 10,10,10,1,1,1,1,1,1,1,1,12,12,12,12,12,
+ 12,12,12,26,26,12,12,12,12,12,12,12,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,12,12,12,12,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,12,12,12,26,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,0,0,0,0,0,0,0,0,0,
+ 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
+ 15,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+ 9,9,9,9,9,9,9,9,9,9,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,9,9,9,9,9,9,9,9,9,9,9,9,
+ 9,9,9,9,9,9,9,9,9,9,9,9,9,9,5,5,
+ 5,5,5,5,5,0,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,9,9,9,9,9,9,9,9,
+ 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+ 9,9,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,5,9,0,9,9,
+ 0,0,9,0,0,9,9,0,0,9,9,9,9,0,9,9,
+ 9,9,9,9,9,9,5,5,5,5,0,5,0,5,5,5,
+ 5,5,5,5,0,5,5,5,5,5,5,5,5,5,5,5,
+ 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+ 9,9,9,9,9,9,9,9,9,9,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,9,9,0,9,9,9,9,0,0,9,9,9,
+ 9,9,9,9,9,0,9,9,9,9,9,9,9,0,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,9,9,0,9,9,9,9,0,
+ 9,9,9,9,9,0,9,0,0,0,9,9,9,9,9,9,
+ 9,0,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,5,9,9,9,9,
+ 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+ 9,9,9,9,9,9,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+ 9,9,9,9,9,9,9,9,9,9,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,9,9,9,9,9,9,9,9,9,9,9,9,
+ 9,9,9,9,9,9,9,9,9,9,9,9,9,9,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,9,9,9,9,9,9,9,9,
+ 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+ 9,9,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,5,9,9,9,9,
+ 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+ 9,9,9,9,9,9,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+ 9,9,9,9,9,9,9,9,9,9,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,0,0,9,9,9,9,9,9,9,9,
+ 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+ 9,25,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,25,5,5,5,5,
+ 5,5,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+ 9,9,9,9,9,9,9,9,9,9,9,25,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,25,5,5,5,5,5,5,9,9,9,9,
+ 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+ 9,9,9,9,9,25,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,25,
+ 5,5,5,5,5,5,9,9,9,9,9,9,9,9,9,9,
+ 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,25,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,25,5,5,5,5,5,5,
+ 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+ 9,9,9,9,9,9,9,9,9,25,5,5,5,5,5,5,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 5,5,5,25,5,5,5,5,5,5,9,5,0,0,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 0};
+static const guint8 unicode_category_table8 [] = {
+ /* ==== 1F000-1F0C0 ==== */
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,0,0,0,0,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+ 26,26,26,26,0};
+static const guint8 unicode_category_table9 [] = {
+ /* ==== 2F800-2FA40 ==== */
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,0};
+static const guint8 unicode_category_table10 [] = {
+ /* ==== E0000-E0200 ==== */
+ 0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 0};
+static const guint8 *unicode_category [11] = {
+ unicode_category_table0,
+ unicode_category_table1,
+ unicode_category_table2,
+ unicode_category_table3,
+ unicode_category_table4,
+ unicode_category_table5,
+ unicode_category_table6,
+ unicode_category_table7,
+ unicode_category_table8,
+ unicode_category_table9,
+ unicode_category_table10
+};
+
+static const guint8 simple_case_map_ranges_count = 9;
+static const CodePointRange simple_case_map_ranges [] = {
+{0x000040, 0x000600},
+{0x001000, 0x0010D0},
+{0x001D00, 0x002000},
+{0x002100, 0x0021C0},
+{0x002480, 0x002500},
+{0x002C00, 0x002D80},
+{0x00A640, 0x00A7C0},
+{0x00FF20, 0x00FF80},
+{0x010400, 0x010480},
+{0, 0}};
+static const guint16 simple_upper_case_mapping_lowarea_table0 [] = {
+ /* ==== 40-600 ==== */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F,
+ 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0x39C,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,
+ 0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0x178,
+ 0,0x100,0,0x102,0,0x104,0,0x106,0,0x108,0,0x10A,0,0x10C,0,0x10E,
+ 0,0x110,0,0x112,0,0x114,0,0x116,0,0x118,0,0x11A,0,0x11C,0,0x11E,
+ 0,0x120,0,0x122,0,0x124,0,0x126,0,0x128,0,0x12A,0,0x12C,0,0x12E,
+ 0,0x49,0,0x132,0,0x134,0,0x136,0,0,0x139,0,0x13B,0,0x13D,0,
+ 0x13F,0,0x141,0,0x143,0,0x145,0,0x147,0,0,0x14A,0,0x14C,0,0x14E,
+ 0,0x150,0,0x152,0,0x154,0,0x156,0,0x158,0,0x15A,0,0x15C,0,0x15E,
+ 0,0x160,0,0x162,0,0x164,0,0x166,0,0x168,0,0x16A,0,0x16C,0,0x16E,
+ 0,0x170,0,0x172,0,0x174,0,0x176,0,0,0x179,0,0x17B,0,0x17D,0x53,
+ 0x243,0,0,0x182,0,0x184,0,0,0x187,0,0,0,0x18B,0,0,0,
+ 0,0,0x191,0,0,0x1F6,0,0,0,0x198,0x23D,0,0,0,0x220,0,
+ 0,0x1A0,0,0x1A2,0,0x1A4,0,0,0x1A7,0,0,0,0,0x1AC,0,0,
+ 0x1AF,0,0,0,0x1B3,0,0x1B5,0,0,0x1B8,0,0,0,0x1BC,0,0x1F7,
+ 0,0,0,0,0,0x1C4,0x1C4,0,0x1C7,0x1C7,0,0x1CA,0x1CA,0,0x1CD,0,
+ 0x1CF,0,0x1D1,0,0x1D3,0,0x1D5,0,0x1D7,0,0x1D9,0,0x1DB,0x18E,0,0x1DE,
+ 0,0x1E0,0,0x1E2,0,0x1E4,0,0x1E6,0,0x1E8,0,0x1EA,0,0x1EC,0,0x1EE,
+ 0,0,0x1F1,0x1F1,0,0x1F4,0,0,0,0x1F8,0,0x1FA,0,0x1FC,0,0x1FE,
+ 0,0x200,0,0x202,0,0x204,0,0x206,0,0x208,0,0x20A,0,0x20C,0,0x20E,
+ 0,0x210,0,0x212,0,0x214,0,0x216,0,0x218,0,0x21A,0,0x21C,0,0x21E,
+ 0,0,0,0x222,0,0x224,0,0x226,0,0x228,0,0x22A,0,0x22C,0,0x22E,
+ 0,0x230,0,0x232,0,0,0,0,0,0,0,0,0x23B,0,0,0,
+ 0,0,0x241,0,0,0,0,0x246,0,0x248,0,0x24A,0,0x24C,0,0x24E,
+ 0x2C6F,0x2C6D,0,0x181,0x186,0,0x189,0x18A,0,0x18F,0,0x190,0,0,0,0,
+ 0x193,0,0,0x194,0,0,0,0,0x197,0x196,0,0x2C62,0,0,0,0x19C,
+ 0,0x2C6E,0x19D,0,0,0x19F,0,0,0,0,0,0,0,0x2C64,0,0,
+ 0x1A6,0,0,0x1A9,0,0,0,0,0x1AE,0x244,0x1B1,0x1B2,0x245,0,0,0,
+ 0,0,0x1B7,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0x399,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0x370,0,0x372,0,0,0,0x376,0,0,0,0x3FD,0x3FE,0x3FF,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0x386,0x388,0x389,0x38A,
+ 0,0x391,0x392,0x393,0x394,0x395,0x396,0x397,0x398,0x399,0x39A,0x39B,0x39C,0x39D,0x39E,0x39F,
+ 0x3A0,0x3A1,0x3A3,0x3A3,0x3A4,0x3A5,0x3A6,0x3A7,0x3A8,0x3A9,0x3AA,0x3AB,0x38C,0x38E,0x38F,0,
+ 0x392,0x398,0,0,0,0x3A6,0x3A0,0x3CF,0,0x3D8,0,0x3DA,0,0x3DC,0,0x3DE,
+ 0,0x3E0,0,0x3E2,0,0x3E4,0,0x3E6,0,0x3E8,0,0x3EA,0,0x3EC,0,0x3EE,
+ 0x39A,0x3A1,0x3F9,0,0,0x395,0,0,0x3F7,0,0,0x3FA,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0x410,0x411,0x412,0x413,0x414,0x415,0x416,0x417,0x418,0x419,0x41A,0x41B,0x41C,0x41D,0x41E,0x41F,
+ 0x420,0x421,0x422,0x423,0x424,0x425,0x426,0x427,0x428,0x429,0x42A,0x42B,0x42C,0x42D,0x42E,0x42F,
+ 0x400,0x401,0x402,0x403,0x404,0x405,0x406,0x407,0x408,0x409,0x40A,0x40B,0x40C,0x40D,0x40E,0x40F,
+ 0,0x460,0,0x462,0,0x464,0,0x466,0,0x468,0,0x46A,0,0x46C,0,0x46E,
+ 0,0x470,0,0x472,0,0x474,0,0x476,0,0x478,0,0x47A,0,0x47C,0,0x47E,
+ 0,0x480,0,0,0,0,0,0,0,0,0,0x48A,0,0x48C,0,0x48E,
+ 0,0x490,0,0x492,0,0x494,0,0x496,0,0x498,0,0x49A,0,0x49C,0,0x49E,
+ 0,0x4A0,0,0x4A2,0,0x4A4,0,0x4A6,0,0x4A8,0,0x4AA,0,0x4AC,0,0x4AE,
+ 0,0x4B0,0,0x4B2,0,0x4B4,0,0x4B6,0,0x4B8,0,0x4BA,0,0x4BC,0,0x4BE,
+ 0,0,0x4C1,0,0x4C3,0,0x4C5,0,0x4C7,0,0x4C9,0,0x4CB,0,0x4CD,0x4C0,
+ 0,0x4D0,0,0x4D2,0,0x4D4,0,0x4D6,0,0x4D8,0,0x4DA,0,0x4DC,0,0x4DE,
+ 0,0x4E0,0,0x4E2,0,0x4E4,0,0x4E6,0,0x4E8,0,0x4EA,0,0x4EC,0,0x4EE,
+ 0,0x4F0,0,0x4F2,0,0x4F4,0,0x4F6,0,0x4F8,0,0x4FA,0,0x4FC,0,0x4FE,
+ 0,0x500,0,0x502,0,0x504,0,0x506,0,0x508,0,0x50A,0,0x50C,0,0x50E,
+ 0,0x510,0,0x512,0,0x514,0,0x516,0,0x518,0,0x51A,0,0x51C,0,0x51E,
+ 0,0x520,0,0x522,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0x531,0x532,0x533,0x534,0x535,0x536,0x537,0x538,0x539,0x53A,0x53B,0x53C,0x53D,0x53E,0x53F,
+ 0x540,0x541,0x542,0x543,0x544,0x545,0x546,0x547,0x548,0x549,0x54A,0x54B,0x54C,0x54D,0x54E,0x54F,
+ 0x550,0x551,0x552,0x553,0x554,0x555,0x556,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0};
+static const guint16 simple_upper_case_mapping_lowarea_table1 [] = {
+ /* ==== 1000-10D0 ==== */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0};
+static const guint16 simple_upper_case_mapping_lowarea_table2 [] = {
+ /* ==== 1D00-2000 ==== */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0xA77D,0,0,0,0x2C63,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0x1E00,0,0x1E02,0,0x1E04,0,0x1E06,0,0x1E08,0,0x1E0A,0,0x1E0C,0,0x1E0E,
+ 0,0x1E10,0,0x1E12,0,0x1E14,0,0x1E16,0,0x1E18,0,0x1E1A,0,0x1E1C,0,0x1E1E,
+ 0,0x1E20,0,0x1E22,0,0x1E24,0,0x1E26,0,0x1E28,0,0x1E2A,0,0x1E2C,0,0x1E2E,
+ 0,0x1E30,0,0x1E32,0,0x1E34,0,0x1E36,0,0x1E38,0,0x1E3A,0,0x1E3C,0,0x1E3E,
+ 0,0x1E40,0,0x1E42,0,0x1E44,0,0x1E46,0,0x1E48,0,0x1E4A,0,0x1E4C,0,0x1E4E,
+ 0,0x1E50,0,0x1E52,0,0x1E54,0,0x1E56,0,0x1E58,0,0x1E5A,0,0x1E5C,0,0x1E5E,
+ 0,0x1E60,0,0x1E62,0,0x1E64,0,0x1E66,0,0x1E68,0,0x1E6A,0,0x1E6C,0,0x1E6E,
+ 0,0x1E70,0,0x1E72,0,0x1E74,0,0x1E76,0,0x1E78,0,0x1E7A,0,0x1E7C,0,0x1E7E,
+ 0,0x1E80,0,0x1E82,0,0x1E84,0,0x1E86,0,0x1E88,0,0x1E8A,0,0x1E8C,0,0x1E8E,
+ 0,0x1E90,0,0x1E92,0,0x1E94,0,0,0,0,0,0x1E60,0,0,0,0,
+ 0,0x1EA0,0,0x1EA2,0,0x1EA4,0,0x1EA6,0,0x1EA8,0,0x1EAA,0,0x1EAC,0,0x1EAE,
+ 0,0x1EB0,0,0x1EB2,0,0x1EB4,0,0x1EB6,0,0x1EB8,0,0x1EBA,0,0x1EBC,0,0x1EBE,
+ 0,0x1EC0,0,0x1EC2,0,0x1EC4,0,0x1EC6,0,0x1EC8,0,0x1ECA,0,0x1ECC,0,0x1ECE,
+ 0,0x1ED0,0,0x1ED2,0,0x1ED4,0,0x1ED6,0,0x1ED8,0,0x1EDA,0,0x1EDC,0,0x1EDE,
+ 0,0x1EE0,0,0x1EE2,0,0x1EE4,0,0x1EE6,0,0x1EE8,0,0x1EEA,0,0x1EEC,0,0x1EEE,
+ 0,0x1EF0,0,0x1EF2,0,0x1EF4,0,0x1EF6,0,0x1EF8,0,0x1EFA,0,0x1EFC,0,0x1EFE,
+ 0x1F08,0x1F09,0x1F0A,0x1F0B,0x1F0C,0x1F0D,0x1F0E,0x1F0F,0,0,0,0,0,0,0,0,
+ 0x1F18,0x1F19,0x1F1A,0x1F1B,0x1F1C,0x1F1D,0,0,0,0,0,0,0,0,0,0,
+0x1F28,0x1F29,0x1F2A,0x1F2B,0x1F2C,0x1F2D,0x1F2E,0x1F2F,0,0,0,0,0,0,0,0,
+ 0x1F38,0x1F39,0x1F3A,0x1F3B,0x1F3C,0x1F3D,0x1F3E,0x1F3F,0,0,0,0,0,0,0,0,
+ 0x1F48,0x1F49,0x1F4A,0x1F4B,0x1F4C,0x1F4D,0,0,0,0,0,0,0,0,0,0,
+0,0x1F59,0,0x1F5B,0,0x1F5D,0,0x1F5F,0,0,0,0,0,0,0,0,
+ 0x1F68,0x1F69,0x1F6A,0x1F6B,0x1F6C,0x1F6D,0x1F6E,0x1F6F,0,0,0,0,0,0,0,0,
+ 0x1FBA,0x1FBB,0x1FC8,0x1FC9,0x1FCA,0x1FCB,0x1FDA,0x1FDB,0x1FF8,0x1FF9,0x1FEA,0x1FEB,0x1FFA,0x1FFB,0,0,
+0x1F88,0x1F89,0x1F8A,0x1F8B,0x1F8C,0x1F8D,0x1F8E,0x1F8F,0,0,0,0,0,0,0,0,
+ 0x1F98,0x1F99,0x1F9A,0x1F9B,0x1F9C,0x1F9D,0x1F9E,0x1F9F,0,0,0,0,0,0,0,0,
+ 0x1FA8,0x1FA9,0x1FAA,0x1FAB,0x1FAC,0x1FAD,0x1FAE,0x1FAF,0,0,0,0,0,0,0,0,
+ 0x1FB8,0x1FB9,0,0x1FBC,0,0,0,0,0,0,0,0,0,0,0x399,0,
+ 0,0,0,0x1FCC,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0x1FD8,0x1FD9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0x1FE8,0x1FE9,0,0,0,0x1FEC,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0x1FFC,0,0,0,0,0,0,0,0,0,0,0,0};
+static const guint16 simple_upper_case_mapping_lowarea_table3 [] = {
+ /* ==== 2100-21C0 ==== */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x2132,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0x2160,0x2161,0x2162,0x2163,0x2164,0x2165,0x2166,0x2167,0x2168,0x2169,0x216A,0x216B,0x216C,0x216D,0x216E,0x216F,
+ 0,0,0,0,0x2183,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0};
+static const guint16 simple_upper_case_mapping_lowarea_table4 [] = {
+ /* ==== 2480-2500 ==== */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0x24B6,0x24B7,0x24B8,0x24B9,0x24BA,0x24BB,0x24BC,0x24BD,0x24BE,0x24BF,0x24C0,0x24C1,0x24C2,0x24C3,0x24C4,0x24C5,
+ 0x24C6,0x24C7,0x24C8,0x24C9,0x24CA,0x24CB,0x24CC,0x24CD,0x24CE,0x24CF,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0};
+static const guint16 simple_upper_case_mapping_lowarea_table5 [] = {
+ /* ==== 2C00-2D80 ==== */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0x2C00,0x2C01,0x2C02,0x2C03,0x2C04,0x2C05,0x2C06,0x2C07,0x2C08,0x2C09,0x2C0A,0x2C0B,0x2C0C,0x2C0D,0x2C0E,0x2C0F,
+ 0x2C10,0x2C11,0x2C12,0x2C13,0x2C14,0x2C15,0x2C16,0x2C17,0x2C18,0x2C19,0x2C1A,0x2C1B,0x2C1C,0x2C1D,0x2C1E,0x2C1F,
+ 0x2C20,0x2C21,0x2C22,0x2C23,0x2C24,0x2C25,0x2C26,0x2C27,0x2C28,0x2C29,0x2C2A,0x2C2B,0x2C2C,0x2C2D,0x2C2E,0,
+0,0x2C60,0,0,0,0x23A,0x23E,0,0x2C67,0,0x2C69,0,0x2C6B,0,0,0,
+ 0,0,0,0x2C72,0,0,0x2C75,0,0,0,0,0,0,0,0,0,
+0,0x2C80,0,0x2C82,0,0x2C84,0,0x2C86,0,0x2C88,0,0x2C8A,0,0x2C8C,0,0x2C8E,
+ 0,0x2C90,0,0x2C92,0,0x2C94,0,0x2C96,0,0x2C98,0,0x2C9A,0,0x2C9C,0,0x2C9E,
+ 0,0x2CA0,0,0x2CA2,0,0x2CA4,0,0x2CA6,0,0x2CA8,0,0x2CAA,0,0x2CAC,0,0x2CAE,
+ 0,0x2CB0,0,0x2CB2,0,0x2CB4,0,0x2CB6,0,0x2CB8,0,0x2CBA,0,0x2CBC,0,0x2CBE,
+ 0,0x2CC0,0,0x2CC2,0,0x2CC4,0,0x2CC6,0,0x2CC8,0,0x2CCA,0,0x2CCC,0,0x2CCE,
+ 0,0x2CD0,0,0x2CD2,0,0x2CD4,0,0x2CD6,0,0x2CD8,0,0x2CDA,0,0x2CDC,0,0x2CDE,
+ 0,0x2CE0,0,0x2CE2,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0x10A0,0x10A1,0x10A2,0x10A3,0x10A4,0x10A5,0x10A6,0x10A7,0x10A8,0x10A9,0x10AA,0x10AB,0x10AC,0x10AD,0x10AE,0x10AF,
+ 0x10B0,0x10B1,0x10B2,0x10B3,0x10B4,0x10B5,0x10B6,0x10B7,0x10B8,0x10B9,0x10BA,0x10BB,0x10BC,0x10BD,0x10BE,0x10BF,
+ 0x10C0,0x10C1,0x10C2,0x10C3,0x10C4,0x10C5,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0};
+static const guint16 simple_upper_case_mapping_lowarea_table6 [] = {
+ /* ==== A640-A7C0 ==== */
+ 0,0xA640,0,0xA642,0,0xA644,0,0xA646,0,0xA648,0,0xA64A,0,0xA64C,0,0xA64E,
+ 0,0xA650,0,0xA652,0,0xA654,0,0xA656,0,0xA658,0,0xA65A,0,0xA65C,0,0xA65E,
+ 0,0,0,0xA662,0,0xA664,0,0xA666,0,0xA668,0,0xA66A,0,0xA66C,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0xA680,0,0xA682,0,0xA684,0,0xA686,0,0xA688,0,0xA68A,0,0xA68C,0,0xA68E,
+ 0,0xA690,0,0xA692,0,0xA694,0,0xA696,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0xA722,0,0xA724,0,0xA726,0,0xA728,0,0xA72A,0,0xA72C,0,0xA72E,
+ 0,0,0,0xA732,0,0xA734,0,0xA736,0,0xA738,0,0xA73A,0,0xA73C,0,0xA73E,
+ 0,0xA740,0,0xA742,0,0xA744,0,0xA746,0,0xA748,0,0xA74A,0,0xA74C,0,0xA74E,
+ 0,0xA750,0,0xA752,0,0xA754,0,0xA756,0,0xA758,0,0xA75A,0,0xA75C,0,0xA75E,
+ 0,0xA760,0,0xA762,0,0xA764,0,0xA766,0,0xA768,0,0xA76A,0,0xA76C,0,0xA76E,
+ 0,0,0,0,0,0,0,0,0,0,0xA779,0,0xA77B,0,0,0xA77E,
+ 0,0xA780,0,0xA782,0,0xA784,0,0xA786,0,0,0,0,0xA78B,0};
+static const guint16 simple_upper_case_mapping_lowarea_table7 [] = {
+ /* ==== FF20-FF80 ==== */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0xFF21,0xFF22,0xFF23,0xFF24,0xFF25,0xFF26,0xFF27,0xFF28,0xFF29,0xFF2A,0xFF2B,0xFF2C,0xFF2D,0xFF2E,0xFF2F,
+ 0xFF30,0xFF31,0xFF32,0xFF33,0xFF34,0xFF35,0xFF36,0xFF37,0xFF38,0xFF39,0xFF3A,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0};
+static const guint16 *simple_upper_case_mapping_lowarea [] = {
+ simple_upper_case_mapping_lowarea_table0,
+ simple_upper_case_mapping_lowarea_table1,
+ simple_upper_case_mapping_lowarea_table2,
+ simple_upper_case_mapping_lowarea_table3,
+ simple_upper_case_mapping_lowarea_table4,
+ simple_upper_case_mapping_lowarea_table5,
+ simple_upper_case_mapping_lowarea_table6,
+ simple_upper_case_mapping_lowarea_table7};
+static const int simple_upper_case_mapping_lowarea_table_count = 8;
+
+static const guint32 simple_upper_case_mapping_higharea_table0 [] = {
+ /* ==== 10400-10480 ==== */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0x10400,0x10401,0x10402,0x10403,0x10404,0x10405,0x10406,0x10407,
+ 0x10408,0x10409,0x1040A,0x1040B,0x1040C,0x1040D,0x1040E,0x1040F,0x10410,0x10411,0x10412,0x10413,0x10414,0x10415,0x10416,0x10417,
+ 0x10418,0x10419,0x1041A,0x1041B,0x1041C,0x1041D,0x1041E,0x1041F,0x10420,0x10421,0x10422,0x10423,0x10424,0x10425,0x10426,0x10427,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0};
+static const guint32 *simple_upper_case_mapping_higharea [] = {
+ simple_upper_case_mapping_higharea_table0};
+
+static const guint16 simple_lower_case_mapping_lowarea_table0 [] = {
+ /* ==== 40-600 ==== */
+ 0,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F,
+ 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,
+ 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0x101,0,0x103,0,0x105,0,0x107,0,0x109,0,0x10B,0,0x10D,0,0x10F,0,
+ 0x111,0,0x113,0,0x115,0,0x117,0,0x119,0,0x11B,0,0x11D,0,0x11F,0,
+ 0x121,0,0x123,0,0x125,0,0x127,0,0x129,0,0x12B,0,0x12D,0,0x12F,0,
+ 0x69,0,0x133,0,0x135,0,0x137,0,0,0x13A,0,0x13C,0,0x13E,0,0x140,
+ 0,0x142,0,0x144,0,0x146,0,0x148,0,0,0x14B,0,0x14D,0,0x14F,0,
+ 0x151,0,0x153,0,0x155,0,0x157,0,0x159,0,0x15B,0,0x15D,0,0x15F,0,
+ 0x161,0,0x163,0,0x165,0,0x167,0,0x169,0,0x16B,0,0x16D,0,0x16F,0,
+ 0x171,0,0x173,0,0x175,0,0x177,0,0xFF,0x17A,0,0x17C,0,0x17E,0,0,
+ 0,0x253,0x183,0,0x185,0,0x254,0x188,0,0x256,0x257,0x18C,0,0,0x1DD,0x259,
+ 0x25B,0x192,0,0x260,0x263,0,0x269,0x268,0x199,0,0,0,0x26F,0x272,0,0x275,
+ 0x1A1,0,0x1A3,0,0x1A5,0,0x280,0x1A8,0,0x283,0,0,0x1AD,0,0x288,0x1B0,
+ 0,0x28A,0x28B,0x1B4,0,0x1B6,0,0x292,0x1B9,0,0,0,0x1BD,0,0,0,
+ 0,0,0,0,0x1C6,0x1C6,0,0x1C9,0x1C9,0,0x1CC,0x1CC,0,0x1CE,0,0x1D0,
+ 0,0x1D2,0,0x1D4,0,0x1D6,0,0x1D8,0,0x1DA,0,0x1DC,0,0,0x1DF,0,
+ 0x1E1,0,0x1E3,0,0x1E5,0,0x1E7,0,0x1E9,0,0x1EB,0,0x1ED,0,0x1EF,0,
+ 0,0x1F3,0x1F3,0,0x1F5,0,0x195,0x1BF,0x1F9,0,0x1FB,0,0x1FD,0,0x1FF,0,
+ 0x201,0,0x203,0,0x205,0,0x207,0,0x209,0,0x20B,0,0x20D,0,0x20F,0,
+ 0x211,0,0x213,0,0x215,0,0x217,0,0x219,0,0x21B,0,0x21D,0,0x21F,0,
+ 0x19E,0,0x223,0,0x225,0,0x227,0,0x229,0,0x22B,0,0x22D,0,0x22F,0,
+ 0x231,0,0x233,0,0,0,0,0,0,0,0x2C65,0x23C,0,0x19A,0x2C66,0,
+ 0,0x242,0,0x180,0x289,0x28C,0x247,0,0x249,0,0x24B,0,0x24D,0,0x24F,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0x371,0,0x373,0,0,0,0x377,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0x3AC,0,0x3AD,0x3AE,0x3AF,0,0x3CC,0,0x3CD,0x3CE,
+ 0,0x3B1,0x3B2,0x3B3,0x3B4,0x3B5,0x3B6,0x3B7,0x3B8,0x3B9,0x3BA,0x3BB,0x3BC,0x3BD,0x3BE,0x3BF,
+ 0x3C0,0x3C1,0,0x3C3,0x3C4,0x3C5,0x3C6,0x3C7,0x3C8,0x3C9,0x3CA,0x3CB,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x3D7,
+ 0,0,0,0,0,0,0,0,0x3D9,0,0x3DB,0,0x3DD,0,0x3DF,0,
+ 0x3E1,0,0x3E3,0,0x3E5,0,0x3E7,0,0x3E9,0,0x3EB,0,0x3ED,0,0x3EF,0,
+ 0,0,0,0,0x3B8,0,0,0x3F8,0,0x3F2,0x3FB,0,0,0x37B,0x37C,0x37D,
+ 0x450,0x451,0x452,0x453,0x454,0x455,0x456,0x457,0x458,0x459,0x45A,0x45B,0x45C,0x45D,0x45E,0x45F,
+ 0x430,0x431,0x432,0x433,0x434,0x435,0x436,0x437,0x438,0x439,0x43A,0x43B,0x43C,0x43D,0x43E,0x43F,
+ 0x440,0x441,0x442,0x443,0x444,0x445,0x446,0x447,0x448,0x449,0x44A,0x44B,0x44C,0x44D,0x44E,0x44F,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0x461,0,0x463,0,0x465,0,0x467,0,0x469,0,0x46B,0,0x46D,0,0x46F,0,
+ 0x471,0,0x473,0,0x475,0,0x477,0,0x479,0,0x47B,0,0x47D,0,0x47F,0,
+ 0x481,0,0,0,0,0,0,0,0,0,0x48B,0,0x48D,0,0x48F,0,
+ 0x491,0,0x493,0,0x495,0,0x497,0,0x499,0,0x49B,0,0x49D,0,0x49F,0,
+ 0x4A1,0,0x4A3,0,0x4A5,0,0x4A7,0,0x4A9,0,0x4AB,0,0x4AD,0,0x4AF,0,
+ 0x4B1,0,0x4B3,0,0x4B5,0,0x4B7,0,0x4B9,0,0x4BB,0,0x4BD,0,0x4BF,0,
+ 0x4CF,0x4C2,0,0x4C4,0,0x4C6,0,0x4C8,0,0x4CA,0,0x4CC,0,0x4CE,0,0,
+ 0x4D1,0,0x4D3,0,0x4D5,0,0x4D7,0,0x4D9,0,0x4DB,0,0x4DD,0,0x4DF,0,
+ 0x4E1,0,0x4E3,0,0x4E5,0,0x4E7,0,0x4E9,0,0x4EB,0,0x4ED,0,0x4EF,0,
+ 0x4F1,0,0x4F3,0,0x4F5,0,0x4F7,0,0x4F9,0,0x4FB,0,0x4FD,0,0x4FF,0,
+ 0x501,0,0x503,0,0x505,0,0x507,0,0x509,0,0x50B,0,0x50D,0,0x50F,0,
+ 0x511,0,0x513,0,0x515,0,0x517,0,0x519,0,0x51B,0,0x51D,0,0x51F,0,
+ 0x521,0,0x523,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0x561,0x562,0x563,0x564,0x565,0x566,0x567,0x568,0x569,0x56A,0x56B,0x56C,0x56D,0x56E,0x56F,
+ 0x570,0x571,0x572,0x573,0x574,0x575,0x576,0x577,0x578,0x579,0x57A,0x57B,0x57C,0x57D,0x57E,0x57F,
+ 0x580,0x581,0x582,0x583,0x584,0x585,0x586,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0};
+static const guint16 simple_lower_case_mapping_lowarea_table1 [] = {
+ /* ==== 1000-10D0 ==== */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0x2D00,0x2D01,0x2D02,0x2D03,0x2D04,0x2D05,0x2D06,0x2D07,0x2D08,0x2D09,0x2D0A,0x2D0B,0x2D0C,0x2D0D,0x2D0E,0x2D0F,
+ 0x2D10,0x2D11,0x2D12,0x2D13,0x2D14,0x2D15,0x2D16,0x2D17,0x2D18,0x2D19,0x2D1A,0x2D1B,0x2D1C,0x2D1D,0x2D1E,0x2D1F,
+ 0x2D20,0x2D21,0x2D22,0x2D23,0x2D24,0x2D25,0};
+static const guint16 simple_lower_case_mapping_lowarea_table2 [] = {
+ /* ==== 1D00-2000 ==== */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0x1E01,0,0x1E03,0,0x1E05,0,0x1E07,0,0x1E09,0,0x1E0B,0,0x1E0D,0,0x1E0F,0,
+ 0x1E11,0,0x1E13,0,0x1E15,0,0x1E17,0,0x1E19,0,0x1E1B,0,0x1E1D,0,0x1E1F,0,
+ 0x1E21,0,0x1E23,0,0x1E25,0,0x1E27,0,0x1E29,0,0x1E2B,0,0x1E2D,0,0x1E2F,0,
+ 0x1E31,0,0x1E33,0,0x1E35,0,0x1E37,0,0x1E39,0,0x1E3B,0,0x1E3D,0,0x1E3F,0,
+ 0x1E41,0,0x1E43,0,0x1E45,0,0x1E47,0,0x1E49,0,0x1E4B,0,0x1E4D,0,0x1E4F,0,
+ 0x1E51,0,0x1E53,0,0x1E55,0,0x1E57,0,0x1E59,0,0x1E5B,0,0x1E5D,0,0x1E5F,0,
+ 0x1E61,0,0x1E63,0,0x1E65,0,0x1E67,0,0x1E69,0,0x1E6B,0,0x1E6D,0,0x1E6F,0,
+ 0x1E71,0,0x1E73,0,0x1E75,0,0x1E77,0,0x1E79,0,0x1E7B,0,0x1E7D,0,0x1E7F,0,
+ 0x1E81,0,0x1E83,0,0x1E85,0,0x1E87,0,0x1E89,0,0x1E8B,0,0x1E8D,0,0x1E8F,0,
+ 0x1E91,0,0x1E93,0,0x1E95,0,0,0,0,0,0,0,0,0,0xDF,0,
+ 0x1EA1,0,0x1EA3,0,0x1EA5,0,0x1EA7,0,0x1EA9,0,0x1EAB,0,0x1EAD,0,0x1EAF,0,
+ 0x1EB1,0,0x1EB3,0,0x1EB5,0,0x1EB7,0,0x1EB9,0,0x1EBB,0,0x1EBD,0,0x1EBF,0,
+ 0x1EC1,0,0x1EC3,0,0x1EC5,0,0x1EC7,0,0x1EC9,0,0x1ECB,0,0x1ECD,0,0x1ECF,0,
+ 0x1ED1,0,0x1ED3,0,0x1ED5,0,0x1ED7,0,0x1ED9,0,0x1EDB,0,0x1EDD,0,0x1EDF,0,
+ 0x1EE1,0,0x1EE3,0,0x1EE5,0,0x1EE7,0,0x1EE9,0,0x1EEB,0,0x1EED,0,0x1EEF,0,
+ 0x1EF1,0,0x1EF3,0,0x1EF5,0,0x1EF7,0,0x1EF9,0,0x1EFB,0,0x1EFD,0,0x1EFF,0,
+ 0,0,0,0,0,0,0,0,0x1F00,0x1F01,0x1F02,0x1F03,0x1F04,0x1F05,0x1F06,0x1F07,
+ 0,0,0,0,0,0,0,0,0x1F10,0x1F11,0x1F12,0x1F13,0x1F14,0x1F15,0,0,
+0,0,0,0,0,0,0,0,0x1F20,0x1F21,0x1F22,0x1F23,0x1F24,0x1F25,0x1F26,0x1F27,
+ 0,0,0,0,0,0,0,0,0x1F30,0x1F31,0x1F32,0x1F33,0x1F34,0x1F35,0x1F36,0x1F37,
+ 0,0,0,0,0,0,0,0,0x1F40,0x1F41,0x1F42,0x1F43,0x1F44,0x1F45,0,0,
+0,0,0,0,0,0,0,0,0,0x1F51,0,0x1F53,0,0x1F55,0,0x1F57,
+ 0,0,0,0,0,0,0,0,0x1F60,0x1F61,0x1F62,0x1F63,0x1F64,0x1F65,0x1F66,0x1F67,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0x1F80,0x1F81,0x1F82,0x1F83,0x1F84,0x1F85,0x1F86,0x1F87,
+ 0,0,0,0,0,0,0,0,0x1F90,0x1F91,0x1F92,0x1F93,0x1F94,0x1F95,0x1F96,0x1F97,
+ 0,0,0,0,0,0,0,0,0x1FA0,0x1FA1,0x1FA2,0x1FA3,0x1FA4,0x1FA5,0x1FA6,0x1FA7,
+ 0,0,0,0,0,0,0,0,0x1FB0,0x1FB1,0x1F70,0x1F71,0x1FB3,0,0,0,
+ 0,0,0,0,0,0,0,0,0x1F72,0x1F73,0x1F74,0x1F75,0x1FC3,0,0,0,
+ 0,0,0,0,0,0,0,0,0x1FD0,0x1FD1,0x1F76,0x1F77,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0x1FE0,0x1FE1,0x1F7A,0x1F7B,0x1FE5,0,0,0,
+ 0,0,0,0,0,0,0,0,0x1F78,0x1F79,0x1F7C,0x1F7D,0x1FF3,0,0,0};
+static const guint16 simple_lower_case_mapping_lowarea_table3 [] = {
+ /* ==== 2100-21C0 ==== */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0x3C9,0,0,0,0x6B,0xE5,0,0,0,0,
+ 0,0,0x214E,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0x2170,0x2171,0x2172,0x2173,0x2174,0x2175,0x2176,0x2177,0x2178,0x2179,0x217A,0x217B,0x217C,0x217D,0x217E,0x217F,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0x2184,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0};
+static const guint16 simple_lower_case_mapping_lowarea_table4 [] = {
+ /* ==== 2480-2500 ==== */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0x24D0,0x24D1,0x24D2,0x24D3,0x24D4,0x24D5,0x24D6,0x24D7,0x24D8,0x24D9,
+ 0x24DA,0x24DB,0x24DC,0x24DD,0x24DE,0x24DF,0x24E0,0x24E1,0x24E2,0x24E3,0x24E4,0x24E5,0x24E6,0x24E7,0x24E8,0x24E9,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0};
+static const guint16 simple_lower_case_mapping_lowarea_table5 [] = {
+ /* ==== 2C00-2D80 ==== */
+ 0x2C30,0x2C31,0x2C32,0x2C33,0x2C34,0x2C35,0x2C36,0x2C37,0x2C38,0x2C39,0x2C3A,0x2C3B,0x2C3C,0x2C3D,0x2C3E,0x2C3F,
+ 0x2C40,0x2C41,0x2C42,0x2C43,0x2C44,0x2C45,0x2C46,0x2C47,0x2C48,0x2C49,0x2C4A,0x2C4B,0x2C4C,0x2C4D,0x2C4E,0x2C4F,
+ 0x2C50,0x2C51,0x2C52,0x2C53,0x2C54,0x2C55,0x2C56,0x2C57,0x2C58,0x2C59,0x2C5A,0x2C5B,0x2C5C,0x2C5D,0x2C5E,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0x2C61,0,0x26B,0x1D7D,0x27D,0,0,0x2C68,0,0x2C6A,0,0x2C6C,0,0x251,0x271,0x250,
+ 0,0,0x2C73,0,0,0x2C76,0,0,0,0,0,0,0,0,0,0,
+0x2C81,0,0x2C83,0,0x2C85,0,0x2C87,0,0x2C89,0,0x2C8B,0,0x2C8D,0,0x2C8F,0,
+ 0x2C91,0,0x2C93,0,0x2C95,0,0x2C97,0,0x2C99,0,0x2C9B,0,0x2C9D,0,0x2C9F,0,
+ 0x2CA1,0,0x2CA3,0,0x2CA5,0,0x2CA7,0,0x2CA9,0,0x2CAB,0,0x2CAD,0,0x2CAF,0,
+ 0x2CB1,0,0x2CB3,0,0x2CB5,0,0x2CB7,0,0x2CB9,0,0x2CBB,0,0x2CBD,0,0x2CBF,0,
+ 0x2CC1,0,0x2CC3,0,0x2CC5,0,0x2CC7,0,0x2CC9,0,0x2CCB,0,0x2CCD,0,0x2CCF,0,
+ 0x2CD1,0,0x2CD3,0,0x2CD5,0,0x2CD7,0,0x2CD9,0,0x2CDB,0,0x2CDD,0,0x2CDF,0,
+ 0x2CE1,0,0x2CE3,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0};
+static const guint16 simple_lower_case_mapping_lowarea_table6 [] = {
+ /* ==== A640-A7C0 ==== */
+ 0xA641,0,0xA643,0,0xA645,0,0xA647,0,0xA649,0,0xA64B,0,0xA64D,0,0xA64F,0,
+ 0xA651,0,0xA653,0,0xA655,0,0xA657,0,0xA659,0,0xA65B,0,0xA65D,0,0xA65F,0,
+ 0,0,0xA663,0,0xA665,0,0xA667,0,0xA669,0,0xA66B,0,0xA66D,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0xA681,0,0xA683,0,0xA685,0,0xA687,0,0xA689,0,0xA68B,0,0xA68D,0,0xA68F,0,
+ 0xA691,0,0xA693,0,0xA695,0,0xA697,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0xA723,0,0xA725,0,0xA727,0,0xA729,0,0xA72B,0,0xA72D,0,0xA72F,0,
+ 0,0,0xA733,0,0xA735,0,0xA737,0,0xA739,0,0xA73B,0,0xA73D,0,0xA73F,0,
+ 0xA741,0,0xA743,0,0xA745,0,0xA747,0,0xA749,0,0xA74B,0,0xA74D,0,0xA74F,0,
+ 0xA751,0,0xA753,0,0xA755,0,0xA757,0,0xA759,0,0xA75B,0,0xA75D,0,0xA75F,0,
+ 0xA761,0,0xA763,0,0xA765,0,0xA767,0,0xA769,0,0xA76B,0,0xA76D,0,0xA76F,0,
+ 0,0,0,0,0,0,0,0,0,0xA77A,0,0xA77C,0,0x1D79,0xA77F,0,
+ 0xA781,0,0xA783,0,0xA785,0,0xA787,0,0,0,0,0xA78C,0,0};
+static const guint16 simple_lower_case_mapping_lowarea_table7 [] = {
+ /* ==== FF20-FF80 ==== */
+ 0,0xFF41,0xFF42,0xFF43,0xFF44,0xFF45,0xFF46,0xFF47,0xFF48,0xFF49,0xFF4A,0xFF4B,0xFF4C,0xFF4D,0xFF4E,0xFF4F,
+ 0xFF50,0xFF51,0xFF52,0xFF53,0xFF54,0xFF55,0xFF56,0xFF57,0xFF58,0xFF59,0xFF5A,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0};
+static const guint16 *simple_lower_case_mapping_lowarea [] = {
+ simple_lower_case_mapping_lowarea_table0,
+ simple_lower_case_mapping_lowarea_table1,
+ simple_lower_case_mapping_lowarea_table2,
+ simple_lower_case_mapping_lowarea_table3,
+ simple_lower_case_mapping_lowarea_table4,
+ simple_lower_case_mapping_lowarea_table5,
+ simple_lower_case_mapping_lowarea_table6,
+ simple_lower_case_mapping_lowarea_table7};
+static const int simple_lower_case_mapping_lowarea_table_count = 8;
+
+static const guint32 simple_lower_case_mapping_higharea_table0 [] = {
+ /* ==== 10400-10480 ==== */
+ 0x10428,0x10429,0x1042A,0x1042B,0x1042C,0x1042D,0x1042E,0x1042F,0x10430,0x10431,0x10432,0x10433,0x10434,0x10435,0x10436,0x10437,
+ 0x10438,0x10439,0x1043A,0x1043B,0x1043C,0x1043D,0x1043E,0x1043F,0x10440,0x10441,0x10442,0x10443,0x10444,0x10445,0x10446,0x10447,
+ 0x10448,0x10449,0x1044A,0x1044B,0x1044C,0x1044D,0x1044E,0x1044F,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0};
+static const guint32 *simple_lower_case_mapping_higharea [] = {
+ simple_lower_case_mapping_higharea_table0};
+
+
+static const SimpleTitlecaseMapping simple_titlecase_mapping [] = {
+ {0x0001C4, 0x000000, 0x0001C5},
+ {0x0001C5, 0x0001C4, 0x0001C5},
+ {0x0001C6, 0x0001C4, 0x0001C5},
+ {0x0001C7, 0x000000, 0x0001C8},
+ {0x0001C8, 0x0001C7, 0x0001C8},
+ {0x0001C9, 0x0001C7, 0x0001C8},
+ {0x0001CA, 0x000000, 0x0001CB},
+ {0x0001CB, 0x0001CA, 0x0001CB},
+ {0x0001CC, 0x0001CA, 0x0001CB},
+ {0x0001F1, 0x000000, 0x0001F2},
+ {0x0001F2, 0x0001F1, 0x0001F2},
+ {0x0001F3, 0x0001F1, 0x0001F2}
+};
+static const guint8 simple_titlecase_mapping_count = 12;
+
+#endif
+
common_sources = \
$(platform_sources) \
+ appdomain.c \
+ domain.c \
appdomain-icalls.h \
assembly.c \
assembly-internals.h \
number-formatter.h \
number-ms.c \
number-ms.h \
+ object.c \
object-internals.h \
opcodes.c \
property-bag.h \
w32process.h \
w32process-internals.h \
profiler.c \
- profiler-events.h \
profiler-private.h \
rand.h \
rand.c \
w32handle-namespace.c \
w32handle.h \
w32handle.c \
- w32error.h
+ w32error.h \
+ reflection.c \
+ dynamic-image.c \
+ sre.c \
+ sre-encode.c \
+ sre-save.c \
+ custom-attrs.c \
+ fdhandle.h \
+ fdhandle.c
# These source files have compile time dependencies on GC code
gc_dependent_sources = \
- appdomain.c \
- domain.c \
gc-stats.c \
gc.c \
monitor.c \
mono-hash.c \
- mono-conc-hash.c \
- object.c \
- dynamic-image.c \
- sre.c \
- sre-encode.c \
- sre-save.c \
- custom-attrs.c \
- reflection.c
-
+ mono-conc-hash.c
boehm_sources = \
boehm-gc.c
object.h \
opcodes.h \
profiler.h \
+ profiler-events.h \
reflection.h \
row-indexes.h \
tokentype.h \
mono_loader_lock (); //FIXME why do we need the loader lock here?
mono_domain_lock (domain);
-#ifdef HAVE_SGEN_GC
/*
* We need to make sure that we don't have any remsets
* pointing into static data of the to-be-freed domain because
for (i = 0; i < domain->class_vtable_array->len; ++i)
zero_static_data ((MonoVTable *)g_ptr_array_index (domain->class_vtable_array, i));
mono_gc_collect (0);
-#endif
for (i = 0; i < domain->class_vtable_array->len; ++i)
clear_cached_vtable ((MonoVTable *)g_ptr_array_index (domain->class_vtable_array, i));
deregister_reflection_info_roots (domain);
parse_public_key (const gchar *key, gchar** pubkey, gboolean *is_ecma)
{
const gchar *pkey;
- gchar header [16], val, *arr;
+ gchar header [16], val, *arr, *endp;
gint i, j, offset, bitlen, keylen, pkeylen;
keylen = strlen (key) >> 1;
if (!pubkey)
return TRUE;
+ arr = (gchar *)g_malloc (keylen + 4);
/* Encode the size of the blob */
- offset = 0;
- if (keylen <= 127) {
- arr = (gchar *)g_malloc (keylen + 1);
- arr [offset++] = keylen;
- } else {
- arr = (gchar *)g_malloc (keylen + 2);
- arr [offset++] = 0x80; /* 10bs */
- arr [offset++] = keylen;
- }
+ mono_metadata_encode_value (keylen, &arr[0], &endp);
+ offset = (gint)(endp-arr);
for (i = offset, j = 0; i < keylen + offset; i++) {
arr [i] = g_ascii_xdigit_value (key [j++]) << 4;
static void
on_gc_notification (GC_EventType event)
{
- MonoProfilerGCEvent e = (MonoProfilerGCEvent)event;
+ MonoProfilerGCEvent e;
- switch (e) {
- case MONO_GC_EVENT_PRE_STOP_WORLD:
+ switch (event) {
+ case GC_EVENT_PRE_STOP_WORLD:
+ e = MONO_GC_EVENT_PRE_STOP_WORLD;
MONO_GC_WORLD_STOP_BEGIN ();
break;
- case MONO_GC_EVENT_POST_STOP_WORLD:
+ case GC_EVENT_POST_STOP_WORLD:
+ e = MONO_GC_EVENT_POST_STOP_WORLD;
MONO_GC_WORLD_STOP_END ();
break;
- case MONO_GC_EVENT_PRE_START_WORLD:
+ case GC_EVENT_PRE_START_WORLD:
+ e = MONO_GC_EVENT_PRE_START_WORLD;
MONO_GC_WORLD_RESTART_BEGIN (1);
break;
- case MONO_GC_EVENT_POST_START_WORLD:
+ case GC_EVENT_POST_START_WORLD:
+ e = MONO_GC_EVENT_POST_START_WORLD;
MONO_GC_WORLD_RESTART_END (1);
break;
- case MONO_GC_EVENT_START:
+ case GC_EVENT_START:
+ e = MONO_GC_EVENT_START;
MONO_GC_BEGIN (1);
#ifndef DISABLE_PERFCOUNTERS
if (mono_perfcounters)
gc_start_time = mono_100ns_ticks ();
break;
- case MONO_GC_EVENT_END:
+ case GC_EVENT_END:
+ e = MONO_GC_EVENT_END;
MONO_GC_END (1);
#if defined(ENABLE_DTRACE) && defined(__sun__)
/* This works around a dtrace -G problem on Solaris.
break;
}
- MONO_PROFILER_RAISE (gc_event, (e, 0));
+ switch (event) {
+ case GC_EVENT_MARK_START:
+ case GC_EVENT_MARK_END:
+ case GC_EVENT_RECLAIM_START:
+ case GC_EVENT_RECLAIM_END:
+ break;
+ default:
+ MONO_PROFILER_RAISE (gc_event, (e, 0));
+ break;
+ }
- switch (e) {
- case MONO_GC_EVENT_PRE_STOP_WORLD:
+ switch (event) {
+ case GC_EVENT_PRE_STOP_WORLD:
mono_thread_info_suspend_lock ();
MONO_PROFILER_RAISE (gc_event, (MONO_GC_EVENT_PRE_STOP_WORLD_LOCKED, 0));
break;
- case MONO_GC_EVENT_POST_START_WORLD:
+ case GC_EVENT_POST_START_WORLD:
mono_thread_info_suspend_unlock ();
MONO_PROFILER_RAISE (gc_event, (MONO_GC_EVENT_POST_START_WORLD_UNLOCKED, 0));
break;
* @klass. The method will typically have an thread-local inline allocation sequence.
* The signature of the called method is:
* object allocate (MonoVTable *vtable)
- * Some of the logic here is similar to mono_class_get_allocation_ftn () i object.c,
- * keep in sync.
* The thread local alloc logic is taken from libgc/pthread_support.c.
*/
-
MonoMethod*
mono_gc_get_managed_allocator (MonoClass *klass, gboolean for_box, gboolean known_instance_size)
{
#ifdef ENABLE_ICALL_EXPORT
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
+#define ICALL_DECL_EXPORT MONO_API
#define ICALL_EXPORT MONO_API
#else
+#define ICALL_DECL_EXPORT
#define ICALL_EXPORT static
#endif
*/
struct _MonoGenericInst {
#ifndef MONO_SMALL_CONFIG
- guint id; /* unique ID for debugging */
+ gint32 id; /* unique ID for debugging */
#endif
guint type_argc : 22; /* number of type arguments */
guint is_open : 1; /* if this is an open type */
typedef struct {
guint64 new_object_count;
- size_t initialized_class_count;
- size_t generic_vtable_count;
+ gsize initialized_class_count;
+ gsize generic_vtable_count;
size_t used_class_count;
size_t method_count;
size_t class_vtable_size;
size_t class_static_data_size;
size_t generic_instance_count;
- size_t generic_class_count;
- size_t inflated_method_count;
+ gsize generic_class_count;
+ gsize inflated_method_count;
size_t inflated_method_count_2;
- size_t inflated_type_count;
+ gsize inflated_type_count;
size_t generics_metadata_size;
size_t delegate_creations;
size_t imt_tables_size;
#include <mono/utils/mono-logger-internals.h>
#include <mono/utils/mono-memory-model.h>
#include <mono/utils/atomic.h>
+#include <mono/utils/unlocked.h>
#include <mono/utils/bsearch.h>
#include <mono/utils/checked-build.h>
}
}
- mono_stats.inflated_type_count++;
+ UnlockedIncrementSize (&mono_stats.inflated_type_count);
return inflated;
}
if (!inflated)
return type;
- mono_stats.inflated_type_count++;
+ UnlockedIncrementSize (&mono_stats.inflated_type_count);
return inflated;
}
return (MonoMethod*)cached;
}
- mono_stats.inflated_method_count++;
+ UnlockedIncrementSize (&mono_stats.inflated_method_count);
inflated_methods_size += sizeof (MonoMethodInflated);
return;
}
- mono_stats.generic_vtable_count ++;
+ UnlockedIncrementSize (&mono_stats.generic_vtable_count);
in_setup = g_list_prepend (in_setup, klass);
if (mono_class_is_ginst (klass)) {
goto leave;
}
- mono_stats.initialized_class_count++;
+ UnlockedIncrementSize (&mono_stats.initialized_class_count);
if (mono_class_is_ginst (klass) && !mono_class_get_generic_class (klass)->is_dynamic) {
MonoClass *gklass = mono_class_get_generic_class (klass)->container_class;
return !mono_class_has_failure (klass);
}
- mono_stats.initialized_class_count++;
+ UnlockedIncrementSize (&mono_stats.initialized_class_count);
if (mono_class_is_ginst (klass) && !mono_class_get_generic_class (klass)->is_dynamic)
- mono_stats.generic_class_count++;
+ UnlockedIncrementSize (&mono_stats.generic_class_count);
if (mono_class_is_ginst (klass) || image_is_dynamic (klass->image) || !klass->type_token || (has_cached_info && !cached_info.has_nested_classes))
klass->nested_classes_inited = TRUE;
{
mono_free_bstr (ptr);
}
+
+void*
+mono_cominterop_get_com_interface (MonoObject *object, MonoClass *ic, MonoError *error)
+{
+ error_init (error);
+
+#ifndef DISABLE_COM
+ if (!object)
+ return NULL;
+
+ if (cominterop_object_is_rcw (object)) {
+ MonoClass *klass = NULL;
+ MonoRealProxy* real_proxy = NULL;
+ if (!object)
+ return NULL;
+ klass = mono_object_class (object);
+ if (!mono_class_is_transparent_proxy (klass)) {
+ mono_error_set_invalid_operation (error, "Class is not transparent");
+ return NULL;
+ }
+
+ real_proxy = ((MonoTransparentProxy*)object)->rp;
+ if (!real_proxy) {
+ mono_error_set_invalid_operation (error, "RealProxy is null");
+ return NULL;
+ }
+
+ klass = mono_object_class (real_proxy);
+ if (klass != mono_class_get_interop_proxy_class ()) {
+ mono_error_set_invalid_operation (error, "Object is not a proxy");
+ return NULL;
+ }
+
+ if (!((MonoComInteropProxy*)real_proxy)->com_object) {
+ mono_error_set_invalid_operation (error, "Proxy points to null COM object");
+ return NULL;
+ }
+
+ void* com_itf = cominterop_get_interface_checked (((MonoComInteropProxy*)real_proxy)->com_object, ic, error);
+ return com_itf;
+ }
+ else {
+ void* ccw_entry = cominterop_get_ccw_checked (object, ic, error);
+ return ccw_entry;
+ }
+#else
+ g_assert_not_reached ();
+#endif
+}
MonoClass*
mono_class_try_get_com_object_class (void);
+void*
+mono_cominterop_get_com_interface (MonoObject* object, MonoClass* ic, MonoError *error);
+
#endif /* __MONO_COMINTEROP_H__ */
static MonoCustomAttrInfo*
mono_custom_attrs_from_builders_handle (MonoImage *alloc_img, MonoImage *image, MonoArrayHandle cattrs);
+static gboolean
+bcheck_blob (const char *ptr, int bump, const char *endp, MonoError *error);
+
+static gboolean
+decode_blob_value_checked (const char *ptr, const char *endp, guint32 *size_out, const char **retp, MonoError *error);
+
/*
* LOCKING: Acquires the loader lock.
*/
}
static MonoClass*
-load_cattr_enum_type (MonoImage *image, const char *p, const char **end, MonoError *error)
+load_cattr_enum_type (MonoImage *image, const char *p, const char *boundp, const char **end, MonoError *error)
{
char *n;
MonoType *t;
- int slen = mono_metadata_decode_value (p, &p);
-
+ guint32 slen;
error_init (error);
+ if (!decode_blob_value_checked (p, boundp, &slen, &p, error))
+ return NULL;
+
+ if (boundp && slen > 0 && !bcheck_blob (p, slen - 1, boundp, error))
+ return NULL;
n = (char *)g_memdup (p, slen + 1);
n [slen] = 0;
t = cattr_type_from_name (n, image, TRUE, error);
}
static void*
-load_cattr_value (MonoImage *image, MonoType *t, const char *p, const char **end, MonoError *error)
+load_cattr_value (MonoImage *image, MonoType *t, const char *p, const char *boundp, const char **end, MonoError *error)
{
- int slen, type = t->type;
+ int type = t->type;
+ guint32 slen;
MonoClass *tklass = t->data.klass;
+ g_assert (boundp);
error_init (error);
handle_enum:
case MONO_TYPE_I1:
case MONO_TYPE_BOOLEAN: {
MonoBoolean *bval = (MonoBoolean *)g_malloc (sizeof (MonoBoolean));
+ if (!bcheck_blob (p, 0, boundp, error))
+ return NULL;
*bval = *p;
*end = p + 1;
return bval;
case MONO_TYPE_U2:
case MONO_TYPE_I2: {
guint16 *val = (guint16 *)g_malloc (sizeof (guint16));
+ if (!bcheck_blob (p, 1, boundp, error))
+ return NULL;
*val = read16 (p);
*end = p + 2;
return val;
case MONO_TYPE_U4:
case MONO_TYPE_I4: {
guint32 *val = (guint32 *)g_malloc (sizeof (guint32));
+ if (!bcheck_blob (p, 3, boundp, error))
+ return NULL;
*val = read32 (p);
*end = p + 4;
return val;
case MONO_TYPE_U8:
case MONO_TYPE_I8: {
guint64 *val = (guint64 *)g_malloc (sizeof (guint64));
+ if (!bcheck_blob (p, 7, boundp, error))
+ return NULL;
*val = read64 (p);
*end = p + 8;
return val;
}
case MONO_TYPE_R8: {
double *val = (double *)g_malloc (sizeof (double));
+ if (!bcheck_blob (p, 7, boundp, error))
+ return NULL;
readr8 (p, val);
*end = p + 8;
return val;
if (mono_is_corlib_image (k->image) && strcmp (k->name_space, "System") == 0 && strcmp (k->name, "DateTime") == 0){
guint64 *val = (guint64 *)g_malloc (sizeof (guint64));
+ if (!bcheck_blob (p, 7, boundp, error))
+ return NULL;
*val = read64 (p);
*end = p + 8;
return val;
break;
case MONO_TYPE_STRING:
+ if (!bcheck_blob (p, 0, boundp, error))
+ return NULL;
if (*p == (char)0xFF) {
*end = p + 1;
return NULL;
}
- slen = mono_metadata_decode_value (p, &p);
+ if (!decode_blob_value_checked (p, boundp, &slen, &p, error))
+ return NULL;
+ if (slen > 0 && !bcheck_blob (p, slen - 1, boundp, error))
+ return NULL;
*end = p + slen;
return mono_string_new_len_checked (mono_domain_get (), p, slen, error);
case MONO_TYPE_CLASS: {
MonoReflectionType *rt;
char *n;
MonoType *t;
+ if (!bcheck_blob (p, 0, boundp, error))
+ return NULL;
if (*p == (char)0xFF) {
*end = p + 1;
return NULL;
}
handle_type:
- slen = mono_metadata_decode_value (p, &p);
+ if (!decode_blob_value_checked (p, boundp, &slen, &p, error))
+ return NULL;
+ if (slen > 0 && !bcheck_blob (p, slen - 1, boundp, error))
+ return NULL;
n = (char *)g_memdup (p, slen + 1);
n [slen] = 0;
t = cattr_type_from_name (n, image, FALSE, error);
return rt;
}
case MONO_TYPE_OBJECT: {
+ if (!bcheck_blob (p, 0, boundp, error))
+ return NULL;
char subt = *p++;
MonoObject *obj;
MonoClass *subc = NULL;
goto handle_enum;
} else if (subt == 0x1D) {
MonoType simple_type = {{0}};
+ if (!bcheck_blob (p, 0, boundp, error))
+ return NULL;
int etype = *p;
p ++;
if (etype == 0x50) {
tklass = mono_defaults.systemtype_class;
} else if (etype == 0x55) {
- tklass = load_cattr_enum_type (image, p, &p, error);
- if (!mono_error_ok (error))
+ tklass = load_cattr_enum_type (image, p, boundp, &p, error);
+ if (!is_ok (error))
return NULL;
} else {
if (etype == 0x51)
} else if (subt == 0x55) {
char *n;
MonoType *t;
- slen = mono_metadata_decode_value (p, &p);
+ if (!decode_blob_value_checked (p, boundp, &slen, &p, error))
+ return NULL;
+ if (slen > 0 && !bcheck_blob (p, slen - 1, boundp, error))
+ return NULL;
n = (char *)g_memdup (p, slen + 1);
n [slen] = 0;
t = cattr_type_from_name (n, image, FALSE, error);
} else {
g_error ("Unknown type 0x%02x for object type encoding in custom attr", subt);
}
- val = load_cattr_value (image, &subc->byval_arg, p, end, error);
+ val = load_cattr_value (image, &subc->byval_arg, p, boundp, end, error);
obj = NULL;
- if (mono_error_ok (error)) {
+ if (is_ok (error)) {
obj = mono_object_new_checked (mono_domain_get (), subc, error);
g_assert (!subc->has_references);
- if (mono_error_ok (error))
+ if (is_ok (error))
mono_gc_memmove_atomic ((char*)obj + sizeof (MonoObject), val, mono_class_value_size (subc, NULL));
}
case MONO_TYPE_SZARRAY: {
MonoArray *arr;
guint32 i, alen, basetype;
+ if (!bcheck_blob (p, 3, boundp, error))
+ return NULL;
alen = read32 (p);
p += 4;
if (alen == 0xffffffff) {
case MONO_TYPE_I1:
case MONO_TYPE_BOOLEAN:
for (i = 0; i < alen; i++) {
+ if (!bcheck_blob (p, 0, boundp, error))
+ return NULL;
MonoBoolean val = *p++;
mono_array_set (arr, MonoBoolean, i, val);
}
case MONO_TYPE_U2:
case MONO_TYPE_I2:
for (i = 0; i < alen; i++) {
+ if (!bcheck_blob (p, 1, boundp, error))
+ return NULL;
guint16 val = read16 (p);
mono_array_set (arr, guint16, i, val);
p += 2;
case MONO_TYPE_U4:
case MONO_TYPE_I4:
for (i = 0; i < alen; i++) {
+ if (!bcheck_blob (p, 3, boundp, error))
+ return NULL;
guint32 val = read32 (p);
mono_array_set (arr, guint32, i, val);
p += 4;
break;
case MONO_TYPE_R8:
for (i = 0; i < alen; i++) {
+ if (!bcheck_blob (p, 7, boundp, error))
+ return NULL;
double val;
readr8 (p, &val);
mono_array_set (arr, double, i, val);
case MONO_TYPE_U8:
case MONO_TYPE_I8:
for (i = 0; i < alen; i++) {
+ if (!bcheck_blob (p, 7, boundp, error))
+ return NULL;
guint64 val = read64 (p);
mono_array_set (arr, guint64, i, val);
p += 8;
case MONO_TYPE_STRING:
case MONO_TYPE_SZARRAY:
for (i = 0; i < alen; i++) {
- MonoObject *item = (MonoObject *)load_cattr_value (image, &tklass->byval_arg, p, &p, error);
- if (!mono_error_ok (error))
+ MonoObject *item = (MonoObject *)load_cattr_value (image, &tklass->byval_arg, p, boundp, &p, error);
+ if (!is_ok (error))
return NULL;
mono_array_setref (arr, i, item);
}
}
static MonoObject*
-load_cattr_value_boxed (MonoDomain *domain, MonoImage *image, MonoType *t, const char* p, const char** end, MonoError *error)
+load_cattr_value_boxed (MonoDomain *domain, MonoImage *image, MonoType *t, const char* p, const char *boundp, const char** end, MonoError *error)
{
error_init (error);
gboolean is_ref = type_is_reference (t);
- void *val = load_cattr_value (image, t, p, end, error);
+ void *val = load_cattr_value (image, t, p, boundp, end, error);
if (!is_ok (error)) {
if (is_ref)
g_free (val);
return ainfo;
}
+static void
+set_custom_attr_fmt_error (MonoError *error)
+{
+ error_init (error);
+ mono_error_set_generic_error (error, "System.Reflection", "CustomAttributeFormatException", "Binary format of the specified custom attribute was invalid.");
+}
+
+/**
+ * bcheck_blob:
+ * \param ptr a pointer into a blob
+ * \param bump how far we plan on reading past \p ptr.
+ * \param endp upper bound for \p ptr - one past the last valid value for \p ptr.
+ * \param error set on error
+ *
+ * Check that ptr+bump is below endp. Returns TRUE on success, or FALSE on
+ * failure and sets \p error.
+ */
+static gboolean
+bcheck_blob (const char *ptr, int bump, const char *endp, MonoError *error)
+{
+ error_init (error);
+ if (ADDP_IS_GREATER_OR_OVF (ptr, bump, endp - 1)) {
+ set_custom_attr_fmt_error (error);
+ return FALSE;
+ } else
+ return TRUE;
+}
+
+/**
+ * decode_blob_size_checked:
+ * \param ptr a pointer into a blob
+ * \param endp upper bound for \p ptr - one pas the last valid value for \p ptr
+ * \param size_out on success set to the decoded size
+ * \param retp on success set to the next byte after the encoded size
+ * \param error set on error
+ *
+ * Decode an encoded size value which takes 1, 2, or 4 bytes and set \p
+ * size_out to the decoded size and \p retp to the next byte after the encoded
+ * size. Returns TRUE on success, or FALASE on failure and sets \p error.
+ */
+static gboolean
+decode_blob_size_checked (const char *ptr, const char *endp, guint32 *size_out, const char **retp, MonoError *error)
+{
+ error_init (error);
+ if (endp && !bcheck_blob (ptr, 0, endp, error))
+ goto leave;
+ if ((*ptr & 0x80) != 0) {
+ if ((*ptr & 0x40) == 0 && !bcheck_blob (ptr, 1, endp, error))
+ goto leave;
+ else if (!bcheck_blob (ptr, 3, endp, error))
+ goto leave;
+ }
+ *size_out = mono_metadata_decode_blob_size (ptr, retp);
+leave:
+ return is_ok (error);
+}
+
+/**
+ * decode_blob_value_checked:
+ * \param ptr a pointer into a blob
+ * \param endp upper bound for \p ptr - one pas the last valid value for \p ptr
+ * \param value_out on success set to the decoded value
+ * \param retp on success set to the next byte after the encoded size
+ * \param error set on error
+ *
+ * Decode an encoded uint32 value which takes 1, 2, or 4 bytes and set \p
+ * value_out to the decoded value and \p retp to the next byte after the
+ * encoded value. Returns TRUE on success, or FALASE on failure and sets \p
+ * error.
+ */
+static gboolean
+decode_blob_value_checked (const char *ptr, const char *endp, guint32 *value_out, const char **retp, MonoError *error)
+{
+ /* This similar to decode_blob_size_checked, above but delegates to
+ * mono_metadata_decode_value which is semantically different. */
+ error_init (error);
+ if (!bcheck_blob (ptr, 0, endp, error))
+ goto leave;
+ if ((*ptr & 0x80) != 0) {
+ if ((*ptr & 0x40) == 0 && !bcheck_blob (ptr, 1, endp, error))
+ goto leave;
+ else if (!bcheck_blob (ptr, 3, endp, error))
+ goto leave;
+ }
+ *value_out = mono_metadata_decode_value (ptr, retp);
+leave:
+ return is_ok (error);
+}
static MonoObject*
create_custom_attr (MonoImage *image, MonoMethod *method, const guchar *data, guint32 len, MonoError *error)
{
const char *p = (const char*)data;
+ const char *data_end = (const char*)data + len;
const char *named;
guint32 i, j, num_named;
MonoObject *attr;
mono_class_init (method->klass);
if (!mono_verifier_verify_cattr_content (image, method, data, len, NULL)) {
- mono_error_set_generic_error (error, "System.Reflection", "CustomAttributeFormatException", "Binary format of the specified custom attribute was invalid.");
+ set_custom_attr_fmt_error (error);
return NULL;
}
/* skip prolog */
p += 2;
for (i = 0; i < mono_method_signature (method)->param_count; ++i) {
- params [i] = load_cattr_value (image, mono_method_signature (method)->params [i], p, &p, error);
- if (!mono_error_ok (error))
+ params [i] = load_cattr_value (image, mono_method_signature (method)->params [i], p, data_end, &p, error);
+ if (!is_ok (error))
goto fail;
}
goto fail;
}
- num_named = read16 (named);
- named += 2;
+ if (named + 1 < data_end) {
+ num_named = read16 (named);
+ named += 2;
+ } else {
+ /* CoreCLR allows p == data + len */
+ if (named == data_end)
+ num_named = 0;
+ else {
+ set_custom_attr_fmt_error (error);
+ goto fail;
+ }
+ }
for (j = 0; j < num_named; j++) {
- gint name_len;
+ guint32 name_len;
char *name, named_type, data_type;
+ if (!bcheck_blob (named, 1, data_end, error))
+ goto fail;
named_type = *named++;
data_type = *named++; /* type of data */
- if (data_type == MONO_TYPE_SZARRAY)
+ if (data_type == MONO_TYPE_SZARRAY) {
+ if (!bcheck_blob (named, 0, data_end, error))
+ goto fail;
data_type = *named++;
+ }
if (data_type == MONO_TYPE_ENUM) {
- gint type_len;
+ guint32 type_len;
char *type_name;
- type_len = mono_metadata_decode_blob_size (named, &named);
+ if (!decode_blob_size_checked (named, data_end, &type_len, &named, error))
+ goto fail;
+ if (type_len > 0 && !bcheck_blob (named, type_len - 1, data_end, error))
+ goto fail;
type_name = (char *)g_malloc (type_len + 1);
memcpy (type_name, named, type_len);
type_name [type_len] = 0;
/* FIXME: lookup the type and check type consistency */
g_free (type_name);
}
- name_len = mono_metadata_decode_blob_size (named, &named);
+ if (!decode_blob_size_checked (named, data_end, &name_len, &named, error))
+ goto fail;
+ if (name_len > 0 && !bcheck_blob (named, name_len - 1, data_end, error))
+ goto fail;
name = (char *)g_malloc (name_len + 1);
memcpy (name, named, name_len);
name [name_len] = 0;
goto fail;
}
- val = load_cattr_value (image, field->type, named, &named, error);
- if (!mono_error_ok (error)) {
+ val = load_cattr_value (image, field->type, named, data_end, &named, error);
+ if (!is_ok (error)) {
g_free (name);
if (!type_is_reference (field->type))
g_free (val);
prop_type = prop->get? mono_method_signature (prop->get)->ret :
mono_method_signature (prop->set)->params [mono_method_signature (prop->set)->param_count - 1];
- pparams [0] = load_cattr_value (image, prop_type, named, &named, error);
- if (!mono_error_ok (error)) {
+ pparams [0] = load_cattr_value (image, prop_type, named, data_end, &named, error);
+ if (!is_ok (error)) {
g_free (name);
if (!type_is_reference (prop_type))
g_free (pparams [0]);
MonoClass *attrklass;
MonoDomain *domain;
const char *p = (const char*)data;
+ const char *data_end = p + len;
const char *named;
guint32 i, j, num_named;
CattrNamedArg *arginfo = NULL;
if (len < 2 || read16 (p) != 0x0001) /* Prolog */
return;
+ /* skip prolog */
+ p += 2;
+ /* Parse each argument corresponding to the signature's parameters from
+ * the blob and store in typedargs.
+ */
typedargs = mono_array_new_checked (domain, mono_get_object_class (), mono_method_signature (method)->param_count, error);
return_if_nok (error);
- /* skip prolog */
- p += 2;
for (i = 0; i < mono_method_signature (method)->param_count; ++i) {
MonoObject *obj;
- obj = load_cattr_value_boxed (domain, image, mono_method_signature (method)->params [i], p, &p, error);
+ obj = load_cattr_value_boxed (domain, image, mono_method_signature (method)->params [i], p, data_end, &p, error);
return_if_nok (error);
mono_array_setref (typedargs, i, obj);
}
named = p;
+
+ /* Parse mandatory count of named arguments (could be zero) */
+ if (!bcheck_blob (named, 1, data_end, error))
+ return;
num_named = read16 (named);
namedargs = mono_array_new_checked (domain, mono_get_object_class (), num_named, error);
return_if_nok (error);
arginfo = g_new0 (CattrNamedArg, num_named);
*named_arg_info = arginfo;
+ /* Parse each named arg, and add to arginfo. Each named argument could
+ * be a field name or a property name followed by a value. */
for (j = 0; j < num_named; j++) {
- gint name_len;
+ guint32 name_len;
char *name, named_type, data_type;
- named_type = *named++;
+ if (!bcheck_blob (named, 1, data_end, error))
+ return;
+ named_type = *named++; /* field or property? */
data_type = *named++; /* type of data */
- if (data_type == MONO_TYPE_SZARRAY)
+ if (data_type == MONO_TYPE_SZARRAY) {
+ if (!bcheck_blob (named, 0, data_end, error))
+ return;
data_type = *named++;
+ }
if (data_type == MONO_TYPE_ENUM) {
- gint type_len;
+ guint32 type_len;
char *type_name;
- type_len = mono_metadata_decode_blob_size (named, &named);
+ if (!decode_blob_size_checked (named, data_end, &type_len, &named, error))
+ return;
if (ADDP_IS_GREATER_OR_OVF ((const guchar*)named, type_len, data + len))
goto fail;
/* FIXME: lookup the type and check type consistency */
g_free (type_name);
}
- name_len = mono_metadata_decode_blob_size (named, &named);
+ /* named argument name: length, then name */
+ if (!decode_blob_size_checked(named, data_end, &name_len, &named, error))
+ return;
if (ADDP_IS_GREATER_OR_OVF ((const guchar*)named, name_len, data + len))
goto fail;
name = (char *)g_malloc (name_len + 1);
name [name_len] = 0;
named += name_len;
if (named_type == 0x53) {
+ /* Named arg is a field. */
MonoObject *obj;
MonoClassField *field = mono_class_get_field_from_name (attrklass, name);
arginfo [j].type = field->type;
arginfo [j].field = field;
- obj = load_cattr_value_boxed (domain, image, field->type, named, &named, error);
+ obj = load_cattr_value_boxed (domain, image, field->type, named, data_end, &named, error);
if (!is_ok (error)) {
g_free (name);
return;
mono_array_setref (namedargs, j, obj);
} else if (named_type == 0x54) {
+ /* Named arg is a property */
MonoObject *obj;
MonoType *prop_type;
MonoProperty *prop = mono_class_get_property_from_name (attrklass, name);
arginfo [j].type = prop_type;
arginfo [j].prop = prop;
- obj = load_cattr_value_boxed (domain, image, prop_type, named, &named, error);
+ obj = load_cattr_value_boxed (domain, image, prop_type, named, data_end, &named, error);
if (!is_ok (error)) {
g_free (name);
return;
MonoReflectionAssemblyBuilderHandle assemblyb = MONO_HANDLE_CAST (MonoReflectionAssemblyBuilder, obj);
MonoReflectionAssemblyHandle assembly = MONO_HANDLE_CAST (MonoReflectionAssembly, assemblyb);
MonoArrayHandle cattrs = MONO_HANDLE_NEW_GET (MonoArray, assemblyb, cattrs);
- cinfo = mono_custom_attrs_from_builders_handle (NULL, MONO_HANDLE_GETVAL (assembly, assembly)->image, cattrs);
+ MonoImage * image = MONO_HANDLE_GETVAL (assembly, assembly)->image;
+ g_assert (image);
+ cinfo = mono_custom_attrs_from_builders_handle (NULL, image, cattrs);
} else if (strcmp ("TypeBuilder", klass->name) == 0) {
MonoReflectionTypeBuilderHandle tb = MONO_HANDLE_CAST (MonoReflectionTypeBuilder, obj);
MonoReflectionModuleBuilderHandle module = MONO_HANDLE_NEW_GET (MonoReflectionModuleBuilder, tb, module);
}
mono_appdomains_unlock ();
-#ifdef HAVE_BOEHM_GC
- domain = (MonoDomain *)mono_gc_alloc_fixed (sizeof (MonoDomain), MONO_GC_DESCRIPTOR_NULL, MONO_ROOT_SOURCE_DOMAIN, "domain object");
-#else
- domain = (MonoDomain *)mono_gc_alloc_fixed (sizeof (MonoDomain), domain_gc_desc, MONO_ROOT_SOURCE_DOMAIN, "domain object");
- mono_gc_register_root ((char*)&(domain->MONO_DOMAIN_FIRST_GC_TRACKED), G_STRUCT_OFFSET (MonoDomain, MONO_DOMAIN_LAST_GC_TRACKED) - G_STRUCT_OFFSET (MonoDomain, MONO_DOMAIN_FIRST_GC_TRACKED), MONO_GC_DESCRIPTOR_NULL, MONO_ROOT_SOURCE_DOMAIN, "misc domain fields");
-#endif
+ if (!mono_gc_is_moving ()) {
+ domain = (MonoDomain *)mono_gc_alloc_fixed (sizeof (MonoDomain), MONO_GC_DESCRIPTOR_NULL, MONO_ROOT_SOURCE_DOMAIN, "domain object");
+ } else {
+ domain = (MonoDomain *)mono_gc_alloc_fixed (sizeof (MonoDomain), domain_gc_desc, MONO_ROOT_SOURCE_DOMAIN, "domain object");
+ mono_gc_register_root ((char*)&(domain->MONO_DOMAIN_FIRST_GC_TRACKED), G_STRUCT_OFFSET (MonoDomain, MONO_DOMAIN_LAST_GC_TRACKED) - G_STRUCT_OFFSET (MonoDomain, MONO_DOMAIN_FIRST_GC_TRACKED), MONO_GC_DESCRIPTOR_NULL, MONO_ROOT_SOURCE_DOMAIN, "misc domain fields");
+ }
domain->shadow_serial = shadow_serial;
domain->domain = NULL;
domain->setup = NULL;
domain->setup = NULL;
-#ifndef HAVE_BOEHM_GC
- mono_gc_deregister_root ((char*)&(domain->MONO_DOMAIN_FIRST_GC_TRACKED));
-#endif
+ if (mono_gc_is_moving ())
+ mono_gc_deregister_root ((char*)&(domain->MONO_DOMAIN_FIRST_GC_TRACKED));
mono_appdomains_lock ();
appdomains_list [domain->domain_id] = NULL;
mono_appdomains_unlock ();
- /* FIXME: anything else required ? */
-
mono_gc_free_fixed (domain);
#ifndef DISABLE_PERFCOUNTERS
} MonoILT;
+typedef enum {
+ MONO_DYN_IMAGE_TOK_NEW, /* assert if same token is registered already */
+ MONO_DYN_IMAGE_TOK_SAME_OK, /* allow collision only with the same object */
+ MONO_DYN_IMAGE_TOK_REPLACE, /* keep the new object, always */
+} MonoDynamicImageTokCollision;
+
void
mono_dynamic_images_init (void);
void
-mono_dynamic_image_register_token (MonoDynamicImage *assembly, guint32 token, MonoObjectHandle obj);
+mono_dynamic_image_register_token (MonoDynamicImage *assembly, guint32 token, MonoObjectHandle obj, int tok_collision);
gboolean
mono_dynamic_image_is_valid_token (MonoDynamicImage *image, guint32 token);
* the Module.ResolveXXXToken () methods to work.
*/
void
-mono_dynamic_image_register_token (MonoDynamicImage *assembly, guint32 token, MonoObjectHandle obj)
+mono_dynamic_image_register_token (MonoDynamicImage *assembly, guint32 token, MonoObjectHandle obj, int how_collide)
{
MONO_REQ_GC_UNSAFE_MODE;
+ g_assert (!MONO_HANDLE_IS_NULL (obj));
+ g_assert (strcmp (mono_handle_class (obj)->name, "EnumBuilder"));
dynamic_image_lock (assembly);
+ MonoObject *prev = (MonoObject *)mono_g_hash_table_lookup (assembly->tokens, GUINT_TO_POINTER (token));
+ if (prev) {
+ switch (how_collide) {
+ case MONO_DYN_IMAGE_TOK_NEW:
+ g_assert_not_reached ();
+ case MONO_DYN_IMAGE_TOK_SAME_OK:
+ g_assert (prev == MONO_HANDLE_RAW (obj));
+ break;
+ case MONO_DYN_IMAGE_TOK_REPLACE:
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+ }
mono_g_hash_table_insert (assembly->tokens, GUINT_TO_POINTER (token), MONO_HANDLE_RAW (obj));
dynamic_image_unlock (assembly);
}
#else
void
-mono_dynamic_image_register_token (MonoDynamicImage *assembly, guint32 token, MonoObjectHandle obj)
+mono_dynamic_image_register_token (MonoDynamicImage *assembly, guint32 token, MonoObjectHandle obj, int how_collide)
{
}
#endif
--- /dev/null
+
+#include "fdhandle.h"
+#include "utils/mono-lazy-init.h"
+#include "utils/mono-coop-mutex.h"
+
+static GHashTable *fds;
+static MonoCoopMutex fds_mutex;
+static MonoFDHandleCallback fds_callback[MONO_FDTYPE_COUNT];
+static mono_lazy_init_t fds_init = MONO_LAZY_INIT_STATUS_NOT_INITIALIZED;
+
+static const gchar *types_str[] = {
+ "File",
+ "Console",
+ "Pipe",
+ "Socket",
+ NULL
+};
+
+static void
+fds_remove (gpointer data)
+{
+ MonoFDHandle* fdhandle;
+
+ fdhandle = (MonoFDHandle*) data;
+ g_assert (fdhandle);
+
+ g_assert (fds_callback [fdhandle->type].close);
+ fds_callback [fdhandle->type].close (fdhandle);
+
+ mono_refcount_dec (fdhandle);
+}
+
+static void
+initialize (void)
+{
+ fds = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, fds_remove);
+ mono_coop_mutex_init (&fds_mutex);
+}
+
+void
+mono_fdhandle_register (MonoFDType type, MonoFDHandleCallback *callback)
+{
+ mono_lazy_initialize (&fds_init, initialize);
+ memcpy (&fds_callback [type], callback, sizeof (MonoFDHandleCallback));
+}
+
+static void
+fdhandle_destroy (gpointer data)
+{
+ MonoFDHandle* fdhandle;
+
+ fdhandle = (MonoFDHandle*) data;
+ g_assert (fdhandle);
+
+ g_assert (fds_callback [fdhandle->type].destroy);
+ fds_callback [fdhandle->type].destroy (fdhandle);
+}
+
+void
+mono_fdhandle_init (MonoFDHandle *fdhandle, MonoFDType type, gint fd)
+{
+ mono_refcount_init (fdhandle, fdhandle_destroy);
+ fdhandle->type = type;
+ fdhandle->fd = fd;
+}
+
+void
+mono_fdhandle_insert (MonoFDHandle *fdhandle)
+{
+ mono_coop_mutex_lock (&fds_mutex);
+
+ if (g_hash_table_lookup_extended (fds, GINT_TO_POINTER(fdhandle->fd), NULL, NULL))
+ g_error("%s: duplicate %s fd %d", __func__, types_str [fdhandle->type], fdhandle->fd);
+
+ g_hash_table_insert (fds, GINT_TO_POINTER(fdhandle->fd), fdhandle);
+
+ mono_coop_mutex_unlock (&fds_mutex);
+}
+
+gboolean
+mono_fdhandle_try_insert (MonoFDHandle *fdhandle)
+{
+ mono_coop_mutex_lock (&fds_mutex);
+
+ if (g_hash_table_lookup_extended (fds, GINT_TO_POINTER(fdhandle->fd), NULL, NULL)) {
+ /* we raced between 2 invocations of mono_fdhandle_try_insert */
+ mono_coop_mutex_unlock (&fds_mutex);
+
+ return FALSE;
+ }
+
+ g_hash_table_insert (fds, GINT_TO_POINTER(fdhandle->fd), fdhandle);
+
+ mono_coop_mutex_unlock (&fds_mutex);
+
+ return TRUE;
+}
+
+gboolean
+mono_fdhandle_lookup_and_ref (gint fd, MonoFDHandle **fdhandle)
+{
+ mono_coop_mutex_lock (&fds_mutex);
+
+ if (!g_hash_table_lookup_extended (fds, GINT_TO_POINTER(fd), NULL, (gpointer*) fdhandle)) {
+ mono_coop_mutex_unlock (&fds_mutex);
+ return FALSE;
+ }
+
+ mono_refcount_inc (*fdhandle);
+
+ mono_coop_mutex_unlock (&fds_mutex);
+
+ return TRUE;
+}
+
+void
+mono_fdhandle_unref (MonoFDHandle *fdhandle)
+{
+ mono_refcount_dec (fdhandle);
+}
+
+gboolean
+mono_fdhandle_close (gint fd)
+{
+ MonoFDHandle *fdhandle;
+ gboolean removed;
+
+ mono_coop_mutex_lock (&fds_mutex);
+
+ if (!g_hash_table_lookup_extended (fds, GINT_TO_POINTER(fd), NULL, (gpointer*) &fdhandle)) {
+ mono_coop_mutex_unlock (&fds_mutex);
+
+ return FALSE;
+ }
+
+ removed = g_hash_table_remove (fds, GINT_TO_POINTER(fdhandle->fd));
+ g_assert (removed);
+
+ mono_coop_mutex_unlock (&fds_mutex);
+
+ return TRUE;
+}
--- /dev/null
+
+#ifndef __MONO_METADATA_FDHANDLE_H__
+#define __MONO_METADATA_FDHANDLE_H__
+
+#include <config.h>
+#include <glib.h>
+
+#include "utils/refcount.h"
+
+typedef enum {
+ MONO_FDTYPE_FILE,
+ MONO_FDTYPE_CONSOLE,
+ MONO_FDTYPE_PIPE,
+ MONO_FDTYPE_SOCKET,
+ MONO_FDTYPE_COUNT
+} MonoFDType;
+
+typedef struct {
+ MonoRefCount ref;
+ MonoFDType type;
+ gint fd;
+} MonoFDHandle;
+
+typedef struct {
+ void (*close) (MonoFDHandle *fdhandle);
+ void (*destroy) (MonoFDHandle *fdhandle);
+} MonoFDHandleCallback;
+
+void
+mono_fdhandle_register (MonoFDType type, MonoFDHandleCallback *callback);
+
+void
+mono_fdhandle_init (MonoFDHandle *fdhandle, MonoFDType type, gint fd);
+
+void
+mono_fdhandle_insert (MonoFDHandle *fdhandle);
+
+gboolean
+mono_fdhandle_try_insert (MonoFDHandle *fdhandle);
+
+gboolean
+mono_fdhandle_lookup_and_ref (gint fd, MonoFDHandle **fdhandle);
+
+void
+mono_fdhandle_unref (MonoFDHandle *fdhandle);
+
+gboolean
+mono_fdhandle_close (gint fd);
+
+#endif /* __MONO_METADATA_FDHANDLE_H__ */
HANDLES(ICALL(SOCK_4, "Blocking_internal(intptr,bool,int&)", ves_icall_System_Net_Sockets_Socket_Blocking_internal))
HANDLES(ICALL(SOCK_5, "Close_internal(intptr,int&)", ves_icall_System_Net_Sockets_Socket_Close_internal))
HANDLES(ICALL(SOCK_6, "Connect_internal(intptr,System.Net.SocketAddress,int&,bool)", ves_icall_System_Net_Sockets_Socket_Connect_internal))
-HANDLES(ICALL (SOCK_6a, "Disconnect_internal(intptr,bool,int&)", ves_icall_System_Net_Sockets_Socket_Disconnect_internal))
+HANDLES(ICALL(SOCK_6a, "Disconnect_internal(intptr,bool,int&)", ves_icall_System_Net_Sockets_Socket_Disconnect_internal))
+HANDLES(ICALL(SOCK_6b, "Duplicate_internal", ves_icall_System_Net_Sockets_Socket_Duplicate_internal))
HANDLES(ICALL(SOCK_7, "GetSocketOption_arr_internal(intptr,System.Net.Sockets.SocketOptionLevel,System.Net.Sockets.SocketOptionName,byte[]&,int&)", ves_icall_System_Net_Sockets_Socket_GetSocketOption_arr_internal))
HANDLES(ICALL(SOCK_8, "GetSocketOption_obj_internal(intptr,System.Net.Sockets.SocketOptionLevel,System.Net.Sockets.SocketOptionName,object&,int&)", ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal))
HANDLES(ICALL(SOCK_21, "IOControl_internal(intptr,int,byte[],byte[],int&)", ves_icall_System_Net_Sockets_Socket_IOControl_internal))
{
error_init (error);
- *cil_method = mono_get_method_from_token (image, token, NULL, context, NULL, error);
+ *cil_method = mono_get_method_checked (image, token, NULL, context, error);
if (!*cil_method)
return NULL;
int i = 0;
MonoClass *klass;
+ MonoError error;
#endif
if (!array)
return NULL;
#ifndef DISABLE_COM
-
+ error_init (&error);
klass = array->obj.vtable->klass;
switch (klass->element_class->byval_arg.type) {
break;
case MONO_TYPE_CLASS:
nativeArraySize = array->max_length;
- nativeArray = (void **)malloc(sizeof(gpointer) * nativeArraySize);
- for(i = 0; i < nativeArraySize; ++i)
- nativeArray[i] = ves_icall_System_Runtime_InteropServices_Marshal_GetIUnknownForObjectInternal(((MonoObject **)array->vector)[i]);
+ nativeArray = (void **)g_malloc (sizeof(gpointer) * nativeArraySize);
+ for(i = 0; i < nativeArraySize; ++i) {
+ nativeArray[i] = mono_cominterop_get_com_interface (((MonoObject **)array->vector)[i], klass->element_class, &error);
+ if (mono_error_set_pending_exception (&error))
+ break;
+ }
return nativeArray;
case MONO_TYPE_U1:
case MONO_TYPE_BOOLEAN:
{
#ifndef DISABLE_COM
MonoClass *klass;
- int i = 0;
if (!array)
return;
return;
klass = array->obj.vtable->klass;
- if (klass->element_class->byval_arg.type == MONO_TYPE_CLASS) {
- for(i = 0; i < array->max_length; ++i)
- mono_marshal_free_ccw (mono_array_get (array, MonoObject*, i));
+ if (klass->element_class->byval_arg.type == MONO_TYPE_CLASS)
g_free (nativeArray);
- }
#endif
}
layout = mono_class_get_flags (klass) & TYPE_ATTRIBUTE_LAYOUT_MASK;
- /* The mempool is protected by the loader lock */
info = (MonoMarshalType *)mono_image_alloc0 (klass->image, MONO_SIZEOF_MARSHAL_TYPE + sizeof (MonoMarshalField) * count);
info->num_fields = count;
info->min_align = min_align;
/* Update the class's blittable info, if the layouts don't match */
- if (info->native_size != mono_class_value_size (klass, NULL))
+ if (info->native_size != mono_class_value_size (klass, NULL)) {
+ mono_loader_lock ();
klass->blittable = FALSE;
+ mono_loader_unlock ();
+ }
/* If this is an array type, ensure that we have element info */
if (klass->rank && !mono_marshal_is_loading_type_info (klass->element_class)) {
#include "mempool.h"
#include "mempool-internals.h"
+#include "utils/mono-compiler.h"
/*
* MonoMemPool is for fast allocation of memory. We free
/**
* mono_mempool_new_size:
+ *
+ * clang's ThreadSanitizer detects races of total_bytes_allocated and pool->d.allocated throughout the functions
+ * * mono_mempool_alloc
+ * * mono_mempool_new_size
+ * * mono_mempool_destroy
+ * while these races could lead to wrong values, total_bytes_allocated is just used for debugging / reporting and since
+ * the mempool.c functions are called quite often, a discussion led the the conclusion of ignoring these races:
+ * https://bugzilla.xamarin.com/show_bug.cgi?id=57936
+ *
* \param initial_size the amount of memory to initially reserve for the memory pool.
* \returns a new memory pool with a specific initial memory reservation.
*/
+MONO_NO_SANITIZE_THREAD
MonoMemPool *
mono_mempool_new_size (int initial_size)
{
/**
* mono_mempool_destroy:
+ *
+ * clang's ThreadSanitizer detects races of total_bytes_allocated and pool->d.allocated throughout the functions
+ * * mono_mempool_alloc
+ * * mono_mempool_new_size
+ * * mono_mempool_destroy
+ * while these races could lead to wrong values, total_bytes_allocated is just used for debugging / reporting and since
+ * the mempool.c functions are called quite often, a discussion led the the conclusion of ignoring these races:
+ * https://bugzilla.xamarin.com/show_bug.cgi?id=57936
+ *
* \param pool the memory pool to destroy
*
* Free all memory associated with this pool.
*/
+MONO_NO_SANITIZE_THREAD
void
mono_mempool_destroy (MonoMemPool *pool)
{
/**
* mono_mempool_alloc:
+ *
+ * clang's ThreadSanitizer detects races of total_bytes_allocated and pool->d.allocated throughout the functions
+ * * mono_mempool_alloc
+ * * mono_mempool_new_size
+ * * mono_mempool_destroy
+ * while these races could lead to wrong values, total_bytes_allocated is just used for debugging / reporting and since
+ * the mempool.c functions are called quite often, a discussion led the the conclusion of ignoring these races:
+ * https://bugzilla.xamarin.com/show_bug.cgi?id=57936
+ *
* \param pool the memory pool to use
* \param size size of the memory block
*
*
* \returns the address of a newly allocated memory block.
*/
+MONO_NO_SANITIZE_THREAD
gpointer
mono_mempool_alloc (MonoMemPool *pool, guint size)
{
#include <mono/metadata/class-internals.h>
#include <mono/metadata/object-internals.h>
+#include <mono/metadata/profiler-private.h>
#include <mono/metadata/monitor.h>
#include <mono/metadata/handle.h>
#ifdef HAVE_SGEN_GC
break;
/*
- * CustomAttributeType: TypeDef, TypeRef, MethodDef,
- * MemberRef and String.
+ * CustomAttributeType: MethodDef, MemberRef.
*/
case MONO_MT_CAT_IDX:
- /* String is a heap, if it is wide, we know the size */
- /* See above, nope.
- if (meta->idx_string_wide){
- field_size = 4;
- break;
- }*/
-
- n = MAX (get_nrows (meta, MONO_TABLE_TYPEREF),
- get_nrows (meta, MONO_TABLE_TYPEDEF));
- n = MAX (n, get_nrows (meta, MONO_TABLE_METHOD));
- n = MAX (n, get_nrows (meta, MONO_TABLE_MEMBERREF));
+ n = MAX (get_nrows (meta, MONO_TABLE_METHOD),
+ get_nrows (meta, MONO_TABLE_MEMBERREF));
/* 3 bits to encode */
field_size = rtsize (meta, n, 16-3);
* \param ptr pointer to a blob object
* \param rptr the new position of the pointer
*
- * This decodes a compressed size as described by 23.1.4 (a blob or user string object)
+ * This decodes a compressed size as described by 24.2.4 (#US and #Blob a blob or user string object)
*
* \returns the size of the blob object
*/
#define NBUILTIN_TYPES() (sizeof (builtin_types) / sizeof (builtin_types [0]))
static GHashTable *type_cache = NULL;
-static int next_generic_inst_id = 0;
+static gint32 next_generic_inst_id = 0;
/* Protected by image_sets_mutex */
static MonoImageSet *mscorlib_image_set;
int size = MONO_SIZEOF_GENERIC_INST + type_argc * sizeof (MonoType *);
ginst = (MonoGenericInst *)mono_image_set_alloc0 (set, size);
#ifndef MONO_SMALL_CONFIG
- ginst->id = ++next_generic_inst_id;
+ ginst->id = InterlockedIncrement (&next_generic_inst_id);
#endif
ginst->is_open = is_open;
ginst->type_argc = type_argc;
monolist_item_vtable = mono_class_vtable (mono_get_root_domain (), klass);
g_assert (monolist_item_vtable);
}
- res = (MonoMList*)mono_object_new_fast_checked (monolist_item_vtable, error);
+ res = (MonoMList*)mono_object_new_specific_checked (monolist_item_vtable, error);
return_val_if_nok (error, NULL);
MONO_OBJECT_SETREF (res, data, data);
return res;
gboolean
mono_delegate_ctor (MonoObjectHandle this_obj, MonoObjectHandle target, gpointer addr, MonoError *error);
-void*
-mono_class_get_allocation_ftn (MonoVTable *vtable, gboolean for_box, gboolean *pass_size_in_words);
-
void
mono_runtime_free_method (MonoDomain *domain, MonoMethod *method);
MonoObject*
mono_object_new_fast_checked (MonoVTable *vtable, MonoError *error);
-MonoObject *
-ves_icall_object_new_fast (MonoVTable *vtable);
-
MonoObject *
mono_object_clone_checked (MonoObject *obj, MonoError *error);
DECL_OFFSET(MonoThreadsSync, status)
DECL_OFFSET(MonoThreadsSync, nest)
+DECL_OFFSET(MonoProfilerCallContext, method)
+DECL_OFFSET(MonoProfilerCallContext, return_value)
+
#ifdef HAVE_SGEN_GC
DECL_OFFSET(SgenClientThreadInfo, in_critical_region)
DECL_OFFSET(SgenThreadInfo, tlab_next)
DECL_OFFSET(MonoJitTlsData, lmf)
DECL_OFFSET(MonoJitTlsData, class_cast_from)
DECL_OFFSET(MonoJitTlsData, class_cast_to)
-DECL_OFFSET(MonoJitTlsData, handler_block_return_address)
DECL_OFFSET(MonoJitTlsData, restore_stack_prot)
DECL_OFFSET(MonoGSharedVtMethodRuntimeInfo, locals_size)
type_initialization_hash = g_hash_table_new (NULL, NULL);
blocked_thread_hash = g_hash_table_new (NULL, NULL);
mono_os_mutex_init_recursive (&ldstr_section);
+ mono_register_jit_icall (ves_icall_string_alloc, "ves_icall_string_alloc", mono_create_icall_signature ("object int"), FALSE);
}
void
size = max_size;
}
-#ifdef HAVE_SGEN_GC
- /*An Ephemeron cannot be marked by sgen*/
- if (!static_fields && klass->image == mono_defaults.corlib && !strcmp ("Ephemeron", klass->name)) {
+ /* An Ephemeron cannot be marked by sgen */
+ if (mono_gc_is_moving () && !static_fields && klass->image == mono_defaults.corlib && !strcmp ("Ephemeron", klass->name)) {
*max_set = 0;
memset (bitmap, 0, size / 8);
return bitmap;
}
-#endif
for (p = klass; p != NULL; p = p->parent) {
gpointer iter = NULL;
int max_set = 0;
gsize *bitmap;
gsize default_bitmap [4] = {0};
- static gboolean gcj_inited = FALSE;
MonoGCDescriptor gc_descr;
- if (!gcj_inited) {
- mono_loader_lock ();
-
- mono_register_jit_icall (ves_icall_object_new_fast, "ves_icall_object_new_fast", mono_create_icall_signature ("object ptr"), FALSE);
- mono_register_jit_icall (ves_icall_string_alloc, "ves_icall_string_alloc", mono_create_icall_signature ("object int"), FALSE);
-
- gcj_inited = TRUE;
- mono_loader_unlock ();
- }
-
if (!klass->inited)
mono_class_init (klass);
vt->domain = domain;
mono_class_compute_gc_descriptor (klass);
- /*
- * We can't use typed allocation in the non-root domains, since the
- * collector needs the GC descriptor stored in the vtable even after
- * the mempool containing the vtable is destroyed when the domain is
- * unloaded. An alternative might be to allocate vtables in the GC
- * heap, but this does not seem to work (it leads to crashes inside
- * libgc). If that approach is tried, two gc descriptors need to be
- * allocated for each class: one for the root domain, and one for all
- * other domains. The second descriptor should contain a bit for the
- * vtable field in MonoObject, since we can no longer assume the
- * vtable is reachable by other roots after the appdomain is unloaded.
- */
-#ifdef HAVE_BOEHM_GC
- if (domain != mono_get_root_domain () && !mono_dont_free_domains)
+ /*
+ * For Boehm:
+ * We can't use typed allocation in the non-root domains, since the
+ * collector needs the GC descriptor stored in the vtable even after
+ * the mempool containing the vtable is destroyed when the domain is
+ * unloaded. An alternative might be to allocate vtables in the GC
+ * heap, but this does not seem to work (it leads to crashes inside
+ * libgc). If that approach is tried, two gc descriptors need to be
+ * allocated for each class: one for the root domain, and one for all
+ * other domains. The second descriptor should contain a bit for the
+ * vtable field in MonoObject, since we can no longer assume the
+ * vtable is reachable by other roots after the appdomain is unloaded.
+ */
+ if (!mono_gc_is_moving () && domain != mono_get_root_domain () && !mono_dont_free_domains)
vt->gc_descr = MONO_GC_DESCRIPTOR_NULL;
else
-#endif
vt->gc_descr = klass->gc_descr;
gc_bits = mono_gc_get_vtable_bits (klass);
return o;
}
-MonoObject *
-ves_icall_object_new_fast (MonoVTable *vtable)
-{
- MonoError error;
- MonoObject *o = mono_object_new_fast_checked (vtable, &error);
- mono_error_set_pending_exception (&error);
-
- return o;
-}
-
MonoObject*
mono_object_new_mature (MonoVTable *vtable, MonoError *error)
{
return o;
}
-/**
- * mono_class_get_allocation_ftn:
- * \param vtable vtable
- * \param for_box the object will be used for boxing
- * \param pass_size_in_words Unused
- * \returns the allocation function appropriate for the given class.
- */
-void*
-mono_class_get_allocation_ftn (MonoVTable *vtable, gboolean for_box, gboolean *pass_size_in_words)
-{
- MONO_REQ_GC_NEUTRAL_MODE;
-
- *pass_size_in_words = FALSE;
-
- if (mono_class_has_finalizer (vtable->klass) || mono_class_is_marshalbyref (vtable->klass))
- return ves_icall_object_new_specific;
-
- if (vtable->gc_descr != MONO_GC_DESCRIPTOR_NULL) {
-
- return ves_icall_object_new_fast;
-
- /*
- * FIXME: This is actually slower than ves_icall_object_new_fast, because
- * of the overhead of parameter passing.
- */
- /*
- *pass_size_in_words = TRUE;
-#ifdef GC_REDIRECT_TO_LOCAL
- return GC_local_gcj_fast_malloc;
-#else
- return GC_gcj_fast_malloc;
-#endif
- */
- }
-
- return ves_icall_object_new_specific;
-}
-
/**
* mono_object_new_from_token:
* \param image Context where the type_token is hosted
static void
array_full_copy_unchecked_size (MonoArray *src, MonoArray *dest, MonoClass *klass, uintptr_t size)
{
-#ifdef HAVE_SGEN_GC
- if (klass->element_class->valuetype) {
- if (klass->element_class->has_references)
- mono_value_copy_array (dest, 0, mono_array_addr_with_size_fast (src, 0, 0), mono_array_length (src));
- else
- mono_gc_memmove_atomic (&dest->vector, &src->vector, size);
+ if (mono_gc_is_moving ()) {
+ if (klass->element_class->valuetype) {
+ if (klass->element_class->has_references)
+ mono_value_copy_array (dest, 0, mono_array_addr_with_size_fast (src, 0, 0), mono_array_length (src));
+ else
+ mono_gc_memmove_atomic (&dest->vector, &src->vector, size);
+ } else {
+ mono_array_memcpy_refs (dest, 0, src, 0, mono_array_length (src));
+ }
} else {
- mono_array_memcpy_refs (dest, 0, src, 0, mono_array_length (src));
+ mono_gc_memmove_atomic (&dest->vector, &src->vector, size);
}
-#else
- mono_gc_memmove_atomic (&dest->vector, &src->vector, size);
-#endif
}
/**
size = size - sizeof (MonoObject);
-#ifdef HAVE_SGEN_GC
- g_assert (size == mono_class_value_size (klass, NULL));
- mono_gc_wbarrier_value_copy ((char *)res + sizeof (MonoObject), value, 1, klass);
-#else
+ if (mono_gc_is_moving ()) {
+ g_assert (size == mono_class_value_size (klass, NULL));
+ mono_gc_wbarrier_value_copy ((char *)res + sizeof (MonoObject), value, 1, klass);
+ } else {
#if NO_UNALIGNED_ACCESS
- mono_gc_memmove_atomic ((char *)res + sizeof (MonoObject), value, size);
-#else
- switch (size) {
- case 1:
- *((guint8 *) res + sizeof (MonoObject)) = *(guint8 *) value;
- break;
- case 2:
- *(guint16 *)((guint8 *) res + sizeof (MonoObject)) = *(guint16 *) value;
- break;
- case 4:
- *(guint32 *)((guint8 *) res + sizeof (MonoObject)) = *(guint32 *) value;
- break;
- case 8:
- *(guint64 *)((guint8 *) res + sizeof (MonoObject)) = *(guint64 *) value;
- break;
- default:
mono_gc_memmove_atomic ((char *)res + sizeof (MonoObject), value, size);
- }
-#endif
+#else
+ switch (size) {
+ case 1:
+ *((guint8 *) res + sizeof (MonoObject)) = *(guint8 *) value;
+ break;
+ case 2:
+ *(guint16 *)((guint8 *) res + sizeof (MonoObject)) = *(guint16 *) value;
+ break;
+ case 4:
+ *(guint32 *)((guint8 *) res + sizeof (MonoObject)) = *(guint32 *) value;
+ break;
+ case 8:
+ *(guint64 *)((guint8 *) res + sizeof (MonoObject)) = *(guint64 *) value;
+ break;
+ default:
+ mono_gc_memmove_atomic ((char *)res + sizeof (MonoObject), value, size);
+ }
#endif
+ }
if (klass->has_finalize) {
mono_object_register_finalizer (res);
return_val_if_nok (error, NULL);
MONO_PROFILER_EVENT_1(assembly_unloading, AssemblyLUnloading, MonoAssembly *, assembly)
MONO_PROFILER_EVENT_1(assembly_unloaded, AssemblyLUnloaded, MonoAssembly *, assembly)
-MONO_PROFILER_EVENT_1(method_enter, MethodEnter, MonoMethod *, method)
-MONO_PROFILER_EVENT_1(method_leave, MethodLeave, MonoMethod *, method)
+MONO_PROFILER_EVENT_2(method_enter, MethodEnter, MonoMethod *, method, MonoProfilerCallContext *, context)
+MONO_PROFILER_EVENT_2(method_leave, MethodLeave, MonoMethod *, method, MonoProfilerCallContext *, context)
+MONO_PROFILER_EVENT_2(method_tail_call, MethodTailCall, MonoMethod *, method, MonoMethod *, target)
MONO_PROFILER_EVENT_2(method_exception_leave, MethodExceptionLeave, MonoMethod *, method, MonoObject *, exception)
MONO_PROFILER_EVENT_1(method_free, MethodFree, MonoMethod *, method)
MONO_PROFILER_EVENT_1(method_begin_invoke, MethodBeginInvoke, MonoMethod *, method)
#ifndef __MONO_PROFILER_PRIVATE_H__
#define __MONO_PROFILER_PRIVATE_H__
+#include <mono/metadata/class-internals.h>
#define MONO_PROFILER_UNSTABLE_GC_ROOTS
#include <mono/metadata/profiler.h>
-#include <mono/utils/mono-lazy-init.h>
+#include <mono/utils/mono-context.h>
#include <mono/utils/mono-os-mutex.h>
#include <mono/utils/mono-os-semaphore.h>
struct _MonoProfilerDesc {
MonoProfilerHandle next;
MonoProfiler *prof;
+ volatile gpointer cleanup_callback;
volatile gpointer coverage_filter;
volatile gpointer call_instrumentation_filter;
typedef struct {
gboolean startup_done;
+
MonoProfilerHandle profilers;
- mono_lazy_init_t coverage_status;
+
+ gboolean code_coverage;
mono_mutex_t coverage_mutex;
GHashTable *coverage_hash;
+
MonoProfilerHandle sampling_owner;
MonoSemType sampling_semaphore;
MonoProfilerSampleMode sample_mode;
- uint64_t sample_freq;
+ guint32 sample_freq;
+
gboolean allocations;
+ gboolean call_contexts;
+ void (*context_enable) (void);
+ gpointer (*context_get_this) (MonoProfilerCallContext *);
+ gpointer (*context_get_argument) (MonoProfilerCallContext *, guint32);
+ gpointer (*context_get_local) (MonoProfilerCallContext *, guint32);
+ gpointer (*context_get_result) (MonoProfilerCallContext *);
+ void (*context_free_buffer) (gpointer);
+
#define _MONO_PROFILER_EVENT(name) \
volatile gint32 name ## _count;
#define MONO_PROFILER_EVENT_0(name, type) \
}
MonoProfilerCoverageInfo *mono_profiler_coverage_alloc (MonoMethod *method, guint32 entries);
-void mono_profiler_coverage_free (MonoMethod *method);
-gboolean mono_profiler_should_instrument_method (MonoMethod *method, gboolean entry);
+struct _MonoProfilerCallContext {
+ /*
+ * Must be the first field (the JIT relies on it). Only filled out if this
+ * is a JIT frame; otherwise, zeroed.
+ */
+ MonoContext context;
+ /*
+ * A non-NULL MonoInterpFrameHandle if this is an interpreter frame.
+ */
+ gpointer interp_frame;
+ MonoMethod *method;
+ /*
+ * Points to the return value for an epilogue context. For a prologue, this
+ * is set to NULL.
+ */
+ gpointer return_value;
+};
+
+MonoProfilerCallInstrumentationFlags mono_profiler_get_call_instrumentation_flags (MonoMethod *method);
gboolean mono_profiler_sampling_enabled (void);
-void mono_profiler_sampling_thread_sleep (void);
+void mono_profiler_sampling_thread_post (void);
+void mono_profiler_sampling_thread_wait (void);
static inline gboolean
mono_profiler_allocations_enabled (void)
}
#define _MONO_PROFILER_EVENT(name, ...) \
- void mono_profiler_raise_ ## name (__VA_ARGS__);
+ ICALL_DECL_EXPORT void mono_profiler_raise_ ## name (__VA_ARGS__);
#define MONO_PROFILER_EVENT_0(name, type) \
_MONO_PROFILER_EVENT(name, void)
#define MONO_PROFILER_EVENT_1(name, type, arg1_type, arg1_name) \
#include <mono/metadata/profiler-private.h>
#include <mono/utils/mono-dl.h>
#include <mono/utils/mono-error-internals.h>
+#include <mono/utils/mono-logger-internals.h>
MonoProfilerState mono_profiler_state;
#define NEW_INITIALIZER_NAME "mono_profiler_init"
static gboolean
-load_profiler (MonoDl *module, const char *desc, const char *suffix)
+load_profiler (MonoDl *module, const char *name, const char *desc)
{
if (!module)
return FALSE;
- char *old_name;
-
- if (suffix)
- old_name = g_strdup_printf (OLD_INITIALIZER_NAME "_%s", suffix);
- else
- old_name = g_strdup_printf (OLD_INITIALIZER_NAME);
-
+ char *err, *old_name = g_strdup_printf (OLD_INITIALIZER_NAME);
MonoProfilerInitializer func;
- char *err;
-
if (!(err = mono_dl_symbol (module, old_name, (gpointer) &func))) {
- g_warning ("Found old-style startup symbol %s; profiler has not been migrated to the new API.", old_name);
+ mono_profiler_printf_err ("Found old-style startup symbol '%s' for the '%s' profiler; it has not been migrated to the new API.", old_name, name);
g_free (old_name);
return FALSE;
}
g_free (err);
g_free (old_name);
- char *new_name;
-
- if (suffix)
- new_name = g_strdup_printf (NEW_INITIALIZER_NAME "_%s", suffix);
- else
- new_name = g_strdup_printf (NEW_INITIALIZER_NAME);
+ char *new_name = g_strdup_printf (NEW_INITIALIZER_NAME "_%s", name);
if ((err = mono_dl_symbol (module, new_name, (gpointer *) &func))) {
g_free (err);
}
static gboolean
-load_profiler_from_executable (const char *desc, const char *name)
+load_profiler_from_executable (const char *name, const char *desc)
{
char *err;
MonoDl *module = mono_dl_open (NULL, MONO_DL_EAGER, &err);
if (!module) {
- g_warning ("Could not open main executable (%s).", err);
+ mono_profiler_printf_err ("Could not open main executable: %s", err);
g_free (err);
return FALSE;
}
- return load_profiler (module, desc, name);
+ return load_profiler (module, name, desc);
}
static gboolean
-load_profiler_from_directory (const char *directory, const char *libname, const char *desc)
+load_profiler_from_directory (const char *directory, const char *libname, const char *name, const char *desc)
{
char* path;
void *iter = NULL;
g_free (path);
if (module)
- return load_profiler (module, desc, NULL);
+ return load_profiler (module, name, desc);
}
return FALSE;
}
static gboolean
-load_profiler_from_installation (const char *libname, const char *desc)
+load_profiler_from_installation (const char *libname, const char *name, const char *desc)
{
char *err;
MonoDl *module = mono_dl_open_runtime_lib (libname, MONO_DL_EAGER, &err);
g_free (err);
if (module)
- return load_profiler (module, desc, NULL);
+ return load_profiler (module, name, desc);
return FALSE;
}
void
mono_profiler_load (const char *desc)
{
- mono_gc_base_init ();
-
if (!desc || !strcmp ("default", desc))
desc = "log:report";
} else
mname = g_strdup (desc);
- if (!load_profiler_from_executable (desc, mname)) {
+ if (!load_profiler_from_executable (mname, desc)) {
char *libname = g_strdup_printf ("mono-profiler-%s", mname);
- gboolean res = load_profiler_from_installation (libname, desc);
+ gboolean res = load_profiler_from_installation (libname, mname, desc);
if (!res && mono_config_get_assemblies_dir ())
- res = load_profiler_from_directory (mono_assembly_getrootdir (), libname, desc);
+ res = load_profiler_from_directory (mono_assembly_getrootdir (), libname, mname, desc);
if (!res)
- res = load_profiler_from_directory (NULL, libname, desc);
+ res = load_profiler_from_directory (NULL, libname, mname, desc);
if (!res)
- g_warning ("The '%s' profiler wasn't found in the main executable nor could it be loaded from '%s'.", mname, libname);
+ mono_profiler_printf_err ("The '%s' profiler wasn't found in the main executable nor could it be loaded from '%s'.", mname, libname);
g_free (libname);
}
}
MonoProfilerHandle
-mono_profiler_install (MonoProfiler *prof)
+mono_profiler_create (MonoProfiler *prof)
{
MonoProfilerHandle handle = g_new0 (struct _MonoProfilerDesc, 1);
return handle;
}
+void
+mono_profiler_set_cleanup_callback (MonoProfilerHandle handle, MonoProfilerCleanupCallback cb)
+{
+ InterlockedWritePointer (&handle->cleanup_callback, (gpointer) cb);
+}
+
void
mono_profiler_set_coverage_filter_callback (MonoProfilerHandle handle, MonoProfilerCoverageFilterCallback cb)
{
InterlockedWritePointer (&handle->coverage_filter, (gpointer) cb);
}
-static void
-initialize_coverage (void)
+mono_bool
+mono_profiler_enable_coverage (void)
{
+ if (mono_profiler_state.startup_done)
+ return FALSE;
+
mono_os_mutex_init (&mono_profiler_state.coverage_mutex);
mono_profiler_state.coverage_hash = g_hash_table_new (NULL, NULL);
-}
-static void
-lazy_initialize_coverage (void)
-{
- mono_lazy_initialize (&mono_profiler_state.coverage_status, initialize_coverage);
+ if (!mono_debug_enabled ())
+ mono_debug_init (MONO_DEBUG_FORMAT_MONO);
+
+ return mono_profiler_state.code_coverage = TRUE;
}
static void
mono_os_mutex_unlock (&mono_profiler_state.coverage_mutex);
}
-void
+mono_bool
mono_profiler_get_coverage_data (MonoProfilerHandle handle, MonoMethod *method, MonoProfilerCoverageCallback cb)
{
- lazy_initialize_coverage ();
+ if (!mono_profiler_state.code_coverage)
+ return FALSE;
coverage_lock ();
coverage_unlock ();
if (!info)
- return;
+ return FALSE;
MonoError error;
MonoMethodHeader *header = mono_method_get_header_checked (method, &error);
guint32 size;
const unsigned char *start = mono_method_header_get_code (header, &size, NULL);
- const unsigned char *end = start - size;
+ const unsigned char *end = start + size;
MonoDebugMethodInfo *minfo = mono_debug_lookup_method (method);
for (guint32 i = 0; i < info->entries; i++) {
}
mono_metadata_free_mh (header);
+
+ return TRUE;
}
MonoProfilerCoverageInfo *
mono_profiler_coverage_alloc (MonoMethod *method, guint32 entries)
{
- lazy_initialize_coverage ();
+ if (!mono_profiler_state.code_coverage)
+ return FALSE;
gboolean cover = FALSE;
return info;
}
-void
-mono_profiler_coverage_free (MonoMethod *method)
-{
- lazy_initialize_coverage ();
-
- coverage_lock ();
-
- MonoProfilerCoverageInfo *info = g_hash_table_lookup (mono_profiler_state.coverage_hash, method);
-
- if (info) {
- g_hash_table_remove (mono_profiler_state.coverage_hash, method);
- g_free (info);
- }
-
- coverage_unlock ();
-}
-
mono_bool
mono_profiler_enable_sampling (MonoProfilerHandle handle)
{
}
mono_bool
-mono_profiler_set_sample_mode (MonoProfilerHandle handle, MonoProfilerSampleMode mode, uint64_t freq)
+mono_profiler_set_sample_mode (MonoProfilerHandle handle, MonoProfilerSampleMode mode, uint32_t freq)
{
if (handle != mono_profiler_state.sampling_owner)
return FALSE;
mono_profiler_state.sample_mode = mode;
mono_profiler_state.sample_freq = freq;
- mono_os_sem_post (&mono_profiler_state.sampling_semaphore);
+ mono_profiler_sampling_thread_post ();
return TRUE;
}
mono_bool
-mono_profiler_get_sample_mode (MonoProfilerHandle handle, MonoProfilerSampleMode *mode, uint64_t *freq)
+mono_profiler_get_sample_mode (MonoProfilerHandle handle, MonoProfilerSampleMode *mode, uint32_t *freq)
{
if (mode)
*mode = mono_profiler_state.sample_mode;
}
void
-mono_profiler_sampling_thread_sleep (void)
+mono_profiler_sampling_thread_post (void)
+{
+ mono_os_sem_post (&mono_profiler_state.sampling_semaphore);
+}
+
+void
+mono_profiler_sampling_thread_wait (void)
{
mono_os_sem_wait (&mono_profiler_state.sampling_semaphore, MONO_SEM_FLAGS_NONE);
}
if (mono_profiler_state.startup_done)
return FALSE;
- mono_profiler_state.allocations = TRUE;
-
- return TRUE;
+ return mono_profiler_state.allocations = TRUE;
}
void
InterlockedWritePointer (&handle->call_instrumentation_filter, (gpointer) cb);
}
-gboolean
-mono_profiler_should_instrument_method (MonoMethod *method, gboolean entry)
+mono_bool
+mono_profiler_enable_call_context_introspection (void)
+{
+ if (mono_profiler_state.startup_done)
+ return FALSE;
+
+ mono_profiler_state.context_enable ();
+
+ return mono_profiler_state.call_contexts = TRUE;
+}
+
+void *
+mono_profiler_call_context_get_this (MonoProfilerCallContext *context)
+{
+ if (!mono_profiler_state.call_contexts)
+ return NULL;
+
+ return mono_profiler_state.context_get_this (context);
+}
+
+void *
+mono_profiler_call_context_get_argument (MonoProfilerCallContext *context, uint32_t position)
+{
+ if (!mono_profiler_state.call_contexts)
+ return NULL;
+
+ return mono_profiler_state.context_get_argument (context, position);
+}
+
+void *
+mono_profiler_call_context_get_local (MonoProfilerCallContext *context, uint32_t position)
+{
+ if (!mono_profiler_state.call_contexts)
+ return NULL;
+
+ return mono_profiler_state.context_get_local (context, position);
+}
+
+void *
+mono_profiler_call_context_get_result (MonoProfilerCallContext *context)
+{
+ if (!mono_profiler_state.call_contexts)
+ return NULL;
+
+ return mono_profiler_state.context_get_result (context);
+}
+
+void
+mono_profiler_call_context_free_buffer (void *buffer)
+{
+ mono_profiler_state.context_free_buffer (buffer);
+}
+
+MonoProfilerCallInstrumentationFlags
+mono_profiler_get_call_instrumentation_flags (MonoMethod *method)
{
MonoProfilerCallInstrumentationFlags flags = MONO_PROFILER_CALL_INSTRUMENTATION_NONE;
flags |= cb (handle->prof, method);
}
- if (entry)
- return flags & MONO_PROFILER_CALL_INSTRUMENTATION_PROLOGUE;
- else
- return flags & MONO_PROFILER_CALL_INSTRUMENTATION_EPILOGUE;
+ return flags;
}
void
#undef MONO_PROFILER_EVENT_3
#undef MONO_PROFILER_EVENT_4
#undef _MONO_PROFILER_EVENT
+
+ MonoProfilerHandle head = mono_profiler_state.profilers;
+
+ while (head) {
+ MonoProfilerCleanupCallback cb = head->cleanup_callback;
+
+ if (cb)
+ cb (head->prof);
+
+ MonoProfilerHandle cur = head;
+ head = head->next;
+
+ g_free (cur);
+ }
+
+ if (mono_profiler_state.code_coverage) {
+ mono_os_mutex_destroy (&mono_profiler_state.coverage_mutex);
+
+ GHashTableIter iter;
+
+ g_hash_table_iter_init (&iter, mono_profiler_state.coverage_hash);
+
+ MonoProfilerCoverageInfo *info;
+
+ while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &info))
+ g_free (info);
+
+ g_hash_table_destroy (mono_profiler_state.coverage_hash);
+ }
+
+ if (mono_profiler_state.sampling_owner)
+ mono_os_sem_destroy (&mono_profiler_state.sampling_semaphore);
}
static void
#undef MONO_PROFILER_EVENT_3
#undef MONO_PROFILER_EVENT_4
#undef _MONO_PROFILER_EVENT
+
+/*
+ * The following code is here to maintain compatibility with a few profiler API
+ * functions used by Xamarin.{Android,iOS,Mac} so that they keep working
+ * regardless of which system Mono version is used.
+ *
+ * TODO: Remove this some day if we're OK with breaking compatibility.
+ */
+
+typedef void *MonoLegacyProfiler;
+
+typedef void (*MonoLegacyProfileFunc) (MonoLegacyProfiler *prof);
+typedef void (*MonoLegacyProfileThreadFunc) (MonoLegacyProfiler *prof, uintptr_t tid);
+typedef void (*MonoLegacyProfileGCFunc) (MonoLegacyProfiler *prof, MonoProfilerGCEvent event, int generation);
+typedef void (*MonoLegacyProfileGCResizeFunc) (MonoLegacyProfiler *prof, int64_t new_size);
+typedef void (*MonoLegacyProfileJitResult) (MonoLegacyProfiler *prof, MonoMethod *method, MonoJitInfo *jinfo, int result);
+
+struct _MonoProfiler {
+ MonoProfilerHandle handle;
+ MonoLegacyProfiler *profiler;
+ MonoLegacyProfileFunc shutdown_callback;
+ MonoLegacyProfileThreadFunc thread_start, thread_end;
+ MonoLegacyProfileGCFunc gc_event;
+ MonoLegacyProfileGCResizeFunc gc_heap_resize;
+ MonoLegacyProfileJitResult jit_end2;
+};
+
+static MonoProfiler *current;
+
+MONO_API void mono_profiler_install (MonoLegacyProfiler *prof, MonoLegacyProfileFunc callback);
+MONO_API void mono_profiler_install_thread (MonoLegacyProfileThreadFunc start, MonoLegacyProfileThreadFunc end);
+MONO_API void mono_profiler_install_gc (MonoLegacyProfileGCFunc callback, MonoLegacyProfileGCResizeFunc heap_resize_callback);
+MONO_API void mono_profiler_install_jit_end (MonoLegacyProfileJitResult end);
+MONO_API void mono_profiler_set_events (int flags);
+
+static void
+shutdown_cb (MonoProfiler *prof)
+{
+ prof->shutdown_callback (prof->profiler);
+}
+
+void
+mono_profiler_install (MonoLegacyProfiler *prof, MonoLegacyProfileFunc callback)
+{
+ current = g_new0 (MonoProfiler, 1);
+ current->handle = mono_profiler_create (current);
+ current->profiler = prof;
+ current->shutdown_callback = callback;
+
+ if (callback)
+ mono_profiler_set_runtime_shutdown_end_callback (current->handle, shutdown_cb);
+}
+
+static void
+thread_start_cb (MonoProfiler *prof, uintptr_t tid)
+{
+ prof->thread_start (prof->profiler, tid);
+}
+
+static void
+thread_stop_cb (MonoProfiler *prof, uintptr_t tid)
+{
+ prof->thread_end (prof->profiler, tid);
+}
+
+void
+mono_profiler_install_thread (MonoLegacyProfileThreadFunc start, MonoLegacyProfileThreadFunc end)
+{
+ current->thread_start = start;
+ current->thread_end = end;
+
+ if (start)
+ mono_profiler_set_thread_started_callback (current->handle, thread_start_cb);
+
+ if (end)
+ mono_profiler_set_thread_stopped_callback (current->handle, thread_stop_cb);
+}
+
+static void
+gc_event_cb (MonoProfiler *prof, MonoProfilerGCEvent event, uint32_t generation)
+{
+ prof->gc_event (prof->profiler, event, generation);
+}
+
+static void
+gc_resize_cb (MonoProfiler *prof, uintptr_t size)
+{
+ prof->gc_heap_resize (prof->profiler, size);
+}
+
+void
+mono_profiler_install_gc (MonoLegacyProfileGCFunc callback, MonoLegacyProfileGCResizeFunc heap_resize_callback)
+{
+ current->gc_event = callback;
+ current->gc_heap_resize = heap_resize_callback;
+
+ if (callback)
+ mono_profiler_set_gc_event_callback (current->handle, gc_event_cb);
+
+ if (heap_resize_callback)
+ mono_profiler_set_gc_resize_callback (current->handle, gc_resize_cb);
+}
+
+static void
+jit_done_cb (MonoProfiler *prof, MonoMethod *method, MonoJitInfo *jinfo)
+{
+ prof->jit_end2 (prof->profiler, method, jinfo, 0);
+}
+
+static void
+jit_failed_cb (MonoProfiler *prof, MonoMethod *method)
+{
+ prof->jit_end2 (prof->profiler, method, NULL, 1);
+}
+
+void
+mono_profiler_install_jit_end (MonoLegacyProfileJitResult end)
+{
+ current->jit_end2 = end;
+
+ if (end) {
+ mono_profiler_set_jit_done_callback (current->handle, jit_done_cb);
+ mono_profiler_set_jit_failed_callback (current->handle, jit_failed_cb);
+ }
+}
+
+void
+mono_profiler_set_events (int flags)
+{
+ /* Do nothing. */
+}
* the module after it has been loaded. If the specified module has already
* been loaded, this function has no effect.
*
- * A module should declare an entry point like so:
+ * A module called foo should declare an entry point like so:
*
- * void mono_profiler_init (const char *desc)
+ * void mono_profiler_init_foo (const char *desc)
* {
* }
*
/*
* Installs a profiler and returns a handle for it. The handle is used with the
- * other functions in the profiler API (e.g. for setting up callbacks).
+ * other functions in the profiler API (e.g. for setting up callbacks). The
+ * given structure pointer will be passed to all callbacks from the profiler
+ * API. It can be NULL.
*
* This function may only be called from your profiler's init function.
*
* };
*
* MonoProfiler *prof = calloc (1, sizeof (MonoProfiler));
- * MonoProfilerHandle handle = mono_profiler_install (prof);
+ * MonoProfilerHandle handle = mono_profiler_create (prof);
* mono_profiler_set_shutdown_callback (handle, my_shutdown_cb);
*
* This function is not async safe.
*/
-MONO_API MonoProfilerHandle mono_profiler_install (MonoProfiler *prof);
+MONO_API MonoProfilerHandle mono_profiler_create (MonoProfiler *prof);
+
+typedef void (*MonoProfilerCleanupCallback) (MonoProfiler *prof);
+
+/*
+ * Sets a profiler cleanup function. This function will be invoked at shutdown
+ * when the profiler API is cleaning up its internal structures. It's mainly
+ * intended for a profiler to free the structure pointer that was passed to
+ * mono_profiler_create, if necessary.
+ *
+ * This function is async safe.
+ */
+MONO_API void mono_profiler_set_cleanup_callback (MonoProfilerHandle handle, MonoProfilerCleanupCallback cb);
+
+/*
+ * Enables support for code coverage instrumentation. At the moment, this means
+ * enabling the debug info subsystem. If you do not call this function, you
+ * will not be able to use mono_profiler_get_coverage_data. Returns TRUE if
+ * code coverage support was enabled, or FALSE if the function was called too
+ * late for this to be possible.
+ *
+ * This function may only be called from your profiler's init function.
+ *
+ * This function is not async safe.
+ */
+MONO_API mono_bool mono_profiler_enable_coverage (void);
typedef mono_bool (*MonoProfilerCoverageFilterCallback) (MonoProfiler *prof, MonoMethod *method);
* Sets a code coverage filter function. The profiler API will invoke filter
* functions from all installed profilers. If any of them return TRUE, then the
* given method will be instrumented for coverage analysis. All filters are
- * guaranteed to be called exactly once per method, even if an earlier filter
+ * guaranteed to be called at least once per method, even if an earlier filter
* has already returned TRUE.
*
* Note that filter functions must be installed before a method is compiled in
/*
* Retrieves all coverage data for the specified method and invokes the given
- * callback for each entry.
+ * callback for each entry. Source location information will only be filled out
+ * if the given method has debug info available. Returns TRUE if the given
+ * method was instrumented for code coverage; otherwise, FALSE.
+ *
+ * Please note that the structure passed to the callback is only valid for the
+ * duration of the callback.
*
* This function is not async safe.
*/
-MONO_API void mono_profiler_get_coverage_data (MonoProfilerHandle handle, MonoMethod *method, MonoProfilerCoverageCallback cb);
+MONO_API mono_bool mono_profiler_get_coverage_data (MonoProfilerHandle handle, MonoMethod *method, MonoProfilerCoverageCallback cb);
typedef enum {
/*
MONO_API mono_bool mono_profiler_enable_sampling (MonoProfilerHandle handle);
/*
- * Sets the sampling mode and frequency (in Hz). If the calling profiler has
- * ownership over sampling settings, the settings will be changed and this
- * function will return TRUE; otherwise, it returns FALSE without changing any
- * settings.
+ * Sets the sampling mode and frequency (in Hz). The frequency must be a
+ * positive number. If the calling profiler has ownership over sampling
+ * settings, the settings will be changed and this function will return TRUE;
+ * otherwise, it returns FALSE without changing any settings.
*
* This function is async safe.
*/
-MONO_API mono_bool mono_profiler_set_sample_mode (MonoProfilerHandle handle, MonoProfilerSampleMode mode, uint64_t freq);
+MONO_API mono_bool mono_profiler_set_sample_mode (MonoProfilerHandle handle, MonoProfilerSampleMode mode, uint32_t freq);
/*
* Retrieves the current sampling mode and/or frequency (in Hz). Returns TRUE if
*
* This function is async safe.
*/
-MONO_API mono_bool mono_profiler_get_sample_mode (MonoProfilerHandle handle, MonoProfilerSampleMode *mode, uint64_t *freq);
+MONO_API mono_bool mono_profiler_get_sample_mode (MonoProfilerHandle handle, MonoProfilerSampleMode *mode, uint32_t *freq);
/*
* Enables instrumentation of GC allocations. This is necessary so that managed
typedef enum {
/* Do not instrument calls. */
- MONO_PROFILER_CALL_INSTRUMENTATION_NONE = 1 << 0,
- /* Instrument method prologues. */
- MONO_PROFILER_CALL_INSTRUMENTATION_PROLOGUE = 1 << 1,
- /* Instrument method epilogues. */
- MONO_PROFILER_CALL_INSTRUMENTATION_EPILOGUE = 1 << 2,
+ MONO_PROFILER_CALL_INSTRUMENTATION_NONE = 0,
+ /* Instrument method entries. */
+ MONO_PROFILER_CALL_INSTRUMENTATION_ENTER = 1 << 1,
+ /* Also capture a call context for method entries. */
+ MONO_PROFILER_CALL_INSTRUMENTATION_ENTER_CONTEXT = 1 << 2,
+ /* Instrument method exits. */
+ MONO_PROFILER_CALL_INSTRUMENTATION_LEAVE = 1 << 3,
+ /* Also capture a call context for method exits. */
+ MONO_PROFILER_CALL_INSTRUMENTATION_LEAVE_CONTEXT = 1 << 4,
+ /* Instrument method exits as a result of a tail call. */
+ MONO_PROFILER_CALL_INSTRUMENTATION_TAIL_CALL = 1 << 5,
+ /* Instrument exceptional method exits. */
+ MONO_PROFILER_CALL_INSTRUMENTATION_EXCEPTION_LEAVE = 1 << 6,
} MonoProfilerCallInstrumentationFlags;
typedef MonoProfilerCallInstrumentationFlags (*MonoProfilerCallInstrumentationFilterCallback) (MonoProfiler *prof, MonoMethod *method);
* filter functions from all installed profilers. If any of them return flags
* other than MONO_PROFILER_CALL_INSTRUMENTATION_NONE, then the given method
* will be instrumented as requested. All filters are guaranteed to be called
- * at least once (possibly more) per method entry and exit, even if earlier
- * filters have already specified all flags.
+ * exactly once per method, even if earlier filters have already specified all
+ * flags.
*
* Note that filter functions must be installed before a method is compiled in
* order to have any effect, i.e. you should register your filter function in
- * your profiler's init function.
+ * your profiler's init function. Also, if you want to instrument a method
+ * that's going to be AOT-compiled, you must attach your profiler and install a
+ * call instrumentation filter function at AOT time. This can be done in
+ * exactly the same way as you would normally, i.e. by passing the --profile
+ * option on the command line, by calling mono_profiler_load, or simply by
+ * using the profiler API as an embedder.
*
- * Keep in mind that method instrumentation is extremely heavy and will slow
- * down most applications to a crawl. Consider using sampling instead if it
- * would work for your use case.
+ * Keep in mind that indiscriminate method instrumentation is extremely heavy
+ * and will slow down most applications to a crawl. Consider using sampling
+ * instead if it would work for your use case.
*
* This function is async safe.
*/
MONO_API void mono_profiler_set_call_instrumentation_filter_callback (MonoProfilerHandle handle, MonoProfilerCallInstrumentationFilterCallback cb);
+/*
+ * Enables support for retrieving stack frame data from a call context. At the
+ * moment, this means enabling the debug info subsystem. If you do not call
+ * this function, you will not be able to use the call context introspection
+ * functions (they will simply return NULL). Returns TRUE if call context
+ * introspection was enabled, or FALSE if the function was called too late for
+ * this to be possible.
+ *
+ * Please note: Mono's LLVM backend does not support this feature. This means
+ * that methods with call context instrumentation will be handled by Mono's
+ * JIT even in LLVM mode. There is also a special case when Mono is compiling
+ * in LLVM-only mode: Since LLVM does not provide a way to implement call
+ * contexts, a NULL context will always be passed to enter/leave events even
+ * though this method returns TRUE.
+ *
+ * This function may only be called from your profiler's init function.
+ *
+ * This function is not async safe.
+ */
+MONO_API mono_bool mono_profiler_enable_call_context_introspection (void);
+
+typedef struct _MonoProfilerCallContext MonoProfilerCallContext;
+
+/*
+ * Given a valid call context from an enter/leave event, retrieves a pointer to
+ * the this reference for the method. Returns NULL if none exists (i.e. it's a
+ * static method) or if call context introspection was not enabled.
+ *
+ * The buffer returned by this function must be freed with
+ * mono_profiler_call_context_free_buffer.
+ *
+ * Please note that a call context is only valid for the duration of the
+ * enter/leave callback it was passed to.
+ *
+ * This function is not async safe.
+ */
+MONO_API void *mono_profiler_call_context_get_this (MonoProfilerCallContext *context);
+
+/*
+ * Given a valid call context from an enter/leave event, retrieves a pointer to
+ * the method argument at the given position. Returns NULL if position is out
+ * of bounds or if call context introspection was not enabled.
+ *
+ * The buffer returned by this function must be freed with
+ * mono_profiler_call_context_free_buffer.
+ *
+ * Please note that a call context is only valid for the duration of the
+ * enter/leave callback it was passed to.
+ *
+ * This function is not async safe.
+ */
+MONO_API void *mono_profiler_call_context_get_argument (MonoProfilerCallContext *context, uint32_t position);
+
+/*
+ * Given a valid call context from an enter/leave event, retrieves a pointer to
+ * the local variable at the given position. Returns NULL if position is out of
+ * bounds or if call context introspection was not enabled.
+ *
+ * The buffer returned by this function must be freed with
+ * mono_profiler_call_context_free_buffer.
+ *
+ * Please note that a call context is only valid for the duration of the
+ * enter/leave callback it was passed to.
+ *
+ * This function is not async safe.
+ */
+MONO_API void *mono_profiler_call_context_get_local (MonoProfilerCallContext *context, uint32_t position);
+
+/*
+ * Given a valid call context from an enter/leave event, retrieves a pointer to
+ * return value of a method. Returns NULL if the method has no return value
+ * (i.e. it returns void), if the leave event was the result of a tail call, if
+ * the function is called on a context from an enter event, or if call context
+ * introspection was not enabled.
+ *
+ * The buffer returned by this function must be freed with
+ * mono_profiler_call_context_free_buffer.
+ *
+ * Please note that a call context is only valid for the duration of the
+ * enter/leave callback it was passed to.
+ *
+ * This function is not async safe.
+ */
+MONO_API void *mono_profiler_call_context_get_result (MonoProfilerCallContext *context);
+
+/*
+ * Frees a buffer returned by one of the call context introspection functions.
+ * Passing a NULL buffer is allowed, which makes this function a no-op.
+ *
+ * This function is not async safe.
+ */
+MONO_API void mono_profiler_call_context_free_buffer (void *buffer);
+
#ifdef MONO_PROFILER_UNSTABLE_GC_ROOTS
typedef enum {
/* Upper 2 bytes. */
MONO_PROFILER_CODE_BUFFER_EXCEPTION_HANDLING = 9,
} MonoProfilerCodeBufferType;
-// Keep somewhat in sync with libgc/include/gc.h : GC_EventType.
typedef enum {
- MONO_GC_EVENT_START = 0,
- MONO_GC_EVENT_MARK_START = 1,
- MONO_GC_EVENT_MARK_END = 2,
- MONO_GC_EVENT_RECLAIM_START = 3,
- MONO_GC_EVENT_RECLAIM_END = 4,
- MONO_GC_EVENT_END = 5,
MONO_GC_EVENT_PRE_STOP_WORLD = 6,
/* When this event arrives, the GC and suspend locks are acquired. */
MONO_GC_EVENT_PRE_STOP_WORLD_LOCKED = 10,
MONO_GC_EVENT_POST_STOP_WORLD = 7,
+ MONO_GC_EVENT_START = 0,
+ MONO_GC_EVENT_END = 5,
MONO_GC_EVENT_PRE_START_WORLD = 8,
/* When this event arrives, the GC and suspend locks are released. */
MONO_GC_EVENT_POST_START_WORLD_UNLOCKED = 11,
guint
reflected_hash (gconstpointer a);
-#ifdef HAVE_BOEHM_GC
-/* ReflectedEntry doesn't need to be GC tracked */
-#define ALLOC_REFENTRY g_new0 (ReflectedEntry, 1)
-#define FREE_REFENTRY(entry) g_free ((entry))
-#define REFENTRY_REQUIRES_CLEANUP
-#else
-#define ALLOC_REFENTRY (ReflectedEntry *)mono_mempool_alloc (domain->mp, sizeof (ReflectedEntry))
-/* FIXME: */
-#define FREE_REFENTRY(entry)
-#endif
+static inline ReflectedEntry*
+alloc_reflected_entry (MonoDomain *domain)
+{
+ if (!mono_gc_is_moving ())
+ return g_new0 (ReflectedEntry, 1);
+ else
+ return (ReflectedEntry *)mono_mempool_alloc (domain->mp, sizeof (ReflectedEntry));
+}
+
+static void
+free_reflected_entry (ReflectedEntry *entry)
+{
+ if (!mono_gc_is_moving ())
+ g_free (entry);
+}
static inline MonoObject*
cache_object (MonoDomain *domain, MonoClass *klass, gpointer item, MonoObject* o)
obj = (MonoObject*) mono_conc_g_hash_table_lookup (domain->refobject_hash, &pe);
if (obj == NULL) {
- ReflectedEntry *e = ALLOC_REFENTRY;
+ ReflectedEntry *e = alloc_reflected_entry (domain);
e->item = item;
e->refclass = klass;
mono_conc_g_hash_table_insert (domain->refobject_hash, e, o);
MonoObjectHandle obj = MONO_HANDLE_NEW (MonoObject, mono_conc_g_hash_table_lookup (domain->refobject_hash, &pe));
if (MONO_HANDLE_IS_NULL (obj)) {
- ReflectedEntry *e = ALLOC_REFENTRY;
+ ReflectedEntry *e = alloc_reflected_entry (domain);
e->item = item;
e->refclass = klass;
mono_conc_g_hash_table_insert (domain->refobject_hash, e, MONO_HANDLE_RAW (o));
}
}
-
/**
* mono_custom_attrs_free:
*/
g_free (ainfo);
}
-
gboolean
reflected_equal (gconstpointer a, gconstpointer b)
{
return seed;
}
-
static void
clear_cached_object (MonoDomain *domain, gpointer o, MonoClass *klass)
{
if (mono_conc_g_hash_table_lookup_extended (domain->refobject_hash, &pe, &orig_pe, &orig_value)) {
mono_conc_g_hash_table_remove (domain->refobject_hash, &pe);
- FREE_REFENTRY (orig_pe);
+ free_reflected_entry (orig_pe);
}
}
mono_domain_unlock (domain);
}
-#ifdef REFENTRY_REQUIRES_CLEANUP
static void
cleanup_refobject_hash (gpointer key, gpointer value, gpointer user_data)
{
- FREE_REFENTRY (key);
+ free_reflected_entry (key);
}
-#endif
void
mono_reflection_cleanup_domain (MonoDomain *domain)
{
if (domain->refobject_hash) {
-/*let's avoid scanning the whole hashtable if not needed*/
-#ifdef REFENTRY_REQUIRES_CLEANUP
mono_conc_g_hash_table_foreach (domain->refobject_hash, cleanup_refobject_hash, NULL);
-#endif
mono_conc_g_hash_table_destroy (domain->refobject_hash);
domain->refobject_hash = NULL;
}
}
-
/**
* mono_assembly_get_object:
* \param domain an app domain
static void G_GNUC_UNUSED
sgen_client_binary_protocol_mark_start (int generation)
{
- MONO_PROFILER_RAISE (gc_event, (MONO_GC_EVENT_MARK_START, generation));
}
static void G_GNUC_UNUSED
sgen_client_binary_protocol_mark_end (int generation)
{
- MONO_PROFILER_RAISE (gc_event, (MONO_GC_EVENT_MARK_END, generation));
}
static void G_GNUC_UNUSED
sgen_client_binary_protocol_reclaim_start (int generation)
{
- MONO_PROFILER_RAISE (gc_event, (MONO_GC_EVENT_RECLAIM_START, generation));
}
static void G_GNUC_UNUSED
sgen_client_binary_protocol_reclaim_end (int generation)
{
- MONO_PROFILER_RAISE (gc_event, (MONO_GC_EVENT_RECLAIM_END, generation));
}
static void
{
}
+static void G_GNUC_UNUSED
+sgen_client_binary_protocol_worker_finish_stats (int worker_index, int generation, gboolean forced, long long major_scan, long long los_scan, long long work_time)
+{
+}
+
+static void G_GNUC_UNUSED
+sgen_client_binary_protocol_collection_end_stats (long long major_scan, long long los_scan, long long finish_stack)
+{
+}
+
#define TLAB_ACCESS_INIT SgenThreadInfo *__thread_info__ = (SgenThreadInfo*)mono_tls_get_sgen_thread_info ()
#define IN_CRITICAL_REGION (__thread_info__->client_info.in_critical_region)
if ((klass->image == &assembly->image) && (type->type != MONO_TYPE_VAR) &&
(type->type != MONO_TYPE_MVAR)) {
token = MONO_TYPEDEFORREF_TYPEDEF | (MONO_HANDLE_GETVAL (tb, table_idx) << MONO_TYPEDEFORREF_BITS);
- mono_dynamic_image_register_token (assembly, token, MONO_HANDLE_CAST (MonoObject, tb));
+ /* This function is called multiple times from sre and sre-save, so same object is okay */
+ mono_dynamic_image_register_token (assembly, token, MONO_HANDLE_CAST (MonoObject, tb), MONO_DYN_IMAGE_TOK_SAME_OK);
goto leave;
}
token = MONO_TYPEDEFORREF_TYPEREF | (table->next_idx << MONO_TYPEDEFORREF_BITS); /* typeref */
g_hash_table_insert (assembly->typeref, type, GUINT_TO_POINTER(token));
table->next_idx ++;
- mono_dynamic_image_register_token (assembly, token, MONO_HANDLE_CAST (MonoObject, tb));
+
+
+ if (!MONO_HANDLE_IS_NULL (tb)) {
+ /* This function is called multiple times from sre and sre-save, so same object is okay */
+ mono_dynamic_image_register_token (assembly, token, MONO_HANDLE_CAST (MonoObject, tb), MONO_DYN_IMAGE_TOK_SAME_OK);
+ }
+
leave:
HANDLE_FUNCTION_RETURN_VAL (token);
}
g_assert_not_reached ();
}
break;
+ case MONO_TABLE_TYPEREF:
+ g_assert (!strcmp (iltoken->member->vtable->klass->name, "RuntimeType"));
+ MonoClass *k = mono_class_from_mono_type (((MonoReflectionType*)iltoken->member)->type);
+ MonoObject *obj = mono_class_get_ref_info_raw (k); /* FIXME use handles */
+ g_assert (obj);
+ g_assert (!strcmp (mono_object_class (obj)->name, "TypeBuilder"));
+ g_assert (((MonoReflectionTypeBuilder*)obj)->module->dynamic_image != assembly);
+ continue;
case MONO_TABLE_MEMBERREF:
if (!strcmp (iltoken->member->vtable->klass->name, "MonoArrayMethod")) {
am = (MonoReflectionArrayMethod*)iltoken->member;
}
token = MONO_TOKEN_STRING | idx;
- mono_dynamic_image_register_token (assembly, token, MONO_HANDLE_CAST (MonoObject, str));
+ mono_dynamic_image_register_token (assembly, token, MONO_HANDLE_CAST (MonoObject, str), MONO_DYN_IMAGE_TOK_NEW);
leave:
HANDLE_FUNCTION_RETURN_VAL (token);
g_error ("requested method token for %s\n", klass->name);
}
- mono_dynamic_image_register_token (assembly, token, obj);
+ mono_dynamic_image_register_token (assembly, token, obj, MONO_DYN_IMAGE_TOK_NEW);
return token;
fail:
g_assert (!mono_error_ok (error));
return 0;
}
+ /* This function is called from ModuleBuilder:getToken multiple times for the same objects */
+ int how_collide = MONO_DYN_IMAGE_TOK_SAME_OK;
+
if (strcmp (klass->name, "RuntimeType") == 0) {
MonoType *type = mono_reflection_type_handle_mono_type (MONO_HANDLE_CAST (MonoReflectionType, obj), error);
return_val_if_nok (error, 0);
MonoClass *mc = mono_class_from_mono_type (type);
token = mono_metadata_token_from_dor (
mono_dynimage_encode_typedef_or_ref_full (assembly, type, !mono_class_is_gtd (mc) || create_open_instance));
+ /* If it's a RuntimeType now, we could have registered a
+ * TypeBuilder for it before, so replacing is okay. */
+ how_collide = MONO_DYN_IMAGE_TOK_REPLACE;
} else if (strcmp (klass->name, "MonoCMethod") == 0 ||
strcmp (klass->name, "MonoMethod") == 0) {
MonoReflectionMethodHandle m = MONO_HANDLE_CAST (MonoReflectionMethod, obj);
* FIXME: do the equivalent for Fields.
*/
token = method->token;
+ how_collide = MONO_DYN_IMAGE_TOK_REPLACE;
} else {
/*
* Each token should have a unique index, but the indexes are
*/
method_table_idx --;
token = MONO_TOKEN_METHOD_DEF | method_table_idx;
+ how_collide = MONO_DYN_IMAGE_TOK_NEW;
}
} else {
token = mono_image_get_methodref_token (assembly, method, create_open_instance);
static guint32 field_table_idx = 0xffffff;
field_table_idx --;
token = MONO_TOKEN_FIELD_DEF | field_table_idx;
+ how_collide = MONO_DYN_IMAGE_TOK_NEW;
} else {
token = mono_image_get_fieldref_token (assembly, obj, field);
}
MonoReflectionSigHelperHandle s = MONO_HANDLE_CAST (MonoReflectionSigHelper, obj);
token = MONO_TOKEN_SIGNATURE | mono_image_get_sighelper_token (assembly, s, error);
return_val_if_nok (error, 0);
- } else if (strcmp (klass->name, "EnumBuilder") == 0) {
- MonoType *type = mono_reflection_type_handle_mono_type (MONO_HANDLE_CAST (MonoReflectionType, obj), error);
- return_val_if_nok (error, 0);
- token = mono_metadata_token_from_dor (
- mono_image_typedef_or_ref (assembly, type));
} else {
g_error ("requested token for %s\n", klass->name);
}
if (register_token)
- mono_dynamic_image_register_token (assembly, token, obj);
+ mono_dynamic_image_register_token (assembly, token, obj, how_collide);
return token;
}
*/
mono_image_append_class_to_reflection_info_set (klass);
- mono_dynamic_image_register_token (dynamic_image, MONO_TOKEN_TYPE_DEF | table_idx, MONO_HANDLE_CAST (MonoObject, ref_tb));
+ mono_dynamic_image_register_token (dynamic_image, MONO_TOKEN_TYPE_DEF | table_idx, MONO_HANDLE_CAST (MonoObject, ref_tb), MONO_DYN_IMAGE_TOK_NEW);
if ((!strcmp (klass->name, "ValueType") && !strcmp (klass->name_space, "System")) ||
(!strcmp (klass->name, "Object") && !strcmp (klass->name_space, "System")) ||
ves_icall_ModuleBuilder_RegisterToken (MonoReflectionModuleBuilderHandle mb, MonoObjectHandle obj, guint32 token, MonoError *error)
{
error_init (error);
- mono_dynamic_image_register_token (MONO_HANDLE_GETVAL (mb, dynamic_image), token, obj);
+ /* This function may be called by ModuleBuilder.FixupTokens to update
+ * an existing token, so replace is okay here. */
+ mono_dynamic_image_register_token (MONO_HANDLE_GETVAL (mb, dynamic_image), token, obj, MONO_DYN_IMAGE_TOK_REPLACE);
}
MonoObjectHandle
gunichar2* mono_thread_get_name (MonoInternalThread *this_obj, guint32 *name_len);
MONO_API MonoException* mono_thread_get_undeniable_exception (void);
+void mono_thread_self_abort (void);
void mono_thread_set_name_internal (MonoInternalThread *this_obj, MonoString *name, gboolean permanent, gboolean reset, MonoError *error);
void mono_threads_join_threads (void);
void mono_thread_join (gpointer tid);
-void mono_thread_detach_internal (MonoInternalThread *thread);
-
void ves_icall_System_Threading_Thread_GetStackTraces (MonoArray **out_threads, MonoArray **out_stack_traces);
MONO_API gpointer
return TRUE;
}
+static void
+mono_thread_detach_internal (MonoInternalThread *thread)
+{
+ gboolean removed;
+
+ g_assert (thread != NULL);
+ SET_CURRENT_OBJECT (thread);
+
+ THREAD_DEBUG (g_message ("%s: mono_thread_detach for %p (%"G_GSIZE_FORMAT")", __func__, thread, (gsize)thread->tid));
+
+#ifndef HOST_WIN32
+ mono_w32mutex_abandon ();
+#endif
+
+ if (thread->abort_state_handle) {
+ mono_gchandle_free (thread->abort_state_handle);
+ thread->abort_state_handle = 0;
+ }
+
+ thread->abort_exc = NULL;
+ thread->current_appcontext = NULL;
+
+ /*
+ * thread->synch_cs can be NULL if this was called after
+ * ves_icall_System_Threading_InternalThread_Thread_free_internal.
+ * This can happen only during shutdown.
+ * The shutting_down flag is not always set, so we can't assert on it.
+ */
+ if (thread->synch_cs)
+ LOCK_THREAD (thread);
+
+ thread->state |= ThreadState_Stopped;
+ thread->state &= ~ThreadState_Background;
+
+ if (thread->synch_cs)
+ UNLOCK_THREAD (thread);
+
+ /*
+ An interruption request has leaked to cleanup. Adjust the global counter.
+
+ This can happen is the abort source thread finds the abortee (this) thread
+ in unmanaged code. If this thread never trips back to managed code or check
+ the local flag it will be left set and positively unbalance the global counter.
+
+ Leaving the counter unbalanced will cause a performance degradation since all threads
+ will now keep checking their local flags all the time.
+ */
+ mono_thread_clear_interruption_requested (thread);
+
+ mono_threads_lock ();
+
+ if (!threads) {
+ removed = FALSE;
+ } else if (mono_g_hash_table_lookup (threads, (gpointer)thread->tid) != thread) {
+ /* We have to check whether the thread object for the
+ * tid is still the same in the table because the
+ * thread might have been destroyed and the tid reused
+ * in the meantime, in which case the tid would be in
+ * the table, but with another thread object.
+ */
+ removed = FALSE;
+ } else {
+ mono_g_hash_table_remove (threads, (gpointer)thread->tid);
+ removed = TRUE;
+ }
+
+ mono_threads_unlock ();
+
+ /* Don't close the handle here, wait for the object finalizer
+ * to do it. Otherwise, the following race condition applies:
+ *
+ * 1) Thread exits (and mono_thread_detach_internal() closes the handle)
+ *
+ * 2) Some other handle is reassigned the same slot
+ *
+ * 3) Another thread tries to join the first thread, and
+ * blocks waiting for the reassigned handle to be signalled
+ * (which might never happen). This is possible, because the
+ * thread calling Join() still has a reference to the first
+ * thread's object.
+ */
+
+ /* if the thread is not in the hash it has been removed already */
+ if (!removed) {
+ mono_domain_unset ();
+ mono_memory_barrier ();
+
+ if (mono_thread_cleanup_fn)
+ mono_thread_cleanup_fn (thread_get_tid (thread));
+
+ goto done;
+ }
+
+ mono_release_type_locks (thread);
+
+ /* Can happen when we attach the profiler helper thread in order to heapshot. */
+ if (!mono_thread_info_lookup (MONO_UINT_TO_NATIVE_THREAD_ID (thread->tid))->tools_thread)
+ MONO_PROFILER_RAISE (thread_stopped, (thread->tid));
+
+ mono_hazard_pointer_clear (mono_hazard_pointer_get (), 1);
+
+ /*
+ * This will signal async signal handlers that the thread has exited.
+ * The profiler callback needs this to be set, so it cannot be done earlier.
+ */
+ mono_domain_unset ();
+ mono_memory_barrier ();
+
+ if (thread == mono_thread_internal_current ())
+ mono_thread_pop_appdomain_ref ();
+
+ mono_free_static_data (thread->static_data);
+ thread->static_data = NULL;
+ ref_stack_destroy (thread->appdomain_refs);
+ thread->appdomain_refs = NULL;
+
+ g_assert (thread->suspended);
+ mono_os_event_destroy (thread->suspended);
+ g_free (thread->suspended);
+ thread->suspended = NULL;
+
+ if (mono_thread_cleanup_fn)
+ mono_thread_cleanup_fn (thread_get_tid (thread));
+
+ mono_memory_barrier ();
+
+ if (mono_gc_is_moving ()) {
+ MONO_GC_UNREGISTER_ROOT (thread->thread_pinning_ref);
+ thread->thread_pinning_ref = NULL;
+ }
+
+done:
+ SET_CURRENT_OBJECT (NULL);
+ mono_domain_unset ();
+
+ mono_thread_info_unset_internal_thread_gchandle ((MonoThreadInfo*) thread->thread_info);
+
+ /* Don't need to close the handle to this thread, even though we took a
+ * reference in mono_thread_attach (), because the GC will do it
+ * when the Thread object is finalised.
+ */
+}
+
typedef struct {
gint32 ref;
MonoThread *thread;
return mono_thread_attach_full (domain, FALSE);
}
-void
-mono_thread_detach_internal (MonoInternalThread *thread)
-{
- gboolean removed;
-
- g_assert (thread != NULL);
- SET_CURRENT_OBJECT (thread);
-
- THREAD_DEBUG (g_message ("%s: mono_thread_detach for %p (%"G_GSIZE_FORMAT")", __func__, thread, (gsize)thread->tid));
-
-#ifndef HOST_WIN32
- mono_w32mutex_abandon ();
-#endif
-
- if (thread->abort_state_handle) {
- mono_gchandle_free (thread->abort_state_handle);
- thread->abort_state_handle = 0;
- }
-
- thread->abort_exc = NULL;
- thread->current_appcontext = NULL;
-
- /*
- * thread->synch_cs can be NULL if this was called after
- * ves_icall_System_Threading_InternalThread_Thread_free_internal.
- * This can happen only during shutdown.
- * The shutting_down flag is not always set, so we can't assert on it.
- */
- if (thread->synch_cs)
- LOCK_THREAD (thread);
-
- thread->state |= ThreadState_Stopped;
- thread->state &= ~ThreadState_Background;
-
- if (thread->synch_cs)
- UNLOCK_THREAD (thread);
-
- /*
- An interruption request has leaked to cleanup. Adjust the global counter.
-
- This can happen is the abort source thread finds the abortee (this) thread
- in unmanaged code. If this thread never trips back to managed code or check
- the local flag it will be left set and positively unbalance the global counter.
-
- Leaving the counter unbalanced will cause a performance degradation since all threads
- will now keep checking their local flags all the time.
- */
- mono_thread_clear_interruption_requested (thread);
-
- mono_threads_lock ();
-
- if (!threads) {
- removed = FALSE;
- } else if (mono_g_hash_table_lookup (threads, (gpointer)thread->tid) != thread) {
- /* We have to check whether the thread object for the
- * tid is still the same in the table because the
- * thread might have been destroyed and the tid reused
- * in the meantime, in which case the tid would be in
- * the table, but with another thread object.
- */
- removed = FALSE;
- } else {
- mono_g_hash_table_remove (threads, (gpointer)thread->tid);
- removed = TRUE;
- }
-
- mono_threads_unlock ();
-
- /* Don't close the handle here, wait for the object finalizer
- * to do it. Otherwise, the following race condition applies:
- *
- * 1) Thread exits (and mono_thread_detach_internal() closes the handle)
- *
- * 2) Some other handle is reassigned the same slot
- *
- * 3) Another thread tries to join the first thread, and
- * blocks waiting for the reassigned handle to be signalled
- * (which might never happen). This is possible, because the
- * thread calling Join() still has a reference to the first
- * thread's object.
- */
-
- /* if the thread is not in the hash it has been removed already */
- if (!removed) {
- mono_domain_unset ();
- mono_memory_barrier ();
-
- if (mono_thread_cleanup_fn)
- mono_thread_cleanup_fn (thread_get_tid (thread));
-
- goto done;
- }
-
- mono_release_type_locks (thread);
-
- /* Can happen when we attach the profiler helper thread in order to heapshot. */
- if (!mono_thread_info_lookup (MONO_UINT_TO_NATIVE_THREAD_ID (thread->tid))->tools_thread)
- MONO_PROFILER_RAISE (thread_stopped, (thread->tid));
-
- mono_hazard_pointer_clear (mono_hazard_pointer_get (), 1);
-
- /*
- * This will signal async signal handlers that the thread has exited.
- * The profiler callback needs this to be set, so it cannot be done earlier.
- */
- mono_domain_unset ();
- mono_memory_barrier ();
-
- if (thread == mono_thread_internal_current ())
- mono_thread_pop_appdomain_ref ();
-
- mono_free_static_data (thread->static_data);
- thread->static_data = NULL;
- ref_stack_destroy (thread->appdomain_refs);
- thread->appdomain_refs = NULL;
-
- g_assert (thread->suspended);
- mono_os_event_destroy (thread->suspended);
- g_free (thread->suspended);
- thread->suspended = NULL;
-
- if (mono_thread_cleanup_fn)
- mono_thread_cleanup_fn (thread_get_tid (thread));
-
- mono_memory_barrier ();
-
- if (mono_gc_is_moving ()) {
- MONO_GC_UNREGISTER_ROOT (thread->thread_pinning_ref);
- thread->thread_pinning_ref = NULL;
- }
-
-done:
- SET_CURRENT_OBJECT (NULL);
- mono_domain_unset ();
-
- mono_thread_info_unset_internal_thread_gchandle ((MonoThreadInfo*) thread->thread_info);
-
- /* Don't need to close the handle to this thread, even though we took a
- * reference in mono_thread_attach (), because the GC will do it
- * when the Thread object is finalised.
- */
-}
-
/**
* mono_thread_detach:
*/
return TRUE;
}
+void
+mono_thread_self_abort (void)
+{
+ MonoError error;
+ self_abort_internal (&error);
+ mono_error_set_pending_exception (&error);
+}
+
/*
* mono_thread_get_undeniable_exception:
*
#define WSAEHOSTDOWN 10064
#define WSAEHOSTUNREACH 10065
#define WSASYSCALLFAILURE 10107
+#define WSAENXIO 100001
#endif
#include "w32file-unix-glob.h"
#include "w32handle.h"
#include "w32error.h"
+#include "fdhandle.h"
#include "utils/mono-io-portability.h"
#include "utils/mono-logger-internals.h"
#include "utils/mono-os-mutex.h"
/* Currently used for both FILE, CONSOLE and PIPE handle types.
* This may have to change in future. */
typedef struct {
+ MonoFDHandle fdhandle;
gchar *filename;
FileShare *share_info; /* Pointer into shared mem */
- gint fd;
guint32 security_attributes;
guint32 fileaccess;
guint32 sharemode;
guint32 attrs;
-} MonoW32HandleFile;
+} FileHandle;
typedef struct {
gchar **namelist;
filetime->dwHighDateTime = ticks >> 32;
}
+static FileHandle*
+file_data_create (MonoFDType type, gint fd)
+{
+ FileHandle *filehandle;
+
+ filehandle = g_new0 (FileHandle, 1);
+ mono_fdhandle_init ((MonoFDHandle*) filehandle, type, fd);
+
+ return filehandle;
+}
+
+static gint
+_wapi_unlink (const gchar *pathname);
+
+static void
+file_share_release (FileShare *share_info);
+
+static void
+file_data_close (MonoFDHandle *fdhandle)
+{
+ FileHandle* filehandle;
+
+ filehandle = (FileHandle*) fdhandle;
+ g_assert (filehandle);
+
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: closing fd %d", __func__, ((MonoFDHandle*) filehandle)->fd);
+
+ if (((MonoFDHandle*) filehandle)->type == MONO_FDTYPE_FILE && (filehandle->attrs & FILE_FLAG_DELETE_ON_CLOSE)) {
+ _wapi_unlink (filehandle->filename);
+ }
+
+ if (((MonoFDHandle*) filehandle)->type != MONO_FDTYPE_CONSOLE || ((MonoFDHandle*) filehandle)->fd > 2) {
+ if (filehandle->share_info) {
+ file_share_release (filehandle->share_info);
+ filehandle->share_info = NULL;
+ }
+
+ MONO_ENTER_GC_SAFE;
+ close (((MonoFDHandle*) filehandle)->fd);
+ MONO_EXIT_GC_SAFE;
+ }
+}
+
+static void
+file_data_destroy (MonoFDHandle *fdhandle)
+{
+ FileHandle *filehandle;
+
+ filehandle = (FileHandle*) fdhandle;
+ g_assert (filehandle);
+
+ if (filehandle->filename)
+ g_free (filehandle->filename);
+
+ g_free (filehandle);
+}
+
static void
file_share_release (FileShare *share_info)
{
g_assert (share_info->handle_refs > 0);
share_info->handle_refs -= 1;
- if (share_info->handle_refs == 0)
+ if (share_info->handle_refs == 0) {
g_hash_table_remove (file_share_table, share_info);
+ // g_free (share_info);
+ }
mono_coop_mutex_unlock (&file_share_mutex);
}
return TRUE;
}
-static void file_close (gpointer handle, gpointer data);
-static void file_details (gpointer data);
-static const gchar* file_typename (void);
-static gsize file_typesize (void);
-static gint file_getfiletype(void);
-static gboolean file_read(gpointer handle, gpointer buffer, guint32 numbytes, guint32 *bytesread);
-static gboolean file_write(gpointer handle, gconstpointer buffer, guint32 numbytes, guint32 *byteswritten);
-static gboolean file_flush(gpointer handle);
-static guint32 file_seek(gpointer handle, gint32 movedistance,
- gint32 *highmovedistance, gint method);
-static gboolean file_setendoffile(gpointer handle);
-static guint32 file_getfilesize(gpointer handle, guint32 *highsize);
-static gboolean file_getfiletime(gpointer handle, FILETIME *create_time,
- FILETIME *access_time,
- FILETIME *write_time);
-static gboolean file_setfiletime(gpointer handle,
- const FILETIME *create_time,
- const FILETIME *access_time,
- const FILETIME *write_time);
-static guint32 GetDriveTypeFromPath (const gchar *utf8_root_path_name);
-
-/* File handle is only signalled for overlapped IO */
-static MonoW32HandleOps _wapi_file_ops = {
- file_close, /* close */
- NULL, /* signal */
- NULL, /* own */
- NULL, /* is_owned */
- NULL, /* special_wait */
- NULL, /* prewait */
- file_details, /* details */
- file_typename, /* typename */
- file_typesize, /* typesize */
-};
-
-static void console_close (gpointer handle, gpointer data);
-static void console_details (gpointer data);
-static const gchar* console_typename (void);
-static gsize console_typesize (void);
-static gint console_getfiletype(void);
-static gboolean console_read(gpointer handle, gpointer buffer, guint32 numbytes, guint32 *bytesread);
-static gboolean console_write(gpointer handle, gconstpointer buffer, guint32 numbytes, guint32 *byteswritten);
-
-/* Console is mostly the same as file, except it can block waiting for
- * input or output
- */
-static MonoW32HandleOps _wapi_console_ops = {
- console_close, /* close */
- NULL, /* signal */
- NULL, /* own */
- NULL, /* is_owned */
- NULL, /* special_wait */
- NULL, /* prewait */
- console_details, /* details */
- console_typename, /* typename */
- console_typesize, /* typesize */
-};
+static const gchar* find_typename (void)
+{
+ return "Find";
+}
-static const gchar* find_typename (void);
-static gsize find_typesize (void);
+static gsize find_typesize (void)
+{
+ return sizeof (MonoW32HandleFind);
+}
static MonoW32HandleOps _wapi_find_ops = {
NULL, /* close */
find_typesize, /* typesize */
};
-static void pipe_close (gpointer handle, gpointer data);
-static void pipe_details (gpointer data);
-static const gchar* pipe_typename (void);
-static gsize pipe_typesize (void);
-static gint pipe_getfiletype (void);
-static gboolean pipe_read (gpointer handle, gpointer buffer, guint32 numbytes, guint32 *bytesread);
-static gboolean pipe_write (gpointer handle, gconstpointer buffer, guint32 numbytes, guint32 *byteswritten);
-
-/* Pipe handles
- */
-static MonoW32HandleOps _wapi_pipe_ops = {
- pipe_close, /* close */
- NULL, /* signal */
- NULL, /* own */
- NULL, /* is_owned */
- NULL, /* special_wait */
- NULL, /* prewait */
- pipe_details, /* details */
- pipe_typename, /* typename */
- pipe_typesize, /* typesize */
-};
-
-static const struct {
- /* File, console and pipe handles */
- gint (*getfiletype)(void);
-
- /* File, console and pipe handles */
- gboolean (*readfile)(gpointer handle, gpointer buffer, guint32 numbytes, guint32 *bytesread);
- gboolean (*writefile)(gpointer handle, gconstpointer buffer, guint32 numbytes, guint32 *byteswritten);
- gboolean (*flushfile)(gpointer handle);
-
- /* File handles */
- guint32 (*seek)(gpointer handle, gint32 movedistance,
- gint32 *highmovedistance, gint method);
- gboolean (*setendoffile)(gpointer handle);
- guint32 (*getfilesize)(gpointer handle, guint32 *highsize);
- gboolean (*getfiletime)(gpointer handle, FILETIME *create_time,
- FILETIME *access_time,
- FILETIME *write_time);
- gboolean (*setfiletime)(gpointer handle,
- const FILETIME *create_time,
- const FILETIME *access_time,
- const FILETIME *write_time);
-} io_ops[MONO_W32HANDLE_COUNT]={
- {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
- /* file */
- {file_getfiletype,
- file_read, file_write,
- file_flush, file_seek,
- file_setendoffile,
- file_getfilesize,
- file_getfiletime,
- file_setfiletime},
- /* console */
- {console_getfiletype,
- console_read,
- console_write,
- NULL, NULL, NULL, NULL, NULL, NULL},
- /* thread */
- {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
- /* sem */
- {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
- /* mutex */
- {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
- /* event */
- {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
- /* socket (will need at least read and write) */
- {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
- /* find */
- {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
- /* process */
- {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
- /* pipe */
- {pipe_getfiletype,
- pipe_read,
- pipe_write,
- NULL, NULL, NULL, NULL, NULL, NULL},
-};
-
static gboolean lock_while_writing = FALSE;
/* Some utility functions.
}
}
-/* Handle ops.
- */
-static void file_close (gpointer handle, gpointer data)
-{
- /* FIXME: after mono_w32handle_close is coop-aware, change this to MONO_REQ_GC_UNSAFE_MODE and leave just the switch to SAFE around close() below */
- MONO_ENTER_GC_UNSAFE;
- MonoW32HandleFile *file_handle = (MonoW32HandleFile *)data;
- gint fd = file_handle->fd;
-
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: closing file handle %p [%s]", __func__, handle,
- file_handle->filename);
-
- if (file_handle->attrs & FILE_FLAG_DELETE_ON_CLOSE)
- _wapi_unlink (file_handle->filename);
-
- g_free (file_handle->filename);
-
- if (file_handle->share_info)
- file_share_release (file_handle->share_info);
-
- MONO_ENTER_GC_SAFE;
- close (fd);
- MONO_EXIT_GC_SAFE;
- MONO_EXIT_GC_UNSAFE;
-}
-
-static void file_details (gpointer data)
-{
- MonoW32HandleFile *file = (MonoW32HandleFile *)data;
-
- g_print ("[%20s] acc: %c%c%c, shr: %c%c%c, attrs: %5u",
- file->filename,
- file->fileaccess&GENERIC_READ?'R':'.',
- file->fileaccess&GENERIC_WRITE?'W':'.',
- file->fileaccess&GENERIC_EXECUTE?'X':'.',
- file->sharemode&FILE_SHARE_READ?'R':'.',
- file->sharemode&FILE_SHARE_WRITE?'W':'.',
- file->sharemode&FILE_SHARE_DELETE?'D':'.',
- file->attrs);
-}
-
-static const gchar* file_typename (void)
-{
- return "File";
-}
-
-static gsize file_typesize (void)
-{
- return sizeof (MonoW32HandleFile);
-}
-
-static gint file_getfiletype(void)
-{
- return(FILE_TYPE_DISK);
-}
-
static gboolean
-file_read(gpointer handle, gpointer buffer, guint32 numbytes, guint32 *bytesread)
+file_read(FileHandle *filehandle, gpointer buffer, guint32 numbytes, guint32 *bytesread)
{
- MonoW32HandleFile *file_handle;
- gboolean ok;
- gint fd, ret;
+ gint ret;
MonoThreadInfo *info = mono_thread_info_current ();
-
- ok=mono_w32handle_lookup (handle, MONO_W32HANDLE_FILE,
- (gpointer *)&file_handle);
- if(ok==FALSE) {
- g_warning ("%s: error looking up file handle %p", __func__,
- handle);
- mono_w32error_set_last (ERROR_INVALID_HANDLE);
- return(FALSE);
- }
- fd = file_handle->fd;
if(bytesread!=NULL) {
*bytesread=0;
}
- if(!(file_handle->fileaccess & GENERIC_READ) &&
- !(file_handle->fileaccess & GENERIC_ALL)) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p doesn't have GENERIC_READ access: %u",
- __func__, handle, file_handle->fileaccess);
+ if(!(filehandle->fileaccess & (GENERIC_READ | GENERIC_ALL))) {
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fd %d doesn't have GENERIC_READ access: %u", __func__, ((MonoFDHandle*) filehandle)->fd, filehandle->fileaccess);
mono_w32error_set_last (ERROR_ACCESS_DENIED);
return(FALSE);
do {
MONO_ENTER_GC_SAFE;
- ret = read (fd, buffer, numbytes);
+ ret = read (((MonoFDHandle*) filehandle)->fd, buffer, numbytes);
MONO_EXIT_GC_SAFE;
} while (ret == -1 && errno == EINTR &&
!mono_thread_info_is_interrupt_state (info));
if(ret==-1) {
gint err = errno;
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: read of handle %p error: %s", __func__,
- handle, strerror(err));
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: read of fd %d error: %s", __func__, ((MonoFDHandle*) filehandle)->fd, g_strerror(err));
mono_w32error_set_last (mono_w32error_unix_to_win32 (err));
return(FALSE);
}
}
static gboolean
-file_write(gpointer handle, gconstpointer buffer, guint32 numbytes, guint32 *byteswritten)
+file_write(FileHandle *filehandle, gconstpointer buffer, guint32 numbytes, guint32 *byteswritten)
{
- MonoW32HandleFile *file_handle;
- gboolean ok;
- gint ret, fd;
+ gint ret;
off_t current_pos = 0;
MonoThreadInfo *info = mono_thread_info_current ();
- ok=mono_w32handle_lookup (handle, MONO_W32HANDLE_FILE,
- (gpointer *)&file_handle);
- if(ok==FALSE) {
- g_warning ("%s: error looking up file handle %p", __func__,
- handle);
- mono_w32error_set_last (ERROR_INVALID_HANDLE);
- return(FALSE);
- }
-
- fd = file_handle->fd;
-
if(byteswritten!=NULL) {
*byteswritten=0;
}
- if(!(file_handle->fileaccess & GENERIC_WRITE) &&
- !(file_handle->fileaccess & GENERIC_ALL)) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p doesn't have GENERIC_WRITE access: %u", __func__, handle, file_handle->fileaccess);
+ if(!(filehandle->fileaccess & GENERIC_WRITE) && !(filehandle->fileaccess & GENERIC_ALL)) {
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fd %d doesn't have GENERIC_WRITE access: %u", __func__, ((MonoFDHandle*) filehandle)->fd, filehandle->fileaccess);
mono_w32error_set_last (ERROR_ACCESS_DENIED);
return(FALSE);
* systems
*/
MONO_ENTER_GC_SAFE;
- current_pos = lseek (fd, (off_t)0, SEEK_CUR);
+ current_pos = lseek (((MonoFDHandle*) filehandle)->fd, (off_t)0, SEEK_CUR);
MONO_EXIT_GC_SAFE;
if (current_pos == -1) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p lseek failed: %s", __func__,
- handle, strerror (errno));
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fd %d lseek failed: %s", __func__, ((MonoFDHandle*) filehandle)->fd, g_strerror (errno));
_wapi_set_last_error_from_errno ();
return(FALSE);
}
- if (_wapi_lock_file_region (fd, current_pos,
- numbytes) == FALSE) {
+ if (_wapi_lock_file_region (((MonoFDHandle*) filehandle)->fd, current_pos, numbytes) == FALSE) {
/* The error has already been set */
return(FALSE);
}
do {
MONO_ENTER_GC_SAFE;
- ret = write (fd, buffer, numbytes);
+ ret = write (((MonoFDHandle*) filehandle)->fd, buffer, numbytes);
MONO_EXIT_GC_SAFE;
} while (ret == -1 && errno == EINTR &&
!mono_thread_info_is_interrupt_state (info));
if (lock_while_writing) {
- _wapi_unlock_file_region (fd, current_pos, numbytes);
+ _wapi_unlock_file_region (((MonoFDHandle*) filehandle)->fd, current_pos, numbytes);
}
if (ret == -1) {
} else {
_wapi_set_last_error_from_errno ();
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: write of handle %p error: %s",
- __func__, handle, strerror(errno));
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: write of fd %d error: %s", __func__, ((MonoFDHandle*) filehandle)->fd, g_strerror(errno));
return(FALSE);
}
return(TRUE);
}
-static gboolean file_flush(gpointer handle)
+static gboolean file_flush(FileHandle *filehandle)
{
- MonoW32HandleFile *file_handle;
- gboolean ok;
- gint ret, fd;
-
- ok=mono_w32handle_lookup (handle, MONO_W32HANDLE_FILE,
- (gpointer *)&file_handle);
- if(ok==FALSE) {
- g_warning ("%s: error looking up file handle %p", __func__,
- handle);
- mono_w32error_set_last (ERROR_INVALID_HANDLE);
- return(FALSE);
- }
-
- fd = file_handle->fd;
+ gint ret;
- if(!(file_handle->fileaccess & GENERIC_WRITE) &&
- !(file_handle->fileaccess & GENERIC_ALL)) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p doesn't have GENERIC_WRITE access: %u", __func__, handle, file_handle->fileaccess);
+ if(!(filehandle->fileaccess & (GENERIC_WRITE | GENERIC_ALL))) {
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fd %d doesn't have GENERIC_WRITE access: %u", __func__, ((MonoFDHandle*) filehandle)->fd, filehandle->fileaccess);
mono_w32error_set_last (ERROR_ACCESS_DENIED);
return(FALSE);
}
MONO_ENTER_GC_SAFE;
- ret=fsync(fd);
+ ret=fsync(((MonoFDHandle*) filehandle)->fd);
MONO_EXIT_GC_SAFE;
if (ret==-1) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fsync of handle %p error: %s", __func__, handle,
- strerror(errno));
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fsync of fd %d error: %s", __func__, ((MonoFDHandle*) filehandle)->fd, g_strerror(errno));
_wapi_set_last_error_from_errno ();
return(FALSE);
return(TRUE);
}
-static guint32 file_seek(gpointer handle, gint32 movedistance,
+static guint32 file_seek(FileHandle *filehandle, gint32 movedistance,
gint32 *highmovedistance, gint method)
{
- MonoW32HandleFile *file_handle;
- gboolean ok;
gint64 offset, newpos;
- gint whence, fd;
+ gint whence;
guint32 ret;
-
- ok=mono_w32handle_lookup (handle, MONO_W32HANDLE_FILE,
- (gpointer *)&file_handle);
- if(ok==FALSE) {
- g_warning ("%s: error looking up file handle %p", __func__,
- handle);
- mono_w32error_set_last (ERROR_INVALID_HANDLE);
- return(INVALID_SET_FILE_POINTER);
- }
-
- fd = file_handle->fd;
- if(!(file_handle->fileaccess & GENERIC_READ) &&
- !(file_handle->fileaccess & GENERIC_WRITE) &&
- !(file_handle->fileaccess & GENERIC_ALL)) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p doesn't have GENERIC_READ or GENERIC_WRITE access: %u", __func__, handle, file_handle->fileaccess);
+ if(!(filehandle->fileaccess & (GENERIC_READ | GENERIC_WRITE | GENERIC_ALL))) {
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fd %d doesn't have GENERIC_READ or GENERIC_WRITE access: %u", __func__, ((MonoFDHandle*) filehandle)->fd, filehandle->fileaccess);
mono_w32error_set_last (ERROR_ACCESS_DENIED);
return(INVALID_SET_FILE_POINTER);
offset=movedistance;
#endif
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: moving handle %p by %" G_GINT64_FORMAT " bytes from %d", __func__,
- handle, offset, whence);
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: moving fd %d by %" G_GINT64_FORMAT " bytes from %d", __func__, ((MonoFDHandle*) filehandle)->fd, offset, whence);
#ifdef PLATFORM_ANDROID
/* bionic doesn't support -D_FILE_OFFSET_BITS=64 */
MONO_ENTER_GC_SAFE;
- newpos=lseek64(fd, offset, whence);
+ newpos=lseek64(((MonoFDHandle*) filehandle)->fd, offset, whence);
MONO_EXIT_GC_SAFE;
#else
MONO_ENTER_GC_SAFE;
- newpos=lseek(fd, offset, whence);
+ newpos=lseek(((MonoFDHandle*) filehandle)->fd, offset, whence);
MONO_EXIT_GC_SAFE;
#endif
if(newpos==-1) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: lseek on handle %p returned error %s",
- __func__, handle, strerror(errno));
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: lseek on fd %d returned error %s", __func__, ((MonoFDHandle*) filehandle)->fd, g_strerror(errno));
_wapi_set_last_error_from_errno ();
return(INVALID_SET_FILE_POINTER);
}
#endif
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: move of handle %p returning %" G_GUINT32_FORMAT "/%" G_GINT32_FORMAT, __func__,
- handle, ret, highmovedistance==NULL?0:*highmovedistance);
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: move of fd %d returning %" G_GUINT32_FORMAT "/%" G_GINT32_FORMAT, __func__, ((MonoFDHandle*) filehandle)->fd, ret, highmovedistance==NULL?0:*highmovedistance);
return(ret);
}
-static gboolean file_setendoffile(gpointer handle)
+static gboolean file_setendoffile(FileHandle *filehandle)
{
- MonoW32HandleFile *file_handle;
- gboolean ok;
struct stat statbuf;
off_t pos;
- gint ret, fd;
+ gint ret;
MonoThreadInfo *info = mono_thread_info_current ();
- ok=mono_w32handle_lookup (handle, MONO_W32HANDLE_FILE,
- (gpointer *)&file_handle);
- if(ok==FALSE) {
- g_warning ("%s: error looking up file handle %p", __func__,
- handle);
- mono_w32error_set_last (ERROR_INVALID_HANDLE);
- return(FALSE);
- }
- fd = file_handle->fd;
-
- if(!(file_handle->fileaccess & GENERIC_WRITE) &&
- !(file_handle->fileaccess & GENERIC_ALL)) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p doesn't have GENERIC_WRITE access: %u", __func__, handle, file_handle->fileaccess);
+ if(!(filehandle->fileaccess & (GENERIC_WRITE | GENERIC_ALL))) {
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fd %d doesn't have GENERIC_WRITE access: %u", __func__, ((MonoFDHandle*) filehandle)->fd, filehandle->fileaccess);
mono_w32error_set_last (ERROR_ACCESS_DENIED);
return(FALSE);
*/
MONO_ENTER_GC_SAFE;
- ret=fstat(fd, &statbuf);
+ ret=fstat(((MonoFDHandle*) filehandle)->fd, &statbuf);
MONO_EXIT_GC_SAFE;
if(ret==-1) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p fstat failed: %s", __func__,
- handle, strerror(errno));
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fd %d fstat failed: %s", __func__, ((MonoFDHandle*) filehandle)->fd, g_strerror(errno));
_wapi_set_last_error_from_errno ();
return(FALSE);
}
MONO_ENTER_GC_SAFE;
- pos=lseek(fd, (off_t)0, SEEK_CUR);
+ pos=lseek(((MonoFDHandle*) filehandle)->fd, (off_t)0, SEEK_CUR);
MONO_EXIT_GC_SAFE;
if(pos==-1) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p lseek failed: %s", __func__,
- handle, strerror(errno));
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fd %d lseek failed: %s", __func__, ((MonoFDHandle*) filehandle)->fd, g_strerror(errno));
_wapi_set_last_error_from_errno ();
return(FALSE);
*/
do {
MONO_ENTER_GC_SAFE;
- ret = write (fd, "", 1);
+ ret = write (((MonoFDHandle*) filehandle)->fd, "", 1);
MONO_EXIT_GC_SAFE;
} while (ret == -1 && errno == EINTR &&
!mono_thread_info_is_interrupt_state (info));
if(ret==-1) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p extend write failed: %s", __func__, handle, strerror(errno));
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fd %d extend write failed: %s", __func__, ((MonoFDHandle*) filehandle)->fd, g_strerror(errno));
_wapi_set_last_error_from_errno ();
return(FALSE);
/* And put the file position back after the write */
MONO_ENTER_GC_SAFE;
- ret = lseek (fd, pos, SEEK_SET);
+ ret = lseek (((MonoFDHandle*) filehandle)->fd, pos, SEEK_SET);
MONO_EXIT_GC_SAFE;
if (ret == -1) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p second lseek failed: %s",
- __func__, handle, strerror(errno));
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fd %d second lseek failed: %s", __func__, ((MonoFDHandle*) filehandle)->fd, g_strerror(errno));
_wapi_set_last_error_from_errno ();
return(FALSE);
*/
do {
MONO_ENTER_GC_SAFE;
- ret=ftruncate(fd, pos);
+ ret=ftruncate(((MonoFDHandle*) filehandle)->fd, pos);
MONO_EXIT_GC_SAFE;
}
while (ret==-1 && errno==EINTR && !mono_thread_info_is_interrupt_state (info));
if(ret==-1) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p ftruncate failed: %s", __func__,
- handle, strerror(errno));
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fd %d ftruncate failed: %s", __func__, ((MonoFDHandle*) filehandle)->fd, g_strerror(errno));
_wapi_set_last_error_from_errno ();
return(FALSE);
return(TRUE);
}
-static guint32 file_getfilesize(gpointer handle, guint32 *highsize)
+static guint32 file_getfilesize(FileHandle *filehandle, guint32 *highsize)
{
- MonoW32HandleFile *file_handle;
- gboolean ok;
struct stat statbuf;
guint32 size;
gint ret;
- gint fd;
- ok=mono_w32handle_lookup (handle, MONO_W32HANDLE_FILE,
- (gpointer *)&file_handle);
- if(ok==FALSE) {
- g_warning ("%s: error looking up file handle %p", __func__,
- handle);
- mono_w32error_set_last (ERROR_INVALID_HANDLE);
- return(INVALID_FILE_SIZE);
- }
- fd = file_handle->fd;
-
- if(!(file_handle->fileaccess & GENERIC_READ) &&
- !(file_handle->fileaccess & GENERIC_WRITE) &&
- !(file_handle->fileaccess & GENERIC_ALL)) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p doesn't have GENERIC_READ or GENERIC_WRITE access: %u", __func__, handle, file_handle->fileaccess);
+ if(!(filehandle->fileaccess & (GENERIC_READ | GENERIC_WRITE | GENERIC_ALL))) {
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fd %d doesn't have GENERIC_READ or GENERIC_WRITE access: %u", __func__, ((MonoFDHandle*) filehandle)->fd, filehandle->fileaccess);
mono_w32error_set_last (ERROR_ACCESS_DENIED);
return(INVALID_FILE_SIZE);
mono_w32error_set_last (ERROR_SUCCESS);
MONO_ENTER_GC_SAFE;
- ret = fstat(fd, &statbuf);
+ ret = fstat(((MonoFDHandle*) filehandle)->fd, &statbuf);
MONO_EXIT_GC_SAFE;
if (ret == -1) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p fstat failed: %s", __func__,
- handle, strerror(errno));
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fd %d fstat failed: %s", __func__, ((MonoFDHandle*) filehandle)->fd, g_strerror(errno));
_wapi_set_last_error_from_errno ();
return(INVALID_FILE_SIZE);
guint64 bigsize;
gint res;
MONO_ENTER_GC_SAFE;
- res = ioctl (fd, BLKGETSIZE64, &bigsize);
+ res = ioctl (((MonoFDHandle*) filehandle)->fd, BLKGETSIZE64, &bigsize);
MONO_EXIT_GC_SAFE;
if (res < 0) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p ioctl BLKGETSIZE64 failed: %s",
- __func__, handle, strerror(errno));
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fd %d ioctl BLKGETSIZE64 failed: %s", __func__, ((MonoFDHandle*) filehandle)->fd, g_strerror(errno));
_wapi_set_last_error_from_errno ();
return(INVALID_FILE_SIZE);
return(size);
}
-static gboolean file_getfiletime(gpointer handle, FILETIME *create_time,
+static gboolean file_getfiletime(FileHandle *filehandle, FILETIME *create_time,
FILETIME *access_time,
FILETIME *write_time)
{
- MonoW32HandleFile *file_handle;
- gboolean ok;
struct stat statbuf;
guint64 create_ticks, access_ticks, write_ticks;
- gint ret, fd;
-
- ok=mono_w32handle_lookup (handle, MONO_W32HANDLE_FILE,
- (gpointer *)&file_handle);
- if(ok==FALSE) {
- g_warning ("%s: error looking up file handle %p", __func__,
- handle);
- mono_w32error_set_last (ERROR_INVALID_HANDLE);
- return(FALSE);
- }
- fd = file_handle->fd;
+ gint ret;
- if(!(file_handle->fileaccess & GENERIC_READ) &&
- !(file_handle->fileaccess & GENERIC_ALL)) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p doesn't have GENERIC_READ access: %u",
- __func__, handle, file_handle->fileaccess);
+ if(!(filehandle->fileaccess & (GENERIC_READ | GENERIC_ALL))) {
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fd %d doesn't have GENERIC_READ access: %u", __func__, ((MonoFDHandle*) filehandle)->fd, filehandle->fileaccess);
mono_w32error_set_last (ERROR_ACCESS_DENIED);
return(FALSE);
}
MONO_ENTER_GC_SAFE;
- ret=fstat(fd, &statbuf);
+ ret=fstat(((MonoFDHandle*) filehandle)->fd, &statbuf);
MONO_EXIT_GC_SAFE;
if(ret==-1) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p fstat failed: %s", __func__, handle,
- strerror(errno));
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fd %d fstat failed: %s", __func__, ((MonoFDHandle*) filehandle)->fd, g_strerror(errno));
_wapi_set_last_error_from_errno ();
return(FALSE);
return(TRUE);
}
-static gboolean file_setfiletime(gpointer handle,
+static gboolean file_setfiletime(FileHandle *filehandle,
const FILETIME *create_time G_GNUC_UNUSED,
const FILETIME *access_time,
const FILETIME *write_time)
{
- MonoW32HandleFile *file_handle;
- gboolean ok;
struct utimbuf utbuf;
struct stat statbuf;
guint64 access_ticks, write_ticks;
- gint ret, fd;
+ gint ret;
- ok=mono_w32handle_lookup (handle, MONO_W32HANDLE_FILE,
- (gpointer *)&file_handle);
- if(ok==FALSE) {
- g_warning ("%s: error looking up file handle %p", __func__,
- handle);
- mono_w32error_set_last (ERROR_INVALID_HANDLE);
- return(FALSE);
- }
- fd = file_handle->fd;
- if(!(file_handle->fileaccess & GENERIC_WRITE) &&
- !(file_handle->fileaccess & GENERIC_ALL)) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p doesn't have GENERIC_WRITE access: %u", __func__, handle, file_handle->fileaccess);
+ if(!(filehandle->fileaccess & (GENERIC_WRITE | GENERIC_ALL))) {
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fd %d doesn't have GENERIC_WRITE access: %u", __func__, ((MonoFDHandle*) filehandle)->fd, filehandle->fileaccess);
mono_w32error_set_last (ERROR_ACCESS_DENIED);
return(FALSE);
}
- if(file_handle->filename == NULL) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p unknown filename", __func__, handle);
+ if(filehandle->filename == NULL) {
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fd %d unknown filename", __func__, ((MonoFDHandle*) filehandle)->fd);
mono_w32error_set_last (ERROR_INVALID_HANDLE);
return(FALSE);
* the event that one of the FileTime structs is NULL
*/
MONO_ENTER_GC_SAFE;
- ret=fstat (fd, &statbuf);
+ ret=fstat (((MonoFDHandle*) filehandle)->fd, &statbuf);
MONO_EXIT_GC_SAFE;
if(ret==-1) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p fstat failed: %s", __func__, handle,
- strerror(errno));
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fd %d fstat failed: %s", __func__, ((MonoFDHandle*) filehandle)->fd, g_strerror(errno));
mono_w32error_set_last (ERROR_INVALID_PARAMETER);
return(FALSE);
utbuf.modtime=statbuf.st_mtime;
}
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: setting handle %p access %ld write %ld", __func__,
- handle, utbuf.actime, utbuf.modtime);
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: setting fd %d access %ld write %ld", __func__,
+ ((MonoFDHandle*) filehandle)->fd, utbuf.actime, utbuf.modtime);
- ret = _wapi_utime (file_handle->filename, &utbuf);
+ ret = _wapi_utime (filehandle->filename, &utbuf);
if (ret == -1) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p [%s] utime failed: %s", __func__,
- handle, file_handle->filename, strerror(errno));
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fd %d [%s] utime failed: %s", __func__, ((MonoFDHandle*) filehandle)->fd, filehandle->filename, g_strerror(errno));
mono_w32error_set_last (ERROR_INVALID_PARAMETER);
return(FALSE);
return(TRUE);
}
-static void console_close (gpointer handle, gpointer data)
-{
- /* FIXME: after mono_w32handle_close is coop-aware, change this to MONO_REQ_GC_UNSAFE_MODE and leave just the switch to SAFE around close() below */
- MONO_ENTER_GC_UNSAFE;
- MonoW32HandleFile *console_handle = (MonoW32HandleFile *)data;
- gint fd = console_handle->fd;
-
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: closing console handle %p", __func__, handle);
-
- g_free (console_handle->filename);
-
- if (fd > 2) {
- if (console_handle->share_info)
- file_share_release (console_handle->share_info);
- MONO_ENTER_GC_SAFE;
- close (fd);
- MONO_EXIT_GC_SAFE;
- }
- MONO_EXIT_GC_UNSAFE;
-}
-
-static void console_details (gpointer data)
-{
- file_details (data);
-}
-
-static const gchar* console_typename (void)
-{
- return "Console";
-}
-
-static gsize console_typesize (void)
-{
- return sizeof (MonoW32HandleFile);
-}
-
-static gint console_getfiletype(void)
-{
- return(FILE_TYPE_CHAR);
-}
-
static gboolean
-console_read(gpointer handle, gpointer buffer, guint32 numbytes, guint32 *bytesread)
+console_read(FileHandle *filehandle, gpointer buffer, guint32 numbytes, guint32 *bytesread)
{
- MonoW32HandleFile *console_handle;
- gboolean ok;
- gint ret, fd;
+ gint ret;
MonoThreadInfo *info = mono_thread_info_current ();
- ok=mono_w32handle_lookup (handle, MONO_W32HANDLE_CONSOLE,
- (gpointer *)&console_handle);
- if(ok==FALSE) {
- g_warning ("%s: error looking up console handle %p", __func__,
- handle);
- mono_w32error_set_last (ERROR_INVALID_HANDLE);
- return(FALSE);
- }
- fd = console_handle->fd;
-
if(bytesread!=NULL) {
*bytesread=0;
}
- if(!(console_handle->fileaccess & GENERIC_READ) &&
- !(console_handle->fileaccess & GENERIC_ALL)) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p doesn't have GENERIC_READ access: %u",
- __func__, handle, console_handle->fileaccess);
+ if(!(filehandle->fileaccess & (GENERIC_READ | GENERIC_ALL))) {
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fd %d doesn't have GENERIC_READ access: %u", __func__, ((MonoFDHandle*) filehandle)->fd, filehandle->fileaccess);
mono_w32error_set_last (ERROR_ACCESS_DENIED);
return(FALSE);
do {
MONO_ENTER_GC_SAFE;
- ret=read(fd, buffer, numbytes);
+ ret=read(((MonoFDHandle*) filehandle)->fd, buffer, numbytes);
MONO_EXIT_GC_SAFE;
} while (ret==-1 && errno==EINTR && !mono_thread_info_is_interrupt_state (info));
if(ret==-1) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: read of handle %p error: %s", __func__, handle,
- strerror(errno));
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: read of fd %d error: %s", __func__, ((MonoFDHandle*) filehandle)->fd, g_strerror(errno));
_wapi_set_last_error_from_errno ();
return(FALSE);
}
static gboolean
-console_write(gpointer handle, gconstpointer buffer, guint32 numbytes, guint32 *byteswritten)
+console_write(FileHandle *filehandle, gconstpointer buffer, guint32 numbytes, guint32 *byteswritten)
{
- MonoW32HandleFile *console_handle;
- gboolean ok;
- gint ret, fd;
+ gint ret;
MonoThreadInfo *info = mono_thread_info_current ();
- ok=mono_w32handle_lookup (handle, MONO_W32HANDLE_CONSOLE,
- (gpointer *)&console_handle);
- if(ok==FALSE) {
- g_warning ("%s: error looking up console handle %p", __func__,
- handle);
- mono_w32error_set_last (ERROR_INVALID_HANDLE);
- return(FALSE);
- }
- fd = console_handle->fd;
-
if(byteswritten!=NULL) {
*byteswritten=0;
}
- if(!(console_handle->fileaccess & GENERIC_WRITE) &&
- !(console_handle->fileaccess & GENERIC_ALL)) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p doesn't have GENERIC_WRITE access: %u", __func__, handle, console_handle->fileaccess);
+ if(!(filehandle->fileaccess & (GENERIC_WRITE | GENERIC_ALL))) {
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fd %d doesn't have GENERIC_WRITE access: %u", __func__, ((MonoFDHandle*) filehandle)->fd, filehandle->fileaccess);
mono_w32error_set_last (ERROR_ACCESS_DENIED);
return(FALSE);
do {
MONO_ENTER_GC_SAFE;
- ret = write(fd, buffer, numbytes);
+ ret = write(((MonoFDHandle*) filehandle)->fd, buffer, numbytes);
MONO_EXIT_GC_SAFE;
} while (ret == -1 && errno == EINTR &&
!mono_thread_info_is_interrupt_state (info));
} else {
_wapi_set_last_error_from_errno ();
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: write of handle %p error: %s",
- __func__, handle, strerror(errno));
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: write of fd %d error: %s", __func__, ((MonoFDHandle*) filehandle)->fd, g_strerror(errno));
return(FALSE);
}
return(TRUE);
}
-static const gchar* find_typename (void)
-{
- return "Find";
-}
-
-static gsize find_typesize (void)
-{
- return sizeof (MonoW32HandleFind);
-}
-
-static void pipe_close (gpointer handle, gpointer data)
-{
- /* FIXME: after mono_w32handle_close is coop-aware, change this to MONO_REQ_GC_UNSAFE_MODE and leave just the switch to SAFE around close() below */
- MONO_ENTER_GC_UNSAFE;
- MonoW32HandleFile *pipe_handle = (MonoW32HandleFile*)data;
- gint fd = pipe_handle->fd;
-
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: closing pipe handle %p fd %d", __func__, handle, fd);
-
- /* No filename with pipe handles */
-
- if (pipe_handle->share_info)
- file_share_release (pipe_handle->share_info);
-
- MONO_ENTER_GC_SAFE;
- close (fd);
- MONO_EXIT_GC_SAFE;
- MONO_EXIT_GC_UNSAFE;
-}
-
-static void pipe_details (gpointer data)
-{
- file_details (data);
-}
-
-static const gchar* pipe_typename (void)
-{
- return "Pipe";
-}
-
-static gsize pipe_typesize (void)
-{
- return sizeof (MonoW32HandleFile);
-}
-
-static gint pipe_getfiletype(void)
-{
- return(FILE_TYPE_PIPE);
-}
-
static gboolean
-pipe_read (gpointer handle, gpointer buffer, guint32 numbytes, guint32 *bytesread)
+pipe_read (FileHandle *filehandle, gpointer buffer, guint32 numbytes, guint32 *bytesread)
{
- MonoW32HandleFile *pipe_handle;
- gboolean ok;
- gint ret, fd;
+ gint ret;
MonoThreadInfo *info = mono_thread_info_current ();
- ok=mono_w32handle_lookup (handle, MONO_W32HANDLE_PIPE,
- (gpointer *)&pipe_handle);
- if(ok==FALSE) {
- g_warning ("%s: error looking up pipe handle %p", __func__,
- handle);
- mono_w32error_set_last (ERROR_INVALID_HANDLE);
- return(FALSE);
- }
- fd = pipe_handle->fd;
-
if(bytesread!=NULL) {
*bytesread=0;
}
- if(!(pipe_handle->fileaccess & GENERIC_READ) &&
- !(pipe_handle->fileaccess & GENERIC_ALL)) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p doesn't have GENERIC_READ access: %u",
- __func__, handle, pipe_handle->fileaccess);
+ if(!(filehandle->fileaccess & (GENERIC_READ | GENERIC_ALL))) {
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fd %d doesn't have GENERIC_READ access: %u", __func__, ((MonoFDHandle*) filehandle)->fd, filehandle->fileaccess);
mono_w32error_set_last (ERROR_ACCESS_DENIED);
return(FALSE);
}
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: reading up to %" G_GUINT32_FORMAT " bytes from pipe %p", __func__,
- numbytes, handle);
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: reading up to %" G_GUINT32_FORMAT " bytes from pipe %d", __func__, numbytes, ((MonoFDHandle*) filehandle)->fd);
do {
MONO_ENTER_GC_SAFE;
- ret=read(fd, buffer, numbytes);
+ ret=read(((MonoFDHandle*) filehandle)->fd, buffer, numbytes);
MONO_EXIT_GC_SAFE;
} while (ret==-1 && errno==EINTR && !mono_thread_info_is_interrupt_state (info));
} else {
_wapi_set_last_error_from_errno ();
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: read of handle %p error: %s", __func__,
- handle, strerror(errno));
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: read of fd %d error: %s", __func__,((MonoFDHandle*) filehandle)->fd, g_strerror(errno));
return(FALSE);
}
}
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: read %d bytes from pipe %p", __func__, ret, handle);
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: read %d bytes from pipe %d", __func__, ret, ((MonoFDHandle*) filehandle)->fd);
if(bytesread!=NULL) {
*bytesread=ret;
}
static gboolean
-pipe_write(gpointer handle, gconstpointer buffer, guint32 numbytes, guint32 *byteswritten)
+pipe_write(FileHandle *filehandle, gconstpointer buffer, guint32 numbytes, guint32 *byteswritten)
{
- MonoW32HandleFile *pipe_handle;
- gboolean ok;
- gint ret, fd;
+ gint ret;
MonoThreadInfo *info = mono_thread_info_current ();
- ok=mono_w32handle_lookup (handle, MONO_W32HANDLE_PIPE,
- (gpointer *)&pipe_handle);
- if(ok==FALSE) {
- g_warning ("%s: error looking up pipe handle %p", __func__,
- handle);
- mono_w32error_set_last (ERROR_INVALID_HANDLE);
- return(FALSE);
- }
- fd = pipe_handle->fd;
-
if(byteswritten!=NULL) {
*byteswritten=0;
}
- if(!(pipe_handle->fileaccess & GENERIC_WRITE) &&
- !(pipe_handle->fileaccess & GENERIC_ALL)) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p doesn't have GENERIC_WRITE access: %u", __func__, handle, pipe_handle->fileaccess);
+ if(!(filehandle->fileaccess & (GENERIC_WRITE | GENERIC_ALL))) {
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fd %d doesn't have GENERIC_WRITE access: %u", __func__, ((MonoFDHandle*) filehandle)->fd, filehandle->fileaccess);
mono_w32error_set_last (ERROR_ACCESS_DENIED);
return(FALSE);
}
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: writing up to %" G_GUINT32_FORMAT " bytes to pipe %p", __func__,
- numbytes, handle);
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: writing up to %" G_GUINT32_FORMAT " bytes to pipe %d", __func__, numbytes, ((MonoFDHandle*) filehandle)->fd);
do {
MONO_ENTER_GC_SAFE;
- ret = write (fd, buffer, numbytes);
+ ret = write (((MonoFDHandle*) filehandle)->fd, buffer, numbytes);
MONO_EXIT_GC_SAFE;
} while (ret == -1 && errno == EINTR &&
!mono_thread_info_is_interrupt_state (info));
} else {
_wapi_set_last_error_from_errno ();
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: write of handle %p error: %s", __func__,
- handle, strerror(errno));
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: write of fd %d error: %s", __func__,((MonoFDHandle*) filehandle)->fd, g_strerror(errno));
return(FALSE);
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Share mode prevents open: requested access: 0x%" PRIx32 ", file has sharing = NONE", __func__, fileaccess);
file_share_release (*share_info);
+ *share_info = NULL;
return(FALSE);
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Share mode prevents open: requested access: 0x%" PRIx32 ", file has sharing: 0x%" PRIx32, __func__, fileaccess, file_existing_share);
file_share_release (*share_info);
+ *share_info = NULL;
return(FALSE);
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Access mode prevents open: requested share: 0x%" PRIx32 ", file has access: 0x%" PRIx32, __func__, sharemode, file_existing_access);
file_share_release (*share_info);
+ *share_info = NULL;
return(FALSE);
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Share mode prevents open: requested access: 0x%" PRIx32 ", file has sharing = NONE", __func__, (*share_info)->access);
file_share_release (*share_info);
+ *share_info = NULL;
return(FALSE);
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Share mode prevents open: requested access: 0x%" PRIx32 ", file has sharing: 0x%" PRIx32, __func__, (*share_info)->access, file_existing_share);
file_share_release (*share_info);
+ *share_info = NULL;
return(FALSE);
}
gpointer
mono_w32file_create(const gunichar2 *name, guint32 fileaccess, guint32 sharemode, guint32 createmode, guint32 attrs)
{
- MonoW32HandleFile file_handle = {0};
- gpointer handle;
+ FileHandle *filehandle;
+ MonoFDType type;
gint flags=convert_flags(fileaccess, createmode);
/*mode_t perms=convert_perms(sharemode);*/
/* we don't use sharemode, because that relates to sharing of
mode_t perms=0666;
gchar *filename;
gint fd, ret;
- MonoW32HandleType handle_type;
struct stat statbuf;
if (attrs & FILE_ATTRIBUTE_TEMPORARY)
}
if (fd == -1) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Error opening file %s: %s", __func__, filename,
- strerror(errno));
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Error opening file %s: %s", __func__, filename, g_strerror(errno));
_wapi_set_last_path_error_from_errno (NULL, filename);
g_free (filename);
return(INVALID_HANDLE_VALUE);
}
- if (fd >= mono_w32handle_fd_reserve) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: File descriptor is too big", __func__);
-
- mono_w32error_set_last (ERROR_TOO_MANY_OPEN_FILES);
-
- MONO_ENTER_GC_SAFE;
- close (fd);
- MONO_EXIT_GC_SAFE;
- g_free (filename);
-
- return(INVALID_HANDLE_VALUE);
- }
-
MONO_ENTER_GC_SAFE;
ret = fstat (fd, &statbuf);
MONO_EXIT_GC_SAFE;
if (ret == -1) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fstat error of file %s: %s", __func__,
- filename, strerror (errno));
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fstat error of file %s: %s", __func__, filename, g_strerror (errno));
_wapi_set_last_error_from_errno ();
- g_free (filename);
MONO_ENTER_GC_SAFE;
close (fd);
MONO_EXIT_GC_SAFE;
-
+
return(INVALID_HANDLE_VALUE);
}
- if (share_allows_open (&statbuf, sharemode, fileaccess,
- &file_handle.share_info) == FALSE) {
- mono_w32error_set_last (ERROR_SHARING_VIOLATION);
+#ifndef S_ISFIFO
+#define S_ISFIFO(m) ((m & S_IFIFO) != 0)
+#endif
+ if (S_ISFIFO (statbuf.st_mode)) {
+ type = MONO_FDTYPE_PIPE;
+ /* maintain invariant that pipes have no filename */
g_free (filename);
+ filename = NULL;
+ } else if (S_ISCHR (statbuf.st_mode)) {
+ type = MONO_FDTYPE_CONSOLE;
+ } else {
+ type = MONO_FDTYPE_FILE;
+ }
+
+ filehandle = file_data_create (type, fd);
+ filehandle->filename = filename;
+ filehandle->fileaccess = fileaccess;
+ filehandle->sharemode = sharemode;
+ filehandle->attrs = attrs;
+
+ if (!share_allows_open (&statbuf, filehandle->sharemode, filehandle->fileaccess, &filehandle->share_info)) {
+ mono_w32error_set_last (ERROR_SHARING_VIOLATION);
MONO_ENTER_GC_SAFE;
- close (fd);
+ close (((MonoFDHandle*) filehandle)->fd);
MONO_EXIT_GC_SAFE;
+ mono_fdhandle_unref ((MonoFDHandle*) filehandle);
return (INVALID_HANDLE_VALUE);
}
- if (file_handle.share_info == NULL) {
+ if (!filehandle->share_info) {
/* No space, so no more files can be opened */
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: No space in the share table", __func__);
mono_w32error_set_last (ERROR_TOO_MANY_OPEN_FILES);
MONO_ENTER_GC_SAFE;
- close (fd);
+ close (((MonoFDHandle*) filehandle)->fd);
MONO_EXIT_GC_SAFE;
- g_free (filename);
+ mono_fdhandle_unref ((MonoFDHandle*) filehandle);
return(INVALID_HANDLE_VALUE);
}
-
- file_handle.filename = filename;
-
- file_handle.fd = fd;
- file_handle.fileaccess=fileaccess;
- file_handle.sharemode=sharemode;
- file_handle.attrs=attrs;
#ifdef HAVE_POSIX_FADVISE
if (attrs & FILE_FLAG_SEQUENTIAL_SCAN) {
MONO_ENTER_GC_SAFE;
- posix_fadvise (fd, 0, 0, POSIX_FADV_SEQUENTIAL);
+ posix_fadvise (((MonoFDHandle*) filehandle)->fd, 0, 0, POSIX_FADV_SEQUENTIAL);
MONO_EXIT_GC_SAFE;
}
if (attrs & FILE_FLAG_RANDOM_ACCESS) {
MONO_ENTER_GC_SAFE;
- posix_fadvise (fd, 0, 0, POSIX_FADV_RANDOM);
+ posix_fadvise (((MonoFDHandle*) filehandle)->fd, 0, 0, POSIX_FADV_RANDOM);
MONO_EXIT_GC_SAFE;
}
#endif
#ifdef F_RDAHEAD
if (attrs & FILE_FLAG_SEQUENTIAL_SCAN) {
MONO_ENTER_GC_SAFE;
- fcntl(fd, F_RDAHEAD, 1);
+ fcntl(((MonoFDHandle*) filehandle)->fd, F_RDAHEAD, 1);
MONO_EXIT_GC_SAFE;
}
#endif
-#ifndef S_ISFIFO
-#define S_ISFIFO(m) ((m & S_IFIFO) != 0)
-#endif
- if (S_ISFIFO (statbuf.st_mode)) {
- handle_type = MONO_W32HANDLE_PIPE;
- /* maintain invariant that pipes have no filename */
- file_handle.filename = NULL;
- g_free (filename);
- filename = NULL;
- } else if (S_ISCHR (statbuf.st_mode)) {
- handle_type = MONO_W32HANDLE_CONSOLE;
- } else {
- handle_type = MONO_W32HANDLE_FILE;
- }
+ mono_fdhandle_insert ((MonoFDHandle*) filehandle);
- MONO_ENTER_GC_SAFE; /* FIXME: mono_w32handle_new_fd should be updated with coop transitions */
- handle = mono_w32handle_new_fd (handle_type, fd, &file_handle);
- MONO_EXIT_GC_SAFE;
- if (handle == INVALID_HANDLE_VALUE) {
- g_warning ("%s: error creating file handle", __func__);
- g_free (filename);
- MONO_ENTER_GC_SAFE;
- close (fd);
- MONO_EXIT_GC_SAFE;
-
- mono_w32error_set_last (ERROR_GEN_FAILURE);
- return(INVALID_HANDLE_VALUE);
- }
-
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: returning handle %p", __func__, handle);
-
- return(handle);
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: returning handle %p", __func__, GINT_TO_POINTER(((MonoFDHandle*) filehandle)->fd));
+
+ return GINT_TO_POINTER(((MonoFDHandle*) filehandle)->fd);
}
gboolean
mono_w32file_close (gpointer handle)
{
- gboolean res;
- MONO_ENTER_GC_SAFE;
- /* FIXME: we transition here and not in file_close, pipe_close,
- * console_close because w32handle_close is not coop aware yet, but it
- * calls back into w32file. */
- res = mono_w32handle_close (handle);
- MONO_EXIT_GC_SAFE;
- return res;
+ if (!mono_fdhandle_close (GPOINTER_TO_INT (handle))) {
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
+ return FALSE;
+ }
+
+ return TRUE;
}
gboolean mono_w32file_delete(const gunichar2 *name)
mono_w32error_set_last (ERROR_SHARING_VIOLATION);
return FALSE;
}
- if (shareinfo)
+ if (shareinfo) {
file_share_release (shareinfo);
+ shareinfo = NULL;
+ }
result = _wapi_rename (utf8_name, utf8_dest_name);
errno_copy = errno;
ret_utime = utime (utf8_dest, &dest_time);
MONO_EXIT_GC_SAFE;
if (ret_utime == -1)
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: file [%s] utime failed: %s", __func__, utf8_dest, strerror(errno));
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: file [%s] utime failed: %s", __func__, utf8_dest, g_strerror(errno));
g_free (utf8_src);
g_free (utf8_dest);
return ret;
}
-static MonoCoopMutex stdhandle_mutex;
-
static gpointer
_wapi_stdhandle_create (gint fd, const gchar *name)
{
- gpointer handle;
gint flags;
- MonoW32HandleFile file_handle = {0};
+ FileHandle *filehandle;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: creating standard handle type %s, fd %d", __func__, name, fd);
/* Invalid fd. Not really much point checking for EBADF
* specifically
*/
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fcntl error on fd %d: %s", __func__, fd, strerror(errno));
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fcntl error on fd %d: %s", __func__, fd, g_strerror(errno));
mono_w32error_set_last (mono_w32error_unix_to_win32 (errno));
return INVALID_HANDLE_VALUE;
}
+ filehandle = file_data_create (MONO_FDTYPE_CONSOLE, fd);
+ filehandle->filename = g_strdup(name);
+
switch (flags & (O_RDONLY|O_WRONLY|O_RDWR)) {
case O_RDONLY:
- file_handle.fileaccess = GENERIC_READ;
+ filehandle->fileaccess = GENERIC_READ;
break;
case O_WRONLY:
- file_handle.fileaccess = GENERIC_WRITE;
+ filehandle->fileaccess = GENERIC_WRITE;
break;
case O_RDWR:
- file_handle.fileaccess = GENERIC_READ | GENERIC_WRITE;
+ filehandle->fileaccess = GENERIC_READ | GENERIC_WRITE;
break;
default:
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Can't figure out flags 0x%x", __func__, flags);
- file_handle.fileaccess = 0;
+ filehandle->fileaccess = 0;
break;
}
- file_handle.fd = fd;
- file_handle.filename = g_strdup(name);
/* some default security attributes might be needed */
- file_handle.security_attributes = 0;
+ filehandle->security_attributes = 0;
/* Apparently input handles can't be written to. (I don't
* know if output or error handles can't be read from.)
*/
if (fd == 0)
- file_handle.fileaccess &= ~GENERIC_WRITE;
+ filehandle->fileaccess &= ~GENERIC_WRITE;
- file_handle.sharemode = 0;
- file_handle.attrs = 0;
+ filehandle->sharemode = 0;
+ filehandle->attrs = 0;
- handle = mono_w32handle_new_fd (MONO_W32HANDLE_CONSOLE, fd, &file_handle);
- if (handle == INVALID_HANDLE_VALUE) {
- g_warning ("%s: error creating file handle", __func__);
- mono_w32error_set_last (ERROR_GEN_FAILURE);
- return INVALID_HANDLE_VALUE;
+ if (!mono_fdhandle_try_insert ((MonoFDHandle*) filehandle)) {
+ /* we raced between 2 invocations of _wapi_stdhandle_create */
+ mono_fdhandle_unref ((MonoFDHandle*) filehandle);
+ return GINT_TO_POINTER(fd);
}
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: returning handle %p", __func__, handle);
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: returning handle %p", __func__, GINT_TO_POINTER(((MonoFDHandle*) filehandle)->fd));
- return handle;
+ return GINT_TO_POINTER(((MonoFDHandle*) filehandle)->fd);
}
enum {
static gpointer
mono_w32file_get_std_handle (gint stdhandle)
{
- MonoW32HandleFile *file_handle;
- gpointer handle;
+ FileHandle **filehandle;
gint fd;
const gchar *name;
- gboolean ok;
switch(stdhandle) {
case STD_INPUT_HANDLE:
g_assert_not_reached ();
}
- handle = GINT_TO_POINTER (fd);
-
- mono_coop_mutex_lock (&stdhandle_mutex);
+ if (!mono_fdhandle_lookup_and_ref(fd, (MonoFDHandle**) &filehandle)) {
+ gpointer handle;
- ok = mono_w32handle_lookup (handle, MONO_W32HANDLE_CONSOLE,
- (gpointer *)&file_handle);
- if (ok == FALSE) {
- /* Need to create this console handle */
handle = _wapi_stdhandle_create (fd, name);
-
if (handle == INVALID_HANDLE_VALUE) {
mono_w32error_set_last (ERROR_NO_MORE_FILES);
- goto done;
+ return INVALID_HANDLE_VALUE;
}
}
-
- done:
- mono_coop_mutex_unlock (&stdhandle_mutex);
- return(handle);
+ return GINT_TO_POINTER (fd);
}
gboolean
mono_w32file_read (gpointer handle, gpointer buffer, guint32 numbytes, guint32 *bytesread)
{
- MonoW32HandleType type;
+ FileHandle *filehandle;
+ gboolean ret;
- type = mono_w32handle_get_type (handle);
-
- if(io_ops[type].readfile==NULL) {
+ if (!mono_fdhandle_lookup_and_ref(GPOINTER_TO_INT(handle), (MonoFDHandle**) &filehandle)) {
mono_w32error_set_last (ERROR_INVALID_HANDLE);
- return(FALSE);
+ return FALSE;
}
-
- return(io_ops[type].readfile (handle, buffer, numbytes, bytesread));
+
+ switch (((MonoFDHandle*) filehandle)->type) {
+ case MONO_FDTYPE_FILE:
+ ret = file_read(filehandle, buffer, numbytes, bytesread);
+ break;
+ case MONO_FDTYPE_CONSOLE:
+ ret = console_read(filehandle, buffer, numbytes, bytesread);
+ break;
+ case MONO_FDTYPE_PIPE:
+ ret = pipe_read(filehandle, buffer, numbytes, bytesread);
+ break;
+ default:
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
+ mono_fdhandle_unref ((MonoFDHandle*) filehandle);
+ return FALSE;
+ }
+
+ mono_fdhandle_unref ((MonoFDHandle*) filehandle);
+ return ret;
}
gboolean
mono_w32file_write (gpointer handle, gconstpointer buffer, guint32 numbytes, guint32 *byteswritten)
{
- MonoW32HandleType type;
+ FileHandle *filehandle;
+ gboolean ret;
- type = mono_w32handle_get_type (handle);
-
- if(io_ops[type].writefile==NULL) {
+ if (!mono_fdhandle_lookup_and_ref(GPOINTER_TO_INT(handle), (MonoFDHandle**) &filehandle)) {
mono_w32error_set_last (ERROR_INVALID_HANDLE);
- return(FALSE);
+ return FALSE;
}
-
- return(io_ops[type].writefile (handle, buffer, numbytes, byteswritten));
+
+ switch (((MonoFDHandle*) filehandle)->type) {
+ case MONO_FDTYPE_FILE:
+ ret = file_write(filehandle, buffer, numbytes, byteswritten);
+ break;
+ case MONO_FDTYPE_CONSOLE:
+ ret = console_write(filehandle, buffer, numbytes, byteswritten);
+ break;
+ case MONO_FDTYPE_PIPE:
+ ret = pipe_write(filehandle, buffer, numbytes, byteswritten);
+ break;
+ default:
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
+ mono_fdhandle_unref ((MonoFDHandle*) filehandle);
+ return FALSE;
+ }
+
+ mono_fdhandle_unref ((MonoFDHandle*) filehandle);
+ return ret;
}
gboolean
mono_w32file_flush (gpointer handle)
{
- MonoW32HandleType type;
+ FileHandle *filehandle;
+ gboolean ret;
- type = mono_w32handle_get_type (handle);
-
- if(io_ops[type].flushfile==NULL) {
+ if (!mono_fdhandle_lookup_and_ref(GPOINTER_TO_INT(handle), (MonoFDHandle**) &filehandle)) {
mono_w32error_set_last (ERROR_INVALID_HANDLE);
- return(FALSE);
+ return FALSE;
}
-
- return(io_ops[type].flushfile (handle));
+
+ switch (((MonoFDHandle*) filehandle)->type) {
+ case MONO_FDTYPE_FILE:
+ ret = file_flush(filehandle);
+ break;
+ default:
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
+ mono_fdhandle_unref ((MonoFDHandle*) filehandle);
+ return FALSE;
+ }
+
+ mono_fdhandle_unref ((MonoFDHandle*) filehandle);
+ return ret;
}
gboolean
mono_w32file_truncate (gpointer handle)
{
- MonoW32HandleType type;
+ FileHandle *filehandle;
+ gboolean ret;
- type = mono_w32handle_get_type (handle);
-
- if (io_ops[type].setendoffile == NULL) {
+ if (!mono_fdhandle_lookup_and_ref(GPOINTER_TO_INT(handle), (MonoFDHandle**) &filehandle)) {
mono_w32error_set_last (ERROR_INVALID_HANDLE);
- return(FALSE);
+ return FALSE;
}
-
- return(io_ops[type].setendoffile (handle));
+
+ switch (((MonoFDHandle*) filehandle)->type) {
+ case MONO_FDTYPE_FILE:
+ ret = file_setendoffile(filehandle);
+ break;
+ default:
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
+ mono_fdhandle_unref ((MonoFDHandle*) filehandle);
+ return FALSE;
+ }
+
+ mono_fdhandle_unref ((MonoFDHandle*) filehandle);
+ return ret;
}
guint32
mono_w32file_seek (gpointer handle, gint32 movedistance, gint32 *highmovedistance, guint32 method)
{
- MonoW32HandleType type;
+ FileHandle *filehandle;
+ guint32 ret;
- type = mono_w32handle_get_type (handle);
-
- if (io_ops[type].seek == NULL) {
+ if (!mono_fdhandle_lookup_and_ref(GPOINTER_TO_INT(handle), (MonoFDHandle**) &filehandle)) {
mono_w32error_set_last (ERROR_INVALID_HANDLE);
- return(INVALID_SET_FILE_POINTER);
+ return INVALID_SET_FILE_POINTER;
}
-
- return(io_ops[type].seek (handle, movedistance, highmovedistance,
- method));
+
+ switch (((MonoFDHandle*) filehandle)->type) {
+ case MONO_FDTYPE_FILE:
+ ret = file_seek(filehandle, movedistance, highmovedistance, method);
+ break;
+ default:
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
+ mono_fdhandle_unref ((MonoFDHandle*) filehandle);
+ return INVALID_SET_FILE_POINTER;
+ }
+
+ mono_fdhandle_unref ((MonoFDHandle*) filehandle);
+ return ret;
}
gint
mono_w32file_get_type(gpointer handle)
{
- MonoW32HandleType type;
+ FileHandle *filehandle;
+ gint ret;
- type = mono_w32handle_get_type (handle);
-
- if (io_ops[type].getfiletype == NULL) {
+ if (!mono_fdhandle_lookup_and_ref(GPOINTER_TO_INT(handle), (MonoFDHandle**) &filehandle)) {
mono_w32error_set_last (ERROR_INVALID_HANDLE);
- return(FILE_TYPE_UNKNOWN);
+ return FILE_TYPE_UNKNOWN;
}
-
- return(io_ops[type].getfiletype ());
+
+ switch (((MonoFDHandle*) filehandle)->type) {
+ case MONO_FDTYPE_FILE:
+ ret = FILE_TYPE_DISK;
+ break;
+ case MONO_FDTYPE_CONSOLE:
+ ret = FILE_TYPE_CHAR;
+ break;
+ case MONO_FDTYPE_PIPE:
+ ret = FILE_TYPE_PIPE;
+ break;
+ default:
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
+ mono_fdhandle_unref ((MonoFDHandle*) filehandle);
+ return FILE_TYPE_UNKNOWN;
+ }
+
+ mono_fdhandle_unref ((MonoFDHandle*) filehandle);
+ return ret;
}
static guint32
GetFileSize(gpointer handle, guint32 *highsize)
{
- MonoW32HandleType type;
+ FileHandle *filehandle;
+ guint32 ret;
- type = mono_w32handle_get_type (handle);
-
- if (io_ops[type].getfilesize == NULL) {
+ if (!mono_fdhandle_lookup_and_ref(GPOINTER_TO_INT(handle), (MonoFDHandle**) &filehandle)) {
mono_w32error_set_last (ERROR_INVALID_HANDLE);
- return(INVALID_FILE_SIZE);
+ return INVALID_FILE_SIZE;
}
-
- return(io_ops[type].getfilesize (handle, highsize));
+
+ switch (((MonoFDHandle*) filehandle)->type) {
+ case MONO_FDTYPE_FILE:
+ ret = file_getfilesize(filehandle, highsize);
+ break;
+ default:
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
+ mono_fdhandle_unref ((MonoFDHandle*) filehandle);
+ return INVALID_FILE_SIZE;
+ }
+
+ mono_fdhandle_unref ((MonoFDHandle*) filehandle);
+ return ret;
}
gboolean
mono_w32file_get_times(gpointer handle, FILETIME *create_time, FILETIME *access_time, FILETIME *write_time)
{
- MonoW32HandleType type;
+ FileHandle *filehandle;
+ gboolean ret;
- type = mono_w32handle_get_type (handle);
-
- if (io_ops[type].getfiletime == NULL) {
+ if (!mono_fdhandle_lookup_and_ref(GPOINTER_TO_INT(handle), (MonoFDHandle**) &filehandle)) {
mono_w32error_set_last (ERROR_INVALID_HANDLE);
- return(FALSE);
+ return FALSE;
}
-
- return(io_ops[type].getfiletime (handle, create_time, access_time,
- write_time));
+
+ switch (((MonoFDHandle*) filehandle)->type) {
+ case MONO_FDTYPE_FILE:
+ ret = file_getfiletime(filehandle, create_time, access_time, write_time);
+ break;
+ default:
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
+ mono_fdhandle_unref ((MonoFDHandle*) filehandle);
+ return FALSE;
+ }
+
+ mono_fdhandle_unref ((MonoFDHandle*) filehandle);
+ return ret;
}
gboolean
mono_w32file_set_times(gpointer handle, const FILETIME *create_time, const FILETIME *access_time, const FILETIME *write_time)
{
- MonoW32HandleType type;
+ FileHandle *filehandle;
+ gboolean ret;
- type = mono_w32handle_get_type (handle);
-
- if (io_ops[type].setfiletime == NULL) {
+ if (!mono_fdhandle_lookup_and_ref(GPOINTER_TO_INT(handle), (MonoFDHandle**) &filehandle)) {
mono_w32error_set_last (ERROR_INVALID_HANDLE);
- return(FALSE);
+ return FALSE;
}
-
- return(io_ops[type].setfiletime (handle, create_time, access_time,
- write_time));
+
+ switch (((MonoFDHandle*) filehandle)->type) {
+ case MONO_FDTYPE_FILE:
+ ret = file_setfiletime(filehandle, create_time, access_time, write_time);
+ break;
+ default:
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
+ mono_fdhandle_unref ((MonoFDHandle*) filehandle);
+ return FALSE;
+ }
+
+ mono_fdhandle_unref ((MonoFDHandle*) filehandle);
+ return ret;
}
/* A tick is a 100-nanosecond interval. File time epoch is Midnight,
gboolean
mono_w32file_create_pipe (gpointer *readpipe, gpointer *writepipe, guint32 size)
{
- MonoW32HandleFile pipe_read_handle = {0};
- MonoW32HandleFile pipe_write_handle = {0};
- gpointer read_handle;
- gpointer write_handle;
+ FileHandle *read_filehandle, *write_filehandle;
gint filedes[2];
gint ret;
MONO_ENTER_GC_SAFE;
ret=pipe (filedes);
MONO_EXIT_GC_SAFE;
- if(ret==-1) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Error creating pipe: %s", __func__,
- strerror (errno));
-
+ if (ret==-1) {
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Error creating pipe: (%d) %s",
+ __func__, errno, g_strerror (errno));
+
_wapi_set_last_error_from_errno ();
- return(FALSE);
+ return FALSE;
}
- if (filedes[0] >= mono_w32handle_fd_reserve ||
- filedes[1] >= mono_w32handle_fd_reserve) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: File descriptor is too big", __func__);
-
- mono_w32error_set_last (ERROR_TOO_MANY_OPEN_FILES);
-
- MONO_ENTER_GC_SAFE;
- close (filedes[0]);
- close (filedes[1]);
- MONO_EXIT_GC_SAFE;
-
- return(FALSE);
- }
-
/* filedes[0] is open for reading, filedes[1] for writing */
- pipe_read_handle.fd = filedes [0];
- pipe_read_handle.fileaccess = GENERIC_READ;
- read_handle = mono_w32handle_new_fd (MONO_W32HANDLE_PIPE, filedes[0],
- &pipe_read_handle);
- if (read_handle == INVALID_HANDLE_VALUE) {
- g_warning ("%s: error creating pipe read handle", __func__);
- MONO_ENTER_GC_SAFE;
- close (filedes[0]);
- close (filedes[1]);
- MONO_EXIT_GC_SAFE;
- mono_w32error_set_last (ERROR_GEN_FAILURE);
-
- return(FALSE);
- }
-
- pipe_write_handle.fd = filedes [1];
- pipe_write_handle.fileaccess = GENERIC_WRITE;
- write_handle = mono_w32handle_new_fd (MONO_W32HANDLE_PIPE, filedes[1],
- &pipe_write_handle);
- if (write_handle == INVALID_HANDLE_VALUE) {
- g_warning ("%s: error creating pipe write handle", __func__);
+ read_filehandle = file_data_create (MONO_FDTYPE_PIPE, filedes[0]);
+ read_filehandle->fileaccess = GENERIC_READ;
- MONO_ENTER_GC_SAFE;
- mono_w32handle_close (read_handle);
-
- close (filedes[0]);
- close (filedes[1]);
- MONO_EXIT_GC_SAFE;
- mono_w32error_set_last (ERROR_GEN_FAILURE);
-
- return(FALSE);
- }
-
- *readpipe = read_handle;
- *writepipe = write_handle;
+ write_filehandle = file_data_create (MONO_FDTYPE_PIPE, filedes[1]);
+ write_filehandle->fileaccess = GENERIC_WRITE;
+
+ mono_fdhandle_insert ((MonoFDHandle*) read_filehandle);
+ mono_fdhandle_insert ((MonoFDHandle*) write_filehandle);
+
+ *readpipe = GINT_TO_POINTER(((MonoFDHandle*) read_filehandle)->fd);
+ *writepipe = GINT_TO_POINTER(((MonoFDHandle*) write_filehandle)->fd);
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Returning pipe: read handle %p, write handle %p",
- __func__, read_handle, write_handle);
+ __func__, GINT_TO_POINTER(((MonoFDHandle*) read_filehandle)->fd), GINT_TO_POINTER(((MonoFDHandle*) write_filehandle)->fd));
return(TRUE);
}
if (ret == -1) {
_wapi_set_last_error_from_errno ();
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: statvfs failed: %s", __func__, strerror (errno));
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: statvfs failed: %s", __func__, g_strerror (errno));
return(FALSE);
}
static gboolean
LockFile (gpointer handle, guint32 offset_low, guint32 offset_high, guint32 length_low, guint32 length_high)
{
- MonoW32HandleFile *file_handle;
+ FileHandle *filehandle;
+ gboolean ret;
off_t offset, length;
- if (!mono_w32handle_lookup (handle, MONO_W32HANDLE_FILE, (gpointer *)&file_handle)) {
- g_warning ("%s: error looking up file handle %p", __func__, handle);
+ if (!mono_fdhandle_lookup_and_ref(GPOINTER_TO_INT(handle), (MonoFDHandle**) &filehandle)) {
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
+ return FALSE;
+ }
+
+ if (((MonoFDHandle*) filehandle)->type != MONO_FDTYPE_FILE) {
mono_w32error_set_last (ERROR_INVALID_HANDLE);
+ mono_fdhandle_unref ((MonoFDHandle*) filehandle);
return FALSE;
}
- if (!(file_handle->fileaccess & GENERIC_READ) && !(file_handle->fileaccess & GENERIC_WRITE) && !(file_handle->fileaccess & GENERIC_ALL)) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p doesn't have GENERIC_READ or GENERIC_WRITE access: %u", __func__, handle, file_handle->fileaccess);
+ if (!(filehandle->fileaccess & (GENERIC_READ | GENERIC_WRITE | GENERIC_ALL))) {
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fd %d doesn't have GENERIC_READ or GENERIC_WRITE access: %u", __func__, ((MonoFDHandle*) filehandle)->fd, filehandle->fileaccess);
mono_w32error_set_last (ERROR_ACCESS_DENIED);
+ mono_fdhandle_unref ((MonoFDHandle*) filehandle);
return FALSE;
}
offset = ((gint64)offset_high << 32) | offset_low;
length = ((gint64)length_high << 32) | length_low;
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Locking handle %p, offset %" G_GINT64_FORMAT ", length %" G_GINT64_FORMAT, __func__,
- handle, (gint64) offset, (gint64) length);
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Locking fd %d, offset %" G_GINT64_FORMAT ", length %" G_GINT64_FORMAT, __func__, ((MonoFDHandle*) filehandle)->fd, (gint64) offset, (gint64) length);
#else
if (offset_high > 0 || length_high > 0) {
mono_w32error_set_last (ERROR_INVALID_PARAMETER);
+ mono_fdhandle_unref ((MonoFDHandle*) filehandle);
return FALSE;
}
+
offset = offset_low;
length = length_low;
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Locking handle %p, offset %" G_GINT64_FORMAT ", length %" G_GINT64_FORMAT, __func__,
- handle, (gint64) offset, (gint64) length);
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Locking fd %d, offset %" G_GINT64_FORMAT ", length %" G_GINT64_FORMAT, __func__, ((MonoFDHandle*) filehandle)->fd, (gint64) offset, (gint64) length);
#endif
- return _wapi_lock_file_region (GPOINTER_TO_UINT(handle), offset, length);
+ ret = _wapi_lock_file_region (((MonoFDHandle*) filehandle)->fd, offset, length);
+
+ mono_fdhandle_unref ((MonoFDHandle*) filehandle);
+ return ret;
}
static gboolean
UnlockFile (gpointer handle, guint32 offset_low, guint32 offset_high, guint32 length_low, guint32 length_high)
{
- MonoW32HandleFile *file_handle;
+ FileHandle *filehandle;
+ gboolean ret;
off_t offset, length;
- if (!mono_w32handle_lookup (handle, MONO_W32HANDLE_FILE, (gpointer *)&file_handle)) {
- g_warning ("%s: error looking up file handle %p", __func__, handle);
+ if (!mono_fdhandle_lookup_and_ref(GPOINTER_TO_INT(handle), (MonoFDHandle**) &filehandle)) {
mono_w32error_set_last (ERROR_INVALID_HANDLE);
return FALSE;
}
- if (!(file_handle->fileaccess & GENERIC_READ) && !(file_handle->fileaccess & GENERIC_WRITE) && !(file_handle->fileaccess & GENERIC_ALL)) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p doesn't have GENERIC_READ or GENERIC_WRITE access: %u", __func__, handle, file_handle->fileaccess);
+ if (((MonoFDHandle*) filehandle)->type != MONO_FDTYPE_FILE) {
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
+ mono_fdhandle_unref ((MonoFDHandle*) filehandle);
+ return FALSE;
+ }
+
+ if (!(filehandle->fileaccess & (GENERIC_READ | GENERIC_WRITE | GENERIC_ALL))) {
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fd %d doesn't have GENERIC_READ or GENERIC_WRITE access: %u", __func__, ((MonoFDHandle*) filehandle)->fd, filehandle->fileaccess);
mono_w32error_set_last (ERROR_ACCESS_DENIED);
+ mono_fdhandle_unref ((MonoFDHandle*) filehandle);
return FALSE;
}
offset = ((gint64)offset_high << 32) | offset_low;
length = ((gint64)length_high << 32) | length_low;
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Unlocking handle %p, offset %" G_GINT64_FORMAT ", length %" G_GINT64_FORMAT, __func__,
- handle, (gint64) offset, (gint64) length);
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Unlocking fd %d, offset %" G_GINT64_FORMAT ", length %" G_GINT64_FORMAT, __func__, ((MonoFDHandle*) filehandle)->fd, (gint64) offset, (gint64) length);
#else
offset = offset_low;
length = length_low;
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Unlocking handle %p, offset %" G_GINT64_FORMAT ", length %" G_GINT64_FORMAT, __func__, handle, (gint64) offset, (gint64) length);
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Unlocking fd %p, offset %" G_GINT64_FORMAT ", length %" G_GINT64_FORMAT, __func__, ((MonoFDHandle*) filehandle)->fd, (gint64) offset, (gint64) length);
#endif
- return _wapi_unlock_file_region (GPOINTER_TO_UINT(handle), offset, length);
+ ret = _wapi_unlock_file_region (((MonoFDHandle*) filehandle)->fd, offset, length);
+
+ mono_fdhandle_unref ((MonoFDHandle*) filehandle);
+ return ret;
}
void
mono_w32file_init (void)
{
- mono_coop_mutex_init (&stdhandle_mutex);
- mono_coop_mutex_init (&file_share_mutex);
+ MonoFDHandleCallback file_data_callbacks = {
+ .close = file_data_close,
+ .destroy = file_data_destroy
+ };
+
+ mono_fdhandle_register (MONO_FDTYPE_FILE, &file_data_callbacks);
+ mono_fdhandle_register (MONO_FDTYPE_CONSOLE, &file_data_callbacks);
+ mono_fdhandle_register (MONO_FDTYPE_PIPE, &file_data_callbacks);
- mono_w32handle_register_ops (MONO_W32HANDLE_FILE, &_wapi_file_ops);
- mono_w32handle_register_ops (MONO_W32HANDLE_CONSOLE, &_wapi_console_ops);
- mono_w32handle_register_ops (MONO_W32HANDLE_FIND, &_wapi_find_ops);
- mono_w32handle_register_ops (MONO_W32HANDLE_PIPE, &_wapi_pipe_ops);
+ mono_coop_mutex_init (&file_share_mutex);
-/* mono_w32handle_register_capabilities (MONO_W32HANDLE_FILE, */
-/* MONO_W32HANDLE_CAP_WAIT); */
-/* mono_w32handle_register_capabilities (MONO_W32HANDLE_CONSOLE, */
-/* MONO_W32HANDLE_CAP_WAIT); */
+ mono_w32handle_register_ops (MONO_W32HANDLE_FIND, &_wapi_find_ops);
if (g_hasenv ("MONO_STRICT_IO_EMULATION"))
lock_while_writing = TRUE;
ves_icall_System_IO_MonoIO_DuplicateHandle (HANDLE source_process_handle, HANDLE source_handle,
HANDLE target_process_handle, HANDLE *target_handle, gint32 access, gint32 inherit, gint32 options, gint32 *error)
{
- /* This is only used on Windows */
+#ifndef HOST_WIN32
+ *target_handle = mono_w32handle_duplicate (source_handle);
+#else
gboolean ret;
-
-#ifdef HOST_WIN32
+
MONO_ENTER_GC_SAFE;
ret=DuplicateHandle (source_process_handle, source_handle, target_process_handle, target_handle, access, inherit, options);
MONO_EXIT_GC_SAFE;
-#else
- *target_handle = mono_w32handle_duplicate (source_handle);
- ret = TRUE;
-#endif
- if(ret==FALSE) {
+ if (!ret) {
*error = mono_w32error_get_last ();
/* FIXME: throw an exception? */
return(FALSE);
}
-
+#endif
+
return(TRUE);
}
#define SLOT_OFFSET(x) (x % HANDLE_PER_SLOT)
static MonoW32HandleBase *private_handles [SLOT_MAX];
-static guint32 private_handles_count = 0;
-static guint32 private_handles_slots_count = 0;
-
-guint32 mono_w32handle_fd_reserve;
+static guint32 private_handles_size = 0;
/*
* This is an internal handle which is used for handling waiting for multiple handles.
static gboolean shutting_down = FALSE;
-static gboolean
-type_is_fd (MonoW32HandleType type)
-{
- switch (type) {
- case MONO_W32HANDLE_FILE:
- case MONO_W32HANDLE_CONSOLE:
- case MONO_W32HANDLE_SOCKET:
- case MONO_W32HANDLE_PIPE:
- return TRUE;
- default:
- return FALSE;
- }
-}
-
static gboolean
mono_w32handle_lookup_data (gpointer handle, MonoW32HandleBase **handle_data)
{
g_assert ((sizeof (handle_ops) / sizeof (handle_ops[0]))
== MONO_W32HANDLE_COUNT);
- /* This is needed by the code in mono_w32handle_new_internal */
- mono_w32handle_fd_reserve = (eg_getdtablesize () + (HANDLE_PER_SLOT - 1)) & ~(HANDLE_PER_SLOT - 1);
-
- do {
- /*
- * The entries in private_handles reserved for fds are allocated lazily to
- * save memory.
- */
-
- private_handles_count += HANDLE_PER_SLOT;
- private_handles_slots_count ++;
- } while(mono_w32handle_fd_reserve > private_handles_count);
-
mono_os_mutex_init (&scan_mutex);
mono_os_cond_init (&global_signal_cond);
static gsize
mono_w32handle_ops_typesize (MonoW32HandleType type);
-static void mono_w32handle_init_handle (MonoW32HandleBase *handle,
- MonoW32HandleType type, gpointer handle_specific)
-{
- g_assert (handle->ref == 0);
-
- handle->type = type;
- handle->signalled = FALSE;
- handle->ref = 1;
-
- mono_os_cond_init (&handle->signal_cond);
- mono_os_mutex_init (&handle->signal_mutex);
-
- if (handle_specific)
- handle->specific = g_memdup (handle_specific, mono_w32handle_ops_typesize (type));
-}
-
/*
* mono_w32handle_new_internal:
* @type: Init handle to this type
* descriptors
*/
- if (last < mono_w32handle_fd_reserve) {
- last = mono_w32handle_fd_reserve;
+ if (last == 0) {
+ /* We need to go from 1 since a handle of value 0 can be considered invalid in managed code */
+ last = 1;
} else {
retry = TRUE;
}
again:
count = last;
- for(i = SLOT_INDEX (count); i < private_handles_slots_count; i++) {
+ for(i = SLOT_INDEX (count); i < private_handles_size; i++) {
if (private_handles [i]) {
for (k = SLOT_OFFSET (count); k < HANDLE_PER_SLOT; k++) {
MonoW32HandleBase *handle = &private_handles [i][k];
if(handle->type == MONO_W32HANDLE_UNUSED) {
last = count + 1;
- mono_w32handle_init_handle (handle, type, handle_specific);
+ g_assert (handle->ref == 0);
+
+ handle->type = type;
+ handle->signalled = FALSE;
+ handle->ref = 1;
+
+ mono_os_cond_init (&handle->signal_cond);
+ mono_os_mutex_init (&handle->signal_mutex);
+
+ if (handle_specific)
+ handle->specific = g_memdup (handle_specific, mono_w32handle_ops_typesize (type));
+
return (count);
}
count++;
}
}
- if(retry && last > mono_w32handle_fd_reserve) {
+ if (retry) {
/* Try again from the beginning */
- last = mono_w32handle_fd_reserve;
+ last = 1;
+ retry = FALSE;
goto again;
}
/* Will need to expand the array. The caller will sort it out */
- return(0);
+ return G_MAXUINT32;
}
gpointer
mono_w32handle_new (MonoW32HandleType type, gpointer handle_specific)
{
- guint32 handle_idx = 0;
+ guint32 handle_idx;
gpointer handle;
g_assert (!shutting_down);
- g_assert(!type_is_fd(type));
-
mono_os_mutex_lock (&scan_mutex);
- while ((handle_idx = mono_w32handle_new_internal (type, handle_specific)) == 0) {
+ while ((handle_idx = mono_w32handle_new_internal (type, handle_specific)) == G_MAXUINT32) {
/* Try and expand the array, and have another go */
- int idx = SLOT_INDEX (private_handles_count);
- if (idx >= SLOT_MAX) {
- break;
- }
+ if (private_handles_size >= SLOT_MAX) {
+ mono_os_mutex_unlock (&scan_mutex);
- private_handles [idx] = g_new0 (MonoW32HandleBase, HANDLE_PER_SLOT);
+ /* We ran out of slots */
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: failed to create %s handle", __func__, mono_w32handle_ops_typename (type));
+ return INVALID_HANDLE_VALUE;
+ }
- private_handles_count += HANDLE_PER_SLOT;
- private_handles_slots_count ++;
+ private_handles [private_handles_size ++] = g_new0 (MonoW32HandleBase, HANDLE_PER_SLOT);
}
mono_os_mutex_unlock (&scan_mutex);
- if (handle_idx == 0) {
- /* We ran out of slots */
- handle = INVALID_HANDLE_VALUE;
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: failed to create %s handle", __func__, mono_w32handle_ops_typename (type));
- goto done;
- }
-
- /* Make sure we left the space for fd mappings */
- g_assert (handle_idx >= mono_w32handle_fd_reserve);
-
handle = GUINT_TO_POINTER (handle_idx);
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: create %s handle %p", __func__, mono_w32handle_ops_typename (type), handle);
-done:
return(handle);
}
-gpointer mono_w32handle_new_fd (MonoW32HandleType type, int fd,
- gpointer handle_specific)
-{
- MonoW32HandleBase *handle_data;
- int fd_index, fd_offset;
-
- g_assert (!shutting_down);
-
- g_assert(type_is_fd(type));
-
- if (fd >= mono_w32handle_fd_reserve) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: failed to create %s handle, fd is too big", __func__, mono_w32handle_ops_typename (type));
-
- return(GUINT_TO_POINTER (INVALID_HANDLE_VALUE));
- }
-
- fd_index = SLOT_INDEX (fd);
- fd_offset = SLOT_OFFSET (fd);
-
- mono_os_mutex_lock (&scan_mutex);
- /* Initialize the array entries on demand */
- if (!private_handles [fd_index]) {
- if (!private_handles [fd_index])
- private_handles [fd_index] = g_new0 (MonoW32HandleBase, HANDLE_PER_SLOT);
- }
-
- handle_data = &private_handles [fd_index][fd_offset];
-
- if (handle_data->type != MONO_W32HANDLE_UNUSED) {
- mono_os_mutex_unlock (&scan_mutex);
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: failed to create %s handle, fd is already in use", __func__, mono_w32handle_ops_typename (type));
- /* FIXME: clean up this handle? We can't do anything
- * with the fd, cos thats the new one
- */
- return(GUINT_TO_POINTER (INVALID_HANDLE_VALUE));
- }
-
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: create %s handle %p", __func__, mono_w32handle_ops_typename (type), GUINT_TO_POINTER(fd));
-
- mono_w32handle_init_handle (handle_data, type, handle_specific);
-
- mono_os_mutex_unlock (&scan_mutex);
-
- return(GUINT_TO_POINTER(fd));
-}
-
static gboolean
mono_w32handle_ref_core (gpointer handle, MonoW32HandleBase *handle_data);
return handle;
if (!mono_w32handle_lookup_data (handle, &handle_data))
return INVALID_HANDLE_VALUE;
- if (handle == (gpointer) 0 && handle_data->type != MONO_W32HANDLE_CONSOLE)
- return handle;
if (!mono_w32handle_ref_core (handle, handle_data))
g_error ("%s: failed to ref handle %p", __func__, handle);
return FALSE;
if (!mono_w32handle_lookup_data (handle, &handle_data))
return FALSE;
- if (handle == (gpointer) 0 && handle_data->type != MONO_W32HANDLE_CONSOLE) {
- /* Problem: because we map file descriptors to the
- * same-numbered handle we can't tell the difference
- * between a bogus handle and the handle to stdin.
- * Assume that it's the console handle if that handle
- * exists... */
- return FALSE;
- }
destroy = mono_w32handle_unref_core (handle, handle_data);
if (destroy)
mono_os_mutex_lock (&scan_mutex);
- for (i = SLOT_INDEX (0); i < private_handles_slots_count; i++) {
+ for (i = SLOT_INDEX (0); i < private_handles_size; i++) {
if (!private_handles [i])
continue;
for (k = SLOT_OFFSET (0); k < HANDLE_PER_SLOT; k++) {
w32handle_destroy (handle);
}
-static void
-mono_w32handle_ops_close (gpointer handle, gpointer data);
-
-void
-mono_w32handle_force_close (gpointer handle, gpointer data)
-{
- mono_w32handle_ops_close (handle, data);
-}
-
void
mono_w32handle_register_ops (MonoW32HandleType type, MonoW32HandleOps *ops)
{
return (NULL);
}
-static void
-mono_w32handle_ops_close (gpointer handle, gpointer data)
-{
- MonoW32HandleBase *handle_data;
- MonoW32HandleType type;
-
- if (!mono_w32handle_lookup_data (handle, &handle_data)) {
- return;
- }
-
- type = handle_data->type;
-
- if (handle_ops[type] != NULL &&
- handle_ops[type]->close != NULL) {
- handle_ops[type]->close (handle, data);
- }
-}
-
static void
mono_w32handle_ops_details (MonoW32HandleType type, gpointer data)
{
typedef enum {
MONO_W32HANDLE_UNUSED = 0,
- MONO_W32HANDLE_FILE,
- MONO_W32HANDLE_CONSOLE,
- MONO_W32HANDLE_THREAD,
MONO_W32HANDLE_SEM,
MONO_W32HANDLE_MUTEX,
MONO_W32HANDLE_EVENT,
- MONO_W32HANDLE_SOCKET,
MONO_W32HANDLE_FIND,
MONO_W32HANDLE_PROCESS,
- MONO_W32HANDLE_PIPE,
MONO_W32HANDLE_NAMEDMUTEX,
MONO_W32HANDLE_NAMEDSEM,
MONO_W32HANDLE_NAMEDEVENT,
MONO_W32HANDLE_CAP_SPECIAL_WAIT = 0x08,
} MonoW32HandleCapability;
-extern guint32 mono_w32handle_fd_reserve;
-
void
mono_w32handle_init (void);
gpointer
mono_w32handle_new (MonoW32HandleType type, gpointer handle_specific);
-gpointer
-mono_w32handle_new_fd (MonoW32HandleType type, int fd, gpointer handle_specific);
-
gpointer
mono_w32handle_duplicate (gpointer handle);
gboolean
mono_w32handle_test_capabilities (gpointer handle, MonoW32HandleCapability caps);
-void
-mono_w32handle_force_close (gpointer handle, gpointer data);
-
void
mono_w32handle_set_signal_state (gpointer handle, gboolean state, gboolean broadcast);
dup2 (err_fd, 2);
/* Close all file descriptors */
- for (i = mono_w32handle_fd_reserve - 1; i > 2; i--)
+ for (i = eg_getdtablesize() - 1; i > 2; i--)
close (i);
#ifdef DEBUG_ENABLED
gint32
mono_w32socket_convert_error (gint error);
+gboolean
+mono_w32socket_duplicate (gpointer handle, gint32 targetProcessId, gpointer *duplicate_handle);
+
#endif // __MONO_METADATA_W32SOCKET_INTERNALS_H__
#include "w32socket.h"
#include "w32socket-internals.h"
#include "w32error.h"
-#include "w32handle.h"
+#include "fdhandle.h"
#include "utils/mono-logger-internals.h"
#include "utils/mono-poll.h"
typedef struct {
- int domain;
- int type;
- int protocol;
- int saved_error;
- int still_readable;
-} MonoW32HandleSocket;
+ MonoFDHandle fdhandle;
+ gint domain;
+ gint type;
+ gint protocol;
+ gint saved_error;
+ gint still_readable;
+} SocketHandle;
+
+static SocketHandle*
+socket_data_create (MonoFDType type, gint fd)
+{
+ SocketHandle *sockethandle;
+
+ sockethandle = g_new0 (SocketHandle, 1);
+ mono_fdhandle_init ((MonoFDHandle*) sockethandle, type, fd);
-static guint32 in_cleanup = 0;
+ return sockethandle;
+}
static void
-socket_close (gpointer handle, gpointer data)
+socket_data_close (MonoFDHandle *fdhandle)
{
- int ret;
- MonoW32HandleSocket *socket_handle = (MonoW32HandleSocket *)data;
- MonoThreadInfo *info = mono_thread_info_current ();
+ MonoThreadInfo *info;
+ SocketHandle* sockethandle;
+ gint ret;
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: closing socket handle %p", __func__, handle);
+ sockethandle = (SocketHandle*) fdhandle;
+ g_assert (sockethandle);
- /* Shutdown the socket for reading, to interrupt any potential
- * receives that may be blocking for data. See bug 75705. */
- shutdown (GPOINTER_TO_UINT (handle), SHUT_RD);
+ info = mono_thread_info_current ();
- do {
- ret = close (GPOINTER_TO_UINT(handle));
- } while (ret == -1 && errno == EINTR &&
- !mono_thread_info_is_interrupt_state (info));
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: closing fd %d", __func__, ((MonoFDHandle*) sockethandle)->fd);
+ /* Shutdown the socket for reading, to interrupt any potential
+ * receives that may be blocking for data. See bug 75705. */
+ MONO_ENTER_GC_SAFE;
+ shutdown (((MonoFDHandle*) sockethandle)->fd, SHUT_RD);
+ MONO_EXIT_GC_SAFE;
+
+retry_close:
+ MONO_ENTER_GC_SAFE;
+ ret = close (((MonoFDHandle*) sockethandle)->fd);
+ MONO_EXIT_GC_SAFE;
if (ret == -1) {
- gint errnum = errno;
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: close error: %s", __func__, g_strerror (errno));
- if (!in_cleanup)
- mono_w32socket_set_last_error (mono_w32socket_convert_error (errnum));
+ if (errno == EINTR && !mono_thread_info_is_interrupt_state (info))
+ goto retry_close;
}
- if (!in_cleanup)
- socket_handle->saved_error = 0;
+ sockethandle->saved_error = 0;
}
static void
-socket_details (gpointer data)
+socket_data_destroy (MonoFDHandle *fdhandle)
{
- /* FIXME: do something */
-}
+ SocketHandle *sockethandle;
-static const gchar*
-socket_typename (void)
-{
- return "Socket";
-}
+ sockethandle = (SocketHandle*) fdhandle;
+ g_assert (sockethandle);
-static gsize
-socket_typesize (void)
-{
- return sizeof (MonoW32HandleSocket);
+ g_free (sockethandle);
}
-static MonoW32HandleOps ops = {
- socket_close, /* close */
- NULL, /* signal */
- NULL, /* own */
- NULL, /* is_owned */
- NULL, /* special_wait */
- NULL, /* prewait */
- socket_details, /* details */
- socket_typename, /* typename */
- socket_typesize, /* typesize */
-};
-
void
mono_w32socket_initialize (void)
{
- mono_w32handle_register_ops (MONO_W32HANDLE_SOCKET, &ops);
-}
-
-static gboolean
-cleanup_close (gpointer handle, gpointer data, gpointer user_data)
-{
- if (mono_w32handle_get_type (handle) == MONO_W32HANDLE_SOCKET)
- mono_w32handle_force_close (handle, data);
+ MonoFDHandleCallback socket_data_callbacks = {
+ .close = socket_data_close,
+ .destroy = socket_data_destroy
+ };
- return FALSE;
+ mono_fdhandle_register (MONO_FDTYPE_SOCKET, &socket_data_callbacks);
}
void
mono_w32socket_cleanup (void)
{
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: cleaning up", __func__);
-
- in_cleanup = 1;
- mono_w32handle_foreach (cleanup_close, NULL);
- in_cleanup = 0;
}
SOCKET
mono_w32socket_accept (SOCKET sock, struct sockaddr *addr, socklen_t *addrlen, gboolean blocking)
{
- gpointer handle;
- gpointer new_handle;
- MonoW32HandleSocket *socket_handle;
- MonoW32HandleSocket new_socket_handle;
- SOCKET new_fd;
+ SocketHandle *sockethandle, *accepted_socket_data;
MonoThreadInfo *info;
+ gint accepted_fd;
if (addr != NULL && *addrlen < sizeof(struct sockaddr)) {
mono_w32socket_set_last_error (WSAEFAULT);
return INVALID_SOCKET;
}
- handle = GUINT_TO_POINTER (sock);
- if (!mono_w32handle_lookup (handle, MONO_W32HANDLE_SOCKET, (gpointer *)&socket_handle)) {
- mono_w32socket_set_last_error (WSAENOTSOCK);
+ if (!mono_fdhandle_lookup_and_ref(sock, (MonoFDHandle**) &sockethandle)) {
+ mono_w32error_set_last (WSAENOTSOCK);
+ return INVALID_SOCKET;
+ }
+
+ if (((MonoFDHandle*) sockethandle)->type != MONO_FDTYPE_SOCKET) {
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
+ mono_w32error_set_last (WSAENOTSOCK);
return INVALID_SOCKET;
}
info = mono_thread_info_current ();
do {
- new_fd = accept (sock, addr, addrlen);
- } while (new_fd == -1 && errno == EINTR && !mono_thread_info_is_interrupt_state (info));
+ MONO_ENTER_GC_SAFE;
+ accepted_fd = accept (((MonoFDHandle*) sockethandle)->fd, addr, addrlen);
+ MONO_EXIT_GC_SAFE;
+ } while (accepted_fd == -1 && errno == EINTR && !mono_thread_info_is_interrupt_state (info));
- if (new_fd == -1) {
- gint errnum = errno;
+ if (accepted_fd == -1) {
+ gint error = mono_w32socket_convert_error (errno);
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: accept error: %s", __func__, g_strerror(errno));
- mono_w32socket_set_last_error (mono_w32socket_convert_error (errnum));
+ mono_w32socket_set_last_error (error);
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return INVALID_SOCKET;
}
- if (new_fd >= mono_w32handle_fd_reserve) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: File descriptor is too big", __func__);
-
- mono_w32socket_set_last_error (WSASYSCALLFAILURE);
+ accepted_socket_data = socket_data_create (MONO_FDTYPE_SOCKET, accepted_fd);
+ accepted_socket_data->domain = sockethandle->domain;
+ accepted_socket_data->type = sockethandle->type;
+ accepted_socket_data->protocol = sockethandle->protocol;
+ accepted_socket_data->still_readable = 1;
- close (new_fd);
+ mono_fdhandle_insert ((MonoFDHandle*) accepted_socket_data);
- return INVALID_SOCKET;
- }
-
- new_socket_handle.domain = socket_handle->domain;
- new_socket_handle.type = socket_handle->type;
- new_socket_handle.protocol = socket_handle->protocol;
- new_socket_handle.still_readable = 1;
-
- new_handle = mono_w32handle_new_fd (MONO_W32HANDLE_SOCKET, new_fd,
- &new_socket_handle);
- if(new_handle == INVALID_HANDLE_VALUE) {
- g_warning ("%s: error creating socket handle", __func__);
- mono_w32socket_set_last_error (ERROR_GEN_FAILURE);
- return INVALID_SOCKET;
- }
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: returning accepted handle %p", __func__, GINT_TO_POINTER(((MonoFDHandle*) accepted_socket_data)->fd));
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: returning newly accepted socket handle %p with",
- __func__, new_handle);
-
- return new_fd;
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
+ return ((MonoFDHandle*) accepted_socket_data)->fd;
}
int
mono_w32socket_connect (SOCKET sock, const struct sockaddr *addr, int addrlen, gboolean blocking)
{
- gpointer handle;
- MonoW32HandleSocket *socket_handle;
+ SocketHandle *sockethandle;
+ gint ret;
+
+ if (!mono_fdhandle_lookup_and_ref(sock, (MonoFDHandle**) &sockethandle)) {
+ mono_w32error_set_last (WSAENOTSOCK);
+ return SOCKET_ERROR;
+ }
- handle = GUINT_TO_POINTER (sock);
- if (!mono_w32handle_lookup (handle, MONO_W32HANDLE_SOCKET, (gpointer *)&socket_handle)) {
- mono_w32socket_set_last_error (WSAENOTSOCK);
+ if (((MonoFDHandle*) sockethandle)->type != MONO_FDTYPE_SOCKET) {
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
+ mono_w32error_set_last (WSAENOTSOCK);
return SOCKET_ERROR;
}
- if (connect (sock, addr, addrlen) == -1) {
+ MONO_ENTER_GC_SAFE;
+ ret = connect (((MonoFDHandle*) sockethandle)->fd, addr, addrlen);
+ MONO_EXIT_GC_SAFE;
+ if (ret == -1) {
MonoThreadInfo *info;
mono_pollfd fds;
gint errnum, so_error;
if (errnum != WSAEWOULDBLOCK) {
/* ECONNRESET means the socket was closed by another thread */
/* Async close on mac raises ECONNABORTED. */
- socket_handle->saved_error = errnum;
+ sockethandle->saved_error = errnum;
}
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return SOCKET_ERROR;
}
info = mono_thread_info_current ();
- fds.fd = sock;
+ fds.fd = ((MonoFDHandle*) sockethandle)->fd;
fds.events = MONO_POLLOUT;
- while (mono_poll (&fds, 1, -1) == -1 && !mono_thread_info_is_interrupt_state (info)) {
+ for (;;) {
+ MONO_ENTER_GC_SAFE;
+ ret = mono_poll (&fds, 1, -1);
+ MONO_EXIT_GC_SAFE;
+ if (ret != -1 || mono_thread_info_is_interrupt_state (info))
+ break;
+
if (errno != EINTR) {
gint errnum = errno;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: connect poll error: %s", __func__, g_strerror (errno));
mono_w32socket_set_last_error (mono_w32socket_convert_error (errnum));
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return SOCKET_ERROR;
}
}
len = sizeof(so_error);
- if (getsockopt (sock, SOL_SOCKET, SO_ERROR, &so_error, &len) == -1) {
+ MONO_ENTER_GC_SAFE;
+ ret = getsockopt (((MonoFDHandle*) sockethandle)->fd, SOL_SOCKET, SO_ERROR, &so_error, &len);
+ MONO_EXIT_GC_SAFE;
+ if (ret == -1) {
gint errnum = errno;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: connect getsockopt error: %s", __func__, g_strerror (errno));
mono_w32socket_set_last_error (mono_w32socket_convert_error (errnum));
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return SOCKET_ERROR;
}
gint errnum = mono_w32socket_convert_error (so_error);
/* Need to save this socket error */
- socket_handle->saved_error = errnum;
+ sockethandle->saved_error = errnum;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: connect getsockopt returned error: %s",
__func__, g_strerror (so_error));
mono_w32socket_set_last_error (errnum);
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return SOCKET_ERROR;
}
}
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return 0;
}
int
mono_w32socket_recvfrom (SOCKET sock, char *buf, int len, int flags, struct sockaddr *from, socklen_t *fromlen, gboolean blocking)
{
- gpointer handle;
- MonoW32HandleSocket *socket_handle;
+ SocketHandle *sockethandle;
int ret;
MonoThreadInfo *info;
- handle = GUINT_TO_POINTER (sock);
- if (!mono_w32handle_lookup (handle, MONO_W32HANDLE_SOCKET, (gpointer *)&socket_handle)) {
- mono_w32socket_set_last_error (WSAENOTSOCK);
+ if (!mono_fdhandle_lookup_and_ref(sock, (MonoFDHandle**) &sockethandle)) {
+ mono_w32error_set_last (WSAENOTSOCK);
+ return SOCKET_ERROR;
+ }
+
+ if (((MonoFDHandle*) sockethandle)->type != MONO_FDTYPE_SOCKET) {
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
+ mono_w32error_set_last (WSAENOTSOCK);
return SOCKET_ERROR;
}
info = mono_thread_info_current ();
do {
- ret = recvfrom (sock, buf, len, flags, from, fromlen);
+ MONO_ENTER_GC_SAFE;
+ ret = recvfrom (((MonoFDHandle*) sockethandle)->fd, buf, len, flags, from, fromlen);
+ MONO_EXIT_GC_SAFE;
} while (ret == -1 && errno == EINTR && !mono_thread_info_is_interrupt_state (info));
if (ret == 0 && len > 0) {
* still_readable != 1 then shutdown
* (SHUT_RD|SHUT_RDWR) has been called locally.
*/
- if (socket_handle->still_readable != 1) {
+ if (sockethandle->still_readable != 1) {
ret = -1;
errno = EINTR;
}
gint errnum = errno;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: recv error: %s", __func__, g_strerror(errno));
mono_w32socket_set_last_error (mono_w32socket_convert_error (errnum));
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return SOCKET_ERROR;
}
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return ret;
}
int
mono_w32socket_recvbuffers (SOCKET sock, WSABUF *buffers, guint32 count, guint32 *received, guint32 *flags, gpointer overlapped, gpointer complete, gboolean blocking)
{
- MonoW32HandleSocket *socket_handle;
+ SocketHandle *sockethandle;
MonoThreadInfo *info;
- gpointer handle;
gint ret;
struct msghdr hdr;
g_assert (overlapped == NULL);
g_assert (complete == NULL);
- handle = GUINT_TO_POINTER (sock);
- if (!mono_w32handle_lookup (handle, MONO_W32HANDLE_SOCKET, (gpointer *)&socket_handle)) {
- mono_w32socket_set_last_error (WSAENOTSOCK);
+ if (!mono_fdhandle_lookup_and_ref(sock, (MonoFDHandle**) &sockethandle)) {
+ mono_w32error_set_last (WSAENOTSOCK);
+ return SOCKET_ERROR;
+ }
+
+ if (((MonoFDHandle*) sockethandle)->type != MONO_FDTYPE_SOCKET) {
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
+ mono_w32error_set_last (WSAENOTSOCK);
return SOCKET_ERROR;
}
wsabuf_to_msghdr (buffers, count, &hdr);
do {
- ret = recvmsg (sock, &hdr, *flags);
+ MONO_ENTER_GC_SAFE;
+ ret = recvmsg (((MonoFDHandle*) sockethandle)->fd, &hdr, *flags);
+ MONO_EXIT_GC_SAFE;
} while (ret == -1 && errno == EINTR && !mono_thread_info_is_interrupt_state (info));
msghdr_iov_free (&hdr);
if (ret == 0) {
/* see mono_w32socket_recvfrom */
- if (socket_handle->still_readable != 1) {
+ if (sockethandle->still_readable != 1) {
ret = -1;
errno = EINTR;
}
gint errnum = errno;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: recvmsg error: %s", __func__, g_strerror(errno));
mono_w32socket_set_last_error (mono_w32socket_convert_error (errnum));
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return SOCKET_ERROR;
}
*received = ret;
*flags = hdr.msg_flags;
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return 0;
}
int
mono_w32socket_send (SOCKET sock, char *buf, int len, int flags, gboolean blocking)
{
- gpointer handle;
+ SocketHandle *sockethandle;
int ret;
MonoThreadInfo *info;
- handle = GUINT_TO_POINTER (sock);
- if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
- mono_w32socket_set_last_error (WSAENOTSOCK);
+ if (!mono_fdhandle_lookup_and_ref(sock, (MonoFDHandle**) &sockethandle)) {
+ mono_w32error_set_last (WSAENOTSOCK);
+ return SOCKET_ERROR;
+ }
+
+ if (((MonoFDHandle*) sockethandle)->type != MONO_FDTYPE_SOCKET) {
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
+ mono_w32error_set_last (WSAENOTSOCK);
return SOCKET_ERROR;
}
info = mono_thread_info_current ();
do {
- ret = send (sock, buf, len, flags);
+ MONO_ENTER_GC_SAFE;
+ ret = send (((MonoFDHandle*) sockethandle)->fd, buf, len, flags);
+ MONO_EXIT_GC_SAFE;
} while (ret == -1 && errno == EINTR && !mono_thread_info_is_interrupt_state (info));
if (ret == -1) {
/* At least linux returns EAGAIN/EWOULDBLOCK when the timeout has been set on
* a blocking socket. See bug #599488 */
if (errnum == EAGAIN) {
- ret = fcntl (sock, F_GETFL, 0);
+ MONO_ENTER_GC_SAFE;
+ ret = fcntl (((MonoFDHandle*) sockethandle)->fd, F_GETFL, 0);
+ MONO_EXIT_GC_SAFE;
if (ret != -1 && (ret & O_NONBLOCK) == 0)
errnum = ETIMEDOUT;
}
#endif /* O_NONBLOCK */
mono_w32socket_set_last_error (mono_w32socket_convert_error (errnum));
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return SOCKET_ERROR;
}
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return ret;
}
int
mono_w32socket_sendto (SOCKET sock, const char *buf, int len, int flags, const struct sockaddr *to, int tolen, gboolean blocking)
{
- gpointer handle;
+ SocketHandle *sockethandle;
int ret;
MonoThreadInfo *info;
- handle = GUINT_TO_POINTER (sock);
- if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
- mono_w32socket_set_last_error (WSAENOTSOCK);
+ if (!mono_fdhandle_lookup_and_ref(sock, (MonoFDHandle**) &sockethandle)) {
+ mono_w32error_set_last (WSAENOTSOCK);
+ return SOCKET_ERROR;
+ }
+
+ if (((MonoFDHandle*) sockethandle)->type != MONO_FDTYPE_SOCKET) {
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
+ mono_w32error_set_last (WSAENOTSOCK);
return SOCKET_ERROR;
}
info = mono_thread_info_current ();
do {
- ret = sendto (sock, buf, len, flags, to, tolen);
+ MONO_ENTER_GC_SAFE;
+ ret = sendto (((MonoFDHandle*) sockethandle)->fd, buf, len, flags, to, tolen);
+ MONO_EXIT_GC_SAFE;
} while (ret == -1 && errno == EINTR && !mono_thread_info_is_interrupt_state (info));
if (ret == -1) {
gint errnum = errno;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: send error: %s", __func__, g_strerror (errno));
mono_w32socket_set_last_error (mono_w32socket_convert_error (errnum));
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return SOCKET_ERROR;
}
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return ret;
}
{
struct msghdr hdr;
MonoThreadInfo *info;
- gpointer handle;
+ SocketHandle *sockethandle;
gint ret;
g_assert (overlapped == NULL);
g_assert (complete == NULL);
- handle = GUINT_TO_POINTER (sock);
- if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
- mono_w32socket_set_last_error (WSAENOTSOCK);
+ if (!mono_fdhandle_lookup_and_ref(sock, (MonoFDHandle**) &sockethandle)) {
+ mono_w32error_set_last (WSAENOTSOCK);
+ return SOCKET_ERROR;
+ }
+
+ if (((MonoFDHandle*) sockethandle)->type != MONO_FDTYPE_SOCKET) {
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
+ mono_w32error_set_last (WSAENOTSOCK);
return SOCKET_ERROR;
}
wsabuf_to_msghdr (buffers, count, &hdr);
do {
- ret = sendmsg (sock, &hdr, flags);
+ MONO_ENTER_GC_SAFE;
+ ret = sendmsg (((MonoFDHandle*) sockethandle)->fd, &hdr, flags);
+ MONO_EXIT_GC_SAFE;
} while (ret == -1 && errno == EINTR && !mono_thread_info_is_interrupt_state (info));
msghdr_iov_free (&hdr);
gint errnum = errno;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: sendmsg error: %s", __func__, g_strerror (errno));
mono_w32socket_set_last_error (mono_w32socket_convert_error (errnum));
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return SOCKET_ERROR;
}
*sent = ret;
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return 0;
}
mono_w32socket_transmit_file (SOCKET sock, gpointer file_handle, TRANSMIT_FILE_BUFFERS *buffers, guint32 flags, gboolean blocking)
{
MonoThreadInfo *info;
- gpointer handle;
+ SocketHandle *sockethandle;
gint file;
gssize ret;
#if defined(HAVE_SENDFILE) && (defined(__linux__) || defined(DARWIN))
gchar *buffer;
#endif
- handle = GUINT_TO_POINTER (sock);
- if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
- mono_w32socket_set_last_error (WSAENOTSOCK);
- return FALSE;
+ if (!mono_fdhandle_lookup_and_ref(sock, (MonoFDHandle**) &sockethandle)) {
+ mono_w32error_set_last (WSAENOTSOCK);
+ return SOCKET_ERROR;
+ }
+
+ if (((MonoFDHandle*) sockethandle)->type != MONO_FDTYPE_SOCKET) {
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
+ mono_w32error_set_last (WSAENOTSOCK);
+ return SOCKET_ERROR;
}
/* Write the header */
if (buffers != NULL && buffers->Head != NULL && buffers->HeadLength > 0) {
- ret = mono_w32socket_send (sock, buffers->Head, buffers->HeadLength, 0, FALSE);
- if (ret == SOCKET_ERROR)
+ ret = mono_w32socket_send (((MonoFDHandle*) sockethandle)->fd, buffers->Head, buffers->HeadLength, 0, FALSE);
+ if (ret == SOCKET_ERROR) {
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return FALSE;
+ }
}
info = mono_thread_info_current ();
file = GPOINTER_TO_INT (file_handle);
#if defined(HAVE_SENDFILE) && (defined(__linux__) || defined(DARWIN))
+ MONO_ENTER_GC_SAFE;
ret = fstat (file, &statbuf);
+ MONO_EXIT_GC_SAFE;
if (ret == -1) {
gint errnum = errno;
mono_w32socket_set_last_error (mono_w32socket_convert_error (errnum));
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return SOCKET_ERROR;
}
do {
+ MONO_ENTER_GC_SAFE;
#ifdef __linux__
- ret = sendfile (sock, file, NULL, statbuf.st_size);
+ ret = sendfile (((MonoFDHandle*) sockethandle)->fd, file, NULL, statbuf.st_size);
#elif defined(DARWIN)
/* TODO: header/tail could be sent in the 5th argument */
/* TODO: Might not send the entire file for non-blocking sockets */
- ret = sendfile (file, sock, 0, &statbuf.st_size, NULL, 0);
+ ret = sendfile (file, ((MonoFDHandle*) sockethandle)->fd, 0, &statbuf.st_size, NULL, 0);
#endif
+ MONO_EXIT_GC_SAFE;
} while (ret != -1 && errno == EINTR && !mono_thread_info_is_interrupt_state (info));
#else
buffer = g_malloc (SF_BUFFER_SIZE);
do {
do {
+ MONO_ENTER_GC_SAFE;
ret = read (file, buffer, SF_BUFFER_SIZE);
+ MONO_EXIT_GC_SAFE;
} while (ret == -1 && errno == EINTR && !mono_thread_info_is_interrupt_state (info));
if (ret == -1 || ret == 0)
break;
do {
- ret = send (sock, buffer, ret, 0); /* short sends? enclose this in a loop? */
+ MONO_ENTER_GC_SAFE;
+ ret = send (((MonoFDHandle*) sockethandle)->fd, buffer, ret, 0); /* short sends? enclose this in a loop? */
+ MONO_EXIT_GC_SAFE;
} while (ret == -1 && errno == EINTR && !mono_thread_info_is_interrupt_state (info));
} while (ret != -1 && errno == EINTR && !mono_thread_info_is_interrupt_state (info));
if (ret == -1) {
gint errnum = errno;
mono_w32socket_set_last_error (mono_w32socket_convert_error (errnum));
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return FALSE;
}
/* Write the tail */
if (buffers != NULL && buffers->Tail != NULL && buffers->TailLength > 0) {
- ret = mono_w32socket_send (sock, buffers->Tail, buffers->TailLength, 0, FALSE);
- if (ret == SOCKET_ERROR)
+ ret = mono_w32socket_send (((MonoFDHandle*) sockethandle)->fd, buffers->Tail, buffers->TailLength, 0, FALSE);
+ if (ret == SOCKET_ERROR) {
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return FALSE;
+ }
}
if ((flags & TF_DISCONNECT) == TF_DISCONNECT)
- mono_w32handle_close (handle);
+ mono_w32socket_close (((MonoFDHandle*) sockethandle)->fd);
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return TRUE;
}
SOCKET
mono_w32socket_socket (int domain, int type, int protocol)
{
- MonoW32HandleSocket socket_handle = {0};
- gpointer handle;
- SOCKET sock;
-
- socket_handle.domain = domain;
- socket_handle.type = type;
- socket_handle.protocol = protocol;
- socket_handle.still_readable = 1;
-
- sock = socket (domain, type, protocol);
- if (sock == -1 && domain == AF_INET && type == SOCK_RAW &&
- protocol == 0) {
- /* Retry with protocol == 4 (see bug #54565) */
- // https://bugzilla.novell.com/show_bug.cgi?id=MONO54565
- socket_handle.protocol = 4;
- sock = socket (AF_INET, SOCK_RAW, 4);
- }
+ SocketHandle *sockethandle;
+ gint fd;
+
+retry_socket:
+ MONO_ENTER_GC_SAFE;
+ fd = socket (domain, type, protocol);
+ MONO_EXIT_GC_SAFE;
+ if (fd == -1) {
+ if (domain == AF_INET && type == SOCK_RAW && protocol == 0) {
+ /* Retry with protocol == 4 (see bug #54565) */
+ // https://bugzilla.novell.com/show_bug.cgi?id=MONO54565
+ protocol = 4;
+ goto retry_socket;
+ }
- if (sock == -1) {
gint errnum = errno;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: socket error: %s", __func__, g_strerror (errno));
mono_w32socket_set_last_error (mono_w32socket_convert_error (errnum));
return INVALID_SOCKET;
}
- if (sock >= mono_w32handle_fd_reserve) {
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: File descriptor is too big (%d >= %d)",
- __func__, sock, mono_w32handle_fd_reserve);
-
- mono_w32socket_set_last_error (WSASYSCALLFAILURE);
- close (sock);
-
- return INVALID_SOCKET;
- }
+ sockethandle = socket_data_create(MONO_FDTYPE_SOCKET, fd);
+ sockethandle->domain = domain;
+ sockethandle->type = type;
+ sockethandle->protocol = protocol;
+ sockethandle->still_readable = 1;
/* .net seems to set this by default for SOCK_STREAM, not for
* SOCK_DGRAM (see bug #36322)
{
int ret, true_ = 1;
- ret = setsockopt (sock, SOL_SOCKET, SO_REUSEADDR, &true_, sizeof (true_));
+ MONO_ENTER_GC_SAFE;
+ ret = setsockopt (((MonoFDHandle*) sockethandle)->fd, SOL_SOCKET, SO_REUSEADDR, &true_, sizeof (true_));
+ MONO_EXIT_GC_SAFE;
if (ret == -1) {
- close (sock);
gint errnum = errno;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Error setting SO_REUSEADDR", __func__);
mono_w32socket_set_last_error (mono_w32socket_convert_error (errnum));
+
+ MONO_ENTER_GC_SAFE;
+ close (((MonoFDHandle*) sockethandle)->fd);
+ MONO_EXIT_GC_SAFE;
+
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return INVALID_SOCKET;
}
}
+ mono_fdhandle_insert ((MonoFDHandle*) sockethandle);
- handle = mono_w32handle_new_fd (MONO_W32HANDLE_SOCKET, sock, &socket_handle);
- if (handle == INVALID_HANDLE_VALUE) {
- g_warning ("%s: error creating socket handle", __func__);
- mono_w32socket_set_last_error (WSASYSCALLFAILURE);
- close (sock);
- return INVALID_SOCKET;
- }
-
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: returning socket handle %p", __func__, handle);
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: returning socket handle %p", __func__, GINT_TO_POINTER(((MonoFDHandle*) sockethandle)->fd));
- return sock;
+ return ((MonoFDHandle*) sockethandle)->fd;
}
gint
mono_w32socket_bind (SOCKET sock, struct sockaddr *addr, socklen_t addrlen)
{
- gpointer handle;
+ SocketHandle *sockethandle;
int ret;
- handle = GUINT_TO_POINTER (sock);
- if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
- mono_w32socket_set_last_error (WSAENOTSOCK);
+ if (!mono_fdhandle_lookup_and_ref(sock, (MonoFDHandle**) &sockethandle)) {
+ mono_w32error_set_last (WSAENOTSOCK);
return SOCKET_ERROR;
}
- ret = bind (sock, addr, addrlen);
+ if (((MonoFDHandle*) sockethandle)->type != MONO_FDTYPE_SOCKET) {
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
+ mono_w32error_set_last (WSAENOTSOCK);
+ return SOCKET_ERROR;
+ }
+
+ MONO_ENTER_GC_SAFE;
+ ret = bind (((MonoFDHandle*) sockethandle)->fd, addr, addrlen);
+ MONO_EXIT_GC_SAFE;
if (ret == -1) {
gint errnum = errno;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: bind error: %s", __func__, g_strerror(errno));
mono_w32socket_set_last_error (mono_w32socket_convert_error (errnum));
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return SOCKET_ERROR;
}
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return 0;
}
gint
mono_w32socket_getpeername (SOCKET sock, struct sockaddr *name, socklen_t *namelen)
{
- gpointer handle;
+ SocketHandle *sockethandle;
gint ret;
- handle = GUINT_TO_POINTER (sock);
- if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
- mono_w32socket_set_last_error (WSAENOTSOCK);
+ if (!mono_fdhandle_lookup_and_ref(sock, (MonoFDHandle**) &sockethandle)) {
+ mono_w32error_set_last (WSAENOTSOCK);
return SOCKET_ERROR;
}
- ret = getpeername (sock, name, namelen);
+ if (((MonoFDHandle*) sockethandle)->type != MONO_FDTYPE_SOCKET) {
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
+ mono_w32error_set_last (WSAENOTSOCK);
+ return SOCKET_ERROR;
+ }
+
+ MONO_ENTER_GC_SAFE;
+ ret = getpeername (((MonoFDHandle*) sockethandle)->fd, name, namelen);
+ MONO_EXIT_GC_SAFE;
if (ret == -1) {
gint errnum = errno;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: getpeername error: %s", __func__, g_strerror (errno));
mono_w32socket_set_last_error (mono_w32socket_convert_error (errnum));
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return SOCKET_ERROR;
}
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return 0;
}
gint
mono_w32socket_getsockname (SOCKET sock, struct sockaddr *name, socklen_t *namelen)
{
- gpointer handle;
+ SocketHandle *sockethandle;
gint ret;
- handle = GUINT_TO_POINTER (sock);
- if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
- mono_w32socket_set_last_error (WSAENOTSOCK);
+ if (!mono_fdhandle_lookup_and_ref(sock, (MonoFDHandle**) &sockethandle)) {
+ mono_w32error_set_last (WSAENOTSOCK);
+ return SOCKET_ERROR;
+ }
+
+ if (((MonoFDHandle*) sockethandle)->type != MONO_FDTYPE_SOCKET) {
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
+ mono_w32error_set_last (WSAENOTSOCK);
return SOCKET_ERROR;
}
- ret = getsockname (sock, name, namelen);
+ MONO_ENTER_GC_SAFE;
+ ret = getsockname (((MonoFDHandle*) sockethandle)->fd, name, namelen);
+ MONO_EXIT_GC_SAFE;
if (ret == -1) {
gint errnum = errno;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: getsockname error: %s", __func__, g_strerror (errno));
mono_w32socket_set_last_error (mono_w32socket_convert_error (errnum));
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return SOCKET_ERROR;
}
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return 0;
}
gint
mono_w32socket_getsockopt (SOCKET sock, gint level, gint optname, gpointer optval, socklen_t *optlen)
{
- gpointer handle;
+ SocketHandle *sockethandle;
gint ret;
struct timeval tv;
gpointer tmp_val;
- MonoW32HandleSocket *socket_handle;
- handle = GUINT_TO_POINTER (sock);
- if (!mono_w32handle_lookup (handle, MONO_W32HANDLE_SOCKET, (gpointer *)&socket_handle)) {
- mono_w32socket_set_last_error (WSAENOTSOCK);
+ if (!mono_fdhandle_lookup_and_ref(sock, (MonoFDHandle**) &sockethandle)) {
+ mono_w32error_set_last (WSAENOTSOCK);
+ return SOCKET_ERROR;
+ }
+
+ if (((MonoFDHandle*) sockethandle)->type != MONO_FDTYPE_SOCKET) {
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
+ mono_w32error_set_last (WSAENOTSOCK);
return SOCKET_ERROR;
}
*optlen = sizeof (tv);
}
- ret = getsockopt (sock, level, optname, tmp_val, optlen);
+ MONO_ENTER_GC_SAFE;
+ ret = getsockopt (((MonoFDHandle*) sockethandle)->fd, level, optname, tmp_val, optlen);
+ MONO_EXIT_GC_SAFE;
if (ret == -1) {
gint errnum = errno;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: getsockopt error: %s", __func__, g_strerror (errno));
mono_w32socket_set_last_error (mono_w32socket_convert_error (errnum));
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return SOCKET_ERROR;
}
if (optname == SO_ERROR) {
if (*((int *)optval) != 0) {
*((int *) optval) = mono_w32socket_convert_error (*((int *)optval));
- socket_handle->saved_error = *((int *)optval);
+ sockethandle->saved_error = *((int *)optval);
} else {
- *((int *)optval) = socket_handle->saved_error;
+ *((int *)optval) = sockethandle->saved_error;
}
}
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return 0;
}
gint
mono_w32socket_setsockopt (SOCKET sock, gint level, gint optname, const gpointer optval, socklen_t optlen)
{
- gpointer handle;
+ SocketHandle *sockethandle;
gint ret;
gpointer tmp_val;
#if defined (__linux__)
#endif
struct timeval tv;
- handle = GUINT_TO_POINTER (sock);
- if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
- mono_w32socket_set_last_error (WSAENOTSOCK);
+ if (!mono_fdhandle_lookup_and_ref(sock, (MonoFDHandle**) &sockethandle)) {
+ mono_w32error_set_last (WSAENOTSOCK);
+ return SOCKET_ERROR;
+ }
+
+ if (((MonoFDHandle*) sockethandle)->type != MONO_FDTYPE_SOCKET) {
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
+ mono_w32error_set_last (WSAENOTSOCK);
return SOCKET_ERROR;
}
}
#endif
- ret = setsockopt (sock, level, optname, tmp_val, optlen);
+ MONO_ENTER_GC_SAFE;
+ ret = setsockopt (((MonoFDHandle*) sockethandle)->fd, level, optname, tmp_val, optlen);
+ MONO_EXIT_GC_SAFE;
if (ret == -1) {
gint errnum = errno;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: setsockopt error: %s", __func__, g_strerror (errno));
mono_w32socket_set_last_error (mono_w32socket_convert_error (errnum));
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return SOCKET_ERROR;
}
int type;
socklen_t type_len = sizeof (type);
- if (!getsockopt (sock, level, SO_TYPE, &type, &type_len)) {
- if (type == SOCK_DGRAM || type == SOCK_STREAM)
- setsockopt (sock, level, SO_REUSEPORT, tmp_val, optlen);
+ MONO_ENTER_GC_SAFE;
+ ret = getsockopt (((MonoFDHandle*) sockethandle)->fd, level, SO_TYPE, &type, &type_len);
+ MONO_EXIT_GC_SAFE;
+ if (!ret) {
+ if (type == SOCK_DGRAM || type == SOCK_STREAM) {
+ MONO_ENTER_GC_SAFE;
+ setsockopt (((MonoFDHandle*) sockethandle)->fd, level, SO_REUSEPORT, tmp_val, optlen);
+ MONO_EXIT_GC_SAFE;
+ }
}
}
#endif
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return ret;
}
gint
mono_w32socket_listen (SOCKET sock, gint backlog)
{
- gpointer handle;
+ SocketHandle *sockethandle;
gint ret;
- handle = GUINT_TO_POINTER (sock);
- if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
- mono_w32socket_set_last_error (WSAENOTSOCK);
+ if (!mono_fdhandle_lookup_and_ref(sock, (MonoFDHandle**) &sockethandle)) {
+ mono_w32error_set_last (WSAENOTSOCK);
return SOCKET_ERROR;
}
- ret = listen (sock, backlog);
+ if (((MonoFDHandle*) sockethandle)->type != MONO_FDTYPE_SOCKET) {
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
+ mono_w32error_set_last (WSAENOTSOCK);
+ return SOCKET_ERROR;
+ }
+
+ MONO_ENTER_GC_SAFE;
+ ret = listen (((MonoFDHandle*) sockethandle)->fd, backlog);
+ MONO_EXIT_GC_SAFE;
if (ret == -1) {
gint errnum = errno;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: listen error: %s", __func__, g_strerror (errno));
mono_w32socket_set_last_error (mono_w32socket_convert_error (errnum));
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return SOCKET_ERROR;
}
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return 0;
}
gint
mono_w32socket_shutdown (SOCKET sock, gint how)
{
- MonoW32HandleSocket *socket_handle;
- gpointer handle;
+ SocketHandle *sockethandle;
gint ret;
- handle = GUINT_TO_POINTER (sock);
- if (!mono_w32handle_lookup (handle, MONO_W32HANDLE_SOCKET, (gpointer *)&socket_handle)) {
- mono_w32socket_set_last_error (WSAENOTSOCK);
+ if (!mono_fdhandle_lookup_and_ref(sock, (MonoFDHandle**) &sockethandle)) {
+ mono_w32error_set_last (WSAENOTSOCK);
+ return SOCKET_ERROR;
+ }
+
+ if (((MonoFDHandle*) sockethandle)->type != MONO_FDTYPE_SOCKET) {
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
+ mono_w32error_set_last (WSAENOTSOCK);
return SOCKET_ERROR;
}
if (how == SHUT_RD || how == SHUT_RDWR)
- socket_handle->still_readable = 0;
+ sockethandle->still_readable = 0;
- ret = shutdown (sock, how);
+ MONO_ENTER_GC_SAFE;
+ ret = shutdown (((MonoFDHandle*) sockethandle)->fd, how);
+ MONO_EXIT_GC_SAFE;
if (ret == -1) {
gint errnum = errno;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: shutdown error: %s", __func__, g_strerror (errno));
mono_w32socket_set_last_error (mono_w32socket_convert_error (errnum));
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return SOCKET_ERROR;
}
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return ret;
}
gint
mono_w32socket_disconnect (SOCKET sock, gboolean reuse)
{
- MonoW32HandleSocket *socket_handle;
- gpointer handle;
+ SocketHandle *sockethandle;
SOCKET newsock;
gint ret;
* SOCK_STREAM, SOCK_SEQPACKET or SOCK_RDM (according to msdn)
* if we really wanted to */
- handle = GUINT_TO_POINTER (sock);
- if (!mono_w32handle_lookup (handle, MONO_W32HANDLE_SOCKET, (gpointer *)&socket_handle)) {
- mono_w32socket_set_last_error (WSAENOTSOCK);
+ if (!mono_fdhandle_lookup_and_ref(sock, (MonoFDHandle**) &sockethandle)) {
+ mono_w32error_set_last (WSAENOTSOCK);
return SOCKET_ERROR;
}
- newsock = socket (socket_handle->domain, socket_handle->type, socket_handle->protocol);
+ if (((MonoFDHandle*) sockethandle)->type != MONO_FDTYPE_SOCKET) {
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
+ mono_w32error_set_last (WSAENOTSOCK);
+ return SOCKET_ERROR;
+ }
+
+ MONO_ENTER_GC_SAFE;
+ newsock = socket (sockethandle->domain, sockethandle->type, sockethandle->protocol);
+ MONO_EXIT_GC_SAFE;
if (newsock == -1) {
gint errnum = errno;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: socket error: %s", __func__, g_strerror (errnum));
mono_w32socket_set_last_error (mono_w32socket_convert_error (errnum));
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return SOCKET_ERROR;
}
* should not be a race condition between the old fd being
* closed and the new socket fd being copied over */
do {
- ret = dup2 (newsock, sock);
+ MONO_ENTER_GC_SAFE;
+ ret = dup2 (newsock, ((MonoFDHandle*) sockethandle)->fd);
+ MONO_EXIT_GC_SAFE;
} while (ret == -1 && errno == EAGAIN);
if (ret == -1) {
gint errnum = errno;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: dup2 error: %s", __func__, g_strerror (errnum));
mono_w32socket_set_last_error (mono_w32socket_convert_error (errnum));
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return SOCKET_ERROR;
}
+ MONO_ENTER_GC_SAFE;
close (newsock);
+ MONO_EXIT_GC_SAFE;
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return 0;
}
static gboolean
extension_disconect (SOCKET sock, OVERLAPPED *overlapped, guint32 flags, guint32 reserved)
{
- return mono_w32socket_disconnect (sock, flags & TF_REUSE_SOCKET) == 0;
+ gboolean ret;
+ MONO_ENTER_GC_UNSAFE;
+ ret = mono_w32socket_disconnect (sock, flags & TF_REUSE_SOCKET) == 0;
+ MONO_EXIT_GC_UNSAFE;
+ return ret;
}
static gboolean
extension_transmit_file (SOCKET sock, gpointer file_handle, guint32 bytes_to_write, guint32 bytes_per_send,
OVERLAPPED *ol, TRANSMIT_FILE_BUFFERS *buffers, guint32 flags)
{
- return mono_w32socket_transmit_file (sock, file_handle, buffers, flags, FALSE);
+ gboolean ret;
+ MONO_ENTER_GC_UNSAFE;
+ ret = mono_w32socket_transmit_file (sock, file_handle, buffers, flags, FALSE);
+ MONO_EXIT_GC_UNSAFE;
+ return ret;
}
static struct {
gint
mono_w32socket_ioctl (SOCKET sock, gint32 command, gchar *input, gint inputlen, gchar *output, gint outputlen, glong *written)
{
- gpointer handle;
+ SocketHandle *sockethandle;
gint ret;
gchar *buffer;
- handle = GUINT_TO_POINTER (sock);
- if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
- mono_w32socket_set_last_error (WSAENOTSOCK);
+ if (!mono_fdhandle_lookup_and_ref(sock, (MonoFDHandle**) &sockethandle)) {
+ mono_w32error_set_last (WSAENOTSOCK);
+ return SOCKET_ERROR;
+ }
+
+ if (((MonoFDHandle*) sockethandle)->type != MONO_FDTYPE_SOCKET) {
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
+ mono_w32error_set_last (WSAENOTSOCK);
return SOCKET_ERROR;
}
* actually set an error here...
*/
mono_w32socket_set_last_error (WSAEINVAL);
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return SOCKET_ERROR;
}
if (outputlen < sizeof(gpointer)) {
/* Or here... */
mono_w32socket_set_last_error (WSAEINVAL);
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return SOCKET_ERROR;
}
if (output == NULL) {
/* Or here */
mono_w32socket_set_last_error (WSAEINVAL);
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return SOCKET_ERROR;
}
if (memcmp (guid, &extension_functions[i].guid, sizeof(GUID)) == 0) {
memcpy (output, &extension_functions[i].func, sizeof(gpointer));
*written = sizeof(gpointer);
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return 0;
}
}
mono_w32socket_set_last_error (WSAEINVAL);
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return SOCKET_ERROR;
}
if (inputlen < 3 * sizeof (guint32)) {
mono_w32socket_set_last_error (WSAEINVAL);
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return SOCKET_ERROR;
}
onoff = *((guint32*) input);
- ret = setsockopt (sock, SOL_SOCKET, SO_KEEPALIVE, &onoff, sizeof (guint32));
+ MONO_ENTER_GC_SAFE;
+ ret = setsockopt (((MonoFDHandle*) sockethandle)->fd, SOL_SOCKET, SO_KEEPALIVE, &onoff, sizeof (guint32));
+ MONO_EXIT_GC_SAFE;
if (ret < 0) {
mono_w32socket_set_last_error (mono_w32socket_convert_error (errno));
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return SOCKET_ERROR;
}
keepalivetime /= 1000;
if (keepalivetime == 0 || rem >= 500)
keepalivetime++;
- ret = setsockopt (sock, IPPROTO_TCP, TCP_KEEPIDLE, &keepalivetime, sizeof (guint32));
+ MONO_ENTER_GC_SAFE;
+ ret = setsockopt (((MonoFDHandle*) sockethandle)->fd, IPPROTO_TCP, TCP_KEEPIDLE, &keepalivetime, sizeof (guint32));
+ MONO_EXIT_GC_SAFE;
if (ret == 0) {
rem = keepaliveinterval % 1000;
keepaliveinterval /= 1000;
if (keepaliveinterval == 0 || rem >= 500)
keepaliveinterval++;
- ret = setsockopt (sock, IPPROTO_TCP, TCP_KEEPINTVL, &keepaliveinterval, sizeof (guint32));
+ MONO_ENTER_GC_SAFE;
+ ret = setsockopt (((MonoFDHandle*) sockethandle)->fd, IPPROTO_TCP, TCP_KEEPINTVL, &keepaliveinterval, sizeof (guint32));
+ MONO_EXIT_GC_SAFE;
}
if (ret != 0) {
mono_w32socket_set_last_error (mono_w32socket_convert_error (errno));
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return SOCKET_ERROR;
}
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return 0;
}
#endif
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return 0;
}
buffer = inputlen > 0 ? (gchar*) g_memdup (input, inputlen) : NULL;
- ret = ioctl (sock, command, buffer);
+ MONO_ENTER_GC_SAFE;
+ ret = ioctl (((MonoFDHandle*) sockethandle)->fd, command, buffer);
+ MONO_EXIT_GC_SAFE;
if (ret == -1) {
g_free (buffer);
gint errnum = errno;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: WSAIoctl error: %s", __func__, g_strerror (errno));
mono_w32socket_set_last_error (mono_w32socket_convert_error (errnum));
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return SOCKET_ERROR;
}
if (!buffer) {
*written = 0;
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return 0;
}
g_free (buffer);
*written = inputlen;
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return 0;
}
gboolean
mono_w32socket_close (SOCKET sock)
{
- return mono_w32handle_close (GINT_TO_POINTER (sock));
+ if (!mono_fdhandle_close (sock)) {
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
+ return FALSE;
+ }
+
+ return TRUE;
}
gint
-mono_w32socket_set_blocking (SOCKET socket, gboolean blocking)
+mono_w32socket_set_blocking (SOCKET sock, gboolean blocking)
{
#ifdef O_NONBLOCK
+ SocketHandle *sockethandle;
gint ret;
- gpointer handle;
- handle = GINT_TO_POINTER (socket);
- if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
- mono_w32socket_set_last_error (WSAENOTSOCK);
+ if (!mono_fdhandle_lookup_and_ref(sock, (MonoFDHandle**) &sockethandle)) {
+ mono_w32error_set_last (WSAENOTSOCK);
+ return SOCKET_ERROR;
+ }
+
+ if (((MonoFDHandle*) sockethandle)->type != MONO_FDTYPE_SOCKET) {
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
+ mono_w32error_set_last (WSAENOTSOCK);
return SOCKET_ERROR;
}
/* This works better than ioctl(...FIONBIO...)
* on Linux (it causes connect to return
* EINPROGRESS, but the ioctl doesn't seem to) */
- ret = fcntl (socket, F_GETFL, 0);
- if (ret != -1)
- ret = fcntl (socket, F_SETFL, blocking ? (ret & (~O_NONBLOCK)) : (ret | (O_NONBLOCK)));
+ MONO_ENTER_GC_SAFE;
+ ret = fcntl (((MonoFDHandle*) sockethandle)->fd, F_GETFL, 0);
+ MONO_EXIT_GC_SAFE;
+ if (ret == -1) {
+ gint errnum = mono_w32socket_convert_error (errno);
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fcntl(F_GETFL) error: %s", __func__, g_strerror (errno));
+ mono_w32socket_set_last_error (errnum);
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
+ return SOCKET_ERROR;
+ }
+ MONO_ENTER_GC_SAFE;
+ ret = fcntl (((MonoFDHandle*) sockethandle)->fd, F_SETFL, blocking ? (ret & (~O_NONBLOCK)) : (ret | (O_NONBLOCK)));
+ MONO_EXIT_GC_SAFE;
if (ret == -1) {
- gint errnum = errno;
- mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: ioctl error: %s", __func__, g_strerror (errno));
- mono_w32socket_set_last_error (mono_w32socket_convert_error (errnum));
+ gint errnum = mono_w32socket_convert_error (errno);
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fcntl(F_SETFL) error: %s", __func__, g_strerror (errno));
+ mono_w32socket_set_last_error (errnum);
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return SOCKET_ERROR;
}
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return 0;
#else
mono_w32socket_set_last_error (ERROR_NOT_SUPPORTED);
}
gint
-mono_w32socket_get_available (SOCKET socket, guint64 *amount)
+mono_w32socket_get_available (SOCKET sock, guint64 *amount)
{
+ SocketHandle *sockethandle;
gint ret;
- gpointer handle;
- handle = GINT_TO_POINTER (socket);
- if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
- mono_w32socket_set_last_error (WSAENOTSOCK);
+ if (!mono_fdhandle_lookup_and_ref(sock, (MonoFDHandle**) &sockethandle)) {
+ mono_w32error_set_last (WSAENOTSOCK);
+ return SOCKET_ERROR;
+ }
+
+ if (((MonoFDHandle*) sockethandle)->type != MONO_FDTYPE_SOCKET) {
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
+ mono_w32error_set_last (WSAENOTSOCK);
return SOCKET_ERROR;
}
// the ip buffer.
socklen_t optlen = sizeof (int);
- ret = getsockopt (socket, SOL_SOCKET, SO_NREAD, (gulong*) amount, &optlen);
+ MONO_ENTER_GC_SAFE;
+ ret = getsockopt (((MonoFDHandle*) sockethandle)->fd, SOL_SOCKET, SO_NREAD, (gulong*) amount, &optlen);
+ MONO_EXIT_GC_SAFE;
+ if (ret == -1) {
+ gint errnum = mono_w32socket_convert_error (errno);
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: getsockopt error: %s", __func__, g_strerror (errno));
+ mono_w32socket_set_last_error (errnum);
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
+ return SOCKET_ERROR;
+ }
#else
- ret = ioctl (socket, FIONREAD, (gulong*) amount);
-#endif
-
+ MONO_ENTER_GC_SAFE;
+ ret = ioctl (((MonoFDHandle*) sockethandle)->fd, FIONREAD, (gulong*) amount);
+ MONO_EXIT_GC_SAFE;
if (ret == -1) {
- gint errnum = errno;
+ gint errnum = mono_w32socket_convert_error (errno);
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: ioctl error: %s", __func__, g_strerror (errno));
- mono_w32socket_set_last_error (mono_w32socket_convert_error (errnum));
+ mono_w32socket_set_last_error (errnum);
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return SOCKET_ERROR;
}
+#endif
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
return 0;
}
case ENODEV: return WSAENETDOWN;
#ifdef EPROTOTYPE
case EPROTOTYPE: return WSAEPROTOTYPE;
+#endif
+#ifdef ENXIO
+ case ENXIO: return WSAENXIO;
#endif
default:
g_error ("%s: no translation into winsock error for (%d) \"%s\"", __func__, error, g_strerror (error));
return FALSE;
#endif
}
+
+gboolean
+mono_w32socket_duplicate (gpointer handle, gint32 targetProcessId, gpointer *duplicate_handle)
+{
+ SocketHandle *sockethandle;
+
+ if (!mono_fdhandle_lookup_and_ref (GPOINTER_TO_INT(handle), (MonoFDHandle**) &sockethandle)) {
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
+ return FALSE;
+ }
+
+ if (((MonoFDHandle*) sockethandle)->type != MONO_FDTYPE_SOCKET) {
+ mono_fdhandle_unref ((MonoFDHandle*) sockethandle);
+ mono_w32error_set_last (ERROR_INVALID_HANDLE);
+ return FALSE;
+ }
+
+ *duplicate_handle = handle;
+ return TRUE;
+}
{
MonoInternalThread *curthread = mono_thread_internal_current ();
SOCKET newsock = INVALID_SOCKET;
+ MONO_ENTER_GC_SAFE;
ALERTABLE_SOCKET_CALL (FD_ACCEPT_BIT, blocking, TRUE, newsock, accept, s, addr, addrlen);
+ MONO_EXIT_GC_SAFE;
return newsock;
}
int mono_w32socket_connect (SOCKET s, const struct sockaddr *name, int namelen, gboolean blocking)
{
int ret = SOCKET_ERROR;
+ MONO_ENTER_GC_SAFE;
ALERTABLE_SOCKET_CALL (FD_CONNECT_BIT, blocking, FALSE, ret, connect, s, name, namelen);
ret = WSAGetLastError () != 0 ? SOCKET_ERROR : 0;
+ MONO_EXIT_GC_SAFE;
return ret;
}
{
MonoInternalThread *curthread = mono_thread_internal_current ();
int ret = SOCKET_ERROR;
+ MONO_ENTER_GC_SAFE;
ALERTABLE_SOCKET_CALL (FD_READ_BIT, blocking, TRUE, ret, recv, s, buf, len, flags);
+ MONO_EXIT_GC_SAFE;
return ret;
}
int mono_w32socket_recvfrom (SOCKET s, char *buf, int len, int flags, struct sockaddr *from, socklen_t *fromlen, gboolean blocking)
{
int ret = SOCKET_ERROR;
+ MONO_ENTER_GC_SAFE;
ALERTABLE_SOCKET_CALL (FD_READ_BIT, blocking, TRUE, ret, recvfrom, s, buf, len, flags, from, fromlen);
+ MONO_EXIT_GC_SAFE;
return ret;
}
int mono_w32socket_recvbuffers (SOCKET s, WSABUF *lpBuffers, guint32 dwBufferCount, guint32 *lpNumberOfBytesRecvd, guint32 *lpFlags, gpointer lpOverlapped, gpointer lpCompletionRoutine, gboolean blocking)
{
int ret = SOCKET_ERROR;
+ MONO_ENTER_GC_SAFE;
ALERTABLE_SOCKET_CALL (FD_READ_BIT, blocking, TRUE, ret, WSARecv, s, lpBuffers, dwBufferCount, lpNumberOfBytesRecvd, lpFlags, lpOverlapped, lpCompletionRoutine);
+ MONO_EXIT_GC_SAFE;
return ret;
}
int mono_w32socket_send (SOCKET s, char *buf, int len, int flags, gboolean blocking)
{
int ret = SOCKET_ERROR;
+ MONO_ENTER_GC_SAFE;
ALERTABLE_SOCKET_CALL (FD_WRITE_BIT, blocking, FALSE, ret, send, s, buf, len, flags);
+ MONO_EXIT_GC_SAFE;
return ret;
}
int mono_w32socket_sendto (SOCKET s, const char *buf, int len, int flags, const struct sockaddr *to, int tolen, gboolean blocking)
{
int ret = SOCKET_ERROR;
+ MONO_ENTER_GC_SAFE;
ALERTABLE_SOCKET_CALL (FD_WRITE_BIT, blocking, FALSE, ret, sendto, s, buf, len, flags, to, tolen);
+ MONO_EXIT_GC_SAFE;
return ret;
}
int mono_w32socket_sendbuffers (SOCKET s, WSABUF *lpBuffers, guint32 dwBufferCount, guint32 *lpNumberOfBytesRecvd, guint32 lpFlags, gpointer lpOverlapped, gpointer lpCompletionRoutine, gboolean blocking)
{
int ret = SOCKET_ERROR;
+ MONO_ENTER_GC_SAFE;
ALERTABLE_SOCKET_CALL (FD_WRITE_BIT, blocking, FALSE, ret, WSASend, s, lpBuffers, dwBufferCount, lpNumberOfBytesRecvd, lpFlags, lpOverlapped, lpCompletionRoutine);
+ MONO_EXIT_GC_SAFE;
return ret;
}
{
LOGDEBUG (g_message ("%06d - Performing %s TransmitFile () on socket %d", GetCurrentThreadId (), blocking ? "blocking" : "non-blocking", hSocket));
- int error = 0;
+ int error = 0, ret;
+
+ MONO_ENTER_GC_SAFE;
+
if (blocking) {
OVERLAPPED overlapped = { 0 };
overlapped.hEvent = WSACreateEvent ();
- if (overlapped.hEvent == WSA_INVALID_EVENT)
- return FALSE;
+ if (overlapped.hEvent == WSA_INVALID_EVENT) {
+ ret = FALSE;
+ goto done;
+ }
if (!TransmitFile (hSocket, hFile, 0, 0, &overlapped, lpTransmitBuffers, dwReserved)) {
error = WSAGetLastError ();
if (error == WSA_IO_PENDING) {
blocking ? "blocking" : "non-blocking", hSocket, error == 0, error));
WSASetLastError (error);
- return error == 0;
+ ret = error == 0;
+
+done:
+ MONO_EXIT_GC_SAFE;
+ return ret;
}
#endif /* #if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT | HAVE_UWP_WINAPI_SUPPORT) */
DWORD output_bytes;
gint ret;
+ MONO_ENTER_GC_SAFE;
+
/* Use the SIO_GET_EXTENSION_FUNCTION_POINTER to determine
* the address of the disconnect method without taking
* a hard dependency on a single provider
GUID disconnect_guid = WSAID_DISCONNECTEX;
ret = WSAIoctl (sock, SIO_GET_EXTENSION_FUNCTION_POINTER, &disconnect_guid, sizeof (GUID), &disconnect, sizeof (LPFN_DISCONNECTEX), &output_bytes, NULL, NULL);
if (ret == 0) {
- if (!disconnect (sock, NULL, reuse ? TF_REUSE_SOCKET : 0, 0))
- return WSAGetLastError ();
+ if (!disconnect (sock, NULL, reuse ? TF_REUSE_SOCKET : 0, 0)) {
+ ret = WSAGetLastError ();
+ goto done;
+ }
- return 0;
+ ret = 0;
+ goto done;
}
GUID transmit_file_guid = WSAID_TRANSMITFILE;
ret = WSAIoctl (sock, SIO_GET_EXTENSION_FUNCTION_POINTER, &transmit_file_guid, sizeof (GUID), &transmit_file, sizeof (LPFN_TRANSMITFILE), &output_bytes, NULL, NULL);
if (ret == 0) {
- if (!transmit_file (sock, NULL, 0, 0, NULL, NULL, TF_DISCONNECT | (reuse ? TF_REUSE_SOCKET : 0)))
- return WSAGetLastError ();
+ if (!transmit_file (sock, NULL, 0, 0, NULL, NULL, TF_DISCONNECT | (reuse ? TF_REUSE_SOCKET : 0))) {
+ ret = WSAGetLastError ();
+ goto done;
+ }
- return 0;
+ ret = 0;
+ goto done;
}
- return ERROR_NOT_SUPPORTED;
+ ret = ERROR_NOT_SUPPORTED;
+
+done:
+ MONO_EXIT_GC_SAFE;
+ return ret;
}
#endif /* #if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT | HAVE_UWP_WINAPI_SUPPORT) */
gint
mono_w32socket_set_blocking (SOCKET sock, gboolean blocking)
{
+ gint ret;
gulong nonblocking_long = !blocking;
- return ioctlsocket (sock, FIONBIO, &nonblocking_long);
+ MONO_ENTER_GC_SAFE;
+ ret = ioctlsocket (sock, FIONBIO, &nonblocking_long);
+ MONO_EXIT_GC_SAFE;
+ return ret;
}
gint
mono_w32socket_get_available (SOCKET sock, guint64 *amount)
{
- return ioctlsocket (sock, FIONREAD, (int*) amount);
+ gint ret;
+ MONO_ENTER_GC_SAFE;
+ ret = ioctlsocket (sock, FIONREAD, (int*) amount);
+ MONO_EXIT_GC_SAFE;
+ return ret;
}
void
error_init (error);
return TRUE;
}
+
+gboolean
+mono_w32socket_duplicate (gpointer handle, gint32 targetProcessId, gpointer *duplicate_handle)
+{
+ gboolean ret;
+
+ MONO_ENTER_GC_SAFE;
+ ret = DuplicateHandle (GetCurrentProcess(), handle, GINT_TO_POINTER(targetProcessId), duplicate_handle, 0, 0, 0x00000002 /* DUPLICATE_SAME_ACCESS */);
+ MONO_EXIT_GC_SAFE;
+
+ return ret;
+}
static SOCKET
mono_w32socket_socket (int domain, int type, int protocol)
{
- return WSASocket (domain, type, protocol, NULL, 0, WSA_FLAG_OVERLAPPED);
+ SOCKET ret;
+ MONO_ENTER_GC_SAFE;
+ ret = WSASocket (domain, type, protocol, NULL, 0, WSA_FLAG_OVERLAPPED);
+ MONO_EXIT_GC_SAFE;
+ return ret;
}
static gint
mono_w32socket_bind (SOCKET sock, struct sockaddr *addr, socklen_t addrlen)
{
- return bind (sock, addr, addrlen);
+ gint ret;
+ MONO_ENTER_GC_SAFE;
+ ret = bind (sock, addr, addrlen);
+ MONO_EXIT_GC_SAFE;
+ return ret;
}
static gint
mono_w32socket_getpeername (SOCKET sock, struct sockaddr *name, socklen_t *namelen)
{
- return getpeername (sock, name, namelen);
+ gint ret;
+ MONO_ENTER_GC_SAFE;
+ ret = getpeername (sock, name, namelen);
+ MONO_EXIT_GC_SAFE;
+ return ret;
}
static gint
mono_w32socket_getsockname (SOCKET sock, struct sockaddr *name, socklen_t *namelen)
{
- return getsockname (sock, name, namelen);
+ gint ret;
+ MONO_ENTER_GC_SAFE;
+ ret = getsockname (sock, name, namelen);
+ MONO_EXIT_GC_SAFE;
+ return ret;
}
static gint
mono_w32socket_getsockopt (SOCKET sock, gint level, gint optname, gpointer optval, socklen_t *optlen)
{
- return getsockopt (sock, level, optname, optval, optlen);
+ gint ret;
+ MONO_ENTER_GC_SAFE;
+ ret = getsockopt (sock, level, optname, optval, optlen);
+ MONO_EXIT_GC_SAFE;
+ return ret;
}
static gint
mono_w32socket_setsockopt (SOCKET sock, gint level, gint optname, const gpointer optval, socklen_t optlen)
{
- return setsockopt (sock, level, optname, optval, optlen);
+ gint ret;
+ MONO_ENTER_GC_SAFE;
+ ret = setsockopt (sock, level, optname, optval, optlen);
+ MONO_EXIT_GC_SAFE;
+ return ret;
}
static gint
mono_w32socket_listen (SOCKET sock, gint backlog)
{
- return listen (sock, backlog);
+ gint ret;
+ MONO_ENTER_GC_SAFE;
+ ret = listen (sock, backlog);
+ MONO_EXIT_GC_SAFE;
+ return ret;
}
static gint
mono_w32socket_shutdown (SOCKET sock, gint how)
{
- return shutdown (sock, how);
+ gint ret;
+ MONO_ENTER_GC_SAFE;
+ ret = shutdown (sock, how);
+ MONO_EXIT_GC_SAFE;
+ return ret;
}
static gint
mono_w32socket_ioctl (SOCKET sock, gint32 command, gchar *input, gint inputlen, gchar *output, gint outputlen, glong *written)
{
- return WSAIoctl (sock, command, input, inputlen, output, outputlen, written, NULL, NULL);
+ gint ret;
+ MONO_ENTER_GC_SAFE;
+ ret = WSAIoctl (sock, command, input, inputlen, output, outputlen, written, NULL, NULL);
+ MONO_EXIT_GC_SAFE;
+ return ret;
}
static gboolean
mono_w32socket_close (SOCKET sock)
{
- return CloseHandle (sock);
+ gboolean ret;
+ MONO_ENTER_GC_SAFE;
+ ret = CloseHandle (sock);
+ MONO_EXIT_GC_SAFE;
+ return ret;
}
#endif /* HOST_WIN32 */
* polling system does not notify when the socket is closed */
mono_threadpool_io_remove_socket (GPOINTER_TO_INT (sock));
- MONO_ENTER_GC_SAFE;
mono_w32socket_close ((SOCKET) sock);
- MONO_EXIT_GC_SAFE;
}
gint32
return NULL;
}
- MONO_ENTER_GC_SAFE;
newsock = mono_w32socket_accept (sock, NULL, 0, blocking);
- MONO_EXIT_GC_SAFE;
-
if (newsock == INVALID_SOCKET)
*werror = mono_w32socket_get_last_error ();
error_init (error);
*werror = 0;
- MONO_ENTER_GC_SAFE;
-
ret = mono_w32socket_listen (sock, backlog);
-
- MONO_EXIT_GC_SAFE;
-
if (ret == SOCKET_ERROR)
*werror = mono_w32socket_get_last_error ();
}
}
sa = (salen <= 128) ? (gchar *)alloca (salen) : (gchar *)g_malloc0 (salen);
- MONO_ENTER_GC_SAFE;
-
ret = mono_w32socket_getsockname (sock, (struct sockaddr *)sa, &salen);
-
- MONO_EXIT_GC_SAFE;
-
if (ret == SOCKET_ERROR) {
*werror = mono_w32socket_get_last_error ();
if (salen > 128)
sa = (salen <= 128) ? (gchar *)alloca (salen) : (gchar *)g_malloc0 (salen);
/* Note: linux returns just 2 for AF_UNIX. Always. */
- MONO_ENTER_GC_SAFE;
-
ret = mono_w32socket_getpeername (sock, (struct sockaddr *)sa, &salen);
-
- MONO_EXIT_GC_SAFE;
-
if (ret == SOCKET_ERROR) {
*werror = mono_w32socket_get_last_error ();
if (salen > 128)
return;
}
- MONO_ENTER_GC_SAFE;
ret = mono_w32socket_connect (sock, sa, sa_size, blocking);
- MONO_EXIT_GC_SAFE;
-
if (ret == SOCKET_ERROR)
*werror = mono_w32socket_get_last_error ();
return;
}
- MONO_ENTER_GC_SAFE;
*werror = mono_w32socket_disconnect (sock, reuse);
- MONO_EXIT_GC_SAFE;
mono_thread_info_uninstall_interrupt (&interrupted);
if (interrupted)
}
#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT | HAVE_UWP_WINAPI_SUPPORT) */
+MonoBoolean
+ves_icall_System_Net_Sockets_Socket_Duplicate_internal (gpointer handle, gint32 targetProcessId, gpointer *duplicate_handle, gint32 *werror, MonoError *error)
+{
+ error_init (error);
+
+ *werror = 0;
+ if (!mono_w32socket_duplicate (handle, targetProcessId, duplicate_handle)) {
+ *werror = mono_w32error_get_last ();
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
gint32
ves_icall_System_Net_Sockets_Socket_Receive_internal (gsize sock, MonoArrayHandle buffer, gint32 offset, gint32 count, gint32 flags, gint32 *werror, gboolean blocking, MonoError *error)
{
uint32_t gchandle;
gchar *buf = MONO_ARRAY_HANDLE_PIN (buffer, gchar, offset, &gchandle);
- MONO_ENTER_GC_SAFE;
ret = mono_w32socket_recv (sock, buf, count, recvflags, blocking);
- MONO_EXIT_GC_SAFE;
mono_gchandle_free (gchandle);
uint32_t gchandle;
WSABUF *wsabufs = MONO_ARRAY_HANDLE_PIN (buffers, WSABUF, 0, &gchandle);
- MONO_ENTER_GC_SAFE;
ret = mono_w32socket_recvbuffers (sock, wsabufs, count, &recv, &recvflags, NULL, NULL, blocking);
- MONO_EXIT_GC_SAFE;
mono_gchandle_free (gchandle);
uint32_t gchandle;
buf = MONO_ARRAY_HANDLE_PIN (buffer, gchar, offset, &gchandle);
- MONO_ENTER_GC_SAFE;
ret = mono_w32socket_recvfrom (sock, buf, count, recvflags, sa, &sa_size, blocking);
- MONO_EXIT_GC_SAFE;
mono_gchandle_free (gchandle);
uint32_t gchandle;
gchar *buf = MONO_ARRAY_HANDLE_PIN (buffer, gchar, offset, &gchandle);
- MONO_ENTER_GC_SAFE;
ret = mono_w32socket_send (sock, buf, count, sendflags, blocking);
- MONO_EXIT_GC_SAFE;
mono_gchandle_free (gchandle);
uint32_t gchandle;
WSABUF *wsabufs = MONO_ARRAY_HANDLE_PIN (buffers, WSABUF, 0, &gchandle);
- MONO_ENTER_GC_SAFE;
ret = mono_w32socket_sendbuffers (sock, wsabufs, count, &sent, sendflags, NULL, NULL, blocking);
- MONO_EXIT_GC_SAFE;
mono_gchandle_free (gchandle);
uint32_t gchandle;
gchar *buf = MONO_ARRAY_HANDLE_PIN (buffer, gchar, offset, &gchandle);
- MONO_ENTER_GC_SAFE;
ret = mono_w32socket_sendto (sock, buf, count, sendflags, sa, sa_size, blocking);
- MONO_EXIT_GC_SAFE;
mono_gchandle_free (gchandle);
return;
}
- MONO_ENTER_GC_SAFE;
-
/* No need to deal with MulticastOption names here, because
* you cant getsockopt AddMembership or DropMembership (the
* int getsockopt will error, causing an exception)
ret = mono_w32socket_getsockopt (sock, system_level, system_name, &val, &valsize);
}
- MONO_EXIT_GC_SAFE;
-
if (ret == SOCKET_ERROR) {
*werror = mono_w32socket_get_last_error ();
return;
uint32_t gchandle;
guchar *buf = MONO_ARRAY_HANDLE_PIN (byte_val, guchar, 0, &gchandle);
- MONO_ENTER_GC_SAFE;
-
ret = mono_w32socket_getsockopt (sock, system_level, system_name, buf, &valsize);
- MONO_EXIT_GC_SAFE;
-
mono_gchandle_free (gchandle);
if (ret == SOCKET_ERROR)
return;
}
- MONO_ENTER_GC_SAFE;
-
/* Currently, the values for how (recv=0, send=1, both=2) match the BSD API */
ret = mono_w32socket_shutdown (sock, how);
-
- MONO_EXIT_GC_SAFE;
-
if (ret == SOCKET_ERROR)
*werror = mono_w32socket_get_last_error ();
o_buffer = MONO_ARRAY_HANDLE_PIN (output, gchar, 0, &o_gchandle);
}
- MONO_ENTER_GC_SAFE;
-
ret = mono_w32socket_ioctl (sock, code, i_buffer, i_len, o_buffer, o_len, &output_bytes);
- MONO_EXIT_GC_SAFE;
-
if (i_gchandle)
mono_gchandle_free (i_gchandle);
if (o_gchandle)
g_free (address);
- MONO_ENTER_GC_SAFE;
-
switch (family) {
case AF_INET: {
#if HAVE_SOCKADDR_IN_SIN_LEN
saddr.sin_len = sizeof (saddr);
#endif
+ MONO_ENTER_GC_SAFE;
ret = getnameinfo ((struct sockaddr*)&saddr, sizeof (saddr), hostname, sizeof (hostname), NULL, 0, 0) == 0;
+ MONO_EXIT_GC_SAFE;
break;
}
#ifdef HAVE_STRUCT_SOCKADDR_IN6
#if HAVE_SOCKADDR_IN6_SIN_LEN
saddr6.sin6_len = sizeof (saddr6);
#endif
+ MONO_ENTER_GC_SAFE;
ret = getnameinfo ((struct sockaddr*)&saddr6, sizeof (saddr6), hostname, sizeof (hostname), NULL, 0, 0) == 0;
+ MONO_EXIT_GC_SAFE;
break;
}
#endif
g_assert_not_reached ();
}
- MONO_EXIT_GC_SAFE;
-
if (!ret)
return FALSE;
buffers.TailLength = mono_array_handle_length (post_buffer);
}
- MONO_ENTER_GC_SAFE;
ret = mono_w32socket_transmit_file (sock, file, &buffers, flags, blocking);
- MONO_EXIT_GC_SAFE;
if (pre_buffer_gchandle)
mono_gchandle_free (pre_buffer_gchandle);
void
ves_icall_System_Net_Sockets_Socket_Disconnect_internal (gsize sock, MonoBoolean reuse, gint32 *werror, MonoError *error);
+MonoBoolean
+ves_icall_System_Net_Sockets_Socket_Duplicate_internal (gpointer handle, gint32 targetProcessId, gpointer *duplicate_handle, gint32 *werror, MonoError *error);
+
gboolean
ves_icall_System_Net_Sockets_Socket_SendFile_internal (gsize sock, MonoStringHandle filename,
MonoArrayHandle pre_buffer, MonoArrayHandle post_buffer,
type-checking.c \
lldb.h \
lldb.c \
- memory-access.c
+ memory-access.c \
+ mini-profiler.c
test_sources = \
basic-calls.cs \
basic-long.cs \
bench.cs \
+ builtin-types.cs \
objects.cs \
arrays.cs \
basic-float.cs \
basic-float.exe \
basic-long.exe \
basic-calls.exe \
+ builtin-types.exe \
objects.exe \
arrays.exe \
basic-math.exe \
regtests_DISABLED =
if FULL_AOT_TESTS
-regtests_DISABLED +=
+regtests_DISABLED += builtin-types.exe
endif
regtests = $(filter-out $(regtests_DISABLED),$(regtests_UNIVERSAL))
basic-vectors.exe: basic-vectors.cs TestDriver.dll
$(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:$(CLASS)/System.Numerics.dll -r:$(CLASS)/System.Numerics.Vectors.dll
+builtin-types.exe: builtin-types.cs TestDriver.dll
+ $(MCS) -out:$@ $(CSFLAGS) -define:ARCH_$(shell echo $$((8 * $(SIZEOF_VOID_P)))) $< -r:TestDriver.dll
+
nacl.exe: nacl.cs TestDriver.dll
$(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:$(CLASS)/Mono.Simd.dll
#ifdef DISABLE_REMOTING
if (tramp_type == MONO_TRAMPOLINE_GENERIC_VIRTUAL_REMOTING)
continue;
-#endif
-#ifndef MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD
- if (tramp_type == MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD)
- continue;
#endif
mono_arch_create_generic_trampoline ((MonoTrampolineType)tramp_type, &info, acfg->aot_opts.use_trampolines_page? 2: TRUE);
emit_trampoline (acfg, acfg->got_offset, info);
}
}
-#ifdef MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD_AOT
- mono_arch_create_handler_block_trampoline (&info, TRUE);
- emit_trampoline (acfg, acfg->got_offset, info);
-#endif
-
if (mono_aot_mode_is_interp (&acfg->aot_opts)) {
mono_arch_get_enter_icall_trampoline (&info);
emit_trampoline (acfg, acfg->got_offset, info);
#ifdef ENABLE_LLVM
if (acfg->llvm) {
llvm_acfg = acfg;
- mono_llvm_create_aot_module (acfg->image->assembly, acfg->global_prefix, TRUE, acfg->aot_opts.static_link, acfg->aot_opts.llvm_only);
+ mono_llvm_create_aot_module (acfg->image->assembly, acfg->global_prefix, acfg->nshared_got_entries, TRUE, acfg->aot_opts.static_link, acfg->aot_opts.llvm_only);
}
#endif
g_slist_free (nesting [i]);
g_free (nesting);
}
+ jinfo->from_llvm = 1;
} else {
len = mono_jit_info_size (flags, num_clauses, num_holes);
jinfo = (MonoJitInfo *)alloc0_jit_info_data (domain, len, async);
return code;
}
-/*
- * mono_aot_get_method:
- *
- * Return a pointer to the AOTed native code for METHOD if it can be found,
- * NULL otherwise.
- * On platforms with function pointers, this doesn't return a function pointer.
- */
-gpointer
-mono_aot_get_method (MonoDomain *domain, MonoMethod *method)
-{
- MonoError error;
-
- gpointer res = mono_aot_get_method_checked (domain, method, &error);
- /* This is external only, so its ok to raise here */
- mono_error_raise_exception (&error); /* OK to throw, external only without a good alternative */
- return res;
-}
-
/**
* Same as mono_aot_get_method, but we try to avoid loading any metadata from the
* method.
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
+using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
m.Invoke (arr, null);
return 0;
}
+
+ public static int test_0_fault_clauses () {
+ object [] data = { 1, 2, 3 };
+ int [] expected = { 1, 2, 3 };
+
+ try {
+ Action d = delegate () { data.Cast<IEnumerable> ().GetEnumerator ().MoveNext (); };
+ d ();
+ } catch (Exception ex) {
+ }
+ return 0;
+ }
}
--- /dev/null
+// #define ARCH_32
+#define NINT_JIT_OPTIMIZED
+
+using System;
+using System.Diagnostics;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+
+public class BuiltinTests {
+ static int test_0_nint_ctor ()
+ {
+ var x = new nint (10);
+ var y = new nint (x);
+ var z = new nint (new nint (20));
+ if ((int)x != 10)
+ return 1;
+ if ((int)y != 10)
+ return 2;
+ if ((int)z != 20)
+ return 3;
+ return 0;
+ }
+
+ static int test_0_nint_casts ()
+ {
+ var x = (nint)10;
+ var y = (nint)20L;
+
+ if ((int)x != 10)
+ return 1;
+ if ((long)x != 10L)
+ return 2;
+ if ((int)y != 20)
+ return 3;
+ if ((long)y != 20L)
+ return 4;
+ return 0;
+ }
+
+ static int test_0_nint_plus ()
+ {
+ var x = (nint)10;
+ var z = +x;
+ if ((int)z != 10)
+ return 1;
+ return 0;
+ }
+
+ static int test_0_nint_neg ()
+ {
+ var x = (nint)10;
+ var z = -x;
+ if ((int)z != -10)
+ return 1;
+ return 0;
+ }
+
+ static int test_0_nint_comp ()
+ {
+ var x = (nint)10;
+ var z = ~x;
+ if ((int)z != ~10)
+ return 1;
+ return 0;
+ }
+
+#if FALSE
+ static int test_0_nint_inc ()
+ {
+ var x = (nint)10;
+ ++x;
+ if ((int)x != 11)
+ return 1;
+ return 0;
+ }
+
+ static int test_0_nint_dec ()
+ {
+ var x = (nint)10;
+ --x;
+ if ((int)x != 9)
+ return 1;
+ return 0;
+ }
+#endif
+
+ static int test_0_nint_add ()
+ {
+ var x = (nint)10;
+ var y = (nint)20;
+ var z = x + y;
+ if ((int)z != 30)
+ return 1;
+ return 0;
+ }
+
+ static int test_0_nint_sub ()
+ {
+ var x = (nint)10;
+ var y = (nint)20;
+ var z = x - y;
+ if ((int)z != -10)
+ return 1;
+ return 0;
+ }
+
+ static int test_0_nint_mul ()
+ {
+ var x = (nint)10;
+ var y = (nint)20;
+ var z = x * y;
+ if ((int)z != 200)
+ return 1;
+ return 0;
+ }
+
+ static int test_0_nint_div ()
+ {
+ var x = (nint)30;
+ var y = (nint)3;
+ var z = x / y;
+ if ((int)z != 10)
+ return 1;
+ return 0;
+ }
+
+ static int test_0_nint_rem ()
+ {
+ var x = (nint)22;
+ var y = (nint)10;
+ var z = x % y;
+ if ((int)z != 2)
+ return 1;
+ return 0;
+ }
+
+ static int test_0_nint_and ()
+ {
+ var x = (nint)0x30;
+ var y = (nint)0x11;
+ var z = x & y;
+ if ((int)z != 0x10)
+ return 1;
+ return 0;
+ }
+
+ static int test_0_nint_or ()
+ {
+ var x = (nint)0x0F;
+ var y = (nint)0xF0;
+ var z = x | y;
+ if ((int)z != 0xFF)
+ return 1;
+ return 0;
+ }
+
+ static int test_0_nint_xor ()
+ {
+ var x = (nint)0xFF;
+ var y = (nint)0xF0;
+ var z = x ^ y;
+ if ((int)z != 0x0F)
+ return 1;
+ return 0;
+ }
+
+ static int test_0_nint_shl ()
+ {
+ var x = (nint)10;
+ var z = x << 2;
+ if ((int)z != 40)
+ return 1;
+ return 0;
+ }
+
+ static int test_0_nint_shr ()
+ {
+ var x = (nint)10;
+ var z = x >> 2;
+ if ((int)z != 2)
+ return 1;
+ return 0;
+ }
+
+ static int test_0_nint_cmp_same_val ()
+ {
+ var x = (nint)10;
+ var y = (nint)10;
+ if (!(x == y))
+ return 1;
+ if (x != y)
+ return 2;
+ if (x < y)
+ return 3;
+ if (x > y)
+ return 4;
+ if (!(x <= y))
+ return 5;
+ if (!(x >= y))
+ return 6;
+ return 0;
+ }
+
+ static int test_0_nint_cmp_small_val ()
+ {
+ var x = (nint)5;
+ var y = (nint)10;
+ if (x == y)
+ return 1;
+ if (!(x != y))
+ return 2;
+ if (!(x < y))
+ return 3;
+ if (x > y)
+ return 4;
+ if (!(x <= y))
+ return 5;
+ if (x >= y)
+ return 6;
+ return 0;
+ }
+
+ static int test_0_nint_cmp_large_val ()
+ {
+ var x = (nint)20;
+ var y = (nint)10;
+ if (x == y)
+ return 1;
+ if (!(x != y))
+ return 2;
+ if (x < y)
+ return 3;
+ if (!(x > y))
+ return 4;
+ if (x <= y)
+ return 1;
+ if (!(x >= y))
+ return 1;
+ return 0;
+ }
+
+ // static int test_0_nint_call_boxed_equals ()
+ // {
+ // object x = new nint (10);
+ // object y = new nint (10);
+ // if (!x.Equals (y))
+ // return 1;
+ // return 0;
+ // }
+
+ static int test_0_nint_call_boxed_funs ()
+ {
+ object x = new nint (10);
+ object y = new nint (10);
+ if (x.GetHashCode () == 0)
+ return 2;
+ if (x.ToString () != "10")
+ return 3;
+ return 0;
+ }
+
+ public int test_0_nint_unboxed_member_calls ()
+ {
+ var x = (nint)10;
+#if FALSE
+ if (!x.Equals (x))
+ return 1;
+#endif
+ if (x != nint.Parse ("10"))
+ return 2;
+ return 0;
+ }
+
+ static int test_0_nuint_ctor ()
+ {
+ var x = new nuint (10u);
+ var y = new nuint (x);
+ var z = new nuint (new nuint (20u));
+ if ((uint)x != 10)
+ return 1;
+ if ((uint)y != 10)
+ return 2;
+ if ((uint)z != 20)
+ return 3;
+ return 0;
+ }
+
+ static int test_0_nuint_casts ()
+ {
+ var x = (nuint)10;
+ var y = (nuint)20L;
+
+ if ((uint)x != 10)
+ return 1;
+ if ((ulong)x != 10L)
+ return 2;
+ if ((uint)y != 20)
+ return 3;
+ if ((ulong)y != 20L)
+ return 4;
+ return 0;
+ }
+
+ static int test_0_nuint_plus ()
+ {
+ var x = (nuint)10;
+ var z = +x;
+ if ((uint)z != 10)
+ return 1;
+ return 0;
+ }
+
+ // static int test_0_nuint_neg ()
+ // {
+ // var x = (nuint)10;
+ // var z = -x;
+ // if ((uint)z != -10)
+ // return 1;
+ // return 0;
+ // }
+
+ static int test_0_nuint_comp ()
+ {
+ var x = (nuint)10;
+ var z = ~x;
+ if ((uint)z != ~10u)
+ return 1;
+ return 0;
+ }
+
+#if FALSE
+ static int test_0_nuint_inc ()
+ {
+ var x = (nuint)10;
+ ++x;
+ if ((uint)x != 11)
+ return 1;
+ return 0;
+ }
+
+ static int test_0_nuint_dec ()
+ {
+ var x = (nuint)10;
+ --x;
+ if ((uint)x != 9)
+ return 1;
+ return 0;
+ }
+#endif
+
+ static int test_0_nuint_add ()
+ {
+ var x = (nuint)10;
+ var y = (nuint)20;
+ var z = x + y;
+ if ((uint)z != 30)
+ return 1;
+ return 0;
+ }
+
+ static int test_0_nuint_sub ()
+ {
+ var x = (nuint)20;
+ var y = (nuint)5;
+ var z = x - y;
+ if ((uint)z != 15)
+ return 1;
+ return 0;
+ }
+
+ static int test_0_nuint_mul ()
+ {
+ var x = (nuint)10;
+ var y = (nuint)20;
+ var z = x * y;
+ if ((uint)z != 200)
+ return 1;
+ return 0;
+ }
+
+ static int test_0_nuint_div ()
+ {
+ var x = (nuint)30;
+ var y = (nuint)3;
+ var z = x / y;
+ if ((uint)z != 10)
+ return 1;
+ return 0;
+ }
+
+ static int test_0_nuint_rem ()
+ {
+ var x = (nuint)22;
+ var y = (nuint)10;
+ var z = x % y;
+ if ((uint)z != 2)
+ return 1;
+ return 0;
+ }
+
+ static int test_0_nuint_and ()
+ {
+ var x = (nuint)0x30;
+ var y = (nuint)0x11;
+ var z = x & y;
+ if ((uint)z != 0x10)
+ return 1;
+ return 0;
+ }
+
+ static int test_0_nuint_or ()
+ {
+ var x = (nuint)0x0F;
+ var y = (nuint)0xF0;
+ var z = x | y;
+ if ((uint)z != 0xFF)
+ return 1;
+ return 0;
+ }
+
+ static int test_0_nuint_xor ()
+ {
+ var x = (nuint)0xFF;
+ var y = (nuint)0xF0;
+ var z = x ^ y;
+ if ((uint)z != 0x0F)
+ return 1;
+ return 0;
+ }
+
+ static int test_0_nuint_shl ()
+ {
+ var x = (nuint)10;
+ var z = x << 2;
+ if ((uint)z != 40)
+ return 1;
+ return 0;
+ }
+
+ static int test_0_nuint_shr ()
+ {
+ var x = (nuint)10;
+ var z = x >> 2;
+ if ((uint)z != 2)
+ return 1;
+ return 0;
+ }
+
+ static int test_0_nuint_cmp_same_val ()
+ {
+ var x = (nuint)10;
+ var y = (nuint)10;
+ if (!(x == y))
+ return 1;
+ if (x != y)
+ return 2;
+ if (x < y)
+ return 3;
+ if (x > y)
+ return 4;
+ if (!(x <= y))
+ return 5;
+ if (!(x >= y))
+ return 6;
+ return 0;
+ }
+
+ static int test_0_nuint_cmp_small_val ()
+ {
+ var x = (nuint)5;
+ var y = (nuint)10;
+ if (x == y)
+ return 1;
+ if (!(x != y))
+ return 2;
+ if (!(x < y))
+ return 3;
+ if (x > y)
+ return 4;
+ if (!(x <= y))
+ return 5;
+ if (x >= y)
+ return 6;
+ return 0;
+ }
+
+ static int test_0_nuint_cmp_large_val ()
+ {
+ var x = (nuint)20;
+ var y = (nuint)10;
+ if (x == y)
+ return 1;
+ if (!(x != y))
+ return 2;
+ if (x < y)
+ return 3;
+ if (!(x > y))
+ return 4;
+ if (x <= y)
+ return 1;
+ if (!(x >= y))
+ return 1;
+ return 0;
+ }
+
+ // static int test_0_nuint_call_boxed_equals ()
+ // {
+ // object x = new nuint (10);
+ // object y = new nuint (10);
+ // if (!x.Equals (y))
+ // return 1;
+ // return 0;
+ // }
+
+ static int test_0_nuint_call_boxed_funs ()
+ {
+ object x = new nuint (10u);
+ object y = new nuint (10u);
+ if (x.GetHashCode () == 0)
+ return 2;
+ if (x.ToString () != "10")
+ return 3;
+ return 0;
+ }
+
+ public int test_0_nuint_unboxed_member_calls ()
+ {
+ var x = (nuint)10;
+#if FALSE
+ if (!x.Equals (x))
+ return 1;
+#endif
+ if (x != nuint.Parse ("10"))
+ return 2;
+ return 0;
+ }
+
+ static int test_0_nfloat_ctor ()
+ {
+ var x = new nfloat (10.0f);
+ var y = new nfloat (x);
+ var z = new nfloat (new nfloat (20f));
+ if ((float)x != 10f)
+ return 1;
+ if ((float)y != 10f)
+ return 2;
+ if ((float)z != 20f)
+ return 3;
+ return 0;
+ }
+
+ static int test_0_nfloat_casts ()
+ {
+ var x = (nfloat)10f;
+
+ if ((float)x != 10f)
+ return 1;
+ if ((double)x != 10)
+ return 2;
+#if FALSE
+ var y = (nfloat)20;
+ if ((float)y != 20f)
+ return 3;
+ if ((double)y != 20)
+ return 4;
+#endif
+ return 0;
+ }
+
+ static int test_0_nfloat_plus ()
+ {
+ var x = (nfloat)10f;
+ var z = +x;
+ if ((float)z != 10f)
+ return 1;
+ return 0;
+ }
+
+ static int test_0_nfloat_neg ()
+ {
+ var x = (nfloat)10f;
+ var z = -x;
+ if ((float)z != -10f)
+ return 1;
+ return 0;
+ }
+
+#if FALSE
+ static int test_0_nfloat_inc ()
+ {
+ var x = (nfloat)10f;
+ ++x;
+ if ((float)x != 11f) {
+ Console.WriteLine ((float)x);
+ return 1;
+ }
+ return 0;
+ }
+
+ static int test_0_nfloat_dec ()
+ {
+ var x = (nfloat)10f;
+ --x;
+ if ((float)x != 9f) {
+ Console.WriteLine ((float)x);
+ return 1;
+ }
+ return 0;
+ }
+#endif
+
+ static int test_0_nfloat_add ()
+ {
+ var x = (nfloat)10f;
+ var y = (nfloat)20f;
+ var z = x + y;
+ if ((float)z != 30f)
+ return 1;
+ return 0;
+ }
+
+ static int test_0_nfloat_sub ()
+ {
+ var x = (nfloat)10f;
+ var y = (nfloat)20f;
+ var z = x - y;
+ if ((float)z != -10f)
+ return 1;
+ return 0;
+ }
+
+ static int test_0_nfloat_mul ()
+ {
+ var x = (nfloat)10f;
+ var y = (nfloat)20f;
+ var z = x * y;
+ if ((float)z != 200f)
+ return 1;
+ return 0;
+ }
+
+ static int test_0_nfloat_div ()
+ {
+ var x = (nfloat)30f;
+ var y = (nfloat)3f;
+ var z = x / y;
+ if ((float)z != 10f)
+ return 1;
+ return 0;
+ }
+
+ static int test_0_nfloat_rem ()
+ {
+ var x = (nfloat)22f;
+ var y = (nfloat)10f;
+ var z = x % y;
+ if ((float)z != 2f)
+ return 1;
+ return 0;
+ }
+
+ static int test_0_nfloat_cmp_same_val ()
+ {
+ var x = (nfloat)10f;
+ var y = (nfloat)10f;
+ if (!(x == y))
+ return 1;
+ if (x != y)
+ return 2;
+ if (x < y)
+ return 3;
+ if (x > y)
+ return 4;
+ if (!(x <= y))
+ return 5;
+ if (!(x >= y))
+ return 6;
+ return 0;
+ }
+
+ static int test_0_nfloat_cmp_small_val ()
+ {
+ var x = (nfloat)5f;
+ var y = (nfloat)10f;
+ if (x == y)
+ return 1;
+ if (!(x != y))
+ return 2;
+ if (!(x < y))
+ return 3;
+ if (x > y)
+ return 4;
+ if (!(x <= y))
+ return 5;
+ if (x >= y)
+ return 6;
+ return 0;
+ }
+
+ static int test_0_nfloat_cmp_large_val ()
+ {
+ var x = (nfloat)20f;
+ var y = (nfloat)10f;
+ if (x == y)
+ return 1;
+ if (!(x != y))
+ return 2;
+ if (x < y)
+ return 3;
+ if (!(x > y))
+ return 4;
+ if (x <= y)
+ return 1;
+ if (!(x >= y))
+ return 1;
+ return 0;
+ }
+
+ /* fails on arm64 */
+#if FALSE
+ static int test_0_nfloat_cmp_left_nan ()
+ {
+ var x = (nfloat)float.NaN;
+ var y = (nfloat)10f;
+ if (x == y)
+ return 1;
+ if (!(x != y))
+ return 2;
+ if (x < y)
+ return 3;
+ if (x > y)
+ return 4;
+ if (x <= y)
+ return 1;
+ if (x >= y)
+ return 1;
+ return 0;
+ }
+
+
+ static int test_0_nfloat_cmp_right_nan ()
+ {
+ var x = (nfloat)10f;
+ var y = (nfloat)float.NaN;
+ if (x == y)
+ return 1;
+ if (!(x != y))
+ return 2;
+ if (x < y)
+ return 3;
+ if (x > y)
+ return 4;
+ if (x <= y)
+ return 1;
+ if (x >= y)
+ return 1;
+ return 0;
+ }
+#endif
+
+ // static int test_0_nfloat_call_boxed_equals ()
+ // {
+ // object x = new nfloat (10f);
+ // object y = new nfloat (10f);
+ // if (!x.Equals (y))
+ // return 1;
+ // return 0;
+ // }
+
+ static int test_0_nfloat_call_boxed_funs ()
+ {
+ object x = new nfloat (10f);
+ object y = new nfloat (10f);
+ if (x.GetHashCode () == 0)
+ return 2;
+ if (x.ToString () != "10")
+ return 3;
+ return 0;
+ }
+
+ public int test_0_nfloat_unboxed_member_calls ()
+ {
+ var x = (nfloat)10f;
+#if FALSE
+ if (!x.Equals (x))
+ return 1;
+#endif
+ if (x != nfloat.Parse ("10"))
+ return 2;
+ return 0;
+ }
+
+ public static int Main (String[] args) {
+ return TestDriver.RunTests (typeof (BuiltinTests), args);
+ }
+}
+
+
+// !!! WARNING - GENERATED CODE - DO NOT EDIT !!!
+//
+// Generated by NativeTypes.tt, a T4 template.
+//
+// NativeTypes.cs: basic types with 32 or 64 bit sizes:
+//
+// - nint
+// - nuint
+// - nfloat
+//
+// Authors:
+// Aaron Bockover <abock@xamarin.com>
+//
+// Copyright 2013 Xamarin, Inc. All rights reserved.
+//
+
+namespace System
+{
+ [Serializable]
+ [DebuggerDisplay ("{v,nq}")]
+ public unsafe struct nint : IFormattable, IConvertible, IComparable, IComparable<nint>, IEquatable <nint>
+ {
+ internal nint (nint v) { this.v = v.v; }
+ public nint (Int32 v) { this.v = v; }
+
+#if ARCH_32
+ public static readonly int Size = 4;
+
+ public static readonly nint MaxValue = Int32.MaxValue;
+ public static readonly nint MinValue = Int32.MinValue;
+
+ [DebuggerBrowsable (DebuggerBrowsableState.Never)]
+ internal Int32 v;
+
+ public nint (Int64 v) { this.v = (Int32)v; }
+#else
+ public static readonly int Size = 8;
+
+ public static readonly nint MaxValue = (nint) Int64.MaxValue; // 64-bit only codepath
+ public static readonly nint MinValue = (nint) Int64.MinValue; // 64-bit only codepath
+
+ [DebuggerBrowsable (DebuggerBrowsableState.Never)]
+ internal Int64 v;
+
+ public nint (Int64 v) { this.v = v; }
+#endif
+
+ public static explicit operator nint (nuint v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nint ((int)v.v);
+#else
+ return new nint ((long)v.v);
+#endif
+ }
+
+ public static explicit operator nuint (nint v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nuint ((uint)v.v);
+#else
+ return new nuint ((ulong)v.v);
+#endif
+ }
+
+ public static explicit operator nint (nfloat v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nint ((int)v.v);
+#else
+ return new nint ((long)v.v);
+#endif
+ }
+
+ public static implicit operator nfloat (nint v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nfloat ((float)v.v);
+#else
+ return new nfloat ((double)v.v);
+#endif
+ }
+
+ public static explicit operator nint (IntPtr v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nint (*((int *)&v));
+#else
+ return new nint (*((long *)&v));
+#endif
+ }
+
+ public static explicit operator IntPtr (nint v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return *((IntPtr *)&v.v);
+#else
+ return *((IntPtr *)&v.v);
+#endif
+ }
+
+ public static implicit operator nint (sbyte v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nint ((int)v);
+#else
+ return new nint ((long)v);
+#endif
+ }
+
+ public static explicit operator sbyte (nint v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return (sbyte)v.v;
+#else
+ return (sbyte)v.v;
+#endif
+ }
+
+ public static implicit operator nint (byte v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nint ((int)v);
+#else
+ return new nint ((long)v);
+#endif
+ }
+
+ public static explicit operator byte (nint v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return (byte)v.v;
+#else
+ return (byte)v.v;
+#endif
+ }
+
+ public static implicit operator nint (char v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nint ((int)v);
+#else
+ return new nint ((long)v);
+#endif
+ }
+
+ public static explicit operator char (nint v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return (char)v.v;
+#else
+ return (char)v.v;
+#endif
+ }
+
+ public static implicit operator nint (short v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nint ((int)v);
+#else
+ return new nint ((long)v);
+#endif
+ }
+
+ public static explicit operator short (nint v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return (short)v.v;
+#else
+ return (short)v.v;
+#endif
+ }
+
+ public static explicit operator nint (ushort v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nint ((int)v);
+#else
+ return new nint ((long)v);
+#endif
+ }
+
+ public static explicit operator ushort (nint v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return (ushort)v.v;
+#else
+ return (ushort)v.v;
+#endif
+ }
+
+ public static implicit operator nint (int v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nint ((int)v);
+#else
+ return new nint ((long)v);
+#endif
+ }
+
+ public static explicit operator int (nint v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return (int)v.v;
+#else
+ return (int)v.v;
+#endif
+ }
+
+ public static explicit operator nint (uint v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nint ((int)v);
+#else
+ return new nint ((long)v);
+#endif
+ }
+
+ public static explicit operator uint (nint v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return (uint)v.v;
+#else
+ return (uint)v.v;
+#endif
+ }
+
+ public static explicit operator nint (long v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nint ((int)v);
+#else
+ return new nint ((long)v);
+#endif
+ }
+
+ public static implicit operator long (nint v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return (long)v.v;
+#else
+ return (long)v.v;
+#endif
+ }
+
+ public static explicit operator nint (ulong v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nint ((int)v);
+#else
+ return new nint ((long)v);
+#endif
+ }
+
+ public static explicit operator ulong (nint v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return (ulong)v.v;
+#else
+ return (ulong)v.v;
+#endif
+ }
+
+ public static explicit operator nint (float v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nint ((int)v);
+#else
+ return new nint ((long)v);
+#endif
+ }
+
+ public static implicit operator float (nint v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return (float)v.v;
+#else
+ return (float)v.v;
+#endif
+ }
+
+ public static explicit operator nint (double v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nint ((int)v);
+#else
+ return new nint ((long)v);
+#endif
+ }
+
+ public static implicit operator double (nint v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return (double)v.v;
+#else
+ return (double)v.v;
+#endif
+ }
+
+ public static explicit operator nint (decimal v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nint ((int)v);
+#else
+ return new nint ((long)v);
+#endif
+ }
+
+ public static implicit operator decimal (nint v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return (decimal)v.v;
+#else
+ return (decimal)v.v;
+#endif
+ }
+
+#if NINT_JIT_OPTIMIZED
+ public static nint operator + (nint v) { throw new NotImplementedException (); }
+ public static nint operator - (nint v) { throw new NotImplementedException (); }
+ public static nint operator ~ (nint v) { throw new NotImplementedException (); }
+#else
+ public static nint operator + (nint v) { return new nint (+v.v); }
+ public static nint operator - (nint v) { return new nint (-v.v); }
+ public static nint operator ~ (nint v) { return new nint (~v.v); }
+#endif
+
+#if NINT_JIT_OPTIMIZED
+ public static nint operator ++ (nint v) { throw new NotImplementedException (); }
+ public static nint operator -- (nint v) { throw new NotImplementedException (); }
+#else
+ public static nint operator ++ (nint v) { return new nint (v.v + 1); }
+ public static nint operator -- (nint v) { return new nint (v.v - 1); }
+#endif
+
+#if NINT_JIT_OPTIMIZED
+ public static nint operator + (nint l, nint r) { throw new NotImplementedException (); }
+ public static nint operator - (nint l, nint r) { throw new NotImplementedException (); }
+ public static nint operator * (nint l, nint r) { throw new NotImplementedException (); }
+ public static nint operator / (nint l, nint r) { throw new NotImplementedException (); }
+ public static nint operator % (nint l, nint r) { throw new NotImplementedException (); }
+ public static nint operator & (nint l, nint r) { throw new NotImplementedException (); }
+ public static nint operator | (nint l, nint r) { throw new NotImplementedException (); }
+ public static nint operator ^ (nint l, nint r) { throw new NotImplementedException (); }
+
+ public static nint operator << (nint l, int r) { throw new NotImplementedException (); }
+ public static nint operator >> (nint l, int r) { throw new NotImplementedException (); }
+#else
+ public static nint operator + (nint l, nint r) { return new nint (l.v + r.v); }
+ public static nint operator - (nint l, nint r) { return new nint (l.v - r.v); }
+ public static nint operator * (nint l, nint r) { return new nint (l.v * r.v); }
+ public static nint operator / (nint l, nint r) { return new nint (l.v / r.v); }
+ public static nint operator % (nint l, nint r) { return new nint (l.v % r.v); }
+ public static nint operator & (nint l, nint r) { return new nint (l.v & r.v); }
+ public static nint operator | (nint l, nint r) { return new nint (l.v | r.v); }
+ public static nint operator ^ (nint l, nint r) { return new nint (l.v ^ r.v); }
+
+ public static nint operator << (nint l, int r) { return new nint (l.v << r); }
+ public static nint operator >> (nint l, int r) { return new nint (l.v >> r); }
+#endif
+
+#if NINT_JIT_OPTIMIZED
+ public static bool operator == (nint l, nint r) { throw new NotImplementedException (); }
+ public static bool operator != (nint l, nint r) { throw new NotImplementedException (); }
+ public static bool operator < (nint l, nint r) { throw new NotImplementedException (); }
+ public static bool operator > (nint l, nint r) { throw new NotImplementedException (); }
+ public static bool operator <= (nint l, nint r) { throw new NotImplementedException (); }
+ public static bool operator >= (nint l, nint r) { throw new NotImplementedException (); }
+#else
+ public static bool operator == (nint l, nint r) { return l.v == r.v; }
+ public static bool operator != (nint l, nint r) { return l.v != r.v; }
+ public static bool operator < (nint l, nint r) { return l.v < r.v; }
+ public static bool operator > (nint l, nint r) { return l.v > r.v; }
+ public static bool operator <= (nint l, nint r) { return l.v <= r.v; }
+ public static bool operator >= (nint l, nint r) { return l.v >= r.v; }
+#endif
+
+ public int CompareTo (nint value) { return v.CompareTo (value.v); }
+ public int CompareTo (object value)
+ {
+ if (value is nint)
+ return v.CompareTo (((nint) value).v);
+ return v.CompareTo (value);
+ }
+ public bool Equals (nint obj) { return v.Equals (obj.v); }
+ public override bool Equals (object obj)
+ {
+ if (obj is nint)
+ return v.Equals (((nint) obj).v);
+ return v.Equals (obj);
+ }
+ public override int GetHashCode () { return v.GetHashCode (); }
+
+#if ARCH_32
+ public static nint Parse (string s, IFormatProvider provider) { return (nint)Int32.Parse (s, provider); }
+ public static nint Parse (string s, NumberStyles style) { return (nint)Int32.Parse (s, style); }
+ public static nint Parse (string s) { return (nint)Int32.Parse (s); }
+ public static nint Parse (string s, NumberStyles style, IFormatProvider provider) {
+ return (nint)Int32.Parse (s, style, provider);
+ }
+
+ public static bool TryParse (string s, out nint result)
+ {
+ Int32 v;
+ var r = Int32.TryParse (s, out v);
+ result = (nint)v;
+ return r;
+ }
+
+ public static bool TryParse (string s, NumberStyles style, IFormatProvider provider, out nint result)
+ {
+ Int32 v;
+ var r = Int32.TryParse (s, style, provider, out v);
+ result = (nint)v;
+ return r;
+ }
+#else
+ public static nint Parse (string s, IFormatProvider provider) { return (nint)Int64.Parse (s, provider); }
+ public static nint Parse (string s, NumberStyles style) { return (nint)Int64.Parse (s, style); }
+ public static nint Parse (string s) { return (nint)Int64.Parse (s); }
+ public static nint Parse (string s, NumberStyles style, IFormatProvider provider) {
+ return (nint)Int64.Parse (s, style, provider);
+ }
+
+ public static bool TryParse (string s, out nint result)
+ {
+ Int64 v;
+ var r = Int64.TryParse (s, out v);
+ result = (nint)v;
+ return r;
+ }
+
+ public static bool TryParse (string s, NumberStyles style, IFormatProvider provider, out nint result)
+ {
+ Int64 v;
+ var r = Int64.TryParse (s, style, provider, out v);
+ result = (nint)v;
+ return r;
+ }
+#endif
+
+ public override string ToString () { return v.ToString (); }
+ public string ToString (IFormatProvider provider) { return v.ToString (provider); }
+ public string ToString (string format) { return v.ToString (format); }
+ public string ToString (string format, IFormatProvider provider) { return v.ToString (format, provider); }
+
+ public TypeCode GetTypeCode () { return v.GetTypeCode (); }
+
+ bool IConvertible.ToBoolean (IFormatProvider provider) { return ((IConvertible)v).ToBoolean (provider); }
+ byte IConvertible.ToByte (IFormatProvider provider) { return ((IConvertible)v).ToByte (provider); }
+ char IConvertible.ToChar (IFormatProvider provider) { return ((IConvertible)v).ToChar (provider); }
+ DateTime IConvertible.ToDateTime (IFormatProvider provider) { return ((IConvertible)v).ToDateTime (provider); }
+ decimal IConvertible.ToDecimal (IFormatProvider provider) { return ((IConvertible)v).ToDecimal (provider); }
+ double IConvertible.ToDouble (IFormatProvider provider) { return ((IConvertible)v).ToDouble (provider); }
+ short IConvertible.ToInt16 (IFormatProvider provider) { return ((IConvertible)v).ToInt16 (provider); }
+ int IConvertible.ToInt32 (IFormatProvider provider) { return ((IConvertible)v).ToInt32 (provider); }
+ long IConvertible.ToInt64 (IFormatProvider provider) { return ((IConvertible)v).ToInt64 (provider); }
+ sbyte IConvertible.ToSByte (IFormatProvider provider) { return ((IConvertible)v).ToSByte (provider); }
+ float IConvertible.ToSingle (IFormatProvider provider) { return ((IConvertible)v).ToSingle (provider); }
+ ushort IConvertible.ToUInt16 (IFormatProvider provider) { return ((IConvertible)v).ToUInt16 (provider); }
+ uint IConvertible.ToUInt32 (IFormatProvider provider) { return ((IConvertible)v).ToUInt32 (provider); }
+ ulong IConvertible.ToUInt64 (IFormatProvider provider) { return ((IConvertible)v).ToUInt64 (provider); }
+
+ object IConvertible.ToType (Type targetType, IFormatProvider provider) {
+ return ((IConvertible)v).ToType (targetType, provider);
+ }
+
+ public static void CopyArray (IntPtr source, nint [] destination, int startIndex, int length)
+ {
+ if (source == IntPtr.Zero)
+ throw new ArgumentNullException ("source");
+ if (destination == null)
+ throw new ArgumentNullException ("destination");
+ if (destination.Rank != 1)
+ throw new ArgumentException ("destination", "array is multi-dimensional");
+ if (startIndex < 0)
+ throw new ArgumentException ("startIndex", "must be >= 0");
+ if (length < 0)
+ throw new ArgumentException ("length", "must be >= 0");
+ if (startIndex + length > destination.Length)
+ throw new ArgumentException ("length", "startIndex + length > destination.Length");
+
+ for (int i = 0; i < length; i++)
+ destination [i + startIndex] = (nint)Marshal.ReadIntPtr (source, i * nint.Size);
+ }
+
+ public static void CopyArray (nint [] source, int startIndex, IntPtr destination, int length)
+ {
+ if (source == null)
+ throw new ArgumentNullException ("source");
+ if (destination == IntPtr.Zero)
+ throw new ArgumentNullException ("destination");
+ if (source.Rank != 1)
+ throw new ArgumentException ("source", "array is multi-dimensional");
+ if (startIndex < 0)
+ throw new ArgumentException ("startIndex", "must be >= 0");
+ if (length < 0)
+ throw new ArgumentException ("length", "must be >= 0");
+ if (startIndex + length > source.Length)
+ throw new ArgumentException ("length", "startIndex + length > source.Length");
+
+ for (int i = 0; i < length; i++)
+ Marshal.WriteIntPtr (destination, i * nint.Size, (IntPtr)source [i + startIndex]);
+ }
+ }
+ [Serializable]
+ [DebuggerDisplay ("{v,nq}")]
+ public unsafe struct nuint : IFormattable, IConvertible, IComparable, IComparable<nuint>, IEquatable <nuint>
+ {
+ internal nuint (nuint v) { this.v = v.v; }
+ public nuint (UInt32 v) { this.v = v; }
+
+#if ARCH_32
+ public static readonly int Size = 4;
+
+ public static readonly nuint MaxValue = UInt32.MaxValue;
+ public static readonly nuint MinValue = UInt32.MinValue;
+
+ [DebuggerBrowsable (DebuggerBrowsableState.Never)]
+ internal UInt32 v;
+
+ public nuint (UInt64 v) { this.v = (UInt32)v; }
+#else
+ public static readonly int Size = 8;
+
+ public static readonly nuint MaxValue = (nuint) UInt64.MaxValue; // 64-bit only codepath
+ public static readonly nuint MinValue = (nuint) UInt64.MinValue; // 64-bit only codepath
+
+ [DebuggerBrowsable (DebuggerBrowsableState.Never)]
+ internal UInt64 v;
+
+ public nuint (UInt64 v) { this.v = v; }
+#endif
+
+ public static explicit operator nuint (nfloat v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nuint ((uint)v.v);
+#else
+ return new nuint ((ulong)v.v);
+#endif
+ }
+
+ public static implicit operator nfloat (nuint v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nfloat ((float)v.v);
+#else
+ return new nfloat ((double)v.v);
+#endif
+ }
+
+ public static explicit operator nuint (IntPtr v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nuint (*((uint *)&v));
+#else
+ return new nuint (*((ulong *)&v));
+#endif
+ }
+
+ public static explicit operator IntPtr (nuint v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return *((IntPtr *)&v.v);
+#else
+ return *((IntPtr *)&v.v);
+#endif
+ }
+
+ public static explicit operator nuint (sbyte v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nuint ((uint)v);
+#else
+ return new nuint ((ulong)v);
+#endif
+ }
+
+ public static explicit operator sbyte (nuint v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return (sbyte)v.v;
+#else
+ return (sbyte)v.v;
+#endif
+ }
+
+ public static implicit operator nuint (byte v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nuint ((uint)v);
+#else
+ return new nuint ((ulong)v);
+#endif
+ }
+
+ public static explicit operator byte (nuint v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return (byte)v.v;
+#else
+ return (byte)v.v;
+#endif
+ }
+
+ public static implicit operator nuint (char v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nuint ((uint)v);
+#else
+ return new nuint ((ulong)v);
+#endif
+ }
+
+ public static explicit operator char (nuint v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return (char)v.v;
+#else
+ return (char)v.v;
+#endif
+ }
+
+ public static explicit operator nuint (short v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nuint ((uint)v);
+#else
+ return new nuint ((ulong)v);
+#endif
+ }
+
+ public static explicit operator short (nuint v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return (short)v.v;
+#else
+ return (short)v.v;
+#endif
+ }
+
+ public static implicit operator nuint (ushort v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nuint ((uint)v);
+#else
+ return new nuint ((ulong)v);
+#endif
+ }
+
+ public static explicit operator ushort (nuint v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return (ushort)v.v;
+#else
+ return (ushort)v.v;
+#endif
+ }
+
+ public static explicit operator nuint (int v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nuint ((uint)v);
+#else
+ return new nuint ((ulong)v);
+#endif
+ }
+
+ public static explicit operator int (nuint v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return (int)v.v;
+#else
+ return (int)v.v;
+#endif
+ }
+
+ public static implicit operator nuint (uint v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nuint ((uint)v);
+#else
+ return new nuint ((ulong)v);
+#endif
+ }
+
+ public static explicit operator uint (nuint v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return (uint)v.v;
+#else
+ return (uint)v.v;
+#endif
+ }
+
+ public static explicit operator nuint (long v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nuint ((uint)v);
+#else
+ return new nuint ((ulong)v);
+#endif
+ }
+
+ public static explicit operator long (nuint v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return (long)v.v;
+#else
+ return (long)v.v;
+#endif
+ }
+
+ public static explicit operator nuint (ulong v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nuint ((uint)v);
+#else
+ return new nuint ((ulong)v);
+#endif
+ }
+
+ public static implicit operator ulong (nuint v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return (ulong)v.v;
+#else
+ return (ulong)v.v;
+#endif
+ }
+
+ public static explicit operator nuint (float v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nuint ((uint)v);
+#else
+ return new nuint ((ulong)v);
+#endif
+ }
+
+ public static implicit operator float (nuint v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return (float)v.v;
+#else
+ return (float)v.v;
+#endif
+ }
+
+ public static explicit operator nuint (double v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nuint ((uint)v);
+#else
+ return new nuint ((ulong)v);
+#endif
+ }
+
+ public static implicit operator double (nuint v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return (double)v.v;
+#else
+ return (double)v.v;
+#endif
+ }
+
+ public static explicit operator nuint (decimal v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nuint ((uint)v);
+#else
+ return new nuint ((ulong)v);
+#endif
+ }
+
+ public static implicit operator decimal (nuint v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return (decimal)v.v;
+#else
+ return (decimal)v.v;
+#endif
+ }
+
+#if NINT_JIT_OPTIMIZED
+ public static nuint operator + (nuint v) { throw new NotImplementedException (); }
+ public static nuint operator ~ (nuint v) { throw new NotImplementedException (); }
+#else
+ public static nuint operator + (nuint v) { return new nuint (+v.v); }
+ public static nuint operator ~ (nuint v) { return new nuint (~v.v); }
+#endif
+
+#if NINT_JIT_OPTIMIZED
+ public static nuint operator ++ (nuint v) { throw new NotImplementedException (); }
+ public static nuint operator -- (nuint v) { throw new NotImplementedException (); }
+#else
+ public static nuint operator ++ (nuint v) { return new nuint (v.v + 1); }
+ public static nuint operator -- (nuint v) { return new nuint (v.v - 1); }
+#endif
+
+#if NINT_JIT_OPTIMIZED
+ public static nuint operator + (nuint l, nuint r) { throw new NotImplementedException (); }
+ public static nuint operator - (nuint l, nuint r) { throw new NotImplementedException (); }
+ public static nuint operator * (nuint l, nuint r) { throw new NotImplementedException (); }
+ public static nuint operator / (nuint l, nuint r) { throw new NotImplementedException (); }
+ public static nuint operator % (nuint l, nuint r) { throw new NotImplementedException (); }
+ public static nuint operator & (nuint l, nuint r) { throw new NotImplementedException (); }
+ public static nuint operator | (nuint l, nuint r) { throw new NotImplementedException (); }
+ public static nuint operator ^ (nuint l, nuint r) { throw new NotImplementedException (); }
+
+ public static nuint operator << (nuint l, int r) { throw new NotImplementedException (); }
+ public static nuint operator >> (nuint l, int r) { throw new NotImplementedException (); }
+#else
+ public static nuint operator + (nuint l, nuint r) { return new nuint (l.v + r.v); }
+ public static nuint operator - (nuint l, nuint r) { return new nuint (l.v - r.v); }
+ public static nuint operator * (nuint l, nuint r) { return new nuint (l.v * r.v); }
+ public static nuint operator / (nuint l, nuint r) { return new nuint (l.v / r.v); }
+ public static nuint operator % (nuint l, nuint r) { return new nuint (l.v % r.v); }
+ public static nuint operator & (nuint l, nuint r) { return new nuint (l.v & r.v); }
+ public static nuint operator | (nuint l, nuint r) { return new nuint (l.v | r.v); }
+ public static nuint operator ^ (nuint l, nuint r) { return new nuint (l.v ^ r.v); }
+
+ public static nuint operator << (nuint l, int r) { return new nuint (l.v << r); }
+ public static nuint operator >> (nuint l, int r) { return new nuint (l.v >> r); }
+#endif
+
+#if NINT_JIT_OPTIMIZED
+ public static bool operator == (nuint l, nuint r) { throw new NotImplementedException (); }
+ public static bool operator != (nuint l, nuint r) { throw new NotImplementedException (); }
+ public static bool operator < (nuint l, nuint r) { throw new NotImplementedException (); }
+ public static bool operator > (nuint l, nuint r) { throw new NotImplementedException (); }
+ public static bool operator <= (nuint l, nuint r) { throw new NotImplementedException (); }
+ public static bool operator >= (nuint l, nuint r) { throw new NotImplementedException (); }
+#else
+ public static bool operator == (nuint l, nuint r) { return l.v == r.v; }
+ public static bool operator != (nuint l, nuint r) { return l.v != r.v; }
+ public static bool operator < (nuint l, nuint r) { return l.v < r.v; }
+ public static bool operator > (nuint l, nuint r) { return l.v > r.v; }
+ public static bool operator <= (nuint l, nuint r) { return l.v <= r.v; }
+ public static bool operator >= (nuint l, nuint r) { return l.v >= r.v; }
+#endif
+
+ public int CompareTo (nuint value) { return v.CompareTo (value.v); }
+ public int CompareTo (object value)
+ {
+ if (value is nuint)
+ return v.CompareTo (((nuint) value).v);
+ return v.CompareTo (value);
+ }
+ public bool Equals (nuint obj) { return v.Equals (obj.v); }
+ public override bool Equals (object obj)
+ {
+ if (obj is nuint)
+ return v.Equals (((nuint) obj).v);
+ return v.Equals (obj);
+ }
+ public override int GetHashCode () { return v.GetHashCode (); }
+
+#if ARCH_32
+ public static nuint Parse (string s, IFormatProvider provider) { return (nuint)UInt32.Parse (s, provider); }
+ public static nuint Parse (string s, NumberStyles style) { return (nuint)UInt32.Parse (s, style); }
+ public static nuint Parse (string s) { return (nuint)UInt32.Parse (s); }
+ public static nuint Parse (string s, NumberStyles style, IFormatProvider provider) {
+ return (nuint)UInt32.Parse (s, style, provider);
+ }
+
+ public static bool TryParse (string s, out nuint result)
+ {
+ UInt32 v;
+ var r = UInt32.TryParse (s, out v);
+ result = (nuint)v;
+ return r;
+ }
+
+ public static bool TryParse (string s, NumberStyles style, IFormatProvider provider, out nuint result)
+ {
+ UInt32 v;
+ var r = UInt32.TryParse (s, style, provider, out v);
+ result = (nuint)v;
+ return r;
+ }
+#else
+ public static nuint Parse (string s, IFormatProvider provider) { return (nuint)UInt64.Parse (s, provider); }
+ public static nuint Parse (string s, NumberStyles style) { return (nuint)UInt64.Parse (s, style); }
+ public static nuint Parse (string s) { return (nuint)UInt64.Parse (s); }
+ public static nuint Parse (string s, NumberStyles style, IFormatProvider provider) {
+ return (nuint)UInt64.Parse (s, style, provider);
+ }
+
+ public static bool TryParse (string s, out nuint result)
+ {
+ UInt64 v;
+ var r = UInt64.TryParse (s, out v);
+ result = (nuint)v;
+ return r;
+ }
+
+ public static bool TryParse (string s, NumberStyles style, IFormatProvider provider, out nuint result)
+ {
+ UInt64 v;
+ var r = UInt64.TryParse (s, style, provider, out v);
+ result = (nuint)v;
+ return r;
+ }
+#endif
+
+ public override string ToString () { return v.ToString (); }
+ public string ToString (IFormatProvider provider) { return v.ToString (provider); }
+ public string ToString (string format) { return v.ToString (format); }
+ public string ToString (string format, IFormatProvider provider) { return v.ToString (format, provider); }
+
+ public TypeCode GetTypeCode () { return v.GetTypeCode (); }
+
+ bool IConvertible.ToBoolean (IFormatProvider provider) { return ((IConvertible)v).ToBoolean (provider); }
+ byte IConvertible.ToByte (IFormatProvider provider) { return ((IConvertible)v).ToByte (provider); }
+ char IConvertible.ToChar (IFormatProvider provider) { return ((IConvertible)v).ToChar (provider); }
+ DateTime IConvertible.ToDateTime (IFormatProvider provider) { return ((IConvertible)v).ToDateTime (provider); }
+ decimal IConvertible.ToDecimal (IFormatProvider provider) { return ((IConvertible)v).ToDecimal (provider); }
+ double IConvertible.ToDouble (IFormatProvider provider) { return ((IConvertible)v).ToDouble (provider); }
+ short IConvertible.ToInt16 (IFormatProvider provider) { return ((IConvertible)v).ToInt16 (provider); }
+ int IConvertible.ToInt32 (IFormatProvider provider) { return ((IConvertible)v).ToInt32 (provider); }
+ long IConvertible.ToInt64 (IFormatProvider provider) { return ((IConvertible)v).ToInt64 (provider); }
+ sbyte IConvertible.ToSByte (IFormatProvider provider) { return ((IConvertible)v).ToSByte (provider); }
+ float IConvertible.ToSingle (IFormatProvider provider) { return ((IConvertible)v).ToSingle (provider); }
+ ushort IConvertible.ToUInt16 (IFormatProvider provider) { return ((IConvertible)v).ToUInt16 (provider); }
+ uint IConvertible.ToUInt32 (IFormatProvider provider) { return ((IConvertible)v).ToUInt32 (provider); }
+ ulong IConvertible.ToUInt64 (IFormatProvider provider) { return ((IConvertible)v).ToUInt64 (provider); }
+
+ object IConvertible.ToType (Type targetType, IFormatProvider provider) {
+ return ((IConvertible)v).ToType (targetType, provider);
+ }
+
+ public static void CopyArray (IntPtr source, nuint [] destination, int startIndex, int length)
+ {
+ if (source == IntPtr.Zero)
+ throw new ArgumentNullException ("source");
+ if (destination == null)
+ throw new ArgumentNullException ("destination");
+ if (destination.Rank != 1)
+ throw new ArgumentException ("destination", "array is multi-dimensional");
+ if (startIndex < 0)
+ throw new ArgumentException ("startIndex", "must be >= 0");
+ if (length < 0)
+ throw new ArgumentException ("length", "must be >= 0");
+ if (startIndex + length > destination.Length)
+ throw new ArgumentException ("length", "startIndex + length > destination.Length");
+
+ for (int i = 0; i < length; i++)
+ destination [i + startIndex] = (nuint)Marshal.ReadIntPtr (source, i * nuint.Size);
+ }
+
+ public static void CopyArray (nuint [] source, int startIndex, IntPtr destination, int length)
+ {
+ if (source == null)
+ throw new ArgumentNullException ("source");
+ if (destination == IntPtr.Zero)
+ throw new ArgumentNullException ("destination");
+ if (source.Rank != 1)
+ throw new ArgumentException ("source", "array is multi-dimensional");
+ if (startIndex < 0)
+ throw new ArgumentException ("startIndex", "must be >= 0");
+ if (length < 0)
+ throw new ArgumentException ("length", "must be >= 0");
+ if (startIndex + length > source.Length)
+ throw new ArgumentException ("length", "startIndex + length > source.Length");
+
+ for (int i = 0; i < length; i++)
+ Marshal.WriteIntPtr (destination, i * nuint.Size, (IntPtr)source [i + startIndex]);
+ }
+ }
+ [Serializable]
+ [DebuggerDisplay ("{v,nq}")]
+ public unsafe struct nfloat : IFormattable, IConvertible, IComparable, IComparable<nfloat>, IEquatable <nfloat>
+ {
+ internal nfloat (nfloat v) { this.v = v.v; }
+ public nfloat (Single v) { this.v = v; }
+
+#if ARCH_32
+ public static readonly int Size = 4;
+
+ public static readonly nfloat MaxValue = Single.MaxValue;
+ public static readonly nfloat MinValue = Single.MinValue;
+ public static readonly nfloat Epsilon = (nfloat)Single.Epsilon;
+ public static readonly nfloat NaN = (nfloat)Single.NaN;
+ public static readonly nfloat NegativeInfinity = (nfloat)Single.NegativeInfinity;
+ public static readonly nfloat PositiveInfinity = (nfloat)Single.PositiveInfinity;
+
+ [DebuggerBrowsable (DebuggerBrowsableState.Never)]
+ internal Single v;
+
+ public nfloat (Double v) { this.v = (Single)v; }
+#else
+ public static readonly int Size = 8;
+
+ public static readonly nfloat MaxValue = (nfloat) Double.MaxValue; // 64-bit only codepath
+ public static readonly nfloat MinValue = (nfloat) Double.MinValue; // 64-bit only codepath
+ public static readonly nfloat Epsilon = (nfloat)Double.Epsilon;
+ public static readonly nfloat NaN = (nfloat)Double.NaN;
+ public static readonly nfloat NegativeInfinity = (nfloat)Double.NegativeInfinity;
+ public static readonly nfloat PositiveInfinity = (nfloat)Double.PositiveInfinity;
+
+ [DebuggerBrowsable (DebuggerBrowsableState.Never)]
+ internal Double v;
+
+ public nfloat (Double v) { this.v = v; }
+#endif
+
+ public static explicit operator nfloat (IntPtr v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nfloat (*((float *)&v));
+#else
+ return new nfloat (*((double *)&v));
+#endif
+ }
+
+ public static explicit operator IntPtr (nfloat v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return *((IntPtr *)&v.v);
+#else
+ return *((IntPtr *)&v.v);
+#endif
+ }
+
+ public static implicit operator nfloat (sbyte v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nfloat ((float)v);
+#else
+ return new nfloat ((double)v);
+#endif
+ }
+
+ public static explicit operator sbyte (nfloat v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return (sbyte)v.v;
+#else
+ return (sbyte)v.v;
+#endif
+ }
+
+ public static implicit operator nfloat (byte v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nfloat ((float)v);
+#else
+ return new nfloat ((double)v);
+#endif
+ }
+
+ public static explicit operator byte (nfloat v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return (byte)v.v;
+#else
+ return (byte)v.v;
+#endif
+ }
+
+ public static implicit operator nfloat (char v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nfloat ((float)v);
+#else
+ return new nfloat ((double)v);
+#endif
+ }
+
+ public static explicit operator char (nfloat v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return (char)v.v;
+#else
+ return (char)v.v;
+#endif
+ }
+
+ public static implicit operator nfloat (short v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nfloat ((float)v);
+#else
+ return new nfloat ((double)v);
+#endif
+ }
+
+ public static explicit operator short (nfloat v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return (short)v.v;
+#else
+ return (short)v.v;
+#endif
+ }
+
+ public static implicit operator nfloat (ushort v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nfloat ((float)v);
+#else
+ return new nfloat ((double)v);
+#endif
+ }
+
+ public static explicit operator ushort (nfloat v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return (ushort)v.v;
+#else
+ return (ushort)v.v;
+#endif
+ }
+
+ public static implicit operator nfloat (int v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nfloat ((float)v);
+#else
+ return new nfloat ((double)v);
+#endif
+ }
+
+ public static explicit operator int (nfloat v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return (int)v.v;
+#else
+ return (int)v.v;
+#endif
+ }
+
+ public static implicit operator nfloat (uint v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nfloat ((float)v);
+#else
+ return new nfloat ((double)v);
+#endif
+ }
+
+ public static explicit operator uint (nfloat v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return (uint)v.v;
+#else
+ return (uint)v.v;
+#endif
+ }
+
+ public static implicit operator nfloat (long v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nfloat ((float)v);
+#else
+ return new nfloat ((double)v);
+#endif
+ }
+
+ public static explicit operator long (nfloat v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return (long)v.v;
+#else
+ return (long)v.v;
+#endif
+ }
+
+ public static implicit operator nfloat (ulong v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nfloat ((float)v);
+#else
+ return new nfloat ((double)v);
+#endif
+ }
+
+ public static explicit operator ulong (nfloat v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return (ulong)v.v;
+#else
+ return (ulong)v.v;
+#endif
+ }
+
+ public static implicit operator nfloat (float v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nfloat ((float)v);
+#else
+ return new nfloat ((double)v);
+#endif
+ }
+
+ public static explicit operator float (nfloat v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return (float)v.v;
+#else
+ return (float)v.v;
+#endif
+ }
+
+ public static explicit operator nfloat (double v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nfloat ((float)v);
+#else
+ return new nfloat ((double)v);
+#endif
+ }
+
+ public static implicit operator double (nfloat v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return (double)v.v;
+#else
+ return (double)v.v;
+#endif
+ }
+
+ public static explicit operator nfloat (decimal v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return new nfloat ((float)v);
+#else
+ return new nfloat ((double)v);
+#endif
+ }
+
+ public static explicit operator decimal (nfloat v)
+ {
+#if NINT_JIT_OPTIMIZED
+ throw new NotImplementedException ();
+#elif ARCH_32
+ return (decimal)v.v;
+#else
+ return (decimal)v.v;
+#endif
+ }
+
+#if NINT_JIT_OPTIMIZED
+ public static nfloat operator + (nfloat v) { throw new NotImplementedException (); }
+ public static nfloat operator - (nfloat v) { throw new NotImplementedException (); }
+#else
+ public static nfloat operator + (nfloat v) { return new nfloat (+v.v); }
+ public static nfloat operator - (nfloat v) { return new nfloat (-v.v); }
+#endif
+
+#if NINT_JIT_OPTIMIZED
+ public static nfloat operator ++ (nfloat v) { throw new NotImplementedException (); }
+ public static nfloat operator -- (nfloat v) { throw new NotImplementedException (); }
+#else
+ public static nfloat operator ++ (nfloat v) { return new nfloat (v.v + 1); }
+ public static nfloat operator -- (nfloat v) { return new nfloat (v.v - 1); }
+#endif
+
+#if NINT_JIT_OPTIMIZED
+ public static nfloat operator + (nfloat l, nfloat r) { throw new NotImplementedException (); }
+ public static nfloat operator - (nfloat l, nfloat r) { throw new NotImplementedException (); }
+ public static nfloat operator * (nfloat l, nfloat r) { throw new NotImplementedException (); }
+ public static nfloat operator / (nfloat l, nfloat r) { throw new NotImplementedException (); }
+ public static nfloat operator % (nfloat l, nfloat r) { throw new NotImplementedException (); }
+#else
+ public static nfloat operator + (nfloat l, nfloat r) { return new nfloat (l.v + r.v); }
+ public static nfloat operator - (nfloat l, nfloat r) { return new nfloat (l.v - r.v); }
+ public static nfloat operator * (nfloat l, nfloat r) { return new nfloat (l.v * r.v); }
+ public static nfloat operator / (nfloat l, nfloat r) { return new nfloat (l.v / r.v); }
+ public static nfloat operator % (nfloat l, nfloat r) { return new nfloat (l.v % r.v); }
+#endif
+
+#if NINT_JIT_OPTIMIZED
+ public static bool operator == (nfloat l, nfloat r) { throw new NotImplementedException (); }
+ public static bool operator != (nfloat l, nfloat r) { throw new NotImplementedException (); }
+ public static bool operator < (nfloat l, nfloat r) { throw new NotImplementedException (); }
+ public static bool operator > (nfloat l, nfloat r) { throw new NotImplementedException (); }
+ public static bool operator <= (nfloat l, nfloat r) { throw new NotImplementedException (); }
+ public static bool operator >= (nfloat l, nfloat r) { throw new NotImplementedException (); }
+#else
+ public static bool operator == (nfloat l, nfloat r) { return l.v == r.v; }
+ public static bool operator != (nfloat l, nfloat r) { return l.v != r.v; }
+ public static bool operator < (nfloat l, nfloat r) { return l.v < r.v; }
+ public static bool operator > (nfloat l, nfloat r) { return l.v > r.v; }
+ public static bool operator <= (nfloat l, nfloat r) { return l.v <= r.v; }
+ public static bool operator >= (nfloat l, nfloat r) { return l.v >= r.v; }
+#endif
+
+ public int CompareTo (nfloat value) { return v.CompareTo (value.v); }
+ public int CompareTo (object value)
+ {
+ if (value is nfloat)
+ return v.CompareTo (((nfloat) value).v);
+ return v.CompareTo (value);
+ }
+ public bool Equals (nfloat obj) { return v.Equals (obj.v); }
+ public override bool Equals (object obj)
+ {
+ if (obj is nfloat)
+ return v.Equals (((nfloat) obj).v);
+ return v.Equals (obj);
+ }
+ public override int GetHashCode () { return v.GetHashCode (); }
+
+#if ARCH_32
+ public static bool IsNaN (nfloat f) { return Single.IsNaN ((Single)f); }
+ public static bool IsInfinity (nfloat f) { return Single.IsInfinity ((Single)f); }
+ public static bool IsPositiveInfinity (nfloat f) { return Single.IsPositiveInfinity ((Single)f); }
+ public static bool IsNegativeInfinity (nfloat f) { return Single.IsNegativeInfinity ((Single)f); }
+
+ public static nfloat Parse (string s, IFormatProvider provider) { return (nfloat)Single.Parse (s, provider); }
+ public static nfloat Parse (string s, NumberStyles style) { return (nfloat)Single.Parse (s, style); }
+ public static nfloat Parse (string s) { return (nfloat)Single.Parse (s); }
+ public static nfloat Parse (string s, NumberStyles style, IFormatProvider provider) {
+ return (nfloat)Single.Parse (s, style, provider);
+ }
+
+ public static bool TryParse (string s, out nfloat result)
+ {
+ Single v;
+ var r = Single.TryParse (s, out v);
+ result = (nfloat)v;
+ return r;
+ }
+
+ public static bool TryParse (string s, NumberStyles style, IFormatProvider provider, out nfloat result)
+ {
+ Single v;
+ var r = Single.TryParse (s, style, provider, out v);
+ result = (nfloat)v;
+ return r;
+ }
+#else
+ public static bool IsNaN (nfloat f) { return Double.IsNaN ((Double)f); }
+ public static bool IsInfinity (nfloat f) { return Double.IsInfinity ((Double)f); }
+ public static bool IsPositiveInfinity (nfloat f) { return Double.IsPositiveInfinity ((Double)f); }
+ public static bool IsNegativeInfinity (nfloat f) { return Double.IsNegativeInfinity ((Double)f); }
+
+ public static nfloat Parse (string s, IFormatProvider provider) { return (nfloat)Double.Parse (s, provider); }
+ public static nfloat Parse (string s, NumberStyles style) { return (nfloat)Double.Parse (s, style); }
+ public static nfloat Parse (string s) { return (nfloat)Double.Parse (s); }
+ public static nfloat Parse (string s, NumberStyles style, IFormatProvider provider) {
+ return (nfloat)Double.Parse (s, style, provider);
+ }
+
+ public static bool TryParse (string s, out nfloat result)
+ {
+ Double v;
+ var r = Double.TryParse (s, out v);
+ result = (nfloat)v;
+ return r;
+ }
+
+ public static bool TryParse (string s, NumberStyles style, IFormatProvider provider, out nfloat result)
+ {
+ Double v;
+ var r = Double.TryParse (s, style, provider, out v);
+ result = (nfloat)v;
+ return r;
+ }
+#endif
+
+ public override string ToString () { return v.ToString (); }
+ public string ToString (IFormatProvider provider) { return v.ToString (provider); }
+ public string ToString (string format) { return v.ToString (format); }
+ public string ToString (string format, IFormatProvider provider) { return v.ToString (format, provider); }
+
+ public TypeCode GetTypeCode () { return v.GetTypeCode (); }
+
+ bool IConvertible.ToBoolean (IFormatProvider provider) { return ((IConvertible)v).ToBoolean (provider); }
+ byte IConvertible.ToByte (IFormatProvider provider) { return ((IConvertible)v).ToByte (provider); }
+ char IConvertible.ToChar (IFormatProvider provider) { return ((IConvertible)v).ToChar (provider); }
+ DateTime IConvertible.ToDateTime (IFormatProvider provider) { return ((IConvertible)v).ToDateTime (provider); }
+ decimal IConvertible.ToDecimal (IFormatProvider provider) { return ((IConvertible)v).ToDecimal (provider); }
+ double IConvertible.ToDouble (IFormatProvider provider) { return ((IConvertible)v).ToDouble (provider); }
+ short IConvertible.ToInt16 (IFormatProvider provider) { return ((IConvertible)v).ToInt16 (provider); }
+ int IConvertible.ToInt32 (IFormatProvider provider) { return ((IConvertible)v).ToInt32 (provider); }
+ long IConvertible.ToInt64 (IFormatProvider provider) { return ((IConvertible)v).ToInt64 (provider); }
+ sbyte IConvertible.ToSByte (IFormatProvider provider) { return ((IConvertible)v).ToSByte (provider); }
+ float IConvertible.ToSingle (IFormatProvider provider) { return ((IConvertible)v).ToSingle (provider); }
+ ushort IConvertible.ToUInt16 (IFormatProvider provider) { return ((IConvertible)v).ToUInt16 (provider); }
+ uint IConvertible.ToUInt32 (IFormatProvider provider) { return ((IConvertible)v).ToUInt32 (provider); }
+ ulong IConvertible.ToUInt64 (IFormatProvider provider) { return ((IConvertible)v).ToUInt64 (provider); }
+
+ object IConvertible.ToType (Type targetType, IFormatProvider provider) {
+ return ((IConvertible)v).ToType (targetType, provider);
+ }
+
+ public static void CopyArray (IntPtr source, nfloat [] destination, int startIndex, int length)
+ {
+ if (source == IntPtr.Zero)
+ throw new ArgumentNullException ("source");
+ if (destination == null)
+ throw new ArgumentNullException ("destination");
+ if (destination.Rank != 1)
+ throw new ArgumentException ("destination", "array is multi-dimensional");
+ if (startIndex < 0)
+ throw new ArgumentException ("startIndex", "must be >= 0");
+ if (length < 0)
+ throw new ArgumentException ("length", "must be >= 0");
+ if (startIndex + length > destination.Length)
+ throw new ArgumentException ("length", "startIndex + length > destination.Length");
+
+ for (int i = 0; i < length; i++)
+ destination [i + startIndex] = (nfloat)Marshal.ReadIntPtr (source, i * nfloat.Size);
+ }
+
+ public static void CopyArray (nfloat [] source, int startIndex, IntPtr destination, int length)
+ {
+ if (source == null)
+ throw new ArgumentNullException ("source");
+ if (destination == IntPtr.Zero)
+ throw new ArgumentNullException ("destination");
+ if (source.Rank != 1)
+ throw new ArgumentException ("source", "array is multi-dimensional");
+ if (startIndex < 0)
+ throw new ArgumentException ("startIndex", "must be >= 0");
+ if (length < 0)
+ throw new ArgumentException ("length", "must be >= 0");
+ if (startIndex + length > source.Length)
+ throw new ArgumentException ("length", "startIndex + length > source.Length");
+
+ for (int i = 0; i < length; i++)
+ Marshal.WriteIntPtr (destination, i * nfloat.Size, (IntPtr)source [i + startIndex]);
+ }
+ }
+}
generic_class_init: src1:A len:32 clob:c
get_last_error: dest:i len:32
+
+fill_prof_call_ctx: src1:i len:128
atomic_store_r8: dest:b src1:f len:32
generic_class_init: src1:a len:44 clob:c
+
+fill_prof_call_ctx: src1:i len:128
generic_class_init: src1:a len:44 clob:c
gc_safe_point: src1:i len:12 clob:c
+
+fill_prof_call_ctx: src1:i len:128
gc_param_slot_liveness_def: len:0
get_sp: dest:i len:6
set_sp: src1:i len:6
+
+fill_prof_call_ctx: src1:i len:128
jit->code_start = cfg->native_code;
jit->epilogue_begin = cfg->epilog_begin;
jit->code_size = cfg->code_len;
- jit->has_var_info = debug_options.mdb_optimizations != 0;
+ jit->has_var_info = debug_options.mdb_optimizations || MONO_CFG_PROFILE_CALL_CONTEXT (cfg);
if (jit->epilogue_begin)
record_line_number (info, jit->epilogue_begin, header->code_size);
MonoClass *klass;
} EventInfo;
-/* Dummy structure used for the profiler callbacks */
-typedef struct {
- void* dummy;
-} DebuggerProfiler;
-
typedef struct {
guint8 *buf, *p, *end;
} Buffer;
/* Mutex for the cond var above */
static MonoCoopMutex debugger_thread_exited_mutex;
-static DebuggerProfiler debugger_profiler;
-
/* The single step request instance */
static SingleStepReq *ss_req;
mono_coop_mutex_init (&debugger_thread_exited_mutex);
mono_coop_cond_init (&debugger_thread_exited_cond);
- MonoProfilerHandle prof = mono_profiler_install ((MonoProfiler*)&debugger_profiler);
+ MonoProfilerHandle prof = mono_profiler_create (NULL);
mono_profiler_set_runtime_shutdown_end_callback (prof, runtime_shutdown);
mono_profiler_set_runtime_initialized_callback (prof, runtime_initialized);
mono_profiler_set_domain_loaded_callback (prof, appdomain_load);
}
} else {
for (opt = 0; opt < G_N_ELEMENTS (opt_sets); ++opt) {
+ /* builtin-types.cs needs OPT_INTRINS enabled */
+ if (!strcmp ("builtin-types", image->assembly_name))
+ if (!(opt_sets [opt] & MONO_OPT_INTRINS))
+ continue;
+
mini_regression_step (image, verbose, total_run, &total,
opt_sets [opt] & ~exclude,
timer, domain);
guint32 opt, action = DO_EXEC, recompilation_times = 1;
MonoGraphOptions mono_graph_options = (MonoGraphOptions)0;
int mini_verbose = 0;
- gboolean enable_profile = FALSE;
char *trace_options = NULL;
- char *profile_options = NULL;
char *aot_options = NULL;
char *forced_version = NULL;
GPtrArray *agents = NULL;
} else if (strcmp (argv [i], "--jitmap") == 0) {
mono_enable_jit_map ();
} else if (strcmp (argv [i], "--profile") == 0) {
- enable_profile = TRUE;
- profile_options = NULL;
+ mini_add_profiler_argument (NULL);
} else if (strncmp (argv [i], "--profile=", 10) == 0) {
- enable_profile = TRUE;
- profile_options = argv [i] + 10;
+ mini_add_profiler_argument (argv [i] + 10);
} else if (strncmp (argv [i], "--agent=", 8) == 0) {
if (agents == NULL)
agents = g_ptr_array_new ();
/* Set rootdir before loading config */
mono_set_rootdir ();
- if (enable_profile) {
- mini_profiler_enable_with_options (profile_options);
- }
-
mono_attach_parse_options (attach_options);
if (trace_options != NULL){
}
}
+mono_bool
+mono_jit_aot_compiling (void)
+{
+ return mono_compile_aot;
+}
+
/**
* mono_jit_set_trace_options:
* \param options string representing the trace options
pop
ret
}
+
+ .method public static int32 test_2_fault () cil managed
+ {
+ .maxstack 16
+ .locals init (int32 V_0)
+ IL_0000: ldc.i4.0
+ IL_0001: stloc.0
+ .try
+ {
+ .try
+ {
+ IL_0002: newobj instance void [mscorlib]System.Exception::.ctor()
+ IL_0007: throw
+ leave.s IL_0018
+ } // end .try
+ fault
+ {
+ IL_0009: ldloc.0
+ IL_000a: ldc.i4.1
+ IL_000b: add
+ IL_000c: stloc.0
+ endfinally
+ } // end handler
+ IL_000f: leave.s IL_0018
+
+ } // end .try
+ catch [mscorlib]System.Object
+ {
+ IL_0011: pop
+ IL_0012: ldloc.0
+ IL_0013: ldc.i4.1
+ IL_0014: add
+ IL_0015: stloc.0
+ IL_0016: leave.s IL_0018
+
+ } // end handler
+ IL_0018: ldloc.0
+ ret
+ }
+
+ .method public static int32 test_0_fault_no_exception () cil managed
+ {
+ .maxstack 16
+ .locals init (int32 V_0)
+ IL_0000: ldc.i4.0
+ IL_0001: stloc.0
+ .try
+ {
+ .try
+ {
+ leave.s IL_0018
+ } // end .try
+ fault
+ {
+ IL_0009: ldloc.0
+ IL_000a: ldc.i4.1
+ IL_000b: add
+ IL_000c: stloc.0
+ endfinally
+ } // end handler
+ IL_000f: leave.s IL_0018
+
+ } // end .try
+ catch [mscorlib]System.Object
+ {
+ IL_0011: pop
+ IL_0012: ldloc.0
+ IL_0013: ldc.i4.1
+ IL_0014: add
+ IL_0015: stloc.0
+ IL_0016: leave.s IL_0018
+
+ } // end handler
+ IL_0018: ldloc.0
+ ret
+ }
}
#define ALIGN_PTR_TO(ptr,align) (gpointer)((((gssize)(ptr)) + (align - 1)) & (~(align - 1)))
#define ROUND_DOWN(VALUE,SIZE) ((VALUE) & ~((SIZE) - 1))
-#if defined(TARGET_AMD64) && !defined(HOST_WIN32) && !defined(__APPLE__)
-#define USE_ELF_WRITER 1
-#define USE_ELF_RELA 1
-#endif
-
-#if defined(TARGET_X86) && !defined(HOST_WIN32) && !defined(__APPLE__)
-#define USE_ELF_WRITER 1
-#endif
-
-#if defined(TARGET_ARM) && !defined(TARGET_MACH) && !defined(HOST_WIN32)
-//#define USE_ELF_WRITER 1
-#endif
-
-#if defined(__mips__)
-#define USE_ELF_WRITER 1
-#endif
-
-#if defined(TARGET_X86) && defined(__APPLE__)
-//#define USE_MACH_WRITER
-#endif
-
-#if defined(USE_ELF_WRITER) || defined(USE_MACH_WRITER)
-#define USE_BIN_WRITER 1
-#endif
-
#ifdef USE_BIN_WRITER
typedef struct _BinSymbol BinSymbol;
typedef struct _MonoImageWriter MonoImageWriter;
+#if defined(TARGET_AMD64) && !defined(HOST_WIN32) && !defined(__APPLE__)
+#define USE_ELF_WRITER 1
+#define USE_ELF_RELA 1
+#endif
+
+#if defined(TARGET_X86) && !defined(HOST_WIN32) && !defined(__APPLE__)
+#define USE_ELF_WRITER 1
+#endif
+
+#if defined(TARGET_ARM) && !defined(TARGET_MACH) && !defined(HOST_WIN32)
+//#define USE_ELF_WRITER 1
+#endif
+
+#if defined(__mips__)
+#define USE_ELF_WRITER 1
+#endif
+
+#if defined(TARGET_X86) && defined(__APPLE__)
+//#define USE_MACH_WRITER
+#endif
+
+#if defined(USE_ELF_WRITER) || defined(USE_MACH_WRITER)
+#define USE_BIN_WRITER 1
+#endif
+
/* Relocation types */
#define R_ARM_CALL 28
#define R_ARM_JUMP24 29
#endif
} stackval;
-typedef struct _MonoInvocation MonoInvocation;
+typedef struct _InterpFrame InterpFrame;
typedef void (*MonoFuncV) (void);
typedef void (*MonoPIFunc) (MonoFuncV callme, void *margs);
* Structure representing a method transformed for the interpreter
* This is domain specific
*/
-typedef struct _RuntimeMethod
+typedef struct _InterpMethod
{
/* NOTE: These first two elements (method and
next_jit_code_hash) must be in the same order and at the
same offset as in MonoJitInfo, because of the jit_code_hash
internal hash table in MonoDomain. */
MonoMethod *method;
- struct _RuntimeMethod *next_jit_code_hash;
+ struct _InterpMethod *next_jit_code_hash;
guint32 locals_size;
guint32 args_size;
guint32 stack_size;
MonoType **param_types;
MonoJitInfo *jinfo;
MonoDomain *domain;
-} RuntimeMethod;
+ MonoProfilerCallInstrumentationFlags prof_flags;
+} InterpMethod;
-struct _MonoInvocation {
- MonoInvocation *parent; /* parent */
- RuntimeMethod *runtime_method; /* parent */
+struct _InterpFrame {
+ InterpFrame *parent; /* parent */
+ InterpMethod *imethod; /* parent */
MonoMethod *method; /* parent */
stackval *retval; /* parent */
char *args;
typedef struct {
MonoDomain *original_domain;
- MonoInvocation *base_frame;
- MonoInvocation *current_frame;
- MonoInvocation *env_frame;
+ InterpFrame *base_frame;
+ InterpFrame *current_frame;
+ InterpFrame *env_frame;
jmp_buf *current_env;
unsigned char search_for_handler;
unsigned char managed_code;
/* Resume state for resuming execution in mixed mode */
gboolean has_resume_state;
/* Frame to resume execution at */
- MonoInvocation *handler_frame;
+ InterpFrame *handler_frame;
/* IP to resume execution at */
gpointer handler_ip;
} ThreadContext;
extern GSList *jit_classes;
MonoException *
-mono_interp_transform_method (RuntimeMethod *runtime_method, ThreadContext *context);
+mono_interp_transform_method (InterpMethod *imethod, ThreadContext *context);
void
mono_interp_transform_init (void);
-RuntimeMethod *
-mono_interp_get_runtime_method (MonoDomain *domain, MonoMethod *method, MonoError *error);
+InterpMethod *
+mono_interp_get_imethod (MonoDomain *domain, MonoMethod *method, MonoError *error);
#endif /* __MONO_MINI_INTERPRETER_INTERNALS_H__ */
#endif
static inline void
-init_frame (MonoInvocation *frame, MonoInvocation *parent_frame, RuntimeMethod *rmethod, stackval *method_args, stackval *method_retval)
+init_frame (InterpFrame *frame, InterpFrame *parent_frame, InterpMethod *rmethod, stackval *method_args, stackval *method_retval)
{
frame->parent = parent_frame;
frame->stack_args = method_args;
frame->retval = method_retval;
- frame->runtime_method = rmethod;
+ frame->imethod = rmethod;
frame->ex = NULL;
frame->ip = NULL;
frame->invoke_trap = 0;
}
#define INIT_FRAME(frame,parent_frame,method_args,method_retval,domain,mono_method,error) do { \
- RuntimeMethod *_rmethod = mono_interp_get_runtime_method ((domain), (mono_method), (error)); \
+ InterpMethod *_rmethod = mono_interp_get_imethod ((domain), (mono_method), (error)); \
init_frame ((frame), (parent_frame), _rmethod, (method_args), (method_retval)); \
} while (0)
/* If TRUE, interpreted code will be interrupted at function entry/backward branches */
static gboolean ss_enabled;
-void ves_exec_method (MonoInvocation *frame);
+void ves_exec_method (InterpFrame *frame);
-static char* dump_frame (MonoInvocation *inv);
-static MonoArray *get_trace_ips (MonoDomain *domain, MonoInvocation *top);
-static void ves_exec_method_with_context (MonoInvocation *frame, ThreadContext *context, unsigned short *start_with_ip, MonoException *filter_exception, int exit_at_finally);
+static char* dump_frame (InterpFrame *inv);
+static MonoArray *get_trace_ips (MonoDomain *domain, InterpFrame *top);
+static void ves_exec_method_with_context (InterpFrame *frame, ThreadContext *context, unsigned short *start_with_ip, MonoException *filter_exception, int exit_at_finally);
-typedef void (*ICallMethod) (MonoInvocation *frame);
+typedef void (*ICallMethod) (InterpFrame *frame);
static guint32 die_on_exception = 0;
static MonoNativeTlsKey thread_context_id;
-static char* dump_args (MonoInvocation *inv);
+static char* dump_args (InterpFrame *inv);
#define DEBUG_INTERP 0
#define COUNT_OPS 0
}
static void
-debug_enter (MonoInvocation *frame, int *tracing)
+debug_enter (InterpFrame *frame, int *tracing)
{
if (db_methods) {
- g_list_foreach (db_methods, db_match_method, (gpointer)frame->runtime_method->method);
+ g_list_foreach (db_methods, db_match_method, (gpointer)frame->imethod->method);
if (break_on_method)
*tracing = nested_trace ? (global_tracing = 2, 3) : 2;
break_on_method = 0;
}
if (*tracing) {
- MonoMethod *method = frame->runtime_method->method;
+ MonoMethod *method = frame->imethod->method;
char *mn, *args = dump_args (frame);
debug_indent_level++;
output_indent ();
g_print ("%s)\n", args);
g_free (args);
}
- if (mono_profiler_should_instrument_method (frame->runtime_method->method, TRUE))
- MONO_PROFILER_RAISE (method_enter, (frame->runtime_method->method));
}
char *mn, *args; \
args = dump_retval (frame); \
output_indent (); \
- mn = mono_method_full_name (frame->runtime_method->method, FALSE); \
+ mn = mono_method_full_name (frame->imethod->method, FALSE); \
g_print ("(%p) Leaving %s", mono_thread_internal_current (), mn); \
g_free (mn); \
g_print (" => %s\n", args); \
g_free (args); \
debug_indent_level--; \
if (tracing == 3) global_tracing = 0; \
- } \
- if (mono_profiler_should_instrument_method (frame->runtime_method->method, FALSE)) \
- MONO_PROFILER_RAISE (method_enter, (frame->runtime_method->method));
+ }
#else
int mono_interp_traceopt = 0;
-static void debug_enter (MonoInvocation *frame, int *tracing)
+static void debug_enter (InterpFrame *frame, int *tracing)
{
}
#define DEBUG_LEAVE()
#define ves_abort() \
do {\
- ves_real_abort(__LINE__, frame->runtime_method->method, ip, frame->stack, sp); \
+ ves_real_abort(__LINE__, frame->imethod->method, ip, frame->stack, sp); \
THROW_EX (mono_get_exception_execution_engine (NULL), ip); \
} while (0);
-static RuntimeMethod*
-lookup_runtime_method (MonoDomain *domain, MonoMethod *method)
+static InterpMethod*
+lookup_imethod (MonoDomain *domain, MonoMethod *method)
{
- RuntimeMethod *rtm;
+ InterpMethod *rtm;
MonoJitDomainInfo *info;
info = domain_jit_info (domain);
return rtm;
}
-RuntimeMethod*
-mono_interp_get_runtime_method (MonoDomain *domain, MonoMethod *method, MonoError *error)
+InterpMethod*
+mono_interp_get_imethod (MonoDomain *domain, MonoMethod *method, MonoError *error)
{
- RuntimeMethod *rtm;
+ InterpMethod *rtm;
MonoJitDomainInfo *info;
MonoMethodSignature *sig;
int i;
sig = mono_method_signature (method);
- rtm = mono_domain_alloc0 (domain, sizeof (RuntimeMethod));
+ rtm = mono_domain_alloc0 (domain, sizeof (InterpMethod));
rtm->method = method;
rtm->domain = domain;
rtm->param_count = sig->param_count;
mono_internal_hash_table_insert (&info->interp_code_hash, method, rtm);
mono_domain_jit_code_hash_unlock (domain);
+ rtm->prof_flags = mono_profiler_get_call_instrumentation_flags (rtm->method);
+
return rtm;
}
{
if (method->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED)
method = mono_marshal_get_synchronized_wrapper (method);
- return mono_interp_get_runtime_method (domain, method, error);
+ return mono_interp_get_imethod (domain, method, error);
}
/*
* be able to do stack walks.
*/
static void
-interp_push_lmf (MonoLMFExt *ext, MonoInvocation *frame)
+interp_push_lmf (MonoLMFExt *ext, InterpFrame *frame)
{
memset (ext, 0, sizeof (MonoLMFExt));
ext->interp_exit = TRUE;
mono_pop_lmf (&ext->lmf);
}
-static inline RuntimeMethod*
-get_virtual_method (RuntimeMethod *runtime_method, MonoObject *obj)
+static inline InterpMethod*
+get_virtual_method (InterpMethod *imethod, MonoObject *obj)
{
- MonoMethod *m = runtime_method->method;
- MonoDomain *domain = runtime_method->domain;
- RuntimeMethod *ret = NULL;
+ MonoMethod *m = imethod->method;
+ MonoDomain *domain = imethod->domain;
+ InterpMethod *ret = NULL;
MonoError error;
#ifndef DISABLE_REMOTING
if (mono_object_is_transparent_proxy (obj)) {
- ret = mono_interp_get_runtime_method (domain, mono_marshal_get_remoting_invoke (m), &error);
+ ret = mono_interp_get_imethod (domain, mono_marshal_get_remoting_invoke (m), &error);
mono_error_assert_ok (&error);
return ret;
}
if ((m->flags & METHOD_ATTRIBUTE_FINAL) || !(m->flags & METHOD_ATTRIBUTE_VIRTUAL)) {
if (m->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED) {
- ret = mono_interp_get_runtime_method (domain, mono_marshal_get_synchronized_wrapper (m), &error);
+ ret = mono_interp_get_imethod (domain, mono_marshal_get_synchronized_wrapper (m), &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
} else {
- ret = runtime_method;
+ ret = imethod;
}
return ret;
}
virtual_method = mono_marshal_get_synchronized_wrapper (virtual_method);
}
- RuntimeMethod *virtual_runtime_method = mono_interp_get_runtime_method (domain, virtual_method, &error);
+ InterpMethod *virtual_imethod = mono_interp_get_imethod (domain, virtual_method, &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
- return virtual_runtime_method;
+ return virtual_imethod;
}
static void inline
-stackval_from_data (MonoType *type, stackval *result, char *data, gboolean pinvoke)
+stackval_from_data (MonoType *type_, stackval *result, char *data, gboolean pinvoke)
{
+ MonoType *type = mini_native_type_replace_type (type_);
if (type->byref) {
switch (type->type) {
case MONO_TYPE_OBJECT:
}
static void inline
-stackval_to_data (MonoType *type, stackval *val, char *data, gboolean pinvoke)
+stackval_to_data (MonoType *type_, stackval *val, char *data, gboolean pinvoke)
{
+ MonoType *type = mini_native_type_replace_type (type_);
if (type->byref) {
gpointer *p = (gpointer*)data;
*p = val->data.p;
}
static void
-fill_in_trace (MonoException *exception, MonoInvocation *frame)
+fill_in_trace (MonoException *exception, InterpFrame *frame)
{
MonoError error;
char *stack_trace = dump_frame (frame);
- MonoDomain *domain = frame->runtime_method->domain;
+ MonoDomain *domain = frame->imethod->domain;
(exception)->stack_trace = mono_string_new_checked (domain, stack_trace, &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
(exception)->trace_ips = get_trace_ips (domain, frame);
if (!rethrow) { \
FILL_IN_TRACE(frame->ex, frame); \
} \
+ MONO_PROFILER_RAISE (exception_throw, ((MonoObject *) exception)); \
goto handle_exception; \
} while (0)
#define THROW_EX(exception,ex_ip) THROW_EX_GENERAL ((exception), (ex_ip), FALSE)
static MonoObject*
-ves_array_create (MonoInvocation *frame, MonoDomain *domain, MonoClass *klass, MonoMethodSignature *sig, stackval *values)
+ves_array_create (InterpFrame *frame, MonoDomain *domain, MonoClass *klass, MonoMethodSignature *sig, stackval *values)
{
uintptr_t *lengths;
intptr_t *lower_bounds;
}
static gint32
-ves_array_calculate_index (MonoArray *ao, stackval *sp, MonoInvocation *frame, gboolean safe)
+ves_array_calculate_index (MonoArray *ao, stackval *sp, InterpFrame *frame, gboolean safe)
{
g_assert (!frame->ex);
MonoClass *ac = ((MonoObject *) ao)->vtable->klass;
}
static void
-ves_array_set (MonoInvocation *frame)
+ves_array_set (InterpFrame *frame)
{
stackval *sp = frame->stack_args + 1;
gint32 esize = mono_array_element_size (ac);
gpointer ea = mono_array_addr_with_size (ao, esize, pos);
- MonoType *mt = mono_method_signature (frame->runtime_method->method)->params [ac->rank];
+ MonoType *mt = mono_method_signature (frame->imethod->method)->params [ac->rank];
stackval_to_data (mt, &sp [ac->rank], ea, FALSE);
}
static void
-ves_array_get (MonoInvocation *frame, gboolean safe)
+ves_array_get (InterpFrame *frame, gboolean safe)
{
stackval *sp = frame->stack_args + 1;
gint32 esize = mono_array_element_size (ac);
gpointer ea = mono_array_addr_with_size (ao, esize, pos);
- MonoType *mt = mono_method_signature (frame->runtime_method->method)->ret;
+ MonoType *mt = mono_method_signature (frame->imethod->method)->ret;
stackval_from_data (mt, frame->retval, ea, FALSE);
}
static gpointer
-ves_array_element_address (MonoInvocation *frame, MonoClass *required_type, MonoArray *ao, stackval *sp, gboolean needs_typecheck)
+ves_array_element_address (InterpFrame *frame, MonoClass *required_type, MonoArray *ao, stackval *sp, gboolean needs_typecheck)
{
MonoClass *ac = ((MonoObject *) ao)->vtable->klass;
if (!context)
return;
- MonoInvocation *frame = context->current_frame;
+ InterpFrame *frame = context->current_frame;
while (frame) {
MonoStackFrameInfo fi;
memset (&fi, 0, sizeof (MonoStackFrameInfo));
/* TODO: hack to make some asserts happy. */
- fi.ji = (MonoJitInfo *) frame->runtime_method;
+ fi.ji = (MonoJitInfo *) frame->imethod;
- if (frame->runtime_method)
- fi.method = fi.actual_method = frame->runtime_method->method;
+ if (frame->imethod)
+ fi.method = fi.actual_method = frame->imethod->method;
if (!fi.method || (fi.method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) || (fi.method->iflags & (METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL | METHOD_IMPL_ATTRIBUTE_RUNTIME))) {
fi.il_offset = -1;
static MonoPIFunc mono_interp_enter_icall_trampoline = NULL;
-static InterpMethodArguments* build_args_from_sig (MonoMethodSignature *sig, MonoInvocation *frame)
+static InterpMethodArguments* build_args_from_sig (MonoMethodSignature *sig, InterpFrame *frame)
{
InterpMethodArguments *margs = g_malloc0 (sizeof (InterpMethodArguments));
}
static void
-ves_pinvoke_method (MonoInvocation *frame, MonoMethodSignature *sig, MonoFuncV addr, gboolean string_ctor, ThreadContext *context)
+ves_pinvoke_method (InterpFrame *frame, MonoMethodSignature *sig, MonoFuncV addr, gboolean string_ctor, ThreadContext *context)
{
jmp_buf env;
- MonoInvocation *old_frame = context->current_frame;
- MonoInvocation *old_env_frame = context->env_frame;
+ InterpFrame *old_frame = context->current_frame;
+ InterpFrame *old_env_frame = context->env_frame;
jmp_buf *old_env = context->current_env;
MonoLMFExt ext;
context->env_frame = frame;
context->current_env = &env;
- g_assert (!frame->runtime_method);
+ g_assert (!frame->imethod);
if (!mono_interp_enter_icall_trampoline) {
if (mono_aot_only) {
mono_interp_enter_icall_trampoline = mono_aot_get_trampoline ("enter_icall_trampoline");
if (del->method)
return;
/* shouldn't need a write barrier because we don't write a MonoObject into the field */
- del->method = ((RuntimeMethod *) del->method_ptr)->method;
+ del->method = ((InterpMethod *) del->method_ptr)->method;
}
/*
* provided by the runtime and is primarily used for the methods of delegates.
*/
static void
-ves_runtime_method (MonoInvocation *frame, ThreadContext *context)
+ves_imethod (InterpFrame *frame, ThreadContext *context)
{
- MonoMethod *method = frame->runtime_method->method;
+ MonoMethod *method = frame->imethod->method;
const char *name = method->name;
MonoObject *obj = (MonoObject*) frame->stack_args->data.p;
MonoObject *isinst_obj;
#if DEBUG_INTERP
static char*
-dump_retval (MonoInvocation *inv)
+dump_retval (InterpFrame *inv)
{
GString *str = g_string_new ("");
- MonoType *ret = mono_method_signature (inv->runtime_method->method)->ret;
+ MonoType *ret = mono_method_signature (inv->imethod->method)->ret;
if (ret->type != MONO_TYPE_VOID)
dump_stackval (str, inv->retval, ret);
#endif
static char*
-dump_args (MonoInvocation *inv)
+dump_args (InterpFrame *inv)
{
GString *str = g_string_new ("");
int i;
- MonoMethodSignature *signature = mono_method_signature (inv->runtime_method->method);
+ MonoMethodSignature *signature = mono_method_signature (inv->imethod->method);
if (signature->param_count == 0 && !signature->hasthis)
return g_string_free (str, FALSE);
if (signature->hasthis) {
- MonoMethod *method = inv->runtime_method->method;
+ MonoMethod *method = inv->imethod->method;
dump_stackval (str, inv->stack_args, &method->klass->byval_arg);
}
}
static char*
-dump_frame (MonoInvocation *inv)
+dump_frame (InterpFrame *inv)
{
GString *str = g_string_new ("");
int i;
MonoError error;
for (i = 0; inv; inv = inv->parent) {
- if (inv->runtime_method != NULL) {
- MonoMethod *method = inv->runtime_method->method;
+ if (inv->imethod != NULL) {
+ MonoMethod *method = inv->imethod->method;
MonoClass *k;
int codep = 0;
if (hd != NULL) {
if (inv->ip) {
opname = mono_interp_opname [*inv->ip];
- codep = inv->ip - inv->runtime_method->code;
+ codep = inv->ip - inv->imethod->code;
source = g_strdup_printf ("%s:%d // (TODO: proper stacktrace)", method->name, codep);
} else
opname = "";
}
static MonoArray *
-get_trace_ips (MonoDomain *domain, MonoInvocation *top)
+get_trace_ips (MonoDomain *domain, InterpFrame *top)
{
int i;
MonoArray *res;
- MonoInvocation *inv;
+ InterpFrame *inv;
MonoError error;
for (i = 0, inv = top; inv; inv = inv->parent)
- if (inv->runtime_method != NULL)
+ if (inv->imethod != NULL)
++i;
res = mono_array_new_checked (domain, mono_defaults.int_class, 2 * i, &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
for (i = 0, inv = top; inv; inv = inv->parent)
- if (inv->runtime_method != NULL) {
- mono_array_set (res, gpointer, i, inv->runtime_method);
+ if (inv->imethod != NULL) {
+ mono_array_set (res, gpointer, i, inv->imethod);
++i;
mono_array_set (res, gpointer, i, (gpointer)inv->ip);
++i;
MonoObject*
mono_interp_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObject **exc, MonoError *error)
{
- MonoInvocation frame;
+ InterpFrame frame;
ThreadContext * volatile context = mono_native_tls_get_value (thread_context_id);
MonoObject *retval = NULL;
MonoMethodSignature *sig = mono_method_signature (method);
stackval result;
stackval *args;
ThreadContext context_struct;
- MonoInvocation *old_frame = NULL;
+ InterpFrame *old_frame = NULL;
jmp_buf env;
error_init (error);
}
typedef struct {
- RuntimeMethod *rmethod;
+ InterpMethod *rmethod;
gpointer this_arg;
gpointer res;
gpointer args [16];
static void
interp_entry (InterpEntryData *data)
{
- MonoInvocation frame;
- RuntimeMethod *rmethod = data->rmethod;
+ InterpFrame frame;
+ InterpMethod *rmethod = data->rmethod;
ThreadContext *context = mono_native_tls_get_value (thread_context_id);
ThreadContext context_struct;
- MonoInvocation *old_frame;
+ InterpFrame *old_frame;
stackval result;
stackval *args;
MonoMethod *method;
static stackval *
do_icall (ThreadContext *context, int op, stackval *sp, gpointer ptr)
{
- MonoInvocation *old_frame = context->current_frame;
- MonoInvocation *old_env_frame = context->env_frame;
+ InterpFrame *old_frame = context->current_frame;
+ InterpFrame *old_env_frame = context->env_frame;
jmp_buf *old_env = context->current_env;
jmp_buf env;
}
static stackval *
-do_jit_call (stackval *sp, unsigned char *vt_sp, ThreadContext *context, MonoInvocation *frame, RuntimeMethod *rmethod)
+do_jit_call (stackval *sp, unsigned char *vt_sp, ThreadContext *context, InterpFrame *frame, InterpMethod *rmethod)
{
MonoMethodSignature *sig;
MonoFtnDesc ftndesc;
}
static void
-do_debugger_tramp (void (*tramp) (void), MonoInvocation *frame)
+do_debugger_tramp (void (*tramp) (void), InterpFrame *frame)
{
MonoLMFExt ext;
interp_push_lmf (&ext, frame);
}
static void
-do_transform_method (MonoInvocation *frame, ThreadContext *context)
+do_transform_method (InterpFrame *frame, ThreadContext *context)
{
MonoLMFExt ext;
/* Use the parent frame as the current frame is not complete yet */
interp_push_lmf (&ext, frame->parent);
- frame->ex = mono_interp_transform_method (frame->runtime_method, context);
+ frame->ex = mono_interp_transform_method (frame->imethod, context);
context->managed_code = 1;
interp_pop_lmf (&ext);
interp_entry (&data); \
}
-#define ARGLIST0 RuntimeMethod *rmethod
-#define ARGLIST1 gpointer arg1, RuntimeMethod *rmethod
-#define ARGLIST2 gpointer arg1, gpointer arg2, RuntimeMethod *rmethod
-#define ARGLIST3 gpointer arg1, gpointer arg2, gpointer arg3, RuntimeMethod *rmethod
-#define ARGLIST4 gpointer arg1, gpointer arg2, gpointer arg3, gpointer arg4, RuntimeMethod *rmethod
-#define ARGLIST5 gpointer arg1, gpointer arg2, gpointer arg3, gpointer arg4, gpointer arg5, RuntimeMethod *rmethod
-#define ARGLIST6 gpointer arg1, gpointer arg2, gpointer arg3, gpointer arg4, gpointer arg5, gpointer arg6, RuntimeMethod *rmethod
-#define ARGLIST7 gpointer arg1, gpointer arg2, gpointer arg3, gpointer arg4, gpointer arg5, gpointer arg6, gpointer arg7, RuntimeMethod *rmethod
-#define ARGLIST8 gpointer arg1, gpointer arg2, gpointer arg3, gpointer arg4, gpointer arg5, gpointer arg6, gpointer arg7, gpointer arg8, RuntimeMethod *rmethod
+#define ARGLIST0 InterpMethod *rmethod
+#define ARGLIST1 gpointer arg1, InterpMethod *rmethod
+#define ARGLIST2 gpointer arg1, gpointer arg2, InterpMethod *rmethod
+#define ARGLIST3 gpointer arg1, gpointer arg2, gpointer arg3, InterpMethod *rmethod
+#define ARGLIST4 gpointer arg1, gpointer arg2, gpointer arg3, gpointer arg4, InterpMethod *rmethod
+#define ARGLIST5 gpointer arg1, gpointer arg2, gpointer arg3, gpointer arg4, gpointer arg5, InterpMethod *rmethod
+#define ARGLIST6 gpointer arg1, gpointer arg2, gpointer arg3, gpointer arg4, gpointer arg5, gpointer arg6, InterpMethod *rmethod
+#define ARGLIST7 gpointer arg1, gpointer arg2, gpointer arg3, gpointer arg4, gpointer arg5, gpointer arg6, gpointer arg7, InterpMethod *rmethod
+#define ARGLIST8 gpointer arg1, gpointer arg2, gpointer arg3, gpointer arg4, gpointer arg5, gpointer arg6, gpointer arg7, gpointer arg8, InterpMethod *rmethod
static void interp_entry_static_0 (ARGLIST0) INTERP_ENTRY0 (NULL, NULL, rmethod)
static void interp_entry_static_1 (ARGLIST1) INTERP_ENTRY1 (NULL, NULL, rmethod)
gpointer addr;
MonoMethodSignature *sig = mono_method_signature (method);
MonoMethod *wrapper;
- RuntimeMethod *rmethod = mono_interp_get_runtime_method (mono_domain_get (), method, error);
+ InterpMethod *rmethod = mono_interp_get_imethod (mono_domain_get (), method, error);
/* HACK: method_ptr of delegate should point to a runtime method*/
if (method->wrapper_type && method->wrapper_type == MONO_WRAPPER_DYNAMIC_METHOD)
} \
sp->data.l = 0; \
output_indent (); \
- char *mn = mono_method_full_name (frame->runtime_method->method, FALSE); \
+ char *mn = mono_method_full_name (frame->imethod->method, FALSE); \
g_print ("(%p) %s -> ", mono_thread_internal_current (), mn); \
g_free (mn); \
mono_interp_dis_mintop(rtm->code, ip); \
* If EXIT_AT_FINALLY is not -1, exit after exiting the finally clause with that index.
*/
static void
-ves_exec_method_with_context (MonoInvocation *frame, ThreadContext *context, unsigned short *start_with_ip, MonoException *filter_exception, int exit_at_finally)
+ves_exec_method_with_context (InterpFrame *frame, ThreadContext *context, unsigned short *start_with_ip, MonoException *filter_exception, int exit_at_finally)
{
- MonoInvocation child_frame;
+ InterpFrame child_frame;
GSList *finally_ips = NULL;
const unsigned short *endfinally_ip = NULL;
const unsigned short *ip = NULL;
register stackval *sp;
- RuntimeMethod *rtm;
+ InterpMethod *rtm;
#if DEBUG_INTERP
gint tracing = global_tracing;
unsigned char *vtalloc;
debug_enter (frame, &tracing);
- if (!frame->runtime_method->transformed) {
+ if (!frame->imethod->transformed) {
context->managed_code = 0;
#if DEBUG_INTERP
- char *mn = mono_method_full_name (frame->runtime_method->method, TRUE);
+ char *mn = mono_method_full_name (frame->imethod->method, TRUE);
g_print ("(%p) Transforming %s\n", mono_thread_internal_current (), mn);
g_free (mn);
#endif
}
}
- rtm = frame->runtime_method;
+ rtm = frame->imethod;
if (!start_with_ip ) {
frame->args = alloca (rtm->alloca_size);
memset (frame->args, 0, rtm->alloca_size);
MINT_IN_CASE(MINT_NOP)
++ip;
MINT_IN_BREAK;
+ MINT_IN_CASE(MINT_NIY)
+ g_error ("mint_niy: instruction not implemented yet. This shouldn't happen.");
+ MINT_IN_BREAK;
MINT_IN_CASE(MINT_BREAK)
++ip;
do_debugger_tramp (mono_debugger_agent_user_break, frame);
MINT_IN_BREAK;
}
MINT_IN_CASE(MINT_JMP) {
- RuntimeMethod *new_method = rtm->data_items [* (guint16 *)(ip + 1)];
+ InterpMethod *new_method = rtm->data_items [* (guint16 *)(ip + 1)];
+
+ if (frame->imethod->prof_flags & MONO_PROFILER_CALL_INSTRUMENTATION_TAIL_CALL)
+ MONO_PROFILER_RAISE (method_tail_call, (frame->imethod->method, new_method->method));
+
if (!new_method->transformed) {
frame->ip = ip;
frame->ex = mono_interp_transform_method (new_method, context);
ip += 2;
if (new_method->alloca_size > rtm->alloca_size)
g_error ("MINT_JMP to method which needs more stack space (%d > %d)", new_method->alloca_size, rtm->alloca_size);
- rtm = frame->runtime_method = new_method;
+ rtm = frame->imethod = new_method;
vt_sp = (unsigned char *) sp + rtm->stack_size;
#if DEBUG_INTERP
vtalloc = vt_sp;
ip += 2;
--sp;
--endsp;
- child_frame.runtime_method = sp->data.p;
+ child_frame.imethod = sp->data.p;
sp->data.p = vt_sp;
child_frame.retval = sp;
#ifndef DISABLE_REMOTING
/* `this' can be NULL for string:.ctor */
if (csignature->hasthis && sp->data.p && mono_object_is_transparent_proxy (sp->data.p)) {
- child_frame.runtime_method = mono_interp_get_runtime_method (rtm->domain, mono_marshal_get_remoting_invoke (child_frame.runtime_method->method), &error);
+ child_frame.imethod = mono_interp_get_imethod (rtm->domain, mono_marshal_get_remoting_invoke (child_frame.imethod->method), &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
} else
#endif
- if (child_frame.runtime_method->method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) {
- child_frame.runtime_method = mono_interp_get_runtime_method (rtm->domain, mono_marshal_get_native_wrapper (child_frame.runtime_method->method, FALSE, FALSE), &error);
+ if (child_frame.imethod->method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) {
+ child_frame.imethod = mono_interp_get_imethod (rtm->domain, mono_marshal_get_native_wrapper (child_frame.imethod->method, FALSE, FALSE), &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
}
--sp;
--endsp;
code = sp->data.p;
- child_frame.runtime_method = NULL;
+ child_frame.imethod = NULL;
sp->data.p = vt_sp;
child_frame.retval = sp;
frame->ip = ip;
- child_frame.runtime_method = rtm->data_items [* (guint16 *)(ip + 1)];
+ child_frame.imethod = rtm->data_items [* (guint16 *)(ip + 1)];
ip += 2;
sp->data.p = vt_sp;
child_frame.retval = sp;
/* decrement by the actual number of args */
- sp -= child_frame.runtime_method->param_count;
- if (child_frame.runtime_method->hasthis)
+ sp -= child_frame.imethod->param_count;
+ if (child_frame.imethod->hasthis)
--sp;
child_frame.stack_args = sp;
#ifndef DISABLE_REMOTING
/* `this' can be NULL for string:.ctor */
- if (child_frame.runtime_method->hasthis && !child_frame.runtime_method->method->klass->valuetype && sp->data.p && mono_object_is_transparent_proxy (sp->data.p)) {
- child_frame.runtime_method = mono_interp_get_runtime_method (rtm->domain, mono_marshal_get_remoting_invoke (child_frame.runtime_method->method), &error);
+ if (child_frame.imethod->hasthis && !child_frame.imethod->method->klass->valuetype && sp->data.p && mono_object_is_transparent_proxy (sp->data.p)) {
+ child_frame.imethod = mono_interp_get_imethod (rtm->domain, mono_marshal_get_remoting_invoke (child_frame.imethod->method), &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
}
#endif
MINT_IN_CASE(MINT_VCALL) {
frame->ip = ip;
- child_frame.runtime_method = rtm->data_items [* (guint16 *)(ip + 1)];
+ child_frame.imethod = rtm->data_items [* (guint16 *)(ip + 1)];
ip += 2;
sp->data.p = vt_sp;
child_frame.retval = sp;
/* decrement by the actual number of args */
- sp -= child_frame.runtime_method->param_count;
- if (child_frame.runtime_method->hasthis) {
+ sp -= child_frame.imethod->param_count;
+ if (child_frame.imethod->hasthis) {
--sp;
MonoObject *this_arg = sp->data.p;
if (!this_arg)
child_frame.stack_args = sp;
#ifndef DISABLE_REMOTING
- if (child_frame.runtime_method->hasthis && !child_frame.runtime_method->method->klass->valuetype && mono_object_is_transparent_proxy (sp->data.p)) {
- child_frame.runtime_method = mono_interp_get_runtime_method (rtm->domain, mono_marshal_get_remoting_invoke (child_frame.runtime_method->method), &error);
+ if (child_frame.imethod->hasthis && !child_frame.imethod->method->klass->valuetype && mono_object_is_transparent_proxy (sp->data.p)) {
+ child_frame.imethod = mono_interp_get_imethod (rtm->domain, mono_marshal_get_remoting_invoke (child_frame.imethod->method), &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
}
#endif
}
MINT_IN_CASE(MINT_JIT_CALL) {
- RuntimeMethod *rmethod = rtm->data_items [* (guint16 *)(ip + 1)];
+ InterpMethod *rmethod = rtm->data_items [* (guint16 *)(ip + 1)];
frame->ip = ip;
ip += 2;
sp = do_jit_call (sp, vt_sp, context, frame, rmethod);
token = * (unsigned short *)(ip + 1);
ip += 2;
- child_frame.runtime_method = rtm->data_items [token];
+ child_frame.imethod = rtm->data_items [token];
sp->data.p = vt_sp;
child_frame.retval = sp;
/* decrement by the actual number of args */
- sp -= child_frame.runtime_method->param_count + 1;
+ sp -= child_frame.imethod->param_count + 1;
child_frame.stack_args = sp;
this_arg = sp->data.p;
if (!this_arg)
THROW_EX (mono_get_exception_null_reference(), ip - 2);
- child_frame.runtime_method = get_virtual_method (child_frame.runtime_method, this_arg);
+ child_frame.imethod = get_virtual_method (child_frame.imethod, this_arg);
MonoClass *this_class = this_arg->vtable->klass;
- if (this_class->valuetype && child_frame.runtime_method->method->klass->valuetype) {
+ if (this_class->valuetype && child_frame.imethod->method->klass->valuetype) {
/* unbox */
gpointer *unboxed = mono_object_unbox (this_arg);
sp [0].data.p = unboxed;
token = * (unsigned short *)(ip + 1);
ip += 2;
- child_frame.runtime_method = rtm->data_items [token];
+ child_frame.imethod = rtm->data_items [token];
sp->data.p = vt_sp;
child_frame.retval = sp;
/* decrement by the actual number of args */
- sp -= child_frame.runtime_method->param_count + 1;
+ sp -= child_frame.imethod->param_count + 1;
child_frame.stack_args = sp;
this_arg = sp->data.p;
if (!this_arg)
THROW_EX (mono_get_exception_null_reference(), ip - 2);
- child_frame.runtime_method = get_virtual_method (child_frame.runtime_method, this_arg);
+ child_frame.imethod = get_virtual_method (child_frame.imethod, this_arg);
MonoClass *this_class = this_arg->vtable->klass;
- if (this_class->valuetype && child_frame.runtime_method->method->klass->valuetype) {
+ if (this_class->valuetype && child_frame.imethod->method->klass->valuetype) {
gpointer *unboxed = mono_object_unbox (this_arg);
sp [0].data.p = unboxed;
}
MINT_IN_BREAK;
}
MINT_IN_CASE(MINT_CALLRUN)
- ves_runtime_method (frame, context);
+ ves_imethod (frame, context);
if (frame->ex) {
rtm = NULL;
goto handle_exception;
goto exit_frame;
MINT_IN_CASE(MINT_RET_VOID)
if (sp > frame->stack)
- g_warning ("ret.void: more values on stack: %d %s", sp-frame->stack, mono_method_full_name (frame->runtime_method->method, TRUE));
+ g_warning ("ret.void: more values on stack: %d %s", sp-frame->stack, mono_method_full_name (frame->imethod->method, TRUE));
goto exit_frame;
MINT_IN_CASE(MINT_RET_VT)
i32 = READ32(ip + 1);
child_frame.ip = NULL;
child_frame.ex = NULL;
- child_frame.runtime_method = rtm->data_items [token];
- csig = mono_method_signature (child_frame.runtime_method->method);
- newobj_class = child_frame.runtime_method->method->klass;
+ child_frame.imethod = rtm->data_items [token];
+ csig = mono_method_signature (child_frame.imethod->method);
+ newobj_class = child_frame.imethod->method->klass;
/*if (profiling_classes) {
guint count = GPOINTER_TO_UINT (g_hash_table_lookup (profiling_classes, newobj_class));
count++;
++sp;
MINT_IN_BREAK;
}
+ MINT_IN_CASE(MINT_NEWOBJ_MAGIC) {
+ guint32 token;
+
+ frame->ip = ip;
+ token = * (guint16 *)(ip + 1);
+ ip += 2;
+
+ MINT_IN_BREAK;
+ }
MINT_IN_CASE(MINT_CASTCLASS)
c = rtm->data_items [*(guint16 *)(ip + 1)];
if ((o = sp [-1].data.p)) {
c = rtm->data_items [* (guint16 *)(ip + 1)];
guint16 offset = * (guint16 *)(ip + 2);
- if (c->byval_arg.type == MONO_TYPE_VALUETYPE && !c->enumtype) {
+ if (c->byval_arg.type == MONO_TYPE_VALUETYPE && !c->enumtype && !(mono_class_is_magic_int (c) || mono_class_is_magic_float (c))) {
int size = mono_class_value_size (c, NULL);
sp [-1 - offset].data.p = mono_value_box_checked (rtm->domain, c, sp [-1 - offset].data.p, &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
goto main_loop;
}
if (frame->ex)
- goto handle_fault;
+ goto handle_catch;
ves_abort();
MINT_IN_BREAK;
MINT_IN_CASE(MINT_LEAVE) /* Fall through */
MINT_IN_CASE(MINT_MONO_RETOBJ)
++ip;
sp--;
- stackval_from_data (mono_method_signature (frame->runtime_method->method)->ret, frame->retval, sp->data.p,
- mono_method_signature (frame->runtime_method->method)->pinvoke);
+ stackval_from_data (mono_method_signature (frame->imethod->method)->ret, frame->retval, sp->data.p,
+ mono_method_signature (frame->imethod->method)->pinvoke);
if (sp > frame->stack)
g_warning ("retobj: more values on stack: %d", sp-frame->stack);
goto exit_frame;
--sp; \
sp [-1].data.i = sp [-1].data.datamem op sp [0].data.datamem; \
++ip;
+
+#define RELOP_FP(datamem, op, noorder) \
+ --sp; \
+ if (isunordered (sp [-1].data.datamem, sp [0].data.datamem)) \
+ sp [-1].data.i = noorder; \
+ else \
+ sp [-1].data.i = sp [-1].data.datamem op sp [0].data.datamem; \
+ ++ip;
+
MINT_IN_CASE(MINT_CEQ_I4)
RELOP(i, ==);
MINT_IN_BREAK;
RELOP(l, ==);
MINT_IN_BREAK;
MINT_IN_CASE(MINT_CEQ_R8)
- --sp;
- if (isunordered (sp [-1].data.f, sp [0].data.f))
- sp [-1].data.i = 0;
- else
- sp [-1].data.i = sp [-1].data.f == sp [0].data.f;
- ++ip;
+ RELOP_FP(f, ==, 0);
+ MINT_IN_BREAK;
+ MINT_IN_CASE(MINT_CNE_I4)
+ RELOP(i, !=);
+ MINT_IN_BREAK;
+ MINT_IN_CASE(MINT_CNE_I8)
+ RELOP(l, !=);
+ MINT_IN_BREAK;
+ MINT_IN_CASE(MINT_CNE_R8)
+ RELOP_FP(f, !=, 0);
MINT_IN_BREAK;
MINT_IN_CASE(MINT_CGT_I4)
RELOP(i, >);
RELOP(l, >);
MINT_IN_BREAK;
MINT_IN_CASE(MINT_CGT_R8)
- --sp;
- if (isunordered (sp [-1].data.f, sp [0].data.f))
- sp [-1].data.i = 0;
- else
- sp [-1].data.i = sp [-1].data.f > sp [0].data.f;
- ++ip;
+ RELOP_FP(f, >, 0);
+ MINT_IN_BREAK;
+ MINT_IN_CASE(MINT_CGE_I4)
+ RELOP(i, >=);
+ MINT_IN_BREAK;
+ MINT_IN_CASE(MINT_CGE_I8)
+ RELOP(l, >=);
+ MINT_IN_BREAK;
+ MINT_IN_CASE(MINT_CGE_R8)
+ RELOP_FP(f, >=, 0);
MINT_IN_BREAK;
#define RELOP_CAST(datamem, op, type) \
sp [-1].data.i = (type)sp [-1].data.datamem op (type)sp [0].data.datamem; \
++ip;
+ MINT_IN_CASE(MINT_CGE_UN_I4)
+ RELOP_CAST(l, >=, guint32);
+ MINT_IN_BREAK;
+ MINT_IN_CASE(MINT_CGE_UN_I8)
+ RELOP_CAST(l, >=, guint64);
+ MINT_IN_BREAK;
+
MINT_IN_CASE(MINT_CGT_UN_I4)
RELOP_CAST(i, >, guint32);
MINT_IN_BREAK;
RELOP_CAST(l, >, guint64);
MINT_IN_BREAK;
MINT_IN_CASE(MINT_CGT_UN_R8)
- --sp;
- if (isunordered (sp [-1].data.f, sp [0].data.f))
- sp [-1].data.i = 1;
- else
- sp [-1].data.i = sp [-1].data.f > sp [0].data.f;
- ++ip;
+ RELOP_FP(f, >, 1);
MINT_IN_BREAK;
MINT_IN_CASE(MINT_CLT_I4)
RELOP(i, <);
RELOP(l, <);
MINT_IN_BREAK;
MINT_IN_CASE(MINT_CLT_R8)
- --sp;
- if (isunordered (sp [-1].data.f, sp [0].data.f))
- sp [-1].data.i = 0;
- else
- sp [-1].data.i = sp [-1].data.f < sp [0].data.f;
- ++ip;
+ RELOP_FP(f, <, 0);
MINT_IN_BREAK;
MINT_IN_CASE(MINT_CLT_UN_I4)
RELOP_CAST(i, <, guint32);
RELOP_CAST(l, <, guint64);
MINT_IN_BREAK;
MINT_IN_CASE(MINT_CLT_UN_R8)
- --sp;
- if (isunordered (sp [-1].data.f, sp [0].data.f))
- sp [-1].data.i = 1;
- else
- sp [-1].data.i = sp [-1].data.f < sp [0].data.f;
- ++ip;
+ RELOP_FP(f, <, 1);
+ MINT_IN_BREAK;
+ MINT_IN_CASE(MINT_CLE_I4)
+ RELOP(i, <=);
MINT_IN_BREAK;
+ MINT_IN_CASE(MINT_CLE_I8)
+ RELOP(l, <=);
+ MINT_IN_BREAK;
+ MINT_IN_CASE(MINT_CLE_UN_I4)
+ RELOP_CAST(l, <=, guint32);
+ MINT_IN_BREAK;
+ MINT_IN_CASE(MINT_CLE_UN_I8)
+ RELOP_CAST(l, <=, guint64);
+ MINT_IN_BREAK;
+ MINT_IN_CASE(MINT_CLE_R8)
+ RELOP_FP(f, <=, 0);
+ MINT_IN_BREAK;
+
+#undef RELOP
+#undef RELOP_FP
+#undef RELOP_CAST
+
MINT_IN_CASE(MINT_LDFTN) {
sp->data.p = rtm->data_items [* (guint16 *)(ip + 1)];
++sp;
MINT_IN_BREAK;
}
MINT_IN_CASE(MINT_LDVIRTFTN) {
- RuntimeMethod *m = rtm->data_items [* (guint16 *)(ip + 1)];
+ InterpMethod *m = rtm->data_items [* (guint16 *)(ip + 1)];
ip += 2;
--sp;
if (!sp->data.p)
MINT_IN_BREAK;
}
+ MINT_IN_CASE(MINT_PROF_ENTER) {
+ ip += 1;
+
+ if (MONO_PROFILER_ENABLED (method_enter)) {
+ MonoProfilerCallContext *prof_ctx = NULL;
+
+ if (frame->imethod->prof_flags & MONO_PROFILER_CALL_INSTRUMENTATION_ENTER_CONTEXT) {
+ prof_ctx = g_new0 (MonoProfilerCallContext, 1);
+ prof_ctx->interp_frame = frame;
+ prof_ctx->method = frame->imethod->method;
+ }
+
+ MONO_PROFILER_RAISE (method_enter, (frame->imethod->method, prof_ctx));
+
+ g_free (prof_ctx);
+ }
+
+ MINT_IN_BREAK;
+ }
+
MINT_IN_CASE(MINT_LDARGA)
sp->data.p = frame->args + * (guint16 *)(ip + 1);
ip += 2;
int len = sp [-1].data.i;
sp [-1].data.p = alloca (len);
- MonoMethodHeader *header = mono_method_get_header_checked (frame->runtime_method->method, &error);
+ MonoMethodHeader *header = mono_method_get_header_checked (frame->imethod->method, &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
if (header && header->init_locals)
memset (sp [-1].data.p, 0, len);
{
int i;
guint32 ip_offset;
- MonoInvocation *inv;
+ InterpFrame *inv;
MonoExceptionClause *clause;
/*char *message;*/
MonoObject *ex_obj;
for (inv = frame; inv; inv = inv->parent) {
MonoMethod *method;
- if (inv->runtime_method == NULL)
+ if (inv->imethod == NULL)
continue;
- method = inv->runtime_method->method;
+ method = inv->imethod->method;
if (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL)
continue;
if (method->iflags & (METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL | METHOD_IMPL_ATTRIBUTE_RUNTIME))
continue;
if (inv->ip == NULL)
continue;
- ip_offset = inv->ip - inv->runtime_method->code;
+ ip_offset = inv->ip - inv->imethod->code;
inv->ex_handler = NULL; /* clear this in case we are trhowing an exception while handling one - this one wins */
- for (i = 0; i < inv->runtime_method->num_clauses; ++i) {
- clause = &inv->runtime_method->clauses [i];
+ for (i = 0; i < inv->imethod->num_clauses; ++i) {
+ clause = &inv->imethod->clauses [i];
#if DEBUG_INTERP
g_print ("* clause [%d]: %p\n", i, clause);
#endif
if (tracing)
g_print ("* Filter found at '%s'\n", method->name);
#endif
- MonoInvocation dup_frame;
+ InterpFrame dup_frame;
stackval retval;
- memcpy (&dup_frame, inv, sizeof (MonoInvocation));
+ memcpy (&dup_frame, inv, sizeof (InterpFrame));
dup_frame.retval = &retval;
- ves_exec_method_with_context (&dup_frame, context, inv->runtime_method->code + clause->data.filter_offset, frame->ex, -1);
+ ves_exec_method_with_context (&dup_frame, context, inv->imethod->code + clause->data.filter_offset, frame->ex, -1);
if (dup_frame.retval->data.i) {
#if DEBUG_INTERP
if (tracing)
g_print ("* Matched Filter at '%s'\n", method->name);
#endif
inv->ex_handler = clause;
- *(MonoException**)(inv->locals + inv->runtime_method->exvar_offsets [i]) = frame->ex;
+ *(MonoException**)(inv->locals + inv->imethod->exvar_offsets [i]) = frame->ex;
goto handle_finally;
}
} else if (clause->flags == MONO_EXCEPTION_CLAUSE_NONE) {
g_print ("* Found handler at '%s'\n", method->name);
#endif
inv->ex_handler = clause;
- *(MonoException**)(inv->locals + inv->runtime_method->exvar_offsets [i]) = frame->ex;
+ *(MonoException**)(inv->locals + inv->imethod->exvar_offsets [i]) = frame->ex;
goto handle_finally;
}
}
guint32 ip_offset;
MonoExceptionClause *clause;
GSList *old_list = finally_ips;
- MonoMethod *method = frame->runtime_method->method;
+ MonoMethod *method = frame->imethod->method;
MonoMethodHeader *header = mono_method_get_header_checked (method, &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
int i;
guint32 ip_offset;
MonoExceptionClause *clause;
- MonoMethod *method = frame->runtime_method->method;
+ GSList *old_list = finally_ips;
+ MonoMethod *method = frame->imethod->method;
MonoMethodHeader *header = mono_method_get_header_checked (method, &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
clause = &rtm->clauses [i];
if (clause->flags == MONO_EXCEPTION_CLAUSE_FAULT && MONO_OFFSET_IN_CLAUSE (clause, ip_offset)) {
ip = rtm->code + clause->handler_offset;
+ finally_ips = g_slist_prepend (finally_ips, (gpointer) ip);
#if DEBUG_INTERP
if (tracing)
g_print ("* Executing handler at IL_%04x\n", clause->handler_offset);
#endif
- goto main_loop;
}
}
+
+ if (old_list != finally_ips && finally_ips) {
+ ip = finally_ips->data;
+ finally_ips = g_slist_remove (finally_ips, ip);
+ sp = frame->stack; /* spec says stack should be empty at endfinally so it should be at the start too */
+ goto main_loop;
+ }
+ }
+ handle_catch:
+ {
/*
* If the handler for the exception was found in this method, we jump
* to it right away, otherwise we return and let the caller run
goto exit_frame;
}
exit_frame:
+
+ if (!frame->ex && MONO_PROFILER_ENABLED (method_leave) &&
+ frame->imethod->prof_flags & MONO_PROFILER_CALL_INSTRUMENTATION_LEAVE) {
+ MonoProfilerCallContext *prof_ctx = NULL;
+
+ if (frame->imethod->prof_flags & MONO_PROFILER_CALL_INSTRUMENTATION_LEAVE_CONTEXT) {
+ prof_ctx = g_new0 (MonoProfilerCallContext, 1);
+ prof_ctx->interp_frame = frame;
+ prof_ctx->method = frame->imethod->method;
+
+ MonoType *rtype = mono_method_signature (frame->imethod->method)->ret;
+
+ switch (rtype->type) {
+ case MONO_TYPE_VOID:
+ break;
+ case MONO_TYPE_VALUETYPE:
+ prof_ctx->return_value = frame->retval->data.p;
+ break;
+ default:
+ prof_ctx->return_value = frame->retval;
+ break;
+ }
+ }
+
+ MONO_PROFILER_RAISE (method_leave, (frame->imethod->method, prof_ctx));
+
+ g_free (prof_ctx);
+ } else if (frame->ex && frame->imethod->prof_flags & MONO_PROFILER_CALL_INSTRUMENTATION_EXCEPTION_LEAVE)
+ MONO_PROFILER_RAISE (method_exception_leave, (frame->imethod->method, &frame->ex->object));
+
DEBUG_LEAVE ();
}
void
-ves_exec_method (MonoInvocation *frame)
+ves_exec_method (InterpFrame *frame)
{
ThreadContext *context = mono_native_tls_get_value (thread_context_id);
ThreadContext context_struct;
- MonoDomain *domain = frame->runtime_method->domain;
+ MonoDomain *domain = frame->imethod->domain;
MonoError error;
jmp_buf env;
}
frame->ip = NULL;
frame->parent = context->current_frame;
- frame->runtime_method = mono_interp_get_runtime_method (domain, frame->method, &error);
+ frame->imethod = mono_interp_get_imethod (domain, frame->method, &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
context->managed_code = 1;
ves_exec_method_with_context (frame, context, NULL, NULL, -1);
void
mono_interp_run_finally (StackFrameInfo *frame, int clause_index, gpointer handler_ip)
{
- MonoInvocation *iframe = frame->interp_frame;
+ InterpFrame *iframe = frame->interp_frame;
ThreadContext *context = mono_native_tls_get_value (thread_context_id);
ves_exec_method_with_context (iframe, context, handler_ip, NULL, clause_index);
}
typedef struct {
- MonoInvocation *current;
+ InterpFrame *current;
} StackIter;
/*
{
StackIter *stack_iter = (StackIter*)iter;
- stack_iter->current = (MonoInvocation*)interp_exit_data;
+ stack_iter->current = (InterpFrame*)interp_exit_data;
}
gboolean
mono_interp_frame_iter_next (MonoInterpStackIter *iter, StackFrameInfo *frame)
{
StackIter *stack_iter = (StackIter*)iter;
- MonoInvocation *iframe = stack_iter->current;
+ InterpFrame *iframe = stack_iter->current;
memset (frame, 0, sizeof (StackFrameInfo));
- /* pinvoke frames doesn't have runtime_method set */
- while (iframe && !(iframe->runtime_method && iframe->runtime_method->code))
+ /* pinvoke frames doesn't have imethod set */
+ while (iframe && !(iframe->imethod && iframe->imethod->code))
iframe = iframe->parent;
if (!iframe)
return FALSE;
// FIXME:
frame->domain = mono_domain_get ();
frame->interp_frame = iframe;
- frame->method = iframe->runtime_method->method;
+ frame->method = iframe->imethod->method;
frame->actual_method = frame->method;
/* This is the offset in the interpreter IR */
- frame->native_offset = (guint8*)iframe->ip - (guint8*)iframe->runtime_method->code;
- frame->ji = iframe->runtime_method->jinfo;
+ frame->native_offset = (guint8*)iframe->ip - (guint8*)iframe->imethod->code;
+ frame->ji = iframe->imethod->jinfo;
stack_iter->current = iframe->parent;
MonoJitInfo*
mono_interp_find_jit_info (MonoDomain *domain, MonoMethod *method)
{
- RuntimeMethod* rtm;
+ InterpMethod* rtm;
- rtm = lookup_runtime_method (domain, method);
+ rtm = lookup_imethod (domain, method);
if (rtm)
return rtm->jinfo;
else
MonoJitInfo*
mono_interp_frame_get_jit_info (MonoInterpFrameHandle frame)
{
- MonoInvocation *iframe = (MonoInvocation*)frame;
+ InterpFrame *iframe = (InterpFrame*)frame;
- g_assert (iframe->runtime_method);
- return iframe->runtime_method->jinfo;
+ g_assert (iframe->imethod);
+ return iframe->imethod->jinfo;
}
gpointer
mono_interp_frame_get_ip (MonoInterpFrameHandle frame)
{
- MonoInvocation *iframe = (MonoInvocation*)frame;
+ InterpFrame *iframe = (InterpFrame*)frame;
- g_assert (iframe->runtime_method);
+ g_assert (iframe->imethod);
return (gpointer)iframe->ip;
}
gpointer
mono_interp_frame_get_arg (MonoInterpFrameHandle frame, int pos)
{
- MonoInvocation *iframe = (MonoInvocation*)frame;
+ InterpFrame *iframe = (InterpFrame*)frame;
- g_assert (iframe->runtime_method);
+ g_assert (iframe->imethod);
- int arg_offset = iframe->runtime_method->arg_offsets [pos + (iframe->runtime_method->hasthis ? 1 : 0)];
+ int arg_offset = iframe->imethod->arg_offsets [pos + (iframe->imethod->hasthis ? 1 : 0)];
return iframe->args + arg_offset;
}
gpointer
mono_interp_frame_get_local (MonoInterpFrameHandle frame, int pos)
{
- MonoInvocation *iframe = (MonoInvocation*)frame;
+ InterpFrame *iframe = (InterpFrame*)frame;
- g_assert (iframe->runtime_method);
+ g_assert (iframe->imethod);
- return iframe->locals + iframe->runtime_method->local_offsets [pos];
+ return iframe->locals + iframe->imethod->local_offsets [pos];
}
gpointer
mono_interp_frame_get_this (MonoInterpFrameHandle frame)
{
- MonoInvocation *iframe = (MonoInvocation*)frame;
+ InterpFrame *iframe = (InterpFrame*)frame;
- g_assert (iframe->runtime_method);
- g_assert (iframe->runtime_method->hasthis);
+ g_assert (iframe->imethod);
+ g_assert (iframe->imethod->hasthis);
- int arg_offset = iframe->runtime_method->arg_offsets [0];
+ int arg_offset = iframe->imethod->arg_offsets [0];
return iframe->args + arg_offset;
}
/* OPDEF (opsymbol, opstring, oplength (in uint16s), optype) */
OPDEF(MINT_NOP, "nop", 1, MintOpNoArgs)
+OPDEF(MINT_NIY, "niy", 1, MintOpNoArgs)
OPDEF(MINT_BREAK, "break", 1, MintOpNoArgs)
OPDEF(MINT_LDNULL, "ldnull", 1, MintOpNoArgs)
OPDEF(MINT_DUP, "dup", 1, MintOpNoArgs)
OPDEF(MINT_ENDFILTER, "endfilter", 1, MintOpNoArgs)
OPDEF(MINT_NEWOBJ, "newobj", 2, MintOpMethodToken)
+OPDEF(MINT_NEWOBJ_MAGIC, "newobj_magic", 2, MintOpMethodToken)
OPDEF(MINT_INITOBJ, "initobj", 3, MintOpInt)
OPDEF(MINT_CASTCLASS, "castclass", 2, MintOpClassToken)
OPDEF(MINT_ISINST, "isinst", 2, MintOpClassToken)
OPDEF(MINT_CEQ_I8, "ceq.i8", 1, MintOpNoArgs)
OPDEF(MINT_CEQ_R8, "ceq.r8", 1, MintOpNoArgs)
+OPDEF(MINT_CNE_I4, "cne.i4", 1, MintOpNoArgs)
+OPDEF(MINT_CNE_I8, "cne.i8", 1, MintOpNoArgs)
+OPDEF(MINT_CNE_R8, "cne.r8", 1, MintOpNoArgs)
+
OPDEF(MINT_CEQ0_I4, "ceq0.i4", 1, MintOpNoArgs)
OPDEF(MINT_CGT_I4, "cgt.i4", 1, MintOpNoArgs)
OPDEF(MINT_CGT_I8, "cgt.i8", 1, MintOpNoArgs)
OPDEF(MINT_CGT_R8, "cgt.r8", 1, MintOpNoArgs)
+OPDEF(MINT_CGE_I4, "cge.i4", 1, MintOpNoArgs)
+OPDEF(MINT_CGE_I8, "cge.i8", 1, MintOpNoArgs)
+OPDEF(MINT_CGE_R8, "cge.r8", 1, MintOpNoArgs)
+
+OPDEF(MINT_CGE_UN_I4, "cge.un.i4", 1, MintOpNoArgs)
+OPDEF(MINT_CGE_UN_I8, "cge.un.i8", 1, MintOpNoArgs)
+
OPDEF(MINT_CGT_UN_I4, "cgt.un.i4", 1, MintOpNoArgs)
OPDEF(MINT_CGT_UN_I8, "cgt.un.i8", 1, MintOpNoArgs)
OPDEF(MINT_CGT_UN_R8, "cgt.un.r8", 1, MintOpNoArgs)
OPDEF(MINT_CLT_I8, "clt.i8", 1, MintOpNoArgs)
OPDEF(MINT_CLT_R8, "clt.r8", 1, MintOpNoArgs)
+OPDEF(MINT_CLE_I4, "cle.i4", 1, MintOpNoArgs)
+OPDEF(MINT_CLE_I8, "cle.i8", 1, MintOpNoArgs)
+OPDEF(MINT_CLE_R8, "cle.r8", 1, MintOpNoArgs)
+
+OPDEF(MINT_CLE_UN_I4, "cle.un.i4", 1, MintOpNoArgs)
+OPDEF(MINT_CLE_UN_I8, "cle.un.i8", 1, MintOpNoArgs)
+
OPDEF(MINT_CLT_UN_I4, "clt.un.i4", 1, MintOpNoArgs)
OPDEF(MINT_CLT_UN_I8, "clt.un.i8", 1, MintOpNoArgs)
OPDEF(MINT_CLT_UN_R8, "clt.un.r8", 1, MintOpNoArgs)
OPDEF(MINT_SDB_INTR_LOC, "sdb_intr_loc", 1, MintOpNoArgs)
OPDEF(MINT_SDB_SEQ_POINT, "sdb_seq_point", 1, MintOpNoArgs)
OPDEF(MINT_SDB_BREAKPOINT, "sdb_breakpoint", 1, MintOpNoArgs)
+
+/*
+ * This needs to be an opcode because we need to trigger the enter event after
+ * the STINARG* opcodes have executed.
+ */
+OPDEF(MINT_PROF_ENTER, "prof_enter", 1, MintOpNoArgs)
{
MonoMethod *method;
MonoMethodHeader *header;
- RuntimeMethod *rtm;
+ InterpMethod *rtm;
const unsigned char *il_code;
const unsigned char *ip;
const unsigned char *last_ip;
STACK_TYPE_VT
};
+#if SIZEOF_VOID_P == 8
+#define MINT_NEG_P MINT_NEG_I8
+#define MINT_NOT_P MINT_NOT_I8
+
+#define MINT_NEG_FP MINT_NEG_R8
+
+#define MINT_ADD_P MINT_ADD_I8
+#define MINT_SUB_P MINT_SUB_I8
+#define MINT_MUL_P MINT_MUL_I8
+#define MINT_DIV_P MINT_DIV_I8
+#define MINT_DIV_UN_P MINT_DIV_UN_I8
+#define MINT_REM_P MINT_REM_I8
+#define MINT_REM_UN_P MINT_REM_UN_I8
+#define MINT_AND_P MINT_AND_I8
+#define MINT_OR_P MINT_OR_I8
+#define MINT_XOR_P MINT_XOR_I8
+#define MINT_SHL_P MINT_SHL_I8
+#define MINT_SHR_P MINT_SHR_I8
+#define MINT_SHR_UN_P MINT_SHR_UN_I8
+
+#define MINT_CEQ_P MINT_CEQ_I8
+#define MINT_CNE_P MINT_CNE_I8
+#define MINT_CLT_P MINT_CLT_I8
+#define MINT_CLT_UN_P MINT_CLT_UN_I8
+#define MINT_CGT_P MINT_CGT_I8
+#define MINT_CGT_UN_P MINT_CGT_UN_I8
+#define MINT_CLE_P MINT_CLE_I8
+#define MINT_CLE_UN_P MINT_CLE_UN_I8
+#define MINT_CGE_P MINT_CGE_I8
+#define MINT_CGE_UN_P MINT_CGE_UN_I8
+
+#define MINT_ADD_FP MINT_ADD_R8
+#define MINT_SUB_FP MINT_SUB_R8
+#define MINT_MUL_FP MINT_MUL_R8
+#define MINT_DIV_FP MINT_DIV_R8
+#define MINT_REM_FP MINT_REM_R8
+
+#define MINT_CNE_FP MINT_CNE_R8
+#define MINT_CEQ_FP MINT_CEQ_R8
+#define MINT_CGT_FP MINT_CGT_R8
+#define MINT_CGE_FP MINT_CGE_R8
+#define MINT_CLT_FP MINT_CLT_R8
+#define MINT_CLE_FP MINT_CLE_R8
+
+#else
+
+#define MINT_NEG_P MINT_NEG_I4
+#define MINT_NOT_P MINT_NOT_I4
+
+#define MINT_NEG_FP MINT_NEG_R8
+
+#define MINT_ADD_P MINT_ADD_I4
+#define MINT_SUB_P MINT_SUB_I4
+#define MINT_MUL_P MINT_MUL_I4
+#define MINT_DIV_P MINT_DIV_I4
+#define MINT_DIV_UN_P MINT_DIV_UN_I4
+#define MINT_REM_P MINT_REM_I4
+#define MINT_REM_UN_P MINT_REM_UN_I4
+#define MINT_AND_P MINT_AND_I4
+#define MINT_OR_P MINT_OR_I4
+#define MINT_XOR_P MINT_XOR_I4
+#define MINT_SHL_P MINT_SHL_I4
+#define MINT_SHR_P MINT_SHR_I4
+#define MINT_SHR_UN_P MINT_SHR_UN_I4
+
+#define MINT_CEQ_P MINT_CEQ_I4
+#define MINT_CNE_P MINT_CNE_I4
+#define MINT_CLT_P MINT_CLT_I4
+#define MINT_CLT_UN_P MINT_CLT_UN_I4
+#define MINT_CGT_P MINT_CGT_I4
+#define MINT_CGT_UN_P MINT_CGT_UN_I4
+#define MINT_CLE_P MINT_CLE_I4
+#define MINT_CLE_UN_P MINT_CLE_UN_I4
+#define MINT_CGE_P MINT_CGE_I4
+#define MINT_CGE_UN_P MINT_CGE_UN_I4
+
+#define MINT_ADD_FP MINT_ADD_R8
+#define MINT_SUB_FP MINT_SUB_R8
+#define MINT_MUL_FP MINT_MUL_R8
+#define MINT_DIV_FP MINT_DIV_R8
+#define MINT_REM_FP MINT_REM_R8
+
+#define MINT_CNE_FP MINT_CNE_R8
+#define MINT_CEQ_FP MINT_CEQ_R8
+#define MINT_CGT_FP MINT_CGT_R8
+#define MINT_CGE_FP MINT_CGE_R8
+#define MINT_CLT_FP MINT_CLT_R8
+#define MINT_CLE_FP MINT_CLE_R8
+
+#endif
+
+typedef struct {
+ const gchar *op_name;
+ guint16 insn [3];
+} MagicIntrinsic;
+
+// static const MagicIntrinsic int_binop[] = {
+
+static const MagicIntrinsic int_unnop[] = {
+ { "op_UnaryPlus", {MINT_NOP, MINT_NOP, MINT_NOP}},
+ { "op_UnaryNegation", {MINT_NEG_P, MINT_NEG_P, MINT_NEG_FP}},
+ { "op_OnesComplement", {MINT_NOT_P, MINT_NOT_P, MINT_NIY}}
+};
+
+static const MagicIntrinsic int_binop[] = {
+ { "op_Addition", {MINT_ADD_P, MINT_ADD_P, MINT_ADD_FP}},
+ { "op_Subtraction", {MINT_SUB_P, MINT_SUB_P, MINT_SUB_FP}},
+ { "op_Multiply", {MINT_MUL_P, MINT_MUL_P, MINT_MUL_FP}},
+ { "op_Division", {MINT_DIV_P, MINT_DIV_UN_P, MINT_DIV_FP}},
+ { "op_Modulus", {MINT_REM_P, MINT_REM_UN_P, MINT_REM_FP}},
+ { "op_BitwiseAnd", {MINT_AND_P, MINT_AND_P, MINT_NIY}},
+ { "op_BitwiseOr", {MINT_OR_P, MINT_OR_P, MINT_NIY}},
+ { "op_ExclusiveOr", {MINT_XOR_P, MINT_XOR_P, MINT_NIY}},
+ { "op_LeftShift", {MINT_SHL_P, MINT_SHL_P, MINT_NIY}},
+ { "op_RightShift", {MINT_SHR_P, MINT_SHR_UN_P, MINT_NIY}},
+};
+
+static const MagicIntrinsic int_cmpop[] = {
+ { "op_Inequality", {MINT_CNE_P, MINT_CNE_P, MINT_CNE_FP}},
+ { "op_Equality", {MINT_CEQ_P, MINT_CEQ_P, MINT_CEQ_FP}},
+ { "op_GreaterThan", {MINT_CGT_P, MINT_CGT_UN_P, MINT_CGT_FP}},
+ { "op_GreaterThanOrEqual", {MINT_CGE_P, MINT_CGE_UN_P, MINT_CGE_FP}},
+ { "op_LessThan", {MINT_CLT_P, MINT_CLT_UN_P, MINT_CLT_FP}},
+ { "op_LessThanOrEqual", {MINT_CLE_P, MINT_CLE_UN_P, MINT_CLE_FP}}
+};
+
static void
grow_code (TransformData *td)
{
}
static int
-mint_type(MonoType *type)
+mint_type(MonoType *type_)
{
+ MonoType *type = mini_native_type_replace_type (type_);
if (type->byref)
return MINT_TYPE_P;
enum_type:
#define SIMPLE_OP(td, op) \
do { \
- ADD_CODE(&td, op); \
- ++td.ip; \
+ ADD_CODE(td, op); \
+ ++td->ip; \
} while (0)
static guint16
return FALSE;
}
+static inline gboolean
+type_size (MonoType *type)
+{
+ if (type->type == MONO_TYPE_I4 || type->type == MONO_TYPE_U4)
+ return 4;
+ else if (type->type == MONO_TYPE_I8 || type->type == MONO_TYPE_U8)
+ return 8;
+ else if (type->type == MONO_TYPE_R4 && !type->byref)
+ return 4;
+ else if (type->type == MONO_TYPE_R8 && !type->byref)
+ return 8;
+ return SIZEOF_VOID_P;
+}
+
+static int mono_class_get_magic_index (MonoClass *k)
+{
+ if (mono_class_is_magic_int (k))
+ return !strcmp ("nint", k->name) ? 0 : 1;
+
+ if (mono_class_is_magic_float (k))
+ return 2;
+
+ return -1;
+}
+
+
static void
interp_transform_call (TransformData *td, MonoMethod *method, MonoMethod *target_method, MonoDomain *domain, MonoGenericContext *generic_context, unsigned char *is_bb_start, int body_start_offset, MonoClass *constrained_class, gboolean readonly)
{
/* Intrinsics */
if (target_method) {
+ const char *tm = target_method->name;
+ int type_index = mono_class_get_magic_index (target_method->klass);
+
if (target_method->klass == mono_defaults.string_class) {
- if (target_method->name [0] == 'g') {
- if (strcmp (target_method->name, "get_Chars") == 0)
+ if (tm [0] == 'g') {
+ if (strcmp (tm, "get_Chars") == 0)
op = MINT_GETCHR;
- else if (strcmp (target_method->name, "get_Length") == 0)
+ else if (strcmp (tm, "get_Length") == 0)
op = MINT_STRLEN;
}
+ } else if (type_index >= 0) {
+ MonoClass *magic_class = target_method->klass;
+
+ const int mt = mint_type (&magic_class->byval_arg);
+ if (!strcmp (".ctor", tm)) {
+ MonoType *arg = csignature->params [0];
+ /* depending on SIZEOF_VOID_P and the type of the value passed to the .ctor we either have to CONV it, or do nothing */
+ int arg_size = type_size (arg);
+
+ if (arg_size > SIZEOF_VOID_P) { // 8 -> 4
+ switch (type_index) {
+ case 0: case 1:
+ ADD_CODE (td, MINT_CONV_I8_I4);
+ break;
+ case 2:
+ // ADD_CODE (td, MINT_CONV_R8_R4);
+ break;
+ }
+ }
+
+ if (arg_size < SIZEOF_VOID_P) { // 4 -> 8
+ switch (type_index) {
+ case 0: case 1:
+ ADD_CODE (td, MINT_CONV_I4_I8);
+ break;
+ case 2:
+ ADD_CODE (td, MINT_CONV_R4_R8);
+ break;
+ }
+ }
+
+ switch (type_index) {
+ case 0: case 1:
+#if SIZEOF_VOID_P == 4
+ ADD_CODE (td, MINT_STIND_I4);
+#else
+ ADD_CODE (td, MINT_STIND_I8);
+#endif
+ break;
+ case 2:
+#if SIZEOF_VOID_P == 4
+ ADD_CODE (td, MINT_STIND_R4);
+#else
+ ADD_CODE (td, MINT_STIND_R8);
+#endif
+ break;
+ }
+
+ td->sp -= 2;
+ td->ip += 5;
+ return;
+ } else if (!strcmp ("op_Implicit", tm ) || !strcmp ("op_Explicit", tm)) {
+ int arg_size = type_size (csignature->params [0]);
+ if (arg_size > SIZEOF_VOID_P) { // 8 -> 4
+ switch (type_index) {
+ case 0: case 1:
+ ADD_CODE (td, MINT_CONV_I8_I4);
+ break;
+ case 2:
+ // ADD_CODE (td, MINT_CONV_R4_R8);
+ break;
+ }
+ }
+
+ if (arg_size < SIZEOF_VOID_P) { // 4 -> 8
+ switch (type_index) {
+ case 0: case 1:
+ ADD_CODE (td, MINT_CONV_I4_I8);
+ break;
+ case 2:
+ ADD_CODE (td, MINT_CONV_R4_R8);
+ break;
+ }
+ }
+
+ SET_TYPE (td->sp - 1, stack_type [mt], magic_class);
+ td->ip += 5;
+ return;
+ } else if (!strcmp (".cctor", tm)) {
+ /* white list */
+ goto no_intrinsic;
+ } else if (!strcmp ("Parse", tm)) {
+ /* white list */
+ goto no_intrinsic;
+ }
+
+ for (i = 0; i < sizeof (int_unnop) / sizeof (MagicIntrinsic); ++i) {
+ if (!strcmp (int_unnop [i].op_name, tm)) {
+ ADD_CODE (td, int_unnop [i].insn [type_index]);
+ SET_TYPE (td->sp - 1, stack_type [mt], magic_class);
+ td->ip += 5;
+ return;
+ }
+ }
+
+ for (i = 0; i < sizeof (int_binop) / sizeof (MagicIntrinsic); ++i) {
+ if (!strcmp (int_binop [i].op_name, tm)) {
+ ADD_CODE (td, int_binop [i].insn [type_index]);
+ td->sp -= 1;
+ SET_TYPE (td->sp - 1, stack_type [mt], magic_class);
+ td->ip += 5;
+ return;
+ }
+ }
+
+ for (i = 0; i < sizeof (int_cmpop) / sizeof (MagicIntrinsic); ++i) {
+ if (!strcmp (int_cmpop [i].op_name, tm)) {
+ MonoClass *k = mono_defaults.boolean_class;
+ ADD_CODE (td, int_cmpop [i].insn [type_index]);
+ td->sp -= 1;
+ SET_TYPE (td->sp - 1, stack_type [mint_type (&k->byval_arg)], k);
+ td->ip += 5;
+ return;
+ }
+ }
+
+ g_error ("TODO: %s", tm);
} else if (mono_class_is_subclass_of (target_method->klass, mono_defaults.array_class, FALSE)) {
- if (!strcmp (target_method->name, "get_Rank")) {
+ if (!strcmp (tm, "get_Rank")) {
op = MINT_ARRAY_RANK;
- } else if (!strcmp (target_method->name, "get_Length")) {
+ } else if (!strcmp (tm, "get_Length")) {
op = MINT_LDLEN;
- } else if (!strcmp (target_method->name, "Address")) {
+ } else if (!strcmp (tm, "Address")) {
op = readonly ? MINT_LDELEMA : MINT_LDELEMA_TC;
}
} else if (target_method->klass->image == mono_defaults.corlib &&
(strcmp (target_method->klass->name_space, "System.Diagnostics") == 0) &&
(strcmp (target_method->klass->name, "Debugger") == 0)) {
- if (!strcmp (target_method->name, "Break") && csignature->param_count == 0) {
+ if (!strcmp (tm, "Break") && csignature->param_count == 0) {
if (mini_should_insert_breakpoint (method))
op = MINT_BREAK;
}
}
}
+no_intrinsic:
if (constrained_class) {
if (constrained_class->enumtype && !strcmp (target_method->name, "GetHashCode")) {
}
} else if (!calli && !virtual && jit_call_supported (target_method, csignature)) {
ADD_CODE(td, MINT_JIT_CALL);
- ADD_CODE(td, get_data_item_index (td, (void *)mono_interp_get_runtime_method (domain, target_method, &error)));
+ ADD_CODE(td, get_data_item_index (td, (void *)mono_interp_get_imethod (domain, target_method, &error)));
mono_error_assert_ok (&error);
} else {
if (calli)
if (calli) {
ADD_CODE(td, get_data_item_index (td, (void *)csignature));
} else {
- ADD_CODE(td, get_data_item_index (td, (void *)mono_interp_get_runtime_method (domain, target_method, &error)));
+ ADD_CODE(td, get_data_item_index (td, (void *)mono_interp_get_imethod (domain, target_method, &error)));
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
}
}
}
static void
-interp_save_debug_info (RuntimeMethod *rtm, MonoMethodHeader *header, TransformData *td, GArray *line_numbers)
+interp_save_debug_info (InterpMethod *rtm, MonoMethodHeader *header, TransformData *td, GArray *line_numbers)
{
MonoDebugMethodJitInfo *dinfo;
int i;
static void
save_seq_points (TransformData *td)
{
- RuntimeMethod *rtm = td->rtm;
+ InterpMethod *rtm = td->rtm;
GByteArray *array;
int i, seq_info_size;
MonoSeqPointInfo *info;
#define BARRIER_IF_VOLATILE(td) \
do { \
if (volatile_) { \
- ADD_CODE (&td, MINT_MONO_MEMORY_BARRIER); \
+ ADD_CODE (td, MINT_MONO_MEMORY_BARRIER); \
volatile_ = FALSE; \
} \
} while (0)
static void
-generate (MonoMethod *method, RuntimeMethod *rtm, unsigned char *is_bb_start, MonoGenericContext *generic_context)
+generate (MonoMethod *method, InterpMethod *rtm, unsigned char *is_bb_start, MonoGenericContext *generic_context)
{
MonoMethodHeader *header = mono_method_get_header (method);
MonoMethodSignature *signature = mono_method_signature (method);
int body_start_offset;
int target;
guint32 token;
- TransformData td;
+ TransformData transform_data;
+ TransformData *td;
int generating_code = 1;
GArray *line_numbers;
MonoDebugMethodInfo *minfo;
verbose_method_inited = TRUE;
}
- memset (&td, 0, sizeof(td));
- td.method = method;
- td.rtm = rtm;
- td.is_bb_start = is_bb_start;
- td.il_code = header->code;
- td.code_size = header->code_size;
- td.header = header;
- td.max_code_size = td.code_size;
- td.new_code = (unsigned short *)g_malloc(td.max_code_size * sizeof(gushort));
- td.new_code_end = td.new_code + td.max_code_size;
- td.mempool = mono_mempool_new ();
- td.in_offsets = g_malloc0(header->code_size * sizeof(int));
- td.stack_state = g_malloc0(header->code_size * sizeof(StackInfo *));
- td.stack_height = g_malloc(header->code_size * sizeof(int));
- td.vt_stack_size = g_malloc(header->code_size * sizeof(int));
- td.n_data_items = 0;
- td.max_data_items = 0;
- td.data_items = NULL;
- td.data_hash = g_hash_table_new (NULL, NULL);
- td.clause_indexes = g_malloc (header->code_size * sizeof (int));
- td.gen_sdb_seq_points = debug_options.gen_sdb_seq_points;
- td.seq_points = g_ptr_array_new ();
- td.relocs = g_ptr_array_new ();
- td.verbose_level = mono_interp_traceopt;
- rtm->data_items = td.data_items;
+ memset (&transform_data, 0, sizeof(transform_data));
+ td = &transform_data;
+
+ td->method = method;
+ td->rtm = rtm;
+ td->is_bb_start = is_bb_start;
+ td->il_code = header->code;
+ td->code_size = header->code_size;
+ td->header = header;
+ td->max_code_size = td->code_size;
+ td->new_code = (unsigned short *)g_malloc(td->max_code_size * sizeof(gushort));
+ td->new_code_end = td->new_code + td->max_code_size;
+ td->mempool = mono_mempool_new ();
+ td->in_offsets = g_malloc0(header->code_size * sizeof(int));
+ td->stack_state = g_malloc0(header->code_size * sizeof(StackInfo *));
+ td->stack_height = g_malloc(header->code_size * sizeof(int));
+ td->vt_stack_size = g_malloc(header->code_size * sizeof(int));
+ td->n_data_items = 0;
+ td->max_data_items = 0;
+ td->data_items = NULL;
+ td->data_hash = g_hash_table_new (NULL, NULL);
+ td->clause_indexes = g_malloc (header->code_size * sizeof (int));
+ td->gen_sdb_seq_points = debug_options.gen_sdb_seq_points;
+ td->seq_points = g_ptr_array_new ();
+ td->relocs = g_ptr_array_new ();
+ td->verbose_level = mono_interp_traceopt;
+ rtm->data_items = td->data_items;
for (i = 0; i < header->code_size; i++) {
- td.stack_height [i] = -1;
- td.clause_indexes [i] = -1;
+ td->stack_height [i] = -1;
+ td->clause_indexes [i] = -1;
}
if (verbose_method_name) {
desc = mono_method_desc_new (name, TRUE);
if (mono_method_desc_full_match (desc, method)) {
- td.verbose_level = 4;
+ td->verbose_level = 4;
}
mono_method_desc_free (desc);
} else {
if (strcmp (method->name, name) == 0)
- td.verbose_level = 4;
+ td->verbose_level = 4;
}
}
- if (td.gen_sdb_seq_points) {
- get_basic_blocks (&td);
+ if (td->gen_sdb_seq_points) {
+ get_basic_blocks (td);
minfo = mono_debug_lookup_method (method);
mono_debug_get_seq_points (minfo, NULL, NULL, NULL, &sps, &n_il_offsets);
// FIXME: Free
- seq_point_locs = mono_bitset_mem_new (mono_mempool_alloc0 (td.mempool, mono_bitset_alloc_size (header->code_size, 0)), header->code_size, 0);
- seq_point_set_locs = mono_bitset_mem_new (mono_mempool_alloc0 (td.mempool, mono_bitset_alloc_size (header->code_size, 0)), header->code_size, 0);
+ seq_point_locs = mono_bitset_mem_new (mono_mempool_alloc0 (td->mempool, mono_bitset_alloc_size (header->code_size, 0)), header->code_size, 0);
+ seq_point_set_locs = mono_bitset_mem_new (mono_mempool_alloc0 (td->mempool, mono_bitset_alloc_size (header->code_size, 0)), header->code_size, 0);
sym_seq_points = TRUE;
for (i = 0; i < n_il_offsets; ++i) {
}
}
- td.new_ip = td.new_code;
- td.last_new_ip = NULL;
+ td->new_ip = td->new_code;
+ td->last_new_ip = NULL;
- td.stack = g_malloc0 ((header->max_stack + 1) * sizeof (td.stack [0]));
- td.sp = td.stack;
- td.max_stack_height = 0;
+ td->stack = g_malloc0 ((header->max_stack + 1) * sizeof (td->stack [0]));
+ td->sp = td->stack;
+ td->max_stack_height = 0;
line_numbers = g_array_new (FALSE, TRUE, sizeof (MonoDebugLineNumberEntry));
for (i = 0; i < header->num_clauses; i++) {
MonoExceptionClause *c = header->clauses + i;
- td.stack_height [c->handler_offset] = 0;
- td.vt_stack_size [c->handler_offset] = 0;
- td.is_bb_start [c->handler_offset] = 1;
+ td->stack_height [c->handler_offset] = 0;
+ td->vt_stack_size [c->handler_offset] = 0;
+ td->is_bb_start [c->handler_offset] = 1;
- td.stack_height [c->handler_offset] = 1;
- td.stack_state [c->handler_offset] = g_malloc0(sizeof(StackInfo));
- td.stack_state [c->handler_offset][0].type = STACK_TYPE_O;
- td.stack_state [c->handler_offset][0].klass = NULL; /*FIX*/
+ td->stack_height [c->handler_offset] = 1;
+ td->stack_state [c->handler_offset] = g_malloc0(sizeof(StackInfo));
+ td->stack_state [c->handler_offset][0].type = STACK_TYPE_O;
+ td->stack_state [c->handler_offset][0].klass = NULL; /*FIX*/
if (c->flags & MONO_EXCEPTION_CLAUSE_FILTER) {
- td.stack_height [c->data.filter_offset] = 0;
- td.vt_stack_size [c->data.filter_offset] = 0;
- td.is_bb_start [c->data.filter_offset] = 1;
-
- td.stack_height [c->data.filter_offset] = 1;
- td.stack_state [c->data.filter_offset] = g_malloc0(sizeof(StackInfo));
- td.stack_state [c->data.filter_offset][0].type = STACK_TYPE_O;
- td.stack_state [c->data.filter_offset][0].klass = NULL; /*FIX*/
+ td->stack_height [c->data.filter_offset] = 0;
+ td->vt_stack_size [c->data.filter_offset] = 0;
+ td->is_bb_start [c->data.filter_offset] = 1;
+
+ td->stack_height [c->data.filter_offset] = 1;
+ td->stack_state [c->data.filter_offset] = g_malloc0(sizeof(StackInfo));
+ td->stack_state [c->data.filter_offset][0].type = STACK_TYPE_O;
+ td->stack_state [c->data.filter_offset][0].klass = NULL; /*FIX*/
}
for (int j = c->handler_offset; j < c->handler_offset + c->handler_len; ++j) {
- if (td.clause_indexes [j] == -1)
- td.clause_indexes [j] = i;
+ if (td->clause_indexes [j] == -1)
+ td->clause_indexes [j] = i;
}
}
- td.ip = header->code;
- end = td.ip + header->code_size;
+ td->ip = header->code;
+ end = td->ip + header->code_size;
- if (td.verbose_level) {
- char *tmp = mono_disasm_code (NULL, method, td.ip, end);
+ if (td->verbose_level) {
+ char *tmp = mono_disasm_code (NULL, method, td->ip, end);
char *name = mono_method_full_name (method, TRUE);
g_print ("Method %s, original code:\n", name);
g_print ("%s\n", tmp);
}
if (signature->hasthis)
- store_inarg (&td, 0);
+ store_inarg (td, 0);
for (i = 0; i < signature->param_count; i++)
- store_inarg (&td, i + !!signature->hasthis);
+ store_inarg (td, i + !!signature->hasthis);
- body_start_offset = td.new_ip - td.new_code;
+ body_start_offset = td->new_ip - td->new_code;
for (i = 0; i < header->num_locals; i++) {
int mt = mint_type(header->locals [i]);
if (mt == MINT_TYPE_VT || mt == MINT_TYPE_O || mt == MINT_TYPE_P) {
- ADD_CODE(&td, MINT_INITLOCALS);
+ ADD_CODE(td, MINT_INITLOCALS);
break;
}
}
+ if (rtm->prof_flags & MONO_PROFILER_CALL_INSTRUMENTATION_ENTER)
+ ADD_CODE (td, MINT_PROF_ENTER);
+
if (sym_seq_points) {
- InterpBasicBlock *cbb = td.offset_to_bb [0];
+ InterpBasicBlock *cbb = td->offset_to_bb [0];
g_assert (cbb);
- emit_seq_point (&td, METHOD_ENTRY_IL_OFFSET, cbb, FALSE);
+ emit_seq_point (td, METHOD_ENTRY_IL_OFFSET, cbb, FALSE);
}
- while (td.ip < end) {
+ while (td->ip < end) {
int in_offset;
- g_assert (td.sp >= td.stack);
- g_assert (td.vt_sp < 0x10000000);
- in_offset = td.ip - header->code;
- td.in_offsets [in_offset] = td.new_ip - td.new_code;
- new_in_start_offset = td.new_ip - td.new_code;
- td.in_start = td.ip;
+ g_assert (td->sp >= td->stack);
+ g_assert (td->vt_sp < 0x10000000);
+ in_offset = td->ip - header->code;
+ td->in_offsets [in_offset] = td->new_ip - td->new_code;
+ new_in_start_offset = td->new_ip - td->new_code;
+ td->in_start = td->ip;
MonoDebugLineNumberEntry lne;
- lne.native_offset = (guint8*)td.new_ip - (guint8*)td.new_code;
+ lne.native_offset = (guint8*)td->new_ip - (guint8*)td->new_code;
lne.il_offset = in_offset;
g_array_append_val (line_numbers, lne);
- if (td.stack_height [in_offset] >= 0) {
+ if (td->stack_height [in_offset] >= 0) {
g_assert (is_bb_start [in_offset]);
- if (td.stack_height [in_offset] > 0)
- memcpy (td.stack, td.stack_state [in_offset], td.stack_height [in_offset] * sizeof(td.stack [0]));
- td.sp = td.stack + td.stack_height [in_offset];
- td.vt_sp = td.vt_stack_size [in_offset];
+ if (td->stack_height [in_offset] > 0)
+ memcpy (td->stack, td->stack_state [in_offset], td->stack_height [in_offset] * sizeof(td->stack [0]));
+ td->sp = td->stack + td->stack_height [in_offset];
+ td->vt_sp = td->vt_stack_size [in_offset];
}
if (is_bb_start [in_offset]) {
generating_code = 1;
}
if (!generating_code) {
- while (td.ip < end && !is_bb_start [td.ip - td.il_code])
- ++td.ip;
+ while (td->ip < end && !is_bb_start [td->ip - td->il_code])
+ ++td->ip;
continue;
}
- if (td.verbose_level > 1) {
+ if (td->verbose_level > 1) {
printf("IL_%04lx %s %-10s -> IL_%04lx, sp %ld, %s %-12s vt_sp %u (max %u)\n",
- td.ip - td.il_code,
- td.is_bb_start [td.ip - td.il_code] == 3 ? "<>" :
- td.is_bb_start [td.ip - td.il_code] == 2 ? "< " :
- td.is_bb_start [td.ip - td.il_code] == 1 ? " >" : " ",
- mono_opcode_name (*td.ip), td.new_ip - td.new_code, td.sp - td.stack,
- td.sp > td.stack ? stack_type_string [td.sp [-1].type] : " ",
- (td.sp > td.stack && (td.sp [-1].type == STACK_TYPE_O || td.sp [-1].type == STACK_TYPE_VT)) ? (td.sp [-1].klass == NULL ? "?" : td.sp [-1].klass->name) : "",
- td.vt_sp, td.max_vt_sp);
+ td->ip - td->il_code,
+ td->is_bb_start [td->ip - td->il_code] == 3 ? "<>" :
+ td->is_bb_start [td->ip - td->il_code] == 2 ? "< " :
+ td->is_bb_start [td->ip - td->il_code] == 1 ? " >" : " ",
+ mono_opcode_name (*td->ip), td->new_ip - td->new_code, td->sp - td->stack,
+ td->sp > td->stack ? stack_type_string [td->sp [-1].type] : " ",
+ (td->sp > td->stack && (td->sp [-1].type == STACK_TYPE_O || td->sp [-1].type == STACK_TYPE_VT)) ? (td->sp [-1].klass == NULL ? "?" : td->sp [-1].klass->name) : "",
+ td->vt_sp, td->max_vt_sp);
}
- if (sym_seq_points && mono_bitset_test_fast (seq_point_locs, td.ip - header->code)) {
- InterpBasicBlock *cbb = td.offset_to_bb [td.ip - header->code];
+ if (sym_seq_points && mono_bitset_test_fast (seq_point_locs, td->ip - header->code)) {
+ InterpBasicBlock *cbb = td->offset_to_bb [td->ip - header->code];
g_assert (cbb);
/*
* backward branches.
*/
if (in_offset == 0 || g_slist_length (cbb->preds) > 1)
- ADD_CODE (&td, MINT_SDB_INTR_LOC);
+ ADD_CODE (td, MINT_SDB_INTR_LOC);
- emit_seq_point (&td, in_offset, cbb, FALSE);
+ emit_seq_point (td, in_offset, cbb, FALSE);
- mono_bitset_set_fast (seq_point_set_locs, td.ip - header->code);
+ mono_bitset_set_fast (seq_point_set_locs, td->ip - header->code);
}
if (sym_seq_points)
- bb_exit = td.offset_to_bb [td.ip - header->code];
+ bb_exit = td->offset_to_bb [td->ip - header->code];
- switch (*td.ip) {
+ switch (*td->ip) {
case CEE_NOP:
/* lose it */
- ++td.ip;
+ ++td->ip;
break;
case CEE_BREAK:
SIMPLE_OP(td, MINT_BREAK);
case CEE_LDARG_1:
case CEE_LDARG_2:
case CEE_LDARG_3:
- load_arg (&td, *td.ip - CEE_LDARG_0);
- ++td.ip;
+ load_arg (td, *td->ip - CEE_LDARG_0);
+ ++td->ip;
break;
case CEE_LDLOC_0:
case CEE_LDLOC_1:
case CEE_LDLOC_2:
case CEE_LDLOC_3:
- load_local (&td, *td.ip - CEE_LDLOC_0);
- ++td.ip;
+ load_local (td, *td->ip - CEE_LDLOC_0);
+ ++td->ip;
break;
case CEE_STLOC_0:
case CEE_STLOC_1:
case CEE_STLOC_2:
case CEE_STLOC_3:
- store_local (&td, *td.ip - CEE_STLOC_0);
- ++td.ip;
+ store_local (td, *td->ip - CEE_STLOC_0);
+ ++td->ip;
break;
case CEE_LDARG_S:
- load_arg (&td, ((guint8 *)td.ip)[1]);
- td.ip += 2;
+ load_arg (td, ((guint8 *)td->ip)[1]);
+ td->ip += 2;
break;
case CEE_LDARGA_S: {
/* NOTE: n includes this */
- int n = ((guint8 *) td.ip) [1];
- ADD_CODE (&td, MINT_LDARGA);
- ADD_CODE (&td, td.rtm->arg_offsets [n]);
- PUSH_SIMPLE_TYPE(&td, STACK_TYPE_MP);
- td.ip += 2;
+ int n = ((guint8 *) td->ip) [1];
+ ADD_CODE (td, MINT_LDARGA);
+ ADD_CODE (td, td->rtm->arg_offsets [n]);
+ PUSH_SIMPLE_TYPE(td, STACK_TYPE_MP);
+ td->ip += 2;
break;
}
case CEE_STARG_S:
- store_arg (&td, ((guint8 *)td.ip)[1]);
- td.ip += 2;
+ store_arg (td, ((guint8 *)td->ip)[1]);
+ td->ip += 2;
break;
case CEE_LDLOC_S:
- load_local (&td, ((guint8 *)td.ip)[1]);
- td.ip += 2;
+ load_local (td, ((guint8 *)td->ip)[1]);
+ td->ip += 2;
break;
case CEE_LDLOCA_S:
- ADD_CODE(&td, MINT_LDLOCA_S);
- ADD_CODE(&td, td.rtm->local_offsets [((guint8 *)td.ip)[1]]);
- PUSH_SIMPLE_TYPE(&td, STACK_TYPE_MP);
- td.ip += 2;
+ ADD_CODE(td, MINT_LDLOCA_S);
+ ADD_CODE(td, td->rtm->local_offsets [((guint8 *)td->ip)[1]]);
+ PUSH_SIMPLE_TYPE(td, STACK_TYPE_MP);
+ td->ip += 2;
break;
case CEE_STLOC_S:
- store_local (&td, ((guint8 *)td.ip)[1]);
- td.ip += 2;
+ store_local (td, ((guint8 *)td->ip)[1]);
+ td->ip += 2;
break;
case CEE_LDNULL:
SIMPLE_OP(td, MINT_LDNULL);
- PUSH_TYPE(&td, STACK_TYPE_O, NULL);
+ PUSH_TYPE(td, STACK_TYPE_O, NULL);
break;
case CEE_LDC_I4_M1:
SIMPLE_OP(td, MINT_LDC_I4_M1);
- PUSH_SIMPLE_TYPE(&td, STACK_TYPE_I4);
+ PUSH_SIMPLE_TYPE(td, STACK_TYPE_I4);
break;
case CEE_LDC_I4_0:
- if (!td.is_bb_start[td.ip + 1 - td.il_code] && td.ip [1] == 0xfe && td.ip [2] == CEE_CEQ &&
- td.sp > td.stack && td.sp [-1].type == STACK_TYPE_I4) {
+ if (!td->is_bb_start[td->ip + 1 - td->il_code] && td->ip [1] == 0xfe && td->ip [2] == CEE_CEQ &&
+ td->sp > td->stack && td->sp [-1].type == STACK_TYPE_I4) {
SIMPLE_OP(td, MINT_CEQ0_I4);
- td.ip += 2;
+ td->ip += 2;
} else {
SIMPLE_OP(td, MINT_LDC_I4_0);
- PUSH_SIMPLE_TYPE(&td, STACK_TYPE_I4);
+ PUSH_SIMPLE_TYPE(td, STACK_TYPE_I4);
}
break;
case CEE_LDC_I4_1:
- if (!td.is_bb_start[td.ip + 1 - td.il_code] &&
- (td.ip [1] == CEE_ADD || td.ip [1] == CEE_SUB) && td.sp [-1].type == STACK_TYPE_I4) {
- ADD_CODE(&td, td.ip [1] == CEE_ADD ? MINT_ADD1_I4 : MINT_SUB1_I4);
- td.ip += 2;
+ if (!td->is_bb_start[td->ip + 1 - td->il_code] &&
+ (td->ip [1] == CEE_ADD || td->ip [1] == CEE_SUB) && td->sp [-1].type == STACK_TYPE_I4) {
+ ADD_CODE(td, td->ip [1] == CEE_ADD ? MINT_ADD1_I4 : MINT_SUB1_I4);
+ td->ip += 2;
} else {
SIMPLE_OP(td, MINT_LDC_I4_1);
- PUSH_SIMPLE_TYPE(&td, STACK_TYPE_I4);
+ PUSH_SIMPLE_TYPE(td, STACK_TYPE_I4);
}
break;
case CEE_LDC_I4_2:
case CEE_LDC_I4_6:
case CEE_LDC_I4_7:
case CEE_LDC_I4_8:
- SIMPLE_OP(td, (*td.ip - CEE_LDC_I4_0) + MINT_LDC_I4_0);
- PUSH_SIMPLE_TYPE(&td, STACK_TYPE_I4);
+ SIMPLE_OP(td, (*td->ip - CEE_LDC_I4_0) + MINT_LDC_I4_0);
+ PUSH_SIMPLE_TYPE(td, STACK_TYPE_I4);
break;
case CEE_LDC_I4_S:
- ADD_CODE(&td, MINT_LDC_I4_S);
- ADD_CODE(&td, ((gint8 *) td.ip) [1]);
- td.ip += 2;
- PUSH_SIMPLE_TYPE(&td, STACK_TYPE_I4);
+ ADD_CODE(td, MINT_LDC_I4_S);
+ ADD_CODE(td, ((gint8 *) td->ip) [1]);
+ td->ip += 2;
+ PUSH_SIMPLE_TYPE(td, STACK_TYPE_I4);
break;
case CEE_LDC_I4:
- i32 = read32 (td.ip + 1);
- ADD_CODE(&td, MINT_LDC_I4);
- WRITE32(&td, &i32);
- td.ip += 5;
- PUSH_SIMPLE_TYPE(&td, STACK_TYPE_I4);
+ i32 = read32 (td->ip + 1);
+ ADD_CODE(td, MINT_LDC_I4);
+ WRITE32(td, &i32);
+ td->ip += 5;
+ PUSH_SIMPLE_TYPE(td, STACK_TYPE_I4);
break;
case CEE_LDC_I8: {
- gint64 val = read64 (td.ip + 1);
- ADD_CODE(&td, MINT_LDC_I8);
- WRITE64(&td, &val);
- td.ip += 9;
- PUSH_SIMPLE_TYPE(&td, STACK_TYPE_I8);
+ gint64 val = read64 (td->ip + 1);
+ ADD_CODE(td, MINT_LDC_I8);
+ WRITE64(td, &val);
+ td->ip += 9;
+ PUSH_SIMPLE_TYPE(td, STACK_TYPE_I8);
break;
}
case CEE_LDC_R4: {
float val;
- readr4 (td.ip + 1, &val);
- ADD_CODE(&td, MINT_LDC_R4);
- WRITE32(&td, &val);
- td.ip += 5;
- PUSH_SIMPLE_TYPE(&td, STACK_TYPE_R8);
+ readr4 (td->ip + 1, &val);
+ ADD_CODE(td, MINT_LDC_R4);
+ WRITE32(td, &val);
+ td->ip += 5;
+ PUSH_SIMPLE_TYPE(td, STACK_TYPE_R8);
break;
}
case CEE_LDC_R8: {
double val;
- readr8 (td.ip + 1, &val);
- ADD_CODE(&td, MINT_LDC_R8);
- WRITE64(&td, &val);
- td.ip += 9;
- PUSH_SIMPLE_TYPE(&td, STACK_TYPE_R8);
+ readr8 (td->ip + 1, &val);
+ ADD_CODE(td, MINT_LDC_R8);
+ WRITE64(td, &val);
+ td->ip += 9;
+ PUSH_SIMPLE_TYPE(td, STACK_TYPE_R8);
break;
}
case CEE_DUP: {
- int type = td.sp [-1].type;
- MonoClass *klass = td.sp [-1].klass;
- if (td.sp [-1].type == STACK_TYPE_VT) {
+ int type = td->sp [-1].type;
+ MonoClass *klass = td->sp [-1].klass;
+ if (td->sp [-1].type == STACK_TYPE_VT) {
gint32 size = mono_class_value_size (klass, NULL);
- PUSH_VT(&td, size);
- ADD_CODE(&td, MINT_DUP_VT);
- WRITE32(&td, &size);
- td.ip ++;
+ PUSH_VT(td, size);
+ ADD_CODE(td, MINT_DUP_VT);
+ WRITE32(td, &size);
+ td->ip ++;
} else
SIMPLE_OP(td, MINT_DUP);
- PUSH_TYPE(&td, type, klass);
+ PUSH_TYPE(td, type, klass);
break;
}
case CEE_POP:
- CHECK_STACK(&td, 1);
+ CHECK_STACK(td, 1);
SIMPLE_OP(td, MINT_POP);
- ADD_CODE (&td, 0);
- if (td.sp [-1].type == STACK_TYPE_VT) {
- int size = mono_class_value_size (td.sp [-1].klass, NULL);
+ ADD_CODE (td, 0);
+ if (td->sp [-1].type == STACK_TYPE_VT) {
+ int size = mono_class_value_size (td->sp [-1].klass, NULL);
size = (size + 7) & ~7;
- ADD_CODE(&td, MINT_VTRESULT);
- ADD_CODE(&td, 0);
- WRITE32(&td, &size);
- td.vt_sp -= size;
+ ADD_CODE(td, MINT_VTRESULT);
+ ADD_CODE(td, 0);
+ WRITE32(td, &size);
+ td->vt_sp -= size;
}
- --td.sp;
+ --td->sp;
break;
case CEE_JMP: {
MonoMethod *m;
- if (td.sp > td.stack)
+ if (td->sp > td->stack)
g_warning ("CEE_JMP: stack must be empty");
- token = read32 (td.ip + 1);
+ token = read32 (td->ip + 1);
m = mono_get_method_full (image, token, NULL, generic_context);
- ADD_CODE (&td, MINT_JMP);
- ADD_CODE (&td, get_data_item_index (&td, mono_interp_get_runtime_method (domain, m, &error)));
+ ADD_CODE (td, MINT_JMP);
+ ADD_CODE (td, get_data_item_index (td, mono_interp_get_imethod (domain, m, &error)));
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
- td.ip += 5;
+ td->ip += 5;
break;
}
case CEE_CALLVIRT: /* Fall through */
case CEE_CALL: {
gboolean need_seq_point = FALSE;
- if (sym_seq_points && !mono_bitset_test_fast (seq_point_locs, td.ip + 5 - header->code))
+ if (sym_seq_points && !mono_bitset_test_fast (seq_point_locs, td->ip + 5 - header->code))
need_seq_point = TRUE;
- interp_transform_call (&td, method, NULL, domain, generic_context, is_bb_start, body_start_offset, constrained_class, readonly);
+ interp_transform_call (td, method, NULL, domain, generic_context, is_bb_start, body_start_offset, constrained_class, readonly);
if (need_seq_point) {
- InterpBasicBlock *cbb = td.offset_to_bb [td.ip - header->code];
+ InterpBasicBlock *cbb = td->offset_to_bb [td->ip - header->code];
g_assert (cbb);
- emit_seq_point (&td, td.ip - header->code, cbb, TRUE);
+ emit_seq_point (td, td->ip - header->code, cbb, TRUE);
}
constrained_class = NULL;
case CEE_RET: {
int vt_size = 0;
if (signature->ret->type != MONO_TYPE_VOID) {
- --td.sp;
+ --td->sp;
MonoClass *klass = mono_class_from_mono_type (signature->ret);
if (mint_type (&klass->byval_arg) == MINT_TYPE_VT) {
vt_size = mono_class_value_size (klass, NULL);
vt_size = (vt_size + 7) & ~7;
}
}
- if (td.sp > td.stack)
- g_warning ("%s.%s: CEE_RET: more values on stack: %d", td.method->klass->name, td.method->name, td.sp - td.stack);
- if (td.vt_sp != vt_size)
- g_error ("%s.%s: CEE_RET: value type stack: %d vs. %d", td.method->klass->name, td.method->name, td.vt_sp, vt_size);
+ if (td->sp > td->stack)
+ g_warning ("%s.%s: CEE_RET: more values on stack: %d", td->method->klass->name, td->method->name, td->sp - td->stack);
+ if (td->vt_sp != vt_size)
+ g_error ("%s.%s: CEE_RET: value type stack: %d vs. %d", td->method->klass->name, td->method->name, td->vt_sp, vt_size);
if (sym_seq_points) {
- InterpBasicBlock *cbb = td.offset_to_bb [td.ip - header->code];
+ InterpBasicBlock *cbb = td->offset_to_bb [td->ip - header->code];
g_assert (cbb);
- emit_seq_point (&td, METHOD_EXIT_IL_OFFSET, bb_exit, FALSE);
+ emit_seq_point (td, METHOD_EXIT_IL_OFFSET, bb_exit, FALSE);
}
if (vt_size == 0)
SIMPLE_OP(td, signature->ret->type == MONO_TYPE_VOID ? MINT_RET_VOID : MINT_RET);
else {
- ADD_CODE(&td, MINT_RET_VT);
- WRITE32(&td, &vt_size);
- ++td.ip;
+ ADD_CODE(td, MINT_RET_VT);
+ WRITE32(td, &vt_size);
+ ++td->ip;
}
generating_code = 0;
break;
}
case CEE_BR:
- handle_branch (&td, MINT_BR_S, MINT_BR, 5 + read32 (td.ip + 1));
- td.ip += 5;
+ handle_branch (td, MINT_BR_S, MINT_BR, 5 + read32 (td->ip + 1));
+ td->ip += 5;
generating_code = 0;
break;
case CEE_BR_S:
- handle_branch (&td, MINT_BR_S, MINT_BR, 2 + (gint8)td.ip [1]);
- td.ip += 2;
+ handle_branch (td, MINT_BR_S, MINT_BR, 2 + (gint8)td->ip [1]);
+ td->ip += 2;
generating_code = 0;
break;
case CEE_BRFALSE:
- one_arg_branch (&td, MINT_BRFALSE_I4, 5 + read32 (td.ip + 1));
- td.ip += 5;
+ one_arg_branch (td, MINT_BRFALSE_I4, 5 + read32 (td->ip + 1));
+ td->ip += 5;
break;
case CEE_BRFALSE_S:
- one_arg_branch (&td, MINT_BRFALSE_I4, 2 + (gint8)td.ip [1]);
- td.ip += 2;
+ one_arg_branch (td, MINT_BRFALSE_I4, 2 + (gint8)td->ip [1]);
+ td->ip += 2;
break;
case CEE_BRTRUE:
- one_arg_branch (&td, MINT_BRTRUE_I4, 5 + read32 (td.ip + 1));
- td.ip += 5;
+ one_arg_branch (td, MINT_BRTRUE_I4, 5 + read32 (td->ip + 1));
+ td->ip += 5;
break;
case CEE_BRTRUE_S:
- one_arg_branch (&td, MINT_BRTRUE_I4, 2 + (gint8)td.ip [1]);
- td.ip += 2;
+ one_arg_branch (td, MINT_BRTRUE_I4, 2 + (gint8)td->ip [1]);
+ td->ip += 2;
break;
case CEE_BEQ:
- two_arg_branch (&td, MINT_BEQ_I4, 5 + read32 (td.ip + 1));
- td.ip += 5;
+ two_arg_branch (td, MINT_BEQ_I4, 5 + read32 (td->ip + 1));
+ td->ip += 5;
break;
case CEE_BEQ_S:
- two_arg_branch (&td, MINT_BEQ_I4, 2 + (gint8) td.ip [1]);
- td.ip += 2;
+ two_arg_branch (td, MINT_BEQ_I4, 2 + (gint8) td->ip [1]);
+ td->ip += 2;
break;
case CEE_BGE:
- two_arg_branch (&td, MINT_BGE_I4, 5 + read32 (td.ip + 1));
- td.ip += 5;
+ two_arg_branch (td, MINT_BGE_I4, 5 + read32 (td->ip + 1));
+ td->ip += 5;
break;
case CEE_BGE_S:
- two_arg_branch (&td, MINT_BGE_I4, 2 + (gint8) td.ip [1]);
- td.ip += 2;
+ two_arg_branch (td, MINT_BGE_I4, 2 + (gint8) td->ip [1]);
+ td->ip += 2;
break;
case CEE_BGT:
- two_arg_branch (&td, MINT_BGT_I4, 5 + read32 (td.ip + 1));
- td.ip += 5;
+ two_arg_branch (td, MINT_BGT_I4, 5 + read32 (td->ip + 1));
+ td->ip += 5;
break;
case CEE_BGT_S:
- two_arg_branch (&td, MINT_BGT_I4, 2 + (gint8) td.ip [1]);
- td.ip += 2;
+ two_arg_branch (td, MINT_BGT_I4, 2 + (gint8) td->ip [1]);
+ td->ip += 2;
break;
case CEE_BLT:
- two_arg_branch (&td, MINT_BLT_I4, 5 + read32 (td.ip + 1));
- td.ip += 5;
+ two_arg_branch (td, MINT_BLT_I4, 5 + read32 (td->ip + 1));
+ td->ip += 5;
break;
case CEE_BLT_S:
- two_arg_branch (&td, MINT_BLT_I4, 2 + (gint8) td.ip [1]);
- td.ip += 2;
+ two_arg_branch (td, MINT_BLT_I4, 2 + (gint8) td->ip [1]);
+ td->ip += 2;
break;
case CEE_BLE:
- two_arg_branch (&td, MINT_BLE_I4, 5 + read32 (td.ip + 1));
- td.ip += 5;
+ two_arg_branch (td, MINT_BLE_I4, 5 + read32 (td->ip + 1));
+ td->ip += 5;
break;
case CEE_BLE_S:
- two_arg_branch (&td, MINT_BLE_I4, 2 + (gint8) td.ip [1]);
- td.ip += 2;
+ two_arg_branch (td, MINT_BLE_I4, 2 + (gint8) td->ip [1]);
+ td->ip += 2;
break;
case CEE_BNE_UN:
- two_arg_branch (&td, MINT_BNE_UN_I4, 5 + read32 (td.ip + 1));
- td.ip += 5;
+ two_arg_branch (td, MINT_BNE_UN_I4, 5 + read32 (td->ip + 1));
+ td->ip += 5;
break;
case CEE_BNE_UN_S:
- two_arg_branch (&td, MINT_BNE_UN_I4, 2 + (gint8) td.ip [1]);
- td.ip += 2;
+ two_arg_branch (td, MINT_BNE_UN_I4, 2 + (gint8) td->ip [1]);
+ td->ip += 2;
break;
case CEE_BGE_UN:
- two_arg_branch (&td, MINT_BGE_UN_I4, 5 + read32 (td.ip + 1));
- td.ip += 5;
+ two_arg_branch (td, MINT_BGE_UN_I4, 5 + read32 (td->ip + 1));
+ td->ip += 5;
break;
case CEE_BGE_UN_S:
- two_arg_branch (&td, MINT_BGE_UN_I4, 2 + (gint8) td.ip [1]);
- td.ip += 2;
+ two_arg_branch (td, MINT_BGE_UN_I4, 2 + (gint8) td->ip [1]);
+ td->ip += 2;
break;
case CEE_BGT_UN:
- two_arg_branch (&td, MINT_BGT_UN_I4, 5 + read32 (td.ip + 1));
- td.ip += 5;
+ two_arg_branch (td, MINT_BGT_UN_I4, 5 + read32 (td->ip + 1));
+ td->ip += 5;
break;
case CEE_BGT_UN_S:
- two_arg_branch (&td, MINT_BGT_UN_I4, 2 + (gint8) td.ip [1]);
- td.ip += 2;
+ two_arg_branch (td, MINT_BGT_UN_I4, 2 + (gint8) td->ip [1]);
+ td->ip += 2;
break;
case CEE_BLE_UN:
- two_arg_branch (&td, MINT_BLE_UN_I4, 5 + read32 (td.ip + 1));
- td.ip += 5;
+ two_arg_branch (td, MINT_BLE_UN_I4, 5 + read32 (td->ip + 1));
+ td->ip += 5;
break;
case CEE_BLE_UN_S:
- two_arg_branch (&td, MINT_BLE_UN_I4, 2 + (gint8) td.ip [1]);
- td.ip += 2;
+ two_arg_branch (td, MINT_BLE_UN_I4, 2 + (gint8) td->ip [1]);
+ td->ip += 2;
break;
case CEE_BLT_UN:
- two_arg_branch (&td, MINT_BLT_UN_I4, 5 + read32 (td.ip + 1));
- td.ip += 5;
+ two_arg_branch (td, MINT_BLT_UN_I4, 5 + read32 (td->ip + 1));
+ td->ip += 5;
break;
case CEE_BLT_UN_S:
- two_arg_branch (&td, MINT_BLT_UN_I4, 2 + (gint8) td.ip [1]);
- td.ip += 2;
+ two_arg_branch (td, MINT_BLT_UN_I4, 2 + (gint8) td->ip [1]);
+ td->ip += 2;
break;
case CEE_SWITCH: {
guint32 n;
const unsigned char *next_ip;
- ++td.ip;
- n = read32 (td.ip);
- ADD_CODE (&td, MINT_SWITCH);
- WRITE32 (&td, &n);
- td.ip += 4;
- next_ip = td.ip + n * 4;
- --td.sp;
- int stack_height = td.sp - td.stack;
+ ++td->ip;
+ n = read32 (td->ip);
+ ADD_CODE (td, MINT_SWITCH);
+ WRITE32 (td, &n);
+ td->ip += 4;
+ next_ip = td->ip + n * 4;
+ --td->sp;
+ int stack_height = td->sp - td->stack;
for (i = 0; i < n; i++) {
- offset = read32 (td.ip);
- target = next_ip - td.il_code + offset;
+ offset = read32 (td->ip);
+ target = next_ip - td->il_code + offset;
if (offset < 0) {
#if DEBUG_INTERP
- if (stack_height > 0 && stack_height != td.stack_height [target])
+ if (stack_height > 0 && stack_height != td->stack_height [target])
g_warning ("SWITCH with back branch and non-empty stack");
#endif
- target = td.in_offsets [target] - (td.new_ip - td.new_code);
+ target = td->in_offsets [target] - (td->new_ip - td->new_code);
} else {
- td.stack_height [target] = stack_height;
- td.vt_stack_size [target] = td.vt_sp;
+ td->stack_height [target] = stack_height;
+ td->vt_stack_size [target] = td->vt_sp;
if (stack_height > 0)
- td.stack_state [target] = g_memdup (td.stack, stack_height * sizeof (td.stack [0]));
+ td->stack_state [target] = g_memdup (td->stack, stack_height * sizeof (td->stack [0]));
- Reloc *reloc = mono_mempool_alloc0 (td.mempool, sizeof (Reloc));
+ Reloc *reloc = mono_mempool_alloc0 (td->mempool, sizeof (Reloc));
reloc->type = RELOC_SWITCH;
- reloc->offset = td.new_ip - td.new_code;
+ reloc->offset = td->new_ip - td->new_code;
reloc->target = target;
- g_ptr_array_add (td.relocs, reloc);
+ g_ptr_array_add (td->relocs, reloc);
target = 0xffff;
}
- WRITE32 (&td, &target);
- td.ip += 4;
+ WRITE32 (td, &target);
+ td->ip += 4;
}
break;
}
case CEE_LDIND_I1:
- CHECK_STACK (&td, 1);
+ CHECK_STACK (td, 1);
SIMPLE_OP (td, MINT_LDIND_I1);
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
BARRIER_IF_VOLATILE (td);
break;
case CEE_LDIND_U1:
- CHECK_STACK (&td, 1);
+ CHECK_STACK (td, 1);
SIMPLE_OP (td, MINT_LDIND_U1);
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
BARRIER_IF_VOLATILE (td);
break;
case CEE_LDIND_I2:
- CHECK_STACK (&td, 1);
+ CHECK_STACK (td, 1);
SIMPLE_OP (td, MINT_LDIND_I2);
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
BARRIER_IF_VOLATILE (td);
break;
case CEE_LDIND_U2:
- CHECK_STACK (&td, 1);
+ CHECK_STACK (td, 1);
SIMPLE_OP (td, MINT_LDIND_U2);
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
BARRIER_IF_VOLATILE (td);
break;
case CEE_LDIND_I4:
- CHECK_STACK (&td, 1);
+ CHECK_STACK (td, 1);
SIMPLE_OP (td, MINT_LDIND_I4);
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
BARRIER_IF_VOLATILE (td);
break;
case CEE_LDIND_U4:
- CHECK_STACK (&td, 1);
+ CHECK_STACK (td, 1);
SIMPLE_OP (td, MINT_LDIND_U4);
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
BARRIER_IF_VOLATILE (td);
break;
case CEE_LDIND_I8:
- CHECK_STACK (&td, 1);
+ CHECK_STACK (td, 1);
SIMPLE_OP (td, MINT_LDIND_I8);
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I8);
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I8);
BARRIER_IF_VOLATILE (td);
break;
case CEE_LDIND_I:
- CHECK_STACK (&td, 1);
+ CHECK_STACK (td, 1);
SIMPLE_OP (td, MINT_LDIND_I);
- ADD_CODE (&td, 0);
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I);
+ ADD_CODE (td, 0);
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I);
BARRIER_IF_VOLATILE (td);
break;
case CEE_LDIND_R4:
- CHECK_STACK (&td, 1);
+ CHECK_STACK (td, 1);
SIMPLE_OP (td, MINT_LDIND_R4);
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_R8);
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_R8);
BARRIER_IF_VOLATILE (td);
break;
case CEE_LDIND_R8:
- CHECK_STACK (&td, 1);
+ CHECK_STACK (td, 1);
SIMPLE_OP (td, MINT_LDIND_R8);
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_R8);
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_R8);
BARRIER_IF_VOLATILE (td);
break;
case CEE_LDIND_REF:
- CHECK_STACK (&td, 1);
+ CHECK_STACK (td, 1);
SIMPLE_OP (td, MINT_LDIND_REF);
BARRIER_IF_VOLATILE (td);
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_O);
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_O);
break;
case CEE_STIND_REF:
- CHECK_STACK (&td, 2);
+ CHECK_STACK (td, 2);
BARRIER_IF_VOLATILE (td);
SIMPLE_OP (td, MINT_STIND_REF);
- td.sp -= 2;
+ td->sp -= 2;
break;
case CEE_STIND_I1:
- CHECK_STACK (&td, 2);
+ CHECK_STACK (td, 2);
BARRIER_IF_VOLATILE (td);
SIMPLE_OP (td, MINT_STIND_I1);
- td.sp -= 2;
+ td->sp -= 2;
break;
case CEE_STIND_I2:
- CHECK_STACK (&td, 2);
+ CHECK_STACK (td, 2);
BARRIER_IF_VOLATILE (td);
SIMPLE_OP (td, MINT_STIND_I2);
- td.sp -= 2;
+ td->sp -= 2;
break;
case CEE_STIND_I4:
- CHECK_STACK (&td, 2);
+ CHECK_STACK (td, 2);
BARRIER_IF_VOLATILE (td);
SIMPLE_OP (td, MINT_STIND_I4);
- td.sp -= 2;
+ td->sp -= 2;
break;
case CEE_STIND_I:
- CHECK_STACK (&td, 2);
+ CHECK_STACK (td, 2);
BARRIER_IF_VOLATILE (td);
SIMPLE_OP (td, MINT_STIND_I);
- td.sp -= 2;
+ td->sp -= 2;
break;
case CEE_STIND_I8:
- CHECK_STACK (&td, 2);
+ CHECK_STACK (td, 2);
BARRIER_IF_VOLATILE (td);
SIMPLE_OP (td, MINT_STIND_I8);
- td.sp -= 2;
+ td->sp -= 2;
break;
case CEE_STIND_R4:
- CHECK_STACK (&td, 2);
+ CHECK_STACK (td, 2);
BARRIER_IF_VOLATILE (td);
SIMPLE_OP (td, MINT_STIND_R4);
- td.sp -= 2;
+ td->sp -= 2;
break;
case CEE_STIND_R8:
- CHECK_STACK (&td, 2);
+ CHECK_STACK (td, 2);
BARRIER_IF_VOLATILE (td);
SIMPLE_OP (td, MINT_STIND_R8);
- td.sp -= 2;
+ td->sp -= 2;
break;
case CEE_ADD:
- binary_arith_op(&td, MINT_ADD_I4);
- ++td.ip;
+ binary_arith_op(td, MINT_ADD_I4);
+ ++td->ip;
break;
case CEE_SUB:
- binary_arith_op(&td, MINT_SUB_I4);
- ++td.ip;
+ binary_arith_op(td, MINT_SUB_I4);
+ ++td->ip;
break;
case CEE_MUL:
- binary_arith_op(&td, MINT_MUL_I4);
- ++td.ip;
+ binary_arith_op(td, MINT_MUL_I4);
+ ++td->ip;
break;
case CEE_DIV:
- binary_arith_op(&td, MINT_DIV_I4);
- ++td.ip;
+ binary_arith_op(td, MINT_DIV_I4);
+ ++td->ip;
break;
case CEE_DIV_UN:
- binary_arith_op(&td, MINT_DIV_UN_I4);
- ++td.ip;
+ binary_arith_op(td, MINT_DIV_UN_I4);
+ ++td->ip;
break;
case CEE_REM:
- binary_arith_op (&td, MINT_REM_I4);
- ++td.ip;
+ binary_arith_op (td, MINT_REM_I4);
+ ++td->ip;
break;
case CEE_REM_UN:
- binary_arith_op (&td, MINT_REM_UN_I4);
- ++td.ip;
+ binary_arith_op (td, MINT_REM_UN_I4);
+ ++td->ip;
break;
case CEE_AND:
- binary_arith_op (&td, MINT_AND_I4);
- ++td.ip;
+ binary_arith_op (td, MINT_AND_I4);
+ ++td->ip;
break;
case CEE_OR:
- binary_arith_op (&td, MINT_OR_I4);
- ++td.ip;
+ binary_arith_op (td, MINT_OR_I4);
+ ++td->ip;
break;
case CEE_XOR:
- binary_arith_op (&td, MINT_XOR_I4);
- ++td.ip;
+ binary_arith_op (td, MINT_XOR_I4);
+ ++td->ip;
break;
case CEE_SHL:
- shift_op (&td, MINT_SHL_I4);
- ++td.ip;
+ shift_op (td, MINT_SHL_I4);
+ ++td->ip;
break;
case CEE_SHR:
- shift_op (&td, MINT_SHR_I4);
- ++td.ip;
+ shift_op (td, MINT_SHR_I4);
+ ++td->ip;
break;
case CEE_SHR_UN:
- shift_op (&td, MINT_SHR_UN_I4);
- ++td.ip;
+ shift_op (td, MINT_SHR_UN_I4);
+ ++td->ip;
break;
case CEE_NEG:
- unary_arith_op (&td, MINT_NEG_I4);
- ++td.ip;
+ unary_arith_op (td, MINT_NEG_I4);
+ ++td->ip;
break;
case CEE_NOT:
- unary_arith_op (&td, MINT_NOT_I4);
- ++td.ip;
+ unary_arith_op (td, MINT_NOT_I4);
+ ++td->ip;
break;
case CEE_CONV_U1:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
- ADD_CODE(&td, MINT_CONV_U1_R8);
+ ADD_CODE(td, MINT_CONV_U1_R8);
break;
case STACK_TYPE_I4:
- ADD_CODE(&td, MINT_CONV_U1_I4);
+ ADD_CODE(td, MINT_CONV_U1_I4);
break;
case STACK_TYPE_I8:
- ADD_CODE(&td, MINT_CONV_U1_I8);
+ ADD_CODE(td, MINT_CONV_U1_I8);
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case CEE_CONV_I1:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
- ADD_CODE(&td, MINT_CONV_I1_R8);
+ ADD_CODE(td, MINT_CONV_I1_R8);
break;
case STACK_TYPE_I4:
- ADD_CODE(&td, MINT_CONV_I1_I4);
+ ADD_CODE(td, MINT_CONV_I1_I4);
break;
case STACK_TYPE_I8:
- ADD_CODE(&td, MINT_CONV_I1_I8);
+ ADD_CODE(td, MINT_CONV_I1_I8);
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case CEE_CONV_U2:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
- ADD_CODE(&td, MINT_CONV_U2_R8);
+ ADD_CODE(td, MINT_CONV_U2_R8);
break;
case STACK_TYPE_I4:
- ADD_CODE(&td, MINT_CONV_U2_I4);
+ ADD_CODE(td, MINT_CONV_U2_I4);
break;
case STACK_TYPE_I8:
- ADD_CODE(&td, MINT_CONV_U2_I8);
+ ADD_CODE(td, MINT_CONV_U2_I8);
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case CEE_CONV_I2:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
- ADD_CODE(&td, MINT_CONV_I2_R8);
+ ADD_CODE(td, MINT_CONV_I2_R8);
break;
case STACK_TYPE_I4:
- ADD_CODE(&td, MINT_CONV_I2_I4);
+ ADD_CODE(td, MINT_CONV_I2_I4);
break;
case STACK_TYPE_I8:
- ADD_CODE(&td, MINT_CONV_I2_I8);
+ ADD_CODE(td, MINT_CONV_I2_I8);
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case CEE_CONV_U:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
#if SIZEOF_VOID_P == 4
- ADD_CODE(&td, MINT_CONV_U4_R8);
+ ADD_CODE(td, MINT_CONV_U4_R8);
#else
- ADD_CODE(&td, MINT_CONV_U8_R8);
+ ADD_CODE(td, MINT_CONV_U8_R8);
#endif
break;
case STACK_TYPE_I4:
#if SIZEOF_VOID_P == 8
- ADD_CODE(&td, MINT_CONV_U8_I4);
+ ADD_CODE(td, MINT_CONV_U8_I4);
#endif
break;
case STACK_TYPE_I8:
#if SIZEOF_VOID_P == 4
- ADD_CODE(&td, MINT_CONV_U4_I8);
+ ADD_CODE(td, MINT_CONV_U4_I8);
#endif
break;
case STACK_TYPE_MP:
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I);
break;
case CEE_CONV_I:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
#if SIZEOF_VOID_P == 8
- ADD_CODE(&td, MINT_CONV_I8_R8);
+ ADD_CODE(td, MINT_CONV_I8_R8);
#else
- ADD_CODE(&td, MINT_CONV_I4_R8);
+ ADD_CODE(td, MINT_CONV_I4_R8);
#endif
break;
case STACK_TYPE_I4:
#if SIZEOF_VOID_P == 8
- ADD_CODE(&td, MINT_CONV_I8_I4);
+ ADD_CODE(td, MINT_CONV_I8_I4);
#endif
break;
case STACK_TYPE_O:
break;
case STACK_TYPE_I8:
#if SIZEOF_VOID_P == 4
- ADD_CODE(&td, MINT_CONV_I4_I8);
+ ADD_CODE(td, MINT_CONV_I4_I8);
#endif
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I);
break;
case CEE_CONV_U4:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
- ADD_CODE(&td, MINT_CONV_U4_R8);
+ ADD_CODE(td, MINT_CONV_U4_R8);
break;
case STACK_TYPE_I4:
break;
case STACK_TYPE_I8:
- ADD_CODE(&td, MINT_CONV_U4_I8);
+ ADD_CODE(td, MINT_CONV_U4_I8);
break;
case STACK_TYPE_MP:
#if SIZEOF_VOID_P == 8
- ADD_CODE(&td, MINT_CONV_U4_I8);
+ ADD_CODE(td, MINT_CONV_U4_I8);
#endif
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case CEE_CONV_I4:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
- ADD_CODE(&td, MINT_CONV_I4_R8);
+ ADD_CODE(td, MINT_CONV_I4_R8);
break;
case STACK_TYPE_I4:
break;
case STACK_TYPE_I8:
- ADD_CODE(&td, MINT_CONV_I4_I8);
+ ADD_CODE(td, MINT_CONV_I4_I8);
break;
case STACK_TYPE_MP:
#if SIZEOF_VOID_P == 8
- ADD_CODE(&td, MINT_CONV_I4_I8);
+ ADD_CODE(td, MINT_CONV_I4_I8);
#endif
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case CEE_CONV_I8:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
- ADD_CODE(&td, MINT_CONV_I8_R8);
+ ADD_CODE(td, MINT_CONV_I8_R8);
break;
case STACK_TYPE_I4:
- ADD_CODE(&td, MINT_CONV_I8_I4);
+ ADD_CODE(td, MINT_CONV_I8_I4);
break;
case STACK_TYPE_I8:
break;
case STACK_TYPE_MP:
#if SIZEOF_VOID_P == 4
- ADD_CODE(&td, MINT_CONV_I8_I4);
+ ADD_CODE(td, MINT_CONV_I8_I4);
#endif
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I8);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I8);
break;
case CEE_CONV_R4:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
- ADD_CODE(&td, MINT_CONV_R4_R8);
+ ADD_CODE(td, MINT_CONV_R4_R8);
break;
case STACK_TYPE_I8:
- ADD_CODE(&td, MINT_CONV_R4_I8);
+ ADD_CODE(td, MINT_CONV_R4_I8);
break;
case STACK_TYPE_I4:
- ADD_CODE(&td, MINT_CONV_R4_I4);
+ ADD_CODE(td, MINT_CONV_R4_I4);
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_R8);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_R8);
break;
case CEE_CONV_R8:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_I4:
- ADD_CODE(&td, MINT_CONV_R8_I4);
+ ADD_CODE(td, MINT_CONV_R8_I4);
break;
case STACK_TYPE_I8:
- ADD_CODE(&td, MINT_CONV_R8_I8);
+ ADD_CODE(td, MINT_CONV_R8_I8);
break;
case STACK_TYPE_R8:
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_R8);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_R8);
break;
case CEE_CONV_U8:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_I4:
- ADD_CODE(&td, MINT_CONV_U8_I4);
+ ADD_CODE(td, MINT_CONV_U8_I4);
break;
case STACK_TYPE_I8:
break;
case STACK_TYPE_R8:
- ADD_CODE(&td, MINT_CONV_U8_R8);
+ ADD_CODE(td, MINT_CONV_U8_R8);
break;
case STACK_TYPE_MP:
#if SIZEOF_VOID_P == 4
- ADD_CODE(&td, MINT_CONV_U8_I4);
+ ADD_CODE(td, MINT_CONV_U8_I4);
#endif
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I8);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I8);
break;
case CEE_CPOBJ: {
- CHECK_STACK (&td, 2);
+ CHECK_STACK (td, 2);
- token = read32 (td.ip + 1);
+ token = read32 (td->ip + 1);
klass = mono_class_get_full (image, token, generic_context);
if (klass->valuetype) {
- ADD_CODE (&td, MINT_CPOBJ);
- ADD_CODE (&td, get_data_item_index(&td, klass));
+ ADD_CODE (td, MINT_CPOBJ);
+ ADD_CODE (td, get_data_item_index(td, klass));
} else {
- ADD_CODE (&td, MINT_LDIND_REF);
- ADD_CODE (&td, MINT_STIND_REF);
+ ADD_CODE (td, MINT_LDIND_REF);
+ ADD_CODE (td, MINT_STIND_REF);
}
- td.ip += 5;
- td.sp -= 2;
+ td->ip += 5;
+ td->sp -= 2;
break;
}
case CEE_LDOBJ: {
int size;
- CHECK_STACK (&td, 1);
+ CHECK_STACK (td, 1);
- token = read32 (td.ip + 1);
+ token = read32 (td->ip + 1);
if (method->wrapper_type != MONO_WRAPPER_NONE)
klass = (MonoClass *)mono_method_get_wrapper_data (method, token);
else
klass = mono_class_get_full (image, token, generic_context);
- ADD_CODE(&td, MINT_LDOBJ);
- ADD_CODE(&td, get_data_item_index(&td, klass));
+ ADD_CODE(td, MINT_LDOBJ);
+ ADD_CODE(td, get_data_item_index(td, klass));
if (mint_type (&klass->byval_arg) == MINT_TYPE_VT) {
size = mono_class_value_size (klass, NULL);
- PUSH_VT(&td, size);
+ PUSH_VT(td, size);
}
- td.ip += 5;
- SET_TYPE(td.sp - 1, stack_type[mint_type(&klass->byval_arg)], klass);
+ td->ip += 5;
+ SET_TYPE(td->sp - 1, stack_type[mint_type(&klass->byval_arg)], klass);
BARRIER_IF_VOLATILE (td);
break;
}
case CEE_LDSTR: {
MonoString *s;
- token = mono_metadata_token_index (read32 (td.ip + 1));
- td.ip += 5;
+ token = mono_metadata_token_index (read32 (td->ip + 1));
+ td->ip += 5;
if (method->wrapper_type == MONO_WRAPPER_DYNAMIC_METHOD) {
s = mono_method_get_wrapper_data (method, token);
} else if (method->wrapper_type != MONO_WRAPPER_NONE) {
} else {
s = mono_ldstr (domain, image, token);
}
- ADD_CODE(&td, MINT_LDSTR);
- ADD_CODE(&td, get_data_item_index (&td, s));
- PUSH_TYPE(&td, STACK_TYPE_O, mono_defaults.string_class);
+ ADD_CODE(td, MINT_LDSTR);
+ ADD_CODE(td, get_data_item_index (td, s));
+ PUSH_TYPE(td, STACK_TYPE_O, mono_defaults.string_class);
break;
}
case CEE_NEWOBJ: {
guint32 vt_stack_used = 0;
guint32 vt_res_size = 0;
- td.ip++;
- token = read32 (td.ip);
- td.ip += 4;
+ td->ip++;
+ token = read32 (td->ip);
+ td->ip += 4;
if (method->wrapper_type != MONO_WRAPPER_NONE)
m = (MonoMethod *)mono_method_get_wrapper_data (method, token);
csignature = mono_method_signature (m);
klass = m->klass;
- td.sp -= csignature->param_count;
- ADD_CODE(&td, MINT_NEWOBJ);
- ADD_CODE(&td, get_data_item_index (&td, mono_interp_get_runtime_method (domain, m, &error)));
- mono_error_cleanup (&error); /* FIXME: don't swallow the error */
- if (mint_type (&klass->byval_arg) == MINT_TYPE_VT) {
- vt_res_size = mono_class_value_size (klass, NULL);
- PUSH_VT (&td, vt_res_size);
- }
- for (i = 0; i < csignature->param_count; ++i) {
- int mt = mint_type(csignature->params [i]);
- if (mt == MINT_TYPE_VT) {
- MonoClass *k = mono_class_from_mono_type (csignature->params [i]);
- gint32 size = mono_class_value_size (k, NULL);
- size = (size + 7) & ~7;
- vt_stack_used += size;
+ td->sp -= csignature->param_count;
+ if (mono_class_is_magic_int (klass) || mono_class_is_magic_float (klass)) {
+ ADD_CODE (td, MINT_NEWOBJ_MAGIC);
+ ADD_CODE (td, get_data_item_index (td, mono_interp_get_imethod (domain, m, &error)));
+ PUSH_TYPE (td, stack_type [mint_type (&klass->byval_arg)], klass);
+ } else {
+ ADD_CODE(td, MINT_NEWOBJ);
+ ADD_CODE(td, get_data_item_index (td, mono_interp_get_imethod (domain, m, &error)));
+ mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+
+ if (mint_type (&klass->byval_arg) == MINT_TYPE_VT) {
+ vt_res_size = mono_class_value_size (klass, NULL);
+ PUSH_VT (td, vt_res_size);
}
+ for (i = 0; i < csignature->param_count; ++i) {
+ int mt = mint_type(csignature->params [i]);
+ if (mt == MINT_TYPE_VT) {
+ MonoClass *k = mono_class_from_mono_type (csignature->params [i]);
+ gint32 size = mono_class_value_size (k, NULL);
+ size = (size + 7) & ~7;
+ vt_stack_used += size;
+ }
+ }
+ if (vt_stack_used != 0 || vt_res_size != 0) {
+ ADD_CODE(td, MINT_VTRESULT);
+ ADD_CODE(td, vt_res_size);
+ WRITE32(td, &vt_stack_used);
+ td->vt_sp -= vt_stack_used;
+ }
+ PUSH_TYPE (td, stack_type [mint_type (&klass->byval_arg)], klass);
}
- if (vt_stack_used != 0 || vt_res_size != 0) {
- ADD_CODE(&td, MINT_VTRESULT);
- ADD_CODE(&td, vt_res_size);
- WRITE32(&td, &vt_stack_used);
- td.vt_sp -= vt_stack_used;
- }
- PUSH_TYPE (&td, stack_type [mint_type (&klass->byval_arg)], klass);
break;
}
case CEE_CASTCLASS:
- CHECK_STACK (&td, 1);
- token = read32 (td.ip + 1);
+ CHECK_STACK (td, 1);
+ token = read32 (td->ip + 1);
klass = mini_get_class (method, token, generic_context);
- ADD_CODE(&td, MINT_CASTCLASS);
- ADD_CODE(&td, get_data_item_index (&td, klass));
- td.sp [-1].klass = klass;
- td.ip += 5;
+ ADD_CODE(td, MINT_CASTCLASS);
+ ADD_CODE(td, get_data_item_index (td, klass));
+ td->sp [-1].klass = klass;
+ td->ip += 5;
break;
case CEE_ISINST:
- CHECK_STACK (&td, 1);
- token = read32 (td.ip + 1);
+ CHECK_STACK (td, 1);
+ token = read32 (td->ip + 1);
klass = mini_get_class (method, token, generic_context);
- ADD_CODE(&td, MINT_ISINST);
- ADD_CODE(&td, get_data_item_index (&td, klass));
- td.ip += 5;
+ ADD_CODE(td, MINT_ISINST);
+ ADD_CODE(td, get_data_item_index (td, klass));
+ td->ip += 5;
break;
case CEE_CONV_R_UN:
- switch (td.sp [-1].type) {
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
break;
case STACK_TYPE_I8:
- ADD_CODE(&td, MINT_CONV_R_UN_I8);
+ ADD_CODE(td, MINT_CONV_R_UN_I8);
break;
case STACK_TYPE_I4:
- ADD_CODE(&td, MINT_CONV_R_UN_I4);
+ ADD_CODE(td, MINT_CONV_R_UN_I4);
break;
default:
g_assert_not_reached ();
}
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_R8);
- ++td.ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_R8);
+ ++td->ip;
break;
case CEE_UNBOX:
- CHECK_STACK (&td, 1);
- token = read32 (td.ip + 1);
+ CHECK_STACK (td, 1);
+ token = read32 (td->ip + 1);
if (method->wrapper_type != MONO_WRAPPER_NONE)
klass = (MonoClass *)mono_method_get_wrapper_data (method, token);
g_error ("cee_unbox: implement Nullable");
}
- ADD_CODE(&td, MINT_UNBOX);
- ADD_CODE(&td, get_data_item_index (&td, klass));
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_MP);
- td.ip += 5;
+ ADD_CODE(td, MINT_UNBOX);
+ ADD_CODE(td, get_data_item_index (td, klass));
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_MP);
+ td->ip += 5;
break;
case CEE_UNBOX_ANY:
- CHECK_STACK (&td, 1);
- token = read32 (td.ip + 1);
+ CHECK_STACK (td, 1);
+ token = read32 (td->ip + 1);
klass = mini_get_class (method, token, generic_context);
if (mini_type_is_reference (&klass->byval_arg)) {
int mt = mint_type (&klass->byval_arg);
- ADD_CODE (&td, MINT_CASTCLASS);
- ADD_CODE (&td, get_data_item_index (&td, klass));
- SET_TYPE (td.sp - 1, stack_type [mt], klass);
- td.ip += 5;
+ ADD_CODE (td, MINT_CASTCLASS);
+ ADD_CODE (td, get_data_item_index (td, klass));
+ SET_TYPE (td->sp - 1, stack_type [mt], klass);
+ td->ip += 5;
} else if (mono_class_is_nullable (klass)) {
MonoMethod *target_method = mono_class_get_method_from_name (klass, "Unbox", 1);
- /* td.ip is incremented by interp_transform_call */
- interp_transform_call (&td, method, target_method, domain, generic_context, is_bb_start, body_start_offset, NULL, FALSE);
+ /* td->ip is incremented by interp_transform_call */
+ interp_transform_call (td, method, target_method, domain, generic_context, is_bb_start, body_start_offset, NULL, FALSE);
} else {
int mt = mint_type (&klass->byval_arg);
- ADD_CODE (&td, MINT_UNBOX);
- ADD_CODE (&td, get_data_item_index (&td, klass));
+ ADD_CODE (td, MINT_UNBOX);
+ ADD_CODE (td, get_data_item_index (td, klass));
- ADD_CODE (&td, MINT_LDOBJ);
- ADD_CODE (&td, get_data_item_index(&td, klass));
- SET_TYPE (td.sp - 1, stack_type [mt], klass);
+ ADD_CODE (td, MINT_LDOBJ);
+ ADD_CODE (td, get_data_item_index(td, klass));
+ SET_TYPE (td->sp - 1, stack_type [mt], klass);
if (mt == MINT_TYPE_VT) {
int size = mono_class_value_size (klass, NULL);
- PUSH_VT (&td, size);
+ PUSH_VT (td, size);
}
- td.ip += 5;
+ td->ip += 5;
}
break;
case CEE_THROW:
- CHECK_STACK (&td, 1);
+ CHECK_STACK (td, 1);
SIMPLE_OP (td, MINT_THROW);
- --td.sp;
+ --td->sp;
generating_code = 0;
break;
case CEE_LDFLDA:
- CHECK_STACK (&td, 1);
- token = read32 (td.ip + 1);
+ CHECK_STACK (td, 1);
+ token = read32 (td->ip + 1);
field = interp_field_from_token (method, token, &klass, generic_context);
gboolean is_static = !!(field->type->attrs & FIELD_ATTRIBUTE_STATIC);
mono_class_init (klass);
if (is_static) {
- ADD_CODE (&td, MINT_POP);
- ADD_CODE (&td, 0);
- ADD_CODE (&td, MINT_LDSFLDA);
- ADD_CODE (&td, get_data_item_index (&td, field));
+ ADD_CODE (td, MINT_POP);
+ ADD_CODE (td, 0);
+ ADD_CODE (td, MINT_LDSFLDA);
+ ADD_CODE (td, get_data_item_index (td, field));
} else {
- if ((td.sp - 1)->type == STACK_TYPE_O) {
- ADD_CODE (&td, MINT_LDFLDA);
+ if ((td->sp - 1)->type == STACK_TYPE_O) {
+ ADD_CODE (td, MINT_LDFLDA);
} else {
- g_assert ((td.sp -1)->type == STACK_TYPE_MP);
- ADD_CODE (&td, MINT_LDFLDA_UNSAFE);
+ g_assert ((td->sp -1)->type == STACK_TYPE_MP);
+ ADD_CODE (td, MINT_LDFLDA_UNSAFE);
}
- ADD_CODE (&td, klass->valuetype ? field->offset - sizeof (MonoObject) : field->offset);
+ ADD_CODE (td, klass->valuetype ? field->offset - sizeof (MonoObject) : field->offset);
}
- td.ip += 5;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_MP);
+ td->ip += 5;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_MP);
break;
case CEE_LDFLD: {
- CHECK_STACK (&td, 1);
- token = read32 (td.ip + 1);
+ CHECK_STACK (td, 1);
+ token = read32 (td->ip + 1);
field = interp_field_from_token (method, token, &klass, generic_context);
gboolean is_static = !!(field->type->attrs & FIELD_ATTRIBUTE_STATIC);
mono_class_init (klass);
#ifndef DISABLE_REMOTING
if (klass->marshalbyref) {
g_assert (!is_static);
- ADD_CODE(&td, mt == MINT_TYPE_VT ? MINT_LDRMFLD_VT : MINT_LDRMFLD);
- ADD_CODE(&td, get_data_item_index (&td, field));
+ ADD_CODE(td, mt == MINT_TYPE_VT ? MINT_LDRMFLD_VT : MINT_LDRMFLD);
+ ADD_CODE(td, get_data_item_index (td, field));
} else
#endif
{
if (is_static) {
- ADD_CODE (&td, MINT_POP);
- ADD_CODE (&td, 0);
- ADD_CODE (&td, mt == MINT_TYPE_VT ? MINT_LDSFLD_VT : MINT_LDSFLD);
- ADD_CODE (&td, get_data_item_index (&td, field));
+ ADD_CODE (td, MINT_POP);
+ ADD_CODE (td, 0);
+ ADD_CODE (td, mt == MINT_TYPE_VT ? MINT_LDSFLD_VT : MINT_LDSFLD);
+ ADD_CODE (td, get_data_item_index (td, field));
} else {
- ADD_CODE (&td, MINT_LDFLD_I1 + mt - MINT_TYPE_I1);
- ADD_CODE (&td, klass->valuetype ? field->offset - sizeof(MonoObject) : field->offset);
+ ADD_CODE (td, MINT_LDFLD_I1 + mt - MINT_TYPE_I1);
+ ADD_CODE (td, klass->valuetype ? field->offset - sizeof(MonoObject) : field->offset);
}
}
if (mt == MINT_TYPE_VT) {
int size = mono_class_value_size (field_klass, NULL);
- PUSH_VT(&td, size);
- WRITE32(&td, &size);
+ PUSH_VT(td, size);
+ WRITE32(td, &size);
}
- if (td.sp [-1].type == STACK_TYPE_VT) {
+ if (td->sp [-1].type == STACK_TYPE_VT) {
int size = mono_class_value_size (klass, NULL);
size = (size + 7) & ~7;
- td.vt_sp -= size;
- ADD_CODE (&td, MINT_VTRESULT);
- ADD_CODE (&td, 0);
- WRITE32 (&td, &size);
+ td->vt_sp -= size;
+ ADD_CODE (td, MINT_VTRESULT);
+ ADD_CODE (td, 0);
+ WRITE32 (td, &size);
}
- td.ip += 5;
- SET_TYPE(td.sp - 1, stack_type [mt], field_klass);
+ td->ip += 5;
+ SET_TYPE(td->sp - 1, stack_type [mt], field_klass);
BARRIER_IF_VOLATILE (td);
break;
}
case CEE_STFLD: {
- CHECK_STACK (&td, 2);
- token = read32 (td.ip + 1);
+ CHECK_STACK (td, 2);
+ token = read32 (td->ip + 1);
field = interp_field_from_token (method, token, &klass, generic_context);
gboolean is_static = !!(field->type->attrs & FIELD_ATTRIBUTE_STATIC);
mono_class_init (klass);
#ifndef DISABLE_REMOTING
if (klass->marshalbyref) {
g_assert (!is_static);
- ADD_CODE(&td, mt == MINT_TYPE_VT ? MINT_STRMFLD_VT : MINT_STRMFLD);
- ADD_CODE(&td, get_data_item_index (&td, field));
+ ADD_CODE(td, mt == MINT_TYPE_VT ? MINT_STRMFLD_VT : MINT_STRMFLD);
+ ADD_CODE(td, get_data_item_index (td, field));
} else
#endif
{
if (is_static) {
- ADD_CODE (&td, MINT_POP);
- ADD_CODE (&td, 1);
- ADD_CODE (&td, mt == MINT_TYPE_VT ? MINT_STSFLD_VT : MINT_STSFLD);
- ADD_CODE (&td, get_data_item_index (&td, field));
+ ADD_CODE (td, MINT_POP);
+ ADD_CODE (td, 1);
+ ADD_CODE (td, mt == MINT_TYPE_VT ? MINT_STSFLD_VT : MINT_STSFLD);
+ ADD_CODE (td, get_data_item_index (td, field));
} else {
- ADD_CODE (&td, MINT_STFLD_I1 + mt - MINT_TYPE_I1);
- ADD_CODE (&td, klass->valuetype ? field->offset - sizeof(MonoObject) : field->offset);
+ ADD_CODE (td, MINT_STFLD_I1 + mt - MINT_TYPE_I1);
+ ADD_CODE (td, klass->valuetype ? field->offset - sizeof(MonoObject) : field->offset);
}
}
if (mt == MINT_TYPE_VT) {
MonoClass *klass = mono_class_from_mono_type (field->type);
int size = mono_class_value_size (klass, NULL);
- POP_VT(&td, size);
- WRITE32(&td, &size);
+ POP_VT(td, size);
+ WRITE32(td, &size);
}
- td.ip += 5;
- td.sp -= 2;
+ td->ip += 5;
+ td->sp -= 2;
break;
}
case CEE_LDSFLDA:
- token = read32 (td.ip + 1);
+ token = read32 (td->ip + 1);
field = interp_field_from_token (method, token, &klass, generic_context);
- ADD_CODE(&td, MINT_LDSFLDA);
- ADD_CODE(&td, get_data_item_index (&td, field));
- td.ip += 5;
- PUSH_SIMPLE_TYPE(&td, STACK_TYPE_MP);
+ ADD_CODE(td, MINT_LDSFLDA);
+ ADD_CODE(td, get_data_item_index (td, field));
+ td->ip += 5;
+ PUSH_SIMPLE_TYPE(td, STACK_TYPE_MP);
break;
case CEE_LDSFLD:
- token = read32 (td.ip + 1);
+ token = read32 (td->ip + 1);
field = interp_field_from_token (method, token, &klass, generic_context);
mt = mint_type(field->type);
- ADD_CODE(&td, mt == MINT_TYPE_VT ? MINT_LDSFLD_VT : MINT_LDSFLD);
- ADD_CODE(&td, get_data_item_index (&td, field));
+ ADD_CODE(td, mt == MINT_TYPE_VT ? MINT_LDSFLD_VT : MINT_LDSFLD);
+ ADD_CODE(td, get_data_item_index (td, field));
klass = NULL;
if (mt == MINT_TYPE_VT) {
MonoClass *klass = mono_class_from_mono_type (field->type);
int size = mono_class_value_size (klass, NULL);
- PUSH_VT(&td, size);
- WRITE32(&td, &size);
+ PUSH_VT(td, size);
+ WRITE32(td, &size);
klass = field->type->data.klass;
} else {
if (mt == MINT_TYPE_O)
klass = mono_class_from_mono_type (field->type);
}
- td.ip += 5;
- PUSH_TYPE(&td, stack_type [mt], klass);
+ td->ip += 5;
+ PUSH_TYPE(td, stack_type [mt], klass);
break;
case CEE_STSFLD:
- CHECK_STACK (&td, 1);
- token = read32 (td.ip + 1);
+ CHECK_STACK (td, 1);
+ token = read32 (td->ip + 1);
field = interp_field_from_token (method, token, &klass, generic_context);
mt = mint_type(field->type);
- ADD_CODE(&td, mt == MINT_TYPE_VT ? MINT_STSFLD_VT : MINT_STSFLD);
- ADD_CODE(&td, get_data_item_index (&td, field));
+ ADD_CODE(td, mt == MINT_TYPE_VT ? MINT_STSFLD_VT : MINT_STSFLD);
+ ADD_CODE(td, get_data_item_index (td, field));
if (mt == MINT_TYPE_VT) {
MonoClass *klass = mono_class_from_mono_type (field->type);
int size = mono_class_value_size (klass, NULL);
- POP_VT (&td, size);
- WRITE32 (&td, &size);
+ POP_VT (td, size);
+ WRITE32 (td, &size);
}
- td.ip += 5;
- --td.sp;
+ td->ip += 5;
+ --td->sp;
break;
case CEE_STOBJ: {
int size;
- token = read32 (td.ip + 1);
+ token = read32 (td->ip + 1);
if (method->wrapper_type != MONO_WRAPPER_NONE)
klass = (MonoClass *)mono_method_get_wrapper_data (method, token);
klass = mini_get_class (method, token, generic_context);
BARRIER_IF_VOLATILE (td);
- ADD_CODE(&td, td.sp [-1].type == STACK_TYPE_VT ? MINT_STOBJ_VT : MINT_STOBJ);
- ADD_CODE(&td, get_data_item_index (&td, klass));
- if (td.sp [-1].type == STACK_TYPE_VT) {
+ ADD_CODE(td, td->sp [-1].type == STACK_TYPE_VT ? MINT_STOBJ_VT : MINT_STOBJ);
+ ADD_CODE(td, get_data_item_index (td, klass));
+ if (td->sp [-1].type == STACK_TYPE_VT) {
size = mono_class_value_size (klass, NULL);
size = (size + 7) & ~7;
- td.vt_sp -= size;
+ td->vt_sp -= size;
}
- td.ip += 5;
- td.sp -= 2;
+ td->ip += 5;
+ td->sp -= 2;
break;
}
case CEE_CONV_OVF_I_UN:
case CEE_CONV_OVF_U_UN:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
#if SIZEOF_VOID_P == 8
- ADD_CODE(&td, MINT_CONV_OVF_I8_UN_R8);
+ ADD_CODE(td, MINT_CONV_OVF_I8_UN_R8);
#else
- ADD_CODE(&td, MINT_CONV_OVF_I4_UN_R8);
+ ADD_CODE(td, MINT_CONV_OVF_I4_UN_R8);
#endif
break;
case STACK_TYPE_I8:
#if SIZEOF_VOID_P == 4
- ADD_CODE (&td, MINT_CONV_OVF_I4_UN_I8);
+ ADD_CODE (td, MINT_CONV_OVF_I4_UN_I8);
#endif
break;
case STACK_TYPE_I4:
#if SIZEOF_VOID_P == 8
- ADD_CODE(&td, MINT_CONV_I8_U4);
+ ADD_CODE(td, MINT_CONV_I8_U4);
#elif SIZEOF_VOID_P == 4
- if (*td.ip == CEE_CONV_OVF_I_UN)
- ADD_CODE(&td, MINT_CONV_OVF_I4_U4);
+ if (*td->ip == CEE_CONV_OVF_I_UN)
+ ADD_CODE(td, MINT_CONV_OVF_I4_U4);
#endif
break;
default:
g_assert_not_reached ();
break;
}
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I8);
- ++td.ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I8);
+ ++td->ip;
break;
case CEE_CONV_OVF_I8_UN:
case CEE_CONV_OVF_U8_UN:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
- ADD_CODE(&td, MINT_CONV_OVF_I8_UN_R8);
+ ADD_CODE(td, MINT_CONV_OVF_I8_UN_R8);
break;
case STACK_TYPE_I8:
- if (*td.ip == CEE_CONV_OVF_I8_UN)
- ADD_CODE (&td, MINT_CONV_OVF_I8_U8);
+ if (*td->ip == CEE_CONV_OVF_I8_UN)
+ ADD_CODE (td, MINT_CONV_OVF_I8_U8);
break;
case STACK_TYPE_I4:
- ADD_CODE(&td, MINT_CONV_I8_U4);
+ ADD_CODE(td, MINT_CONV_I8_U4);
break;
default:
g_assert_not_reached ();
break;
}
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I8);
- ++td.ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I8);
+ ++td->ip;
break;
case CEE_BOX: {
int size;
- CHECK_STACK (&td, 1);
- token = read32 (td.ip + 1);
+ CHECK_STACK (td, 1);
+ token = read32 (td->ip + 1);
if (method->wrapper_type != MONO_WRAPPER_NONE)
klass = (MonoClass *)mono_method_get_wrapper_data (method, token);
else
if (mono_class_is_nullable (klass)) {
MonoMethod *target_method = mono_class_get_method_from_name (klass, "Box", 1);
- /* td.ip is incremented by interp_transform_call */
- interp_transform_call (&td, method, target_method, domain, generic_context, is_bb_start, body_start_offset, NULL, FALSE);
+ /* td->ip is incremented by interp_transform_call */
+ interp_transform_call (td, method, target_method, domain, generic_context, is_bb_start, body_start_offset, NULL, FALSE);
} else if (!klass->valuetype) {
/* already boxed, do nothing. */
- td.ip += 5;
+ td->ip += 5;
} else {
if (mint_type (&klass->byval_arg) == MINT_TYPE_VT && !klass->enumtype) {
size = mono_class_value_size (klass, NULL);
size = (size + 7) & ~7;
- td.vt_sp -= size;
+ td->vt_sp -= size;
}
- ADD_CODE(&td, MINT_BOX);
- ADD_CODE(&td, get_data_item_index (&td, klass));
- ADD_CODE (&td, 0);
- SET_TYPE(td.sp - 1, STACK_TYPE_O, klass);
- td.ip += 5;
+ ADD_CODE(td, MINT_BOX);
+ ADD_CODE(td, get_data_item_index (td, klass));
+ ADD_CODE (td, 0);
+ SET_TYPE(td->sp - 1, STACK_TYPE_O, klass);
+ td->ip += 5;
}
break;
}
case CEE_NEWARR: {
- CHECK_STACK (&td, 1);
- token = read32 (td.ip + 1);
+ CHECK_STACK (td, 1);
+ token = read32 (td->ip + 1);
if (method->wrapper_type != MONO_WRAPPER_NONE)
klass = (MonoClass *)mono_method_get_wrapper_data (method, token);
else
klass = mini_get_class (method, token, generic_context);
- unsigned char lentype = (td.sp - 1)->type;
+ unsigned char lentype = (td->sp - 1)->type;
if (lentype == STACK_TYPE_I8) {
/* mimic mini behaviour */
- ADD_CODE (&td, MINT_CONV_OVF_U4_I8);
+ ADD_CODE (td, MINT_CONV_OVF_U4_I8);
} else {
g_assert (lentype == STACK_TYPE_I4);
- ADD_CODE (&td, MINT_CONV_OVF_U4_I4);
+ ADD_CODE (td, MINT_CONV_OVF_U4_I4);
}
- SET_SIMPLE_TYPE (td.sp - 1, STACK_TYPE_I4);
- ADD_CODE (&td, MINT_NEWARR);
- ADD_CODE (&td, get_data_item_index (&td, klass));
- SET_TYPE (td.sp - 1, STACK_TYPE_O, klass);
- td.ip += 5;
+ SET_SIMPLE_TYPE (td->sp - 1, STACK_TYPE_I4);
+ ADD_CODE (td, MINT_NEWARR);
+ ADD_CODE (td, get_data_item_index (td, klass));
+ SET_TYPE (td->sp - 1, STACK_TYPE_O, klass);
+ td->ip += 5;
break;
}
case CEE_LDLEN:
- CHECK_STACK (&td, 1);
+ CHECK_STACK (td, 1);
SIMPLE_OP (td, MINT_LDLEN);
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I);
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I);
break;
case CEE_LDELEMA:
- CHECK_STACK (&td, 2);
- ENSURE_I4 (&td, 1);
- token = read32 (td.ip + 1);
+ CHECK_STACK (td, 2);
+ ENSURE_I4 (td, 1);
+ token = read32 (td->ip + 1);
if (method->wrapper_type != MONO_WRAPPER_NONE)
klass = (MonoClass *) mono_method_get_wrapper_data (method, token);
klass = mini_get_class (method, token, generic_context);
if (!klass->valuetype && method->wrapper_type == MONO_WRAPPER_NONE && !readonly) {
- ADD_CODE (&td, MINT_LDELEMA_TC);
+ ADD_CODE (td, MINT_LDELEMA_TC);
} else {
- ADD_CODE (&td, MINT_LDELEMA);
+ ADD_CODE (td, MINT_LDELEMA);
}
- ADD_CODE (&td, get_data_item_index (&td, klass));
+ ADD_CODE (td, get_data_item_index (td, klass));
/* according to spec, ldelema bytecode is only used for 1-dim arrays */
- ADD_CODE (&td, 2);
+ ADD_CODE (td, 2);
readonly = FALSE;
- td.ip += 5;
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_MP);
+ td->ip += 5;
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_MP);
break;
case CEE_LDELEM_I1:
- CHECK_STACK (&td, 2);
- ENSURE_I4 (&td, 1);
+ CHECK_STACK (td, 2);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_I1);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case CEE_LDELEM_U1:
- CHECK_STACK (&td, 2);
- ENSURE_I4 (&td, 1);
+ CHECK_STACK (td, 2);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_U1);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case CEE_LDELEM_I2:
- CHECK_STACK (&td, 2);
- ENSURE_I4 (&td, 1);
+ CHECK_STACK (td, 2);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_I2);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case CEE_LDELEM_U2:
- CHECK_STACK (&td, 2);
- ENSURE_I4 (&td, 1);
+ CHECK_STACK (td, 2);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_U2);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case CEE_LDELEM_I4:
- CHECK_STACK (&td, 2);
- ENSURE_I4 (&td, 1);
+ CHECK_STACK (td, 2);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_I4);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case CEE_LDELEM_U4:
- CHECK_STACK (&td, 2);
- ENSURE_I4 (&td, 1);
+ CHECK_STACK (td, 2);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_U4);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case CEE_LDELEM_I8:
- CHECK_STACK (&td, 2);
- ENSURE_I4 (&td, 1);
+ CHECK_STACK (td, 2);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_I8);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I8);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I8);
break;
case CEE_LDELEM_I:
- CHECK_STACK (&td, 2);
- ENSURE_I4 (&td, 1);
+ CHECK_STACK (td, 2);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_I);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I);
break;
case CEE_LDELEM_R4:
- CHECK_STACK (&td, 2);
- ENSURE_I4 (&td, 1);
+ CHECK_STACK (td, 2);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_R4);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_R8);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_R8);
break;
case CEE_LDELEM_R8:
- CHECK_STACK (&td, 2);
- ENSURE_I4 (&td, 1);
+ CHECK_STACK (td, 2);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_R8);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_R8);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_R8);
break;
case CEE_LDELEM_REF:
- CHECK_STACK (&td, 2);
- ENSURE_I4 (&td, 1);
+ CHECK_STACK (td, 2);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_REF);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_O);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_O);
break;
case CEE_LDELEM:
- CHECK_STACK (&td, 2);
- token = read32 (td.ip + 1);
+ CHECK_STACK (td, 2);
+ token = read32 (td->ip + 1);
klass = mini_get_class (method, token, generic_context);
switch (mint_type (&klass->byval_arg)) {
case MINT_TYPE_I1:
- ENSURE_I4 (&td, 1);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_I1);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case MINT_TYPE_U1:
- ENSURE_I4 (&td, 1);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_U1);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case MINT_TYPE_U2:
- ENSURE_I4 (&td, 1);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_U2);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case MINT_TYPE_I2:
- ENSURE_I4 (&td, 1);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_I2);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case MINT_TYPE_I4:
- ENSURE_I4 (&td, 1);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_I4);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case MINT_TYPE_I8:
- ENSURE_I4 (&td, 1);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_I8);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I8);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I8);
break;
case MINT_TYPE_R4:
- ENSURE_I4 (&td, 1);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_R4);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_R8);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_R8);
break;
case MINT_TYPE_R8:
- ENSURE_I4 (&td, 1);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_R8);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_R8);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_R8);
break;
case MINT_TYPE_O:
- ENSURE_I4 (&td, 1);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_REF);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_O);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_O);
break;
case MINT_TYPE_VT: {
int size = mono_class_value_size (klass, NULL);
- ENSURE_I4 (&td, 1);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_VT);
- ADD_CODE (&td, get_data_item_index (&td, klass));
- WRITE32 (&td, &size);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_VT);
- PUSH_VT (&td, size);
+ ADD_CODE (td, get_data_item_index (td, klass));
+ WRITE32 (td, &size);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_VT);
+ PUSH_VT (td, size);
break;
}
default: {
break;
}
}
- td.ip += 4;
+ td->ip += 4;
break;
case CEE_STELEM_I:
- CHECK_STACK (&td, 3);
- ENSURE_I4 (&td, 2);
+ CHECK_STACK (td, 3);
+ ENSURE_I4 (td, 2);
SIMPLE_OP (td, MINT_STELEM_I);
- td.sp -= 3;
+ td->sp -= 3;
break;
case CEE_STELEM_I1:
- CHECK_STACK (&td, 3);
- ENSURE_I4 (&td, 2);
+ CHECK_STACK (td, 3);
+ ENSURE_I4 (td, 2);
SIMPLE_OP (td, MINT_STELEM_I1);
- td.sp -= 3;
+ td->sp -= 3;
break;
case CEE_STELEM_I2:
- CHECK_STACK (&td, 3);
- ENSURE_I4 (&td, 2);
+ CHECK_STACK (td, 3);
+ ENSURE_I4 (td, 2);
SIMPLE_OP (td, MINT_STELEM_I2);
- td.sp -= 3;
+ td->sp -= 3;
break;
case CEE_STELEM_I4:
- CHECK_STACK (&td, 3);
- ENSURE_I4 (&td, 2);
+ CHECK_STACK (td, 3);
+ ENSURE_I4 (td, 2);
SIMPLE_OP (td, MINT_STELEM_I4);
- td.sp -= 3;
+ td->sp -= 3;
break;
case CEE_STELEM_I8:
- CHECK_STACK (&td, 3);
- ENSURE_I4 (&td, 2);
+ CHECK_STACK (td, 3);
+ ENSURE_I4 (td, 2);
SIMPLE_OP (td, MINT_STELEM_I8);
- td.sp -= 3;
+ td->sp -= 3;
break;
case CEE_STELEM_R4:
- CHECK_STACK (&td, 3);
- ENSURE_I4 (&td, 2);
+ CHECK_STACK (td, 3);
+ ENSURE_I4 (td, 2);
SIMPLE_OP (td, MINT_STELEM_R4);
- td.sp -= 3;
+ td->sp -= 3;
break;
case CEE_STELEM_R8:
- CHECK_STACK (&td, 3);
- ENSURE_I4 (&td, 2);
+ CHECK_STACK (td, 3);
+ ENSURE_I4 (td, 2);
SIMPLE_OP (td, MINT_STELEM_R8);
- td.sp -= 3;
+ td->sp -= 3;
break;
case CEE_STELEM_REF:
- CHECK_STACK (&td, 3);
- ENSURE_I4 (&td, 2);
+ CHECK_STACK (td, 3);
+ ENSURE_I4 (td, 2);
SIMPLE_OP (td, MINT_STELEM_REF);
- td.sp -= 3;
+ td->sp -= 3;
break;
case CEE_STELEM:
- CHECK_STACK (&td, 3);
- ENSURE_I4 (&td, 2);
- token = read32 (td.ip + 1);
+ CHECK_STACK (td, 3);
+ ENSURE_I4 (td, 2);
+ token = read32 (td->ip + 1);
klass = mini_get_class (method, token, generic_context);
switch (mint_type (&klass->byval_arg)) {
case MINT_TYPE_U1:
case MINT_TYPE_VT: {
int size = mono_class_value_size (klass, NULL);
SIMPLE_OP (td, MINT_STELEM_VT);
- ADD_CODE (&td, get_data_item_index (&td, klass));
- WRITE32 (&td, &size);
- POP_VT (&td, size);
+ ADD_CODE (td, get_data_item_index (td, klass));
+ WRITE32 (td, &size);
+ POP_VT (td, size);
break;
}
default: {
break;
}
}
- td.ip += 4;
- td.sp -= 3;
+ td->ip += 4;
+ td->sp -= 3;
break;
#if 0
case CEE_CONV_OVF_U1:
#endif
#endif
case CEE_CKFINITE:
- CHECK_STACK (&td, 1);
+ CHECK_STACK (td, 1);
SIMPLE_OP (td, MINT_CKFINITE);
break;
case CEE_MKREFANY:
- CHECK_STACK (&td, 1);
- ENSURE_I4 (&td, 2);
- token = read32 (td.ip + 1);
+ CHECK_STACK (td, 1);
+ ENSURE_I4 (td, 2);
+ token = read32 (td->ip + 1);
klass = mini_get_class (method, token, generic_context);
- ADD_CODE (&td, MINT_MKREFANY);
- ADD_CODE (&td, get_data_item_index (&td, klass));
+ ADD_CODE (td, MINT_MKREFANY);
+ ADD_CODE (td, get_data_item_index (td, klass));
- td.ip += 5;
- PUSH_VT (&td, sizeof (MonoTypedRef));
- SET_TYPE(td.sp - 1, STACK_TYPE_VT, mono_defaults.typed_reference_class);
+ td->ip += 5;
+ PUSH_VT (td, sizeof (MonoTypedRef));
+ SET_TYPE(td->sp - 1, STACK_TYPE_VT, mono_defaults.typed_reference_class);
break;
case CEE_REFANYVAL: {
- CHECK_STACK (&td, 1);
- ENSURE_I4 (&td, 2);
- token = read32 (td.ip + 1);
+ CHECK_STACK (td, 1);
+ ENSURE_I4 (td, 2);
+ token = read32 (td->ip + 1);
- ADD_CODE (&td, MINT_REFANYVAL);
+ ADD_CODE (td, MINT_REFANYVAL);
- POP_VT (&td, sizeof (MonoTypedRef));
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_MP);
+ POP_VT (td, sizeof (MonoTypedRef));
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_MP);
- td.ip += 5;
+ td->ip += 5;
break;
}
case CEE_CONV_OVF_I1:
case CEE_CONV_OVF_I1_UN:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
- ADD_CODE(&td, MINT_CONV_OVF_I1_R8);
+ ADD_CODE(td, MINT_CONV_OVF_I1_R8);
break;
case STACK_TYPE_I4:
- ADD_CODE(&td, MINT_CONV_OVF_I1_I4);
+ ADD_CODE(td, MINT_CONV_OVF_I1_I4);
break;
case STACK_TYPE_I8:
- ADD_CODE(&td, MINT_CONV_OVF_I1_I8);
+ ADD_CODE(td, MINT_CONV_OVF_I1_I8);
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case CEE_CONV_OVF_U1:
case CEE_CONV_OVF_U1_UN:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
- ADD_CODE(&td, MINT_CONV_OVF_U1_R8);
+ ADD_CODE(td, MINT_CONV_OVF_U1_R8);
break;
case STACK_TYPE_I4:
- ADD_CODE(&td, MINT_CONV_OVF_U1_I4);
+ ADD_CODE(td, MINT_CONV_OVF_U1_I4);
break;
case STACK_TYPE_I8:
- ADD_CODE(&td, MINT_CONV_OVF_U1_I8);
+ ADD_CODE(td, MINT_CONV_OVF_U1_I8);
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case CEE_CONV_OVF_I2:
case CEE_CONV_OVF_I2_UN:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
- ADD_CODE(&td, MINT_CONV_OVF_I2_R8);
+ ADD_CODE(td, MINT_CONV_OVF_I2_R8);
break;
case STACK_TYPE_I4:
- ADD_CODE(&td, MINT_CONV_OVF_I2_I4);
+ ADD_CODE(td, MINT_CONV_OVF_I2_I4);
break;
case STACK_TYPE_I8:
- ADD_CODE(&td, MINT_CONV_OVF_I2_I8);
+ ADD_CODE(td, MINT_CONV_OVF_I2_I8);
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case CEE_CONV_OVF_U2_UN:
case CEE_CONV_OVF_U2:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
- ADD_CODE(&td, MINT_CONV_OVF_U2_R8);
+ ADD_CODE(td, MINT_CONV_OVF_U2_R8);
break;
case STACK_TYPE_I4:
- ADD_CODE(&td, MINT_CONV_OVF_U2_I4);
+ ADD_CODE(td, MINT_CONV_OVF_U2_I4);
break;
case STACK_TYPE_I8:
- ADD_CODE(&td, MINT_CONV_OVF_U2_I8);
+ ADD_CODE(td, MINT_CONV_OVF_U2_I8);
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
#if SIZEOF_VOID_P == 4
case CEE_CONV_OVF_I:
#endif
case CEE_CONV_OVF_I4:
case CEE_CONV_OVF_I4_UN:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
- ADD_CODE(&td, MINT_CONV_OVF_I4_R8);
+ ADD_CODE(td, MINT_CONV_OVF_I4_R8);
break;
case STACK_TYPE_I4:
- if (*td.ip == CEE_CONV_OVF_I4_UN)
- ADD_CODE(&td, MINT_CONV_OVF_I4_U4);
+ if (*td->ip == CEE_CONV_OVF_I4_UN)
+ ADD_CODE(td, MINT_CONV_OVF_I4_U4);
break;
case STACK_TYPE_I8:
- if (*td.ip == CEE_CONV_OVF_I4_UN)
- ADD_CODE (&td, MINT_CONV_OVF_I4_U8);
+ if (*td->ip == CEE_CONV_OVF_I4_UN)
+ ADD_CODE (td, MINT_CONV_OVF_I4_U8);
else
- ADD_CODE (&td, MINT_CONV_OVF_I4_I8);
+ ADD_CODE (td, MINT_CONV_OVF_I4_I8);
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
#if SIZEOF_VOID_P == 4
case CEE_CONV_OVF_U:
#endif
case CEE_CONV_OVF_U4:
case CEE_CONV_OVF_U4_UN:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
- ADD_CODE(&td, MINT_CONV_OVF_U4_R8);
+ ADD_CODE(td, MINT_CONV_OVF_U4_R8);
break;
case STACK_TYPE_I4:
- if (*td.ip != CEE_CONV_OVF_U4_UN)
- ADD_CODE(&td, MINT_CONV_OVF_U4_I4);
+ if (*td->ip != CEE_CONV_OVF_U4_UN)
+ ADD_CODE(td, MINT_CONV_OVF_U4_I4);
break;
case STACK_TYPE_I8:
- ADD_CODE(&td, MINT_CONV_OVF_U4_I8);
+ ADD_CODE(td, MINT_CONV_OVF_U4_I8);
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
#if SIZEOF_VOID_P == 8
case CEE_CONV_OVF_I:
#endif
case CEE_CONV_OVF_I8:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
- ADD_CODE(&td, MINT_CONV_OVF_I8_R8);
+ ADD_CODE(td, MINT_CONV_OVF_I8_R8);
break;
case STACK_TYPE_I4:
- ADD_CODE(&td, MINT_CONV_I8_I4);
+ ADD_CODE(td, MINT_CONV_I8_I4);
break;
case STACK_TYPE_I8:
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I8);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I8);
break;
#if SIZEOF_VOID_P == 8
case CEE_CONV_OVF_U:
#endif
case CEE_CONV_OVF_U8:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
- ADD_CODE(&td, MINT_CONV_OVF_U8_R8);
+ ADD_CODE(td, MINT_CONV_OVF_U8_R8);
break;
case STACK_TYPE_I4:
- ADD_CODE(&td, MINT_CONV_OVF_U8_I4);
+ ADD_CODE(td, MINT_CONV_OVF_U8_I4);
break;
case STACK_TYPE_I8:
- ADD_CODE (&td, MINT_CONV_OVF_U8_I8);
+ ADD_CODE (td, MINT_CONV_OVF_U8_I8);
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I8);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I8);
break;
case CEE_LDTOKEN: {
int size;
gpointer handle;
- token = read32 (td.ip + 1);
+ token = read32 (td->ip + 1);
if (method->wrapper_type == MONO_WRAPPER_DYNAMIC_METHOD || method->wrapper_type == MONO_WRAPPER_SYNCHRONIZED) {
handle = mono_method_get_wrapper_data (method, token);
klass = (MonoClass *) mono_method_get_wrapper_data (method, token + 1);
g_assert (mt == MINT_TYPE_VT);
size = mono_class_value_size (klass, NULL);
g_assert (size == sizeof(gpointer));
- PUSH_VT (&td, sizeof(gpointer));
- ADD_CODE (&td, MINT_LDTOKEN);
- ADD_CODE (&td, get_data_item_index (&td, handle));
+ PUSH_VT (td, sizeof(gpointer));
+ ADD_CODE (td, MINT_LDTOKEN);
+ ADD_CODE (td, get_data_item_index (td, handle));
- SET_TYPE (td.sp, stack_type [mt], klass);
- td.sp++;
- td.ip += 5;
+ SET_TYPE (td->sp, stack_type [mt], klass);
+ td->sp++;
+ td->ip += 5;
break;
}
case CEE_ADD_OVF:
- binary_arith_op(&td, MINT_ADD_OVF_I4);
- ++td.ip;
+ binary_arith_op(td, MINT_ADD_OVF_I4);
+ ++td->ip;
break;
case CEE_ADD_OVF_UN:
- binary_arith_op(&td, MINT_ADD_OVF_UN_I4);
- ++td.ip;
+ binary_arith_op(td, MINT_ADD_OVF_UN_I4);
+ ++td->ip;
break;
case CEE_MUL_OVF:
- binary_arith_op(&td, MINT_MUL_OVF_I4);
- ++td.ip;
+ binary_arith_op(td, MINT_MUL_OVF_I4);
+ ++td->ip;
break;
case CEE_MUL_OVF_UN:
- binary_arith_op(&td, MINT_MUL_OVF_UN_I4);
- ++td.ip;
+ binary_arith_op(td, MINT_MUL_OVF_UN_I4);
+ ++td->ip;
break;
case CEE_SUB_OVF:
- binary_arith_op(&td, MINT_SUB_OVF_I4);
- ++td.ip;
+ binary_arith_op(td, MINT_SUB_OVF_I4);
+ ++td->ip;
break;
case CEE_SUB_OVF_UN:
- binary_arith_op(&td, MINT_SUB_OVF_UN_I4);
- ++td.ip;
+ binary_arith_op(td, MINT_SUB_OVF_UN_I4);
+ ++td->ip;
break;
case CEE_ENDFINALLY:
- g_assert (td.clause_indexes [in_offset] != -1);
- td.sp = td.stack;
+ g_assert (td->clause_indexes [in_offset] != -1);
+ td->sp = td->stack;
SIMPLE_OP (td, MINT_ENDFINALLY);
- ADD_CODE (&td, td.clause_indexes [in_offset]);
+ ADD_CODE (td, td->clause_indexes [in_offset]);
generating_code = 0;
break;
case CEE_LEAVE:
- td.sp = td.stack;
- handle_branch (&td, MINT_LEAVE_S, MINT_LEAVE, 5 + read32 (td.ip + 1));
- td.ip += 5;
+ td->sp = td->stack;
+ handle_branch (td, MINT_LEAVE_S, MINT_LEAVE, 5 + read32 (td->ip + 1));
+ td->ip += 5;
generating_code = 0;
break;
case CEE_LEAVE_S:
- td.sp = td.stack;
- handle_branch (&td, MINT_LEAVE_S, MINT_LEAVE, 2 + (gint8)td.ip [1]);
- td.ip += 2;
+ td->sp = td->stack;
+ handle_branch (td, MINT_LEAVE_S, MINT_LEAVE, 2 + (gint8)td->ip [1]);
+ td->ip += 2;
generating_code = 0;
break;
case CEE_UNUSED41:
- ++td.ip;
- switch (*td.ip) {
+ ++td->ip;
+ switch (*td->ip) {
case CEE_MONO_CALLI_EXTRA_ARG:
/* Same as CEE_CALLI, except that we drop the extra arg required for llvm specific behaviour */
- ADD_CODE (&td, MINT_POP);
- ADD_CODE (&td, 1);
- --td.sp;
- interp_transform_call (&td, method, NULL, domain, generic_context, is_bb_start, body_start_offset, NULL, FALSE);
+ ADD_CODE (td, MINT_POP);
+ ADD_CODE (td, 1);
+ --td->sp;
+ interp_transform_call (td, method, NULL, domain, generic_context, is_bb_start, body_start_offset, NULL, FALSE);
break;
case CEE_MONO_JIT_ICALL_ADDR: {
guint32 token;
gpointer func;
MonoJitICallInfo *info;
- token = read32 (td.ip + 1);
- td.ip += 5;
+ token = read32 (td->ip + 1);
+ td->ip += 5;
func = mono_method_get_wrapper_data (method, token);
info = mono_find_jit_icall_by_addr (func);
- ADD_CODE (&td, MINT_LDFTN);
- ADD_CODE (&td, get_data_item_index (&td, func));
- PUSH_SIMPLE_TYPE (&td, STACK_TYPE_I);
+ ADD_CODE (td, MINT_LDFTN);
+ ADD_CODE (td, get_data_item_index (td, func));
+ PUSH_SIMPLE_TYPE (td, STACK_TYPE_I);
break;
}
case CEE_MONO_ICALL: {
gpointer func;
MonoJitICallInfo *info;
- token = read32 (td.ip + 1);
- td.ip += 5;
+ token = read32 (td->ip + 1);
+ td->ip += 5;
func = mono_method_get_wrapper_data (method, token);
info = mono_find_jit_icall_by_addr (func);
g_assert (info);
- CHECK_STACK (&td, info->sig->param_count);
+ CHECK_STACK (td, info->sig->param_count);
switch (info->sig->param_count) {
case 0:
if (MONO_TYPE_IS_VOID (info->sig->ret))
- ADD_CODE (&td,MINT_ICALL_V_V);
+ ADD_CODE (td,MINT_ICALL_V_V);
else
- ADD_CODE (&td, MINT_ICALL_V_P);
+ ADD_CODE (td, MINT_ICALL_V_P);
break;
case 1:
if (MONO_TYPE_IS_VOID (info->sig->ret))
- ADD_CODE (&td,MINT_ICALL_P_V);
+ ADD_CODE (td,MINT_ICALL_P_V);
else
- ADD_CODE (&td,MINT_ICALL_P_P);
+ ADD_CODE (td,MINT_ICALL_P_P);
break;
case 2:
if (MONO_TYPE_IS_VOID (info->sig->ret)) {
if (info->sig->params [1]->type == MONO_TYPE_I4)
- ADD_CODE (&td,MINT_ICALL_PI_V);
+ ADD_CODE (td,MINT_ICALL_PI_V);
else
- ADD_CODE (&td,MINT_ICALL_PP_V);
+ ADD_CODE (td,MINT_ICALL_PP_V);
} else {
if (info->sig->params [1]->type == MONO_TYPE_I4)
- ADD_CODE (&td,MINT_ICALL_PI_P);
+ ADD_CODE (td,MINT_ICALL_PI_P);
else
- ADD_CODE (&td,MINT_ICALL_PP_P);
+ ADD_CODE (td,MINT_ICALL_PP_P);
}
break;
case 3:
g_assert (MONO_TYPE_IS_VOID (info->sig->ret));
if (info->sig->params [2]->type == MONO_TYPE_I4)
- ADD_CODE (&td,MINT_ICALL_PPI_V);
+ ADD_CODE (td,MINT_ICALL_PPI_V);
else
- ADD_CODE (&td,MINT_ICALL_PPP_V);
+ ADD_CODE (td,MINT_ICALL_PPP_V);
break;
default:
g_assert_not_reached ();
if (func == mono_ftnptr_to_delegate) {
g_error ("TODO: ?");
}
- ADD_CODE(&td, get_data_item_index (&td, func));
- td.sp -= info->sig->param_count;
+ ADD_CODE(td, get_data_item_index (td, func));
+ td->sp -= info->sig->param_count;
if (!MONO_TYPE_IS_VOID (info->sig->ret)) {
- td.sp ++;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I);
+ td->sp ++;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I);
}
break;
}
case CEE_MONO_VTADDR: {
int size;
- CHECK_STACK (&td, 1);
+ CHECK_STACK (td, 1);
if (method->wrapper_type == MONO_WRAPPER_MANAGED_TO_NATIVE)
- size = mono_class_native_size(td.sp [-1].klass, NULL);
+ size = mono_class_native_size(td->sp [-1].klass, NULL);
else
- size = mono_class_value_size(td.sp [-1].klass, NULL);
+ size = mono_class_value_size(td->sp [-1].klass, NULL);
size = (size + 7) & ~7;
- ADD_CODE(&td, MINT_VTRESULT);
- ADD_CODE(&td, 0);
- WRITE32(&td, &size);
- td.vt_sp -= size;
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_MP);
+ ADD_CODE(td, MINT_VTRESULT);
+ ADD_CODE(td, 0);
+ WRITE32(td, &size);
+ td->vt_sp -= size;
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_MP);
break;
}
case CEE_MONO_LDPTR:
case CEE_MONO_CLASSCONST:
- token = read32 (td.ip + 1);
- td.ip += 5;
- ADD_CODE(&td, MINT_MONO_LDPTR);
- ADD_CODE(&td, get_data_item_index (&td, mono_method_get_wrapper_data (method, token)));
- td.sp [0].type = STACK_TYPE_I;
- ++td.sp;
+ token = read32 (td->ip + 1);
+ td->ip += 5;
+ ADD_CODE(td, MINT_MONO_LDPTR);
+ ADD_CODE(td, get_data_item_index (td, mono_method_get_wrapper_data (method, token)));
+ td->sp [0].type = STACK_TYPE_I;
+ ++td->sp;
break;
case CEE_MONO_OBJADDR:
- CHECK_STACK (&td, 1);
- ++td.ip;
- td.sp[-1].type = STACK_TYPE_MP;
+ CHECK_STACK (td, 1);
+ ++td->ip;
+ td->sp[-1].type = STACK_TYPE_MP;
/* do nothing? */
break;
case CEE_MONO_NEWOBJ:
- token = read32 (td.ip + 1);
- td.ip += 5;
- ADD_CODE(&td, MINT_MONO_NEWOBJ);
- ADD_CODE(&td, get_data_item_index (&td, mono_method_get_wrapper_data (method, token)));
- td.sp [0].type = STACK_TYPE_O;
- ++td.sp;
+ token = read32 (td->ip + 1);
+ td->ip += 5;
+ ADD_CODE(td, MINT_MONO_NEWOBJ);
+ ADD_CODE(td, get_data_item_index (td, mono_method_get_wrapper_data (method, token)));
+ td->sp [0].type = STACK_TYPE_O;
+ ++td->sp;
break;
case CEE_MONO_RETOBJ:
- CHECK_STACK (&td, 1);
- token = read32 (td.ip + 1);
- td.ip += 5;
- ADD_CODE(&td, MINT_MONO_RETOBJ);
- td.sp--;
+ CHECK_STACK (td, 1);
+ token = read32 (td->ip + 1);
+ td->ip += 5;
+ ADD_CODE(td, MINT_MONO_RETOBJ);
+ td->sp--;
klass = (MonoClass *)mono_method_get_wrapper_data (method, token);
/*stackval_from_data (signature->ret, frame->retval, sp->data.vt, signature->pinvoke);*/
- if (td.sp > td.stack)
- g_warning ("CEE_MONO_RETOBJ: more values on stack: %d", td.sp-td.stack);
+ if (td->sp > td->stack)
+ g_warning ("CEE_MONO_RETOBJ: more values on stack: %d", td->sp-td->stack);
break;
case CEE_MONO_LDNATIVEOBJ:
- token = read32 (td.ip + 1);
- td.ip += 5;
+ token = read32 (td->ip + 1);
+ td->ip += 5;
klass = (MonoClass *)mono_method_get_wrapper_data (method, token);
g_assert(klass->valuetype);
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_MP);
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_MP);
break;
case CEE_MONO_TLS: {
- gint32 key = read32 (td.ip + 1);
- td.ip += 5;
+ gint32 key = read32 (td->ip + 1);
+ td->ip += 5;
g_assert (key < TLS_KEY_NUM);
- ADD_CODE (&td, MINT_MONO_TLS);
- WRITE32 (&td, &key);
- PUSH_SIMPLE_TYPE (&td, STACK_TYPE_MP);
+ ADD_CODE (td, MINT_MONO_TLS);
+ WRITE32 (td, &key);
+ PUSH_SIMPLE_TYPE (td, STACK_TYPE_MP);
break;
}
case CEE_MONO_ATOMIC_STORE_I4:
- CHECK_STACK (&td, 2);
+ CHECK_STACK (td, 2);
SIMPLE_OP (td, MINT_MONO_ATOMIC_STORE_I4);
- td.sp -= 2;
- td.ip++;
+ td->sp -= 2;
+ td->ip++;
break;
case CEE_MONO_SAVE_LMF:
case CEE_MONO_RESTORE_LMF:
case CEE_MONO_NOT_TAKEN:
- ++td.ip;
+ ++td->ip;
break;
case CEE_MONO_LDPTR_INT_REQ_FLAG:
- ADD_CODE (&td, MINT_MONO_LDPTR);
- ADD_CODE (&td, get_data_item_index (&td, mono_thread_interruption_request_flag ()));
- PUSH_TYPE (&td, STACK_TYPE_MP, NULL);
- ++td.ip;
+ ADD_CODE (td, MINT_MONO_LDPTR);
+ ADD_CODE (td, get_data_item_index (td, mono_thread_interruption_request_flag ()));
+ PUSH_TYPE (td, STACK_TYPE_MP, NULL);
+ ++td->ip;
break;
case CEE_MONO_MEMORY_BARRIER:
- ADD_CODE (&td, MINT_MONO_MEMORY_BARRIER);
- ++td.ip;
+ ADD_CODE (td, MINT_MONO_MEMORY_BARRIER);
+ ++td->ip;
break;
case CEE_MONO_JIT_ATTACH:
- ADD_CODE (&td, MINT_MONO_JIT_ATTACH);
- ++td.ip;
+ ADD_CODE (td, MINT_MONO_JIT_ATTACH);
+ ++td->ip;
break;
case CEE_MONO_JIT_DETACH:
- ADD_CODE (&td, MINT_MONO_JIT_DETACH);
- ++td.ip;
+ ADD_CODE (td, MINT_MONO_JIT_DETACH);
+ ++td->ip;
break;
case CEE_MONO_LDDOMAIN:
- ADD_CODE (&td, MINT_MONO_LDDOMAIN);
- td.sp [0].type = STACK_TYPE_I;
- ++td.sp;
- ++td.ip;
+ ADD_CODE (td, MINT_MONO_LDDOMAIN);
+ td->sp [0].type = STACK_TYPE_I;
+ ++td->sp;
+ ++td->ip;
break;
default:
- g_error ("transform.c: Unimplemented opcode: 0xF0 %02x at 0x%x\n", *td.ip, td.ip-header->code);
+ g_error ("transform.c: Unimplemented opcode: 0xF0 %02x at 0x%x\n", *td->ip, td->ip-header->code);
}
break;
#if 0
* throw point is just (ip - n_prefix_bytes).
*/
case CEE_PREFIX1:
- ++td.ip;
- switch (*td.ip) {
+ ++td->ip;
+ switch (*td->ip) {
#if 0
case CEE_ARGLIST: ves_abort(); break;
#endif
case CEE_CEQ:
- CHECK_STACK(&td, 2);
- if (td.sp [-1].type == STACK_TYPE_O || td.sp [-1].type == STACK_TYPE_MP)
- ADD_CODE(&td, MINT_CEQ_I4 + STACK_TYPE_I - STACK_TYPE_I4);
+ CHECK_STACK(td, 2);
+ if (td->sp [-1].type == STACK_TYPE_O || td->sp [-1].type == STACK_TYPE_MP)
+ ADD_CODE(td, MINT_CEQ_I4 + STACK_TYPE_I - STACK_TYPE_I4);
else
- ADD_CODE(&td, MINT_CEQ_I4 + td.sp [-1].type - STACK_TYPE_I4);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
- ++td.ip;
+ ADD_CODE(td, MINT_CEQ_I4 + td->sp [-1].type - STACK_TYPE_I4);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
+ ++td->ip;
break;
case CEE_CGT:
- CHECK_STACK(&td, 2);
- if (td.sp [-1].type == STACK_TYPE_O || td.sp [-1].type == STACK_TYPE_MP)
- ADD_CODE(&td, MINT_CGT_I4 + STACK_TYPE_I - STACK_TYPE_I4);
+ CHECK_STACK(td, 2);
+ if (td->sp [-1].type == STACK_TYPE_O || td->sp [-1].type == STACK_TYPE_MP)
+ ADD_CODE(td, MINT_CGT_I4 + STACK_TYPE_I - STACK_TYPE_I4);
else
- ADD_CODE(&td, MINT_CGT_I4 + td.sp [-1].type - STACK_TYPE_I4);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
- ++td.ip;
+ ADD_CODE(td, MINT_CGT_I4 + td->sp [-1].type - STACK_TYPE_I4);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
+ ++td->ip;
break;
case CEE_CGT_UN:
- CHECK_STACK(&td, 2);
- if (td.sp [-1].type == STACK_TYPE_O || td.sp [-1].type == STACK_TYPE_MP)
- ADD_CODE(&td, MINT_CGT_UN_I4 + STACK_TYPE_I - STACK_TYPE_I4);
+ CHECK_STACK(td, 2);
+ if (td->sp [-1].type == STACK_TYPE_O || td->sp [-1].type == STACK_TYPE_MP)
+ ADD_CODE(td, MINT_CGT_UN_I4 + STACK_TYPE_I - STACK_TYPE_I4);
else
- ADD_CODE(&td, MINT_CGT_UN_I4 + td.sp [-1].type - STACK_TYPE_I4);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
- ++td.ip;
+ ADD_CODE(td, MINT_CGT_UN_I4 + td->sp [-1].type - STACK_TYPE_I4);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
+ ++td->ip;
break;
case CEE_CLT:
- CHECK_STACK(&td, 2);
- if (td.sp [-1].type == STACK_TYPE_O || td.sp [-1].type == STACK_TYPE_MP)
- ADD_CODE(&td, MINT_CLT_I4 + STACK_TYPE_I - STACK_TYPE_I4);
+ CHECK_STACK(td, 2);
+ if (td->sp [-1].type == STACK_TYPE_O || td->sp [-1].type == STACK_TYPE_MP)
+ ADD_CODE(td, MINT_CLT_I4 + STACK_TYPE_I - STACK_TYPE_I4);
else
- ADD_CODE(&td, MINT_CLT_I4 + td.sp [-1].type - STACK_TYPE_I4);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
- ++td.ip;
+ ADD_CODE(td, MINT_CLT_I4 + td->sp [-1].type - STACK_TYPE_I4);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
+ ++td->ip;
break;
case CEE_CLT_UN:
- CHECK_STACK(&td, 2);
- if (td.sp [-1].type == STACK_TYPE_O || td.sp [-1].type == STACK_TYPE_MP)
- ADD_CODE(&td, MINT_CLT_UN_I4 + STACK_TYPE_I - STACK_TYPE_I4);
+ CHECK_STACK(td, 2);
+ if (td->sp [-1].type == STACK_TYPE_O || td->sp [-1].type == STACK_TYPE_MP)
+ ADD_CODE(td, MINT_CLT_UN_I4 + STACK_TYPE_I - STACK_TYPE_I4);
else
- ADD_CODE(&td, MINT_CLT_UN_I4 + td.sp [-1].type - STACK_TYPE_I4);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
- ++td.ip;
+ ADD_CODE(td, MINT_CLT_UN_I4 + td->sp [-1].type - STACK_TYPE_I4);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
+ ++td->ip;
break;
case CEE_LDVIRTFTN: /* fallthrough */
case CEE_LDFTN: {
MonoMethod *m;
- if (*td.ip == CEE_LDVIRTFTN) {
- CHECK_STACK (&td, 1);
- --td.sp;
+ if (*td->ip == CEE_LDVIRTFTN) {
+ CHECK_STACK (td, 1);
+ --td->sp;
}
- token = read32 (td.ip + 1);
+ token = read32 (td->ip + 1);
if (method->wrapper_type != MONO_WRAPPER_NONE)
m = (MonoMethod *)mono_method_get_wrapper_data (method, token);
else
if (method->wrapper_type == MONO_WRAPPER_NONE && m->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED)
m = mono_marshal_get_synchronized_wrapper (m);
- ADD_CODE(&td, *td.ip == CEE_LDFTN ? MINT_LDFTN : MINT_LDVIRTFTN);
- ADD_CODE(&td, get_data_item_index (&td, mono_interp_get_runtime_method (domain, m, &error)));
+ ADD_CODE(td, *td->ip == CEE_LDFTN ? MINT_LDFTN : MINT_LDVIRTFTN);
+ ADD_CODE(td, get_data_item_index (td, mono_interp_get_imethod (domain, m, &error)));
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
- td.ip += 5;
- PUSH_SIMPLE_TYPE (&td, STACK_TYPE_F);
+ td->ip += 5;
+ PUSH_SIMPLE_TYPE (td, STACK_TYPE_F);
break;
}
case CEE_LDARG:
- load_arg (&td, read16 (td.ip + 1));
- td.ip += 3;
+ load_arg (td, read16 (td->ip + 1));
+ td->ip += 3;
break;
case CEE_LDARGA: {
- int n = read16 (td.ip + 1);
- ADD_CODE (&td, MINT_LDARGA);
- ADD_CODE (&td, td.rtm->arg_offsets [n]); /* FIX for large offsets */
- PUSH_SIMPLE_TYPE(&td, STACK_TYPE_MP);
- td.ip += 3;
+ int n = read16 (td->ip + 1);
+ ADD_CODE (td, MINT_LDARGA);
+ ADD_CODE (td, td->rtm->arg_offsets [n]); /* FIX for large offsets */
+ PUSH_SIMPLE_TYPE(td, STACK_TYPE_MP);
+ td->ip += 3;
break;
}
case CEE_STARG:
- store_arg (&td, read16 (td.ip + 1));
- td.ip += 3;
+ store_arg (td, read16 (td->ip + 1));
+ td->ip += 3;
break;
case CEE_LDLOC:
- load_local (&td, read16 (td.ip + 1));
- td.ip += 3;
+ load_local (td, read16 (td->ip + 1));
+ td->ip += 3;
break;
case CEE_LDLOCA:
- ADD_CODE(&td, MINT_LDLOCA_S);
- ADD_CODE(&td, td.rtm->local_offsets [read16 (td.ip + 1)]);
- PUSH_SIMPLE_TYPE(&td, STACK_TYPE_MP);
- td.ip += 3;
+ ADD_CODE(td, MINT_LDLOCA_S);
+ ADD_CODE(td, td->rtm->local_offsets [read16 (td->ip + 1)]);
+ PUSH_SIMPLE_TYPE(td, STACK_TYPE_MP);
+ td->ip += 3;
break;
case CEE_STLOC:
- store_local (&td, read16 (td.ip + 1));
- td.ip += 3;
+ store_local (td, read16 (td->ip + 1));
+ td->ip += 3;
break;
case CEE_LOCALLOC:
- CHECK_STACK (&td, 1);
+ CHECK_STACK (td, 1);
#if SIZEOF_VOID_P == 8
- if (td.sp [-1].type == STACK_TYPE_I8)
- ADD_CODE(&td, MINT_CONV_I4_I8);
+ if (td->sp [-1].type == STACK_TYPE_I8)
+ ADD_CODE(td, MINT_CONV_I4_I8);
#endif
- ADD_CODE(&td, MINT_LOCALLOC);
- if (td.sp != td.stack + 1)
+ ADD_CODE(td, MINT_LOCALLOC);
+ if (td->sp != td->stack + 1)
g_warning("CEE_LOCALLOC: stack not empty");
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_MP);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_MP);
break;
#if 0
case CEE_UNUSED57: ves_abort(); break;
#endif
case CEE_ENDFILTER:
- ADD_CODE (&td, MINT_ENDFILTER);
- ++td.ip;
+ ADD_CODE (td, MINT_ENDFILTER);
+ ++td->ip;
break;
case CEE_UNALIGNED_:
- td.ip += 2;
+ td->ip += 2;
break;
case CEE_VOLATILE_:
- ++td.ip;
+ ++td->ip;
volatile_ = TRUE;
break;
case CEE_TAIL_:
- ++td.ip;
+ ++td->ip;
/* FIX: should do something? */;
+ // TODO: This should raise a method_tail_call profiler event.
break;
case CEE_INITOBJ:
- CHECK_STACK(&td, 1);
- token = read32 (td.ip + 1);
+ CHECK_STACK(td, 1);
+ token = read32 (td->ip + 1);
klass = mini_get_class (method, token, generic_context);
if (klass->valuetype) {
- ADD_CODE (&td, MINT_INITOBJ);
+ ADD_CODE (td, MINT_INITOBJ);
i32 = mono_class_value_size (klass, NULL);
- WRITE32 (&td, &i32);
+ WRITE32 (td, &i32);
} else {
- ADD_CODE (&td, MINT_LDNULL);
- ADD_CODE (&td, MINT_STIND_REF);
+ ADD_CODE (td, MINT_LDNULL);
+ ADD_CODE (td, MINT_STIND_REF);
}
- td.ip += 5;
- --td.sp;
+ td->ip += 5;
+ --td->sp;
break;
case CEE_CPBLK:
- CHECK_STACK(&td, 3);
+ CHECK_STACK(td, 3);
/* FIX? convert length to I8? */
if (volatile_)
- ADD_CODE (&td, MINT_MONO_MEMORY_BARRIER);
- ADD_CODE(&td, MINT_CPBLK);
+ ADD_CODE (td, MINT_MONO_MEMORY_BARRIER);
+ ADD_CODE(td, MINT_CPBLK);
BARRIER_IF_VOLATILE (td);
- td.sp -= 3;
- ++td.ip;
+ td->sp -= 3;
+ ++td->ip;
break;
case CEE_READONLY_:
readonly = TRUE;
- td.ip += 1;
+ td->ip += 1;
break;
case CEE_CONSTRAINED_:
- token = read32 (td.ip + 1);
+ token = read32 (td->ip + 1);
constrained_class = mini_get_class (method, token, generic_context);
mono_class_init (constrained_class);
- td.ip += 5;
+ td->ip += 5;
break;
case CEE_INITBLK:
- CHECK_STACK(&td, 3);
+ CHECK_STACK(td, 3);
BARRIER_IF_VOLATILE (td);
- ADD_CODE(&td, MINT_INITBLK);
- td.sp -= 3;
- td.ip += 1;
+ ADD_CODE(td, MINT_INITBLK);
+ td->sp -= 3;
+ td->ip += 1;
break;
case CEE_NO_:
/* FIXME: implement */
- td.ip += 2;
+ td->ip += 2;
break;
case CEE_RETHROW: {
- int clause_index = td.clause_indexes [in_offset];
+ int clause_index = td->clause_indexes [in_offset];
g_assert (clause_index != -1);
SIMPLE_OP (td, MINT_RETHROW);
- ADD_CODE (&td, rtm->exvar_offsets [clause_index]);
+ ADD_CODE (td, rtm->exvar_offsets [clause_index]);
generating_code = 0;
break;
}
case CEE_SIZEOF: {
gint32 size;
- token = read32 (td.ip + 1);
- td.ip += 5;
+ token = read32 (td->ip + 1);
+ td->ip += 5;
if (mono_metadata_token_table (token) == MONO_TABLE_TYPESPEC && !image_is_dynamic (method->klass->image) && !generic_context) {
int align;
MonoType *type = mono_type_create_from_typespec (image, token);
#endif
size = mono_type_size (&szclass->byval_arg, &align);
}
- ADD_CODE(&td, MINT_LDC_I4);
- WRITE32(&td, &size);
- PUSH_SIMPLE_TYPE(&td, STACK_TYPE_I4);
+ ADD_CODE(td, MINT_LDC_I4);
+ WRITE32(td, &size);
+ PUSH_SIMPLE_TYPE(td, STACK_TYPE_I4);
break;
}
case CEE_REFANYTYPE:
- ADD_CODE (&td, MINT_REFANYTYPE);
- td.ip += 1;
- POP_VT (&td, sizeof (MonoTypedRef));
- PUSH_VT (&td, sizeof (gpointer));
- SET_TYPE(td.sp - 1, STACK_TYPE_VT, NULL);
+ ADD_CODE (td, MINT_REFANYTYPE);
+ td->ip += 1;
+ POP_VT (td, sizeof (MonoTypedRef));
+ PUSH_VT (td, sizeof (gpointer));
+ SET_TYPE(td->sp - 1, STACK_TYPE_VT, NULL);
break;
default:
- g_error ("transform.c: Unimplemented opcode: 0xFE %02x (%s) at 0x%x\n", *td.ip, mono_opcode_name (256 + *td.ip), td.ip-header->code);
+ g_error ("transform.c: Unimplemented opcode: 0xFE %02x (%s) at 0x%x\n", *td->ip, mono_opcode_name (256 + *td->ip), td->ip-header->code);
}
break;
default:
- g_error ("transform.c: Unimplemented opcode: %02x at 0x%x\n", *td.ip, td.ip-header->code);
+ g_error ("transform.c: Unimplemented opcode: %02x at 0x%x\n", *td->ip, td->ip-header->code);
}
- if (td.new_ip - td.new_code != new_in_start_offset)
- td.last_new_ip = td.new_code + new_in_start_offset;
- else if (td.is_bb_start [td.in_start - td.il_code])
- td.is_bb_start [td.ip - td.il_code] = 1;
+ if (td->new_ip - td->new_code != new_in_start_offset)
+ td->last_new_ip = td->new_code + new_in_start_offset;
+ else if (td->is_bb_start [td->in_start - td->il_code])
+ td->is_bb_start [td->ip - td->il_code] = 1;
- td.last_ip = td.in_start;
+ td->last_ip = td->in_start;
}
/* Handle relocations */
- for (int i = 0; i < td.relocs->len; ++i) {
- Reloc *reloc = g_ptr_array_index (td.relocs, i);
+ for (int i = 0; i < td->relocs->len; ++i) {
+ Reloc *reloc = g_ptr_array_index (td->relocs, i);
- int offset = td.in_offsets [reloc->target] - reloc->offset;
+ int offset = td->in_offsets [reloc->target] - reloc->offset;
switch (reloc->type) {
case RELOC_SHORT_BRANCH:
- g_assert (td.new_code [reloc->offset + 1] == 0xffff);
- td.new_code [reloc->offset + 1] = offset;
+ g_assert (td->new_code [reloc->offset + 1] == 0xffff);
+ td->new_code [reloc->offset + 1] = offset;
break;
case RELOC_LONG_BRANCH: {
guint16 *v = (guint16 *) &offset;
- g_assert (td.new_code [reloc->offset + 1] == 0xbeef);
- g_assert (td.new_code [reloc->offset + 2] == 0xdead);
- td.new_code [reloc->offset + 1] = *(guint16 *) v;
- td.new_code [reloc->offset + 2] = *(guint16 *) (v + 1);
+ g_assert (td->new_code [reloc->offset + 1] == 0xbeef);
+ g_assert (td->new_code [reloc->offset + 2] == 0xdead);
+ td->new_code [reloc->offset + 1] = *(guint16 *) v;
+ td->new_code [reloc->offset + 2] = *(guint16 *) (v + 1);
break;
}
case RELOC_SWITCH: {
guint16 *v = (guint16*)&offset;
- td.new_code [reloc->offset] = *(guint16*)v;
- td.new_code [reloc->offset + 1] = *(guint16*)(v + 1);
+ td->new_code [reloc->offset] = *(guint16*)v;
+ td->new_code [reloc->offset + 1] = *(guint16*)(v + 1);
break;
}
default:
}
}
- if (td.verbose_level) {
- const guint16 *p = td.new_code;
- printf("Runtime method: %s %p, VT stack size: %d\n", mono_method_full_name (method, TRUE), rtm, td.max_vt_sp);
- printf("Calculated stack size: %d, stated size: %d\n", td.max_stack_height, header->max_stack);
- while (p < td.new_ip) {
- p = mono_interp_dis_mintop(td.new_code, p);
+ if (td->verbose_level) {
+ const guint16 *p = td->new_code;
+ printf("Runtime method: %s %p, VT stack size: %d\n", mono_method_full_name (method, TRUE), rtm, td->max_vt_sp);
+ printf("Calculated stack size: %d, stated size: %d\n", td->max_stack_height, header->max_stack);
+ while (p < td->new_ip) {
+ p = mono_interp_dis_mintop(td->new_code, p);
printf("\n");
}
}
- g_assert (td.max_stack_height <= (header->max_stack + 1));
+ g_assert (td->max_stack_height <= (header->max_stack + 1));
- int code_len = td.new_ip - td.new_code;
+ int code_len = td->new_ip - td->new_code;
rtm->clauses = mono_domain_alloc0 (domain, header->num_clauses * sizeof (MonoExceptionClause));
memcpy (rtm->clauses, header->clauses, header->num_clauses * sizeof(MonoExceptionClause));
- rtm->code = mono_domain_alloc0 (domain, (td.new_ip - td.new_code) * sizeof (gushort));
- memcpy (rtm->code, td.new_code, (td.new_ip - td.new_code) * sizeof(gushort));
- g_free (td.new_code);
+ rtm->code = mono_domain_alloc0 (domain, (td->new_ip - td->new_code) * sizeof (gushort));
+ memcpy (rtm->code, td->new_code, (td->new_ip - td->new_code) * sizeof(gushort));
+ g_free (td->new_code);
rtm->new_body_start = rtm->code + body_start_offset;
rtm->num_clauses = header->num_clauses;
for (i = 0; i < header->num_clauses; i++) {
MonoExceptionClause *c = rtm->clauses + i;
int end_off = c->try_offset + c->try_len;
- c->try_offset = td.in_offsets [c->try_offset];
- c->try_len = td.in_offsets [end_off] - c->try_offset;
+ c->try_offset = td->in_offsets [c->try_offset];
+ c->try_len = td->in_offsets [end_off] - c->try_offset;
end_off = c->handler_offset + c->handler_len;
- c->handler_offset = td.in_offsets [c->handler_offset];
- c->handler_len = td.in_offsets [end_off] - c->handler_offset;
+ c->handler_offset = td->in_offsets [c->handler_offset];
+ c->handler_len = td->in_offsets [end_off] - c->handler_offset;
if (c->flags & MONO_EXCEPTION_CLAUSE_FILTER)
- c->data.filter_offset = td.in_offsets [c->data.filter_offset];
+ c->data.filter_offset = td->in_offsets [c->data.filter_offset];
}
- rtm->vt_stack_size = td.max_vt_sp;
+ rtm->vt_stack_size = td->max_vt_sp;
rtm->alloca_size = rtm->locals_size + rtm->args_size + rtm->vt_stack_size + rtm->stack_size;
- rtm->data_items = mono_domain_alloc0 (domain, td.n_data_items * sizeof (td.data_items [0]));
- memcpy (rtm->data_items, td.data_items, td.n_data_items * sizeof (td.data_items [0]));
+ rtm->data_items = mono_domain_alloc0 (domain, td->n_data_items * sizeof (td->data_items [0]));
+ memcpy (rtm->data_items, td->data_items, td->n_data_items * sizeof (td->data_items [0]));
/* Save debug info */
- interp_save_debug_info (rtm, header, &td, line_numbers);
+ interp_save_debug_info (rtm, header, td, line_numbers);
/* Create a MonoJitInfo for the interpreted method by creating the interpreter IR as the native code. */
int jinfo_len = mono_jit_info_size (0, header->num_clauses, 0);
}
}
- save_seq_points (&td);
+ save_seq_points (td);
- g_free (td.in_offsets);
+ g_free (td->in_offsets);
for (i = 0; i < header->code_size; ++i)
- g_free (td.stack_state [i]);
- g_free (td.stack_state);
- g_free (td.stack_height);
- g_free (td.vt_stack_size);
- g_free (td.data_items);
- g_free (td.stack);
- g_hash_table_destroy (td.data_hash);
- g_free (td.clause_indexes);
- g_ptr_array_free (td.seq_points, TRUE);
+ g_free (td->stack_state [i]);
+ g_free (td->stack_state);
+ g_free (td->stack_height);
+ g_free (td->vt_stack_size);
+ g_free (td->data_items);
+ g_free (td->stack);
+ g_hash_table_destroy (td->data_hash);
+ g_free (td->clause_indexes);
+ g_ptr_array_free (td->seq_points, TRUE);
g_array_free (line_numbers, TRUE);
- g_ptr_array_free (td.relocs, TRUE);
- mono_mempool_destroy (td.mempool);
+ g_ptr_array_free (td->relocs, TRUE);
+ mono_mempool_destroy (td->mempool);
}
static mono_mutex_t calc_section;
}
MonoException *
-mono_interp_transform_method (RuntimeMethod *runtime_method, ThreadContext *context)
+mono_interp_transform_method (InterpMethod *imethod, ThreadContext *context)
{
int i, align, size, offset;
- MonoMethod *method = runtime_method->method;
+ MonoMethod *method = imethod->method;
MonoImage *image = method->klass->image;
MonoMethodHeader *header = mono_method_get_header (method);
MonoMethodSignature *signature = mono_method_signature (method);
MonoVTable *method_class_vt;
int backwards;
MonoGenericContext *generic_context = NULL;
- MonoDomain *domain = runtime_method->domain;
+ MonoDomain *domain = imethod->domain;
// g_printerr ("TRANSFORM(0x%016lx): begin %s::%s\n", mono_thread_current (), method->klass->name, method->name);
- method_class_vt = mono_class_vtable (domain, runtime_method->method->klass);
+ method_class_vt = mono_class_vtable (domain, imethod->method->klass);
if (!method_class_vt->initialized) {
MonoError error;
jmp_buf env;
- MonoInvocation *last_env_frame = context->env_frame;
+ InterpFrame *last_env_frame = context->env_frame;
jmp_buf *old_env = context->current_env;
error_init (&error);
if (method->iflags & (METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL | METHOD_IMPL_ATTRIBUTE_RUNTIME)) {
MonoMethod *nm = NULL;
mono_os_mutex_lock(&calc_section);
- if (runtime_method->transformed) {
+ if (imethod->transformed) {
mono_os_mutex_unlock(&calc_section);
- MONO_PROFILER_RAISE (jit_done, (method, runtime_method->jinfo));
+ MONO_PROFILER_RAISE (jit_done, (method, imethod->jinfo));
return NULL;
}
}
}
if (nm == NULL) {
- runtime_method->code = g_malloc(sizeof(short));
- runtime_method->code[0] = MINT_CALLRUN;
+ imethod->code = g_malloc(sizeof(short));
+ imethod->code[0] = MINT_CALLRUN;
}
}
if (nm == NULL) {
- runtime_method->stack_size = sizeof (stackval); /* for tracing */
- runtime_method->alloca_size = runtime_method->stack_size;
- runtime_method->transformed = TRUE;
+ imethod->stack_size = sizeof (stackval); /* for tracing */
+ imethod->alloca_size = imethod->stack_size;
+ imethod->transformed = TRUE;
mono_os_mutex_unlock(&calc_section);
MONO_PROFILER_RAISE (jit_done, (method, NULL));
return NULL;
} else if (method->klass == mono_defaults.array_class) {
if (!strcmp (method->name, "UnsafeMov") || !strcmp (method->name, "UnsafeLoad")) {
mono_os_mutex_lock (&calc_section);
- if (!runtime_method->transformed) {
- runtime_method->code = g_malloc (sizeof (short));
- runtime_method->code[0] = MINT_CALLRUN;
- runtime_method->stack_size = sizeof (stackval); /* for tracing */
- runtime_method->alloca_size = runtime_method->stack_size;
- runtime_method->transformed = TRUE;
+ if (!imethod->transformed) {
+ imethod->code = g_malloc (sizeof (short));
+ imethod->code[0] = MINT_CALLRUN;
+ imethod->stack_size = sizeof (stackval); /* for tracing */
+ imethod->alloca_size = imethod->stack_size;
+ imethod->transformed = TRUE;
}
mono_os_mutex_unlock(&calc_section);
MONO_PROFILER_RAISE (jit_done, (method, NULL));
/* the rest needs to be locked so it is only done once */
mono_os_mutex_lock(&calc_section);
- if (runtime_method->transformed) {
+ if (imethod->transformed) {
mono_os_mutex_unlock(&calc_section);
g_free (is_bb_start);
- MONO_PROFILER_RAISE (jit_done, (method, runtime_method->jinfo));
+ MONO_PROFILER_RAISE (jit_done, (method, imethod->jinfo));
return NULL;
}
- runtime_method->local_offsets = g_malloc (header->num_locals * sizeof(guint32));
- runtime_method->stack_size = (sizeof (stackval)) * (header->max_stack + 2); /* + 1 for returns of called functions + 1 for 0-ing in trace*/
- runtime_method->stack_size = (runtime_method->stack_size + 7) & ~7;
+ imethod->local_offsets = g_malloc (header->num_locals * sizeof(guint32));
+ imethod->stack_size = (sizeof (stackval)) * (header->max_stack + 2); /* + 1 for returns of called functions + 1 for 0-ing in trace*/
+ imethod->stack_size = (imethod->stack_size + 7) & ~7;
offset = 0;
for (i = 0; i < header->num_locals; ++i) {
size = mono_type_size (header->locals [i], &align);
offset += align - 1;
offset &= ~(align - 1);
- runtime_method->local_offsets [i] = offset;
+ imethod->local_offsets [i] = offset;
offset += size;
}
offset = (offset + 7) & ~7;
- runtime_method->exvar_offsets = g_malloc (header->num_clauses * sizeof (guint32));
+ imethod->exvar_offsets = g_malloc (header->num_clauses * sizeof (guint32));
for (i = 0; i < header->num_clauses; i++) {
offset += sizeof (MonoObject*);
- runtime_method->exvar_offsets [i] = offset;
+ imethod->exvar_offsets [i] = offset;
}
offset = (offset + 7) & ~7;
- runtime_method->locals_size = offset;
- g_assert (runtime_method->locals_size < 65536);
+ imethod->locals_size = offset;
+ g_assert (imethod->locals_size < 65536);
offset = 0;
- runtime_method->arg_offsets = g_malloc ((!!signature->hasthis + signature->param_count) * sizeof(guint32));
+ imethod->arg_offsets = g_malloc ((!!signature->hasthis + signature->param_count) * sizeof(guint32));
if (signature->hasthis) {
g_assert (!signature->pinvoke);
size = mono_type_stack_size (&method->klass->byval_arg, &align);
offset += align - 1;
offset &= ~(align - 1);
- runtime_method->arg_offsets [0] = offset;
+ imethod->arg_offsets [0] = offset;
offset += size;
}
size = mono_type_stack_size (signature->params [i], &align);
offset += align - 1;
offset &= ~(align - 1);
- runtime_method->arg_offsets [i + !!signature->hasthis] = offset;
+ imethod->arg_offsets [i + !!signature->hasthis] = offset;
offset += size;
}
offset = (offset + 7) & ~7;
- runtime_method->args_size = offset;
- g_assert (runtime_method->args_size < 10000);
+ imethod->args_size = offset;
+ g_assert (imethod->args_size < 10000);
- generate (method, runtime_method, is_bb_start, generic_context);
+ generate (method, imethod, is_bb_start, generic_context);
g_free (is_bb_start);
// FIXME: Add a different callback ?
- MONO_PROFILER_RAISE (jit_done, (method, runtime_method->jinfo));
- runtime_method->transformed = TRUE;
+ MONO_PROFILER_RAISE (jit_done, (method, imethod->jinfo));
+ imethod->transformed = TRUE;
mono_os_mutex_unlock(&calc_section);
return NULL;
MONO_API void
mono_jit_set_aot_mode (MonoAotMode mode);
+/*
+ * Returns whether the runtime was invoked for the purpose of AOT-compiling an
+ * assembly, i.e. no managed code will run.
+ */
+MONO_API mono_bool
+mono_jit_aot_compiling (void);
+
/* Allow embedders to decide wherther to actually obey breakpoint instructions
* in specific methods (works for both break IL instructions and Debugger.Break ()
* method calls).
MONO_API char* mono_get_runtime_build_info (void);
-/* The following APIs are not stable. Avoid if possible. */
-
-MONO_API MonoJitInfo *
-mono_get_jit_info_from_method (MonoDomain *domain, MonoMethod *method);
-
-MONO_API MONO_RT_EXTERNAL_ONLY void *
-mono_aot_get_method (MonoDomain *domain, MonoMethod *method);
-
MONO_END_DECLS
#endif
EMIT_NEW_STORE_MEMBASE (cfg, ins, OP_STORE_MEMBASE_REG, lmf_addr_reg, 0, prev_lmf_reg);
}
-static void
-emit_instrumentation_call (MonoCompile *cfg, void *func, gboolean entry)
-{
- MonoInst *iargs [1];
-
- /*
- * Avoid instrumenting inlined methods since it can
- * distort profiling results.
- */
- if (cfg->method != cfg->current_method)
- return;
-
- if (mono_profiler_should_instrument_method (cfg->method, entry)) {
- EMIT_NEW_METHODCONST (cfg, iargs [0], cfg->method);
- mono_emit_jit_icall (cfg, func, iargs);
- }
-}
-
static int
ret_type_to_call_opcode (MonoCompile *cfg, MonoType *type, int calli, int virt)
{
inline static MonoCallInst *
mono_emit_call_args (MonoCompile *cfg, MonoMethodSignature *sig,
- MonoInst **args, int calli, int virtual_, int tail, int rgctx, int unbox_trampoline)
+ MonoInst **args, int calli, int virtual_, int tail, int rgctx, int unbox_trampoline, MonoMethod *target)
{
MonoType *sig_ret;
MonoCallInst *call;
tail = FALSE;
if (tail) {
- emit_instrumentation_call (cfg, mono_profiler_raise_method_leave, FALSE);
+ mini_profiler_emit_tail_call (cfg, target);
MONO_INST_NEW_CALL (cfg, call, OP_TAILCALL);
} else
MONO_ADD_INS (cfg->cbb, ins);
}
- call = mono_emit_call_args (cfg, sig, args, TRUE, FALSE, FALSE, rgctx_arg ? TRUE : FALSE, FALSE);
+ call = mono_emit_call_args (cfg, sig, args, TRUE, FALSE, FALSE, rgctx_arg ? TRUE : FALSE, FALSE, NULL);
call->inst.sreg1 = addr->dreg;
need_unbox_trampoline = method->klass == mono_defaults.object_class || mono_class_is_interface (method->klass);
- call = mono_emit_call_args (cfg, sig, args, FALSE, virtual_, tail, rgctx_arg ? TRUE : FALSE, need_unbox_trampoline);
+ call = mono_emit_call_args (cfg, sig, args, FALSE, virtual_, tail, rgctx_arg ? TRUE : FALSE, need_unbox_trampoline, method);
#ifndef DISABLE_REMOTING
if (might_be_remote)
g_assert (sig);
- call = mono_emit_call_args (cfg, sig, args, FALSE, FALSE, FALSE, FALSE, FALSE);
+ call = mono_emit_call_args (cfg, sig, args, FALSE, FALSE, FALSE, FALSE, FALSE, NULL);
call->fptr = func;
MONO_ADD_INS (cfg->cbb, (MonoInst*)call);
/* This happens often in argument checking code, eg. throw new FooException... */
/* Avoid relocations and save some space by calling a helper function specialized to mscorlib */
EMIT_NEW_ICONST (cfg, iargs [0], mono_metadata_token_index (klass->type_token));
- return mono_emit_jit_icall (cfg, mono_helper_newobj_mscorlib, iargs);
+ alloc_ftn = mono_helper_newobj_mscorlib;
} else {
MonoVTable *vtable = mono_class_vtable (cfg->domain, klass);
MonoMethod *managed_alloc = NULL;
- gboolean pass_lw;
if (!vtable) {
mono_cfg_set_exception (cfg, MONO_EXCEPTION_TYPE_LOAD);
EMIT_NEW_ICONST (cfg, iargs [1], size);
return mono_emit_method_call (cfg, managed_alloc, iargs, NULL);
}
- alloc_ftn = mono_class_get_allocation_ftn (vtable, for_box, &pass_lw);
- if (pass_lw) {
- guint32 lw = vtable->klass->instance_size;
- lw = ((lw + (sizeof (gpointer) - 1)) & ~(sizeof (gpointer) - 1)) / sizeof (gpointer);
- EMIT_NEW_ICONST (cfg, iargs [0], lw);
- EMIT_NEW_VTABLECONST (cfg, iargs [1], vtable);
- }
- else {
- EMIT_NEW_VTABLECONST (cfg, iargs [0], vtable);
- }
+ alloc_ftn = ves_icall_object_new_specific;
+ EMIT_NEW_VTABLECONST (cfg, iargs [0], vtable);
}
return mono_emit_jit_icall (cfg, alloc_ftn, iargs);
if (g_list_find (cfg->dont_inline, method))
return FALSE;
+ if (mono_profiler_get_call_instrumentation_flags (method))
+ return FALSE;
+
return TRUE;
}
tblock->real_offset = clause->handler_offset;
tblock->flags |= BB_EXCEPTION_HANDLER;
+ if (clause->flags == MONO_EXCEPTION_CLAUSE_FINALLY)
+ mono_create_exvar_for_offset (cfg, clause->handler_offset);
/*
* Linking the try block with the EH block hinders inlining as we won't be able to
* merge the bblocks from inlining and produce an artificial hole for no good reason.
if (cfg->gshared && mono_method_check_context_used (cmethod))
GENERIC_SHARING_FAILURE (CEE_JMP);
- emit_instrumentation_call (cfg, mono_profiler_raise_method_leave, FALSE);
+ mini_profiler_emit_tail_call (cfg, cmethod);
fsig = mono_method_signature (cmethod);
n = fsig->param_count + fsig->hasthis;
/* Handle tail calls similarly to normal calls */
tail_call = TRUE;
} else {
- emit_instrumentation_call (cfg, mono_profiler_raise_method_leave, FALSE);
+ mini_profiler_emit_tail_call (cfg, cmethod);
MONO_INST_NEW_CALL (cfg, call, OP_JMP);
call->tail_call = TRUE;
break;
}
case CEE_RET:
+ mini_profiler_emit_leave (cfg, sig->ret->type != MONO_TYPE_VOID ? sp [-1] : NULL);
+
if (cfg->method != method) {
/* return from inlined method */
/*
cfg->ret_var_set = TRUE;
}
} else {
- emit_instrumentation_call (cfg, mono_profiler_raise_method_leave, FALSE);
-
if (cfg->lmf_var && cfg->cbb->in_count && !cfg->llvm_only)
emit_pop_lmf (cfg);
if ((handlers = mono_find_final_block (cfg, ip, target, MONO_EXCEPTION_CLAUSE_FINALLY))) {
GList *tmp;
- MonoExceptionClause *clause;
for (tmp = handlers; tmp; tmp = tmp->next) {
- clause = (MonoExceptionClause *)tmp->data;
+ MonoExceptionClause *clause = (MonoExceptionClause *)tmp->data;
+ MonoInst *abort_exc = (MonoInst *)mono_find_exvar_for_offset (cfg, clause->handler_offset);
+ MonoBasicBlock *dont_throw;
+
tblock = cfg->cil_offset_to_bb [clause->handler_offset];
g_assert (tblock);
link_bblock (cfg, cfg->cbb, tblock);
+
+ MONO_EMIT_NEW_PCONST (cfg, abort_exc->dreg, 0);
+
MONO_INST_NEW (cfg, ins, OP_CALL_HANDLER);
ins->inst_target_bb = tblock;
ins->inst_eh_block = clause;
MONO_ADD_INS (cfg->cbb, ins);
cfg->cbb->has_call_handler = 1;
+
+ /* Throw exception if exvar is set */
+ /* FIXME Do we need this for calls from catch/filter ? */
+ NEW_BBLOCK (cfg, dont_throw);
+ MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, abort_exc->dreg, 0);
+ MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_PBEQ, dont_throw);
+ mono_emit_jit_icall (cfg, mono_thread_self_abort, NULL);
+ cfg->cbb->clause_hole = clause;
+
+ MONO_START_BB (cfg, dont_throw);
+ cfg->cbb->clause_hole = clause;
+
if (COMPILE_LLVM (cfg)) {
MonoBasicBlock *target_bb;
}
cfg->cbb = init_localsbb;
- emit_instrumentation_call (cfg, mono_profiler_raise_method_enter, TRUE);
+ mini_profiler_emit_enter (cfg);
if (seq_points) {
MonoBasicBlock *bb;
mono_aot_register_jit_icall ("mono_amd64_throw_corlib_exception", mono_amd64_throw_corlib_exception);
mono_aot_register_jit_icall ("mono_amd64_resume_unwind", mono_amd64_resume_unwind);
mono_aot_register_jit_icall ("mono_amd64_get_original_ip", mono_amd64_get_original_ip);
- mono_aot_register_jit_icall ("mono_amd64_handler_block_trampoline_helper", mono_amd64_handler_block_trampoline_helper);
#if defined(MONO_ARCH_GSHAREDVT_SUPPORTED)
mono_aot_register_jit_icall ("mono_amd64_start_gsharedvt_call", mono_amd64_start_gsharedvt_call);
case OP_GET_LAST_ERROR:
emit_get_last_error(code, ins->dreg);
break;
+ case OP_FILL_PROF_CALL_CTX:
+ for (int i = 0; i < AMD64_NREG; i++)
+ if (AMD64_IS_CALLEE_SAVED_REG (i) || i == AMD64_RSP)
+ amd64_mov_membase_reg (code, ins->sreg1, MONO_STRUCT_OFFSET (MonoContext, gregs) + i * sizeof (mgreg_t), i, sizeof (mgreg_t));
+ break;
default:
g_warning ("unknown opcode %s in %s()\n", mono_inst_name (ins->opcode), __FUNCTION__);
g_assert_not_reached ();
}
#endif
-gboolean
-mono_arch_print_tree (MonoInst *tree, int arity)
-{
- return 0;
-}
-
mgreg_t
mono_arch_context_get_int_reg (MonoContext *ctx, int reg)
{
ctx->gregs [reg] = val;
}
-gpointer
-mono_arch_install_handler_block_guard (MonoJitInfo *ji, MonoJitExceptionInfo *clause, MonoContext *ctx, gpointer new_value)
-{
- gpointer *sp, old_value;
- char *bp;
-
- /*Load the spvar*/
- bp = (char *)MONO_CONTEXT_GET_BP (ctx);
- sp = (gpointer *)*(gpointer*)(bp + clause->exvar_offset);
-
- old_value = *sp;
- if (old_value < ji->code_start || (char*)old_value > ((char*)ji->code_start + ji->code_size))
- return old_value;
-
- *sp = new_value;
-
- return old_value;
-}
-
/*
* mono_arch_emit_load_aotconst:
*
#define MONO_ARCH_DYN_CALL_PARAM_AREA (DYN_CALL_STACK_ARGS * 8)
#define MONO_ARCH_LLVM_SUPPORTED 1
-#define MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD 1
-#define MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD_AOT 1
#define MONO_ARCH_HAVE_CARD_TABLE_WBARRIER 1
#define MONO_ARCH_HAVE_SETUP_RESUME_FROM_SIGNAL_HANDLER_CTX 1
#define MONO_ARCH_GC_MAPS_SUPPORTED 1
int
mono_amd64_get_tls_gs_offset (void) MONO_LLVM_INTERNAL;
-gpointer
-mono_amd64_handler_block_trampoline_helper (void);
-
#if defined(TARGET_WIN32) && !defined(DISABLE_JIT)
#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
mono_aot_register_jit_icall ("mono_arm_start_gsharedvt_call", mono_arm_start_gsharedvt_call);
#endif
mono_aot_register_jit_icall ("mono_arm_unaligned_stack", mono_arm_unaligned_stack);
- mono_aot_register_jit_icall ("mono_arm_handler_block_trampoline_helper", mono_arm_handler_block_trampoline_helper);
#if defined(__ARM_EABI__)
eabi_supported = TRUE;
#endif
arm_patch (buf [0], code);
break;
}
-
+ case OP_FILL_PROF_CALL_CTX:
+ for (int i = 0; i < ARMREG_MAX; i++)
+ if ((MONO_ARCH_CALLEE_SAVED_REGS & (1 << i)) || i == ARMREG_SP || i == ARMREG_FP)
+ ARM_STR_IMM (code, i, ins->sreg1, MONO_STRUCT_OFFSET (MonoContext, regs) + i * sizeof (mgreg_t));
+ break;
default:
g_warning ("unknown opcode %s in %s()\n", mono_inst_name (ins->opcode), __FUNCTION__);
g_assert_not_reached ();
return NULL;
}
-gboolean
-mono_arch_print_tree (MonoInst *tree, int arity)
-{
- return 0;
-}
-
#ifndef DISABLE_JIT
#endif
return mono_arm_get_exception_trampolines (aot);
}
-gpointer
-mono_arch_install_handler_block_guard (MonoJitInfo *ji, MonoJitExceptionInfo *clause, MonoContext *ctx, gpointer new_value)
-{
- gpointer *lr_loc;
- char *old_value;
- char *bp;
-
- /*Load the spvar*/
- bp = MONO_CONTEXT_GET_BP (ctx);
- lr_loc = (gpointer*)(bp + clause->exvar_offset);
-
- old_value = *lr_loc;
- if ((char*)old_value < (char*)ji->code_start || (char*)old_value > ((char*)ji->code_start + ji->code_size))
- return old_value;
-
- *lr_loc = new_value;
-
- return old_value;
-}
-
#if defined(MONO_ARCH_SOFT_DEBUG_SUPPORTED)
/*
* mono_arch_set_breakpoint:
#define MONO_ARCH_GC_MAPS_SUPPORTED 1
#define MONO_ARCH_HAVE_SETUP_ASYNC_CALLBACK 1
#define MONO_ARCH_HAVE_CONTEXT_SET_INT_REG 1
-#define MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD 1
-#ifndef TARGET_IOS
-#define MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD_AOT 1
-#endif
#define MONO_ARCH_HAVE_SETUP_RESUME_FROM_SIGNAL_HANDLER_CTX 1
#define MONO_ARCH_GSHAREDVT_SUPPORTED 1
#define MONO_ARCH_HAVE_GENERAL_RGCTX_LAZY_FETCH_TRAMPOLINE 1
void
mono_arm_unaligned_stack (MonoMethod *method);
-gpointer
-mono_arm_handler_block_trampoline_helper (gpointer *ptr);
-
/* MonoJumpInfo **ji */
guint8*
mono_arm_emit_aotconst (gpointer ji, guint8 *code, guint8 *buf, int dreg, int patch_type, gconstpointer data);
{
mono_aot_register_jit_icall ("mono_arm_throw_exception", mono_arm_throw_exception);
mono_aot_register_jit_icall ("mono_arm_resume_unwind", mono_arm_resume_unwind);
- mono_aot_register_jit_icall ("mono_arm_handler_block_trampoline_helper", mono_arm_handler_block_trampoline_helper);
if (!mono_aot_only)
bp_trampoline = mini_get_breakpoint_trampoline ();
#endif
break;
}
-
+ case OP_FILL_PROF_CALL_CTX:
+ for (int i = 0; i < MONO_MAX_IREGS; i++)
+ if ((MONO_ARCH_CALLEE_SAVED_REGS & (1 << i)) || i == ARMREG_SP || i == ARMREG_FP)
+ arm_strx (code, i, ins->sreg1, MONO_STRUCT_OFFSET (MonoContext, regs) + i * sizeof (mgreg_t));
+ break;
default:
g_warning ("unknown opcode %s in %s()\n", mono_inst_name (ins->opcode), __FUNCTION__);
g_assert_not_reached ();
return NULL;
}
-gboolean
-mono_arch_print_tree (MonoInst *tree, int arity)
-{
- return FALSE;
-}
-
guint32
mono_arch_get_patch_offset (guint8 *code)
{
return get_call_info (mp, sig);
}
-gpointer
-mono_arch_install_handler_block_guard (MonoJitInfo *ji, MonoJitExceptionInfo *clause, MonoContext *ctx, gpointer new_value)
-{
- gpointer *lr_loc;
- char *old_value;
- char *bp;
-
- /*Load the spvar*/
- bp = MONO_CONTEXT_GET_BP (ctx);
- lr_loc = (gpointer*)(bp + clause->exvar_offset);
-
- old_value = *lr_loc;
- if ((char*)old_value < (char*)ji->code_start || (char*)old_value > ((char*)ji->code_start + ji->code_size))
- return old_value;
-
- *lr_loc = new_value;
-
- return old_value;
-}
#define MONO_ARCH_HAVE_OP_GENERIC_CLASS_INIT 1
#define MONO_ARCH_HAVE_OPCODE_NEEDS_EMULATION 1
#define MONO_ARCH_HAVE_DECOMPOSE_LONG_OPTS 1
-#define MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD 1
#define MONO_ARCH_HAVE_INIT_LMF_EXT 1
-#ifndef TARGET_IOS
-#define MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD_AOT 1
-#endif
#ifdef TARGET_IOS
void mono_arm_resume_unwind (gpointer arg, mgreg_t pc, mgreg_t *int_regs, gdouble *fp_regs, gboolean corlib, gboolean rethrow);
-gpointer mono_arm_handler_block_trampoline_helper (gpointer *ptr);
-
CallInfo* mono_arch_get_call_info (MonoMemPool *mp, MonoMethodSignature *sig);
#endif /* __MONO_MINI_ARM64_H__ */
static void mono_raise_exception_with_ctx (MonoException *exc, MonoContext *ctx);
static void mono_runtime_walk_stack_with_ctx (MonoJitStackWalk func, MonoContext *start_ctx, MonoUnwindOptions unwind_options, void *user_data);
static gboolean mono_current_thread_has_handle_block_guard (void);
+static gboolean mono_install_handler_block_guard (MonoThreadUnwindState *ctx);
static gboolean
first_managed (MonoStackFrameInfo *frame, MonoContext *ctx, gpointer addr)
for (i = 0; i < table->num_holes; ++i) {
MonoTryBlockHoleJitInfo *hole = &table->holes [i];
- if (hole->clause == clause && hole->offset <= offset && hole->offset + hole->length > offset)
+ if (ji->clauses [hole->clause].try_offset == ji->clauses [clause].try_offset && hole->offset <= offset && hole->offset + hole->length > offset)
return FALSE;
}
return TRUE;
* that was called by the EH machinery. It won't have a guard trampoline installed, so we must
* check for this situation here and resume interruption if we are below the guarded block.
*/
- if (G_UNLIKELY (jit_tls->handler_block_return_address)) {
+ if (G_UNLIKELY (jit_tls->handler_block)) {
gboolean is_outside = FALSE;
gpointer prot_bp = MONO_CONTEXT_GET_BP (&jit_tls->handler_block_context);
gpointer catch_bp = MONO_CONTEXT_GET_BP (ctx);
//FIXME make this stack direction aware
+
if (catch_bp > prot_bp) {
is_outside = TRUE;
} else if (catch_bp == prot_bp) {
}
}
if (is_outside) {
- jit_tls->handler_block_return_address = NULL;
jit_tls->handler_block = NULL;
mono_thread_resume_interruption (TRUE); /*We ignore the exception here, it will be raised later*/
}
jit_tls->orig_ex_ctx_set = TRUE;
MONO_PROFILER_RAISE (exception_clause, (method, i, ei->flags, ex_obj));
jit_tls->orig_ex_ctx_set = FALSE;
- mini_set_abort_threshold (ctx);
- call_filter (ctx, ei->handler_start);
}
if (ei->flags == MONO_EXCEPTION_CLAUSE_FINALLY) {
if (mono_trace_is_enabled () && mono_trace_eval (method))
#ifndef DISABLE_PERFCOUNTERS
mono_perfcounters->exceptions_finallys++;
#endif
+ }
+ if (ei->flags == MONO_EXCEPTION_CLAUSE_FAULT || ei->flags == MONO_EXCEPTION_CLAUSE_FINALLY) {
mono_set_lmf (lmf);
if (ji->from_llvm) {
/*
}
}
- jit_tls->orig_ex_ctx_set = TRUE;
- MONO_PROFILER_RAISE (method_exception_leave, (method, ex_obj));
- jit_tls->orig_ex_ctx_set = FALSE;
+ if (MONO_PROFILER_ENABLED (method_exception_leave) &&
+ mono_profiler_get_call_instrumentation_flags (method) & MONO_PROFILER_CALL_INSTRUMENTATION_EXCEPTION_LEAVE) {
+ jit_tls->orig_ex_ctx_set = TRUE;
+ MONO_PROFILER_RAISE (method_exception_leave, (method, ex_obj));
+ jit_tls->orig_ex_ctx_set = FALSE;
+ }
*ctx = new_ctx;
}
mono_restore_context (&new_ctx);
}
-#ifdef MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD
-
typedef struct {
MonoJitInfo *ji;
MonoContext ctx;
continue;
/*If ip points to the first instruction it means the handler block didn't start
so we can leave its execution to the EH machinery*/
- if (ei->handler_start < ip && ip < ei->data.handler_end) {
+ if (ei->handler_start <= ip && ip < ei->data.handler_end) {
pdata->ji = ji;
pdata->ei = ei;
pdata->ctx = *ctx;
}
-static gpointer
+static void
install_handler_block_guard (MonoJitInfo *ji, MonoContext *ctx)
{
int i;
MonoJitExceptionInfo *clause = NULL;
gpointer ip;
+ guint8 *bp;
ip = MONO_CONTEXT_GET_IP (ctx);
clause = &ji->clauses [i];
if (clause->flags != MONO_EXCEPTION_CLAUSE_FINALLY)
continue;
- if (clause->handler_start < ip && clause->data.handler_end > ip)
+ if (clause->handler_start <= ip && clause->data.handler_end > ip)
break;
}
/*no matching finally */
if (i == ji->num_clauses)
- return NULL;
-
- /*If we stopped on the instruction right before the try, we haven't actually started executing it*/
- if (ip == clause->handler_start)
- return NULL;
+ return;
- return mono_arch_install_handler_block_guard (ji, clause, ctx, mono_create_handler_block_trampoline ());
+ /*Load the spvar*/
+ bp = (guint8*)MONO_CONTEXT_GET_BP (ctx);
+ *(bp + clause->exvar_offset) = 1;
}
/*
* Finds the bottom handler block running and install a block guard if needed.
*/
-gboolean
+static gboolean
mono_install_handler_block_guard (MonoThreadUnwindState *ctx)
{
FindHandlerBlockData data = { 0 };
MonoJitTlsData *jit_tls = (MonoJitTlsData *)ctx->unwind_data [MONO_UNWIND_DATA_JIT_TLS];
- gpointer resume_ip;
-
-#ifndef MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD_AOT
- if (mono_aot_only)
- return FALSE;
-#endif
/* Guard against a null MonoJitTlsData. This can happens if the thread receives the
* interrupt signal before the JIT has time to initialize its TLS data for the given thread.
*/
- if (!jit_tls || jit_tls->handler_block_return_address)
+ if (!jit_tls || jit_tls->handler_block)
return FALSE;
/* Do an async safe stack walk */
memcpy (&jit_tls->handler_block_context, &data.ctx, sizeof (MonoContext));
- resume_ip = install_handler_block_guard (data.ji, &data.ctx);
- if (resume_ip == NULL)
- return FALSE;
+ install_handler_block_guard (data.ji, &data.ctx);
- jit_tls->handler_block_return_address = resume_ip;
jit_tls->handler_block = data.ei;
return TRUE;
mono_current_thread_has_handle_block_guard (void)
{
MonoJitTlsData *jit_tls = (MonoJitTlsData *)mono_tls_get_jit_tls ();
- return jit_tls && jit_tls->handler_block_return_address != NULL;
-}
-
-#else
-gboolean
-mono_install_handler_block_guard (MonoThreadUnwindState *ctx)
-{
- return FALSE;
+ return jit_tls && jit_tls->handler_block != NULL;
}
-static gboolean
-mono_current_thread_has_handle_block_guard (void)
-{
- return FALSE;
-}
-
-#endif
-
void
mono_set_cast_details (MonoClass *from, MonoClass *to)
{
void (*cleanup)(void);
void (*emit_method)(MonoCompile *cfg);
void (*emit_call)(MonoCompile *cfg, MonoCallInst *call);
- void (*create_aot_module)(MonoAssembly *assembly, const char *global_prefix, gboolean emit_dwarf, gboolean static_link, gboolean llvm_only);
+ void (*create_aot_module)(MonoAssembly *assembly, const char *global_prefix, int initial_got_size, gboolean emit_dwarf, gboolean static_link, gboolean llvm_only);
void (*emit_aot_module)(const char *filename, const char *cu_name);
void (*check_method_supported)(MonoCompile *cfg);
void (*emit_aot_file_info)(MonoAotFileInfo *info, gboolean has_jitted_code);
}
void
-mono_llvm_create_aot_module (MonoAssembly *assembly, const char *global_prefix, gboolean emit_dwarf, gboolean static_link, gboolean llvm_only)
+mono_llvm_create_aot_module (MonoAssembly *assembly, const char *global_prefix, int initial_got_size, gboolean emit_dwarf, gboolean static_link, gboolean llvm_only)
{
- backend.create_aot_module (assembly, global_prefix, emit_dwarf, static_link, llvm_only);
+ backend.create_aot_module (assembly, global_prefix, initial_got_size, emit_dwarf, static_link, llvm_only);
}
void
clause = get_most_deep_clause (cfg, ctx, bb);
if (clause) {
- g_assert (clause->flags == MONO_EXCEPTION_CLAUSE_NONE || clause->flags == MONO_EXCEPTION_CLAUSE_FINALLY);
+ g_assert (clause->flags == MONO_EXCEPTION_CLAUSE_NONE || clause->flags == MONO_EXCEPTION_CLAUSE_FINALLY || clause->flags == MONO_EXCEPTION_CLAUSE_FAULT);
/*
* Have to use an invoke instead of a call, branching to the
* handler bblock of the clause containing this bblock.
*/
- g_assert (ec->flags == MONO_EXCEPTION_CLAUSE_NONE || ec->flags == MONO_EXCEPTION_CLAUSE_FINALLY);
+ g_assert (ec->flags == MONO_EXCEPTION_CLAUSE_NONE || ec->flags == MONO_EXCEPTION_CLAUSE_FINALLY || ec->flags == MONO_EXCEPTION_CLAUSE_FAULT);
tblock = cfg->cil_offset_to_bb [ec->handler_offset];
g_assert (tblock);
MonoExceptionClause *group_cursor = group_start;
for (int i = 0; i < group_size; i ++) {
- if (!(group_cursor->flags & MONO_EXCEPTION_CLAUSE_FINALLY))
+ if (!(group_cursor->flags & MONO_EXCEPTION_CLAUSE_FINALLY || group_cursor->flags & MONO_EXCEPTION_CLAUSE_FAULT))
finally_only = FALSE;
group_cursor++;
MonoExceptionClause *clause = &ctx->cfg->header->clauses [clause_index];
// Make exception available to catch blocks
- if (!(clause->flags & MONO_EXCEPTION_CLAUSE_FINALLY)) {
+ if (!(clause->flags & MONO_EXCEPTION_CLAUSE_FINALLY || clause->flags & MONO_EXCEPTION_CLAUSE_FAULT)) {
LLVMValueRef mono_exc = mono_llvm_emit_load_exception_call (ctx, ctx->builder);
g_assert (ctx->ex_var);
}
/* Start a new bblock which CALL_HANDLER can branch to */
- target_bb = bblocks [bb->block_num].call_handler_target_bb;
- if (target_bb) {
- ctx->builder = builder = create_builder (ctx);
- LLVMPositionBuilderAtEnd (ctx->builder, target_bb);
+ ctx->builder = builder = create_builder (ctx);
+ LLVMPositionBuilderAtEnd (ctx->builder, target_bb);
- ctx->bblocks [bb->block_num].end_bblock = target_bb;
+ ctx->bblocks [bb->block_num].end_bblock = target_bb;
- /* Store the exception into the IL level exvar */
- if (bb->in_scount == 1) {
- g_assert (bb->in_scount == 1);
- exvar = bb->in_stack [0];
+ /* Store the exception into the IL level exvar */
+ if (bb->in_scount == 1) {
+ g_assert (bb->in_scount == 1);
+ exvar = bb->in_stack [0];
- // FIXME: This is shared with filter clauses ?
- g_assert (!values [exvar->dreg]);
+ // FIXME: This is shared with filter clauses ?
+ g_assert (!values [exvar->dreg]);
- g_assert (ctx->ex_var);
- values [exvar->dreg] = LLVMBuildLoad (builder, ctx->ex_var, "");
- emit_volatile_store (ctx, exvar->dreg);
- }
+ g_assert (ctx->ex_var);
+ values [exvar->dreg] = LLVMBuildLoad (builder, ctx->ex_var, "");
+ emit_volatile_store (ctx, exvar->dreg);
}
+
+ /* Make normal branches to the start of the clause branch to the new bblock */
+ bblocks [bb->block_num].bblock = target_bb;
}
static void
LLVMValueRef val, switch_ins, callee;
GSList *bb_list;
BBInfo *info;
+ gboolean is_fault = MONO_REGION_FLAGS (bb->region) == MONO_EXCEPTION_CLAUSE_FAULT;
- handler_bb = (MonoBasicBlock*)g_hash_table_lookup (ctx->region_to_handler, GUINT_TO_POINTER (mono_get_block_region_notry (cfg, bb->region)));
- g_assert (handler_bb);
- info = &bblocks [handler_bb->block_num];
- lhs = info->finally_ind;
- g_assert (lhs);
+ /*
+ * Fault clauses are like finally clauses, but they are only called if an exception is thrown.
+ */
+ if (!is_fault) {
+ handler_bb = (MonoBasicBlock*)g_hash_table_lookup (ctx->region_to_handler, GUINT_TO_POINTER (mono_get_block_region_notry (cfg, bb->region)));
+ g_assert (handler_bb);
+ info = &bblocks [handler_bb->block_num];
+ lhs = info->finally_ind;
+ g_assert (lhs);
- bb_list = info->call_handler_return_bbs;
+ bb_list = info->call_handler_return_bbs;
- resume_bb = gen_bb (ctx, "ENDFINALLY_RESUME_BB");
+ resume_bb = gen_bb (ctx, "ENDFINALLY_RESUME_BB");
- /* Load the finally variable */
- val = LLVMBuildLoad (builder, lhs, "");
+ /* Load the finally variable */
+ val = LLVMBuildLoad (builder, lhs, "");
- /* Reset the variable */
- LLVMBuildStore (builder, LLVMConstInt (LLVMInt32Type (), 0, FALSE), lhs);
+ /* Reset the variable */
+ LLVMBuildStore (builder, LLVMConstInt (LLVMInt32Type (), 0, FALSE), lhs);
- /* Branch to either resume_bb, or to the bblocks in bb_list */
- switch_ins = LLVMBuildSwitch (builder, val, resume_bb, g_slist_length (bb_list));
- /*
- * The other targets are added at the end to handle OP_CALL_HANDLER
- * opcodes processed later.
- */
- info->endfinally_switch_ins_list = g_slist_append_mempool (cfg->mempool, info->endfinally_switch_ins_list, switch_ins);
+ /* Branch to either resume_bb, or to the bblocks in bb_list */
+ switch_ins = LLVMBuildSwitch (builder, val, resume_bb, g_slist_length (bb_list));
+ /*
+ * The other targets are added at the end to handle OP_CALL_HANDLER
+ * opcodes processed later.
+ */
+ info->endfinally_switch_ins_list = g_slist_append_mempool (cfg->mempool, info->endfinally_switch_ins_list, switch_ins);
- builder = ctx->builder = create_builder (ctx);
- LLVMPositionBuilderAtEnd (ctx->builder, resume_bb);
+ builder = ctx->builder = create_builder (ctx);
+ LLVMPositionBuilderAtEnd (ctx->builder, resume_bb);
+ }
if (ctx->llvm_only) {
emit_resume_eh (ctx, bb);
header = cfg->header;
for (i = 0; i < header->num_clauses; ++i) {
clause = &header->clauses [i];
- if (clause->flags != MONO_EXCEPTION_CLAUSE_FINALLY && clause->flags != MONO_EXCEPTION_CLAUSE_NONE) {
- set_failure (ctx, "non-finally/catch clause.");
+ if (clause->flags != MONO_EXCEPTION_CLAUSE_FINALLY && clause->flags != MONO_EXCEPTION_CLAUSE_FAULT && clause->flags != MONO_EXCEPTION_CLAUSE_NONE) {
+ set_failure (ctx, "non-finally/catch/fault clause.");
return;
}
}
}
}
- /*
- * The INDIRECT flag added by OP_LDADDR inhibits optimizations, even if the LDADDR
- * was later optimized away, so clear these flags, and add them back for the still
- * present OP_LDADDR instructions.
- */
- for (i = 0; i < cfg->next_vreg; ++i) {
- MonoInst *ins;
-
- ins = get_vreg_to_inst (cfg, i);
- if (ins && ins != cfg->rgctx_var)
- ins->flags &= ~MONO_INST_INDIRECT;
- }
-
/*
* Make a first pass over the code to precreate PHI nodes/set INDIRECT flags.
*/
}
void
-mono_llvm_create_aot_module (MonoAssembly *assembly, const char *global_prefix, gboolean emit_dwarf, gboolean static_link, gboolean llvm_only)
+mono_llvm_create_aot_module (MonoAssembly *assembly, const char *global_prefix, int initial_got_size, gboolean emit_dwarf, gboolean static_link, gboolean llvm_only)
{
MonoLLVMModule *module = &aot_module;
module->static_link = static_link;
module->llvm_only = llvm_only;
/* The first few entries are reserved */
- module->max_got_offset = 16;
+ module->max_got_offset = initial_got_size;
module->context = LLVMGetGlobalContext ();
if (llvm_only)
void mono_llvm_cleanup (void) MONO_LLVM_INTERNAL;
void mono_llvm_emit_method (MonoCompile *cfg) MONO_LLVM_INTERNAL;
void mono_llvm_emit_call (MonoCompile *cfg, MonoCallInst *call) MONO_LLVM_INTERNAL;
-void mono_llvm_create_aot_module (MonoAssembly *assembly, const char *global_prefix, gboolean emit_dwarf, gboolean static_link, gboolean llvm_only) MONO_LLVM_INTERNAL;
+void mono_llvm_create_aot_module (MonoAssembly *assembly, const char *global_prefix, int initial_got_size, gboolean emit_dwarf, gboolean static_link, gboolean llvm_only) MONO_LLVM_INTERNAL;
void mono_llvm_emit_aot_module (const char *filename, const char *cu_name) MONO_LLVM_INTERNAL;
void mono_llvm_emit_aot_file_info (MonoAotFileInfo *info, gboolean has_jitted_code) MONO_LLVM_INTERNAL;
void mono_llvm_emit_aot_data (const char *symbol, guint8 *data, int data_len) MONO_LLVM_INTERNAL;
return NULL;
}
-gboolean
-mono_arch_print_tree (MonoInst *tree, int arity)
-{
- return 0;
-}
-
mgreg_t
mono_arch_context_get_int_reg (MonoContext *ctx, int reg)
{
{ 2, STACK_R8, STACK_R8, STACK_R8, OP_FCONV_TO_R8, OP_FCONV_TO_R4, OP_FMOVE, 0, 0, OP_PT_STORE_FP_MEMBASE_REG, 0 },
};
-static inline gboolean mono_class_is_magic_int (MonoClass *klass);
-static inline gboolean mono_class_is_magic_float (MonoClass *klass);
-
static inline gboolean
type_size (MonoCompile *cfg, MonoType *type)
return TRUE;
if (!strcmp ("Xamarin.WatchOS", klass->image->assembly_name))
return TRUE;
+ /* regression test suite */
+ if (!strcmp ("builtin-types", klass->image->assembly_name))
+ return TRUE;
return FALSE;
}
-static inline gboolean
+gboolean
mono_class_is_magic_int (MonoClass *klass)
{
static MonoClass *magic_nint_class;
return FALSE;
}
-static inline gboolean
+gboolean
mono_class_is_magic_float (MonoClass *klass)
{
static MonoClass *magic_nfloat_class;
MINI_OP(OP_SET_SP, "set_sp", NONE, IREG, NONE)
MINI_OP(OP_GET_LAST_ERROR, "get_last_error", IREG, NONE, NONE)
+
+/*
+ * Fill out a MonoContext contained in a MonoProfilerCallContext. This only
+ * stores the stack pointer, frame pointer, and callee-saved registers. This
+ * should be enough to locate arguments and variables.
+ */
+MINI_OP(OP_FILL_PROF_CALL_CTX, "fill_prof_call_ctx", NONE, IREG, NONE)
mono_profiler_get_sample_mode (NULL, &mode, NULL);
if (mode == MONO_PROFILER_SAMPLE_MODE_NONE) {
- mono_profiler_sampling_thread_sleep ();
+ mono_profiler_sampling_thread_wait ();
+
+ if (!InterlockedRead (&sampling_thread_running))
+ goto done;
+
goto init;
}
clock_init (mode);
for (guint64 sleep = clock_get_time_ns (); InterlockedRead (&sampling_thread_running); clock_sleep_ns_abs (sleep)) {
- uint64_t freq;
+ uint32_t freq;
MonoProfilerSampleMode new_mode;
mono_profiler_get_sample_mode (NULL, &new_mode, &freq);
} FOREACH_THREAD_SAFE_END
}
- InterlockedWrite (&sampling_thread_exiting, 1);
-
clock_cleanup ();
+done:
+ InterlockedWrite (&sampling_thread_exiting, 1);
+
pthread_setschedparam (pthread_self (), old_policy, &old_sched);
mono_thread_info_detach ();
{
InterlockedWrite (&sampling_thread_running, 0);
+ mono_profiler_sampling_thread_post ();
+
#ifndef PLATFORM_MACOSX
/*
* There is a slight problem when we're using CLOCK_PROCESS_CPUTIME_ID: If
return NULL;
}
-gboolean
-mono_arch_print_tree (MonoInst *tree, int arity)
-{
- return 0;
-}
-
mgreg_t
mono_arch_context_get_int_reg (MonoContext *ctx, int reg)
{
}
}
-
-#if 0
-// FIXME: To get the test case finally_block_ending_in_dead_bb to work properly we need to define the following
-// (in mini-ppc.h) and then implement the fuction mono_arch_create_handler_block_trampoline.
-// #define MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD 1
-
-gpointer
-mono_arch_create_handler_block_trampoline (void)
-{
- . . .
-}
-#endif
#define MONO_ARCH_HAVE_DECOMPOSE_VTYPE_OPTS 1
#define MONO_ARCH_RETURN_CAN_USE_MULTIPLE_REGISTERS 1
-// FIXME: To get the test case finally_block_ending_in_dead_bb to work properly define the following
-// and then implement the fuction mono_arch_create_handler_block_trampoline.
-// #define MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD 1
-
// Define "DEBUG_ELFABIV2" to allow for debugging output for ELF ABI v2 function call and return codegen
// #define DEBUG_ELFABIV2
--- /dev/null
+/*
+ * Licensed to the .NET Foundation under one or more agreements.
+ * The .NET Foundation licenses this file to you under the MIT license.
+ * See the LICENSE file in the project root for more information.
+ */
+
+#include <config.h>
+
+#include <mono/metadata/abi-details.h>
+#include <mono/metadata/mono-debug.h>
+
+#include "interp/interp.h"
+#include "ir-emit.h"
+#include "mini.h"
+
+#ifndef DISABLE_JIT
+
+static MonoInst *
+emit_fill_call_ctx (MonoCompile *cfg, MonoInst *method, MonoInst *ret)
+{
+ cfg->flags |= MONO_CFG_HAS_ALLOCA;
+
+ MonoInst *alloc, *size, *fill_ctx;
+
+ EMIT_NEW_ICONST (cfg, size, sizeof (MonoProfilerCallContext));
+ MONO_INST_NEW (cfg, alloc, OP_LOCALLOC);
+ alloc->dreg = alloc_preg (cfg);
+ alloc->sreg1 = size->dreg;
+ alloc->flags |= MONO_INST_INIT;
+ MONO_ADD_INS (cfg->cbb, alloc);
+ MONO_INST_NEW (cfg, fill_ctx, OP_FILL_PROF_CALL_CTX);
+ fill_ctx->sreg1 = alloc->dreg;
+ MONO_ADD_INS (cfg->cbb, fill_ctx);
+ MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STORE_MEMBASE_REG, alloc->dreg, MONO_STRUCT_OFFSET (MonoProfilerCallContext, method), method->dreg);
+
+ if (ret) {
+ MonoInst *var = mono_compile_create_var (cfg, mono_method_signature (cfg->method)->ret, OP_LOCAL);
+
+ MonoInst *store, *addr;
+
+ EMIT_NEW_TEMPSTORE (cfg, store, var->inst_c0, ret);
+ EMIT_NEW_VARLOADA (cfg, addr, var, NULL);
+ MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STORE_MEMBASE_REG, alloc->dreg, MONO_STRUCT_OFFSET (MonoProfilerCallContext, return_value), addr->dreg);
+ }
+
+ return alloc;
+}
+
+void
+mini_profiler_emit_enter (MonoCompile *cfg)
+{
+ if (!MONO_CFG_PROFILE (cfg, ENTER) || cfg->current_method != cfg->method)
+ return;
+
+ MonoInst *iargs [2];
+
+ EMIT_NEW_METHODCONST (cfg, iargs [0], cfg->method);
+
+ if (MONO_CFG_PROFILE (cfg, ENTER_CONTEXT) && !cfg->llvm_only)
+ iargs [1] = emit_fill_call_ctx (cfg, iargs [0], NULL);
+ else
+ EMIT_NEW_PCONST (cfg, iargs [1], NULL);
+
+ /* void mono_profiler_raise_method_enter (MonoMethod *method, MonoProfilerCallContext *ctx) */
+ mono_emit_jit_icall (cfg, mono_profiler_raise_method_enter, iargs);
+}
+
+void
+mini_profiler_emit_leave (MonoCompile *cfg, MonoInst *ret)
+{
+ if (!MONO_CFG_PROFILE (cfg, LEAVE) || cfg->current_method != cfg->method)
+ return;
+
+ MonoInst *iargs [2];
+
+ EMIT_NEW_METHODCONST (cfg, iargs [0], cfg->method);
+
+ if (MONO_CFG_PROFILE (cfg, LEAVE_CONTEXT) && !cfg->llvm_only)
+ iargs [1] = emit_fill_call_ctx (cfg, iargs [0], ret);
+ else
+ EMIT_NEW_PCONST (cfg, iargs [1], NULL);
+
+ /* void mono_profiler_raise_method_leave (MonoMethod *method, MonoProfilerCallContext *ctx) */
+ mono_emit_jit_icall (cfg, mono_profiler_raise_method_leave, iargs);
+}
+
+void
+mini_profiler_emit_tail_call (MonoCompile *cfg, MonoMethod *target)
+{
+ if (!MONO_CFG_PROFILE (cfg, TAIL_CALL) || cfg->current_method != cfg->method)
+ return;
+
+ g_assert (cfg->current_method == cfg->method);
+
+ MonoInst *iargs [2];
+
+ EMIT_NEW_METHODCONST (cfg, iargs [0], cfg->method);
+
+ if (target)
+ EMIT_NEW_METHODCONST (cfg, iargs [1], target);
+ else
+ EMIT_NEW_PCONST (cfg, iargs [1], NULL);
+
+ /* void mono_profiler_raise_method_tail_call (MonoMethod *method, MonoMethod *target) */
+ mono_emit_jit_icall (cfg, mono_profiler_raise_method_tail_call, iargs);
+}
+
+#endif
+
+void
+mini_profiler_context_enable (void)
+{
+ if (!mono_debug_enabled ())
+ mono_debug_init (MONO_DEBUG_FORMAT_MONO);
+}
+
+static gpointer
+memdup_with_type (gpointer data, MonoType *t)
+{
+ int dummy;
+
+ return g_memdup (data, mono_type_size (t, &dummy));
+}
+
+static guint8 *
+get_int_reg (MonoContext *ctx, guint32 reg)
+{
+ return (guint8 *) mono_arch_context_get_int_reg (ctx, reg);
+}
+
+static gpointer
+get_variable_buffer (MonoDebugMethodJitInfo *jit, MonoDebugVarInfo *var, MonoContext *ctx)
+{
+ guint32 flags = var->index & MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS;
+ guint32 reg = var->index & ~MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS;
+
+ switch (flags) {
+ case MONO_DEBUG_VAR_ADDRESS_MODE_REGISTER: {
+ /*
+ * This is kind of a special case: All other address modes ultimately
+ * produce an address to where the actual value is located, but this
+ * address mode gets us the value itself as an mgreg_t value.
+ */
+ mgreg_t value = (mgreg_t) get_int_reg (ctx, reg);
+
+ return memdup_with_type (&value, var->type);
+ }
+ case MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET:
+ return memdup_with_type (get_int_reg (ctx, reg) + (gint32) var->offset, var->type);
+ case MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET_INDIR:
+ case MONO_DEBUG_VAR_ADDRESS_MODE_VTADDR:
+ return memdup_with_type (*(guint8 **) (get_int_reg (ctx, reg) + (gint32) var->offset), var->type);
+ case MONO_DEBUG_VAR_ADDRESS_MODE_GSHAREDVT_LOCAL: {
+ guint32 idx = reg;
+
+ MonoDebugVarInfo *info_var = jit->gsharedvt_info_var;
+
+ flags = info_var->index & MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS;
+ reg = info_var->index & ~MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS;
+
+ MonoGSharedVtMethodRuntimeInfo *info;
+
+ switch (flags) {
+ case MONO_DEBUG_VAR_ADDRESS_MODE_REGISTER:
+ info = (MonoGSharedVtMethodRuntimeInfo *) get_int_reg (ctx, reg);
+ break;
+ case MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET:
+ info = *(MonoGSharedVtMethodRuntimeInfo **) (get_int_reg (ctx, reg) + (gint32) info_var->offset);
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+
+ MonoDebugVarInfo *locals_var = jit->gsharedvt_locals_var;
+
+ flags = locals_var->index & MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS;
+ reg = locals_var->index & ~MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS;
+
+ guint8 *locals;
+
+ switch (flags) {
+ case MONO_DEBUG_VAR_ADDRESS_MODE_REGISTER:
+ locals = get_int_reg (ctx, reg);
+ break;
+ case MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET:
+ locals = *(guint8 **) (get_int_reg (ctx, reg) + (gint32) info_var->offset);
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+
+ return memdup_with_type (locals + (gsize) info->entries [idx], var->type);
+ }
+ default:
+ g_assert_not_reached ();
+ return NULL;
+ }
+}
+
+gpointer
+mini_profiler_context_get_this (MonoProfilerCallContext *ctx)
+{
+ if (!mono_method_signature (ctx->method)->hasthis)
+ return NULL;
+
+ if (ctx->interp_frame)
+ return memdup_with_type (mono_interp_frame_get_this (ctx->interp_frame), &ctx->method->klass->this_arg);
+
+ MonoDebugMethodJitInfo *info = mono_debug_find_method (ctx->method, mono_domain_get ());
+
+ if (!info)
+ return NULL;
+
+ return get_variable_buffer (info, info->this_var, &ctx->context);
+}
+
+gpointer
+mini_profiler_context_get_argument (MonoProfilerCallContext *ctx, guint32 pos)
+{
+ MonoMethodSignature *sig = mono_method_signature (ctx->method);
+
+ if (pos >= sig->param_count)
+ return NULL;
+
+ if (ctx->interp_frame)
+ return memdup_with_type (mono_interp_frame_get_arg (ctx->interp_frame, pos), sig->params [pos]);
+
+ MonoDebugMethodJitInfo *info = mono_debug_find_method (ctx->method, mono_domain_get ());
+
+ if (!info)
+ return NULL;
+
+ return get_variable_buffer (info, &info->params [pos], &ctx->context);
+}
+
+gpointer
+mini_profiler_context_get_local (MonoProfilerCallContext *ctx, guint32 pos)
+{
+ MonoError error;
+ MonoMethodHeader *header = mono_method_get_header_checked (ctx->method, &error);
+ mono_error_assert_ok (&error); // Must be a valid method at this point.
+
+ if (pos >= header->num_locals) {
+ mono_metadata_free_mh (header);
+ return NULL;
+ }
+
+ MonoType *t = header->locals [pos];
+
+ mono_metadata_free_mh (header);
+
+ if (ctx->interp_frame)
+ return memdup_with_type (mono_interp_frame_get_local (ctx->interp_frame, pos), t);
+
+ MonoDebugMethodJitInfo *info = mono_debug_find_method (ctx->method, mono_domain_get ());
+
+ if (!info)
+ return NULL;
+
+ return get_variable_buffer (info, &info->locals [pos], &ctx->context);
+}
+
+gpointer
+mini_profiler_context_get_result (MonoProfilerCallContext *ctx)
+{
+ if (!ctx->return_value)
+ return NULL;
+
+ return memdup_with_type (ctx->return_value, mono_method_signature (ctx->method)->ret);
+}
+
+void
+mini_profiler_context_free_buffer (void *buffer)
+{
+ g_free (buffer);
+}
#endif
GList* mono_aot_paths;
-static gboolean mini_enable_profiler = FALSE;
-static char* mini_profiler_options = NULL;
+static GPtrArray *profile_options;
static GSList *tramp_infos;
static void register_icalls (void);
-static gboolean mini_profiler_enabled (void) { return mini_enable_profiler; }
-static const char* mini_profiler_get_options (void) { return mini_profiler_options; }
-
gboolean
mono_running_on_valgrind (void)
{
return ji;
}
-MonoJitInfo *
-mono_get_jit_info_from_method (MonoDomain *domain, MonoMethod *method)
-{
- return lookup_method (domain, method);
-}
-
MonoClass*
mini_get_class (MonoMethod *method, guint32 token, MonoGenericContext *context)
{
}
void
-mini_profiler_enable_with_options (const char* profile_options)
+mini_add_profiler_argument (const char *desc)
{
- mini_enable_profiler = TRUE;
- mini_profiler_options = g_strdup (profile_options);
+ if (!profile_options)
+ profile_options = g_ptr_array_new ();
+
+ g_ptr_array_add (profile_options, (gpointer) desc);
}
MonoDomain *
mono_install_get_class_from_name (mono_aot_get_class_from_name);
mono_install_jit_info_find_in_aot (mono_aot_find_jit_info);
- if (mini_profiler_enabled ())
- mono_profiler_load (mini_profiler_get_options ());
+ mono_profiler_state.context_enable = mini_profiler_context_enable;
+ mono_profiler_state.context_get_this = mini_profiler_context_get_this;
+ mono_profiler_state.context_get_argument = mini_profiler_context_get_argument;
+ mono_profiler_state.context_get_local = mini_profiler_context_get_local;
+ mono_profiler_state.context_get_result = mini_profiler_context_get_result;
+ mono_profiler_state.context_free_buffer = mini_profiler_context_free_buffer;
+
+ if (profile_options)
+ for (guint i = 0; i < profile_options->len; i++)
+ mono_profiler_load ((const char *) g_ptr_array_index (profile_options, i));
mono_profiler_started ();
* the wrapper would call the icall which would call the wrapper and
* so on.
*/
- register_icall (mono_profiler_raise_method_enter, "mono_profiler_raise_method_enter", "void ptr", TRUE);
- register_icall (mono_profiler_raise_method_leave, "mono_profiler_raise_method_leave", "void ptr", TRUE);
+ register_icall (mono_profiler_raise_method_enter, "mono_profiler_raise_method_enter", "void ptr ptr", TRUE);
+ register_icall (mono_profiler_raise_method_leave, "mono_profiler_raise_method_leave", "void ptr ptr", TRUE);
+ register_icall (mono_profiler_raise_method_tail_call, "mono_profiler_raise_method_tail_call", "void ptr ptr", TRUE);
register_icall (mono_trace_enter_method, "mono_trace_enter_method", NULL, TRUE);
register_icall (mono_trace_leave_method, "mono_trace_leave_method", NULL, TRUE);
register_dyn_icall (mono_get_rethrow_exception (), "mono_arch_rethrow_exception", "void object", TRUE);
register_dyn_icall (mono_get_throw_corlib_exception (), "mono_arch_throw_corlib_exception", "void ptr", TRUE);
register_icall (mono_thread_get_undeniable_exception, "mono_thread_get_undeniable_exception", "object", FALSE);
+ register_icall (mono_thread_self_abort, "mono_thread_self_abort", "void", FALSE);
register_icall (mono_thread_interruption_checkpoint, "mono_thread_interruption_checkpoint", "object", FALSE);
register_icall (mono_thread_force_interruption_checkpoint_noraise, "mono_thread_force_interruption_checkpoint_noraise", "object", FALSE);
mono_profiler_cleanup ();
+ if (profile_options)
+ g_ptr_array_free (profile_options, TRUE);
+
free_jit_tls_data ((MonoJitTlsData *)mono_tls_get_jit_tls ());
mono_icall_cleanup ();
/*========================= End of Function ========================*/
-/*------------------------------------------------------------------*/
-/* */
-/* Name - mono_arch_print_tree */
-/* */
-/* Function - Print platform-specific opcode details. */
-/* */
-/* Returns - 1 - opcode details have been printed */
-/* 0 - opcode details have not been printed */
-/* */
-/*------------------------------------------------------------------*/
-
-gboolean
-mono_arch_print_tree (MonoInst *tree, int arity)
-{
- gboolean done;
-
- switch (tree->opcode) {
- case OP_S390_LOADARG:
- case OP_S390_ARGREG:
- case OP_S390_ARGPTR:
- printf ("[0x%lx(%s)]", tree->inst_offset,
- mono_arch_regname (tree->inst_basereg));
- done = 1;
- break;
- case OP_S390_STKARG:
- printf ("[0x%lx(previous_frame)]",
- tree->inst_offset);
- done = 1;
- break;
- case OP_S390_MOVE:
- printf ("[0x%lx(%d,%s),0x%lx(%s)]",
- tree->inst_offset, tree->backend.size,
- mono_arch_regname(tree->dreg),
- tree->inst_imm,
- mono_arch_regname(tree->sreg1));
- done = 1;
- break;
- case OP_S390_SETF4RET:
- printf ("[f%s,f%s]",
- mono_arch_regname (tree->dreg),
- mono_arch_regname (tree->sreg1));
- done = 1;
- break;
- case OP_TLS_GET:
- printf ("[0x%lx(0x%lx,%s)]", tree->inst_offset,
- tree->inst_imm,
- mono_arch_regname (tree->sreg1));
- done = 1;
- break;
- case OP_TLS_SET:
- printf ("[0x%lx(0x%lx,%s)]", tree->inst_offset,
- tree->inst_imm,
- mono_arch_regname (tree->sreg1));
- done = 1;
- break;
- case OP_S390_BKCHAIN:
- printf ("[previous_frame(%s)]",
- mono_arch_regname (tree->sreg1));
- done = 1;
- default:
- done = 0;
- }
- return (done);
-}
-
-/*========================= End of Function ========================*/
-
/*------------------------------------------------------------------*/
/* */
/* Name - mono_arch_regalloc_cost */
/*========================= End of Function ========================*/
-/*------------------------------------------------------------------*/
-/* */
-/* Name - mono_arch_install_handler_block_guard */
-/* */
-/* Function - */
-/* */
-/*------------------------------------------------------------------*/
-
-gpointer
-mono_arch_install_handler_block_guard (MonoJitInfo *ji, MonoJitExceptionInfo *clause,
- MonoContext *ctx, gpointer new_value)
-{
- int offset;
- gpointer *sp, old_value;
- char *bp;
-
- offset = clause->exvar_offset;
-
- /*Load the spvar*/
- bp = MONO_CONTEXT_GET_BP (ctx);
- sp = *(gpointer*)(bp + offset);
-
- old_value = *sp;
- if (old_value < ji->code_start || (char*)old_value > ((char*)ji->code_start + ji->code_size))
- return old_value;
-
- *sp = new_value;
-
- return old_value;
-}
-
-/*========================= End of Function ========================*/
-
/*------------------------------------------------------------------*/
/* */
/* Name - get_delegate_invoke_impl. */
#define MONO_ARCH_GC_MAPS_SUPPORTED 1
#define MONO_ARCH_GSHARED_SUPPORTED 1
#define MONO_ARCH_MONITOR_ENTER_ADJUSTMENT 1
-#define MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD 1
#define MONO_ARCH_HAVE_INVALIDATE_METHOD 1
#define MONO_ARCH_HAVE_OP_GENERIC_CLASS_INIT 1
#define MONO_ARCH_HAVE_SETUP_ASYNC_CALLBACK 1
return 0;
}
-gboolean
-mono_arch_print_tree (MonoInst *tree, int arity)
-{
- return 0;
-}
-
mgreg_t
mono_arch_context_get_int_reg (MonoContext *ctx, int reg)
{
return code;
}
-#ifdef MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD
-static gpointer
-mono_handler_block_guard_trampoline (mgreg_t *regs, guint8 *code, gpointer *tramp_info, guint8* tramp)
-{
- MONO_REQ_GC_UNSAFE_MODE;
-
- MonoContext ctx;
- MonoException *exc;
- MonoJitTlsData *jit_tls = (MonoJitTlsData *)mono_tls_get_jit_tls ();
- gpointer resume_ip = jit_tls->handler_block_return_address;
-
- memcpy (&ctx, &jit_tls->handler_block_context, sizeof (MonoContext));
- MONO_CONTEXT_SET_IP (&ctx, jit_tls->handler_block_return_address);
-
- jit_tls->handler_block_return_address = NULL;
- jit_tls->handler_block = NULL;
-
- if (!resume_ip) /*this should not happen, but we should avoid crashing */
- exc = mono_get_exception_execution_engine ("Invalid internal state, resuming abort after handler block but no resume ip found");
- else
- exc = mono_thread_resume_interruption (TRUE);
-
- if (exc) {
- mono_handle_exception (&ctx, (MonoObject *)exc);
- mono_restore_context (&ctx);
- }
-
- return resume_ip;
-}
-
-gpointer
-mono_create_handler_block_trampoline (void)
-{
- static gpointer code;
-
- if (code)
- return code;
-
- if (mono_aot_only) {
- gpointer tmp = mono_aot_get_trampoline ("handler_block_trampoline");
- g_assert (tmp);
- mono_memory_barrier ();
- code = tmp;
- return code;
- }
-
- mono_trampolines_lock ();
- if (!code) {
- MonoTrampInfo *info;
- gpointer tmp;
-
- tmp = mono_arch_create_handler_block_trampoline (&info, FALSE);
- mono_tramp_info_register (info, NULL);
- mono_memory_barrier ();
- code = tmp;
- }
- mono_trampolines_unlock ();
-
- return code;
-}
-#endif
-
/*
* mono_get_trampoline_func:
*
#endif
case MONO_TRAMPOLINE_VCALL:
return mono_vcall_trampoline;
-#ifdef MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD
- case MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD:
- return mono_handler_block_guard_trampoline;
-#endif
default:
g_assert_not_reached ();
return NULL;
mono_trampoline_code [MONO_TRAMPOLINE_GENERIC_VIRTUAL_REMOTING] = create_trampoline_code (MONO_TRAMPOLINE_GENERIC_VIRTUAL_REMOTING);
#endif
mono_trampoline_code [MONO_TRAMPOLINE_VCALL] = create_trampoline_code (MONO_TRAMPOLINE_VCALL);
-#ifdef MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD
- mono_trampoline_code [MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD] = create_trampoline_code (MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD);
- mono_create_handler_block_trampoline ();
-#endif
mono_counters_register ("Calls to trampolines", MONO_COUNTER_JIT | MONO_COUNTER_INT, &trampoline_calls);
mono_counters_register ("JIT trampolines", MONO_COUNTER_JIT | MONO_COUNTER_INT, &jit_trampolines);
"delegate",
"restore_stack_prot",
"generic_virtual_remoting",
- "vcall",
- "handler_block_guard"
+ "vcall"
};
/*
case OP_SET_SP:
x86_mov_reg_reg (code, X86_ESP, ins->sreg1, sizeof (mgreg_t));
break;
+ case OP_FILL_PROF_CALL_CTX:
+ x86_mov_membase_reg (code, ins->sreg1, MONO_STRUCT_OFFSET (MonoContext, esp), X86_ESP, sizeof (mgreg_t));
+ x86_mov_membase_reg (code, ins->sreg1, MONO_STRUCT_OFFSET (MonoContext, ebp), X86_EBP, sizeof (mgreg_t));
+ x86_mov_membase_reg (code, ins->sreg1, MONO_STRUCT_OFFSET (MonoContext, ebx), X86_EBX, sizeof (mgreg_t));
+ x86_mov_membase_reg (code, ins->sreg1, MONO_STRUCT_OFFSET (MonoContext, esi), X86_ESI, sizeof (mgreg_t));
+ x86_mov_membase_reg (code, ins->sreg1, MONO_STRUCT_OFFSET (MonoContext, edi), X86_EDI, sizeof (mgreg_t));
+ break;
default:
g_warning ("unknown opcode %s\n", mono_inst_name (ins->opcode));
g_assert_not_reached ();
return ins;
}
-gboolean
-mono_arch_print_tree (MonoInst *tree, int arity)
-{
- return 0;
-}
-
guint32
mono_arch_get_patch_offset (guint8 *code)
{
#endif /* MONO_ARCH_SIMD_INTRINSICS */
}
-/*MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD*/
-gpointer
-mono_arch_install_handler_block_guard (MonoJitInfo *ji, MonoJitExceptionInfo *clause, MonoContext *ctx, gpointer new_value)
-{
- int offset;
- gpointer *sp, old_value;
- char *bp;
-
- offset = clause->exvar_offset;
-
- /*Load the spvar*/
- bp = MONO_CONTEXT_GET_BP (ctx);
- sp = *(gpointer*)(bp + offset);
-
- old_value = *sp;
- if (old_value < ji->code_start || (char*)old_value > ((char*)ji->code_start + ji->code_size))
- return old_value;
-
- *sp = new_value;
-
- return old_value;
-}
-
/*
* mono_aot_emit_load_got_addr:
*
#define MONO_ARCH_SOFT_DEBUG_SUPPORTED 1
#define MONO_ARCH_HAVE_EXCEPTIONS_INIT 1
-#define MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD 1
#define MONO_ARCH_HAVE_CARD_TABLE_WBARRIER 1
#define MONO_ARCH_HAVE_SETUP_RESUME_FROM_SIGNAL_HANDLER_CTX 1
if (cfg->verbose_level > 2)
g_print ("creating locals\n");
- for (i = 0; i < header->num_locals; ++i)
+ for (i = 0; i < header->num_locals; ++i) {
+ if (cfg->verbose_level > 2)
+ g_print ("\tlocal [%d]: ", i);
cfg->locals [i] = mono_compile_create_var (cfg, header->locals [i], OP_LOCAL);
+ }
if (cfg->verbose_level > 2)
g_print ("locals done\n");
mono_arch_emit_epilog (cfg);
cfg->epilog_end = cfg->code_len;
}
+
+ if (bb->clause_hole)
+ mono_cfg_add_try_hole (cfg, bb->clause_hole, cfg->native_code + bb->native_offset, bb);
}
mono_arch_emit_exceptions (cfg);
MonoExceptionClause *ec = &header->clauses [i];
MonoJitExceptionInfo *ei = &jinfo->clauses [i];
MonoBasicBlock *tblock;
- MonoInst *exvar, *spvar;
+ MonoInst *exvar;
ei->flags = ec->flags;
if (G_UNLIKELY (cfg->verbose_level >= 4))
printf ("IL clause: try 0x%x-0x%x handler 0x%x-0x%x filter 0x%x\n", ec->try_offset, ec->try_offset + ec->try_len, ec->handler_offset, ec->handler_offset + ec->handler_len, ec->flags == MONO_EXCEPTION_CLAUSE_FILTER ? ec->data.filter_offset : 0);
- /*
- * The spvars are needed by mono_arch_install_handler_block_guard ().
- */
- if (ei->flags == MONO_EXCEPTION_CLAUSE_FINALLY) {
- int region;
-
- region = ((i + 1) << 8) | MONO_REGION_FINALLY | ec->flags;
- spvar = mono_find_spvar_for_region (cfg, region);
- g_assert (spvar);
- ei->exvar_offset = spvar->inst_offset;
- } else {
- exvar = mono_find_exvar_for_offset (cfg, ec->handler_offset);
- ei->exvar_offset = exvar ? exvar->inst_offset : 0;
- }
+ exvar = mono_find_exvar_for_offset (cfg, ec->handler_offset);
+ ei->exvar_offset = exvar ? exvar->inst_offset : 0;
if (ei->flags == MONO_EXCEPTION_CLAUSE_FILTER) {
tblock = cfg->cil_offset_to_bb [ec->data.filter_offset];
}
#endif
+ cfg->prof_flags = mono_profiler_get_call_instrumentation_flags (cfg->method);
+
/* The debugger has no liveness information, so avoid sharing registers/stack slots */
- if (debug_options.mdb_optimizations) {
+ if (debug_options.mdb_optimizations || MONO_CFG_PROFILE_CALL_CONTEXT (cfg)) {
cfg->disable_reuse_registers = TRUE;
cfg->disable_reuse_stack_slots = TRUE;
/*
#endif
/* Version number of the AOT file format */
-#define MONO_AOT_FILE_VERSION 140
+#define MONO_AOT_FILE_VERSION 141
//TODO: This is x86/amd64 specific.
#define mono_simd_shuffle_mask(a,b,c,d) ((a) | ((b) << 2) | ((c) << 4) | ((d) << 6))
/* List of call sites in this bblock sorted by pc_offset */
GSList *gc_callsites;
+ /* If this is not null, the basic block is a try hole for this clause */
+ MonoExceptionClause *clause_hole;
+
/*
* The region encodes whether the basic block is inside
* a finally, catch, filter or none of these.
MonoContext ex_ctx;
ResumeState resume_state;
- /*Variabled use to implement handler blocks (finally/catch/etc) guards during interruption*/
- /* handler block return address */
- gpointer handler_block_return_address;
-
/* handler block been guarded. It's safe to store this even for dynamic methods since there
is an activation on stack making sure it will remain alive.*/
MonoJitExceptionInfo *handler_block;
MONO_TRAMPOLINE_RESTORE_STACK_PROT,
MONO_TRAMPOLINE_GENERIC_VIRTUAL_REMOTING,
MONO_TRAMPOLINE_VCALL,
- MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD,
MONO_TRAMPOLINE_NUM
} MonoTrampolineType;
/* These trampolines receive an argument directly in a register */
#define MONO_TRAMPOLINE_TYPE_HAS_ARG(t) \
- ((t) == MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD)
+ (FALSE)
/* optimization flags */
#define OPTFLAG(id,shift,name,descr) MONO_OPT_ ## id = 1 << shift,
/* A hashtable of region ID-> SP var mappings */
/* An SP var is a place to store the stack pointer (used by handlers)*/
+ /*
+ * FIXME We can potentially get rid of this, since it was mainly used
+ * for hijacking return address for handler.
+ */
GHashTable *spvars;
- /* A hashtable of region ID -> EX var mappings */
- /* An EX var stores the exception object passed to catch/filter blocks */
+ /*
+ * A hashtable of region ID -> EX var mappings
+ * An EX var stores the exception object passed to catch/filter blocks
+ * For finally blocks, it is set to TRUE if we should throw an abort
+ * once the execution of the finally block is over.
+ */
GHashTable *exvars;
GList *ldstr_list; /* used by AOT */
int stat_inlineable_methods;
int stat_inlined_methods;
int stat_code_reallocs;
+
+ MonoProfilerCallInstrumentationFlags prof_flags;
} MonoCompile;
+#define MONO_CFG_PROFILE(cfg, flag) \
+ G_UNLIKELY ((cfg)->prof_flags & MONO_PROFILER_CALL_INSTRUMENTATION_ ## flag)
+
+#define MONO_CFG_PROFILE_CALL_CONTEXT(cfg) \
+ (MONO_CFG_PROFILE (cfg, ENTER_CONTEXT) || MONO_CFG_PROFILE (cfg, LEAVE_CONTEXT))
+
typedef enum {
MONO_CFG_HAS_ALLOCA = 1 << 0,
MONO_CFG_HAS_CALLS = 1 << 1,
void mini_cleanup (MonoDomain *domain);
MONO_API MonoDebugOptions *mini_get_debug_options (void);
MONO_API gboolean mini_parse_debug_option (const char *option);
-void mini_profiler_enable_with_options (const char *profile_options);
+
+/* profiler support */
+void mini_add_profiler_argument (const char *desc);
+void mini_profiler_emit_enter (MonoCompile *cfg);
+void mini_profiler_emit_leave (MonoCompile *cfg, MonoInst *ret);
+void mini_profiler_emit_tail_call (MonoCompile *cfg, MonoMethod *target);
+void mini_profiler_context_enable (void);
+gpointer mini_profiler_context_get_this (MonoProfilerCallContext *ctx);
+gpointer mini_profiler_context_get_argument (MonoProfilerCallContext *ctx, guint32 pos);
+gpointer mini_profiler_context_get_local (MonoProfilerCallContext *ctx, guint32 pos);
+gpointer mini_profiler_context_get_result (MonoProfilerCallContext *ctx);
+void mini_profiler_context_free_buffer (gpointer buffer);
/* graph dumping */
void mono_cfg_dump_create_context (MonoCompile *cfg);
void mono_arch_fill_argument_info (MonoCompile *cfg);
void mono_arch_allocate_vars (MonoCompile *m);
int mono_arch_get_argument_info (MonoMethodSignature *csig, int param_count, MonoJitArgumentInfo *arg_info);
-gboolean mono_arch_print_tree (MonoInst *tree, int arity);
void mono_arch_emit_call (MonoCompile *cfg, MonoCallInst *call);
void mono_arch_emit_outarg_vt (MonoCompile *cfg, MonoInst *ins, MonoInst *src);
void mono_arch_emit_setret (MonoCompile *cfg, MonoMethod *method, MonoInst *val);
GSList *mono_arch_get_trampolines (gboolean aot);
gpointer mono_arch_get_enter_icall_trampoline (MonoTrampInfo **info);
-/* Handle block guard */
-gpointer mono_arch_install_handler_block_guard (MonoJitInfo *ji, MonoJitExceptionInfo *clause, MonoContext *ctx, gpointer new_value);
-gpointer mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot);
-gpointer mono_create_handler_block_trampoline (void);
-gboolean mono_install_handler_block_guard (MonoThreadUnwindState *ctx);
-
/*New interruption machinery */
void
mono_setup_async_callback (MonoContext *ctx, void (*async_cb)(void *fun), gpointer user_data);
guint32 mono_arch_cpu_enumerate_simd_versions (void);
void mono_simd_intrinsics_init (void);
+gboolean mono_class_is_magic_int (MonoClass *klass);
+gboolean mono_class_is_magic_float (MonoClass *klass);
MonoInst* mono_emit_native_types_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args);
MonoType* mini_native_type_replace_type (MonoType *type) MONO_LLVM_INTERNAL;
return src->sreg1;
} else if (spec [MONO_INST_DEST] == 'x') {
return src->dreg;
- } else if (src->opcode == OP_VCALL) {
+ } else if (src->opcode == OP_VCALL || src->opcode == OP_VCALL_MEMBASE) {
return src->dreg;
}
MonoJumpInfo *ji = NULL;
const guint kMaxCodeSize = 630;
- if (tramp_type == MONO_TRAMPOLINE_JUMP || tramp_type == MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD)
+ if (tramp_type == MONO_TRAMPOLINE_JUMP)
has_caller = FALSE;
else
has_caller = TRUE;
mono_amd64_patch (br [0], code);
//amd64_breakpoint (code);
- if (tramp_type != MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD) {
- /* Obtain the trampoline argument which is encoded in the instruction stream */
- if (aot) {
- /* Load the GOT offset */
- amd64_mov_reg_membase (code, AMD64_R11, AMD64_RBP, tramp_offset, sizeof(gpointer));
- /*
- * r11 points to a call *<offset>(%rip) instruction, load the
- * pc-relative offset from the instruction itself.
- */
- amd64_mov_reg_membase (code, AMD64_RAX, AMD64_R11, 3, 4);
- /* 7 is the length of the call, 8 is the offset to the next got slot */
- amd64_alu_reg_imm_size (code, X86_ADD, AMD64_RAX, 7 + sizeof (gpointer), sizeof(gpointer));
- /* Compute the address of the GOT slot */
- amd64_alu_reg_reg_size (code, X86_ADD, AMD64_R11, AMD64_RAX, sizeof(gpointer));
- /* Load the value */
- amd64_mov_reg_membase (code, AMD64_R11, AMD64_R11, 0, sizeof(gpointer));
- } else {
- amd64_mov_reg_membase (code, AMD64_R11, AMD64_RBP, tramp_offset, sizeof(gpointer));
- amd64_mov_reg_membase (code, AMD64_RAX, AMD64_R11, 5, 1);
- amd64_widen_reg (code, AMD64_RAX, AMD64_RAX, TRUE, FALSE);
- amd64_alu_reg_imm_size (code, X86_CMP, AMD64_RAX, 4, 1);
- br [0] = code;
- x86_branch8 (code, X86_CC_NE, 6, FALSE);
- /* 32 bit immediate */
- amd64_mov_reg_membase (code, AMD64_R11, AMD64_R11, 6, 4);
- br [1] = code;
- x86_jump8 (code, 10);
- /* 64 bit immediate */
- mono_amd64_patch (br [0], code);
- amd64_mov_reg_membase (code, AMD64_R11, AMD64_R11, 6, 8);
- mono_amd64_patch (br [1], code);
- }
- amd64_mov_membase_reg (code, AMD64_RBP, arg_offset, AMD64_R11, sizeof(gpointer));
+ /* Obtain the trampoline argument which is encoded in the instruction stream */
+ if (aot) {
+ /* Load the GOT offset */
+ amd64_mov_reg_membase (code, AMD64_R11, AMD64_RBP, tramp_offset, sizeof(gpointer));
+ /*
+ * r11 points to a call *<offset>(%rip) instruction, load the
+ * pc-relative offset from the instruction itself.
+ */
+ amd64_mov_reg_membase (code, AMD64_RAX, AMD64_R11, 3, 4);
+ /* 7 is the length of the call, 8 is the offset to the next got slot */
+ amd64_alu_reg_imm_size (code, X86_ADD, AMD64_RAX, 7 + sizeof (gpointer), sizeof(gpointer));
+ /* Compute the address of the GOT slot */
+ amd64_alu_reg_reg_size (code, X86_ADD, AMD64_R11, AMD64_RAX, sizeof(gpointer));
+ /* Load the value */
+ amd64_mov_reg_membase (code, AMD64_R11, AMD64_R11, 0, sizeof(gpointer));
} else {
- amd64_mov_reg_membase (code, AMD64_R11, AMD64_RBP, saved_regs_offset + (MONO_AMD64_ARG_REG1 * sizeof(mgreg_t)), sizeof(mgreg_t));
- amd64_mov_membase_reg (code, AMD64_RBP, arg_offset, AMD64_R11, sizeof(gpointer));
+ amd64_mov_reg_membase (code, AMD64_R11, AMD64_RBP, tramp_offset, sizeof(gpointer));
+ amd64_mov_reg_membase (code, AMD64_RAX, AMD64_R11, 5, 1);
+ amd64_widen_reg (code, AMD64_RAX, AMD64_RAX, TRUE, FALSE);
+ amd64_alu_reg_imm_size (code, X86_CMP, AMD64_RAX, 4, 1);
+ br [0] = code;
+ x86_branch8 (code, X86_CC_NE, 6, FALSE);
+ /* 32 bit immediate */
+ amd64_mov_reg_membase (code, AMD64_R11, AMD64_R11, 6, 4);
+ br [1] = code;
+ x86_jump8 (code, 10);
+ /* 64 bit immediate */
+ mono_amd64_patch (br [0], code);
+ amd64_mov_reg_membase (code, AMD64_R11, AMD64_R11, 6, 8);
+ mono_amd64_patch (br [1], code);
}
+ amd64_mov_membase_reg (code, AMD64_RBP, arg_offset, AMD64_R11, sizeof(gpointer));
/* Save LMF begin */
}
#endif /* !DISABLE_JIT */
-gpointer
-mono_amd64_handler_block_trampoline_helper (void)
-{
- MonoJitTlsData *jit_tls = (MonoJitTlsData *)mono_tls_get_jit_tls ();
- return jit_tls->handler_block_return_address;
-}
-
-#ifndef DISABLE_JIT
-gpointer
-mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot)
-{
- guint8 *code, *buf;
- int tramp_size = 64;
- MonoJumpInfo *ji = NULL;
- GSList *unwind_ops;
-
- code = buf = (guint8 *)mono_global_codeman_reserve (tramp_size + MONO_TRAMPOLINE_UNWINDINFO_SIZE(0));
-
- unwind_ops = mono_arch_get_cie_program ();
-
- /*
- * This trampoline restore the call chain of the handler block then jumps into the code that deals with it.
- * We get here from the ret emitted by CEE_ENDFINALLY.
- * The stack is misaligned.
- */
- /* Align the stack before the call to mono_amd64_handler_block_trampoline_helper() */
-#ifdef TARGET_WIN32
- /* Also make room for the "register parameter stack area" as specified by the Windows x64 ABI (4 64-bit registers) */
- amd64_alu_reg_imm (code, X86_SUB, AMD64_RSP, 8 + 4 * 8);
-#else
- amd64_alu_reg_imm (code, X86_SUB, AMD64_RSP, 8);
-#endif
- if (aot) {
- code = mono_arch_emit_load_aotconst (buf, code, &ji, MONO_PATCH_INFO_JIT_ICALL_ADDR, "mono_amd64_handler_block_trampoline_helper");
- amd64_call_reg (code, AMD64_R11);
- } else {
- amd64_mov_reg_imm (code, AMD64_RAX, mono_amd64_handler_block_trampoline_helper);
- amd64_call_reg (code, AMD64_RAX);
- }
- /* Undo stack alignment */
-#ifdef TARGET_WIN32
- amd64_alu_reg_imm (code, X86_ADD, AMD64_RSP, 8 + 4 * 8);
-#else
- amd64_alu_reg_imm (code, X86_ADD, AMD64_RSP, 8);
-#endif
- /* Save the result to the stack */
- amd64_push_reg (code, AMD64_RAX);
-#ifdef TARGET_WIN32
- /* Make room for the "register parameter stack area" as specified by the Windows x64 ABI (4 64-bit registers) */
- amd64_alu_reg_imm (code, X86_SUB, AMD64_RSP, 4 * 8);
-#endif
- if (aot) {
- char *name = g_strdup_printf ("trampoline_func_%d", MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD);
- code = mono_arch_emit_load_aotconst (buf, code, &ji, MONO_PATCH_INFO_JIT_ICALL_ADDR, name);
- amd64_mov_reg_reg (code, AMD64_RAX, AMD64_R11, 8);
- } else {
- amd64_mov_reg_imm (code, AMD64_RAX, mono_get_trampoline_func (MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD));
- }
- /* The stack is aligned */
- amd64_call_reg (code, AMD64_RAX);
-#ifdef TARGET_WIN32
- amd64_alu_reg_imm (code, X86_ADD, AMD64_RSP, 4 * 8);
-#endif
- /* Load return address */
- amd64_pop_reg (code, AMD64_RAX);
- /* The stack is misaligned, thats what the code we branch to expects */
- amd64_jump_reg (code, AMD64_RAX);
-
- mono_arch_flush_icache (buf, code - buf);
- MONO_PROFILER_RAISE (jit_code_buffer, (buf, code - buf, MONO_PROFILER_CODE_BUFFER_HELPER, NULL));
- g_assert (code - buf <= tramp_size);
- g_assert_checked (mono_arch_unwindinfo_validate_size (unwind_ops, MONO_TRAMPOLINE_UNWINDINFO_SIZE(0)));
-
- *info = mono_tramp_info_create ("handler_block_trampoline", buf, code - buf, ji, unwind_ops);
-
- return buf;
-}
-#endif /* !DISABLE_JIT */
-
/*
* mono_arch_get_call_target:
*
return NULL;
}
-gpointer
-mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot)
-{
- g_assert_not_reached ();
- return NULL;
-}
-
void
mono_arch_invalidate_method (MonoJitInfo *ji, void *func, gpointer func_arg)
{
*(guint8**)jump_entry = addr;
}
-gpointer
-mono_arm_handler_block_trampoline_helper (gpointer *ptr)
-{
- MonoJitTlsData *jit_tls = mono_tls_get_jit_tls ();
- return jit_tls->handler_block_return_address;
-}
-
#ifndef DISABLE_JIT
#define arm_is_imm12(v) ((int)(v) > -4096 && (int)(v) < 4096)
return buf;
}
-gpointer
-mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot)
-{
- guint8 *tramp;
- guint8 *code, *buf;
- int tramp_size = 64;
- MonoJumpInfo *ji = NULL;
- GSList *unwind_ops = NULL;
-
- code = buf = mono_global_codeman_reserve (tramp_size);
-
- unwind_ops = mono_arch_get_cie_program ();
-
- tramp = mono_arch_create_specific_trampoline (NULL, MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD, NULL, NULL);
-
- /*
- This trampoline restore the call chain of the handler block then jumps into the code that deals with it.
- */
-
- /*
- * We are in a method frame after the call emitted by OP_CALL_HANDLER.
- */
- /* Obtain jit_tls->handler_block_return_address */
- if (aot) {
- code = mono_arm_emit_aotconst (&ji, code, buf, ARMREG_R0, MONO_PATCH_INFO_JIT_ICALL_ADDR, "mono_arm_handler_block_trampoline_helper");
- } else {
- ARM_LDR_IMM (code, ARMREG_R0, ARMREG_PC, 0);
- ARM_B (code, 0);
- *(gpointer*)code = mono_arm_handler_block_trampoline_helper;
- code += 4;
- }
- ARM_BLX_REG (code, ARMREG_R0);
- /* Set it as the return address so the trampoline will return to it */
- ARM_MOV_REG_REG (code, ARMREG_LR, ARMREG_R0);
-
- /* Call the trampoline */
- if (aot) {
- char *name = g_strdup_printf ("trampoline_func_%d", MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD);
- code = mono_arm_emit_aotconst (&ji, code, buf, ARMREG_R0, MONO_PATCH_INFO_JIT_ICALL_ADDR, name);
- code = emit_bx (code, ARMREG_R0);
- } else {
- ARM_LDR_IMM (code, ARMREG_R0, ARMREG_PC, 0);
- code = emit_bx (code, ARMREG_R0);
- *(gpointer*)code = tramp;
- code += 4;
- }
-
- mono_arch_flush_icache (buf, code - buf);
- MONO_PROFILER_RAISE (jit_code_buffer, (buf, code - buf, MONO_PROFILER_CODE_BUFFER_HELPER, NULL));
- g_assert (code - buf <= tramp_size);
-
- *info = mono_tramp_info_create ("handler_block_trampoline", buf, code - buf, ji, unwind_ops);
-
- return buf;
-}
-
guint8*
mono_arch_create_sdb_trampoline (gboolean single_step, MonoTrampInfo **info, gboolean aot)
{
return NULL;
}
-gpointer
-mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot)
-{
- g_assert_not_reached ();
- return NULL;
-}
-
guint8*
mono_arch_create_sdb_trampoline (gboolean single_step, MonoTrampInfo **info, gboolean aot)
{
return ((guint32*)plt_entry) [4];
}
-gpointer
-mono_arm_handler_block_trampoline_helper (gpointer *ptr)
-{
- MonoJitTlsData *jit_tls = mono_tls_get_jit_tls ();
- return jit_tls->handler_block_return_address;
-}
-
#ifndef DISABLE_JIT
guchar*
return buf;
}
-gpointer
-mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot)
-{
- guint8 *tramp;
- guint8 *code, *buf;
- int tramp_size = 64;
- MonoJumpInfo *ji = NULL;
- GSList *unwind_ops = NULL;
-
- code = buf = mono_global_codeman_reserve (tramp_size);
-
- unwind_ops = NULL;
-
- /*
- This trampoline restore the call chain of the handler block then jumps into the code that deals with it.
- */
-
- /*
- * We are in a method frame after the call emitted by OP_CALL_HANDLER.
- */
- /* Call a helper to obtain jit_tls->handler_block_return_address */
- if (aot)
- code = mono_arm_emit_aotconst (&ji, code, buf, ARMREG_IP0, MONO_PATCH_INFO_JIT_ICALL_ADDR, "mono_arm_handler_block_trampoline_helper");
- else
- code = mono_arm_emit_imm64 (code, ARMREG_IP0, (guint64)mono_arm_handler_block_trampoline_helper);
- arm_blrx (code, ARMREG_IP0);
- /* Set it as the return address so the trampoline will return to it */
- arm_movx (code, ARMREG_LR, ARMREG_R0);
-
- /* Call the C trampoline function */
- if (aot) {
- char *name = g_strdup_printf ("trampoline_func_%d", MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD);
- code = mono_arm_emit_aotconst (&ji, code, buf, ARMREG_IP0, MONO_PATCH_INFO_JIT_ICALL_ADDR, name);
- } else {
- tramp = mono_arch_create_specific_trampoline (NULL, MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD, NULL, NULL);
- code = mono_arm_emit_imm64 (code, ARMREG_IP0, (guint64)tramp);
- }
- arm_brx (code, ARMREG_IP0);
-
- mono_arch_flush_icache (buf, code - buf);
- MONO_PROFILER_RAISE (jit_code_buffer, (buf, code - buf, MONO_PROFILER_CODE_BUFFER_HELPER, NULL));
- g_assert (code - buf <= tramp_size);
-
- *info = mono_tramp_info_create ("handler_block_trampoline", buf, code - buf, ji, unwind_ops);
-
- return buf;
-}
-
/*
* mono_arch_create_sdb_trampoline:
*
return NULL;
}
-gpointer
-mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot)
-{
- g_assert_not_reached ();
- return NULL;
-}
-
gpointer
mono_arch_get_unbox_trampoline (MonoMethod *m, gpointer addr)
{
code = buf = mono_global_codeman_reserve(512);
- if ((tramp_type == MONO_TRAMPOLINE_JUMP) ||
- (tramp_type == MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD))
+ if (tramp_type == MONO_TRAMPOLINE_JUMP)
has_caller = 0;
else
has_caller = 1;
}
/*========================= End of Function ========================*/
-
-/*------------------------------------------------------------------*/
-/* */
-/* Name - handler_block_trampoline_helper */
-/* */
-/* Function - */
-/* */
-/*------------------------------------------------------------------*/
-
-static void
-handler_block_trampoline_helper (gpointer *ptr)
-{
- MonoJitTlsData *jit_tls = mono_tls_get_jit_tls ();
- *ptr = jit_tls->handler_block_return_address;
-}
-
-/*========================= End of Function ========================*/
-
-/*------------------------------------------------------------------*/
-/* */
-/* Name - mono_arch_create_handler_block_trampoline */
-/* */
-/* Function - */
-/* */
-/*------------------------------------------------------------------*/
-
-gpointer
-mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot)
-{
- guint8 *tramp = mono_get_trampoline_code (MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD);
- guint8 *code, *buf;
- int tramp_size = 64;
- MonoJumpInfo *ji = NULL;
- GSList *unwind_ops = NULL;
-
- g_assert (!aot);
-
- code = buf = mono_global_codeman_reserve (tramp_size);
-
- /*
- * This trampoline restore the call chain of the handler block
- * then jumps into the code that deals with it.
- */
-
- /*
- * Slow path uses a C helper
- */
- S390_SET (code, s390_r2, tramp);
- S390_SET (code, s390_r1, handler_block_trampoline_helper);
- s390_br (code, s390_r1);
-
- mono_arch_flush_icache (buf, code - buf);
- MONO_PROFILER_RAISE (jit_code_buffer, (buf, code - buf, MONO_PROFILER_CODE_BUFFER_HELPER, NULL));
- g_assert (code - buf <= tramp_size);
-
- *info = mono_tramp_info_create ("handler_block_trampoline", buf, code - buf, ji, unwind_ops);
-
- return buf;
-}
-
-/*========================= End of Function ========================*/
mono_add_unwind_op_def_cfa_offset (unwind_ops, code, buf, cfa_offset);
x86_ret (code);
} else {
- /* The trampoline argument is at the top of the stack, and it contains the address we need to branch to */
- if (tramp_type == MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD) {
- x86_pop_reg (code, X86_EAX);
- cfa_offset -= sizeof (mgreg_t);
- mono_add_unwind_op_def_cfa_offset (unwind_ops, code, buf, cfa_offset);
- x86_alu_reg_imm (code, X86_ADD, X86_ESP, 0x8);
- x86_jump_reg (code, X86_EAX);
- } else {
- x86_ret (code);
- }
+ x86_ret (code);
}
g_assert ((code - buf) <= 256);
x86_call_code (code, (guint8*)func);
}
-static gpointer
-handler_block_trampoline_helper (void)
-{
- MonoJitTlsData *jit_tls = mono_tls_get_jit_tls ();
- return jit_tls->handler_block_return_address;
-}
-
-gpointer
-mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot)
-{
- guint8 *tramp = mono_get_trampoline_code (MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD);
- guint8 *code, *buf;
- int tramp_size = 64;
- MonoJumpInfo *ji = NULL;
- int cfa_offset;
- GSList *unwind_ops = NULL;
-
- g_assert (!aot);
-
- code = buf = mono_global_codeman_reserve (tramp_size);
-
- unwind_ops = mono_arch_get_cie_program ();
- cfa_offset = sizeof (mgreg_t);
- /*
- This trampoline restore the call chain of the handler block then jumps into the code that deals with it.
- */
-
- /*
- * We are in a method frame after the call emitted by OP_CALL_HANDLER.
- */
-
- /*Slow path uses a c helper*/
- x86_call_code (code, handler_block_trampoline_helper);
- /* Simulate a call */
- /*Fix stack alignment*/
- x86_alu_reg_imm (code, X86_SUB, X86_ESP, 0x4);
- cfa_offset += sizeof (mgreg_t);
- mono_add_unwind_op_def_cfa_offset (unwind_ops, code, buf, cfa_offset);
-
- /* This is the address the trampoline will return to */
- x86_push_reg (code, X86_EAX);
- cfa_offset += sizeof (mgreg_t);
- mono_add_unwind_op_def_cfa_offset (unwind_ops, code, buf, cfa_offset);
-
- /* Dummy trampoline argument, since we call the generic trampoline directly */
- x86_push_imm (code, 0);
- cfa_offset += sizeof (mgreg_t);
- mono_add_unwind_op_def_cfa_offset (unwind_ops, code, buf, cfa_offset);
- x86_jump_code (code, tramp);
-
- mono_arch_flush_icache (buf, code - buf);
- MONO_PROFILER_RAISE (jit_code_buffer, (buf, code - buf, MONO_PROFILER_CODE_BUFFER_HELPER, NULL));
- g_assert (code - buf <= tramp_size);
-
- *info = mono_tramp_info_create ("handler_block_trampoline", buf, code - buf, ji, unwind_ops);
-
- return buf;
-}
-
guint8*
mono_arch_get_call_target (guint8 *code)
{
#include <glib.h>
#include "mini.h"
-#if !defined(DISABLE_AOT) && !defined(DISABLE_JIT) && USE_BIN_WRITER
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#include <sys/stat.h>
#include "image-writer.h"
+
+#if !defined(DISABLE_AOT) && !defined(DISABLE_JIT) && USE_BIN_WRITER
+
#include "dwarfwriter.h"
#include "mono/utils/mono-compiler.h"
void
mono_save_trampoline_xdebug_info (MonoTrampInfo *info)
{
+ const char *info_name = info->name;
+ if (info_name == NULL)
+ info_name = "";
+
if (use_gdb_interface) {
MonoImageWriter *w;
MonoDwarfWriter *dw;
xdebug_begin_emit (&w, &dw);
- mono_dwarf_writer_emit_trampoline (dw, info->name, NULL, NULL, info->code, info->code_size, info->unwind_ops);
+ mono_dwarf_writer_emit_trampoline (dw, info_name, NULL, NULL, info->code, info->code_size, info->unwind_ops);
xdebug_end_emit (w, dw, NULL);
return;
mono_loader_lock_if_inited ();
- mono_dwarf_writer_emit_trampoline (xdebug_writer, info->name, NULL, NULL, info->code, info->code_size, info->unwind_ops);
+ mono_dwarf_writer_emit_trampoline (xdebug_writer, info_name, NULL, NULL, info->code, info->code_size, info->unwind_ops);
fflush (xdebug_fp);
mono_loader_unlock_if_inited ();
}
/*
- * mono-profiler-aot.c: Ahead of Time Compiler Profiler for Mono.
+ * aot.c: Ahead of Time Compiler Profiler for Mono.
*
*
* Copyright 2008-2009 Novell, Inc (http://www.novell.com)
}
void
-mono_profiler_init (const char *desc);
+mono_profiler_init_aot (const char *desc);
/**
- * mono_profiler_init:
+ * mono_profiler_init_aot:
* the entry point
*/
void
-mono_profiler_init (const char *desc)
+mono_profiler_init_aot (const char *desc)
{
MonoProfiler *prof;
const char *p;
const char *opt;
- char *outfile_name;
+ char *outfile_name = NULL;
p = desc;
if (strncmp (p, "aot", 3))
mono_os_mutex_init (&mutex);
- MonoProfilerHandle handle = mono_profiler_install (prof);
+ MonoProfilerHandle handle = mono_profiler_create (prof);
mono_profiler_set_runtime_shutdown_end_callback (handle, prof_shutdown);
mono_profiler_set_jit_done_callback (handle, prof_jit_leave);
}
/*
- * mono-profiler-iomap.c: IOMAP string profiler for Mono.
+ * iomap.c: IOMAP string profiler for Mono.
*
* Authors:
* Marek Habersack <mhabersack@novell.com>
static inline gchar *build_hint_from_stack (MonoDomain *domain, void **stack, gint stack_entries);
static inline void store_string_location (MonoProfiler *prof, const gchar *string, guint32 hash, size_t len);
static void mono_portability_remember_string (MonoProfiler *prof, MonoDomain *domain, MonoString *str);
-void mono_profiler_init (const char *desc);
+void mono_profiler_init_iomap (const char *desc);
static void mismatched_stats_foreach_func (gpointer key, gpointer value, gpointer user_data)
{
mono_os_mutex_destroy (&mismatched_files_section);
}
-void mono_profiler_init (const char *desc)
+void mono_profiler_init_iomap (const char *desc)
{
MonoProfiler *prof = g_new0 (MonoProfiler, 1);
prof->saved_strings_hash = g_hash_table_new (NULL, NULL);
prof->string_locations_hash = g_hash_table_new (mismatched_files_guint32_hash, mismatched_files_guint32_equal);
- MonoProfilerHandle handle = mono_profiler_install (prof);
+ MonoProfilerHandle handle = mono_profiler_create (prof);
mono_profiler_set_runtime_shutdown_end_callback (handle, profiler_shutdown);
mono_profiler_set_runtime_initialized_callback (handle, runtime_initialized_cb);
mono_profiler_set_iomap_report_callback (handle, mono_portability_iomap_event);
#include <config.h>
-
+#include <mono/utils/mono-logger-internals.h>
+#include <mono/utils/mono-proclib.h>
#include "log.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
-#ifdef HAVE_SCHED_GETAFFINITY
-#include <sched.h>
-
-# ifndef GLIBC_HAS_CPU_COUNT
-static int
-CPU_COUNT(cpu_set_t *set)
-{
- int i, count = 0;
-
- for (int i = 0; i < CPU_SETSIZE; i++)
- if (CPU_ISSET(i, set))
- count++;
- return count;
-}
-# endif
-#endif
-
typedef struct {
const char *event_name;
const int mask;
} NameAndMask;
static NameAndMask event_list[] = {
- { "domain", PROFLOG_DOMAIN_EVENTS },
- { "assembly", PROFLOG_ASSEMBLY_EVENTS },
- { "module", PROFLOG_MODULE_EVENTS },
- { "class", PROFLOG_CLASS_EVENTS },
- { "jit", PROFLOG_JIT_COMPILATION_EVENTS },
{ "exception", PROFLOG_EXCEPTION_EVENTS },
- { "gcalloc", PROFLOG_ALLOCATION_EVENTS },
- { "gc", PROFLOG_GC_EVENTS },
- { "thread", PROFLOG_THREAD_EVENTS },
- { "calls", PROFLOG_CALL_EVENTS },
- //{ "inscov", PROFLOG_INS_COVERAGE_EVENTS }, //this is a profiler API event, but there's no actual event for us to emit here
- //{ "sampling", PROFLOG_SAMPLING_EVENTS }, //it makes no sense to enable/disable this event by itself
{ "monitor", PROFLOG_MONITOR_EVENTS },
- { "gcmove", PROFLOG_GC_MOVES_EVENTS },
+ { "gc", PROFLOG_GC_EVENTS },
+ { "gcalloc", PROFLOG_GC_ALLOCATION_EVENTS },
+ { "gcmove", PROFLOG_GC_MOVE_EVENTS },
{ "gcroot", PROFLOG_GC_ROOT_EVENTS },
- { "context", PROFLOG_CONTEXT_EVENTS },
- { "finalization", PROFLOG_FINALIZATION_EVENTS },
- { "counter", PROFLOG_COUNTER_EVENTS },
{ "gchandle", PROFLOG_GC_HANDLE_EVENTS },
+ { "finalization", PROFLOG_GC_FINALIZATION_EVENTS },
+ { "counter", PROFLOG_COUNTER_EVENTS },
+ { "jit", PROFLOG_JIT_EVENTS },
- { "typesystem", PROFLOG_TYPELOADING_ALIAS },
- { "coverage", PROFLOG_CODECOV_ALIAS },
- //{ "sample", PROFLOG_PERF_SAMPLING_ALIAS }, //takes args, explicitly handles
- { "alloc", PROFLOG_GC_ALLOC_ALIAS },
- //{ "heapshot", PROFLOG_HEAPSHOT_ALIAS }, //takes args, explicitly handled
+ { "alloc", PROFLOG_ALLOC_ALIAS },
{ "legacy", PROFLOG_LEGACY_ALIAS },
};
static void usage (void);
static void set_hsmode (ProfilerConfig *config, const char* val);
static void set_sample_freq (ProfilerConfig *config, const char *val);
-static int mono_cpu_count (void);
-
static gboolean
match_option (const char *arg, const char *opt_name, const char **rval)
config->do_report = TRUE;
} else if (match_option (arg, "debug", NULL)) {
config->do_debug = TRUE;
- } else if (match_option (arg, "debug-coverage", NULL)) {
- config->debug_coverage = TRUE;
- } else if (match_option (arg, "sampling-real", NULL)) {
- config->sampling_mode = MONO_PROFILER_SAMPLE_MODE_REAL;
- } else if (match_option (arg, "sampling-process", NULL)) {
- config->sampling_mode = MONO_PROFILER_SAMPLE_MODE_PROCESS;
} else if (match_option (arg, "heapshot", &val)) {
- config->enable_mask |= PROFLOG_HEAPSHOT_ALIAS;
set_hsmode (config, val);
+ if (config->hs_mode != MONO_PROFILER_HEAPSHOT_NONE)
+ config->enable_mask |= PROFLOG_HEAPSHOT_ALIAS;
+ } else if (match_option (arg, "heapshot-on-shutdown", NULL)) {
+ config->hs_on_shutdown = TRUE;
+ config->enable_mask |= PROFLOG_HEAPSHOT_ALIAS;
} else if (match_option (arg, "sample", &val)) {
set_sample_freq (config, val);
- if (config->sample_freq)
- config->enable_mask |= PROFLOG_PERF_SAMPLING_ALIAS;
+ config->sampling_mode = MONO_PROFILER_SAMPLE_MODE_PROCESS;
+ config->enable_mask |= PROFLOG_SAMPLE_EVENTS;
+ } else if (match_option (arg, "sample-real", &val)) {
+ set_sample_freq (config, val);
+ config->sampling_mode = MONO_PROFILER_SAMPLE_MODE_REAL;
+ config->enable_mask |= PROFLOG_SAMPLE_EVENTS;
+ } else if (match_option (arg, "calls", NULL)) {
+ config->enter_leave = TRUE;
+ } else if (match_option (arg, "coverage", NULL)) {
+ config->collect_coverage = TRUE;
} else if (match_option (arg, "zip", NULL)) {
config->use_zip = TRUE;
} else if (match_option (arg, "output", &val)) {
int num_frames = strtoul (val, &end, 10);
if (num_frames > MAX_FRAMES)
num_frames = MAX_FRAMES;
- config->notraces = num_frames == 0;
config->num_frames = num_frames;
} else if (match_option (arg, "maxsamples", &val)) {
char *end;
break;
}
}
- if (i == G_N_ELEMENTS (event_list)) {
- printf ("Could not parse argument %s\n", arg);
- }
+
+ if (i == G_N_ELEMENTS (event_list))
+ mono_profiler_printf_err ("Could not parse argument: %s", arg);
}
}
//XXX change this to header constants
config->max_allocated_sample_hits = mono_cpu_count () * 1000;
- config->sampling_mode = MONO_PROFILER_SAMPLE_MODE_PROCESS;
+ config->sampling_mode = MONO_PROFILER_SAMPLE_MODE_NONE;
config->sample_freq = 100;
config->max_call_depth = 100;
config->num_frames = MAX_FRAMES;
static void
set_hsmode (ProfilerConfig *config, const char* val)
{
- char *end;
- unsigned int count;
- if (!val)
+ if (!val) {
+ config->hs_mode = MONO_PROFILER_HEAPSHOT_MAJOR;
return;
+ }
+
if (strcmp (val, "ondemand") == 0) {
- config->hs_mode_ondemand = TRUE;
+ config->hs_mode = MONO_PROFILER_HEAPSHOT_ON_DEMAND;
return;
}
- count = strtoul (val, &end, 10);
+ char *end;
+
+ unsigned int count = strtoul (val, &end, 10);
+
if (val == end) {
usage ();
return;
}
- if (strcmp (end, "ms") == 0)
- config->hs_mode_ms = count;
- else if (strcmp (end, "gc") == 0)
- config->hs_mode_gc = count;
- else
+ if (strcmp (end, "ms") == 0) {
+ config->hs_mode = MONO_PROFILER_HEAPSHOT_X_MS;
+ config->hs_freq_ms = count;
+ } else if (strcmp (end, "gc") == 0) {
+ config->hs_mode = MONO_PROFILER_HEAPSHOT_X_GC;
+ config->hs_freq_gc = count;
+ } else
usage ();
}
-/*
-Sampling frequency allows for one undocumented, hidden and ignored argument. The sampling kind.
-Back in the day when this was done using perf, we could specify one of: cycles,instr,cacherefs,cachemiss,branches,branchmiss
-With us moving ot userland sampling, those options are now meaningless.
-*/
static void
set_sample_freq (ProfilerConfig *config, const char *val)
{
if (!val)
return;
- const char *p = val;
-
- // Is it only the frequency (new option style)?
- if (isdigit (*p))
- goto parse;
-
- // Skip the sample type for backwards compatibility.
- while (isalpha (*p))
- p++;
-
- // Skip the forward slash only if we got a sample type.
- if (p != val && *p == '/') {
- p++;
-
- char *end;
-
- parse:
- config->sample_freq = strtoul (p, &end, 10);
+ char *end;
- if (p == end) {
- usage ();
- return;
- }
+ int freq = strtoul (val, &end, 10);
- p = end;
+ if (val == end) {
+ usage ();
+ return;
}
- if (*p)
- usage ();
+ config->sample_freq = freq;
}
static void
usage (void)
{
- printf ("Log profiler version %d.%d (format: %d)\n", LOG_VERSION_MAJOR, LOG_VERSION_MINOR, LOG_DATA_VERSION);
- printf ("Usage: mono --profile=log[:OPTION1[,OPTION2...]] program.exe\n");
- printf ("Options:\n");
- printf ("\thelp show this usage info\n");
- printf ("\t[no]'event' enable/disable a profiling event. Valid values: domain, assembly, module, class, jit, exception, gcalloc, gc, thread, monitor, gcmove, gcroot, context, finalization, counter, gchandle\n");
- printf ("\t[no]typesystem enable/disable typesystem related events such as class and assembly loading\n");
- printf ("\t[no]alloc enable/disable recording allocation info\n");
- printf ("\t[no]calls enable/disable recording enter/leave method events\n");
- printf ("\t[no]legacy enable/disable pre mono 5.4 default profiler events\n");
- printf ("\tsample[=frequency] enable/disable statistical sampling of threads (frequency in Hz, 100 by default)\n");
- printf ("\theapshot[=MODE] record heap shot info (by default at each major collection)\n");
- printf ("\t MODE: every XXms milliseconds, every YYgc collections, ondemand\n");
- printf ("\t[no]coverage enable collection of code coverage data\n");
- printf ("\tcovfilter=ASSEMBLY add an assembly to the code coverage filters\n");
- printf ("\t add a + to include the assembly or a - to exclude it\n");
- printf ("\t covfilter=-mscorlib\n");
- printf ("\tcovfilter-file=FILE use FILE to generate the list of assemblies to be filtered\n");
- printf ("\tmaxframes=NUM collect up to NUM stack frames\n");
- printf ("\tcalldepth=NUM ignore method events for call chain depth bigger than NUM\n");
- printf ("\toutput=FILENAME write the data to file FILENAME (The file is always overwriten)\n");
- printf ("\toutput=+FILENAME write the data to file FILENAME.pid (The file is always overwriten)\n");
- printf ("\toutput=|PROGRAM write the data to the stdin of PROGRAM\n");
- printf ("\t %%t is subtituted with date and time, %%p with the pid\n");
- printf ("\treport create a report instead of writing the raw data to a file\n");
- printf ("\tzip compress the output data\n");
- printf ("\tport=PORTNUM use PORTNUM for the listening command server\n");
-}
-
-static int
-mono_cpu_count (void)
-{
-#ifdef PLATFORM_ANDROID
- /* Android tries really hard to save power by powering off CPUs on SMP phones which
- * means the normal way to query cpu count returns a wrong value with userspace API.
- * Instead we use /sys entries to query the actual hardware CPU count.
- */
- int count = 0;
- char buffer[8] = {'\0'};
- int present = open ("/sys/devices/system/cpu/present", O_RDONLY);
- /* Format of the /sys entry is a cpulist of indexes which in the case
- * of present is always of the form "0-(n-1)" when there is more than
- * 1 core, n being the number of CPU cores in the system. Otherwise
- * the value is simply 0
- */
- if (present != -1 && read (present, (char*)buffer, sizeof (buffer)) > 3)
- count = strtol (((char*)buffer) + 2, NULL, 10);
- if (present != -1)
- close (present);
- if (count > 0)
- return count + 1;
-#endif
-
-#if defined(HOST_ARM) || defined (HOST_ARM64)
-
- /* ARM platforms tries really hard to save power by powering off CPUs on SMP phones which
- * means the normal way to query cpu count returns a wrong value with userspace API. */
-
-#ifdef _SC_NPROCESSORS_CONF
- {
- int count = sysconf (_SC_NPROCESSORS_CONF);
- if (count > 0)
- return count;
- }
-#endif
-
-#else
-
-#ifdef HAVE_SCHED_GETAFFINITY
- {
- cpu_set_t set;
- if (sched_getaffinity (getpid (), sizeof (set), &set) == 0)
- return CPU_COUNT (&set);
- }
-#endif
-#ifdef _SC_NPROCESSORS_ONLN
- {
- int count = sysconf (_SC_NPROCESSORS_ONLN);
- if (count > 0)
- return count;
- }
-#endif
-
-#endif /* defined(HOST_ARM) || defined (HOST_ARM64) */
-
-#ifdef USE_SYSCTL
- {
- int count;
- int mib [2];
- size_t len = sizeof (int);
- mib [0] = CTL_HW;
- mib [1] = HW_NCPU;
- if (sysctl (mib, 2, &count, &len, NULL, 0) == 0)
- return count;
- }
-#endif
-#ifdef HOST_WIN32
- {
- SYSTEM_INFO info;
- GetSystemInfo (&info);
- return info.dwNumberOfProcessors;
- }
-#endif
-
- static gboolean warned;
-
- if (!warned) {
- g_warning ("Don't know how to determine CPU count on this platform; assuming 1");
- warned = TRUE;
- }
-
- return 1;
+ mono_profiler_printf ("Mono log profiler version %d.%d (format: %d)", LOG_VERSION_MAJOR, LOG_VERSION_MINOR, LOG_DATA_VERSION);
+ mono_profiler_printf ("Usage: mono --profile=log[:OPTION1[,OPTION2...]] program.exe\n");
+ mono_profiler_printf ("Options:");
+ mono_profiler_printf ("\thelp show this usage info");
+ mono_profiler_printf ("\t[no]'EVENT' enable/disable an individual profiling event");
+ mono_profiler_printf ("\t valid EVENT values:");
+
+ for (int i = 0; i < G_N_ELEMENTS (event_list); i++)
+ mono_profiler_printf ("\t %s", event_list [i].event_name);
+
+ mono_profiler_printf ("\t[no]alloc enable/disable recording allocation info");
+ mono_profiler_printf ("\t[no]legacy enable/disable pre mono 5.4 default profiler events");
+ mono_profiler_printf ("\tsample[-real][=FREQ] enable/disable statistical sampling of threads");
+ mono_profiler_printf ("\t FREQ in Hz, 100 by default");
+ mono_profiler_printf ("\t the -real variant uses wall clock time instead of process time");
+ mono_profiler_printf ("\theapshot[=MODE] record heapshot info (by default at each major collection)");
+ mono_profiler_printf ("\t MODE: every XXms milliseconds, every YYgc collections, ondemand");
+ mono_profiler_printf ("\theapshot-on-shutdown do a heapshot on runtime shutdown");
+ mono_profiler_printf ("\t this option is independent of the above option");
+ mono_profiler_printf ("\tcalls enable recording enter/leave method events (very heavy)");
+ mono_profiler_printf ("\tcoverage enable collection of code coverage data");
+ mono_profiler_printf ("\tcovfilter=ASSEMBLY add ASSEMBLY to the code coverage filters");
+ mono_profiler_printf ("\t prefix a + to include the assembly or a - to exclude it");
+ mono_profiler_printf ("\t e.g. covfilter=-mscorlib");
+ mono_profiler_printf ("\tcovfilter-file=FILE use FILE to generate the list of assemblies to be filtered");
+ mono_profiler_printf ("\tmaxframes=NUM collect up to NUM stack frames");
+ mono_profiler_printf ("\tcalldepth=NUM ignore method events for call chain depth bigger than NUM");
+ mono_profiler_printf ("\toutput=FILENAME write the data to file FILENAME (the file is always overwritten)");
+ mono_profiler_printf ("\toutput=+FILENAME write the data to file FILENAME.pid (the file is always overwritten)");
+ mono_profiler_printf ("\toutput=|PROGRAM write the data to the stdin of PROGRAM");
+ mono_profiler_printf ("\t %%t is substituted with date and time, %%p with the pid");
+ mono_profiler_printf ("\treport create a report instead of writing the raw data to a file");
+ mono_profiler_printf ("\tzip compress the output data");
+ mono_profiler_printf ("\tport=PORTNUM use PORTNUM for the listening command server");
}
/*
- * mono-profiler-log.c: mono log profiler
+ * log.c: mono log profiler
*
* Authors:
* Paolo Molaro (lupus@ximian.com)
#include <config.h>
#include <mono/metadata/assembly.h>
+#include <mono/metadata/class-internals.h>
#include <mono/metadata/debug-helpers.h>
-#include "../metadata/metadata-internals.h"
+#include <mono/metadata/loader.h>
+#include <mono/metadata/metadata-internals.h>
#include <mono/metadata/mono-config.h>
#include <mono/metadata/mono-gc.h>
#include <mono/metadata/mono-perfcounters.h>
+#include <mono/metadata/tabledefs.h>
#include <mono/utils/atomic.h>
#include <mono/utils/hazard-pointer.h>
#include <mono/utils/lock-free-alloc.h>
#include <mono/utils/lock-free-queue.h>
#include <mono/utils/mono-conc-hashtable.h>
+#include <mono/utils/mono-coop-mutex.h>
#include <mono/utils/mono-counters.h>
+#include <mono/utils/mono-logger-internals.h>
#include <mono/utils/mono-linked-list-set.h>
#include <mono/utils/mono-membar.h>
#include <mono/utils/mono-mmap.h>
#include <zlib.h>
#endif
-#define BUFFER_SIZE (4096 * 16)
-
-/* Worst-case size in bytes of a 64-bit value encoded with LEB128. */
-#define LEB128_SIZE 10
-
-/* Size of a value encoded as a single byte. */
-#undef BYTE_SIZE // mach/i386/vm_param.h on OS X defines this to 8, but it isn't used for anything.
-#define BYTE_SIZE 1
-
-/* Size in bytes of the event prefix (ID + time). */
-#define EVENT_SIZE (BYTE_SIZE + LEB128_SIZE)
-
-static volatile gint32 runtime_inited;
-static volatile gint32 in_shutdown;
-
-static ProfilerConfig config;
-static int nocalls = 0;
-static int notraces = 0;
-static int use_zip = 0;
-static int do_report = 0;
-static int do_heap_shot = 0;
-static int max_call_depth = 0;
-static int command_port = 0;
-static int heapshot_requested = 0;
-static int do_mono_sample = 0;
-static int do_debug = 0;
-static int do_coverage = 0;
-static gboolean no_counters = FALSE;
-static gboolean debug_coverage = FALSE;
-static int max_allocated_sample_hits;
-
-#define ENABLED(EVT) (config.effective_mask & (EVT))
-
// Statistics for internal profiler data structures.
static gint32 sample_allocations_ctr,
buffer_allocations_ctr;
coverage_classes_ctr,
coverage_assemblies_ctr;
-static MonoLinkedListSet profiler_thread_list;
-
-/*
- * file format:
- * [header] [buffer]*
- *
- * The file is composed by a header followed by 0 or more buffers.
- * Each buffer contains events that happened on a thread: for a given thread
- * buffers that appear later in the file are guaranteed to contain events
- * that happened later in time. Buffers from separate threads could be interleaved,
- * though.
- * Buffers are not required to be aligned.
- *
- * header format:
- * [id: 4 bytes] constant value: LOG_HEADER_ID
- * [major: 1 byte] [minor: 1 byte] major and minor version of the log profiler
- * [format: 1 byte] version of the data format for the rest of the file
- * [ptrsize: 1 byte] size in bytes of a pointer in the profiled program
- * [startup time: 8 bytes] time in milliseconds since the unix epoch when the program started
- * [timer overhead: 4 bytes] approximate overhead in nanoseconds of the timer
- * [flags: 4 bytes] file format flags, should be 0 for now
- * [pid: 4 bytes] pid of the profiled process
- * [port: 2 bytes] tcp port for server if != 0
- * [args size: 4 bytes] size of args
- * [args: string] arguments passed to the profiler
- * [arch size: 4 bytes] size of arch
- * [arch: string] architecture the profiler is running on
- * [os size: 4 bytes] size of os
- * [os: string] operating system the profiler is running on
- *
- * The multiple byte integers are in little-endian format.
- *
- * buffer format:
- * [buffer header] [event]*
- * Buffers have a fixed-size header followed by 0 or more bytes of event data.
- * Timing information and other values in the event data are usually stored
- * as uleb128 or sleb128 integers. To save space, as noted for each item below,
- * some data is represented as a difference between the actual value and
- * either the last value of the same type (like for timing information) or
- * as the difference from a value stored in a buffer header.
- *
- * For timing information the data is stored as uleb128, since timing
- * increases in a monotonic way in each thread: the value is the number of
- * nanoseconds to add to the last seen timing data in a buffer. The first value
- * in a buffer will be calculated from the time_base field in the buffer head.
- *
- * Object or heap sizes are stored as uleb128.
- * Pointer differences are stored as sleb128, instead.
- *
- * If an unexpected value is found, the rest of the buffer should be ignored,
- * as generally the later values need the former to be interpreted correctly.
- *
- * buffer header format:
- * [bufid: 4 bytes] constant value: BUF_ID
- * [len: 4 bytes] size of the data following the buffer header
- * [time_base: 8 bytes] time base in nanoseconds since an unspecified epoch
- * [ptr_base: 8 bytes] base value for pointers
- * [obj_base: 8 bytes] base value for object addresses
- * [thread id: 8 bytes] system-specific thread ID (pthread_t for example)
- * [method_base: 8 bytes] base value for MonoMethod pointers
- *
- * event format:
- * [extended info: upper 4 bits] [type: lower 4 bits]
- * [time diff: uleb128] nanoseconds since last timing
- * [data]*
- * The data that follows depends on type and the extended info.
- * Type is one of the enum values in mono-profiler-log.h: TYPE_ALLOC, TYPE_GC,
- * TYPE_METADATA, TYPE_METHOD, TYPE_EXCEPTION, TYPE_MONITOR, TYPE_HEAP.
- * The extended info bits are interpreted based on type, see
- * each individual event description below.
- * strings are represented as a 0-terminated utf8 sequence.
- *
- * backtrace format:
- * [num: uleb128] number of frames following
- * [frame: sleb128]* mum MonoMethod* as a pointer difference from the last such
- * pointer or the buffer method_base
- *
- * type alloc format:
- * type: TYPE_ALLOC
- * exinfo: zero or TYPE_ALLOC_BT
- * [ptr: sleb128] class as a byte difference from ptr_base
- * [obj: sleb128] object address as a byte difference from obj_base
- * [size: uleb128] size of the object in the heap
- * If exinfo == TYPE_ALLOC_BT, a backtrace follows.
- *
- * type GC format:
- * type: TYPE_GC
- * exinfo: one of TYPE_GC_EVENT, TYPE_GC_RESIZE, TYPE_GC_MOVE, TYPE_GC_HANDLE_CREATED[_BT],
- * TYPE_GC_HANDLE_DESTROYED[_BT], TYPE_GC_FINALIZE_START, TYPE_GC_FINALIZE_END,
- * TYPE_GC_FINALIZE_OBJECT_START, TYPE_GC_FINALIZE_OBJECT_END
- * if exinfo == TYPE_GC_RESIZE
- * [heap_size: uleb128] new heap size
- * if exinfo == TYPE_GC_EVENT
- * [event type: byte] GC event (MONO_GC_EVENT_* from profiler.h)
- * [generation: byte] GC generation event refers to
- * if exinfo == TYPE_GC_MOVE
- * [num_objects: uleb128] number of object moves that follow
- * [objaddr: sleb128]+ num_objects object pointer differences from obj_base
- * num is always an even number: the even items are the old
- * addresses, the odd numbers are the respective new object addresses
- * if exinfo == TYPE_GC_HANDLE_CREATED[_BT]
- * [handle_type: uleb128] MonoGCHandleType enum value
- * upper bits reserved as flags
- * [handle: uleb128] GC handle value
- * [objaddr: sleb128] object pointer differences from obj_base
- * If exinfo == TYPE_GC_HANDLE_CREATED_BT, a backtrace follows.
- * if exinfo == TYPE_GC_HANDLE_DESTROYED[_BT]
- * [handle_type: uleb128] MonoGCHandleType enum value
- * upper bits reserved as flags
- * [handle: uleb128] GC handle value
- * If exinfo == TYPE_GC_HANDLE_DESTROYED_BT, a backtrace follows.
- * if exinfo == TYPE_GC_FINALIZE_OBJECT_{START,END}
- * [object: sleb128] the object as a difference from obj_base
- *
- * type metadata format:
- * type: TYPE_METADATA
- * exinfo: one of: TYPE_END_LOAD, TYPE_END_UNLOAD (optional for TYPE_THREAD and TYPE_DOMAIN,
- * doesn't occur for TYPE_CLASS)
- * [mtype: byte] metadata type, one of: TYPE_CLASS, TYPE_IMAGE, TYPE_ASSEMBLY, TYPE_DOMAIN,
- * TYPE_THREAD, TYPE_CONTEXT
- * [pointer: sleb128] pointer of the metadata type depending on mtype
- * if mtype == TYPE_CLASS
- * [image: sleb128] MonoImage* as a pointer difference from ptr_base
- * [name: string] full class name
- * if mtype == TYPE_IMAGE
- * [name: string] image file name
- * if mtype == TYPE_ASSEMBLY
- * [image: sleb128] MonoImage* as a pointer difference from ptr_base
- * [name: string] assembly name
- * if mtype == TYPE_DOMAIN && exinfo == 0
- * [name: string] domain friendly name
- * if mtype == TYPE_CONTEXT
- * [domain: sleb128] domain id as pointer
- * if mtype == TYPE_THREAD && exinfo == 0
- * [name: string] thread name
- *
- * type method format:
- * type: TYPE_METHOD
- * exinfo: one of: TYPE_LEAVE, TYPE_ENTER, TYPE_EXC_LEAVE, TYPE_JIT
- * [method: sleb128] MonoMethod* as a pointer difference from the last such
- * pointer or the buffer method_base
- * if exinfo == TYPE_JIT
- * [code address: sleb128] pointer to the native code as a diff from ptr_base
- * [code size: uleb128] size of the generated code
- * [name: string] full method name
- *
- * type exception format:
- * type: TYPE_EXCEPTION
- * exinfo: zero, TYPE_CLAUSE, or TYPE_THROW_BT
- * if exinfo == TYPE_CLAUSE
- * [clause type: byte] MonoExceptionEnum enum value
- * [clause index: uleb128] index of the current clause
- * [method: sleb128] MonoMethod* as a pointer difference from the last such
- * pointer or the buffer method_base
- * [object: sleb128] the exception object as a difference from obj_base
- * else
- * [object: sleb128] the exception object as a difference from obj_base
- * If exinfo == TYPE_THROW_BT, a backtrace follows.
- *
- * type runtime format:
- * type: TYPE_RUNTIME
- * exinfo: one of: TYPE_JITHELPER
- * if exinfo == TYPE_JITHELPER
- * [type: byte] MonoProfilerCodeBufferType enum value
- * [buffer address: sleb128] pointer to the native code as a diff from ptr_base
- * [buffer size: uleb128] size of the generated code
- * if type == MONO_PROFILER_CODE_BUFFER_SPECIFIC_TRAMPOLINE
- * [name: string] buffer description name
- *
- * type monitor format:
- * type: TYPE_MONITOR
- * exinfo: zero or TYPE_MONITOR_BT
- * [type: byte] MonoProfilerMonitorEvent enum value
- * [object: sleb128] the lock object as a difference from obj_base
- * If exinfo == TYPE_MONITOR_BT, a backtrace follows.
- *
- * type heap format
- * type: TYPE_HEAP
- * exinfo: one of TYPE_HEAP_START, TYPE_HEAP_END, TYPE_HEAP_OBJECT, TYPE_HEAP_ROOT
- * if exinfo == TYPE_HEAP_OBJECT
- * [object: sleb128] the object as a difference from obj_base
- * [class: sleb128] the object MonoClass* as a difference from ptr_base
- * [size: uleb128] size of the object on the heap
- * [num_refs: uleb128] number of object references
- * each referenced objref is preceded by a uleb128 encoded offset: the
- * first offset is from the object address and each next offset is relative
- * to the previous one
- * [objrefs: sleb128]+ object referenced as a difference from obj_base
- * The same object can appear multiple times, but only the first time
- * with size != 0: in the other cases this data will only be used to
- * provide additional referenced objects.
- * if exinfo == TYPE_HEAP_ROOT
- * [num_roots: uleb128] number of root references
- * [num_gc: uleb128] number of major gcs
- * [object: sleb128] the object as a difference from obj_base
- * [root_type: byte] the root_type: MonoProfileGCRootType (profiler.h)
- * [extra_info: uleb128] the extra_info value
- * object, root_type and extra_info are repeated num_roots times
- *
- * type sample format
- * type: TYPE_SAMPLE
- * exinfo: one of TYPE_SAMPLE_HIT, TYPE_SAMPLE_USYM, TYPE_SAMPLE_UBIN, TYPE_SAMPLE_COUNTERS_DESC, TYPE_SAMPLE_COUNTERS
- * if exinfo == TYPE_SAMPLE_HIT
- * [thread: sleb128] thread id as difference from ptr_base
- * [count: uleb128] number of following instruction addresses
- * [ip: sleb128]* instruction pointer as difference from ptr_base
- * [mbt_count: uleb128] number of managed backtrace frames
- * [method: sleb128]* MonoMethod* as a pointer difference from the last such
- * pointer or the buffer method_base (the first such method can be also indentified by ip, but this is not neccessarily true)
- * if exinfo == TYPE_SAMPLE_USYM
- * [address: sleb128] symbol address as a difference from ptr_base
- * [size: uleb128] symbol size (may be 0 if unknown)
- * [name: string] symbol name
- * if exinfo == TYPE_SAMPLE_UBIN
- * [address: sleb128] address where binary has been loaded as a difference from ptr_base
- * [offset: uleb128] file offset of mapping (the same file can be mapped multiple times)
- * [size: uleb128] memory size
- * [name: string] binary name
- * if exinfo == TYPE_SAMPLE_COUNTERS_DESC
- * [len: uleb128] number of counters
- * for i = 0 to len
- * [section: uleb128] section of counter
- * if section == MONO_COUNTER_PERFCOUNTERS:
- * [section_name: string] section name of counter
- * [name: string] name of counter
- * [type: byte] type of counter
- * [unit: byte] unit of counter
- * [variance: byte] variance of counter
- * [index: uleb128] unique index of counter
- * if exinfo == TYPE_SAMPLE_COUNTERS
- * while true:
- * [index: uleb128] unique index of counter
- * if index == 0:
- * break
- * [type: byte] type of counter value
- * if type == string:
- * if value == null:
- * [0: byte] 0 -> value is null
- * else:
- * [1: byte] 1 -> value is not null
- * [value: string] counter value
- * else:
- * [value: uleb128/sleb128/double] counter value, can be sleb128, uleb128 or double (determined by using type)
- *
- * type coverage format
- * type: TYPE_COVERAGE
- * exinfo: one of TYPE_COVERAGE_METHOD, TYPE_COVERAGE_STATEMENT, TYPE_COVERAGE_ASSEMBLY, TYPE_COVERAGE_CLASS
- * if exinfo == TYPE_COVERAGE_METHOD
- * [assembly: string] name of assembly
- * [class: string] name of the class
- * [name: string] name of the method
- * [signature: string] the signature of the method
- * [filename: string] the file path of the file that contains this method
- * [token: uleb128] the method token
- * [method_id: uleb128] an ID for this data to associate with the buffers of TYPE_COVERAGE_STATEMENTS
- * [len: uleb128] the number of TYPE_COVERAGE_BUFFERS associated with this method
- * if exinfo == TYPE_COVERAGE_STATEMENTS
- * [method_id: uleb128] an the TYPE_COVERAGE_METHOD buffer to associate this with
- * [offset: uleb128] the il offset relative to the previous offset
- * [counter: uleb128] the counter for this instruction
- * [line: uleb128] the line of filename containing this instruction
- * [column: uleb128] the column containing this instruction
- * if exinfo == TYPE_COVERAGE_ASSEMBLY
- * [name: string] assembly name
- * [guid: string] assembly GUID
- * [filename: string] assembly filename
- * [number_of_methods: uleb128] the number of methods in this assembly
- * [fully_covered: uleb128] the number of fully covered methods
- * [partially_covered: uleb128] the number of partially covered methods
- * currently partially_covered will always be 0, and fully_covered is the
- * number of methods that are fully and partially covered.
- * if exinfo == TYPE_COVERAGE_CLASS
- * [name: string] assembly name
- * [class: string] class name
- * [number_of_methods: uleb128] the number of methods in this class
- * [fully_covered: uleb128] the number of fully covered methods
- * [partially_covered: uleb128] the number of partially covered methods
- * currently partially_covered will always be 0, and fully_covered is the
- * number of methods that are fully and partially covered.
- *
- * type meta format:
- * type: TYPE_META
- * exinfo: one of: TYPE_SYNC_POINT
- * if exinfo == TYPE_SYNC_POINT
- * [type: byte] MonoProfilerSyncPointType enum value
- */
-
// Pending data to be written to the log, for a single thread.
// Threads periodically flush their own LogBuffers by calling safe_send
typedef struct _LogBuffer LogBuffer;
typedef struct {
MonoLinkedListSetNode node;
- // Convenience pointer to the profiler structure.
- MonoProfiler *profiler;
-
// Was this thread added to the LLS?
gboolean attached;
#endif
}
-#ifdef __APPLE__
-static mach_timebase_info_data_t timebase_info;
-#elif defined (HOST_WIN32)
-static LARGE_INTEGER pcounter_freq;
-#endif
-
-#define TICKS_PER_SEC 1000000000LL
-
-static uint64_t
-current_time (void)
-{
-#ifdef __APPLE__
- uint64_t time = mach_absolute_time ();
-
- time *= timebase_info.numer;
- time /= timebase_info.denom;
-
- return time;
-#elif defined (HOST_WIN32)
- LARGE_INTEGER value;
-
- QueryPerformanceCounter (&value);
-
- return value.QuadPart * TICKS_PER_SEC / pcounter_freq.QuadPart;
-#elif defined (CLOCK_MONOTONIC)
- struct timespec tspec;
-
- clock_gettime (CLOCK_MONOTONIC, &tspec);
-
- return ((uint64_t) tspec.tv_sec * TICKS_PER_SEC + tspec.tv_nsec);
-#else
- struct timeval tv;
-
- gettimeofday (&tv, NULL);
-
- return ((uint64_t) tv.tv_sec * TICKS_PER_SEC + tv.tv_usec * 1000);
-#endif
-}
-
-static int timer_overhead;
-
-static void
-init_time (void)
-{
-#ifdef __APPLE__
- mach_timebase_info (&timebase_info);
-#elif defined (HOST_WIN32)
- QueryPerformanceFrequency (&pcounter_freq);
-#endif
-
- uint64_t time_start = current_time ();
-
- for (int i = 0; i < 256; ++i)
- current_time ();
-
- uint64_t time_end = current_time ();
-
- timer_overhead = (time_end - time_start) / 256;
-}
+#define ENABLED(EVT) (!!(log_config.effective_mask & (EVT)))
+#define ENABLE(EVT) do { log_config.effective_mask |= (EVT); } while (0)
+#define DISABLE(EVT) do { log_config.effective_mask &= ~(EVT); } while (0)
/*
* These macros should be used when writing an event to a log buffer. They
char *name;
};
-static MonoProfiler *log_profiler;
+typedef struct MonoCounterAgent {
+ MonoCounter *counter;
+ // MonoCounterAgent specific data :
+ void *value;
+ size_t value_size;
+ guint32 index;
+ gboolean emitted;
+ struct MonoCounterAgent *next;
+} MonoCounterAgent;
+
+typedef struct _PerfCounterAgent PerfCounterAgent;
+struct _PerfCounterAgent {
+ PerfCounterAgent *next;
+ guint32 index;
+ char *category_name;
+ char *name;
+ gint64 value;
+ gboolean emitted;
+ gboolean updated;
+ gboolean deleted;
+};
struct _MonoProfiler {
MonoProfilerHandle handle;
+
FILE* file;
#if defined (HAVE_SYS_ZLIB)
gzFile gzfile;
#endif
+
char *args;
uint64_t startup_time;
+ int timer_overhead;
+
+#ifdef __APPLE__
+ mach_timebase_info_data_t timebase_info;
+#elif defined (HOST_WIN32)
+ LARGE_INTEGER pcounter_freq;
+#endif
+
int pipe_output;
int command_port;
int server_socket;
int pipes [2];
+
+ MonoLinkedListSet profiler_thread_list;
+ volatile gint32 buffer_lock_state;
+ volatile gint32 buffer_lock_exclusive_intent;
+
+ volatile gint32 runtime_inited;
+ volatile gint32 in_shutdown;
+
MonoNativeThreadId helper_thread;
+
MonoNativeThreadId writer_thread;
- MonoNativeThreadId dumper_thread;
volatile gint32 run_writer_thread;
- MonoLockFreeAllocSizeClass writer_entry_size_class;
- MonoLockFreeAllocator writer_entry_allocator;
MonoLockFreeQueue writer_queue;
MonoSemType writer_queue_sem;
+
+ MonoLockFreeAllocSizeClass writer_entry_size_class;
+ MonoLockFreeAllocator writer_entry_allocator;
+
MonoConcurrentHashTable *method_table;
mono_mutex_t method_table_mutex;
+
+ MonoNativeThreadId dumper_thread;
volatile gint32 run_dumper_thread;
MonoLockFreeQueue dumper_queue;
MonoSemType dumper_queue_sem;
+
MonoLockFreeAllocSizeClass sample_size_class;
MonoLockFreeAllocator sample_allocator;
MonoLockFreeQueue sample_reuse_queue;
+
BinaryObject *binary_objects;
+
+ volatile gint32 heapshot_requested;
+ guint64 gc_count;
+ guint64 last_hs_time;
+ gboolean do_heap_walk;
+
+ mono_mutex_t counters_mutex;
+ MonoCounterAgent *counters;
+ PerfCounterAgent *perfcounters;
+ guint32 counters_index;
+
+ mono_mutex_t coverage_mutex;
+ GPtrArray *coverage_data;
+
GPtrArray *coverage_filters;
+ MonoConcurrentHashTable *coverage_filtered_classes;
+ MonoConcurrentHashTable *coverage_suppressed_assemblies;
+
+ MonoConcurrentHashTable *coverage_methods;
+ MonoConcurrentHashTable *coverage_assemblies;
+ MonoConcurrentHashTable *coverage_classes;
+
+ MonoConcurrentHashTable *coverage_image_to_methods;
+
+ guint32 coverage_previous_offset;
+ guint32 coverage_method_id;
+
+ MonoCoopMutex api_mutex;
};
+static ProfilerConfig log_config;
+static struct _MonoProfiler log_profiler;
+
typedef struct {
MonoLockFreeQueueNode node;
GPtrArray *methods;
uint64_t time;
} MethodInfo;
+#define TICKS_PER_SEC 1000000000LL
+
+static uint64_t
+current_time (void)
+{
+#ifdef __APPLE__
+ uint64_t time = mach_absolute_time ();
+
+ time *= log_profiler.timebase_info.numer;
+ time /= log_profiler.timebase_info.denom;
+
+ return time;
+#elif defined (HOST_WIN32)
+ LARGE_INTEGER value;
+
+ QueryPerformanceCounter (&value);
+
+ return value.QuadPart * TICKS_PER_SEC / log_profiler.pcounter_freq.QuadPart;
+#elif defined (CLOCK_MONOTONIC)
+ struct timespec tspec;
+
+ clock_gettime (CLOCK_MONOTONIC, &tspec);
+
+ return ((uint64_t) tspec.tv_sec * TICKS_PER_SEC + tspec.tv_nsec);
+#else
+ struct timeval tv;
+
+ gettimeofday (&tv, NULL);
+
+ return ((uint64_t) tv.tv_sec * TICKS_PER_SEC + tv.tv_usec * 1000);
+#endif
+}
+
+static void
+init_time (void)
+{
+#ifdef __APPLE__
+ mach_timebase_info (&log_profiler.timebase_info);
+#elif defined (HOST_WIN32)
+ QueryPerformanceFrequency (&log_profiler.pcounter_freq);
+#endif
+
+ uint64_t time_start = current_time ();
+
+ for (int i = 0; i < 256; ++i)
+ current_time ();
+
+ uint64_t time_end = current_time ();
+
+ log_profiler.timer_overhead = (time_end - time_start) / 256;
+}
+
static char*
pstrdup (const char *s)
{
return p;
}
+#define BUFFER_SIZE (4096 * 16)
+
+/* Worst-case size in bytes of a 64-bit value encoded with LEB128. */
+#define LEB128_SIZE 10
+
+/* Size of a value encoded as a single byte. */
+#undef BYTE_SIZE // mach/i386/vm_param.h on OS X defines this to 8, but it isn't used for anything.
+#define BYTE_SIZE 1
+
+/* Size in bytes of the event prefix (ID + time). */
+#define EVENT_SIZE (BYTE_SIZE + LEB128_SIZE)
+
static void *
alloc_buffer (int size)
{
}
static MonoProfilerThread *
-init_thread (MonoProfiler *prof, gboolean add_to_lls)
+init_thread (gboolean add_to_lls)
{
MonoProfilerThread *thread = PROF_TLS_GET ();
thread = g_malloc (sizeof (MonoProfilerThread));
thread->node.key = thread_id ();
- thread->profiler = prof;
thread->attached = add_to_lls;
thread->call_depth = 0;
thread->busy = 0;
*/
if (add_to_lls) {
MonoThreadHazardPointers *hp = mono_hazard_pointer_get ();
- g_assert (mono_lls_insert (&profiler_thread_list, hp, &thread->node) && "Why can't we insert the thread in the LLS?");
+ g_assert (mono_lls_insert (&log_profiler.profiler_thread_list, hp, &thread->node) && "Why can't we insert the thread in the LLS?");
clear_hazard_pointers (hp);
}
static MonoProfilerThread *
get_thread (void)
{
- return init_thread (log_profiler, TRUE);
+ return init_thread (TRUE);
}
// Only valid if init_thread () was called with add_to_lls = FALSE.
*
* The lock does not support recursion.
*/
-static volatile gint32 buffer_lock_state;
-static volatile gint32 buffer_lock_exclusive_intent;
static void
buffer_lock (void)
* the exclusive lock in the gc_event () callback when the world
* is about to stop.
*/
- if (InterlockedRead (&buffer_lock_state) != get_thread ()->small_id << 16) {
+ if (InterlockedRead (&log_profiler.buffer_lock_state) != get_thread ()->small_id << 16) {
MONO_ENTER_GC_SAFE;
gint32 old, new_;
do {
restart:
// Hold off if a thread wants to take the exclusive lock.
- while (InterlockedRead (&buffer_lock_exclusive_intent))
+ while (InterlockedRead (&log_profiler.buffer_lock_exclusive_intent))
mono_thread_info_yield ();
- old = InterlockedRead (&buffer_lock_state);
+ old = InterlockedRead (&log_profiler.buffer_lock_state);
// Is a thread holding the exclusive lock?
if (old >> 16) {
}
new_ = old + 1;
- } while (InterlockedCompareExchange (&buffer_lock_state, new_, old) != old);
+ } while (InterlockedCompareExchange (&log_profiler.buffer_lock_state, new_, old) != old);
MONO_EXIT_GC_SAFE;
}
{
mono_memory_barrier ();
- gint32 state = InterlockedRead (&buffer_lock_state);
+ gint32 state = InterlockedRead (&log_profiler.buffer_lock_state);
// See the comment in buffer_lock ().
if (state == PROF_TLS_GET ()->small_id << 16)
g_assert (state && "Why are we decrementing a zero reader count?");
g_assert (!(state >> 16) && "Why is the exclusive lock held?");
- InterlockedDecrement (&buffer_lock_state);
+ InterlockedDecrement (&log_profiler.buffer_lock_state);
}
static void
{
gint32 new_ = get_thread ()->small_id << 16;
- g_assert (InterlockedRead (&buffer_lock_state) != new_ && "Why are we taking the exclusive lock twice?");
+ g_assert (InterlockedRead (&log_profiler.buffer_lock_state) != new_ && "Why are we taking the exclusive lock twice?");
- InterlockedIncrement (&buffer_lock_exclusive_intent);
+ InterlockedIncrement (&log_profiler.buffer_lock_exclusive_intent);
MONO_ENTER_GC_SAFE;
- while (InterlockedCompareExchange (&buffer_lock_state, new_, 0))
+ while (InterlockedCompareExchange (&log_profiler.buffer_lock_state, new_, 0))
mono_thread_info_yield ();
MONO_EXIT_GC_SAFE;
{
mono_memory_barrier ();
- gint32 state = InterlockedRead (&buffer_lock_state);
+ gint32 state = InterlockedRead (&log_profiler.buffer_lock_state);
gint32 excl = state >> 16;
g_assert (excl && "Why is the exclusive lock not held?");
g_assert (excl == PROF_TLS_GET ()->small_id && "Why does another thread hold the exclusive lock?");
g_assert (!(state & 0xFFFF) && "Why are there readers when the exclusive lock is held?");
- InterlockedWrite (&buffer_lock_state, 0);
- InterlockedDecrement (&buffer_lock_exclusive_intent);
+ InterlockedWrite (&log_profiler.buffer_lock_state, 0);
+ InterlockedDecrement (&log_profiler.buffer_lock_exclusive_intent);
}
static void
{
MonoProfilerThread *thread = get_thread ();
- if (!mono_conc_hashtable_lookup (thread->profiler->method_table, method)) {
+ if (!mono_conc_hashtable_lookup (log_profiler.method_table, method)) {
MethodInfo *info = (MethodInfo *) g_malloc (sizeof (MethodInfo));
info->method = method;
}
static void
-dump_header (MonoProfiler *profiler)
+dump_header (void)
{
- const char *args = profiler->args;
+ const char *args = log_profiler.args;
const char *arch = mono_config_get_cpu ();
const char *os = mono_config_get_os ();
*p++ = LOG_DATA_VERSION;
*p++ = sizeof (void *);
p = write_int64 (p, ((uint64_t) time (NULL)) * 1000);
- p = write_int32 (p, timer_overhead);
+ p = write_int32 (p, log_profiler.timer_overhead);
p = write_int32 (p, 0); /* flags */
p = write_int32 (p, process_id ());
- p = write_int16 (p, profiler->command_port);
+ p = write_int16 (p, log_profiler.command_port);
p = write_header_string (p, args);
p = write_header_string (p, arch);
p = write_header_string (p, os);
#if defined (HAVE_SYS_ZLIB)
- if (profiler->gzfile) {
- gzwrite (profiler->gzfile, hbuf, p - hbuf);
+ if (log_profiler.gzfile) {
+ gzwrite (log_profiler.gzfile, hbuf, p - hbuf);
} else
#endif
{
- fwrite (hbuf, p - hbuf, 1, profiler->file);
- fflush (profiler->file);
+ fwrite (hbuf, p - hbuf, 1, log_profiler.file);
+ fflush (log_profiler.file);
}
g_free (hbuf);
static void
send_buffer (MonoProfilerThread *thread)
{
- WriterQueueEntry *entry = mono_lock_free_alloc (&thread->profiler->writer_entry_allocator);
+ WriterQueueEntry *entry = mono_lock_free_alloc (&log_profiler.writer_entry_allocator);
entry->methods = thread->methods;
entry->buffer = thread->buffer;
mono_lock_free_queue_node_init (&entry->node, FALSE);
- mono_lock_free_queue_enqueue (&thread->profiler->writer_queue, &entry->node);
- mono_os_sem_post (&thread->profiler->writer_queue_sem);
+ mono_lock_free_queue_enqueue (&log_profiler.writer_queue, &entry->node);
+ mono_os_sem_post (&log_profiler.writer_queue_sem);
}
static void
InterlockedIncrement (&thread_ends_ctr);
- if (ENABLED (PROFLOG_THREAD_EVENTS)) {
- LogBuffer *buf = ensure_logbuf_unsafe (thread,
- EVENT_SIZE /* event */ +
- BYTE_SIZE /* type */ +
- LEB128_SIZE /* tid */
- );
+ LogBuffer *buf = ensure_logbuf_unsafe (thread,
+ EVENT_SIZE /* event */ +
+ BYTE_SIZE /* type */ +
+ LEB128_SIZE /* tid */
+ );
- emit_event (buf, TYPE_END_UNLOAD | TYPE_METADATA);
- emit_byte (buf, TYPE_THREAD);
- emit_ptr (buf, (void *) thread->node.key);
- }
+ emit_event (buf, TYPE_END_UNLOAD | TYPE_METADATA);
+ emit_byte (buf, TYPE_THREAD);
+ emit_ptr (buf, (void *) thread->node.key);
}
send_buffer (thread);
{
MonoThreadHazardPointers *hp = mono_hazard_pointer_get ();
- if (mono_lls_remove (&profiler_thread_list, hp, &thread->node))
+ if (mono_lls_remove (&log_profiler.profiler_thread_list, hp, &thread->node))
mono_thread_hazardous_try_free (thread, free_thread);
clear_hazard_pointers (hp);
}
static void
-dump_buffer (MonoProfiler *profiler, LogBuffer *buf)
+dump_buffer (LogBuffer *buf)
{
char hbuf [128];
char *p = hbuf;
if (buf->next)
- dump_buffer (profiler, buf->next);
+ dump_buffer (buf->next);
if (buf->cursor - buf->buf) {
p = write_int32 (p, BUF_ID);
p = write_int64 (p, buf->method_base);
#if defined (HAVE_SYS_ZLIB)
- if (profiler->gzfile) {
- gzwrite (profiler->gzfile, hbuf, p - hbuf);
- gzwrite (profiler->gzfile, buf->buf, buf->cursor - buf->buf);
+ if (log_profiler.gzfile) {
+ gzwrite (log_profiler.gzfile, hbuf, p - hbuf);
+ gzwrite (log_profiler.gzfile, buf->buf, buf->cursor - buf->buf);
} else
#endif
{
- fwrite (hbuf, p - hbuf, 1, profiler->file);
- fwrite (buf->buf, buf->cursor - buf->buf, 1, profiler->file);
- fflush (profiler->file);
+ fwrite (hbuf, p - hbuf, 1, log_profiler.file);
+ fwrite (buf->buf, buf->cursor - buf->buf, 1, log_profiler.file);
+ fflush (log_profiler.file);
}
}
}
static void
-dump_buffer_threadless (MonoProfiler *profiler, LogBuffer *buf)
+dump_buffer_threadless (LogBuffer *buf)
{
for (LogBuffer *iter = buf; iter; iter = iter->next)
iter->thread_id = 0;
- dump_buffer (profiler, buf);
+ dump_buffer (buf);
}
// Only valid if init_thread () was called with add_to_lls = FALSE.
static void
sync_point_flush (void)
{
- g_assert (InterlockedRead (&buffer_lock_state) == PROF_TLS_GET ()->small_id << 16 && "Why don't we hold the exclusive lock?");
+ g_assert (InterlockedRead (&log_profiler.buffer_lock_state) == PROF_TLS_GET ()->small_id << 16 && "Why don't we hold the exclusive lock?");
- MONO_LLS_FOREACH_SAFE (&profiler_thread_list, MonoProfilerThread, thread) {
+ MONO_LLS_FOREACH_SAFE (&log_profiler.profiler_thread_list, MonoProfilerThread, thread) {
g_assert (thread->attached && "Why is a thread in the LLS not attached?");
send_buffer (thread);
static void
sync_point_mark (MonoProfilerSyncPointType type)
{
- g_assert (InterlockedRead (&buffer_lock_state) == PROF_TLS_GET ()->small_id << 16 && "Why don't we hold the exclusive lock?");
+ g_assert (InterlockedRead (&log_profiler.buffer_lock_state) == PROF_TLS_GET ()->small_id << 16 && "Why don't we hold the exclusive lock?");
ENTER_LOG (&sync_points_ctr, logbuffer,
EVENT_SIZE /* event */ +
emit_obj (logbuffer, refs [i]);
}
- EXIT_LOG_EXPLICIT (DO_SEND);
+ EXIT_LOG;
return 0;
}
-static unsigned int hs_mode_ms = 0;
-static unsigned int hs_mode_gc = 0;
-static unsigned int hs_mode_ondemand = 0;
-static unsigned int gc_count = 0;
-static uint64_t last_hs_time = 0;
-static gboolean do_heap_walk = FALSE;
-static gboolean ignore_heap_events;
-
static void
gc_roots (MonoProfiler *prof, MonoObject *const *objects, const MonoProfilerGCRootType *root_types, const uintptr_t *extra_info, uint64_t num)
{
- if (ignore_heap_events)
- return;
-
ENTER_LOG (&heap_roots_ctr, logbuffer,
EVENT_SIZE /* event */ +
LEB128_SIZE /* num */ +
emit_value (logbuffer, extra_info [i]);
}
- EXIT_LOG_EXPLICIT (DO_SEND);
+ EXIT_LOG;
}
static void
trigger_on_demand_heapshot (void)
{
- if (heapshot_requested)
+ if (InterlockedRead (&log_profiler.heapshot_requested))
mono_gc_collect (mono_gc_max_generation ());
}
-#define ALL_GC_EVENTS_MASK (PROFLOG_GC_MOVES_EVENTS | PROFLOG_GC_ROOT_EVENTS | PROFLOG_GC_EVENTS | PROFLOG_HEAPSHOT_FEATURE)
+#define ALL_GC_EVENTS_MASK (PROFLOG_GC_EVENTS | PROFLOG_GC_MOVE_EVENTS | PROFLOG_GC_ROOT_EVENTS)
static void
gc_event (MonoProfiler *profiler, MonoProfilerGCEvent ev, uint32_t generation)
{
- if (ev == MONO_GC_EVENT_START) {
- uint64_t now = current_time ();
-
- if (hs_mode_ms && (now - last_hs_time) / 1000 * 1000 >= hs_mode_ms)
- do_heap_walk = TRUE;
- else if (hs_mode_gc && !(gc_count % hs_mode_gc))
- do_heap_walk = TRUE;
- else if (hs_mode_ondemand)
- do_heap_walk = heapshot_requested;
- else if (!hs_mode_ms && !hs_mode_gc && generation == mono_gc_max_generation ())
- do_heap_walk = TRUE;
-
- //If using heapshot, ignore events for collections we don't care
- if (ENABLED (PROFLOG_HEAPSHOT_FEATURE)) {
- // Ignore events generated during the collection itself (IE GC ROOTS)
- ignore_heap_events = !do_heap_walk;
- }
- }
-
-
if (ENABLED (PROFLOG_GC_EVENTS)) {
ENTER_LOG (&gc_events_ctr, logbuffer,
EVENT_SIZE /* event */ +
emit_byte (logbuffer, ev);
emit_byte (logbuffer, generation);
- EXIT_LOG_EXPLICIT (NO_SEND);
+ EXIT_LOG;
}
switch (ev) {
- case MONO_GC_EVENT_START:
- if (generation == mono_gc_max_generation ())
- gc_count++;
-
- break;
case MONO_GC_EVENT_PRE_STOP_WORLD_LOCKED:
+ switch (log_config.hs_mode) {
+ case MONO_PROFILER_HEAPSHOT_NONE:
+ log_profiler.do_heap_walk = FALSE;
+ break;
+ case MONO_PROFILER_HEAPSHOT_MAJOR:
+ log_profiler.do_heap_walk = generation == mono_gc_max_generation ();
+ break;
+ case MONO_PROFILER_HEAPSHOT_ON_DEMAND:
+ log_profiler.do_heap_walk = InterlockedRead (&log_profiler.heapshot_requested);
+ break;
+ case MONO_PROFILER_HEAPSHOT_X_GC:
+ log_profiler.do_heap_walk = !(log_profiler.gc_count % log_config.hs_freq_gc);
+ break;
+ case MONO_PROFILER_HEAPSHOT_X_MS:
+ log_profiler.do_heap_walk = (current_time () - log_profiler.last_hs_time) / 1000 * 1000 >= log_config.hs_freq_ms;
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+
+ /*
+ * heapshot_requested is set either because on-demand heapshot is
+ * enabled and a heapshot was triggered, or because we're doing a
+ * shutdown heapshot. In the latter case, we won't check it in the
+ * switch above, so check it here and override any decision we made
+ * above.
+ */
+ if (InterlockedRead (&log_profiler.heapshot_requested))
+ log_profiler.do_heap_walk = TRUE;
+
+ if (ENABLED (PROFLOG_GC_ROOT_EVENTS) && log_profiler.do_heap_walk)
+ mono_profiler_set_gc_roots_callback (log_profiler.handle, gc_roots);
+
/*
* Ensure that no thread can be in the middle of writing to
* a buffer when the world stops...
*/
buffer_lock_excl ();
+
break;
case MONO_GC_EVENT_POST_STOP_WORLD:
/*
if (ENABLED (ALL_GC_EVENTS_MASK))
sync_point (SYNC_POINT_WORLD_STOP);
- /*
- * All heap events are surrounded by a HEAP_START and a HEAP_ENV event.
- * Right now, that's the case for GC Moves, GC Roots or heapshots.
- */
- if (ENABLED (PROFLOG_GC_MOVES_EVENTS | PROFLOG_GC_ROOT_EVENTS) || do_heap_walk) {
+ // Surround heapshots with HEAP_START/HEAP_END events.
+ if (log_profiler.do_heap_walk) {
ENTER_LOG (&heap_starts_ctr, logbuffer,
EVENT_SIZE /* event */
);
emit_event (logbuffer, TYPE_HEAP_START | TYPE_HEAP);
- EXIT_LOG_EXPLICIT (DO_SEND);
+ EXIT_LOG;
}
+ break;
+ case MONO_GC_EVENT_START:
+ if (generation == mono_gc_max_generation ())
+ log_profiler.gc_count++;
+
break;
case MONO_GC_EVENT_PRE_START_WORLD:
- if (do_heap_shot && do_heap_walk)
+ mono_profiler_set_gc_roots_callback (log_profiler.handle, NULL);
+
+ if (log_profiler.do_heap_walk) {
mono_gc_walk_heap (0, gc_reference, NULL);
- /* Matching HEAP_END to the HEAP_START from above */
- if (ENABLED (PROFLOG_GC_MOVES_EVENTS | PROFLOG_GC_ROOT_EVENTS) || do_heap_walk) {
ENTER_LOG (&heap_ends_ctr, logbuffer,
EVENT_SIZE /* event */
);
emit_event (logbuffer, TYPE_HEAP_END | TYPE_HEAP);
- EXIT_LOG_EXPLICIT (DO_SEND);
- }
+ EXIT_LOG;
- if (do_heap_shot && do_heap_walk) {
- do_heap_walk = FALSE;
- heapshot_requested = 0;
- last_hs_time = current_time ();
+ log_profiler.do_heap_walk = FALSE;
+ log_profiler.last_hs_time = current_time ();
+
+ InterlockedWrite (&log_profiler.heapshot_requested, 0);
}
/*
*/
if (ENABLED (ALL_GC_EVENTS_MASK))
sync_point_mark (SYNC_POINT_WORLD_START);
+
break;
case MONO_GC_EVENT_POST_START_WORLD_UNLOCKED:
/*
* their buffers again.
*/
buffer_unlock_excl ();
+
break;
default:
break;
emit_event (logbuffer, TYPE_GC_RESIZE | TYPE_GC);
emit_value (logbuffer, new_size);
- EXIT_LOG_EXPLICIT (DO_SEND);
+ EXIT_LOG;
}
typedef struct {
int32_t native_offsets [MAX_FRAMES];
} FrameData;
-static int num_frames = MAX_FRAMES;
-
static mono_bool
walk_stack (MonoMethod *method, int32_t native_offset, int32_t il_offset, mono_bool managed, void* data)
{
FrameData *frame = (FrameData *)data;
- if (method && frame->count < num_frames) {
+ if (method && frame->count < log_config.num_frames) {
frame->il_offsets [frame->count] = il_offset;
frame->native_offsets [frame->count] = native_offset;
frame->methods [frame->count++] = method;
- //printf ("In %d %s at %d (native: %d)\n", frame->count, mono_method_get_name (method), il_offset, native_offset);
}
- return frame->count == num_frames;
+ return frame->count == log_config.num_frames;
}
/*
}
static void
-emit_bt (MonoProfiler *prof, LogBuffer *logbuffer, FrameData *data)
+emit_bt (LogBuffer *logbuffer, FrameData *data)
{
- if (data->count > num_frames)
- printf ("bad num frames: %d\n", data->count);
-
emit_value (logbuffer, data->count);
while (data->count)
static void
gc_alloc (MonoProfiler *prof, MonoObject *obj)
{
- int do_bt = (nocalls && InterlockedRead (&runtime_inited) && !notraces) ? TYPE_ALLOC_BT : 0;
+ int do_bt = (!log_config.enter_leave && InterlockedRead (&log_profiler.runtime_inited) && log_config.num_frames) ? TYPE_ALLOC_BT : 0;
FrameData data;
uintptr_t len = mono_object_get_size (obj);
/* account for object alignment in the heap */
emit_value (logbuffer, len);
if (do_bt)
- emit_bt (prof, logbuffer, &data);
+ emit_bt (logbuffer, &data);
EXIT_LOG;
}
for (int i = 0; i < num; ++i)
emit_obj (logbuffer, objects [i]);
- EXIT_LOG_EXPLICIT (DO_SEND);
+ EXIT_LOG;
}
static void
gc_handle (MonoProfiler *prof, int op, MonoGCHandleType type, uint32_t handle, MonoObject *obj)
{
- int do_bt = nocalls && InterlockedRead (&runtime_inited) && !notraces;
+ int do_bt = !log_config.enter_leave && InterlockedRead (&log_profiler.runtime_inited) && log_config.num_frames;
FrameData data;
if (do_bt)
emit_obj (logbuffer, obj);
if (do_bt)
- emit_bt (prof, logbuffer, &data);
+ emit_bt (logbuffer, &data);
EXIT_LOG;
}
finalize_end (MonoProfiler *prof)
{
trigger_on_demand_heapshot ();
- if (ENABLED (PROFLOG_FINALIZATION_EVENTS)) {
+ if (ENABLED (PROFLOG_GC_FINALIZATION_EVENTS)) {
ENTER_LOG (&finalize_ends_ctr, buf,
EVENT_SIZE /* event */
);
{
char *name;
- if (InterlockedRead (&runtime_inited))
+ if (InterlockedRead (&log_profiler.runtime_inited))
name = mono_type_get_name (mono_class_get_type (klass));
else
name = type_name (klass);
EXIT_LOG;
- if (runtime_inited)
+ if (InterlockedRead (&log_profiler.runtime_inited))
mono_free (name);
else
g_free (name);
}
static void
-method_enter (MonoProfiler *prof, MonoMethod *method)
+method_enter (MonoProfiler *prof, MonoMethod *method, MonoProfilerCallContext *ctx)
{
- if (get_thread ()->call_depth++ <= max_call_depth) {
+ if (get_thread ()->call_depth++ <= log_config.max_call_depth) {
ENTER_LOG (&method_entries_ctr, logbuffer,
EVENT_SIZE /* event */ +
LEB128_SIZE /* method */
}
static void
-method_leave (MonoProfiler *prof, MonoMethod *method)
+method_leave (MonoProfiler *prof, MonoMethod *method, MonoProfilerCallContext *ctx)
{
- if (--get_thread ()->call_depth <= max_call_depth) {
+ if (--get_thread ()->call_depth <= log_config.max_call_depth) {
ENTER_LOG (&method_exits_ctr, logbuffer,
EVENT_SIZE /* event */ +
LEB128_SIZE /* method */
}
}
+static void
+tail_call (MonoProfiler *prof, MonoMethod *method, MonoMethod *target)
+{
+ method_leave (prof, method, NULL);
+}
+
static void
method_exc_leave (MonoProfiler *prof, MonoMethod *method, MonoObject *exc)
{
- if (!nocalls && --get_thread ()->call_depth <= max_call_depth) {
+ if (--get_thread ()->call_depth <= log_config.max_call_depth) {
ENTER_LOG (&method_exception_exits_ctr, logbuffer,
EVENT_SIZE /* event */ +
LEB128_SIZE /* method */
static MonoProfilerCallInstrumentationFlags
method_filter (MonoProfiler *prof, MonoMethod *method)
{
- return MONO_PROFILER_CALL_INSTRUMENTATION_PROLOGUE | MONO_PROFILER_CALL_INSTRUMENTATION_EPILOGUE;
+ return MONO_PROFILER_CALL_INSTRUMENTATION_ENTER |
+ MONO_PROFILER_CALL_INSTRUMENTATION_LEAVE |
+ MONO_PROFILER_CALL_INSTRUMENTATION_TAIL_CALL |
+ MONO_PROFILER_CALL_INSTRUMENTATION_EXCEPTION_LEAVE;
}
static void
static void
throw_exc (MonoProfiler *prof, MonoObject *object)
{
- int do_bt = (nocalls && InterlockedRead (&runtime_inited) && !notraces) ? TYPE_THROW_BT : 0;
+ int do_bt = (!log_config.enter_leave && InterlockedRead (&log_profiler.runtime_inited) && log_config.num_frames) ? TYPE_THROW_BT : 0;
FrameData data;
if (do_bt)
emit_obj (logbuffer, object);
if (do_bt)
- emit_bt (prof, logbuffer, &data);
+ emit_bt (logbuffer, &data);
EXIT_LOG;
}
static void
monitor_event (MonoProfiler *profiler, MonoObject *object, MonoProfilerMonitorEvent ev)
{
- int do_bt = (nocalls && InterlockedRead (&runtime_inited) && !notraces) ? TYPE_MONITOR_BT : 0;
+ int do_bt = (!log_config.enter_leave && InterlockedRead (&log_profiler.runtime_inited) && log_config.num_frames) ? TYPE_MONITOR_BT : 0;
FrameData data;
if (do_bt)
emit_obj (logbuffer, object);
if (do_bt)
- emit_bt (profiler, logbuffer, &data);
+ emit_bt (logbuffer, &data);
EXIT_LOG;
}
static void
thread_start (MonoProfiler *prof, uintptr_t tid)
{
- if (ENABLED (PROFLOG_THREAD_EVENTS)) {
- ENTER_LOG (&thread_starts_ctr, logbuffer,
- EVENT_SIZE /* event */ +
- BYTE_SIZE /* type */ +
- LEB128_SIZE /* tid */
- );
+ ENTER_LOG (&thread_starts_ctr, logbuffer,
+ EVENT_SIZE /* event */ +
+ BYTE_SIZE /* type */ +
+ LEB128_SIZE /* tid */
+ );
- emit_event (logbuffer, TYPE_END_LOAD | TYPE_METADATA);
- emit_byte (logbuffer, TYPE_THREAD);
- emit_ptr (logbuffer, (void*) tid);
+ emit_event (logbuffer, TYPE_END_LOAD | TYPE_METADATA);
+ emit_byte (logbuffer, TYPE_THREAD);
+ emit_ptr (logbuffer, (void*) tid);
- EXIT_LOG;
- }
+ EXIT_LOG;
}
static void
thread_end (MonoProfiler *prof, uintptr_t tid)
{
- if (ENABLED (PROFLOG_THREAD_EVENTS)) {
- ENTER_LOG (&thread_ends_ctr, logbuffer,
- EVENT_SIZE /* event */ +
- BYTE_SIZE /* type */ +
- LEB128_SIZE /* tid */
- );
+ ENTER_LOG (&thread_ends_ctr, logbuffer,
+ EVENT_SIZE /* event */ +
+ BYTE_SIZE /* type */ +
+ LEB128_SIZE /* tid */
+ );
- emit_event (logbuffer, TYPE_END_UNLOAD | TYPE_METADATA);
- emit_byte (logbuffer, TYPE_THREAD);
- emit_ptr (logbuffer, (void*) tid);
+ emit_event (logbuffer, TYPE_END_UNLOAD | TYPE_METADATA);
+ emit_byte (logbuffer, TYPE_THREAD);
+ emit_ptr (logbuffer, (void*) tid);
- EXIT_LOG_EXPLICIT (NO_SEND);
- }
+ EXIT_LOG_EXPLICIT (NO_SEND);
MonoProfilerThread *thread = get_thread ();
{
int len = strlen (name) + 1;
- if (ENABLED (PROFLOG_THREAD_EVENTS)) {
- ENTER_LOG (&thread_names_ctr, logbuffer,
- EVENT_SIZE /* event */ +
- BYTE_SIZE /* type */ +
- LEB128_SIZE /* tid */ +
- len /* name */
- );
+ ENTER_LOG (&thread_names_ctr, logbuffer,
+ EVENT_SIZE /* event */ +
+ BYTE_SIZE /* type */ +
+ LEB128_SIZE /* tid */ +
+ len /* name */
+ );
- emit_event (logbuffer, TYPE_METADATA);
- emit_byte (logbuffer, TYPE_THREAD);
- emit_ptr (logbuffer, (void*)tid);
- memcpy (logbuffer->cursor, name, len);
- logbuffer->cursor += len;
+ emit_event (logbuffer, TYPE_METADATA);
+ emit_byte (logbuffer, TYPE_THREAD);
+ emit_ptr (logbuffer, (void*)tid);
+ memcpy (logbuffer->cursor, name, len);
+ logbuffer->cursor += len;
- EXIT_LOG;
- }
+ EXIT_LOG;
}
static void
typedef struct {
MonoLockFreeQueueNode node;
- MonoProfiler *prof;
uint64_t time;
uintptr_t tid;
const void *ip;
{
SampleHit *sample = (SampleHit *) data;
- if (sample->count < num_frames) {
+ if (sample->count < log_config.num_frames) {
int i = sample->count;
sample->frames [i].method = method;
sample->count++;
}
- return sample->count == num_frames;
+ return sample->count == log_config.num_frames;
}
#define SAMPLE_SLOT_SIZE(FRAMES) (sizeof (SampleHit) + sizeof (AsyncFrameInfo) * (FRAMES - MONO_ZERO_LEN_ARRAY))
SampleHit *sample = p;
mono_lock_free_queue_node_unpoison (&sample->node);
- mono_lock_free_queue_enqueue (&sample->prof->dumper_queue, &sample->node);
- mono_os_sem_post (&sample->prof->dumper_queue_sem);
+ mono_lock_free_queue_enqueue (&log_profiler.dumper_queue, &sample->node);
+ mono_os_sem_post (&log_profiler.dumper_queue_sem);
}
static void
* invoking runtime functions, which is not async-signal-safe.
*/
- if (InterlockedRead (&in_shutdown))
+ if (InterlockedRead (&log_profiler.in_shutdown))
return;
SampleHit *sample = (SampleHit *) mono_lock_free_queue_dequeue (&profiler->sample_reuse_queue);
* If we're out of reusable sample events and we're not allowed to
* allocate more, we have no choice but to drop the event.
*/
- if (InterlockedRead (&sample_allocations_ctr) >= max_allocated_sample_hits)
+ if (InterlockedRead (&sample_allocations_ctr) >= log_config.max_allocated_sample_hits)
return;
sample = mono_lock_free_alloc (&profiler->sample_allocator);
- sample->prof = profiler;
mono_lock_free_queue_node_init (&sample->node, TRUE);
InterlockedIncrement (&sample_allocations_ctr);
if (++i == hsize)
i = 0;
} while (i != start_pos);
- /* should not happen */
- printf ("failed code page store\n");
+ g_assert_not_reached ();
return 0;
}
//#if defined(HAVE_DL_ITERATE_PHDR) && defined(ELFMAG0)
#if 0
static void
-dump_ubin (MonoProfiler *prof, const char *filename, uintptr_t load_addr, uint64_t offset, uintptr_t size)
+dump_ubin (const char *filename, uintptr_t load_addr, uint64_t offset, uintptr_t size)
{
int len = strlen (filename) + 1;
memcpy (logbuffer->cursor, filename, len);
logbuffer->cursor += len;
- EXIT_LOG_EXPLICIT (DO_SEND);
+ EXIT_LOG;
}
#endif
static void
-dump_usym (MonoProfiler *prof, const char *name, uintptr_t value, uintptr_t size)
+dump_usym (const char *name, uintptr_t value, uintptr_t size)
{
int len = strlen (name) + 1;
memcpy (logbuffer->cursor, name, len);
logbuffer->cursor += len;
- EXIT_LOG_EXPLICIT (DO_SEND);
+ EXIT_LOG;
}
/* ELF code crashes on some systems. */
#endif
static void
-dump_elf_symbols (MonoProfiler *prof, ElfW(Sym) *symbols, int num_symbols, const char *strtab, void *load_addr)
+dump_elf_symbols (ElfW(Sym) *symbols, int num_symbols, const char *strtab, void *load_addr)
{
int i;
for (i = 0; i < num_symbols; ++i) {
sym = strtab + symbols [i].st_name;
if (!symbols [i].st_name || !symbols [i].st_size || (symbols [i].st_info & 0xf) != STT_FUNC)
continue;
- //printf ("symbol %s at %d\n", sym, symbols [i].st_value);
dump_usym (sym, (uintptr_t)load_addr + symbols [i].st_value, symbols [i].st_size);
}
}
shstrtabh = (void*)((char*)sheader + (header->e_shentsize * header->e_shstrndx));
strtab = (const char*)data + shstrtabh->sh_offset;
for (i = 0; i < header->e_shnum; ++i) {
- //printf ("section header: %d\n", sheader->sh_type);
if (sheader->sh_type == SHT_SYMTAB) {
symtabh = sheader;
strtabh = (void*)((char*)data + header->e_shoff + sheader->sh_link * header->e_shentsize);
- /*printf ("symtab section header: %d, .strstr: %d\n", i, sheader->sh_link);*/
break;
}
sheader = (void*)((char*)sheader + header->e_shentsize);
static int
elf_dl_callback (struct dl_phdr_info *info, size_t size, void *data)
{
- MonoProfiler *prof = data;
char buf [256];
const char *filename;
BinaryObject *obj;
ElfW(Word) *hash_table = NULL;
ElfW(Ehdr) *header = NULL;
const char* strtab = NULL;
- for (obj = prof->binary_objects; obj; obj = obj->next) {
+ for (obj = log_profiler.binary_objects; obj; obj = obj->next) {
if (obj->addr == a)
return 0;
}
obj = g_calloc (sizeof (BinaryObject), 1);
obj->addr = (void*)info->dlpi_addr;
obj->name = pstrdup (filename);
- obj->next = prof->binary_objects;
- prof->binary_objects = obj;
- //printf ("loaded file: %s at %p, segments: %d\n", filename, (void*)info->dlpi_addr, info->dlpi_phnum);
+ obj->next = log_profiler.binary_objects;
+ log_profiler.binary_objects = obj;
a = NULL;
for (i = 0; i < info->dlpi_phnum; ++i) {
- //printf ("segment type %d file offset: %d, size: %d\n", info->dlpi_phdr[i].p_type, info->dlpi_phdr[i].p_offset, info->dlpi_phdr[i].p_memsz);
if (info->dlpi_phdr[i].p_type == PT_LOAD && !header) {
header = (ElfW(Ehdr)*)(info->dlpi_addr + info->dlpi_phdr[i].p_vaddr);
if (header->e_ident [EI_MAG0] != ELFMAG0 ||
header->e_ident [EI_MAG3] != ELFMAG3 ) {
header = NULL;
}
- dump_ubin (prof, filename, info->dlpi_addr + info->dlpi_phdr[i].p_vaddr, info->dlpi_phdr[i].p_offset, info->dlpi_phdr[i].p_memsz);
+ dump_ubin (filename, info->dlpi_addr + info->dlpi_phdr[i].p_vaddr, info->dlpi_phdr[i].p_offset, info->dlpi_phdr[i].p_memsz);
} else if (info->dlpi_phdr[i].p_type == PT_DYNAMIC) {
dyn = (ElfW(Dyn) *)(info->dlpi_addr + info->dlpi_phdr[i].p_vaddr);
}
}
- if (read_elf_symbols (prof, filename, (void*)info->dlpi_addr))
+ if (read_elf_symbols (filename, (void*)info->dlpi_addr))
return 0;
if (!info->dlpi_name || !info->dlpi_name[0])
return 0;
return 0;
for (i = 0; dyn [i].d_tag != DT_NULL; ++i) {
if (dyn [i].d_tag == DT_SYMTAB) {
- if (symtab && do_debug)
- printf ("multiple symtabs: %d\n", i);
symtab = (ElfW(Sym) *)(a + dyn [i].d_un.d_ptr);
} else if (dyn [i].d_tag == DT_HASH) {
hash_table = (ElfW(Word) *)(a + dyn [i].d_un.d_ptr);
if (!hash_table)
return 0;
num_sym = hash_table [1];
- dump_elf_symbols (prof, symtab, num_sym, strtab, (void*)info->dlpi_addr);
+ dump_elf_symbols (symtab, num_sym, strtab, (void*)info->dlpi_addr);
return 0;
}
static int
-load_binaries (MonoProfiler *prof)
+load_binaries (void)
{
- dl_iterate_phdr (elf_dl_callback, prof);
+ dl_iterate_phdr (elf_dl_callback, NULL);
return 1;
}
#else
static int
-load_binaries (MonoProfiler *prof)
+load_binaries (void)
{
return 0;
}
}
static void
-dump_unmanaged_coderefs (MonoProfiler *prof)
+dump_unmanaged_coderefs (void)
{
int i;
const char* last_symbol;
uintptr_t addr, page_end;
- if (load_binaries (prof))
+ if (load_binaries ())
return;
for (i = 0; i < size_code_pages; ++i) {
const char* sym;
last_symbol = sym;
if (!sym)
continue;
- dump_usym (prof, sym, addr, 0); /* let's not guess the size */
- //printf ("found symbol at %p: %s\n", (void*)addr, sym);
+ dump_usym (sym, addr, 0); /* let's not guess the size */
}
}
}
-typedef struct MonoCounterAgent {
- MonoCounter *counter;
- // MonoCounterAgent specific data :
- void *value;
- size_t value_size;
- short index;
- short emitted;
- struct MonoCounterAgent *next;
-} MonoCounterAgent;
-
-static MonoCounterAgent* counters;
-static int counters_index = 1;
-static mono_mutex_t counters_mutex;
-
static void
counters_add_agent (MonoCounter *counter)
{
- if (InterlockedRead (&in_shutdown))
+ if (InterlockedRead (&log_profiler.in_shutdown))
return;
MonoCounterAgent *agent, *item;
- mono_os_mutex_lock (&counters_mutex);
+ mono_os_mutex_lock (&log_profiler.counters_mutex);
- for (agent = counters; agent; agent = agent->next) {
+ for (agent = log_profiler.counters; agent; agent = agent->next) {
if (agent->counter == counter) {
agent->value_size = 0;
if (agent->value) {
agent->counter = counter;
agent->value = NULL;
agent->value_size = 0;
- agent->index = counters_index++;
- agent->emitted = 0;
+ agent->index = log_profiler.counters_index++;
+ agent->emitted = FALSE;
agent->next = NULL;
- if (!counters) {
- counters = agent;
+ if (!log_profiler.counters) {
+ log_profiler.counters = agent;
} else {
- item = counters;
+ item = log_profiler.counters;
while (item->next)
item = item->next;
item->next = agent;
}
done:
- mono_os_mutex_unlock (&counters_mutex);
+ mono_os_mutex_unlock (&log_profiler.counters_mutex);
}
static mono_bool
}
static void
-counters_init (MonoProfiler *profiler)
+counters_init (void)
{
- mono_os_mutex_init (&counters_mutex);
+ mono_os_mutex_init (&log_profiler.counters_mutex);
+
+ log_profiler.counters_index = 1;
mono_counters_on_register (&counters_add_agent);
mono_counters_foreach (counters_init_foreach_callback, NULL);
}
static void
-counters_emit (MonoProfiler *profiler)
+counters_emit (void)
{
MonoCounterAgent *agent;
int len = 0;
LEB128_SIZE /* len */
;
- mono_os_mutex_lock (&counters_mutex);
+ mono_os_mutex_lock (&log_profiler.counters_mutex);
- for (agent = counters; agent; agent = agent->next) {
+ for (agent = log_profiler.counters; agent; agent = agent->next) {
if (agent->emitted)
continue;
emit_event (logbuffer, TYPE_SAMPLE_COUNTERS_DESC | TYPE_SAMPLE);
emit_value (logbuffer, len);
- for (agent = counters; agent; agent = agent->next) {
+ for (agent = log_profiler.counters; agent; agent = agent->next) {
const char *name;
if (agent->emitted)
emit_byte (logbuffer, mono_counter_get_variance (agent->counter));
emit_value (logbuffer, agent->index);
- agent->emitted = 1;
+ agent->emitted = TRUE;
}
- EXIT_LOG_EXPLICIT (DO_SEND);
+ EXIT_LOG;
done:
- mono_os_mutex_unlock (&counters_mutex);
+ mono_os_mutex_unlock (&log_profiler.counters_mutex);
}
static void
-counters_sample (MonoProfiler *profiler, uint64_t timestamp)
+counters_sample (uint64_t timestamp)
{
MonoCounterAgent *agent;
MonoCounter *counter;
void *buffer;
int size;
- counters_emit (profiler);
+ counters_emit ();
buffer_size = 8;
buffer = g_calloc (1, buffer_size);
- mono_os_mutex_lock (&counters_mutex);
+ mono_os_mutex_lock (&log_profiler.counters_mutex);
size =
EVENT_SIZE /* event */
;
- for (agent = counters; agent; agent = agent->next) {
+ for (agent = log_profiler.counters; agent; agent = agent->next) {
size +=
LEB128_SIZE /* index */ +
BYTE_SIZE /* type */ +
emit_event_time (logbuffer, TYPE_SAMPLE_COUNTERS | TYPE_SAMPLE, timestamp);
- for (agent = counters; agent; agent = agent->next) {
+ for (agent = log_profiler.counters; agent; agent = agent->next) {
size_t size;
counter = agent->counter;
emit_value (logbuffer, 0);
- EXIT_LOG_EXPLICIT (DO_SEND);
+ EXIT_LOG;
- mono_os_mutex_unlock (&counters_mutex);
+ mono_os_mutex_unlock (&log_profiler.counters_mutex);
}
-typedef struct _PerfCounterAgent PerfCounterAgent;
-struct _PerfCounterAgent {
- PerfCounterAgent *next;
- int index;
- char *category_name;
- char *name;
- int type;
- gint64 value;
- guint8 emitted;
- guint8 updated;
- guint8 deleted;
-};
-
-static PerfCounterAgent *perfcounters = NULL;
-
static void
-perfcounters_emit (MonoProfiler *profiler)
+perfcounters_emit (void)
{
PerfCounterAgent *pcagent;
int len = 0;
LEB128_SIZE /* len */
;
- for (pcagent = perfcounters; pcagent; pcagent = pcagent->next) {
+ for (pcagent = log_profiler.perfcounters; pcagent; pcagent = pcagent->next) {
if (pcagent->emitted)
continue;
emit_event (logbuffer, TYPE_SAMPLE_COUNTERS_DESC | TYPE_SAMPLE);
emit_value (logbuffer, len);
- for (pcagent = perfcounters; pcagent; pcagent = pcagent->next) {
+ for (pcagent = log_profiler.perfcounters; pcagent; pcagent = pcagent->next) {
if (pcagent->emitted)
continue;
emit_byte (logbuffer, MONO_COUNTER_VARIABLE);
emit_value (logbuffer, pcagent->index);
- pcagent->emitted = 1;
+ pcagent->emitted = TRUE;
}
- EXIT_LOG_EXPLICIT (DO_SEND);
+ EXIT_LOG;
}
static gboolean
{
PerfCounterAgent *pcagent;
- for (pcagent = perfcounters; pcagent; pcagent = pcagent->next) {
+ for (pcagent = log_profiler.perfcounters; pcagent; pcagent = pcagent->next) {
if (strcmp (pcagent->category_name, category_name) != 0 || strcmp (pcagent->name, name) != 0)
continue;
if (pcagent->value == value)
return TRUE;
pcagent->value = value;
- pcagent->updated = 1;
- pcagent->deleted = 0;
+ pcagent->updated = TRUE;
+ pcagent->deleted = FALSE;
return TRUE;
}
pcagent = g_new0 (PerfCounterAgent, 1);
- pcagent->next = perfcounters;
- pcagent->index = counters_index++;
+ pcagent->next = log_profiler.perfcounters;
+ pcagent->index = log_profiler.counters_index++;
pcagent->category_name = g_strdup (category_name);
pcagent->name = g_strdup (name);
- pcagent->type = (int) type;
pcagent->value = value;
- pcagent->emitted = 0;
- pcagent->updated = 1;
- pcagent->deleted = 0;
+ pcagent->emitted = FALSE;
+ pcagent->updated = TRUE;
+ pcagent->deleted = FALSE;
- perfcounters = pcagent;
+ log_profiler.perfcounters = pcagent;
return TRUE;
}
static void
-perfcounters_sample (MonoProfiler *profiler, uint64_t timestamp)
+perfcounters_sample (uint64_t timestamp)
{
PerfCounterAgent *pcagent;
int len = 0;
int size;
- mono_os_mutex_lock (&counters_mutex);
+ mono_os_mutex_lock (&log_profiler.counters_mutex);
/* mark all perfcounters as deleted, foreach will unmark them as necessary */
- for (pcagent = perfcounters; pcagent; pcagent = pcagent->next)
- pcagent->deleted = 1;
+ for (pcagent = log_profiler.perfcounters; pcagent; pcagent = pcagent->next)
+ pcagent->deleted = TRUE;
- mono_perfcounter_foreach (perfcounters_foreach, perfcounters);
+ mono_perfcounter_foreach (perfcounters_foreach, NULL);
- perfcounters_emit (profiler);
+ perfcounters_emit ();
size =
EVENT_SIZE /* event */
;
- for (pcagent = perfcounters; pcagent; pcagent = pcagent->next) {
+ for (pcagent = log_profiler.perfcounters; pcagent; pcagent = pcagent->next) {
if (pcagent->deleted || !pcagent->updated)
continue;
emit_event_time (logbuffer, TYPE_SAMPLE_COUNTERS | TYPE_SAMPLE, timestamp);
- for (pcagent = perfcounters; pcagent; pcagent = pcagent->next) {
+ for (pcagent = log_profiler.perfcounters; pcagent; pcagent = pcagent->next) {
if (pcagent->deleted || !pcagent->updated)
continue;
emit_uvalue (logbuffer, pcagent->index);
emit_byte (logbuffer, MONO_COUNTER_LONG);
emit_svalue (logbuffer, pcagent->value);
- pcagent->updated = 0;
+ pcagent->updated = FALSE;
}
emit_value (logbuffer, 0);
- EXIT_LOG_EXPLICIT (DO_SEND);
+ EXIT_LOG;
done:
- mono_os_mutex_unlock (&counters_mutex);
+ mono_os_mutex_unlock (&log_profiler.counters_mutex);
}
static void
-counters_and_perfcounters_sample (MonoProfiler *prof)
+counters_and_perfcounters_sample (void)
{
uint64_t now = current_time ();
- counters_sample (prof, now);
- perfcounters_sample (prof, now);
+ counters_sample (now);
+ perfcounters_sample (now);
}
-#define COVERAGE_DEBUG(x) if (debug_coverage) {x}
-static mono_mutex_t coverage_mutex;
-static MonoConcurrentHashTable *coverage_methods = NULL;
-static MonoConcurrentHashTable *coverage_assemblies = NULL;
-static MonoConcurrentHashTable *coverage_classes = NULL;
-
-static MonoConcurrentHashTable *filtered_classes = NULL;
-static MonoConcurrentHashTable *image_to_methods = NULL;
-static MonoConcurrentHashTable *suppressed_assemblies = NULL;
-static gboolean coverage_initialized = FALSE;
-
-static GPtrArray *coverage_data = NULL;
-static int previous_offset = 0;
-
typedef struct {
MonoLockFreeQueueNode node;
MonoMethod *method;
static void
obtain_coverage_for_method (MonoProfiler *prof, const MonoProfilerCoverageData *entry)
{
- int offset = entry->il_offset - previous_offset;
+ int offset = entry->il_offset - log_profiler.coverage_previous_offset;
CoverageEntry *e = g_new (CoverageEntry, 1);
- previous_offset = entry->il_offset;
+ log_profiler.coverage_previous_offset = entry->il_offset;
e->offset = offset;
e->counter = entry->counter;
e->line = entry->line;
e->column = entry->column;
- g_ptr_array_add (coverage_data, e);
+ g_ptr_array_add (log_profiler.coverage_data, e);
}
static char *
return ret;
}
-static int method_id;
static void
build_method_buffer (gpointer key, gpointer value, gpointer userdata)
{
MonoMethod *method = (MonoMethod *)value;
- MonoProfiler *prof = (MonoProfiler *)userdata;
MonoClass *klass;
MonoImage *image;
char *class_name;
const char *image_name, *method_name, *sig, *first_filename;
guint i;
- previous_offset = 0;
- coverage_data = g_ptr_array_new ();
+ log_profiler.coverage_previous_offset = 0;
+ log_profiler.coverage_data = g_ptr_array_new ();
- mono_profiler_get_coverage_data (prof->handle, method, obtain_coverage_for_method);
+ mono_profiler_get_coverage_data (log_profiler.handle, method, obtain_coverage_for_method);
klass = mono_method_get_class (method);
image = mono_class_get_image (klass);
class_name = parse_generic_type_names (mono_type_get_name (mono_class_get_type (klass)));
method_name = mono_method_get_name (method);
- if (coverage_data->len != 0) {
- CoverageEntry *entry = (CoverageEntry *)coverage_data->pdata[0];
+ if (log_profiler.coverage_data->len != 0) {
+ CoverageEntry *entry = (CoverageEntry *)log_profiler.coverage_data->pdata[0];
first_filename = entry->filename ? entry->filename : "";
} else
first_filename = "";
emit_string (logbuffer, first_filename, strlen (first_filename) + 1);
emit_uvalue (logbuffer, mono_method_get_token (method));
- emit_uvalue (logbuffer, method_id);
- emit_value (logbuffer, coverage_data->len);
+ emit_uvalue (logbuffer, log_profiler.coverage_method_id);
+ emit_value (logbuffer, log_profiler.coverage_data->len);
- EXIT_LOG_EXPLICIT (DO_SEND);
+ EXIT_LOG;
- for (i = 0; i < coverage_data->len; i++) {
- CoverageEntry *entry = (CoverageEntry *)coverage_data->pdata[i];
+ for (i = 0; i < log_profiler.coverage_data->len; i++) {
+ CoverageEntry *entry = (CoverageEntry *)log_profiler.coverage_data->pdata[i];
ENTER_LOG (&coverage_statements_ctr, logbuffer,
EVENT_SIZE /* event */ +
);
emit_event (logbuffer, TYPE_COVERAGE_STATEMENT | TYPE_COVERAGE);
- emit_uvalue (logbuffer, method_id);
+ emit_uvalue (logbuffer, log_profiler.coverage_method_id);
emit_uvalue (logbuffer, entry->offset);
emit_uvalue (logbuffer, entry->counter);
emit_uvalue (logbuffer, entry->line);
emit_uvalue (logbuffer, entry->column);
- EXIT_LOG_EXPLICIT (DO_SEND);
+ EXIT_LOG;
}
- method_id++;
+ log_profiler.coverage_method_id++;
g_free (class_name);
- g_ptr_array_foreach (coverage_data, free_coverage_entry, NULL);
- g_ptr_array_free (coverage_data, TRUE);
- coverage_data = NULL;
+ g_ptr_array_foreach (log_profiler.coverage_data, free_coverage_entry, NULL);
+ g_ptr_array_free (log_profiler.coverage_data, TRUE);
}
/* This empties the queue */
emit_uvalue (logbuffer, fully_covered);
emit_uvalue (logbuffer, partially_covered);
- EXIT_LOG_EXPLICIT (DO_SEND);
+ EXIT_LOG;
g_free (class_name);
}
static void
get_coverage_for_image (MonoImage *image, int *number_of_methods, guint *fully_covered, int *partially_covered)
{
- MonoLockFreeQueue *image_methods = (MonoLockFreeQueue *)mono_conc_hashtable_lookup (image_to_methods, image);
+ MonoLockFreeQueue *image_methods = (MonoLockFreeQueue *)mono_conc_hashtable_lookup (log_profiler.coverage_image_to_methods, image);
*number_of_methods = mono_image_get_table_rows (image, MONO_TABLE_METHOD);
if (image_methods)
emit_uvalue (logbuffer, fully_covered);
emit_uvalue (logbuffer, partially_covered);
- EXIT_LOG_EXPLICIT (DO_SEND);
+ EXIT_LOG;
}
static void
-dump_coverage (MonoProfiler *prof)
+dump_coverage (void)
{
- if (!coverage_initialized)
- return;
-
- COVERAGE_DEBUG(fprintf (stderr, "Coverage: Started dump\n");)
- method_id = 0;
-
- mono_os_mutex_lock (&coverage_mutex);
- mono_conc_hashtable_foreach (coverage_assemblies, build_assembly_buffer, NULL);
- mono_conc_hashtable_foreach (coverage_classes, build_class_buffer, NULL);
- mono_conc_hashtable_foreach (coverage_methods, build_method_buffer, prof);
- mono_os_mutex_unlock (&coverage_mutex);
-
- COVERAGE_DEBUG(fprintf (stderr, "Coverage: Finished dump\n");)
+ mono_os_mutex_lock (&log_profiler.coverage_mutex);
+ mono_conc_hashtable_foreach (log_profiler.coverage_assemblies, build_assembly_buffer, NULL);
+ mono_conc_hashtable_foreach (log_profiler.coverage_classes, build_class_buffer, NULL);
+ mono_conc_hashtable_foreach (log_profiler.coverage_methods, build_method_buffer, NULL);
+ mono_os_mutex_unlock (&log_profiler.coverage_mutex);
}
static MonoLockFreeQueueNode *
MonoLockFreeQueue *image_methods, *class_methods;
MonoLockFreeQueueNode *node;
- g_assert (coverage_initialized && "Why are we being asked for coverage filter info when we're not doing coverage?");
-
- COVERAGE_DEBUG(fprintf (stderr, "Coverage filter for %s\n", mono_method_get_name (method));)
-
flags = mono_method_get_flags (method, &iflags);
- if ((iflags & 0x1000 /*METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL*/) ||
- (flags & 0x2000 /*METHOD_ATTRIBUTE_PINVOKE_IMPL*/)) {
- COVERAGE_DEBUG(fprintf (stderr, " Internal call or pinvoke - ignoring\n");)
+ if ((iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) ||
+ (flags & METHOD_ATTRIBUTE_PINVOKE_IMPL))
return FALSE;
- }
// Don't need to do anything else if we're already tracking this method
- if (mono_conc_hashtable_lookup (coverage_methods, method)) {
- COVERAGE_DEBUG(fprintf (stderr, " Already tracking\n");)
+ if (mono_conc_hashtable_lookup (log_profiler.coverage_methods, method))
return TRUE;
- }
klass = mono_method_get_class (method);
image = mono_class_get_image (klass);
// Don't handle coverage for the core assemblies
- if (mono_conc_hashtable_lookup (suppressed_assemblies, (gpointer) mono_image_get_name (image)) != NULL)
+ if (mono_conc_hashtable_lookup (log_profiler.coverage_suppressed_assemblies, (gpointer) mono_image_get_name (image)) != NULL)
return FALSE;
if (prof->coverage_filters) {
/* Check already filtered classes first */
- if (mono_conc_hashtable_lookup (filtered_classes, klass)) {
- COVERAGE_DEBUG(fprintf (stderr, " Already filtered\n");)
+ if (mono_conc_hashtable_lookup (log_profiler.coverage_filtered_classes, klass))
return FALSE;
- }
classname = mono_type_get_name (mono_class_get_type (klass));
fqn = g_strdup_printf ("[%s]%s", mono_image_get_name (image), classname);
- COVERAGE_DEBUG(fprintf (stderr, " Looking for %s in filter\n", fqn);)
// Check positive filters first
has_positive = FALSE;
found = FALSE;
if (filter [0] == '+') {
filter = &filter [1];
- COVERAGE_DEBUG(fprintf (stderr, " Checking against +%s ...", filter);)
-
- if (strstr (fqn, filter) != NULL) {
- COVERAGE_DEBUG(fprintf (stderr, "matched\n");)
+ if (strstr (fqn, filter) != NULL)
found = TRUE;
- } else
- COVERAGE_DEBUG(fprintf (stderr, "no match\n");)
has_positive = TRUE;
}
}
if (has_positive && !found) {
- COVERAGE_DEBUG(fprintf (stderr, " Positive match was not found\n");)
-
- mono_os_mutex_lock (&coverage_mutex);
- mono_conc_hashtable_insert (filtered_classes, klass, klass);
- mono_os_mutex_unlock (&coverage_mutex);
+ mono_os_mutex_lock (&log_profiler.coverage_mutex);
+ mono_conc_hashtable_insert (log_profiler.coverage_filtered_classes, klass, klass);
+ mono_os_mutex_unlock (&log_profiler.coverage_mutex);
g_free (fqn);
g_free (classname);
// Skip '-'
filter = &filter [1];
- COVERAGE_DEBUG(fprintf (stderr, " Checking against -%s ...", filter);)
if (strstr (fqn, filter) != NULL) {
- COVERAGE_DEBUG(fprintf (stderr, "matched\n");)
-
- mono_os_mutex_lock (&coverage_mutex);
- mono_conc_hashtable_insert (filtered_classes, klass, klass);
- mono_os_mutex_unlock (&coverage_mutex);
+ mono_os_mutex_lock (&log_profiler.coverage_mutex);
+ mono_conc_hashtable_insert (log_profiler.coverage_filtered_classes, klass, klass);
+ mono_os_mutex_unlock (&log_profiler.coverage_mutex);
g_free (fqn);
g_free (classname);
return FALSE;
- } else
- COVERAGE_DEBUG(fprintf (stderr, "no match\n");)
-
+ }
}
g_free (fqn);
g_free (classname);
}
- COVERAGE_DEBUG(fprintf (stderr, " Handling coverage for %s\n", mono_method_get_name (method));)
header = mono_method_get_header_checked (method, &error);
mono_error_cleanup (&error);
// generated causing a crash. See https://bugzilla.xamarin.com/show_bug.cgi?id=39325
mono_assembly_addref (assembly);
- mono_os_mutex_lock (&coverage_mutex);
- mono_conc_hashtable_insert (coverage_methods, method, method);
- mono_conc_hashtable_insert (coverage_assemblies, assembly, assembly);
- mono_os_mutex_unlock (&coverage_mutex);
+ mono_os_mutex_lock (&log_profiler.coverage_mutex);
+ mono_conc_hashtable_insert (log_profiler.coverage_methods, method, method);
+ mono_conc_hashtable_insert (log_profiler.coverage_assemblies, assembly, assembly);
+ mono_os_mutex_unlock (&log_profiler.coverage_mutex);
- image_methods = (MonoLockFreeQueue *)mono_conc_hashtable_lookup (image_to_methods, image);
+ image_methods = (MonoLockFreeQueue *)mono_conc_hashtable_lookup (log_profiler.coverage_image_to_methods, image);
if (image_methods == NULL) {
image_methods = (MonoLockFreeQueue *) g_malloc (sizeof (MonoLockFreeQueue));
mono_lock_free_queue_init (image_methods);
- mono_os_mutex_lock (&coverage_mutex);
- mono_conc_hashtable_insert (image_to_methods, image, image_methods);
- mono_os_mutex_unlock (&coverage_mutex);
+ mono_os_mutex_lock (&log_profiler.coverage_mutex);
+ mono_conc_hashtable_insert (log_profiler.coverage_image_to_methods, image, image_methods);
+ mono_os_mutex_unlock (&log_profiler.coverage_mutex);
}
node = create_method_node (method);
mono_lock_free_queue_enqueue (image_methods, node);
- class_methods = (MonoLockFreeQueue *)mono_conc_hashtable_lookup (coverage_classes, klass);
+ class_methods = (MonoLockFreeQueue *)mono_conc_hashtable_lookup (log_profiler.coverage_classes, klass);
if (class_methods == NULL) {
class_methods = (MonoLockFreeQueue *) g_malloc (sizeof (MonoLockFreeQueue));
mono_lock_free_queue_init (class_methods);
- mono_os_mutex_lock (&coverage_mutex);
- mono_conc_hashtable_insert (coverage_classes, klass, class_methods);
- mono_os_mutex_unlock (&coverage_mutex);
+ mono_os_mutex_lock (&log_profiler.coverage_mutex);
+ mono_conc_hashtable_insert (log_profiler.coverage_classes, klass, class_methods);
+ mono_os_mutex_unlock (&log_profiler.coverage_mutex);
}
node = create_method_node (method);
char *line;
FILE *sa_file;
- suppressed_assemblies = mono_conc_hashtable_new (g_str_hash, g_str_equal);
+ log_profiler.coverage_suppressed_assemblies = mono_conc_hashtable_new (g_str_hash, g_str_equal);
sa_file = fopen (SUPPRESSION_DIR "/mono-profiler-log.suppression", "r");
if (sa_file == NULL)
return;
/* Don't need to free @content as it is referred to by the lines stored in @suppressed_assemblies */
content = get_file_content (sa_file);
- if (content == NULL) {
- g_error ("mono-profiler-log.suppression is greater than 128kb - aborting\n");
- }
+ if (content == NULL)
+ g_error ("mono-profiler-log.suppression is greater than 128kb - aborting.");
while ((line = get_next_line (content, &content))) {
line = g_strchomp (g_strchug (line));
/* No locking needed as we're doing initialization */
- mono_conc_hashtable_insert (suppressed_assemblies, line, line);
+ mono_conc_hashtable_insert (log_profiler.coverage_suppressed_assemblies, line, line);
}
fclose (sa_file);
static void
parse_cov_filter_file (GPtrArray *filters, const char *file)
{
- FILE *filter_file;
- char *line, *content;
+ FILE *filter_file = fopen (file, "r");
- filter_file = fopen (file, "r");
if (filter_file == NULL) {
- fprintf (stderr, "Unable to open %s\n", file);
+ mono_profiler_printf_err ("Could not open coverage filter file '%s'.", file);
return;
}
/* Don't need to free content as it is referred to by the lines stored in @filters */
- content = get_file_content (filter_file);
+ char *content = get_file_content (filter_file);
+
if (content == NULL)
- fprintf (stderr, "WARNING: %s is greater than 128kb - ignoring\n", file);
+ mono_profiler_printf_err ("Coverage filter file '%s' is larger than 128kb - ignoring.", file);
+
+ char *line;
while ((line = get_next_line (content, &content)))
g_ptr_array_add (filters, g_strchug (g_strchomp (line)));
}
static void
-coverage_init (MonoProfiler *prof)
-{
- g_assert (!coverage_initialized && "Why are we initializing coverage twice?");
-
- COVERAGE_DEBUG(fprintf (stderr, "Coverage initialized\n");)
-
- mono_os_mutex_init (&coverage_mutex);
- coverage_methods = mono_conc_hashtable_new (NULL, NULL);
- coverage_assemblies = mono_conc_hashtable_new (NULL, NULL);
- coverage_classes = mono_conc_hashtable_new (NULL, NULL);
- filtered_classes = mono_conc_hashtable_new (NULL, NULL);
- image_to_methods = mono_conc_hashtable_new (NULL, NULL);
+coverage_init (void)
+{
+ mono_os_mutex_init (&log_profiler.coverage_mutex);
+ log_profiler.coverage_methods = mono_conc_hashtable_new (NULL, NULL);
+ log_profiler.coverage_assemblies = mono_conc_hashtable_new (NULL, NULL);
+ log_profiler.coverage_classes = mono_conc_hashtable_new (NULL, NULL);
+ log_profiler.coverage_filtered_classes = mono_conc_hashtable_new (NULL, NULL);
+ log_profiler.coverage_image_to_methods = mono_conc_hashtable_new (NULL, NULL);
init_suppressed_assemblies ();
-
- coverage_initialized = TRUE;
}
static void
}
static void
-cleanup_reusable_samples (MonoProfiler *prof)
+cleanup_reusable_samples (void)
{
SampleHit *sample;
- while ((sample = (SampleHit *) mono_lock_free_queue_dequeue (&prof->sample_reuse_queue)))
+ while ((sample = (SampleHit *) mono_lock_free_queue_dequeue (&log_profiler.sample_reuse_queue)))
mono_thread_hazardous_try_free (sample, free_sample_hit);
}
+static void
+log_early_shutdown (MonoProfiler *prof)
+{
+ if (log_config.hs_on_shutdown) {
+ InterlockedWrite (&log_profiler.heapshot_requested, 1);
+ mono_gc_collect (mono_gc_max_generation ());
+ }
+}
+
static void
log_shutdown (MonoProfiler *prof)
{
- InterlockedWrite (&in_shutdown, 1);
+ InterlockedWrite (&log_profiler.in_shutdown, 1);
- if (!no_counters)
- counters_and_perfcounters_sample (prof);
+ if (ENABLED (PROFLOG_COUNTER_EVENTS))
+ counters_and_perfcounters_sample ();
- dump_coverage (prof);
+ if (log_config.collect_coverage)
+ dump_coverage ();
char c = 1;
if (write (prof->pipes [1], &c, 1) != 1) {
- fprintf (stderr, "Could not write to pipe: %s\n", strerror (errno));
+ mono_profiler_printf_err ("Could not write to log profiler pipe: %s", g_strerror (errno));
exit (1);
}
mono_native_thread_join (prof->helper_thread);
- mono_os_mutex_destroy (&counters_mutex);
+ mono_os_mutex_destroy (&log_profiler.counters_mutex);
MonoCounterAgent *mc_next;
- for (MonoCounterAgent *cur = counters; cur; cur = mc_next) {
+ for (MonoCounterAgent *cur = log_profiler.counters; cur; cur = mc_next) {
mc_next = cur->next;
g_free (cur);
}
PerfCounterAgent *pc_next;
- for (PerfCounterAgent *cur = perfcounters; cur; cur = pc_next) {
+ for (PerfCounterAgent *cur = log_profiler.perfcounters; cur; cur = pc_next) {
pc_next = cur->next;
g_free (cur);
}
* not immediately removed upon calling mono_lls_remove (), by
* iterating until the head is NULL.
*/
- while (profiler_thread_list.head) {
- MONO_LLS_FOREACH_SAFE (&profiler_thread_list, MonoProfilerThread, thread) {
+ while (log_profiler.profiler_thread_list.head) {
+ MONO_LLS_FOREACH_SAFE (&log_profiler.profiler_thread_list, MonoProfilerThread, thread) {
g_assert (thread->attached && "Why is a thread in the LLS not attached?");
remove_thread (thread);
*/
mono_thread_hazardous_try_free_all ();
- cleanup_reusable_samples (prof);
+ cleanup_reusable_samples ();
/*
* Finally, make sure that all sample hits are freed. This should cover all
*/
mono_thread_hazardous_try_free_all ();
- gint32 state = InterlockedRead (&buffer_lock_state);
+ gint32 state = InterlockedRead (&log_profiler.buffer_lock_state);
g_assert (!(state & 0xFFFF) && "Why is the reader count still non-zero?");
g_assert (!(state >> 16) && "Why is the exclusive lock still held?");
mono_conc_hashtable_destroy (prof->method_table);
mono_os_mutex_destroy (&prof->method_table_mutex);
- if (coverage_initialized) {
- mono_os_mutex_lock (&coverage_mutex);
- mono_conc_hashtable_foreach (coverage_assemblies, unref_coverage_assemblies, prof);
- mono_os_mutex_unlock (&coverage_mutex);
+ if (log_config.collect_coverage) {
+ mono_os_mutex_lock (&log_profiler.coverage_mutex);
+ mono_conc_hashtable_foreach (log_profiler.coverage_assemblies, unref_coverage_assemblies, NULL);
+ mono_os_mutex_unlock (&log_profiler.coverage_mutex);
- mono_conc_hashtable_destroy (coverage_methods);
- mono_conc_hashtable_destroy (coverage_assemblies);
- mono_conc_hashtable_destroy (coverage_classes);
- mono_conc_hashtable_destroy (filtered_classes);
+ mono_conc_hashtable_destroy (log_profiler.coverage_methods);
+ mono_conc_hashtable_destroy (log_profiler.coverage_assemblies);
+ mono_conc_hashtable_destroy (log_profiler.coverage_classes);
+ mono_conc_hashtable_destroy (log_profiler.coverage_filtered_classes);
- mono_conc_hashtable_destroy (image_to_methods);
- mono_conc_hashtable_destroy (suppressed_assemblies);
- mono_os_mutex_destroy (&coverage_mutex);
+ mono_conc_hashtable_destroy (log_profiler.coverage_image_to_methods);
+ mono_conc_hashtable_destroy (log_profiler.coverage_suppressed_assemblies);
+ mono_os_mutex_destroy (&log_profiler.coverage_mutex);
}
+ mono_coop_mutex_destroy (&log_profiler.api_mutex);
+
PROF_TLS_FREE ();
g_free (prof->args);
- g_free (prof);
}
static char*
* error and exiting.
*/
if (fd >= FD_SETSIZE) {
- fprintf (stderr, "File descriptor is out of bounds for fd_set: %d\n", fd);
+ mono_profiler_printf_err ("File descriptor is out of bounds for fd_set: %d", fd);
exit (1);
}
static void *
helper_thread (void *arg)
{
- MonoProfiler *prof = (MonoProfiler *) arg;
-
mono_threads_attach_tools_thread ();
mono_native_thread_set_name (mono_native_thread_id_get (), "Profiler helper");
- MonoProfilerThread *thread = init_thread (prof, FALSE);
+ MonoProfilerThread *thread = init_thread (FALSE);
GArray *command_sockets = g_array_new (FALSE, FALSE, sizeof (int));
FD_ZERO (&rfds);
- add_to_fd_set (&rfds, prof->server_socket, &max_fd);
- add_to_fd_set (&rfds, prof->pipes [0], &max_fd);
+ add_to_fd_set (&rfds, log_profiler.server_socket, &max_fd);
+ add_to_fd_set (&rfds, log_profiler.pipes [0], &max_fd);
for (gint i = 0; i < command_sockets->len; i++)
add_to_fd_set (&rfds, g_array_index (command_sockets, int, i), &max_fd);
if (errno == EINTR)
continue;
- fprintf (stderr, "Error in mono-profiler-log server: %s", strerror (errno));
+ mono_profiler_printf_err ("Could not poll in log profiler helper thread: %s", g_strerror (errno));
exit (1);
}
- if (!no_counters)
- counters_and_perfcounters_sample (prof);
+ if (ENABLED (PROFLOG_COUNTER_EVENTS))
+ counters_and_perfcounters_sample ();
buffer_lock_excl ();
buffer_unlock_excl ();
// Are we shutting down?
- if (FD_ISSET (prof->pipes [0], &rfds)) {
+ if (FD_ISSET (log_profiler.pipes [0], &rfds)) {
char c;
- read (prof->pipes [0], &c, 1);
+ read (log_profiler.pipes [0], &c, 1);
break;
}
buf [len] = 0;
- if (!strcmp (buf, "heapshot\n") && hs_mode_ondemand) {
+ if (log_config.hs_mode == MONO_PROFILER_HEAPSHOT_ON_DEMAND && !strcmp (buf, "heapshot\n")) {
// Rely on the finalization callback triggering a GC.
- heapshot_requested = 1;
+ InterlockedWrite (&log_profiler.heapshot_requested, 1);
mono_gc_finalize_notify ();
}
}
- if (FD_ISSET (prof->server_socket, &rfds)) {
- int fd = accept (prof->server_socket, NULL, NULL);
+ if (FD_ISSET (log_profiler.server_socket, &rfds)) {
+ int fd = accept (log_profiler.server_socket, NULL, NULL);
if (fd != -1) {
if (fd >= FD_SETSIZE)
}
static void
-start_helper_thread (MonoProfiler* prof)
+start_helper_thread (void)
{
- if (pipe (prof->pipes) == -1) {
- fprintf (stderr, "Cannot create pipe: %s\n", strerror (errno));
+ if (pipe (log_profiler.pipes) == -1) {
+ mono_profiler_printf_err ("Could not create log profiler pipe: %s", g_strerror (errno));
exit (1);
}
- prof->server_socket = socket (PF_INET, SOCK_STREAM, 0);
+ log_profiler.server_socket = socket (PF_INET, SOCK_STREAM, 0);
- if (prof->server_socket == -1) {
- fprintf (stderr, "Cannot create server socket: %s\n", strerror (errno));
+ if (log_profiler.server_socket == -1) {
+ mono_profiler_printf_err ("Could not create log profiler server socket: %s", g_strerror (errno));
exit (1);
}
memset (&server_address, 0, sizeof (server_address));
server_address.sin_family = AF_INET;
server_address.sin_addr.s_addr = INADDR_ANY;
- server_address.sin_port = htons (prof->command_port);
+ server_address.sin_port = htons (log_profiler.command_port);
- if (bind (prof->server_socket, (struct sockaddr *) &server_address, sizeof (server_address)) == -1) {
- fprintf (stderr, "Cannot bind server socket on port %d: %s\n", prof->command_port, strerror (errno));
- close (prof->server_socket);
+ if (bind (log_profiler.server_socket, (struct sockaddr *) &server_address, sizeof (server_address)) == -1) {
+ mono_profiler_printf_err ("Could not bind log profiler server socket on port %d: %s", log_profiler.command_port, g_strerror (errno));
+ close (log_profiler.server_socket);
exit (1);
}
- if (listen (prof->server_socket, 1) == -1) {
- fprintf (stderr, "Cannot listen on server socket: %s\n", strerror (errno));
- close (prof->server_socket);
+ if (listen (log_profiler.server_socket, 1) == -1) {
+ mono_profiler_printf_err ("Could not listen on log profiler server socket: %s", g_strerror (errno));
+ close (log_profiler.server_socket);
exit (1);
}
socklen_t slen = sizeof (server_address);
- if (getsockname (prof->server_socket, (struct sockaddr *) &server_address, &slen)) {
- fprintf (stderr, "Could not get assigned port: %s\n", strerror (errno));
- close (prof->server_socket);
+ if (getsockname (log_profiler.server_socket, (struct sockaddr *) &server_address, &slen)) {
+ mono_profiler_printf_err ("Could not retrieve assigned port for log profiler server socket: %s", g_strerror (errno));
+ close (log_profiler.server_socket);
exit (1);
}
- prof->command_port = ntohs (server_address.sin_port);
+ log_profiler.command_port = ntohs (server_address.sin_port);
- if (!mono_native_thread_create (&prof->helper_thread, helper_thread, prof)) {
- fprintf (stderr, "Could not start helper thread\n");
- close (prof->server_socket);
+ if (!mono_native_thread_create (&log_profiler.helper_thread, helper_thread, NULL)) {
+ mono_profiler_printf_err ("Could not start log profiler helper thread");
+ close (log_profiler.server_socket);
exit (1);
}
}
}
static gboolean
-handle_writer_queue_entry (MonoProfiler *prof)
+handle_writer_queue_entry (void)
{
WriterQueueEntry *entry;
- if ((entry = (WriterQueueEntry *) mono_lock_free_queue_dequeue (&prof->writer_queue))) {
+ if ((entry = (WriterQueueEntry *) mono_lock_free_queue_dequeue (&log_profiler.writer_queue))) {
if (!entry->methods)
goto no_methods;
for (guint i = 0; i < entry->methods->len; i++) {
MethodInfo *info = (MethodInfo *) g_ptr_array_index (entry->methods, i);
- if (mono_conc_hashtable_lookup (prof->method_table, info->method))
+ if (mono_conc_hashtable_lookup (log_profiler.method_table, info->method))
goto free_info; // This method already has metadata emitted.
/*
* method lists will just be empty for the rest of the
* app's lifetime.
*/
- mono_os_mutex_lock (&prof->method_table_mutex);
- mono_conc_hashtable_insert (prof->method_table, info->method, info->method);
- mono_os_mutex_unlock (&prof->method_table_mutex);
+ mono_os_mutex_lock (&log_profiler.method_table_mutex);
+ mono_conc_hashtable_insert (log_profiler.method_table, info->method, info->method);
+ mono_os_mutex_unlock (&log_profiler.method_table_mutex);
char *name = mono_method_full_name (info->method, 1);
int nlen = strlen (name) + 1;
if (wrote_methods) {
MonoProfilerThread *thread = PROF_TLS_GET ();
- dump_buffer_threadless (prof, thread->buffer);
+ dump_buffer_threadless (thread->buffer);
init_buffer_state (thread);
}
no_methods:
- dump_buffer (prof, entry->buffer);
+ dump_buffer (entry->buffer);
mono_thread_hazardous_try_free (entry, free_writer_entry);
static void *
writer_thread (void *arg)
{
- MonoProfiler *prof = (MonoProfiler *)arg;
-
mono_threads_attach_tools_thread ();
mono_native_thread_set_name (mono_native_thread_id_get (), "Profiler writer");
- dump_header (prof);
+ dump_header ();
- MonoProfilerThread *thread = init_thread (prof, FALSE);
+ MonoProfilerThread *thread = init_thread (FALSE);
- while (InterlockedRead (&prof->run_writer_thread)) {
- mono_os_sem_wait (&prof->writer_queue_sem, MONO_SEM_FLAGS_NONE);
- handle_writer_queue_entry (prof);
+ while (InterlockedRead (&log_profiler.run_writer_thread)) {
+ mono_os_sem_wait (&log_profiler.writer_queue_sem, MONO_SEM_FLAGS_NONE);
+ handle_writer_queue_entry ();
}
/* Drain any remaining entries on shutdown. */
- while (handle_writer_queue_entry (prof));
+ while (handle_writer_queue_entry ());
free_buffer (thread->buffer, thread->buffer->size);
deinit_thread (thread);
}
static void
-start_writer_thread (MonoProfiler* prof)
+start_writer_thread (void)
{
- InterlockedWrite (&prof->run_writer_thread, 1);
+ InterlockedWrite (&log_profiler.run_writer_thread, 1);
- if (!mono_native_thread_create (&prof->writer_thread, writer_thread, prof)) {
- fprintf (stderr, "Could not start writer thread\n");
+ if (!mono_native_thread_create (&log_profiler.writer_thread, writer_thread, NULL)) {
+ mono_profiler_printf_err ("Could not start log profiler writer thread");
exit (1);
}
}
SampleHit *sample = p;
mono_lock_free_queue_node_unpoison (&sample->node);
- mono_lock_free_queue_enqueue (&sample->prof->sample_reuse_queue, &sample->node);
+ mono_lock_free_queue_enqueue (&log_profiler.sample_reuse_queue, &sample->node);
}
static gboolean
-handle_dumper_queue_entry (MonoProfiler *prof)
+handle_dumper_queue_entry (void)
{
SampleHit *sample;
- if ((sample = (SampleHit *) mono_lock_free_queue_dequeue (&prof->dumper_queue))) {
+ if ((sample = (SampleHit *) mono_lock_free_queue_dequeue (&log_profiler.dumper_queue))) {
for (int i = 0; i < sample->count; ++i) {
MonoMethod *method = sample->frames [i].method;
MonoDomain *domain = sample->frames [i].domain;
ENTER_LOG (&sample_hits_ctr, logbuffer,
EVENT_SIZE /* event */ +
- BYTE_SIZE /* type */ +
LEB128_SIZE /* tid */ +
LEB128_SIZE /* count */ +
1 * (
for (int i = 0; i < sample->count; ++i)
emit_method (logbuffer, sample->frames [i].method);
- EXIT_LOG_EXPLICIT (DO_SEND);
+ EXIT_LOG;
mono_thread_hazardous_try_free (sample, reuse_sample_hit);
- dump_unmanaged_coderefs (prof);
+ dump_unmanaged_coderefs ();
}
return FALSE;
static void *
dumper_thread (void *arg)
{
- MonoProfiler *prof = (MonoProfiler *)arg;
-
mono_threads_attach_tools_thread ();
mono_native_thread_set_name (mono_native_thread_id_get (), "Profiler dumper");
- MonoProfilerThread *thread = init_thread (prof, FALSE);
+ MonoProfilerThread *thread = init_thread (FALSE);
- while (InterlockedRead (&prof->run_dumper_thread)) {
+ while (InterlockedRead (&log_profiler.run_dumper_thread)) {
/*
* Flush samples every second so it doesn't seem like the profiler is
* not working if the program is mostly idle.
*/
- if (mono_os_sem_timedwait (&prof->dumper_queue_sem, 1000, MONO_SEM_FLAGS_NONE) == MONO_SEM_TIMEDWAIT_RET_TIMEDOUT)
+ if (mono_os_sem_timedwait (&log_profiler.dumper_queue_sem, 1000, MONO_SEM_FLAGS_NONE) == MONO_SEM_TIMEDWAIT_RET_TIMEDOUT)
send_log_unsafe (FALSE);
- handle_dumper_queue_entry (prof);
+ handle_dumper_queue_entry ();
}
/* Drain any remaining entries on shutdown. */
- while (handle_dumper_queue_entry (prof));
+ while (handle_dumper_queue_entry ());
send_log_unsafe (FALSE);
deinit_thread (thread);
}
static void
-start_dumper_thread (MonoProfiler* prof)
+start_dumper_thread (void)
{
- InterlockedWrite (&prof->run_dumper_thread, 1);
+ InterlockedWrite (&log_profiler.run_dumper_thread, 1);
- if (!mono_native_thread_create (&prof->dumper_thread, dumper_thread, prof)) {
- fprintf (stderr, "Could not start dumper thread\n");
+ if (!mono_native_thread_create (&log_profiler.dumper_thread, dumper_thread, NULL)) {
+ mono_profiler_printf_err ("Could not start log profiler dumper thread");
exit (1);
}
}
mono_counters_register (name, MONO_COUNTER_UINT | MONO_COUNTER_PROFILER | MONO_COUNTER_MONOTONIC, counter);
}
+ICALL_EXPORT gint32
+proflog_icall_GetMaxStackTraceFrames (void)
+{
+ return MAX_FRAMES;
+}
+
+ICALL_EXPORT gint32
+proflog_icall_GetStackTraceFrames (void)
+{
+ return log_config.num_frames;
+}
+
+ICALL_EXPORT void
+proflog_icall_SetStackTraceFrames (gint32 value)
+{
+ log_config.num_frames = value;
+}
+
+ICALL_EXPORT MonoProfilerHeapshotMode
+proflog_icall_GetHeapshotMode (void)
+{
+ return log_config.hs_mode;
+}
+
+ICALL_EXPORT void
+proflog_icall_SetHeapshotMode (MonoProfilerHeapshotMode value)
+{
+ log_config.hs_mode = value;
+}
+
+ICALL_EXPORT gint32
+proflog_icall_GetHeapshotMillisecondsFrequency (void)
+{
+ return log_config.hs_freq_ms;
+}
+
+ICALL_EXPORT void
+proflog_icall_SetHeapshotMillisecondsFrequency (gint32 value)
+{
+ log_config.hs_freq_ms = value;
+}
+
+ICALL_EXPORT gint32
+proflog_icall_GetHeapshotCollectionsFrequency (void)
+{
+ return log_config.hs_freq_gc;
+}
+
+ICALL_EXPORT void
+proflog_icall_SetHeapshotCollectionsFrequency (gint32 value)
+{
+ log_config.hs_freq_gc = value;
+}
+
+ICALL_EXPORT gint32
+proflog_icall_GetCallDepth (void)
+{
+ return log_config.max_call_depth;
+}
+
+ICALL_EXPORT void
+proflog_icall_SetCallDepth (gint32 value)
+{
+ log_config.max_call_depth = value;
+}
+
+ICALL_EXPORT void
+proflog_icall_GetSampleMode (MonoProfilerSampleMode *mode, gint32 *frequency)
+{
+ uint32_t freq;
+
+ mono_profiler_get_sample_mode (log_profiler.handle, mode, &freq);
+
+ *frequency = freq;
+}
+
+ICALL_EXPORT MonoBoolean
+proflog_icall_SetSampleMode (MonoProfilerSampleMode mode, gint32 frequency)
+{
+ mono_coop_mutex_lock (&log_profiler.api_mutex);
+
+ mono_bool result = mono_profiler_set_sample_mode (log_profiler.handle, mode, frequency);
+
+ if (mode != MONO_PROFILER_SAMPLE_MODE_NONE) {
+ ENABLE (PROFLOG_SAMPLE_EVENTS);
+ mono_profiler_set_sample_hit_callback (log_profiler.handle, mono_sample_hit);
+ } else {
+ DISABLE (PROFLOG_SAMPLE_EVENTS);
+ mono_profiler_set_sample_hit_callback (log_profiler.handle, NULL);
+ }
+
+ mono_coop_mutex_unlock (&log_profiler.api_mutex);
+
+ return result;
+}
+
+ICALL_EXPORT MonoBoolean
+proflog_icall_GetExceptionEvents (void)
+{
+ return ENABLED (PROFLOG_EXCEPTION_EVENTS);
+}
+
+ICALL_EXPORT void
+proflog_icall_SetExceptionEvents (MonoBoolean value)
+{
+ mono_coop_mutex_lock (&log_profiler.api_mutex);
+
+ if (value) {
+ ENABLE (PROFLOG_EXCEPTION_EVENTS);
+ mono_profiler_set_exception_throw_callback (log_profiler.handle, throw_exc);
+ mono_profiler_set_exception_clause_callback (log_profiler.handle, clause_exc);
+ } else {
+ DISABLE (PROFLOG_EXCEPTION_EVENTS);
+ mono_profiler_set_exception_throw_callback (log_profiler.handle, NULL);
+ mono_profiler_set_exception_clause_callback (log_profiler.handle, NULL);
+ }
+
+ mono_coop_mutex_unlock (&log_profiler.api_mutex);
+}
+
+ICALL_EXPORT MonoBoolean
+proflog_icall_GetMonitorEvents (void)
+{
+ return ENABLED (PROFLOG_MONITOR_EVENTS);
+}
+
+ICALL_EXPORT void
+proflog_icall_SetMonitorEvents (MonoBoolean value)
+{
+ mono_coop_mutex_lock (&log_profiler.api_mutex);
+
+ if (value) {
+ ENABLE (PROFLOG_EXCEPTION_EVENTS);
+ mono_profiler_set_monitor_contention_callback (log_profiler.handle, monitor_contention);
+ mono_profiler_set_monitor_acquired_callback (log_profiler.handle, monitor_acquired);
+ mono_profiler_set_monitor_failed_callback (log_profiler.handle, monitor_failed);
+ } else {
+ DISABLE (PROFLOG_EXCEPTION_EVENTS);
+ mono_profiler_set_monitor_contention_callback (log_profiler.handle, NULL);
+ mono_profiler_set_monitor_acquired_callback (log_profiler.handle, NULL);
+ mono_profiler_set_monitor_failed_callback (log_profiler.handle, NULL);
+ }
+
+ mono_coop_mutex_unlock (&log_profiler.api_mutex);
+}
+
+ICALL_EXPORT MonoBoolean
+proflog_icall_GetGCEvents (void)
+{
+ return ENABLED (PROFLOG_GC_EVENTS);
+}
+
+ICALL_EXPORT void
+proflog_icall_SetGCEvents (MonoBoolean value)
+{
+ mono_coop_mutex_lock (&log_profiler.api_mutex);
+
+ if (value)
+ ENABLE (PROFLOG_GC_EVENTS);
+ else
+ DISABLE (PROFLOG_GC_EVENTS);
+
+ mono_coop_mutex_unlock (&log_profiler.api_mutex);
+}
+
+ICALL_EXPORT MonoBoolean
+proflog_icall_GetGCAllocationEvents (void)
+{
+ return ENABLED (PROFLOG_GC_ALLOCATION_EVENTS);
+}
+
+ICALL_EXPORT void
+proflog_icall_SetGCAllocationEvents (MonoBoolean value)
+{
+ mono_coop_mutex_lock (&log_profiler.api_mutex);
+
+ if (value) {
+ ENABLE (PROFLOG_GC_ALLOCATION_EVENTS);
+ mono_profiler_set_gc_allocation_callback (log_profiler.handle, gc_alloc);
+ } else {
+ DISABLE (PROFLOG_GC_ALLOCATION_EVENTS);
+ mono_profiler_set_gc_allocation_callback (log_profiler.handle, NULL);
+ }
+
+ mono_coop_mutex_unlock (&log_profiler.api_mutex);
+}
+
+ICALL_EXPORT MonoBoolean
+proflog_icall_GetGCMoveEvents (void)
+{
+ return ENABLED (PROFLOG_GC_MOVE_EVENTS);
+}
+
+ICALL_EXPORT void
+proflog_icall_SetGCMoveEvents (MonoBoolean value)
+{
+ mono_coop_mutex_lock (&log_profiler.api_mutex);
+
+ if (value) {
+ ENABLE (PROFLOG_GC_MOVE_EVENTS);
+ mono_profiler_set_gc_moves_callback (log_profiler.handle, gc_moves);
+ } else {
+ DISABLE (PROFLOG_GC_MOVE_EVENTS);
+ mono_profiler_set_gc_moves_callback (log_profiler.handle, NULL);
+ }
+
+ mono_coop_mutex_unlock (&log_profiler.api_mutex);
+}
+
+ICALL_EXPORT MonoBoolean
+proflog_icall_GetGCRootEvents (void)
+{
+ return ENABLED (PROFLOG_GC_ROOT_EVENTS);
+}
+
+ICALL_EXPORT void
+proflog_icall_SetGCRootEvents (MonoBoolean value)
+{
+ mono_coop_mutex_lock (&log_profiler.api_mutex);
+
+ if (value)
+ ENABLE (PROFLOG_GC_ROOT_EVENTS);
+ else
+ DISABLE (PROFLOG_GC_ROOT_EVENTS);
+
+ mono_coop_mutex_unlock (&log_profiler.api_mutex);
+}
+
+ICALL_EXPORT MonoBoolean
+proflog_icall_GetGCHandleEvents (void)
+{
+ return ENABLED (PROFLOG_GC_HANDLE_EVENTS);
+}
+
+ICALL_EXPORT void
+proflog_icall_SetGCHandleEvents (MonoBoolean value)
+{
+ mono_coop_mutex_lock (&log_profiler.api_mutex);
+
+ if (value) {
+ ENABLE (PROFLOG_GC_HANDLE_EVENTS);
+ mono_profiler_set_gc_handle_created_callback (log_profiler.handle, gc_handle_created);
+ mono_profiler_set_gc_handle_deleted_callback (log_profiler.handle, gc_handle_deleted);
+ } else {
+ DISABLE (PROFLOG_GC_HANDLE_EVENTS);
+ mono_profiler_set_gc_handle_created_callback (log_profiler.handle, NULL);
+ mono_profiler_set_gc_handle_deleted_callback (log_profiler.handle, NULL);
+ }
+
+ mono_coop_mutex_unlock (&log_profiler.api_mutex);
+}
+
+ICALL_EXPORT MonoBoolean
+proflog_icall_GetGCFinalizationEvents (void)
+{
+ return ENABLED (PROFLOG_GC_FINALIZATION_EVENTS);
+}
+
+ICALL_EXPORT void
+proflog_icall_SetGCFinalizationEvents (MonoBoolean value)
+{
+ mono_coop_mutex_lock (&log_profiler.api_mutex);
+
+ if (value) {
+ ENABLE (PROFLOG_GC_FINALIZATION_EVENTS);
+ mono_profiler_set_gc_finalizing_callback (log_profiler.handle, finalize_begin);
+ mono_profiler_set_gc_finalizing_object_callback (log_profiler.handle, finalize_object_begin);
+ mono_profiler_set_gc_finalized_object_callback (log_profiler.handle, finalize_object_end);
+ } else {
+ DISABLE (PROFLOG_GC_FINALIZATION_EVENTS);
+ mono_profiler_set_gc_finalizing_callback (log_profiler.handle, NULL);
+ mono_profiler_set_gc_finalizing_object_callback (log_profiler.handle, NULL);
+ mono_profiler_set_gc_finalized_object_callback (log_profiler.handle, NULL);
+ }
+
+ mono_coop_mutex_unlock (&log_profiler.api_mutex);
+}
+
+ICALL_EXPORT MonoBoolean
+proflog_icall_GetCounterEvents (void)
+{
+ return ENABLED (PROFLOG_COUNTER_EVENTS);
+}
+
+ICALL_EXPORT void
+proflog_icall_SetCounterEvents (MonoBoolean value)
+{
+ mono_coop_mutex_lock (&log_profiler.api_mutex);
+
+ if (value)
+ ENABLE (PROFLOG_COUNTER_EVENTS);
+ else
+ DISABLE (PROFLOG_COUNTER_EVENTS);
+
+ mono_coop_mutex_unlock (&log_profiler.api_mutex);
+}
+
+ICALL_EXPORT MonoBoolean
+proflog_icall_GetJitEvents (void)
+{
+ return ENABLED (PROFLOG_JIT_EVENTS);
+}
+
+ICALL_EXPORT void
+proflog_icall_SetJitEvents (MonoBoolean value)
+{
+ mono_coop_mutex_lock (&log_profiler.api_mutex);
+
+ if (value) {
+ ENABLE (PROFLOG_JIT_EVENTS);
+ mono_profiler_set_jit_code_buffer_callback (log_profiler.handle, code_buffer_new);
+ } else {
+ DISABLE (PROFLOG_JIT_EVENTS);
+ mono_profiler_set_jit_code_buffer_callback (log_profiler.handle, NULL);
+ }
+
+ mono_coop_mutex_unlock (&log_profiler.api_mutex);
+}
+
static void
runtime_initialized (MonoProfiler *profiler)
{
- InterlockedWrite (&runtime_inited, 1);
+ InterlockedWrite (&log_profiler.runtime_inited, 1);
register_counter ("Sample events allocated", &sample_allocations_ctr);
register_counter ("Log buffers allocated", &buffer_allocations_ctr);
register_counter ("Event: Coverage classes", &coverage_classes_ctr);
register_counter ("Event: Coverage assemblies", &coverage_assemblies_ctr);
- counters_init (profiler);
+ counters_init ();
/*
* We must start the helper thread before the writer thread. This is
* because the helper thread sets up the command port which is written to
* the log header by the writer thread.
*/
- start_helper_thread (profiler);
- start_writer_thread (profiler);
- start_dumper_thread (profiler);
+ start_helper_thread ();
+ start_writer_thread ();
+ start_dumper_thread ();
+
+ mono_coop_mutex_init (&log_profiler.api_mutex);
+
+#define ADD_ICALL(NAME) \
+ mono_add_internal_call ("Mono.Profiler.Log.LogProfiler::" EGLIB_STRINGIFY (NAME), proflog_icall_ ## NAME);
+
+ ADD_ICALL (GetMaxStackTraceFrames);
+ ADD_ICALL (GetStackTraceFrames);
+ ADD_ICALL (SetStackTraceFrames);
+ ADD_ICALL (GetHeapshotMode);
+ ADD_ICALL (SetHeapshotMode);
+ ADD_ICALL (GetHeapshotMillisecondsFrequency);
+ ADD_ICALL (SetHeapshotMillisecondsFrequency);
+ ADD_ICALL (GetHeapshotCollectionsFrequency);
+ ADD_ICALL (SetHeapshotCollectionsFrequency);
+ ADD_ICALL (GetCallDepth);
+ ADD_ICALL (SetCallDepth);
+ ADD_ICALL (GetSampleMode);
+ ADD_ICALL (SetSampleMode);
+ ADD_ICALL (GetExceptionEvents);
+ ADD_ICALL (SetExceptionEvents);
+ ADD_ICALL (GetMonitorEvents);
+ ADD_ICALL (SetMonitorEvents);
+ ADD_ICALL (GetGCEvents);
+ ADD_ICALL (SetGCEvents);
+ ADD_ICALL (GetGCAllocationEvents);
+ ADD_ICALL (SetGCAllocationEvents);
+ ADD_ICALL (GetGCMoveEvents);
+ ADD_ICALL (SetGCMoveEvents);
+ ADD_ICALL (GetGCRootEvents);
+ ADD_ICALL (SetGCRootEvents);
+ ADD_ICALL (GetGCHandleEvents);
+ ADD_ICALL (SetGCHandleEvents);
+ ADD_ICALL (GetGCFinalizationEvents);
+ ADD_ICALL (SetGCFinalizationEvents);
+ ADD_ICALL (GetCounterEvents);
+ ADD_ICALL (SetCounterEvents);
+ ADD_ICALL (GetJitEvents);
+ ADD_ICALL (SetJitEvents);
+
+#undef ADD_ICALL
}
static void
create_profiler (const char *args, const char *filename, GPtrArray *filters)
{
char *nf;
- int force_delete = 0;
- log_profiler = (MonoProfiler *) g_calloc (1, sizeof (MonoProfiler));
- log_profiler->args = pstrdup (args);
- log_profiler->command_port = command_port;
-
- if (filename && *filename == '-') {
- force_delete = 1;
- filename++;
- g_warning ("WARNING: the output:-FILENAME option is deprecated, the profiler now always overrides the output file\n");
- }
+ log_profiler.args = pstrdup (args);
+ log_profiler.command_port = log_config.command_port;
//If filename begin with +, append the pid at the end
if (filename && *filename == '+')
filename = g_strdup_printf ("%s.%d", filename + 1, getpid ());
-
if (!filename) {
- if (do_report)
+ if (log_config.do_report)
filename = "|mprof-report -";
else
filename = "output.mlpd";
nf = (char*)filename;
} else {
nf = new_filename (filename);
- if (do_report) {
+ if (log_config.do_report) {
int s = strlen (nf) + 32;
char *p = (char *) g_malloc (s);
snprintf (p, s, "|mprof-report '--out=%s' -", nf);
}
}
if (*nf == '|') {
- log_profiler->file = popen (nf + 1, "w");
- log_profiler->pipe_output = 1;
+ log_profiler.file = popen (nf + 1, "w");
+ log_profiler.pipe_output = 1;
} else if (*nf == '#') {
int fd = strtol (nf + 1, NULL, 10);
- log_profiler->file = fdopen (fd, "a");
- } else {
- if (force_delete)
- unlink (nf);
- log_profiler->file = fopen (nf, "wb");
- }
- if (!log_profiler->file) {
- fprintf (stderr, "Cannot create profiler output: %s\n", nf);
+ log_profiler.file = fdopen (fd, "a");
+ } else
+ log_profiler.file = fopen (nf, "wb");
+
+ if (!log_profiler.file) {
+ mono_profiler_printf_err ("Could not create log profiler output file '%s'.", nf);
exit (1);
}
#if defined (HAVE_SYS_ZLIB)
- if (use_zip)
- log_profiler->gzfile = gzdopen (fileno (log_profiler->file), "wb");
+ if (log_config.use_zip)
+ log_profiler.gzfile = gzdopen (fileno (log_profiler.file), "wb");
#endif
/*
g_assert (SAMPLE_SLOT_SIZE (MAX_FRAMES) * 2 < LOCK_FREE_ALLOC_SB_USABLE_SIZE (SAMPLE_BLOCK_SIZE));
// FIXME: We should free this stuff too.
- mono_lock_free_allocator_init_size_class (&log_profiler->sample_size_class, SAMPLE_SLOT_SIZE (num_frames), SAMPLE_BLOCK_SIZE);
- mono_lock_free_allocator_init_allocator (&log_profiler->sample_allocator, &log_profiler->sample_size_class, MONO_MEM_ACCOUNT_PROFILER);
+ mono_lock_free_allocator_init_size_class (&log_profiler.sample_size_class, SAMPLE_SLOT_SIZE (log_config.num_frames), SAMPLE_BLOCK_SIZE);
+ mono_lock_free_allocator_init_allocator (&log_profiler.sample_allocator, &log_profiler.sample_size_class, MONO_MEM_ACCOUNT_PROFILER);
- mono_lock_free_queue_init (&log_profiler->sample_reuse_queue);
+ mono_lock_free_queue_init (&log_profiler.sample_reuse_queue);
g_assert (sizeof (WriterQueueEntry) * 2 < LOCK_FREE_ALLOC_SB_USABLE_SIZE (WRITER_ENTRY_BLOCK_SIZE));
// FIXME: We should free this stuff too.
- mono_lock_free_allocator_init_size_class (&log_profiler->writer_entry_size_class, sizeof (WriterQueueEntry), WRITER_ENTRY_BLOCK_SIZE);
- mono_lock_free_allocator_init_allocator (&log_profiler->writer_entry_allocator, &log_profiler->writer_entry_size_class, MONO_MEM_ACCOUNT_PROFILER);
+ mono_lock_free_allocator_init_size_class (&log_profiler.writer_entry_size_class, sizeof (WriterQueueEntry), WRITER_ENTRY_BLOCK_SIZE);
+ mono_lock_free_allocator_init_allocator (&log_profiler.writer_entry_allocator, &log_profiler.writer_entry_size_class, MONO_MEM_ACCOUNT_PROFILER);
- mono_lock_free_queue_init (&log_profiler->writer_queue);
- mono_os_sem_init (&log_profiler->writer_queue_sem, 0);
+ mono_lock_free_queue_init (&log_profiler.writer_queue);
+ mono_os_sem_init (&log_profiler.writer_queue_sem, 0);
- mono_lock_free_queue_init (&log_profiler->dumper_queue);
- mono_os_sem_init (&log_profiler->dumper_queue_sem, 0);
+ mono_lock_free_queue_init (&log_profiler.dumper_queue);
+ mono_os_sem_init (&log_profiler.dumper_queue_sem, 0);
- mono_os_mutex_init (&log_profiler->method_table_mutex);
- log_profiler->method_table = mono_conc_hashtable_new (NULL, NULL);
+ mono_os_mutex_init (&log_profiler.method_table_mutex);
+ log_profiler.method_table = mono_conc_hashtable_new (NULL, NULL);
- if (do_coverage)
- coverage_init (log_profiler);
- log_profiler->coverage_filters = filters;
+ if (log_config.collect_coverage)
+ coverage_init ();
- log_profiler->startup_time = current_time ();
-}
+ log_profiler.coverage_filters = filters;
-/*
- * declaration to silence the compiler: this is the entry point that
- * mono will load from the shared library and call.
- */
-extern void
-mono_profiler_init (const char *desc);
+ log_profiler.startup_time = current_time ();
+}
-extern void
+MONO_API void
mono_profiler_init_log (const char *desc);
-/*
- * this is the entry point that will be used when the profiler
- * is embedded inside the main executable.
- */
void
mono_profiler_init_log (const char *desc)
-{
- mono_profiler_init (desc);
-}
-
-void
-mono_profiler_init (const char *desc)
{
GPtrArray *filters = NULL;
- proflog_parse_args (&config, desc [3] == ':' ? desc + 4 : "");
-
- //XXX maybe later cleanup to use config directly
- nocalls = !(config.effective_mask & PROFLOG_CALL_EVENTS);
- no_counters = !(config.effective_mask & PROFLOG_COUNTER_EVENTS);
- do_report = config.do_report;
- do_debug = config.do_debug;
- do_heap_shot = (config.effective_mask & PROFLOG_HEAPSHOT_FEATURE);
- hs_mode_ondemand = config.hs_mode_ondemand;
- hs_mode_ms = config.hs_mode_ms;
- hs_mode_gc = config.hs_mode_gc;
- do_mono_sample = (config.effective_mask & PROFLOG_SAMPLING_FEATURE);
- use_zip = config.use_zip;
- command_port = config.command_port;
- num_frames = config.num_frames;
- notraces = config.notraces;
- max_allocated_sample_hits = config.max_allocated_sample_hits;
- max_call_depth = config.max_call_depth;
- do_coverage = (config.effective_mask & PROFLOG_CODE_COV_FEATURE);
- debug_coverage = config.debug_coverage;
-
- if (config.cov_filter_files) {
+ proflog_parse_args (&log_config, desc [3] == ':' ? desc + 4 : "");
+
+ if (log_config.cov_filter_files) {
filters = g_ptr_array_new ();
int i;
- for (i = 0; i < config.cov_filter_files->len; ++i) {
- const char *name = config.cov_filter_files->pdata [i];
+ for (i = 0; i < log_config.cov_filter_files->len; ++i) {
+ const char *name = log_config.cov_filter_files->pdata [i];
parse_cov_filter_file (filters, name);
}
}
PROF_TLS_INIT ();
- create_profiler (desc, config.output_filename, filters);
+ create_profiler (desc, log_config.output_filename, filters);
- mono_lls_init (&profiler_thread_list, NULL);
+ mono_lls_init (&log_profiler.profiler_thread_list, NULL);
- MonoProfilerHandle handle = log_profiler->handle = mono_profiler_install (log_profiler);
+ MonoProfilerHandle handle = log_profiler.handle = mono_profiler_create (&log_profiler);
- //Required callbacks
+ /*
+ * Required callbacks. These are either necessary for the profiler itself
+ * to function, or provide metadata that's needed if other events (e.g.
+ * allocations, exceptions) are dynamically enabled/disabled.
+ */
+
+ mono_profiler_set_runtime_shutdown_begin_callback (handle, log_early_shutdown);
mono_profiler_set_runtime_shutdown_end_callback (handle, log_shutdown);
mono_profiler_set_runtime_initialized_callback (handle, runtime_initialized);
mono_profiler_set_gc_event_callback (handle, gc_event);
- mono_profiler_set_gc_resize_callback (handle, gc_resize);
+
mono_profiler_set_thread_started_callback (handle, thread_start);
mono_profiler_set_thread_stopped_callback (handle, thread_end);
-
- //It's questionable whether we actually want this to be mandatory, maybe put it behind the actual event?
mono_profiler_set_thread_name_callback (handle, thread_name);
- if (config.effective_mask & PROFLOG_DOMAIN_EVENTS) {
- mono_profiler_set_domain_loaded_callback (handle, domain_loaded);
- mono_profiler_set_domain_unloading_callback (handle, domain_unloaded);
- mono_profiler_set_domain_name_callback (handle, domain_name);
- }
+ mono_profiler_set_domain_loaded_callback (handle, domain_loaded);
+ mono_profiler_set_domain_unloading_callback (handle, domain_unloaded);
+ mono_profiler_set_domain_name_callback (handle, domain_name);
- if (config.effective_mask & PROFLOG_ASSEMBLY_EVENTS) {
- mono_profiler_set_assembly_loaded_callback (handle, assembly_loaded);
- mono_profiler_set_assembly_unloading_callback (handle, assembly_unloaded);
- }
+ mono_profiler_set_context_loaded_callback (handle, context_loaded);
+ mono_profiler_set_context_unloaded_callback (handle, context_unloaded);
- if (config.effective_mask & PROFLOG_MODULE_EVENTS) {
- mono_profiler_set_image_loaded_callback (handle, image_loaded);
- mono_profiler_set_image_unloading_callback (handle, image_unloaded);
- }
+ mono_profiler_set_assembly_loaded_callback (handle, assembly_loaded);
+ mono_profiler_set_assembly_unloading_callback (handle, assembly_unloaded);
- if (config.effective_mask & PROFLOG_CLASS_EVENTS)
- mono_profiler_set_class_loaded_callback (handle, class_loaded);
+ mono_profiler_set_image_loaded_callback (handle, image_loaded);
+ mono_profiler_set_image_unloading_callback (handle, image_unloaded);
- if (config.effective_mask & PROFLOG_JIT_COMPILATION_EVENTS) {
- mono_profiler_set_jit_done_callback (handle, method_jitted);
- mono_profiler_set_jit_code_buffer_callback (handle, code_buffer_new);
- }
+ mono_profiler_set_class_loaded_callback (handle, class_loaded);
+
+ mono_profiler_set_jit_done_callback (handle, method_jitted);
- if (config.effective_mask & PROFLOG_EXCEPTION_EVENTS) {
+ if (ENABLED (PROFLOG_EXCEPTION_EVENTS)) {
mono_profiler_set_exception_throw_callback (handle, throw_exc);
mono_profiler_set_exception_clause_callback (handle, clause_exc);
}
- if (config.effective_mask & PROFLOG_ALLOCATION_EVENTS) {
- mono_profiler_enable_allocations ();
- mono_profiler_set_gc_allocation_callback (handle, gc_alloc);
- }
-
- //PROFLOG_GC_EVENTS is mandatory
- //PROFLOG_THREAD_EVENTS is mandatory
-
- if (config.effective_mask & PROFLOG_CALL_EVENTS) {
- mono_profiler_set_call_instrumentation_filter_callback (handle, method_filter);
- mono_profiler_set_method_enter_callback (handle, method_enter);
- mono_profiler_set_method_leave_callback (handle, method_leave);
- mono_profiler_set_method_exception_leave_callback (handle, method_exc_leave);
- }
-
- if (config.effective_mask & PROFLOG_INS_COVERAGE_EVENTS)
- mono_profiler_set_coverage_filter_callback (handle, coverage_filter);
-
- if (config.effective_mask & PROFLOG_SAMPLING_EVENTS) {
- mono_profiler_enable_sampling (handle);
-
- if (!mono_profiler_set_sample_mode (handle, config.sampling_mode, config.sample_freq))
- g_warning ("Another profiler controls sampling parameters; the log profiler will not be able to modify them");
-
- mono_profiler_set_sample_hit_callback (handle, mono_sample_hit);
- }
-
- if (config.effective_mask & PROFLOG_MONITOR_EVENTS) {
+ if (ENABLED (PROFLOG_MONITOR_EVENTS)) {
mono_profiler_set_monitor_contention_callback (handle, monitor_contention);
mono_profiler_set_monitor_acquired_callback (handle, monitor_acquired);
mono_profiler_set_monitor_failed_callback (handle, monitor_failed);
}
- if (config.effective_mask & PROFLOG_GC_MOVES_EVENTS)
+ if (ENABLED (PROFLOG_GC_EVENTS))
+ mono_profiler_set_gc_resize_callback (handle, gc_resize);
+
+ if (ENABLED (PROFLOG_GC_ALLOCATION_EVENTS))
+ mono_profiler_set_gc_allocation_callback (handle, gc_alloc);
+
+ if (ENABLED (PROFLOG_GC_MOVE_EVENTS))
mono_profiler_set_gc_moves_callback (handle, gc_moves);
- if (config.effective_mask & PROFLOG_GC_ROOT_EVENTS)
+ if (ENABLED (PROFLOG_GC_ROOT_EVENTS))
mono_profiler_set_gc_roots_callback (handle, gc_roots);
- if (config.effective_mask & PROFLOG_CONTEXT_EVENTS) {
- mono_profiler_set_context_loaded_callback (handle, context_loaded);
- mono_profiler_set_context_unloaded_callback (handle, context_unloaded);
+ if (ENABLED (PROFLOG_GC_HANDLE_EVENTS)) {
+ mono_profiler_set_gc_handle_created_callback (handle, gc_handle_created);
+ mono_profiler_set_gc_handle_deleted_callback (handle, gc_handle_deleted);
}
- if (config.effective_mask & PROFLOG_FINALIZATION_EVENTS) {
+ if (ENABLED (PROFLOG_GC_FINALIZATION_EVENTS)) {
mono_profiler_set_gc_finalizing_callback (handle, finalize_begin);
mono_profiler_set_gc_finalized_callback (handle, finalize_end);
mono_profiler_set_gc_finalizing_object_callback (handle, finalize_object_begin);
- mono_profiler_set_gc_finalized_object_callback (handle, finalize_object_end);
- } else if (ENABLED (PROFLOG_HEAPSHOT_FEATURE) && config.hs_mode_ondemand) {
- //On Demand heapshot uses the finalizer thread to force a collection and thus a heapshot
- mono_profiler_set_gc_finalized_callback (handle, finalize_end);
}
- //PROFLOG_COUNTER_EVENTS is a pseudo event controled by the no_counters global var
+ //On Demand heapshot uses the finalizer thread to force a collection and thus a heapshot
+ mono_profiler_set_gc_finalized_callback (handle, finalize_end);
- if (config.effective_mask & PROFLOG_GC_HANDLE_EVENTS) {
- mono_profiler_set_gc_handle_created_callback (handle, gc_handle_created);
- mono_profiler_set_gc_handle_deleted_callback (handle, gc_handle_deleted);
+ if (ENABLED (PROFLOG_SAMPLE_EVENTS))
+ mono_profiler_set_sample_hit_callback (handle, mono_sample_hit);
+
+ if (ENABLED (PROFLOG_JIT_EVENTS))
+ mono_profiler_set_jit_code_buffer_callback (handle, code_buffer_new);
+
+ if (log_config.enter_leave) {
+ mono_profiler_set_call_instrumentation_filter_callback (handle, method_filter);
+ mono_profiler_set_method_enter_callback (handle, method_enter);
+ mono_profiler_set_method_leave_callback (handle, method_leave);
+ mono_profiler_set_method_tail_call_callback (handle, tail_call);
+ mono_profiler_set_method_exception_leave_callback (handle, method_exc_leave);
+ }
+
+ if (log_config.collect_coverage) {
+ mono_profiler_enable_coverage ();
+ mono_profiler_set_coverage_filter_callback (handle, coverage_filter);
}
+
+ mono_profiler_enable_allocations ();
+ mono_profiler_enable_sampling (handle);
+
+ /*
+ * If no sample option was given by the user, this just leaves the sampling
+ * thread in idle mode. We do this even if no option was given so that we
+ * can warn if another profiler controls sampling parameters.
+ */
+ if (!mono_profiler_set_sample_mode (handle, log_config.sampling_mode, log_config.sample_freq))
+ mono_profiler_printf_err ("Another profiler controls sampling parameters; the log profiler will not be able to modify them.");
}
added an exception object field to TYPE_CLAUSE
class unload events no longer exist (they were never emitted)
removed type field from TYPE_SAMPLE_HIT
+ removed MONO_GC_EVENT_{MARK,RECLAIM}_{START,END}
+ */
+
+/*
+ * file format:
+ * [header] [buffer]*
+ *
+ * The file is composed by a header followed by 0 or more buffers.
+ * Each buffer contains events that happened on a thread: for a given thread
+ * buffers that appear later in the file are guaranteed to contain events
+ * that happened later in time. Buffers from separate threads could be interleaved,
+ * though.
+ * Buffers are not required to be aligned.
+ *
+ * header format:
+ * [id: 4 bytes] constant value: LOG_HEADER_ID
+ * [major: 1 byte] [minor: 1 byte] major and minor version of the log profiler
+ * [format: 1 byte] version of the data format for the rest of the file
+ * [ptrsize: 1 byte] size in bytes of a pointer in the profiled program
+ * [startup time: 8 bytes] time in milliseconds since the unix epoch when the program started
+ * [timer overhead: 4 bytes] approximate overhead in nanoseconds of the timer
+ * [flags: 4 bytes] file format flags, should be 0 for now
+ * [pid: 4 bytes] pid of the profiled process
+ * [port: 2 bytes] tcp port for server if != 0
+ * [args size: 4 bytes] size of args
+ * [args: string] arguments passed to the profiler
+ * [arch size: 4 bytes] size of arch
+ * [arch: string] architecture the profiler is running on
+ * [os size: 4 bytes] size of os
+ * [os: string] operating system the profiler is running on
+ *
+ * The multiple byte integers are in little-endian format.
+ *
+ * buffer format:
+ * [buffer header] [event]*
+ * Buffers have a fixed-size header followed by 0 or more bytes of event data.
+ * Timing information and other values in the event data are usually stored
+ * as uleb128 or sleb128 integers. To save space, as noted for each item below,
+ * some data is represented as a difference between the actual value and
+ * either the last value of the same type (like for timing information) or
+ * as the difference from a value stored in a buffer header.
+ *
+ * For timing information the data is stored as uleb128, since timing
+ * increases in a monotonic way in each thread: the value is the number of
+ * nanoseconds to add to the last seen timing data in a buffer. The first value
+ * in a buffer will be calculated from the time_base field in the buffer head.
+ *
+ * Object or heap sizes are stored as uleb128.
+ * Pointer differences are stored as sleb128, instead.
+ *
+ * If an unexpected value is found, the rest of the buffer should be ignored,
+ * as generally the later values need the former to be interpreted correctly.
+ *
+ * buffer header format:
+ * [bufid: 4 bytes] constant value: BUF_ID
+ * [len: 4 bytes] size of the data following the buffer header
+ * [time_base: 8 bytes] time base in nanoseconds since an unspecified epoch
+ * [ptr_base: 8 bytes] base value for pointers
+ * [obj_base: 8 bytes] base value for object addresses
+ * [thread id: 8 bytes] system-specific thread ID (pthread_t for example)
+ * [method_base: 8 bytes] base value for MonoMethod pointers
+ *
+ * event format:
+ * [extended info: upper 4 bits] [type: lower 4 bits]
+ * [time diff: uleb128] nanoseconds since last timing
+ * [data]*
+ * The data that follows depends on type and the extended info.
+ * Type is one of the enum values in mono-profiler-log.h: TYPE_ALLOC, TYPE_GC,
+ * TYPE_METADATA, TYPE_METHOD, TYPE_EXCEPTION, TYPE_MONITOR, TYPE_HEAP.
+ * The extended info bits are interpreted based on type, see
+ * each individual event description below.
+ * strings are represented as a 0-terminated utf8 sequence.
+ *
+ * backtrace format:
+ * [num: uleb128] number of frames following
+ * [frame: sleb128]* mum MonoMethod* as a pointer difference from the last such
+ * pointer or the buffer method_base
+ *
+ * type alloc format:
+ * type: TYPE_ALLOC
+ * exinfo: zero or TYPE_ALLOC_BT
+ * [ptr: sleb128] class as a byte difference from ptr_base
+ * [obj: sleb128] object address as a byte difference from obj_base
+ * [size: uleb128] size of the object in the heap
+ * If exinfo == TYPE_ALLOC_BT, a backtrace follows.
+ *
+ * type GC format:
+ * type: TYPE_GC
+ * exinfo: one of TYPE_GC_EVENT, TYPE_GC_RESIZE, TYPE_GC_MOVE, TYPE_GC_HANDLE_CREATED[_BT],
+ * TYPE_GC_HANDLE_DESTROYED[_BT], TYPE_GC_FINALIZE_START, TYPE_GC_FINALIZE_END,
+ * TYPE_GC_FINALIZE_OBJECT_START, TYPE_GC_FINALIZE_OBJECT_END
+ * if exinfo == TYPE_GC_RESIZE
+ * [heap_size: uleb128] new heap size
+ * if exinfo == TYPE_GC_EVENT
+ * [event type: byte] GC event (MONO_GC_EVENT_* from profiler.h)
+ * [generation: byte] GC generation event refers to
+ * if exinfo == TYPE_GC_MOVE
+ * [num_objects: uleb128] number of object moves that follow
+ * [objaddr: sleb128]+ num_objects object pointer differences from obj_base
+ * num is always an even number: the even items are the old
+ * addresses, the odd numbers are the respective new object addresses
+ * if exinfo == TYPE_GC_HANDLE_CREATED[_BT]
+ * [handle_type: uleb128] MonoGCHandleType enum value
+ * upper bits reserved as flags
+ * [handle: uleb128] GC handle value
+ * [objaddr: sleb128] object pointer differences from obj_base
+ * If exinfo == TYPE_GC_HANDLE_CREATED_BT, a backtrace follows.
+ * if exinfo == TYPE_GC_HANDLE_DESTROYED[_BT]
+ * [handle_type: uleb128] MonoGCHandleType enum value
+ * upper bits reserved as flags
+ * [handle: uleb128] GC handle value
+ * If exinfo == TYPE_GC_HANDLE_DESTROYED_BT, a backtrace follows.
+ * if exinfo == TYPE_GC_FINALIZE_OBJECT_{START,END}
+ * [object: sleb128] the object as a difference from obj_base
+ *
+ * type metadata format:
+ * type: TYPE_METADATA
+ * exinfo: one of: TYPE_END_LOAD, TYPE_END_UNLOAD (optional for TYPE_THREAD and TYPE_DOMAIN,
+ * doesn't occur for TYPE_CLASS)
+ * [mtype: byte] metadata type, one of: TYPE_CLASS, TYPE_IMAGE, TYPE_ASSEMBLY, TYPE_DOMAIN,
+ * TYPE_THREAD, TYPE_CONTEXT
+ * [pointer: sleb128] pointer of the metadata type depending on mtype
+ * if mtype == TYPE_CLASS
+ * [image: sleb128] MonoImage* as a pointer difference from ptr_base
+ * [name: string] full class name
+ * if mtype == TYPE_IMAGE
+ * [name: string] image file name
+ * if mtype == TYPE_ASSEMBLY
+ * [image: sleb128] MonoImage* as a pointer difference from ptr_base
+ * [name: string] assembly name
+ * if mtype == TYPE_DOMAIN && exinfo == 0
+ * [name: string] domain friendly name
+ * if mtype == TYPE_CONTEXT
+ * [domain: sleb128] domain id as pointer
+ * if mtype == TYPE_THREAD && exinfo == 0
+ * [name: string] thread name
+ *
+ * type method format:
+ * type: TYPE_METHOD
+ * exinfo: one of: TYPE_LEAVE, TYPE_ENTER, TYPE_EXC_LEAVE, TYPE_JIT
+ * [method: sleb128] MonoMethod* as a pointer difference from the last such
+ * pointer or the buffer method_base
+ * if exinfo == TYPE_JIT
+ * [code address: sleb128] pointer to the native code as a diff from ptr_base
+ * [code size: uleb128] size of the generated code
+ * [name: string] full method name
+ *
+ * type exception format:
+ * type: TYPE_EXCEPTION
+ * exinfo: zero, TYPE_CLAUSE, or TYPE_THROW_BT
+ * if exinfo == TYPE_CLAUSE
+ * [clause type: byte] MonoExceptionEnum enum value
+ * [clause index: uleb128] index of the current clause
+ * [method: sleb128] MonoMethod* as a pointer difference from the last such
+ * pointer or the buffer method_base
+ * [object: sleb128] the exception object as a difference from obj_base
+ * else
+ * [object: sleb128] the exception object as a difference from obj_base
+ * If exinfo == TYPE_THROW_BT, a backtrace follows.
+ *
+ * type runtime format:
+ * type: TYPE_RUNTIME
+ * exinfo: one of: TYPE_JITHELPER
+ * if exinfo == TYPE_JITHELPER
+ * [type: byte] MonoProfilerCodeBufferType enum value
+ * [buffer address: sleb128] pointer to the native code as a diff from ptr_base
+ * [buffer size: uleb128] size of the generated code
+ * if type == MONO_PROFILER_CODE_BUFFER_SPECIFIC_TRAMPOLINE
+ * [name: string] buffer description name
+ *
+ * type monitor format:
+ * type: TYPE_MONITOR
+ * exinfo: zero or TYPE_MONITOR_BT
+ * [type: byte] MonoProfilerMonitorEvent enum value
+ * [object: sleb128] the lock object as a difference from obj_base
+ * If exinfo == TYPE_MONITOR_BT, a backtrace follows.
+ *
+ * type heap format
+ * type: TYPE_HEAP
+ * exinfo: one of TYPE_HEAP_START, TYPE_HEAP_END, TYPE_HEAP_OBJECT, TYPE_HEAP_ROOT
+ * if exinfo == TYPE_HEAP_OBJECT
+ * [object: sleb128] the object as a difference from obj_base
+ * [class: sleb128] the object MonoClass* as a difference from ptr_base
+ * [size: uleb128] size of the object on the heap
+ * [num_refs: uleb128] number of object references
+ * each referenced objref is preceded by a uleb128 encoded offset: the
+ * first offset is from the object address and each next offset is relative
+ * to the previous one
+ * [objrefs: sleb128]+ object referenced as a difference from obj_base
+ * The same object can appear multiple times, but only the first time
+ * with size != 0: in the other cases this data will only be used to
+ * provide additional referenced objects.
+ * if exinfo == TYPE_HEAP_ROOT
+ * [num_roots: uleb128] number of root references
+ * [num_gc: uleb128] number of major gcs
+ * [object: sleb128] the object as a difference from obj_base
+ * [root_type: byte] the root_type: MonoProfileGCRootType (profiler.h)
+ * [extra_info: uleb128] the extra_info value
+ * object, root_type and extra_info are repeated num_roots times
+ *
+ * type sample format
+ * type: TYPE_SAMPLE
+ * exinfo: one of TYPE_SAMPLE_HIT, TYPE_SAMPLE_USYM, TYPE_SAMPLE_UBIN, TYPE_SAMPLE_COUNTERS_DESC, TYPE_SAMPLE_COUNTERS
+ * if exinfo == TYPE_SAMPLE_HIT
+ * [thread: sleb128] thread id as difference from ptr_base
+ * [count: uleb128] number of following instruction addresses
+ * [ip: sleb128]* instruction pointer as difference from ptr_base
+ * [mbt_count: uleb128] number of managed backtrace frames
+ * [method: sleb128]* MonoMethod* as a pointer difference from the last such
+ * pointer or the buffer method_base (the first such method can be also indentified by ip, but this is not neccessarily true)
+ * if exinfo == TYPE_SAMPLE_USYM
+ * [address: sleb128] symbol address as a difference from ptr_base
+ * [size: uleb128] symbol size (may be 0 if unknown)
+ * [name: string] symbol name
+ * if exinfo == TYPE_SAMPLE_UBIN
+ * [address: sleb128] address where binary has been loaded as a difference from ptr_base
+ * [offset: uleb128] file offset of mapping (the same file can be mapped multiple times)
+ * [size: uleb128] memory size
+ * [name: string] binary name
+ * if exinfo == TYPE_SAMPLE_COUNTERS_DESC
+ * [len: uleb128] number of counters
+ * for i = 0 to len
+ * [section: uleb128] section of counter
+ * if section == MONO_COUNTER_PERFCOUNTERS:
+ * [section_name: string] section name of counter
+ * [name: string] name of counter
+ * [type: byte] type of counter
+ * [unit: byte] unit of counter
+ * [variance: byte] variance of counter
+ * [index: uleb128] unique index of counter
+ * if exinfo == TYPE_SAMPLE_COUNTERS
+ * while true:
+ * [index: uleb128] unique index of counter
+ * if index == 0:
+ * break
+ * [type: byte] type of counter value
+ * if type == string:
+ * if value == null:
+ * [0: byte] 0 -> value is null
+ * else:
+ * [1: byte] 1 -> value is not null
+ * [value: string] counter value
+ * else:
+ * [value: uleb128/sleb128/double] counter value, can be sleb128, uleb128 or double (determined by using type)
+ *
+ * type coverage format
+ * type: TYPE_COVERAGE
+ * exinfo: one of TYPE_COVERAGE_METHOD, TYPE_COVERAGE_STATEMENT, TYPE_COVERAGE_ASSEMBLY, TYPE_COVERAGE_CLASS
+ * if exinfo == TYPE_COVERAGE_METHOD
+ * [assembly: string] name of assembly
+ * [class: string] name of the class
+ * [name: string] name of the method
+ * [signature: string] the signature of the method
+ * [filename: string] the file path of the file that contains this method
+ * [token: uleb128] the method token
+ * [method_id: uleb128] an ID for this data to associate with the buffers of TYPE_COVERAGE_STATEMENTS
+ * [len: uleb128] the number of TYPE_COVERAGE_BUFFERS associated with this method
+ * if exinfo == TYPE_COVERAGE_STATEMENTS
+ * [method_id: uleb128] an the TYPE_COVERAGE_METHOD buffer to associate this with
+ * [offset: uleb128] the il offset relative to the previous offset
+ * [counter: uleb128] the counter for this instruction
+ * [line: uleb128] the line of filename containing this instruction
+ * [column: uleb128] the column containing this instruction
+ * if exinfo == TYPE_COVERAGE_ASSEMBLY
+ * [name: string] assembly name
+ * [guid: string] assembly GUID
+ * [filename: string] assembly filename
+ * [number_of_methods: uleb128] the number of methods in this assembly
+ * [fully_covered: uleb128] the number of fully covered methods
+ * [partially_covered: uleb128] the number of partially covered methods
+ * currently partially_covered will always be 0, and fully_covered is the
+ * number of methods that are fully and partially covered.
+ * if exinfo == TYPE_COVERAGE_CLASS
+ * [name: string] assembly name
+ * [class: string] class name
+ * [number_of_methods: uleb128] the number of methods in this class
+ * [fully_covered: uleb128] the number of fully covered methods
+ * [partially_covered: uleb128] the number of partially covered methods
+ * currently partially_covered will always be 0, and fully_covered is the
+ * number of methods that are fully and partially covered.
+ *
+ * type meta format:
+ * type: TYPE_META
+ * exinfo: one of: TYPE_SYNC_POINT
+ * if exinfo == TYPE_SYNC_POINT
+ * [type: byte] MonoProfilerSyncPointType enum value
*/
enum {
TYPE_COVERAGE_CLASS = 3 << 4,
/* extended type for TYPE_META */
TYPE_SYNC_POINT = 0 << 4,
- TYPE_END
};
enum {
};
typedef enum {
- SYNC_POINT_PERIODIC,
- SYNC_POINT_WORLD_STOP,
- SYNC_POINT_WORLD_START
+ SYNC_POINT_PERIODIC = 0,
+ SYNC_POINT_WORLD_STOP = 1,
+ SYNC_POINT_WORLD_START = 2,
} MonoProfilerSyncPointType;
typedef enum {
} MonoProfilerMonitorEvent;
enum {
- MONO_PROFILER_GC_HANDLE_CREATED,
- MONO_PROFILER_GC_HANDLE_DESTROYED,
+ MONO_PROFILER_GC_HANDLE_CREATED = 0,
+ MONO_PROFILER_GC_HANDLE_DESTROYED = 1,
};
+typedef enum {
+ MONO_PROFILER_HEAPSHOT_NONE = 0,
+ MONO_PROFILER_HEAPSHOT_MAJOR = 1,
+ MONO_PROFILER_HEAPSHOT_ON_DEMAND = 2,
+ MONO_PROFILER_HEAPSHOT_X_GC = 3,
+ MONO_PROFILER_HEAPSHOT_X_MS = 4,
+} MonoProfilerHeapshotMode;
+
// If you alter MAX_FRAMES, you may need to alter SAMPLE_BLOCK_SIZE too.
#define MAX_FRAMES 32
//The following flags control emitting individual events
-#define PROFLOG_DOMAIN_EVENTS (1 << 0)
-#define PROFLOG_ASSEMBLY_EVENTS (1 << 1)
-#define PROFLOG_MODULE_EVENTS (1 << 2)
-#define PROFLOG_CLASS_EVENTS (1 << 3)
-#define PROFLOG_JIT_COMPILATION_EVENTS (1 << 4)
-#define PROFLOG_EXCEPTION_EVENTS (1 << 5)
-#define PROFLOG_ALLOCATION_EVENTS (1 << 6)
-#define PROFLOG_GC_EVENTS (1 << 7)
-#define PROFLOG_THREAD_EVENTS (1 << 8)
-//This generate enter/leave events
-#define PROFLOG_CALL_EVENTS (1 << 9)
-#define PROFLOG_INS_COVERAGE_EVENTS (1 << 10)
-#define PROFLOG_SAMPLING_EVENTS (1 << 11)
-#define PROFLOG_MONITOR_EVENTS (1 << 12)
-#define PROFLOG_GC_MOVES_EVENTS (1 << 13)
-
-#define PROFLOG_GC_ROOT_EVENTS (1 << 14)
-#define PROFLOG_CONTEXT_EVENTS (1 << 15)
-#define PROFLOG_FINALIZATION_EVENTS (1 << 16)
-#define PROFLOG_COUNTER_EVENTS (1 << 17)
-#define PROFLOG_GC_HANDLE_EVENTS (1 << 18)
-
-//The following flags control whole subsystems
-//Enables code coverage generation
-#define PROFLOG_CODE_COV_FEATURE (1 << 19)
-//This enables sampling to be generated
-#define PROFLOG_SAMPLING_FEATURE (1 << 20)
-//This enable heap dumping during GCs and filter GCRoots and GCHandle events outside of the dumped collections
-#define PROFLOG_HEAPSHOT_FEATURE (1 << 21)
-
-
-
-//The follow flags are the common aliases we want ppl to use
-#define PROFLOG_TYPELOADING_ALIAS (PROFLOG_DOMAIN_EVENTS | PROFLOG_ASSEMBLY_EVENTS | PROFLOG_MODULE_EVENTS | PROFLOG_CLASS_EVENTS)
-#define PROFLOG_CODECOV_ALIAS (PROFLOG_INS_COVERAGE_EVENTS | PROFLOG_CODE_COV_FEATURE)
-#define PROFLOG_PERF_SAMPLING_ALIAS (PROFLOG_TYPELOADING_ALIAS | PROFLOG_THREAD_EVENTS | PROFLOG_SAMPLING_EVENTS | PROFLOG_SAMPLING_FEATURE)
-#define PROFLOG_GC_ALLOC_ALIAS (PROFLOG_TYPELOADING_ALIAS | PROFLOG_THREAD_EVENTS | PROFLOG_GC_EVENTS | PROFLOG_ALLOCATION_EVENTS)
-#define PROFLOG_HEAPSHOT_ALIAS (PROFLOG_TYPELOADING_ALIAS | PROFLOG_THREAD_EVENTS | PROFLOG_GC_EVENTS | PROFLOG_GC_ROOT_EVENTS | PROFLOG_HEAPSHOT_FEATURE)
-#define PROFLOG_LEGACY_ALIAS (PROFLOG_TYPELOADING_ALIAS | PROFLOG_GC_EVENTS | PROFLOG_THREAD_EVENTS | PROFLOG_JIT_COMPILATION_EVENTS | PROFLOG_EXCEPTION_EVENTS | PROFLOG_MONITOR_EVENTS | PROFLOG_GC_ROOT_EVENTS | PROFLOG_CONTEXT_EVENTS | PROFLOG_FINALIZATION_EVENTS | PROFLOG_COUNTER_EVENTS)
-
+#define PROFLOG_EXCEPTION_EVENTS (1 << 0)
+#define PROFLOG_MONITOR_EVENTS (1 << 1)
+#define PROFLOG_GC_EVENTS (1 << 2)
+#define PROFLOG_GC_ALLOCATION_EVENTS (1 << 3)
+#define PROFLOG_GC_MOVE_EVENTS (1 << 4)
+#define PROFLOG_GC_ROOT_EVENTS (1 << 5)
+#define PROFLOG_GC_HANDLE_EVENTS (1 << 6)
+#define PROFLOG_GC_FINALIZATION_EVENTS (1 << 7)
+#define PROFLOG_COUNTER_EVENTS (1 << 8)
+#define PROFLOG_SAMPLE_EVENTS (1 << 9)
+#define PROFLOG_JIT_EVENTS (1 << 10)
+
+#define PROFLOG_ALLOC_ALIAS (PROFLOG_GC_EVENTS | PROFLOG_GC_ALLOCATION_EVENTS | PROFLOG_GC_MOVE_EVENTS)
+#define PROFLOG_HEAPSHOT_ALIAS (PROFLOG_GC_EVENTS | PROFLOG_GC_ROOT_EVENTS)
+#define PROFLOG_LEGACY_ALIAS (PROFLOG_EXCEPTION_EVENTS | PROFLOG_MONITOR_EVENTS | PROFLOG_GC_EVENTS | PROFLOG_GC_MOVE_EVENTS | PROFLOG_GC_ROOT_EVENTS | PROFLOG_GC_HANDLE_EVENTS | PROFLOG_GC_FINALIZATION_EVENTS | PROFLOG_COUNTER_EVENTS)
typedef struct {
//Events explicitly enabled
int enable_mask;
+
//Events explicitly disabled
int disable_mask;
- //Actual mask the profiler should use
+ // Actual mask the profiler should use. Can be changed at runtime.
int effective_mask;
+ // Whether to do method prologue/epilogue instrumentation. Only used at startup.
+ gboolean enter_leave;
+
+ // Whether to collect code coverage by instrumenting basic blocks.
+ gboolean collect_coverage;
+
//Emit a report at the end of execution
gboolean do_report;
//Enable profiler internal debugging
gboolean do_debug;
- //Enable code coverage specific debugging
- gboolean debug_coverage;
-
//Where to compress the output file
gboolean use_zip;
- //If true, don't generate stacktraces
- gboolean notraces;
+ // Heapshot mode (every major, on demand, XXgc, XXms). Can be changed at runtime.
+ MonoProfilerHeapshotMode hs_mode;
- //If true, heapshots are generated on demand only
- gboolean hs_mode_ondemand;
+ // Heapshot frequency in milliseconds (for MONO_HEAPSHOT_X_MS). Can be changed at runtime.
+ unsigned int hs_freq_ms;
- //HeapShort frequency in milliseconds
- unsigned int hs_mode_ms;
+ // Heapshot frequency in number of collections (for MONO_HEAPSHOT_X_GC). Can be changed at runtime.
+ unsigned int hs_freq_gc;
- //HeapShort frequency in number of collections
- unsigned int hs_mode_gc;
+ // Whether to do a heapshot on shutdown.
+ gboolean hs_on_shutdown;
- //Sample frequency in Hertz
+ // Sample frequency in Hertz. Only used at startup.
int sample_freq;
- //Maximum number of frames to collect
+ // Maximum number of frames to collect. Can be changed at runtime.
int num_frames;
- //Max depth to record enter/leave events
+ // Max depth to record enter/leave events. Can be changed at runtime.
int max_call_depth;
//Name of the generated mlpd file
//Filter files used by the code coverage mode
GPtrArray *cov_filter_files;
- //Port to listen for profiling commands
+ // Port to listen for profiling commands (e.g. "heapshot" for on-demand heapshot).
int command_port;
- //Max size of the sample hit buffer, we'll drop frames if it's reached
+ // Maximum number of SampleHit structures. We'll drop samples if this number is not sufficient.
int max_allocated_sample_hits;
+ // Sample mode. Only used at startup.
MonoProfilerSampleMode sampling_mode;
} ProfilerConfig;
SAMPLE_BRANCH_MISSES,
};
+enum {
+ MONO_GC_EVENT_MARK_START = 1,
+ MONO_GC_EVENT_MARK_END = 2,
+ MONO_GC_EVENT_RECLAIM_START = 3,
+ MONO_GC_EVENT_RECLAIM_END = 4,
+};
+
static const char*
sample_type_name (int type)
{
report_errors ();
}
# test heapshot traces
-$report = run_test_sgen ("test-heapshot.exe", "heapshot,output=-traces.mlpd,legacy", "--traces traces.mlpd");
+$report = run_test_sgen ("test-heapshot.exe", "heapshot,output=traces.mlpd,legacy", "--traces traces.mlpd");
if ($report ne "missing binary") {
check_report_basics ($report);
check_report_heapshot ($report, 0, {"T" => 5000});
report_errors ();
}
# test traces
-$report = run_test ("test-traces.exe", "legacy,calls,alloc,output=-traces.mlpd", "--maxframes=7 --traces traces.mlpd");
+$report = run_test ("test-traces.exe", "legacy,calls,alloc,output=traces.mlpd", "--maxframes=7 --traces traces.mlpd");
check_report_basics ($report);
check_call_traces ($report,
"T:level3 (int)" => [2020, "T:Main (string[])"],
);
report_errors ();
# test traces without enter/leave events
-$report = run_test ("test-traces.exe", "legacy,alloc,output=-traces.mlpd", "--traces traces.mlpd");
+$report = run_test ("test-traces.exe", "legacy,alloc,output=traces.mlpd", "--traces traces.mlpd");
check_report_basics ($report);
# this has been broken recently
check_exception_traces ($report,
/*
- * mono-codeanalyst.c: VTune profiler
+ * vtune.c: VTune profiler
*
* Author:
* Virgile Bello (virgile.bello@gmail.com)
/* the entry point */
void
-mono_profiler_init (const char *desc)
+mono_profiler_init_vtune (const char *desc)
{
iJIT_IsProfilingActiveFlags flags = iJIT_IsProfilingActive();
if (flags == iJIT_SAMPLING_ON)
{
- MonoProfilerHandle handle = mono_profiler_install (NULL);
+ MonoProfilerHandle handle = mono_profiler_create (NULL);
mono_profiler_set_runtime_shutdown_end_callback (handle, codeanalyst_shutdown);
mono_profiler_set_jit_done_callback (handle, method_jit_done);
mono_profiler_set_jit_code_buffer_callback (handle, code_buffer_new);
return *slot != NULL;
}
+/* Removes all NULL pointers from the array. Not thread safe */
+void
+sgen_array_list_remove_nulls (SgenArrayList *array)
+{
+ guint32 start = 0;
+ volatile gpointer *slot;
+ gboolean skipped = FALSE;
+
+ SGEN_ARRAY_LIST_FOREACH_SLOT (array, slot) {
+ if (*slot) {
+ *sgen_array_list_get_slot (array, start++) = *slot;
+ if (skipped)
+ *slot = NULL;
+ } else {
+ skipped = TRUE;
+ }
+ } SGEN_ARRAY_LIST_END_FOREACH_SLOT;
+
+ mono_memory_write_barrier ();
+ array->next_slot = start;
+ array->slot_hint = start;
+}
+
#endif
guint32 sgen_array_list_find (SgenArrayList *array, gpointer ptr);
gboolean sgen_array_list_default_cas_setter (volatile gpointer *slot, gpointer ptr, int data);
gboolean sgen_array_list_default_is_slot_set (volatile gpointer *slot);
-
+void sgen_array_list_remove_nulls (SgenArrayList *array);
#endif
static guint64 time_major_pinning = 0;
static guint64 time_major_scan_pinned = 0;
static guint64 time_major_scan_roots = 0;
-static guint64 time_major_scan_mod_union = 0;
+static guint64 time_major_scan_mod_union_blocks = 0;
+static guint64 time_major_scan_mod_union_los = 0;
static guint64 time_major_finish_gray_stack = 0;
static guint64 time_major_free_bigobjs = 0;
static guint64 time_major_los_sweep = 0;
mono_counters_register ("Major pinning", MONO_COUNTER_GC | MONO_COUNTER_ULONG | MONO_COUNTER_TIME, &time_major_pinning);
mono_counters_register ("Major scan pinned", MONO_COUNTER_GC | MONO_COUNTER_ULONG | MONO_COUNTER_TIME, &time_major_scan_pinned);
mono_counters_register ("Major scan roots", MONO_COUNTER_GC | MONO_COUNTER_ULONG | MONO_COUNTER_TIME, &time_major_scan_roots);
- mono_counters_register ("Major scan mod union", MONO_COUNTER_GC | MONO_COUNTER_ULONG | MONO_COUNTER_TIME, &time_major_scan_mod_union);
+ mono_counters_register ("Major scan mod union blocks", MONO_COUNTER_GC | MONO_COUNTER_ULONG | MONO_COUNTER_TIME, &time_major_scan_mod_union_blocks);
+ mono_counters_register ("Major scan mod union los", MONO_COUNTER_GC | MONO_COUNTER_ULONG | MONO_COUNTER_TIME, &time_major_scan_mod_union_los);
mono_counters_register ("Major finish gray stack", MONO_COUNTER_GC | MONO_COUNTER_ULONG | MONO_COUNTER_TIME, &time_major_finish_gray_stack);
mono_counters_register ("Major free big objects", MONO_COUNTER_GC | MONO_COUNTER_ULONG | MONO_COUNTER_TIME, &time_major_free_bigobjs);
mono_counters_register ("Major LOS sweep", MONO_COUNTER_GC | MONO_COUNTER_ULONG | MONO_COUNTER_TIME, &time_major_los_sweep);
typedef struct {
ScanJob scan_job;
int job_index, job_split_count;
+ int data;
} ParallelScanJob;
static ScanCopyContext
ScanCopyContext ctx = scan_copy_context_for_scan_job (worker_data_untyped, (ScanJob*)job_data);
SGEN_TV_GETTIME (atv);
- major_collector.scan_card_table (CARDTABLE_SCAN_GLOBAL, ctx, job_data->job_index, job_data->job_split_count);
+ major_collector.scan_card_table (CARDTABLE_SCAN_GLOBAL, ctx, job_data->job_index, job_data->job_split_count, job_data->data);
SGEN_TV_GETTIME (btv);
time_minor_scan_major_blocks += SGEN_TV_ELAPSED (atv, btv);
+
+ if (worker_data_untyped)
+ ((WorkerData*)worker_data_untyped)->major_scan_time += SGEN_TV_ELAPSED (atv, btv);
}
static void
sgen_los_scan_card_table (CARDTABLE_SCAN_GLOBAL, ctx, job_data->job_index, job_data->job_split_count);
SGEN_TV_GETTIME (btv);
time_minor_scan_los += SGEN_TV_ELAPSED (atv, btv);
+
+ if (worker_data_untyped)
+ ((WorkerData*)worker_data_untyped)->los_scan_time += SGEN_TV_ELAPSED (atv, btv);
}
static void
job_scan_major_mod_union_card_table (void *worker_data_untyped, SgenThreadPoolJob *job)
{
+ SGEN_TV_DECLARE (atv);
+ SGEN_TV_DECLARE (btv);
ParallelScanJob *job_data = (ParallelScanJob*)job;
ScanCopyContext ctx = scan_copy_context_for_scan_job (worker_data_untyped, (ScanJob*)job_data);
g_assert (concurrent_collection_in_progress);
- major_collector.scan_card_table (CARDTABLE_SCAN_MOD_UNION, ctx, job_data->job_index, job_data->job_split_count);
+ SGEN_TV_GETTIME (atv);
+ major_collector.scan_card_table (CARDTABLE_SCAN_MOD_UNION, ctx, job_data->job_index, job_data->job_split_count, job_data->data);
+ SGEN_TV_GETTIME (btv);
+ time_major_scan_mod_union_blocks += SGEN_TV_ELAPSED (atv, btv);
+
+ if (worker_data_untyped)
+ ((WorkerData*)worker_data_untyped)->major_scan_time += SGEN_TV_ELAPSED (atv, btv);
}
static void
job_scan_los_mod_union_card_table (void *worker_data_untyped, SgenThreadPoolJob *job)
{
+ SGEN_TV_DECLARE (atv);
+ SGEN_TV_DECLARE (btv);
ParallelScanJob *job_data = (ParallelScanJob*)job;
ScanCopyContext ctx = scan_copy_context_for_scan_job (worker_data_untyped, (ScanJob*)job_data);
g_assert (concurrent_collection_in_progress);
+ SGEN_TV_GETTIME (atv);
sgen_los_scan_card_table (CARDTABLE_SCAN_MOD_UNION, ctx, job_data->job_index, job_data->job_split_count);
+ SGEN_TV_GETTIME (btv);
+ time_major_scan_mod_union_los += SGEN_TV_ELAPSED (atv, btv);
+
+ if (worker_data_untyped)
+ ((WorkerData*)worker_data_untyped)->los_scan_time += SGEN_TV_ELAPSED (atv, btv);
}
static void
job_major_mod_union_preclean (void *worker_data_untyped, SgenThreadPoolJob *job)
{
+ SGEN_TV_DECLARE (atv);
+ SGEN_TV_DECLARE (btv);
ParallelScanJob *job_data = (ParallelScanJob*)job;
ScanCopyContext ctx = scan_copy_context_for_scan_job (worker_data_untyped, (ScanJob*)job_data);
g_assert (concurrent_collection_in_progress);
+ SGEN_TV_GETTIME (atv);
+ major_collector.scan_card_table (CARDTABLE_SCAN_MOD_UNION_PRECLEAN, ctx, job_data->job_index, job_data->job_split_count, job_data->data);
+ SGEN_TV_GETTIME (btv);
- major_collector.scan_card_table (CARDTABLE_SCAN_MOD_UNION_PRECLEAN, ctx, job_data->job_index, job_data->job_split_count);
+ g_assert (worker_data_untyped);
+ ((WorkerData*)worker_data_untyped)->major_scan_time += SGEN_TV_ELAPSED (atv, btv);
}
static void
job_los_mod_union_preclean (void *worker_data_untyped, SgenThreadPoolJob *job)
{
+ SGEN_TV_DECLARE (atv);
+ SGEN_TV_DECLARE (btv);
ParallelScanJob *job_data = (ParallelScanJob*)job;
ScanCopyContext ctx = scan_copy_context_for_scan_job (worker_data_untyped, (ScanJob*)job_data);
g_assert (concurrent_collection_in_progress);
-
+ SGEN_TV_GETTIME (atv);
sgen_los_scan_card_table (CARDTABLE_SCAN_MOD_UNION_PRECLEAN, ctx, job_data->job_index, job_data->job_split_count);
+ SGEN_TV_GETTIME (btv);
+
+ g_assert (worker_data_untyped);
+ ((WorkerData*)worker_data_untyped)->los_scan_time += SGEN_TV_ELAPSED (atv, btv);
}
static void
{
ParallelScanJob *psj;
ScanJob *sj;
+ size_t num_major_sections = major_collector.get_num_major_sections ();
int split_count = sgen_workers_get_job_split_count (GENERATION_OLD);
int i;
/* Mod union preclean jobs */
psj->scan_job.gc_thread_gray_queue = NULL;
psj->job_index = i;
psj->job_split_count = split_count;
+ psj->data = num_major_sections / split_count;
sgen_workers_enqueue_job (GENERATION_OLD, &psj->scan_job.job, TRUE);
}
enqueue_scan_remembered_set_jobs (SgenGrayQueue *gc_thread_gray_queue, SgenObjectOperations *ops, gboolean enqueue)
{
int i, split_count = sgen_workers_get_job_split_count (GENERATION_NURSERY);
+ size_t num_major_sections = major_collector.get_num_major_sections ();
ScanJob *sj;
sj = (ScanJob*)sgen_thread_pool_job_alloc ("scan wbroots", job_scan_wbroots, sizeof (ScanJob));
psj->scan_job.gc_thread_gray_queue = gc_thread_gray_queue;
psj->job_index = i;
psj->job_split_count = split_count;
+ psj->data = num_major_sections / split_count;
sgen_workers_enqueue_job (GENERATION_NURSERY, &psj->scan_job.job, enqueue);
psj = (ParallelScanJob*)sgen_thread_pool_job_alloc ("scan LOS remsets", job_scan_los_card_table, sizeof (ParallelScanJob));
TV_DECLARE (btv);
SGEN_TV_DECLARE (last_minor_collection_start_tv);
SGEN_TV_DECLARE (last_minor_collection_end_tv);
+ guint64 major_scan_start = time_minor_scan_major_blocks;
+ guint64 los_scan_start = time_minor_scan_los;
+ guint64 finish_gray_start = time_minor_finish_gray_stack;
if (disable_minor_collections)
return TRUE;
current_collection_generation = -1;
objects_pinned = 0;
+ if (is_parallel)
+ binary_protocol_collection_end_stats (0, 0, time_minor_finish_gray_stack - finish_gray_start);
+ else
+ binary_protocol_collection_end_stats (
+ time_minor_scan_major_blocks - major_scan_start,
+ time_minor_scan_los - los_scan_start,
+ time_minor_finish_gray_stack - finish_gray_start);
+
binary_protocol_collection_end (gc_stats.minor_gc_count - 1, GENERATION_NURSERY, 0, 0);
if (check_nursery_objects_pinned && !sgen_minor_collector.is_split)
if (mode == COPY_OR_MARK_FROM_ROOTS_FINISH_CONCURRENT) {
if (object_ops_par != NULL)
sgen_workers_set_num_active_workers (GENERATION_OLD, 0);
- if (sgen_workers_have_idle_work (GENERATION_OLD)) {
+ if (object_ops_par == NULL && sgen_workers_have_idle_work (GENERATION_OLD)) {
/*
* We force the finish of the worker with the new object ops context
- * which can also do copying. We need to have finished pinning.
+ * which can also do copying. We need to have finished pinning. On the
+ * parallel collector, there is no need to drain the private queues
+ * here, since we can do it as part of the finishing work, achieving
+ * better work distribution.
*/
sgen_workers_start_all_workers (GENERATION_OLD, object_ops_nopar, object_ops_par, NULL);
if (mode == COPY_OR_MARK_FROM_ROOTS_FINISH_CONCURRENT) {
int i, split_count = sgen_workers_get_job_split_count (GENERATION_OLD);
+ size_t num_major_sections = major_collector.get_num_major_sections ();
gboolean parallel = object_ops_par != NULL;
/* If we're not parallel we finish the collection on the gc thread */
psj->scan_job.gc_thread_gray_queue = gc_thread_gray_queue;
psj->job_index = i;
psj->job_split_count = split_count;
+ psj->data = num_major_sections / split_count;
sgen_workers_enqueue_job (GENERATION_OLD, &psj->scan_job.job, parallel);
psj = (ParallelScanJob*)sgen_thread_pool_job_alloc ("scan LOS mod union cardtable", job_scan_los_mod_union_card_table, sizeof (ParallelScanJob));
mword fragment_total;
TV_DECLARE (atv);
TV_DECLARE (btv);
-
- TV_GETTIME (btv);
+ guint64 major_scan_start = time_major_scan_mod_union_blocks;
+ guint64 los_scan_start = time_major_scan_mod_union_los;
+ guint64 finish_gray_start = time_major_finish_gray_stack;
if (concurrent_collection_in_progress) {
SgenObjectOperations *object_ops_par = NULL;
sgen_workers_assert_gray_queue_is_empty (GENERATION_OLD);
+ TV_GETTIME (btv);
finish_gray_stack (GENERATION_OLD, CONTEXT_FROM_OBJECT_OPERATIONS (object_ops_nopar, gc_thread_gray_queue));
TV_GETTIME (atv);
time_major_finish_gray_stack += TV_ELAPSED (btv, atv);
binary_protocol_flush_buffers (FALSE);
//consistency_check ();
+ if (major_collector.is_parallel)
+ binary_protocol_collection_end_stats (0, 0, time_major_finish_gray_stack - finish_gray_start);
+ else
+ binary_protocol_collection_end_stats (
+ time_major_scan_mod_union_blocks - major_scan_start,
+ time_major_scan_mod_union_los - los_scan_start,
+ time_major_finish_gray_stack - finish_gray_start);
binary_protocol_collection_end (gc_stats.major_gc_count - 1, GENERATION_OLD, counts.num_scanned_objects, counts.num_unique_scanned_objects);
}
/*
* Use concurrent major and dynamic nursery with a more
* aggressive shrinking relative to pause times.
- * FIXME use parallel minors
*/
- minor = SGEN_MINOR_SIMPLE;
+ minor = SGEN_MINOR_SIMPLE_PARALLEL;
major = SGEN_MAJOR_CONCURRENT;
dynamic_nursery = TRUE;
sgen_max_pause_margin = SGEN_PAUSE_MODE_MAX_PAUSE_MARGIN;
void (*free_non_pinned_object) (GCObject *obj, size_t size);
void (*pin_objects) (SgenGrayQueue *queue);
void (*pin_major_object) (GCObject *obj, SgenGrayQueue *queue);
- void (*scan_card_table) (CardTableScanType scan_type, ScanCopyContext ctx, int job_index, int job_split_count);
+ void (*scan_card_table) (CardTableScanType scan_type, ScanCopyContext ctx, int job_index, int job_split_count, int block_count);
void (*iterate_live_block_ranges) (sgen_cardtable_block_callback callback);
void (*iterate_block_ranges) (sgen_cardtable_block_callback callback);
void (*update_cardtable_mod_union) (void);
/* non-allocated block free-list */
static void *empty_blocks = NULL;
static size_t num_empty_blocks = 0;
+static gboolean compact_blocks = FALSE;
/*
* We can iterate the block list also while sweep is in progress but we
(bl) = BLOCK_UNTAG ((bl));
#define END_FOREACH_BLOCK_NO_LOCK } SGEN_ARRAY_LIST_END_FOREACH_SLOT; }
+#define FOREACH_BLOCK_RANGE_HAS_REFERENCES_NO_LOCK(bl,begin,end,index,hr) { \
+ volatile gpointer *slot; \
+ SGEN_ARRAY_LIST_FOREACH_SLOT_RANGE (&allocated_blocks, begin, end, slot, index) { \
+ (bl) = (MSBlockInfo *) (*slot); \
+ if (!(bl)) \
+ continue; \
+ (hr) = BLOCK_IS_TAGGED_HAS_REFERENCES ((bl)); \
+ (bl) = BLOCK_UNTAG ((bl));
+#define END_FOREACH_BLOCK_RANGE_NO_LOCK } SGEN_ARRAY_LIST_END_FOREACH_SLOT_RANGE; }
+
static volatile size_t num_major_sections = 0;
/*
* One free block list for each block object size. We add and remove blocks from these
sgen_workers_foreach (GENERATION_NURSERY, sgen_worker_clear_free_block_lists);
sgen_workers_foreach (GENERATION_OLD, sgen_worker_clear_free_block_lists);
+
+ compact_blocks = TRUE;
}
static void sweep_finish (void);
#endif
old_num_major_sections = num_major_sections;
+
+ /* Compact the block list if it hasn't been compacted in a while and nobody is using it */
+ if (compact_blocks && !sweep_in_progress () && !sweep_blocks_job && !sgen_concurrent_collection_in_progress ()) {
+ /*
+ * We support null elements in the array but do regular compaction to avoid
+ * excessive traversal of the array and to facilitate splitting into well
+ * balanced sections for parallel modes. We compact as soon as possible after
+ * sweep.
+ */
+ sgen_array_list_remove_nulls (&allocated_blocks);
+ compact_blocks = FALSE;
+ }
}
static void
{
SGEN_ASSERT (0, sweep_state == SWEEP_STATE_SWEPT, "Sweeping must have finished before freeing blocks");
-#ifdef TARGET_WIN32
+#if defined(HOST_WIN32) || defined(HOST_ORBIS)
/*
* sgen_free_os_memory () asserts in mono_vfree () because windows doesn't like freeing the middle of
* a VirtualAlloc ()-ed block.
}
static void
-major_scan_card_table (CardTableScanType scan_type, ScanCopyContext ctx, int job_index, int job_split_count)
+major_scan_card_table (CardTableScanType scan_type, ScanCopyContext ctx, int job_index, int job_split_count, int block_count)
{
MSBlockInfo *block;
gboolean has_references, was_sweeping, skip_scan;
+ int first_block, last_block, index;
+
+ /*
+ * The last_block's index is at least (num_major_sections - 1) since we
+ * can have nulls in the allocated_blocks list. The last worker will
+ * scan the left-overs of the list. We expect few null entries in the
+ * allocated_blocks list, therefore using num_major_sections for computing
+ * block_count shouldn't affect work distribution.
+ */
+ first_block = block_count * job_index;
+ if (job_index == job_split_count - 1)
+ last_block = allocated_blocks.next_slot;
+ else
+ last_block = block_count * (job_index + 1);
if (!concurrent_mark)
g_assert (scan_type == CARDTABLE_SCAN_GLOBAL);
was_sweeping = sweep_in_progress ();
binary_protocol_major_card_table_scan_start (sgen_timestamp (), scan_type & CARDTABLE_SCAN_MOD_UNION);
- FOREACH_BLOCK_HAS_REFERENCES_NO_LOCK (block, has_references) {
- if (__index % job_split_count != job_index)
- continue;
+ FOREACH_BLOCK_RANGE_HAS_REFERENCES_NO_LOCK (block, first_block, last_block, index, has_references) {
#ifdef PREFETCH_CARDS
- int prefetch_index = __index + 6 * job_split_count;
+ int prefetch_index = index + 6;
if (prefetch_index < allocated_blocks.next_slot) {
MSBlockInfo *prefetch_block = BLOCK_UNTAG (*sgen_array_list_get_slot (&allocated_blocks, prefetch_index));
PREFETCH_READ (prefetch_block);
}
}
#endif
-
if (!has_references)
continue;
skip_scan = FALSE;
* sweep start since we are in a nursery collection. Also avoid CAS-ing
*/
if (sweep_in_progress ()) {
- skip_scan = !ensure_block_is_checked_for_sweeping (__index, TRUE, NULL);
+ skip_scan = !ensure_block_is_checked_for_sweeping (index, TRUE, NULL);
} else if (was_sweeping) {
/* Recheck in case sweep finished after dereferencing the slot */
- skip_scan = *sgen_array_list_get_slot (&allocated_blocks, __index) == 0;
+ skip_scan = *sgen_array_list_get_slot (&allocated_blocks, index) == 0;
}
}
}
if (!skip_scan)
scan_card_table_for_block (block, scan_type, ctx);
- } END_FOREACH_BLOCK_NO_LOCK;
+ } END_FOREACH_BLOCK_RANGE_NO_LOCK;
binary_protocol_major_card_table_scan_end (sgen_timestamp (), scan_type & CARDTABLE_SCAN_MOD_UNION);
}
IS_VTABLE_MATCH (ptr == entry->value_vtable)
END_PROTOCOL_ENTRY_HEAVY
-BEGIN_PROTOCOL_ENTRY2 (binary_protocol_major_card_table_scan_start, TYPE_LONGLONG, timestamp, TYPE_BOOL, mod_union)
+BEGIN_PROTOCOL_ENTRY_HEAVY2 (binary_protocol_major_card_table_scan_start, TYPE_LONGLONG, timestamp, TYPE_BOOL, mod_union)
DEFAULT_PRINT ()
IS_ALWAYS_MATCH (TRUE)
MATCH_INDEX (BINARY_PROTOCOL_MATCH)
IS_VTABLE_MATCH (FALSE)
-END_PROTOCOL_ENTRY
+END_PROTOCOL_ENTRY_HEAVY
-BEGIN_PROTOCOL_ENTRY2 (binary_protocol_major_card_table_scan_end, TYPE_LONGLONG, timestamp, TYPE_BOOL, mod_union)
+BEGIN_PROTOCOL_ENTRY_HEAVY2 (binary_protocol_major_card_table_scan_end, TYPE_LONGLONG, timestamp, TYPE_BOOL, mod_union)
DEFAULT_PRINT ()
IS_ALWAYS_MATCH (TRUE)
MATCH_INDEX (BINARY_PROTOCOL_MATCH)
IS_VTABLE_MATCH (FALSE)
-END_PROTOCOL_ENTRY
+END_PROTOCOL_ENTRY_HEAVY
-BEGIN_PROTOCOL_ENTRY2 (binary_protocol_los_card_table_scan_start, TYPE_LONGLONG, timestamp, TYPE_BOOL, mod_union)
+BEGIN_PROTOCOL_ENTRY_HEAVY2 (binary_protocol_los_card_table_scan_start, TYPE_LONGLONG, timestamp, TYPE_BOOL, mod_union)
DEFAULT_PRINT ()
IS_ALWAYS_MATCH (TRUE)
MATCH_INDEX (BINARY_PROTOCOL_MATCH)
IS_VTABLE_MATCH (FALSE)
-END_PROTOCOL_ENTRY
+END_PROTOCOL_ENTRY_HEAVY
-BEGIN_PROTOCOL_ENTRY2 (binary_protocol_los_card_table_scan_end, TYPE_LONGLONG, timestamp, TYPE_BOOL, mod_union)
+BEGIN_PROTOCOL_ENTRY_HEAVY2 (binary_protocol_los_card_table_scan_end, TYPE_LONGLONG, timestamp, TYPE_BOOL, mod_union)
DEFAULT_PRINT ()
IS_ALWAYS_MATCH (TRUE)
MATCH_INDEX (BINARY_PROTOCOL_MATCH)
IS_VTABLE_MATCH (FALSE)
-END_PROTOCOL_ENTRY
+END_PROTOCOL_ENTRY_HEAVY
-BEGIN_PROTOCOL_ENTRY2 (binary_protocol_finish_gray_stack_start, TYPE_LONGLONG, timestamp, TYPE_INT, generation)
+BEGIN_PROTOCOL_ENTRY_HEAVY2 (binary_protocol_finish_gray_stack_start, TYPE_LONGLONG, timestamp, TYPE_INT, generation)
DEFAULT_PRINT ()
IS_ALWAYS_MATCH (TRUE)
MATCH_INDEX (BINARY_PROTOCOL_MATCH)
IS_VTABLE_MATCH (FALSE)
-END_PROTOCOL_ENTRY
+END_PROTOCOL_ENTRY_HEAVY
-BEGIN_PROTOCOL_ENTRY2 (binary_protocol_finish_gray_stack_end, TYPE_LONGLONG, timestamp, TYPE_INT, generation)
+BEGIN_PROTOCOL_ENTRY_HEAVY2 (binary_protocol_finish_gray_stack_end, TYPE_LONGLONG, timestamp, TYPE_INT, generation)
DEFAULT_PRINT ()
IS_ALWAYS_MATCH (TRUE)
MATCH_INDEX (BINARY_PROTOCOL_MATCH)
IS_VTABLE_MATCH (FALSE)
-END_PROTOCOL_ENTRY
+END_PROTOCOL_ENTRY_HEAVY
BEGIN_PROTOCOL_ENTRY2 (binary_protocol_worker_finish, TYPE_LONGLONG, timestamp, TYPE_BOOL, forced)
DEFAULT_PRINT ()
IS_VTABLE_MATCH (FALSE)
END_PROTOCOL_ENTRY
+BEGIN_PROTOCOL_ENTRY6 (binary_protocol_worker_finish_stats, TYPE_INT, worker_index, TYPE_INT, generation, TYPE_BOOL, forced, TYPE_LONGLONG, major_scan, TYPE_LONGLONG, los_scan, TYPE_LONGLONG, work_time)
+DEFAULT_PRINT ()
+IS_ALWAYS_MATCH (TRUE)
+MATCH_INDEX (BINARY_PROTOCOL_MATCH)
+IS_VTABLE_MATCH (FALSE)
+END_PROTOCOL_ENTRY
+
+BEGIN_PROTOCOL_ENTRY3 (binary_protocol_collection_end_stats, TYPE_LONGLONG, major_scan, TYPE_LONGLONG, los_scan, TYPE_LONGLONG, finish_stack)
+DEFAULT_PRINT ()
+IS_ALWAYS_MATCH (TRUE)
+MATCH_INDEX (BINARY_PROTOCOL_MATCH)
+IS_VTABLE_MATCH (FALSE)
+END_PROTOCOL_ENTRY
+
#undef BEGIN_PROTOCOL_ENTRY0
#undef BEGIN_PROTOCOL_ENTRY1
#undef BEGIN_PROTOCOL_ENTRY2
static int threads_num;
static MonoNativeThreadId threads [SGEN_THREADPOOL_MAX_NUM_THREADS];
+static int threads_context [SGEN_THREADPOOL_MAX_NUM_THREADS];
static volatile gboolean threadpool_shutdown;
static volatile int threads_finished;
}
static mono_native_thread_return_t
-thread_func (int worker_index)
+thread_func (void *data)
{
+ int worker_index = (int)(gsize)data;
int current_context;
void *thread_data = NULL;
SgenThreadPoolJob *job = NULL;
SgenThreadPoolContext *context = NULL;
+ threads_context [worker_index] = -1;
get_work (worker_index, ¤t_context, &do_idle, &job);
+ threads_context [worker_index] = current_context;
if (!threadpool_shutdown) {
context = &pool_contexts [current_context];
}
void
-sgen_thread_pool_idle_wait (int context_id)
+sgen_thread_pool_idle_wait (int context_id, SgenThreadPoolContinueIdleWaitFunc continue_wait)
{
SGEN_ASSERT (0, pool_contexts [context_id].idle_job_func, "Why are we waiting for idle without an idle function?");
mono_os_mutex_lock (&lock);
- while (pool_contexts [context_id].continue_idle_job_func (NULL, context_id))
+ while (continue_wait (context_id, threads_context))
mono_os_cond_wait (&done_cond, &lock);
mono_os_mutex_unlock (&lock);
typedef void (*SgenThreadPoolIdleJobFunc) (void*);
typedef gboolean (*SgenThreadPoolContinueIdleJobFunc) (void*, int);
typedef gboolean (*SgenThreadPoolShouldWorkFunc) (void*);
+typedef gboolean (*SgenThreadPoolContinueIdleWaitFunc) (int, int*);
struct _SgenThreadPoolJob {
const char *name;
void sgen_thread_pool_job_wait (int context_id, SgenThreadPoolJob *job);
void sgen_thread_pool_idle_signal (int context_id);
-void sgen_thread_pool_idle_wait (int context_id);
+void sgen_thread_pool_idle_wait (int context_id, SgenThreadPoolContinueIdleWaitFunc continue_wait);
void sgen_thread_pool_wait_for_all_jobs (int context_id);
SGEN_ASSERT (0, old_state == STATE_WORKING, "We can only transition to NOT WORKING from WORKING");
else if (new_state == STATE_WORKING)
SGEN_ASSERT (0, old_state == STATE_WORK_ENQUEUED, "We can only transition to WORKING from WORK ENQUEUED");
- if (new_state == STATE_NOT_WORKING || new_state == STATE_WORKING)
- SGEN_ASSERT (6, sgen_thread_pool_is_thread_pool_thread (mono_native_thread_id_get ()), "Only the worker thread is allowed to transition to NOT_WORKING or WORKING");
return InterlockedCompareExchange (&data->state, new_state, old_state) == old_state;
}
break;
did_set_state = set_state (&context->workers_data [i], old_state, STATE_WORK_ENQUEUED);
+
+ if (did_set_state && old_state == STATE_NOT_WORKING)
+ context->workers_data [i].last_start = sgen_timestamp ();
} while (!did_set_state);
if (!state_is_working_or_enqueued (old_state))
State old_state;
int i, working = 0;
WorkerContext *context = data->context;
+ gint64 last_start = data->last_start;
++stat_workers_num_finished;
/* Make sure each worker has a chance of seeing the enqueued jobs */
sgen_workers_ensure_awake (context);
SGEN_ASSERT (0, data->state == STATE_WORK_ENQUEUED, "Why did we fail to set our own state to ENQUEUED");
+
+ /*
+ * Log to be able to get the duration of normal concurrent M&S phase.
+ * Worker indexes are 1 based, since 0 is logically considered gc thread.
+ */
+ binary_protocol_worker_finish_stats (data - &context->workers_data [0] + 1, context->generation, context->forced_stop, data->major_scan_time, data->los_scan_time, data->total_time + sgen_timestamp () - last_start);
goto work_available;
}
}
context->workers_finished = TRUE;
mono_os_mutex_unlock (&context->finished_lock);
- binary_protocol_worker_finish (sgen_timestamp (), context->forced_stop);
+ data->total_time += (sgen_timestamp () - last_start);
+ binary_protocol_worker_finish_stats (data - &context->workers_data [0] + 1, context->generation, context->forced_stop, data->major_scan_time, data->los_scan_time, data->total_time);
sgen_gray_object_queue_trim_free_list (&data->private_gray_queue);
return;
}
}
+/* This is called with thread pool lock so no context switch can happen */
+static gboolean
+continue_idle_wait (int calling_context, int *threads_context)
+{
+ WorkerContext *context;
+ int i;
+
+ if (worker_contexts [GENERATION_OLD].workers_num && calling_context == worker_contexts [GENERATION_OLD].thread_pool_context)
+ context = &worker_contexts [GENERATION_OLD];
+ else if (worker_contexts [GENERATION_NURSERY].workers_num && calling_context == worker_contexts [GENERATION_NURSERY].thread_pool_context)
+ context = &worker_contexts [GENERATION_NURSERY];
+ else
+ g_assert_not_reached ();
+
+ /*
+ * We assume there are no pending jobs, since this is called only after
+ * we waited for all the jobs.
+ */
+ for (i = 0; i < context->active_workers_num; i++) {
+ if (threads_context [i] == calling_context)
+ return TRUE;
+ }
+
+ if (sgen_workers_have_idle_work (context->generation) && !context->forced_stop)
+ return TRUE;
+
+ /*
+ * At this point there are no jobs to be done, and no objects to be scanned
+ * in the gray queues. We can simply asynchronously finish all the workers
+ * from the context that were not finished already (due to being stuck working
+ * in another context)
+ */
+
+ for (i = 0; i < context->active_workers_num; i++) {
+ if (context->workers_data [i].state == STATE_WORK_ENQUEUED)
+ set_state (&context->workers_data [i], STATE_WORK_ENQUEUED, STATE_WORKING);
+ if (context->workers_data [i].state == STATE_WORKING)
+ worker_try_finish (&context->workers_data [i]);
+ }
+
+ return FALSE;
+}
+
+
void
sgen_workers_stop_all_workers (int generation)
{
WorkerContext *context = &worker_contexts [generation];
+ mono_os_mutex_lock (&context->finished_lock);
context->finish_callback = NULL;
- mono_memory_write_barrier ();
+ mono_os_mutex_unlock (&context->finished_lock);
+
context->forced_stop = TRUE;
sgen_thread_pool_wait_for_all_jobs (context->thread_pool_context);
- sgen_thread_pool_idle_wait (context->thread_pool_context);
+ sgen_thread_pool_idle_wait (context->thread_pool_context, continue_idle_wait);
SGEN_ASSERT (0, !sgen_workers_are_working (context), "Can only signal enqueue work when in no work state");
context->started = FALSE;
sgen_workers_start_all_workers (int generation, SgenObjectOperations *object_ops_nopar, SgenObjectOperations *object_ops_par, SgenWorkersFinishCallback callback)
{
WorkerContext *context = &worker_contexts [generation];
+ int i;
SGEN_ASSERT (0, !context->started, "Why are we starting to work without finishing previous cycle");
context->idle_func_object_ops_par = object_ops_par;
context->finish_callback = callback;
context->worker_awakenings = 0;
context->started = TRUE;
+
+ for (i = 0; i < context->active_workers_num; i++) {
+ context->workers_data [i].major_scan_time = 0;
+ context->workers_data [i].los_scan_time = 0;
+ context->workers_data [i].total_time = 0;
+ context->workers_data [i].last_start = 0;
+ }
mono_memory_write_barrier ();
/*
WorkerContext *context = &worker_contexts [generation];
int i;
- /*
- * It might be the case that a worker didn't get to run anything
- * in this context, because it was stuck working on a long job
- * in another context. In this case its state is active (WORK_ENQUEUED)
- * and we need to wait for it to finish itself.
- * FIXME Avoid having to wait for the worker to report its own finish.
- */
+ SGEN_ASSERT (0, !context->finish_callback, "Why are we joining concurrent mark early");
sgen_thread_pool_wait_for_all_jobs (context->thread_pool_context);
- sgen_thread_pool_idle_wait (context->thread_pool_context);
+ sgen_thread_pool_idle_wait (context->thread_pool_context, continue_idle_wait);
SGEN_ASSERT (0, !sgen_workers_are_working (context), "Can only signal enqueue work when in no work state");
/* At this point all the workers have stopped. */
}
/*
- * Can only be called if the workers are stopped.
- * If we're stopped, there are also no pending jobs.
+ * Can only be called if the workers are not working in the
+ * context and there are no pending jobs.
*/
gboolean
sgen_workers_have_idle_work (int generation)
WorkerContext *context = &worker_contexts [generation];
int i;
- SGEN_ASSERT (0, context->forced_stop && !sgen_workers_are_working (context), "Checking for idle work should only happen if the workers are stopped.");
-
if (!sgen_section_gray_queue_is_empty (&context->workers_distribute_gray_queue))
return TRUE;
*/
gpointer free_block_lists;
WorkerContext *context;
+
+ /* Work time distribution. Measured in ticks. */
+ gint64 major_scan_time, los_scan_time, total_time;
+ /*
+ * When changing the state of the worker from not working to work enqueued
+ * we set the timestamp so we can compute for how long the worker did actual
+ * work during the phase
+ */
+ gint64 last_start;
};
struct _WorkerContext {
PROFILE_MCS_FLAGS = -d:MOBILE,MOBILE_LEGACY
endif
-MCS_NO_LIB = $(TOOLS_RUNTIME) $(CSC) -unsafe -debug:portable \
+MCS_NO_UNSAFE = $(TOOLS_RUNTIME) $(CSC) -debug:portable \
-noconfig -nologo \
-nowarn:0162 -nowarn:0168 -nowarn:0219 -nowarn:0414 -nowarn:0618 \
-nowarn:0169 -nowarn:1690 -nowarn:0649 -nowarn:0612 -nowarn:3021 \
-nowarn:0197 $(PROFILE_MCS_FLAGS)
+MCS_NO_LIB = $(MCS_NO_UNSAFE) -unsafe
MCS = $(MCS_NO_LIB)
# appdomain-threadpool-unload.exe creates 100 appdomains, takes too long with llvm
LLVM_DISABLED_TESTS = \
+ finally_block_ending_in_dead_bb.exe \
appdomain-threadpool-unload.exe
LLVM = $(filter --llvm, $(MONO_ENV_OPTIONS))
libtest_la_SOURCES = libtest.c
libtest_la_LIBADD = $(GLIB_LIBS) $(LIBICONV)
-test-internalsvisibleto: internalsvisibleto-runtimetest.exe internalsvisibleto-compilertest.exe internalsvisibleto-library.dll
- $(Q) $(RUNTIME) internalsvisibleto-runtimetest.exe 1>internalsvisibleto-runtimetest.exe.stdout 2>internalsvisibleto-runtimetest.exe.stderr
- $(Q) $(RUNTIME) internalsvisibleto-compilertest.exe 1>internalsvisibleto-compilertest.exe.stdout 2>internalsvisibleto-compilertest.exe.stderr
-
-internalsvisibleto-runtimetest.exe: internalsvisibleto-runtimetest.cs internalsvisibleto-library.cs
- $(Q) $(MCS) -out:internalsvisibleto-correctcase.dll -target:library -d:CORRECT_CASE -d:PERMISSIVE internalsvisibleto-library.cs
- $(Q) $(MCS) -out:internalsvisibleto-wrongcase.dll -target:library -d:WRONG_CASE -d:PERMISSIVE internalsvisibleto-library.cs
- $(Q) $(MCS) -out:internalsvisibleto-runtimetest.exe -warn:0 -r:internalsvisibleto-correctcase.dll -r:internalsvisibleto-wrongcase.dll internalsvisibleto-runtimetest.cs
- $(Q) $(MCS) -out:internalsvisibleto-correctcase.dll -target:library -d:CORRECT_CASE internalsvisibleto-library.cs
- $(Q) $(MCS) -out:internalsvisibleto-wrongcase.dll -target:library -d:WRONG_CASE internalsvisibleto-library.cs
-
-internalsvisibleto-compilertest.exe: internalsvisibleto-compilertest.cs internalsvisibleto-library.cs
- $(Q) $(MCS) -out:internalsvisibleto-correctcase-2.dll -target:library -d:CORRECT_CASE internalsvisibleto-library.cs
- $(Q) $(MCS) -out:internalsvisibleto-wrongcase-2.dll -target:library -d:WRONG_CASE internalsvisibleto-library.cs
- $(Q) $(MCS) -out:internalsvisibleto-compilertest.exe -warn:0 -r:internalsvisibleto-correctcase-2.dll -r:internalsvisibleto-wrongcase-2.dll internalsvisibleto-compilertest.cs
+INTERNALSVISIBLETO_TEST_SRC = \
+ internalsvisibleto-runtimetest.cs \
+ internalsvisibleto-compilertest.cs
+
+INTERNALSVISIBLETO_TEST_LIB_SRC = \
+ internalsvisibleto-library.cs
+
+INTERNALSVISIBLETO_TEST_LIBS = \
+ internalsvisibleto-correctcase.dll \
+ internalsvisibleto-wrongcase.dll \
+ internalsvisibleto-correctcase-2.dll \
+ internalsvisibleto-wrongcase-2.dll \
+ internalsvisibleto-correctcase-sign2048.dll \
+ internalsvisibleto-wrongcase-sign2048.dll \
+ internalsvisibleto-correctcase-2-sign2048.dll \
+ internalsvisibleto-wrongcase-2-sign2048.dll
+
+
+INTERNALSVISIBLETO_TEST = \
+ $(INTERNALSVISIBLETO_TEST_SRC:.cs=.exe) \
+ $(INTERNALSVISIBLETO_TEST_SRC:.cs=-sign2048.exe)
+
+if FULL_AOT_TESTS
+INTERNALSVISIBLETO_TESTAOT = \
+ $(INTERNALSVISIBLETO_TEST:.exe=.exe$(PLATFORM_AOT_SUFFIX))
+INTERNALSVISIBLETO_TESTAOT_LIBS = \
+ $(INTERNALSVISIBLETO_TEST_LIBS:.dll=.dll$(PLATFORM_AOT_SUFFIX))
+endif
+
+if HYBRID_AOT_TESTS
+INTERNALSVISIBLETO_TESTAOT = \
+ $(INTERNALSVISIBLETO_TEST:.exe=.exe$(PLATFORM_AOT_SUFFIX))
+INTERNALSVISIBLETO_TESTAOT_LIBS = \
+ $(INTERNALSVISIBLETO_TEST_LIBS:.dll=.dll$(PLATFORM_AOT_SUFFIX))
+endif
+
+EXTRA_DIST += $(INTERNALSVISIBLETO_TEST_SRC) $(INTERNALSVISIBLETO_TEST_LIB_SRC)
+
+test-internalsvisibleto: test-runner.exe $(INTERNALSVISIBLETO_TEST) $(INTERNALSVISIBLETO_TESTAOT) $(INTERNALSVISIBLETO_TESTAOT_LIBS)
+ $(TOOLS_RUNTIME) $(TEST_RUNNER) --testsuite-name $@ $(INTERNALSVISIBLETO_TEST)
+
+internalsvisibleto-correctcase.dll internalsvisibleto-wrongcase.dll internalsvisibleto-runtimetest.exe: internalsvisibleto-runtimetest.cs internalsvisibleto-library.cs
+ $(Q) $(MCS_NO_UNSAFE) -out:internalsvisibleto-correctcase.dll -target:library -d:CORRECT_CASE -d:PERMISSIVE internalsvisibleto-library.cs
+ $(Q) $(MCS_NO_UNSAFE) -out:internalsvisibleto-wrongcase.dll -target:library -d:WRONG_CASE -d:PERMISSIVE internalsvisibleto-library.cs
+ $(Q) $(MCS_NO_UNSAFE) -out:internalsvisibleto-runtimetest.exe -warn:0 -r:internalsvisibleto-correctcase.dll -r:internalsvisibleto-wrongcase.dll internalsvisibleto-runtimetest.cs
+ $(Q) $(MCS_NO_UNSAFE) -out:internalsvisibleto-correctcase.dll -target:library -d:CORRECT_CASE internalsvisibleto-library.cs
+ $(Q) $(MCS_NO_UNSAFE) -out:internalsvisibleto-wrongcase.dll -target:library -d:WRONG_CASE internalsvisibleto-library.cs
+
+internalsvisibleto-correctcase-2.dll internalsvisibleto-wrongcase-2.dll internalsvisibleto-compilertest.exe: internalsvisibleto-compilertest.cs internalsvisibleto-library.cs
+ $(Q) $(MCS_NO_UNSAFE) -out:internalsvisibleto-correctcase-2.dll -target:library -d:CORRECT_CASE internalsvisibleto-library.cs
+ $(Q) $(MCS_NO_UNSAFE) -out:internalsvisibleto-wrongcase-2.dll -target:library -d:WRONG_CASE internalsvisibleto-library.cs
+ $(Q) $(MCS_NO_UNSAFE) -out:internalsvisibleto-compilertest.exe -warn:0 -r:internalsvisibleto-correctcase-2.dll -r:internalsvisibleto-wrongcase-2.dll internalsvisibleto-compilertest.cs
+
+internalsvisibleto-correctcase-sign2048.dll internalsvisibleto-wrongcase-sign2048.dll internalsvisibleto-runtimetest-sign2048.exe: internalsvisibleto-runtimetest.cs internalsvisibleto-library.cs internalsvisibleto-2048.snk
+ $(Q) $(MCS_NO_UNSAFE) -out:internalsvisibleto-correctcase-sign2048.dll -target:library -d:CORRECT_CASE -d:PERMISSIVE -d:SIGN2048 internalsvisibleto-library.cs
+ $(Q) $(MCS_NO_UNSAFE) -out:internalsvisibleto-wrongcase-sign2048.dll -target:library -d:WRONG_CASE -d:PERMISSIVE -d:SIGN2048 internalsvisibleto-library.cs
+ $(Q) $(MCS_NO_UNSAFE) -out:internalsvisibleto-runtimetest-sign2048.exe -warn:0 -r:internalsvisibleto-correctcase-sign2048.dll -r:internalsvisibleto-wrongcase-sign2048.dll -d:SIGN2048 internalsvisibleto-runtimetest.cs
+ $(Q) $(MCS_NO_UNSAFE) -out:internalsvisibleto-correctcase-sign2048.dll -target:library -d:CORRECT_CASE -d:SIGN2048 internalsvisibleto-library.cs
+ $(Q) $(MCS_NO_UNSAFE) -out:internalsvisibleto-wrongcase-sign2048.dll -target:library -d:WRONG_CASE -d:SIGN2048 internalsvisibleto-library.cs
+
+internalsvisibleto-correctcase-2-sign2048.dll internalsvisibleto-wrongcase-2-sign2048.dll internalsvisibleto-compilertest-sign2048.exe: internalsvisibleto-compilertest.cs internalsvisibleto-library.cs internalsvisibleto-2048.snk
+ $(Q) $(MCS_NO_UNSAFE) -out:internalsvisibleto-correctcase-2-sign2048.dll -target:library -d:CORRECT_CASE -d:SIGN2048 internalsvisibleto-library.cs
+ $(Q) $(MCS_NO_UNSAFE) -out:internalsvisibleto-wrongcase-2-sign2048.dll -target:library -d:WRONG_CASE -d:SIGN2048 internalsvisibleto-library.cs
+ $(Q) $(MCS_NO_UNSAFE) -out:internalsvisibleto-compilertest-sign2048.exe -warn:0 -r:internalsvisibleto-correctcase-2-sign2048.dll -r:internalsvisibleto-wrongcase-2-sign2048.dll -d:SIGN2048 internalsvisibleto-compilertest.cs
+
CLEANFILES = $(TESTS_CS) $(TESTS_IL) $(TESTS_BENCH) $(TESTS_STRESS) $(TESTSAOT_CS) $(TESTSAOT_IL) $(TESTSAOT_BENCH) $(TESTSAOT_STRESS) *.dll *.stdout *.aotlog *.exe stest.dat
[DllImport ("libtest")]
public static extern int mono_test_marshal_ccw_itest ([MarshalAs (UnmanagedType.Interface)]ITestPresSig itest);
+ [DllImport ("libtest")]
+ public static extern int mono_test_marshal_array_ccw_itest (int count, [MarshalAs (UnmanagedType.LPArray, SizeParamIndex=0)] ITest[] ppUnk);
+
[DllImport("libtest")]
public static extern int mono_test_marshal_safearray_out_1dim_vt_bstr_empty ([MarshalAs (UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_VARIANT)]out Array array);
mono_test_marshal_ccw_itest (test_pres_sig);
+ // test for Xamarin-47560
+ var tests = new[] { test.Test };
+ if (mono_test_marshal_array_ccw_itest (1, tests) != 0)
+ return 201;
+
#endregion // COM Callable Wrapper Tests
#region SAFEARRAY tests
using System;
+#if SIGN2048
+using System.Reflection;
+[assembly: AssemblyDelaySign(true)]
+[assembly: AssemblyKeyFile(@"internalsvisibleto-2048.snk")]
+#endif
+
namespace InternalsVisibleTo {
class Program {
static void Main (string[] args) {
Console.WriteLine("-- Correct case --");
+ try {
+ var a = new CorrectCaseFriendAssembly.PublicClass ();
+ a.InternalMethod ();
+ Console.WriteLine ("Access friend internal method: OK");
+ } catch (MemberAccessException) {
+ failCount += 1;
+ Console.WriteLine ("Access friend internal method: Fail");
+ }
+
try {
var a = new CorrectCaseFriendAssembly.InternalClass(@internal: 0);
Console.WriteLine("Access internal class internal ctor: OK");
using System;
using System.Runtime.CompilerServices;
+#if SIGN2048
+using System.Reflection;
+[assembly: AssemblyDelaySign(true)]
+[assembly: AssemblyKeyFile(@"internalsvisibleto-2048.snk")]
+#endif
+
#if CORRECT_CASE
+#if !SIGN2048
[assembly: InternalsVisibleTo("internalsvisibleto-runtimetest")]
[assembly: InternalsVisibleTo("internalsvisibleto-compilertest")]
#else
+[assembly: InternalsVisibleTo("internalsvisibleto-runtimetest-sign2048, PublicKey=00240000048000001401000006020000002400005253413100080000010001002b524ed36058e444d0f2b12aeeeadab6f9a614dae43300d489746d143103a63c0178d0e316cc7a83156637d02b95b617c34bfa6877bc418118ce6d652e73211fdb80e5bc1878c6ef1b488dae12925390e7932dae9b22ada65ec76694a73b8e940db558d03ff5a3bee28017cb4448cd41dc946cc248e3313417f59092b9b62996de506c9446c7dceffed8e854cfa3d42eee30cdccbce934318b64ee20489178c00fa587f4ea666e4421eeae157fddf5ce7cfcf76e3b8b390005297f1b7e502c0f211c8c3f6886012cc4173aeedb4dc915d6d8f3821c19c0f1eedcccec8e839c1443ac96db7231ddebb391a5a92373aa87a6f2b2c8a9d57ad204e61813cc280da3")]
+[assembly: InternalsVisibleTo("internalsvisibleto-compilertest-sign2048, PublicKey=00240000048000001401000006020000002400005253413100080000010001002b524ed36058e444d0f2b12aeeeadab6f9a614dae43300d489746d143103a63c0178d0e316cc7a83156637d02b95b617c34bfa6877bc418118ce6d652e73211fdb80e5bc1878c6ef1b488dae12925390e7932dae9b22ada65ec76694a73b8e940db558d03ff5a3bee28017cb4448cd41dc946cc248e3313417f59092b9b62996de506c9446c7dceffed8e854cfa3d42eee30cdccbce934318b64ee20489178c00fa587f4ea666e4421eeae157fddf5ce7cfcf76e3b8b390005297f1b7e502c0f211c8c3f6886012cc4173aeedb4dc915d6d8f3821c19c0f1eedcccec8e839c1443ac96db7231ddebb391a5a92373aa87a6f2b2c8a9d57ad204e61813cc280da3")]
+#endif // SIGN2048
+#else
+#if !SIGN2048
[assembly: InternalsVisibleTo("iNtErnAlsVisibLETo-RUntimeTesT")]
[assembly: InternalsVisibleTo("iNtErnAlsVisibLETo-COmpilerTesT")]
-#endif
+#else
+[assembly: InternalsVisibleTo("iNtErnAlsVisibLETo-RUntimeTesT-sign2048, PublicKey=00240000048000001401000006020000002400005253413100080000010001002b524ed36058e444d0f2b12aeeeadab6f9a614dae43300d489746d143103a63c0178d0e316cc7a83156637d02b95b617c34bfa6877bc418118ce6d652e73211fdb80e5bc1878c6ef1b488dae12925390e7932dae9b22ada65ec76694a73b8e940db558d03ff5a3bee28017cb4448cd41dc946cc248e3313417f59092b9b62996de506c9446c7dceffed8e854cfa3d42eee30cdccbce934318b64ee20489178c00fa587f4ea666e4421eeae157fddf5ce7cfcf76e3b8b390005297f1b7e502c0f211c8c3f6886012cc4173aeedb4dc915d6d8f3821c19c0f1eedcccec8e839c1443ac96db7231ddebb391a5a92373aa87a6f2b2c8a9d57ad204e61813cc280da3")]
+[assembly: InternalsVisibleTo("iNtErnAlsVisibLETo-COmpilerTesT-sign2048, PublicKey=00240000048000001401000006020000002400005253413100080000010001002b524ed36058e444d0f2b12aeeeadab6f9a614dae43300d489746d143103a63c0178d0e316cc7a83156637d02b95b617c34bfa6877bc418118ce6d652e73211fdb80e5bc1878c6ef1b488dae12925390e7932dae9b22ada65ec76694a73b8e940db558d03ff5a3bee28017cb4448cd41dc946cc248e3313417f59092b9b62996de506c9446c7dceffed8e854cfa3d42eee30cdccbce934318b64ee20489178c00fa587f4ea666e4421eeae157fddf5ce7cfcf76e3b8b390005297f1b7e502c0f211c8c3f6886012cc4173aeedb4dc915d6d8f3821c19c0f1eedcccec8e839c1443ac96db7231ddebb391a5a92373aa87a6f2b2c8a9d57ad204e61813cc280da3")]
+#endif // SIGN2048
+#endif // !CORRECT_CASE
#if CORRECT_CASE
namespace CorrectCaseFriendAssembly {
using System;
+#if SIGN2048
+using System.Reflection;
+[assembly: AssemblyDelaySign(true)]
+[assembly: AssemblyKeyFile(@"internalsvisibleto-2048.snk")]
+#endif
+
namespace InternalsVisibleTo {
class Program {
static void Main (string[] args) {
Console.WriteLine("-- Correct case --");
+ try {
+ var a = new CorrectCaseFriendAssembly.PublicClass ();
+ a.InternalMethod ();
+ Console.WriteLine ("Access friend internal method: OK");
+ } catch (MemberAccessException) {
+ failCount += 1;
+ Console.WriteLine ("Access friend internal method: Fail");
+ }
+
try {
var a = new CorrectCaseFriendAssembly.InternalClass(@private: false);
Console.WriteLine("Access internal class private ctor: OK");
return 0;
}
+// Xamarin-47560
+LIBTEST_API int STDCALL
+mono_test_marshal_array_ccw_itest (int count, MonoComObject ** ppUnk)
+{
+ int hr = 0;
+
+ if (!ppUnk)
+ return 1;
+
+ if (count < 1)
+ return 2;
+
+ if (!ppUnk[0])
+ return 3;
+
+ hr = ppUnk[0]->vtbl->SByteIn (ppUnk[0], -100);
+ if (hr != 0)
+ return 4;
+
+ return 0;
+}
+
/*
* mono_method_get_unmanaged_thunk tests
*/
checked-build.h \
os-event.h \
refcount.h \
- w32api.h
+ w32api.h \
+ unlocked.h
arch_sources =
#define MONO_GNUC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#endif
+#if defined(__has_feature)
+#if __has_feature(thread_sanitizer)
+#define MONO_HAS_CLANG_THREAD_SANITIZER 1
+#else
+#define MONO_HAS_CLANG_THREAD_SANITIZER 0
+#endif
+#else
+#define MONO_HAS_CLANG_THREAD_SANITIZER 0
+#endif
+
+/* Used to tell Clang's ThreadSanitizer to not report data races that occur within a certain function */
+#if MONO_HAS_CLANG_THREAD_SANITIZER
+#define MONO_NO_SANITIZE_THREAD __attribute__ ((no_sanitize("thread")))
+#else
+#define MONO_NO_SANITIZE_THREAD
+#endif
+
#endif /* __UTILS_MONO_COMPILER_H__*/
MONO_TRACE_W32HANDLE
} MonoTraceMask;
-extern GLogLevelFlags mono_internal_current_level;
-extern MonoTraceMask mono_internal_current_mask;
+MONO_API extern GLogLevelFlags mono_internal_current_level;
+MONO_API extern MonoTraceMask mono_internal_current_mask;
void
mono_trace_init (void);
void
mono_trace_cleanup (void);
-void
+MONO_API void
mono_tracev_inner (GLogLevelFlags level, MonoTraceMask mask, const char *format, va_list args);
void
#define mono_gc_printf(gc_log_file, format, ...) g_log ("mono-gc", G_LOG_LEVEL_MESSAGE, format, ##__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_CRITICAL, format "\n", ##__VA_ARGS__)
+#define mono_profiler_printf(format, ...) g_log ("mono-prof", G_LOG_LEVEL_MESSAGE, format "\n", ##__VA_ARGS__)
+#define mono_profiler_printf_err(format, ...) g_log ("mono-prof", G_LOG_LEVEL_CRITICAL, format "\n", ##__VA_ARGS__)
#define mono_runtime_stdout_fflush() do { } while (0)
#else
#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_profiler_printf(format, ...) fprintf (stdout, format "\n", ##__VA_ARGS__)
+#define mono_profiler_printf_err(format, ...) fprintf (stderr, format "\n", ##__VA_ARGS__)
#define mono_runtime_stdout_fflush() do { fflush (stdout); } while (0)
#endif
#include <glib.h>
#include <mono/utils/mono-compiler.h>
+#include <mono/utils/mono-publib.h>
/* never remove or reorder these enums values: they are used in corlib/System */
int mono_process_current_pid (void);
-int mono_cpu_count (void);
+MONO_API int mono_cpu_count (void);
gint64 mono_cpu_get_data (int cpu_id, MonoCpuData data, MonoProcessError *error);
gint32 mono_cpu_usage (MonoCpuUsageState *prev);
mono_threads_platform_get_stack_bounds (guint8 **staddr, size_t *stsize)
{
pthread_attr_t attr;
+ gint res;
*staddr = NULL;
*stsize = (size_t)-1;
- pthread_getattr_np (pthread_self (), &attr);
- pthread_attr_getstack (&attr, (void**)staddr, stsize);
- pthread_attr_destroy (&attr);
+ res = pthread_attr_init (&attr);
+ if (G_UNLIKELY (res != 0))
+ g_error ("%s: pthread_attr_init failed with \"%s\" (%d)", __func__, g_strerror (res), res);
+
+ res = pthread_getattr_np (pthread_self (), &attr);
+ if (G_UNLIKELY (res != 0))
+ g_error ("%s: pthread_getattr_np failed with \"%s\" (%d)", __func__, g_strerror (res), res);
+
+ res = pthread_attr_getstack (&attr, (void**)staddr, stsize);
+ if (G_UNLIKELY (res != 0))
+ g_error ("%s: pthread_attr_getstack failed with \"%s\" (%d)", __func__, g_strerror (res), res);
+
+ res = pthread_attr_destroy (&attr);
+ if (G_UNLIKELY (res != 0))
+ g_error ("%s: pthread_attr_destroy failed with \"%s\" (%d)", __func__, g_strerror (res), res);
+
}
#endif
} else {
char n [63];
- memcpy (n, name, sizeof (n) - 1);
+ strncpy (n, name, sizeof (n) - 1);
n [sizeof (n) - 1] = '\0';
pthread_setname_np (n);
}
} else {
char n [PTHREAD_MAX_NAMELEN_NP];
- memcpy (n, name, sizeof (n) - 1);
+ strncpy (n, name, sizeof (n) - 1);
n [sizeof (n) - 1] = '\0';
pthread_setname_np (tid, "%s", (void*)n);
}
} else {
char n [16];
- memcpy (n, name, sizeof (n) - 1);
+ strncpy (n, name, sizeof (n) - 1);
n [sizeof (n) - 1] = '\0';
pthread_setname_np (tid, n);
}
--- /dev/null
+/**
+ * \file
+ * Contains inline functions to explicitly mark data races that should not be changed.
+ * This way, instruments like Clang's ThreadSanitizer can be told to ignore very specific instructions.
+ *
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+
+#ifndef _UNLOCKED_H_
+#define _UNLOCKED_H_
+
+#include <glib.h>
+#include <mono/utils/mono-compiler.h>
+
+#if MONO_HAS_CLANG_THREAD_SANITIZER
+#define MONO_UNLOCKED_ATTRS MONO_NO_SANITIZE_THREAD MONO_NEVER_INLINE static
+#else
+#define MONO_UNLOCKED_ATTRS MONO_ALWAYS_INLINE static inline
+#endif
+
+MONO_UNLOCKED_ATTRS
+gint32
+UnlockedIncrement (gint32 *val)
+{
+ return ++*val;
+}
+
+MONO_UNLOCKED_ATTRS
+gint64
+UnlockedIncrement64 (gint64 *val)
+{
+ return ++*val;
+}
+
+MONO_UNLOCKED_ATTRS
+gsize
+UnlockedIncrementSize (gsize *val)
+{
+ return ++*val;
+}
+
+#endif /* _UNLOCKED_H_ */
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\garray.c" />
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gbytearray.c" />
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gerror.c" />
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gfile.c" />
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\ghashtable.c" />
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\giconv.c" />
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\glist.c" />
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gmarkup.c" />
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gmem.c" />
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\goutput.c" />
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gpattern.c" />
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gptrarray.c" />
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gqsort.c" />
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gqueue.c" />
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gshell.c" />
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gslist.c" />
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gspawn.c" />
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gstr.c" />
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gstring.c" />
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gunicode.c" />
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gutf8.c" />
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\garray.c" />
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gbytearray.c" />
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gerror.c" />
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gfile.c" />
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\ghashtable.c" />
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\giconv.c" />
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\glist.c" />
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gmarkup.c" />
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gmem.c" />
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\goutput.c" />
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gpattern.c" />
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gptrarray.c" />
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gqsort.c" />
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gqueue.c" />
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gshell.c" />
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gslist.c" />
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gspawn.c" />
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gstr.c" />
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gstring.c" />
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gunicode.c" />
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gutf8.c" />
</ItemGroup>
<ItemGroup>
- <ClInclude Include="$(MonoSourceLocation)\eglib\src\glib.h" />
- <ClInclude Include="$(MonoSourceLocation)\eglib\src\gmodule.h" />
- <ClInclude Include="$(MonoSourceLocation)\eglib\src\sort.frag.h" />
+ <ClInclude Include="$(MonoSourceLocation)\mono\eglib\glib.h" />
+ <ClInclude Include="$(MonoSourceLocation)\mono\eglib\gmodule.h" />
+ <ClInclude Include="$(MonoSourceLocation)\mono\eglib\sort.frag.h" />
</ItemGroup>
</Project>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\garray.c">
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\garray.c">
<Filter>Source Files\Common</Filter>
</ClCompile>
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gbytearray.c">
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gbytearray.c">
<Filter>Source Files\Common</Filter>
</ClCompile>
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gfile.c">
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gfile.c">
<Filter>Source Files\Common</Filter>
</ClCompile>
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gerror.c">
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gerror.c">
<Filter>Source Files\Common</Filter>
</ClCompile>
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\ghashtable.c">
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\ghashtable.c">
<Filter>Source Files\Common</Filter>
</ClCompile>
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\giconv.c">
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\giconv.c">
<Filter>Source Files\Common</Filter>
</ClCompile>
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\glist.c">
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\glist.c">
<Filter>Source Files\Common</Filter>
</ClCompile>
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gmarkup.c">
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gmarkup.c">
<Filter>Source Files\Common</Filter>
</ClCompile>
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gmem.c">
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gmem.c">
<Filter>Source Files\Common</Filter>
</ClCompile>
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\goutput.c">
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\goutput.c">
<Filter>Source Files\Common</Filter>
</ClCompile>
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gpattern.c">
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gpattern.c">
<Filter>Source Files\Common</Filter>
</ClCompile>
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gptrarray.c">
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gptrarray.c">
<Filter>Source Files\Common</Filter>
</ClCompile>
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gqsort.c">
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gqsort.c">
<Filter>Source Files\Common</Filter>
</ClCompile>
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gqueue.c">
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gqueue.c">
<Filter>Source Files\Common</Filter>
</ClCompile>
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gshell.c">
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gshell.c">
<Filter>Source Files\Common</Filter>
</ClCompile>
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gslist.c">
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gslist.c">
<Filter>Source Files\Common</Filter>
</ClCompile>
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gspawn.c">
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gspawn.c">
<Filter>Source Files\Common</Filter>
</ClCompile>
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gstr.c">
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gstr.c">
<Filter>Source Files\Common</Filter>
</ClCompile>
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gstring.c">
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gstring.c">
<Filter>Source Files\Common</Filter>
</ClCompile>
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gunicode.c">
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gunicode.c">
<Filter>Source Files\Common</Filter>
</ClCompile>
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gutf8.c">
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gutf8.c">
<Filter>Source Files\Common</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
- <ClInclude Include="$(MonoSourceLocation)\eglib\src\glib.h">
+ <ClInclude Include="$(MonoSourceLocation)\mono\eglib\glib.h">
<Filter>Header Files\Common</Filter>
</ClInclude>
- <ClInclude Include="$(MonoSourceLocation)\eglib\src\gmodule.h">
+ <ClInclude Include="$(MonoSourceLocation)\mono\eglib\gmodule.h">
<Filter>Header Files\Common</Filter>
</ClInclude>
- <ClInclude Include="$(MonoSourceLocation)\eglib\src\sort.frag.h">
+ <ClInclude Include="$(MonoSourceLocation)\mono\eglib\sort.frag.h">
<Filter>Header Files\Common</Filter>
</ClInclude>
</ItemGroup>
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gfile-posix.c" />
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gfile-posix.c" />
</ItemGroup>
</Project>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gfile-posix.c">
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gfile-posix.c">
<Filter>Source Files\Posix</Filter>
</ClCompile>
</ItemGroup>
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gdate-win32.c" />
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gdir-win32.c" />
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gfile-win32.c" />
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gmisc-win32.c" />
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gmodule-win32.c" />
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gpath.c" />
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gtimer-win32.c" />
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gunicode-win32.c" />
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gdate-win32.c" />
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gdir-win32.c" />
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gfile-win32.c" />
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gmisc-win32.c" />
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gmodule-win32.c" />
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gpath.c" />
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gtimer-win32.c" />
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gunicode-win32.c" />
</ItemGroup>
<ItemGroup>
- <ClInclude Include="$(MonoSourceLocation)\eglib\src\gmodule-win32-internals.h" />
+ <ClInclude Include="$(MonoSourceLocation)\mono\eglib\gmodule-win32-internals.h" />
</ItemGroup>
</Project>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gdate-win32.c">
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gdate-win32.c">
<Filter>Source Files\Win32</Filter>
</ClCompile>
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gdir-win32.c">
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gdir-win32.c">
<Filter>Source Files\Win32</Filter>
</ClCompile>
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gfile-win32.c">
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gfile-win32.c">
<Filter>Source Files\Win32</Filter>
</ClCompile>
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gmisc-win32.c">
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gmisc-win32.c">
<Filter>Source Files\Win32</Filter>
</ClCompile>
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gmodule-win32.c">
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gmodule-win32.c">
<Filter>Source Files\Win32</Filter>
</ClCompile>
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gpath.c">
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gpath.c">
<Filter>Source Files\Win32</Filter>
</ClCompile>
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gtimer-win32.c">
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gtimer-win32.c">
<Filter>Source Files\Win32</Filter>
</ClCompile>
- <ClCompile Include="$(MonoSourceLocation)\eglib\src\gunicode-win32.c">
+ <ClCompile Include="$(MonoSourceLocation)\mono\eglib\gunicode-win32.c">
<Filter>Source Files\Win32</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
- <ClInclude Include="$(MonoSourceLocation)\eglib\src\gmodule-win32-internals.h">
+ <ClInclude Include="$(MonoSourceLocation)\mono\eglib\gmodule-win32-internals.h">
<Filter>Header Files\Win32</Filter>
</ClInclude>
</ItemGroup>
-<?xml version="1.0" encoding="utf-8"?>\r
+<?xml version="1.0" encoding="utf-8"?>\r
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<ItemGroup Label="ProjectConfigurations">\r
<ProjectConfiguration Include="Debug|Win32">\r
</PreBuildEvent>\r
<ClCompile>\r
<Optimization>Disabled</Optimization>\r
- <AdditionalIncludeDirectories>$(MONO_EGLIB_SOURCE_DIR);$(MONO_EGLIB_INCLUDE_DIR);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+ <AdditionalIncludeDirectories>$(MONO_DIR);$(MONO_EGLIB_SOURCE_DIR);$(MONO_EGLIB_INCLUDE_DIR);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
<MinimalRebuild>true</MinimalRebuild>\r
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r
<PrecompiledHeader>\r
</PreBuildEvent>\r
<ClCompile>\r
<Optimization>MinSpace</Optimization>\r
- <AdditionalIncludeDirectories>$(MONO_EGLIB_SOURCE_DIR);$(MONO_EGLIB_INCLUDE_DIR);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+ <AdditionalIncludeDirectories>$(MONO_DIR);$(MONO_EGLIB_SOURCE_DIR);$(MONO_EGLIB_INCLUDE_DIR);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
<PrecompiledHeader>\r
</PrecompiledHeader>\r
<WarningLevel>Level4</WarningLevel>\r
</Midl>\r
<ClCompile>\r
<Optimization>Disabled</Optimization>\r
- <AdditionalIncludeDirectories>$(MONO_EGLIB_SOURCE_DIR);$(MONO_EGLIB_INCLUDE_DIR);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+ <AdditionalIncludeDirectories>$(MONO_DIR);$(MONO_EGLIB_SOURCE_DIR);$(MONO_EGLIB_INCLUDE_DIR);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
<MinimalRebuild>true</MinimalRebuild>\r
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r
<PrecompiledHeader>\r
</Midl>\r
<ClCompile>\r
<Optimization>MinSpace</Optimization>\r
- <AdditionalIncludeDirectories>$(MONO_EGLIB_SOURCE_DIR);$(MONO_EGLIB_INCLUDE_DIR);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+ <AdditionalIncludeDirectories>$(MONO_DIR);$(MONO_EGLIB_SOURCE_DIR);$(MONO_EGLIB_INCLUDE_DIR);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
<PrecompiledHeader>\r
</PrecompiledHeader>\r
<WarningLevel>Level4</WarningLevel>\r
<ClCompile Include="..\mono\mini\type-checking.c" />\r
<ClCompile Include="..\mono\mini\lldb.c" />\r
<ClCompile Include="..\mono\mini\interp\interp-stubs.c" />\r
+ <ClCompile Include="..\mono\mini\mini-profiler.c" />\r
</ItemGroup>\r
<PropertyGroup Label="Globals">\r
<ProjectGuid>{CB0D9E92-293C-439C-9AC7-C5F59B6E0772}</ProjectGuid>\r
<ClCompile Include="..\mono\mini\interp\interp-stubs.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
+ <ClCompile Include="..\mono\mini\mini-profiler.c">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
</ItemGroup>\r
<ItemGroup>\r
<ClInclude Include="..\mono\mini\abcremoval.h">\r
<ClInclude Include="..\mono\metadata\object-internals.h" />\r
<ClInclude Include="..\mono\metadata\object.h" />\r
<ClInclude Include="..\mono\metadata\opcodes.h" />\r
+ <ClInclude Include="..\mono\metadata\profiler-events.h" />\r
<ClInclude Include="..\mono\metadata\profiler-private.h" />\r
<ClInclude Include="..\mono\metadata\profiler.h" />\r
<ClInclude Include="..\mono\metadata\rand.h" />\r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
<ImportGroup Label="ExtensionTargets">\r
</ImportGroup>\r
-</Project>
\ No newline at end of file
+</Project>\r
<ClInclude Include="..\mono\metadata\w32process-win32-internals.h">\r
<Filter>Header Files</Filter>\r
</ClInclude>\r
- <ClInclude Include="..\mono\metadata\profiler.h">\r
+ <ClInclude Include="..\mono\metadata\profiler-events.h">\r
<Filter>Header Files</Filter>\r
</ClInclude>\r
<ClInclude Include="..\mono\metadata\profiler-private.h">\r
<Filter>Header Files</Filter>\r
</ClInclude>\r
+ <ClInclude Include="..\mono\metadata\profiler.h">\r
+ <Filter>Header Files</Filter>\r
+ </ClInclude>\r
<ClInclude Include="..\mono\metadata\rand.h">\r
<Filter>Header Files</Filter>\r
</ClInclude>\r
<Filter>Resource Files</Filter>\r
</None>\r
</ItemGroup>\r
-</Project>
\ No newline at end of file
+</Project>\r
<ClInclude Include="..\mono\utils\strenc.h" />\r
<ClInclude Include="..\mono\utils\valgrind.h" />\r
<ClInclude Include="..\mono\utils\atomic.h" />\r
+ <ClInclude Include="..\mono\utils\unlocked.h" />
<ClInclude Include="..\mono\utils\mono-hwcap.h" />\r
<ClInclude Include="..\mono\utils\mono-hwcap-x86.h" />\r
<ClInclude Include="..\mono\utils\bsearch.h" />\r
<ClInclude Include="..\mono\utils\os-event.h">\r
<Filter>Header Files</Filter>\r
</ClInclude>\r
+ <ClInclude Include="..\mono\utils\unlocked.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>\r
<ItemGroup>\r
<Filter Include="Header Files">\r
<MONO_CFG_DIR>$(MONO_DIR)/runtime/etc</MONO_CFG_DIR>
<MONO_NUNIT_RUN_TARGET>net_4_x_System_test.dll</MONO_NUNIT_RUN_TARGET>
<MONO_NUNIT_FIXTURE></MONO_NUNIT_FIXTURE>
- <MONO_NUNIT_ARGS>-noshadow -exclude=NotWorking,ValueAdd,CAS,InetAccess /labels</MONO_NUNIT_ARGS>
+ <MONO_NUNIT_ARGS>-noshadow -exclude=NotWorking,CAS /labels</MONO_NUNIT_ARGS>
<MONO_NUNIT_ARGS Condition="'$(MONO_NUNIT_FIXTURE)'!=''">$(MONO_NUNIT_ARGS) -fixture $(MONO_NUNIT_FIXTURE)</MONO_NUNIT_ARGS>
<MONO_NUNIT_RUN_ADDITIONAL_ARGS>
</MONO_NUNIT_RUN_ADDITIONAL_ARGS>
</BuildMacro>
</ItemGroup>
<ItemDefinitionGroup />
-</Project>
\ No newline at end of file
+</Project>
; file generated by create-windef.pl
LIBRARY mono-profiler-vtune.dll
EXPORTS
-mono_profiler_startup
\ No newline at end of file
+mono_profiler_init_vtune
EXPORTS
MonoFixupCorEE
mono_add_internal_call
-mono_aot_get_method
mono_aot_register_module
mono_array_addr_with_size
mono_array_class_get
mono_counters_register
mono_counters_register_with_size
mono_counters_sample
+mono_cpu_count
mono_custom_attrs_construct
mono_custom_attrs_free
mono_custom_attrs_from_assembly
mono_get_int32_class
mono_get_int64_class
mono_get_intptr_class
-mono_get_jit_info_from_method
mono_get_machine_config
mono_get_method
mono_get_method_constrained
mono_print_thread_dump
mono_print_thread_dump_from_ctx
mono_print_unhandled_exception
+mono_profiler_call_context_free_buffer
+mono_profiler_call_context_get_argument
+mono_profiler_call_context_get_local
+mono_profiler_call_context_get_result
+mono_profiler_call_context_get_this
+mono_profiler_create
mono_profiler_enable_allocations
+mono_profiler_enable_call_context_introspection
mono_profiler_enable_sampling
mono_profiler_get_coverage_data
mono_profiler_get_sample_mode
mono_profiler_install
+mono_profiler_install_gc
+mono_profiler_install_jit_end
+mono_profiler_install_thread
mono_profiler_load
mono_profiler_set_assembly_loaded_callback
mono_profiler_set_assembly_loading_callback
mono_profiler_set_domain_name_callback
mono_profiler_set_domain_unloaded_callback
mono_profiler_set_domain_unloading_callback
+mono_profiler_set_events
mono_profiler_set_exception_clause_callback
mono_profiler_set_exception_throw_callback
mono_profiler_set_gc_allocation_callback
mono_trace_set_mask_string
mono_trace_set_print_handler
mono_trace_set_printerr_handler
+mono_tracev_inner
mono_type_create_from_typespec
mono_type_full_name
mono_type_generic_inst_is_valuetype
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="UserMacros">
<!-- Change this to custom build tree location to enable out of source tree builds, example c:/mono-build/ -->
<top_srcdir>$(MSBuildProjectDirectory)/$(MonoSourceLocation)</top_srcdir>
<MONO_DIR>$(top_srcdir)</MONO_DIR>
<MONO_INCLUDE_DIR>$(MONO_DIR)/mono</MONO_INCLUDE_DIR>
- <MONO_EGLIB_INCLUDE_DIR>$(MONO_DIR)/eglib;$(MONO_DIR)/eglib/include;$(MONO_DIR)/eglib/test</MONO_EGLIB_INCLUDE_DIR>
- <MONO_EGLIB_SOURCE_DIR>$(MONO_DIR)/eglib/src</MONO_EGLIB_SOURCE_DIR>
+ <MONO_EGLIB_INCLUDE_DIR>$(MONO_DIR)/mono/eglib</MONO_EGLIB_INCLUDE_DIR>
+ <MONO_EGLIB_SOURCE_DIR>$(MONO_DIR)/mono/eglib</MONO_EGLIB_SOURCE_DIR>
<MONO_LIBGC_INCLUDE_DIR>$(MONO_DIR)/libgc/include</MONO_LIBGC_INCLUDE_DIR>
<MONO_LIBGC_SOURCE_DIR>$(MONO_DIR)/libgc/src</MONO_LIBGC_SOURCE_DIR>
<MONO_JIT_INCLUDE_DIR>$(MONO_INCLUDE_DIR)/jit</MONO_JIT_INCLUDE_DIR>
EXPORTS
MonoFixupCorEE
mono_add_internal_call
-mono_aot_get_method
mono_aot_register_module
mono_array_addr_with_size
mono_array_class_get
mono_counters_register
mono_counters_register_with_size
mono_counters_sample
+mono_cpu_count
mono_custom_attrs_construct
mono_custom_attrs_free
mono_custom_attrs_from_assembly
mono_get_int32_class
mono_get_int64_class
mono_get_intptr_class
-mono_get_jit_info_from_method
mono_get_machine_config
mono_get_method
mono_get_method_constrained
mono_print_thread_dump
mono_print_thread_dump_from_ctx
mono_print_unhandled_exception
+mono_profiler_call_context_free_buffer
+mono_profiler_call_context_get_argument
+mono_profiler_call_context_get_local
+mono_profiler_call_context_get_result
+mono_profiler_call_context_get_this
+mono_profiler_create
mono_profiler_enable_allocations
+mono_profiler_enable_call_context_introspection
mono_profiler_enable_sampling
mono_profiler_get_coverage_data
mono_profiler_get_sample_mode
mono_profiler_install
+mono_profiler_install_gc
+mono_profiler_install_jit_end
+mono_profiler_install_thread
mono_profiler_load
mono_profiler_set_assembly_loaded_callback
mono_profiler_set_assembly_loading_callback
mono_profiler_set_domain_name_callback
mono_profiler_set_domain_unloaded_callback
mono_profiler_set_domain_unloading_callback
+mono_profiler_set_events
mono_profiler_set_exception_clause_callback
mono_profiler_set_exception_throw_callback
mono_profiler_set_gc_allocation_callback
mono_trace_set_mask_string
mono_trace_set_print_handler
mono_trace_set_printerr_handler
+mono_tracev_inner
mono_type_create_from_typespec
mono_type_full_name
mono_type_generic_inst_is_valuetype
</ProjectReference>\r
</ItemDefinitionGroup>\r
<ItemGroup>\r
- <ClCompile Include="..\mono\profiler\mono-profiler-vtune.c" />\r
+ <ClCompile Include="..\mono\profiler\vtune.c" />\r
</ItemGroup>\r
<ItemGroup>\r
<None Include="mono-profiler-vtune.def" />\r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
<ImportGroup Label="ExtensionTargets">\r
</ImportGroup>\r
-</Project>
\ No newline at end of file
+</Project>\r
</Filter>\r
</ItemGroup>\r
<ItemGroup>\r
- <ClCompile Include="..\mono\profiler\mono-profiler-vtune.c">\r
+ <ClCompile Include="..\mono\profiler\vtune.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
</ItemGroup>\r
<Filter>Resource Files</Filter>\r
</None>\r
</ItemGroup>\r
-</Project>
\ No newline at end of file
+</Project>\r
<AssemblyName>@ASSEMBLYNAME@</AssemblyName>\r
<TargetFrameworkVersion>v@FX_VERSION</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
+@SIGNATURE@\r
</PropertyGroup>\r
- @SIGNATURE@\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
string strongNameSection = "";
if (StrongNameKeyFile != null){
strongNameSection = String.Format (
- " <PropertyGroup>" + NewLine +
" <SignAssembly>true</SignAssembly>" + NewLine +
"{1}" +
- " </PropertyGroup>" + NewLine +
- " <PropertyGroup>" + NewLine +
- " <AssemblyOriginatorKeyFile>{0}</AssemblyOriginatorKeyFile>" + NewLine +
- " </PropertyGroup>", StrongNameKeyFile, StrongNameDelaySign ? " <DelaySign>true</DelaySign>" + NewLine : "");
+ " <AssemblyOriginatorKeyFile>{0}</AssemblyOriginatorKeyFile>",
+ StrongNameKeyFile, StrongNameDelaySign ? " <DelaySign>true</DelaySign>" + NewLine : "");
}
Csproj.output = template.
Replace ("@OUTPUTTYPE@", Target == Target.Library ? "Library" : "Exe").
-<?xml version="1.0" encoding="utf-8"?>\r
+<?xml version="1.0" encoding="utf-8"?>\r
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<ItemGroup Label="ProjectConfigurations">\r
<ProjectConfiguration Include="Debug|Win32">\r
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
<ClCompile>\r
<Optimization>Disabled</Optimization>\r
- <AdditionalIncludeDirectories>$(MONO_EGLIB_INCLUDE_DIR);$(MONO_EGLIB_SOURCE_DIR)%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+ <AdditionalIncludeDirectories>$(MONO_DIR);$(MONO_EGLIB_INCLUDE_DIR);$(MONO_EGLIB_SOURCE_DIR)%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBTEST_EGLIB_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
<MinimalRebuild>true</MinimalRebuild>\r
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
<ClCompile>\r
<Optimization>MinSpace</Optimization>\r
- <AdditionalIncludeDirectories>$(MONO_EGLIB_INCLUDE_DIR);$(MONO_EGLIB_SOURCE_DIR)%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+ <AdditionalIncludeDirectories>$(MONO_DIR);$(MONO_EGLIB_INCLUDE_DIR);$(MONO_EGLIB_SOURCE_DIR)%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBTEST_EGLIB_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
<PrecompiledHeader>\r
</PrecompiledHeader>\r
</Midl>\r
<ClCompile>\r
<Optimization>Disabled</Optimization>\r
- <AdditionalIncludeDirectories>$(MONO_EGLIB_INCLUDE_DIR);$(MONO_EGLIB_SOURCE_DIR)%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+ <AdditionalIncludeDirectories>$(MONO_DIR);$(MONO_EGLIB_INCLUDE_DIR);$(MONO_EGLIB_SOURCE_DIR)%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBTEST_EGLIB_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
<MinimalRebuild>true</MinimalRebuild>\r
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r
</Midl>\r
<ClCompile>\r
<Optimization>MinSpace</Optimization>\r
- <AdditionalIncludeDirectories>$(MONO_EGLIB_INCLUDE_DIR);$(MONO_EGLIB_SOURCE_DIR)%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+ <AdditionalIncludeDirectories>$(MONO_DIR);$(MONO_EGLIB_INCLUDE_DIR);$(MONO_EGLIB_SOURCE_DIR)%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBTEST_EGLIB_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
<PrecompiledHeader>\r
</PrecompiledHeader>\r
</Link>\r
</ItemDefinitionGroup>\r
<ItemGroup>\r
- <ClCompile Include="..\eglib\test\array.c" />\r
- <ClCompile Include="..\eglib\test\dir.c" />\r
- <ClCompile Include="..\eglib\test\driver.c" />\r
- <ClCompile Include="..\eglib\test\endian.c" />\r
- <ClCompile Include="..\eglib\test\fake.c" />\r
- <ClCompile Include="..\eglib\test\file.c" />\r
+ <ClCompile Include="..\mono\eglib\test\array.c" />\r
+ <ClCompile Include="..\mono\eglib\test\dir.c" />\r
+ <ClCompile Include="..\mono\eglib\test\driver.c" />\r
+ <ClCompile Include="..\mono\eglib\test\endian.c" />\r
+ <ClCompile Include="..\mono\eglib\test\fake.c" />\r
+ <ClCompile Include="..\mono\eglib\test\file.c" />\r
<ClCompile Include="getopt.c" />\r
<ClCompile Include="getopt_long.c" />\r
- <ClCompile Include="..\eglib\test\hashtable.c" />\r
- <ClCompile Include="..\eglib\test\list.c" />\r
- <ClCompile Include="..\eglib\test\markup.c" />\r
- <ClCompile Include="..\eglib\test\memory.c" />\r
- <ClCompile Include="..\eglib\test\module.c" />\r
- <ClCompile Include="..\eglib\test\path.c" />\r
- <ClCompile Include="..\eglib\test\pattern.c" />\r
- <ClCompile Include="..\eglib\test\ptrarray.c" />\r
- <ClCompile Include="..\eglib\test\queue.c" />\r
- <ClCompile Include="..\eglib\test\shell.c" />\r
- <ClCompile Include="..\eglib\test\sizes.c" />\r
- <ClCompile Include="..\eglib\test\slist.c" />\r
- <ClCompile Include="..\eglib\test\spawn.c" />\r
- <ClCompile Include="..\eglib\test\string-util.c" />\r
- <ClCompile Include="..\eglib\test\string.c" />\r
- <ClCompile Include="..\eglib\test\test.c" />\r
- <ClCompile Include="..\eglib\test\timer.c" />\r
- <ClCompile Include="..\eglib\test\unicode.c" />\r
- <ClCompile Include="..\eglib\test\utf8.c" />\r
+ <ClCompile Include="..\mono\eglib\test\hashtable.c" />\r
+ <ClCompile Include="..\mono\eglib\test\list.c" />\r
+ <ClCompile Include="..\mono\eglib\test\markup.c" />\r
+ <ClCompile Include="..\mono\eglib\test\memory.c" />\r
+ <ClCompile Include="..\mono\eglib\test\module.c" />\r
+ <ClCompile Include="..\mono\eglib\test\path.c" />\r
+ <ClCompile Include="..\mono\eglib\test\pattern.c" />\r
+ <ClCompile Include="..\mono\eglib\test\ptrarray.c" />\r
+ <ClCompile Include="..\mono\eglib\test\queue.c" />\r
+ <ClCompile Include="..\mono\eglib\test\shell.c" />\r
+ <ClCompile Include="..\mono\eglib\test\sizes.c" />\r
+ <ClCompile Include="..\mono\eglib\test\slist.c" />\r
+ <ClCompile Include="..\mono\eglib\test\spawn.c" />\r
+ <ClCompile Include="..\mono\eglib\test\string-util.c" />\r
+ <ClCompile Include="..\mono\eglib\test\string.c" />\r
+ <ClCompile Include="..\mono\eglib\test\test.c" />\r
+ <ClCompile Include="..\mono\eglib\test\timer.c" />\r
+ <ClCompile Include="..\mono\eglib\test\unicode.c" />\r
+ <ClCompile Include="..\mono\eglib\test\utf8.c" />\r
</ItemGroup>\r
<ItemGroup>\r
<ClInclude Include="getopt.h" />\r
<ClInclude Include="getopt_long.h" />\r
- <ClInclude Include="..\eglib\src\glib.h" />\r
- <ClInclude Include="..\eglib\test\test.h" />\r
- <ClInclude Include="..\eglib\test\tests.h" />\r
+ <ClInclude Include="..\mono\eglib\src\glib.h" />\r
+ <ClInclude Include="..\mono\eglib\test\test.h" />\r
+ <ClInclude Include="..\mono\eglib\test\tests.h" />\r
</ItemGroup>\r
<ItemGroup>\r
<ProjectReference Include="eglib.vcxproj">\r
-<?xml version="1.0" encoding="utf-8"?>\r
+<?xml version="1.0" encoding="utf-8"?>\r
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<ItemGroup>\r
- <ClCompile Include="..\eglib\test\array.c">\r
+ <ClCompile Include="..\mono\eglib\test\array.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
- <ClCompile Include="..\eglib\test\dir.c">\r
+ <ClCompile Include="..\mono\eglib\test\dir.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
- <ClCompile Include="..\eglib\test\driver.c">\r
+ <ClCompile Include="..\mono\eglib\test\driver.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
- <ClCompile Include="..\eglib\test\endian.c">\r
+ <ClCompile Include="..\mono\eglib\test\endian.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
- <ClCompile Include="..\eglib\test\fake.c">\r
+ <ClCompile Include="..\mono\eglib\test\fake.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
- <ClCompile Include="..\eglib\test\file.c">\r
+ <ClCompile Include="..\mono\eglib\test\file.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
<ClCompile Include="getopt.c">\r
<ClCompile Include="getopt_long.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
- <ClCompile Include="..\eglib\test\hashtable.c">\r
+ <ClCompile Include="..\mono\eglib\test\hashtable.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
- <ClCompile Include="..\eglib\test\list.c">\r
+ <ClCompile Include="..\mono\eglib\test\list.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
- <ClCompile Include="..\eglib\test\markup.c">\r
+ <ClCompile Include="..\mono\eglib\test\markup.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
- <ClCompile Include="..\eglib\test\memory.c">\r
+ <ClCompile Include="..\mono\eglib\test\memory.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
- <ClCompile Include="..\eglib\test\module.c">\r
+ <ClCompile Include="..\mono\eglib\test\module.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
- <ClCompile Include="..\eglib\test\path.c">\r
+ <ClCompile Include="..\mono\eglib\test\path.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
- <ClCompile Include="..\eglib\test\pattern.c">\r
+ <ClCompile Include="..\mono\eglib\test\pattern.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
- <ClCompile Include="..\eglib\test\ptrarray.c">\r
+ <ClCompile Include="..\mono\eglib\test\ptrarray.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
- <ClCompile Include="..\eglib\test\queue.c">\r
+ <ClCompile Include="..\mono\eglib\test\queue.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
- <ClCompile Include="..\eglib\test\shell.c">\r
+ <ClCompile Include="..\mono\eglib\test\shell.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
- <ClCompile Include="..\eglib\test\sizes.c">\r
+ <ClCompile Include="..\mono\eglib\test\sizes.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
- <ClCompile Include="..\eglib\test\slist.c">\r
+ <ClCompile Include="..\mono\eglib\test\slist.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
- <ClCompile Include="..\eglib\test\spawn.c">\r
+ <ClCompile Include="..\mono\eglib\test\spawn.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
- <ClCompile Include="..\eglib\test\string.c">\r
+ <ClCompile Include="..\mono\eglib\test\string.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
- <ClCompile Include="..\eglib\test\string-util.c">\r
+ <ClCompile Include="..\mono\eglib\test\string-util.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
- <ClCompile Include="..\eglib\test\test.c">\r
+ <ClCompile Include="..\mono\eglib\test\test.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
- <ClCompile Include="..\eglib\test\utf8.c">\r
+ <ClCompile Include="..\mono\eglib\test\utf8.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
- <ClCompile Include="..\eglib\test\timer.c">\r
+ <ClCompile Include="..\mono\eglib\test\timer.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
- <ClCompile Include="..\eglib\test\unicode.c">\r
+ <ClCompile Include="..\mono\eglib\test\unicode.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
</ItemGroup>\r
<ClInclude Include="getopt_long.h">\r
<Filter>Header Files</Filter>\r
</ClInclude>\r
- <ClInclude Include="..\eglib\src\glib.h">\r
+ <ClInclude Include="..\mono\eglib\src\glib.h">\r
<Filter>Header Files</Filter>\r
</ClInclude>\r
- <ClInclude Include="..\eglib\test\test.h">\r
+ <ClInclude Include="..\mono\eglib\test\test.h">\r
<Filter>Header Files</Filter>\r
</ClInclude>\r
- <ClInclude Include="..\eglib\test\tests.h">\r
+ <ClInclude Include="..\mono\eglib\test\tests.h">\r
<Filter>Header Files</Filter>\r
</ClInclude>\r
</ItemGroup>\r
@ECHO off
SET CONFIG_H=..\config.h
-SET EGLIB_CONFIG_H=..\eglib\config.h
SET CYG_CONFIG_H=..\cygconfig.h
-SET EGLIB_CYG_CONFIG_H=..\eglib\cygconfig.h
SET WIN_CONFIG_H=..\winconfig.h
-SET EGLIB_WIN_CONFIG_H=..\eglib\winconfig.h
SET CONFIGURE_AC=..\configure.ac
SET VERSION_H=..\mono\mini\version.h
REM Backup existing config.h into cygconfig.h if its not already replaced.
%windir%\system32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -NonInteractive -File backup-config-files.ps1 %CONFIG_H% %CYG_CONFIG_H% 2>&1
-%windir%\system32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -NonInteractive -File backup-config-files.ps1 %EGLIB_CONFIG_H% %EGLIB_CYG_CONFIG_H% 2>&1
%windir%\system32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -NonInteractive -File compare-config-files.ps1 %WIN_CONFIG_H% %CONFIG_H% %CONFIGURE_AC% 2>&1
%windir%\system32\WindowsPowerShell\v1.0\powershell.exe -NonInteractive -Command "$mono_version=[int[]](Select-String -path %CONFIGURE_AC% -pattern 'AC_INIT\(mono, \[(.*)\]').Matches[0].Groups[1].Value.Split('.'); $corlib_counter=[int](Select-String -path %CONFIGURE_AC% -pattern 'MONO_CORLIB_COUNTER=(.*)').Matches[0].Groups[1].Value; (Get-Content %CONFIG_H%) -replace '#MONO_CORLIB_VERSION#',('1{0:00}{1:00}{2:00}{3:000}' -f $mono_version[0],$mono_version[1],$mono_version[2],$corlib_counter) | Set-Content %CONFIG_H%" 2>&1
)
-%windir%\system32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -NonInteractive -File compare-config-files.ps1 %EGLIB_WIN_CONFIG_H% %EGLIB_CONFIG_H% 2>&1
-
-IF NOT %ERRORLEVEL% == 0 (
- ECHO copy %EGLIB_WIN_CONFIG_H% %EGLIB_CONFIG_H%
- copy %EGLIB_WIN_CONFIG_H% %EGLIB_CONFIG_H%
-)
-
SET VERSION_CONTENT="#define FULL_VERSION \"Visual Studio built mono\""
%windir%\system32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -NonInteractive -File compare-config-content.ps1 %VERSION_CONTENT% %VERSION_H% 2>&1
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ilasm-net_4_x", "mcs/ilasm/ilasm-net_4_x.csproj", "{D32B01EF-8E8D-41C1-848D-6DAEAA3FCA6C}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "resgen-net_4_x", "mcs/tools/resgen/resgen-net_4_x.csproj", "{647DC12E-A4EE-424A-9EC7-CE6643EE2EF7}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "gacutil-net_4_x", "mcs/tools/gacutil/gacutil-net_4_x.csproj", "{6B9993FC-E28D-4D55-8F96-C8A35B2BC6E7}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "culevel-net_4_x", "mcs/tools/culevel/culevel-net_4_x.csproj", "{ED867AC1-079C-4B5E-ADF9-E7722053B360}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cil-stringreplacer-net_4_x", "mcs/tools/cil-stringreplacer/cil-stringreplacer-net_4_x.csproj", "{FD725431-CB26-466D-BD55-C739485A50C9}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "commoncryptogenerator-net_4_x", "mcs/tools/commoncryptogenerator/commoncryptogenerator-net_4_x.csproj", "{12527E95-60D3-4A66-91C6-7F8031519299}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "resx2sr-net_4_x", "mcs/tools/resx2sr/resx2sr-net_4_x.csproj", "{07D30676-A919-4763-8C3C-B2C4DAFFC662}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "al-net_4_x", "mcs/tools/al/al-net_4_x.csproj", "{D237CE6E-EA8F-4E8E-8413-295B27714AC6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "monolinker-net_4_x", "mcs/tools/linker/monolinker-net_4_x.csproj", "{FA920637-C202-4E75-AC0F-1A8DBD631DF1}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "al-net_4_x", "mcs/tools/al/al-net_4_x.csproj", "{D237CE6E-EA8F-4E8E-8413-295B27714AC6}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "culevel-net_4_x", "mcs/tools/culevel/culevel-net_4_x.csproj", "{ED867AC1-079C-4B5E-ADF9-E7722053B360}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "genxs-net_4_x", "mcs/tools/genxs/genxs-net_4_x.csproj", "{DCD2613C-B1A0-489B-BCA1-79BEBB9B9541}"
EndProject
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "xsd-net_4_x", "mcs/tools/mono-xsd/xsd-net_4_x.csproj", "{3CB8E3C0-0EFA-4AB3-9F60-02DC274F77F8}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "resgen-net_4_x", "mcs/tools/resgen/resgen-net_4_x.csproj", "{647DC12E-A4EE-424A-9EC7-CE6643EE2EF7}"
+EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wsdl-net_4_x", "mcs/tools/wsdl/wsdl-net_4_x.csproj", "{69D00FEC-59AA-43A0-90AD-87F400B8613C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp-net_4_x", "mcs/tools/csharp/csharp-net_4_x.csproj", "{3E3DE804-DF6C-43D0-9DFC-13C7FFD949CA}"
{D32B01EF-8E8D-41C1-848D-6DAEAA3FCA6C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D32B01EF-8E8D-41C1-848D-6DAEAA3FCA6C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D32B01EF-8E8D-41C1-848D-6DAEAA3FCA6C}.Release|Any CPU.Build.0 = Release|Any CPU
- {647DC12E-A4EE-424A-9EC7-CE6643EE2EF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {647DC12E-A4EE-424A-9EC7-CE6643EE2EF7}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {647DC12E-A4EE-424A-9EC7-CE6643EE2EF7}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {647DC12E-A4EE-424A-9EC7-CE6643EE2EF7}.Release|Any CPU.Build.0 = Release|Any CPU
{6B9993FC-E28D-4D55-8F96-C8A35B2BC6E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6B9993FC-E28D-4D55-8F96-C8A35B2BC6E7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6B9993FC-E28D-4D55-8F96-C8A35B2BC6E7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6B9993FC-E28D-4D55-8F96-C8A35B2BC6E7}.Release|Any CPU.Build.0 = Release|Any CPU
- {ED867AC1-079C-4B5E-ADF9-E7722053B360}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {ED867AC1-079C-4B5E-ADF9-E7722053B360}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {ED867AC1-079C-4B5E-ADF9-E7722053B360}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {ED867AC1-079C-4B5E-ADF9-E7722053B360}.Release|Any CPU.Build.0 = Release|Any CPU
- {FD725431-CB26-466D-BD55-C739485A50C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {FD725431-CB26-466D-BD55-C739485A50C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {FD725431-CB26-466D-BD55-C739485A50C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {FD725431-CB26-466D-BD55-C739485A50C9}.Release|Any CPU.Build.0 = Release|Any CPU
- {12527E95-60D3-4A66-91C6-7F8031519299}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {12527E95-60D3-4A66-91C6-7F8031519299}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {12527E95-60D3-4A66-91C6-7F8031519299}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {12527E95-60D3-4A66-91C6-7F8031519299}.Release|Any CPU.Build.0 = Release|Any CPU
- {07D30676-A919-4763-8C3C-B2C4DAFFC662}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {07D30676-A919-4763-8C3C-B2C4DAFFC662}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {07D30676-A919-4763-8C3C-B2C4DAFFC662}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {07D30676-A919-4763-8C3C-B2C4DAFFC662}.Release|Any CPU.Build.0 = Release|Any CPU
- {FA920637-C202-4E75-AC0F-1A8DBD631DF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {FA920637-C202-4E75-AC0F-1A8DBD631DF1}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {FA920637-C202-4E75-AC0F-1A8DBD631DF1}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {FA920637-C202-4E75-AC0F-1A8DBD631DF1}.Release|Any CPU.Build.0 = Release|Any CPU
{D237CE6E-EA8F-4E8E-8413-295B27714AC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D237CE6E-EA8F-4E8E-8413-295B27714AC6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D237CE6E-EA8F-4E8E-8413-295B27714AC6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D237CE6E-EA8F-4E8E-8413-295B27714AC6}.Release|Any CPU.Build.0 = Release|Any CPU
+ {FA920637-C202-4E75-AC0F-1A8DBD631DF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FA920637-C202-4E75-AC0F-1A8DBD631DF1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FA920637-C202-4E75-AC0F-1A8DBD631DF1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FA920637-C202-4E75-AC0F-1A8DBD631DF1}.Release|Any CPU.Build.0 = Release|Any CPU
+ {ED867AC1-079C-4B5E-ADF9-E7722053B360}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {ED867AC1-079C-4B5E-ADF9-E7722053B360}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {ED867AC1-079C-4B5E-ADF9-E7722053B360}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {ED867AC1-079C-4B5E-ADF9-E7722053B360}.Release|Any CPU.Build.0 = Release|Any CPU
{DCD2613C-B1A0-489B-BCA1-79BEBB9B9541}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DCD2613C-B1A0-489B-BCA1-79BEBB9B9541}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DCD2613C-B1A0-489B-BCA1-79BEBB9B9541}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3CB8E3C0-0EFA-4AB3-9F60-02DC274F77F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3CB8E3C0-0EFA-4AB3-9F60-02DC274F77F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3CB8E3C0-0EFA-4AB3-9F60-02DC274F77F8}.Release|Any CPU.Build.0 = Release|Any CPU
+ {647DC12E-A4EE-424A-9EC7-CE6643EE2EF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {647DC12E-A4EE-424A-9EC7-CE6643EE2EF7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {647DC12E-A4EE-424A-9EC7-CE6643EE2EF7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {647DC12E-A4EE-424A-9EC7-CE6643EE2EF7}.Release|Any CPU.Build.0 = Release|Any CPU
{69D00FEC-59AA-43A0-90AD-87F400B8613C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{69D00FEC-59AA-43A0-90AD-87F400B8613C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{69D00FEC-59AA-43A0-90AD-87F400B8613C}.Release|Any CPU.ActiveCfg = Release|Any CPU
class FsharpPackage(GitHubTarballPackage):
-
def __init__(self):
- GitHubTarballPackage.__init__(
- self,
- 'fsharp',
- 'fsharp',
- '4.1.8',
- '991186f6c95b30a80f217b9319354b32c86212de',
+ GitHubTarballPackage.__init__(self,
+ 'fsharp', 'fsharp',
+ '4.1.25',
+ '9687f27c3e6be7b9e1646bb9ee1ae0b02080daae',
configure='./configure --prefix="%{package_prefix}"',
- override_properties={
- 'make': 'make'})
+ override_properties={ 'make': 'make' })
- self.extra_stage_files = [
- 'lib/mono/xbuild/Microsoft/VisualStudio/v/FSharp/Microsoft.FSharp.Targets']
- self.sources.extend(
- [
- 'patches/fsharp-enable-jit-tracking-for-portable-pdb.patch',
- 'patches/fsharp-fix-mdb-support.patch',
- 'patches/fsharp-Fix-mono-gac-location.patch',
- 'patches/fsharp-fix-xbuild-check.patch'])
+ self.extra_stage_files = ['lib/mono/xbuild/Microsoft/VisualStudio/v/FSharp/Microsoft.FSharp.Targets']
+ self.sources.extend(['patches/fsharp-fix-mdb-support.patch'])
def prep(self):
Package.prep(self)
self.cpp_flags = []
def arch_build(self, arch):
+ Package.profile.arch_build(arch, self)
if arch == 'darwin-64': # 64-bit build pass
- self.local_configure_flags = ['--build=x86_64-apple-darwin11.2.0']
+ self.local_configure_flags.extend(['--build=x86_64-apple-darwin11.2.0'])
if arch == 'darwin-32':
- self.local_configure_flags = ['--build=i386-apple-darwin11.2.0']
+ self.local_configure_flags.extend(['--build=i386-apple-darwin11.2.0'])
# LLVM says that libstdc++4.6 is broken and we should use libstdc++4.7.
# This switches it to the right libstdc++.
self.sh('patch -p1 < "%{local_sources[' + str(p) + ']}"')
def arch_build(self, arch):
+ Package.profile.arch_build(arch, self)
if arch == 'darwin-64': # 64-bit build pass
- self.local_gcc_flags = ['-m64']
- self.local_configure_flags = ['--build=x86_64-apple-darwin11.2.0', '--disable-boehm']
+ self.local_configure_flags.extend (['--build=x86_64-apple-darwin11.2.0', '--disable-boehm'])
if arch == 'darwin-32': # 32-bit build pass
- self.local_gcc_flags = ['-m32']
- self.local_configure_flags = ['--build=i386-apple-darwin11.2.0']
+ self.local_configure_flags.extend (['--build=i386-apple-darwin11.2.0'])
self.local_configure_flags.extend(
['--cache-file=%s/%s-%s.cache' % (self.profile.bockbuild.build_root, self.name, arch)])
class MSBuild (GitHubPackage):
def __init__ (self):
- GitHubPackage.__init__ (self, 'mono', 'msbuild', '15.3',
- revision = 'f7dcc3900c808775adad970f047202b4de34e986')
+ GitHubPackage.__init__ (self, 'mono', 'msbuild', '15.4',
+ revision = '0f250921e0b91ca1bda6494df49ae8ad703aeb5c')
def build (self):
self.sh ('./cibuild.sh --scope Compile --target Mono --host Mono --config Release')
+++ /dev/null
-From 208aa8170bede4c176b5e3afa6811d1d7a5a330c Mon Sep 17 00:00:00 2001
-From: nosami <jasonimison@gmail.com>
-Date: Tue, 11 Apr 2017 12:10:04 +0100
-Subject: [PATCH] Fix mono/gac location
-
----
- src/fsharp/targets.make | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/src/fsharp/targets.make b/src/fsharp/targets.make
-index 014294a..716adb7 100644
---- a/src/fsharp/targets.make
-+++ b/src/fsharp/targets.make
-@@ -157,9 +157,9 @@ install-gac-lib:
- echo "Using gacutil to install $(outdir)$(ASSEMBLY) into GAC root $(DESTDIR)$(libdir) as package $(TARGET)"; \
- $(monobindir)/gacutil -i $(outdir)$(ASSEMBLY) -root $(DESTDIR)$(libdir) -package $(TARGET); \
- else \
-- echo "Installing $(outdir)$(NAME).dll to $(DESTDIR)$(gacdir)/gac/$(NAME)/$(VERSION)__$(TOKEN)/"; \
-- mkdir -p $(DESTDIR)$(gacdir)/gac/$(NAME)/$(VERSION)__$(TOKEN)/; \
-- $(INSTALL_LIB) $(outdir)$(NAME).dll $(DESTDIR)$(gacdir)/gac/$(NAME)/$(VERSION)__$(TOKEN)/; \
-+ echo "Installing $(outdir)$(NAME).dll to $(DESTDIR)$(monodir)/gac/$(NAME)/$(VERSION)__$(TOKEN)/"; \
-+ mkdir -p $(DESTDIR)$(monodir)/gac/$(NAME)/$(VERSION)__$(TOKEN)/; \
-+ $(INSTALL_LIB) $(outdir)$(NAME).dll $(DESTDIR)$(monodir)/gac/$(NAME)/$(VERSION)__$(TOKEN)/; \
- fi; \
- fi
-
---
-2.8.0
-
+++ /dev/null
-From f28dbdfaa4427c1e62c16bc6d59106f9f5db15f7 Mon Sep 17 00:00:00 2001
-From: nosami <jasonimison@gmail.com>
-Date: Fri, 21 Apr 2017 16:34:27 +0100
-Subject: [PATCH] Enable JIT tracking for portable PDB debugging
-
-Setting JIT tracking to true adds the `DebuggableAttribute.DebuggingModes.Default`
-flag to the generated Debuggable attribute
-See https://msdn.microsoft.com/en-us/library/system.diagnostics.debuggableattribute.debuggingmodes(v=vs.110).aspx
-
-Without this flag I see the following message when debugging unless I have "Debug project code only: do not step into framework code" unchecked to allow stepping into framework code.
-```
-Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
-```
-Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=55092
----
- src/fsharp/CompileOptions.fs | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/src/fsharp/CompileOptions.fs b/src/fsharp/CompileOptions.fs
-index 209cdd90..97860085 100755
---- a/src/fsharp/CompileOptions.fs
-+++ b/src/fsharp/CompileOptions.fs
-@@ -466,9 +466,9 @@ let SetDebugSwitch (tcConfigB : TcConfigBuilder) (dtype : string option) (s : Op
- match dtype with
- | Some(s) ->
- match s with
-- | "portable" -> tcConfigB.portablePDB <- true; tcConfigB.embeddedPDB <- false; tcConfigB.jitTracking <- false; tcConfigB.ignoreSymbolStoreSequencePoints <- true
-+ | "portable" -> tcConfigB.portablePDB <- true; tcConfigB.embeddedPDB <- false; tcConfigB.jitTracking <- true; tcConfigB.ignoreSymbolStoreSequencePoints <- true
- | "pdbonly" -> tcConfigB.portablePDB <- false; tcConfigB.embeddedPDB <- false; tcConfigB.jitTracking <- false
-- | "embedded" -> tcConfigB.portablePDB <- true; tcConfigB.embeddedPDB <- true; tcConfigB.jitTracking <- false; tcConfigB.ignoreSymbolStoreSequencePoints <- true
-+ | "embedded" -> tcConfigB.portablePDB <- true; tcConfigB.embeddedPDB <- true; tcConfigB.jitTracking <- true; tcConfigB.ignoreSymbolStoreSequencePoints <- true
- | "full" -> tcConfigB.portablePDB <- false; tcConfigB.embeddedPDB <- false; tcConfigB.jitTracking <- true
- | _ -> error(Error(FSComp.SR.optsUnrecognizedDebugType(s), rangeCmdArgs))
- | None -> tcConfigB.portablePDB <- false; tcConfigB.embeddedPDB <- false; tcConfigB.jitTracking <- s = OptionSwitch.On;
---
-2.11.0 (Apple Git-81)
-
+++ /dev/null
-commit 8f93ad340dc81a23155e68c79a5c3eab53b6eeb5
-Author: Ankit Jain <ankit.jain@xamarin.com>
-Date: Sat Apr 15 04:17:18 2017 -0400
-
- [msbuild] Fix test for is-running-on-xbuild
-
-diff --git a/src/fsharp/FSharp.Build/Microsoft.FSharp.targets b/src/fsharp/FSharp.Build/Microsoft.FSharp.targets
-index ec28077d..10840ada 100644
---- a/src/fsharp/FSharp.Build/Microsoft.FSharp.targets
-+++ b/src/fsharp/FSharp.Build/Microsoft.FSharp.targets
-@@ -66,7 +66,7 @@ this file.
-
- <PropertyGroup>
- <UsingXBuild>false</UsingXBuild>
-- <UsingXBuild Condition="$(MSBuildExtensionsPath32.Contains('xbuild'))">true</UsingXBuild>
-+ <UsingXBuild Condition="'$(MSBuildAssemblyVersion)' == ''">true</UsingXBuild>
- </PropertyGroup>
-
- <Target
Package('sqlite-autoconf', '3090200', sources=[
- 'http://www.sqlite.org/2015/%{name}-%{version}.tar.gz'
+ 'https://www.sqlite.org/2015/%{name}-%{version}.tar.gz'
])
build_profiles += orbis
endif
+if INSTALL_UNREAL
+build_profiles += unreal
+endif
+
test_profiles = $(build_profiles)
if BUILD_MCS
/*
* Bare bones profiler. Compile with:
- *
- * linux : gcc -shared -o mono-profiler-sample.so sample.c `pkg-config --cflags --libs mono`
- * mac : gcc sample.c -o mono-profiler-sample.dylib -Dmono_free=free -lz `pkg-config --cflags mono-2` -undefined suppress -flat_namespace
*
- * Install the binary where the dynamic loader can find it. eg /usr/lib etc
+ * linux : gcc -fPIC -shared -o libmono-profiler-sample.so sample.c `pkg-config --cflags --libs mono-2`
+ * mac : gcc -o mono-profiler-sample.dylib sample.c -lz `pkg-config --cflags mono-2` -undefined suppress -flat_namespace
+ * linux with a custom prefix (e.g. --prefix=/opt/my-mono-build):
+ * gcc -fPIC -shared -o libmono-profiler-sample.so sample.c `PKG_CONFIG_PATH=/opt/my-mono-build/lib/pkgconfig/ pkg-config --cflags --libs mono-2`
+ *
+ * Install the binary where the dynamic loader can find it. eg /usr/lib etc.
+ * For a custom prefix build, <prefix>/lib would also work.
* Then run mono with:
* mono --profile=sample your_application.exe
*
*/
struct _MonoProfiler {
- int ncalls;
+ unsigned long long ncalls;
};
+static MonoProfiler prof_instance;
+
/* called at the end of the program */
static void
sample_shutdown (MonoProfiler *prof)
{
- g_print ("total number of calls: %d\n", prof->ncalls);
+ printf("total number of calls: %llu\n", prof->ncalls);
}
static void
-sample_method_enter (MonoProfiler *prof, MonoMethod *method)
+sample_method_enter (MonoProfiler *prof, MonoMethod *method, MonoProfilerCallContext *ctx)
{
prof->ncalls++;
}
-static void
-sample_method_leave (MonoProfiler *prof, MonoMethod *method)
-{
-}
-
static MonoProfilerCallInstrumentationFlags
sample_instrumentation_filter (MonoProfiler *prof, MonoMethod *method)
{
- return MONO_PROFILER_CALL_INSTRUMENTATION_PROLOGUE | MONO_PROFILER_CALL_INSTRUMENTATION_EPILOGUE;
+ return MONO_PROFILER_CALL_INSTRUMENTATION_ENTER;
}
/* the entry point */
void
-mono_profiler_init (const char *desc)
+mono_profiler_init_sample (const char *desc)
{
- MonoProfiler *prof;
-
- prof = g_new0 (MonoProfiler, 1);
+ MonoProfiler *prof = &prof_instance;
- MonoProfilerHandle handle = mono_profiler_install (prof);
- mono_profiler_set_runtime_shutdown_callback (handle, sample_shutdown);
+ MonoProfilerHandle handle = mono_profiler_create (prof);
+ mono_profiler_set_runtime_shutdown_end_callback (handle, sample_shutdown);
mono_profiler_set_call_instrumentation_filter_callback (handle, sample_instrumentation_filter);
mono_profiler_set_method_enter_callback (handle, sample_method_enter);
- mono_profiler_set_method_leave_callback (handle, sample_method_leave);
}
}
void
-mono_profiler_init (const char *desc)
+mono_profiler_init_size (const char *desc)
{
- MonoProfilerHandle handle = mono_profiler_install (NULL);
+ MonoProfilerHandle handle = mono_profiler_create (NULL);
mono_profiler_set_jit_done_callback (handle, install_icall);
}
--- /dev/null
+# ------------------------------------------------------------ #
+# mono/eglib
+# ------------------------------------------------------------ #
+
+fun:monoeg_g_hash_table_iter_next
+
+# ------------------------------------------------------------ #
+# mono/metadata
+# ------------------------------------------------------------ #
+
+# class.c #
+
+fun:inflate_generic_type
+fun:init_sizes_with_info
+fun:make_generic_param_class
+fun:mono_class_create_from_typedef
+fun:mono_class_from_generic_parameter_internal
+fun:mono_class_get_field_count
+fun:mono_class_get_method_from_name_flags
+fun:mono_class_get_methods
+fun:mono_class_has_failure
+fun:mono_class_has_finalizer
+fun:mono_class_inflate_generic_method_full_checked
+fun:mono_class_inflate_generic_type_no_copy
+fun:mono_class_inflate_generic_type_with_mempool
+fun:mono_class_init
+fun:mono_class_layout_fields
+fun:mono_class_setup_basic_field_info
+fun:mono_class_setup_fields
+fun:mono_class_setup_methods
+fun:mono_class_setup_vtable_full
+fun:mono_class_setup_vtable_general
+fun:mono_generic_class_get_class
+fun:mono_method_get_context_general
+fun:mono_type_get_basic_type_from_generic
+fun:mono_type_get_underlying_type
+
+# class-accessors.c #
+
+fun:mono_class_get_flags
+fun:mono_class_get_method_count
+fun:mono_class_set_method_count
+
+# class-inlines.h #
+
+fun:mono_class_is_ginst
+fun:mono_class_is_gtd
+
+# domain.c #
+
+fun:mono_domain_alloc0
+
+# gc.c #
+
+fun:finalize_domain_objects
+fun:finalizer_thread
+fun:mono_domain_finalize
+fun:mono_gc_cleanup
+
+# handle.h #
+
+fun:mono_stack_mark_pop
+
+# handle.c #
+
+fun:mono_handle_new
+fun:mono_handle_stack_scan
+
+# icall.c #
+
+fun:ves_icall_System_Array_FastCopy
+fun:ves_icall_System_Reflection_MonoMethodInfo_get_parameter_info
+fun:ves_icall_RuntimeType_GetConstructors_native
+
+# image.c #
+
+fun:mono_image_alloc
+fun:mono_image_alloc0
+fun:mono_image_strdup
+
+# jit-info.c #
+
+fun:jit_info_table_add
+fun:jit_info_table_chunk_index
+fun:jit_info_table_find
+fun:jit_info_table_index
+fun:mono_jit_compile_method_with_opt
+fun:mono_jit_info_init
+fun:mono_jit_info_table_find_internal
+
+# loader.c #
+
+fun:cache_memberref_sig
+fun:mon_new
+fun:mono_get_method_from_token
+fun:mono_method_get_signature_checked
+fun:mono_method_signature_checked
+
+# marshal.c #
+
+fun:mono_marshal_get_native_wrapper
+fun:mono_marshal_isinst_with_cache
+
+# metadata.c #
+
+fun:img_set_cache_get
+fun:_mono_metadata_generic_class_equal
+fun:mono_metadata_lookup_generic_class
+fun:mono_type_get_type
+fun:mono_type_is_struct
+
+# monitor.c #
+
+fun:mono_monitor_ensure_owned
+fun:mono_monitor_exit_inflated
+fun:mono_monitor_try_enter_inflated
+fun:mono_monitor_try_enter_internal
+fun:mono_object_hash
+fun:ves_icall_System_Threading_Monitor_Monitor_pulse_all
+fun:ves_icall_System_Threading_Monitor_Monitor_test_synchronised
+fun:ves_icall_System_Threading_Monitor_Monitor_wait
+
+# mono-conc-hash.c #
+
+fun:mono_conc_g_hash_table_lookup_extended
+fun:set_key
+
+# mono-hash.c #
+
+fun:mono_g_hash_table_find_slot
+fun:mono_g_hash_table_max_chain_length
+
+# object.c #
+
+fun:mono_class_compute_gc_descriptor
+fun:mono_class_create_runtime_vtable
+fun:mono_class_vtable_full
+fun:mono_delegate_ctor_with_method
+fun:mono_object_handle_isinst
+fun:mono_runtime_class_init_full
+
+# reflection.c #
+
+fun:method_object_construct
+fun:reflected_equal
+
+# reflection-cache.h #
+
+fun:cache_object_handle
+
+# runtime.c #
+
+fun:mono_runtime_is_shutting_down
+fun:mono_runtime_try_shutdown
+
+# sgen-mono.c #
+
+fun:mono_gc_alloc_string
+fun:mono_gc_alloc_vector
+fun:mono_gc_thread_in_critical_region
+fun:mono_gc_wbarrier_set_arrayref
+fun:sgen_client_gchandle_created
+fun:sgen_client_gchandle_destroyed
+
+# threadpool.c #
+
+fun:worker_callback
+
+# threadpool-worker-default.c #
+
+fun:heuristic_adjust
+fun:heuristic_notify_work_completed
+fun:heuristic_should_adjust
+fun:hill_climbing_update
+fun:monitor_should_keep_running
+fun:monitor_thread
+
+# threads.c #
+
+fun:build_wait_tids
+fun:create_thread
+fun:mono_thread_clr_state
+fun:mono_thread_detach_internal
+fun:mono_threads_add_joinable_thread
+fun:mono_threads_join_threads
+fun:remove_and_abort_threads
+
+# w32handle.c #
+
+fun:mono_w32handle_init_handle
+fun:mono_w32handle_lookup_data
+fun:mono_w32handle_unref_core
+
+# ------------------------------------------------------------ #
+# mono/mini
+# ------------------------------------------------------------ #
+
+# alias-analysis.c #
+
+fun:recompute_aliased_variables
+
+# method-to-ir.c #
+
+fun:mono_method_to_ir
+
+# mini.c #
+
+fun:mini_method_compile
+fun:mono_allocate_stack_slots
+fun:mono_jit_compile_method_inner
+fun:mono_save_seq_point_info
+fun:mono_time_track_end
+fun:mono_type_to_load_membase
+
+# mini-amd64.c #
+
+fun:mono_arch_get_delegate_invoke_impl
+
+# mini-exceptions.c #
+
+fun:mono_thread_state_init_from_sigctx
+
+# mini-generic-sharing.c #
+
+fun:mini_get_basic_type_from_generic
+fun:mini_is_gsharedvt_type
+fun:mini_type_get_underlying_type
+fun:mono_class_fill_runtime_generic_context
+fun:mono_generic_context_check_used
+fun:mono_method_check_context_used
+
+# mini-native-types.c #
+
+fun:mini_native_type_replace_type
+
+# mini-runtime.c #
+
+fun:mono_jit_find_compiled_method_with_jit_info
+
+# mini-trampolines.c #
+
+fun:common_call_trampoline
+fun:mini_resolve_imt_method
+fun:mono_create_jit_trampoline
+fun:mono_delegate_trampoline
+fun:mono_magic_trampoline
+fun:mono_rgctx_lazy_fetch_trampoline
+fun:mono_vcall_trampoline
+
+# ------------------------------------------------------------ #
+# mono/sgen
+# ------------------------------------------------------------ #
+
+# sgen-alloc.c #
+
+fun:sgen_alloc_obj
+fun:sgen_clear_tlabs
+fun:sgen_try_alloc_obj_nolock
+
+# sgen-array-list.h #
+
+fun:sgen_array_list_bucketize
+
+# sgen-array-list.c #
+
+fun:sgen_array_list_add
+fun:sgen_array_list_find_unset
+
+# sgen-cardtable.h #
+
+fun:sgen_card_table_mark_address
+
+# sgen-fin-weak-hash.c #
+
+fun:add_stage_entry
+
+# sgen-gc.h #
+
+fun:sgen_set_nursery_scan_start
+
+# sgen-gc.c #
+
+fun:mono_gc_wbarrier_generic_store
+fun:sgen_conservatively_pin_objects_from
+
+# sgen-gchandles.c #
+
+fun:is_slot_set
+fun:link_get
+fun:mono_gchandle_free
+fun:sgen_gchandle_iterate
+
+# sgen-marksweep.c #
+
+fun:ensure_block_is_checked_for_sweeping
+fun:major_finish_sweep_checking
+fun:set_block_state
+fun:sweep_block
+fun:sweep_block_for_size
+fun:unlink_slot_from_free_list_uncontested
+
+# sgen-nursery-allocator.c #
+
+fun:sgen_fragment_allocator_add
+fun:sgen_fragment_allocator_alloc
+fun:sgen_fragment_allocator_par_range_alloc
+fun:sgen_fragment_allocator_release
+
+# ------------------------------------------------------------ #
+# mono/utils
+# ------------------------------------------------------------ #
+
+# hazard-pointer.c #
+
+fun:is_pointer_hazardous
+fun:mono_get_hazardous_pointer
+
+# memfuncs.c #
+
+fun:mono_gc_bzero_aligned
+fun:mono_gc_memmove_aligned
+
+# mono-conc-hashtable.c #
+
+fun:mono_conc_hashtable_lookup
+
+# mono-context.c #
+
+fun:mono_sigctx_to_monoctx
+
+# mono-lazy-init.h #
+
+fun:mono_lazy_initialize
+
+# mono-threads-posix-signals.c #
+
+fun:restart_signal_handler
+fun:suspend_signal_handler
+
+# mono-threads-state-machine.c #
+
+fun:check_thread_state
+fun:mono_threads_transition_finish_async_suspend
+
+# os-event-unix.c #
+
+fun:mono_os_event_set
+
+# refcount.h #
+
+fun:mono_refcount_decrement
export TEST_HARNESS_VERBOSE=1
+make_timeout=300m
+
if [[ $CI_TAGS == *'collect-coverage'* ]]; then
# Collect coverage for further use by lcov and similar tools.
# Coverage must be collected with -O0 and debug information.
export CFLAGS="-ggdb3 --coverage -O0"
# Collect coverage on all optimizations
export MONO_ENV_OPTIONS="$MONO_ENV_OPTIONS -O=all"
+elif [[ ${CI_TAGS} == *'clang-sanitizer'* ]]; then
+ export CC="clang"
+ export CXX="clang++"
+ export CFLAGS="-g -O1 -fsanitize=thread -fsanitize-blacklist=${MONO_REPO_ROOT}/scripts/ci/clang-thread-sanitizer-blacklist -mllvm -tsan-instrument-atomics=false"
+ export LDFLAGS="-fsanitize=thread"
+ # TSAN_OPTIONS are used by programs that were compiled with Clang's ThreadSanitizer
+ # see https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags for more details
+ export TSAN_OPTIONS="history_size=7:exitcode=0:force_seq_cst_atomics=1"
+ make_timeout=30m
elif [[ ${label} == w* ]]; then
# Passing -ggdb3 on Cygwin breaks linking against libmonosgen-x.y.dll
export CFLAGS="-g -O2"
if [[ ${CI_TAGS} == *'checked-all'* ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --enable-checked-build=all"; fi
if [[ ${CI_TAGS} == *'mcs-compiler'* ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-csc=mcs"; fi
+if [[ ${CI_TAGS} == *'disable-mcs-build'* ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --disable-mcs-build"; fi
if [[ ${CI_TAGS} == *'fullaot_llvm'* ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --enable-llvm=yes --with-runtime_preset=fullaot ";
elif [[ ${CI_TAGS} == *'hybridaot_llvm'* ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --enable-llvm=yes --with-runtime_preset=hybridaot";
make_parallelism=-j4
if [[ ${label} == 'debian-8-ppc64el' ]]; then make_parallelism=-j1; fi
-${TESTCMD} --label=make --timeout=300m --fatal make ${make_parallelism} -w V=1
+${TESTCMD} --label=make --timeout=${make_timeout} --fatal make ${make_parallelism} -w V=1
if [[ ${CI_TAGS} == *'checked-coop'* ]]; then export MONO_CHECK_MODE=gc,thread; fi
if [[ ${CI_TAGS} == *'checked-all'* ]]; then export MONO_CHECK_MODE=all; fi
then ${TESTCMD} --label=aot-test --skip;
else ${TESTCMD} --label=aot-test --timeout=30m make -w -C mono/tests -j4 -k test-aot
fi
+${TESTCMD} --label=compile-bcl-tests --timeout=40m make -i -w -C runtime -j4 test
${TESTCMD} --label=compile-runtime-tests --timeout=40m make -w -C mono/tests -j4 tests
${TESTCMD} --label=runtime --timeout=160m make -w -C mono/tests -k test-wrench V=1 CI=1 CI_PR=${ghprbPullId}
${TESTCMD} --label=runtime-unit-tests --timeout=5m make -w -C mono/unit-tests -k check
${TESTCMD} --label=corlib --timeout=30m make -w -C mcs/class/corlib run-test
+if [[ ${label} == w* ]]; then ${TESTCMD} --label=corlib-xunit --skip; else ${TESTCMD} --label=corlib-xunit --timeout=5m make -w -C mcs/class/corlib run-xunit-test; fi
${TESTCMD} --label=verify --timeout=15m make -w -C runtime mcs-compileall
${TESTCMD} --label=profiler --timeout=30m make -w -C mono/profiler -k check
${TESTCMD} --label=compiler --timeout=30m make -w -C mcs/tests run-test
}
}
- static bool dump_asm, dump_ver;
+ static bool dump_asm, dump_ver, dump_guids_for_msbuild;
static void Main (string[] args) {
if (args.Length > 1) {
dump_asm = args [1].Equals ("asm");
dump_ver = args [1].Equals ("ver");
+ dump_guids_for_msbuild = args [1].Equals ("guids_for_msbuild");
} else {
dump_asm = true;
}
var data = StreamToArray (entry.Open ());
AppDomain ad = AppDomain.CreateDomain ("parse_" + ++domain_id);
DoParse p = (DoParse)ad.CreateInstanceAndUnwrap (typeof (DoParse).Assembly.FullName, typeof (DoParse).FullName);
- p.ParseAssembly (data, version, entry.Name, entry.FullName, dump_asm, dump_ver);
+ p.ParseAssembly (data, version, entry.Name, entry.FullName, dump_asm, dump_ver, dump_guids_for_msbuild);
AppDomain.Unload (ad);
}
}
return parts[parts.Length - 2];
}
- public void ParseAssembly (byte[] data, string version, string name, string fullname, bool dump_asm, bool dump_ver) {
+ public void ParseAssembly (byte[] data, string version, string name, string fullname, bool dump_asm, bool dump_ver, bool dump_guids_for_msbuild) {
var a = Assembly.ReflectionOnlyLoad (data);
var m = a.GetModules ()[0];
var id = m.ModuleVersionId.ToString ().ToUpper ();
//IGNORED_ASM_VER (SYS_IO_COMPRESSION, 4, 1, 2, 0),
var ver = a.GetName ().Version;
- if (dump_ver)
+ if (dump_ver) {
Console.WriteLine ($"IGNORED_ASM_VER ({str}, {ver.Major}, {ver.Minor}, {ver.Build}, {ver.Revision}),");
+ } else if (dump_guids_for_msbuild) {
+ // This needs to be kept in sync with FilterDeniedAssemblies msbuild task in msbuild
+ Console.WriteLine ($"{name},{id},{ver.Major},{ver.Minor},{ver.Build},{ver.Revision}");
+ }
}
-}
\ No newline at end of file
+}
static string AndroidNdkPath = @"";
static string MaccoreDir = @"";
static string TargetDir = @"";
+ static bool GenIOS;
public enum TargetPlatform
{
MaccoreDir = Path.Combine (maccoreDir);
}
- if (Directory.Exists(MaccoreDir))
+ if (Directory.Exists(MaccoreDir) || GenIOS)
SetupiOSTargets();
foreach (var target in Targets)
source.Options.AddDefines ("HAVE_SGEN_GC");
source.Options.AddDefines ("HAVE_MOVING_COLLECTOR");
+ source.Options.AddDefines("MONO_GENERATING_OFFSETS");
}
}
{ "android-ndk=", "Path to Android NDK", v => AndroidNdkPath = v },
{ "targetdir=", "Path to the directory containing the mono build", v =>TargetDir = v },
{ "mono=", "include directory", v => MonoDir = v },
+ { "gen-ios", "generate iOS offsets", v => GenIOS = v != null },
{ "h|help", "show this message and exit", v => showHelp = v != null },
};
parserOptions.AddArguments("-xc");
parserOptions.AddArguments("-std=gnu99");
parserOptions.AddDefines("CPPSHARP");
+ parserOptions.AddDefines("MONO_GENERATING_OFFSETS");
foreach (var define in target.Defines)
parserOptions.AddDefines(define);
var includeDirs = new[]
{
targetBuild,
- Path.Combine(targetBuild, "eglib", "src"),
+ Path.Combine(targetBuild, "mono", "eglib"),
MonoDir,
Path.Combine(MonoDir, "mono"),
Path.Combine(MonoDir, "mono", "mini"),
- Path.Combine(MonoDir, "eglib", "src")
+ Path.Combine(MonoDir, "mono", "eglib")
};
foreach (var inc in includeDirs)
"MonoTypedRef",
"MonoThreadsSync",
"SgenThreadInfo",
- "SgenClientThreadInfo"
+ "SgenClientThreadInfo",
+ "MonoProfilerCallContext"
};
DumpClasses(writer, ctx, types);
}
mono_class_init (klass);
if (mono_class_has_failure (klass)) {
- printf ("Error verifying class(0x%08x) %s.%s a type load error happened\n", token, klass->name_space, klass->name);
+ MonoError type_load_error;
+ error_init (&type_load_error);
+ mono_error_set_for_class_failure (&type_load_error, klass);
+ printf ("Could not initialize class(0x%08x) %s.%s due to %s\n", token, klass->name_space, klass->name, mono_error_get_message (&type_load_error));
+ mono_error_cleanup (&type_load_error);
++count;
}
mono_class_setup_vtable (klass);
if (mono_class_has_failure (klass)) {
- printf ("Error verifying class(0x%08x) %s.%s a type load error happened\n", token, klass->name_space, klass->name);
+ MonoError type_load_error;
+ error_init (&type_load_error);
+ mono_error_set_for_class_failure (&type_load_error, klass);
+ printf ("Could not initialize vtable of class(0x%08x) %s.%s due to %s\n", token, klass->name_space, klass->name, mono_error_get_message (&type_load_error));
+ mono_error_cleanup (&type_load_error);
++count;
}
}
-/* config.h. Generated from config.h.in by configure. */
-/* config.h.in. Generated from configure.ac by autoheader. */
-
#ifndef _MSC_VER
#include "cygconfig.h"
#else
/* Define to 1 if you have IPv6 support. */
#define HAVE_STRUCT_SOCKADDR_IN6 1
+/* Defined as strtok_s in eglib-config.hw */
+#define HAVE_STRTOK_R 1
+
/* Have a working sigaltstack */
/* #undef HAVE_WORKING_SIGALTSTACK */