mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-18 03:51:19 -10:00
Compare commits
223
Commits
xcode8
...
mono-1-1-13-3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9334918613 | ||
|
|
195be47f2f | ||
|
|
457bb1f247 | ||
|
|
f5b438a51d | ||
|
|
9937117115 | ||
|
|
4ba996de38 | ||
|
|
ed6334ae35 | ||
|
|
c08a2cd9b3 | ||
|
|
e5f26d3004 | ||
|
|
c3733aa980 | ||
|
|
53c61e76ed | ||
|
|
5829e96050 | ||
|
|
5da1119d76 | ||
|
|
0a175bf1a4 | ||
|
|
088c7334ba | ||
|
|
c2c1b1fcfd | ||
|
|
38324a0f52 | ||
|
|
cd1a3ac098 | ||
|
|
4a7a7ab11b | ||
|
|
ea5801c624 | ||
|
|
baf743d89e | ||
|
|
58d7543806 | ||
|
|
f6b84806d7 | ||
|
|
51ebd81dd9 | ||
|
|
9483519cfc | ||
|
|
456b542599 | ||
|
|
520763b0a2 | ||
|
|
71cf5a9be9 | ||
|
|
5c4bba130e | ||
|
|
0ab2fad3a5 | ||
|
|
6119b81254 | ||
|
|
e5b91ab094 | ||
|
|
a9728748e7 | ||
|
|
f8834c4f48 | ||
|
|
34a82ac108 | ||
|
|
a5c28269b1 | ||
|
|
31df63b323 | ||
|
|
6d59bc1f3f | ||
|
|
5fd7dc5ada | ||
|
|
f0b2efd583 | ||
|
|
818b91cb22 | ||
|
|
571d48dba8 | ||
|
|
7788901473 | ||
|
|
4ff6ffbe36 | ||
|
|
28e122bcf5 | ||
|
|
e60232a944 | ||
|
|
11df64e4b8 | ||
|
|
30032bb8fb | ||
|
|
075ea9ac0d | ||
|
|
00d366568e | ||
|
|
870e79a0fd | ||
|
|
cad7a4e698 | ||
|
|
16a08b18be | ||
|
|
b3c23ed215 | ||
|
|
5f6b7974bf | ||
|
|
f66d6296f4 | ||
|
|
df4807294d | ||
|
|
8f38791659 | ||
|
|
d0ab558222 | ||
|
|
3a319110cb | ||
|
|
89263dce56 | ||
|
|
1470ae3076 | ||
|
|
5366c31ac9 | ||
|
|
32df99bd6f | ||
|
|
661565dba9 | ||
|
|
212281f2d3 | ||
|
|
8cb3df657a | ||
|
|
da6dc4eed5 | ||
|
|
afb6910759 | ||
|
|
0d2f3751f1 | ||
|
|
57bf6ae887 | ||
|
|
d709670672 | ||
|
|
e9e448624a | ||
|
|
dc919ec1d7 | ||
|
|
67722d400a | ||
|
|
1e5da6f858 | ||
|
|
c6f81f5b9a | ||
|
|
9fe6fe10ae | ||
|
|
d5fd43350d | ||
|
|
4e12849547 | ||
|
|
a52936ffde | ||
|
|
d644872f3b | ||
|
|
51ccea026b | ||
|
|
cdcff1c71f | ||
|
|
d02ae5061f | ||
|
|
0d8b04be59 | ||
|
|
f96ef184e3 | ||
|
|
0724f383bd | ||
|
|
c618aa1f93 | ||
|
|
a7d1363cc6 | ||
|
|
46a7ba89c5 | ||
|
|
176dc4d4ac | ||
|
|
e647c71760 | ||
|
|
77eaced11d | ||
|
|
1d2e52d593 | ||
|
|
639d7c0b7f | ||
|
|
f48b807c5b | ||
|
|
38f9f0879d | ||
|
|
00fb6eea39 | ||
|
|
2c02393df8 | ||
|
|
542db3c933 | ||
|
|
28c09a3cc2 | ||
|
|
5ad3531cd8 | ||
|
|
32e28e47e6 | ||
|
|
fff12b1908 | ||
|
|
9369390676 | ||
|
|
1f613a1653 | ||
|
|
810dc5158d | ||
|
|
ec4600822d | ||
|
|
9e0243cbbf | ||
|
|
edd26bd0f7 | ||
|
|
827aaeae7f | ||
|
|
ae8301741f | ||
|
|
199c2205b4 | ||
|
|
417697e53a | ||
|
|
e41a822945 | ||
|
|
24e89c4d94 | ||
|
|
8ed815e9a4 | ||
|
|
849cb942a3 | ||
|
|
1bb398b766 | ||
|
|
ddcba9afcf | ||
|
|
f757a0160c | ||
|
|
caa3147dcf | ||
|
|
4fbed4ee86 | ||
|
|
1e400ba4d5 | ||
|
|
340d67b758 | ||
|
|
52406c8ccb | ||
|
|
f2e9427a5c | ||
|
|
18c740db38 | ||
|
|
8e1e5b4097 | ||
|
|
9b4068798a | ||
|
|
422cb6cc96 | ||
|
|
d2c18ab72f | ||
|
|
a48d54b56c | ||
|
|
bec0751d5b | ||
|
|
50b08c4665 | ||
|
|
f7f9eda2db | ||
|
|
435cb2dd46 | ||
|
|
5d246500ef | ||
|
|
14837aa6c1 | ||
|
|
51d9b8154e | ||
|
|
fa5c7724ea | ||
|
|
643e1a7a03 | ||
|
|
6e2a247bf7 | ||
|
|
de22929eb0 | ||
|
|
1171cba17b | ||
|
|
6a7fb1c73d | ||
|
|
8522885699 | ||
|
|
806646dcc8 | ||
|
|
ae46d2413b | ||
|
|
ff409be5fe | ||
|
|
9585905fc7 | ||
|
|
68da0245b6 | ||
|
|
7bf6b8a543 | ||
|
|
24906dde22 | ||
|
|
bf9916e270 | ||
|
|
c6747a0d3f | ||
|
|
17a0cd07df | ||
|
|
d23c285914 | ||
|
|
c94c32d25f | ||
|
|
d14f7229de | ||
|
|
358364e296 | ||
|
|
3c3298c935 | ||
|
|
a8169657e5 | ||
|
|
2abcd8c550 | ||
|
|
0d8ab85503 | ||
|
|
cab3731f55 | ||
|
|
8ec3155df9 | ||
|
|
cbf8c48dd3 | ||
|
|
b1ecc84c40 | ||
|
|
397b7ac493 | ||
|
|
050260877b | ||
|
|
671301931a | ||
|
|
ee40dbd92b | ||
|
|
91edcf60a5 | ||
|
|
7202caa9d9 | ||
|
|
e5c93bb691 | ||
|
|
57accaa58c | ||
|
|
5ca532241d | ||
|
|
5295717ed2 | ||
|
|
e8c324e6a2 | ||
|
|
a0746ae6c5 | ||
|
|
8a5afbae36 | ||
|
|
bcffcd5b81 | ||
|
|
eabeb7d2e2 | ||
|
|
451614ec61 | ||
|
|
172ee433de | ||
|
|
4769716742 | ||
|
|
60e5bcc42d | ||
|
|
0fe9c3f5e7 | ||
|
|
ee2bdff675 | ||
|
|
ac504cc3db | ||
|
|
0d6bd08a90 | ||
|
|
e76f20efbb | ||
|
|
b8fbf2ec20 | ||
|
|
e8d49a8870 | ||
|
|
6635c94936 | ||
|
|
0e6e9da90b | ||
|
|
cf532c2e60 | ||
|
|
9a5238504a | ||
|
|
a0f9928e49 | ||
|
|
b64ac133b7 | ||
|
|
3534344b61 | ||
|
|
7ff7a966fb | ||
|
|
51436c31ee | ||
|
|
0c158dc33c | ||
|
|
b1bf3e9ff1 | ||
|
|
52a04a859c | ||
|
|
6f594e13f3 | ||
|
|
81a1f566ea | ||
|
|
0717dd85e9 | ||
|
|
d6da946bec | ||
|
|
931932d774 | ||
|
|
8a77f84436 | ||
|
|
e73d556bf7 | ||
|
|
e606120a95 | ||
|
|
eeec6e8904 | ||
|
|
628c8cbae0 | ||
|
|
e6ca6781e1 | ||
|
|
852bcf8213 | ||
|
|
0738b1b7fa | ||
|
|
c0c70fc306 | ||
|
|
cef2791818 |
No files matched your search
@@ -1,86 +1,13 @@
|
||||
2006-02-27 Raja R Harinath <[email protected]>
|
||||
|
||||
* configure.in (runtime/etc/mono/{1.0,2.0}/machine.config):
|
||||
Fix m4-quoting.
|
||||
|
||||
Sat Feb 25 11:53:30 CET 2006 Paolo Molaro <[email protected]>
|
||||
|
||||
* configure.in: more feature for --enable-minimal flags.
|
||||
|
||||
2006-02-24 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* configure.in: define PLATFORM_BSD.
|
||||
|
||||
2006-02-17 Zoltan Varga <[email protected]>
|
||||
|
||||
* Makefile.am: Avoid installing mint.pc if mint is not compiled.
|
||||
|
||||
2006-02-07 Chris Toshok <[email protected]>
|
||||
|
||||
* data/net_2_0/Makefile.am (EXTRA_DIST): add web.config
|
||||
(mono_DATA): same.
|
||||
|
||||
* data/net_2_0/machine.config: remove the system.web section from
|
||||
here.
|
||||
|
||||
* data/net_2_0/web.config: and add it here.
|
||||
|
||||
2006-02-02 Carlos Alberto Cortez <[email protected]>
|
||||
|
||||
* data/net_2_0/machine.config: Add FtpRequestCreator
|
||||
to create new instances of System.Net.FtpWebWebRequest.
|
||||
|
||||
2006-02-01 Sebastien Pouliot <[email protected]>
|
||||
|
||||
* libmono.vcproj: Added new files to the VS.NET build.
|
||||
* README.vsnet: Updated VS.NET build instructions.
|
||||
|
||||
2006-01-26 Chris Toshok <[email protected]>
|
||||
|
||||
* data/net_2_0/machine.config: ignore runtime and startup
|
||||
sections.
|
||||
|
||||
2006-01-25 Chris Toshok <[email protected]>
|
||||
|
||||
* data/net_2_0/machine.config: ignore mscorlib,
|
||||
system.runtime.remoting, and strongNames sections.
|
||||
|
||||
2006-01-25 Chris Toshok <[email protected]>
|
||||
|
||||
* data/net_2_0/machine.config: for system.web, add default
|
||||
<authorization> section that allows everything. also, add
|
||||
System.Configuration to system.web/compilation/assemblies.
|
||||
|
||||
2006-01-23 Chris Toshok <[email protected]>
|
||||
|
||||
* data/net_2_0/machine.config: add System.Configuration to the
|
||||
list of assemblies in system.web/compilation.
|
||||
|
||||
2006-01-23 Martin Baulig <[email protected]>
|
||||
|
||||
* configure.in: Added configure check whether the Mono Debugger is
|
||||
supported on this platform; AC_DEFINE(MONO_DEBUGGER_SUPPORTED) and
|
||||
also added a `MONO_DEBUGGER_SUPPORTED' automake conditional.
|
||||
|
||||
2006-01-13 Raja R Harinath <[email protected]>
|
||||
|
||||
* data/net_2_0/machine.config: Fix a couple of typos in type names.
|
||||
|
||||
2006-01-10 Raja R Harinath <[email protected]>
|
||||
|
||||
* scripts/Makefile.am (scripts_2_0): Add nunit-console2.
|
||||
|
||||
2006-01-09 Chris Toshok <[email protected]>
|
||||
|
||||
* data/net_2_0/machine.config: switch over to the 2.0
|
||||
configuration sections for System.Web and System.Web.Services.
|
||||
Also, add the configProtectedData stuff so we can encrypt config
|
||||
sections.
|
||||
|
||||
2006-01-08 Robert Jordan <[email protected]>
|
||||
|
||||
* man/mkbundle.1: Documented environment variables and Windows issues.
|
||||
|
||||
2006-01-06 Jonathan Pryor <[email protected]>
|
||||
|
||||
* data/config.in: s/libintl/intl/g. Mono.Unix.Catalog DllImports "intl"
|
||||
|
||||
@@ -20,12 +20,8 @@ dist-hook:
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
if JIT_SUPPORTED
|
||||
if INTERP_SUPPORTED
|
||||
pkgconfig_DATA= mono.pc mint.pc dotnet.pc mono-cairo.pc
|
||||
else
|
||||
pkgconfig_DATA= mono.pc dotnet.pc mono-cairo.pc
|
||||
endif
|
||||
else
|
||||
pkgconfig_DATA= mint.pc mono-cairo.pc
|
||||
endif
|
||||
noinst_DATA = mono-uninstalled.pc
|
||||
|
||||
@@ -25,11 +25,6 @@ This is Mono.
|
||||
|
||||
http://www.hpl.hp.com/research/linux/libunwind/download.php4
|
||||
|
||||
On Solaris, make sure that you used GNU tar to unpack this package, as
|
||||
Solaris tar will not unpack this correctly, and you will get strange errors.
|
||||
|
||||
On Solaris, make sure that you use the GNU toolchain to build the software.
|
||||
|
||||
Optional dependencies:
|
||||
|
||||
* libgdiplus
|
||||
@@ -47,8 +42,7 @@ This is Mono.
|
||||
make
|
||||
make install
|
||||
|
||||
Mono supports a JIT engine on x86, SPARC, SPARCv9, S/390, AMD64, ARM
|
||||
and PowerPC systems.
|
||||
Mono supports a JIT engine on x86, SPARC, SPARCv9, S/390, AMD64 and PowerPC systems.
|
||||
|
||||
If you obtained this as a snapshot, you will need an existing
|
||||
Mono installation. To upgrade your installation, unpack both
|
||||
@@ -93,11 +87,10 @@ This is Mono.
|
||||
|
||||
If you don't have a working Mono installation, an obvious choice
|
||||
is to install the latest released packages of 'mono' for your
|
||||
distribution and running autogen.sh; make; make install in the
|
||||
mono module directory.
|
||||
distribution and try from the beginning.
|
||||
|
||||
You can also try a slightly more risky approach: this may not work,
|
||||
so start from the released tarball as detailed above.
|
||||
You can also try a slightly more risky approach that should work
|
||||
almost all the time.
|
||||
|
||||
This works by first getting the latest version of the 'monolite'
|
||||
distribution, which contains just enough to run the 'mcs'
|
||||
@@ -175,7 +168,7 @@ This is Mono.
|
||||
metadata/
|
||||
The object system and metadata reader.
|
||||
|
||||
mini/
|
||||
jit/
|
||||
The Just in Time Compiler.
|
||||
|
||||
dis/
|
||||
@@ -193,7 +186,7 @@ This is Mono.
|
||||
definition of the CIL bytecodes.
|
||||
|
||||
interp/
|
||||
Interpreter for CLI executables (obsolete).
|
||||
Interpreter for CLI executables.
|
||||
|
||||
arch/
|
||||
Architecture specific portions.
|
||||
|
||||
+12
-21
@@ -1,8 +1,8 @@
|
||||
README.vsnet Last updated: 2006-02-01
|
||||
README.vsnet Last updated: 2005-05-26
|
||||
|
||||
|
||||
SVN includes a Visual Studio .NET 2005 solution, mono.sln, and some
|
||||
projects files to build most of the unmanaged parts in Mono.
|
||||
SVN now includes a Visual Studio .NET 2005 (beta2) solution, mono.sln,
|
||||
and some projects files to build most of the unmanaged parts in Mono.
|
||||
|
||||
The "mono.sln" solution file contains the VC projects files for:
|
||||
|
||||
@@ -30,12 +30,12 @@ REQUIREMENTS
|
||||
* build the class libraries; and
|
||||
* test for regressions.
|
||||
|
||||
* Visual Studio .NET 2005. Previous Visual Studio versions may work or
|
||||
requires, hopefully minimal, changes.
|
||||
* Visual Studio .NET 2005 beta2. Previous Visual Studio versions may
|
||||
work or requires, hopefully minimal, changes.
|
||||
|
||||
* VSDependencies.zip must be decompressed under the /mono/ directory
|
||||
(otherwise you will need to edit all the projects files). This file can
|
||||
be downloaded from http://www.go-mono.com/archive/VSDependencies.zip
|
||||
* VSDependencies.zip must be decompressed under /mono/ (otherwise you
|
||||
will need to edit all the projects files. This file can be downloaded
|
||||
from http://www.go-mono.com/archive/VSDependencies.zip
|
||||
|
||||
|
||||
LOCAL CHANGES
|
||||
@@ -85,11 +85,9 @@ requires a working cygwin environment to create some files (e.g. via
|
||||
genmdesc, monoburg). This isn't so bad as without cygwin you wouldn't be
|
||||
able to test Mono properly (see REQUIREMENTS);
|
||||
|
||||
[3] Only the Debug target is configured properly (that would be easy to
|
||||
fix, but would require turning off some optimizations like omitting
|
||||
stack frames). Anyway there are other issues [1] to fix before switching
|
||||
to Release and IMHO the _biggest_ advantage to VS.NET is it's debugger/
|
||||
debugging tools;
|
||||
[3] Only the Debug target is configured properly (easy to fix). Anyway
|
||||
there are other issues [1] to fix before switching to Release and IMHO
|
||||
the _biggest_ advantage to VS.NET is it's debugger/debugging tools;
|
||||
|
||||
[4] The C compiler emits _lots_ of warning during compilation. Some
|
||||
warnings have been turned off for some projects (there was so much that
|
||||
@@ -103,17 +101,10 @@ Platform SDK (Windows Server 2003 is the latest) to ensure you have the
|
||||
latest Windows header files. You can download it from:
|
||||
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm
|
||||
|
||||
[6] Not everyone has VS.NET so it is possible you may have to add some
|
||||
(new) files to the build from time to time. See "more informations" for
|
||||
reporting those changes.
|
||||
|
||||
[7] Probably a lot more I didn't discover... or has changed since.
|
||||
[6] Probably a lot more I didn't discover...
|
||||
|
||||
|
||||
MORE INFORMATIONS
|
||||
|
||||
Please email <[email protected]> if you have any problem
|
||||
and/or if there's something wrong/missing in the instructions.
|
||||
|
||||
An online version of this file is available at
|
||||
http://www.mono-project.com/Mono:Windows
|
||||
+4
-21
@@ -6,7 +6,7 @@ AC_CANONICAL_SYSTEM
|
||||
m4_ifdef([_A][M_PROG_TAR],[_A][M_SET_OPTION([tar-ustar])])
|
||||
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AM_INIT_AUTOMAKE(mono,1.1.13)
|
||||
AM_INIT_AUTOMAKE(mono,1.1.13.3)
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
AC_PROG_LN_S
|
||||
@@ -498,8 +498,7 @@ if test "x$with_xen_opt" = "xyes"; then
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(minimal, [ --enable-minimal=LIST drop support for LIST subsystems.
|
||||
LIST is a comma-separated list from: aot, profiler, decimal, pinvoke, debug,
|
||||
reflection_emit, large_code, logging, com, ssa.],
|
||||
LIST is a comma-separated list from: aot, profiler, decimal, pinvoke, debug, reflection_emit.],
|
||||
[
|
||||
for feature in `echo "$enable_minimal" | sed -e "s/,/ /g"`; do
|
||||
eval "mono_feature_disable_$feature='yes'"
|
||||
@@ -532,22 +531,6 @@ if test "x$mono_feature_disable_reflection_emit" = "xyes"; then
|
||||
AC_DEFINE(DISABLE_REFLECTION_EMIT, 1, [Disable reflection emit support])
|
||||
fi
|
||||
|
||||
if test "x$mono_feature_disable_large_code" = "xyes"; then
|
||||
AC_DEFINE(DISABLE_LARGE_CODE, 1, [Disable support for huge assemblies])
|
||||
fi
|
||||
|
||||
if test "x$mono_feature_disable_logging" = "xyes"; then
|
||||
AC_DEFINE(DISABLE_LOGGING, 1, [Disable support debug logging])
|
||||
fi
|
||||
|
||||
if test "x$mono_feature_disable_com" = "xyes"; then
|
||||
AC_DEFINE(DISABLE_COM, 1, [Disable COM support])
|
||||
fi
|
||||
|
||||
if test "x$mono_feature_disable_ssa" = "xyes"; then
|
||||
AC_DEFINE(DISABLE_SSA, 1, [Disable advanced SSA JIT optimizations])
|
||||
fi
|
||||
|
||||
LIBGC_CFLAGS=
|
||||
LIBGC_LIBS=
|
||||
LIBGC_STATIC_LIBS=
|
||||
@@ -1805,7 +1788,7 @@ AC_CONFIG_FILES([runtime/semdel-wrapper],[chmod +x runtime/semdel-wrapper])
|
||||
AC_CONFIG_COMMANDS([runtime/etc/mono/1.0/machine.config],
|
||||
[ depth=../../../..
|
||||
case $srcdir in
|
||||
[[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;;
|
||||
[\\/$]* | ?:[\\/]* ) reldir=$srcdir ;;
|
||||
.) reldir=$depth ;;
|
||||
*) reldir=$depth/$srcdir ;;
|
||||
esac
|
||||
@@ -1819,7 +1802,7 @@ AC_CONFIG_COMMANDS([runtime/etc/mono/1.0/machine.config],
|
||||
AC_CONFIG_COMMANDS([runtime/etc/mono/2.0/machine.config],
|
||||
[ depth=../../../..
|
||||
case $srcdir in
|
||||
[[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;;
|
||||
[\\/$]* | ?:[\\/]* ) reldir=$srcdir ;;
|
||||
.) reldir=$depth ;;
|
||||
*) reldir=$depth/$srcdir ;;
|
||||
esac
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
monodir = $(sysconfdir)/mono/2.0
|
||||
|
||||
EXTRA_DIST = machine.config \
|
||||
web.config \
|
||||
DefaultWsdlHelpGenerator.aspx
|
||||
DefaultWsdlHelpGenerator.aspx
|
||||
|
||||
mono_DATA = machine.config \
|
||||
web.config \
|
||||
DefaultWsdlHelpGenerator.aspx
|
||||
|
||||
+120
-42
@@ -3,38 +3,41 @@
|
||||
<configuration>
|
||||
|
||||
<configSections>
|
||||
<section name="configProtectedData" type="System.Configuration.ProtectedConfigurationSection, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="appSettings" type="System.Configuration.AppSettingsSection, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="connectionStrings" type="System.Configuration.ConnectionStringsSection, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="mscorlib" type="System.Configuration.IgnoreSection, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="runtime" type="System.Configuration.IgnoreSection, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="startup" type="System.Configuration.IgnoreSection, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="appSettings" type="System.Configuration.NameValueFileSectionHandler, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<section name="system.diagnostics" type="System.Diagnostics.DiagnosticsConfigurationHandler, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<section name="system.runtime.remoting" type="System.Configuration.IgnoreSection, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowLocation="false"/>
|
||||
<section name="strongNames" type="System.Configuration.IgnoreSection, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowLocation="false"/>
|
||||
<sectionGroup name="system.web" type="System.Web.Configuration.SystemWebSectionGroup, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<section name="authentication" type="System.Web.Configuration.AuthenticationSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="authorization" type="System.Web.Configuration.AuthorizationSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="clientTarget" type="System.Web.Configuration.ClientTargetSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="compilation" type="System.Web.Configuration.CompilationSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="customErrors" type="System.Web.Configuration.CustomErrorsSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="globalization" type="System.Web.Configuration.GlobalizationSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="httpHandlers" type="System.Web.Configuration.HttpHandlersSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="httpModules" type="System.Web.Configuration.HttpModulesSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="httpRuntime" type="System.Web.Configuration.HttpRuntimeSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="machineKey" type="System.Web.Configuration.MachineKeySection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="pages" type="System.Web.Configuration.PagesSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="profile" type="System.Web.Configuration.ProfileSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="sessionState" type="System.Web.Configuration.SessionStateSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="trace" type="System.Web.Configuration.TraceSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="webControls" type="System.Web.Configuration.WebControlsSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="webServices" type="System.Web.Services.Configuration.WebServicesSection, System.Web.Services, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<sectionGroup name="caching" type="System.Web.Configuration.SystemWebCachingSectionGroup, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<section name="cache" type="System.Web.Configuration.CacheSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="outputCache" type="System.Web.Configuration.OutputCacheSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="outputCacheSettings" type="System.Web.Configuration.OutputCacheSettingsSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="sqlCacheDependency" type="System.Web.Configuration.OutputCacheSettingsSection, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
</sectionGroup>
|
||||
<section name="system.runtime.remoting" type="System.Configuration.IgnoreSectionHandler, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowLocation="false"/>
|
||||
<section name="strongNames" type="System.Configuration.IgnoreSectionHandler, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowLocation="false"/>
|
||||
<sectionGroup name="system.web">
|
||||
<section name="httpHandlers"
|
||||
type="System.Web.Configuration.HttpHandlersSectionHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="httpModules"
|
||||
type="System.Web.Configuration.HttpModulesConfigurationHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="machineKey"
|
||||
type="System.Web.Configuration.MachineKeyConfigHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="authentication"
|
||||
type="System.Web.Configuration.AuthenticationConfigHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="authorization"
|
||||
type="System.Web.Configuration.AuthorizationConfigHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="globalization"
|
||||
type="System.Web.Configuration.GlobalizationConfigurationHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="sessionState"
|
||||
type="System.Web.SessionState.SessionStateSectionHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="trace"
|
||||
type="System.Web.Configuration.TraceConfigurationHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="webServices"
|
||||
type="System.Web.Services.Configuration.WebServicesConfigurationSectionHandler, System.Web.Services, Version=2.0.0.0 Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="webControls"
|
||||
type="System.Web.Configuration.WebControlsSectionHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="compilation"
|
||||
type="System.Web.Configuration.CompilationConfigurationHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="httpRuntime"
|
||||
type="System.Web.Configuration.HttpRuntimeConfigurationHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="customErrors"
|
||||
type="System.Web.Configuration.CustomErrorsConfigHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<section name="pages"
|
||||
type="System.Web.Configuration.PagesConfigurationHandler, System.Web, Version=2.0.0.0, Culture=neutral" />
|
||||
<section name="clientTarget"
|
||||
type="System.Web.Configuration.ClientTargetSectionHandler, System.Web, Version=2.0.0.0, Culture=neutral" />
|
||||
</sectionGroup>
|
||||
<sectionGroup name="system.net">
|
||||
<section name="settings"
|
||||
@@ -50,16 +53,6 @@
|
||||
</sectionGroup>
|
||||
<section name="system.drawing" type="System.Configuration.NameValueSectionHandler, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
</configSections>
|
||||
|
||||
<configProtectedData defaultProvider="RsaProtectedConfigurationProvider">
|
||||
<providers>
|
||||
<add name="RsaProtectedConfigurationProvider" type="System.Configuration.RsaProtectedConfigurationProvider, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
|
||||
description="" keyContainerName="MonoFrameworkConfigurationKey" cspProviderName="" useMachineContainer="true" useOAEP="false" />
|
||||
<add name="DataProtectionConfigurationProvider" type="System.Configuration.DpapiProtectedConfigurationProvider, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
|
||||
description="" useMachineProtection="true" keyEntropy="" />
|
||||
</providers>
|
||||
</configProtectedData>
|
||||
|
||||
<system.net>
|
||||
<connectionManagement>
|
||||
<add address="*" maxconnection="2" />
|
||||
@@ -80,12 +73,97 @@
|
||||
<add prefix="http" type="System.Net.HttpRequestCreator, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add prefix="https" type="System.Net.HttpRequestCreator, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add prefix="file" type="System.Net.FileWebRequestCreator, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add prefix="ftp" type="System.Net.FtpRequestCreator, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
</webRequestModules>
|
||||
<settings>
|
||||
<ipv6 enabled="false"/>
|
||||
</settings>
|
||||
</system.net>
|
||||
<system.web>
|
||||
<httpHandlers>
|
||||
<add verb="*" path="Trace.axd" type="System.Web.Handlers.TraceHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.aspx" type="System.Web.UI.PageHandlerFactory, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.asmx" validate="false" type="System.Web.Services.Protocols.WebServiceHandlerFactory, System.Web.Services, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.ashx" type="System.Web.UI.SimpleHandlerFactory, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="GET" path="WebResource.axd" type="System.Web.Handlers.AssemblyResourceLoader, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.asax" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.ascx" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.config" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.Config" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.cs" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.dll" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.rem" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting, Culture=neutral, PublicKeyToken=b77a5c561934e089" validate="false" />
|
||||
<add verb="*" path="*.soap" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting, Culture=neutral, PublicKeyToken=b77a5c561934e089" validate="false" />
|
||||
<add verb="GET,HEAD" path="*" type="System.Web.StaticFileHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*" type="System.Web.HttpMethodNotAllowedHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
</httpHandlers>
|
||||
<httpModules>
|
||||
<add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add name="Session" type="System.Web.SessionState.SessionStateModule, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add name="OutputCache" type="System.Web.Caching.OutputCacheModule, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
</httpModules>
|
||||
<authentication mode="Forms">
|
||||
<forms name=".MONOAUTH" loginUrl="login.aspx" protection="All" timeout="30" path="/">
|
||||
<credentials passwordFormat="Clear">
|
||||
<!--<user name="gonzalo" password="gonz"/>-->
|
||||
</credentials>
|
||||
</forms>
|
||||
</authentication>
|
||||
<machineKey validationKey="AutoGenerate" decryptionKey="AutoGenerate" validation="SHA1" />
|
||||
<globalization requestEncoding="utf-8"
|
||||
responseEncoding="utf-8"
|
||||
fileEncoding="utf-8"/>
|
||||
<!--
|
||||
culture="en-US"
|
||||
uiculture="en-US" />
|
||||
-->
|
||||
<sessionState mode="InProc" />
|
||||
<webServices>
|
||||
<protocols>
|
||||
<add name="HttpSoap"/>
|
||||
<add name="HttpPost"/>
|
||||
<add name="HttpGet"/>
|
||||
<add name="Documentation"/>
|
||||
</protocols>
|
||||
<wsdlHelpGenerator href="DefaultWsdlHelpGenerator.aspx" />
|
||||
</webServices>
|
||||
<webControls clientScriptsLocation="/web_scripts" />
|
||||
<compilation debug="false" defaultLanguage="c#" explicit="true" strict="false" >
|
||||
<compilers>
|
||||
<compiler language="cs;c#;csharp" extension=".cs" warningLevel="1" compilerOptions=""
|
||||
type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
|
||||
warningLevel="1" compilerOptions=""
|
||||
type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
</compilers>
|
||||
<assemblies>
|
||||
<!--<add assembly="mscorlib" /> -->
|
||||
<add assembly="System" />
|
||||
<add assembly="System.Xml" />
|
||||
<add assembly="System.Data" />
|
||||
<add assembly="System.Web" />
|
||||
<add assembly="System.Web.Services" />
|
||||
<add assembly="System.Drawing" />
|
||||
<add assembly="*" /> <!-- Add assemblies in bin directory -->
|
||||
</assemblies>
|
||||
</compilation>
|
||||
<httpRuntime executionTimeout="90"
|
||||
maxRequestLength="4096"
|
||||
useFullyQualifiedRedirectUrl="false"
|
||||
minFreeThreads="8"
|
||||
minLocalRequestFreeThreads="4"
|
||||
appRequestQueueLimit="100" />
|
||||
<pages buffer="true"
|
||||
enableSessionState="true"
|
||||
autoEventWireup="true"
|
||||
validateRequest="true" />
|
||||
<clientTarget>
|
||||
<add alias="ie5" userAgent="Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0)" />
|
||||
<add alias="ie4" userAgent="Mozilla/4.0 (compatible; MSIE 4.0; Windows NT 4.0)" />
|
||||
<add alias="uplevel" userAgent="Mozilla/4.0 (compatible; MSIE 4.0; Windows NT 4.0)" />
|
||||
<add alias="downlevel" userAgent="Unknown" />
|
||||
</clientTarget>
|
||||
</system.web>
|
||||
|
||||
<system.runtime.remoting>
|
||||
<application>
|
||||
|
||||
@@ -1,103 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<configuration>
|
||||
|
||||
<system.web>
|
||||
<authorization>
|
||||
<allow users="*" />
|
||||
</authorization>
|
||||
<httpHandlers>
|
||||
<add verb="*" path="Trace.axd" type="System.Web.Handlers.TraceHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.aspx" type="System.Web.UI.PageHandlerFactory, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.asmx" validate="false" type="System.Web.Services.Protocols.WebServiceHandlerFactory, System.Web.Services, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.ashx" type="System.Web.UI.SimpleHandlerFactory, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="GET" path="WebResource.axd" type="System.Web.Handlers.AssemblyResourceLoader, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.master" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.resources" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.skin" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.browser" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.sitemap" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.webinfo" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.resx" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.asax" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.ascx" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.config" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.Config" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.cs" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.vb" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.csproj" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.vbproj" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.licx" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.dll" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.rem" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting, Culture=neutral, PublicKeyToken=b77a5c561934e089" validate="false" />
|
||||
<add verb="*" path="*.soap" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting, Culture=neutral, PublicKeyToken=b77a5c561934e089" validate="false" />
|
||||
<add verb="GET,HEAD" path="*" type="System.Web.StaticFileHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*" type="System.Web.HttpMethodNotAllowedHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
</httpHandlers>
|
||||
<httpModules>
|
||||
<add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add name="Session" type="System.Web.SessionState.SessionStateModule, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add name="OutputCache" type="System.Web.Caching.OutputCacheModule, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
</httpModules>
|
||||
<authentication mode="Forms">
|
||||
<forms name=".MONOAUTH" loginUrl="login.aspx" protection="All" timeout="30" path="/">
|
||||
<credentials passwordFormat="Clear">
|
||||
<!--<user name="gonzalo" password="gonz"/>-->
|
||||
</credentials>
|
||||
</forms>
|
||||
</authentication>
|
||||
<machineKey validationKey="AutoGenerate" decryptionKey="AutoGenerate" validation="SHA1" />
|
||||
<globalization requestEncoding="utf-8"
|
||||
responseEncoding="utf-8"
|
||||
fileEncoding="utf-8"/>
|
||||
<!--
|
||||
culture="en-US"
|
||||
uiculture="en-US" />
|
||||
-->
|
||||
<sessionState mode="InProc" />
|
||||
<webServices>
|
||||
<protocols>
|
||||
<add name="HttpSoap"/>
|
||||
<add name="HttpPost"/>
|
||||
<add name="HttpGet"/>
|
||||
<add name="Documentation"/>
|
||||
</protocols>
|
||||
<wsdlHelpGenerator href="DefaultWsdlHelpGenerator.aspx" />
|
||||
</webServices>
|
||||
<webControls clientScriptsLocation="/web_scripts" />
|
||||
<compilation debug="false" defaultLanguage="c#" explicit="true" strict="false" >
|
||||
<compilers>
|
||||
<compiler language="cs;c#;csharp" extension=".cs" warningLevel="1" compilerOptions=""
|
||||
type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
|
||||
warningLevel="1" compilerOptions=""
|
||||
type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
</compilers>
|
||||
<assemblies>
|
||||
<!--<add assembly="mscorlib" /> -->
|
||||
<add assembly="System" />
|
||||
<add assembly="System.Xml" />
|
||||
<add assembly="System.Configuration" />
|
||||
<add assembly="System.Data" />
|
||||
<add assembly="System.Web" />
|
||||
<add assembly="System.Web.Services" />
|
||||
<add assembly="System.Drawing" />
|
||||
<add assembly="*" /> <!-- Add assemblies in bin directory -->
|
||||
</assemblies>
|
||||
</compilation>
|
||||
<httpRuntime executionTimeout="90"
|
||||
maxRequestLength="4096"
|
||||
useFullyQualifiedRedirectUrl="false"
|
||||
minFreeThreads="8"
|
||||
minLocalRequestFreeThreads="4"
|
||||
appRequestQueueLimit="100" />
|
||||
<clientTarget>
|
||||
<add alias="ie5" userAgent="Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0)" />
|
||||
<add alias="ie4" userAgent="Mozilla/4.0 (compatible; MSIE 4.0; Windows NT 4.0)" />
|
||||
<add alias="uplevel" userAgent="Mozilla/4.0 (compatible; MSIE 4.0; Windows NT 4.0)" />
|
||||
<add alias="downlevel" userAgent="Unknown" />
|
||||
</clientTarget>
|
||||
</system.web>
|
||||
|
||||
</configuration>
|
||||
+3
-25
@@ -1,26 +1,8 @@
|
||||
|
||||
Thu Feb 9 16:20:55 CET 2006 Paolo Molaro <[email protected]>
|
||||
Thu Feb 2 10:38:53 CET 2006 Paolo Molaro <[email protected]>
|
||||
|
||||
* os_dep.c, include/private/gcconfig.h, darwin_stop_world.c:
|
||||
OSX/x86 support, mostly from Geoff Norton <[email protected]>.
|
||||
|
||||
Wed Feb 1 18:23:55 CET 2006 Paolo Molaro <[email protected]>
|
||||
|
||||
* pthread_support.c, *: back out Zoltan's patch since it's
|
||||
incorrect.
|
||||
The correct fix it to execute the cleanup from inside
|
||||
the thread also when using the __thread var to access the
|
||||
current GC_thread.
|
||||
|
||||
2006-02-01 Zoltan Varga <[email protected]>
|
||||
|
||||
* pthread_support.c (GC_thread_deregister_foreign): New public API
|
||||
function to deregister a foreign thread from the GC.
|
||||
(GC_destroy_thread_local): Clean up the TLS key too.
|
||||
|
||||
Tue Jan 24 12:34:06 CET 2006 Paolo Molaro <[email protected]>
|
||||
|
||||
* *: update from upstream changes.
|
||||
* pthread_support.c: make sure the proper cleanup also happens
|
||||
when using __thread vars.
|
||||
|
||||
2006-01-21 Martin Baulig <[email protected]>
|
||||
|
||||
@@ -31,10 +13,6 @@ Tue Jan 24 12:34:06 CET 2006 Paolo Molaro <[email protected]>
|
||||
* include/libgc-mono-debugger.h: Call the conditional
|
||||
`_IN_THE_MONO_DEBUGGER', not `IN_MONO_DEBUGGER'.
|
||||
|
||||
2006-01-11 Zoltan Varga <[email protected]>
|
||||
|
||||
* include/private/gcconfig.h: Undef _FILE_OFFSET_BITS on sparc.
|
||||
|
||||
2006-01-03 Geoff Norton <[email protected]>
|
||||
|
||||
* darwin_stop_world.c: Merge a patch from Bruce Mitchener that fixes a small
|
||||
|
||||
+5
-36
@@ -41,7 +41,7 @@ asm_libgc_sources =
|
||||
endif
|
||||
|
||||
libmonogc_la_SOURCES = allchblk.c alloc.c blacklst.c checksums.c dbg_mlc.c \
|
||||
dyn_load.c finalize.c gc_dlopen.c gcj_mlc.c headers.c \
|
||||
dyn_load.c finalize.c gc_dlopen.c gcj_mlc.c headers.c aix_irix_threads.c \
|
||||
malloc.c mallocx.c mark.c mark_rts.c misc.c new_hblk.c \
|
||||
obj_map.c os_dep.c pcr_interface.c ptr_chck.c real_malloc.c reclaim.c \
|
||||
solaris_pthreads.c solaris_threads.c specific.c stubborn.c typd_mlc.c \
|
||||
@@ -49,9 +49,10 @@ backgraph.c win32_threads.c \
|
||||
pthread_support.c pthread_stop_world.c darwin_stop_world.c \
|
||||
$(asm_libgc_sources)
|
||||
|
||||
# Include THREADDLLIBS here to ensure that the correct versions of
|
||||
|
||||
# Include THREADLIBS here to ensure that the correct versions of
|
||||
# linuxthread semaphore functions get linked:
|
||||
libmonogc_la_LIBADD = @addobjs@ $(THREADDLLIBS) $(UNWINDLIBS)
|
||||
libmonogc_la_LIBADD = @addobjs@ $(THREADLIBS) $(UNWINDLIBS)
|
||||
libmonogc_la_DEPENDENCIES = @addobjs@
|
||||
libmonogc_la_LDFLAGS = -version-info 1:2:0
|
||||
|
||||
@@ -68,48 +69,16 @@ EXTRA_DIST += alpha_mach_dep.S mips_sgi_mach_dep.s sparc_mach_dep.S
|
||||
|
||||
AM_CFLAGS = @GC_CFLAGS@
|
||||
|
||||
if CPLUSPLUS
|
||||
extra_checks = test_cpp
|
||||
else
|
||||
extra_checks =
|
||||
endif
|
||||
|
||||
#check_PROGRAMS = gctest $(extra_checks)
|
||||
|
||||
#test.o: $(srcdir)/tests/test.c
|
||||
# $(COMPILE) -c $(srcdir)/tests/test.c
|
||||
# Using $< in the above seems to fail with the HP/UX on Itanium make.
|
||||
#test_cpp.o: $(srcdir)/tests/test_cpp.cc
|
||||
# $(CXXCOMPILE) -c $(srcdir)/tests/test_cpp.cc
|
||||
|
||||
## FIXME: this is probably the reason why some files from BUILT_SOURCES
|
||||
## are included in the distribution
|
||||
# gctest_OBJECTS = test.o
|
||||
#gctest_SOURCES = tests/test.c
|
||||
#gctest_LDADD = ./libgc.la $(THREADDLLIBS) $(UNWINDLIBS) $(EXTRA_TEST_LIBS)
|
||||
#test_cpp_SOURCES = tests/test_cpp.cc
|
||||
#test_cpp_LDADD = ./libgc.la ./libgccpp.la $(THREADDLLIBS) $(UNWINDLIBS) $(EXTRA_TEST_LIBS)
|
||||
|
||||
#TESTS = gctest $(extra_checks)
|
||||
|
||||
## FIXME: relies on internal code generated by automake.
|
||||
all_objs = @addobjs@ $(libgc_la_OBJECTS)
|
||||
$(all_objs) : include/private/gcconfig.h include/private/gc_priv.h \
|
||||
include/private/gc_hdrs.h include/gc.h include/gc_gcj.h include/gc_mark.h
|
||||
|
||||
## FIXME: we shouldn't have to do this, but automake forces us to.
|
||||
if COMPILER_XLC
|
||||
## XLC neither requires nor tolerates the unnecessary assembler goop
|
||||
ASM_CPP_OPTIONS =
|
||||
else
|
||||
## We use -Wp,-P to strip #line directives. Irix `as' chokes on
|
||||
## these.
|
||||
ASM_CPP_OPTIONS = -Wp,-P -x assembler-with-cpp
|
||||
endif
|
||||
.s.lo:
|
||||
## We use -Wp,-P to strip #line directives. Irix `as' chokes on
|
||||
## these.
|
||||
$(LTCOMPILE) $(ASM_CPP_OPTIONS) -c $<
|
||||
$(LTCOMPILE) -Wp,-P -x assembler-with-cpp -c $<
|
||||
|
||||
## We have our own definition of LTCOMPILE because we want to use our
|
||||
## CFLAGS, not those passed in from the top level make.
|
||||
|
||||
+9
-14
@@ -36,7 +36,7 @@ CFLAGS= -O -I$(srcdir)/include -DATOMIC_UNCOLLECTABLE -DNO_SIGNALS -DNO_EXECUTE_
|
||||
# -DGC_LINUX_THREADS -DPARALLEL_MARK -DTHREAD_LOCAL_ALLOC
|
||||
# To build the parallel collector in a static library on HP/UX,
|
||||
# add to the above:
|
||||
# -DGC_HPUX_THREADS -DPARALLEL_MARK -DTHREAD_LOCAL_ALLOC -D_POSIX_C_SOURCE=199506L -mt
|
||||
# -DGC_HPUX_THREADS -DPARALLEL_MARK -DTHREAD_LOCAL_ALLOC -D_POSIX_C_SOURCE=199506L
|
||||
# To build the thread-safe collector on Tru64, add to the above:
|
||||
# -pthread -DGC_OSF1_THREADS
|
||||
|
||||
@@ -70,11 +70,10 @@ HOSTCFLAGS=$(CFLAGS)
|
||||
# Also requires -D_REENTRANT or -D_POSIX_C_SOURCE=199506L. See README.hp.
|
||||
# -DGC_LINUX_THREADS enables support for Xavier Leroy's Linux threads.
|
||||
# see README.linux. -D_REENTRANT may also be required.
|
||||
# -DGC_OSF1_THREADS enables support for Tru64 pthreads.
|
||||
# -DGC_FREEBSD_THREADS enables support for FreeBSD pthreads.
|
||||
# -DGC_OSF1_THREADS enables support for Tru64 pthreads. Untested.
|
||||
# -DGC_FREEBSD_THREADS enables support for FreeBSD pthreads. Untested.
|
||||
# Appeared to run into some underlying thread problems.
|
||||
# -DGC_DARWIN_THREADS enables support for Mac OS X pthreads.
|
||||
# -DGC_AIX_THREADS enables support for IBM AIX threads.
|
||||
# -DGC_DARWIN_THREADS enables support for Mac OS X pthreads. Untested.
|
||||
# -DGC_DGUX386_THREADS enables support for DB/UX on I386 threads.
|
||||
# See README.DGUX386.
|
||||
# -DGC_WIN32_THREADS enables support for win32 threads. That makes sense
|
||||
@@ -234,8 +233,8 @@ HOSTCFLAGS=$(CFLAGS)
|
||||
# -DTHREAD_LOCAL_ALLOC defines GC_local_malloc(), GC_local_malloc_atomic()
|
||||
# and GC_local_gcj_malloc(). Needed for gc_gcj.h interface. These allocate
|
||||
# in a way that usually does not involve acquisition of a global lock.
|
||||
# Currently works only on platforms such as Linux which use pthread_support.c.
|
||||
# Recommended for multiprocessors.
|
||||
# Currently requires -DGC_LINUX_THREADS, but should be easy to port to
|
||||
# other pthreads environments. Recommended for multiprocessors.
|
||||
# -DUSE_COMPILER_TLS causes thread local allocation to use compiler-supported
|
||||
# "__thread" thread-local variables. This is the default in HP/UX. It
|
||||
# may help performance on recent Linux installations. (It failed for
|
||||
@@ -277,10 +276,6 @@ HOSTCFLAGS=$(CFLAGS)
|
||||
# -DPOINTER_SHIFT=n causes the collector to left shift candidate pointers
|
||||
# by the indicated amount before trying to interpret them. Applied
|
||||
# after POINTER_MASK. EXPERIMENTAL. See also the preceding macro.
|
||||
# -DDARWIN_DONT_PARSE_STACK Causes the Darwin port to discover thread
|
||||
# stack bounds in the same way as other pthread ports, without trying to
|
||||
# walk the frames onthe stack. This is recommended only as a fallback
|
||||
# for applications that don't support proper stack unwinding.
|
||||
#
|
||||
|
||||
CXXFLAGS= $(CFLAGS)
|
||||
@@ -288,9 +283,9 @@ AR= ar
|
||||
RANLIB= ranlib
|
||||
|
||||
|
||||
OBJS= alloc.o reclaim.o allchblk.o misc.o mach_dep.o os_dep.o mark_rts.o headers.o mark.o obj_map.o blacklst.o finalize.o new_hblk.o dbg_mlc.o malloc.o stubborn.o checksums.o solaris_threads.o pthread_support.o pthread_stop_world.o darwin_stop_world.o typd_mlc.o ptr_chck.o mallocx.o solaris_pthreads.o gcj_mlc.o specific.o gc_dlopen.o backgraph.o win32_threads.o
|
||||
OBJS= alloc.o reclaim.o allchblk.o misc.o mach_dep.o os_dep.o mark_rts.o headers.o mark.o obj_map.o blacklst.o finalize.o new_hblk.o dbg_mlc.o malloc.o stubborn.o checksums.o solaris_threads.o aix_irix_threads.o pthread_support.o pthread_stop_world.o darwin_stop_world.o typd_mlc.o ptr_chck.o mallocx.o solaris_pthreads.o gcj_mlc.o specific.o gc_dlopen.o backgraph.o win32_threads.o
|
||||
|
||||
CSRCS= reclaim.c allchblk.c misc.c alloc.c mach_dep.c os_dep.c mark_rts.c headers.c mark.c obj_map.c pcr_interface.c blacklst.c finalize.c new_hblk.c real_malloc.c dyn_load.c dbg_mlc.c malloc.c stubborn.c checksums.c solaris_threads.c pthread_support.c pthread_stop_world.c darwin_stop_world.c typd_mlc.c ptr_chck.c mallocx.c solaris_pthreads.c gcj_mlc.c specific.c gc_dlopen.c backgraph.c win32_threads.c
|
||||
CSRCS= reclaim.c allchblk.c misc.c alloc.c mach_dep.c os_dep.c mark_rts.c headers.c mark.c obj_map.c pcr_interface.c blacklst.c finalize.c new_hblk.c real_malloc.c dyn_load.c dbg_mlc.c malloc.c stubborn.c checksums.c solaris_threads.c aix_irix_threads.c pthread_support.c pthread_stop_world.c darwin_stop_world.c typd_mlc.c ptr_chck.c mallocx.c solaris_pthreads.c gcj_mlc.c specific.c gc_dlopen.c backgraph.c win32_threads.c
|
||||
|
||||
CORD_SRCS= cord/cordbscs.c cord/cordxtra.c cord/cordprnt.c cord/de.c cord/cordtest.c include/cord.h include/ec.h include/private/cord_pos.h cord/de_win.c cord/de_win.h cord/de_cmds.h cord/de_win.ICO cord/de_win.RC
|
||||
|
||||
@@ -329,7 +324,7 @@ DOC_FILES= README.QUICK doc/README.Mac doc/README.MacOSX doc/README.OS2 \
|
||||
doc/simple_example.html
|
||||
|
||||
TESTS= tests/test.c tests/test_cpp.cc tests/trace_test.c \
|
||||
tests/leak_test.c tests/thread_leak_test.c tests/middle.c
|
||||
tests/leak_test.c tests/thread_leak_test.c
|
||||
|
||||
GNU_BUILD_FILES= configure.in Makefile.am configure acinclude.m4 \
|
||||
libtool.m4 install-sh configure.host Makefile.in \
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Makefile for Windows NT. Assumes Microsoft compiler.
|
||||
# Makefile for Windows NT. Assumes Microsoft compiler, and a single thread.
|
||||
# DLLs are included in the root set under NT, but not under win32S.
|
||||
# Use "nmake nodebug=1 all" for optimized versions of library, gctest and editor.
|
||||
|
||||
|
||||
+10
-18
@@ -111,7 +111,7 @@ void GC_print_hblkfreelist()
|
||||
for (i = 0; i <= N_HBLK_FLS; ++i) {
|
||||
h = GC_hblkfreelist[i];
|
||||
# ifdef USE_MUNMAP
|
||||
if (0 != h) GC_printf1("Free list %ld:\n",
|
||||
if (0 != h) GC_printf1("Free list %ld (Total size %ld):\n",
|
||||
(unsigned long)i);
|
||||
# else
|
||||
if (0 != h) GC_printf2("Free list %ld (Total size %ld):\n",
|
||||
@@ -133,12 +133,10 @@ void GC_print_hblkfreelist()
|
||||
h = hhdr -> hb_next;
|
||||
}
|
||||
}
|
||||
# ifndef USE_MUNMAP
|
||||
if (total_free != GC_large_free_bytes) {
|
||||
if (total_free != GC_large_free_bytes) {
|
||||
GC_printf1("GC_large_free_bytes = %lu (INCONSISTENT!!)\n",
|
||||
(unsigned long) GC_large_free_bytes);
|
||||
}
|
||||
# endif
|
||||
}
|
||||
GC_printf1("Total of %lu bytes on free list\n", (unsigned long)total_free);
|
||||
}
|
||||
|
||||
@@ -183,7 +181,7 @@ void GC_dump_regions()
|
||||
hhdr = HDR(p);
|
||||
GC_printf1("\t0x%lx ", (unsigned long)p);
|
||||
if (IS_FORWARDING_ADDR_OR_NIL(hhdr)) {
|
||||
GC_printf1("Missing header!!(%ld)\n", hhdr);
|
||||
GC_printf1("Missing header!!\n", hhdr);
|
||||
p += HBLKSIZE;
|
||||
continue;
|
||||
}
|
||||
@@ -285,8 +283,8 @@ int n;
|
||||
GET_HDR(hhdr -> hb_prev, phdr);
|
||||
phdr -> hb_next = hhdr -> hb_next;
|
||||
}
|
||||
FREE_ASSERT(GC_free_bytes[index] >= hhdr -> hb_sz);
|
||||
INCR_FREE_BYTES(index, - (signed_word)(hhdr -> hb_sz));
|
||||
FREE_ASSERT(GC_free_bytes[index] >= 0);
|
||||
if (0 != hhdr -> hb_next) {
|
||||
hdr * nhdr;
|
||||
GC_ASSERT(!IS_FORWARDING_ADDR_OR_NIL(NHDR(hhdr)));
|
||||
@@ -470,11 +468,7 @@ int index;
|
||||
if (total_size == bytes) return h;
|
||||
rest = (struct hblk *)((word)h + bytes);
|
||||
rest_hdr = GC_install_header(rest);
|
||||
if (0 == rest_hdr) {
|
||||
/* This may be very bad news ... */
|
||||
WARN("Header allocation failed: Dropping block.\n", 0);
|
||||
return(0);
|
||||
}
|
||||
if (0 == rest_hdr) return(0);
|
||||
rest_hdr -> hb_sz = total_size - bytes;
|
||||
rest_hdr -> hb_flags = 0;
|
||||
# ifdef GC_ASSERTIONS
|
||||
@@ -590,9 +584,8 @@ int n;
|
||||
GET_HDR(hbp, hhdr);
|
||||
size_avail = hhdr->hb_sz;
|
||||
if (size_avail < size_needed) continue;
|
||||
if (size_avail != size_needed
|
||||
&& !GC_use_entire_heap
|
||||
&& !GC_dont_gc
|
||||
if (!GC_use_entire_heap
|
||||
&& size_avail != size_needed
|
||||
&& USED_HEAP_SIZE >= GC_requested_heapsize
|
||||
&& !TRUE_INCREMENTAL && GC_should_collect()) {
|
||||
# ifdef USE_MUNMAP
|
||||
@@ -609,8 +602,7 @@ int n;
|
||||
/* If we are deallocating lots of memory from */
|
||||
/* finalizers, fail and collect sooner rather */
|
||||
/* than later. */
|
||||
if (WORDS_TO_BYTES(GC_finalizer_mem_freed)
|
||||
> (GC_heapsize >> 4)) {
|
||||
if (GC_finalizer_mem_freed > (GC_heapsize >> 4)) {
|
||||
continue;
|
||||
}
|
||||
# endif /* !USE_MUNMAP */
|
||||
@@ -700,7 +692,7 @@ int n;
|
||||
struct hblk * h;
|
||||
struct hblk * prev = hhdr -> hb_prev;
|
||||
|
||||
GC_words_wasted += BYTES_TO_WORDS(total_size);
|
||||
GC_words_wasted += total_size;
|
||||
GC_large_free_bytes -= total_size;
|
||||
GC_remove_from_fl(hhdr, n);
|
||||
for (h = hbp; h < limit; h++) {
|
||||
|
||||
+11
-25
@@ -92,16 +92,6 @@ char * GC_copyright[] =
|
||||
|
||||
# include "version.h"
|
||||
|
||||
#if defined(SAVE_CALL_CHAIN) && \
|
||||
!(defined(REDIRECT_MALLOC) && defined(GC_HAVE_BUILTIN_BACKTRACE))
|
||||
# define SAVE_CALL_CHAIN_IN_GC
|
||||
/* This is only safe if the call chain save mechanism won't end up */
|
||||
/* calling GC_malloc. The GNU C library documentation suggests */
|
||||
/* that backtrace doesn't use malloc, but at least the initial */
|
||||
/* call in some versions does seem to invoke the dynamic linker, */
|
||||
/* which uses malloc. */
|
||||
#endif
|
||||
|
||||
/* some more variables */
|
||||
|
||||
extern signed_word GC_mem_found; /* Number of reclaimed longwords */
|
||||
@@ -114,6 +104,8 @@ word GC_free_space_divisor = 3;
|
||||
extern GC_bool GC_collection_in_progress();
|
||||
/* Collection is in progress, or was abandoned. */
|
||||
|
||||
extern GC_bool GC_print_back_height;
|
||||
|
||||
int GC_never_stop_func GC_PROTO((void)) { return(0); }
|
||||
|
||||
unsigned long GC_time_limit = TIME_LIMIT;
|
||||
@@ -141,7 +133,7 @@ int GC_n_attempts = 0; /* Number of attempts at finishing */
|
||||
if (GC_print_stats) {
|
||||
GC_printf0("Abandoning stopped marking after ");
|
||||
GC_printf1("%lu msecs", (unsigned long)time_diff);
|
||||
GC_printf1("(attempt %ld)\n", (unsigned long) GC_n_attempts);
|
||||
GC_printf1("(attempt %d)\n", (unsigned long) GC_n_attempts);
|
||||
}
|
||||
# endif
|
||||
return(1);
|
||||
@@ -206,8 +198,7 @@ word GC_adj_words_allocd()
|
||||
/* had been reallocated this round. Finalization is user */
|
||||
/* visible progress. And if we don't count this, we have */
|
||||
/* stability problems for programs that finalize all objects. */
|
||||
if ((GC_words_wasted >> 3) < result)
|
||||
result += GC_words_wasted;
|
||||
result += GC_words_wasted;
|
||||
/* This doesn't reflect useful work. But if there is lots of */
|
||||
/* new fragmentation, the same is probably true of the heap, */
|
||||
/* and the collection will be correspondingly cheaper. */
|
||||
@@ -232,8 +223,6 @@ void GC_clear_a_few_frames()
|
||||
{
|
||||
# define NWORDS 64
|
||||
word frames[NWORDS];
|
||||
/* Some compilers will warn that frames was set but never used. */
|
||||
/* That's the whole idea ... */
|
||||
register int i;
|
||||
|
||||
for (i = 0; i < NWORDS; i++) frames[i] = 0;
|
||||
@@ -310,7 +299,7 @@ void GC_maybe_gc()
|
||||
# endif
|
||||
if (GC_stopped_mark(GC_time_limit == GC_TIME_UNLIMITED?
|
||||
GC_never_stop_func : GC_timeout_stop_func)) {
|
||||
# ifdef SAVE_CALL_CHAIN_IN_GC
|
||||
# ifdef SAVE_CALL_CHAIN
|
||||
GC_save_callers(GC_last_stack);
|
||||
# endif
|
||||
GC_finish_collection();
|
||||
@@ -379,7 +368,7 @@ GC_stop_func stop_func;
|
||||
}
|
||||
GC_invalidate_mark_state(); /* Flush mark stack. */
|
||||
GC_clear_marks();
|
||||
# ifdef SAVE_CALL_CHAIN_IN_GC
|
||||
# ifdef SAVE_CALL_CHAIN
|
||||
GC_save_callers(GC_last_stack);
|
||||
# endif
|
||||
GC_is_full_gc = TRUE;
|
||||
@@ -434,7 +423,7 @@ int n;
|
||||
for (i = GC_deficit; i < GC_RATE*n; i++) {
|
||||
if (GC_mark_some((ptr_t)0)) {
|
||||
/* Need to finish a collection */
|
||||
# ifdef SAVE_CALL_CHAIN_IN_GC
|
||||
# ifdef SAVE_CALL_CHAIN
|
||||
GC_save_callers(GC_last_stack);
|
||||
# endif
|
||||
# ifdef PARALLEL_MARK
|
||||
@@ -971,7 +960,7 @@ word n;
|
||||
# endif
|
||||
expansion_slop = WORDS_TO_BYTES(min_words_allocd()) + 4*MAXHINCR*HBLKSIZE;
|
||||
if (GC_last_heap_addr == 0 && !((word)space & SIGNB)
|
||||
|| (GC_last_heap_addr != 0 && GC_last_heap_addr < (ptr_t)space)) {
|
||||
|| GC_last_heap_addr != 0 && GC_last_heap_addr < (ptr_t)space) {
|
||||
/* Assume the heap is growing up */
|
||||
GC_greatest_plausible_heap_addr =
|
||||
(GC_PTR)GC_max((ptr_t)GC_greatest_plausible_heap_addr,
|
||||
@@ -1040,9 +1029,9 @@ word needed_blocks;
|
||||
GC_bool ignore_off_page;
|
||||
{
|
||||
if (!GC_incremental && !GC_dont_gc &&
|
||||
((GC_dont_expand && GC_words_allocd > 0)
|
||||
|| (GC_fo_entries > (last_fo_entries + 500) && (last_words_finalized || GC_words_finalized))
|
||||
|| GC_should_collect())) {
|
||||
(GC_dont_expand && GC_words_allocd > 0
|
||||
|| (GC_fo_entries > (last_fo_entries + 500) && (last_words_finalized || GC_words_finalized))
|
||||
|| GC_should_collect())) {
|
||||
GC_gcollect_inner();
|
||||
last_fo_entries = GC_fo_entries;
|
||||
last_words_finalized = GC_words_finalized;
|
||||
@@ -1053,9 +1042,6 @@ GC_bool ignore_off_page;
|
||||
if (blocks_to_get > MAXHINCR) {
|
||||
word slop;
|
||||
|
||||
/* Get the minimum required to make it likely that we */
|
||||
/* can satisfy the current request in the presence of black- */
|
||||
/* listing. This will probably be more than MAXHINCR. */
|
||||
if (ignore_off_page) {
|
||||
slop = 4;
|
||||
} else {
|
||||
|
||||
+13
-12
@@ -1,3 +1,4 @@
|
||||
# $Id$
|
||||
.arch ev6
|
||||
|
||||
.text
|
||||
@@ -11,13 +12,13 @@ GC_push_regs:
|
||||
.mask 0x04000000, 0
|
||||
.frame $sp, 16, $26, 0
|
||||
|
||||
/* $0 integer result */
|
||||
/* $1-$8 temp regs - not preserved cross calls */
|
||||
/* $9-$15 call saved regs */
|
||||
/* $16-$21 argument regs - not preserved cross calls */
|
||||
/* $22-$28 temp regs - not preserved cross calls */
|
||||
/* $29 global pointer - not preserved cross calls */
|
||||
/* $30 stack pointer */
|
||||
# $0 integer result
|
||||
# $1-$8 temp regs - not preserved cross calls
|
||||
# $9-$15 call saved regs
|
||||
# $16-$21 argument regs - not preserved cross calls
|
||||
# $22-$28 temp regs - not preserved cross calls
|
||||
# $29 global pointer - not preserved cross calls
|
||||
# $30 stack pointer
|
||||
|
||||
# define call_push(x) \
|
||||
mov x, $16; \
|
||||
@@ -32,12 +33,12 @@ GC_push_regs:
|
||||
call_push($14)
|
||||
call_push($15)
|
||||
|
||||
/* $f0-$f1 floating point results */
|
||||
/* $f2-$f9 call saved regs */
|
||||
/* $f10-$f30 temp regs - not preserved cross calls */
|
||||
# $f0-$f1 floating point results
|
||||
# $f2-$f9 call saved regs
|
||||
# $f10-$f30 temp regs - not preserved cross calls
|
||||
|
||||
/* Use the most efficient transfer method for this hardware. */
|
||||
/* Bit 1 detects the FIX extension, which includes ftoit. */
|
||||
# Use the most efficient transfer method for this hardware.
|
||||
# Bit 1 detects the FIX extension, which includes ftoit.
|
||||
amask 2, $0
|
||||
bne $0, $use_stack
|
||||
|
||||
|
||||
+12
-31
@@ -85,7 +85,7 @@ static back_edges * new_back_edges(void)
|
||||
{
|
||||
if (0 == back_edge_space) {
|
||||
back_edge_space = (back_edges *)
|
||||
GET_MEM(MAX_BACK_EDGE_STRUCTS*sizeof(back_edges));
|
||||
sbrk(MAX_BACK_EDGE_STRUCTS*sizeof(back_edges));
|
||||
}
|
||||
if (0 != avail_back_edges) {
|
||||
back_edges * result = avail_back_edges;
|
||||
@@ -113,31 +113,17 @@ static void deallocate_back_edges(back_edges *p)
|
||||
/* Table of objects that are currently on the depth-first search */
|
||||
/* stack. Only objects with in-degree one are in this table. */
|
||||
/* Other objects are identified using HEIGHT_IN_PROGRESS. */
|
||||
/* FIXME: This data structure NEEDS IMPROVEMENT. */
|
||||
#define INITIAL_IN_PROGRESS 10000
|
||||
/* This data structure NEEDS IMPROVEMENT. */
|
||||
#define MAX_IN_PROGRESS 10000
|
||||
static ptr_t * in_progress_space = 0;
|
||||
static size_t in_progress_size = 0;
|
||||
static size_t n_in_progress = 0;
|
||||
static int n_in_progress = 0;
|
||||
|
||||
static void push_in_progress(ptr_t p)
|
||||
{
|
||||
if (n_in_progress >= in_progress_size)
|
||||
if (in_progress_size == 0) {
|
||||
in_progress_size = INITIAL_IN_PROGRESS;
|
||||
in_progress_space = (ptr_t *)GET_MEM(in_progress_size * sizeof(ptr_t));
|
||||
} else {
|
||||
ptr_t * new_in_progress_space;
|
||||
in_progress_size *= 2;
|
||||
new_in_progress_space = (ptr_t *)
|
||||
GET_MEM(in_progress_size * sizeof(ptr_t));
|
||||
BCOPY(in_progress_space, new_in_progress_space,
|
||||
n_in_progress * sizeof(ptr_t));
|
||||
in_progress_space = new_in_progress_space;
|
||||
/* FIXME: This just drops the old space. */
|
||||
}
|
||||
if (in_progress_space == 0)
|
||||
ABORT("MAKE_BACK_GRAPH: Out of in-progress space: "
|
||||
"Huge linear data structure?");
|
||||
in_progress_space = sbrk(MAX_IN_PROGRESS * sizeof(ptr_t));
|
||||
if (n_in_progress == MAX_IN_PROGRESS)
|
||||
ABORT("Exceeded MAX_IN_PROGRESS");
|
||||
in_progress_space[n_in_progress++] = p;
|
||||
}
|
||||
|
||||
@@ -332,8 +318,8 @@ static void add_back_edges(ptr_t p, word n_words, word gc_descr)
|
||||
}
|
||||
}
|
||||
|
||||
/* Rebuild the representation of the backward reachability graph. */
|
||||
/* Does not examine mark bits. Can be called before GC. */
|
||||
/* Rebuild the reprentation of the backward reachability graph. */
|
||||
/* Does not examine mark bits. Can be called before GC. */
|
||||
void GC_build_back_graph(void)
|
||||
{
|
||||
GC_apply_to_each_object(add_back_edges);
|
||||
@@ -438,20 +424,15 @@ static void update_max_height(ptr_t p, word n_words, word gc_descr)
|
||||
}
|
||||
}
|
||||
|
||||
word GC_max_max_height = 0;
|
||||
|
||||
void GC_traverse_back_graph(void)
|
||||
{
|
||||
static word max_max_height = 0;
|
||||
GC_max_height = 0;
|
||||
GC_apply_to_each_object(update_max_height);
|
||||
}
|
||||
|
||||
void GC_print_back_graph_stats(void)
|
||||
{
|
||||
GC_printf2("Maximum backwards height of reachable objects at GC %lu is %ld\n",
|
||||
(unsigned long) GC_gc_no, GC_max_height);
|
||||
if (GC_max_height > GC_max_max_height) {
|
||||
GC_max_max_height = GC_max_height;
|
||||
if (GC_max_height > max_max_height) {
|
||||
max_max_height = GC_max_height;
|
||||
GC_printf0("The following unreachable object is last in a longest chain "
|
||||
"of unreachable objects:\n");
|
||||
GC_print_heap_obj(GC_deepest_obj);
|
||||
|
||||
+26
-37
@@ -15,9 +15,9 @@
|
||||
dnl Process this file with autoconf to produce configure.
|
||||
|
||||
AC_PREREQ(2.53)
|
||||
AC_INIT(libgc-mono, 6.6, [email protected])
|
||||
AC_INIT(libgc-mono, 6.3alpha6, [email protected])
|
||||
|
||||
AM_INIT_AUTOMAKE(libgc-mono, 6.6, no-define)
|
||||
AM_INIT_AUTOMAKE(libgc-mono, 6.2, no-define)
|
||||
|
||||
AC_CONFIG_SRCDIR(gcj_mlc.c)
|
||||
AC_CANONICAL_HOST
|
||||
@@ -67,15 +67,14 @@ AC_ARG_ENABLE(cplusplus,
|
||||
)
|
||||
|
||||
INCLUDES=-I${srcdir}/include
|
||||
THREADDLLIBS=
|
||||
## Libraries needed to support dynamic loading and/or threads.
|
||||
THREADLIBS=
|
||||
case "$THREADS" in
|
||||
no | none | single)
|
||||
THREADS=none
|
||||
;;
|
||||
posix | pthreads)
|
||||
THREADS=posix
|
||||
THREADDLLIBS=-lpthread
|
||||
THREADLIBS=-lpthread
|
||||
case "$host" in
|
||||
x86-*-linux* | ia64-*-linux* | i386-*-linux* | i486-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* | alpha-*-linux* | s390*-*-linux* | powerpc-*-linux*)
|
||||
AC_DEFINE(GC_LINUX_THREADS)
|
||||
@@ -101,7 +100,7 @@ case "$THREADS" in
|
||||
AC_DEFINE(PARALLEL_MARK)
|
||||
fi
|
||||
AC_DEFINE(THREAD_LOCAL_ALLOC)
|
||||
THREADDLLIBS="-lpthread -lrt"
|
||||
THREADLIBS="-lpthread -lrt"
|
||||
;;
|
||||
*-*-freebsd4*)
|
||||
AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")
|
||||
@@ -112,16 +111,22 @@ case "$THREADS" in
|
||||
INCLUDES="$INCLUDES $PTHREAD_CFLAGS"
|
||||
fi
|
||||
if test "x$PTHREAD_LIBS" = "x"; then
|
||||
THREADDLLIBS=-pthread
|
||||
THREADLIBS=-pthread
|
||||
else
|
||||
THREADDLLIBS=$PTHREAD_LIBS
|
||||
THREADLIBS=$PTHREAD_LIBS
|
||||
fi
|
||||
;;
|
||||
*-*-freebsd5*)
|
||||
AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")
|
||||
AC_DEFINE(GC_FREEBSD_THREADS)
|
||||
INCLUDES="$INCLUDES -pthread"
|
||||
THREADDLLIBS=-pthread
|
||||
if test "x$PTHREAD_CFLAGS" != "x"; then
|
||||
INCLUDES="$INCLUDES $PTHREAD_CFLAGS"
|
||||
fi
|
||||
if test "x$PTHREAD_LIBS" = "x"; then
|
||||
THREADLIBS=-pthread
|
||||
else
|
||||
THREADLIBS="$PTHREAD_LIBS"
|
||||
fi
|
||||
;;
|
||||
*-*-freebsd6*)
|
||||
AC_DEFINE(GC_FREEBSD_THREADS)
|
||||
@@ -129,9 +134,9 @@ case "$THREADS" in
|
||||
INCLUDES="$INCLUDES $PTHREAD_CFLAGS"
|
||||
fi
|
||||
if test "x$PTHREAD_LIBS" = "x"; then
|
||||
THREADDLLIBS=-pthread
|
||||
THREADLIBS=-pthread
|
||||
else
|
||||
THREADDLLIBS="$PTHREAD_LIBS"
|
||||
THREADLIBS="$PTHREAD_LIBS"
|
||||
fi
|
||||
;;
|
||||
*-*-solaris*)
|
||||
@@ -160,10 +165,7 @@ case "$THREADS" in
|
||||
# Measurements havent yet been done.
|
||||
fi
|
||||
INCLUDES="$INCLUDES -pthread"
|
||||
THREADDLLIBS="-lpthread -lrt"
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR("Pthreads not supported by the GC on this platform.")
|
||||
THREADLIBS="-lpthread -lrt"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
@@ -177,9 +179,9 @@ case "$THREADS" in
|
||||
;;
|
||||
dgux386)
|
||||
THREADS=dgux386
|
||||
AC_MSG_RESULT($THREADDLLIBS)
|
||||
AC_MSG_RESULT($THREADLIBS)
|
||||
# Use pthread GCC switch
|
||||
THREADDLLIBS=-pthread
|
||||
THREADLIBS=-pthread
|
||||
if test "${enable_parallel_mark}" = yes; then
|
||||
AC_DEFINE(PARALLEL_MARK)
|
||||
fi
|
||||
@@ -191,7 +193,7 @@ case "$THREADS" in
|
||||
;;
|
||||
aix)
|
||||
THREADS=posix
|
||||
THREADDLLIBS=-lpthread
|
||||
THREADLIBS=-lpthread
|
||||
AC_DEFINE(GC_AIX_THREADS)
|
||||
AC_DEFINE(_REENTRANT)
|
||||
;;
|
||||
@@ -202,7 +204,7 @@ case "$THREADS" in
|
||||
AC_MSG_ERROR($THREADS is an unknown thread package)
|
||||
;;
|
||||
esac
|
||||
AC_SUBST(THREADDLLIBS)
|
||||
AC_SUBST(THREADLIBS)
|
||||
|
||||
case "$host" in
|
||||
powerpc-*-darwin*)
|
||||
@@ -211,25 +213,12 @@ case "$host" in
|
||||
esac
|
||||
AM_CONDITIONAL(POWERPC_DARWIN,test x$powerpc_darwin = xtrue)
|
||||
|
||||
AC_MSG_CHECKING(for xlc)
|
||||
AC_TRY_COMPILE([],[
|
||||
#ifndef __xlC__
|
||||
# error
|
||||
#endif
|
||||
], [compiler_xlc=yes], [compiler_xlc=no])
|
||||
AC_MSG_RESULT($compiler_xlc)
|
||||
AM_CONDITIONAL(COMPILER_XLC,test $compiler_xlc = yes)
|
||||
if test $compiler_xlc = yes -a "$powerpc_darwin" = true; then
|
||||
# the darwin stack-frame-walking code is completely broken on xlc
|
||||
AC_DEFINE(DARWIN_DONT_PARSE_STACK)
|
||||
fi
|
||||
|
||||
# We never want libdl on darwin. It is a fake libdl that just ends up making
|
||||
# dyld calls anyway
|
||||
case "$host" in
|
||||
*-*-darwin*) ;;
|
||||
*)
|
||||
AC_CHECK_LIB(dl, dlopen, THREADDLLIBS="$THREADDLLIBS -ldl")
|
||||
AC_CHECK_LIB(dl, dlopen, EXTRA_TEST_LIBS="$EXTRA_TEST_LIBS -ldl")
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -330,7 +319,7 @@ case "$host" in
|
||||
machdep="sparc_mach_dep.lo"
|
||||
AC_DEFINE(SUNOS53_SHARED_LIB)
|
||||
;;
|
||||
sparc*-sun-solaris2.*)
|
||||
sparc-sun-solaris2.*)
|
||||
machdep="sparc_mach_dep.lo"
|
||||
;;
|
||||
ia64-*-*)
|
||||
@@ -392,10 +381,10 @@ AC_MSG_RESULT($THREADS)
|
||||
|
||||
dnl As of 4.13a2, the collector will not properly work on Solaris when
|
||||
dnl built with gcc and -O. So we remove -O in the appropriate case.
|
||||
dnl Not needed anymore on Solaris.
|
||||
dnl
|
||||
AC_MSG_CHECKING(whether Solaris gcc optimization fix is necessary)
|
||||
case "$host" in
|
||||
*aix*)
|
||||
sparc-sun-solaris2*|*aix*)
|
||||
if test "$GCC" = yes; then
|
||||
AC_MSG_RESULT(yes)
|
||||
new_CFLAGS=
|
||||
|
||||
@@ -59,7 +59,7 @@ static int extract_conv_spec(CORD_pos source, char *buf,
|
||||
register int result = 0;
|
||||
register int current_number = 0;
|
||||
register int saw_period = 0;
|
||||
register int saw_number = 0;
|
||||
register int saw_number;
|
||||
register int chars_so_far = 0;
|
||||
register char current;
|
||||
|
||||
@@ -243,7 +243,7 @@ int CORD_vsprintf(CORD * out, CORD format, va_list args)
|
||||
char * str = va_arg(args, char *);
|
||||
register char c;
|
||||
|
||||
while ((c = *str++)) {
|
||||
while (c = *str++) {
|
||||
CORD_ec_append(result, c);
|
||||
}
|
||||
goto done;
|
||||
@@ -320,7 +320,7 @@ int CORD_vsprintf(CORD * out, CORD format, va_list args)
|
||||
if (buf != result[0].ec_bufptr) {
|
||||
register char c;
|
||||
|
||||
while ((c = *buf++)) {
|
||||
while (c = *buf++) {
|
||||
CORD_ec_append(result, c);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -221,7 +221,7 @@ void test_printf()
|
||||
if (CORD_cmp(result, result2) != 0)ABORT("CORD_sprintf goofed 5");
|
||||
}
|
||||
|
||||
int main()
|
||||
main()
|
||||
{
|
||||
# ifdef THINK_C
|
||||
printf("cordtest:\n");
|
||||
|
||||
+15
-129
@@ -12,33 +12,23 @@
|
||||
Page 50: "If a leaf procedure's red zone usage would exceed 224 bytes, then
|
||||
it must set up a stack frame just like routines that call other routines."
|
||||
*/
|
||||
#ifdef POWERPC
|
||||
# if CPP_WORDSZ == 32
|
||||
# define PPC_RED_ZONE_SIZE 224
|
||||
# elif CPP_WORDSZ == 64
|
||||
# define PPC_RED_ZONE_SIZE 320
|
||||
# endif
|
||||
#endif
|
||||
#define PPC_RED_ZONE_SIZE 224
|
||||
|
||||
/* Not 64-bit clean. Wait until Apple defines their 64-bit ABI */
|
||||
typedef struct StackFrame {
|
||||
unsigned long savedSP;
|
||||
unsigned long savedCR;
|
||||
unsigned long savedLR;
|
||||
unsigned long reserved[2];
|
||||
unsigned long savedRTOC;
|
||||
unsigned int savedSP;
|
||||
unsigned int savedCR;
|
||||
unsigned int savedLR;
|
||||
unsigned int reserved[2];
|
||||
unsigned int savedRTOC;
|
||||
} StackFrame;
|
||||
|
||||
unsigned long FindTopOfStack(unsigned int stack_start) {
|
||||
|
||||
unsigned int FindTopOfStack(unsigned int stack_start) {
|
||||
StackFrame *frame;
|
||||
|
||||
if (stack_start == 0) {
|
||||
# ifdef POWERPC
|
||||
# if CPP_WORDSZ == 32
|
||||
__asm__ volatile("lwz %0,0(r1)" : "=r" (frame));
|
||||
# else
|
||||
__asm__ volatile("ldz %0,0(r1)" : "=r" (frame));
|
||||
# endif
|
||||
# endif
|
||||
__asm__ volatile("lwz %0,0(r1)" : "=r" (frame));
|
||||
} else {
|
||||
frame = (StackFrame *)stack_start;
|
||||
}
|
||||
@@ -47,7 +37,7 @@ unsigned long FindTopOfStack(unsigned int stack_start) {
|
||||
/* GC_printf1("FindTopOfStack start at sp = %p\n", frame); */
|
||||
# endif
|
||||
do {
|
||||
if (frame->savedSP == 0) break;
|
||||
if (frame->savedSP == NULL) break;
|
||||
/* if there are no more stack frames, stop */
|
||||
|
||||
frame = (StackFrame*)frame->savedSP;
|
||||
@@ -63,108 +53,9 @@ unsigned long FindTopOfStack(unsigned int stack_start) {
|
||||
/* GC_printf1("FindTopOfStack finish at sp = %p\n", frame); */
|
||||
# endif
|
||||
|
||||
return (unsigned long)frame;
|
||||
return (unsigned int)frame;
|
||||
}
|
||||
|
||||
#ifdef DARWIN_DONT_PARSE_STACK
|
||||
void GC_push_all_stacks() {
|
||||
int i;
|
||||
kern_return_t r;
|
||||
GC_thread p;
|
||||
pthread_t me;
|
||||
ptr_t lo, hi;
|
||||
#if defined(POWERPC)
|
||||
ppc_thread_state_t state;
|
||||
#elif defined(I386)
|
||||
i386_thread_state_t state;
|
||||
#else
|
||||
# error FIXME for non-x86 || ppc architectures
|
||||
#endif
|
||||
mach_msg_type_number_t thread_state_count = MACHINE_THREAD_STATE_COUNT;
|
||||
|
||||
me = pthread_self();
|
||||
if (!GC_thr_initialized) GC_thr_init();
|
||||
|
||||
for(i=0;i<THREAD_TABLE_SZ;i++) {
|
||||
for(p=GC_threads[i];p!=0;p=p->next) {
|
||||
if(p -> flags & FINISHED) continue;
|
||||
if(pthread_equal(p->id,me)) {
|
||||
lo = GC_approx_sp();
|
||||
} else {
|
||||
/* Get the thread state (registers, etc) */
|
||||
r = thread_get_state(
|
||||
p->stop_info.mach_thread,
|
||||
MACHINE_THREAD_STATE,
|
||||
(natural_t*)&state,
|
||||
&thread_state_count);
|
||||
if(r != KERN_SUCCESS) ABORT("thread_get_state failed");
|
||||
|
||||
#if defined(I386)
|
||||
lo = state.esp;
|
||||
|
||||
GC_push_one(state.eax);
|
||||
GC_push_one(state.ebx);
|
||||
GC_push_one(state.ecx);
|
||||
GC_push_one(state.edx);
|
||||
GC_push_one(state.edi);
|
||||
GC_push_one(state.esi);
|
||||
GC_push_one(state.ebp);
|
||||
#elif defined(POWERPC)
|
||||
lo = (void*)(state.r1 - PPC_RED_ZONE_SIZE);
|
||||
|
||||
GC_push_one(state.r0);
|
||||
GC_push_one(state.r2);
|
||||
GC_push_one(state.r3);
|
||||
GC_push_one(state.r4);
|
||||
GC_push_one(state.r5);
|
||||
GC_push_one(state.r6);
|
||||
GC_push_one(state.r7);
|
||||
GC_push_one(state.r8);
|
||||
GC_push_one(state.r9);
|
||||
GC_push_one(state.r10);
|
||||
GC_push_one(state.r11);
|
||||
GC_push_one(state.r12);
|
||||
GC_push_one(state.r13);
|
||||
GC_push_one(state.r14);
|
||||
GC_push_one(state.r15);
|
||||
GC_push_one(state.r16);
|
||||
GC_push_one(state.r17);
|
||||
GC_push_one(state.r18);
|
||||
GC_push_one(state.r19);
|
||||
GC_push_one(state.r20);
|
||||
GC_push_one(state.r21);
|
||||
GC_push_one(state.r22);
|
||||
GC_push_one(state.r23);
|
||||
GC_push_one(state.r24);
|
||||
GC_push_one(state.r25);
|
||||
GC_push_one(state.r26);
|
||||
GC_push_one(state.r27);
|
||||
GC_push_one(state.r28);
|
||||
GC_push_one(state.r29);
|
||||
GC_push_one(state.r30);
|
||||
GC_push_one(state.r31);
|
||||
#else
|
||||
# error FIXME for non-x86 || ppc architectures
|
||||
#endif
|
||||
} /* p != me */
|
||||
if(p->flags & MAIN_THREAD)
|
||||
hi = GC_stackbottom;
|
||||
else
|
||||
hi = p->stack_end;
|
||||
#if DEBUG_THREADS
|
||||
GC_printf3("Darwin: Stack for thread 0x%lx = [%lx,%lx)\n",
|
||||
(unsigned long) p -> id,
|
||||
(unsigned long) lo,
|
||||
(unsigned long) hi
|
||||
);
|
||||
#endif
|
||||
GC_push_all_stack(lo,hi);
|
||||
} /* for(p=GC_threads[i]...) */
|
||||
} /* for(i=0;i<THREAD_TABLE_SZ...) */
|
||||
}
|
||||
|
||||
#else /* !DARWIN_DONT_PARSE_STACK; Use FindTopOfStack() */
|
||||
|
||||
void GC_push_all_stacks() {
|
||||
int i;
|
||||
kern_return_t r;
|
||||
@@ -184,12 +75,8 @@ void GC_push_all_stacks() {
|
||||
lo = GC_approx_sp();
|
||||
hi = (ptr_t)FindTopOfStack(0);
|
||||
} else {
|
||||
# if defined(POWERPC)
|
||||
# if CPP_WORDSZ == 32
|
||||
# ifdef POWERPC
|
||||
ppc_thread_state_t info;
|
||||
# else
|
||||
ppc_thread_state64_t info;
|
||||
# endif
|
||||
mach_msg_type_number_t outCount = THREAD_STATE_MAX;
|
||||
r = thread_get_state(thread, MACHINE_THREAD_STATE,
|
||||
(natural_t *)&info, &outCount);
|
||||
@@ -269,7 +156,6 @@ void GC_push_all_stacks() {
|
||||
} /* for(p=GC_threads[i]...) */
|
||||
vm_deallocate(current_task(), (vm_address_t)act_list, sizeof(thread_t) * listcount);
|
||||
}
|
||||
#endif /* !DARWIN_DONT_PARSE_STACK */
|
||||
|
||||
static mach_port_t GC_mach_handler_thread;
|
||||
static int GC_use_mach_handler_thread = 0;
|
||||
@@ -440,8 +326,6 @@ void GC_start_world()
|
||||
kern_return_t kern_result;
|
||||
thread_act_array_t act_list;
|
||||
mach_msg_type_number_t listcount;
|
||||
struct thread_basic_info info;
|
||||
mach_msg_type_number_t outCount = THREAD_INFO_MAX;
|
||||
|
||||
# if DEBUG_THREADS
|
||||
GC_printf0("World starting\n");
|
||||
@@ -468,6 +352,8 @@ void GC_start_world()
|
||||
# endif
|
||||
continue;
|
||||
}
|
||||
struct thread_basic_info info;
|
||||
mach_msg_type_number_t outCount = THREAD_INFO_MAX;
|
||||
kern_result = thread_info(thread, THREAD_BASIC_INFO,
|
||||
(thread_info_t)&info, &outCount);
|
||||
if(kern_result != KERN_SUCCESS) continue;
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ are GPL'ed, but with an exception that should cover all uses in the
|
||||
collector. (If you are concerned about such things, I recommend you look
|
||||
at the notice in config.guess or ltmain.sh.)
|
||||
|
||||
This is version 6.6 of a conservative garbage collector for C and C++.
|
||||
This is version 6.3alpha6 of a conservative garbage collector for C and C++.
|
||||
|
||||
You might find a more recent version of this at
|
||||
|
||||
|
||||
@@ -2076,175 +2076,7 @@ Since 6.3alpha5:
|
||||
- Remove ltconfig, clean up configure messages for DGUX (thanks to
|
||||
Adrian Bunk for the patches).
|
||||
- Integrated NetBSD/OpenBSD patches from Marc Recht and Matthias Drochner.
|
||||
|
||||
Since gc6.3alpha6:
|
||||
- Compile test_cpp.cc with CXXCOMPILE instead of COMPILE.
|
||||
- Very large allocations could cause a collector hang. Correct
|
||||
calculation of GC_collect_at_heapsize.
|
||||
- GC_print_hblkfreelist printed some bogus results if USE_MUNMAP
|
||||
was defined.
|
||||
- The generic GC_THREADS macro didn't work correctly on Solaris,
|
||||
since the implementation failed to include gc_config_macros.h
|
||||
before deciding whether or not to compile the rest of the file.
|
||||
- Threadlibs.c failed to expand the generic GC_THREADS macro.
|
||||
- Correct MacOSX thread stop code. (Thanks to Dick Porter.)
|
||||
- SMALL_OBJ definition was off by one. This could cause crashes
|
||||
at startup. (Thanks to Zoltan Varga for narrowing this down to
|
||||
a trivial test case.)
|
||||
- Integrate Paolo Molara's patch to deal with a race in the Darwin
|
||||
thread stopping code.
|
||||
- Changed X86_64 implementation to use SA_SIGINFO in the MPROTECT_VDB
|
||||
implementation. The old approach appears to have been broken by
|
||||
recent kernels.
|
||||
- Add GC_ATTR_UNUSED to eliminate a warning in gc_allocator.h. (Thanks
|
||||
to Andrew Begel.)
|
||||
- Fix GC_task_self declaration in os_dep.c. (Thanks to Andrew Pinski.)
|
||||
- Increase INITIAL_BUF_SZ in os_dep.c for Solaris /proc reads.
|
||||
|
||||
Since 6.3:
|
||||
- Merge gcconfig.h changes from gcc tree.
|
||||
- Unconditionally include gc_priv.h in solaris_pthreads.c, win32_threads.h,
|
||||
aix_irix_threads.c, and solaris_threads.c to get thread definitions.
|
||||
- Start marker threads in GC_thr_init, so that they get started even
|
||||
if no other threads are ever started. (Oddly enough, the parallel
|
||||
collector worked correctly, though not well, with no helper threads.)
|
||||
- Go ahead and split large blocks in GC_allochblk_nth if GC_dont_gc
|
||||
is set. (Thanks to Alexander Petrossian.)
|
||||
- GC_PRINT_BACK_HEIGHT would deadlock with thread support.
|
||||
- Let in_progress_space in backgraph.s grow dynamically.
|
||||
- Fix README.solaris2. The GC_thr_init() hack doesn't work anymore.
|
||||
- Convert GC_finalizer_mem_freed to bytes in allchblk.c.
|
||||
- Add missing declaration for GC_generic_malloc_words_small_inner.
|
||||
Without it, s390x breaks. (Thanks to Ulrich Weigand.)
|
||||
- Applied several MacOSX patches to support older tool chains.
|
||||
(Thanks to Stefan Ring.)
|
||||
- Bug fix for NetBSD/amd64. (Thanks to Marc Recht.) Add NetBSD/sh3
|
||||
support. (Thanks to Uchiyama Yasushi.)
|
||||
- Fixed an uninitialized variable in cordprnt.c. (Thanks to gcc for
|
||||
providing the warning.)
|
||||
- Eliminated some, but not all, gcc -Wall warnings.
|
||||
- Changed some old style casts to reinterpret_cast in new_gc_alloc.h.
|
||||
(Thanks to Dan Grayson.)
|
||||
- GC_extend_size_map shouldn't adjust for GC_all_interior_pointers if
|
||||
GC_DONT_ADD_BYTE_AT_END is set.
|
||||
- Changed some (long) casts to (word) in preparation for win64.
|
||||
(Thanks to Peter Colson.)
|
||||
- Changed "int stack_size" declaration in pthread_support.c to use
|
||||
size_t. (Only mattered with GC_ASSERTIONS enabled.)
|
||||
- Added CRIS (etrax) support. (Thanks to Simon Posnjak and
|
||||
Hans-Peter Nilsson.)
|
||||
- Removed GC_IGNORE_FB frame buffer recognition, and replaced
|
||||
it with a check that the mapping type is MEM_IMAGE.
|
||||
In theory, this should work much better, but it is a high
|
||||
risk change for win32. (Thanks to Ashley Bone for the crucial
|
||||
experimental data behind this, and to Rutger Ovidus for
|
||||
some further experiments.)
|
||||
- Fixed print_block_list to print the correct kind number for
|
||||
STUBBORN. (Thanks to Rutger Ovidus.)
|
||||
- GC_allochblk_nth incremented GC_words_wasted by bytes rather than
|
||||
words.
|
||||
- Consider GC_words_wasted in GC_adj_words_allocd only if it is within
|
||||
reason. (A hack to avoid some extremely unlikely scenarios in which
|
||||
we manage to allocate only "wasted" space. 7.0 has a better fix.)
|
||||
- Changed PowerPC GC_clear implementation to use lwsync instead of
|
||||
eieio, since the documentation recommends against eieio, and
|
||||
it seems to be incorrect if the preceding memory op is a load.
|
||||
- Fixed print_block_list to print the correct kind number for
|
||||
STUBBORN. (Thanks to Rutger Ovidus.)
|
||||
- Have configure.in generate an error if it is asked to support
|
||||
pthreads, but doesn't know how to.
|
||||
- Added Kazuhiro Inaoka's patch for Renesas M32R support.
|
||||
- Have the GNU build mechanism link with -ldl. Rename THREADLIBS
|
||||
to THREADDLLIBS to reflect this. (Thanks to Sven Verdoolaege.)
|
||||
- Added Hannes Mehnert's patch for FreeBSD/SPARC support.
|
||||
- Merged some FreeBSD specific patches to threadlibs.c and dyn_load.c.
|
||||
(Thanks tp John Merryweather Cooper.)
|
||||
- Define MPROTECT_VDB on MACOSX only if threads are being used, since the
|
||||
dirty page tracking mechanism uses threads. (This avoids an undefined
|
||||
reference to _GC_darwin_register_mach_handler_thread.)
|
||||
- By popular demand, use __libc symbols only if we are built with
|
||||
USE_LIBC_PRIVATES, which is off by default, and not otherwise documented.
|
||||
- Ignore GC_enable_incremental() requests when KEEP_BACK_PTRS is set.
|
||||
The GC itself will dirty lots of pages in this cases, probably making
|
||||
it counterproductive on all platforms. And the DARWIN port crashes.
|
||||
|
||||
Since GC6.4:
|
||||
- Integrated Paolo Molaro's patch to deal with EINTR in sem_wait.
|
||||
- Make GC_approx_sp() write to dummy location to ensure that stack
|
||||
is grown here, when sp looks reasonable, rather than later, when
|
||||
it might look like a bad memory reference. (Problem was never
|
||||
observed that I know of. But on rereading the code it seemed
|
||||
dubious.)
|
||||
- Separate out GC_with_callee_saves_pushed and sometimes call
|
||||
it from GC_suspend_handler in pthread_stop_world.c. Callee-save
|
||||
register values sometimes failed to get traced under HP/UX on
|
||||
PA-RISC. Linux/IA64 had the same problem, though non-stacked
|
||||
callee-save registers seem to be so rarely used there that nobody
|
||||
ever noticed.
|
||||
- Integrated an ancient Darwin powerpc_darwin_machine_dep.s patch
|
||||
from Andreas Tobler, which I had lost.
|
||||
- Fix compare_and_exchange implementation for gcc/IA64 to deal with
|
||||
pickier compiler versions.
|
||||
- Fixed Itanium 32-bit ABI support (HP/UX). In particular, the
|
||||
compare_and_exchange implementation didn't consider that possibility.
|
||||
- Undefine GC_pthread_detach in win32_threads.c. (Thanks to
|
||||
Tagliapietra Tommaso.)
|
||||
- Fixed inclusion of frame.h for NETBSD in os_dep.c.
|
||||
- Applied Dan Bonachea's patch to use mmap on AIX.
|
||||
- Several fixes to resurrect the Irix port on recent OS versions.
|
||||
- Change ALPHA to use LINUX_STACKBOTTOM.
|
||||
- Change SPARC64/LINUX to also use LINUX_STACKBOTTOM. Deal with potential
|
||||
bad values of __libc_stack_end on that platform. (Thanks to David Miller.)
|
||||
- Relax gctest to allow larger heap if ALIGN_DOUBLE isn't set.
|
||||
(Unnecessary in 7.0)
|
||||
- Force a define of __STDC__=0 for the IBM compiler on AIX, so that
|
||||
we get prototypes. (Unnecessary in 7.0)
|
||||
- GC_INIT definition for AIX and CYGWIN referred to DATASTART and DATAEND
|
||||
which are only defined in private include files.
|
||||
- Integrated some small gcconfig.h patches from Dan Bonachea. Also
|
||||
relaxed assertion about FreeBSD stack size in pthread_support.c.
|
||||
- Integrated Andrew Begel's darwin_stop_world.c patch for 64-bit
|
||||
support. This may need additional work.
|
||||
- Avoided potentially infinite recursion in GC_save_callers if
|
||||
the system backtrace calls malloc. The workaround currently requires
|
||||
__thread support if this code is used with threads.
|
||||
- Avoided another similar infinite recursion by conditionally
|
||||
invoking GC_save_callers in alloc.c. (Thanks to Matthias Andree
|
||||
for helping to track down both of these.)
|
||||
- Removed all traces of aix_irix_threads.c. AIX and Irix now use
|
||||
pthread_support.c and pthread_stop_world.c. The old code appeared
|
||||
to be unreliable for AIX, and was not regularly maintained.
|
||||
- On Irix, ignore segments with MA_FETCHOP or MA_NOTCACHED attributed;
|
||||
they're not always safe to read.
|
||||
- Fixed a previously vacuous assertion (diagnosed by the SGI compiler)
|
||||
in GC_remove_from_fl.
|
||||
- Fix stack_size assertion in GC_pthread_create.
|
||||
- Fix assertion in GC_steal_mark_stack.
|
||||
|
||||
Since 6.5
|
||||
- Fix CPU count detection for Irix and FreeBSD. (Thanks to Dan Bonachea.)
|
||||
- Integrate Dan Bonachea's patch for the IBM XLC compiler on Darwin.
|
||||
- Integrated Andreas Tobler's FreeBSD/PowerPC patch.
|
||||
- Don't access the GC thread structure from the restart handler. It's
|
||||
unsafe, since the handler may run too late. (Thanks to Ben Maurer for
|
||||
tracking this down.)
|
||||
- Applied Christian Thalinger's patch to change comment syntax in
|
||||
alpha_mach_dep.S.
|
||||
- Added test for GC_no_dls in GC_dyld_image_add for DARWIN. (Thanks to
|
||||
Juan Jose Garcia Ripoli).
|
||||
- Use LINUX_STACKBOTTOM for Linux/SH and LINUX/ARM. (Thanks to Sugioka
|
||||
Toshinobu and Christian Thalinger.)
|
||||
- Rewrote GC_parse_map_entry. This assumed a fixed column layout of
|
||||
/proc/self/maps on Linux. This ceased to be true about 2 years ago.
|
||||
The old code is probably quite problemetic with -DREDIRECT_MALLOC. It
|
||||
is also used by default for IA64, though I haven't seen actual failures
|
||||
there.
|
||||
- More consistently define HBLKSIZE to 4096 on 64 bit architectures with
|
||||
4K pages. (Thanks to Andrew Haley.)
|
||||
- With win32 threads, GC_stop_world needs to acquire GC_write_cs. (Thanks
|
||||
to Ben Hutchings for the observation and patch.)
|
||||
- Move up struct callinfo declaration to make gcc 4.0.2. happy.
|
||||
|
||||
To do:
|
||||
- The USE_MUNMAP code should really use a separate data structure
|
||||
indexed by physical page to keep track of time since last use of
|
||||
|
||||
@@ -1,16 +1,3 @@
|
||||
6.5 update:
|
||||
I disabled incremental GC on Darwin in this version, since I couldn't
|
||||
get gctest to pass when the GC was built as a dynamic library. Building
|
||||
with -DMPROTECT_VDB (and threads) on the command line should get you
|
||||
back to the old state. - HB
|
||||
|
||||
./configure --enable-cplusplus results in a "make check" failure, probably
|
||||
because the ::delete override ends up in a separate dl, and Darwin dynamic
|
||||
loader semantics appear to be such that this is not really visible to the
|
||||
main program, unlike on ELF systems. Someone who understands dynamic
|
||||
loading needs to lookat this. For now, gc_cpp.o needs to be linked
|
||||
statically, if needed. - HB
|
||||
|
||||
Darwin/MacOSX Support - December 16, 2003
|
||||
=========================================
|
||||
|
||||
|
||||
@@ -115,7 +115,6 @@ GC_IGNORE_FB[=<n>] - (Win32 only.) Try to avoid treating a mapped
|
||||
are never honored, eliminating this risk for most,
|
||||
but not all, applications. This feature is likely to disappear
|
||||
if/when we find a less disgusting "solution".
|
||||
IN VERSION 6.4 AND LATER, THIS SHOULD BE UNNECESSARY.
|
||||
|
||||
The following turn on runtime flags that are also program settable. Checked
|
||||
only during initialization. We expect that they will usually be set through
|
||||
|
||||
@@ -19,10 +19,10 @@ Linux threads. These should not be touched by the client program.
|
||||
|
||||
To use threads, you need to abide by the following requirements:
|
||||
|
||||
1) You need to use LinuxThreads or NPTL (which are included in libc6).
|
||||
1) You need to use LinuxThreads (which are included in libc6).
|
||||
|
||||
The collector relies on some implementation details of the LinuxThreads
|
||||
package. This code may not work on other
|
||||
package. It is unlikely that this code will work on other
|
||||
pthread implementations (in particular it will *not* work with
|
||||
MIT pthreads).
|
||||
|
||||
|
||||
@@ -43,7 +43,9 @@ can result in unpleasant heap growth. But it seems better than the
|
||||
race/deadlock issues we had before.
|
||||
|
||||
If solaris_threads are used on an X86 processor with malloc redirected to
|
||||
GC_malloc a deadlock is likely to result.
|
||||
GC_malloc, it is necessary to call GC_thr_init explicitly before forking the
|
||||
first thread. (This avoids a deadlock arising from calling GC_thr_init
|
||||
with the allocation lock held.)
|
||||
|
||||
It appears that there is a problem in using gc_cpp.h in conjunction with
|
||||
Solaris threads and Sun's C++ runtime. Apparently the overloaded new operator
|
||||
|
||||
+31
-48
@@ -96,7 +96,7 @@
|
||||
/* Newer versions of GNU/Linux define this macro. We
|
||||
* define it similarly for any ELF systems that don't. */
|
||||
# ifndef ElfW
|
||||
# if defined(FREEBSD)
|
||||
# ifdef FREEBSD
|
||||
# if __ELF_WORD_SIZE == 32
|
||||
# define ElfW(type) Elf32_##type
|
||||
# else
|
||||
@@ -114,7 +114,7 @@
|
||||
# define ElfW(type) Elf32_##type
|
||||
# else
|
||||
# define ElfW(type) Elf64_##type
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
@@ -493,6 +493,7 @@ static struct link_map *
|
||||
GC_FirstDLOpenedLinkMap()
|
||||
{
|
||||
ElfW(Dyn) *dp;
|
||||
struct r_debug *r;
|
||||
static struct link_map *cachedResult = 0;
|
||||
|
||||
if( _DYNAMIC == 0) {
|
||||
@@ -501,12 +502,6 @@ GC_FirstDLOpenedLinkMap()
|
||||
if( cachedResult == 0 ) {
|
||||
int tag;
|
||||
for( dp = _DYNAMIC; (tag = dp->d_tag) != 0; dp++ ) {
|
||||
/* FIXME: The DT_DEBUG header is not mandated by the */
|
||||
/* ELF spec. This code appears to be dependent on */
|
||||
/* idiosynchracies of older GNU tool chains. If this code */
|
||||
/* fails for you, the real problem is probably that it is */
|
||||
/* being used at all. You should be getting the */
|
||||
/* dl_iterate_phdr version. */
|
||||
if( tag == DT_DEBUG ) {
|
||||
struct link_map *lm
|
||||
= ((struct r_debug *)(dp->d_un.d_ptr))->r_map;
|
||||
@@ -631,8 +626,7 @@ void GC_register_dynamic_libraries()
|
||||
}
|
||||
for (i = 0; i < needed_sz; i++) {
|
||||
flags = addr_map[i].pr_mflags;
|
||||
if ((flags & (MA_BREAK | MA_STACK | MA_PHYS
|
||||
| MA_FETCHOP | MA_NOTCACHED)) != 0) goto irrelevant;
|
||||
if ((flags & (MA_BREAK | MA_STACK | MA_PHYS)) != 0) goto irrelevant;
|
||||
if ((flags & (MA_READ | MA_WRITE)) != (MA_READ | MA_WRITE))
|
||||
goto irrelevant;
|
||||
/* The latter test is empirically useless in very old Irix */
|
||||
@@ -754,10 +748,6 @@ void GC_register_dynamic_libraries()
|
||||
|
||||
# define HAVE_REGISTER_MAIN_STATIC_DATA
|
||||
|
||||
/* The frame buffer testing code is dead in this version. */
|
||||
/* We leave it here temporarily in case the switch to just */
|
||||
/* testing for MEM_IMAGE sections causes un expected */
|
||||
/* problems. */
|
||||
GC_bool GC_warn_fb = TRUE; /* Warn about traced likely */
|
||||
/* graphics memory. */
|
||||
GC_bool GC_disallow_ignore_fb = FALSE;
|
||||
@@ -772,27 +762,25 @@ void GC_register_dynamic_libraries()
|
||||
|
||||
/* Should [start, start+len) be treated as a frame buffer */
|
||||
/* and ignored? */
|
||||
/* Unfortunately, we currently are not quite sure how to tell */
|
||||
/* this automatically, and rely largely on user input. */
|
||||
/* We expect that any mapping with type MEM_MAPPED (which */
|
||||
/* apparently excludes library data sections) can be safely */
|
||||
/* ignored. But we're too chicken to do that in this */
|
||||
/* version. */
|
||||
/* Unfortunately, we currently have no real way to tell */
|
||||
/* automatically, and rely largely on user input. */
|
||||
/* FIXME: If we had more data on this phenomenon (e.g. */
|
||||
/* is start aligned to a MB multiple?) we should be able to */
|
||||
/* do better. */
|
||||
/* Based on a very limited sample, it appears that: */
|
||||
/* - Frame buffer mappings appear as mappings of large */
|
||||
/* length, usually a bit less than a power of two. */
|
||||
/* - The definition of "a bit less" in the above cannot */
|
||||
/* be made more precise. */
|
||||
/* - Have a starting address at best 64K aligned. */
|
||||
/* - Have type == MEM_MAPPED. */
|
||||
static GC_bool is_frame_buffer(ptr_t start, size_t len, DWORD tp)
|
||||
/* - Frame buffer mappings appear as mappings of length */
|
||||
/* 2**n MB - 192K. (We guess the 192K can vary a bit.) */
|
||||
/* - Have a stating address at best 64K aligned. */
|
||||
/* I'd love more information about the mapping, since I */
|
||||
/* can't reproduce the problem. */
|
||||
static GC_bool is_frame_buffer(ptr_t start, size_t len)
|
||||
{
|
||||
static GC_bool initialized = FALSE;
|
||||
# define MB (1024*1024)
|
||||
# define DEFAULT_FB_MB 15
|
||||
# define MIN_FB_MB 3
|
||||
|
||||
if (GC_disallow_ignore_fb || tp != MEM_MAPPED) return FALSE;
|
||||
if (GC_disallow_ignore_fb) return FALSE;
|
||||
if (!initialized) {
|
||||
char * ignore_fb_string = GETENV("GC_IGNORE_FB");
|
||||
|
||||
@@ -881,11 +869,7 @@ void GC_register_dynamic_libraries()
|
||||
&& (protect == PAGE_EXECUTE_READWRITE
|
||||
|| protect == PAGE_READWRITE)
|
||||
&& !GC_is_heap_base(buf.AllocationBase)
|
||||
/* This used to check for
|
||||
* !is_frame_buffer(p, buf.RegionSize, buf.Type)
|
||||
* instead of just checking for MEM_IMAGE.
|
||||
* If something breaks, change it back. */
|
||||
&& buf.Type == MEM_IMAGE) {
|
||||
&& !is_frame_buffer(p, buf.RegionSize)) {
|
||||
# ifdef DEBUG_VIRTUALQUERY
|
||||
GC_dump_meminfo(&buf);
|
||||
# endif
|
||||
@@ -1141,22 +1125,21 @@ static const char *GC_dyld_name_for_hdr(struct mach_header *hdr) {
|
||||
static void GC_dyld_image_add(struct mach_header* hdr, unsigned long slide) {
|
||||
unsigned long start,end,i;
|
||||
const struct section *sec;
|
||||
if (GC_no_dls) return;
|
||||
for(i=0;i<sizeof(GC_dyld_sections)/sizeof(GC_dyld_sections[0]);i++) {
|
||||
sec = getsectbynamefromheader(
|
||||
hdr,GC_dyld_sections[i].seg,GC_dyld_sections[i].sect);
|
||||
if(sec == NULL || sec->size == 0) continue;
|
||||
start = slide + sec->addr;
|
||||
end = start + sec->size;
|
||||
# ifdef DARWIN_DEBUG
|
||||
GC_printf4("Adding section at %p-%p (%lu bytes) from image %s\n",
|
||||
if(sec == NULL || sec->size == 0) continue;
|
||||
start = slide + sec->addr;
|
||||
end = start + sec->size;
|
||||
# ifdef DARWIN_DEBUG
|
||||
GC_printf4("Adding section at %p-%p (%lu bytes) from image %s\n",
|
||||
start,end,sec->size,GC_dyld_name_for_hdr(hdr));
|
||||
# endif
|
||||
# endif
|
||||
GC_add_roots((char*)start,(char*)end);
|
||||
}
|
||||
# ifdef DARWIN_DEBUG
|
||||
GC_print_static_roots();
|
||||
# endif
|
||||
}
|
||||
# ifdef DARWIN_DEBUG
|
||||
GC_print_static_roots();
|
||||
# endif
|
||||
}
|
||||
|
||||
/* This should never be called by a thread holding the lock */
|
||||
@@ -1169,15 +1152,15 @@ static void GC_dyld_image_remove(struct mach_header* hdr, unsigned long slide) {
|
||||
if(sec == NULL || sec->size == 0) continue;
|
||||
start = slide + sec->addr;
|
||||
end = start + sec->size;
|
||||
# ifdef DARWIN_DEBUG
|
||||
# ifdef DARWIN_DEBUG
|
||||
GC_printf4("Removing section at %p-%p (%lu bytes) from image %s\n",
|
||||
start,end,sec->size,GC_dyld_name_for_hdr(hdr));
|
||||
# endif
|
||||
GC_remove_roots((char*)start,(char*)end);
|
||||
}
|
||||
# ifdef DARWIN_DEBUG
|
||||
GC_print_static_roots();
|
||||
# endif
|
||||
# ifdef DARWIN_DEBUG
|
||||
GC_print_static_roots();
|
||||
# endif
|
||||
}
|
||||
|
||||
void GC_register_dynamic_libraries() {
|
||||
|
||||
+16
-17
@@ -807,21 +807,24 @@ void (* GC_finalizer_notifier)() = (void (*) GC_PROTO((void)))0;
|
||||
|
||||
static GC_word last_finalizer_notification = 0;
|
||||
|
||||
#ifdef KEEP_BACK_PTRS
|
||||
void GC_generate_random_backtrace_no_gc(void);
|
||||
#endif
|
||||
|
||||
void GC_notify_or_invoke_finalizers GC_PROTO((void))
|
||||
{
|
||||
/* This is a convenient place to generate backtraces if appropriate, */
|
||||
/* since that code is not callable with the allocation lock. */
|
||||
# if defined(KEEP_BACK_PTRS) || defined(MAKE_BACK_GRAPH)
|
||||
static word last_back_trace_gc_no = 1; /* Skip first one. */
|
||||
# ifdef KEEP_BACK_PTRS
|
||||
if (GC_backtraces > 0) {
|
||||
static word last_back_trace_gc_no = 3; /* Skip early ones. */
|
||||
long i;
|
||||
|
||||
if (GC_gc_no > last_back_trace_gc_no) {
|
||||
word i;
|
||||
|
||||
# ifdef KEEP_BACK_PTRS
|
||||
LOCK();
|
||||
LOCK();
|
||||
if (GC_gc_no > last_back_trace_gc_no) {
|
||||
/* Stops when GC_gc_no wraps; that's OK. */
|
||||
last_back_trace_gc_no = (word)(-1); /* disable others. */
|
||||
for (i = 0; i < GC_backtraces; ++i) {
|
||||
last_back_trace_gc_no = (word)(-1); /* disable others. */
|
||||
for (i = 0; i < GC_backtraces; ++i) {
|
||||
/* FIXME: This tolerates concurrent heap mutation, */
|
||||
/* which may cause occasional mysterious results. */
|
||||
/* We need to release the GC lock, since GC_print_callers */
|
||||
@@ -829,14 +832,10 @@ void GC_notify_or_invoke_finalizers GC_PROTO((void))
|
||||
UNLOCK();
|
||||
GC_generate_random_backtrace_no_gc();
|
||||
LOCK();
|
||||
}
|
||||
last_back_trace_gc_no = GC_gc_no;
|
||||
UNLOCK();
|
||||
# endif
|
||||
# ifdef MAKE_BACK_GRAPH
|
||||
if (GC_print_back_height)
|
||||
GC_print_back_graph_stats();
|
||||
# endif
|
||||
}
|
||||
last_back_trace_gc_no = GC_gc_no;
|
||||
}
|
||||
UNLOCK();
|
||||
}
|
||||
# endif
|
||||
if (GC_finalize_now == 0) return;
|
||||
|
||||
+1
-1
@@ -206,7 +206,7 @@ register struct hblk * h;
|
||||
{
|
||||
hdr * result;
|
||||
|
||||
if (!get_index((word) h)) return(0);
|
||||
if (!get_index((word) h)) return(FALSE);
|
||||
result = alloc_hdr();
|
||||
SET_HDR(h, result);
|
||||
# ifdef USE_MUNMAP
|
||||
|
||||
+6
-29
@@ -32,7 +32,7 @@
|
||||
|
||||
# include "gc_config_macros.h"
|
||||
|
||||
# if defined(__STDC__) || defined(__cplusplus) || defined(_AIX)
|
||||
# if defined(__STDC__) || defined(__cplusplus)
|
||||
# define GC_PROTO(args) args
|
||||
typedef void * GC_PTR;
|
||||
# define GC_CONST const
|
||||
@@ -207,7 +207,7 @@ GC_API GC_word GC_free_space_divisor;
|
||||
/* least N/GC_free_space_divisor bytes between */
|
||||
/* collections, where N is the heap size plus */
|
||||
/* a rough estimate of the root set size. */
|
||||
/* Initially, GC_free_space_divisor = 3. */
|
||||
/* Initially, GC_free_space_divisor = 4. */
|
||||
/* Increasing its value will use less space */
|
||||
/* but more collection time. Decreasing it */
|
||||
/* will appreciably decrease collection time */
|
||||
@@ -324,9 +324,6 @@ GC_API void GC_end_stubborn_change GC_PROTO((GC_PTR));
|
||||
/* the base of the user object. */
|
||||
/* Return 0 if displaced_pointer doesn't point to within a valid */
|
||||
/* object. */
|
||||
/* Note that a deallocated object in the garbage collected heap */
|
||||
/* may be considered valid, even if it has been deallocated with */
|
||||
/* GC_free. */
|
||||
GC_API GC_PTR GC_base GC_PROTO((GC_PTR displaced_pointer));
|
||||
|
||||
/* Given a pointer to the base of an object, return its size in bytes. */
|
||||
@@ -867,7 +864,7 @@ GC_API int GC_thread_is_registered GC_PROTO((void));
|
||||
|
||||
/* Safer assignment of a pointer to a nonstack location. */
|
||||
#ifdef GC_DEBUG
|
||||
# if defined(__STDC__) || defined(_AIX)
|
||||
# ifdef __STDC__
|
||||
# define GC_PTR_STORE(p, q) \
|
||||
(*(void **)GC_is_visible(p) = GC_is_valid_displacement(q))
|
||||
# else
|
||||
@@ -958,7 +955,7 @@ extern void GC_thr_init(void); /* Needed for Solaris/X86 */
|
||||
* no-op and the collector self-initializes. But a number of platforms
|
||||
* make that too hard.
|
||||
*/
|
||||
#if (defined(sparc) || defined(__sparc)) && defined(sun)
|
||||
#if defined(sparc) || defined(__sparc)
|
||||
/*
|
||||
* If you are planning on putting
|
||||
* the collector in a SunOS 5 dynamic library, you need to call GC_INIT()
|
||||
@@ -968,32 +965,12 @@ extern void GC_thr_init(void); /* Needed for Solaris/X86 */
|
||||
# define GC_INIT() { extern end, etext; \
|
||||
GC_noop(&end, &etext); }
|
||||
#else
|
||||
# if defined(__CYGWIN32__) || defined (_AIX)
|
||||
# if defined(__CYGWIN32__) && defined(GC_DLL) || defined (_AIX)
|
||||
/*
|
||||
* Similarly gnu-win32 DLLs need explicit initialization from
|
||||
* the main program, as does AIX.
|
||||
*/
|
||||
# ifdef __CYGWIN32__
|
||||
extern int _data_start__[];
|
||||
extern int _data_end__[];
|
||||
extern int _bss_start__[];
|
||||
extern int _bss_end__[];
|
||||
# define GC_MAX(x,y) ((x) > (y) ? (x) : (y))
|
||||
# define GC_MIN(x,y) ((x) < (y) ? (x) : (y))
|
||||
# define GC_DATASTART ((GC_PTR) GC_MIN(_data_start__, _bss_start__))
|
||||
# define GC_DATAEND ((GC_PTR) GC_MAX(_data_end__, _bss_end__))
|
||||
# ifdef GC_DLL
|
||||
# define GC_INIT() { GC_add_roots(GC_DATASTART, GC_DATAEND); }
|
||||
# else
|
||||
# define GC_INIT()
|
||||
# endif
|
||||
# endif
|
||||
# if defined(_AIX)
|
||||
extern int _data[], _end[];
|
||||
# define GC_DATASTART ((GC_PTR)((ulong)_data))
|
||||
# define GC_DATAEND ((GC_PTR)((ulong)_end))
|
||||
# define GC_INIT() { GC_add_roots(GC_DATASTART, GC_DATAEND); }
|
||||
# endif
|
||||
# define GC_INIT() { GC_add_roots(DATASTART, DATAEND); }
|
||||
# else
|
||||
# if defined(__APPLE__) && defined(__MACH__) || defined(GC_WIN32_THREADS)
|
||||
# define GC_INIT() { GC_init(); }
|
||||
|
||||
@@ -39,13 +39,7 @@
|
||||
|
||||
#define GC_ALLOCATOR_H
|
||||
|
||||
#include "gc.h"
|
||||
|
||||
#if defined(__GNUC__)
|
||||
# define GC_ATTR_UNUSED __attribute__((unused))
|
||||
#else
|
||||
# define GC_ATTR_UNUSED
|
||||
#endif
|
||||
#include "gc.h" // For size_t
|
||||
|
||||
/* First some helpers to allow us to dispatch on whether or not a type
|
||||
* is known to be pointerfree.
|
||||
@@ -128,7 +122,7 @@ public:
|
||||
}
|
||||
|
||||
// __p is not permitted to be a null pointer.
|
||||
void deallocate(pointer __p, size_type GC_ATTR_UNUSED GC_n)
|
||||
void deallocate(pointer __p, size_type GC_n)
|
||||
{ GC_FREE(__p); }
|
||||
|
||||
size_type max_size() const throw()
|
||||
@@ -204,7 +198,7 @@ public:
|
||||
}
|
||||
|
||||
// __p is not permitted to be a null pointer.
|
||||
void deallocate(pointer __p, size_type GC_ATTR_UNUSED GC_n)
|
||||
void deallocate(pointer __p, size_type GC_n)
|
||||
{ GC_FREE(__p); }
|
||||
|
||||
size_type max_size() const throw()
|
||||
|
||||
@@ -95,10 +95,6 @@
|
||||
# define GC_DGUX386_THREADS
|
||||
# define GC_PTHREADS
|
||||
# endif
|
||||
# if defined(_AIX)
|
||||
# define GC_AIX_THREADS
|
||||
# define GC_PTHREADS
|
||||
# endif
|
||||
#endif /* GC_THREADS */
|
||||
|
||||
#if defined(GC_THREADS) && !defined(GC_PTHREADS) && \
|
||||
|
||||
@@ -74,7 +74,7 @@ cycle, then that's considered a storage leak, and neither will be
|
||||
collectable. See the interface gc.h for low-level facilities for
|
||||
handling such cycles of objects with clean-up.
|
||||
|
||||
The collector cannot guarantee that it will find all inaccessible
|
||||
The collector cannot guarrantee that it will find all inaccessible
|
||||
objects. In practice, it finds almost all of them.
|
||||
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ enum { GC_byte_alignment = 8 };
|
||||
enum { GC_word_alignment = GC_byte_alignment/GC_bytes_per_word };
|
||||
|
||||
inline void * &GC_obj_link(void * p)
|
||||
{ return *reinterpret_cast<void **>(p); }
|
||||
{ return *(void **)p; }
|
||||
|
||||
// Compute a number of words >= n+1 bytes.
|
||||
// The +1 allows for pointers one past the end.
|
||||
@@ -228,7 +228,7 @@ class single_client_gc_alloc_template {
|
||||
} else {
|
||||
flh = GC_objfreelist_ptr + nwords;
|
||||
GC_obj_link(p) = *flh;
|
||||
memset(reinterpret_cast<char *>(p) + GC_bytes_per_word, 0,
|
||||
memset((char *)p + GC_bytes_per_word, 0,
|
||||
GC_bytes_per_word * (nwords - 1));
|
||||
*flh = p;
|
||||
GC_aux::GC_mem_recently_freed += nwords;
|
||||
@@ -352,9 +352,9 @@ class simple_alloc<T, alloc> { \
|
||||
public: \
|
||||
static T *allocate(size_t n) \
|
||||
{ return 0 == n? 0 : \
|
||||
reinterpret_cast<T*>(alloc::ptr_free_allocate(n * sizeof (T))); } \
|
||||
(T*) alloc::ptr_free_allocate(n * sizeof (T)); } \
|
||||
static T *allocate(void) \
|
||||
{ return reinterpret_cast<T*>(alloc::ptr_free_allocate(sizeof (T))); } \
|
||||
{ return (T*) alloc::ptr_free_allocate(sizeof (T)); } \
|
||||
static void deallocate(T *p, size_t n) \
|
||||
{ if (0 != n) alloc::ptr_free_deallocate(p, n * sizeof (T)); } \
|
||||
static void deallocate(T *p) \
|
||||
|
||||
@@ -108,7 +108,7 @@ extern hdr * GC_invalid_header; /* header for an imaginary block */
|
||||
|
||||
/* Analogous to GET_HDR, except that in the case of large objects, it */
|
||||
/* Returns the header for the object beginning, and updates p. */
|
||||
/* Returns GC_invalid_header instead of 0. All of this saves a branch */
|
||||
/* Returns &GC_bad_header instead of 0. All of this saves a branch */
|
||||
/* in the fast path. */
|
||||
# define HC_GET_HDR(p, hhdr, source) \
|
||||
{ \
|
||||
|
||||
@@ -155,25 +155,6 @@
|
||||
# define GC_TEST_AND_SET_DEFINED
|
||||
# endif
|
||||
# if defined(POWERPC)
|
||||
# if CPP_WORDSZ == 64
|
||||
inline static int GC_test_and_set(volatile unsigned int *addr) {
|
||||
unsigned long oldval;
|
||||
unsigned long temp = 1; /* locked value */
|
||||
|
||||
__asm__ __volatile__(
|
||||
"1:\tldarx %0,0,%3\n" /* load and reserve */
|
||||
"\tcmpdi %0, 0\n" /* if load is */
|
||||
"\tbne 2f\n" /* non-zero, return already set */
|
||||
"\tstdcx. %2,0,%1\n" /* else store conditional */
|
||||
"\tbne- 1b\n" /* retry if lost reservation */
|
||||
"\tsync\n" /* import barrier */
|
||||
"2:\t\n" /* oldval is zero if we set */
|
||||
: "=&r"(oldval), "=p"(addr)
|
||||
: "r"(temp), "1"(addr)
|
||||
: "cr0","memory");
|
||||
return (int)oldval;
|
||||
}
|
||||
# else
|
||||
inline static int GC_test_and_set(volatile unsigned int *addr) {
|
||||
int oldval;
|
||||
int temp = 1; /* locked value */
|
||||
@@ -191,13 +172,12 @@
|
||||
: "cr0","memory");
|
||||
return oldval;
|
||||
}
|
||||
# endif
|
||||
# define GC_TEST_AND_SET_DEFINED
|
||||
inline static void GC_clear(volatile unsigned int *addr) {
|
||||
__asm__ __volatile__("lwsync" : : : "memory");
|
||||
*(addr) = 0;
|
||||
}
|
||||
# define GC_CLEAR_DEFINED
|
||||
# define GC_TEST_AND_SET_DEFINED
|
||||
inline static void GC_clear(volatile unsigned int *addr) {
|
||||
__asm__ __volatile__("eieio" : : : "memory");
|
||||
*(addr) = 0;
|
||||
}
|
||||
# define GC_CLEAR_DEFINED
|
||||
# endif
|
||||
# if defined(ALPHA)
|
||||
inline static int GC_test_and_set(volatile unsigned int * addr)
|
||||
@@ -251,30 +231,6 @@
|
||||
}
|
||||
# define GC_TEST_AND_SET_DEFINED
|
||||
# endif /* ARM32 */
|
||||
# ifdef CRIS
|
||||
inline static int GC_test_and_set(volatile unsigned int *addr) {
|
||||
/* Ripped from linuxthreads/sysdeps/cris/pt-machine.h. */
|
||||
/* Included with Hans-Peter Nilsson's permission. */
|
||||
register unsigned long int ret;
|
||||
|
||||
/* Note the use of a dummy output of *addr to expose the write.
|
||||
* The memory barrier is to stop *other* writes being moved past
|
||||
* this code.
|
||||
*/
|
||||
__asm__ __volatile__("clearf\n"
|
||||
"0:\n\t"
|
||||
"movu.b [%2],%0\n\t"
|
||||
"ax\n\t"
|
||||
"move.b %3,[%2]\n\t"
|
||||
"bwf 0b\n\t"
|
||||
"clearf"
|
||||
: "=&r" (ret), "=m" (*addr)
|
||||
: "r" (addr), "r" ((int) 1), "m" (*addr)
|
||||
: "memory");
|
||||
return ret;
|
||||
}
|
||||
# define GC_TEST_AND_SET_DEFINED
|
||||
# endif /* CRIS */
|
||||
# ifdef S390
|
||||
inline static int GC_test_and_set(volatile unsigned int *addr) {
|
||||
int ret;
|
||||
@@ -318,8 +274,6 @@
|
||||
# define GC_test_and_set(addr) test_and_set((void *)addr,1)
|
||||
# endif
|
||||
# else
|
||||
# include <sgidefs.h>
|
||||
# include <mutex.h>
|
||||
# define GC_test_and_set(addr) __test_and_set32((void *)addr,1)
|
||||
# define GC_clear(addr) __lock_release(addr);
|
||||
# define GC_CLEAR_DEFINED
|
||||
@@ -392,7 +346,7 @@
|
||||
# endif
|
||||
|
||||
# if defined(GC_PTHREADS) && !defined(GC_SOLARIS_THREADS) \
|
||||
&& !defined(GC_WIN32_THREADS)
|
||||
&& !defined(GC_IRIX_THREADS) && !defined(GC_WIN32_THREADS)
|
||||
# define NO_THREAD (pthread_t)(-1)
|
||||
# include <pthread.h>
|
||||
# if defined(PARALLEL_MARK)
|
||||
@@ -439,29 +393,6 @@
|
||||
|
||||
# if defined(POWERPC)
|
||||
# if !defined(GENERIC_COMPARE_AND_SWAP)
|
||||
# if CPP_WORDSZ == 64
|
||||
/* Returns TRUE if the comparison succeeded. */
|
||||
inline static GC_bool GC_compare_and_exchange(volatile GC_word *addr,
|
||||
GC_word old, GC_word new_val)
|
||||
{
|
||||
unsigned long result, dummy;
|
||||
__asm__ __volatile__(
|
||||
"1:\tldarx %0,0,%5\n"
|
||||
"\tcmpd %0,%4\n"
|
||||
"\tbne 2f\n"
|
||||
"\tstdcx. %3,0,%2\n"
|
||||
"\tbne- 1b\n"
|
||||
"\tsync\n"
|
||||
"\tli %1, 1\n"
|
||||
"\tb 3f\n"
|
||||
"2:\tli %1, 0\n"
|
||||
"3:\t\n"
|
||||
: "=&r" (dummy), "=r" (result), "=p" (addr)
|
||||
: "r" (new_val), "r" (old), "2"(addr)
|
||||
: "cr0","memory");
|
||||
return (GC_bool) result;
|
||||
}
|
||||
# else
|
||||
/* Returns TRUE if the comparison succeeded. */
|
||||
inline static GC_bool GC_compare_and_exchange(volatile GC_word *addr,
|
||||
GC_word old, GC_word new_val)
|
||||
@@ -483,7 +414,6 @@
|
||||
: "cr0","memory");
|
||||
return (GC_bool) result;
|
||||
}
|
||||
# endif
|
||||
# endif /* !GENERIC_COMPARE_AND_SWAP */
|
||||
inline static void GC_memory_barrier()
|
||||
{
|
||||
@@ -497,18 +427,9 @@
|
||||
GC_word old, GC_word new_val)
|
||||
{
|
||||
unsigned long oldval;
|
||||
# if CPP_WORDSZ == 32
|
||||
__asm__ __volatile__(
|
||||
"addp4 %0=0,%1\n"
|
||||
"mov ar.ccv=%3 ;; cmpxchg4.rel %0=[%0],%2,ar.ccv"
|
||||
: "=&r"(oldval)
|
||||
: "r"(addr), "r"(new_val), "r"(old) : "memory");
|
||||
# else
|
||||
__asm__ __volatile__(
|
||||
"mov ar.ccv=%3 ;; cmpxchg8.rel %0=[%1],%2,ar.ccv"
|
||||
: "=r"(oldval)
|
||||
: "r"(addr), "r"(new_val), "r"(old) : "memory");
|
||||
# endif
|
||||
__asm__ __volatile__("mov ar.ccv=%4 ;; cmpxchg8.rel %0=%1,%2,ar.ccv"
|
||||
: "=r"(oldval), "=m"(*addr)
|
||||
: "r"(new_val), "1"(*addr), "r"(old) : "memory");
|
||||
return (oldval == old);
|
||||
}
|
||||
# endif /* !GENERIC_COMPARE_AND_SWAP */
|
||||
@@ -672,6 +593,33 @@
|
||||
extern pthread_t GC_mark_lock_holder;
|
||||
# endif
|
||||
# endif /* GC_PTHREADS with linux_threads.c implementation */
|
||||
# if defined(GC_IRIX_THREADS)
|
||||
# include <pthread.h>
|
||||
/* This probably should never be included, but I can't test */
|
||||
/* on Irix anymore. */
|
||||
# include <mutex.h>
|
||||
|
||||
extern volatile unsigned int GC_allocate_lock;
|
||||
/* This is not a mutex because mutexes that obey the (optional) */
|
||||
/* POSIX scheduling rules are subject to convoys in high contention */
|
||||
/* applications. This is basically a spin lock. */
|
||||
extern pthread_t GC_lock_holder;
|
||||
extern void GC_lock(void);
|
||||
/* Allocation lock holder. Only set if acquired by client through */
|
||||
/* GC_call_with_alloc_lock. */
|
||||
# define SET_LOCK_HOLDER() GC_lock_holder = pthread_self()
|
||||
# define NO_THREAD (pthread_t)(-1)
|
||||
# define UNSET_LOCK_HOLDER() GC_lock_holder = NO_THREAD
|
||||
# define I_HOLD_LOCK() (pthread_equal(GC_lock_holder, pthread_self()))
|
||||
# define LOCK() { if (GC_test_and_set(&GC_allocate_lock)) GC_lock(); }
|
||||
# define UNLOCK() GC_clear(&GC_allocate_lock);
|
||||
extern VOLATILE GC_bool GC_collecting;
|
||||
# define ENTER_GC() \
|
||||
{ \
|
||||
GC_collecting = 1; \
|
||||
}
|
||||
# define EXIT_GC() GC_collecting = 0;
|
||||
# endif /* GC_IRIX_THREADS */
|
||||
# if defined(GC_WIN32_THREADS)
|
||||
# if defined(GC_PTHREADS)
|
||||
# include <pthread.h>
|
||||
|
||||
@@ -259,6 +259,17 @@ typedef char * ptr_t; /* A generic pointer to which we can add */
|
||||
/* */
|
||||
/*********************************/
|
||||
|
||||
#ifdef SAVE_CALL_CHAIN
|
||||
|
||||
/* Fill in the pc and argument information for up to NFRAMES of my */
|
||||
/* callers. Ignore my frame and my callers frame. */
|
||||
struct callinfo;
|
||||
void GC_save_callers GC_PROTO((struct callinfo info[NFRAMES]));
|
||||
|
||||
void GC_print_callers GC_PROTO((struct callinfo info[NFRAMES]));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef NEED_CALLINFO
|
||||
struct callinfo {
|
||||
word ci_pc; /* Caller, not callee, pc */
|
||||
@@ -272,16 +283,6 @@ typedef char * ptr_t; /* A generic pointer to which we can add */
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef SAVE_CALL_CHAIN
|
||||
|
||||
/* Fill in the pc and argument information for up to NFRAMES of my */
|
||||
/* callers. Ignore my frame and my callers frame. */
|
||||
void GC_save_callers GC_PROTO((struct callinfo info[NFRAMES]));
|
||||
|
||||
void GC_print_callers GC_PROTO((struct callinfo info[NFRAMES]));
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*********************************/
|
||||
/* */
|
||||
@@ -550,7 +551,7 @@ extern GC_warn_proc GC_current_warn_proc;
|
||||
|
||||
#define CPP_MAXOBJBYTES (CPP_HBLKSIZE/2)
|
||||
#define MAXOBJBYTES ((word)CPP_MAXOBJBYTES)
|
||||
#define CPP_MAXOBJSZ BYTES_TO_WORDS(CPP_MAXOBJBYTES)
|
||||
#define CPP_MAXOBJSZ BYTES_TO_WORDS(CPP_HBLKSIZE/2)
|
||||
#define MAXOBJSZ ((word)CPP_MAXOBJSZ)
|
||||
|
||||
# define divHBLKSZ(n) ((n) >> LOG_HBLKSIZE)
|
||||
@@ -938,11 +939,11 @@ struct _GC_arrays {
|
||||
char _valid_offsets[VALID_OFFSET_SZ];
|
||||
/* GC_valid_offsets[i] == TRUE ==> i */
|
||||
/* is registered as a displacement. */
|
||||
# define OFFSET_VALID(displ) \
|
||||
(GC_all_interior_pointers || GC_valid_offsets[displ])
|
||||
char _modws_valid_offsets[sizeof(word)];
|
||||
/* GC_valid_offsets[i] ==> */
|
||||
/* GC_modws_valid_offsets[i%sizeof(word)] */
|
||||
# define OFFSET_VALID(displ) \
|
||||
(GC_all_interior_pointers || GC_valid_offsets[displ])
|
||||
# ifdef STUBBORN_ALLOC
|
||||
page_hash_table _changed_pages;
|
||||
/* Stubborn object pages that were changes since last call to */
|
||||
@@ -1632,10 +1633,6 @@ ptr_t GC_generic_malloc_ignore_off_page GC_PROTO((size_t b, int k));
|
||||
/* are ignored. */
|
||||
ptr_t GC_generic_malloc_inner GC_PROTO((word lb, int k));
|
||||
/* Ditto, but I already hold lock, etc. */
|
||||
ptr_t GC_generic_malloc_words_small_inner GC_PROTO((word lw, int k));
|
||||
/* Analogous to the above, but assumes */
|
||||
/* a small object size, and bypasses */
|
||||
/* MERGE_SIZES mechanism. */
|
||||
ptr_t GC_generic_malloc_words_small GC_PROTO((size_t lw, int k));
|
||||
/* As above, but size in units of words */
|
||||
/* Bypasses MERGE_SIZES. Assumes */
|
||||
@@ -1729,13 +1726,6 @@ extern GC_bool GC_print_stats; /* Produce at least some logging output */
|
||||
|
||||
#ifdef KEEP_BACK_PTRS
|
||||
extern long GC_backtraces;
|
||||
void GC_generate_random_backtrace_no_gc(void);
|
||||
#endif
|
||||
|
||||
extern GC_bool GC_print_back_height;
|
||||
|
||||
#ifdef MAKE_BACK_GRAPH
|
||||
void GC_print_back_graph_stats(void);
|
||||
#endif
|
||||
|
||||
/* Macros used for collector internal allocation. */
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
# endif
|
||||
|
||||
/* And one for FreeBSD: */
|
||||
# if defined(__FreeBSD__) && !defined(FREEBSD)
|
||||
# if defined(__FreeBSD__)
|
||||
# define FREEBSD
|
||||
# endif
|
||||
|
||||
@@ -97,10 +97,6 @@
|
||||
# define ARM32
|
||||
# define mach_type_known
|
||||
# endif
|
||||
# if defined(NETBSD) && defined(__sh__)
|
||||
# define SH
|
||||
# define mach_type_known
|
||||
# endif
|
||||
# if defined(vax)
|
||||
# define VAX
|
||||
# ifdef ultrix
|
||||
@@ -119,8 +115,8 @@
|
||||
# if defined(nec_ews) || defined(_nec_ews)
|
||||
# define EWS4800
|
||||
# endif
|
||||
# if !defined(LINUX) && !defined(EWS4800) && !defined(NETBSD)
|
||||
# if defined(ultrix) || defined(__ultrix)
|
||||
# if !defined(LINUX) && !defined(EWS4800)
|
||||
# if defined(ultrix) || defined(__ultrix) || defined(__NetBSD__)
|
||||
# define ULTRIX
|
||||
# else
|
||||
# if defined(_SYSTYPE_SVR4) || defined(SYSTYPE_SVR4) \
|
||||
@@ -174,7 +170,7 @@
|
||||
# define mach_type_known
|
||||
# endif
|
||||
# if defined(sparc) && defined(unix) && !defined(sun) && !defined(linux) \
|
||||
&& !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__FreeBSD__)
|
||||
&& !defined(__OpenBSD__) && !(__NetBSD__)
|
||||
# define SPARC
|
||||
# define DRSNX
|
||||
# define mach_type_known
|
||||
@@ -205,16 +201,14 @@
|
||||
# if defined(_PA_RISC1_0) || defined(_PA_RISC1_1) || defined(_PA_RISC2_0) \
|
||||
|| defined(hppa) || defined(__hppa__)
|
||||
# define HP_PA
|
||||
# if !defined(LINUX) && !defined(HPUX)
|
||||
# ifndef LINUX
|
||||
# define HPUX
|
||||
# endif
|
||||
# define mach_type_known
|
||||
# endif
|
||||
# if defined(__ia64) && defined(_HPUX_SOURCE)
|
||||
# define IA64
|
||||
# ifndef HPUX
|
||||
# define HPUX
|
||||
# endif
|
||||
# define HPUX
|
||||
# define mach_type_known
|
||||
# endif
|
||||
# if defined(__BEOS__) && defined(_X86_)
|
||||
@@ -238,18 +232,7 @@
|
||||
# define ARM32
|
||||
# define mach_type_known
|
||||
# endif
|
||||
# if defined(LINUX) && defined(__cris__)
|
||||
# ifndef CRIS
|
||||
# define CRIS
|
||||
# endif
|
||||
# define mach_type_known
|
||||
# endif
|
||||
# if defined(LINUX) && (defined(powerpc) || defined(__powerpc__) || \
|
||||
defined(powerpc64) || defined(__powerpc64__))
|
||||
# define POWERPC
|
||||
# define mach_type_known
|
||||
# endif
|
||||
# if defined(FREEBSD) && (defined(powerpc) || defined(__powerpc__))
|
||||
# if defined(LINUX) && (defined(powerpc) || defined(__powerpc__) || defined(powerpc64) || defined(__powerpc64__))
|
||||
# define POWERPC
|
||||
# define mach_type_known
|
||||
# endif
|
||||
@@ -269,10 +252,6 @@
|
||||
# define SH
|
||||
# define mach_type_known
|
||||
# endif
|
||||
# if defined(LINUX) && defined(__m32r__)
|
||||
# define M32R
|
||||
# define mach_type_known
|
||||
# endif
|
||||
# if defined(__alpha) || defined(__alpha__)
|
||||
# define ALPHA
|
||||
# if !defined(LINUX) && !defined(NETBSD) && !defined(OPENBSD) && !defined(FREEBSD)
|
||||
@@ -297,36 +276,16 @@
|
||||
# define MACOS
|
||||
# define mach_type_known
|
||||
# endif
|
||||
# if defined(macosx) || (defined(__APPLE__) && defined(__MACH__))
|
||||
# define DARWIN
|
||||
# if defined(__ppc__) || defined(__ppc64__)
|
||||
# if defined(macosx) || \
|
||||
defined(__APPLE__) && defined(__MACH__) && defined(__ppc__)
|
||||
# define DARWIN
|
||||
# define POWERPC
|
||||
# define mach_type_known
|
||||
# elif defined(__i386__)
|
||||
# endif
|
||||
# if defined(__APPLE__) && defined(__MACH__) && defined(__i386__)
|
||||
# define DARWIN
|
||||
# define I386
|
||||
# define mach_type_known
|
||||
# define DARWIN_DONT_PARSE_STACK
|
||||
# define OS_TYPE "DARWIN"
|
||||
# define DYNAMIC_LOADING
|
||||
/* XXX: see get_end(3), get_etext() and get_end() should not be used.
|
||||
These aren't used when dyld support is enabled (it is by default) */
|
||||
# define DATASTART ((ptr_t) get_etext())
|
||||
# define DATAEND ((ptr_t) get_end())
|
||||
# define STACKBOTTOM ((ptr_t) 0xc0000000)
|
||||
# define USE_MMAP
|
||||
# define USE_MMAP_ANON
|
||||
# define USE_ASM_PUSH_REGS
|
||||
/* This is potentially buggy. It needs more testing. See the comments in
|
||||
os_dep.c. It relies on threads to track writes. */
|
||||
# ifdef GC_DARWIN_THREADS
|
||||
/* # define MPROTECT_VDB -- diabled for now. May work for some apps. */
|
||||
# endif
|
||||
# include <unistd.h>
|
||||
# define GETPAGESIZE() getpagesize()
|
||||
/* There seems to be some issues with trylock hanging on darwin. This
|
||||
should be looked into some more */
|
||||
# define NO_PTHREAD_TRYLOCK
|
||||
# endif
|
||||
--> Not really supported, but at least we recognize it.
|
||||
# endif
|
||||
# if defined(NeXT) && defined(mc68000)
|
||||
# define M68K
|
||||
@@ -355,10 +314,6 @@
|
||||
# define X86_64
|
||||
# define mach_type_known
|
||||
# endif
|
||||
# if defined(FREEBSD) && defined(__sparc__)
|
||||
# define SPARC
|
||||
# define mach_type_known
|
||||
#endif
|
||||
# if defined(bsdi) && (defined(i386) || defined(__i386__))
|
||||
# define I386
|
||||
# define BSDI
|
||||
@@ -519,22 +474,17 @@
|
||||
/* POWERPC ==> IBM/Apple PowerPC */
|
||||
/* (MACOS(<=9),DARWIN(incl.MACOSX),*/
|
||||
/* LINUX, NETBSD, NOSYS variants) */
|
||||
/* Handles 32 and 64-bit variants. */
|
||||
/* AIX should be handled here, but */
|
||||
/* that's called an RS6000. */
|
||||
/* CRIS ==> Axis Etrax */
|
||||
/* M32R ==> Renesas M32R */
|
||||
|
||||
|
||||
/*
|
||||
* For each architecture and OS, the following need to be defined:
|
||||
*
|
||||
* CPP_WORDSZ is a simple integer constant representing the word size.
|
||||
* CPP_WORD_SZ is a simple integer constant representing the word size.
|
||||
* in bits. We assume byte addressibility, where a byte has 8 bits.
|
||||
* We also assume CPP_WORDSZ is either 32 or 64.
|
||||
* We also assume CPP_WORD_SZ is either 32 or 64.
|
||||
* (We care about the length of pointers, not hardware
|
||||
* bus widths. Thus a 64 bit processor with a C compiler that uses
|
||||
* 32 bit pointers should use CPP_WORDSZ of 32, not 64. Default is 32.)
|
||||
* 32 bit pointers should use CPP_WORD_SZ of 32, not 64. Default is 32.)
|
||||
*
|
||||
* MACH_TYPE is a string representation of the machine type.
|
||||
* OS_TYPE is analogous for the OS.
|
||||
@@ -555,9 +505,6 @@
|
||||
* DATAEND, if not `end' where `end' is defined as ``extern int end[];''.
|
||||
* RTH suggests gaining access to linker script synth'd values with
|
||||
* this idiom instead of `&end' where `end' is defined as ``extern int end;'' .
|
||||
* Otherwise, ``GCC will assume these are in .sdata/.sbss'' and it will, e.g.,
|
||||
* cause failures on alpha*-*-* with ``-msmall-data or -fpic'' or mips-*-*
|
||||
* without any special options.
|
||||
*
|
||||
* ALIGN_DOUBLE of GC_malloc should return blocks aligned to twice
|
||||
* the pointer size.
|
||||
@@ -651,8 +598,7 @@
|
||||
*/
|
||||
# if defined(__GNUC__) && ((__GNUC__ >= 3) || \
|
||||
(__GNUC__ == 2 && __GNUC_MINOR__ >= 8)) \
|
||||
&& !defined(__INTEL_COMPILER) \
|
||||
&& !defined(__PATHCC__)
|
||||
&& !defined(__INTEL_COMPILER)
|
||||
# define HAVE_BUILTIN_UNWIND_INIT
|
||||
# endif
|
||||
|
||||
@@ -776,7 +722,7 @@
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if defined(POWERPC)
|
||||
# ifdef POWERPC
|
||||
# define MACH_TYPE "POWERPC"
|
||||
# ifdef MACOS
|
||||
# define ALIGNMENT 2 /* Still necessary? Could it be 4? */
|
||||
@@ -789,14 +735,12 @@
|
||||
# define DATAEND /* not needed */
|
||||
# endif
|
||||
# ifdef LINUX
|
||||
# if defined(__powerpc64__)
|
||||
# if (defined (powerpc64) || defined(__powerpc64__))
|
||||
# define ALIGNMENT 8
|
||||
# define CPP_WORDSZ 64
|
||||
# ifndef HBLKSIZE
|
||||
# define HBLKSIZE 4096
|
||||
# endif
|
||||
# else
|
||||
# define ALIGNMENT 4
|
||||
# define ALIGNMENT 4 /* Guess. Can someone verify? */
|
||||
/* This was 2, but that didn't sound right. */
|
||||
# endif
|
||||
# define OS_TYPE "LINUX"
|
||||
/* HEURISTIC1 has been reliably reported to fail for a 32-bit */
|
||||
@@ -808,12 +752,7 @@
|
||||
# define DATAEND (_end)
|
||||
# endif
|
||||
# ifdef DARWIN
|
||||
# ifdef __ppc64__
|
||||
# define ALIGNMENT 8
|
||||
# define CPP_WORDSZ 64
|
||||
# else
|
||||
# define ALIGNMENT 4
|
||||
# endif
|
||||
# define ALIGNMENT 4
|
||||
# define OS_TYPE "DARWIN"
|
||||
# define DYNAMIC_LOADING
|
||||
/* XXX: see get_end(3), get_etext() and get_end() should not be used.
|
||||
@@ -825,10 +764,8 @@
|
||||
# define USE_MMAP_ANON
|
||||
# define USE_ASM_PUSH_REGS
|
||||
/* This is potentially buggy. It needs more testing. See the comments in
|
||||
os_dep.c. It relies on threads to track writes. */
|
||||
# ifdef GC_DARWIN_THREADS
|
||||
/* # define MPROTECT_VDB -- diabled for now. May work for some apps. */
|
||||
# endif
|
||||
os_dep.c */
|
||||
# define MPROTECT_VDB
|
||||
# include <unistd.h>
|
||||
# define GETPAGESIZE() getpagesize()
|
||||
# if defined(USE_PPC_PREFETCH) && defined(__GNUC__)
|
||||
@@ -842,22 +779,6 @@
|
||||
should be looked into some more */
|
||||
# define NO_PTHREAD_TRYLOCK
|
||||
# endif
|
||||
# ifdef FREEBSD
|
||||
# define ALIGNMENT 4
|
||||
# define OS_TYPE "FREEBSD"
|
||||
# ifndef GC_FREEBSD_THREADS
|
||||
# define MPROTECT_VDB
|
||||
# endif
|
||||
# define SIG_SUSPEND SIGUSR1
|
||||
# define SIG_THR_RESTART SIGUSR2
|
||||
# define FREEBSD_STACKBOTTOM
|
||||
# ifdef __ELF__
|
||||
# define DYNAMIC_LOADING
|
||||
# endif
|
||||
extern char etext[];
|
||||
extern char * GC_FreeBSDGetDataStart();
|
||||
# define DATASTART GC_FreeBSDGetDataStart(0x1000, &etext)
|
||||
# endif
|
||||
# ifdef NETBSD
|
||||
# define ALIGNMENT 4
|
||||
# define OS_TYPE "NETBSD"
|
||||
@@ -913,10 +834,6 @@
|
||||
# define CPP_WORDSZ 32
|
||||
# endif
|
||||
# define ALIGN_DOUBLE
|
||||
# ifdef _FILE_OFFSET_BITS
|
||||
# undef _FILE_OFFSET_BITS /* libelf.h & procfs.h doesn't compile with large file support */
|
||||
# define _FILE_OFFSET_BITS 32
|
||||
# endif
|
||||
# ifdef SUNOS5
|
||||
# define OS_TYPE "SUNOS5"
|
||||
extern int _etext[];
|
||||
@@ -997,10 +914,12 @@
|
||||
extern ptr_t GC_SysVGetDataStart();
|
||||
# ifdef __arch64__
|
||||
# define DATASTART GC_SysVGetDataStart(0x100000, _etext)
|
||||
/* libc_stack_end is not set reliably for sparc64 */
|
||||
# define STACKBOTTOM ((ptr_t) 0x80000000000ULL)
|
||||
# else
|
||||
# define DATASTART GC_SysVGetDataStart(0x10000, _etext)
|
||||
# define LINUX_STACKBOTTOM
|
||||
# endif
|
||||
# define LINUX_STACKBOTTOM
|
||||
# endif
|
||||
# ifdef OPENBSD
|
||||
# define OS_TYPE "OPENBSD"
|
||||
@@ -1019,23 +938,6 @@
|
||||
# define DATASTART ((ptr_t)(etext))
|
||||
# endif
|
||||
# endif
|
||||
# ifdef FREEBSD
|
||||
# define OS_TYPE "FREEBSD"
|
||||
# define SIG_SUSPEND SIGUSR1
|
||||
# define SIG_THR_RESTART SIGUSR2
|
||||
# define FREEBSD_STACKBOTTOM
|
||||
# ifdef __ELF__
|
||||
# define DYNAMIC_LOADING
|
||||
# endif
|
||||
extern char etext[];
|
||||
extern char edata[];
|
||||
extern char end[];
|
||||
# define NEED_FIND_LIMIT
|
||||
# define DATASTART ((ptr_t)(&etext))
|
||||
# define DATAEND (GC_find_limit (DATASTART, TRUE))
|
||||
# define DATASTART2 ((ptr_t)(&edata))
|
||||
# define DATAEND2 ((ptr_t)(&end))
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifdef I386
|
||||
@@ -1220,8 +1122,26 @@
|
||||
# endif
|
||||
# ifdef CYGWIN32
|
||||
# define OS_TYPE "CYGWIN32"
|
||||
# define DATASTART ((ptr_t)GC_DATASTART) /* From gc.h */
|
||||
# define DATAEND ((ptr_t)GC_DATAEND)
|
||||
extern int _data_start__[];
|
||||
extern int _data_end__[];
|
||||
extern int _bss_start__[];
|
||||
extern int _bss_end__[];
|
||||
/* For binutils 2.9.1, we have */
|
||||
/* DATASTART = _data_start__ */
|
||||
/* DATAEND = _bss_end__ */
|
||||
/* whereas for some earlier versions it was */
|
||||
/* DATASTART = _bss_start__ */
|
||||
/* DATAEND = _data_end__ */
|
||||
/* To get it right for both, we take the */
|
||||
/* minumum/maximum of the two. */
|
||||
# ifndef MAX
|
||||
# define MAX(x,y) ((x) > (y) ? (x) : (y))
|
||||
# endif
|
||||
# ifndef MIN
|
||||
# define MIN(x,y) ((x) < (y) ? (x) : (y))
|
||||
# endif
|
||||
# define DATASTART ((ptr_t) MIN(_data_start__, _bss_start__))
|
||||
# define DATAEND ((ptr_t) MAX(_data_end__, _bss_end__))
|
||||
# undef STACK_GRAN
|
||||
# define STACK_GRAN 0x10000
|
||||
# define HEURISTIC1
|
||||
@@ -1432,6 +1352,8 @@
|
||||
# define DATAEND /* not needed */
|
||||
# endif
|
||||
# if defined(NETBSD)
|
||||
/* This also checked for __MIPSEL__ . Why? NETBSD recognition */
|
||||
/* should be handled at the top of the file. */
|
||||
# define ALIGNMENT 4
|
||||
# define OS_TYPE "NETBSD"
|
||||
# define HEURISTIC2
|
||||
@@ -1465,8 +1387,6 @@
|
||||
# define CPP_WORDSZ 32
|
||||
# define STACKBOTTOM ((ptr_t)((ulong)&errno))
|
||||
# endif
|
||||
# define USE_MMAP
|
||||
# define USE_MMAP_ANON
|
||||
/* From AIX linker man page:
|
||||
_text Specifies the first location of the program.
|
||||
_etext Specifies the first location after the program.
|
||||
@@ -1623,7 +1543,7 @@
|
||||
# endif
|
||||
# ifdef LINUX
|
||||
# define OS_TYPE "LINUX"
|
||||
# define LINUX_STACKBOTTOM
|
||||
# define STACKBOTTOM ((ptr_t) 0x120000000)
|
||||
# ifdef __ELF__
|
||||
# define SEARCH_FOR_DATA_START
|
||||
# define DYNAMIC_LOADING
|
||||
@@ -1774,7 +1694,7 @@
|
||||
# define USE_GENERIC_PUSH_REGS
|
||||
# ifdef UTS4
|
||||
# define OS_TYPE "UTS4"
|
||||
extern int etext[];
|
||||
extern int etext[];
|
||||
extern int _etext[];
|
||||
extern int _end[];
|
||||
extern ptr_t GC_SysVGetDataStart();
|
||||
@@ -1788,20 +1708,18 @@
|
||||
# define MACH_TYPE "S390"
|
||||
# define USE_GENERIC_PUSH_REGS
|
||||
# ifndef __s390x__
|
||||
# define ALIGNMENT 4
|
||||
# define CPP_WORDSZ 32
|
||||
# define ALIGNMENT 4
|
||||
# define CPP_WORDSZ 32
|
||||
# else
|
||||
# define ALIGNMENT 8
|
||||
# define CPP_WORDSZ 64
|
||||
# endif
|
||||
# ifndef HBLKSIZE
|
||||
# define HBLKSIZE 4096
|
||||
# define ALIGNMENT 8
|
||||
# define CPP_WORDSZ 64
|
||||
# define HBLKSIZE 4096
|
||||
# endif
|
||||
# ifdef LINUX
|
||||
# define OS_TYPE "LINUX"
|
||||
# define LINUX_STACKBOTTOM
|
||||
# define DYNAMIC_LOADING
|
||||
extern int __data_start[];
|
||||
extern int __data_start[];
|
||||
# define DATASTART ((ptr_t)(__data_start))
|
||||
extern int _end[];
|
||||
# define DATAEND (_end)
|
||||
@@ -1878,19 +1796,6 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
# ifdef CRIS
|
||||
# define MACH_TYPE "CRIS"
|
||||
# define CPP_WORDSZ 32
|
||||
# define ALIGNMENT 1
|
||||
# define OS_TYPE "LINUX"
|
||||
# define DYNAMIC_LOADING
|
||||
# define LINUX_STACKBOTTOM
|
||||
# define USE_GENERIC_PUSH_REGS
|
||||
# define SEARCH_FOR_DATA_START
|
||||
extern int _end[];
|
||||
# define DATAEND (_end)
|
||||
# endif
|
||||
|
||||
# ifdef SH
|
||||
# define MACH_TYPE "SH"
|
||||
# define ALIGNMENT 4
|
||||
@@ -1900,20 +1805,13 @@
|
||||
# endif
|
||||
# ifdef LINUX
|
||||
# define OS_TYPE "LINUX"
|
||||
# define LINUX_STACKBOTTOM
|
||||
# define STACKBOTTOM ((ptr_t) 0x7c000000)
|
||||
# define USE_GENERIC_PUSH_REGS
|
||||
# define DYNAMIC_LOADING
|
||||
# define SEARCH_FOR_DATA_START
|
||||
extern int _end[];
|
||||
# define DATAEND (_end)
|
||||
# endif
|
||||
# ifdef NETBSD
|
||||
# define OS_TYPE "NETBSD"
|
||||
# define HEURISTIC2
|
||||
# define DATASTART GC_data_start
|
||||
# define USE_GENERIC_PUSH_REGS
|
||||
# define DYNAMIC_LOADING
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifdef SH4
|
||||
@@ -1923,23 +1821,6 @@
|
||||
# define DATAEND /* not needed */
|
||||
# endif
|
||||
|
||||
# ifdef M32R
|
||||
# define CPP_WORDSZ 32
|
||||
# define MACH_TYPE "M32R"
|
||||
# define ALIGNMENT 4
|
||||
# ifdef LINUX
|
||||
# define OS_TYPE "LINUX"
|
||||
# define LINUX_STACKBOTTOM
|
||||
# undef STACK_GRAN
|
||||
# define STACK_GRAN 0x10000000
|
||||
# define USE_GENERIC_PUSH_REGS
|
||||
# define DYNAMIC_LOADING
|
||||
# define SEARCH_FOR_DATA_START
|
||||
extern int _end[];
|
||||
# define DATAEND (_end)
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifdef X86_64
|
||||
# define MACH_TYPE "X86_64"
|
||||
# define ALIGNMENT 8
|
||||
@@ -2165,9 +2046,8 @@
|
||||
# define THREADS
|
||||
# endif
|
||||
|
||||
# if defined(HP_PA) || defined(M88K) \
|
||||
|| defined(POWERPC) && !defined(DARWIN) \
|
||||
|| defined(LINT) || defined(MSWINCE) || defined(ARM32) || defined(CRIS) \
|
||||
# if defined(HP_PA) || defined(M88K) || defined(POWERPC) && !defined(DARWIN) \
|
||||
|| defined(LINT) || defined(MSWINCE) || defined(ARM32) \
|
||||
|| (defined(I386) && defined(__LCC__))
|
||||
/* Use setjmp based hack to mark from callee-save registers. */
|
||||
/* The define should move to the individual platform */
|
||||
@@ -2308,7 +2188,7 @@
|
||||
# else
|
||||
# if defined(AMIGA) && defined(GC_AMIGA_FASTALLOC)
|
||||
extern void *GC_amiga_get_mem(size_t size);
|
||||
# define GET_MEM(bytes) HBLKPTR((size_t) \
|
||||
define GET_MEM(bytes) HBLKPTR((size_t) \
|
||||
GC_amiga_get_mem((size_t)bytes + GC_page_size) \
|
||||
+ GC_page_size-1)
|
||||
# else
|
||||
@@ -2324,10 +2204,4 @@
|
||||
|
||||
#endif /* GC_PRIVATE_H */
|
||||
|
||||
#if defined(_AIX) && !defined(__GNUC__) && !defined(__STDC__)
|
||||
/* IBMs xlc compiler doesn't appear to follow the convention of */
|
||||
/* defining __STDC__ to be zero in extended mode. */
|
||||
# define __STDC__ 0
|
||||
#endif
|
||||
|
||||
# endif /* GCCONFIG_H */
|
||||
@@ -4,7 +4,7 @@
|
||||
# include "private/gc_priv.h"
|
||||
|
||||
# if defined(GC_PTHREADS) && !defined(GC_SOLARIS_THREADS) \
|
||||
&& !defined(GC_WIN32_THREADS)
|
||||
&& !defined(GC_IRIX_THREADS) && !defined(GC_WIN32_THREADS)
|
||||
|
||||
#if defined(GC_DARWIN_THREADS)
|
||||
# include "private/darwin_stop_world.h"
|
||||
|
||||
+55
-82
@@ -27,10 +27,6 @@
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#if defined(RS6000) || defined(POWERPC)
|
||||
# include <ucontext.h>
|
||||
#endif
|
||||
|
||||
#if defined(__MWERKS__) && !defined(POWERPC)
|
||||
|
||||
asm static void PushMacRegisters()
|
||||
@@ -404,87 +400,64 @@ void GC_push_regs()
|
||||
}
|
||||
#endif /* !USE_GENERIC_PUSH_REGS && !USE_ASM_PUSH_REGS */
|
||||
|
||||
void GC_with_callee_saves_pushed(fn, arg)
|
||||
void (*fn)();
|
||||
ptr_t arg;
|
||||
{
|
||||
word dummy;
|
||||
|
||||
# if defined(USE_GENERIC_PUSH_REGS)
|
||||
# ifdef HAVE_BUILTIN_UNWIND_INIT
|
||||
/* This was suggested by Richard Henderson as the way to */
|
||||
/* force callee-save registers and register windows onto */
|
||||
/* the stack. */
|
||||
__builtin_unwind_init();
|
||||
# else /* !HAVE_BUILTIN_UNWIND_INIT */
|
||||
# if defined(RS6000) || defined(POWERPC)
|
||||
/* FIXME: RS6000 means AIX. */
|
||||
/* This should probably be used in all Posix/non-gcc */
|
||||
/* settings. We defer that change to minimize risk. */
|
||||
ucontext_t ctxt;
|
||||
getcontext(&ctxt);
|
||||
# else
|
||||
/* Generic code */
|
||||
/* The idea is due to Parag Patel at HP. */
|
||||
/* We're not sure whether he would like */
|
||||
/* to be he acknowledged for it or not. */
|
||||
jmp_buf regs;
|
||||
register word * i = (word *) regs;
|
||||
register ptr_t lim = (ptr_t)(regs) + (sizeof regs);
|
||||
|
||||
/* Setjmp doesn't always clear all of the buffer. */
|
||||
/* That tends to preserve garbage. Clear it. */
|
||||
for (; (char *)i < lim; i++) {
|
||||
*i = 0;
|
||||
}
|
||||
# if defined(MSWIN32) || defined(MSWINCE) \
|
||||
|| defined(UTS4) || defined(LINUX) || defined(EWS4800)
|
||||
(void) setjmp(regs);
|
||||
# else
|
||||
(void) _setjmp(regs);
|
||||
/* We don't want to mess with signals. According to */
|
||||
/* SUSV3, setjmp() may or may not save signal mask. */
|
||||
/* _setjmp won't, but is less portable. */
|
||||
# endif
|
||||
# endif /* !AIX ... */
|
||||
# endif /* !HAVE_BUILTIN_UNWIND_INIT */
|
||||
# else
|
||||
# if defined(PTHREADS) && !defined(MSWIN32) /* !USE_GENERIC_PUSH_REGS */
|
||||
/* We may still need this to save thread contexts. */
|
||||
ucontext_t ctxt;
|
||||
getcontext(&ctxt);
|
||||
# else /* Shouldn't be needed */
|
||||
ABORT("Unexpected call to GC_with_callee_saves_pushed");
|
||||
# endif
|
||||
# endif
|
||||
# if (defined(SPARC) && !defined(HAVE_BUILTIN_UNWIND_INIT)) \
|
||||
|| defined(IA64)
|
||||
/* On a register window machine, we need to save register */
|
||||
/* contents on the stack for this to work. The setjmp */
|
||||
/* is probably not needed on SPARC, since pointers are */
|
||||
/* only stored in windowed or scratch registers. It is */
|
||||
/* needed on IA64, since some non-windowed registers are */
|
||||
/* preserved. */
|
||||
{
|
||||
GC_save_regs_ret_val = GC_save_regs_in_stack();
|
||||
/* On IA64 gcc, could use __builtin_ia64_flushrs() and */
|
||||
/* __builtin_ia64_flushrs(). The latter will be done */
|
||||
/* implicitly by __builtin_unwind_init() for gcc3.0.1 */
|
||||
/* and later. */
|
||||
}
|
||||
# endif
|
||||
fn(arg);
|
||||
/* Strongly discourage the compiler from treating the above */
|
||||
/* as a tail-call, since that would pop the register */
|
||||
/* contents before we get a chance to look at them. */
|
||||
GC_noop1((word)(&dummy));
|
||||
}
|
||||
|
||||
#if defined(USE_GENERIC_PUSH_REGS)
|
||||
void GC_generic_push_regs(cold_gc_frame)
|
||||
ptr_t cold_gc_frame;
|
||||
{
|
||||
GC_with_callee_saves_pushed(GC_push_current_stack, cold_gc_frame);
|
||||
{
|
||||
word dummy;
|
||||
|
||||
# ifdef HAVE_BUILTIN_UNWIND_INIT
|
||||
/* This was suggested by Richard Henderson as the way to */
|
||||
/* force callee-save registers and register windows onto */
|
||||
/* the stack. */
|
||||
__builtin_unwind_init();
|
||||
# else /* !HAVE_BUILTIN_UNWIND_INIT */
|
||||
/* Generic code */
|
||||
/* The idea is due to Parag Patel at HP. */
|
||||
/* We're not sure whether he would like */
|
||||
/* to be he acknowledged for it or not. */
|
||||
jmp_buf regs;
|
||||
register word * i = (word *) regs;
|
||||
register ptr_t lim = (ptr_t)(regs) + (sizeof regs);
|
||||
|
||||
/* Setjmp doesn't always clear all of the buffer. */
|
||||
/* That tends to preserve garbage. Clear it. */
|
||||
for (; (char *)i < lim; i++) {
|
||||
*i = 0;
|
||||
}
|
||||
# if defined(POWERPC) || defined(MSWIN32) || defined(MSWINCE) \
|
||||
|| defined(UTS4) || defined(LINUX) || defined(EWS4800)
|
||||
(void) setjmp(regs);
|
||||
# else
|
||||
(void) _setjmp(regs);
|
||||
/* We don't want to mess with signals. According to */
|
||||
/* SUSV3, setjmp() may or may not save signal mask. */
|
||||
/* _setjmp won't, but is less portable. */
|
||||
# endif
|
||||
# endif /* !HAVE_BUILTIN_UNWIND_INIT */
|
||||
# if (defined(SPARC) && !defined(HAVE_BUILTIN_UNWIND_INIT)) \
|
||||
|| defined(IA64)
|
||||
/* On a register window machine, we need to save register */
|
||||
/* contents on the stack for this to work. The setjmp */
|
||||
/* is probably not needed on SPARC, since pointers are */
|
||||
/* only stored in windowed or scratch registers. It is */
|
||||
/* needed on IA64, since some non-windowed registers are */
|
||||
/* preserved. */
|
||||
{
|
||||
GC_save_regs_ret_val = GC_save_regs_in_stack();
|
||||
/* On IA64 gcc, could use __builtin_ia64_flushrs() and */
|
||||
/* __builtin_ia64_flushrs(). The latter will be done */
|
||||
/* implicitly by __builtin_unwind_init() for gcc3.0.1 */
|
||||
/* and later. */
|
||||
}
|
||||
# endif
|
||||
GC_push_current_stack(cold_gc_frame);
|
||||
/* Strongly discourage the compiler from treating the above */
|
||||
/* as a tail-call, since that would pop the register */
|
||||
/* contents before we get a chance to look at them. */
|
||||
GC_noop1((word)(&dummy));
|
||||
}
|
||||
}
|
||||
#endif /* USE_GENERIC_PUSH_REGS */
|
||||
|
||||
@@ -492,7 +465,7 @@ ptr_t cold_gc_frame;
|
||||
/* the stack. Return sp. */
|
||||
# ifdef SPARC
|
||||
asm(" .seg \"text\"");
|
||||
# if defined(SVR4) || defined(NETBSD) || defined(FREEBSD)
|
||||
# if defined(SVR4) || defined(NETBSD)
|
||||
asm(" .globl GC_save_regs_in_stack");
|
||||
asm("GC_save_regs_in_stack:");
|
||||
asm(" .type GC_save_regs_in_stack,#function");
|
||||
|
||||
+1
-2
@@ -172,8 +172,7 @@ int obj_kind;
|
||||
# endif /* REDIRECT_REALLOC */
|
||||
|
||||
|
||||
/* Allocate memory such that only pointers to near the */
|
||||
/* beginning of the object are considered. */
|
||||
/* The same thing, except caller does not hold allocation lock. */
|
||||
/* We avoid holding allocation lock while we clear memory. */
|
||||
ptr_t GC_generic_malloc_ignore_off_page(lb, k)
|
||||
register size_t lb;
|
||||
|
||||
+6
-6
@@ -858,9 +858,9 @@ mse * GC_steal_mark_stack(mse * low, mse * high, mse * local,
|
||||
++top;
|
||||
top -> mse_descr = descr;
|
||||
top -> mse_start = p -> mse_start;
|
||||
GC_ASSERT( (top -> mse_descr & GC_DS_TAGS) != GC_DS_LENGTH ||
|
||||
top -> mse_descr < (ptr_t)GC_greatest_plausible_heap_addr
|
||||
- (ptr_t)GC_least_plausible_heap_addr);
|
||||
GC_ASSERT( top -> mse_descr & GC_DS_TAGS != GC_DS_LENGTH ||
|
||||
top -> mse_descr < GC_greatest_plausible_heap_addr
|
||||
- GC_least_plausible_heap_addr);
|
||||
/* If this is a big object, count it as */
|
||||
/* size/256 + 1 objects. */
|
||||
++i;
|
||||
@@ -1450,8 +1450,8 @@ void GC_push_all_eager(bottom, top)
|
||||
ptr_t bottom;
|
||||
ptr_t top;
|
||||
{
|
||||
word * b = (word *)(((word) bottom + ALIGNMENT-1) & ~(ALIGNMENT-1));
|
||||
word * t = (word *)(((word) top) & ~(ALIGNMENT-1));
|
||||
word * b = (word *)(((long) bottom + ALIGNMENT-1) & ~(ALIGNMENT-1));
|
||||
word * t = (word *)(((long) top) & ~(ALIGNMENT-1));
|
||||
register word *p;
|
||||
register word q;
|
||||
register word *lim;
|
||||
@@ -1739,7 +1739,7 @@ register hdr * hhdr;
|
||||
{
|
||||
register int sz = hhdr -> hb_sz;
|
||||
|
||||
if (sz <= MAXOBJSZ) {
|
||||
if (sz < MAXOBJSZ) {
|
||||
return(GC_page_was_dirty(h));
|
||||
} else {
|
||||
register ptr_t p = (ptr_t)h;
|
||||
|
||||
+1
-4
@@ -368,11 +368,8 @@ ptr_t p;
|
||||
|
||||
ptr_t GC_approx_sp()
|
||||
{
|
||||
VOLATILE word dummy;
|
||||
word dummy;
|
||||
|
||||
dummy = 42; /* Force stack to grow if necessary. Otherwise the */
|
||||
/* later accesses might cause the kernel to think we're */
|
||||
/* doing something wrong. */
|
||||
# ifdef _MSC_VER
|
||||
# pragma warning(disable:4172)
|
||||
# endif
|
||||
|
||||
+2
-5
@@ -246,7 +246,7 @@ void *arg2;
|
||||
byte_sz = WORDS_TO_BYTES(word_sz);
|
||||
if (GC_all_interior_pointers) {
|
||||
/* We need one extra byte; don't fill in GC_size_map[byte_sz] */
|
||||
byte_sz -= EXTRA_BYTES;
|
||||
byte_sz--;
|
||||
}
|
||||
|
||||
for (j = low_limit; j <= byte_sz; j++) GC_size_map[j] = word_sz;
|
||||
@@ -804,10 +804,7 @@ void GC_init_inner()
|
||||
|
||||
void GC_enable_incremental GC_PROTO(())
|
||||
{
|
||||
# if !defined(SMALL_CONFIG) && !defined(KEEP_BACK_PTRS)
|
||||
/* If we are keeping back pointers, the GC itself dirties all */
|
||||
/* pages on which objects have been marked, making */
|
||||
/* incremental GC pointless. */
|
||||
# if !defined(SMALL_CONFIG)
|
||||
if (!GC_find_leak) {
|
||||
DCL_LOCK_STATE;
|
||||
|
||||
|
||||
+91
-149
@@ -60,10 +60,6 @@
|
||||
# include <signal.h>
|
||||
# endif
|
||||
|
||||
#if defined(LINUX) || defined(LINUX_STACKBOTTOM)
|
||||
# include <ctype.h>
|
||||
#endif
|
||||
|
||||
/* Blatantly OS dependent routines, except for those that are related */
|
||||
/* to dynamic loading. */
|
||||
|
||||
@@ -84,7 +80,7 @@
|
||||
# define NEED_FIND_LIMIT
|
||||
# endif
|
||||
|
||||
#if defined(FREEBSD) && (defined(I386) || defined(powerpc) || defined(__powerpc__))
|
||||
#if defined(FREEBSD) && defined(I386)
|
||||
# include <machine/trap.h>
|
||||
# if !defined(PCR)
|
||||
# define NEED_FIND_LIMIT
|
||||
@@ -254,11 +250,30 @@ word GC_apply_to_maps(word (*fn)(char *))
|
||||
// XXXXXXXX-XXXXXXXX r-xp 00000000 30:05 260537 name of mapping...\n
|
||||
// ^^^^^^^^ ^^^^^^^^ ^^^^ ^^
|
||||
// start end prot maj_dev
|
||||
// 0 9 18 32
|
||||
//
|
||||
// For 64 bit ABIs:
|
||||
// 0 17 34 56
|
||||
//
|
||||
// Note that since about auguat 2003 kernels, the columns no longer have
|
||||
// fixed offsets on 64-bit kernels. Hence we no longer rely on fixed offsets
|
||||
// anywhere, which is safer anyway.
|
||||
// The parser is called with a pointer to the entry and the return value
|
||||
// is either NULL or is advanced to the next entry(the byte after the
|
||||
// trailing '\n'.)
|
||||
//
|
||||
#if CPP_WORDSZ == 32
|
||||
# define OFFSET_MAP_START 0
|
||||
# define OFFSET_MAP_END 9
|
||||
# define OFFSET_MAP_PROT 18
|
||||
# define OFFSET_MAP_MAJDEV 32
|
||||
# define ADDR_WIDTH 8
|
||||
#endif
|
||||
|
||||
#if CPP_WORDSZ == 64
|
||||
# define OFFSET_MAP_START 0
|
||||
# define OFFSET_MAP_END 17
|
||||
# define OFFSET_MAP_PROT 34
|
||||
# define OFFSET_MAP_MAJDEV 56
|
||||
# define ADDR_WIDTH 16
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Assign various fields of the first line in buf_ptr to *start, *end,
|
||||
@@ -267,46 +282,37 @@ word GC_apply_to_maps(word (*fn)(char *))
|
||||
char *GC_parse_map_entry(char *buf_ptr, word *start, word *end,
|
||||
char *prot_buf, unsigned int *maj_dev)
|
||||
{
|
||||
char *start_start, *end_start, *prot_start, *maj_dev_start;
|
||||
char *p;
|
||||
char *endp;
|
||||
int i;
|
||||
char *tok;
|
||||
|
||||
if (buf_ptr == NULL || *buf_ptr == '\0') {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
p = buf_ptr;
|
||||
while (isspace(*p)) ++p;
|
||||
start_start = p;
|
||||
GC_ASSERT(isxdigit(*start_start));
|
||||
*start = strtoul(start_start, &endp, 16); p = endp;
|
||||
GC_ASSERT(*p=='-');
|
||||
|
||||
++p;
|
||||
end_start = p;
|
||||
GC_ASSERT(isxdigit(*end_start));
|
||||
*end = strtoul(end_start, &endp, 16); p = endp;
|
||||
GC_ASSERT(isspace(*p));
|
||||
|
||||
while (isspace(*p)) ++p;
|
||||
prot_start = p;
|
||||
GC_ASSERT(*prot_start == 'r' || *prot_start == '-');
|
||||
memcpy(prot_buf, prot_start, 4);
|
||||
memcpy(prot_buf, buf_ptr+OFFSET_MAP_PROT, 4);
|
||||
/* do the protections first. */
|
||||
prot_buf[4] = '\0';
|
||||
if (prot_buf[1] == 'w') {/* we can skip the rest if it's not writable. */
|
||||
/* Skip past protection field to offset field */
|
||||
while (!isspace(*p)) ++p; while (isspace(*p)) ++p;
|
||||
GC_ASSERT(isxdigit(*p));
|
||||
/* Skip past offset field, which we ignore */
|
||||
while (!isspace(*p)) ++p; while (isspace(*p)) ++p;
|
||||
maj_dev_start = p;
|
||||
GC_ASSERT(isxdigit(*maj_dev_start));
|
||||
*maj_dev = strtoul(maj_dev_start, NULL, 16);
|
||||
|
||||
if (prot_buf[1] == 'w') {/* we can skip all of this if it's not writable. */
|
||||
|
||||
tok = buf_ptr;
|
||||
buf_ptr[OFFSET_MAP_START+ADDR_WIDTH] = '\0';
|
||||
*start = strtoul(tok, NULL, 16);
|
||||
|
||||
tok = buf_ptr+OFFSET_MAP_END;
|
||||
buf_ptr[OFFSET_MAP_END+ADDR_WIDTH] = '\0';
|
||||
*end = strtoul(tok, NULL, 16);
|
||||
|
||||
buf_ptr += OFFSET_MAP_MAJDEV;
|
||||
tok = buf_ptr;
|
||||
while (*buf_ptr != ':') buf_ptr++;
|
||||
*buf_ptr++ = '\0';
|
||||
*maj_dev = strtoul(tok, NULL, 16);
|
||||
}
|
||||
|
||||
while (*p && *p++ != '\n');
|
||||
while (*buf_ptr && *buf_ptr++ != '\n');
|
||||
|
||||
return p;
|
||||
return buf_ptr;
|
||||
}
|
||||
|
||||
#endif /* Need to parse /proc/self/maps. */
|
||||
@@ -698,8 +704,8 @@ ptr_t GC_get_stack_base()
|
||||
# if defined(SUNOS5SIGS) || defined(IRIX5) || defined(OSF1) \
|
||||
|| defined(HURD) || defined(NETBSD) || defined(FREEBSD)
|
||||
static struct sigaction old_segv_act;
|
||||
# if defined(IRIX5) || defined(HPUX) \
|
||||
|| defined(HURD) || defined(NETBSD)
|
||||
# if defined(_sigargs) /* !Irix6.x */ || defined(HPUX) \
|
||||
|| defined(HURD) || defined(NETBSD) || defined(FREEBSD)
|
||||
static struct sigaction old_bus_act;
|
||||
# endif
|
||||
# else
|
||||
@@ -731,12 +737,10 @@ ptr_t GC_get_stack_base()
|
||||
/* and setting a handler at the same time. */
|
||||
(void) sigaction(SIGSEGV, 0, &old_segv_act);
|
||||
(void) sigaction(SIGSEGV, &act, 0);
|
||||
(void) sigaction(SIGBUS, 0, &old_bus_act);
|
||||
(void) sigaction(SIGBUS, &act, 0);
|
||||
# else
|
||||
(void) sigaction(SIGSEGV, &act, &old_segv_act);
|
||||
# if defined(IRIX5) \
|
||||
|| defined(HPUX) || defined(HURD) || defined(NETBSD)
|
||||
# if defined(IRIX5) && defined(_sigargs) /* Irix 5.x, not 6.x */ \
|
||||
|| defined(HPUX) || defined(HURD) || defined(NETBSD) || defined(FREEBSD)
|
||||
/* Under Irix 5.x or HP/UX, we may get SIGBUS. */
|
||||
/* Pthreads doesn't exist under Irix 5.x, so we */
|
||||
/* don't have to worry in the threads case. */
|
||||
@@ -774,8 +778,8 @@ ptr_t GC_get_stack_base()
|
||||
# if defined(SUNOS5SIGS) || defined(IRIX5) \
|
||||
|| defined(OSF1) || defined(HURD) || defined(NETBSD) || defined(FREEBSD)
|
||||
(void) sigaction(SIGSEGV, &old_segv_act, 0);
|
||||
# if defined(IRIX5) \
|
||||
|| defined(HPUX) || defined(HURD) || defined(NETBSD)
|
||||
# if defined(IRIX5) && defined(_sigargs) /* Irix 5.x, not 6.x */ \
|
||||
|| defined(HPUX) || defined(HURD) || defined(NETBSD) || defined(FREEBSD)
|
||||
(void) sigaction(SIGBUS, &old_bus_act, 0);
|
||||
# endif
|
||||
# else
|
||||
@@ -855,14 +859,13 @@ ptr_t GC_get_stack_base()
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <ctype.h>
|
||||
|
||||
# define STAT_SKIP 27 /* Number of fields preceding startstack */
|
||||
/* field in /proc/self/stat */
|
||||
|
||||
#ifdef USE_LIBC_PRIVATES
|
||||
# pragma weak __libc_stack_end
|
||||
extern ptr_t __libc_stack_end;
|
||||
#endif
|
||||
|
||||
# ifdef IA64
|
||||
/* Try to read the backing store base from /proc/self/maps. */
|
||||
@@ -892,38 +895,33 @@ ptr_t GC_get_stack_base()
|
||||
return GC_apply_to_maps(backing_store_base_from_maps);
|
||||
}
|
||||
|
||||
# ifdef USE_LIBC_PRIVATES
|
||||
# pragma weak __libc_ia64_register_backing_store_base
|
||||
extern ptr_t __libc_ia64_register_backing_store_base;
|
||||
# endif
|
||||
# pragma weak __libc_ia64_register_backing_store_base
|
||||
extern ptr_t __libc_ia64_register_backing_store_base;
|
||||
|
||||
ptr_t GC_get_register_stack_base(void)
|
||||
{
|
||||
# ifdef USE_LIBC_PRIVATES
|
||||
if (0 != &__libc_ia64_register_backing_store_base
|
||||
&& 0 != __libc_ia64_register_backing_store_base) {
|
||||
/* Glibc 2.2.4 has a bug such that for dynamically linked */
|
||||
/* executables __libc_ia64_register_backing_store_base is */
|
||||
/* defined but uninitialized during constructor calls. */
|
||||
/* Hence we check for both nonzero address and value. */
|
||||
return __libc_ia64_register_backing_store_base;
|
||||
}
|
||||
# endif
|
||||
word result = backing_store_base_from_proc();
|
||||
if (0 == result) {
|
||||
if (0 != &__libc_ia64_register_backing_store_base
|
||||
&& 0 != __libc_ia64_register_backing_store_base) {
|
||||
/* Glibc 2.2.4 has a bug such that for dynamically linked */
|
||||
/* executables __libc_ia64_register_backing_store_base is */
|
||||
/* defined but uninitialized during constructor calls. */
|
||||
/* Hence we check for both nonzero address and value. */
|
||||
return __libc_ia64_register_backing_store_base;
|
||||
} else {
|
||||
word result = backing_store_base_from_proc();
|
||||
if (0 == result) {
|
||||
/* Use dumb heuristics. Works only for default configuration. */
|
||||
result = (word)GC_stackbottom - BACKING_STORE_DISPLACEMENT;
|
||||
result += BACKING_STORE_ALIGNMENT - 1;
|
||||
result &= ~(BACKING_STORE_ALIGNMENT - 1);
|
||||
/* Verify that it's at least readable. If not, we goofed. */
|
||||
GC_noop1(*(word *)result);
|
||||
}
|
||||
return (ptr_t)result;
|
||||
}
|
||||
return (ptr_t)result;
|
||||
}
|
||||
# endif
|
||||
|
||||
void *GC_set_stackbottom = NULL;
|
||||
|
||||
ptr_t GC_linux_stack_base(void)
|
||||
{
|
||||
/* We read the stack base value from /proc/self/stat. We do this */
|
||||
@@ -943,7 +941,7 @@ void *GC_set_stackbottom = NULL;
|
||||
/* since the correct value of __libc_stack_end never */
|
||||
/* becomes visible to us. The second test works around */
|
||||
/* this. */
|
||||
# ifdef USE_LIBC_PRIVATES
|
||||
#if USE_LIBC_PRIVATE_SYMBOLS
|
||||
if (0 != &__libc_stack_end && 0 != __libc_stack_end ) {
|
||||
# ifdef IA64
|
||||
/* Some versions of glibc set the address 16 bytes too */
|
||||
@@ -953,19 +951,10 @@ void *GC_set_stackbottom = NULL;
|
||||
} /* Otherwise it's not safe to add 16 bytes and we fall */
|
||||
/* back to using /proc. */
|
||||
# else
|
||||
# ifdef SPARC
|
||||
/* Older versions of glibc for 64-bit Sparc do not set
|
||||
* this variable correctly, it gets set to either zero
|
||||
* or one.
|
||||
*/
|
||||
if (__libc_stack_end != (ptr_t) (unsigned long)0x1)
|
||||
return __libc_stack_end;
|
||||
# else
|
||||
return __libc_stack_end;
|
||||
# endif
|
||||
# endif
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
f = open("/proc/self/stat", O_RDONLY);
|
||||
if (f < 0 || STAT_READ(f, stat_buf, STAT_BUF_SIZE) < 2 * STAT_SKIP) {
|
||||
ABORT("Couldn't read /proc/self/stat");
|
||||
@@ -1396,7 +1385,7 @@ int * etext_addr;
|
||||
}
|
||||
# endif
|
||||
|
||||
# if defined(FREEBSD) && (defined(I386) || defined(powerpc) || defined(__powerpc__)) && !defined(PCR)
|
||||
# if defined(FREEBSD) && defined(I386) && !defined(PCR)
|
||||
/* Its unclear whether this should be identical to the above, or */
|
||||
/* whether it should apply to non-X86 architectures. */
|
||||
/* For now we don't assume that there is always an empty page after */
|
||||
@@ -1517,7 +1506,7 @@ void GC_register_data_segments()
|
||||
# endif
|
||||
|
||||
|
||||
# if 0 && defined(RS6000) /* We now use mmap */
|
||||
# ifdef RS6000
|
||||
/* The compiler seems to generate speculative reads one past the end of */
|
||||
/* an allocated object. Hence we need to make sure that the page */
|
||||
/* following the last heap page is also mapped. */
|
||||
@@ -2311,11 +2300,8 @@ GC_bool is_ptrfree;
|
||||
# if defined(ALPHA) || defined(M68K)
|
||||
typedef void (* REAL_SIG_PF)(int, int, s_c *);
|
||||
# else
|
||||
# if defined(IA64) || defined(HP_PA) || defined(X86_64)
|
||||
# if defined(IA64) || defined(HP_PA)
|
||||
typedef void (* REAL_SIG_PF)(int, siginfo_t *, s_c *);
|
||||
/* FIXME: */
|
||||
/* According to SUSV3, the last argument should have type */
|
||||
/* void * or ucontext_t * */
|
||||
# else
|
||||
typedef void (* REAL_SIG_PF)(int, s_c);
|
||||
# endif
|
||||
@@ -2403,7 +2389,7 @@ SIG_PF GC_old_segv_handler; /* Also old MSWIN32 ACCESS_VIOLATION filter */
|
||||
# endif
|
||||
# ifdef FREEBSD
|
||||
# define SIG_OK (sig == SIGBUS)
|
||||
# define CODE_OK TRUE
|
||||
# define CODE_OK (code == BUS_PAGE_FAULT)
|
||||
# endif
|
||||
# endif /* SUNOS4 || (FREEBSD && !SUNOS5SIGS) */
|
||||
|
||||
@@ -2428,7 +2414,7 @@ SIG_PF GC_old_segv_handler; /* Also old MSWIN32 ACCESS_VIOLATION filter */
|
||||
# if defined(ALPHA) || defined(M68K)
|
||||
void GC_write_fault_handler(int sig, int code, s_c * sc)
|
||||
# else
|
||||
# if defined(IA64) || defined(HP_PA) || defined(X86_64)
|
||||
# if defined(IA64) || defined(HP_PA)
|
||||
void GC_write_fault_handler(int sig, siginfo_t * si, s_c * scp)
|
||||
# else
|
||||
# if defined(ARM32)
|
||||
@@ -2494,7 +2480,7 @@ SIG_PF GC_old_segv_handler; /* Also old MSWIN32 ACCESS_VIOLATION filter */
|
||||
char * addr = (char *) (scp -> si_addr);
|
||||
# endif
|
||||
# ifdef LINUX
|
||||
# if defined(I386)
|
||||
# if defined(I386) || defined (X86_64)
|
||||
char * addr = (char *) (sc.cr2);
|
||||
# else
|
||||
# if defined(M68K)
|
||||
@@ -2529,7 +2515,7 @@ SIG_PF GC_old_segv_handler; /* Also old MSWIN32 ACCESS_VIOLATION filter */
|
||||
# ifdef ALPHA
|
||||
char * addr = get_fault_addr(sc);
|
||||
# else
|
||||
# if defined(IA64) || defined(HP_PA) || defined(X86_64)
|
||||
# if defined(IA64) || defined(HP_PA)
|
||||
char * addr = si -> si_addr;
|
||||
/* I believe this is claimed to work on all platforms for */
|
||||
/* Linux 2.3.47 and later. Hopefully we don't have to */
|
||||
@@ -2541,11 +2527,7 @@ SIG_PF GC_old_segv_handler; /* Also old MSWIN32 ACCESS_VIOLATION filter */
|
||||
# if defined(ARM32)
|
||||
char * addr = (char *)sc.fault_address;
|
||||
# else
|
||||
# if defined(CRIS)
|
||||
char * addr = (char *)sc.regs.csraddr;
|
||||
# else
|
||||
--> architecture not supported
|
||||
# endif
|
||||
--> architecture not supported
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
@@ -2614,7 +2596,7 @@ SIG_PF GC_old_segv_handler; /* Also old MSWIN32 ACCESS_VIOLATION filter */
|
||||
# if defined(ALPHA) || defined(M68K)
|
||||
(*(REAL_SIG_PF)old_handler) (sig, code, sc);
|
||||
# else
|
||||
# if defined(IA64) || defined(HP_PA) || defined(X86_64)
|
||||
# if defined(IA64) || defined(HP_PA)
|
||||
(*(REAL_SIG_PF)old_handler) (sig, si, scp);
|
||||
# else
|
||||
(*(REAL_SIG_PF)old_handler) (sig, sc);
|
||||
@@ -2708,8 +2690,7 @@ void GC_dirty_init()
|
||||
struct sigaction act, oldact;
|
||||
/* We should probably specify SA_SIGINFO for Linux, and handle */
|
||||
/* the different architectures more uniformly. */
|
||||
# if defined(IRIX5) || defined(LINUX) && !defined(X86_64) \
|
||||
|| defined(OSF1) || defined(HURD)
|
||||
# if defined(IRIX5) || defined(LINUX) || defined(OSF1) || defined(HURD)
|
||||
act.sa_flags = SA_RESTART;
|
||||
act.sa_handler = (SIG_PF)GC_write_fault_handler;
|
||||
# else
|
||||
@@ -3087,7 +3068,7 @@ word n;
|
||||
#include <sys/procfs.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#define INITIAL_BUF_SZ 16384
|
||||
#define INITIAL_BUF_SZ 4096
|
||||
word GC_proc_buf_size = INITIAL_BUF_SZ;
|
||||
char *GC_proc_buf;
|
||||
|
||||
@@ -3422,6 +3403,8 @@ extern kern_return_t exception_raise_state_identity(
|
||||
|
||||
#define MAX_EXCEPTION_PORTS 16
|
||||
|
||||
static mach_port_t GC_task_self;
|
||||
|
||||
static struct {
|
||||
mach_msg_type_number_t count;
|
||||
exception_mask_t masks[MAX_EXCEPTION_PORTS];
|
||||
@@ -3748,7 +3731,7 @@ static kern_return_t GC_forward_exception(
|
||||
exception_behavior_t behavior;
|
||||
thread_state_flavor_t flavor;
|
||||
|
||||
thread_state_t thread_state;
|
||||
thread_state_data_t thread_state;
|
||||
mach_msg_type_number_t thread_state_count = THREAD_STATE_MAX;
|
||||
|
||||
for(i=0;i<GC_old_exc_ports.count;i++)
|
||||
@@ -3809,23 +3792,13 @@ catch_exception_raise(
|
||||
char *addr;
|
||||
struct hblk *h;
|
||||
int i;
|
||||
# if defined(POWERPC)
|
||||
# if CPP_WORDSZ == 32
|
||||
thread_state_flavor_t flavor = PPC_EXCEPTION_STATE;
|
||||
mach_msg_type_number_t exc_state_count = PPC_EXCEPTION_STATE_COUNT;
|
||||
ppc_exception_state_t exc_state;
|
||||
# else
|
||||
thread_state_flavor_t flavor = PPC_EXCEPTION_STATE64;
|
||||
mach_msg_type_number_t exc_state_count = PPC_EXCEPTION_STATE64_COUNT;
|
||||
ppc_exception_state64_t exc_state;
|
||||
# endif
|
||||
# elif defined(I386)
|
||||
thread_state_flavor_t flavor = i386_EXCEPTION_STATE;
|
||||
mach_msg_type_number_t exc_state_count = i386_EXCEPTION_STATE_COUNT;
|
||||
i386_exception_state_t exc_state;
|
||||
# else
|
||||
#ifdef POWERPC
|
||||
thread_state_flavor_t flavor = PPC_EXCEPTION_STATE;
|
||||
mach_msg_type_number_t exc_state_count = PPC_EXCEPTION_STATE_COUNT;
|
||||
ppc_exception_state_t exc_state;
|
||||
#else
|
||||
# error FIXME for non-ppc darwin
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
if(exception != EXC_BAD_ACCESS || code[0] != KERN_PROTECTION_FAILURE) {
|
||||
@@ -3854,13 +3827,7 @@ catch_exception_raise(
|
||||
}
|
||||
|
||||
/* This is the address that caused the fault */
|
||||
#if defined(POWERPC)
|
||||
addr = (char*) exc_state.dar;
|
||||
#elif defined (I386)
|
||||
addr = (char*) exc_state.faultvaddr;
|
||||
#else
|
||||
# error FIXME for non POWERPC/I386
|
||||
#endif
|
||||
|
||||
if((HDR(addr)) == 0) {
|
||||
/* Ugh... just like the SIGBUS problem above, it seems we get a bogus
|
||||
@@ -3991,14 +3958,10 @@ kern_return_t catch_exception_raise_state_identity(
|
||||
# if defined (DRSNX)
|
||||
# include <sys/sparc/frame.h>
|
||||
# else
|
||||
# if defined(OPENBSD)
|
||||
# if defined(OPENBSD) || defined(NETBSD)
|
||||
# include <frame.h>
|
||||
# else
|
||||
# if defined(FREEBSD) || defined(NETBSD)
|
||||
# include <machine/frame.h>
|
||||
# else
|
||||
# include <sys/frame.h>
|
||||
# endif
|
||||
# include <sys/frame.h>
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
@@ -4027,16 +3990,6 @@ kern_return_t catch_exception_raise_state_identity(
|
||||
#if NARGS == 0 && NFRAMES % 2 == 0 /* No padding */ \
|
||||
&& defined(GC_HAVE_BUILTIN_BACKTRACE)
|
||||
|
||||
#ifdef REDIRECT_MALLOC
|
||||
/* Deal with possible malloc calls in backtrace by omitting */
|
||||
/* the infinitely recursing backtrace. */
|
||||
# ifdef THREADS
|
||||
__thread /* If your compiler doesn't understand this */
|
||||
/* you could use something like pthread_getspecific. */
|
||||
# endif
|
||||
GC_in_save_callers = FALSE;
|
||||
#endif
|
||||
|
||||
void GC_save_callers (info)
|
||||
struct callinfo info[NFRAMES];
|
||||
{
|
||||
@@ -4046,26 +3999,15 @@ struct callinfo info[NFRAMES];
|
||||
|
||||
/* We retrieve NFRAMES+1 pc values, but discard the first, since it */
|
||||
/* points to our own frame. */
|
||||
# ifdef REDIRECT_MALLOC
|
||||
if (GC_in_save_callers) {
|
||||
info[0].ci_pc = (word)(&GC_save_callers);
|
||||
for (i = 1; i < NFRAMES; ++i) info[i].ci_pc = 0;
|
||||
return;
|
||||
}
|
||||
GC_in_save_callers = TRUE;
|
||||
# endif
|
||||
GC_ASSERT(sizeof(struct callinfo) == sizeof(void *));
|
||||
npcs = backtrace((void **)tmp_info, NFRAMES + IGNORE_FRAMES);
|
||||
BCOPY(tmp_info+IGNORE_FRAMES, info, (npcs - IGNORE_FRAMES) * sizeof(void *));
|
||||
for (i = npcs - IGNORE_FRAMES; i < NFRAMES; ++i) info[i].ci_pc = 0;
|
||||
# ifdef REDIRECT_MALLOC
|
||||
GC_in_save_callers = FALSE;
|
||||
# endif
|
||||
}
|
||||
|
||||
#else /* No builtin backtrace; do it ourselves */
|
||||
|
||||
#if (defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD)) && defined(SPARC)
|
||||
#if (defined(OPENBSD) || defined(NETBSD)) && defined(SPARC)
|
||||
# define FR_SAVFP fr_fp
|
||||
# define FR_SAVPC fr_pc
|
||||
#else
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
; GC_push_regs function. Under some optimization levels GCC will clobber
|
||||
; some of the non-volatile registers before we get a chance to save them
|
||||
; therefore, this cannot be inline asm.
|
||||
; therefore, this can't be inline asm.
|
||||
|
||||
.text
|
||||
.align 2
|
||||
@@ -64,8 +64,7 @@ _GC_push_regs:
|
||||
; PIC stuff, generated by GCC
|
||||
|
||||
.data
|
||||
.section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
|
||||
.align 2
|
||||
.picsymbol_stub
|
||||
L_GC_push_one$stub:
|
||||
.indirect_symbol _GC_push_one
|
||||
mflr r0
|
||||
@@ -74,12 +73,12 @@ L0$_GC_push_one:
|
||||
mflr r11
|
||||
addis r11,r11,ha16(L_GC_push_one$lazy_ptr-L0$_GC_push_one)
|
||||
mtlr r0
|
||||
lwzu r12,lo16(L_GC_push_one$lazy_ptr-L0$_GC_push_one)(r11)
|
||||
lwz r12,lo16(L_GC_push_one$lazy_ptr-L0$_GC_push_one)(r11)
|
||||
mtctr r12
|
||||
addi r11,r11,lo16(L_GC_push_one$lazy_ptr-L0$_GC_push_one)
|
||||
bctr
|
||||
.data
|
||||
.lazy_symbol_pointer
|
||||
L_GC_push_one$lazy_ptr:
|
||||
.indirect_symbol _GC_push_one
|
||||
.long dyld_stub_binding_helper
|
||||
|
||||
+18
-23
@@ -2,7 +2,7 @@
|
||||
* Copyright (c) 1994 by Xerox Corporation. All rights reserved.
|
||||
* Copyright (c) 1996 by Silicon Graphics. All rights reserved.
|
||||
* Copyright (c) 1998 by Fergus Henderson. All rights reserved.
|
||||
* Copyright (c) 2000-2004 by Hewlett-Packard Company. All rights reserved.
|
||||
* Copyright (c) 2000-2001 by Hewlett-Packard Company. All rights reserved.
|
||||
*
|
||||
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
|
||||
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
|
||||
@@ -50,7 +50,8 @@
|
||||
# include "private/pthread_support.h"
|
||||
|
||||
# if defined(GC_PTHREADS) && !defined(GC_SOLARIS_THREADS) \
|
||||
&& !defined(GC_WIN32_THREADS)
|
||||
&& !defined(GC_IRIX_THREADS) && !defined(GC_WIN32_THREADS) \
|
||||
&& !defined(GC_AIX_THREADS)
|
||||
|
||||
# if defined(GC_HPUX_THREADS) && !defined(USE_PTHREAD_SPECIFIC) \
|
||||
&& !defined(USE_COMPILER_TLS)
|
||||
@@ -67,8 +68,7 @@
|
||||
# endif
|
||||
|
||||
# if (defined(GC_DGUX386_THREADS) || defined(GC_OSF1_THREADS) || \
|
||||
defined(GC_DARWIN_THREADS) || defined(GC_AIX_THREADS)) \
|
||||
&& !defined(USE_PTHREAD_SPECIFIC)
|
||||
defined(GC_DARWIN_THREADS)) && !defined(USE_PTHREAD_SPECIFIC)
|
||||
# define USE_PTHREAD_SPECIFIC
|
||||
# endif
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
# include <semaphore.h>
|
||||
#endif /* !GC_DARWIN_THREADS */
|
||||
|
||||
#if defined(GC_DARWIN_THREADS) || defined(GC_FREEBSD_THREADS)
|
||||
#if defined(GC_DARWIN_THREADS)
|
||||
# include <sys/sysctl.h>
|
||||
#endif /* GC_DARWIN_THREADS */
|
||||
|
||||
@@ -948,9 +948,9 @@ int GC_get_nprocs()
|
||||
/* We hold the allocation lock. */
|
||||
void GC_thr_init()
|
||||
{
|
||||
# ifndef GC_DARWIN_THREADS
|
||||
int dummy;
|
||||
# endif
|
||||
# ifndef GC_DARWIN_THREADS
|
||||
int dummy;
|
||||
# endif
|
||||
GC_thread t;
|
||||
|
||||
if (GC_thr_initialized) return;
|
||||
@@ -982,15 +982,14 @@ void GC_thr_init()
|
||||
# if defined(GC_HPUX_THREADS)
|
||||
GC_nprocs = pthread_num_processors_np();
|
||||
# endif
|
||||
# if defined(GC_OSF1_THREADS) || defined(GC_AIX_THREADS)
|
||||
# if defined(GC_OSF1_THREADS)
|
||||
GC_nprocs = sysconf(_SC_NPROCESSORS_ONLN);
|
||||
if (GC_nprocs <= 0) GC_nprocs = 1;
|
||||
# endif
|
||||
# if defined(GC_IRIX_THREADS)
|
||||
GC_nprocs = sysconf(_SC_NPROC_ONLN);
|
||||
if (GC_nprocs <= 0) GC_nprocs = 1;
|
||||
# if defined(GC_FREEBSD_THREADS)
|
||||
GC_nprocs = 1;
|
||||
# endif
|
||||
# if defined(GC_DARWIN_THREADS) || defined(GC_FREEBSD_THREADS)
|
||||
# if defined(GC_DARWIN_THREADS)
|
||||
int ncpus = 1;
|
||||
size_t len = sizeof(ncpus);
|
||||
sysctl((int[2]) {CTL_HW, HW_NCPU}, 2, &ncpus, &len, NULL, 0);
|
||||
@@ -1037,8 +1036,6 @@ void GC_thr_init()
|
||||
/* Disable true incremental collection, but generational is OK. */
|
||||
GC_time_limit = GC_TIME_UNLIMITED;
|
||||
}
|
||||
/* If we are using a parallel marker, actually start helper threads. */
|
||||
if (GC_parallel) start_mark_threads();
|
||||
# endif
|
||||
}
|
||||
|
||||
@@ -1055,6 +1052,10 @@ void GC_init_parallel()
|
||||
|
||||
/* GC_init() calls us back, so set flag first. */
|
||||
if (!GC_is_initialized) GC_init();
|
||||
/* If we are using a parallel marker, start the helper threads. */
|
||||
# ifdef PARALLEL_MARK
|
||||
if (GC_parallel) start_mark_threads();
|
||||
# endif
|
||||
/* Initialize thread local free lists if used. */
|
||||
# if defined(THREAD_LOCAL_ALLOC) && !defined(DBG_HDRS_ALL)
|
||||
LOCK();
|
||||
@@ -1368,7 +1369,7 @@ WRAP_FUNC(pthread_create)(pthread_t *new_thread,
|
||||
if (!GC_thr_initialized) GC_thr_init();
|
||||
# ifdef GC_ASSERTIONS
|
||||
{
|
||||
size_t stack_size;
|
||||
int stack_size;
|
||||
if (NULL == attr) {
|
||||
pthread_attr_t my_attr;
|
||||
pthread_attr_init(&my_attr);
|
||||
@@ -1376,13 +1377,7 @@ WRAP_FUNC(pthread_create)(pthread_t *new_thread,
|
||||
} else {
|
||||
pthread_attr_getstacksize(attr, &stack_size);
|
||||
}
|
||||
# ifdef PARALLEL_MARK
|
||||
GC_ASSERT(stack_size >= (8*HBLKSIZE*sizeof(word)));
|
||||
# else
|
||||
/* FreeBSD-5.3/Alpha: default pthread stack is 64K, */
|
||||
/* HBLKSIZE=8192, sizeof(word)=8 */
|
||||
GC_ASSERT(stack_size >= 65536);
|
||||
# endif
|
||||
GC_ASSERT(stack_size >= (8*HBLKSIZE*sizeof(word)));
|
||||
/* Our threads may need to do some work for the GC. */
|
||||
/* Ridiculously small threads won't work, and they */
|
||||
/* probably wouldn't work anyway. */
|
||||
|
||||
+1
-1
@@ -888,7 +888,7 @@ void GC_print_block_list()
|
||||
{
|
||||
struct Print_stats pstats;
|
||||
|
||||
GC_printf1("(kind(0=ptrfree,1=normal,2=unc.,%lu=stubborn):size_in_bytes, #_marks_set)\n", STUBBORN);
|
||||
GC_printf0("(kind(0=ptrfree,1=normal,2=unc.,3=stubborn):size_in_bytes, #_marks_set)\n");
|
||||
pstats.number_of_blocks = 0;
|
||||
pstats.total_bytes = 0;
|
||||
GC_apply_to_all_blocks(GC_print_block_descr, (word)&pstats);
|
||||
|
||||
@@ -16,9 +16,8 @@
|
||||
* Modified by Peter C. for Solaris Posix Threads.
|
||||
*/
|
||||
|
||||
# include "private/gc_priv.h"
|
||||
|
||||
# if defined(GC_SOLARIS_PTHREADS)
|
||||
# include "private/gc_priv.h"
|
||||
# include <pthread.h>
|
||||
# include <thread.h>
|
||||
# include <signal.h>
|
||||
|
||||
+8
-11
@@ -16,9 +16,9 @@
|
||||
*/
|
||||
/* Boehm, September 14, 1994 4:44 pm PDT */
|
||||
|
||||
# include "private/gc_priv.h"
|
||||
|
||||
# if defined(GC_SOLARIS_THREADS) || defined(GC_SOLARIS_PTHREADS)
|
||||
|
||||
# include "private/gc_priv.h"
|
||||
# include "private/solaris_threads.h"
|
||||
# include <thread.h>
|
||||
# include <synch.h>
|
||||
@@ -248,8 +248,8 @@ static void stop_all_lwps()
|
||||
for (i = 0; i < max_lwps; i++)
|
||||
last_ids[i] = 0;
|
||||
for (;;) {
|
||||
if (syscall(SYS_ioctl, GC_main_proc_fd, PIOCSTATUS, &status) < 0)
|
||||
ABORT("Main PIOCSTATUS failed");
|
||||
if (syscall(SYS_ioctl, GC_main_proc_fd, PIOCSTATUS, &status) < 0)
|
||||
ABORT("Main PIOCSTATUS failed");
|
||||
if (status.pr_nlwp < 1)
|
||||
ABORT("Invalid number of lwps returned by PIOCSTATUS");
|
||||
if (status.pr_nlwp >= max_lwps) {
|
||||
@@ -262,7 +262,7 @@ static void stop_all_lwps()
|
||||
for (i = 0; i < max_lwps; i++)
|
||||
last_ids[i] = 0;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (syscall(SYS_ioctl, GC_main_proc_fd, PIOCLWPIDS, GC_current_ids) < 0)
|
||||
ABORT("PIOCLWPIDS failed");
|
||||
changed = FALSE;
|
||||
@@ -803,7 +803,6 @@ void GC_thr_init(void)
|
||||
{
|
||||
GC_thread t;
|
||||
thread_t tid;
|
||||
int ret;
|
||||
|
||||
if (GC_thr_initialized)
|
||||
return;
|
||||
@@ -821,11 +820,9 @@ void GC_thr_init(void)
|
||||
t = GC_new_thread(thr_self());
|
||||
t -> stack_size = 0;
|
||||
t -> flags = DETACHED | CLIENT_OWNS_STACK;
|
||||
ret = thr_create(0 /* stack */, 0 /* stack_size */, GC_thr_daemon,
|
||||
0 /* arg */, THR_DETACHED | THR_DAEMON,
|
||||
&tid /* thread_id */);
|
||||
if (ret != 0) {
|
||||
GC_err_printf1("Thr_create returned %ld\n", ret);
|
||||
if (thr_create(0 /* stack */, 0 /* stack_size */, GC_thr_daemon,
|
||||
0 /* arg */, THR_DETACHED | THR_DAEMON,
|
||||
&tid /* thread_id */) != 0) {
|
||||
ABORT("Cant fork daemon");
|
||||
}
|
||||
thr_setprio(tid, 126);
|
||||
|
||||
+1
-2
@@ -11,10 +11,9 @@
|
||||
* modified is included with the above copyright notice.
|
||||
*/
|
||||
|
||||
#include "private/gc_priv.h" /* For GC_compare_and_exchange, GC_memory_barrier */
|
||||
|
||||
#if defined(GC_LINUX_THREADS)
|
||||
|
||||
#include "private/gc_priv.h" /* For GC_compare_and_exchange, GC_memory_barrier */
|
||||
#include "private/specific.h"
|
||||
|
||||
static tse invalid_tse = {INVALID_QTID, 0, 0, INVALID_THREADID};
|
||||
|
||||
+1
-9
@@ -1,4 +1,3 @@
|
||||
# include "gc_config_macros.h"
|
||||
# include "private/gcconfig.h"
|
||||
# include <stdio.h>
|
||||
|
||||
@@ -11,17 +10,10 @@ int main()
|
||||
"-Wl,--wrap -Wl,pthread_sigmask -Wl,--wrap -Wl,sleep\n");
|
||||
# endif
|
||||
# if defined(GC_LINUX_THREADS) || defined(GC_IRIX_THREADS) \
|
||||
|| defined(GC_SOLARIS_PTHREADS) \
|
||||
|| defined(GC_FREEBSD_THREADS) || defined(GC_SOLARIS_PTHREADS) \
|
||||
|| defined(GC_DARWIN_THREADS) || defined(GC_AIX_THREADS)
|
||||
printf("-lpthread\n");
|
||||
# endif
|
||||
# if defined(GC_FREEBSD_THREADS)
|
||||
# if (__FREEBSD_version >= 500000)
|
||||
printf("-lpthread\n");
|
||||
# else
|
||||
printf("-pthread\n");
|
||||
# endif
|
||||
# endif
|
||||
# if defined(GC_HPUX_THREADS) || defined(GC_OSF1_THREADS)
|
||||
printf("-lpthread -lrt\n");
|
||||
# endif
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@
|
||||
/* Eventually this one may become unnecessary. For now we need */
|
||||
/* it to keep the old-style build process working. */
|
||||
#define GC_TMP_VERSION_MAJOR 6
|
||||
#define GC_TMP_VERSION_MINOR 6
|
||||
#define GC_TMP_ALPHA_VERSION GC_NOT_ALPHA
|
||||
#define GC_TMP_VERSION_MINOR 3
|
||||
#define GC_TMP_ALPHA_VERSION 6
|
||||
|
||||
#ifndef GC_NOT_ALPHA
|
||||
# define GC_NOT_ALPHA 0xff
|
||||
|
||||
+2
-13
@@ -1,7 +1,6 @@
|
||||
#include "private/gc_priv.h"
|
||||
|
||||
#if defined(GC_WIN32_THREADS)
|
||||
|
||||
#include "private/gc_priv.h"
|
||||
#include <windows.h>
|
||||
|
||||
#ifdef CYGWIN32
|
||||
@@ -11,7 +10,6 @@
|
||||
# undef pthread_create
|
||||
# undef pthread_sigmask
|
||||
# undef pthread_join
|
||||
# undef pthread_detach
|
||||
# undef dlopen
|
||||
|
||||
# define DEBUG_CYGWIN_THREADS 0
|
||||
@@ -197,7 +195,7 @@ static void GC_delete_thread(DWORD thread_id) {
|
||||
/* Must still be in_use, since nobody else can store our thread_id. */
|
||||
i++) {}
|
||||
if (i > my_max) {
|
||||
WARN("Removing nonexistent thread %ld\n", (GC_word)thread_id);
|
||||
WARN("Removing nonexisiting thread %ld\n", (GC_word)thread_id);
|
||||
} else {
|
||||
GC_delete_gc_thread(thread_table+i);
|
||||
}
|
||||
@@ -244,9 +242,6 @@ void GC_push_thread_structures GC_PROTO((void))
|
||||
# endif
|
||||
}
|
||||
|
||||
/* Defined in misc.c */
|
||||
extern CRITICAL_SECTION GC_write_cs;
|
||||
|
||||
void GC_stop_world()
|
||||
{
|
||||
DWORD thread_id = GetCurrentThreadId();
|
||||
@@ -255,9 +250,6 @@ void GC_stop_world()
|
||||
if (!GC_thr_initialized) ABORT("GC_stop_world() called before GC_thr_init()");
|
||||
|
||||
GC_please_stop = TRUE;
|
||||
# ifndef CYGWIN32
|
||||
EnterCriticalSection(&GC_write_cs);
|
||||
# endif /* !CYGWIN32 */
|
||||
for (i = 0; i <= GC_get_max_thread_index(); i++)
|
||||
if (thread_table[i].stack_base != 0
|
||||
&& thread_table[i].id != thread_id) {
|
||||
@@ -288,9 +280,6 @@ void GC_stop_world()
|
||||
# endif
|
||||
thread_table[i].suspended = TRUE;
|
||||
}
|
||||
# ifndef CYGWIN32
|
||||
LeaveCriticalSection(&GC_write_cs);
|
||||
# endif /* !CYGWIN32 */
|
||||
}
|
||||
|
||||
void GC_start_world()
|
||||
|
||||
@@ -1687,10 +1687,6 @@
|
||||
RelativePath="mono\mini\abcremoval.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\mono\mini\aliasing.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="mono\mini\aot.c"
|
||||
>
|
||||
@@ -1716,10 +1712,6 @@
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\mono\mini\branch-opts.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="mono\mini\cfold.c"
|
||||
>
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
2006-02-22 Jelmer Vernooij <[email protected]>
|
||||
* mbas.1, Makefile.am: Add manpage for mbas (based on mcs.1)
|
||||
|
||||
2006-01-26 Jonathan Pryor <[email protected]>
|
||||
|
||||
* ChangeLog: Started
|
||||
* mono-shlib-cop.1: Document another BUG/design issue that it doesn't check
|
||||
for; formatting/style changes.
|
||||
|
||||
+1
-1
@@ -2,6 +2,6 @@ man_MANS = mcs.1 mono.1 monostyle.1 mono-config.5 sqlsharp.1 oldmono.1 ilasm.1 \
|
||||
cert2spc.1 cilc.1 genxs.1 wsdl.1 disco.1 soapsuds.1 makecert.1 \
|
||||
chktrust.1 setreg.1 sn.1 secutil.1 signcode.1 certmgr.1 monop.1 xsd.1 gacutil.1 \
|
||||
macpack.1 mkbundle.1 dtd2xsd.1 permview.1 prj2make.1 mono-service.1 mono-shlib-cop.1 \
|
||||
al.1 mozroots.1 mono-xmltool.1 mbas.1
|
||||
al.1 mozroots.1
|
||||
|
||||
EXTRA_DIST = $(man_MANS)
|
||||
-240
@@ -1,240 +0,0 @@
|
||||
.TH mbas 1 "21 February 2006"
|
||||
.SH NAME
|
||||
mbas \- Mono Basic Compiler.
|
||||
.SH SYNOPSIS
|
||||
.B mbas
|
||||
[option] [source-files]
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
.I MonoBASIC (mbas)
|
||||
is a CIL compiler for the VisualBasic.NET language, an
|
||||
extended version of Visual Basic.
|
||||
.PP
|
||||
Applications developed on Windows with vbc can execute on Mono and applications
|
||||
compiled with 'mbas' can be executed on .NET runtime.
|
||||
.PP
|
||||
The Mono Basic compiler accepts the same options as
|
||||
the Microsoft VB.NET compiler. Those options can start with a slash or a
|
||||
dash (/checked is the same as -checked). Additionally to this, the
|
||||
GNU-like options are supported, those begin with "--". All
|
||||
-specific flags which are not available in the Microsoft VB.NET
|
||||
compiler are available only with the GNU-style options.
|
||||
.PP
|
||||
Visual Basic.NET source files must end with a ".vb" extension. Compilation of
|
||||
VB.NET source code requires all the files that make up a library, module or
|
||||
executable to be provided on the command line. There is no support
|
||||
for partial compilation. To achieve the benefits of partial
|
||||
compilation, you should compile programs into their own assemblies,
|
||||
and later reference them with the "-r" flag.
|
||||
.PP
|
||||
The Mono Basic compiler generates images (.exe files) that contain
|
||||
CIL byte code that can be executed by any system that implements a Common
|
||||
Language Infrastructure virtual machine such as the Microsoft .NET
|
||||
runtime engine on Windows or the Mono runtime engine on Unix systems.
|
||||
Executables are not bound to a specific CPU or operating system.
|
||||
.PP
|
||||
The Mono Basic compiler by default only references three assemblies:
|
||||
mscorlib.dll, System.dll and System.Xml.dll. If you want to
|
||||
reference extra libraries you must manually specify them using the
|
||||
-pkg: command line option or the -r: command line option.
|
||||
Alternatively if you want to get all of the System libraries, you can
|
||||
use the -pkg:dotnet command line option.
|
||||
.PP
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.I \-\-about
|
||||
Displays information about the Mono Basic compiler
|
||||
.TP
|
||||
.I \-\-addmodule:MODULE1[,MODULE2]
|
||||
Includes the specified modules in the resulting assembly.
|
||||
.TP
|
||||
.I -codepage:ID
|
||||
Specifies the code page used to process the input files from the
|
||||
point it is specified on. By default files will be processed in the
|
||||
Latin-1 code page. The compiler will also automatically detect
|
||||
Unicode files that have an embedded byte mark at the beginning.
|
||||
.TP
|
||||
Other popular encodings are 28591 (Latin1), 1252 (iso-8859-1) and 65001 (UTF-8).
|
||||
.TP
|
||||
Mono Basic supports a couple of shorthands: "utf8" can be used to specify utf-8 instead
|
||||
of using the cryptic 65001 and "reset" restores the automatic handling of
|
||||
code pages. These shorthands are not available on the Microsoft compiler.
|
||||
.TP
|
||||
.I \-define:SYMLIST, -d:SYMLIST
|
||||
Defines the symbol listed by the semi-colon separeted list SYMLIST
|
||||
SYMBOL. This can be tested in the source code by the pre-processor,
|
||||
or can be used by methods that have been tagged with the Conditional
|
||||
attribute.
|
||||
.TP
|
||||
.I \-debug-args:arguments
|
||||
Debugger arguments.
|
||||
.TP
|
||||
.I \-debug:AMOUNT
|
||||
Specify the amount of debugging information to emit. Possible values for
|
||||
AMOUNT are "full" and "pdbonly".
|
||||
.TP
|
||||
.I \-~, \-debugoptions
|
||||
Show debugging info while processing options.
|
||||
.TP
|
||||
.I \-\-fatal
|
||||
This is used for debugging the compiler. This makes the error emission
|
||||
generate an exception that can be caught by a debugger.
|
||||
.TP
|
||||
.I \-imports:import-list
|
||||
Declare global Imports for listed namespaces.
|
||||
.TP
|
||||
.I \-ignorewarn:XXXX
|
||||
Ignores warning number XXXX.
|
||||
.TP
|
||||
.I -lib:PATHLIST, -libpath:PATHLIST
|
||||
Each path specified in the comma-separated list will direct the
|
||||
compiler to look for libraries in that specified path.
|
||||
.TP
|
||||
.I \-L PATH
|
||||
Directs the compiler to look for libraries in the specified path.
|
||||
Multiple paths can be provided by using the option multiple times.
|
||||
.TP
|
||||
.I \-main:CLASS
|
||||
Tells the compiler which CLASS or MODULE contains the entry point. Useful when
|
||||
you are compiling several classes with a Main method.
|
||||
.TP
|
||||
.I \-nologo
|
||||
Suppress printing copyright information on startup.
|
||||
.TP
|
||||
.I \-nostdlib, -nostdlib+
|
||||
Use this flag if you want to compile the core library. This makes the
|
||||
compiler load its internal types from the assembly being compiled.
|
||||
.TP
|
||||
.I \-noconfig, \-noconfig+
|
||||
Disables the default compiler configuration to be loaded. The
|
||||
compiler by default has references to the system assemblies.
|
||||
.TP
|
||||
.I \-nowarn
|
||||
Makes the compiler ignore warnings.
|
||||
.TP
|
||||
.I \-optioncompare:binary, \-optioncompare:text
|
||||
Select between binary and text string comparisons. The default is binary
|
||||
string comparisons.
|
||||
.TP
|
||||
.I \-optionexplicit[+|-]
|
||||
Require explicit declaration of variables
|
||||
.TP
|
||||
.I \-optionstrict[+|-]
|
||||
Enforce strict language semantics
|
||||
.TP
|
||||
.I \-out:FNAME, -o FNAME
|
||||
Names the output file to be generated.
|
||||
.TP
|
||||
.I \-\-parse
|
||||
Used for benchmarking. The compiler will only parse its input files.
|
||||
Currently ignored.
|
||||
.TP
|
||||
.I \-pkg:package1[,packageN]
|
||||
The compiler will invoke pkg-config --libs on the set of packages
|
||||
specified on the command line to obtain libraries and directories to
|
||||
compile the code.
|
||||
.PP
|
||||
This is typically used with third party components, like this:
|
||||
.nf
|
||||
$ mbas -pkg:gtk-sharp demo.vb
|
||||
.fi
|
||||
.TP
|
||||
.TP
|
||||
.I \-pkg:dotnet
|
||||
This will instruct the compiler to reference the System.* libraries
|
||||
available on a typical dotnet framework installation, notice that this
|
||||
does not include all of the Mono libraies, only the System.* ones. This
|
||||
is a convenient shortcut for those porting code.
|
||||
.TP
|
||||
.I -q -quiet
|
||||
Commands the compiler to show only error messages for syntax-related errors
|
||||
and warnings.
|
||||
.TP
|
||||
.I -resource:RESOURCE[,ID]
|
||||
Embeds to the given resource file. The optional ID can be used to
|
||||
give a different name to the resource. If not specified, the resource
|
||||
name will be the file name.
|
||||
.TP
|
||||
.I -linkresource:RESOURCE[,ID]
|
||||
Links to the specified RESOURCE. The optional ID can be used to give
|
||||
a name to the linked resource.
|
||||
.TP
|
||||
.I -r:ASSEMBLY1[,ASSEMBLY2], \-r ASSEMBLY1[,ASSEMBLY2]
|
||||
Reference the named assemblies. Use this to use classes from the named
|
||||
assembly in your program. The assembly will be loaded from either the
|
||||
system directory where all the assemblies live, or from the path
|
||||
explicitly given with the -L option.
|
||||
.PP
|
||||
You can also use a semicolon to separate the assemblies instead of a
|
||||
comma.
|
||||
.TP
|
||||
.I \-removeintchecks[+|-]
|
||||
Remove integer checks. Default off.
|
||||
.TP
|
||||
.I \-rootnamespace:namespace
|
||||
Specifies the root namespace for all type declarations
|
||||
.TP
|
||||
.I \-\-stacktrace
|
||||
Generates a stack trace at the time the error is reported, useful for
|
||||
debugging the compiler.
|
||||
.TP
|
||||
.I \-target:KIND, \-t:KIND
|
||||
Used to specify the desired target. The possible values are: exe
|
||||
(plain executable), winexe (Windows.Forms executable), library
|
||||
(component libraries) and module (partial library).
|
||||
.TP
|
||||
.I \-\-timestamp
|
||||
Another debugging flag. Used to display the times at various points
|
||||
in the compilation process.
|
||||
.TP
|
||||
.I \-tokenize
|
||||
Only tokenizes source files. Currently ignored.
|
||||
.TP
|
||||
.I \-unsafe, -unsafe+
|
||||
Enables compilation of unsafe code.
|
||||
.TP
|
||||
.I \-utf8output[+|-]
|
||||
Emit compiler output in UTF8 character encoding. Currently ignored.
|
||||
.TP
|
||||
.I \-v
|
||||
Debugging. Turns on verbose yacc parsing.
|
||||
.TP
|
||||
.I -. -verbosegetoptions
|
||||
Show verbose parsing of options
|
||||
.TP
|
||||
.I \-\-version
|
||||
Shows the compiler version.
|
||||
.TP
|
||||
.I \-warnaserror, \-warnaserror+
|
||||
Treat warnings as errors.
|
||||
.TP
|
||||
.I \-wlevel:LEVEL
|
||||
Sets the warning level. 0 is the lowest warning level, and 4 is the
|
||||
highest. The default is 2.
|
||||
.TP
|
||||
.I \-\-
|
||||
Use this to stop option parsing, and allow option-looking parameters
|
||||
to be passed on the command line.
|
||||
.SH STABILITY
|
||||
As of early 2006, the Mono Basic compiler is still considered alpha software.
|
||||
Several language constructions that are accepted by the Microsoft Visual
|
||||
Basic.NET compiler are refused by the Mono Basic compiler. Occassional
|
||||
crashes also still occur.
|
||||
.PP
|
||||
.SH AUTHORS
|
||||
See the ChangeLog for authors
|
||||
.PP
|
||||
.SH LICENSE
|
||||
The Mono Basic compiler is released under the terms of the GNU GPL.
|
||||
Please read the accompanying `COPYING' file for details. Alternative
|
||||
licenses are available from Ximian.
|
||||
.PP
|
||||
.SH SEE ALSO
|
||||
mcs(1), mono(1), mint(1), sn(1)
|
||||
.PP
|
||||
.SH BUGS
|
||||
To report bugs in the compiler, you can use `bug-buddy', or you can
|
||||
file bug reports in our bug tracking system:
|
||||
http://bugzilla.ximian.com.
|
||||
.SH MAILING LIST
|
||||
The Mono Basic Mailing List is available at: [email protected]
|
||||
@@ -144,11 +144,6 @@ is to omit the switch.
|
||||
ISO-1 - Restrict compiler to use only ISO standardized features.
|
||||
The usage of features such as generics, static classes, anonymous
|
||||
methods will lead to error.
|
||||
.Sp
|
||||
Notice that this flag only controls the language features available to
|
||||
the programmer, it does not control the kind of assemblies produced.
|
||||
Programs compiled with mcs will reference the 1.1 APIs, Programs
|
||||
compiled with gmcs reference the 2.0 APIs.
|
||||
.TP
|
||||
.I -lib:PATHLIST
|
||||
Each path specified in the comma-separated list will direct the
|
||||
|
||||
@@ -87,22 +87,9 @@ When passed, DIR will be set for the MONO_CFG_DIR environment variable
|
||||
Compresses the assemblies before embedding. This results in smaller
|
||||
executable files, but increases startup time and requires zlib to be
|
||||
installed on the target system.
|
||||
.SH ENVIRONMENT VARIABLES
|
||||
.TP
|
||||
.I "AS"
|
||||
Assembler command. The default is "as".
|
||||
.TP
|
||||
.I "CC"
|
||||
C compiler command. The default is "cc" under Linux and "gcc -mno-cygwin"
|
||||
under Windows.
|
||||
.SH FILES
|
||||
This program will load referenced assemblies from the Mono assembly
|
||||
cache.
|
||||
.SH BUGS
|
||||
The options "--static" and "-z" are not supported under Windows.
|
||||
Moreover, a full cygwin environment containing at least "gcc" and "as"
|
||||
is required for the build process. The generated executable does not
|
||||
depend on cygwin.
|
||||
.SH MAILING LISTS
|
||||
Visit http://lists.ximian.com/mailman/listinfo/mono-devel-list for details.
|
||||
.SH WEB SITE
|
||||
|
||||
+26
-121
@@ -1,13 +1,3 @@
|
||||
.\"
|
||||
.\" mono-shlib-cop manual page.
|
||||
.\" (C) 2005-2006 Jonathan Pryor
|
||||
.\" Author:
|
||||
.\" Jonathan Pryor ([email protected])
|
||||
.\"
|
||||
.de Sp \" Vertical space (when we can't use .PP)
|
||||
.if t .sp .5v
|
||||
.if n .sp
|
||||
..
|
||||
.TH "mono-shlib-cop" 1
|
||||
.SH NAME
|
||||
mono-shlib-cop \- Shared Library Usage Checker
|
||||
@@ -24,7 +14,7 @@ correct.
|
||||
.SH DESCRIPTION
|
||||
.I mono-shlib-cop
|
||||
is a tool that inspects a managed assembly looking for
|
||||
erroneous or suspecious usage of shared libraries.
|
||||
erroneous or suspecious behavior of shared libraries.
|
||||
.PP
|
||||
The tool takes one or more assembly filenames, and inspects each assembly
|
||||
specified.
|
||||
@@ -43,39 +33,25 @@ The warnings checked for include:
|
||||
Is the target shared library a versioned library? (Relevant only on Unix
|
||||
systems, not Mac OS X or Windows.)
|
||||
.PP
|
||||
In general, only versioned libraries such as
|
||||
.I libc.so.6
|
||||
are present on the
|
||||
user's machine, and efforts to load
|
||||
.I libc.so
|
||||
will result in a
|
||||
.B System.DllNotFoundException.
|
||||
There are three solutions to this:
|
||||
In general, only versioned libraries such as libc.so.6 are present on the
|
||||
user's machine, and efforts to load libc.so will result in a
|
||||
System.DllNotFoundException. There are three solutions to this:
|
||||
.TP
|
||||
1.
|
||||
Require that the user install any
|
||||
.I -devel
|
||||
packages which provide the
|
||||
Require that the user install any -devel packages which provide the
|
||||
unversioned library. This usually requires that the user install a large
|
||||
number of additional packages, complicating the installation process.
|
||||
.TP
|
||||
2.
|
||||
Use a fully versioned name in your
|
||||
.B DllImport
|
||||
statements. This requires
|
||||
Use a fully versioned name in your DllImport statements. This requires
|
||||
editing your source code and recompiling whenever you need to target a
|
||||
different version of the shared library.
|
||||
.TP
|
||||
3.
|
||||
Provide an
|
||||
.I assembly.config
|
||||
file which contains <dllmap/> elements to remap
|
||||
Provide an assembly.config file which contains <dllmap/> elements to remap
|
||||
the shared library name used by your assembly to the actual versioned shared
|
||||
library present on the users system. Mono provides a number of pre-existing
|
||||
<dllmap/> entries, including ones for
|
||||
.I libc.so
|
||||
and
|
||||
.I libX11.so.
|
||||
<dllmap/> entries, including libc.so and libX11.so.
|
||||
.SH EXAMPLE
|
||||
The following code contains examples of the above errors and warnings:
|
||||
.nf
|
||||
@@ -94,52 +70,26 @@ The following code contains examples of the above errors and warnings:
|
||||
.TP
|
||||
Bad library name
|
||||
Assuming that the library
|
||||
.I bad-library-name
|
||||
doesn't exist on your machine,
|
||||
.I Demo.BadLibraryName
|
||||
will generate an error, as
|
||||
it requires a shared library which cannot be loaded.
|
||||
This may be ignorable; see
|
||||
.B BUGS
|
||||
.
|
||||
.B bad-library-name
|
||||
doesn't exist on your machine, Demo.BadLibraryName will generate an error, as
|
||||
it requires a shared library which doesn't exist.
|
||||
.TP
|
||||
Bad symbol name
|
||||
.I Demo.BadSymbolName
|
||||
will generate an error, as
|
||||
.I libc.so
|
||||
(remapped to
|
||||
.I libc.so.6
|
||||
by mono's
|
||||
.I $prefix/etc/mono/config
|
||||
file) doesn't contain the function
|
||||
.I BadSymbolName
|
||||
.
|
||||
Demo.BadSymbolName will generate an error, as libc.so (remapped to libc.so.6
|
||||
by mono's $prefix/etc/mono/config file) doesn't contain the function
|
||||
BadSymbolName.
|
||||
.TP
|
||||
Unversioned library dependency
|
||||
Assuming you have the file
|
||||
.I libcap.so
|
||||
,
|
||||
.I Demo.cap_clear
|
||||
will generate a
|
||||
warning because, while
|
||||
.I libcap.so
|
||||
could be loaded,
|
||||
.I libcap.so
|
||||
might not exist on
|
||||
the users machine (on FC2,
|
||||
.I /lib/libcap.so
|
||||
is provided by
|
||||
Assuming you have the file libcap.so, Demo.cap_clear will generate a
|
||||
warning because, while libcap.so could be loaded, libcap.so might not exist on
|
||||
the users machine (on FC2, /lib/libcap.so is provided by
|
||||
.I libcap-devel
|
||||
, and you can't assume that end users will have any
|
||||
.I "-devel"
|
||||
packages installed).
|
||||
, and you can't assume that end users will have any -devel packages installed).
|
||||
.SH FIXING CODE
|
||||
The fix depends on the warning or error:
|
||||
.TP
|
||||
Bad library names
|
||||
Use a valid library name in the
|
||||
.B DllImport
|
||||
attribute, or provide a <dllmap/>
|
||||
Use a valid library name in the DllImport attribute, or provide a <dllmap/>
|
||||
entry to map your existing library name to a valid library name.
|
||||
.TP
|
||||
Bad symbol names
|
||||
@@ -164,16 +114,13 @@ mapping information. For example, with
|
||||
.I Mono.Posix.dll.config
|
||||
\.
|
||||
.PP
|
||||
The
|
||||
.I .config
|
||||
file is an XML document containing a top-level <configuration/>
|
||||
The .config file is an XML document containing a top-level <configuration/>
|
||||
section with nested <dllmap/> entries, which contains
|
||||
.B dll
|
||||
and
|
||||
.B target
|
||||
attributes. The dll attribute should contain the same string used in your
|
||||
.B DllImport
|
||||
attribute value, and the target attribute specifies which shared
|
||||
DllImport attribute value, and the target attribute specifies which shared
|
||||
library mono should
|
||||
.I actually
|
||||
load at runtime.
|
||||
@@ -185,59 +132,17 @@ A sample .config file is:
|
||||
</configuration>
|
||||
.fi
|
||||
.SH BUGS
|
||||
.TP
|
||||
*
|
||||
Only
|
||||
.B DllImport
|
||||
entries are checked; the surrounding IL is ignored. Consequently, if a runtime
|
||||
check is performed to choose which shared library to invoke, an error will be
|
||||
reported even though the specified library is never used. Consider this code:
|
||||
.nf
|
||||
using System.Runtime.InteropServices; // for DllImport
|
||||
class Beep {
|
||||
[DllImport ("kernel32.dll")]
|
||||
private static extern int Beep (int dwFreq, int dwDuration);
|
||||
|
||||
[DllImport ("libcurses.so")]
|
||||
private static extern int beep ();
|
||||
|
||||
public static void Beep ()
|
||||
{
|
||||
if (System.IO.Path.DirectorySeparatorChar == '\\\\') {
|
||||
Beep (750, 300);
|
||||
}
|
||||
else {
|
||||
beep ();
|
||||
}
|
||||
}
|
||||
}
|
||||
.fi
|
||||
If
|
||||
.I mono-shlib-cop
|
||||
is run on this assembly, an error will be reported for using
|
||||
.I kernel32.dll
|
||||
, even though
|
||||
.I kernel32.dll
|
||||
will never be used on Unix platforms.
|
||||
.TP
|
||||
*
|
||||
.I mono-shlib-cop
|
||||
currently only examines the shared library file extension to determine if a
|
||||
warning should be generated. A
|
||||
.I .so
|
||||
extension will always generate a warning, even if the
|
||||
.I .so
|
||||
is not a symlink,
|
||||
isn't provided in a
|
||||
.I -devel
|
||||
package, and there is no versioned shared library
|
||||
(possible examples including
|
||||
.I /usr/lib/libtcl8.4.so,
|
||||
.I /usr/lib/libubsec.so,
|
||||
extension will always generate a warning, even if the .so is not a symlink,
|
||||
isn't provided in a -devel package, and there is no versioned shared library
|
||||
(possible examples including /usr/lib/libtcl8.4.so, /usr/lib/libubsec.so,
|
||||
etc.).
|
||||
.Sp
|
||||
.PP
|
||||
Consequently, warnings for any such libraries are useless, and incorrect.
|
||||
.Sp
|
||||
.PP
|
||||
Windows and Mac OS X will never generate warnings, as these
|
||||
platforms use different shared library extensions.
|
||||
.SH MAILING LISTS
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
.\"
|
||||
.\" mono manual page.
|
||||
.\" (C) 2003 Ximian, Inc.
|
||||
.\" (C) 2004-2005 Novell, Inc.
|
||||
.\" Author:
|
||||
.\" Miguel de Icaza ([email protected])
|
||||
.\"
|
||||
.de Sp \" Vertical space (when we can't use .PP)
|
||||
.if t .sp .5v
|
||||
.if n .sp
|
||||
..
|
||||
.TH mono-xmltool "Mono 1.0"
|
||||
.SH NAME
|
||||
mono-xmltool \- Mono XML validation and transformation tool.
|
||||
.SH SYNOPSIS
|
||||
.PP
|
||||
.B mono-xmltool --validate [*.rng | *.rnc | *.nvdl | *.xsd] [instances]
|
||||
.PP
|
||||
.B mono-xmltool --validate-rng relax-ng-grammar-xml [instances]
|
||||
.PP
|
||||
.B mono-xmltool --validate-rnc relax-ng-compact-grammar-file [instances]
|
||||
.PP
|
||||
.B mono-xmltool --validate-nvdl nvdl-script-xml [instances]
|
||||
.PP
|
||||
.B mono-xmltool --validate-xsd xml-schema [instances]
|
||||
.PP
|
||||
.B mono-xmltool --transform stylesheet instance-xml
|
||||
.PP
|
||||
.B mono-xmltool --prettyprint [source [result]]
|
||||
.PP
|
||||
.SH DESCRIPTION
|
||||
\fImono-xmltool\fP is a command line front end for various functions
|
||||
available in the Mono XML class libraries, currently it offers
|
||||
validation with various different kinds of schemas, xslt
|
||||
transformations and pretty printing.
|
||||
.PP
|
||||
.SH XML VALIDATION
|
||||
mono-xmltool can validate a given set of XML files (the instances
|
||||
parameter) using the given schema file. Currently supported schema
|
||||
files include Relax NG (*.rng), Compact Relax NG (*.rnc),
|
||||
Namespace-based Validation Dispatching Language (*.nvdl) and XML
|
||||
Schema (*.xsd).
|
||||
.PP
|
||||
If invoked with the --validate argument, Mono will use the filename
|
||||
extension to guess the kind of validation required. The
|
||||
--validate-xxx flags would force a specific kind of validation.
|
||||
.PP
|
||||
The following lists the flags and the actual class that implements
|
||||
this in Mono:
|
||||
.TP
|
||||
.I --validate-rng
|
||||
.Sp
|
||||
Commons.Xml.Relaxng.RelaxNgPattern as the schema, and
|
||||
Commons.Xml.Relaxng.RelaxngValidatingReader validator.
|
||||
.TP
|
||||
.I --validate-rnc
|
||||
Commons.Xml.Relaxng.RncParser as the schema, and
|
||||
Commons.Xml.Relaxng.RelaxngValidatingReader validator.
|
||||
.TP
|
||||
.I --validate-nvdl
|
||||
.Sp
|
||||
Commons.Xml.Nvdl as the schema and Commons.Xml.NvdlValidatingReader
|
||||
validator.
|
||||
.TP
|
||||
.I --validate-xsd
|
||||
System.Xml.Schema.XmlSchema as the schema and uses
|
||||
System.Xml.XmlValidatingReader as the validator.
|
||||
.SH TRANSFORMATIONS
|
||||
This does an XSLT transformation, the stylesheet must be an XSLT file,
|
||||
the instance-xml is the document to be processed. Output it sent to
|
||||
the standard output.
|
||||
.SH PRETTY PRINTING
|
||||
Produces a prett-print rendering of the
|
||||
.I source
|
||||
file. If it is not
|
||||
specified it reads the standard input. If
|
||||
.I result
|
||||
is not specified, the output is sent to the standard output.
|
||||
.SH MAILING LISTS
|
||||
Mailing lists are listed at the
|
||||
http://www.mono-project.com/Mailing_Lists
|
||||
.SH WEB SITE
|
||||
http://www.mono-project.com
|
||||
.SH SEE ALSO
|
||||
.BR mono(1), mcs(1).
|
||||
+1
-1
@@ -31,7 +31,7 @@ default_centum_tests := \
|
||||
class/System.XML \
|
||||
class/System.Data
|
||||
|
||||
net_2_0_centum_tests := $(centum_tests) #class/Mono.C5
|
||||
net_2_0_centum_tests := $(centum_tests) class/Mono.C5
|
||||
|
||||
ifdef ONLY_CENTUM_TESTS
|
||||
TEST_SUBDIRS := $($(PROFILE)_centum_tests)
|
||||
|
||||
@@ -1,14 +1,3 @@
|
||||
2006-01-19 Raja R Harinath <[email protected]>
|
||||
|
||||
* library.make (test_lib): Don't allow to be overridden.
|
||||
(test_against, test_dep): Remove.
|
||||
|
||||
2006-01-11 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* executable.make: allow installing a different .config file for
|
||||
executables such as nunit-console.exe that should use a different one
|
||||
depending on the profile.
|
||||
|
||||
2006-01-05 Raja R Harinath <[email protected]>
|
||||
|
||||
* library.make (run-test-lib, run-test-ondotnet-lib): Workaround a
|
||||
|
||||
@@ -4,10 +4,7 @@
|
||||
|
||||
base_prog = $(shell basename $(PROGRAM))
|
||||
sourcefile = $(base_prog).sources
|
||||
base_prog_config := $(wildcard $(base_prog).config.$(PROFILE))
|
||||
ifndef base_prog_config
|
||||
base_prog_config := $(wildcard $(base_prog).config)
|
||||
endif
|
||||
ifdef base_prog_config
|
||||
PROGRAM_config := $(PROGRAM).config
|
||||
endif
|
||||
|
||||
+17
-4
@@ -63,20 +63,33 @@ test_nunit_dep = $(test_nunit_lib:%=$(topdir)/class/lib/$(PROFILE)/%)
|
||||
test_nunit_ref = $(test_nunit_dep:%=-r:%)
|
||||
library_CLEAN_FILES += TestResult*.xml
|
||||
|
||||
ifndef test_against
|
||||
test_against = $(the_lib)
|
||||
test_dep = $(the_lib)
|
||||
endif
|
||||
|
||||
ifndef test_lib
|
||||
test_lib = $(LIBRARY:.dll=_test_$(PROFILE).dll)
|
||||
test_sourcefile = $(LIBRARY:.dll=_test.dll.sources)
|
||||
else
|
||||
test_sourcefile = $(test_lib).sources
|
||||
endif
|
||||
test_pdb = $(test_lib:.dll=.pdb)
|
||||
test_response = $(depsdir)/$(test_lib).response
|
||||
test_makefrag = $(depsdir)/$(test_lib).makefrag
|
||||
test_flags = -r:$(the_lib) $(test_nunit_ref) $(TEST_MCS_FLAGS)
|
||||
test_flags = -r:$(test_against) $(test_nunit_ref) $(TEST_MCS_FLAGS)
|
||||
library_CLEAN_FILES += $(LIBRARY:.dll=_test*.dll) $(LIBRARY:.dll=_test*.pdb) $(test_response) $(test_makefrag)
|
||||
|
||||
ifndef btest_lib
|
||||
btest_lib = $(LIBRARY:.dll=_btest_$(PROFILE).dll)
|
||||
btest_sourcefile = $(LIBRARY:.dll=_btest.dll.sources)
|
||||
else
|
||||
btest_sourcefile = $(btest_lib).sources
|
||||
endif
|
||||
btest_pdb = $(btest_lib:.dll=.pdb)
|
||||
btest_response = $(depsdir)/$(btest_lib).response
|
||||
btest_makefrag = $(depsdir)/$(btest_lib).makefrag
|
||||
btest_flags = -r:$(the_lib) $(test_nunit_ref) $(TEST_MBAS_FLAGS)
|
||||
btest_flags = -r:$(test_against) $(test_nunit_ref) $(TEST_MBAS_FLAGS)
|
||||
library_CLEAN_FILES += $(LIBRARY:.dll=_btest*.dll) $(LIBRARY:.dll=_btest*.pdb) $(btest_response) $(btest_makefrag)
|
||||
|
||||
ifndef HAVE_CS_TESTS
|
||||
@@ -306,7 +319,7 @@ endif
|
||||
|
||||
ifdef HAVE_CS_TESTS
|
||||
|
||||
$(test_lib): $(the_lib) $(test_response) $(test_nunit_dep)
|
||||
$(test_lib): $(test_dep) $(test_response) $(test_nunit_dep)
|
||||
$(TEST_COMPILE) -target:library -out:$@ $(test_flags) @$(test_response)
|
||||
|
||||
$(test_response): $(test_sourcefile)
|
||||
@@ -323,7 +336,7 @@ endif
|
||||
|
||||
ifdef HAVE_VB_TESTS
|
||||
|
||||
$(btest_lib): $(the_lib) $(btest_response) $(test_nunit_dep)
|
||||
$(btest_lib): $(test_dep) $(btest_response) $(test_nunit_dep)
|
||||
$(BTEST_COMPILE) -target:library -out:$@ $(btest_flags) @$(btest_response)
|
||||
|
||||
$(btest_response): $(btest_sourcefile)
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
2006-01-18 Chris Toshok <[email protected]>
|
||||
|
||||
* Makefile (common_dirs): add System.Web again after
|
||||
System.Web.Services.
|
||||
|
||||
2006-01-05 Raja R Harinath <[email protected]>
|
||||
|
||||
* Makefile: Build FirebirdSql.Data.Firebird only in the "default"
|
||||
|
||||
@@ -1,51 +1,6 @@
|
||||
2006-02-02 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* RdpPatterns.cs : After profiling in depth, finally I found the
|
||||
source of the worst perf. problem in the code - return x for
|
||||
(choice x x).
|
||||
It now validates 5MB of OpenDocument specification content.xml,
|
||||
which only Jing could do.
|
||||
|
||||
2006-01-16 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* RdpObjects.cs : fixed warnings.
|
||||
|
||||
2006-01-16 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* RdpPatterns.cs : RdpOneOrMore.EmptyTextDeriv() should be "override".
|
||||
RdpList.EmptyTextDeriv() (which was also virtual incorrectly) was
|
||||
removed since the code was in wrong assumption.
|
||||
* Util.cs : debug string now contains data and dataExcept info.
|
||||
|
||||
2006-01-15 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* RdpPatterns.cs : lazy evaluate Group branches. If left hand is
|
||||
notAllowed, the returned value is always NotAllowed, no need to
|
||||
compute another branch.
|
||||
|
||||
2006-01-13 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* RdpObjects.cs, RdpPatterns.cs : introduced "IsContextDependent"
|
||||
optimization; when a pattern is (namespace) context independent
|
||||
(almost all cases except for QName validation), new TextDeriv()
|
||||
overload that takes MemoizationStore memoizes TextDeriv results.
|
||||
|
||||
2006-01-12 Atsushi Enomoto <[email protected]>
|
||||
2005-01-05 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* RdpPattern.cs :
|
||||
Introduced EmptyTextDeriv() so that the results could be memoized.
|
||||
|
||||
2006-01-10 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* RdpPatterns.cs :
|
||||
- Added StartAttDeriv(), EndAttDeriv() and IsTextValueDependent.
|
||||
(See corresponding changes in RelaxngValidatingReader.cs).
|
||||
- Added a bunch of derivative method overloads to receive
|
||||
MemoizationStore and memoize results efficiently.
|
||||
|
||||
2006-01-05 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* RdpPatterns.cs :
|
||||
- Fixed RdpPattern.TextDeriv() and MixedTextDeriv() to not allow
|
||||
whitespaces incorrectly.
|
||||
- Fixed MixedTextDeriv() to not require string argument.
|
||||
@@ -60,7 +15,7 @@
|
||||
derivative algorithm (it incorrectly extended to return false
|
||||
for RELAX NG predefined datatypes).
|
||||
|
||||
2006-01-04 Atsushi Enomoto <[email protected]>
|
||||
2005-01-04 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* RdpPattern.cs :
|
||||
- Implemented textOnlyDeriv and mixedTextDeriv of "memoization".
|
||||
@@ -73,12 +28,12 @@
|
||||
- Avoid extra pattern creation with related to empty and notAllowed
|
||||
as one hand of binary branches.
|
||||
|
||||
2006-01-03 Atsushi Enomoto <[email protected]>
|
||||
2005-01-03 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* RdpPattern.cs : reduced RdpFlip instantiation. Share patternPool
|
||||
only when it does not exist.
|
||||
|
||||
2006-01-03 Atsushi Enomoto <[email protected]>
|
||||
2005-01-03 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* Util.cs, RdpPatterns.cs : optimization. Removed extraneous
|
||||
delegate instantiation. Avoid using enum for HashTable keys.
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
|
||||
public class RdpDatatype
|
||||
{
|
||||
//RelaxngDatatypeProvider provider;
|
||||
RelaxngDatatypeProvider provider;
|
||||
string localName;
|
||||
string ns;
|
||||
RelaxngDatatype datatype;
|
||||
@@ -78,7 +78,7 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
{
|
||||
this.ns = ns;
|
||||
this.localName = localName;
|
||||
//this.provider = provider;
|
||||
this.provider = provider;
|
||||
if (provider == null)
|
||||
provider = RelaxngMergedProvider.DefaultProvider;
|
||||
datatype = provider.GetDatatype (localName, ns, parameters);
|
||||
@@ -95,15 +95,13 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
get { return localName; }
|
||||
}
|
||||
|
||||
public bool IsContextDependent {
|
||||
get { return datatype.IsContextDependent; }
|
||||
}
|
||||
|
||||
public virtual bool IsAllowed (string value, XmlReader reader)
|
||||
{
|
||||
return datatype.IsValid (value, reader);
|
||||
}
|
||||
|
||||
static char [] wsChars = new char [] {' ', '\n', '\r', '\t'};
|
||||
|
||||
public virtual bool IsTypeEqual (string s1, string s2, XmlReader reader)
|
||||
{
|
||||
return datatype.CompareString (s1, s2, reader);
|
||||
|
||||
@@ -125,8 +125,6 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
return p2;
|
||||
if (p2.PatternType == RelaxngPatternType.NotAllowed)
|
||||
return p1;
|
||||
if (p1 == p2)
|
||||
return p1;
|
||||
// choice-leaves support
|
||||
if (p1.PatternType == RelaxngPatternType.Empty)
|
||||
return MakeChoiceLeaf (p2);
|
||||
@@ -292,14 +290,6 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
|
||||
public abstract bool Nullable { get; }
|
||||
|
||||
internal virtual bool IsTextValueDependent {
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
internal virtual bool IsContextDependent {
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
// fills QName collection
|
||||
public void GetLabels (LabelList elements, LabelList attributes)
|
||||
{
|
||||
@@ -332,36 +322,16 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
return RdpNotAllowed.Instance;
|
||||
}
|
||||
|
||||
internal virtual RdpPattern TextDeriv (string s, XmlReader reader, MemoizationStore memo)
|
||||
{
|
||||
return TextDeriv (s, reader);
|
||||
}
|
||||
|
||||
internal virtual RdpPattern EmptyTextDeriv (MemoizationStore memo)
|
||||
{
|
||||
return TextDeriv (String.Empty, null, memo);
|
||||
}
|
||||
|
||||
internal virtual RdpPattern TextOnlyDeriv ()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
internal virtual RdpPattern TextOnlyDeriv (MemoizationStore store)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
internal virtual RdpPattern MixedTextDeriv ()
|
||||
{
|
||||
return RdpNotAllowed.Instance;
|
||||
}
|
||||
|
||||
internal virtual RdpPattern MixedTextDeriv (MemoizationStore memo)
|
||||
{
|
||||
return RdpNotAllowed.Instance;
|
||||
}
|
||||
|
||||
public RdpPattern ListDeriv (string [] list, int index, XmlReader reader)
|
||||
{
|
||||
return listDerivInternal (list, 0, reader);
|
||||
@@ -437,11 +407,6 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
return RdpNotAllowed.Instance;
|
||||
}
|
||||
|
||||
internal virtual RdpPattern StartTagOpenDeriv (string name, string ns, MemoizationStore memo)
|
||||
{
|
||||
return StartTagOpenDeriv (name, ns);
|
||||
}
|
||||
|
||||
// attDeriv(ctx, this, att)
|
||||
// attDeriv _ _ _ = NotAllowed
|
||||
public virtual RdpPattern AttDeriv (string name, string ns, string value, XmlReader reader)
|
||||
@@ -449,26 +414,6 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
return RdpNotAllowed.Instance;
|
||||
}
|
||||
|
||||
public virtual RdpPattern StartAttDeriv (string name, string ns)
|
||||
{
|
||||
return RdpNotAllowed.Instance;
|
||||
}
|
||||
|
||||
internal virtual RdpPattern StartAttDeriv (string name, string ns, MemoizationStore memo)
|
||||
{
|
||||
return StartAttDeriv (name, ns);
|
||||
}
|
||||
|
||||
public virtual RdpPattern EndAttDeriv ()
|
||||
{
|
||||
return RdpNotAllowed.Instance;
|
||||
}
|
||||
|
||||
internal virtual RdpPattern EndAttDeriv (MemoizationStore memo)
|
||||
{
|
||||
return EndAttDeriv ();
|
||||
}
|
||||
|
||||
public bool ValueMatch (string s, XmlReader reader)
|
||||
{
|
||||
return Nullable && Util.IsWhitespace (s) ||
|
||||
@@ -480,11 +425,6 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
return this;
|
||||
}
|
||||
|
||||
internal virtual RdpPattern StartTagCloseDeriv (MemoizationStore memo)
|
||||
{
|
||||
return StartTagCloseDeriv ();
|
||||
}
|
||||
|
||||
public RdpPattern OneOrMore ()
|
||||
{
|
||||
if (PatternType == RelaxngPatternType.NotAllowed)
|
||||
@@ -497,11 +437,6 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
{
|
||||
return RdpNotAllowed.Instance;
|
||||
}
|
||||
|
||||
internal virtual RdpPattern EndTagDeriv (MemoizationStore memo)
|
||||
{
|
||||
return EndTagDeriv ();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -518,14 +453,6 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
internal override bool IsTextValueDependent {
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
internal override bool IsContextDependent {
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
static RdpEmpty instance;
|
||||
public static RdpEmpty Instance {
|
||||
get { return instance; }
|
||||
@@ -579,14 +506,6 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
internal override bool IsTextValueDependent {
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
internal override bool IsContextDependent {
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override RdpPattern ApplyAfter (RdpApplyAfterHandler h)
|
||||
{
|
||||
return RdpNotAllowed.Instance;
|
||||
@@ -639,14 +558,6 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
internal override bool IsTextValueDependent {
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
internal override bool IsContextDependent {
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override RelaxngPatternType PatternType {
|
||||
get { return RelaxngPatternType.Text; }
|
||||
}
|
||||
@@ -660,21 +571,11 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
return this;
|
||||
}
|
||||
|
||||
internal override RdpPattern EmptyTextDeriv (MemoizationStore memo)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
internal override RdpPattern MixedTextDeriv ()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
internal override RdpPattern MixedTextDeriv (MemoizationStore memo)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
internal override void MarkReachableDefs ()
|
||||
{
|
||||
// do nothing
|
||||
@@ -811,32 +712,6 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
}
|
||||
}
|
||||
|
||||
bool isTextValueDependentComputed;
|
||||
bool isTextValueDependent;
|
||||
|
||||
internal override bool IsTextValueDependent {
|
||||
get {
|
||||
if (!isTextValueDependentComputed) {
|
||||
isTextValueDependent = LValue.IsTextValueDependent || RValue.IsTextValueDependent;
|
||||
isTextValueDependentComputed = true;
|
||||
}
|
||||
return isTextValueDependent;
|
||||
}
|
||||
}
|
||||
|
||||
bool isContextDependentComputed;
|
||||
bool isContextDependent;
|
||||
|
||||
internal override bool IsContextDependent {
|
||||
get {
|
||||
if (!isContextDependentComputed) {
|
||||
isContextDependent = LValue.IsContextDependent || RValue.IsContextDependent;
|
||||
isContextDependentComputed = true;
|
||||
}
|
||||
return isContextDependent;
|
||||
}
|
||||
}
|
||||
|
||||
public override RelaxngPatternType PatternType {
|
||||
get { return RelaxngPatternType.Choice; }
|
||||
}
|
||||
@@ -899,41 +774,18 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
return LValue.TextDeriv (s, reader).Choice (RValue.TextDeriv (s, reader));
|
||||
}
|
||||
|
||||
internal override RdpPattern TextDeriv (string s, XmlReader reader, MemoizationStore memo)
|
||||
{
|
||||
return memo.TextDeriv (LValue, s, reader).Choice (memo.TextDeriv (RValue, s, reader));
|
||||
}
|
||||
|
||||
internal override RdpPattern EmptyTextDeriv (MemoizationStore memo)
|
||||
{
|
||||
return memo.EmptyTextDeriv (LValue)
|
||||
.Choice (memo.EmptyTextDeriv (RValue));
|
||||
}
|
||||
|
||||
internal override RdpPattern TextOnlyDeriv ()
|
||||
{
|
||||
return LValue.TextOnlyDeriv ().Choice (
|
||||
RValue.TextOnlyDeriv ());
|
||||
}
|
||||
|
||||
internal override RdpPattern TextOnlyDeriv (MemoizationStore memo)
|
||||
{
|
||||
return memo.TextOnlyDeriv (LValue).Choice (
|
||||
memo.TextOnlyDeriv (RValue));
|
||||
}
|
||||
|
||||
internal override RdpPattern MixedTextDeriv ()
|
||||
{
|
||||
return LValue.MixedTextDeriv ().Choice (
|
||||
RValue.MixedTextDeriv ());
|
||||
}
|
||||
|
||||
internal override RdpPattern MixedTextDeriv (MemoizationStore memo)
|
||||
{
|
||||
return memo.MixedTextDeriv (LValue).Choice (
|
||||
memo.MixedTextDeriv (RValue));
|
||||
}
|
||||
|
||||
public override RdpPattern ApplyAfter (RdpApplyAfterHandler handler)
|
||||
{
|
||||
// return handler (LValue).Choice (handler (RValue));
|
||||
@@ -952,12 +804,6 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
#endif
|
||||
}
|
||||
|
||||
internal override RdpPattern StartTagOpenDeriv (string name, string ns, MemoizationStore memo)
|
||||
{
|
||||
RdpPattern lDeriv = memo.StartTagOpenDeriv (LValue, name, ns);
|
||||
return lDeriv.Choice (memo.StartTagOpenDeriv (RValue, name, ns));
|
||||
}
|
||||
|
||||
// attDeriv cx (Choice p1 p2) att =
|
||||
// choice (attDeriv cx p1 att) (attDeriv cx p2 att)
|
||||
public override RdpPattern AttDeriv (string name, string ns, string value, XmlReader reader)
|
||||
@@ -966,28 +812,6 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
.Choice (RValue.AttDeriv (name, ns, value, reader));
|
||||
}
|
||||
|
||||
public override RdpPattern StartAttDeriv (string name, string ns)
|
||||
{
|
||||
RdpPattern lDeriv = LValue.StartAttDeriv (name, ns);
|
||||
return lDeriv.Choice (RValue.StartAttDeriv (name, ns));
|
||||
}
|
||||
|
||||
internal override RdpPattern StartAttDeriv (string name, string ns, MemoizationStore memo)
|
||||
{
|
||||
return memo.StartAttDeriv (LValue, name, ns)
|
||||
.Choice (memo.StartAttDeriv (RValue, name, ns));
|
||||
}
|
||||
|
||||
public override RdpPattern EndAttDeriv ()
|
||||
{
|
||||
return LValue.EndAttDeriv ().Choice (RValue.EndAttDeriv ());
|
||||
}
|
||||
|
||||
internal override RdpPattern EndAttDeriv (MemoizationStore memo)
|
||||
{
|
||||
return memo.EndAttDeriv (LValue).Choice (memo.EndAttDeriv (RValue));
|
||||
}
|
||||
|
||||
// startTagCloseDeriv (Choice p1 p2) =
|
||||
// choice (startTagCloseDeriv p1) (startTagCloseDeriv p2)
|
||||
public override RdpPattern StartTagCloseDeriv ()
|
||||
@@ -996,22 +820,11 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
.Choice (RValue.StartTagCloseDeriv ());
|
||||
}
|
||||
|
||||
internal override RdpPattern StartTagCloseDeriv (MemoizationStore memo)
|
||||
{
|
||||
return memo.StartTagCloseDeriv (LValue)
|
||||
.Choice (memo.StartTagCloseDeriv (RValue));
|
||||
}
|
||||
|
||||
public override RdpPattern EndTagDeriv ()
|
||||
{
|
||||
return LValue.EndTagDeriv ().Choice (RValue.EndTagDeriv ());
|
||||
}
|
||||
|
||||
internal override RdpPattern EndTagDeriv (MemoizationStore memo)
|
||||
{
|
||||
return memo.EndTagDeriv (LValue).Choice (memo.EndTagDeriv (RValue));
|
||||
}
|
||||
|
||||
internal override void CheckConstraints (bool attribute, bool oneOrMore, bool oneOrMoreGroup, bool oneOrMoreInterleave, bool list, bool dataExcept)
|
||||
{
|
||||
LValue.CheckConstraints (attribute, oneOrMore, oneOrMoreGroup, oneOrMoreInterleave, list, dataExcept);
|
||||
@@ -1037,14 +850,6 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
}
|
||||
}
|
||||
|
||||
internal override bool IsTextValueDependent {
|
||||
get { return LValue.IsTextValueDependent || RValue.IsTextValueDependent; }
|
||||
}
|
||||
|
||||
internal override bool IsContextDependent {
|
||||
get { return LValue.IsContextDependent || RValue.IsContextDependent; }
|
||||
}
|
||||
|
||||
public override void GetLabels (LabelList elements, LabelList attributes, bool collectNameClass)
|
||||
{
|
||||
LValue.GetLabels (elements, attributes, collectNameClass);
|
||||
@@ -1074,40 +879,16 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
.Choice (LValue.Interleave (RValue.TextDeriv (s, reader)));
|
||||
}
|
||||
|
||||
internal override RdpPattern TextDeriv (string s, XmlReader reader, MemoizationStore memo)
|
||||
{
|
||||
return memo.TextDeriv (LValue, s, reader).Interleave (RValue)
|
||||
.Choice (LValue.Interleave (memo.TextDeriv (RValue, s, reader)));
|
||||
}
|
||||
|
||||
internal override RdpPattern EmptyTextDeriv (MemoizationStore memo)
|
||||
{
|
||||
return memo.EmptyTextDeriv (LValue).Interleave (RValue)
|
||||
.Choice (LValue.Interleave (memo.EmptyTextDeriv (RValue)));
|
||||
}
|
||||
|
||||
internal override RdpPattern TextOnlyDeriv ()
|
||||
{
|
||||
return LValue.TextOnlyDeriv ().Interleave (
|
||||
RValue.TextOnlyDeriv ());
|
||||
}
|
||||
|
||||
internal override RdpPattern TextOnlyDeriv (MemoizationStore memo)
|
||||
{
|
||||
return memo.TextOnlyDeriv (LValue).Interleave (
|
||||
memo.TextOnlyDeriv (RValue));
|
||||
}
|
||||
|
||||
internal override RdpPattern MixedTextDeriv ()
|
||||
{
|
||||
return LValue.MixedTextDeriv ().Interleave (RValue).Choice (
|
||||
LValue.Interleave (RValue.MixedTextDeriv ()));
|
||||
}
|
||||
|
||||
internal override RdpPattern MixedTextDeriv (MemoizationStore memo)
|
||||
{
|
||||
return memo.MixedTextDeriv (LValue).Interleave (RValue).Choice (
|
||||
LValue.Interleave (memo.MixedTextDeriv (RValue)));
|
||||
return MakeInterleave (LValue.MixedTextDeriv (), RValue).Choice (
|
||||
MakeInterleave (LValue, RValue.MixedTextDeriv ()));
|
||||
}
|
||||
|
||||
// => choice (applyAfter (flip interleave p2) (startTagOpenDeriv p1 qn)) (applyAfter (interleave p1) (startTagOpenDeriv p2 qn)
|
||||
@@ -1122,16 +903,6 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
return choiceL.Choice (choiceR);
|
||||
}
|
||||
|
||||
internal override RdpPattern StartTagOpenDeriv (string name, string ns, MemoizationStore memo)
|
||||
{
|
||||
RdpPattern handledL = memo.StartTagOpenDeriv (LValue, name, ns);
|
||||
RdpPattern handledR = memo.StartTagOpenDeriv (RValue, name, ns);
|
||||
RdpFlip flipL = MakeFlip (RdpUtil.InterleaveFunction, RValue);
|
||||
RdpPattern choiceL = handledL.ApplyAfter (new RdpApplyAfterHandler (flipL.Apply));
|
||||
RdpPattern choiceR = handledR.ApplyAfter (new RdpApplyAfterHandler (LValue.Interleave));
|
||||
return choiceL.Choice (choiceR);
|
||||
}
|
||||
|
||||
// attDeriv cx (Interleave p1 p2) att =
|
||||
// choice (interleave (attDeriv cx p1 att) p2)
|
||||
// (interleave p1 (attDeriv cx p2 att))
|
||||
@@ -1143,26 +914,6 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
RValue.AttDeriv (name, ns, value, reader)));
|
||||
}
|
||||
|
||||
public override RdpPattern StartAttDeriv (string name, string ns)
|
||||
{
|
||||
RdpPattern handledL = LValue.StartAttDeriv (name, ns);
|
||||
RdpPattern handledR = RValue.StartAttDeriv (name, ns);
|
||||
RdpFlip flipL = MakeFlip (RdpUtil.InterleaveFunction, RValue);
|
||||
RdpPattern choiceL = handledL.ApplyAfter (new RdpApplyAfterHandler (flipL.Apply));
|
||||
RdpPattern choiceR = handledR.ApplyAfter (new RdpApplyAfterHandler (LValue.Interleave));
|
||||
return choiceL.Choice (choiceR);
|
||||
}
|
||||
|
||||
internal override RdpPattern StartAttDeriv (string name, string ns, MemoizationStore memo)
|
||||
{
|
||||
RdpPattern handledL = memo.StartAttDeriv (LValue, name, ns);
|
||||
RdpPattern handledR = memo.StartAttDeriv (RValue, name, ns);
|
||||
RdpFlip flipL = MakeFlip (RdpUtil.InterleaveFunction, RValue);
|
||||
RdpPattern choiceL = handledL.ApplyAfter (new RdpApplyAfterHandler (flipL.Apply));
|
||||
RdpPattern choiceR = handledR.ApplyAfter (new RdpApplyAfterHandler (LValue.Interleave));
|
||||
return choiceL.Choice (choiceR);
|
||||
}
|
||||
|
||||
// startTagCloseDeriv (Interleave p1 p2) =
|
||||
// interleave (startTagCloseDeriv p1) (startTagCloseDeriv p2)
|
||||
public override RdpPattern StartTagCloseDeriv ()
|
||||
@@ -1171,12 +922,6 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
.Interleave (RValue.StartTagCloseDeriv ());
|
||||
}
|
||||
|
||||
internal override RdpPattern StartTagCloseDeriv (MemoizationStore memo)
|
||||
{
|
||||
return memo.StartTagCloseDeriv (LValue)
|
||||
.Interleave (memo.StartTagCloseDeriv (RValue));
|
||||
}
|
||||
|
||||
public override RelaxngPatternType PatternType {
|
||||
get { return RelaxngPatternType.Interleave; }
|
||||
}
|
||||
@@ -1219,14 +964,6 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
}
|
||||
}
|
||||
|
||||
internal override bool IsTextValueDependent {
|
||||
get { return LValue.IsTextValueDependent || (LValue.Nullable ? RValue.IsTextValueDependent : false); }
|
||||
}
|
||||
|
||||
internal override bool IsContextDependent {
|
||||
get { return LValue.IsContextDependent || (LValue.Nullable ? RValue.IsContextDependent : false); }
|
||||
}
|
||||
|
||||
public override void GetLabels (LabelList elements, LabelList attributes, bool collectNameClass)
|
||||
{
|
||||
LValue.GetLabels (elements, attributes, collectNameClass);
|
||||
@@ -1238,43 +975,15 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
|
||||
public override RdpPattern TextDeriv (string s, XmlReader reader)
|
||||
{
|
||||
RdpPattern p = LValue.TextDeriv (s, reader);
|
||||
p = (p.PatternType == RelaxngPatternType.NotAllowed) ?
|
||||
p : p.Group (RValue);
|
||||
RdpPattern p = LValue.TextDeriv (s, reader).Group (RValue);
|
||||
return LValue.Nullable ?
|
||||
p.Choice (RValue.TextDeriv (s, reader)) : p;
|
||||
}
|
||||
|
||||
internal override RdpPattern TextDeriv (string s, XmlReader reader, MemoizationStore memo)
|
||||
{
|
||||
RdpPattern p = memo.TextDeriv (LValue, s, reader);
|
||||
p = (p.PatternType == RelaxngPatternType.NotAllowed) ?
|
||||
p : p.Group (RValue);
|
||||
return LValue.Nullable ?
|
||||
p.Choice (memo.TextDeriv (RValue, s, reader)) : p;
|
||||
}
|
||||
|
||||
internal override RdpPattern EmptyTextDeriv (MemoizationStore memo)
|
||||
{
|
||||
RdpPattern p = memo.EmptyTextDeriv (LValue);
|
||||
p = p.PatternType == RelaxngPatternType.NotAllowed ?
|
||||
p : p.Group (RValue);
|
||||
return LValue.Nullable ?
|
||||
p.Choice (memo.EmptyTextDeriv (RValue)) : p;
|
||||
}
|
||||
|
||||
internal override RdpPattern TextOnlyDeriv ()
|
||||
{
|
||||
RdpPattern p = LValue.TextOnlyDeriv ();
|
||||
return p.PatternType == RelaxngPatternType.NotAllowed ?
|
||||
p : p.Group (RValue.TextOnlyDeriv ());
|
||||
}
|
||||
|
||||
internal override RdpPattern TextOnlyDeriv (MemoizationStore memo)
|
||||
{
|
||||
RdpPattern p = memo.TextOnlyDeriv (LValue);
|
||||
return p.PatternType == RelaxngPatternType.NotAllowed ?
|
||||
p : p.Group (memo.TextOnlyDeriv (RValue));
|
||||
return LValue.TextOnlyDeriv ().Group (
|
||||
RValue.TextOnlyDeriv ());
|
||||
}
|
||||
|
||||
internal override RdpPattern MixedTextDeriv ()
|
||||
@@ -1284,13 +993,6 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
p.Choice (RValue.MixedTextDeriv ()) : p;
|
||||
}
|
||||
|
||||
internal override RdpPattern MixedTextDeriv (MemoizationStore memo)
|
||||
{
|
||||
RdpPattern p = memo.MixedTextDeriv (LValue).Group (RValue);
|
||||
return LValue.Nullable ?
|
||||
p.Choice (memo.MixedTextDeriv (RValue)) : p;
|
||||
}
|
||||
|
||||
// startTagOpenDeriv (Group p1 p2) qn =
|
||||
// let x = applyAfter (flip group p2) (startTagOpenDeriv p1 qn)
|
||||
// in if nullable p1 then
|
||||
@@ -1308,17 +1010,6 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
return x;
|
||||
}
|
||||
|
||||
internal override RdpPattern StartTagOpenDeriv (string name, string ns, MemoizationStore memo)
|
||||
{
|
||||
RdpPattern handled = memo.StartTagOpenDeriv (LValue, name, ns);
|
||||
RdpFlip f = MakeFlip (RdpUtil.GroupFunction, RValue);
|
||||
RdpPattern x = handled.ApplyAfter (new RdpApplyAfterHandler (f.Apply));
|
||||
if (LValue.Nullable)
|
||||
return x.Choice (memo.StartTagOpenDeriv (RValue, name, ns));
|
||||
else
|
||||
return x;
|
||||
}
|
||||
|
||||
// attDeriv cx (Group p1 p2) att =
|
||||
// choice (group (attDeriv cx p1 att) p2)
|
||||
// (group p1 (attDeriv cx p2 att))
|
||||
@@ -1329,41 +1020,12 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
RValue.AttDeriv (name, ns, value, reader)));
|
||||
}
|
||||
|
||||
// startAttDeriv (group p1 p2) == startAttDeriv (interleave p1 p2)
|
||||
public override RdpPattern StartAttDeriv (string name, string ns)
|
||||
{
|
||||
RdpPattern handledL = LValue.StartAttDeriv (name, ns);
|
||||
RdpPattern handledR = RValue.StartAttDeriv (name, ns);
|
||||
RdpFlip flipL = MakeFlip (RdpUtil.GroupFunction, RValue);
|
||||
RdpPattern choiceL = handledL.ApplyAfter (new RdpApplyAfterHandler (flipL.Apply));
|
||||
RdpPattern choiceR = handledR.ApplyAfter (new RdpApplyAfterHandler (LValue.Group));
|
||||
return choiceL.Choice (choiceR);
|
||||
}
|
||||
|
||||
internal override RdpPattern StartAttDeriv (string name, string ns, MemoizationStore memo)
|
||||
{
|
||||
RdpPattern handledL = memo.StartAttDeriv (LValue, name, ns);
|
||||
RdpPattern handledR = memo.StartAttDeriv (RValue, name, ns);
|
||||
RdpFlip flipL = MakeFlip (RdpUtil.GroupFunction, RValue);
|
||||
RdpPattern choiceL = handledL.ApplyAfter (new RdpApplyAfterHandler (flipL.Apply));
|
||||
RdpPattern choiceR = handledR.ApplyAfter (new RdpApplyAfterHandler (LValue.Group));
|
||||
return choiceL.Choice (choiceR);
|
||||
}
|
||||
|
||||
// startTagCloseDeriv (Group p1 p2) =
|
||||
// group (startTagCloseDeriv p1) (startTagCloseDeriv p2)
|
||||
public override RdpPattern StartTagCloseDeriv ()
|
||||
{
|
||||
RdpPattern p = LValue.StartTagCloseDeriv ();
|
||||
return p.PatternType == RelaxngPatternType.NotAllowed ?
|
||||
p : p.Group (RValue.StartTagCloseDeriv ());
|
||||
}
|
||||
|
||||
internal override RdpPattern StartTagCloseDeriv (MemoizationStore memo)
|
||||
{
|
||||
RdpPattern p = memo.StartTagCloseDeriv (LValue);
|
||||
return p.PatternType == RelaxngPatternType.NotAllowed ?
|
||||
p : p.Group (memo.StartTagCloseDeriv (RValue));
|
||||
return LValue.StartTagCloseDeriv ()
|
||||
.Group (RValue.StartTagCloseDeriv ());
|
||||
}
|
||||
|
||||
public override RelaxngPatternType PatternType {
|
||||
@@ -1439,14 +1101,6 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
get { return Child.Nullable; }
|
||||
}
|
||||
|
||||
internal override bool IsTextValueDependent {
|
||||
get { return Child.IsTextValueDependent; }
|
||||
}
|
||||
|
||||
internal override bool IsContextDependent {
|
||||
get { return Child.IsContextDependent; }
|
||||
}
|
||||
|
||||
public override void GetLabels (LabelList elements, LabelList attributes, bool collectNameClass)
|
||||
{
|
||||
Child.GetLabels (elements, attributes, collectNameClass);
|
||||
@@ -1471,23 +1125,7 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
|
||||
public override RdpPattern TextDeriv (string s, XmlReader reader)
|
||||
{
|
||||
RdpPattern p = Child.TextDeriv (s, reader);
|
||||
return p.PatternType == RelaxngPatternType.NotAllowed ?
|
||||
p : p.Group (this.Choice (RdpEmpty.Instance));
|
||||
}
|
||||
|
||||
internal override RdpPattern TextDeriv (string s, XmlReader reader, MemoizationStore memo)
|
||||
{
|
||||
RdpPattern p = memo.TextDeriv (Child, s, reader);
|
||||
return p.PatternType == RelaxngPatternType.NotAllowed ?
|
||||
p : p.Group (this.Choice (RdpEmpty.Instance));
|
||||
}
|
||||
|
||||
internal override RdpPattern EmptyTextDeriv (MemoizationStore memo)
|
||||
{
|
||||
RdpPattern p = memo.EmptyTextDeriv (Child);
|
||||
return p.PatternType == RelaxngPatternType.NotAllowed ?
|
||||
p : p.Group (this.Choice (RdpEmpty.Instance));
|
||||
return Child.TextDeriv (s, reader).Group (this.Choice (RdpEmpty.Instance));
|
||||
}
|
||||
|
||||
internal override RdpPattern TextOnlyDeriv ()
|
||||
@@ -1495,32 +1133,24 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
return Child.TextOnlyDeriv ().OneOrMore ();
|
||||
}
|
||||
|
||||
internal override RdpPattern TextOnlyDeriv (MemoizationStore memo)
|
||||
{
|
||||
return memo.TextOnlyDeriv (Child).OneOrMore ();
|
||||
}
|
||||
|
||||
internal override RdpPattern MixedTextDeriv ()
|
||||
{
|
||||
RdpPattern p = Child.MixedTextDeriv ();
|
||||
return p.PatternType == RelaxngPatternType.NotAllowed ?
|
||||
p : p.Group (this.Choice (RdpEmpty.Instance));
|
||||
}
|
||||
|
||||
internal override RdpPattern MixedTextDeriv (MemoizationStore memo)
|
||||
{
|
||||
RdpPattern p = memo.MixedTextDeriv (Child);
|
||||
return p.PatternType == RelaxngPatternType.NotAllowed ?
|
||||
p : p.Group (this.Choice (RdpEmpty.Instance));
|
||||
return Child.MixedTextDeriv ().Group (
|
||||
this.Choice (RdpEmpty.Instance));
|
||||
}
|
||||
|
||||
// attDeriv cx (OneOrMore p) att =
|
||||
// group (attDeriv cx p att) (choice (OneOrMore p) Empty)
|
||||
public override RdpPattern AttDeriv (string name, string ns, string value, XmlReader reader)
|
||||
{
|
||||
RdpPattern p = Child.AttDeriv (name, ns, value, reader);
|
||||
return p.PatternType == RelaxngPatternType.NotAllowed ?
|
||||
p : p.Group (Choice (RdpEmpty.Instance));
|
||||
#if UseStatic
|
||||
return RdpUtil.Group (
|
||||
RdpUtil.AttDeriv (ctx, children, att),
|
||||
RdpUtil.Choice (RdpUtil.OneOrMore (children), RdpEmpty.Instance));
|
||||
#else
|
||||
return Child.AttDeriv (name, ns, value, reader)
|
||||
.Group (Choice (RdpEmpty.Instance));
|
||||
#endif
|
||||
}
|
||||
|
||||
// startTagOpenDeriv (OneOrMore p) qn =
|
||||
@@ -1534,30 +1164,6 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
return handled.ApplyAfter (new RdpApplyAfterHandler (f.Apply));
|
||||
}
|
||||
|
||||
internal override RdpPattern StartTagOpenDeriv (string name, string ns, MemoizationStore memo)
|
||||
{
|
||||
RdpPattern rest = RdpEmpty.Instance.Choice (Child.OneOrMore ());
|
||||
RdpPattern handled = memo.StartTagOpenDeriv (Child, name, ns);
|
||||
RdpFlip f = MakeFlip (RdpUtil.GroupFunction, rest);
|
||||
return handled.ApplyAfter (new RdpApplyAfterHandler (f.Apply));
|
||||
}
|
||||
|
||||
public override RdpPattern StartAttDeriv (string name, string ns)
|
||||
{
|
||||
RdpPattern rest = RdpEmpty.Instance.Choice (Child.OneOrMore ());
|
||||
RdpPattern handled = Child.StartAttDeriv (name, ns);
|
||||
RdpFlip f = MakeFlip (RdpUtil.GroupFunction, rest);
|
||||
return handled.ApplyAfter (new RdpApplyAfterHandler (f.Apply));
|
||||
}
|
||||
|
||||
internal override RdpPattern StartAttDeriv (string name, string ns, MemoizationStore memo)
|
||||
{
|
||||
RdpPattern rest = RdpEmpty.Instance.Choice (Child.OneOrMore ());
|
||||
RdpPattern handled = memo.StartAttDeriv (Child, name, ns);
|
||||
RdpFlip f = MakeFlip (RdpUtil.GroupFunction, rest);
|
||||
return handled.ApplyAfter (new RdpApplyAfterHandler (f.Apply));
|
||||
}
|
||||
|
||||
// startTagCloseDeriv (OneOrMore p) =
|
||||
// oneOrMore (startTagCloseDeriv p)
|
||||
public override RdpPattern StartTagCloseDeriv ()
|
||||
@@ -1570,11 +1176,6 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
#endif
|
||||
}
|
||||
|
||||
internal override RdpPattern StartTagCloseDeriv (MemoizationStore memo)
|
||||
{
|
||||
return memo.StartTagCloseDeriv (Child).OneOrMore ();
|
||||
}
|
||||
|
||||
internal override void CheckConstraints (bool attribute, bool oneOrMore, bool oneOrMoreGroup, bool oneOrMoreInterleave, bool list, bool dataExcept)
|
||||
{
|
||||
if (dataExcept)
|
||||
@@ -1609,14 +1210,6 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
internal override bool IsTextValueDependent {
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
internal override bool IsContextDependent {
|
||||
get { return Child.IsContextDependent; }
|
||||
}
|
||||
|
||||
public override RelaxngPatternType PatternType {
|
||||
get { return RelaxngPatternType.List; }
|
||||
}
|
||||
@@ -1668,14 +1261,6 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
internal override bool IsTextValueDependent {
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
internal override bool IsContextDependent {
|
||||
get { return dt.IsContextDependent; }
|
||||
}
|
||||
|
||||
public override RelaxngPatternType PatternType {
|
||||
get { return RelaxngPatternType.Data; }
|
||||
}
|
||||
@@ -1796,14 +1381,6 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
internal override bool IsTextValueDependent {
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
internal override bool IsContextDependent {
|
||||
get { return dt.IsContextDependent; }
|
||||
}
|
||||
|
||||
public override RelaxngPatternType PatternType {
|
||||
get { return RelaxngPatternType.Value; }
|
||||
}
|
||||
@@ -1817,19 +1394,7 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
// do nothing
|
||||
}
|
||||
|
||||
string cachedValue;
|
||||
RdpPattern cachedPattern;
|
||||
|
||||
public override RdpPattern TextDeriv (string s, XmlReader reader)
|
||||
{
|
||||
if (s == cachedValue && !IsContextDependent)
|
||||
return cachedPattern;
|
||||
cachedPattern = TextDerivCore (s, reader);
|
||||
cachedValue = s;
|
||||
return cachedPattern;
|
||||
}
|
||||
|
||||
RdpPattern TextDerivCore (string s, XmlReader reader)
|
||||
{
|
||||
if (dt.IsTypeEqual (value, s, reader))
|
||||
return RdpEmpty.Instance;
|
||||
@@ -1877,14 +1442,6 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
internal override bool IsTextValueDependent {
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
internal override bool IsContextDependent {
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override RelaxngPatternType PatternType {
|
||||
get { return RelaxngPatternType.Attribute; }
|
||||
}
|
||||
@@ -1948,29 +1505,12 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
#endif
|
||||
}
|
||||
|
||||
public override RdpPattern StartAttDeriv (string name, string ns)
|
||||
{
|
||||
return nameClass.Contains (name, ns) ?
|
||||
children.After (RdpEmpty.Instance) : RdpNotAllowed.Instance;
|
||||
}
|
||||
|
||||
internal override RdpPattern StartAttDeriv (string name, string ns, MemoizationStore memo)
|
||||
{
|
||||
return nameClass.Contains (name, ns) ?
|
||||
children.After (RdpEmpty.Instance) : RdpNotAllowed.Instance;
|
||||
}
|
||||
|
||||
// startTagCloseDeriv (Attribute _ _) = NotAllowed
|
||||
public override RdpPattern StartTagCloseDeriv ()
|
||||
{
|
||||
return RdpNotAllowed.Instance;
|
||||
}
|
||||
|
||||
internal override RdpPattern StartTagCloseDeriv (MemoizationStore memo)
|
||||
{
|
||||
return RdpNotAllowed.Instance;
|
||||
}
|
||||
|
||||
internal override void MarkReachableDefs ()
|
||||
{
|
||||
children.MarkReachableDefs ();
|
||||
@@ -2021,14 +1561,6 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
internal override bool IsTextValueDependent {
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
internal override bool IsContextDependent {
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override RelaxngPatternType PatternType {
|
||||
get { return RelaxngPatternType.Element; }
|
||||
}
|
||||
@@ -2086,11 +1618,6 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
return RdpNotAllowed.Instance;
|
||||
}
|
||||
|
||||
internal override RdpPattern TextOnlyDeriv (MemoizationStore memo)
|
||||
{
|
||||
return RdpNotAllowed.Instance;
|
||||
}
|
||||
|
||||
public override RdpPattern StartTagOpenDeriv (string name, string ns)
|
||||
{
|
||||
#if UseStatic
|
||||
@@ -2105,13 +1632,6 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
#endif
|
||||
}
|
||||
|
||||
internal override RdpPattern StartTagOpenDeriv (string name, string ns, MemoizationStore memo)
|
||||
{
|
||||
return nameClass.Contains (name, ns) ?
|
||||
children.After (RdpEmpty.Instance) :
|
||||
RdpNotAllowed.Instance;
|
||||
}
|
||||
|
||||
internal override void MarkReachableDefs ()
|
||||
{
|
||||
children.MarkReachableDefs ();
|
||||
@@ -2145,14 +1665,6 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
internal override bool IsTextValueDependent {
|
||||
get { return LValue.IsTextValueDependent; }
|
||||
}
|
||||
|
||||
internal override bool IsContextDependent {
|
||||
get { return LValue.IsContextDependent; }
|
||||
}
|
||||
|
||||
public override void GetLabels (LabelList elements, LabelList attributes, bool collectNameClass)
|
||||
{
|
||||
LValue.GetLabels (elements, attributes, collectNameClass);
|
||||
@@ -2163,36 +1675,16 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
return LValue.TextDeriv (s, reader).After (RValue);
|
||||
}
|
||||
|
||||
internal override RdpPattern TextDeriv (string s, XmlReader reader, MemoizationStore memo)
|
||||
{
|
||||
return memo.TextDeriv (LValue, s, reader).After (RValue);
|
||||
}
|
||||
|
||||
internal override RdpPattern EmptyTextDeriv (MemoizationStore memo)
|
||||
{
|
||||
return memo.EmptyTextDeriv (LValue).After (RValue);
|
||||
}
|
||||
|
||||
internal override RdpPattern TextOnlyDeriv ()
|
||||
{
|
||||
return LValue.TextOnlyDeriv ().After (RValue);
|
||||
}
|
||||
|
||||
internal override RdpPattern TextOnlyDeriv (MemoizationStore memo)
|
||||
{
|
||||
return memo.TextOnlyDeriv (LValue).After (RValue);
|
||||
}
|
||||
|
||||
internal override RdpPattern MixedTextDeriv ()
|
||||
{
|
||||
return LValue.MixedTextDeriv ().After (RValue);
|
||||
}
|
||||
|
||||
internal override RdpPattern MixedTextDeriv (MemoizationStore memo)
|
||||
{
|
||||
return memo.MixedTextDeriv (LValue).After (RValue);
|
||||
}
|
||||
|
||||
// startTagOpenDeriv (After p1 p2) qn =
|
||||
// applyAfter (flip after p2) (startTagOpenDeriv p1 qn)
|
||||
public override RdpPattern StartTagOpenDeriv (string name, string ns)
|
||||
@@ -2203,14 +1695,6 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
f.Apply));
|
||||
}
|
||||
|
||||
internal override RdpPattern StartTagOpenDeriv (string name, string ns, MemoizationStore memo)
|
||||
{
|
||||
RdpPattern handled = memo.StartTagOpenDeriv (LValue, name, ns);
|
||||
RdpFlip f = MakeFlip (RdpUtil.AfterFunction, RValue);
|
||||
return handled.ApplyAfter (new RdpApplyAfterHandler (
|
||||
f.Apply));
|
||||
}
|
||||
|
||||
public override RdpPattern ApplyAfter (RdpApplyAfterHandler handler)
|
||||
{
|
||||
return LValue.After (handler (RValue));
|
||||
@@ -2223,37 +1707,11 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
return LValue.AttDeriv (name, ns, value, reader).After (RValue);
|
||||
}
|
||||
|
||||
public override RdpPattern StartAttDeriv (string name, string ns)
|
||||
{
|
||||
RdpPattern handled = LValue.StartAttDeriv (name, ns);
|
||||
RdpFlip f = MakeFlip (RdpUtil.AfterFunction, RValue);
|
||||
return handled.ApplyAfter (new RdpApplyAfterHandler (
|
||||
f.Apply));
|
||||
}
|
||||
|
||||
internal override RdpPattern StartAttDeriv (string name, string ns, MemoizationStore memo)
|
||||
{
|
||||
RdpPattern handled = memo.StartAttDeriv (LValue, name, ns);
|
||||
RdpFlip f = MakeFlip (RdpUtil.AfterFunction, RValue);
|
||||
return handled.ApplyAfter (new RdpApplyAfterHandler (
|
||||
f.Apply));
|
||||
}
|
||||
|
||||
public override RdpPattern EndAttDeriv ()
|
||||
{
|
||||
return LValue.Nullable ? RValue : RdpNotAllowed.Instance;
|
||||
}
|
||||
|
||||
public override RdpPattern StartTagCloseDeriv ()
|
||||
{
|
||||
return LValue.StartTagCloseDeriv ().After (RValue);
|
||||
}
|
||||
|
||||
internal override RdpPattern StartTagCloseDeriv (MemoizationStore memo)
|
||||
{
|
||||
return memo.StartTagCloseDeriv (LValue).After (RValue);
|
||||
}
|
||||
|
||||
public override RdpPattern EndTagDeriv ()
|
||||
{
|
||||
return LValue.Nullable ? RValue : RdpNotAllowed.Instance;
|
||||
|
||||
@@ -91,22 +91,6 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
intl = DebugRdpPattern (b.LValue, visitedPattern) +
|
||||
DebugRdpPattern (b.RValue, visitedPattern);
|
||||
|
||||
RdpData data = p as RdpData;
|
||||
if (data != null)
|
||||
intl = String.Format ("name={0},ns={1},type={2} {3}",
|
||||
data.Datatype.LocalName,
|
||||
data.Datatype.NamespaceURI,
|
||||
data.Datatype.GetType (),
|
||||
data is RdpDataExcept ? DebugRdpPattern (((RdpDataExcept) data).Except, visitedPattern) : String.Empty);
|
||||
|
||||
RdpValue value = p as RdpValue;
|
||||
if (value != null)
|
||||
intl = String.Format ("name={0},ns={1},value={2} type={3}",
|
||||
value.Datatype.LocalName,
|
||||
value.Datatype.NamespaceURI,
|
||||
value.Value,
|
||||
value.Datatype.GetType ());
|
||||
|
||||
RdpElement el = p as RdpElement;
|
||||
if (el != null)
|
||||
intl = DebugNameClass (el.NameClass) +
|
||||
|
||||
@@ -1,58 +1,3 @@
|
||||
2006-02-02 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* RelaxngValidatingReader.cs : removed extra tables.
|
||||
|
||||
2006-01-16 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* RelaxngValidatingReader.cs : fixed warning.
|
||||
|
||||
2006-01-16 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* RelaxngValidatingReader.cs : just keep previous TextDeriv() result
|
||||
for each pattern; they are mostly not reused. It makes validator
|
||||
about 30% faster in certain validation and reduces memory use.
|
||||
|
||||
2006-01-13 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* RelaxngValidatingReader.cs : actually using Hashtable of Hashtable
|
||||
(instead of ArrayList of custom MemoizationStart class) is much
|
||||
better for performance. It makes StartTagOpenDeriv and
|
||||
StartAttDeriv more than 10x faster than before.
|
||||
|
||||
2006-01-13 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* RelaxngDatatype.cs, RelaxngDefaultDatatypes.cs,
|
||||
XsdDatatypeProvider.cs, RelaxngValidatingReader.cs :
|
||||
Memoize TextDeriv() results for context independent inputs.
|
||||
|
||||
Due to the API freeze they are kept as internal virtual for now.
|
||||
|
||||
2006-01-12 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* RelaxngValidatingReader.cs : Use RdpPattern.EmptyTextDeriv(). It
|
||||
significantly improves performance wrt empty text nodes.
|
||||
|
||||
2006-01-10 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* RelaxngValidatingReader.cs :
|
||||
- Split memoization support things into MemoizationStore class.
|
||||
- Split single memo ArrayList into a couple of Hashtables and
|
||||
ArrayLists which memoize each kind of derivative results.
|
||||
- Introduced StartAttDeriv() and EndAttDeriv() to replace AttDeriv()
|
||||
and memoize results efficiently. It is textually written in the
|
||||
"derivative algorithm", but not formally specified.
|
||||
- Introduced IsTextValueDependent and EmptyTextDeriv() to
|
||||
differentiate those patterns which results differ depending on
|
||||
the text value and those which doesn't.
|
||||
Those EmptyTextDeriv results are memoized.
|
||||
|
||||
2006-01-10 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* Misc.cs : NormalizeWhitespace() was creating extraneous char[] and
|
||||
it could be heavily called depending on patterns.
|
||||
* RelaxngDefaultDatatypes.cs : avoid extraneous call to
|
||||
NormalizeWhitespace().
|
||||
|
||||
2006-01-05 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* RelaxngValidatingReader.cs :
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using Commons.Xml.Relaxng.Derivative;
|
||||
|
||||
@@ -46,42 +45,28 @@ namespace Commons.Xml.Relaxng
|
||||
if (s.Length == 0)
|
||||
return s;
|
||||
|
||||
StringBuilder sb = null;
|
||||
int noSpaceIndex = 0;
|
||||
bool inSpace = false;
|
||||
|
||||
for (int i = 0; i < s.Length; i++) {
|
||||
switch (s [i]) {
|
||||
char [] ca = s.ToCharArray ();
|
||||
int j = 0;
|
||||
for (int i = 0; i < ca.Length; i++) {
|
||||
switch (ca [i]) {
|
||||
case ' ':
|
||||
case '\r':
|
||||
case '\t':
|
||||
case '\n':
|
||||
if (inSpace)
|
||||
continue;
|
||||
if (sb == null)
|
||||
sb = new StringBuilder (s.Length);
|
||||
if (noSpaceIndex < i) {
|
||||
if (sb.Length > 0)
|
||||
sb.Append (' ');
|
||||
sb.Append (s, noSpaceIndex, i - noSpaceIndex);
|
||||
}
|
||||
inSpace = true;
|
||||
if (j == 0)
|
||||
break;
|
||||
if (ca [j - 1] != ' ')
|
||||
ca [j++] = ' ';
|
||||
break;
|
||||
default:
|
||||
if (inSpace) {
|
||||
noSpaceIndex = i;
|
||||
inSpace = false;
|
||||
}
|
||||
ca [j++] = ca [i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (sb == null)
|
||||
return s;
|
||||
if (!inSpace && noSpaceIndex < s.Length) {
|
||||
sb.Append (' ');
|
||||
sb.Append (s, noSpaceIndex, s.Length - noSpaceIndex);
|
||||
}
|
||||
return sb.ToString ();
|
||||
if (j == 0)
|
||||
return String.Empty;
|
||||
string r = new string (ca, 0, (ca [j - 1] != ' ') ? j : j - 1);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static bool IsWhitespace (string s)
|
||||
|
||||
@@ -38,11 +38,6 @@ namespace Commons.Xml.Relaxng
|
||||
public abstract string Name { get; }
|
||||
public abstract string NamespaceURI { get; }
|
||||
|
||||
internal virtual bool IsContextDependent {
|
||||
// safe default value
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public abstract object Parse (string text, XmlReader reader);
|
||||
|
||||
public virtual bool Compare (object o1, object o2)
|
||||
|
||||
@@ -48,10 +48,6 @@ namespace Commons.Xml.Relaxng
|
||||
public override string Name { get { return "string"; } }
|
||||
public override string NamespaceURI { get { return String.Empty; } }
|
||||
|
||||
internal override bool IsContextDependent {
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override bool IsValid (string text, XmlReader reader)
|
||||
{
|
||||
return true;
|
||||
@@ -83,10 +79,6 @@ namespace Commons.Xml.Relaxng
|
||||
public override string Name { get { return "token"; } }
|
||||
public override string NamespaceURI { get { return String.Empty; } }
|
||||
|
||||
internal override bool IsContextDependent {
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override bool IsValid (string text, XmlReader reader)
|
||||
{
|
||||
return true;
|
||||
@@ -97,55 +89,10 @@ namespace Commons.Xml.Relaxng
|
||||
return Util.NormalizeWhitespace (text);
|
||||
}
|
||||
|
||||
int SkipWhitespaces (string s, int i)
|
||||
{
|
||||
while (i < s.Length) {
|
||||
switch (s [i]) {
|
||||
case '\n': case '\r': case ' ': case '\t':
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
public override bool Compare (object o1, object o2)
|
||||
{
|
||||
string s1 = o1 as string;
|
||||
string s2 = o2 as string;
|
||||
|
||||
int i1 = 0;
|
||||
int i2 = 0;
|
||||
|
||||
while (i1 < s1.Length && i2 < s2.Length) {
|
||||
i1 = SkipWhitespaces (s1, i1);
|
||||
i2 = SkipWhitespaces (s2, i2);
|
||||
while (i1 < s1.Length && i2 < s2.Length) {
|
||||
if (s1 [i1] != s2 [i2])
|
||||
return false;
|
||||
i1++;
|
||||
i2++;
|
||||
if (i1 == s1.Length || i2 == s2.Length)
|
||||
break;
|
||||
if (XmlChar.IsWhitespace (s1 [i1])) {
|
||||
if (!XmlChar.IsWhitespace (s2 [i2]))
|
||||
return false;
|
||||
else
|
||||
break;
|
||||
}
|
||||
else if (XmlChar.IsWhitespace (s2 [i2]))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
i1 = SkipWhitespaces (s1, i1);
|
||||
i2 = SkipWhitespaces (s2, i2);
|
||||
return i1 == s1.Length && i2 == s2.Length;
|
||||
}
|
||||
|
||||
public override bool CompareString (string s1, string s2, XmlReader reader)
|
||||
{
|
||||
return Compare (s1, s2);
|
||||
return Util.NormalizeWhitespace ((string) o1) ==
|
||||
Util.NormalizeWhitespace ((string) o2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -68,6 +68,11 @@ namespace Commons.Xml.Relaxng
|
||||
RelaxngPattern pattern;
|
||||
RdpPattern vState;
|
||||
RdpPattern prevState; // Mainly for debugging.
|
||||
ArrayList PredefinedAttributes = new ArrayList ();
|
||||
bool labelsComputed;
|
||||
Hashtable elementLabels = new Hashtable ();
|
||||
Hashtable attributeLabels = new Hashtable ();
|
||||
bool isEmptiable;
|
||||
bool roughLabelCheck;
|
||||
ArrayList strictCheckCache;
|
||||
bool reportDetails;
|
||||
@@ -363,6 +368,10 @@ namespace Commons.Xml.Relaxng
|
||||
{
|
||||
PrepareState ();
|
||||
|
||||
labelsComputed = false;
|
||||
elementLabels.Clear ();
|
||||
attributeLabels.Clear ();
|
||||
|
||||
bool ret = reader.Read ();
|
||||
|
||||
// Process pending text node validation if required.
|
||||
@@ -378,7 +387,7 @@ namespace Commons.Xml.Relaxng
|
||||
inContent = true;
|
||||
// StartTagOpenDeriv
|
||||
prevState = vState;
|
||||
vState = memo.StartTagOpenDeriv (vState,
|
||||
vState = StartTagOpenDeriv (vState,
|
||||
reader.LocalName, reader.NamespaceURI);
|
||||
if (vState.PatternType == RelaxngPatternType.NotAllowed)
|
||||
throw CreateValidationError (String.Format ("Invalid start tag found. LocalName = {0}, NS = {1}.", reader.LocalName, reader.NamespaceURI), true);
|
||||
@@ -392,36 +401,16 @@ namespace Commons.Xml.Relaxng
|
||||
|
||||
prevState = vState;
|
||||
string attrNS = reader.NamespaceURI;
|
||||
|
||||
#if false // old code
|
||||
|
||||
vState = vState.AttDeriv (reader.LocalName, attrNS, reader.GetAttribute (reader.LocalName, attrNS), this);
|
||||
if (vState == RdpNotAllowed.Instance)
|
||||
if (vState.PatternType == RelaxngPatternType.NotAllowed)
|
||||
throw CreateValidationError (String.Format ("Invalid attribute found. LocalName = {0}, NS = {1}.", reader.LocalName, reader.NamespaceURI), false);
|
||||
|
||||
#else
|
||||
|
||||
prevState = vState;
|
||||
vState = memo.StartAttDeriv (vState, reader.LocalName, attrNS);
|
||||
if (vState == RdpNotAllowed.Instance)
|
||||
throw CreateValidationError (String.Format ("Invalid attribute found. LocalName = {0}, NS = {1}.", reader.LocalName, reader.NamespaceURI), false);
|
||||
prevState = vState;
|
||||
vState = memo.TextOnlyDeriv (vState);
|
||||
vState = TextDeriv (vState, reader.Value, reader);
|
||||
if (Util.IsWhitespace (reader.Value))
|
||||
vState = vState.Choice (prevState);
|
||||
vState = memo.EndAttDeriv (vState);
|
||||
if (vState == RdpNotAllowed.Instance)
|
||||
throw CreateValidationError (String.Format ("Invalid attribute value is found. Value = '{0}'", reader.Value), false);
|
||||
|
||||
#endif
|
||||
} while (reader.MoveToNextAttribute ());
|
||||
MoveToElement ();
|
||||
}
|
||||
|
||||
// StarTagCloseDeriv
|
||||
prevState = vState;
|
||||
vState = memo.StartTagCloseDeriv (vState);
|
||||
vState = StartTagCloseDeriv (vState);
|
||||
if (vState.PatternType == RelaxngPatternType.NotAllowed)
|
||||
throw CreateValidationError (String.Format ("Invalid start tag closing found. LocalName = {0}, NS = {1}.", reader.LocalName, reader.NamespaceURI), false);
|
||||
|
||||
@@ -436,7 +425,7 @@ namespace Commons.Xml.Relaxng
|
||||
inContent = false;
|
||||
// EndTagDeriv
|
||||
prevState = vState;
|
||||
vState = memo.EndTagDeriv (vState);
|
||||
vState = EndTagDeriv (vState);
|
||||
if (vState.PatternType == RelaxngPatternType.NotAllowed)
|
||||
throw CreateValidationError (String.Format ("Invalid end tag found. LocalName = {0}, NS = {1}.", reader.LocalName, reader.NamespaceURI), true);
|
||||
break;
|
||||
@@ -461,14 +450,6 @@ namespace Commons.Xml.Relaxng
|
||||
return ret;
|
||||
}
|
||||
|
||||
RdpPattern TextDeriv (RdpPattern p, string value, XmlReader context)
|
||||
{
|
||||
if (value.Length > 0 && p.IsTextValueDependent)
|
||||
return memo.TextDeriv (p, value, context);
|
||||
else
|
||||
return memo.EmptyTextDeriv (p);
|
||||
}
|
||||
|
||||
void ValidateText (bool remain)
|
||||
{
|
||||
RdpPattern ts = vState;
|
||||
@@ -481,8 +462,8 @@ namespace Commons.Xml.Relaxng
|
||||
case XmlNodeType.Element:
|
||||
startElementDepth = -1;
|
||||
if (!Util.IsWhitespace (cachedValue)) {
|
||||
ts = memo.MixedTextDeriv (ts);
|
||||
ts = TextDeriv (ts, cachedValue, reader);
|
||||
ts = MixedTextDeriv (ts);
|
||||
ts = ts.TextDeriv (cachedValue, reader);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -518,167 +499,125 @@ namespace Commons.Xml.Relaxng
|
||||
|
||||
RdpPattern ValidateTextOnlyCore ()
|
||||
{
|
||||
RdpPattern ts = memo.TextOnlyDeriv (vState);
|
||||
ts = TextDeriv (ts, cachedValue, reader);
|
||||
RdpPattern ts = TextOnlyDeriv (vState);
|
||||
ts = ts.TextDeriv (cachedValue, reader);
|
||||
if (Util.IsWhitespace (cachedValue))
|
||||
ts = vState.Choice (ts);
|
||||
ts = vState.MakeChoice (ts, vState);
|
||||
return ts;
|
||||
}
|
||||
|
||||
MemoizationStore memo = new MemoizationStore ();
|
||||
}
|
||||
#region Memoization support
|
||||
|
||||
#region Memoization support
|
||||
internal class MemoizationStore
|
||||
{
|
||||
Hashtable startOpen = new Hashtable ();
|
||||
Hashtable startClose = new Hashtable ();
|
||||
Hashtable startAtt = new Hashtable ();
|
||||
Hashtable endTag = new Hashtable ();
|
||||
Hashtable endAtt = new Hashtable ();
|
||||
Hashtable textOnly = new Hashtable ();
|
||||
Hashtable mixedText = new Hashtable ();
|
||||
Hashtable emptyText = new Hashtable ();
|
||||
Hashtable text = new Hashtable ();
|
||||
Hashtable text_value = new Hashtable ();
|
||||
Hashtable qnames = new Hashtable ();
|
||||
ArrayList memo = new ArrayList ();
|
||||
|
||||
enum DerivativeType {
|
||||
StartTagOpen,
|
||||
StartAtt,
|
||||
StartTagClose,
|
||||
EndTag,
|
||||
EndAtt,
|
||||
Mixed,
|
||||
TextOnly
|
||||
}
|
||||
|
||||
XmlQualifiedName GetQName (string local, string ns)
|
||||
class Memoization
|
||||
{
|
||||
Hashtable nst = qnames [ns] as Hashtable;
|
||||
if (nst == null) {
|
||||
nst = new Hashtable ();
|
||||
qnames [ns] = nst;
|
||||
public Memoization (DerivativeType type, RdpPattern input, RdpPattern output)
|
||||
{
|
||||
Type = type;
|
||||
Input = input;
|
||||
Output = output;
|
||||
}
|
||||
XmlQualifiedName qn = nst [local] as XmlQualifiedName;
|
||||
if (qn == null) {
|
||||
qn = new XmlQualifiedName (local, ns);
|
||||
nst [local] = qn;
|
||||
|
||||
public readonly DerivativeType Type;
|
||||
public readonly RdpPattern Input;
|
||||
public readonly RdpPattern Output;
|
||||
}
|
||||
|
||||
class MemoizationStartTagOpen : Memoization
|
||||
{
|
||||
public MemoizationStartTagOpen (string name, string ns, RdpPattern input, RdpPattern output)
|
||||
: base (DerivativeType.StartTagOpen, input, output)
|
||||
{
|
||||
Name = name;
|
||||
NS = ns;
|
||||
}
|
||||
return qn;
|
||||
|
||||
public readonly string Name;
|
||||
public readonly string NS;
|
||||
}
|
||||
|
||||
public RdpPattern StartTagOpenDeriv (RdpPattern p, string local, string ns)
|
||||
RdpPattern StartTagOpenDeriv (RdpPattern p, string local, string ns)
|
||||
{
|
||||
Hashtable h = startOpen [p] as Hashtable;
|
||||
if (h == null) {
|
||||
h = new Hashtable ();
|
||||
startOpen [p] = h;
|
||||
for (int i = 0; i < memo.Count; i++) {
|
||||
Memoization tag = (Memoization) memo [i];
|
||||
if (tag.Type != DerivativeType.StartTagOpen)
|
||||
continue;
|
||||
MemoizationStartTagOpen sto =
|
||||
tag as MemoizationStartTagOpen;
|
||||
if (sto.Input == p &&
|
||||
object.ReferenceEquals (sto.Name, local) &&
|
||||
object.ReferenceEquals (sto.NS, ns))
|
||||
return tag.Output;
|
||||
}
|
||||
XmlQualifiedName qn = GetQName (local, ns);
|
||||
RdpPattern m = h [qn] as RdpPattern;
|
||||
if (m == null) {
|
||||
m = p.StartTagOpenDeriv (local, ns, this);
|
||||
h [qn] = m;
|
||||
|
||||
RdpPattern m = p.StartTagOpenDeriv (local, ns);
|
||||
memo.Add (new MemoizationStartTagOpen (local, ns, p, m));
|
||||
return m;
|
||||
}
|
||||
|
||||
RdpPattern StartTagCloseDeriv (RdpPattern p)
|
||||
{
|
||||
for (int i = 0; i < memo.Count; i++) {
|
||||
Memoization tag = (Memoization) memo [i];
|
||||
if (tag.Type == DerivativeType.StartTagClose && tag.Input == p)
|
||||
return tag.Output;
|
||||
}
|
||||
|
||||
RdpPattern m = p.StartTagCloseDeriv ();
|
||||
memo.Add (new Memoization (
|
||||
DerivativeType.StartTagClose, p, m));
|
||||
return m;
|
||||
}
|
||||
|
||||
public RdpPattern StartAttDeriv (RdpPattern p, string local, string ns)
|
||||
RdpPattern EndTagDeriv (RdpPattern p)
|
||||
{
|
||||
Hashtable h = startAtt [p] as Hashtable;
|
||||
if (h == null) {
|
||||
h = new Hashtable ();
|
||||
startAtt [p] = h;
|
||||
for (int i = 0; i < memo.Count; i++) {
|
||||
Memoization tag = (Memoization) memo [i];
|
||||
if (tag.Type == DerivativeType.EndTag && tag.Input == p)
|
||||
return tag.Output;
|
||||
}
|
||||
XmlQualifiedName qn = GetQName (local, ns);
|
||||
RdpPattern m = h [qn] as RdpPattern;
|
||||
if (m == null) {
|
||||
m = p.StartAttDeriv (local, ns, this);
|
||||
h [qn] = m;
|
||||
|
||||
RdpPattern m = p.EndTagDeriv ();
|
||||
memo.Add (new Memoization (DerivativeType.EndTag, p, m));
|
||||
return m;
|
||||
}
|
||||
|
||||
RdpPattern MixedTextDeriv (RdpPattern p)
|
||||
{
|
||||
for (int i = 0; i < memo.Count; i++) {
|
||||
Memoization tag = (Memoization) memo [i];
|
||||
if (tag.Type == DerivativeType.Mixed && tag.Input == p)
|
||||
return tag.Output;
|
||||
}
|
||||
|
||||
RdpPattern m = p.MixedTextDeriv ();
|
||||
memo.Add (new Memoization (DerivativeType.Mixed, p, m));
|
||||
return m;
|
||||
}
|
||||
|
||||
public RdpPattern StartTagCloseDeriv (RdpPattern p)
|
||||
RdpPattern TextOnlyDeriv (RdpPattern p)
|
||||
{
|
||||
RdpPattern m = startClose [p] as RdpPattern;
|
||||
if (m != null)
|
||||
return m;
|
||||
for (int i = 0; i < memo.Count; i++) {
|
||||
Memoization tag = (Memoization) memo [i];
|
||||
if (tag.Type == DerivativeType.TextOnly && tag.Input == p)
|
||||
return tag.Output;
|
||||
}
|
||||
|
||||
m = p.StartTagCloseDeriv (this);
|
||||
startClose [p] = m;
|
||||
RdpPattern m = p.TextOnlyDeriv ();
|
||||
memo.Add (new Memoization (DerivativeType.TextOnly, p, m));
|
||||
return m;
|
||||
}
|
||||
|
||||
public RdpPattern EndTagDeriv (RdpPattern p)
|
||||
{
|
||||
RdpPattern m = endTag [p] as RdpPattern;
|
||||
if (m != null)
|
||||
return m;
|
||||
|
||||
m = p.EndTagDeriv (this);
|
||||
endTag [p] = m;
|
||||
return m;
|
||||
}
|
||||
|
||||
public RdpPattern EndAttDeriv (RdpPattern p)
|
||||
{
|
||||
RdpPattern m = endAtt [p] as RdpPattern;
|
||||
if (m != null)
|
||||
return m;
|
||||
|
||||
m = p.EndAttDeriv (this);
|
||||
endAtt [p] = m;
|
||||
return m;
|
||||
}
|
||||
|
||||
public RdpPattern MixedTextDeriv (RdpPattern p)
|
||||
{
|
||||
RdpPattern m = mixedText [p] as RdpPattern;
|
||||
if (m != null)
|
||||
return m;
|
||||
|
||||
m = p.MixedTextDeriv (this);
|
||||
mixedText [p] = m;
|
||||
return m;
|
||||
}
|
||||
|
||||
public RdpPattern TextOnlyDeriv (RdpPattern p)
|
||||
{
|
||||
RdpPattern m = textOnly [p] as RdpPattern;
|
||||
if (m != null)
|
||||
return m;
|
||||
|
||||
m = p.TextOnlyDeriv (this);
|
||||
textOnly [p] = m;
|
||||
return m;
|
||||
}
|
||||
|
||||
public RdpPattern TextDeriv (RdpPattern p, string value, XmlReader context)
|
||||
{
|
||||
if (p.IsContextDependent)
|
||||
return p.TextDeriv (value, context);
|
||||
|
||||
if (Object.ReferenceEquals (text_value [p], value))
|
||||
return text [p] as RdpPattern;
|
||||
RdpPattern m = p.TextDeriv (value, context, this);
|
||||
text_value [p] = value;
|
||||
text [p] = m;
|
||||
return m;
|
||||
}
|
||||
|
||||
public RdpPattern EmptyTextDeriv (RdpPattern p)
|
||||
{
|
||||
RdpPattern m = emptyText [p] as RdpPattern;
|
||||
if (m != null)
|
||||
return m;
|
||||
|
||||
m = p.EmptyTextDeriv (this);
|
||||
emptyText [p] = m;
|
||||
return m;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -197,10 +197,6 @@ namespace Commons.Xml.Relaxng.XmlSchema
|
||||
get { return type.QualifiedName.Namespace; }
|
||||
}
|
||||
|
||||
internal override bool IsContextDependent {
|
||||
get { return type.Datatype != null && type.Datatype.TokenizedType == XmlTokenizedType.QName; }
|
||||
}
|
||||
|
||||
public override object Parse (string value, XmlReader reader)
|
||||
{
|
||||
// Now we create XmlValidatingReader to handle
|
||||
@@ -233,10 +229,6 @@ namespace Commons.Xml.Relaxng.XmlSchema
|
||||
dt = xstype;
|
||||
}
|
||||
|
||||
internal override bool IsContextDependent {
|
||||
get { return dt.TokenizedType == XmlTokenizedType.QName; }
|
||||
}
|
||||
|
||||
public override string Name {
|
||||
get { return name; }
|
||||
}
|
||||
@@ -268,10 +260,6 @@ namespace Commons.Xml.Relaxng.XmlSchema
|
||||
get { return "http://www.w3.org/2001/XMLSchema-datatypes"; }
|
||||
}
|
||||
|
||||
internal override bool IsContextDependent {
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override object Parse (string s, XmlReader reader)
|
||||
{
|
||||
int colonAt = s.IndexOf (':');
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// I18N.CJK.Big5Convert
|
||||
//
|
||||
// Author:
|
||||
// Alan Tam Siu Lung ([email protected])
|
||||
//
|
||||
|
||||
using System;
|
||||
|
||||
namespace I18N.CJK
|
||||
{
|
||||
internal sealed class Big5Convert : DbcsConvert
|
||||
{
|
||||
// Dummy constructor, no one is aupposed to call it
|
||||
private Big5Convert() : base("big5.table") {}
|
||||
|
||||
// The one and only Big5 conversion object in the system.
|
||||
private static DbcsConvert convert;
|
||||
|
||||
// Get the primary Big5 conversion object.
|
||||
public static DbcsConvert Convert
|
||||
{
|
||||
get {
|
||||
if (convert == null) convert = new DbcsConvert("big5.table");
|
||||
return convert;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -65,7 +65,7 @@ public class CP51932 : MonoEncoding
|
||||
private const int EUC_JP_CODE_PAGE = 51932;
|
||||
|
||||
// Constructor.
|
||||
public CP51932 () : base (EUC_JP_CODE_PAGE, 932)
|
||||
public CP51932 () : base (EUC_JP_CODE_PAGE)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -75,11 +75,6 @@ public class CP51932 : MonoEncoding
|
||||
return new CP51932Encoder (this).GetByteCount (chars, index, length, true);
|
||||
}
|
||||
|
||||
public unsafe override int GetByteCountImpl (char* chars, int count)
|
||||
{
|
||||
return new CP51932Encoder (this).GetByteCountImpl (chars, count, true);
|
||||
}
|
||||
|
||||
public unsafe override int GetBytesImpl (char* chars, int charCount, byte* bytes, int byteCount)
|
||||
{
|
||||
return new CP51932Encoder (this).GetBytesImpl (chars, charCount, bytes, byteCount, true);
|
||||
@@ -186,10 +181,15 @@ public class CP51932 : MonoEncoding
|
||||
public override String WebName {
|
||||
get { return "euc-jp"; }
|
||||
}
|
||||
|
||||
// Get the Windows code page represented by this object.
|
||||
public override int WindowsCodePage {
|
||||
get { return EUC_JP_CODE_PAGE; }
|
||||
}
|
||||
} // CP51932
|
||||
#endif // !ECMA_COMPAT
|
||||
|
||||
public class CP51932Encoder : MonoEncoder
|
||||
public class CP51932Encoder : MonoEncoding.MonoEncoder
|
||||
{
|
||||
public CP51932Encoder (MonoEncoding encoding)
|
||||
: base (encoding)
|
||||
@@ -197,11 +197,22 @@ public class CP51932Encoder : MonoEncoder
|
||||
}
|
||||
|
||||
// Get the number of bytes needed to encode a character buffer.
|
||||
public unsafe override int GetByteCountImpl (
|
||||
char* chars, int count, bool refresh)
|
||||
public override int GetByteCount (
|
||||
char [] chars, int index, int count, bool refresh)
|
||||
{
|
||||
// Validate the parameters.
|
||||
if (chars == null)
|
||||
throw new ArgumentNullException("chars");
|
||||
|
||||
if (index < 0 || index > chars.Length)
|
||||
throw new ArgumentOutOfRangeException
|
||||
("index", Strings.GetString ("ArgRange_Array"));
|
||||
|
||||
if (count < 0 || count > (chars.Length - index))
|
||||
throw new ArgumentOutOfRangeException
|
||||
("count", Strings.GetString ("ArgRange_Array"));
|
||||
|
||||
// Determine the length of the final output.
|
||||
int index = 0;
|
||||
int length = 0;
|
||||
int ch, value;
|
||||
byte [] cjkToJis = JISConvert.Convert.cjkToJis;
|
||||
@@ -255,6 +266,9 @@ public class CP51932Encoder : MonoEncoder
|
||||
{
|
||||
int charIndex = 0;
|
||||
int byteIndex = 0;
|
||||
#if NET_2_0
|
||||
EncoderFallbackBuffer buffer = null;
|
||||
#endif
|
||||
|
||||
// Convert the characters into their byte form.
|
||||
int posn = byteIndex;
|
||||
@@ -331,13 +345,8 @@ public class CP51932Encoder : MonoEncoder
|
||||
}
|
||||
} // CP51932Encoder
|
||||
|
||||
internal class CP51932Decoder : DbcsEncoding.DbcsDecoder
|
||||
public class CP51932Decoder : Decoder
|
||||
{
|
||||
public CP51932Decoder ()
|
||||
: base (null)
|
||||
{
|
||||
}
|
||||
|
||||
int last_count, last_bytes;
|
||||
|
||||
// Get the number of characters needed to decode a byte buffer.
|
||||
@@ -353,7 +362,19 @@ internal class CP51932Decoder : DbcsEncoding.DbcsDecoder
|
||||
#endif
|
||||
int GetCharCount (byte [] bytes, int index, int count, bool refresh)
|
||||
{
|
||||
CheckRange (bytes, index, count);
|
||||
// Validate the parameters.
|
||||
if (bytes == null)
|
||||
throw new ArgumentNullException ("bytes");
|
||||
|
||||
if (index < 0 || index > bytes.Length)
|
||||
throw new ArgumentOutOfRangeException
|
||||
("index", Strings.GetString("ArgRange_Array"));
|
||||
|
||||
if (count < 0 || count > (bytes.Length - index))
|
||||
throw new ArgumentOutOfRangeException
|
||||
("count", Strings.GetString("ArgRange_Array"));
|
||||
|
||||
|
||||
|
||||
// Determine the total length of the converted string.
|
||||
int value = 0;
|
||||
@@ -463,7 +484,30 @@ internal class CP51932Decoder : DbcsEncoding.DbcsDecoder
|
||||
int byteCount, char[] chars,
|
||||
int charIndex, bool refresh)
|
||||
{
|
||||
CheckRange (bytes, byteIndex, byteCount, chars, charIndex);
|
||||
// Validate the parameters.
|
||||
if(bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if(chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if(byteIndex < 0 || byteIndex > bytes.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException
|
||||
("byteIndex", Strings.GetString("ArgRange_Array"));
|
||||
}
|
||||
if(byteCount < 0 || byteCount > (bytes.Length - byteIndex))
|
||||
{
|
||||
throw new ArgumentOutOfRangeException
|
||||
("byteCount", Strings.GetString("ArgRange_Array"));
|
||||
}
|
||||
if(charIndex < 0 || charIndex > chars.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException
|
||||
("charIndex", Strings.GetString("ArgRange_Array"));
|
||||
}
|
||||
|
||||
// Decode the bytes in the buffer.
|
||||
int posn = charIndex;
|
||||
|
||||
+575
-490
File diff suppressed because it is too large.
Load diff
+86
-135
@@ -28,37 +28,6 @@ namespace I18N.CJK
|
||||
return DbcsConvert.Gb2312;
|
||||
}
|
||||
|
||||
// Get the bytes that result from encoding a character buffer.
|
||||
public unsafe override int GetByteCountImpl (
|
||||
char* chars, int count)
|
||||
{
|
||||
DbcsConvert gb2312 = GetConvert ();
|
||||
int index = 0;
|
||||
#if NET_2_0
|
||||
EncoderFallbackBuffer buffer = null;
|
||||
#endif
|
||||
int length = 0;
|
||||
while (count-- > 0) {
|
||||
char c = chars[index++];
|
||||
if (c <= 0x80 || c == 0xFF) { // ASCII
|
||||
length++;
|
||||
continue;
|
||||
}
|
||||
byte b1 = gb2312.u2n[((int)c) * 2 + 1];
|
||||
byte b2 = gb2312.u2n[((int)c) * 2];
|
||||
if (b1 == 0 && b2 == 0) {
|
||||
#if NET_2_0
|
||||
// FIXME: handle fallback for GetByteCount().
|
||||
#else
|
||||
length++;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
length += 2;
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
// Get the bytes that result from encoding a character buffer.
|
||||
public unsafe override int GetBytesImpl (char* chars, int charCount,
|
||||
byte* bytes, int byteCount)
|
||||
@@ -98,15 +67,68 @@ namespace I18N.CJK
|
||||
// Get the characters that result from decoding a byte buffer.
|
||||
public override int GetCharCount (byte [] bytes, int index, int count)
|
||||
{
|
||||
return GetDecoder ().GetCharCount (bytes, index, count);
|
||||
if (bytes == null)
|
||||
throw new ArgumentNullException("bytes");
|
||||
if (index < 0 || index > bytes.Length)
|
||||
throw new ArgumentOutOfRangeException("index", Strings.GetString("ArgRange_Array"));
|
||||
if (count < 0 || index + count > bytes.Length)
|
||||
throw new ArgumentOutOfRangeException("count", Strings.GetString("ArgRange_Array"));
|
||||
|
||||
int lastByte = 0;
|
||||
int length = 0;
|
||||
while (count-- > 0) {
|
||||
int b = bytes [index++];
|
||||
if (lastByte == 0) {
|
||||
if (b <= 0x80 || b == 0xFF) { // ASCII
|
||||
length++;
|
||||
continue;
|
||||
} else {
|
||||
lastByte = b;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
length++;
|
||||
lastByte = 0;
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
if (lastByte != 0)
|
||||
length++;
|
||||
#endif
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
// Get the characters that result from decoding a byte buffer.
|
||||
public override int GetChars(byte[] bytes, int byteIndex, int byteCount,
|
||||
char[] chars, int charIndex)
|
||||
{
|
||||
return GetDecoder ().GetChars (
|
||||
bytes, byteIndex, byteCount, chars, charIndex);
|
||||
DbcsConvert gb2312 = GetConvert ();
|
||||
// A1 40 - FA FF
|
||||
base.GetChars(bytes, byteIndex, byteCount, chars, charIndex);
|
||||
int origIndex = charIndex;
|
||||
int lastByte = 0;
|
||||
while (byteCount-- > 0) {
|
||||
int b = bytes[byteIndex++];
|
||||
if (lastByte == 0) {
|
||||
if (b <= 0x80 || b == 0xFF) { // ASCII
|
||||
chars[charIndex++] = (char)b;
|
||||
continue;
|
||||
} else {
|
||||
lastByte = b;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
int ord = ((lastByte - 0x81) * 191 + b - 0x40) * 2;
|
||||
char c1 = (ord < 0 || ord + 1 >= gb2312.n2u.Length) ?
|
||||
'\0' : (char)(gb2312.n2u[ord] + gb2312.n2u[ord + 1] * 256);
|
||||
if (c1 == 0)
|
||||
chars[charIndex++] = '?';
|
||||
else
|
||||
chars[charIndex++] = c1;
|
||||
lastByte = 0;
|
||||
}
|
||||
return charIndex - origIndex;
|
||||
}
|
||||
|
||||
// Get a decoder that handles a rolling Gb2312 state.
|
||||
@@ -162,113 +184,42 @@ namespace I18N.CJK
|
||||
{
|
||||
get { return("gb2312"); }
|
||||
}
|
||||
}
|
||||
|
||||
// Decoder that handles a rolling Gb2312 state.
|
||||
sealed class CP936Decoder : DbcsEncoding.DbcsDecoder
|
||||
{
|
||||
// Constructor.
|
||||
public CP936Decoder (DbcsConvert convert)
|
||||
: base (convert)
|
||||
|
||||
// Decoder that handles a rolling Gb2312 state.
|
||||
private sealed class CP936Decoder : DbcsDecoder
|
||||
{
|
||||
}
|
||||
|
||||
int last_byte_count, last_byte_bytes;
|
||||
|
||||
// Get the characters that result from decoding a byte buffer.
|
||||
public override int GetCharCount (byte [] bytes, int index, int count)
|
||||
{
|
||||
return GetCharCount (bytes, index, count, false);
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
public override
|
||||
#endif
|
||||
int GetCharCount (byte [] bytes, int index, int count, bool refresh)
|
||||
{
|
||||
CheckRange (bytes, index, count);
|
||||
|
||||
int lastByte = last_byte_count;
|
||||
last_byte_count = 0;
|
||||
int length = 0;
|
||||
while (count-- > 0) {
|
||||
int b = bytes [index++];
|
||||
if (lastByte == 0) {
|
||||
if (b <= 0x80 || b == 0xFF) { // ASCII
|
||||
length++;
|
||||
continue;
|
||||
} else {
|
||||
lastByte = b;
|
||||
continue;
|
||||
// Constructor.
|
||||
public CP936Decoder(DbcsConvert convert) : base(convert) {}
|
||||
|
||||
public override int GetChars(byte[] bytes, int byteIndex, int byteCount,
|
||||
char[] chars, int charIndex)
|
||||
{
|
||||
base.GetChars(bytes, byteIndex, byteCount, chars, charIndex);
|
||||
int origIndex = charIndex;
|
||||
while (byteCount-- > 0) {
|
||||
int b = bytes[byteIndex++];
|
||||
if (lastByte == 0) {
|
||||
if (b <= 0x80 || b == 0xFF) { // ASCII
|
||||
chars[charIndex++] = (char)b;
|
||||
continue;
|
||||
} else if (b < 0x81 || b >= 0xFF) {
|
||||
continue;
|
||||
} else {
|
||||
lastByte = b;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
length++;
|
||||
lastByte = 0;
|
||||
}
|
||||
|
||||
if (lastByte != 0) {
|
||||
if (refresh) {
|
||||
length++;
|
||||
last_byte_count = 0;
|
||||
}
|
||||
else
|
||||
last_byte_count = lastByte;
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
public override int GetChars (byte[] bytes, int byteIndex, int byteCount,
|
||||
char[] chars, int charIndex)
|
||||
{
|
||||
return GetChars (bytes, byteIndex, byteCount, chars, charIndex, false);
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
public override
|
||||
#endif
|
||||
int GetChars (byte [] bytes, int byteIndex, int byteCount,
|
||||
char [] chars, int charIndex, bool refresh)
|
||||
{
|
||||
CheckRange (bytes, byteIndex, byteCount, chars, charIndex);
|
||||
|
||||
int origIndex = charIndex;
|
||||
int lastByte = last_byte_bytes;
|
||||
last_byte_bytes = 0;
|
||||
while (byteCount-- > 0) {
|
||||
int b = bytes[byteIndex++];
|
||||
if (lastByte == 0) {
|
||||
if (b <= 0x80 || b == 0xFF) { // ASCII
|
||||
chars[charIndex++] = (char)b;
|
||||
continue;
|
||||
} else if (b < 0x81 || b >= 0xFF) {
|
||||
continue;
|
||||
int ord = ((lastByte - 0x81) * 191 + b - 0x40) * 2;
|
||||
char c1 = (char)(convert.n2u[ord] + convert.n2u[ord + 1] * 256);
|
||||
if (c1 == 0) {
|
||||
chars[charIndex++] = '?';
|
||||
} else {
|
||||
lastByte = b;
|
||||
continue;
|
||||
chars[charIndex++] = c1;
|
||||
}
|
||||
lastByte = 0;
|
||||
}
|
||||
int ord = ((lastByte - 0x81) * 191 + b - 0x40) * 2;
|
||||
char c1 = ord < 0 || ord >= convert.n2u.Length ?
|
||||
'\0' : (char) (convert.n2u[ord] + convert.n2u[ord + 1] * 256);
|
||||
if (c1 == 0)
|
||||
chars[charIndex++] = '?';
|
||||
else
|
||||
chars[charIndex++] = c1;
|
||||
lastByte = 0;
|
||||
return charIndex - origIndex;
|
||||
}
|
||||
|
||||
if (lastByte != 0) {
|
||||
if (refresh) {
|
||||
// FIXME: handle fallback
|
||||
chars [charIndex++] = '?';
|
||||
last_byte_bytes = 0;
|
||||
}
|
||||
else
|
||||
last_byte_bytes = lastByte;
|
||||
}
|
||||
|
||||
return charIndex - origIndex;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+71
-157
@@ -3,7 +3,6 @@
|
||||
//
|
||||
// Author:
|
||||
// Hye-Shik Chang ([email protected])
|
||||
// Atsushi Enomoto <[email protected]>
|
||||
//
|
||||
|
||||
using System;
|
||||
@@ -105,51 +104,17 @@ namespace I18N.CJK
|
||||
internal class KoreanEncoding : DbcsEncoding
|
||||
{
|
||||
// Constructor.
|
||||
public KoreanEncoding (int codepage, bool useUHC)
|
||||
: base (codepage, 949) {
|
||||
public KoreanEncoding (int codepage, bool useUHC) : base (codepage) {
|
||||
this.useUHC = useUHC;
|
||||
}
|
||||
|
||||
internal override DbcsConvert GetConvert ()
|
||||
{
|
||||
return DbcsConvert.KS;
|
||||
return KSConvert.Convert;
|
||||
}
|
||||
|
||||
bool useUHC;
|
||||
|
||||
// Get the bytes that result from encoding a character buffer.
|
||||
public unsafe override int GetByteCountImpl (char* chars, int count)
|
||||
{
|
||||
int index = 0;
|
||||
int length = 0;
|
||||
DbcsConvert convert = GetConvert ();
|
||||
#if NET_2_0
|
||||
EncoderFallbackBuffer buffer = null;
|
||||
#endif
|
||||
|
||||
// 00 00 - FF FF
|
||||
while (count-- > 0) {
|
||||
char c = chars[index++];
|
||||
if (c <= 0x80 || c == 0xFF) { // ASCII
|
||||
length++;
|
||||
continue;
|
||||
}
|
||||
byte b1 = convert.u2n[((int)c) * 2];
|
||||
byte b2 = convert.u2n[((int)c) * 2 + 1];
|
||||
if (b1 == 0 && b2 == 0) {
|
||||
#if NET_2_0
|
||||
// FIXME: handle fallback for GetByteCountImpl().
|
||||
length++;
|
||||
#else
|
||||
length++;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
length += 2;
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
// Get the bytes that result from encoding a character buffer.
|
||||
public unsafe override int GetBytesImpl (char* chars, int charCount,
|
||||
byte* bytes, int byteCount)
|
||||
@@ -186,17 +151,78 @@ namespace I18N.CJK
|
||||
return byteIndex - origIndex;
|
||||
}
|
||||
|
||||
// Get the characters that result from decoding a byte buffer.
|
||||
public override int GetCharCount (byte[] bytes, int index, int count)
|
||||
{
|
||||
return GetDecoder ().GetCharCount (bytes, index, count);
|
||||
}
|
||||
|
||||
// Get the characters that result from decoding a byte buffer.
|
||||
public override int GetChars(byte[] bytes, int byteIndex, int byteCount,
|
||||
char[] chars, int charIndex)
|
||||
{
|
||||
return GetDecoder ().GetChars (bytes, byteIndex, byteCount, chars, charIndex);
|
||||
DbcsConvert convert = GetConvert ();
|
||||
base.GetChars(bytes, byteIndex, byteCount, chars, charIndex);
|
||||
int origIndex = charIndex;
|
||||
int lastByte = 0;
|
||||
|
||||
while (byteCount-- > 0) {
|
||||
int b = bytes[byteIndex++];
|
||||
if (lastByte == 0) {
|
||||
if (b <= 0x80 || b == 0xFF) { // ASCII
|
||||
chars[charIndex++] = (char)b;
|
||||
continue;
|
||||
} else {
|
||||
lastByte = b;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
char c1;
|
||||
if (useUHC && lastByte < 0xa1) { // UHC Level 1
|
||||
int ord = 8836 + (lastByte - 0x81) * 178;
|
||||
|
||||
if (b >= 0x41 && b <= 0x5A)
|
||||
ord += b - 0x41;
|
||||
else if (b >= 0x61 && b <= 0x7A)
|
||||
ord += b - 0x61 + 26;
|
||||
else if (b >= 0x81 && b <= 0xFE)
|
||||
ord += b - 0x81 + 52;
|
||||
else
|
||||
ord = -1;
|
||||
|
||||
if (ord >= 0 && ord * 2 <= convert.n2u.Length)
|
||||
c1 = (char)(convert.n2u[ord*2] +
|
||||
convert.n2u[ord*2 + 1] * 256);
|
||||
else
|
||||
c1 = (char)0;
|
||||
} else if (useUHC && lastByte <= 0xC6 && b < 0xa1) { // UHC Level 2
|
||||
int ord = 14532 + (lastByte - 0xA1) * 84;
|
||||
|
||||
if (b >= 0x41 && b <= 0x5A)
|
||||
ord += b - 0x41;
|
||||
else if (b >= 0x61 && b <= 0x7A)
|
||||
ord += b - 0x61 + 26;
|
||||
else if (b >= 0x81 && b <= 0xA0)
|
||||
ord += b - 0x81 + 52;
|
||||
else
|
||||
ord = -1;
|
||||
|
||||
if (ord >= 0 && ord * 2 < convert.n2u.Length)
|
||||
c1 = (char)(convert.n2u[ord*2] +
|
||||
convert.n2u[ord*2 + 1] * 256);
|
||||
else
|
||||
c1 = (char)0;
|
||||
} else if (b >= 0xA1 && b <= 0xFE) { // KS X 1001
|
||||
int ord = ((lastByte - 0xA1) * 94 + b - 0xA1) * 2;
|
||||
|
||||
c1 = ord < 0 || ord >= convert.n2u.Length ?
|
||||
'\0' : (char)(convert.n2u[ord] +
|
||||
convert.n2u[ord + 1] * 256);
|
||||
} else
|
||||
c1 = (char)0;
|
||||
|
||||
if (c1 == 0)
|
||||
chars[charIndex++] = '?';
|
||||
else
|
||||
chars[charIndex++] = c1;
|
||||
lastByte = 0;
|
||||
}
|
||||
return charIndex - origIndex;
|
||||
}
|
||||
|
||||
// Get a decoder that handles a rolling UHC state.
|
||||
@@ -215,115 +241,12 @@ namespace I18N.CJK
|
||||
this.useUHC = useUHC;
|
||||
}
|
||||
bool useUHC;
|
||||
int last_byte_count, last_byte_conv;
|
||||
|
||||
public override int GetCharCount (byte[] bytes, int index, int count)
|
||||
{
|
||||
return GetCharCount (bytes, index, count, false);
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
public override
|
||||
#endif
|
||||
int GetCharCount (byte [] bytes, int index, int count, bool refresh)
|
||||
{
|
||||
CheckRange (bytes, index, count);
|
||||
|
||||
int lastByte = last_byte_count;
|
||||
last_byte_count = 0;
|
||||
int length = 0;
|
||||
while (count-- > 0) {
|
||||
int b = bytes[index++];
|
||||
if (lastByte == 0) {
|
||||
if (b <= 0x80 || b == 0xFF) { // ASCII
|
||||
length++;
|
||||
continue;
|
||||
} else {
|
||||
lastByte = b;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
char c1;
|
||||
if (useUHC && lastByte < 0xa1) { // UHC Level 1
|
||||
int ord = 8836 + (lastByte - 0x81) * 178;
|
||||
|
||||
if (b >= 0x41 && b <= 0x5A)
|
||||
ord += b - 0x41;
|
||||
else if (b >= 0x61 && b <= 0x7A)
|
||||
ord += b - 0x61 + 26;
|
||||
else if (b >= 0x81 && b <= 0xFE)
|
||||
ord += b - 0x81 + 52;
|
||||
else
|
||||
ord = -1;
|
||||
|
||||
if (ord >= 0 && ord * 2 <= convert.n2u.Length)
|
||||
c1 = (char)(convert.n2u[ord*2] +
|
||||
convert.n2u[ord*2 + 1] * 256);
|
||||
else
|
||||
c1 = (char)0;
|
||||
} else if (useUHC && lastByte <= 0xC6 && b < 0xA1) { // UHC Level 2
|
||||
int ord = 14532 + (lastByte - 0xA1) * 84;
|
||||
|
||||
if (b >= 0x41 && b <= 0x5A)
|
||||
ord += b - 0x41;
|
||||
else if (b >= 0x61 && b <= 0x7A)
|
||||
ord += b - 0x61 + 26;
|
||||
else if (b >= 0x81 && b <= 0xA0)
|
||||
ord += b - 0x81 + 52;
|
||||
else
|
||||
ord = -1;
|
||||
|
||||
if (ord >= 0 && ord * 2 <= convert.n2u.Length)
|
||||
c1 = (char)(convert.n2u[ord*2] +
|
||||
convert.n2u[ord*2 + 1] * 256);
|
||||
else
|
||||
c1 = (char)0;
|
||||
} else if (b >= 0xA1 && b <= 0xFE) { // KS X 1001
|
||||
int ord = ((lastByte - 0xA1) * 94 + b - 0xA1) * 2;
|
||||
|
||||
c1 = ord < 0 || ord >= convert.n2u.Length ?
|
||||
'\0' : (char)(convert.n2u[ord] +
|
||||
convert.n2u[ord + 1] * 256);
|
||||
} else
|
||||
c1 = (char)0;
|
||||
|
||||
if (c1 == 0)
|
||||
// FIXME: fallback
|
||||
length++;
|
||||
else
|
||||
length++;
|
||||
lastByte = 0;
|
||||
}
|
||||
|
||||
if (lastByte != 0) {
|
||||
if (refresh) {
|
||||
// FIXME: fallback
|
||||
length++;
|
||||
last_byte_count = 0;
|
||||
}
|
||||
else
|
||||
last_byte_count = lastByte;
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
public override int GetChars(byte[] bytes, int byteIndex,
|
||||
int byteCount, char[] chars, int charIndex)
|
||||
{
|
||||
return GetChars (bytes, byteIndex, byteCount, chars, charIndex, false);
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
public override
|
||||
#endif
|
||||
int GetChars(byte[] bytes, int byteIndex,
|
||||
int byteCount, char[] chars, int charIndex, bool refresh)
|
||||
{
|
||||
CheckRange (bytes, byteIndex, byteCount, chars, charIndex);
|
||||
base.GetChars(bytes, byteIndex, byteCount, chars, charIndex);
|
||||
int origIndex = charIndex;
|
||||
int lastByte = last_byte_conv;
|
||||
last_byte_conv = 0;
|
||||
while (byteCount-- > 0) {
|
||||
int b = bytes[byteIndex++];
|
||||
if (lastByte == 0) {
|
||||
@@ -386,15 +309,6 @@ namespace I18N.CJK
|
||||
chars[charIndex++] = c1;
|
||||
lastByte = 0;
|
||||
}
|
||||
|
||||
if (lastByte != 0) {
|
||||
if (refresh) {
|
||||
chars[charIndex++] = '?';
|
||||
last_byte_conv = 0;
|
||||
}
|
||||
else
|
||||
last_byte_conv = lastByte;
|
||||
}
|
||||
return charIndex - origIndex;
|
||||
}
|
||||
}
|
||||
|
||||
+10
-120
@@ -3,7 +3,6 @@
|
||||
//
|
||||
// Author:
|
||||
// Alan Tam Siu Lung ([email protected])
|
||||
// Atsushi Enomoto <[email protected]>
|
||||
//
|
||||
|
||||
using System;
|
||||
@@ -24,39 +23,7 @@ namespace I18N.CJK
|
||||
|
||||
internal override DbcsConvert GetConvert ()
|
||||
{
|
||||
return DbcsConvert.Big5;
|
||||
}
|
||||
|
||||
// Get the bytes that result from encoding a character buffer.
|
||||
public unsafe override int GetByteCountImpl (char* chars, int count)
|
||||
{
|
||||
DbcsConvert convert = GetConvert ();
|
||||
int index = 0;
|
||||
int length = 0;
|
||||
#if NET_2_0
|
||||
EncoderFallbackBuffer buffer = null;
|
||||
#endif
|
||||
|
||||
while (count-- > 0) {
|
||||
char c = chars[index++];
|
||||
if (c <= 0x80 || c == 0xFF) { // ASCII
|
||||
length++;
|
||||
continue;
|
||||
}
|
||||
byte b1 = convert.u2n[((int)c) * 2 + 1];
|
||||
byte b2 = convert.u2n[((int)c) * 2];
|
||||
if (b1 == 0 && b2 == 0) {
|
||||
#if NET_2_0
|
||||
// FIXME: handle fallback for GetByteCountImpl().
|
||||
length++;
|
||||
#else
|
||||
length++;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
length += 2;
|
||||
}
|
||||
return length;
|
||||
return Big5Convert.Convert;
|
||||
}
|
||||
|
||||
// Get the bytes that result from encoding a character buffer.
|
||||
@@ -99,7 +66,6 @@ namespace I18N.CJK
|
||||
public override int GetChars(byte[] bytes, int byteIndex, int byteCount,
|
||||
char[] chars, int charIndex)
|
||||
{
|
||||
/*
|
||||
DbcsConvert convert = GetConvert ();
|
||||
// A1 40 - FA FF
|
||||
base.GetChars(bytes, byteIndex, byteCount, chars, charIndex);
|
||||
@@ -133,9 +99,6 @@ namespace I18N.CJK
|
||||
chars[charIndex++] = '?';
|
||||
|
||||
return charIndex - origIndex;
|
||||
*/
|
||||
|
||||
return GetDecoder ().GetChars (bytes, byteIndex, byteCount, chars, charIndex);
|
||||
}
|
||||
|
||||
// Get a decoder that handles a rolling Big5 state.
|
||||
@@ -181,107 +144,34 @@ namespace I18N.CJK
|
||||
{
|
||||
// Constructor.
|
||||
public CP950Decoder(DbcsConvert convert) : base(convert) {}
|
||||
int last_byte_count, last_byte_conv;
|
||||
|
||||
public override int GetCharCount (byte[] bytes, int index, int count)
|
||||
{
|
||||
return GetCharCount (bytes, index, count, false);
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
public override
|
||||
#endif
|
||||
int GetCharCount (byte[] bytes, int index, int count, bool refresh)
|
||||
{
|
||||
CheckRange (bytes, index, count);
|
||||
|
||||
int lastByte = last_byte_count;
|
||||
last_byte_count = 0;
|
||||
int length = 0;
|
||||
while (count-- > 0) {
|
||||
int b = bytes[index++];
|
||||
if (lastByte == 0) {
|
||||
if (b <= 0x80 || b == 0xFF) { // ASCII
|
||||
length++;
|
||||
} else if (b < 0xA1 || b >= 0xFA) {
|
||||
// incorrect first byte.
|
||||
length++;
|
||||
count--; // cut one more byte.
|
||||
} else {
|
||||
lastByte = b;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
int ord = ((lastByte - 0xA1) * 191 + b - 0x40) * 2;
|
||||
char c1 = ord < 0 || ord > convert.n2u.Length ?
|
||||
'\0' :
|
||||
(char)(convert.n2u[ord] + convert.n2u[ord + 1] * 256);
|
||||
if (c1 == 0)
|
||||
// FIXME: fallback
|
||||
length++;
|
||||
else
|
||||
length++;
|
||||
lastByte = 0;
|
||||
}
|
||||
|
||||
if (lastByte != 0) {
|
||||
if (refresh)
|
||||
// FIXME: fallback
|
||||
length++;
|
||||
else
|
||||
last_byte_count = lastByte;
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
|
||||
public override int GetChars(byte[] bytes, int byteIndex, int byteCount,
|
||||
char[] chars, int charIndex)
|
||||
{
|
||||
return GetChars (bytes, byteIndex, byteCount, chars, charIndex, false);
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
public override
|
||||
#endif
|
||||
int GetChars(byte[] bytes, int byteIndex, int byteCount,
|
||||
char[] chars, int charIndex, bool refresh)
|
||||
{
|
||||
CheckRange (bytes, byteIndex, byteCount, chars, charIndex);
|
||||
|
||||
base.GetChars(bytes, byteIndex, byteCount, chars, charIndex);
|
||||
int origIndex = charIndex;
|
||||
int lastByte = last_byte_conv;
|
||||
last_byte_conv = 0;
|
||||
while (byteCount-- > 0) {
|
||||
int b = bytes[byteIndex++];
|
||||
if (lastByte == 0) {
|
||||
if (b <= 0x80 || b == 0xFF) { // ASCII
|
||||
chars[charIndex++] = (char)b;
|
||||
continue;
|
||||
} else if (b < 0xA1 || b >= 0xFA) {
|
||||
// incorrect first byte.
|
||||
chars[charIndex++] = '?';
|
||||
byteCount--; // cut one more byte.
|
||||
continue;
|
||||
} else {
|
||||
lastByte = b;
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
int ord = ((lastByte - 0xA1) * 191 + b - 0x40) * 2;
|
||||
char c1 = ord < 0 || ord > convert.n2u.Length ?
|
||||
'\0' :
|
||||
(char)(convert.n2u[ord] + convert.n2u[ord + 1] * 256);
|
||||
if (c1 == 0)
|
||||
char c1 = (char)(convert.n2u[ord] + convert.n2u[ord + 1] * 256);
|
||||
if (c1 == 0) {
|
||||
chars[charIndex++] = '?';
|
||||
else
|
||||
} else {
|
||||
chars[charIndex++] = c1;
|
||||
}
|
||||
lastByte = 0;
|
||||
}
|
||||
|
||||
if (lastByte != 0) {
|
||||
if (refresh)
|
||||
chars [charIndex++] = '?';
|
||||
else
|
||||
last_byte_conv = lastByte;
|
||||
}
|
||||
return charIndex - origIndex;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,60 +1,3 @@
|
||||
2006-01-30 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* DbcsEncoding.cs ISO2022JP.cs GB18030Encoding.cs CP51932.cs
|
||||
CP949.cs : Fixed windows code page and some minor properties.
|
||||
|
||||
2006-01-23 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* DbcsConvert.cs ISO2022JP.cs CP950.cs CP932.cs: author lines.
|
||||
Monoized CP932.cs which is too deeply indented to read (and
|
||||
anyways no one other than myself is taking care of it).
|
||||
|
||||
2006-01-23 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* KSConvert.cs Big5Convert.cs Gb2312Convert.cs: removed. They could
|
||||
just be DbcsConvert instances.
|
||||
* I18N.CJK.dll.sources : removed above.
|
||||
* DbcsConvert.cs : added static fields: Big5 and KS.
|
||||
* CP949.cs CP950.cs : use DbcsConvert class directly.
|
||||
|
||||
2006-01-23 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* CP936.cs, CP949.cs, CP950.cs :
|
||||
Added GetByteCountImpl() (there weren't GetByteCount() override
|
||||
in those classes, so they also save extra byte[] allocation).
|
||||
* CP932.cs, CP51932.cs, GB18030Encoding.cs, ISO2022JP.cs :
|
||||
GetByteCount() -> GetByteCountImpl().
|
||||
Fixed ISO2022JPEncoder/Decoder to hold different "shifted_in" flags
|
||||
for GetByteCountImpl() and GetBytesImpl().
|
||||
|
||||
2006-01-23 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* ISO2022JP.cs GB18030Encoding.cs CP936.cs CP51932.cs:
|
||||
fix warnings.
|
||||
|
||||
2006-01-23 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* CP950.cs :
|
||||
This was the last one encoding which needed incomplete byte
|
||||
handling.
|
||||
* DbcsEncoding.cs, GB18030Encoding.cs, CP950.cs, CP932.cs,
|
||||
CP936.cs, CP51932.cs, CP949.cs (all):
|
||||
Made GetCharCount() and GetChars() in DbcsDecoder as different
|
||||
internal CheckRange() methods (it is bad design to have those
|
||||
methods as base methods). Use CheckRange() everywhere.
|
||||
|
||||
2006-01-23 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* CP949.cs :
|
||||
handle incomplete byte (thus conversion implementation went into
|
||||
CP949Decoder like other DBCS encodings).
|
||||
|
||||
2006-01-23 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* CP936.cs :
|
||||
handle incomplete byte (thus conversion implementation went into
|
||||
CP936Decoder like other DBCS encodings).
|
||||
|
||||
2006-01-20 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* CP51932.cs :
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
//
|
||||
// Author:
|
||||
// Alan Tam Siu Lung ([email protected])
|
||||
// Atsushi Enomoto <[email protected]>
|
||||
//
|
||||
|
||||
using System;
|
||||
@@ -28,11 +27,6 @@ namespace I18N.CJK
|
||||
}
|
||||
}
|
||||
|
||||
internal static readonly DbcsConvert Gb2312 =
|
||||
new DbcsConvert ("gb2312.table");
|
||||
internal static readonly DbcsConvert Big5 =
|
||||
new DbcsConvert ("big5.table");
|
||||
internal static readonly DbcsConvert KS =
|
||||
new DbcsConvert ("ks.table");
|
||||
internal static DbcsConvert Gb2312 = new DbcsConvert ("gb2312.table");
|
||||
}
|
||||
}
|
||||
@@ -14,14 +14,7 @@ namespace I18N.CJK
|
||||
[Serializable]
|
||||
internal abstract class DbcsEncoding : MonoEncoding
|
||||
{
|
||||
public DbcsEncoding (int codePage) : this (codePage, 0)
|
||||
{
|
||||
}
|
||||
|
||||
public DbcsEncoding (int codePage, int windowsCodePage)
|
||||
: base (codePage, windowsCodePage)
|
||||
{
|
||||
}
|
||||
public DbcsEncoding(int codePage) : base(codePage) {}
|
||||
|
||||
internal abstract DbcsConvert GetConvert ();
|
||||
|
||||
@@ -106,6 +99,12 @@ namespace I18N.CJK
|
||||
return byteCount;
|
||||
}
|
||||
|
||||
// Get a decoder that handles a rolling state.
|
||||
public override Decoder GetDecoder()
|
||||
{
|
||||
return new DbcsDecoder(GetConvert ());
|
||||
}
|
||||
|
||||
// Determine if this encoding can be displayed in a Web browser.
|
||||
public override bool IsBrowserDisplay
|
||||
{
|
||||
@@ -131,17 +130,20 @@ namespace I18N.CJK
|
||||
}
|
||||
|
||||
// Decoder that handles a rolling state.
|
||||
internal abstract class DbcsDecoder : Decoder
|
||||
internal class DbcsDecoder : Decoder
|
||||
{
|
||||
protected DbcsConvert convert;
|
||||
protected int lastByte;
|
||||
|
||||
// Constructor.
|
||||
public DbcsDecoder(DbcsConvert convert)
|
||||
{
|
||||
this.convert = convert;
|
||||
this.lastByte = 0;
|
||||
}
|
||||
|
||||
internal void CheckRange (byte[] bytes, int index, int count)
|
||||
// Override inherited methods.
|
||||
public override int GetCharCount(byte[] bytes, int index, int count)
|
||||
{
|
||||
if (bytes == null)
|
||||
throw new ArgumentNullException("bytes");
|
||||
@@ -149,9 +151,11 @@ namespace I18N.CJK
|
||||
throw new ArgumentOutOfRangeException("index", Strings.GetString("ArgRange_Array"));
|
||||
if (count < 0 || count > (bytes.Length - index))
|
||||
throw new ArgumentOutOfRangeException("count", Strings.GetString("ArgRange_Array"));
|
||||
char[] buffer = new char[count * 2];
|
||||
return GetChars(bytes, index, count, buffer, 0);
|
||||
}
|
||||
|
||||
internal void CheckRange (byte[] bytes, int byteIndex, int byteCount,
|
||||
|
||||
public override int GetChars(byte[] bytes, int byteIndex, int byteCount,
|
||||
char[] chars, int charIndex)
|
||||
{
|
||||
if (bytes == null)
|
||||
@@ -164,6 +168,7 @@ namespace I18N.CJK
|
||||
throw new ArgumentOutOfRangeException("byteCount", Strings.GetString("ArgRange_Array"));
|
||||
if (charIndex < 0 || charIndex > chars.Length)
|
||||
throw new ArgumentOutOfRangeException("charIndex", Strings.GetString("ArgRange_Array"));
|
||||
return 0; // For subclasses to implement
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace I18N.CJK
|
||||
{
|
||||
// Constructor.
|
||||
public GB18030Encoding ()
|
||||
: base (54936, 936)
|
||||
: base (54936)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -33,34 +33,10 @@ namespace I18N.CJK
|
||||
get { return "Chinese Simplified (GB18030)"; }
|
||||
}
|
||||
|
||||
public override string HeaderName {
|
||||
get { return "GB18030"; }
|
||||
}
|
||||
|
||||
public override string BodyName {
|
||||
get { return "GB18030"; }
|
||||
}
|
||||
|
||||
public override string WebName {
|
||||
get { return "GB18030"; }
|
||||
}
|
||||
|
||||
public override bool IsMailNewsDisplay {
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override bool IsMailNewsSave {
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override bool IsBrowserDisplay {
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override bool IsBrowserSave {
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override int GetMaxByteCount (int len)
|
||||
{
|
||||
// non-GB2312 characters in \u0080 - \uFFFF
|
||||
@@ -77,11 +53,6 @@ namespace I18N.CJK
|
||||
return new GB18030Encoder (this).GetByteCount (chars, index, length, true);
|
||||
}
|
||||
|
||||
public unsafe override int GetByteCountImpl (char* chars, int count)
|
||||
{
|
||||
return new GB18030Encoder (this).GetByteCountImpl (chars, count, true);
|
||||
}
|
||||
|
||||
public unsafe override int GetBytesImpl (char* chars, int charCount, byte* bytes, int byteCount)
|
||||
{
|
||||
return new GB18030Encoder (this).GetBytesImpl (chars, charCount, bytes, byteCount, true);
|
||||
@@ -108,20 +79,20 @@ namespace I18N.CJK
|
||||
}
|
||||
}
|
||||
|
||||
class GB18030Decoder : DbcsEncoding.DbcsDecoder
|
||||
class GB18030Decoder : Decoder
|
||||
{
|
||||
static DbcsConvert gb2312 = DbcsConvert.Gb2312;
|
||||
// for now incomplete block is not supported - should we?
|
||||
// int incomplete1 = -1, incomplete2 = -1, incomplete3 = -1;
|
||||
|
||||
public GB18030Decoder ()
|
||||
: base (null)
|
||||
{
|
||||
}
|
||||
|
||||
public override int GetCharCount (byte [] bytes, int start, int len)
|
||||
{
|
||||
CheckRange (bytes, start, len);
|
||||
if (bytes == null)
|
||||
throw new ArgumentNullException ("bytes");
|
||||
if (start < 0 || start > bytes.Length)
|
||||
throw new ArgumentOutOfRangeException ("start");
|
||||
if (len < 0 || start + len > bytes.Length)
|
||||
throw new ArgumentOutOfRangeException ("len");
|
||||
|
||||
int end = start + len;
|
||||
int ret = 0;
|
||||
@@ -195,7 +166,16 @@ namespace I18N.CJK
|
||||
|
||||
public override int GetChars (byte [] bytes, int byteIndex, int byteCount, char [] chars, int charIndex)
|
||||
{
|
||||
CheckRange (bytes, byteIndex, byteCount, chars, charIndex);
|
||||
if (bytes == null)
|
||||
throw new ArgumentNullException ("bytes");
|
||||
if (chars == null)
|
||||
throw new ArgumentNullException ("chars");
|
||||
if (byteIndex < 0 || byteIndex > bytes.Length)
|
||||
throw new ArgumentOutOfRangeException ("byteIndex");
|
||||
if (byteCount < 0 || byteIndex + byteCount > bytes.Length)
|
||||
throw new ArgumentOutOfRangeException ("byteCount");
|
||||
if (charIndex < 0 || charIndex > chars.Length)
|
||||
throw new ArgumentOutOfRangeException ("charIndex");
|
||||
|
||||
int byteEnd = byteIndex + byteCount;
|
||||
int charStart = charIndex;
|
||||
@@ -274,7 +254,7 @@ namespace I18N.CJK
|
||||
}
|
||||
}
|
||||
|
||||
class GB18030Encoder : MonoEncoder
|
||||
class GB18030Encoder : MonoEncoding.MonoEncoder
|
||||
{
|
||||
static DbcsConvert gb2312 = DbcsConvert.Gb2312;
|
||||
|
||||
@@ -286,10 +266,16 @@ namespace I18N.CJK
|
||||
char incomplete_byte_count;
|
||||
char incomplete_bytes;
|
||||
|
||||
public unsafe override int GetByteCountImpl (char* chars, int count, bool refresh)
|
||||
public override int GetByteCount (char [] chars, int start, int len, bool refresh)
|
||||
{
|
||||
int start = 0;
|
||||
int end = count;
|
||||
if (chars == null)
|
||||
throw new ArgumentNullException ("chars");
|
||||
if (start < 0 || start > chars.Length)
|
||||
throw new ArgumentOutOfRangeException ("index");
|
||||
if (len < 0 || start + len > chars.Length)
|
||||
throw new ArgumentOutOfRangeException ("count");
|
||||
|
||||
int end = start + len;
|
||||
int ret = 0;
|
||||
while (start < end) {
|
||||
char ch = chars [start];
|
||||
@@ -347,6 +333,9 @@ namespace I18N.CJK
|
||||
{
|
||||
int charIndex = 0;
|
||||
int byteIndex = 0;
|
||||
#if NET_2_0
|
||||
EncoderFallbackBuffer buffer = null;
|
||||
#endif
|
||||
|
||||
int charEnd = charIndex + charCount;
|
||||
int byteStart = byteIndex;
|
||||
|
||||
@@ -0,0 +1,299 @@
|
||||
//
|
||||
// I18N.CJK.Gb2312Convert
|
||||
//
|
||||
// Author:
|
||||
// Alan Tam Siu Lung ([email protected])
|
||||
// Dick Porter ([email protected])
|
||||
//
|
||||
|
||||
using System;
|
||||
|
||||
namespace I18N.CJK
|
||||
{
|
||||
internal sealed class Gb2312Convert
|
||||
{
|
||||
public byte[] gb2312_to_unicode;
|
||||
public byte[] gb2312_from_unicode1;
|
||||
public byte[] gb2312_from_unicode2;
|
||||
public byte[] gb2312_from_unicode3;
|
||||
public byte[] gb2312_from_unicode4;
|
||||
public byte[] gb2312_from_unicode5;
|
||||
public byte[] gb2312_from_unicode6;
|
||||
public byte[] gb2312_from_unicode7;
|
||||
public byte[] gb2312_from_unicode8;
|
||||
public byte[] gb2312_from_unicode9;
|
||||
|
||||
private Gb2312Convert()
|
||||
{
|
||||
using (CodeTable table = new CodeTable ("gb2312.table")) {
|
||||
gb2312_to_unicode = table.GetSection (1);
|
||||
|
||||
gb2312_from_unicode1 = table.GetSection (2);
|
||||
gb2312_from_unicode2 = table.GetSection (3);
|
||||
gb2312_from_unicode3 = table.GetSection (4);
|
||||
gb2312_from_unicode4 = table.GetSection (5);
|
||||
gb2312_from_unicode5 = table.GetSection (6);
|
||||
gb2312_from_unicode6 = table.GetSection (7);
|
||||
gb2312_from_unicode7 = table.GetSection (8);
|
||||
gb2312_from_unicode8 = table.GetSection (9);
|
||||
gb2312_from_unicode9 = table.GetSection (10);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// The one and only GB2312 conversion object in the system.
|
||||
private static Gb2312Convert convert;
|
||||
static readonly object lockobj = new object ();
|
||||
// Get the primary GB2312 conversion object.
|
||||
public static Gb2312Convert Convert
|
||||
{
|
||||
get {
|
||||
lock (lockobj) {
|
||||
if (convert == null) {
|
||||
convert = new Gb2312Convert ();
|
||||
}
|
||||
return(convert);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public char BytePairToChar (ref int lastByte, int b)
|
||||
{
|
||||
if (lastByte == 0) {
|
||||
if (b < 0x80) {
|
||||
// ASCII
|
||||
return (char) b;
|
||||
} else if ((b <= 0xa0 &&
|
||||
b != 0x8e &&
|
||||
b != 0x8f) ||
|
||||
b > 0xfe) {
|
||||
// Invalid first byte
|
||||
return char.MinValue;
|
||||
} else {
|
||||
// First byte in a
|
||||
// double-byte sequence
|
||||
lastByte = b;
|
||||
return char.MaxValue;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
// Second byte in a
|
||||
// double-byte sequence
|
||||
if (lastByte < 0x80 ||
|
||||
(lastByte - 0x80) <= 0x20 ||
|
||||
(lastByte - 0x80) > 0x77 ||
|
||||
(b - 0x80) <= 0x20 ||
|
||||
(b - 0x80) >= 0x7f) {
|
||||
// Invalid second byte
|
||||
return char.MinValue;
|
||||
} else {
|
||||
int value;
|
||||
int idx = (((lastByte - 0xa1) * 94 + (b - 0xa1)) * 2);
|
||||
|
||||
if (idx > 0x3fe2) {
|
||||
value = 0;
|
||||
} else {
|
||||
value = (int)(gb2312_to_unicode[idx] | (gb2312_to_unicode[idx + 1] << 8));
|
||||
}
|
||||
|
||||
if (value != 0) {
|
||||
return (char)value;
|
||||
} else {
|
||||
return char.MinValue;
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
lastByte = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public int UcsToGbk (int ch)
|
||||
{
|
||||
byte byte1 = 0, byte2 = 0;
|
||||
int tablepos;
|
||||
|
||||
if (ch >= 0xa4 && ch <= 0x101) {
|
||||
tablepos = (ch - 0xa4) * 2;
|
||||
byte1 = gb2312_from_unicode1 [tablepos];
|
||||
byte2 = gb2312_from_unicode1 [tablepos + 1];
|
||||
} else if (ch >= 0x113 && ch <= 0x2c9) {
|
||||
switch(ch) {
|
||||
case 0x113:
|
||||
byte1 = 0x28;
|
||||
byte2 = 0x25;
|
||||
break;
|
||||
case 0x11b:
|
||||
byte1 = 0x28;
|
||||
byte2 = 0x27;
|
||||
break;
|
||||
case 0x12b:
|
||||
byte1 = 0x28;
|
||||
byte2 = 0x29;
|
||||
break;
|
||||
case 0x14d:
|
||||
byte1 = 0x28;
|
||||
byte2 = 0x2d;
|
||||
break;
|
||||
case 0x16b:
|
||||
byte1 = 0x28;
|
||||
byte2 = 0x31;
|
||||
break;
|
||||
case 0x1ce:
|
||||
byte1 = 0x28;
|
||||
byte2 = 0x23;
|
||||
break;
|
||||
case 0x1d0:
|
||||
byte1 = 0x28;
|
||||
byte2 = 0x2b;
|
||||
break;
|
||||
case 0x1d2:
|
||||
byte1 = 0x28;
|
||||
byte2 = 0x2f;
|
||||
break;
|
||||
case 0x1d4:
|
||||
byte1 = 0x28;
|
||||
byte2 = 0x33;
|
||||
break;
|
||||
case 0x1d6:
|
||||
byte1 = 0x28;
|
||||
byte2 = 0x35;
|
||||
break;
|
||||
case 0x1d8:
|
||||
byte1 = 0x28;
|
||||
byte2 = 0x36;
|
||||
break;
|
||||
case 0x1da:
|
||||
byte1 = 0x28;
|
||||
byte2 = 0x37;
|
||||
break;
|
||||
case 0x1dc:
|
||||
byte1 = 0x28;
|
||||
byte2 = 0x38;
|
||||
break;
|
||||
case 0x2c7:
|
||||
byte1 = 0x21;
|
||||
byte2 = 0x26;
|
||||
break;
|
||||
case 0x2c9:
|
||||
byte1 = 0x21;
|
||||
byte2 = 0x25;
|
||||
break;
|
||||
}
|
||||
} else if (ch >= 0x391 && ch <= 0x3c9) {
|
||||
tablepos = (ch - 0x391) * 2;
|
||||
byte1 = gb2312_from_unicode2 [tablepos];
|
||||
byte2 = gb2312_from_unicode2 [tablepos + 1];
|
||||
} else if (ch >= 0x401 && ch <= 0x451) {
|
||||
tablepos = (ch - 0x401) * 2;
|
||||
byte1 = gb2312_from_unicode3 [tablepos];
|
||||
byte2 = gb2312_from_unicode3 [tablepos + 1];
|
||||
} else if (ch >= 0x2015 && ch <= 0x203b) {
|
||||
tablepos = (ch - 0x2015) * 2;
|
||||
byte1 = gb2312_from_unicode4 [tablepos];
|
||||
byte2 = gb2312_from_unicode4 [tablepos + 1];
|
||||
} else if (ch >= 0x2103 && ch <= 0x22a5) {
|
||||
tablepos = (ch - 0x2103) * 2;
|
||||
byte1 = gb2312_from_unicode5 [tablepos];
|
||||
byte2 = gb2312_from_unicode5 [tablepos + 1];
|
||||
} else if (ch == 0x2312) {
|
||||
byte1 = 0x21;
|
||||
byte2 = 0x50;
|
||||
} else if (ch >= 0x2460 && ch <= 0x249b) {
|
||||
tablepos = (ch - 0x2460) * 2;
|
||||
byte1 = gb2312_from_unicode6 [tablepos];
|
||||
byte2 = gb2312_from_unicode6 [tablepos + 1];
|
||||
} else if (ch >= 0x2500 && ch <= 0x254b) {
|
||||
byte1 = 0x29;
|
||||
byte2 = (byte) (0x24 + (ch % 0x100));
|
||||
} else if (ch >= 0x25a0 && ch <= 0x2642) {
|
||||
switch(ch) {
|
||||
case 0x25a0:
|
||||
byte1 = 0x21;
|
||||
byte2 = 0x76;
|
||||
break;
|
||||
case 0x25a1:
|
||||
byte1 = 0x21;
|
||||
byte2 = 0x75;
|
||||
break;
|
||||
case 0x25b2:
|
||||
byte1 = 0x21;
|
||||
byte2 = 0x78;
|
||||
break;
|
||||
case 0x25b3:
|
||||
byte1 = 0x21;
|
||||
byte2 = 0x77;
|
||||
break;
|
||||
case 0x25c6:
|
||||
byte1 = 0x21;
|
||||
byte2 = 0x74;
|
||||
break;
|
||||
case 0x25c7:
|
||||
byte1 = 0x21;
|
||||
byte2 = 0x73;
|
||||
break;
|
||||
case 0x25cb:
|
||||
byte1 = 0x21;
|
||||
byte2 = 0x70;
|
||||
break;
|
||||
case 0x25ce:
|
||||
byte1 = 0x21;
|
||||
byte2 = 0x72;
|
||||
break;
|
||||
case 0x25cf:
|
||||
byte1 = 0x21;
|
||||
byte2 = 0x71;
|
||||
break;
|
||||
case 0x2605:
|
||||
byte1 = 0x21;
|
||||
byte2 = 0x6f;
|
||||
break;
|
||||
case 0x2606:
|
||||
byte1 = 0x21;
|
||||
byte2 = 0x6e;
|
||||
break;
|
||||
case 0x2640:
|
||||
byte1 = 0x21;
|
||||
byte2 = 0x62;
|
||||
break;
|
||||
case 0x2642:
|
||||
byte1 = 0x21;
|
||||
byte2 = 0x61;
|
||||
break;
|
||||
}
|
||||
} else if (ch >= 0x3000 && ch <= 0x3129) {
|
||||
tablepos = (ch - 0x3000) * 2;
|
||||
byte1 = gb2312_from_unicode7 [tablepos];
|
||||
byte2 = gb2312_from_unicode7 [tablepos + 1];
|
||||
} else if (ch >= 0x3220 && ch <= 0x3229) {
|
||||
byte1 = 0x22;
|
||||
byte2 = (byte) (0x65 + (ch - 0x3220));
|
||||
} else if (ch >= 0x4e00 && ch <= 0x9fa0) {
|
||||
tablepos = (ch - 0x4e00) * 2;
|
||||
byte1 = gb2312_from_unicode8 [tablepos];
|
||||
byte2 = gb2312_from_unicode8 [tablepos + 1];
|
||||
} else if (ch >= 0xff01 && ch <= 0xff5e) {
|
||||
tablepos = (ch - 0xff01) * 2;
|
||||
byte1 = gb2312_from_unicode9 [tablepos];
|
||||
byte2 = gb2312_from_unicode9 [tablepos + 1];
|
||||
} else if (ch == 0xffe0) {
|
||||
byte1 = 0x21;
|
||||
byte2 = 0x69;
|
||||
} else if (ch == 0xffe1) {
|
||||
byte1 = 0x21;
|
||||
byte2 = 0x6a;
|
||||
} else if (ch == 0xffe3) {
|
||||
byte1 = 0x21;
|
||||
byte2 = 0x7e;
|
||||
} else if (ch == 0xffe5) {
|
||||
byte1 = 0x21;
|
||||
byte2 = 0x24;
|
||||
}
|
||||
|
||||
if (byte1 == 0 || byte2 == 0)
|
||||
return -1; // invalid
|
||||
else
|
||||
return ((byte1 + 0x80) << 8) + byte2 + 0x80;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
../Assembly/AssemblyInfo.cs
|
||||
../../../build/common/Consts.cs
|
||||
Big5Convert.cs
|
||||
CP932.cs
|
||||
ISO2022JP.cs
|
||||
CP51932.cs
|
||||
@@ -9,6 +10,8 @@ CP950.cs
|
||||
CodeTable.cs
|
||||
DbcsEncoding.cs
|
||||
DbcsConvert.cs
|
||||
Gb2312Convert.cs
|
||||
GB18030Encoding.cs
|
||||
GB18030Source.cs
|
||||
JISConvert.cs
|
||||
KSConvert.cs
|
||||
@@ -1,15 +1,12 @@
|
||||
//
|
||||
// ISO2022JP.cs
|
||||
//
|
||||
// Author:
|
||||
// Atsushi Enomoto <[email protected]>
|
||||
//
|
||||
using System;
|
||||
using System.Text;
|
||||
using I18N.Common;
|
||||
|
||||
namespace I18N.CJK
|
||||
{
|
||||
// FIXME:
|
||||
// find out what is the difference between 50220, 50221 and 50222.
|
||||
|
||||
[Serializable]
|
||||
public class CP50220 : ISO2022JPEncoding
|
||||
{
|
||||
@@ -52,8 +49,10 @@ namespace I18N.CJK
|
||||
[Serializable]
|
||||
public class ISO2022JPEncoding : MonoEncoding
|
||||
{
|
||||
static JISConvert convert = JISConvert.Convert;
|
||||
|
||||
public ISO2022JPEncoding (int codePage, bool allow1ByteKana, bool allowShiftIO)
|
||||
: base (codePage, 932)
|
||||
: base (codePage)
|
||||
{
|
||||
this.allow_1byte_kana = allow1ByteKana;
|
||||
this.allow_shift_io = allowShiftIO;
|
||||
@@ -90,11 +89,6 @@ namespace I18N.CJK
|
||||
return new ISO2022JPEncoder (this, allow_1byte_kana, allow_shift_io).GetByteCount (chars, charIndex, charCount, true);
|
||||
}
|
||||
|
||||
public unsafe override int GetByteCountImpl (char* chars, int count)
|
||||
{
|
||||
return new ISO2022JPEncoder (this, allow_1byte_kana, allow_shift_io).GetByteCountImpl (chars, count, true);
|
||||
}
|
||||
|
||||
public unsafe override int GetBytesImpl (char* chars, int charCount, byte* bytes, int byteCount)
|
||||
{
|
||||
return new ISO2022JPEncoder (this, allow_1byte_kana, allow_shift_io).GetBytesImpl (chars, charCount, bytes, byteCount, true);
|
||||
@@ -117,14 +111,14 @@ namespace I18N.CJK
|
||||
JISX0201
|
||||
}
|
||||
|
||||
internal class ISO2022JPEncoder : MonoEncoder
|
||||
internal class ISO2022JPEncoder : MonoEncoding.MonoEncoder
|
||||
{
|
||||
static JISConvert convert = JISConvert.Convert;
|
||||
|
||||
readonly bool allow_1byte_kana, allow_shift_io;
|
||||
|
||||
ISO2022JPMode m = ISO2022JPMode.ASCII;
|
||||
bool shifted_in_count, shifted_in_conv;
|
||||
bool shifted_in;
|
||||
|
||||
public ISO2022JPEncoder (MonoEncoding owner, bool allow1ByteKana, bool allowShiftIO)
|
||||
: base (owner)
|
||||
@@ -133,10 +127,9 @@ namespace I18N.CJK
|
||||
this.allow_shift_io = allowShiftIO;
|
||||
}
|
||||
|
||||
public unsafe override int GetByteCountImpl (char* chars, int charCount, bool flush)
|
||||
public override int GetByteCount (char [] chars, int charIndex, int charCount, bool flush)
|
||||
{
|
||||
int charIndex = 0;
|
||||
int end = charCount;
|
||||
int end = charIndex + charCount;
|
||||
int value;
|
||||
int byteCount = 0;
|
||||
|
||||
@@ -151,8 +144,8 @@ namespace I18N.CJK
|
||||
|
||||
if (ch >= 0x2010 && ch <= 0x9FA5)
|
||||
{
|
||||
if (shifted_in_count) {
|
||||
shifted_in_count = false;
|
||||
if (shifted_in) {
|
||||
shifted_in = false;
|
||||
byteCount++; // shift_out
|
||||
}
|
||||
if (m != ISO2022JPMode.JISX0208)
|
||||
@@ -163,8 +156,8 @@ namespace I18N.CJK
|
||||
value = ((int)(convert.cjkToJis[value])) |
|
||||
(((int)(convert.cjkToJis[value + 1])) << 8);
|
||||
} else if (ch >= 0xFF01 && ch <= 0xFF60) {
|
||||
if (shifted_in_count) {
|
||||
shifted_in_count = false;
|
||||
if (shifted_in) {
|
||||
shifted_in = false;
|
||||
byteCount++;
|
||||
}
|
||||
if (m != ISO2022JPMode.JISX0208)
|
||||
@@ -177,9 +170,9 @@ namespace I18N.CJK
|
||||
(((int)(convert.extraToJis[value + 1])) << 8);
|
||||
} else if(ch >= 0xFF60 && ch <= 0xFFA0) {
|
||||
if (allow_shift_io) {
|
||||
if (!shifted_in_count) {
|
||||
if (!shifted_in) {
|
||||
byteCount++;
|
||||
shifted_in_count = true;
|
||||
shifted_in = true;
|
||||
}
|
||||
}
|
||||
else if (m != ISO2022JPMode.JISX0201) {
|
||||
@@ -188,8 +181,8 @@ namespace I18N.CJK
|
||||
}
|
||||
value = ch - 0xFF60 + 0xA0;
|
||||
} else if (ch < 128) {
|
||||
if (shifted_in_count) {
|
||||
shifted_in_count = false;
|
||||
if (shifted_in) {
|
||||
shifted_in = false;
|
||||
byteCount++;
|
||||
}
|
||||
if (m != ISO2022JPMode.ASCII)
|
||||
@@ -207,8 +200,8 @@ namespace I18N.CJK
|
||||
}
|
||||
// must end in ASCII mode
|
||||
if (flush) {
|
||||
if (shifted_in_count) {
|
||||
shifted_in_count = false;
|
||||
if (shifted_in) {
|
||||
shifted_in = false;
|
||||
byteCount++;
|
||||
}
|
||||
if (m != ISO2022JPMode.ASCII)
|
||||
@@ -253,6 +246,9 @@ namespace I18N.CJK
|
||||
{
|
||||
int charIndex = 0;
|
||||
int byteIndex = 0;
|
||||
#if NET_2_0
|
||||
EncoderFallbackBuffer buffer = null;
|
||||
#endif
|
||||
|
||||
int start = byteIndex;
|
||||
int end = charIndex + charCount;
|
||||
@@ -270,9 +266,9 @@ namespace I18N.CJK
|
||||
|
||||
if (ch >= 0x2010 && ch <= 0x9FA5)
|
||||
{
|
||||
if (shifted_in_conv) {
|
||||
if (shifted_in) {
|
||||
bytes [byteIndex++] = 0x0F;
|
||||
shifted_in_conv = false;
|
||||
shifted_in = false;
|
||||
byteCount--;
|
||||
}
|
||||
switch (m) {
|
||||
@@ -287,9 +283,9 @@ namespace I18N.CJK
|
||||
value = ((int)(convert.cjkToJis[value])) |
|
||||
(((int)(convert.cjkToJis[value + 1])) << 8);
|
||||
} else if (ch >= 0xFF01 && ch <= 0xFF60) {
|
||||
if (shifted_in_conv) {
|
||||
if (shifted_in) {
|
||||
bytes [byteIndex++] = 0x0F;
|
||||
shifted_in_conv = false;
|
||||
shifted_in = false;
|
||||
byteCount--;
|
||||
}
|
||||
switch (m) {
|
||||
@@ -310,9 +306,9 @@ namespace I18N.CJK
|
||||
// so here we don't have to consider it.
|
||||
|
||||
if (allow_shift_io) {
|
||||
if (!shifted_in_conv) {
|
||||
if (!shifted_in) {
|
||||
bytes [byteIndex++] = 0x0E;
|
||||
shifted_in_conv = true;
|
||||
shifted_in = true;
|
||||
byteCount--;
|
||||
}
|
||||
} else {
|
||||
@@ -326,9 +322,9 @@ namespace I18N.CJK
|
||||
}
|
||||
value = ch - 0xFF40;
|
||||
} else if (ch < 128) {
|
||||
if (shifted_in_conv) {
|
||||
if (shifted_in) {
|
||||
bytes [byteIndex++] = 0x0F;
|
||||
shifted_in_conv = false;
|
||||
shifted_in = false;
|
||||
byteCount--;
|
||||
}
|
||||
SwitchMode (bytes, ref byteIndex, ref byteCount, ref m, ISO2022JPMode.ASCII);
|
||||
@@ -357,9 +353,9 @@ namespace I18N.CJK
|
||||
}
|
||||
if (flush) {
|
||||
// must end in ASCII mode
|
||||
if (shifted_in_conv) {
|
||||
if (shifted_in) {
|
||||
bytes [byteIndex++] = 0x0F;
|
||||
shifted_in_conv = false;
|
||||
shifted_in = false;
|
||||
byteCount--;
|
||||
}
|
||||
if (m != ISO2022JPMode.ASCII)
|
||||
@@ -372,7 +368,7 @@ namespace I18N.CJK
|
||||
public override void Reset ()
|
||||
{
|
||||
m = ISO2022JPMode.ASCII;
|
||||
shifted_in_conv = shifted_in_count = false;
|
||||
shifted_in = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -383,7 +379,7 @@ namespace I18N.CJK
|
||||
|
||||
readonly bool allow_shift_io;
|
||||
ISO2022JPMode m = ISO2022JPMode.ASCII;
|
||||
bool shifted_in_conv, shifted_in_count;
|
||||
bool shifted_in;
|
||||
|
||||
public ISO2022JPDecoder (bool allow1ByteKana, bool allowShiftIO)
|
||||
{
|
||||
@@ -400,15 +396,15 @@ namespace I18N.CJK
|
||||
if (allow_shift_io) {
|
||||
switch (bytes [i]) {
|
||||
case 0x0F:
|
||||
shifted_in_count = false;
|
||||
shifted_in = false;
|
||||
continue;
|
||||
case 0x0E:
|
||||
shifted_in_count = true;
|
||||
shifted_in = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (bytes [i] != 0x1B) {
|
||||
if (!shifted_in_count && m == ISO2022JPMode.JISX0208) {
|
||||
if (!shifted_in && m == ISO2022JPMode.JISX0208) {
|
||||
if (i + 1 == end)
|
||||
break; // incomplete head of wide char
|
||||
else
|
||||
@@ -457,16 +453,16 @@ namespace I18N.CJK
|
||||
if (allow_shift_io) {
|
||||
switch (bytes [i]) {
|
||||
case 0x0F:
|
||||
shifted_in_conv = false;
|
||||
shifted_in = false;
|
||||
continue;
|
||||
case 0x0E:
|
||||
shifted_in_conv = true;
|
||||
shifted_in = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (bytes [i] != 0x1B) {
|
||||
if (shifted_in_conv || m == ISO2022JPMode.JISX0201) {
|
||||
if (shifted_in || m == ISO2022JPMode.JISX0201) {
|
||||
// half-kana
|
||||
if (bytes [i] < 0x60)
|
||||
chars [charIndex++] = (char) (bytes [i] + 0xFF40);
|
||||
@@ -528,7 +524,7 @@ namespace I18N.CJK
|
||||
public override void Reset ()
|
||||
{
|
||||
m = ISO2022JPMode.ASCII;
|
||||
shifted_in_count = shifted_in_conv = false;
|
||||
shifted_in = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// I18N.CJK.KSConvert
|
||||
//
|
||||
// Author:
|
||||
// Hye-Shik Chang <[email protected]>
|
||||
//
|
||||
|
||||
using System;
|
||||
|
||||
namespace I18N.CJK
|
||||
{
|
||||
internal sealed class KSConvert : DbcsConvert
|
||||
{
|
||||
// Dummy constructor, no one is aupposed to call it
|
||||
private KSConvert() : base("ks.table") {}
|
||||
|
||||
// The one and only KS conversion object in the system.
|
||||
private static DbcsConvert convert;
|
||||
|
||||
// Get the primary KS conversion object.
|
||||
public static DbcsConvert Convert
|
||||
{
|
||||
get {
|
||||
if (convert == null) convert = new DbcsConvert("ks.table");
|
||||
return convert;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ex: ts=8 sts=4 et
|
||||
@@ -1,18 +1,3 @@
|
||||
2006-01-23 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* I18N.CJK.Test.cs :
|
||||
added Decoder950Refresh() and Decoder950NoRefresh().
|
||||
|
||||
2006-01-23 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* I18N.CJK.Test.cs :
|
||||
added Decoder949Refresh() and Decoder949NoRefresh().
|
||||
|
||||
2006-01-23 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* I18N.CJK.Test.cs :
|
||||
added Decoder936Refresh() and Decoder936NoRefresh().
|
||||
|
||||
2006-01-20 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* I18N.CJK.Test.cs :
|
||||
|
||||
@@ -337,75 +337,6 @@ namespace MonoTests.I18N.CJK
|
||||
Assert.AreEqual (1, d.GetChars (new byte [] {0xA1}, 0, 1, chars, 0, true), "#5");
|
||||
Assert.AreEqual (new char [] {'\u30FB'}, chars, "#6");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Decoder936Refresh ()
|
||||
{
|
||||
Encoding e = Encoding.GetEncoding (936);
|
||||
Decoder d = e.GetDecoder ();
|
||||
char [] chars;
|
||||
|
||||
// incomplete
|
||||
chars = new char [1];
|
||||
Assert.AreEqual (0, d.GetChars (new byte [] {0xB0}, 0, 1, chars, 0, false), "#1");
|
||||
Assert.AreEqual (new char [] {'\0'}, chars, "#2");
|
||||
|
||||
// became complete
|
||||
chars = new char [1];
|
||||
Assert.AreEqual (1, d.GetChars (new byte [] {0xA1}, 0, 1, chars, 0, false), "#3");
|
||||
Assert.AreEqual (new char [] {'\u554A'}, chars, "#4");
|
||||
|
||||
// incomplete but refreshed
|
||||
chars = new char [1];
|
||||
Assert.AreEqual (1, d.GetChars (new byte [] {0xB0}, 0, 1, chars, 0, true), "#5");
|
||||
Assert.AreEqual (new char [] {'?'}, chars, "#6");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Decoder949Refresh ()
|
||||
{
|
||||
Encoding e = Encoding.GetEncoding (949);
|
||||
Decoder d = e.GetDecoder ();
|
||||
char [] chars;
|
||||
|
||||
// incomplete
|
||||
chars = new char [1];
|
||||
Assert.AreEqual (0, d.GetChars (new byte [] {0x81}, 0, 1, chars, 0, false), "#1");
|
||||
Assert.AreEqual (new char [] {'\0'}, chars, "#2");
|
||||
|
||||
// became complete
|
||||
chars = new char [1];
|
||||
Assert.AreEqual (1, d.GetChars (new byte [] {0x41}, 0, 1, chars, 0, false), "#3");
|
||||
Assert.AreEqual (new char [] {'\uAC02'}, chars, "#4");
|
||||
|
||||
// incomplete but refreshed
|
||||
chars = new char [1];
|
||||
Assert.AreEqual (1, d.GetChars (new byte [] {0x81}, 0, 1, chars, 0, true), "#5");
|
||||
Assert.AreEqual (new char [] {'?'}, chars, "#6");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Decoder950Refresh ()
|
||||
{
|
||||
Encoding e = Encoding.GetEncoding (950);
|
||||
Decoder d = e.GetDecoder ();
|
||||
char [] chars;
|
||||
|
||||
// incomplete
|
||||
chars = new char [1];
|
||||
Assert.AreEqual (0, d.GetChars (new byte [] {0xF9}, 0, 1, chars, 0, false), "#1");
|
||||
Assert.AreEqual (new char [] {'\0'}, chars, "#2");
|
||||
|
||||
// became complete
|
||||
chars = new char [1];
|
||||
Assert.AreEqual (1, d.GetChars (new byte [] {0x40}, 0, 1, chars, 0, false), "#3");
|
||||
Assert.AreEqual (new char [] {'\u7E98'}, chars, "#4");
|
||||
|
||||
// incomplete but refreshed
|
||||
chars = new char [1];
|
||||
Assert.AreEqual (1, d.GetChars (new byte [] {0xF9}, 0, 1, chars, 0, true), "#5");
|
||||
Assert.AreEqual (new char [] {'?'}, chars, "#6");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -431,75 +362,6 @@ namespace MonoTests.I18N.CJK
|
||||
Assert.AreEqual (0, d.GetChars (new byte [] {0xA1}, 0, 1, chars, 0), "#5");
|
||||
Assert.AreEqual (new char [] {'\0'}, chars, "#6");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Decoder936NoRefresh ()
|
||||
{
|
||||
Encoding e = Encoding.GetEncoding (936);
|
||||
Decoder d = e.GetDecoder ();
|
||||
char [] chars;
|
||||
|
||||
// incomplete
|
||||
chars = new char [1];
|
||||
Assert.AreEqual (0, d.GetChars (new byte [] {0xB0}, 0, 1, chars, 0), "#1");
|
||||
Assert.AreEqual (new char [] {'\0'}, chars, "#2");
|
||||
|
||||
// became complete
|
||||
chars = new char [1];
|
||||
Assert.AreEqual (1, d.GetChars (new byte [] {0xA1}, 0, 1, chars, 0), "#3");
|
||||
Assert.AreEqual (new char [] {'\u554A'}, chars, "#4");
|
||||
|
||||
// incomplete but refreshed
|
||||
chars = new char [1];
|
||||
Assert.AreEqual (0, d.GetChars (new byte [] {0xB0}, 0, 1, chars, 0), "#5");
|
||||
Assert.AreEqual (new char [] {'\0'}, chars, "#6");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Decoder949NoRefresh ()
|
||||
{
|
||||
Encoding e = Encoding.GetEncoding (949);
|
||||
Decoder d = e.GetDecoder ();
|
||||
char [] chars;
|
||||
|
||||
// incomplete
|
||||
chars = new char [1];
|
||||
Assert.AreEqual (0, d.GetChars (new byte [] {0x81}, 0, 1, chars, 0), "#1");
|
||||
Assert.AreEqual (new char [] {'\0'}, chars, "#2");
|
||||
|
||||
// became complete
|
||||
chars = new char [1];
|
||||
Assert.AreEqual (1, d.GetChars (new byte [] {0x41}, 0, 1, chars, 0), "#3");
|
||||
Assert.AreEqual (new char [] {'\uAC02'}, chars, "#4");
|
||||
|
||||
// incomplete but refreshed
|
||||
chars = new char [1];
|
||||
Assert.AreEqual (0, d.GetChars (new byte [] {0x81}, 0, 1, chars, 0), "#5");
|
||||
Assert.AreEqual (new char [] {'\0'}, chars, "#6");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Decoder950NoRefresh ()
|
||||
{
|
||||
Encoding e = Encoding.GetEncoding (950);
|
||||
Decoder d = e.GetDecoder ();
|
||||
char [] chars;
|
||||
|
||||
// incomplete
|
||||
chars = new char [1];
|
||||
Assert.AreEqual (0, d.GetChars (new byte [] {0xF9}, 0, 1, chars, 0), "#1");
|
||||
Assert.AreEqual (new char [] {'\0'}, chars, "#2");
|
||||
|
||||
// became complete
|
||||
chars = new char [1];
|
||||
Assert.AreEqual (1, d.GetChars (new byte [] {0x40}, 0, 1, chars, 0), "#3");
|
||||
Assert.AreEqual (new char [] {'\u7E98'}, chars, "#4");
|
||||
|
||||
// incomplete but refreshed
|
||||
chars = new char [1];
|
||||
Assert.AreEqual (0, d.GetChars (new byte [] {0xF9}, 0, 1, chars, 0), "#5");
|
||||
Assert.AreEqual (new char [] {'\0'}, chars, "#6");
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Korean
|
||||
|
||||
@@ -76,6 +76,27 @@ public abstract class ByteEncoding : MonoEncoding
|
||||
}
|
||||
#endif
|
||||
|
||||
// Get the number of bytes needed to encode a character buffer.
|
||||
public override int GetByteCount(char[] chars, int index, int count)
|
||||
{
|
||||
if(chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if(index < 0 || index > chars.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException
|
||||
("index", Strings.GetString("ArgRange_Array"));
|
||||
}
|
||||
if(count < 0 || count > (chars.Length - index))
|
||||
{
|
||||
throw new ArgumentOutOfRangeException
|
||||
("count", Strings.GetString("ArgRange_Array"));
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
// Convenience wrappers for "GetByteCount".
|
||||
public override int GetByteCount(String s)
|
||||
{
|
||||
if(s == null)
|
||||
@@ -85,12 +106,6 @@ public abstract class ByteEncoding : MonoEncoding
|
||||
return s.Length;
|
||||
}
|
||||
|
||||
// Get the number of bytes needed to encode a character buffer.
|
||||
public unsafe override int GetByteCountImpl (char* chars, int count)
|
||||
{
|
||||
return count;
|
||||
}
|
||||
|
||||
// Convert an array of characters into a byte buffer,
|
||||
// once the parameters have been validated.
|
||||
protected unsafe abstract void ToBytes (
|
||||
|
||||
@@ -1,16 +1,3 @@
|
||||
2006-01-30 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* MonoEncoding.cs :
|
||||
Added another overload that takes windows code page.
|
||||
|
||||
2006-01-23 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* MonoEncoding.cs :
|
||||
Added abstract GetByteCountImpl() in MonoEncoding and MonoEncoder.
|
||||
GetByteCount() is now based on the method above.
|
||||
* ByteEncoding.cs : so GetByteCount() became GetByteCountImpl() and
|
||||
is based on char*.
|
||||
|
||||
2006-01-17 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* MonoEncoding.cs, ByteEncoding.cs :
|
||||
|
||||
@@ -15,21 +15,9 @@ namespace I18N.Common
|
||||
[Serializable]
|
||||
public abstract class MonoEncoding : Encoding
|
||||
{
|
||||
readonly int win_code_page;
|
||||
|
||||
public MonoEncoding (int codePage)
|
||||
: this (codePage, 0)
|
||||
{
|
||||
}
|
||||
|
||||
public MonoEncoding (int codePage, int windowsCodePage)
|
||||
: base (codePage)
|
||||
{
|
||||
win_code_page = windowsCodePage;
|
||||
}
|
||||
|
||||
public override int WindowsCodePage {
|
||||
get { return win_code_page != 0 ? win_code_page : base.WindowsCodePage; }
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
@@ -58,30 +46,6 @@ namespace I18N.Common
|
||||
}
|
||||
#endif
|
||||
|
||||
// Get the bytes that result from encoding a character buffer.
|
||||
public override int GetByteCount (
|
||||
char [] chars, int index, int count)
|
||||
{
|
||||
if (chars == null)
|
||||
throw new ArgumentNullException ("chars");
|
||||
if (index < 0 || index > chars.Length)
|
||||
throw new ArgumentOutOfRangeException
|
||||
("index", Strings.GetString ("ArgRange_Array"));
|
||||
if (count < 0 || count > (chars.Length - index))
|
||||
throw new ArgumentOutOfRangeException
|
||||
("count", Strings.GetString ("ArgRange_Array"));
|
||||
|
||||
if (count == 0)
|
||||
return 0;
|
||||
|
||||
unsafe {
|
||||
fixed (char* cptr = chars) {
|
||||
return GetByteCountImpl (
|
||||
cptr + index, count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get the bytes that result from encoding a character buffer.
|
||||
public override int GetBytes (
|
||||
char [] chars, int charIndex, int charCount,
|
||||
@@ -160,12 +124,6 @@ namespace I18N.Common
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
public unsafe override int GetByteCount (char* chars, int count)
|
||||
|
||||
{
|
||||
return GetByteCountImpl (chars, count);
|
||||
}
|
||||
|
||||
public unsafe override int GetBytes (char* chars, int charCount,
|
||||
byte* bytes, int byteCount)
|
||||
|
||||
@@ -174,13 +132,9 @@ namespace I18N.Common
|
||||
}
|
||||
#endif
|
||||
|
||||
[CLSCompliant (false)]
|
||||
public unsafe abstract int GetByteCountImpl (char* chars, int charCount);
|
||||
|
||||
[CLSCompliant (false)]
|
||||
public unsafe abstract int GetBytesImpl (char* chars, int charCount,
|
||||
byte* bytes, int byteCount);
|
||||
}
|
||||
|
||||
public abstract class MonoEncoder : Encoder
|
||||
{
|
||||
@@ -191,47 +145,8 @@ namespace I18N.Common
|
||||
this.encoding = encoding;
|
||||
}
|
||||
|
||||
public override int GetByteCount (
|
||||
char [] chars, int index, int count, bool refresh)
|
||||
{
|
||||
if (chars == null)
|
||||
throw new ArgumentNullException ("chars");
|
||||
if (index < 0 || index > chars.Length)
|
||||
throw new ArgumentOutOfRangeException
|
||||
("index", Strings.GetString ("ArgRange_Array"));
|
||||
if (count < 0 || count > (chars.Length - index))
|
||||
throw new ArgumentOutOfRangeException
|
||||
("count", Strings.GetString ("ArgRange_Array"));
|
||||
|
||||
if (count == 0)
|
||||
return 0;
|
||||
|
||||
unsafe {
|
||||
fixed (char* cptr = chars) {
|
||||
return GetByteCountImpl (
|
||||
cptr + index, count, refresh);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetBytes (char [] chars, int charIndex, int charCount, byte [] bytes, int byteIndex, bool flush)
|
||||
{
|
||||
if (chars == null)
|
||||
throw new ArgumentNullException ("chars");
|
||||
if (bytes == null)
|
||||
throw new ArgumentNullException ("bytes");
|
||||
if (charIndex < 0 || charIndex > chars.Length)
|
||||
throw new ArgumentOutOfRangeException
|
||||
("charIndex", Strings.GetString ("ArgRange_Array"));
|
||||
if (charCount < 0 || charCount > (chars.Length - charIndex))
|
||||
throw new ArgumentOutOfRangeException
|
||||
("charCount", Strings.GetString ("ArgRange_Array"));
|
||||
if (byteIndex < 0 || byteIndex > bytes.Length)
|
||||
throw new ArgumentOutOfRangeException
|
||||
("byteIndex", Strings.GetString ("ArgRange_Array"));
|
||||
if (bytes.Length - byteIndex < charCount)
|
||||
throw new ArgumentException (Strings.GetString ("Arg_InsufficientSpace"), "bytes");
|
||||
|
||||
if (charCount == 0)
|
||||
return 0;
|
||||
unsafe {
|
||||
@@ -247,9 +162,7 @@ namespace I18N.Common
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe abstract int GetByteCountImpl (char* chars, int charCount, bool refresh);
|
||||
|
||||
public unsafe abstract int GetBytesImpl (char* chars, int charCount, byte* bytes, int byteCount, bool refresh);
|
||||
public unsafe abstract int GetBytesImpl (char* chars, int charCount, byte* bytes, int byteCount, bool flush);
|
||||
|
||||
#if NET_2_0
|
||||
public unsafe override int GetBytes (char* chars, int charCount, byte* bytes, int byteCount, bool flush)
|
||||
@@ -269,4 +182,5 @@ namespace I18N.Common
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
+319
-863
File diff suppressed because it is too large.
Load diff
@@ -1,11 +1,3 @@
|
||||
2006-01-24 Atsushi Enomoto <[email protected]>
|
||||
|
||||
Fixed bug #77325.
|
||||
* windows-28596-2000.ucm : new file. Copied IBM ICU data from
|
||||
http://dev.icu-project.org/cgi-bin/viewcvs.cgi/charset/data/ucm/windows-28596-2000.ucm (revision 1.2)
|
||||
* CP28596.cs : regenerated source file (and made some manual
|
||||
changes) to replace mapping source from old ibm-1089.ucm to above.
|
||||
|
||||
2006-01-17 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* CP1254.cs CP1255.cs CP28596.cs CP1256.cs CP28598.cs CP38598.cs
|
||||
|
||||
@@ -1,666 +0,0 @@
|
||||
# ***************************************************************************
|
||||
# *
|
||||
# * Copyright (C) 2001-2002, International Business Machines
|
||||
# * Corporation and others. All Rights Reserved.
|
||||
# *
|
||||
# ***************************************************************************
|
||||
#
|
||||
# File created on Dec 03 13:48 Pacific Standard Time 2002
|
||||
#
|
||||
# File created by genmucm tool.
|
||||
# from windows 2000 using IMultiLanguage 5.50.4522.1800
|
||||
#
|
||||
# Table Version : 1.0
|
||||
# The 1st column is the Unicode scalar value.
|
||||
# The 2nd column is the codepage byte sequence.
|
||||
# The 3rd column is the fallback indicator.
|
||||
# The fallback indicator can have one of the following values:
|
||||
# |0 for exact 1-1 roundtrip mapping
|
||||
# |1 for the best fallback codepage byte sequence.
|
||||
# |2 for the substitution character
|
||||
# |3 for the best reverse fallback Unicode scaler value
|
||||
#
|
||||
# Encoding description: Arabic (ISO)
|
||||
# Encoding name: iso-8859-6
|
||||
#
|
||||
<code_set_name> "windows-28596-2000"
|
||||
<mb_cur_max> 1
|
||||
<mb_cur_min> 1
|
||||
<uconv_class> "SBCS"
|
||||
<subchar> \x3F
|
||||
<icu:charsetFamily> "ASCII"
|
||||
# Suggested ICU specific alias information
|
||||
#<icu:alias> "windows-28596_VPUA"
|
||||
|
||||
#
|
||||
CHARMAP
|
||||
#
|
||||
#UNICODE 28596
|
||||
#_______ _________
|
||||
<U0000> \x00 |0
|
||||
<U0001> \x01 |0
|
||||
<U0002> \x02 |0
|
||||
<U0003> \x03 |0
|
||||
<U0004> \x04 |0
|
||||
<U0005> \x05 |0
|
||||
<U0006> \x06 |0
|
||||
<U0007> \x07 |0
|
||||
<U0008> \x08 |0
|
||||
<U0009> \x09 |0
|
||||
<U000A> \x0A |0
|
||||
<U000B> \x0B |0
|
||||
<U000C> \x0C |0
|
||||
<U000D> \x0D |0
|
||||
<U000E> \x0E |0
|
||||
<U000F> \x0F |0
|
||||
<U0010> \x10 |0
|
||||
<U0011> \x11 |0
|
||||
<U0012> \x12 |0
|
||||
<U0013> \x13 |0
|
||||
<U0014> \x14 |0
|
||||
<U0015> \x15 |0
|
||||
<U0016> \x16 |0
|
||||
<U0017> \x17 |0
|
||||
<U0018> \x18 |0
|
||||
<U0019> \x19 |0
|
||||
<U001A> \x1A |0
|
||||
<U001B> \x1B |0
|
||||
<U001C> \x1C |0
|
||||
<U001D> \x1D |0
|
||||
<U001E> \x1E |0
|
||||
<U001F> \x1F |0
|
||||
<U0020> \x20 |0
|
||||
<U0021> \x21 |0
|
||||
<U0022> \x22 |0
|
||||
<U0023> \x23 |0
|
||||
<U0024> \x24 |0
|
||||
<U0025> \x25 |0
|
||||
<U0026> \x26 |0
|
||||
<U0027> \x27 |0
|
||||
<U0028> \x28 |0
|
||||
<U0029> \x29 |0
|
||||
<U002A> \x2A |0
|
||||
<U002B> \x2B |0
|
||||
<U002C> \x2C |0
|
||||
<U002D> \x2D |0
|
||||
<U002E> \x2E |0
|
||||
<U002F> \x2F |0
|
||||
<U0030> \x30 |0
|
||||
<U0031> \x31 |0
|
||||
<U0032> \x32 |0
|
||||
<U0033> \x33 |0
|
||||
<U0034> \x34 |0
|
||||
<U0035> \x35 |0
|
||||
<U0036> \x36 |0
|
||||
<U0037> \x37 |0
|
||||
<U0038> \x38 |0
|
||||
<U0039> \x39 |0
|
||||
<U003A> \x3A |0
|
||||
<U003B> \x3B |0
|
||||
<U003C> \x3C |0
|
||||
<U003D> \x3D |0
|
||||
<U003E> \x3E |0
|
||||
<U003F> \x3F |0
|
||||
<U0040> \x40 |0
|
||||
<U0041> \x41 |0
|
||||
<U0042> \x42 |0
|
||||
<U0043> \x43 |0
|
||||
<U0044> \x44 |0
|
||||
<U0045> \x45 |0
|
||||
<U0046> \x46 |0
|
||||
<U0047> \x47 |0
|
||||
<U0048> \x48 |0
|
||||
<U0049> \x49 |0
|
||||
<U004A> \x4A |0
|
||||
<U004B> \x4B |0
|
||||
<U004C> \x4C |0
|
||||
<U004D> \x4D |0
|
||||
<U004E> \x4E |0
|
||||
<U004F> \x4F |0
|
||||
<U0050> \x50 |0
|
||||
<U0051> \x51 |0
|
||||
<U0052> \x52 |0
|
||||
<U0053> \x53 |0
|
||||
<U0054> \x54 |0
|
||||
<U0055> \x55 |0
|
||||
<U0056> \x56 |0
|
||||
<U0057> \x57 |0
|
||||
<U0058> \x58 |0
|
||||
<U0059> \x59 |0
|
||||
<U005A> \x5A |0
|
||||
<U005B> \x5B |0
|
||||
<U005C> \x5C |0
|
||||
<U005D> \x5D |0
|
||||
<U005E> \x5E |0
|
||||
<U005F> \x5F |0
|
||||
<U0060> \x60 |0
|
||||
<U0061> \x61 |0
|
||||
<U0062> \x62 |0
|
||||
<U0063> \x63 |0
|
||||
<U0064> \x64 |0
|
||||
<U0065> \x65 |0
|
||||
<U0066> \x66 |0
|
||||
<U0067> \x67 |0
|
||||
<U0068> \x68 |0
|
||||
<U0069> \x69 |0
|
||||
<U006A> \x6A |0
|
||||
<U006B> \x6B |0
|
||||
<U006C> \x6C |0
|
||||
<U006D> \x6D |0
|
||||
<U006E> \x6E |0
|
||||
<U006F> \x6F |0
|
||||
<U0070> \x70 |0
|
||||
<U0071> \x71 |0
|
||||
<U0072> \x72 |0
|
||||
<U0073> \x73 |0
|
||||
<U0074> \x74 |0
|
||||
<U0075> \x75 |0
|
||||
<U0076> \x76 |0
|
||||
<U0077> \x77 |0
|
||||
<U0078> \x78 |0
|
||||
<U0079> \x79 |0
|
||||
<U007A> \x7A |0
|
||||
<U007B> \x7B |0
|
||||
<U007C> \x7C |0
|
||||
<U007D> \x7D |0
|
||||
<U007E> \x7E |0
|
||||
<U007F> \x7F |0
|
||||
<U0080> \x80 |0
|
||||
<U0081> \x81 |0
|
||||
<U0082> \x82 |0
|
||||
<U0083> \x83 |0
|
||||
<U0084> \x84 |0
|
||||
<U0085> \x85 |0
|
||||
<U0086> \x86 |0
|
||||
<U0087> \x87 |0
|
||||
<U0088> \x88 |0
|
||||
<U0089> \x89 |0
|
||||
<U008A> \x8A |0
|
||||
<U008B> \x8B |0
|
||||
<U008C> \x8C |0
|
||||
<U008D> \x8D |0
|
||||
<U008E> \x8E |0
|
||||
<U008F> \x8F |0
|
||||
<U0090> \x90 |0
|
||||
<U0091> \x91 |0
|
||||
<U0092> \x92 |0
|
||||
<U0093> \x93 |0
|
||||
<U0094> \x94 |0
|
||||
<U0095> \x95 |0
|
||||
<U0096> \x96 |0
|
||||
<U0097> \x97 |0
|
||||
<U0098> \x98 |0
|
||||
<U0099> \x99 |0
|
||||
<U009A> \x9A |0
|
||||
<U009B> \x9B |0
|
||||
<U009C> \x9C |0
|
||||
<U009D> \x9D |0
|
||||
<U009E> \x9E |0
|
||||
<U009F> \x9F |0
|
||||
<U00A0> \xA0 |0
|
||||
<U00A1> \x21 |1
|
||||
<U00A2> \x63 |1
|
||||
<U00A4> \xA4 |0
|
||||
<U00A5> \x59 |1
|
||||
<U00A6> \x7C |1
|
||||
<U00A9> \x43 |1
|
||||
<U00AA> \x61 |1
|
||||
<U00AB> \x3C |1
|
||||
<U00AD> \xAD |0
|
||||
<U00AE> \x52 |1
|
||||
<U00B2> \x32 |1
|
||||
<U00B3> \x33 |1
|
||||
<U00B7> \x2E |1
|
||||
<U00B8> \x2C |1
|
||||
<U00B9> \x31 |1
|
||||
<U00BA> \x6F |1
|
||||
<U00BB> \x3E |1
|
||||
<U00C0> \x41 |1
|
||||
<U00C1> \x41 |1
|
||||
<U00C2> \x41 |1
|
||||
<U00C3> \x41 |1
|
||||
<U00C4> \x41 |1
|
||||
<U00C5> \x41 |1
|
||||
<U00C6> \x41 |1
|
||||
<U00C7> \x43 |1
|
||||
<U00C8> \x45 |1
|
||||
<U00C9> \x45 |1
|
||||
<U00CA> \x45 |1
|
||||
<U00CB> \x45 |1
|
||||
<U00CC> \x49 |1
|
||||
<U00CD> \x49 |1
|
||||
<U00CE> \x49 |1
|
||||
<U00CF> \x49 |1
|
||||
<U00D0> \x44 |1
|
||||
<U00D1> \x4E |1
|
||||
<U00D2> \x4F |1
|
||||
<U00D3> \x4F |1
|
||||
<U00D4> \x4F |1
|
||||
<U00D5> \x4F |1
|
||||
<U00D6> \x4F |1
|
||||
<U00D8> \x4F |1
|
||||
<U00D9> \x55 |1
|
||||
<U00DA> \x55 |1
|
||||
<U00DB> \x55 |1
|
||||
<U00DC> \x55 |1
|
||||
<U00DD> \x59 |1
|
||||
<U00E0> \x61 |1
|
||||
<U00E1> \x61 |1
|
||||
<U00E2> \x61 |1
|
||||
<U00E3> \x61 |1
|
||||
<U00E4> \x61 |1
|
||||
<U00E5> \x61 |1
|
||||
<U00E6> \x61 |1
|
||||
<U00E7> \x63 |1
|
||||
<U00E8> \x65 |1
|
||||
<U00E9> \x65 |1
|
||||
<U00EA> \x65 |1
|
||||
<U00EB> \x65 |1
|
||||
<U00EC> \x69 |1
|
||||
<U00ED> \x69 |1
|
||||
<U00EE> \x69 |1
|
||||
<U00EF> \x69 |1
|
||||
<U00F1> \x6E |1
|
||||
<U00F2> \x6F |1
|
||||
<U00F3> \x6F |1
|
||||
<U00F4> \x6F |1
|
||||
<U00F5> \x6F |1
|
||||
<U00F6> \x6F |1
|
||||
<U00F8> \x6F |1
|
||||
<U00F9> \x75 |1
|
||||
<U00FA> \x75 |1
|
||||
<U00FB> \x75 |1
|
||||
<U00FC> \x75 |1
|
||||
<U00FD> \x79 |1
|
||||
<U00FF> \x79 |1
|
||||
<U0100> \x41 |1
|
||||
<U0101> \x61 |1
|
||||
<U0102> \x41 |1
|
||||
<U0103> \x61 |1
|
||||
<U0104> \x41 |1
|
||||
<U0105> \x61 |1
|
||||
<U0106> \x43 |1
|
||||
<U0107> \x63 |1
|
||||
<U0108> \x43 |1
|
||||
<U0109> \x63 |1
|
||||
<U010A> \x43 |1
|
||||
<U010B> \x63 |1
|
||||
<U010C> \x43 |1
|
||||
<U010D> \x63 |1
|
||||
<U010E> \x44 |1
|
||||
<U010F> \x64 |1
|
||||
<U0110> \x44 |1
|
||||
<U0111> \x64 |1
|
||||
<U0112> \x45 |1
|
||||
<U0113> \x65 |1
|
||||
<U0114> \x45 |1
|
||||
<U0115> \x65 |1
|
||||
<U0116> \x45 |1
|
||||
<U0117> \x65 |1
|
||||
<U0118> \x45 |1
|
||||
<U0119> \x65 |1
|
||||
<U011A> \x45 |1
|
||||
<U011B> \x65 |1
|
||||
<U011C> \x47 |1
|
||||
<U011D> \x67 |1
|
||||
<U011E> \x47 |1
|
||||
<U011F> \x67 |1
|
||||
<U0120> \x47 |1
|
||||
<U0121> \x67 |1
|
||||
<U0122> \x47 |1
|
||||
<U0123> \x67 |1
|
||||
<U0124> \x48 |1
|
||||
<U0125> \x68 |1
|
||||
<U0126> \x48 |1
|
||||
<U0127> \x68 |1
|
||||
<U0128> \x49 |1
|
||||
<U0129> \x69 |1
|
||||
<U012A> \x49 |1
|
||||
<U012B> \x69 |1
|
||||
<U012C> \x49 |1
|
||||
<U012D> \x69 |1
|
||||
<U012E> \x49 |1
|
||||
<U012F> \x69 |1
|
||||
<U0130> \x49 |1
|
||||
<U0131> \x69 |1
|
||||
<U0134> \x4A |1
|
||||
<U0135> \x6A |1
|
||||
<U0136> \x4B |1
|
||||
<U0137> \x6B |1
|
||||
<U0139> \x4C |1
|
||||
<U013A> \x6C |1
|
||||
<U013B> \x4C |1
|
||||
<U013C> \x6C |1
|
||||
<U013D> \x4C |1
|
||||
<U013E> \x6C |1
|
||||
<U0141> \x4C |1
|
||||
<U0142> \x6C |1
|
||||
<U0143> \x4E |1
|
||||
<U0144> \x6E |1
|
||||
<U0145> \x4E |1
|
||||
<U0146> \x6E |1
|
||||
<U0147> \x4E |1
|
||||
<U0148> \x6E |1
|
||||
<U014C> \x4F |1
|
||||
<U014D> \x6F |1
|
||||
<U014E> \x4F |1
|
||||
<U014F> \x6F |1
|
||||
<U0150> \x4F |1
|
||||
<U0151> \x6F |1
|
||||
<U0152> \x4F |1
|
||||
<U0153> \x6F |1
|
||||
<U0154> \x52 |1
|
||||
<U0155> \x72 |1
|
||||
<U0156> \x52 |1
|
||||
<U0157> \x72 |1
|
||||
<U0158> \x52 |1
|
||||
<U0159> \x72 |1
|
||||
<U015A> \x53 |1
|
||||
<U015B> \x73 |1
|
||||
<U015C> \x53 |1
|
||||
<U015D> \x73 |1
|
||||
<U015E> \x53 |1
|
||||
<U015F> \x73 |1
|
||||
<U0160> \x53 |1
|
||||
<U0161> \x73 |1
|
||||
<U0162> \x54 |1
|
||||
<U0163> \x74 |1
|
||||
<U0164> \x54 |1
|
||||
<U0165> \x74 |1
|
||||
<U0166> \x54 |1
|
||||
<U0167> \x74 |1
|
||||
<U0168> \x55 |1
|
||||
<U0169> \x75 |1
|
||||
<U016A> \x55 |1
|
||||
<U016B> \x75 |1
|
||||
<U016C> \x55 |1
|
||||
<U016D> \x75 |1
|
||||
<U016E> \x55 |1
|
||||
<U016F> \x75 |1
|
||||
<U0170> \x55 |1
|
||||
<U0171> \x75 |1
|
||||
<U0172> \x55 |1
|
||||
<U0173> \x75 |1
|
||||
<U0174> \x57 |1
|
||||
<U0175> \x77 |1
|
||||
<U0176> \x59 |1
|
||||
<U0177> \x79 |1
|
||||
<U0178> \x59 |1
|
||||
<U0179> \x5A |1
|
||||
<U017A> \x7A |1
|
||||
<U017B> \x5A |1
|
||||
<U017C> \x7A |1
|
||||
<U017D> \x5A |1
|
||||
<U017E> \x7A |1
|
||||
<U0180> \x62 |1
|
||||
<U0189> \x44 |1
|
||||
<U0191> \x46 |1
|
||||
<U0192> \x66 |1
|
||||
<U0197> \x49 |1
|
||||
<U019A> \x6C |1
|
||||
<U019F> \x4F |1
|
||||
<U01A0> \x4F |1
|
||||
<U01A1> \x6F |1
|
||||
<U01AB> \x74 |1
|
||||
<U01AE> \x54 |1
|
||||
<U01AF> \x55 |1
|
||||
<U01B0> \x75 |1
|
||||
<U01B6> \x7A |1
|
||||
<U01CD> \x41 |1
|
||||
<U01CE> \x61 |1
|
||||
<U01CF> \x49 |1
|
||||
<U01D0> \x69 |1
|
||||
<U01D1> \x4F |1
|
||||
<U01D2> \x6F |1
|
||||
<U01D3> \x55 |1
|
||||
<U01D4> \x75 |1
|
||||
<U01D5> \x55 |1
|
||||
<U01D6> \x75 |1
|
||||
<U01D7> \x55 |1
|
||||
<U01D8> \x75 |1
|
||||
<U01D9> \x55 |1
|
||||
<U01DA> \x75 |1
|
||||
<U01DB> \x55 |1
|
||||
<U01DC> \x75 |1
|
||||
<U01DE> \x41 |1
|
||||
<U01DF> \x61 |1
|
||||
<U01E4> \x47 |1
|
||||
<U01E5> \x67 |1
|
||||
<U01E6> \x47 |1
|
||||
<U01E7> \x67 |1
|
||||
<U01E8> \x4B |1
|
||||
<U01E9> \x6B |1
|
||||
<U01EA> \x4F |1
|
||||
<U01EB> \x6F |1
|
||||
<U01EC> \x4F |1
|
||||
<U01ED> \x6F |1
|
||||
<U01F0> \x6A |1
|
||||
<U0261> \x67 |1
|
||||
<U02B9> \x27 |1
|
||||
<U02BA> \x22 |1
|
||||
<U02BC> \x27 |1
|
||||
<U02C4> \x5E |1
|
||||
<U02C6> \x5E |1
|
||||
<U02C8> \x27 |1
|
||||
<U02CB> \x60 |1
|
||||
<U02CD> \x5F |1
|
||||
<U02DC> \x7E |1
|
||||
<U0300> \x60 |1
|
||||
<U0302> \x5E |1
|
||||
<U0303> \x7E |1
|
||||
<U030E> \x22 |1
|
||||
<U0331> \x5F |1
|
||||
<U0332> \x5F |1
|
||||
<U060C> \xAC |0
|
||||
<U061B> \xBB |0
|
||||
<U061F> \xBF |0
|
||||
<U0621> \xC1 |0
|
||||
<U0622> \xC2 |0
|
||||
<U0623> \xC3 |0
|
||||
<U0624> \xC4 |0
|
||||
<U0625> \xC5 |0
|
||||
<U0626> \xC6 |0
|
||||
<U0627> \xC7 |0
|
||||
<U0628> \xC8 |0
|
||||
<U0629> \xC9 |0
|
||||
<U062A> \xCA |0
|
||||
<U062B> \xCB |0
|
||||
<U062C> \xCC |0
|
||||
<U062D> \xCD |0
|
||||
<U062E> \xCE |0
|
||||
<U062F> \xCF |0
|
||||
<U0630> \xD0 |0
|
||||
<U0631> \xD1 |0
|
||||
<U0632> \xD2 |0
|
||||
<U0633> \xD3 |0
|
||||
<U0634> \xD4 |0
|
||||
<U0635> \xD5 |0
|
||||
<U0636> \xD6 |0
|
||||
<U0637> \xD7 |0
|
||||
<U0638> \xD8 |0
|
||||
<U0639> \xD9 |0
|
||||
<U063A> \xDA |0
|
||||
<U0640> \xE0 |0
|
||||
<U0641> \xE1 |0
|
||||
<U0642> \xE2 |0
|
||||
<U0643> \xE3 |0
|
||||
<U0644> \xE4 |0
|
||||
<U0645> \xE5 |0
|
||||
<U0646> \xE6 |0
|
||||
<U0647> \xE7 |0
|
||||
<U0648> \xE8 |0
|
||||
<U0649> \xE9 |0
|
||||
<U064A> \xEA |0
|
||||
<U064B> \xEB |0
|
||||
<U064C> \xEC |0
|
||||
<U064D> \xED |0
|
||||
<U064E> \xEE |0
|
||||
<U064F> \xEF |0
|
||||
<U0650> \xF0 |0
|
||||
<U0651> \xF1 |0
|
||||
<U0652> \xF2 |0
|
||||
<U2000> \x20 |1
|
||||
<U2001> \x20 |1
|
||||
<U2002> \x20 |1
|
||||
<U2003> \x20 |1
|
||||
<U2004> \x20 |1
|
||||
<U2005> \x20 |1
|
||||
<U2006> \x20 |1
|
||||
<U2010> \x2D |1
|
||||
<U2011> \x2D |1
|
||||
<U2013> \x2D |1
|
||||
<U2014> \x2D |1
|
||||
<U2018> \x27 |1
|
||||
<U2019> \x27 |1
|
||||
<U201A> \x2C |1
|
||||
<U201C> \x22 |1
|
||||
<U201D> \x22 |1
|
||||
<U201E> \x22 |1
|
||||
<U2022> \x2E |1
|
||||
<U2026> \x2E |1
|
||||
<U2032> \x27 |1
|
||||
<U2035> \x60 |1
|
||||
<U2039> \x3C |1
|
||||
<U203A> \x3E |1
|
||||
<U2122> \x54 |1
|
||||
<UF7C8> \xA1 |0
|
||||
<UF7C9> \xA2 |0
|
||||
<UF7CA> \xA3 |0
|
||||
<UF7CB> \xA5 |0
|
||||
<UF7CC> \xA6 |0
|
||||
<UF7CD> \xA7 |0
|
||||
<UF7CE> \xA8 |0
|
||||
<UF7CF> \xA9 |0
|
||||
<UF7D0> \xAA |0
|
||||
<UF7D1> \xAB |0
|
||||
<UF7D2> \xAE |0
|
||||
<UF7D3> \xAF |0
|
||||
<UF7D4> \xB0 |0
|
||||
<UF7D5> \xB1 |0
|
||||
<UF7D6> \xB2 |0
|
||||
<UF7D7> \xB3 |0
|
||||
<UF7D8> \xB4 |0
|
||||
<UF7D9> \xB5 |0
|
||||
<UF7DA> \xB6 |0
|
||||
<UF7DB> \xB7 |0
|
||||
<UF7DC> \xB8 |0
|
||||
<UF7DD> \xB9 |0
|
||||
<UF7DE> \xBA |0
|
||||
<UF7DF> \xBC |0
|
||||
<UF7E0> \xBD |0
|
||||
<UF7E1> \xBE |0
|
||||
<UF7E2> \xC0 |0
|
||||
<UF7E3> \xDB |0
|
||||
<UF7E4> \xDC |0
|
||||
<UF7E5> \xDD |0
|
||||
<UF7E6> \xDE |0
|
||||
<UF7E7> \xDF |0
|
||||
<UF7E8> \xF3 |0
|
||||
<UF7E9> \xF4 |0
|
||||
<UF7EA> \xF5 |0
|
||||
<UF7EB> \xF6 |0
|
||||
<UF7EC> \xF7 |0
|
||||
<UF7ED> \xF8 |0
|
||||
<UF7EE> \xF9 |0
|
||||
<UF7EF> \xFA |0
|
||||
<UF7F0> \xFB |0
|
||||
<UF7F1> \xFC |0
|
||||
<UF7F2> \xFD |0
|
||||
<UF7F3> \xFE |0
|
||||
<UF7F4> \xFF |0
|
||||
<UFF01> \x21 |1
|
||||
<UFF02> \x22 |1
|
||||
<UFF03> \x23 |1
|
||||
<UFF04> \x24 |1
|
||||
<UFF05> \x25 |1
|
||||
<UFF06> \x26 |1
|
||||
<UFF07> \x27 |1
|
||||
<UFF08> \x28 |1
|
||||
<UFF09> \x29 |1
|
||||
<UFF0A> \x2A |1
|
||||
<UFF0B> \x2B |1
|
||||
<UFF0C> \x2C |1
|
||||
<UFF0D> \x2D |1
|
||||
<UFF0E> \x2E |1
|
||||
<UFF0F> \x2F |1
|
||||
<UFF10> \x30 |1
|
||||
<UFF11> \x31 |1
|
||||
<UFF12> \x32 |1
|
||||
<UFF13> \x33 |1
|
||||
<UFF14> \x34 |1
|
||||
<UFF15> \x35 |1
|
||||
<UFF16> \x36 |1
|
||||
<UFF17> \x37 |1
|
||||
<UFF18> \x38 |1
|
||||
<UFF19> \x39 |1
|
||||
<UFF1A> \x3A |1
|
||||
<UFF1B> \x3B |1
|
||||
<UFF1C> \x3C |1
|
||||
<UFF1D> \x3D |1
|
||||
<UFF1E> \x3E |1
|
||||
<UFF20> \x40 |1
|
||||
<UFF21> \x41 |1
|
||||
<UFF22> \x42 |1
|
||||
<UFF23> \x43 |1
|
||||
<UFF24> \x44 |1
|
||||
<UFF25> \x45 |1
|
||||
<UFF26> \x46 |1
|
||||
<UFF27> \x47 |1
|
||||
<UFF28> \x48 |1
|
||||
<UFF29> \x49 |1
|
||||
<UFF2A> \x4A |1
|
||||
<UFF2B> \x4B |1
|
||||
<UFF2C> \x4C |1
|
||||
<UFF2D> \x4D |1
|
||||
<UFF2E> \x4E |1
|
||||
<UFF2F> \x4F |1
|
||||
<UFF30> \x50 |1
|
||||
<UFF31> \x51 |1
|
||||
<UFF32> \x52 |1
|
||||
<UFF33> \x53 |1
|
||||
<UFF34> \x54 |1
|
||||
<UFF35> \x55 |1
|
||||
<UFF36> \x56 |1
|
||||
<UFF37> \x57 |1
|
||||
<UFF38> \x58 |1
|
||||
<UFF39> \x59 |1
|
||||
<UFF3A> \x5A |1
|
||||
<UFF3B> \x5B |1
|
||||
<UFF3C> \x5C |1
|
||||
<UFF3D> \x5D |1
|
||||
<UFF3E> \x5E |1
|
||||
<UFF3F> \x5F |1
|
||||
<UFF40> \x60 |1
|
||||
<UFF41> \x61 |1
|
||||
<UFF42> \x62 |1
|
||||
<UFF43> \x63 |1
|
||||
<UFF44> \x64 |1
|
||||
<UFF45> \x65 |1
|
||||
<UFF46> \x66 |1
|
||||
<UFF47> \x67 |1
|
||||
<UFF48> \x68 |1
|
||||
<UFF49> \x69 |1
|
||||
<UFF4A> \x6A |1
|
||||
<UFF4B> \x6B |1
|
||||
<UFF4C> \x6C |1
|
||||
<UFF4D> \x6D |1
|
||||
<UFF4E> \x6E |1
|
||||
<UFF4F> \x6F |1
|
||||
<UFF50> \x70 |1
|
||||
<UFF51> \x71 |1
|
||||
<UFF52> \x72 |1
|
||||
<UFF53> \x73 |1
|
||||
<UFF54> \x74 |1
|
||||
<UFF55> \x75 |1
|
||||
<UFF56> \x76 |1
|
||||
<UFF57> \x77 |1
|
||||
<UFF58> \x78 |1
|
||||
<UFF59> \x79 |1
|
||||
<UFF5A> \x7A |1
|
||||
<UFF5B> \x7B |1
|
||||
<UFF5C> \x7C |1
|
||||
<UFF5D> \x7D |1
|
||||
<UFF5E> \x7E |1
|
||||
#
|
||||
END CHARMAP
|
||||
#
|
||||
@@ -43,9 +43,9 @@ using I18N.Common;
|
||||
public abstract class ISCIIEncoding : MonoEncoding
|
||||
{
|
||||
// Internal state.
|
||||
int shift;
|
||||
string encodingName;
|
||||
string webName;
|
||||
protected int shift;
|
||||
protected String encodingName;
|
||||
protected String webName;
|
||||
|
||||
// Constructor.
|
||||
protected ISCIIEncoding(int codePage, int shift,
|
||||
@@ -87,51 +87,6 @@ public abstract class ISCIIEncoding : MonoEncoding
|
||||
return s.Length;
|
||||
}
|
||||
|
||||
public unsafe override int GetByteCountImpl (char* chars, int count)
|
||||
{
|
||||
#if NET_2_0
|
||||
EncoderFallbackBuffer buffer = null;
|
||||
int index = 0;
|
||||
int charIndex = 0;
|
||||
int byteIndex = 0;
|
||||
|
||||
int length = 0;
|
||||
char ch;
|
||||
char first = (char)shift;
|
||||
char last = (char)(shift + 0x7F);
|
||||
while(count-- > 0)
|
||||
{
|
||||
ch = chars[index++];
|
||||
if(ch < (char)0x0080)
|
||||
{
|
||||
// Regular ASCII subset.
|
||||
length++;
|
||||
}
|
||||
else if(ch >= first && ch <= last)
|
||||
{
|
||||
// ISCII range that we need to shift.
|
||||
length++;
|
||||
}
|
||||
else if(ch >= '\uFF01' && ch <= '\uFF5E')
|
||||
{
|
||||
// ASCII full-width characters.
|
||||
length++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// FIXME: implement fallback support for GetByteCountImpl().
|
||||
length++;
|
||||
}
|
||||
count--;
|
||||
}
|
||||
|
||||
// Return the final length of the output.
|
||||
return length;
|
||||
#else
|
||||
return count;
|
||||
#endif
|
||||
}
|
||||
|
||||
public unsafe override int GetBytesImpl (char* chars, int charCount, byte* bytes, int byteCount)
|
||||
{
|
||||
#if NET_2_0
|
||||
|
||||
Loaded 100 of 3325 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user