Compare commits

..
2 Commits
Author SHA1 Message Date
nobody 9f09256d3c This commit was manufactured by cvs2svn to create tag 'MCS_0_24'.
svn path=/tags/MCS_0_24/mcs/; revision=14354
2003-05-06 21:04:41 +00:00
nobody 4e4824afab This commit was manufactured by cvs2svn to create branch 'SAVANNAH_CVS'.
svn path=/branches/SAVANNAH_CVS/mcs/; revision=6844
2002-08-21 10:08:33 +00:00
1378 changed files with 41571 additions and 96794 deletions

No files matched your search

-75
View File
@@ -1,78 +1,3 @@
2003-06-10 Dick Porter <[email protected]>
* acconfig.h:
* configure.in: Check for struct ip_mreq if struct ip_mreqn isn't
available.
2003-06-10 Zoltan Varga <[email protected]>
* configure.in: Define HAVE_GC_GCJ_MALLOC for included libgc.
2003-06-10 Martin Baulig <[email protected]>
* configure.in: Fall back to boehm if we don't have a libgc
subdirectory.
2003-06-10 Martin Baulig <[email protected]>
* configure.in: Make the libgc stuff actually work; we now create
a shared libmonogc.so when using the included libgc.
2003-06-09 Martin Baulig <[email protected]>
* configure.in: Only check for gc if --with-gc=boehm.
2003-06-08 Martin Baulig <[email protected]>
* configure.in: Tell libgc's configure about our threads library.
2003-06-08 Martin Baulig <[email protected]>
* libgc/: Integrate the libgc module here.
[Note: A simple `cvs update' won't work this time; you either need
to re-checkout the `mono' module or manually move the `libgc'
module here.]
* configure.in (--with-gc): Added `included' option to use the
included libgc. This is now also the default.
(LIBGC_CFLAGS, LIBGC_LIBS): Put the libgc stuff here and AC_SUBST it.
(INCLUDED_LIBGC): New automake conditional.
(USE_INCLUDED_LIBGC): #define this if appropriate.
* autogen.sh: Run libgc/autogen.sh.
* Makefile.am (SUBDIRS): Added libgc.
2003-06-05 Duncan Mak <[email protected]>
* mono.spec.in (Requires): Add libxml2 and libxslt dependency on
the package.
2003-05-19 Dick Porter <[email protected]>
* configure.in: Netbsd build fix by [email protected].
2003-05-10 Martin Willemoes Hansen <[email protected]>
* scripts/Makefile.am: Added monoresgen secutil sqlsharp
shell wrapper scripts.
2003-05-08 Zoltan Varga <[email protected]>
* mono/tests/Makefile.am:
- Compile with mcs.
- Disable some warnings.
- Added executables to clean target.
- Make testjit the default target.
- Print list of failed tests at the end of a test run.
- Abort tests when Ctrl-C is pressed.
* mono/tests/test-driver: Return with a special exit code when
SIGINT is detected.
* mono/tests/checked.cs: Make it compile.
2003-05-02 Miguel de Icaza <[email protected]>
* runtime/Makefile.am ($(monobins_DATA)): Use explicit file names
+1 -3
View File
@@ -1,8 +1,6 @@
AUTOMAKE_OPTIONS = foreign
SUBDIRS = @libgc_dir@ mono doc docs runtime scripts man data
dnl EXTRA_SUBDIRS = libgc
SUBDIRS = mono doc docs runtime scripts man data
EXTRA_DIST= mono.pc.in mono.spec.in
-4
View File
@@ -5,7 +5,6 @@
#undef HAVE_SOL_TCP
#undef HAVE_IP_PKTINFO
#undef HAVE_STRUCT_IP_MREQN
#undef HAVE_STRUCT_IP_MREQ
#undef HAVE_PTHREAD_MUTEX_TIMEDLOCK
#undef USE_MONO_MUTEX
#undef HAVE_LARGE_FILE_SUPPORT
@@ -14,12 +13,9 @@
#undef NAME_DEV_RANDOM
#undef HAVE_CRYPT_RNG
#undef HAVE_BOEHM_GC
#undef USE_INCLUDED_LIBGC
#undef DISABLE_SHARED_HANDLES
#undef HAVE_TIMEZONE
#undef HAVE_TM_GMTOFF
#undef MONO_SIZEOF_SUNPATH
#undef NEED_LINK_UNLINK
#undef PTHREAD_POINTER_ID
#undef HAVE_GC_H
#undef HAVE_GC_GCJ_MALLOC
-6
View File
@@ -117,12 +117,6 @@ automake --add-missing --gnu $am_opt ||
echo "Running autoconf ..."
autoconf || { echo "**Error**: autoconf failed."; exit 1; }
if test -d $srcdir/libgc; then
echo Running libgc/autogen.sh ...
(cd $srcdir/libgc ; NOCONFIGURE=1 ./autogen.sh "$@")
echo Done running libgc/autogen.sh ...
fi
conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c
+51
View File
@@ -0,0 +1,51 @@
/* config.h.in. Generated automatically from configure.in by autoheader 2.13. */
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
#undef HAVE_INET_PTON
#undef HAVE_INET_ATON
#undef HAVE_SOL_IP
#undef HAVE_SOL_TCP
#undef HAVE_IP_PKTINFO
#undef HAVE_STRUCT_IP_MREQN
#undef HAVE_PTHREAD
#undef HAVE_PTHREAD_MUTEX_TIMEDLOCK
#undef USE_MONO_MUTEX
#undef HAVE_LARGE_FILE_SUPPORT
#undef PLATFORM_WIN32
#undef HAVE_NEW_ICONV
#undef NAME_DEV_RANDOM
#undef HAVE_CRYPT_RNG
#undef HAVE_BOEHM_GC
/* The number of bytes in a void *. */
#undef SIZEOF_VOID_P
/* Define if you have the inet_aton function. */
#undef HAVE_INET_ATON
/* Define if you have the inet_pton function. */
#undef HAVE_INET_PTON
/* Define if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define if you have the <netdb.h> header file. */
#undef HAVE_NETDB_H
/* Define if you have the <sys/filio.h> header file. */
#undef HAVE_SYS_FILIO_H
/* Define if you have the <sys/sockio.h> header file. */
#undef HAVE_SYS_SOCKIO_H
/* Define if you have the <utime.h> header file. */
#undef HAVE_UTIME_H
/* Name of package */
#undef PACKAGE
/* Version number of package */
#undef VERSION
+28 -99
View File
@@ -1,23 +1,9 @@
AC_INIT(README)
AC_CANONICAL_SYSTEM
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(mono,0.25)
AM_INIT_AUTOMAKE(mono,0.24)
AM_MAINTAINER_MODE
dnl
dnl libgc checks
dnl
gc_headers=no
gc=included
use_included_gc=no
if test -d $srcdir/libgc ; then
gc_default=included
else
gc_default=boehm
fi
#
# These are the flags that need to be stored in the mono.pc file for
# compiling code that will embed Mono
@@ -29,7 +15,6 @@ AC_SUBST(libmono_ldflags)
# Thread configuration inspired by sleepycat's db
AC_MSG_CHECKING([host platform characteristics])
libgc_threads=no
case "$host" in
*-*-mingw*|*-*-cygwin*)
platform_win32=yes
@@ -38,20 +23,8 @@ case "$host" in
HOST_CC="gcc"
CPPFLAGS="$CPPFLAGS -DGC_WIN32_THREADS -DWIN32_THREADS"
libdl=
libgc_threads=win32
gc_default=boehm
;;
*-*-*netbsd*)
platform_win32=no
CPPFLAGS="$CPPFLAGS -D_REENTRANT"
libmono_cflags="-D_REENTRANT"
LDFLAGS="$LDFLAGS -pthread"
libmono_ldflags="-pthread"
AC_DEFINE(NEED_LINK_UNLINK)
libdl=
libgc_threads=pthreads
;;
*-*-*freebsd*|*-*-*openbsd*)
*-*-*bsd*)
platform_win32=no
CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"
libmono_cflags="-D_THREAD_SAFE"
@@ -60,7 +33,6 @@ case "$host" in
AC_DEFINE(NEED_LINK_UNLINK)
AC_DEFINE(PTHREAD_POINTER_ID)
libdl=
libgc_threads=pthreads
;;
*-*-linux*)
platform_win32=no
@@ -68,14 +40,12 @@ case "$host" in
libmono_cflags="-DMONO_USE_EXC_TABLES -fexceptions -D_REENTRANT"
libmono_ldflags="-lpthread"
libdl="-ldl"
libgc_threads=pthreads
;;
*-*-solaris*)
platform_win32=no
CPPFLAGS="$CPPFLAGS -DGC_SOLARIS_THREADS -DGC_SOLARIS_PTHREADS -D_REENTRANT"
AC_DEFINE(NEED_LINK_UNLINK)
libmono_cflags="-D_REENTRANT"
libgc_threads=solaris
;;
*-*-darwin*)
platform_win32=no
@@ -86,8 +56,6 @@ case "$host" in
AC_DEFINE(NEED_LINK_UNLINK)
AC_DEFINE(PTHREAD_POINTER_ID)
libdl=
libgc_threads=no
gc_default=none
;;
*)
AC_MSG_WARN([*** Please add $host to configure.in checks!])
@@ -180,18 +148,16 @@ AC_SUBST(GLIB_LIBS)
AC_SUBST(GMODULE_CFLAGS)
AC_SUBST(GMODULE_LIBS)
AC_ARG_WITH(gc, [ --with-gc=boehm,included,none],[gc=$with_gc],[gc=$gc_default])
gc_headers=no
AC_CHECK_HEADERS(gc.h gc/gc.h, gc_headers=yes)
AC_CHECK_LIB(gc, GC_malloc, found_boehm="yes",,$libdl)
gc=auto
AC_ARG_WITH(gc, [ --with-gc=boehm,none],[gc=$with_gc])
LIBGC_CFLAGS=
LIBGC_LIBS=
libgc_dir=
case "x$gc" in
xboehm|xbohem|xyes)
AC_CHECK_HEADERS(gc.h gc/gc.h, gc_headers=yes)
AC_CHECK_LIB(gc, GC_malloc, found_boehm="yes",,$libdl)
if test "x$found_boehm" != "xyes"; then
AC_MSG_ERROR("GC requested but libgc not found! Install libgc or run configure with --with-gc=none.")
AC_MSG_ERROR("GC requested but libgc not found!")
fi
if test "x$gc_headers" != "xyes"; then
AC_MSG_ERROR("GC requested but header files not found! You may need to install them by hand.")
@@ -199,52 +165,30 @@ case "x$gc" in
AC_DEFINE(HAVE_BOEHM_GC)
AC_SUBST(HAVE_BOEHM_GC)
LIBGC_LIBS="-lgc $libdl"
AC_CHECK_FUNCS(GC_gcj_malloc)
LIBS="$LIBS -lgc $libdl"
;;
xincluded)
AC_CONFIG_SUBDIRS(libgc)
found_boehm=yes
gc_headers=yes
use_included_gc=yes
libgc_dir=libgc
LIBGC_CFLAGS='-I$(top_srcdir)/libgc/include'
LIBGC_LIBS='$(top_builddir)/libgc/libmonogc.la'
AC_DEFINE(HAVE_BOEHM_GC)
AC_SUBST(HAVE_BOEHM_GC)
AC_DEFINE(HAVE_GC_H)
AC_DEFINE(USE_INCLUDED_LIBGC)
# The included libgc contains GCJ support
AC_DEFINE(HAVE_GC_GCJ_MALLOC)
;;
xnone)
AC_MSG_WARN("Compiling mono without GC.")
;;
*)
AC_MSG_ERROR([Invalid argument to --with-gc.])
# If libgc was found, use it. Otherwise just warn.
if test "x$found_boehm" != "xyes"; then
AC_MSG_WARN("Compiling mono without GC.")
else
if test "x$gc_headers" != "xyes"; then
AC_MSG_ERROR("Found libgc but not its header files! You may need to install them by hand.")
fi
AC_DEFINE(HAVE_BOEHM_GC)
AC_SUBST(HAVE_BOEHM_GC)
LIBS="$LIBS -lgc $libdl"
gc="boehm"
fi
;;
esac
we_are_embedded_in_mono=yes
export we_are_embedded_in_mono
export libgc_threads
AM_CONDITIONAL(INCLUDED_LIBGC, test x$use_included_gc = xyes)
AC_SUBST(LIBGC_CFLAGS)
AC_SUBST(LIBGC_LIBS)
AC_SUBST(libgc_dir)
dnl
dnl End of libgc checks
dnl
if test "x$gc" = xboehm; then
AC_CHECK_FUNCS(GC_gcj_malloc)
fi
if test x$platform_win32 = xno; then
dnl ******************************************************************
@@ -370,20 +314,8 @@ if test x$platform_win32 = xno; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_STRUCT_IP_MREQN)
], [
# We'll just have to try and use struct ip_mreq
# We'll just have to use struct ip_mreq
AC_MSG_RESULT(no)
AC_MSG_CHECKING(for struct ip_mreq)
AC_TRY_COMPILE([#include <netinet/in.h>], [
struct ip_mreq mreq;
mreq.imr_interface.s_addr = 0;
], [
# Yes, we have it...
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_STRUCT_IP_MREQ)
], [
# No multicast support
AC_MSG_RESULT(no)
])
])
dnl *****************************
@@ -567,15 +499,13 @@ fi
TARGET="unknown"
ACCESS_UNALIGNED="yes"
JIT_SUPPORTED=no
case "$host" in
#mips-sgi-irix5.* | mips-sgi-irix6.*) TARGET=MIPS; ACCESS_UNALIGNED="no";;
i*86-*-*) TARGET=X86; arch_target=x86; JIT_SUPPORTED=yes;;
i*86-*-*) TARGET=X86; arch_target=x86;;
sparc*-*-*) TARGET=SPARC; arch_target=sparc; ACCESS_UNALIGNED="no";;
#alpha*-*-linux* | alpha*-*-osf*) TARGET=ALPHA; ACCESS_UNALIGNED="no";;
#m68k-*-linux*) TARGET=M68K;;
macppc-*-openbsd* | powerpc-*-linux* | powerpc-*-openbsd* | powerpc-*-sysv* | powerpc-*-darwin*) TARGET=POWERPC; arch_target=ppc; JIT_SUPPORTED=yes;;
macppc-*-openbsd* | powerpc-*-linux* | powerpc-*-openbsd* | powerpc-*-sysv* | powerpc-*-darwin*) TARGET=POWERPC; arch_target=ppc;;
arm-*-linux-* | armv4l-*-linux-*) TARGET=ARM; arch_target=arm; ACCESS_UNALIGNED="no";;
s390-*-linux*) TARGET=S390; arch_target=s390; ACCESS_UNALIGNED="no";;
esac
@@ -599,8 +529,6 @@ AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
AM_CONDITIONAL(ARM, test x$TARGET = xARM)
AM_CONDITIONAL(S390, test x$TARGET = xS390)
AM_CONDITIONAL(JIT_SUPPORTED, test x$JIT_SUPPORTED = xyes)
LIBC="libc.so.6"
AC_SUBST(LIBC)
@@ -632,6 +560,7 @@ mono/tests/Makefile
mono/benchmark/Makefile
mono/monoburg/Makefile
mono/monograph/Makefile
mono/jit/Makefile
mono/io-layer/Makefile
mono/handles/Makefile
mono/mini/Makefile
-1
View File
@@ -14,5 +14,4 @@
<dllmap dll="libgtk-win32-2.0-0.dll" target="libgtk-x11-2.0.so" />
<dllmap dll="libglade-2.0-0.dll" target="libglade-2.0.so" />
<dllmap dll="oci" target="clntsh" />
<dllmap dll="gtkhtml-3.0" target="libgtkhtml-3.0.so.2" />
</configuration>
+1 -29
View File
@@ -22,35 +22,7 @@
<section name="sessionState"
type="System.Web.SessionState.SessionStateSectionHandler, System.Web" />
</sectionGroup>
<sectionGroup name="system.net">
<section name="connectionManagement"
type="System.Net.Configuration.ConnectionManagementHandler, System" />
<section name="authenticationModules"
type="System.Net.Configuration.NetAuthenticationModuleHandler, System" />
<section name="defaultProxy"
type="System.Net.Configuration.DefaultProxyHandler, System" />
<section name="webRequestModules"
type="System.Net.Configuration.WebRequestModuleHandler, System" />
</sectionGroup>
</configSections>
<system.net>
<connectionManagement>
<add address="*" maxconnection="2" />
</connectionManagement>
<authenticationModules>
<add type="System.Net.BasicClient" />
</authenticationModules>
<defaultProxy>
<proxy />
<!-- bypassonlocal and proxyaddress are ok -->
<!-- usessystemdefault is not supported -->
</defaultProxy>
<webRequestModules>
<add prefix="http" type="System.Net.HttpRequestCreator, System" />
<add prefix="https" type="System.Net.HttpRequestCreator, System" />
<add prefix="file" type="System.Net.FileWebRequestCreator, System" />
</webRequestModules>
</system.net>
<system.web>
<httpHandlers>
<add verb="*" path="*.aspx" type="System.Web.UI.PageHandlerFactory, System.Web" />
@@ -63,7 +35,7 @@
<httpModules>
<add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule, System.Web" />
<add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule, System.Web" />
<add name="Session" type="System.Web.SessionState.SessionStateModule, System.Web" />
<add name="SessionStateModule" type="System.Web.SessionState.SessionStateModule, System.Web" />
</httpModules>
<authentication mode="Forms">
<forms name=".MONOAUTH" loginUrl="login.aspx" protection="All" timeout="30" path="/">
+1 -1
View File
@@ -5,7 +5,7 @@ WEB_FILES= \
oledb papers \
passport plans porting postgresql ppc projects rationale \
resources roadmap runtime sqlclient sqlite sybase tdsclient \
tds-providers status testing thanks tools \
tds-providers team status testing thanks tools \
porting anoncvs monodoc-xml winforms
OTHERS= pending resources-pending todo mono-build.sh mono-build-w32.sh
+3 -1
View File
@@ -54,7 +54,9 @@
able to test them in real life: Gaurav and Leen worked very
hard on this namespace.
We can now render all HtmlControls and all WebControls.
We can now render all HtmlControls and almost all WebControls.
DataGrid and DataList controls are being finished by Gaurav.
Xml control needs some work on System.Xml related to XSL.
Help in making the controls better is appreciated.
+59 -151
View File
@@ -1,45 +1,25 @@
* CVS Access
Here we describe how one obtains commit access to the CVS repository
and the responsibilities that come with that access privilege.
If you are an active Mono developer, you can get a CVS account
that hosts the Mono source code. This web page contains
details about how to use the CVS server as well as the
policies to use it.
** What is CVS?
If you are not a developer, but want to track the development, please
see the <a href="anoncvs.html">AnonCVS</a> instructions.
Briefly, CVS is a system tool used to store and maintain files and
a history of their changes over time. The Mono source code and related
files are kept on a CVS server at Ximian.
** What Access?
We mean "commit" access. This is the privilege to make permanent
changes to the Mono source code and related files. You need an account
created by the CVS server administrator in order to commit changes to
the files on that server.
** How Does One Obtain Access?
Any active Mono developer can get a CVS account. Normally one is
considered an 'active' developer after sending several patches to the
mailing lists and/or bugzilla for review.
If you are not a developer, but want to access the latest sources,
please see the <a href="anoncvs.html">AnonCVS</a> instructions.
If you feel you are ready for a CVS account send an e-mail to
<a href="mailto:[email protected]">miguel</a> with your public OpenSSH
key for this purpose. Please specify if the key was generated with SSH
version 1 or version 2. Detailed instructions are below.
Send an e-mail to miguel with your public OpenSSH key for this
purpose. Please specify if the key was generated with SSH version 1
or version 2.
* Policies
It is necessary that everyone with CVS commit access respect and
adhere to the following rules. If you ask for and are granted CVS
access, you are agreeing to follow these policies.
Here are some policies about the use of the Mono CVS server.
** Code License
If you are about to commit code to a module, the code that is
being committed should be released under the same license as
being commited should be released under the same license as
the code that the module has.
Check the license if you are unsure, but it is basically:
@@ -48,105 +28,25 @@
If in doubt, check with the maintainers of the module, or send
mail to [email protected].
** Changing code
** Commiting code.
Even if you have CVS commit access, that doesn't mean you can change
code at will in any directory or module. Directories and Namespaces
have a sort of unofficial ownership. If you are not the owner of a
piece of code and you want to make changes/fixes to it, there are two
cases.
1) The change is a typo fix or a one-liner build or trivial fix. In
this case almost anyone can commit (always remembering to add the
proper changelog entry to explain the change). We say "almost anyone",
because changes to certain directories almost always should be reviewed
first. Such as changes to core stuff: corlib/System, System.Collections,
mini/, metadata/, System.IO.
If you are the maintainer for a piece of code, feel free to
commit code, and delegate the work to others.
2) The change is larger. In this case the patch *must* be sent to
mono-devel-list for review by the owner of the code and by the other
hackers. Always submit such patches to the list or bugzilla, although
you may put the owner of the code in the CC header. Hackers come and go.
Mailing a patch to only a personal address is a good way to get the
patch forgotten and missed. Plus, getting the patches reviewed as well
as reviewing them, is a good thing, so try to get used to it.
Use ChangeLog entries so we can keep textual descriptions of
your work, and use the contents of your ChangeLog file as the
CVS commit message (ie, paste the contents of this into the
editor buffer).
Note: If the patch is an addition of code and doesn't change any of the
existing code, the rules are slightly relaxed: there is more freedom
in committing such changes, if they don't interfere with the existing
codebase.
If you are making changes to someone else's code, please make
sure you get in touch with the maintainer of that code before
applying patches. You want to avoid commiting conflicting
work to someone else's code.
** Owning Code
Now, how do you get to be the owner of a chunk of code? The answer is
simple. You wrote the code, so you're the unofficial owner. There is
also another way. After sending a few patches for the code, the
owner (or the core developers of mono, if the owner somehow disappeared)
trusts you and tells you you're free to commit without getting his
review first.
Here is a (partial) list of namespaces/directories with their owners:
<ul>
<li>Debugger module and debug code in mono: martin
<li>mcs compiler: miguel, martin, ravi
<li>Reflection/Reflection.Emit: lupus, zoltan
<li>IO-layer: dick
<li>mini: lupus, dietmar
<li>test suite: nickd (though anyone should feel free to add test cases)
<li>System.IO: dick, ville
<li>security stuff: spouliot
<li>ilasm: jackson
<li>System.Web and related: gonzalo
<li>System.Xml: eno, piers
<li>Remoting: dietmar, lluis
<li>interop/marshal: dietmar
<li>threads: dick
</ul>
If you are the owner of a piece of code, feel free to commit code, and
delegate the work to others.
But, if you're not the owner of the code, committing a rewrite without
getting a review first is not good cvsitizenship (especially when the
rewrite claimed to fix bugs, but not a single regression test has been
added to the suite).
** Commit Rules
Once you know you can commit a patch (because of the rules above) there
are a few other small rules to follow:
<ul>
<li>Always add a changelog entry with a meaningful explanation
<li>If you fix a bug, add a regression test for it in the regression
suite
<li>Don't commit unrelated changes together with a fix: do fine-grained
commits
<li>Always check what you're committing: make sure you're only committing
what you need and make sure you don't change line endings and
whitespace. Do a 'cvs diff -u' of the files you're going to commit and
check the changes.
<li>Don't do reformatting commits, unless you're the original author of
the code
<li>When fixing bugs, don't follow the documentation blindly, it may
well be wrong. Test the behavior on the MS runtime or ask on the list
for discussion if unsure. Don't be afraid of having your changes
reviewed.
<li>Never remove copyright notices from the code
<li>Never remove licensing info from code
<li>Never commit code you didn't write yourself or code that doesn't
have a suitable license
<li>Follow the style conventions
<li>Keep an eye on performance considerations, especially for code in
core classes, ask on the list for guidance
<li>Do a regression test run and a bootstrapping build if making changes
to core functionality before committing. Do not commit code that would
break the compile, because that wastes everybody's time. Two things
Please do not commit code that would break the compile to the
CVS, because that normally wastes everybody's time. Two things
are important in this step: trying to build your sources and making
sure that you add all the new files before you do a commit.
</ul>
Also, remember to pat yourself on the back after the commit, smile and
think we're a step closer to a better free software world.
* Using CVS.
@@ -161,16 +61,14 @@
ssh-keygen -t rsa
</pre>
And mail <a href="mailto:[email protected]">miguel</a> the
id_rsa.pub file.
And mail me the id_rsa.pub file.
If you are using SSH version 1, run:
<pre>
ssh-keygen
</pre>
And mail <a href="mailto:[email protected]">miguel</a> your
identity.pub file.
And mail me your identity.pub file.
If you are using SSH from SSH Communications Security (they offer
a free SSH client for personal use), you have to use OpenSSH to
@@ -183,8 +81,7 @@
where the file id_XXX.pub is your public key file,
normally located under ~/.ssh/ or ~/.ssh2/.
Send to <a href="mailto:[email protected]">miguel</a> the
my_public_key.pub file.
Send to miguel the my_public_key.pub file.
The *exact* format for this file must be:
@@ -226,7 +123,7 @@
** Making patches
Usually you will want to make a patch to contribute, and let
other people review it before committing it. To obtain such a
other people review it before commiting it. To obtain such a
"patch", you type:
<pre>
@@ -235,25 +132,7 @@
mail [email protected] < file.diff
</pre>
** Committing your work
Once you get approval to commit to the CVS, or if you are
committing code that you are the maintainer of, you will want
to commit your code to CVS.
To do this, you have to "add" any new files that you created:
<pre>
cvs add new-file.cs
</pre>
And then commit your changes to the repository:
<pre>
cvs commit file-1.cs file-2.cs
</pre>
* Keeping track of changes.
** Keeping track of changes.
We provide two e-mail based mechanisms to keep track of
changes to the code base:
@@ -272,6 +151,28 @@
We hope to offer LXR and Bonsai in the future as well.
** Commiting your work
Once you get approval to commit to the CVS, or if you are
commiting code that you are the maintainer of, you will want
to commit your code to CVS.
To do this, you have to "add" any new files that you created:
<pre>
cvs add new-file.cs
</pre>
And then commit your changes to the repository:
<pre>
cvs commit file-1.cs file-2.cs
</pre>
* The Mailing Lists
To keep track of the various development and changes to the
CVS tree, you can subscribe to the [email protected].
To subscribe, send an email message to
[email protected] and in the body of the
message put `subscribe'.
@@ -284,3 +185,10 @@
the <a
href="mailto:[email protected]">[email protected]</a>
to receive the patches as they are checked into CVS.
** Recommendations
To build the sources, most of the type trying the `make' command
is enough. In some cases (the class libraries) we use nant, so
you need to run nant manually.
+1 -46
View File
@@ -16,8 +16,7 @@
the source code for Mono, you can start tracking down the
problem. Depending on how much time you have to devote to the
problem you could: <a href="http://bugzilla.ximian.com">File a
bug report</a> (read <a href="#goodbugreport">this</a>); track
down the problem and provide a better
bug report</a>; track down the problem and provide a better
<a href="http://bugzilla.ximian.com">bug report</a>; fix the
bug and provide a patch (you can <a
href="mailto:[email protected]">post it</a> to the <a
@@ -128,50 +127,6 @@
You can review the list of current bugs by going <a href="http://bugzilla.ximian.com/buglist.cgi?product=Mono%2FClass+Libraries&product=Mono%2FMCS&product=Mono%2FRuntime&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&email1=&emailtype1=substring&emailassigned_to1=1&email2=&emailtype2=substring&emailreporter2=1&changedin=&chfieldfrom=&chfieldto=Now&chfieldvalue=&short_desc=&short_desc_type=substring&long_desc=&long_desc_type=substring&bug_file_loc=&bug_file_loc_type=substring&keywords=&keywords_type=anywords&op_sys_details=&op_sys_details_type=substring&version_details=&version_details_type=substring&cmdtype=doit&order=%27Importance%27&form_name=query">here</a>
<a name="goodbugreport"/>
** How to make good bug reports
A mail from Paolo to mono-devel-list contained this check list:
<ol>
* Submit a test case, the smaller it is, the better
* Use <a href="http://bugzilla.ximian.com">
http://bugzilla.ximian.com</a> to report the bug.
<p>In <b>addition</b> to bugzilla, posting to the list is
fine if the bug merits larger exposure or design
discussions to solve; posting to the list twice or more
is just a way to annoy people and make them waste time,
specially when you start a new thread about it.
* If the test involves libraries or assemblies that are
not part of mono, add info about where to download all
the dependencies, and how to compile/install them.
* If compiling the test case requires more than:
<pre> mcs test.cs </pre>
provide the <b>full command line</b> you used to compile
the test.
* If running the test requires more than:
<pre> mono test.exe </pre>
provide the <b>full command line</b> needed to replicate
the bug.
* Provide info about the version of the software you're
using (both mono and the operating system or relevant
libraries).
* Provide the output you expect the test case to produce.
* Provide the actual output <b>you</b> get from the test case.
</ol>
A good bug report complies with at least 6 items from the list.
If your bug report complies with 3 or less items, it is very
poor and it means it will take much more time to fix (when it's
not ignored).
** Small tasks
A few smaller tasks are here, dropped in no particular order:
+54 -71
View File
@@ -14,12 +14,8 @@
* Every classes are present.
* Most classes have their unit tests. Some tests like <code>
SymmetricAlgorithmTest</code> are generated by external
tools.
* MACTripleDES is compatible with the implementation shipped in
framework 1.0. Version 1.1 gives different results when the
MACed data is a multiple of BlockSize (8 bytes).
SymmetricAlgorithmTest</code> are generated by an external
tool.
</ul>
**** TODO
@@ -29,6 +25,10 @@
href="http://bugzilla.ximian.com/show_bug.cgi?id=40689">
40689</a>). The class need to be re-designed.
* Support for adding/modifying OID using the
<code>machine.config</code> configuration file (algorithms
are done).
* RNGCryptoServiceProvider is currently only working on Linux.
The current implementation reside in Mono's runtime and use
the <code>/dev/[u]random</code> device (which do not exists
@@ -44,6 +44,13 @@
algorithm can be different for every CSP (Crypto Service
Provider). However for compatibility we should provide an
implementation compatible with the MS CSP (most likely used).
* Analyse the current coverage of the unit tests on the
cryptographic classes and complete the unit tests.
* Optimizations (performance) on most class are possible. Some
have been done using the Community Edition of BoundChecker
(a free VisualStudio addon) - recommanded!
</ul>
**** Notes
@@ -51,12 +58,7 @@
* All cryptographic algorithms are entirely managed, including
classes named <code>*CryptoServiceProvider</code>, with the
exception of <code>RNGCryptoServiceProvider</code> (which
implementation resides in the runtime).
* There is a bug in the <code>PKCS1MaskGenerationMethod</code>
class (in both framework 1.0 and 1.1). This means our
implementation isn't compatible with MS (but is compatible with
PKCS#1 v.2.1). However we get OAEP padding for every platform!
resides in the runtime).
* Look at assembly Mono.Security.Win32 if you require more
compatiblity with the Microsoft implementation (like accessing
@@ -77,9 +79,9 @@
* Unit tests are generated from a set of existing certificates
(about a dozen) each having different properties. Another
set of certificates (more than 700) are used for a more
set of certificates (more than 300) are used for a more
complete test (but isn't part of the standard test suite for
size and time consideration, i.e. a 7.5Mb C# source file).
size and time consideration, i.e. a 3.5Mb C# source file).
</ul>
**** TODO
@@ -88,6 +90,10 @@
certificates from PE files but cannot validate the signature
nor the certificate chain (and we're still missing some trust
anchors). See Tools section for more information.
* Integration with CryptoAPI (on Windows) isn't possible as
long as the <code>X509Certificate(IntPtr)</code> constructor
isn't completed.
</ul>
**** Notes
@@ -143,12 +149,10 @@
<hr>
** Assembly: Mono.Security
<b>Rational: </b>
<b>Rational</b>
This assembly provides the missing pieces to .NET security. On Windows
CryptoAPI is often used to provide much needed functionalities (like
some cryptographic algorithms, code signing, X.509 certificates). Mono,
for platform independance, implements these functionalities in 100%
managed code.
some cryptographic algorithms, code signing, X.509 certificates).
*** Namespace: Mono.Security
<ul>
@@ -157,8 +161,7 @@
*** Namespace: Mono.Security.Authenticode
<ul>
* Code signing and verification.
* Support for SPC (Software Publisher Certificate) files and
PVK (Private Key) files.
* Support for SPC files and PVK files.
</ul>
*** Namespace: Mono.Security.Cryptography
<ul>
@@ -167,20 +170,20 @@
</ul>
*** Namespace: Mono.Security.X509
<ul>
* X.509 structures (certificate, CRL...) building and decoding.
* X.509 certificate building and decoding.
</ul>
*** Namespace: Mono.Security.X509.Extensions
<ul>
* X.509 extensions (from public X.509 to private PKIX, Netsapce,
Microsoft, Entrust...).
* X.509 extensions (from X.509, PKIX, Netsapce, Microsoft,
Entrust...).
</ul>
**** Status
<ul>
* Some part of the work has not yet been commited (still cleaning up).
* Some part of the work has not yet been commited (cleaning up).
* A big part of this assembly is also included inside Mono's
corlib. The classes are duplicated in this assembly so the
corlib. The class are duplicated in this assembly so the
functionalities can be used without a dependency on Mono's
corlib (which depends on Mono's runtime).
@@ -190,19 +193,18 @@
<hr>
** Assembly: Mono.Security.Win32
<b>Rational: </b>
<b>Rational</b>
This assembly goal is to provide maximum compatibility with CryptoAPI
to application running with Mono's runtime on the Windows operating
system.
<b>This assembly should NEVER be used directly by any application</b>
(e.g. referecing the assembly from a project).
<b>This assembly should NEVER be used directly by any application</b>.
The classes should only be used by modifying the <code>machine.config
</code> configuration file (and then only if this increased
compatibility is required by an application).
See the file <code><a href="http://cvs.hispalinux.es/cgi-bin/cvsweb/~checkout~/mcs/class/Mono.Security.Win32/README?rev=1.1&content-type=text/plain&cvsroot=mono">/mcs/class/Mono.Security.Win32/README</a></code>
for complete instructions.
See the file <code>/mcs/class/Mono.Security.Win32/README</code> for
complete instructions.
*** Namespace: Mono.Security.Cryptography
@@ -214,10 +216,10 @@
* Wrapper classes for unmanaged versions of hash algorithms:
MD2, MD4, MD5 and SHA1 are supported. <b>note</b>: some
algorithms shouldn't be used in new design (MD4 is broken,
MD2 and MD5 aren't considered safe for some usage). They are
included to preserve interoperability with older applications
(e.g. some old, but still valid, X.509 certificates use MD2).
algorithms shouldn't be used in new design (MD4 is broken and
MD2 isn't considered safe). They are included to preserve
interoperability with older applications (e.g. some old, but
still valid, X.509 certificates use MD2).
</ul>
**** TODO
@@ -233,13 +235,9 @@
**** Ideas
<ul>
* Similar assemblies (e.g. <code>Mono.Security.XXX</code>)
could be created for <a href="http://www.openssl.org">OpenSSL</a>,
<a href="http://www.mozilla.org/projects/security/pki/nss/">NSS</a>,
<a href="http://www.eskimo.com/~weidai/cryptlib.html">crypto++</a>,
<a href="http://www.cryptlib.orion.co.nz/">cryptlib</a> ... for
improved performance and/or HSM (Hardware Security Module) support
under Linux and/or Windows.
* Similar assembly could be created for <a href="http://www.openssl.org">
OpenSSL</a>, NSS, crypto++, cryptlib ... for improved
performance and/or HSM support under Linux.
</ul>
<hr>
** Assembly: Microsoft.Web.Services
@@ -256,7 +254,7 @@
<a href="http://www.oasis-open.org/committees/wss/">OASIS</a> or
other committees.
<b>[*] There are some licensing issues to consider before starting to
<b>[*] There are some licensing issues to consider before stating to
implement WS-Security. All contributors must sign an agreement with
Microsoft before commiting anything related to WS-Security into CVS.
</b>
@@ -275,7 +273,7 @@
<ul>
* Nothing (yet) commited in CVS. However the classes in this
namespace are outside WS-Security scope. So development, for
those classes, could be done without signing any agreements.
those, could be done without signing any agreements.
</ul>
**** TODO
@@ -295,7 +293,7 @@
**** Status
The following tools are complete (mostly complete):
The following tools are complete:
<ul>
* <code>secutil</code> is a tool to extract certificates and
strongnames from assemblies in a format that can be easily
@@ -309,21 +307,12 @@
can be used (once transformed in SPC) to sign assemblies.
</ul>
Somewhat usable, somewhat incomplete:
**** TODO
The following tools are still missing or incomplete:
<ul>
* <code>sn</code> is a clone of the <code>sn</code> to manage
strongnames. Current version is limited to creating new keypairs
and converting values.
* <code>monosn</code> is a clone of the <code>sn</code> to manage
strongnames. This tools is part of the runtime (not the class
library) and as such is written in C and won't run without Mono.
</ul>
**** TODO
The following tools are still missing or largely incomplete:
<ul>
* <code>signcode</code> and <code>chktrust</code> (in progress)
for signing and validating Authenticode(tm) signatures on
@@ -342,34 +331,28 @@
<ul>
* SSL/TLS for secure communication (a prototype is under way).
Some work is already visible in Mono.Security assembly (e.g.
RC4, RSAManaged ...).
RC4).
</ul>
<hr>
** How to Help
<ul>
* Complete any of the TODO (and feel good about it ;-).
Complete any of the TODO (and feel good about it ;-).
* Analyse the current coverage of the unit tests on the
cryptographic classes and complete the unit tests.
Add missing unit tests to classes or methods.
* Optimization can also be done on most algorithms as crypto
is never fast enough. Some have been done using the
Community Edition of BoundChecker (a free VisualStudio
addon) - recommanded! Just be sure to test every optimization
(using the unit test) carefully - it's so fast to break an
algorithm ;-).
Write some documentation on the cryptographic classes for the
<a href="http://go-mono.com/tutorial/html/en/index.html">Mono
Handbook</a> as I'm not a very good writer (at least in English).
* Write some documentation on the cryptographic classes for
the <a href="http://go-mono.com/tutorial/html/en/index.html">Mono
Handbook</a> as I'm not a very good writer (at least in English).
</ul>
Optimization can also be done on algorithms as crypto is never fast
enough. Just be sure to test every optimization (using the unit test)
carefully - it's so fast to break an algorithm ;-).
Contact Sebastien Pouliot (<a href="mailto:[email protected]">home</a>
, <a href="mailto:[email protected]">work</a>) if you need additional
informations about the status of the cryptographic classes.
<hr>
Last reviewed: June 11, 2003 (post mono 0.24)
Last reviewed: April 7, 2003 (post mono 0.23)
+4 -272
View File
@@ -13,278 +13,6 @@
section</a>, the <a
href="http://www.go-mono.org/faq.html">FAQ</a>.
<table>
<tbody>
<tr bgcolor="#DDDDDD">
<td>
<b>Release 0.25</b><br>
<a href="archive/mono-0.25.html">Release notes</a><br>
Jun 26, 2003
</td>
<td>
<table cellspacing="1" cellpadding="3">
<tr bgcolor="#BBBBBB">
<td>
<b>Source Code</b>
</td>
<td>
<ul>
<li><a href="archive/mcs-0.25.tar.gz">Mono Class Libraries and C# Compiler.</a>
<li><a href="archive/mono-0.25.tar.gz">Mono Runtime</a>
<li><a href="archive/xsp-0.4.tar.gz">XSP web server (0.4)</a>
<li><a href="archive/monodoc-0.4.tar.gz">MonoDoc 0.5</a>
<li><a href="archive/gtk-sharp-0.10.tar.gz">Gtk# 0.10</a>
</ul>
</td>
</tr>
<tr bgcolor="#BBBBBB">
<td>
<b>Source RPMs</b><br>
(No RPMS for XSP).
</td>
<td>
<ul>
<li><a href="archive/mono-0.25-1.src.rpm">mono-0.25-1.src.rpm</a>
</ul>
</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td bgcolor="#999999">
<img src="images/redhat-36.gif"><b>Red Hat 9.0/x86</b>
<ul>
<li><a href="archive/redhat-90-i386/mono-0.25-1.i386.rpm">mono-0.25-1.i386.rpm</a>
<li><a href="archive/redhat-90-i386/mono-devel-0.25-1.i386.rpm">mono-devel-0.25-1.i386.rpm</a>
<li><a href="archive/redhat-90-i386/mono-debuginfo-0.25-1.i386.rpm">mono-debuginfo-0.25-1.i386.rpm</a>
<br>
<li><a href="archive/redhat-90-i386/gtk-sharp-0.9-1.i386.rpm">gtk-sharp-0.9-1.i386.rpm</a>
<li><a href="archive/redhat-90-i386/gtk-sharp-debuginfo-0.9-1.i386.rpm">gtk-sharp-debuginfo-0.9-1.i386.rpm</a>
<li><a href="archive/redhat-90-i386/monodoc-0.4-1.i386.rpm">monodoc-0.4-1.i386.rpm</a>
</ul>
</td>
<td bgcolor="#999999">
<img src="images/redhat-36.gif"><b>Red Hat 8.0/x86</b>
<ul>
<li><a href="archive/redhat-80-i386/mono-0.25-2.i386.rpm">mono-0.25-2.i386.rpm</a>
<li><a href="archive/redhat-80-i386/mono-devel-0.25-2.i386.rpm">mono-devel-0.25-2.i386.rpm</a>
<br>
<li><a href="archive/redhat-80-i386/gtk-sharp-0.9-1.i386.rpm">gtk-sharp-0.9-1.i386.rpm</a>
<li><a href="archive/redhat-80-i386/monodoc-0.4-1.i386.rpm">monodoc-0.4-1.i386.rpm</a>
</ul>
</td>
</tr>
<tr>
<td bgcolor="#999999">
<img src="images/debian-36.gif"><b>Debian</b>
<ul>
<li><a href="http://www.debianplanet.com/mono/">Debian Packages here.</a>
</ul>
</td>
<td bgcolor="#999999">
<img src="images/windows-36.gif"><b>Windows Setup Wizard (XP, 2000, NT)</b>
<ul>
<li><a href="archive/mono-0.25-win32-1.exe">Setup program.</a>
</ul>
</td>
</tr>
<tr>
<td bgcolor="#999999">
<img src="images/redhat-36.gif"><b>Red Hat 7.3/x86</b>
<ul>
<li><a href="archive/redhat-73-i386/mono-0.25-1.i386.rpm">mono-0.25-1.i386.rpm</a>
<li><a href="archive/redhat-73-i386/mono-devel-0.25-1.i386.rpm">mono-devel-0.25-1.i386.rpm</a>
</ul>
</td>
<td bgcolor="#999999">
<img src="images/mandrake-36.gif"><b>Mandrake 8.2/x86</b>
<ul>
<li><a href="archive/mandrake-82-i386/mono-0.25-1.i586.rpm">mono-0.25-1.i586.rpm</a>
<li><a href="archive/mandrake-82-i386/mono-devel-0.25-1.i586.rpm">mono-devel-0.25-1.i586.rpm</a>
</ul>
</td>
</tr>
<tr>
<td bgcolor="#999999">
<img src="images/suse-36.gif"><b>SuSE 8.2/x86</b>
<ul>
<li><a href="archive/suse-80-i386/mono-0.25-1.i386.rpm">mono-0.25-1.i386.rpm</a>
<li><a href="archive/suse-80-i386/mono-devel-0.25-1.i386.rpm">mono-devel-0.25-1.i386.rpm</a>
</ul>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<tr bgcolor="#CCCCC">
<td>
<b>Regression Tests</b><br>
</td>
<td>
You can get binaries for the Mono Regression Test
Suite <a href="archive/mono-tests.tar.gz">here</a>
</td>
</tr>
</tr>
</tbody>
</table>
* Older Releases:
We provide binaries for older releases until we have packages for the new release.
<table>
<tbody>
<tr bgcolor="#DDDDDD">
<td>
<b>Release 0.24</b><br>
<a href="archive/mono-0.24.html">Release notes</a><br>
May 6, 2003
</td>
<td>
<table cellspacing="1" cellpadding="3">
<tr bgcolor="#BBBBBB">
<td>
<b>Source Code</b>
</td>
<td>
<ul>
<li><a href="archive/mcs-0.24.tar.gz">Mono Class Libraries and C# Compiler.</a>
<li><a href="archive/mono-0.24.tar.gz">Mono Runtime</a>
<li><a href="archive/gc6.1.tar.gz">Boehm GC 6.1</a>
<li><a href="archive/xsp-0.4.tar.gz">XSP web server (0.4)</a>
<li><a href="archive/monodoc-0.4.tar.gz">MonoDoc 0.4</a>
<li><a href="archive/gtk-sharp-0.9.tar.gz">Gtk# 0.9</a>
</ul>
</td>
</tr>
<tr bgcolor="#BBBBBB">
<td>
<b>Source RPMs</b><br>
(No RPMS for XSP).
</td>
<td>
<ul>
<li><a href="archive/libgc-6.1-1.src.rpm">libgc-6.1-1.src.rpm</a>
<li><a href="archive/mono-0.24-1.src.rpm">mono-0.24-1.src.rpm</a>
</ul>
</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td bgcolor="#999999">
<img src="images/redhat-36.gif"><b>Red Hat 9.0/x86</b>
<ul>
<li><a href="archive/redhat-90-i386/libgc-6.1-1.i386.rpm">libgc-6.1-1.i386.rpm</a>
<li><a href="archive/redhat-90-i386/libgc-devel-6.1-1.i386.rpm">libgc-devel-6.1-1.i386.rpm</a>
<li><a href="archive/redhat-90-i386/mono-0.24-1.i386.rpm">mono-0.24-1.i386.rpm</a>
<li><a href="archive/redhat-90-i386/mono-devel-0.24-1.i386.rpm">mono-devel-0.24-1.i386.rpm</a>
<li><a href="archive/redhat-90-i386/mono-debuginfo-0.24-1.i386.rpm">mono-debuginfo-0.24-1.i386.rpm</a>
<br>
<li><a href="archive/redhat-90-i386/gtk-sharp-0.9-1.i386.rpm">gtk-sharp-0.9-1.i386.rpm</a>
<li><a href="archive/redhat-90-i386/gtk-sharp-debuginfo-0.9-1.i386.rpm">gtk-sharp-debuginfo-0.9-1.i386.rpm</a>
<li><a href="archive/redhat-90-i386/monodoc-0.4-1.i386.rpm">monodoc-0.4-1.i386.rpm</a>
</ul>
</td>
<td bgcolor="#999999">
<img src="images/redhat-36.gif"><b>Red Hat 8.0/x86</b>
<ul>
<li><a href="archive/redhat-80-i386/libgc-6.1-1.i386.rpm">libgc-6.1-1.i386.rpm</a>
<li><a href="archive/redhat-80-i386/libgc-devel-6.1-1.i386.rpm">libgc-devel-6.1-1.i386.rpm</a>
<li><a href="archive/redhat-80-i386/mono-0.24-2.i386.rpm">mono-0.24-2.i386.rpm</a>
<li><a href="archive/redhat-80-i386/mono-devel-0.24-2.i386.rpm">mono-devel-0.24-2.i386.rpm</a>
<br>
<li><a href="archive/redhat-80-i386/gtk-sharp-0.9-1.i386.rpm">gtk-sharp-0.9-1.i386.rpm</a>
<li><a href="archive/redhat-80-i386/monodoc-0.4-1.i386.rpm">monodoc-0.4-1.i386.rpm</a>
</ul>
</td>
</tr>
<tr>
<td bgcolor="#999999">
<img src="images/debian-36.gif"><b>Debian</b>
<ul>
<li><a href="http://www.debianplanet.com/mono/">Debian Packages here.</a>
</ul>
</td>
<td bgcolor="#999999">
<img src="images/windows-36.gif"><b>Windows Setup Wizard (XP, 2000, NT)</b>
<ul>
<li><a href="archive/mono-0.24-win32-1.exe">Setup program.</a>
</ul>
</td>
</tr>
<tr>
<td bgcolor="#999999">
<img src="images/redhat-36.gif"><b>Red Hat 7.3/x86</b>
<ul>
<li><a href="archive/redhat-73-i386/libgc-6.1-1.i386.rpm">libgc-6.1-1.i386.rpm</a>
<li><a href="archive/redhat-73-i386/libgc-devel-6.1-1.i386.rpm">libgc-devel-6.1-1.i386.rpm</a>
<li><a href="archive/redhat-73-i386/mono-0.24-1.i386.rpm">mono-0.24-1.i386.rpm</a>
<li><a href="archive/redhat-73-i386/mono-devel-0.24-1.i386.rpm">mono-devel-0.24-1.i386.rpm</a>
</ul>
</td>
<td bgcolor="#999999">
<img src="images/mandrake-36.gif"><b>Mandrake 8.2/x86</b>
<ul>
<li><a href="archive/mandrake-82-i386/libgc-6.1-1.i586.rpm">libgc-6.1-1.i586.rpm</a>
<li><a href="archive/mandrake-82-i386/libgc-devel-6.1-1.i586.rpm">libgc-devel-6.1-1.i586.rpm</a>
<li><a href="archive/mandrake-82-i386/mono-0.24-1.i586.rpm">mono-0.24-1.i586.rpm</a>
<li><a href="archive/mandrake-82-i386/mono-devel-0.24-1.i586.rpm">mono-devel-0.24-1.i586.rpm</a>
</ul>
</td>
</tr>
<tr>
<td bgcolor="#999999">
<img src="images/suse-36.gif"><b>SuSE 8.0/x86</b>
<ul>
<li><a href="archive/suse-80-i386/libgc-6.1-1.i386.rpm">libgc-6.1-1.i386.rpm</a>
<li><a href="archive/suse-80-i386/libgc-devel-6.1-1.i386.rpm">libgc-devel-6.1-1.i386.rpm</a>
<li><a href="archive/suse-80-i386/mono-0.24-1.i386.rpm">mono-0.24-1.i386.rpm</a>
<li><a href="archive/suse-80-i386/mono-devel-0.24-1.i386.rpm">mono-devel-0.24-1.i386.rpm</a>
</ul>
</td>
<td bgcolor="#999999">
<b>Linux s/390</b>
<ul>
<li><a href="archive/s390/libgc-6.1-1.s390.rpm">libgc-6.1-1.s390.rpm</a>
<li><a href="archive/s390/libgc-devel-6.1-1.s390.rpm">libgc-devel-6.1-1.s390.rpm</a>
<li><a href="archive/s390/mono-0.24-1.s390.rpm">mono-0.24-1.s390.rpm</a>
<li><a href="archive/s390/mono-devel-0.24-1.s390.rpm">mono-devel-0.24-1.s390.rpm</a>
</ul>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<tr bgcolor="#CCCCC">
<td>
<b>Regression Tests</b><br>
</td>
<td>
You can get binaries for the Mono Regression Test
Suite <a href="archive/mono-tests.tar.gz">here</a>
</td>
</tr>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr bgcolor="#DDDDDD">
@@ -420,6 +148,10 @@
* Older Releases:
We provide binaries for older releases until we have packages for the new release.
<table>
<tbody>
<tr bgcolor="#DDDDDD">
+23 -100
View File
@@ -4,7 +4,6 @@
<a href="#gui">Building GUI applications with Mono</a><br>
<a href="#msft">Mono and Microsoft</a><br>
<a href="#platforms">Mono platforms</a><br>
<a href="#compatibility">Compatibility</a></br>
<a href="#pnpproject">Mono and the Portable.NET Project</a><br>
<a href="#webservices">Web Services</a><br>
<a href="#asp">Mono and ASP.NET</a><br>
@@ -288,7 +287,7 @@ A: There are several reasons for this.
Next is compatibility. It is not possible to implement
System.Windows.Forms on top of Gtk+/Qt and have 100% compatibility,
because System.Windows.Forms exposes some Win32-isms, such as the
because System.Windows.Forms exposes <i>lots</i> of Win32-isms, such as the
Win32 message loop. In order to maintain compatibility, Wine must be used,
and this is being done; see the
<a href="/winforms.html">System.Windows.Forms effort page</a>.
@@ -490,44 +489,6 @@ A: Mono requires Unicode versions of Win32 APIs to run,
Win32 libs. This is achieved by inserting -lunimono before
-lkerner32/user32 in the linker's specs file.
<a name="compatibility"></a>
** Compatibility
Q: Can Mono run applications developed with the Microsoft.NET fraemwork?
A: Yes, Mono can run applications developed with the Microsft .NET Framework
on Unix. There are a few caveats to keep in mind: Mono has not
been completed yet, so a few API calls might be missing; And in
some cases the Mono behavior *might* be incorrect.
Q: Will missing API entry points be implemented?
A: Yes, the goal of Mono is to implement precisely the .NET Framework
API (as well as compile-time selectable subsets, for those
interested in a lighter version of Mono).
Q: If the behavior of an API call is different, will you fix it?
A: Yes, we will. But we will need your assistance for this. If you find a bug
in the Mono implementation, please fill a bug report in <a
href="http://bugzilla.ximian.com">http://bugzilla.ximian.com</a>.
Do not assume we know about the problem, we might not, and using the bug tracking
system helps us organize the development process.
Q: Can I develop my applications on Windows, and deploy on a supported
Mono platform (like Linux)?
A: Yes, you can.
As of today, Mono is not 100% finished, so it is sometimes useful
to compile the code with Mono, to find out if your application
depends on unimplemented functionality.
Q: Will applications run out the box with Mono?
A: Sometimes they will. But sometimes a .NET application might invoke
Win32 API calls, or assume certain patterns that are not correct
for cross-platform applications.
<a name="pnpproject"></a>
** Mono and Portable.NET
@@ -540,22 +501,8 @@ A: Most of Mono is being written using C#, with only
It is easier to describe what is unique about Mono:
<ul>
<li> An advanced native-code compilation engine: Both
just-in-time compilation (JIT) and pre-compilation of CIL
bytecodes into native code are supported.
<li> A foundation for code optimization: The new code generator in
Mono builds on the experience of our first JIT engine, and enables
us to implement various advanced compiler optimization
tricks. With an SSA-framework, plenty of new optimizations are possible.
The current list of optimizations are: Peephole postpass,
Branch optimizations, Inline method calls, Constant folding, Constant
propagation, Copy propagation, Dead code elimination, Linear scan
global reg allocation, Conditional moves, Emit per-domain code,
Instruction scheduling, Intrinsic method implementations, Tail
recursion and tail calls, Loop related optimizations, Fast x86 FP
compares, Leaf procedures optimizations
<li> A Just-in-Time compiler engine. This is important for
making your applications fast.
<li> A self-hosting C# compiler written in C#, which is clean, easy
to maintain.
@@ -569,43 +516,38 @@ A: Most of Mono is being written using C#, with only
systems, while the interpreter works on SPARC, StrongARM,
s390 and PowerPC systems.
Our new compilation engine is being ported to the PowerPC.
<li> Supports Linux, BSD, Windows and Solaris at this point.
<li> Supports Linux, Windows and Solaris at this point.
<li> The JIT engine is written using a portable instruction
selector which not only generates good code but
selector which not only generates good code (we are told
that we are faster than Rotor, but it is hard to tell) but
is also the foundation to re-target the JIT engine to other
systems.
<li> Full support for remoting in the runtime.
The system employed is described in various compiler
books and it is very similar to what is described in the
book that covers LCC, the ANSI C retargetable C compiler.
<li> The JIT engine supports in-lining, constant folding and propagation,
<li> Full support for remoting in the runtime, but the class
libraries are still behind.
<li> The C# compiler, the JIT engine and the class libraries are
mature enough that the whole system has been self-hosting
since April 2002. This means that we develop Mono
completely with itself at this point.
mature enough that the whole system is self-hosting. This means that
we develop Mono completely with itself at this point.
By forcing ourselves to use our own code to develop our
tools, we bug fix problems rapidly, and the system is
overall more robust and tested than if we did not.
<li> We are not yet done, and there is a lot of work left to be
done
<li> We have a great community of developers, without which Mono
would not be possible.
<li> We are working on an ahead of time compilation mode to
pre-compile code for the target architecture (this is part
of our new code generation effort).
</ul>
In general, Mono is more mature and complete since it has been used
to develop itself, which is a big motivator for stability and
correctness, while Portable.NET remains pretty much an untested
platform.
Q: I hear Mono keeps changing the P/Invoke API, why?
A: We are just fixing our implementation to be compatible with the
Microsoft implementation. In other words, the Mono P/Invoke API is
more complete when compared to the Portable.NET version, hence
various pieces of software that depend on this extended
functionality fail to work properly with Portable.NET.
<a name="webservices"></a>
** Web Services
@@ -829,25 +771,6 @@ A: Replace the __stdcall attribute with the STDCALL macro, and include this
#define STDCALL __attribute__((stdcall))
#endif
Q: I want to be able to execute Mono binaries, without having to use the "mono"
command. How can I do this?
A: From Carlos Perelló:
<i>I think that the best solution is the binfmt feature with the
wrapper that exists with Debian packages at:
<a href="http://www.debianplanet.org/mono/dists/unstable/main/source/admin/">http://www.debianplanet.org/mono/dists/unstable/main/source/admin/</a>
If you want use it with Big endian machines, you should apply a patch
(<a href="http://carlos.pemas.net/debian/mono/binfmt-detector-cli.c.diff">http://carlos.pemas.net/debian/mono/binfmt-detector-cli.c.diff</a>)
It works really good and lets you use wine also, it reads the .exe file
headers and check if it's a .net executable.
This way you just execute: ./my-cool-mono-application.exe and it works
without the need of any wrapper.</i>
<a name="asp">
** Mono and ASP.NET
@@ -1301,7 +1224,7 @@ A: First some background information.
for the open source Mono platform, nor integration with today's
Mono's rich support of Linux.
The Mono strategy for dealing with these technologies is as
The Mono strategy for dealing with these tehcnologies is as
follows: (1) work around the patent by using a different
implementation techinque that retains the API, but changes the
mechanism; if that is not possible, we would (2) remove the pieces
-136
View File
@@ -107,146 +107,10 @@
</td>
</tr>
</table>
<table border=1>
<tr>
<td colspan="3">
<b><center>In the news</center></b>
</td>
</tr>
<tr>
<td>
<img src="images/netmagazine.png">
</td>
<td>
<a href="http://www.fawcette.com/dotnetmag/2003_TE/magazine/columns/trends/default.asp">May 31st, 2003</a>: CLI integration.
</td>
</tr>
<tr>
<td>
<img src="images/infoworld.png">
</td>
<td>
<a href="http://www.infoworld.com/article/03/05/22/HNmono_1.html">May 22nd, 2003</a>: Mono 1.0 plans.
</td>
</tr>
<tr>
<td>
<img src="images/infoworld.png">
</td>
<td>
<a href="http://www.infoworld.com/article/03/03/14/11stratdev_1.html">Mar 14th, 2003</a>: Whither Mono?
</td>
</tr>
<tr>
<td>
<img src="images/b2.png">
</td>
<td>
<a href="http://www.infoworld.com/article/03/05/22/HNmono_1.html">Dec, 2002</a>: The Penguin takes flight.
</td>
</tr>
</table>
</td>
</tr>
</table>
@item Jun 23rd, 2003: DiaCanvas#, Turkish presentation
http://enver.casdb.com/sunumlar/mono/
@item Jun 17th, 2003: Web Services client; Profiling hooks
Lluis and Gonzalo have checked into CVS the support for web
services in the Mono runtime. This allows Mono to work as a
web services client. We still require a WSDL compiler to
compile the initial stub, but Erik has the beginning of a WSDL
compiler ready and Atsushi has continued work on his
experimental Xml Schema to C# class generator.
As part of this, the Mono Http runtime has been rewritten to
increase reliability, scalability and conformance to the
specs. Also our io-layer has been extended to not have
arbitrary limits. This was done as part of our collaboration
with SourceGear.
Paolo has commited the new pluggable profiling API to the Mono
runtime: now the profiler is built as a module, and a new code
coverage analysis has been checked in (and Zoltan already
added improvements to it).
Mark's Mozilla bindings continue to improve, and we will shortly
migrate the Mono documentation browser to use Mozilla, to take
advantage of the tutorial's use of CSS.
Jackson's work on the IL assembler and Ben on running
regression tests have provided us with a very needed tool in
the Mono toolkit. One of the last missing pieces on the SDK.
On the crypto world, we got Sebastien's certificate viewer
checked into CVS and the crypto code keeps advancing by leaps
and bounds.
Alexandre and Aleksey Work continues on Windows.Forms on top
of Wine and Gtk# (the former for full compatibility, the later
for ease-of-authoring).
Cesar checked in the beginning of the semantic analysis code
for his JScript compiler, and will be working on it full time.
@item Jun 11th, 2003: SourceGear and Ximian announce partnership
Ximian, Inc., the leading provider of desktop and server
solutions enabling enterprise Linux adoption, today announced
that SourceGear Corporation will use Mono\x{2122} Project
technology to offer cross-platform versions of its
products. In addition, the companies have entered into a
development partnership under which Ximian® will provide
custom Mono development to enable delivery of SourceGear
products later this year. As a result, SourceGear will offer
both UNIX and Linux clients for its SourceGear Vault source
code management tool, enabling broader use of its solutions in
mixed-platform development organizations.
<a href="http://www.ximian.com/about_us/press_center/press_releases/index.html?pr=sourcegear">Read more...</a>
Some technical details are available <a
href="http://lists.ximian.com/archives/public/mono-list/2003-June/014334.html">here</a>.
@item May 20th, 2003: OpenLink releases WineLib patches.
OpenLink <a
href="http://lists.ximian.com/archives/public/mono-winforms-list/2003-May/000284.html">announced</a>
the release of Vladimir's work to turn Wine into a library
that can be used dynamically from Mono. This work simplifies
the work on System.Windows.Forms as it is no longer necessary
have a special version of the GC, nor have a stub program.
The patches are available <a
href="http://www.openlinksw.com/mono/">here</a>.
Mono packages for the Linux/s390 are available now in the <a
href="download.html">download page</a>.
@item May 10th, 2003: Eclipse runs on Mono
Today Zoltan Varga announced that he got the <a
href="http://www.eclipse.org">Eclipse IDE</a> running on top
of Mono+<a href="http://www.ikvm.net">IKVM</a>.
A screenshot of Eclipse running with Mono can be found <a
href="images/ikvm-screenshot.png">here</a>
@item May 6th, 2003: Mono 0.24 ships
We have released Mono 0.24 which includes our new code
generation engine. A list of the new features is available <a
href="archive/mono-0.24.html">here</a>.
Packages for Windows, and various Linux distributions are
available on our <a href="download.html">download</a> page.
We are shipping Gtk# and MonoDoc packages for the first time.
@item Apr 21st, 2003: Virtuoso 3.0 ships.
<a href="http://www.openlinksw.com">OpenLink's</a> released
+246
View File
@@ -0,0 +1,246 @@
System.Object
System.Exception
System.ValueType
System.Delegate
System.MulticastDelegate
System.Enum
System.Activator
System.ArgIterator
System.__ComObject
System.TypedReference
System.Security.AllowPartiallyTrustedCallersAttribute
System.Runtime.Serialization.Formatter
System.Runtime.Serialization.FormatterConverter
System.Runtime.Serialization.FormatterServices
System.Runtime.Serialization.ObjectIDGenerator
System.Runtime.Serialization.ObjectManager
System.Reflection.ModuleResolveEventHandler
System.Reflection.Pointer
System.Globalization.CompareInfo
System.Globalization.HebrewCalendar
System.Globalization.HijriCalendar
System.Globalization.JapaneseCalendar
System.Globalization.KoreanCalendar
System.Globalization.SortKey
System.Globalization.StringInfo
System.Globalization.TaiwanCalendar
System.Globalization.TextElementEnumerator
System.Globalization.TextInfo
System.Globalization.ThaiBuddhistCalendar
System.IO.IsolatedStorage.IsolatedStorageFile
System.Reflection.Emit.MethodRental
System.Runtime.CompilerServices.AccessedThroughPropertyAttribute
System.Runtime.CompilerServices.CallConvCdecl
System.Runtime.CompilerServices.CallConvStdcall
System.Runtime.CompilerServices.CallConvThiscall
System.Runtime.CompilerServices.CallConvFastcall
System.Runtime.CompilerServices.CustomConstantAttribute
System.Runtime.CompilerServices.DateTimeConstantAttribute
System.Runtime.CompilerServices.DiscardableAttribute
System.Runtime.CompilerServices.DecimalConstantAttribute
System.Runtime.CompilerServices.CompilationRelaxationsAttribute
System.Runtime.CompilerServices.CompilerGlobalScopeAttribute
System.Runtime.CompilerServices.IDispatchConstantAttribute
System.Runtime.CompilerServices.IsVolatile
System.Runtime.CompilerServices.IUnknownConstantAttribute
System.Runtime.CompilerServices.RequiredAttributeAttribute
System.Runtime.InteropServices.ArrayWithOffset
System.Runtime.InteropServices.DispIdAttribute
System.Runtime.InteropServices.ClassInterfaceType
System.Runtime.InteropServices.ClassInterfaceAttribute
System.Runtime.InteropServices.ComVisibleAttribute
System.Runtime.InteropServices.LCIDConversionAttribute
System.Runtime.InteropServices.ComRegisterFunctionAttribute
System.Runtime.InteropServices.ComUnregisterFunctionAttribute
System.Runtime.InteropServices.ProgIdAttribute
System.Runtime.InteropServices.ImportedFromTypeLibAttribute
System.Runtime.InteropServices.IDispatchImplType
System.Runtime.InteropServices.IDispatchImplAttribute
System.Runtime.InteropServices.ComSourceInterfacesAttribute
System.Runtime.InteropServices.ComConversionLossAttribute
System.Runtime.InteropServices.TypeLibTypeFlags
System.Runtime.InteropServices.TypeLibFuncFlags
System.Runtime.InteropServices.TypeLibVarFlags
System.Runtime.InteropServices.TypeLibTypeAttribute
System.Runtime.InteropServices.TypeLibFuncAttribute
System.Runtime.InteropServices.TypeLibVarAttribute
System.Runtime.InteropServices.ComImportAttribute
System.Runtime.InteropServices.PreserveSigAttribute
System.Runtime.InteropServices.ComAliasNameAttribute
System.Runtime.InteropServices.AutomationProxyAttribute
System.Runtime.InteropServices.PrimaryInteropAssemblyAttribute
System.Runtime.InteropServices.CoClassAttribute
System.Runtime.InteropServices.ComEventInterfaceAttribute
System.Runtime.InteropServices.COMException
System.Runtime.InteropServices.ComMemberType
System.Runtime.InteropServices.CurrencyWrapper
System.Runtime.InteropServices.DispatchWrapper
System.Runtime.InteropServices.ErrorWrapper
System.Runtime.InteropServices.ExtensibleClassFactory
System.Runtime.InteropServices.HandleRef
System.Runtime.InteropServices.InvalidComObjectException
System.Runtime.InteropServices.InvalidOleVariantTypeException
System.Runtime.InteropServices.TypeLibImporterFlags
System.Runtime.InteropServices.ExporterEventKind
System.Runtime.InteropServices.ITypeLibExporterNotifySink
System.Runtime.InteropServices.ITypeLibConverter
System.Runtime.InteropServices.MarshalDirectiveException
System.Runtime.InteropServices.ObjectCreationDelegate
System.Runtime.InteropServices.RuntimeEnvironment
System.Runtime.InteropServices.RegistrationServices
System.Runtime.InteropServices.SafeArrayRankMismatchException
System.Runtime.InteropServices.SafeArrayTypeMismatchException
System.Runtime.InteropServices.SEHException
System.Runtime.InteropServices.TypeLibConverter
System.Runtime.InteropServices.BIND_OPTS
System.Runtime.InteropServices.UCOMIBindCtx
System.Runtime.InteropServices.UCOMIConnectionPointContainer
System.Runtime.InteropServices.UCOMIConnectionPoint
System.Runtime.InteropServices.UCOMIEnumMoniker
System.Runtime.InteropServices.CONNECTDATA
System.Runtime.InteropServices.UCOMIEnumConnections
System.Runtime.InteropServices.UCOMIEnumConnectionPoints
System.Runtime.InteropServices.UCOMIEnumString
System.Runtime.InteropServices.UCOMIEnumVARIANT
System.Runtime.InteropServices.FILETIME
System.Runtime.InteropServices.UCOMIMoniker
System.Runtime.InteropServices.UCOMIPersistFile
System.Runtime.InteropServices.UCOMIRunningObjectTable
System.Runtime.InteropServices.STATSTG
System.Runtime.InteropServices.UCOMIStream
System.Runtime.InteropServices.DESCKIND
System.Runtime.InteropServices.BINDPTR
System.Runtime.InteropServices.UCOMITypeComp
System.Runtime.InteropServices.TYPEKIND
System.Runtime.InteropServices.TYPEFLAGS
System.Runtime.InteropServices.IMPLTYPEFLAGS
System.Runtime.InteropServices.TYPEATTR
System.Runtime.InteropServices.FUNCDESC
System.Runtime.InteropServices.IDLFLAG
System.Runtime.InteropServices.IDLDESC
System.Runtime.InteropServices.PARAMFLAG
System.Runtime.InteropServices.PARAMDESC
System.Runtime.InteropServices.TYPEDESC
System.Runtime.InteropServices.ELEMDESC
System.Runtime.InteropServices.VARDESC
System.Runtime.InteropServices.DISPPARAMS
System.Runtime.InteropServices.EXCEPINFO
System.Runtime.InteropServices.FUNCKIND
System.Runtime.InteropServices.INVOKEKIND
System.Runtime.InteropServices.CALLCONV
System.Runtime.InteropServices.FUNCFLAGS
System.Runtime.InteropServices.VARFLAGS
System.Runtime.InteropServices.UCOMITypeInfo
System.Runtime.InteropServices.SYSKIND
System.Runtime.InteropServices.LIBFLAGS
System.Runtime.InteropServices.TYPELIBATTR
System.Runtime.InteropServices.UCOMITypeLib
System.Runtime.InteropServices.UnknownWrapper
System.Runtime.Remoting.IObjectHandle
System.Runtime.Remoting.IRemotingTypeInfo
System.Runtime.Remoting.IChannelInfo
System.Runtime.Remoting.IEnvoyInfo
System.Runtime.Remoting.RemotingConfiguration
System.Runtime.Remoting.TypeEntry
System.Runtime.Remoting.ActivatedClientTypeEntry
System.Runtime.Remoting.ActivatedServiceTypeEntry
System.Runtime.Remoting.WellKnownClientTypeEntry
System.Runtime.Remoting.WellKnownServiceTypeEntry
System.Runtime.Remoting.RemotingException
System.Runtime.Remoting.ServerException
System.Runtime.Remoting.RemotingTimeoutException
System.Runtime.Remoting.RemotingServices
System.Runtime.Remoting.InternalRemotingServices
System.Runtime.Remoting.SoapServices
System.Runtime.Remoting.Activation.UrlAttribute
System.Runtime.Remoting.Messaging.IMessageSink
System.Runtime.Remoting.Messaging.AsyncResult
System.Runtime.Remoting.Messaging.CallContext
System.Runtime.Remoting.Messaging.ILogicalThreadAffinative
System.Runtime.Remoting.Messaging.InternalMessageWrapper
System.Runtime.Remoting.Messaging.IMethodCallMessage
System.Runtime.Remoting.Messaging.MethodCallMessageWrapper
System.Runtime.Remoting.Messaging.HeaderHandler
System.Runtime.Remoting.Messaging.IMessageCtrl
System.Runtime.Remoting.Messaging.IRemotingFormatter
System.Runtime.Remoting.Messaging.ReturnMessage
System.Runtime.Remoting.Messaging.MethodCall
System.Runtime.Remoting.Messaging.ConstructionCall
System.Runtime.Remoting.Messaging.MethodResponse
System.Runtime.Remoting.Messaging.ConstructionResponse
System.Runtime.Remoting.Messaging.MethodReturnMessageWrapper
System.Runtime.Remoting.Messaging.OneWayAttribute
System.Runtime.Remoting.Messaging.MessageSurrogateFilter
System.Runtime.Remoting.Messaging.RemotingSurrogateSelector
System.Runtime.Remoting.Contexts.CrossContextDelegate
System.Runtime.Remoting.Contexts.ContextProperty
System.Runtime.Remoting.Contexts.IContextPropertyActivator
System.Runtime.Remoting.Contexts.IContributeClientContextSink
System.Runtime.Remoting.Contexts.IContributeDynamicSink
System.Runtime.Remoting.Contexts.IContributeEnvoySink
System.Runtime.Remoting.Contexts.IContributeObjectSink
System.Runtime.Remoting.Contexts.IContributeServerContextSink
System.Runtime.Serialization.Formatters.InternalRM
System.Runtime.Serialization.Formatters.InternalST
System.Runtime.Serialization.Formatters.SoapMessage
System.Runtime.Serialization.Formatters.SoapFault
System.Runtime.Serialization.Formatters.ServerFault
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
System.Security.Cryptography.CryptoConfig
System.Security.Cryptography.KeyedHashAlgorithm
System.Security.Cryptography.HMACSHA1
System.Security.Cryptography.MACTripleDES
System.Security.Cryptography.MaskGenerationMethod
System.Security.Cryptography.PasswordDeriveBytes
System.Security.Cryptography.PKCS1MaskGenerationMethod
System.Security.Cryptography.RC2
System.Security.Cryptography.RC2CryptoServiceProvider
System.Security.Cryptography.RSACryptoServiceProvider
System.Security.Cryptography.RSAOAEPKeyExchangeDeformatter
System.Security.Cryptography.RSAOAEPKeyExchangeFormatter
System.Security.Cryptography.RSAPKCS1KeyExchangeDeformatter
System.Security.Cryptography.RSAPKCS1KeyExchangeFormatter
System.Security.Cryptography.RSAPKCS1SignatureDeformatter
System.Security.Cryptography.RSAPKCS1SignatureFormatter
System.Security.Cryptography.SHA1Managed
System.Security.Cryptography.TripleDES
System.Security.Cryptography.TripleDESCryptoServiceProvider
System.Security.Permissions.EnvironmentPermission
System.Security.Permissions.FileDialogPermission
System.Security.Permissions.IsolatedStorageFilePermission
System.Security.Permissions.PrincipalPermissionAttribute
System.Security.Permissions.SecurityPermissionAttribute
System.Security.Permissions.PublisherIdentityPermissionAttribute
System.Security.Permissions.PublisherIdentityPermission
System.Security.Permissions.ReflectionPermission
System.Security.Permissions.RegistryPermission
System.Security.Permissions.PrincipalPermission
System.Security.Permissions.SiteIdentityPermission
System.Security.Permissions.StrongNameIdentityPermission
System.Security.Permissions.StrongNamePublicKeyBlob
System.Security.Permissions.UIPermission
System.Security.Permissions.UrlIdentityPermission
System.Security.Permissions.ZoneIdentityPermission
System.Security.Policy.ApplicationDirectory
System.Security.Policy.ApplicationDirectoryMembershipCondition
System.Security.Policy.FirstMatchCodeGroup
System.Security.Policy.Hash
System.Security.Policy.HashMembershipCondition
System.Security.Policy.NetCodeGroup
System.Security.Policy.PermissionRequestEvidence
System.Security.Policy.Publisher
System.Security.Policy.PublisherMembershipCondition
System.Security.Policy.Site
System.Security.Policy.SiteMembershipCondition
System.Security.Policy.StrongName
System.Security.Policy.StrongNameMembershipCondition
System.Security.Policy.UnionCodeGroup
System.Security.Policy.Url
System.Security.Policy.UrlMembershipCondition
System.Security.Policy.Zone
System.Security.Policy.ZoneMembershipCondition
System.Security.Principal.WindowsIdentity
System.Security.Principal.WindowsImpersonationContext
System.Security.Principal.WindowsPrincipal
System.Threading.CompressedStack
-15
View File
@@ -1,15 +0,0 @@
#!/bin/sh
MANAGED_CALLS=`gdb -silent $1 -pid $2 << EOF | awk '/.* in \?\? \(\)/ {printf("call print_method_from_ip(%s)\n", $2);}'
set height 0
thread apply all bt
quit
EOF`
gdb -silent $1 -pid $2 << EOF
set height 0
thread apply all bt
$MANAGED_CALLS
quit
EOF
+7 -33
View File
@@ -18,7 +18,7 @@
standard GNOME interfaces for easily creating reusable,
language independent components, controls and compound
documents. This technology is known as <a
href="http://developer.ximian.com/articles/whitepapers/bonobo">Bonobo</a>.
href="http://developer.ximian.com/tech/bonobo.html">Bonobo</a>.
Interfaces to Bonobo exist for C, Perl, Python, and
Java.
@@ -134,51 +134,25 @@
** What makes up Mono?
There are various pieces that make up Mono today:
There are various pieces that will make up Mono:
<ul>
* A C# compiler.
* The Virtual Execution System: that has the
* The Virtual Execution System: that will have the
Just-in-Time compiler, garbage collector, loader,
threading engine.
A byte code interpreter is provided for quickly
A byte code interpreter will be provided for quickly
porting Mono to new systems and debugging the JIT
purposes, but it is not intended to be the ideal
execution environment.
* An implemenation of the .NET class libraries:
Remoting, Reflection, Reflection.Emit, Xml, Xpath,
Xslt, Xml Serialization, Web Services support.
* An implemenation of the .NET class library.
* Cross platform class libraries for data access:
Postgress, MySQL, DB2, TDS, Sybase, Oracle, ODBC and
Gnome's GDA.
* Visual development tools.
* Unix class libraries: Mono.Posix
* Gnome-specific class libraries: The Gtk# family.
* A code pre-compiler to generate native code ahead of
time.
* Gtk# a toolkit to develop GNOME applications on Unix
and Windows.
* An implementation of the Remoting infrastructure in
.NET
</ul>
Other work-in-progress components:
<ul>
* A VB.NET compiler and JScript compilers are in the works.
* Web services on the server side.
* We are planning to include Remoting.CORBA as part of
Mono standard distribution.
* A CIL GCC frontend.
</ul>
** Why use GNOME components?
+1 -1
View File
@@ -17,7 +17,7 @@
easy-to-port runtime engine.
</ul>
We are using the Boehm conservative garbage collector.
We are using the Bohem conservative garbage collector.
The Mono runtime can be used as a stand-alone process, or it
can be <a href="embedded-api">embedded into applications</a> (see
-8
View File
@@ -51,14 +51,6 @@
</tr>
</table>
** Eclipse running with Mono
Zoltan Varga made the Java VM for .NET <a
href="http://www.ikvm.net">IKVM</a> run <a
href="http://www.eclipse.org">Eclipse</a>, the IBM Open Source IDE.
<a href="images/ikvm-screenshot.png"><img src="images/ikvm-screenshot-thumb.png"></a>
** Mono Basic
The Mono Basic compiler ships with the Mono distribution.
+49 -10
View File
@@ -24,7 +24,7 @@
<b>mcs/class/doc/TemplateTest.cs</b>
Save a copy of this file in the appropriate test subdirecty
(see below), and replace all the {text} markers with
(see below), and replace all the [text] markers with
appropriate code. Comments in the template are there to guide
you. You should also look at existing tests to see how other
people have written them.
@@ -41,22 +41,29 @@
the appropriate sub-directory under Test for the class you are
testing.
Once your test class is complete, you need to add it to the
AllTests.cs file in the same directory as your new test. Add a
call to "suite.AddTest()" passing the name of your new test
class's suite property as the parameter. You will see
examples in the AllTests.cs file, so just copy and paste
inside there.
Once all of that is done, you can do a 'make test' from the top mcs
directory. Your test class will be automagically included in the
build and the tests will be run along with all the others.
* Tips on writing Unit tests.
You should look at the <a href="http://nunit.org">NUnit documentation</a>,
as it is a fantastic product, and includes fantastic documentation,
but here are some tips for those of you who are already reading
You should look at the NUnit documentation, as it is a
fantastic product, and includes fantastic documentation, but
here are some tips for those of you who are already reading
this web page.
** Provide an unique error message for Assert()
Include an unique message for each Assert() so that when the assert
fails, it is trivial to locate it in the source. Otherwise, it may be
fails, it is trivial to locate the failing one. Otherwise, it may be
difficult to determine which part of the test is failing. A good way
to ensure unique messages is to use something like #A01, #A02 etc.
@@ -97,10 +104,43 @@
AssertEquals ("A01", myTicks[0], t1.Ticks);
</pre>
** Constructors
When writing your testcase, please make sure to provide a constructor
which takes no arguments:
<pre>
public class DateTimeTest : TestCase
{
public DateTimeTest() : base ("[MonoTests.System.DateTimeTest]") {}
public DateTimeTest (string name): base(name) {}
public static ITest Suite
{
get {
TestSuite suite = new TestSuite ();
return suite;
}
}
}
</pre>
** Namespace
Please keep the namespace within each test directory consistent - all
tests which are referenced in the same AllTests.cs must be in the same
namespace. Of course you can use subnamespaces as you like -
especially for subdirectories of your testsuite.
For instance, if your AllTests.cs is in namespace "MonoTests" and you
have a subdirectory called "System", you can put all the tests in that
dir into namespace "MonoTests.System".
** Test your test with the Microsoft runtime
If possible, try to run your testsuite with the Microsoft runtime on
.NET on Windows and make sure all tests in it pass. This is especially
Windows and make sure all tests in it pass. This is especially
important if you're writing a totally new testcase - without this
check you can never be sure that your testcase contains no bugs ....
@@ -111,10 +151,9 @@
result when run with the Microsoft runtime - either because there is a
bug in their runtime or something is misleading or wrong in their
documentation. In this case, please put a detailed description of the
problem to mcs/class/doc/API-notes and do also report it to the
<a href="mailing-lists">mailing list</a> - we'll forward this to the
Microsoft people from time to time to help them fix their documentation
and runtime.
problem to mcs/class/doc/API-notes and do also report it to the list -
we'll forward this to the Microsoft people from time to time to help
them fix their documentation and runtime.
** Unit tests.
+13 -18
View File
@@ -1,9 +1,6 @@
ifeq ($(findstring CYGWIN,$(shell uname)),)
CSC=mcs
RUN_MONO=mono
else
CSC=csc /nologo
endif
ROOT=C:/WINNT
CSCRIPT = $(ROOT)/system32/cscript.exe
CSC=csc
CORCOMPARE=../../../mcs/tools/corcompare
@@ -109,13 +106,13 @@ mono-beginning.xml: ../mono-beginning.xml
cp ../mono-beginning.xml .
deploy/index.rss: mono-rss.exe ../index
$(RUN_MONO) ./mono-rss.exe ../index deploy/index.rss
./mono-rss.exe ../index deploy/index.rss
mono-rss.exe: mono-rss.cs rss.cs
$(CSC) mono-rss.cs rss.cs
../team: render-team-page.exe team.xml
$(RUN_MONO) ./render-team-page.exe team.xml "../team"
./render-team-page.exe team.xml "../team"
render-team-page.exe: render-team-page.cs
$(CSC) render-team-page.cs
@@ -125,8 +122,8 @@ clean:
push:
cp -f $(NON_HTML_SOURCES) deploy
echo scp -P 2200 -r deploy/* www@www.go-mono.com:/web/cvsmodules/mono
(cd deploy; rsync --verbose --recursive --checksum --update --rsh='ssh' . www@www.go-mono.com:/web/cvsmodules/mono )
echo scp -P 2200 -r deploy/* www@www.ximian.com:/web/cvsmodules/mono
(cd deploy; rsync --verbose --recursive --checksum --update --rsh='ssh -p 2200' . www@www.ximian.com:/web/cvsmodules/mono )
push2:
scp -r deploy/* primates:public_html/xxx
@@ -135,12 +132,10 @@ $(OBJECTS): $(patsubst deploy/%.html,src/%.src, $(OBJECTS))
#.PRECIOUS: $(patsubst deploy/%.html,src/%.src, $(OBJECTS))
transform.exe: transform.cs
$(CSC) transform.cs
.PRECIOUS: src/%.src
src/%.src: ../% commands template.html.in #makefile
src/%.src: ../% commands makefile template.html.in
perl htmlify $< > $@
.PRECIOUS: ../class-status-%
@@ -149,20 +144,20 @@ src/%.src: ../% commands template.html.in #makefile
.PRECIOUS: src/%.html.in
src/%.html.in: src/%.xml transform.exe $(CORCOMPARE)/cormissing.xsl
$(RUN_MONO) ./transform.exe $< $(CORCOMPARE)/cormissing.xsl > $@
src/%.html.in: src/%.xml $(CORCOMPARE)/transform.js $(CORCOMPARE)/cormissing.xsl
$(CSCRIPT) /nologo $(CORCOMPARE)/transform.js $< $(CORCOMPARE)/cormissing.xsl > $@
.PRECIOUS: src/%.xml
src/%.xml: ../../../mcs/class/lib/%.dll $(CORCOMPARE)/CorCompare.exe
$(RUN_MONO) $(CORCOMPARE)/CorCompare.exe -x $@ $<
$(CORCOMPARE)/CorCompare.exe -x $@ $<
src/corlib.xml: ../../../mcs/class/lib/corlib_cmp.dll $(CORCOMPARE)/CorCompare.exe
$(RUN_MONO) $(CORCOMPARE)/CorCompare.exe -f corlib -ms mscorlib -x $@ $<
$(CORCOMPARE)/CorCompare.exe -f corlib -ms mscorlib -x $@ $<
src/System.Security.xml: ../../../mcs/class/lib/System.Security_cmp.dll $(CORCOMPARE)/CorCompare.exe
$(RUN_MONO) $(CORCOMPARE)/CorCompare.exe -f System.Security -ms System.Security -x $@ $<
$(CORCOMPARE)/CorCompare.exe -f System.Security -ms System.Security -x $@ $<
../class-status: ../class-status.in
cp -f $< $@
+4 -59
View File
@@ -12,34 +12,6 @@
<contributors xmlns="http://go-mono.org/team.xsd">
<contributor>
<name>
<first-name>Joel</first-name>
<last-name>Basson</last-name>
</name>
<e-mail>[email protected]</e-mail>
<image>none.png</image>
<location>Cape Town, South Africa</location>
<organization></organization>
<description>External Contributor</description>
<tasks>
<task>System.Windows.Forms Gtk</task>
</tasks>
</contributor>
<contributor>
<name>
@@ -915,13 +887,13 @@
</name>
<e-mail>justdandy43@hotmail.com</e-mail>
<e-mail>[email protected].com</e-mail>
<image>none.png</image>
<location>Richmond, Virginia, USA</location>
<location>Columbia, South Carolina, USA</location>
<organization>an insurance company</organization>
<organization>Unemployed</organization>
<description>Mono hacker</description>
@@ -983,7 +955,7 @@
<image>none.png</image>
<location>São Paulo</location>
<location>São Paulo</location>
<organization>WEBforAll.</organization>
@@ -1410,31 +1382,4 @@
</tasks>
</contributor>
<contributor>
<name>
<first-name>John</first-name>
<last-name>Luke</last-name>
</name>
<e-mail>[email protected]</e-mail>
<image>none.png</image>
<location>Daytona, FL</location>
<organization></organization>
<description>Contributor.</description>
<tasks>
<task>Gtk# Documentation.</task>
</tasks>
</contributor>
</contributors>
-20
View File
@@ -1,20 +0,0 @@
using System;
using System.Xml;
using System.Xml.Xsl;
namespace Transform
{
class Transform
{
public static void Main (string [] rgstrArgs)
{
XmlDocument xml = new XmlDocument ();
xml.Load (rgstrArgs [0]);
XslTransform xsl = new XslTransform ();
xsl.Load (rgstrArgs [1]);
xsl.Transform (xml, null, Console.Out);
}
}
}
-7
View File
@@ -27,13 +27,6 @@
* Win32/Wine edition.
Currently (May 21st, 2003) to get the Windows.Forms support
working, you need a Mono installation from CVS, and you need
to install Wine plus the <a
href="http://www.openlinksw.com">OpenLink patch</a>, and
define the environment variable "SWF" (export SWF=1 from your
shell).
<table>
<tr>
<td>
+11 -12
View File
@@ -56,20 +56,19 @@ leave: is simply translated into a branch to the target. If the leave
instruction is inside a finally block (but not inside another handler)
we call the finally handler before we branch to the target.
finally/endfinally, filter/endfilter: is translated into subroutine ending with
a "return" statement. The subroutine does not save EBP, because we need access
to the local variables of the enclosing method. Its is possible that
instructions inside those handlers modify the stack pointer, thus we save the
stack pointer at the start of the handler, and restore it at the end. We have
to use a "call" instruction to execute such finally handlers. This makes it
also possible to execute them inside the stack unwinding code. The exception
object for filters is passed in a local variable (cfg->exvar).
finally/endfinally: is translated into subroutine ending with a "return"
statement. The subroutine does not save EBP/ESP, because we need access to the
local variables of the enclosing method. We have to use a "call"
instruction to execute such finally handlers. This makes it possible to
execute them inside the stack unwinding code.
throw: we first save all regs into a sigcontext struct and then call the stack
unwinding code.
throw: we first save all regs into a sigcontext struct (we pass the
exception object in register ECX), and then call the stack unwinding
code.
catch handler: receives the exception object in ECX. They store that
object into a local variable, so that rethrow can access the object.
catch handler: catch hanlders are always called from the stack unwinding
code. The exception object is passed in a local variable (cfg->exvar).
gcc support for Exceptions
==========================
-349
View File
@@ -1,349 +0,0 @@
Mono JIT porting guide.
Paolo Molaro ([email protected])
* Introduction
This documents describes the process of porting the mono JIT
to a new CPU architecture. The new mono JIT has been designed
to make porting easier though at the same time enable the port
to take full advantage from the new architecture features and
instructions. Knowledge of the mini architecture (described in the
mini-doc.txt file) is a requirement for understanding this guide,
as well as an earlier document about porting the mono interpreter
(available on the web site).
There are six main areas that a port needs to implement to
have a fully-functional JIT for a given architecture:
1) instruction selection
2) native code emission
3) call conventions and register allocation
4) method trampolines
5) exception handling
6) minor helper methods
To take advantage of some not-so-common processor features (for example
conditional execution of instructions as may be found on ARM or ia64), it may
be needed to develop an high-level optimization, but doing so is not a
requirement for getting the JIT to work.
We'll see in more details each of the steps required, note, though,
that a new port may just as well start from a cut&paste of an existing
port to a similar architecture (for example from x86 to amd64, or from
powerpc to sparc).
The architecture specific code is split from the rest of the JIT,
for example the x86 specific code and data is all included in the
following files in the distribution:
mini-x86.h mini-x86.c
inssel-x86.brg
cpu-pentium.md
tramp-x86.c
exceptions-x86.c
I suggest a similar split for other architectures as well.
Note that this document is still incomplete: some sections are only
sketched and some are missing, but the important info to get a port
going is already described.
* Architecture-specific instructions and instruction selection.
The JIT already provides a set of instructions that can be easily
mapped to a great variety of different processor instructions.
Sometimes it may be necessary or advisable to add a new instruction
that represent more closely an instruction in the architecture.
Note that a mini instruction can be used to represent also a short
sequence of CPU low-level instructions, but note that each
instruction represents the minimum amount of code the instruction
scheduler will handle (i.e., the scheduler won't schedule the instructions
that compose the low-level sequence as individual instructions, but just
the whole sequence, as an indivisible block).
New instructions are created by adding a line in the mini-ops.h file,
assigning an opcode and a name. To specify the input and output for
the instruction, there are two different places, depending on the context
in which the instruction gets used.
If the instruction is used in the tree representation, the input and output
types are defined by the BURG rules in the *.brg files (the usual
non-terminals are 'reg' to represent a normal register, 'lreg' to
represent a register or two that hold a 64 bit value, freg for a
floating point register).
If an instruction is used as a low-level CPU instruction, the info
is specified in a machine description file. The description file is
processed by the genmdesc program to provide a data structure that
can be easily used from C code to query the needed info about the
instruction.
As an example, let's consider the add instruction for both x86 and ppc:
x86 version:
add: dest:i src1:i src2:i len:2 clob:1
ppc version:
add: dest:i src1:i src2:i len:4
Note that the instruction takes two input integer registers on both CPU,
but on x86 the first source register is clobbered (clob:1) and the length
in bytes of the instruction differs.
Note that integer adds and floating point adds use different opcodes, unlike
the IL language (64 bit add is done with two instructions on 32 bit architectures,
using a add that sets the carry and an add with carry).
A specific CPU port may assign any meaning to the clob field for an instruction
since the value will be processed in an arch-specific file anyway.
See the top of the existing cpu-pentium.md file for more info on other fields:
the info may or may not be applicable to a different CPU, in this latter case
the info can be ignored.
The code in mini.c together with the BURG rules in inssel.brg, inssel-float.brg
and inssel-long32.brg provides general purpose mappings from the tree representation
to a set of instructions that should be easily implemented in any architecture.
To allow for additional arch-specific functionality, an arch-specific BURG file
can be used: in this file arch-specific instructions can be selected that provide
better performance than the general instructions or that provide functionality
that is needed by the JIT but that cannot be expressed in a general enough way.
As an example, x86 has the special instruction "push" to make it easier to
implement the default call convention (passing arguments on the stack): almost
all the other architectures don't have such an instruction (and don't need it anyway),
so we added a special rule in the inssel-x86.brg file for it.
So, one of the first things needed in a port is to write a cpu-$(arch).md machine
description file and fill it with the needed info. As a start, only a few
instructions can be specified, like the ones required to do simple integer
operations. The default rules of the instruction selector will emit the common
instructions and so we're ready to go for the next step in porting the JIT.
*) Native code emission
Since the first step in porting mono to a new CPU is to port the interpreter,
there should be already a file that allows the emission of binary native code
in a buffer for the architecture. This file should be placed in the
mono/arch/$(arch)/
directory.
The bulk of the code emission happens in the mini-$(arch).c file, in a function
called mono_arch_output_basic_block (). This function takes a basic block, walks the
list of instructions in the block and emits the binary code for each.
Optionally a peephole optimization pass is done on the basic block, but this can be
left for later, when the port actually works.
This function is very simple, there is just a big switch on the instruction opcode
and in the corresponding case the functions or macros to emit the binary native code
are used. Note that in this function the lengths of the instructions are used to
determine if the buffer for the code needs enlarging.
To complete the code emission for a method, a few other functions need
implementing as well:
mono_arch_emit_prolog ()
mono_arch_emit_epilog ()
mono_arch_patch_code ()
mono_arch_emit_prolog () will emit the code to setup the stack frame for a method,
optionally call the callbacks used in profiling and tracing, and move the
arguments to their home location (in a caller-save register if the variable was
allocated to one, or in a stack location if the argument was passed in a volatile
register and wasn't allocated a non-volatile one). caller-save registers used by the
function are saved in the prolog as well.
mono_arch_emit_epilog () will emit the code needed to return from the function,
optionally calling the profiling or tracing callbacks. At this point the basic blocks
or the code that was moved out of the normal flow for the function can be emitted
as well (this is usually done to provide better info for the static branch predictor).
In the epilog, caller-save registers are restored if they were used.
Note that, to help exception handling and stack unwinding, when there is a transition
from managed to unmanaged code, some special processing needs to be done (basically,
saving all the registers and setting up the links in the Last Managed Frame
structure).
When the epilog has been emitted, the upper level code arranges for the buffer of
memory that contains the native code to be copied in an area of executable memory
and at this point, instructions that use relative addressing need to be patched
to have the right offsets: this work is done by mono_arch_patch_code ().
* Call conventions and register allocation
To account for the differences in the call conventions, a few functions need to
be implemented.
mono_arch_allocate_vars () assigns to both arguments and local variables
the offset relative to the frame register where they are stored, dead
variables are simply discarded. The total amount of stack needed is calculated.
mono_arch_call_opcode () is the function that more closely deals with the call
convention on a given system. For each argument to a function call, an instruction
is created that actually puts the argument where needed, be it the stack or a
specific register. This function can also re-arrange th order of evaluation
when multiple arguments are involved if needed (like, on x86 arguments are pushed
on the stack in reverse order). The function needs to carefully take into accounts
platform specific issues, like how structures are returned as well as the
differences in size and/or alignment of managed and corresponding unmanaged
structures.
The other chunk of code that needs to deal with the call convention and other
specifics of a CPU, is the local register allocator, implemented in a function
named mono_arch_local_regalloc (). The local allocator deals with a basic block
at a time and basically just allocates registers for temporary
values during expression evaluation, spilling and unspilling as necessary.
The local allocator needs to take into account clobbering information, both
during simple instructions and during function calls and it needs to deal
with other architecture-specific weirdnesses, like instructions that take
inputs only in specific registers or output only is some.
Some effort will be put later in moving most of the local register allocator to
a common file so that the code can be shared more for similar, risc-like CPUs.
The register allocator does a first pass on the instructions in a block, collecting
liveness information and in a backward pass on the same list performs the
actual register allocation, inserting the instructions needed to spill values,
if necessary.
When this part of code is implemented, some testing can be done with the generated
code for the new architecture. Most helpful is the use of the --regression
command line switch to run the regression tests (basic.cs, for example).
Note that the JIT will try to initialize the runtime, but it may not be able yet to
compile and execute complex code: commenting most of the code in the mini_init()
function in mini.c is needed to let the JIT just compile the regression tests.
Also, using multiple -v switches on the command line makes the JIT dump an
increasing amount of information during compilation.
* Method trampolines
To get better startup performance, the JIT actually compiles a method only when
needed. To achieve this, when a call to a method is compiled, we actually emit a
call to a magic trampoline. The magic trampoline is a function written in assembly
that invokes the compiler to compile the given method and jumps to the newly compiled
code, ensuring the arguments it received are passed correctly to the actual method.
Before jumping to the new code, though, the magic trampoline takes care of patching
the call site so that next time the call will go directly to the method instead of the
trampoline. How does this all work?
mono_arch_create_jit_trampoline () creates a small function that just
preserves the arguments passed to it and adds an additional argument (the method
to compile) before calling the generic trampoline. This small function is called
the specific trampoline, because it is method-specific (the method to compile
is hard-code in the instruction stream).
The generic trampoline saves all the arguments that could get clobbered
and calls a C function that will do two things:
*) actually call the JIT to compile the method
*) identify the calling code so that it can be patched to call directly
the actual method
If the 'this' argument to a method is a boxed valuetype that is passed to
a method that expects just a pointer to the data, an additional unboxing
trampoline will need to be inserted as well.
* Exception handling
Exception handling is likely the most difficult part of the port, as it needs
to deal with unwinding (both managed and unmanaged code) and calling
catch and filter blocks. It also needs to deal with signals, because mono
takes advantage of the MMU in the CPU and of the operation system to
handle dereferences of the NULL pointer. Some of the function needed
to implement the mechanisms are:
mono_arch_get_throw_exception () returns a function that takes an exception object
and invokes an arch-specific function that will enter the exception processing.
To do so, all the relevant registers need to be saved and passed on.
mono_arch_handle_exception () this function takes the exception thrown and
a context that describes the state of the CPU at the time the exception was
thrown. The function needs to implement the exception handling mechanism,
so it makes a search for an handler for the exception and if none is found,
it follows the unhandled exception path (that can print a trace and exit or
just abort the current thread). The difficulty here is to unwind the stack
correctly, by restoring the register state at each call site in the call chain,
calling finally, filters and handler blocks while doing so.
As part of exception handling a couple of internal calls need to be implemented
as well.
ves_icall_get_frame_info () returns info about a specific frame.
mono_jit_walk_stack () walks the stack and calls a callback with info for
each frame found.
ves_icall_get_trace () return an array of StackFrame objects.
** Code generation for filter/finally handlers
Filter and finally handlers are called from 2 different locations:
1.) from within the method containing the exception clauses
2.) from the stack unwinding code
To make this possible we implement them like subroutines, ending with a
"return" statement. The subroutine does not save the base pointer, because we
need access to the local variables of the enclosing method. Its is possible
that instructions inside those handlers modify the stack pointer, thus we save
the stack pointer at the start of the handler, and restore it at the end. We
have to use a "call" instruction to execute such finally handlers.
The MIR code for filter and finally handlers looks like:
OP_START_HANDLER
...
OP_END_FINALLY | OP_ENDFILTER(reg)
OP_START_HANDLER: should save the stack pointer somewhere
OP_END_FINALLY: restores the stack pointers and returns.
OP_ENDFILTER (reg): restores the stack pointers and returns the value in "reg".
** Calling finally/filter handlers
There is a special opcode to call those handler, its called OP_CALL_HANDLER. It
simple emits a call instruction.
Its a bit more complex to call handler from outside (in the stack unwinding
code), because we have to restore the whole context of the method first. After that
we simply emit a call instruction to invoke the handler. Its usually
possible to use the same code to call filter and finally handlers (see
arch_get_call_filter).
** Calling catch handlers
Catch handlers are always called from the stack unwinding code. Unlike finally clauses
or filters, catch handler never return. Instead we simply restore the whole
context, and restart execution at the catch handler.
** Passing Exception objects to catch handlers and filters.
We use a local variable to store exception objects. The stack unwinding code
must store the exception object into this variable before calling catch handler
or filter.
* Minor helper methods
A few minor helper methods are referenced from the arch-independent code.
Some of them are:
*) mono_arch_cpu_optimizations ()
This function returns a mask of optimizations that should be enabled for the
current CPU and a mask of optimizations that should be excluded, instead.
*) mono_arch_regname ()
Returns the name for a numeric register.
*) mono_arch_get_allocatable_int_vars ()
Returns a list of variables that can be allocated to the integer registers
in the current architecture.
*) mono_arch_get_global_int_regs ()
Returns a list of caller-save registers that can be used to allocate variables
in the current method.
*) mono_arch_instrument_mem_needs ()
*) mono_arch_instrument_prolog ()
*) mono_arch_instrument_epilog ()
Functions needed to implement the profiling interface.
* Writing regression tests
Regression tests for the JIT should be written for any bug found in the JIT
in one of the *.cs files in the mini directory. Eventually all the operations
of the JIT should be tested (including the ones that get selected only when
some specific optimization is enabled).
* Platform specific optimizations
An example of a platform-specific optimization is the peephole optimization:
we look at a small window of code at a time and we replace one or more
instructions with others that perform better for the given architecture or CPU.
+26 -24
View File
@@ -10,7 +10,7 @@
..
.TH Mono "Mono 1.0"
.SH NAME
mono \- Mono's ECMA-CLI native code generator (Just-in-Time and Ahead-of-Time)
mono \- Mono's code ECMA-CLI code generator (Just-in-Time and Ahead-of-Time)
.SH SYNOPSIS
.PP
.B mono [options] file [arguments...]
@@ -85,11 +85,9 @@ The following optimizations are implemented:
cmov Conditional moves
shared Emit per-domain code
sched Instruction scheduling
intrins Intrinsic method implementations
instrins Intrinsic method implementations
tailc Tail recursion and tail calls
loop Loop related optimizations
leaf Leaf procedures optimizations
profile Use profiling information
.fi
.Sp
For example, to enable all the optimization but dead code
@@ -97,27 +95,41 @@ elimination and inlining, you can use:
.nf
-O=all,-deadce,-inline
.fi
.SH DEVELOPMENT OPTIONS
.TP
.I "-V", "--version"
Prints JIT version information.
.I "--break method"
Inserts a breakpoint before the method whose name is `method'
(namespace.class:methodname). Use `Main' as method name to insert a
breakpoint on the application's main method.
.TP
.I "--breakonex"
Inserts a breakpoint on exceptions. This allows you to debug your
application with a native debugger when an exception is thrown.
.TP
.I "--coverage"
Performs coverage analysis on the underlying IL code.
.TP
.I "--trace"
Shows method names as they are invoked.
.SH DEVELOPMENT OPTIONS
The following options are used to help when developing a JITed application.
The following options are used to debug a JITed application. They're
only useful when running the JIT in a debugger:
.TP
.I "--debug"
Turns on the debugging mode in the runtime. If an assembly was
compiled with debugging information, it will produce line number
information for stack traces.
.TP
.I "--profile[=profiler[:profiler_args]]"
.I "--profile"
Instructs the runtime to collect profiling information about execution
times and memory allocation, and dump it at the end of the execution.
If a profiler is not specified, the default profiler is used. profiler_args
is a profiler-specific string of options for the profiler itself.
.SH JIT MAINTAINER OPTIONS
.SH MAINTAINER OPTIONS
The maintainer options are only used by those developing the runtime
itself, and not typically of interest to runtime users or developers.
.TP
@@ -155,20 +167,10 @@ compiled. This is used for testing the code generator performance.
.TP
.I "-v", "--verbose"
Increases the verbosity level, each time it is listed, increases the
verbosity level to include more information (including, for example,
a disassembly of the native code produced, code selector info etc.).
verbosity level to include more information.
.TP
.I "--break method"
Inserts a breakpoint before the method whose name is `method'
(namespace.class:methodname). Use `Main' as method name to insert a
breakpoint on the application's main method.
.TP
.I "--breakonex"
Inserts a breakpoint on exceptions. This allows you to debug your
application with a native debugger when an exception is thrown.
.TP
.I "--trace"
Shows method names as they are invoked.
.I "-V", "--version"
Prints JIT version information.
.SH ENVIRONMENT VARIABLES
-481
View File
@@ -1,481 +0,0 @@
GNU LIBRARY GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the library GPL. It is
numbered 2 because it goes with version 2 of the ordinary GPL.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Library General Public License, applies to some
specially designated Free Software Foundation software, and to any
other libraries whose authors decide to use it. You can use it for
your libraries, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if
you distribute copies of the library, or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link a program with the library, you must provide
complete object files to the recipients so that they can relink them
with the library, after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
Our method of protecting your rights has two steps: (1) copyright
the library, and (2) offer you this license which gives you legal
permission to copy, distribute and/or modify the library.
Also, for each distributor's protection, we want to make certain
that everyone understands that there is no warranty for this free
library. If the library is modified by someone else and passed on, we
want its recipients to know that what they have is not the original
version, so that any problems introduced by others will not reflect on
the original authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that companies distributing free
software will individually obtain patent licenses, thus in effect
transforming the program into proprietary software. To prevent this,
we have made it clear that any patent must be licensed for everyone's
free use or not licensed at all.
Most GNU software, including some libraries, is covered by the ordinary
GNU General Public License, which was designed for utility programs. This
license, the GNU Library General Public License, applies to certain
designated libraries. This license is quite different from the ordinary
one; be sure to read it in full, and don't assume that anything in it is
the same as in the ordinary license.
The reason we have a separate public license for some libraries is that
they blur the distinction we usually make between modifying or adding to a
program and simply using it. Linking a program with a library, without
changing the library, is in some sense simply using the library, and is
analogous to running a utility program or application program. However, in
a textual and legal sense, the linked executable is a combined work, a
derivative of the original library, and the ordinary General Public License
treats it as such.
Because of this blurred distinction, using the ordinary General
Public License for libraries did not effectively promote software
sharing, because most developers did not use the libraries. We
concluded that weaker conditions might promote sharing better.
However, unrestricted linking of non-free programs would deprive the
users of those programs of all benefit from the free status of the
libraries themselves. This Library General Public License is intended to
permit developers of non-free programs to use free libraries, while
preserving your freedom as a user of such programs to change the free
libraries that are incorporated in them. (We have not seen how to achieve
this as regards changes in header files, but we have achieved it as regards
changes in the actual functions of the Library.) The hope is that this
will lead to faster development of free libraries.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, while the latter only
works together with the library.
Note that it is possible for a library to be covered by the ordinary
General Public License rather than by this special one.
GNU LIBRARY GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library which
contains a notice placed by the copyright holder or other authorized
party saying it may be distributed under the terms of this Library
General Public License (also called "this License"). Each licensee is
addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also compile or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
c) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
d) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the source code distributed need not include anything that is normally
distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Library General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!
-5
View File
@@ -1,8 +1,3 @@
2003-05-10 Gonzalo Paniagua Javier <[email protected]>
* makefile:
* makefile.gnu: don't use -C when running make.
2003-05-05 Ben Maurer <[email protected]>
* AUTHORS: Added self.
-29
View File
@@ -1,29 +0,0 @@
The Mono code is licensed under various different licenses.
GNU GPL: details avaliable in the file LICENSE.GPL
GNU LGPL: details available in the file LICENSE.LGPL
MIT X11: text available in the file MIT.X11
For your convenience copies of the GNU GPL and GNU LGPL are
located in the file COPYING and COPYING.LIB.
* Class Libraries:
All of the core classes licensed under the terms of
the MIT X11 license.
Third party libraries that we distribute for
convenience reasons are distributed under their own
terms (all of them allow development of proprietary
applications with them).
Third party libraries include: ByteFX.Data,
ICSharpCode.SharpZipLib, Npgsql.
* Mono C# compiler: GNU GPL
* Mono Basic compiler: GNU GPL.
* Various tools in the `tools' directory: GNU GPL.
-15
View File
@@ -1,15 +0,0 @@
Mono compilers and tools.
Copyright (C) 2001, 2002, 2003, Ximian and contributors.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation;
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-15
View File
@@ -1,15 +0,0 @@
Mono class libraries
Copyright (C) Mono project (authors listed in individual ChangeLog entries)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-21
View File
@@ -1,21 +0,0 @@
Copyright (c) 2001, 2002, 2003 Ximian, Inc and the individuals listed
on the ChangeLog entries.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,8 +1,3 @@
2003-05-19 Atsushi Enomoto <[email protected]>
* RdpPattern.cs : Some method name capitalization.
Fixed RdpInterleave.StartTagOpenDeriv() which is logically incorrect.
2003-05-05 Atsushi Enomoto <[email protected]>
* RdpPattern.cs : added RdpAttribute.expandRef(). UnresolvedRef had
@@ -166,12 +166,12 @@ namespace Commons.Xml.Relaxng.Derivative
throw new InvalidOperationException ();
}
internal protected virtual RdpPattern ExpandRef (Hashtable defs)
internal virtual RdpPattern expandRef (Hashtable defs)
{
return this;
}
internal protected virtual RdpPattern ReduceEmptyAndNotAllowed (ref bool result, Hashtable visited)
internal virtual RdpPattern reduceEmptyAndNotAllowed (ref bool result, Hashtable visited)
{
return this;
}
@@ -481,16 +481,16 @@ namespace Commons.Xml.Relaxng.Derivative
}
bool expanded;
internal protected override RdpPattern ExpandRef (Hashtable defs)
internal override RdpPattern expandRef (Hashtable defs)
{
if (!expanded) {
l = l.ExpandRef (defs);
r = r.ExpandRef (defs);
l = l.expandRef (defs);
r = r.expandRef (defs);
}
return this;
}
internal protected override RdpPattern ReduceEmptyAndNotAllowed (ref bool result, Hashtable visited)
internal override RdpPattern reduceEmptyAndNotAllowed (ref bool result, Hashtable visited)
{
if (visited.Contains (this))
return this;
@@ -502,13 +502,13 @@ namespace Commons.Xml.Relaxng.Derivative
return RdpNotAllowed.Instance;
} else if (LValue.PatternType == RngPatternType.Empty) {
result = true;
return RValue.ReduceEmptyAndNotAllowed (ref result, visited);
return RValue.reduceEmptyAndNotAllowed (ref result, visited);
} else if (RValue.PatternType == RngPatternType.Empty) {
result = true;
return LValue.ReduceEmptyAndNotAllowed (ref result, visited);
return LValue.reduceEmptyAndNotAllowed (ref result, visited);
} else {
LValue = LValue.ReduceEmptyAndNotAllowed (ref result, visited);
RValue = RValue.ReduceEmptyAndNotAllowed (ref result, visited);
LValue = LValue.reduceEmptyAndNotAllowed (ref result, visited);
RValue = RValue.reduceEmptyAndNotAllowed (ref result, visited);
return this;
}
}
@@ -532,7 +532,7 @@ namespace Commons.Xml.Relaxng.Derivative
}
}
internal protected override RdpPattern ReduceEmptyAndNotAllowed (ref bool result, Hashtable visited)
internal override RdpPattern reduceEmptyAndNotAllowed (ref bool result, Hashtable visited)
{
if (visited.Contains (this))
return this;
@@ -544,22 +544,22 @@ namespace Commons.Xml.Relaxng.Derivative
return RdpNotAllowed.Instance;
} else if (LValue.PatternType == RngPatternType.NotAllowed) {
result = true;
return RValue.ReduceEmptyAndNotAllowed (ref result, visited);
return RValue.reduceEmptyAndNotAllowed (ref result, visited);
} else if (RValue.PatternType == RngPatternType.NotAllowed) {
result = true;
return LValue.ReduceEmptyAndNotAllowed (ref result, visited);
return LValue.reduceEmptyAndNotAllowed (ref result, visited);
} else if (LValue.PatternType == RngPatternType.Empty &&
RValue.PatternType == RngPatternType.Empty) {
result = true;
return RdpEmpty.Instance;
} else if (RValue.PatternType == RngPatternType.Empty) {
result = true;
RValue = LValue.ReduceEmptyAndNotAllowed (ref result, visited);
RValue = LValue.reduceEmptyAndNotAllowed (ref result, visited);
LValue = RdpEmpty.Instance;
return this;
} else {
LValue = LValue.ReduceEmptyAndNotAllowed (ref result, visited);
RValue = RValue.ReduceEmptyAndNotAllowed (ref result, visited);
LValue = LValue.reduceEmptyAndNotAllowed (ref result, visited);
RValue = RValue.reduceEmptyAndNotAllowed (ref result, visited);
return this;
}
}
@@ -637,7 +637,7 @@ namespace Commons.Xml.Relaxng.Derivative
}
}
internal protected override RdpPattern ReduceEmptyAndNotAllowed (ref bool result, Hashtable visited)
internal override RdpPattern reduceEmptyAndNotAllowed (ref bool result, Hashtable visited)
{
if (visited.Contains (this))
return this;
@@ -648,8 +648,8 @@ namespace Commons.Xml.Relaxng.Derivative
result = true;
return RdpNotAllowed.Instance;
} else {
LValue = LValue.ReduceEmptyAndNotAllowed (ref result, visited);
RValue = RValue.ReduceEmptyAndNotAllowed (ref result, visited);
LValue = LValue.reduceEmptyAndNotAllowed (ref result, visited);
RValue = RValue.reduceEmptyAndNotAllowed (ref result, visited);
return this;
}
}
@@ -667,8 +667,11 @@ namespace Commons.Xml.Relaxng.Derivative
RdpPattern handledL = LValue.StartTagOpenDeriv (name, ns);
RdpPattern handledR = RValue.StartTagOpenDeriv (name, ns);
RdpFlip flipL = new RdpFlip (new RdpBinaryFunction (RdpUtil.Interleave), RValue);
// FIXME: It is not flip in fact, but there are no proper class ;-(
RdpFlip flipR = new RdpFlip (new RdpBinaryFunction (RdpUtil.Interleave), handledR);
RdpPattern choiceL = handledL.ApplyAfter (new RdpApplyAfterHandler (flipL.Apply));
RdpPattern choiceR = handledR.ApplyAfter (new RdpApplyAfterHandler (LValue.Interleave));
RdpPattern choiceR = LValue.ApplyAfter (new RdpApplyAfterHandler (flipR.Apply));
return choiceL.Choice (choiceR);
}
@@ -790,10 +793,10 @@ namespace Commons.Xml.Relaxng.Derivative
RdpPattern child;
bool isExpanded;
internal protected override RdpPattern ExpandRef (Hashtable defs)
internal override RdpPattern expandRef (Hashtable defs)
{
if (!isExpanded)
child = child.ExpandRef (defs);
child = child.expandRef (defs);
return this;
}
@@ -820,7 +823,7 @@ namespace Commons.Xml.Relaxng.Derivative
get { return Child.Nullable; }
}
internal protected override RdpPattern ReduceEmptyAndNotAllowed (ref bool result, Hashtable visited)
internal override RdpPattern reduceEmptyAndNotAllowed (ref bool result, Hashtable visited)
{
if (visited.Contains (this))
return this;
@@ -832,7 +835,7 @@ namespace Commons.Xml.Relaxng.Derivative
} else if (Child.PatternType == RngPatternType.Empty)
return RdpEmpty.Instance;
else {
Child = Child.ReduceEmptyAndNotAllowed (ref result, visited);
Child = Child.reduceEmptyAndNotAllowed (ref result, visited);
return this;
}
}
@@ -896,7 +899,7 @@ namespace Commons.Xml.Relaxng.Derivative
{
}
internal protected override RdpPattern ReduceEmptyAndNotAllowed (ref bool result, Hashtable visited)
internal override RdpPattern reduceEmptyAndNotAllowed (ref bool result, Hashtable visited)
{
if (visited.Contains (this))
return this;
@@ -906,7 +909,7 @@ namespace Commons.Xml.Relaxng.Derivative
result = true;
return RdpNotAllowed.Instance;
} else {
Child = Child.ReduceEmptyAndNotAllowed (ref result, visited);
Child = Child.reduceEmptyAndNotAllowed (ref result, visited);
return this;
}
}
@@ -999,7 +1002,7 @@ namespace Commons.Xml.Relaxng.Derivative
set { except = value; }
}
internal protected override RdpPattern ReduceEmptyAndNotAllowed (ref bool result, Hashtable visited)
internal override RdpPattern reduceEmptyAndNotAllowed (ref bool result, Hashtable visited)
{
if (visited.Contains (this))
return this;
@@ -1009,7 +1012,7 @@ namespace Commons.Xml.Relaxng.Derivative
result = true;
return new RdpData (this.Datatype, this.ParamList);
} else {
except = except.ReduceEmptyAndNotAllowed (ref result, visited);
except = except.reduceEmptyAndNotAllowed (ref result, visited);
return this;
}
}
@@ -1103,16 +1106,16 @@ namespace Commons.Xml.Relaxng.Derivative
}
bool isExpanded;
internal protected override RdpPattern ExpandRef (Hashtable defs)
internal override RdpPattern expandRef (Hashtable defs)
{
if (!isExpanded) {
isExpanded = true;
children = children.ExpandRef (defs);
children = children.expandRef (defs);
}
return this;
}
internal protected override RdpPattern ReduceEmptyAndNotAllowed (ref bool result, Hashtable visited)
internal override RdpPattern reduceEmptyAndNotAllowed (ref bool result, Hashtable visited)
{
if (visited.Contains (this))
return this;
@@ -1122,7 +1125,7 @@ namespace Commons.Xml.Relaxng.Derivative
result = true;
return RdpNotAllowed.Instance;
} else {
children = children.ReduceEmptyAndNotAllowed (ref result, visited);
children = children.reduceEmptyAndNotAllowed (ref result, visited);
return this;
}
}
@@ -1188,22 +1191,22 @@ namespace Commons.Xml.Relaxng.Derivative
}
bool isExpanded;
internal protected override RdpPattern ExpandRef (Hashtable defs)
internal override RdpPattern expandRef (Hashtable defs)
{
if (!isExpanded) {
isExpanded = true;
children = children.ExpandRef (defs);
children = children.expandRef (defs);
}
return this;
}
internal protected override RdpPattern ReduceEmptyAndNotAllowed (ref bool result, Hashtable visited)
internal override RdpPattern reduceEmptyAndNotAllowed (ref bool result, Hashtable visited)
{
if (visited.Contains (this))
return this;
visited.Add (this, this);
children = children.ReduceEmptyAndNotAllowed (ref result, visited);
children = children.reduceEmptyAndNotAllowed (ref result, visited);
return this;
}
@@ -1,21 +1,3 @@
2003-05-19 Atsushi Enomoto <[email protected]>
* RelaxngReader.cs :
+ Now skips immaterial content correctly.
+ Removed MoveToContent().
+ Trimming attribute values and names.
+ Fixed ReadNameClassChoice(), ReadNameClassExcept(),
ReadPatternExcept (). They require one or more contents.
+ QName resolver fix.
+ ReadListPattern() failed to read actual content.
* RelaxngValidatingReader.cs :
+ Fixed incorrect error message.
+ Fixed incorrect attribute namespace handling.
* RngGrammar.cs : Some simplification stuff fix.
Support for illegal recursion check.
* RngNameClass.cs : fixed RngNsName ctor() (argument not passed).
* RngPattern.cs : fixed ParentRef.Compile() (was treated same as Ref).
2003-05-05 Atsushi Enomoto <[email protected]>
* RelaxngReader.cs : ReadExternalRef() hadn't resolved base uri.
@@ -15,20 +15,7 @@ namespace Commons.Xml.Relaxng
{
public class RelaxngReader : XmlDefaultReader
{
// static members.
static RngPattern relaxngGrammar;
static XmlReader relaxngXmlReader;
static RelaxngReader ()
{
// relaxngXmlReader = new XmlTextReader ("relaxng.rng");
// relaxngGrammar = RngPattern.Read (relaxngXmlReader);
}
public static string RngNS = "http://relaxng.org/ns/structure/1.0";
// public static RngPattern RelaxngGrammar {
// get { return relaxngGrammar; }
// }
// fields
Stack nsStack = new Stack ();
@@ -41,7 +28,6 @@ namespace Commons.Xml.Relaxng
}
public RelaxngReader (XmlReader reader, string ns)
// : base (reader == relaxngXmlReader ? reader : new RelaxngValidatingReader (reader, relaxngGrammar))
: base (reader)
{
nsStack.Push (ns == null ? "" : ns);
@@ -55,14 +41,10 @@ namespace Commons.Xml.Relaxng
// public
public override bool Read ()
{
bool skipRead = false;
bool b = false;
bool loop = true;
do {
if (!skipRead)
b = Reader.Read ();
else
skipRead = false;
b = Reader.Read ();
switch (NodeType) {
case XmlNodeType.ProcessingInstruction:
case XmlNodeType.Comment:
@@ -79,11 +61,9 @@ namespace Commons.Xml.Relaxng
break;
default:
if (NamespaceURI != RngNS) {
Reader.Skip ();
skipRead = true;
continue;
}
else
loop = false;
loop = false;
break;
}
} while (b && loop);
@@ -92,12 +72,12 @@ namespace Commons.Xml.Relaxng
case XmlNodeType.Element:
if (!IsEmptyElement) {
if (MoveToAttribute ("ns"))
nsStack.Push (Value.Trim ());
nsStack.Push (Value);
else
nsStack.Push (nsStack.Peek ());
if (MoveToAttribute ("datatypeLibrary"))
datatypeLibraryStack.Push (Value.Trim ());
datatypeLibraryStack.Push (Value);
else
datatypeLibraryStack.Push (datatypeLibraryStack.Peek ());
MoveToElement ();
@@ -111,7 +91,6 @@ namespace Commons.Xml.Relaxng
return b;
}
/*
public override XmlNodeType MoveToContent ()
{
MoveToElement ();
@@ -130,7 +109,6 @@ namespace Commons.Xml.Relaxng
}
return NodeType;
}
*/
// Properties
@@ -166,7 +144,7 @@ namespace Commons.Xml.Relaxng
RngStart s = new RngStart ();
expect ("start");
if (MoveToAttribute ("combine")) {
s.Combine = Value.Trim ();
s.Combine = Value;
if (s.Combine != "choice" && s.Combine != "interleave")
throw new RngException ("Invalid combine attribute: " + s.Combine);
}
@@ -178,17 +156,11 @@ namespace Commons.Xml.Relaxng
return s;
}
private string GetSpaceStrippedAttribute (string name)
{
string v = GetAttribute (name);
return v != null ? v.Trim () : null;
}
public RngDefine ReadDefine ()
{
RngDefine def = new RngDefine ();
expect ("define");
def.Name = GetSpaceStrippedAttribute ("name");
def.Name = GetAttribute ("name");
Read ();
while (NodeType == XmlNodeType.Element)
@@ -201,8 +173,8 @@ namespace Commons.Xml.Relaxng
{
RngParam p = new RngParam ();
expect ("param");
p.Name = GetSpaceStrippedAttribute ("name");
p.Value = ReadString ().Trim ();
p.Name = GetAttribute ("name");
p.Value = ReadString ();
expectEnd ("param");
return p;
}
@@ -225,7 +197,7 @@ namespace Commons.Xml.Relaxng
public RngName ReadNameClassName ()
{
string name = ReadString ().Trim ();
string name = ReadString ();
RngName rName = resolvedName (name);
expectEnd ("name");
return rName;
@@ -255,7 +227,7 @@ namespace Commons.Xml.Relaxng
public RngNsName ReadNameClassNsName ()
{
RngNsName nn = new RngNsName (this.NS);
RngNsName nn = new RngNsName ();
if (!IsEmptyElement) {
Read ();
if (NodeType == XmlNodeType.EndElement) {
@@ -275,16 +247,8 @@ namespace Commons.Xml.Relaxng
public RngNameChoice ReadNameClassChoice ()
{
RngNameChoice nc = new RngNameChoice ();
if (IsEmptyElement)
throw new RngException ("Name choice must have at least one name class.");
Read ();
while (NodeType != XmlNodeType.EndElement) {
while (NodeType == XmlNodeType.EndElement)
nc.Children.Add (ReadNameClass ());
}
if (nc.Children.Count == 0)
throw new RngException ("Name choice must have at least one name class.");
expectEnd ("choice");
return nc;
}
@@ -292,15 +256,8 @@ namespace Commons.Xml.Relaxng
public RngExceptNameClass ReadNameClassExcept ()
{
RngExceptNameClass x = new RngExceptNameClass ();
if (IsEmptyElement)
throw new RngException ("Name choice must have at least one name class.");
Read ();
while (NodeType != XmlNodeType.EndElement)
while (NodeType == XmlNodeType.EndElement)
x.Names.Add (ReadNameClass ());
if (x.Names.Count == 0)
throw new RngException ("Name choice must have at least one name class.");
expectEnd ("except");
return x;
}
@@ -373,14 +330,8 @@ namespace Commons.Xml.Relaxng
public RngExcept ReadPatternExcept ()
{
RngExcept x = new RngExcept ();
if (IsEmptyElement)
throw new RngException ("'except' must have at least one pattern.");
Read ();
while (NodeType != XmlNodeType.EndElement)
while (NodeType == XmlNodeType.EndElement)
x.Patterns.Add (ReadPattern ());
if (x.Patterns.Count == 0)
throw new RngException ("'except' must have at least one pattern.");
expectEnd ("except");
return x;
}
@@ -389,7 +340,7 @@ namespace Commons.Xml.Relaxng
{
RngInclude i = new RngInclude ();
expect ("include");
string href = GetSpaceStrippedAttribute ("href");
string href = GetAttribute ("href");
i.Href = Util.ResolveUri (BaseURI, href);
if (!IsEmptyElement) {
Read ();
@@ -443,7 +394,7 @@ namespace Commons.Xml.Relaxng
private RngName resolvedName (string nameSpec)
{
int colonAt = nameSpec.IndexOf (':');
string prefix = (colonAt < 0) ? "" : nameSpec.Substring (0, colonAt);
string prefix = (colonAt < 0) ? "" : nameSpec.Substring (0, colonAt - 1);
string local = (colonAt < 0) ? nameSpec : nameSpec.Substring (colonAt + 1, nameSpec.Length - colonAt - 1);
string uri = NS;
@@ -461,7 +412,7 @@ namespace Commons.Xml.Relaxng
// try to get name from attribute.
if (MoveToAttribute ("name")) {
el.NameClass = resolvedName (Value.Trim ());
el.NameClass = resolvedName (Value);
}
MoveToElement ();
Read ();
@@ -484,7 +435,7 @@ namespace Commons.Xml.Relaxng
// try to get name from attribute.
if (MoveToAttribute ("name"))
attr.NameClass = resolvedName (Value.Trim ());
attr.NameClass = resolvedName (Value);
MoveToElement ();
if (!IsEmptyElement) {
@@ -516,7 +467,7 @@ namespace Commons.Xml.Relaxng
{
RngRef r = new RngRef ();
expect ("ref");
r.Name = GetSpaceStrippedAttribute ("name");
r.Name = GetAttribute ("name");
if (!IsEmptyElement) {
Read ();
expectEnd ("ref");
@@ -530,7 +481,7 @@ namespace Commons.Xml.Relaxng
{
RngExternalRef r = new RngExternalRef ();
expect ("externalRef");
string href = GetSpaceStrippedAttribute ("href");
string href = GetAttribute ("href");
r.Href = Util.ResolveUri (BaseURI, href);
r.NSContext = NS;
if (!IsEmptyElement) {
@@ -546,7 +497,7 @@ namespace Commons.Xml.Relaxng
{
RngParentRef r = new RngParentRef ();
expect ("parentRef");
r.Name = GetSpaceStrippedAttribute ("name");
r.Name = GetAttribute ("name");
if (!IsEmptyElement) {
Read ();
expectEnd ("parentRef");
@@ -587,7 +538,7 @@ namespace Commons.Xml.Relaxng
RngData data = new RngData ();
expect ("data");
data.Type = GetSpaceStrippedAttribute ("type");
data.Type = GetAttribute ("type");
data.DatatypeLibrary = DatatypeLibrary;
if (!IsEmptyElement) {
@@ -609,15 +560,14 @@ namespace Commons.Xml.Relaxng
RngValue v = new RngValue ();
expect ("value");
if (MoveToAttribute ("type")) {
v.Type = Value.Trim ();
v.Type = Value;
v.DatatypeLibrary = DatatypeLibrary;
} else {
v.Type = "token";
v.DatatypeLibrary = "";
}
v.Namespace = GetSpaceStrippedAttribute ("ns");
MoveToElement ();
v.Value = ReadString ().Trim ();
v.Namespace = GetAttribute ("ns");
v.Value = ReadString ();
expectEnd ("value");
return v;
@@ -626,8 +576,8 @@ namespace Commons.Xml.Relaxng
public RngList ReadListPattern ()
{
RngList list = new RngList ();
expect ("list");
Read ();
ReadPatterns (list);
expectEnd ("list");
return list;
@@ -73,21 +73,19 @@ namespace Commons.Xml.Relaxng
vState = vState.StartTagOpenDeriv (
reader.LocalName, reader.NamespaceURI);
if (vState.PatternType == RngPatternType.NotAllowed)
throw createValidationError (String.Format ("Invalid start tag found. LocalName = {0}, NS = {1}. ", reader.LocalName, reader.NamespaceURI));
throw createValidationError ("Invalid start tag found. Name = {0}{1}");
// AttsDeriv equals to for each AttDeriv
if (reader.AttributeCount > 0) {
string elementNS = reader.NamespaceURI;
reader.MoveToFirstAttribute ();
do {
if (reader.Name.IndexOf ("xml:") == 0 || reader.Name.IndexOf ("xmlns:") == 0 || reader.Name == "xmlns")
continue;
prevState = vState;
string attrNS = reader.NamespaceURI == "" ? elementNS : reader.NamespaceURI;
vState = vState.AttDeriv (reader.LocalName, attrNS, reader.GetAttribute (reader.Name));
vState = vState.AttDeriv (reader.LocalName, reader.NamespaceURI, reader.GetAttribute (reader.Name));
if (vState.PatternType == RngPatternType.NotAllowed)
throw createValidationError (String.Format ("Invalid attribute found. LocalName = {0}, NS = {1}. ", reader.LocalName, reader.NamespaceURI));
throw createValidationError (String.Format ("Invalid attribute found. Name = {0} ", reader.Name));
} while (reader.MoveToNextAttribute ());
}
MoveToElement ();
@@ -96,7 +94,7 @@ namespace Commons.Xml.Relaxng
prevState = vState;
vState = vState.StartTagCloseDeriv ();
if (vState.PatternType == RngPatternType.NotAllowed)
throw createValidationError (String.Format ("Invalid start tag closing found. LocalName = {0}, NS = {1}. ", reader.LocalName, reader.NamespaceURI));
throw createValidationError (String.Format ("Invalid start tag closing found. Name = {0} ", reader.Name));
// if it is empty, then redirect to EndElement
if (reader.IsEmptyElement)
@@ -107,14 +105,14 @@ namespace Commons.Xml.Relaxng
prevState = vState;
vState = vState.EndTagDeriv ();
if (vState.PatternType == RngPatternType.NotAllowed)
throw createValidationError (String.Format ("Invalid end tag found. LocalName = {0}, NS = {1}. ", reader.LocalName, reader.NamespaceURI));
throw createValidationError (String.Format ("Invalid end tag found. Name = {0} ", reader.Name));
break;
case XmlNodeType.CDATA:
case XmlNodeType.Text:
prevState = vState;
vState = vState.TextDeriv (this.Value);
if (vState.PatternType == RngPatternType.NotAllowed)
throw createValidationError (String.Format ("Invalid text found. Text value = {0} ", reader.Value));
throw createValidationError (String.Format ("Validation error. Text value = {0} ", reader.Value));
break;
}
@@ -13,11 +13,11 @@ using System.IO;
using System.Net;
using System.Xml;
using Commons.Xml.Relaxng.Derivative;
//using System.Xml.Serialization;
using System.Xml.Serialization;
namespace Commons.Xml.Relaxng
{
// [XmlRoot (ElementName="grammar", Namespace="http://relaxng.org/ns/structure/1.0")]
[XmlRoot (ElementName="grammar", Namespace="http://relaxng.org/ns/structure/1.0")]
public class RngGrammar : RngPattern
{
// field
@@ -35,23 +35,13 @@ namespace Commons.Xml.Relaxng
// compile cache fields.
Hashtable assembledDefs = new Hashtable ();
RngPattern assembledStart;
RdpPattern compiledStart;
RdpPattern assembledStart;
Hashtable includedUris = new Hashtable ();
RngGrammar parentGrammar;
ArrayList includedGrammars;
Hashtable refPatterns = new Hashtable (); // key = RdpPattern of assembledDefs
// only for checkRecursion()
Hashtable checkedDefs = new Hashtable ();
// this should be checked after its compilation finished to complete
// missing-at-the-tracking patterns (especially of parent grammars).
// key = RdpPattern, value = ArrayList of unresolvedPatterns.
Hashtable unresolvedPatternsTable = new Hashtable ();
ArrayList unresolvedPatterns = new ArrayList ();
// contents key = RdpElement and value = name of the parent define.
private Hashtable ElementDefMap = new Hashtable ();
@@ -61,27 +51,27 @@ namespace Commons.Xml.Relaxng
{
}
// [XmlIgnore]
[XmlIgnore]
public override RngPatternType PatternType {
get { return RngPatternType.Grammar; }
}
// [XmlElement("start")]
[XmlElement("start")]
public IList Starts {
get { return starts; }
}
// [XmlElement("define")]
[XmlElement("define")]
public IList Defines {
get { return defs; }
}
// [XmlElement("include")]
[XmlElement("include")]
public IList Includes {
get { return includes; }
}
// [XmlElement("div")]
[XmlElement("div")]
public IList Divs {
get { return divs; }
}
@@ -115,25 +105,32 @@ namespace Commons.Xml.Relaxng
// see RELAX NG 4.17.
assembleCombine ();
compiledStart = assembledStart.Compile (this);
#if false
// Collect defines whose child is element.
foreach (string key in assembledDefs.Keys) {
RdpElement el = assembledDefs [key] as RdpElement;
if (el != null)
this.ElementDefMap.Add (el, assembledDefs [key]);
}
#endif
// Assemble all define components into top grammar and
// return start patterns for descendant grammars.
// see RELAX NG 4.18.
collectGrammars ();
if (parentGrammar != null)
return assembledStart.Compile (this);
return assembledStart;
// 4.19 (a) remove non-reachable defines
// 4.19 (b) check illegal recursion
checkRecursion (compiledStart, 0);
// 4.19 (c) expandRef
startPattern = compiledStart.ExpandRef (assembledDefs);
startPattern = assembledStart.expandRef (assembledDefs);
// 4.20,21 reduce notAllowed and empty.
bool b;
do {
b = false;
startPattern = startPattern.ReduceEmptyAndNotAllowed (ref b, new Hashtable ());
startPattern = startPattern.reduceEmptyAndNotAllowed (ref b, new Hashtable ());
} while (b);
Hashtable ht = new Hashtable ();
@@ -147,93 +144,16 @@ namespace Commons.Xml.Relaxng
return startPattern;
}
private void checkRecursion (RdpPattern p, int depth)
{
RdpAbstractBinary binary = p as RdpAbstractBinary;
if (binary != null) {
// choice, interleave, group
checkRecursion (binary.LValue, depth);
checkRecursion (binary.RValue, depth);
return;
}
RdpAbstractSingleContent single = p as RdpAbstractSingleContent;
if (single != null) {
checkRecursion (single.Child, depth);
return;
}
switch (p.PatternType) {
case RngPatternType.Ref:
// get checkRecursionDepth from table.
int checkRecursionDepth = -1;
object checkedDepth = checkedDefs [p];
if (checkedDepth != null)
checkRecursionDepth = (int) checkedDepth;
// get refPattern
RdpUnresolvedRef pref = p as RdpUnresolvedRef;
RngGrammar target = pref.IsParentRef ? parentGrammar : this;
RdpPattern refPattern = target.assembledDefs [pref.Name] as RdpPattern;
if (refPattern == null)
throw new RngException ("No matching define found for " + pref.Name);
if (checkRecursionDepth == -1) {
checkedDefs [p] = depth;
checkRecursion (refPattern, depth);
checkedDefs [p] = -2;
}
else if (depth == checkRecursionDepth)
throw new RngException (String.Format ("Detected illegal recursion. Ref name is {0}.", pref.Name));
break;
case RngPatternType.Attribute:
checkRecursion (((RdpAttribute) p).Children, depth);
break;
case RngPatternType.DataExcept:
checkRecursion (((RdpDataExcept) p).Except, depth);
break;
case RngPatternType.Element:
RdpElement el = p as RdpElement;
checkRecursion (el.Children, depth + 1); // +1
break;
case RngPatternType.List:
checkRecursion (((RdpList) p).Child, depth);
break;
}
}
private void completeReference ()
{
foreach (RdpUnresolvedRef pref in this.unresolvedPatterns) {
RdpPattern defP = assembledDefs [pref.Name] as RdpPattern;
ArrayList al = refPatterns [defP] as ArrayList;
if (al == null) {
al = new ArrayList ();
refPatterns [defP] = al;
}
al.Add (pref);
}
}
private void collectGrammars ()
{
// collect ref and parentRef for each define.
includedGrammars = (parentGrammar != null) ?
parentGrammar.includedGrammars : new ArrayList ();
// FIXME: This should be assembledStart.
checkReferences (compiledStart);
completeReference ();
checkReferences (assembledStart);
Hashtable ht = assembledDefs.Clone () as Hashtable;
foreach (string name in ht.Keys) {
RdpPattern p = (RdpPattern) assembledDefs [name];
this.unresolvedPatternsTable [p] = unresolvedPatterns;
checkReferences (p);
completeReference ();
checkReferences (assembledDefs [name] as RdpPattern);
}
// If it is child of any other pattern:
@@ -269,7 +189,6 @@ namespace Commons.Xml.Relaxng
pref.Name = newName;
break;
}
idx++;
}
}
@@ -296,15 +215,13 @@ namespace Commons.Xml.Relaxng
RngGrammar target = pref.IsParentRef ? parentGrammar : this;
RdpPattern defP = target.assembledDefs [pref.Name] as RdpPattern;
if (defP == null)
target.unresolvedPatterns.Add (p);
else {
ArrayList al = target.refPatterns [defP] as ArrayList;
if (al == null) {
al = new ArrayList ();
target.refPatterns [defP] = al;
}
al.Add (p);
throw new RngException ("No matching define found for " + pref.Name);
ArrayList al = target.refPatterns [defP] as ArrayList;
if (al == null) {
al = new ArrayList ();
target.refPatterns [defP] = al;
}
al.Add (p);
break;
case RngPatternType.Attribute:
@@ -354,93 +271,6 @@ namespace Commons.Xml.Relaxng
}
}
#if false
// remove ref and parentRef.
// add new defines for each elements.
private void checkReferences (RngPattern p)
{
RngBinaryContentPattern binary =
p as RngBinaryContentPattern;
if (binary != null) {
// choice, interleave, group
foreach (RngPattern cp in binary.Patterns)
checkReferences (cp);
return;
}
RngSingleContentPattern single =
p as RngSingleContentPattern;
if (single != null) {
// list, element, oneOrMore, zeroOrMore, optional, mixed
foreach (RngPattern cp in single.Patterns)
checkReferences (cp);
return;
}
switch (p.PatternType) {
case RngPatternType.Ref:
RdpUnresolvedRef pref = p as RdpUnresolvedRef;
RngGrammar target = pref.IsParentRef ? parentGrammar : this;
RdpPattern defP = target.assembledDefs [pref.Name] as RdpPattern;
if (defP == null)
throw new RngException ("No matching define found for " + pref.Name);
ArrayList al = target.refPatterns [defP] as ArrayList;
if (al == null) {
al = new ArrayList ();
target.refPatterns [defP] = al;
}
al.Add (p);
break;
case RngPatternType.Attribute:
checkReferences (((RngAttribute) p).Pattern);
break;
case RngPatternType.DataExcept:
foreach (RngPattern cp in ((RngData) p).Except.Patterns)
checkReferences (cp);
break;
case RngPatternType.Element:
RngElement el = p as RngElement;
checkReferences (el.Children);
string name = ElementDefMap [el] as string;
if (name == null) {
// add new define
int idx = 0;
string newName = "element0";
if (el.NameClass is RngName)
newName = ((RngName) el.NameClass).LocalName;
while (true) {
if (assembledDefs [newName] == null) {
assembledDefs.Add (newName, el.Children);
break;
}
newName = "element" + ++idx;
}
}
// Even though the element is replaced with ref,
// derivative of ref is RdpElement in fact...
break;
case RngPatternType.List:
checkReferences (((RdpList) p).Child);
break;
case RngPatternType.Empty:
case RngPatternType.NotAllowed:
case RngPatternType.Text:
case RngPatternType.Value:
break;
//case RngPatternType.ExternalRef:
//case RngPatternType.Include:
// Mixed, Optional, ZeroOrMore are already removed.
// Choice, Group, Interleave, OneOrMore are already proceeded.
}
}
#endif
// Assemble combines.
private void assembleCombine ()
{
@@ -470,23 +300,17 @@ namespace Commons.Xml.Relaxng
// assemble starts and defines with "combine" attribute.
// 3.assemble starts.
// 3assemble starts.
if (starts.Count == 0)
throw new RngException ("grammar must have at least one start component.");
assembledStart = ((RngStart)starts [0]).Pattern;
assembledStart = ((RngStart)starts [0]).Compile (this);
for (int i=1; i<starts.Count; i++) {
RngPattern p2 = ((RngStart) starts [i]).Pattern;;
if (combineStart == "interleave") {
RngInterleave intlv = new RngInterleave ();
intlv.Patterns.Add (assembledStart);
intlv.Patterns.Add (p2);
assembledStart = intlv;
} else {
RngChoice c = new RngChoice ();
c.Patterns.Add (assembledStart);
c.Patterns.Add (p2);
assembledStart = c;
}
RdpPattern p2 = ((RngStart) starts [i])
.Compile (this);
if (combineStart == "interleave")
assembledStart = new RdpInterleave (assembledStart, p2);
else
assembledStart = new RdpChoice (assembledStart, p2);
}
// 4.assemble defines
@@ -71,9 +71,8 @@ namespace Commons.Xml.Relaxng
{
string ns;
RngExceptNameClass except;
public RngNsName (string ns)
public RngNsName ()
{
this.ns = ns;
}
public override RdpNameClass Compile (RngGrammar g)
@@ -630,12 +630,12 @@ namespace Commons.Xml.Relaxng
throw new InvalidOperationException ();
}
internal protected override RdpPattern ExpandRef (Hashtable defs)
internal override RdpPattern expandRef (Hashtable defs)
{
RdpPattern target = (RdpPattern) defs [this.name];
if (target == null)
throw new RngException ("Target definition " + name + " not found.");
return target.ExpandRef (defs);
return target.expandRef (defs);
}
}
@@ -679,7 +679,7 @@ namespace Commons.Xml.Relaxng
internal protected override RdpPattern Compile (RngGrammar grammar)
{
IsCompiled = false;
return new RdpUnresolvedRef (name, true);
return new RdpUnresolvedRef (name, false);
}
public string Name {
@@ -1,10 +1,3 @@
2003-05-13 Martin Willemoes Hansen <[email protected]>
* makefile.gnu: Fixed name of assembly was changed
from Mono.Xml.Relaxng to
Commons.Xml.Relaxng.
* RdpPatternTests.cs, RelaxngReaderTests.cs:
Removed Assertion. prefixes and made them inherit from Assertion.
2003-04-29 Atsushi Enomoto <[email protected]>
* Started.
@@ -1,3 +1,12 @@
RdpPatternTests.cs
RelaxngReaderTests.cs
RelaxngValidatingReaderTests.cs
--target library
-o Mono.Xml.Relaxng_test.dll
--noconfig
-r ../../lib/corlib.dll
-r ../../lib/System.dll
-r ../../lib/System.Xml.dll
-r ../../lib/Mono.Xml.Relaxng.dll
-r ../../lib/System.EnterpriseServices.dll
-r ../../../nunit20/NUnit.Framework.dll
Commons.Xml.Relaxng/RdpPatternTests.cs
Commons.Xml.Relaxng/RelaxngReaderTests.cs
Commons.Xml.Relaxng/RelaxngValidatingReaderTests.cs
@@ -17,7 +17,7 @@ using NUnit.Framework;
namespace MonoTests.Commons.Xml.Relaxng
{
[TestFixture]
public class RdpPatternTests : Assertion
public class RdpPatternTests
{
RelaxngValidatingReader reader;
RdpPattern result;
@@ -31,7 +31,7 @@ namespace MonoTests.Commons.Xml.Relaxng
private void AssertPattern (string s, RngPatternType expected, RdpPattern p)
{
AssertEquals (s, expected, p.PatternType);
Assertion.AssertEquals (s, expected, p.PatternType);
}
[Test]
@@ -16,7 +16,7 @@ using NUnit.Framework;
namespace MonoTests.Commons.Xml.Relaxng
{
[TestFixture]
public class RelaxngReaderTests : Assertion
public class RelaxngReaderTests
{
RelaxngReader reader;
@@ -36,7 +36,7 @@ namespace MonoTests.Commons.Xml.Relaxng
loadGrammarFromUrl ("XmlFiles/SimpleElementPattern1.rng");
RngPattern p = reader.ReadPattern ();
AssertEquals (RngPatternType.Element, p.PatternType);
Assertion.AssertEquals (RngPatternType.Element, p.PatternType);
}
/*
@@ -46,7 +46,7 @@ namespace MonoTests.Commons.Xml.Relaxng
loadGrammarFromUrl ("XmlFiles/relaxng.rng");
RngPattern p = reader.ReadPattern ();
AssertEquals (RngPatternType.Grammar, p.PatternType);
Assertion.AssertEquals (RngPatternType.Grammar, p.PatternType);
}
*/
@@ -1,14 +1,13 @@
topdir = ../../..
LIBRARY = Commons.Xml.Relaxng_test.dll
LIBRARY = Mono.Xml.Relaxng_test.dll
LIB_LIST = Commons.Xml.Relaxng_test.args
LIB_LIST = Mono.Xml.Relaxng_test.args
LIB_FLAGS = \
-r $(topdir)/class/lib/corlib.dll \
-r $(topdir)/class/lib/System.dll \
-r $(topdir)/class/lib/System.Xml.dll \
-r $(topdir)/class/lib/Commons.Xml.Relaxng.dll \
-r $(topdir)/class/lib/NUnit.Framework.dll
-r $(topdir)/class/lib/Mono.Xml.Relaxng.dll \
-r $(topdir)/nunit20/NUnit.Framework.dll
ifdef SUBDIR
USE_SOURCE_RULES=1
@@ -19,11 +18,11 @@ endif
include $(topdir)/class/library.make
NUNITCONSOLE=$(topdir)/nunit20/nunit-console.exe
MONO_PATH = $(topdir)/nunit20:$(topdir)/class/lib:.
MONO_PATH = $(topdir)/nunit20:.
test: $(LIBRARY) run_test
.PHONY: run_test
run_test:
-MONO_PATH=$(MONO_PATH) mono --debug $(NUNITCONSOLE) $(LIBRARY)
-MONO_PATH=$(MONO_PATH) mono --debug $(NUNITCONSOLE) Mono.Xml.Relaxng_test.dll
-4
View File
@@ -1,7 +1,3 @@
2003-06-09 Cesar Octavio Lopez Nataren <[email protected]>
* Added FormalParameterList, Statement, VariableDeclaration,
VariableStatement and Visitor files to the unix.args.
2003-04-21 Cesar Octavio Lopez Nataren <[email protected]>
* Added Antlr.Runtime, it contains the files needed for compiling
@@ -1,9 +1,7 @@
//
// ASTList.cs: Representation of a collection of source elements
// that form an Ecmascript program.
// ASTList.cs:
//
// Author:
// Cesar Octavio Lopez Nataren
// Author: Cesar Octavio Lopez Nataren
//
// (C) 2003, Cesar Octavio Lopez Nataren, <[email protected]>
//
@@ -11,40 +9,9 @@
namespace Microsoft.JScript
{
using System.Collections;
using System.Text;
using System;
public class ASTList : AST
{
internal ArrayList elems;
internal ASTList ()
{
elems = new ArrayList ();
}
internal ASTList Add (AST elem)
{
elems.Add (elem);
return this;
}
public override object Visit (Visitor v, object args)
{
return v.VisitASTList (this, args);
}
public override string ToString ()
{
StringBuilder sb = new StringBuilder ();
foreach (AST ast in elems)
sb.Append (ast.ToString () + "\n");
return sb.ToString ();
}
private ArrayList elems;
}
}
}
@@ -1,8 +1,7 @@
//
// ArrayLiteral.cs:
//
// Author:
// Cesar Octavio Lopez Nataren
// Author: Cesar Octavio Lopez Nataren
//
// (C) 2003, Cesar Octavio Lopez Nataren, <[email protected]>
//
@@ -15,11 +14,5 @@ namespace Microsoft.JScript
public ArrayLiteral (Context context, ASTList elems)
{}
public override object Visit (Visitor v, object args)
{
return v.VisitArrayLiteral (this, args);
}
}
}
@@ -9,10 +9,5 @@
namespace Microsoft.JScript
{
public class Block : AST
{
public override object Visit (Visitor v, object args)
{
return v.VisitBlock (this, args);
}
}
{}
}
@@ -1,68 +1,3 @@
2003-06-09 Cesar Lopez Nataren <[email protected]>
* Added the Visit method to classes: AST, ArrayLiteral, ASTList,
Block, DebugBreak, Eval, ForIn, FunctionDeclaration,
FunctionExpression, Import, Package, ScriptBlock, Throw, Try,
With,
That method will be the driver that will allow classes
that implement the Visitor interface do a walk through the AST's
elements, in particular the Semantic Analizer and the Code
Generator. Every class that inherits from AST will have a Visit
method, that method will receive a Visitor and a object as
parameters, the only thing that it'll do is letting the Visitor
call the respective method VisitX, where X is the name of the
currently visited class.
* ASTList.cs:Added constructor, Add, Visit, ToString methods.
* FunctionDeclaration.cs: Added constructor, Visit and ToString
methods.
* jscript-lexer-parser.g: Added a ASTList as a parameter to the
program (the main entry of the parser). Also added as parameters:
- An AST to source_element.
- A Statement to statement.
- A VariableStatement to variable_statement.
- A VariableStatement to variable_declaration_list.
- A FormalParamerList by formal_parameter_list.
- A ASTList by function_body.
And now some rules return objects:
- A VariableDeclaration by variable_declaration.
- A Functiondeclaration by function_declaration.
* driver.cs: Added the construction of the AST of the EcmaScript
program.
* Visitor.cs: Added this file. It's the visitor interface.
* VariableDeclaration.cs: Added this class, it's the AST
representation of a variable declaration.
* Statement.cs: Added this file. It's the logical representation
of a Statement.
* VariableStatement.cs: Added this class. It's the AST
representation of a chain of variable declarations.
* FormalParameterList.cs: The function declaration needs to store
its parameter, we will put them on this class.
* SemanticAnalizer.cs: Added this class. I'll use the Visitor pattern in order to
implement the semantic analysis and code generation
phases. SemanticAnalizer and CodeGenerator will implement the
Visitor interface, they will walk a program's
AST tree and do their respective work.
* IdentificationTable.cs: Added this class. The SymbolTable will be used
by the SemanticAnalyzer in order to keep track of the variable
declaration encountered, etc..
* SymbolTable.cs: A simple hashtable but for commodity i'll call
it this way.
2003-05-03 Cesar Lopez Nataren <[email protected]>
* jscript-lexer-parser.g:
@@ -8,13 +8,6 @@
namespace Microsoft.JScript
{
using System;
public class DebugBreak : AST
{
public override object Visit (Visitor v, object args)
{
throw new NotImplementedException ();
}
}
{}
}
@@ -12,15 +12,9 @@ namespace Microsoft.JScript
public class Eval : AST
{
public static object JScriptEvaluate (object src, VsaEngine engine)
public static Object JScriptEvaluate (Object src, VsaEngine engine)
{
throw new NotImplementedException ();
}
public override object Visit (Visitor v, object args)
{
return v.VisitEval (this, args);
}
}
}
@@ -1,8 +1,7 @@
//
// ForIn.cs:
//
// Author:
// Cesar Octavio Lopez Nataren
// Author: Cesar Octavio Lopez Nataren
//
// (C) 2003, Cesar Octavio Lopez Nataren, <[email protected]>
//
@@ -14,15 +13,9 @@ namespace Microsoft.JScript
public class ForIn : AST
{
public static IEnumerator JScriptGetEnumerator (object coll)
public static IEnumerator JScriptGetEnumerator (Object coll)
{
throw new NotImplementedException ();
}
public override object Visit (Visitor v, object args)
{
return v.VisitForIn (this, args);
}
}
}
@@ -1,39 +0,0 @@
//
// FormalParameterList.cs: A list of identifiers.
//
// Author:
// Cesar Lopez Nataren
//
// (C) 2003, Cesar Lopez Nataren, <[email protected]>
//
namespace Microsoft.JScript
{
using System.Collections;
using System.Text;
public class FormalParameterList
{
internal ArrayList ids;
public FormalParameterList ()
{
ids = new ArrayList ();
}
internal void Add (string id)
{
ids.Add (id);
}
public override string ToString ()
{
StringBuilder sb = new StringBuilder ();
foreach (string s in ids)
sb.Append (s + " ");
return sb.ToString ();
}
}
}
@@ -1,8 +1,7 @@
//
// FunctionDeclaration.cs:
//
// Author:
// Cesar Octavio Lopez Nataren
// Author: Cesar Octavio Lopez Nataren
//
// (C) 2003, Cesar Octavio Lopez Nataren, <[email protected]>
//
@@ -10,14 +9,9 @@
namespace Microsoft.JScript
{
using System;
using System.Text;
public class FunctionDeclaration : AST
{
internal string id;
internal FormalParameterList parameters;
internal ASTList funcBody;
public static Closure JScriptFunctionDeclaration (RuntimeTypeHandle handle, string name,
string methodName, string [] formalParameters,
JSLocalField [] fields, bool mustSaveStackLocals,
@@ -26,30 +20,5 @@ namespace Microsoft.JScript
{
throw new NotImplementedException ();
}
internal FunctionDeclaration ()
{
parameters = new FormalParameterList ();
funcBody = new ASTList ();
}
public override object Visit (Visitor v, object args)
{
return v.VisitFunctionDeclaration (this, args);
}
public override string ToString ()
{
StringBuilder sb = new StringBuilder ();
sb.Append ("id: " + id + "\n");
sb.Append ("parameters: " + parameters.ToString () + "\n");
sb.Append ("functionBody: " + funcBody.ToString ());
return sb.ToString ();
}
}
}
}
@@ -18,11 +18,5 @@ namespace Microsoft.JScript
{
throw new NotImplementedException ();
}
public override object Visit (Visitor v, object args)
{
return v.VisitFunctionExpression (this, args);
}
}
}
@@ -1,10 +1,7 @@
//
// FunctionObject.cs:
//
// Author:
// Cesar Octavio Lopez Nataren
//
// (C) 2003, Cesar Octavio Lopez Nataren, <[email protected]>
// Author: Cesar Octavio Lopez Nataren
//
namespace Microsoft.JScript
@@ -1,54 +0,0 @@
//
// ExecutionContext.cs: The stack of possible executions environments.
//
// Author:
// Cesar Lopez Nataren
//
// (C) 2003, Cesar Lopez Nataren
//
using System.Collections;
namespace Microsoft.JScript
{
internal class IdentificationTable
{
internal Stack stack;
internal IdentificationTable ()
{
stack = new Stack ();
stack.Push (new SymbolTable ());
}
internal void OpenBlock ()
{
stack.Push (new SymbolTable ());
}
internal void CloseBlock ()
{
stack.Pop ();
}
internal void Enter (string id, VariableDeclaration decl)
{
((SymbolTable) stack.Peek ()).Add (id , decl);
}
internal VariableDeclaration Retrieve (string id)
{
return ((SymbolTable) stack.Peek ()).Retrieve (id);
}
internal bool Contains (string id)
{
return ((SymbolTable) stack.Peek ()).Contains (id);
}
}
}
@@ -14,11 +14,5 @@ namespace Microsoft.JScript
public static void JScriptImport (string name, VsaEngine engine)
{}
public override object Visit (Visitor v, object args)
{
return v.VisitImport (this, args);
}
}
}
@@ -142,14 +142,12 @@ namespace Microsoft.JScript
initialize();
}
public void program(
ASTList astList
) //throws RecognitionException, TokenStreamException
public void program() //throws RecognitionException, TokenStreamException
{
try { // for error handling
source_elements(astList);
source_elements();
}
catch (RecognitionException ex)
{
@@ -166,19 +164,12 @@ namespace Microsoft.JScript
}
}
public void source_elements(
ASTList astList
) //throws RecognitionException, TokenStreamException
public void source_elements() //throws RecognitionException, TokenStreamException
{
AST ast = null;
try { // for error handling
ast=source_element();
if (0==inputState.guessing)
{
if (ast != null) astList. Add (ast);
}
source_element();
{
switch ( LA(1) )
{
@@ -199,7 +190,7 @@ namespace Microsoft.JScript
case LITERAL_var:
case LITERAL_function:
{
source_elements(astList);
source_elements();
break;
}
case EOF:
@@ -229,14 +220,8 @@ namespace Microsoft.JScript
}
}
public AST source_element() //throws RecognitionException, TokenStreamException
public void source_element() //throws RecognitionException, TokenStreamException
{
AST ast;
ast = null;
Statement stm = null;
FunctionDeclaration fd = null;
try { // for error handling
@@ -258,20 +243,12 @@ namespace Microsoft.JScript
case LITERAL_try:
case LITERAL_var:
{
stm=statement();
if (0==inputState.guessing)
{
ast = stm;
}
statement();
break;
}
case LITERAL_function:
{
fd=function_declaration();
if (0==inputState.guessing)
{
ast = fd;
}
function_declaration();
break;
}
default:
@@ -293,16 +270,10 @@ namespace Microsoft.JScript
throw;
}
}
return ast;
}
public Statement statement() //throws RecognitionException, TokenStreamException
public void statement() //throws RecognitionException, TokenStreamException
{
Statement stm;
stm = null;
VariableStatement varStm = null;
try { // for error handling
@@ -315,11 +286,7 @@ namespace Microsoft.JScript
}
case LITERAL_var:
{
varStm=variable_statement();
if (0==inputState.guessing)
{
stm = (Statement) varStm;
}
variable_statement();
break;
}
case SEMI_COLON:
@@ -398,31 +365,22 @@ namespace Microsoft.JScript
throw;
}
}
return stm;
}
public FunctionDeclaration function_declaration() //throws RecognitionException, TokenStreamException
public void function_declaration() //throws RecognitionException, TokenStreamException
{
FunctionDeclaration fd;
Token id = null;
fd = new FunctionDeclaration ();
try { // for error handling
match(LITERAL_function);
id = LT(1);
match(IDENTIFIER);
if (0==inputState.guessing)
{
fd.id = id.getText ();
}
match(LPAREN);
{
switch ( LA(1) )
{
case IDENTIFIER:
{
formal_parameter_list(fd.parameters);
formal_parameter_list();
break;
}
case RPAREN:
@@ -437,7 +395,7 @@ namespace Microsoft.JScript
}
match(RPAREN);
match(LBRACE);
function_body(fd.funcBody);
function_body();
match(RBRACE);
}
catch (RecognitionException ex)
@@ -453,7 +411,6 @@ namespace Microsoft.JScript
throw;
}
}
return fd;
}
public void block() //throws RecognitionException, TokenStreamException
@@ -511,15 +468,13 @@ namespace Microsoft.JScript
}
}
public VariableStatement variable_statement() //throws RecognitionException, TokenStreamException
public void variable_statement() //throws RecognitionException, TokenStreamException
{
VariableStatement varStm;
varStm = new VariableStatement ();
try { // for error handling
match(LITERAL_var);
variable_declaration_list(varStm);
variable_declaration_list();
match(SEMI_COLON);
}
catch (RecognitionException ex)
@@ -535,7 +490,6 @@ namespace Microsoft.JScript
throw;
}
}
return varStm;
}
public void empty_statement() //throws RecognitionException, TokenStreamException
@@ -1402,26 +1356,19 @@ _loop28_breakloop: ;
}
}
public void variable_declaration_list(
VariableStatement varStm
) //throws RecognitionException, TokenStreamException
public void variable_declaration_list() //throws RecognitionException, TokenStreamException
{
VariableDeclaration varDecl = null;
try { // for error handling
varDecl=variable_declaration();
if (0==inputState.guessing)
{
varStm.Add (varDecl);
}
variable_declaration();
{
switch ( LA(1) )
{
case COMMA:
{
match(COMMA);
variable_declaration_list(varStm);
variable_declaration_list();
break;
}
case SEMI_COLON:
@@ -1450,20 +1397,12 @@ _loop28_breakloop: ;
}
}
public VariableDeclaration variable_declaration() //throws RecognitionException, TokenStreamException
public void variable_declaration() //throws RecognitionException, TokenStreamException
{
VariableDeclaration varDecl;
Token id = null;
varDecl = new VariableDeclaration ();
try { // for error handling
id = LT(1);
match(IDENTIFIER);
if (0==inputState.guessing)
{
varDecl.Id = id.getText ();
}
{
switch ( LA(1) )
{
@@ -1497,7 +1436,6 @@ _loop28_breakloop: ;
throw;
}
}
return varDecl;
}
public void initialiser() //throws RecognitionException, TokenStreamException
@@ -2875,7 +2813,7 @@ _loop86_breakloop: ;
{
case IDENTIFIER:
{
formal_parameter_list(null);
formal_parameter_list();
break;
}
case RPAREN:
@@ -2890,7 +2828,7 @@ _loop86_breakloop: ;
}
match(RPAREN);
match(LBRACE);
function_body(null);
function_body();
match(RBRACE);
}
catch (RecognitionException ex)
@@ -3255,27 +3193,19 @@ _loop101_breakloop: ;
}
}
public void formal_parameter_list(
FormalParameterList param
) //throws RecognitionException, TokenStreamException
public void formal_parameter_list() //throws RecognitionException, TokenStreamException
{
Token id = null;
try { // for error handling
id = LT(1);
match(IDENTIFIER);
if (0==inputState.guessing)
{
param.Add (id.getText ());
}
{
switch ( LA(1) )
{
case COMMA:
{
match(COMMA);
formal_parameter_list(param);
formal_parameter_list();
break;
}
case RPAREN:
@@ -3304,14 +3234,12 @@ _loop101_breakloop: ;
}
}
public void function_body(
ASTList funcBody
) //throws RecognitionException, TokenStreamException
public void function_body() //throws RecognitionException, TokenStreamException
{
try { // for error handling
source_elements(funcBody);
source_elements();
}
catch (RecognitionException ex)
{
@@ -12,11 +12,5 @@ namespace Microsoft.JScript
{
public static void JScriptPackage (string rootName, VsaEngine engine)
{}
public override object Visit (Visitor v, object args)
{
return v.VisitPackage (this, args);
}
}
}
@@ -9,10 +9,5 @@
namespace Microsoft.JScript
{
public class ScriptBlock : AST
{
public override object Visit (Visitor v, object args)
{
return v.VisitScriptBlock (this, args);
}
}
{}
}
@@ -1,105 +0,0 @@
//
// SemanticAnaliser.cs: A implementation of the Visitor interface.
// It performs the Semantic Analysis for EcmaScript
//
// Author:
// Cesar Lopez Nataren
//
// (C) 2003, Cesar Lopez Nataren, <[email protected]>
//
using System;
namespace Microsoft.JScript
{
internal class SemanticAnaliser : Visitor
{
private IdentificationTable symTab;
public object VisitASTList (ASTList prog, object obj)
{
throw new NotImplementedException ();
}
public object VisitVariableDeclaration (VariableDeclaration decl,
object args)
{
throw new NotImplementedException ();
}
public object VisitFunctionDeclaration (FunctionDeclaration decl,
object args)
{
throw new NotImplementedException ();
}
public object VisitArrayLiteral (ArrayLiteral al, object args)
{
throw new NotImplementedException ();
}
public object VisitBlock (Block b, object args)
{
throw new NotImplementedException ();
}
public object VisitEval (Eval e, object args)
{
throw new NotImplementedException ();
}
public object VisitForIn (ForIn forIn, object args)
{
throw new NotImplementedException ();
}
public object VisitFunctionExpression (FunctionExpression fexp,
object args)
{
throw new NotImplementedException ();
}
public object VisitImport (Import imp, object args)
{
throw new NotImplementedException ();
}
public object VisitPackage (Package pkg, object args)
{
throw new NotImplementedException ();
}
public object VisitScriptBlock (ScriptBlock sblock, object args)
{
throw new NotImplementedException ();
}
public object VisitThrow (Throw t, object args)
{
throw new NotImplementedException ();
}
public object VisitTry (Try t, object args)
{
throw new NotImplementedException ();
}
public object VisitWith (With w, object args)
{
throw new NotImplementedException ();
}
}
}
@@ -1,22 +0,0 @@
//
// Statement.cs:
//
// Author:
// Cesar Octavio Lopez Nataren
//
// (C) 2003, Cesar Octavio Lopez Nataren, <[email protected]>
//
namespace Microsoft.JScript
{
public class Statement : AST
{
public Statement ()
{}
public override object Visit (Visitor v, object args)
{
return null;
}
}
}
@@ -1,43 +0,0 @@
//
// SymbolTable.cs:
//
// Author:
// Cesar Lopez Nataren
//
// (C) 2003, Cesar Lopez Nataren, <[email protected]>
//
using System;
using System.Collections;
namespace Microsoft.JScript
{
internal class SymbolTable
{
internal Hashtable symbols;
internal SymbolTable ()
{
symbols = new Hashtable ();
}
internal void Add (string id, VariableDeclaration d)
{
symbols.Add (id, d);
}
internal VariableDeclaration Retrieve (string id)
{
return ((VariableDeclaration) symbols [id]);
}
internal bool Contains (string id)
{
return symbols.ContainsKey (id);
}
}
}
@@ -18,7 +18,7 @@ namespace Microsoft.JScript {
/// Use this to decorate any element which you think is not complete
/// </remarks>
[AttributeUsage (AttributeTargets.All, AllowMultiple=true)]
internal class MonoTODOAttribute : Attribute {
public class MonoTODOAttribute : Attribute {
private string comment;
@@ -16,11 +16,5 @@ namespace Microsoft.JScript
{
throw new NotImplementedException ();
}
public override object Visit (Visitor v, object args)
{
return v.VisitThrow (this, args);
}
}
}
@@ -21,11 +21,5 @@ namespace Microsoft.JScript
{
throw new NotImplementedException ();
}
public override object Visit (Visitor v, object args)
{
return v.VisitTry (this, args);
}
}
}
@@ -1,46 +0,0 @@
//
// VariableDeclaration.cs: The AST representation of a VariableDeclaration.
//
// Author:
// Cesar Octavio Lopez Nataren
//
// (C) 2003, Cesar Octavio Lopez Nataren, <[email protected]>
//
namespace Microsoft.JScript
{
using System.Text;
public class VariableDeclaration : Statement
{
private string id;
private AST assignExp;
internal VariableDeclaration ()
{}
public string Id {
get { return id; }
set { id = value; }
}
public override object Visit (Visitor v, object args)
{
return v.VisitVariableDeclaration (this, args);
}
public override string ToString ()
{
StringBuilder sb = new StringBuilder ();
// FIXME: we must add the string
// representation of assignExp, too.
sb.Append (Id);
return sb.ToString ();
}
}
}
@@ -1,41 +0,0 @@
//
// VariableStatement.cs: The AST representation of a VariableStatement.
//
// Author:
// Cesar Octavio Lopez Nataren
//
// (C) 2003, Cesar Octavio Lopez Nataren, <[email protected]>
//
namespace Microsoft.JScript
{
using System.Collections;
using System.Text;
public class VariableStatement : Statement
{
internal ArrayList varDecls;
internal VariableStatement ()
{
varDecls = new ArrayList ();
}
internal void Add (VariableDeclaration varDecl)
{
varDecls.Add (varDecl);
}
public override string ToString ()
{
StringBuilder sb = new StringBuilder ();
foreach (VariableDeclaration varDecl in varDecls)
sb.Append (varDecl.ToString () + " ");
return sb.ToString ();
}
}
}
@@ -1,42 +0,0 @@
//
// Visitor.cs: A interface for transversing the AST.
//
// Author:
// Cesar Lopez Nataren
//
// (C) 2003, Cesar Lopez Nataren, <[email protected]>
//
namespace Microsoft.JScript
{
public interface Visitor
{
object VisitASTList (ASTList prog, object obj);
object VisitVariableDeclaration (VariableDeclaration decl, object args);
object VisitFunctionDeclaration (FunctionDeclaration decl, object args);
object VisitArrayLiteral (ArrayLiteral al, object args);
object VisitBlock (Block b, object args);
object VisitEval (Eval e, object args);
object VisitForIn (ForIn fi, object args);
object VisitFunctionExpression (FunctionExpression fe, object args);
object VisitImport (Import imp, object args);
object VisitPackage (Package imp, object args);
object VisitScriptBlock (ScriptBlock sblock, object args);
object VisitThrow (Throw t, object args);
object VisitTry (Try t, object args);
object VisitWith (With w, object args);
}
}
@@ -16,11 +16,5 @@ namespace Microsoft.JScript
{
throw new NotImplementedException ();
}
public override object Visit (Visitor v, object args)
{
return v.VisitWith (this, args);
}
}
}
@@ -9,7 +9,5 @@
namespace Microsoft.JScript
{
public abstract class AST
{
public abstract object Visit (Visitor v, object obj);
}
{}
}
@@ -39,31 +39,24 @@ namespace Microsoft.JScript
moduleBuilder = assemblyBuilder.DefineDynamicModule (JSCRIPT_MODULE, basename + ".exe", false);
}
public ASTList GetAST (string filename)
public void GetAST (string filename)
{
StreamReader reader = new StreamReader (filename);
JScriptLexer lexer = new JScriptLexer (reader);
JScriptParser parser = new JScriptParser (lexer);
ASTList astList = new ASTList ();
parser.program (astList);
return astList;
parser.program ();
}
public static void Main (string [] args)
{
try {
string basename = Path.GetFileNameWithoutExtension (args [0]);
Jsc compiler = new Jsc (basename);
ASTList astList = compiler.GetAST (args [0]);
Console.WriteLine (astList.ToString ());
compiler.GetAST (args [0]);
} catch (IndexOutOfRangeException) {
Console.WriteLine ("Usage: [mono] mjs.exe filename.js");
Console.WriteLine ("Usage: [mono] mjsc.exe filename.js");
}
}
}
@@ -18,46 +18,33 @@ options {
class JScriptParser extends Parser;
// Program, see section 14 from Ecma-262, page 75.
program [ASTList astList]
program
:
source_elements [astList]
source_elements
;
source_elements [ASTList astList]
{ AST ast = null; }
source_elements
:
ast = source_element { if (ast != null) astList. Add (ast); } (source_elements [astList] | )
source_element (source_elements | )
;
// See Section 14 from Ecma-262, page 75.
source_element returns [AST ast]
{
ast = null;
Statement stm = null;
FunctionDeclaration fd = null;
}
source_element
:
stm = statement
{ ast = stm; }
statement
|
fd = function_declaration
{ ast = fd; }
function_declaration
;
// Statement, see section 12 from Ecma-262, page 61.
statement returns [Statement stm]
{
stm = null;
VariableStatement varStm = null;
}
statement
:
block
|
varStm = variable_statement
{ stm = (Statement) varStm; }
variable_statement
|
empty_statement
|
@@ -187,23 +174,20 @@ statement_list
;
// VariableStatement, see section 12.2 from Ecma-262 3td Edition, page 74.
variable_statement returns [VariableStatement varStm]
{ varStm = new VariableStatement (); }
variable_statement
:
"var" variable_declaration_list [varStm] SEMI_COLON
"var" variable_declaration_list SEMI_COLON
;
variable_declaration_list [VariableStatement varStm]
{ VariableDeclaration varDecl = null; }
variable_declaration_list
:
varDecl = variable_declaration { varStm.Add (varDecl); } (COMMA variable_declaration_list [varStm] | )
variable_declaration (COMMA variable_declaration_list | )
;
variable_declaration returns [VariableDeclaration varDecl]
{ varDecl = new VariableDeclaration (); }
variable_declaration
:
id:IDENTIFIER { varDecl.Id = id.getText (); } (initialiser | )
IDENTIFIER (initialiser | )
;
@@ -302,7 +286,7 @@ equality_expression
// FIXME: more options left to implement
relational_expression
:
shift_expression ((L_THAN | G_THAN | LE_THAN | GE_THAN | "instanceof" | "in") relational_expression | )
shift_expression ((L_THAN | G_THAN | LE_THAN | GE_THAN | "instanceof" | "in" ) relational_expression | )
;
@@ -462,29 +446,28 @@ expression: assignment_expression (COMMA expression | ) ;
// Function definition, see Section 13 from Ecma-262, page 71.
function_declaration returns [FunctionDeclaration fd]
{ fd = new FunctionDeclaration (); }
function_declaration
:
"function" id:IDENTIFIER { fd.id = id.getText (); } LPAREN (formal_parameter_list [fd.parameters] | ) RPAREN LBRACE function_body [fd.funcBody] RBRACE
"function" IDENTIFIER LPAREN (formal_parameter_list | ) RPAREN LBRACE function_body RBRACE
;
// This elems are just for compiling purposes.
function_expression
:
"function" (IDENTIFIER | ) LPAREN (formal_parameter_list [null] | ) RPAREN LBRACE function_body [null] RBRACE
"function" (IDENTIFIER | ) LPAREN (formal_parameter_list | ) RPAREN LBRACE function_body RBRACE
;
formal_parameter_list [FormalParameterList param]
formal_parameter_list
:
id:IDENTIFIER { param.Add (id.getText ()); } (COMMA formal_parameter_list [param] | )
IDENTIFIER (COMMA formal_parameter_list | )
;
function_body [ASTList funcBody]
function_body
:
source_elements [funcBody]
source_elements
;
-5
View File
@@ -26,7 +26,6 @@ Microsoft.JScript/ErrorConstructor.cs
Microsoft.JScript/ErrorObject.cs
Microsoft.JScript/Eval.cs
Microsoft.JScript/ForIn.cs
Microsoft.JScript/FormalParameterList.cs
Microsoft.JScript/FunctionConstructor.cs
Microsoft.JScript/FunctionDeclaration.cs
Microsoft.JScript/FunctionExpression.cs
@@ -60,17 +59,13 @@ Microsoft.JScript/RegExpObject.cs
Microsoft.JScript/ScriptBlock.cs
Microsoft.JScript/ScriptFunction.cs
Microsoft.JScript/ScriptObject.cs
Microsoft.JScript/Statement.cs
Microsoft.JScript/StringConstructor.cs
Microsoft.JScript/StringObject.cs
Microsoft.JScript/TODOAttribute.cs
Microsoft.JScript/Throw.cs
Microsoft.JScript/Try.cs
Microsoft.JScript/UnaryOp.cs
Microsoft.JScript/VariableDeclaration.cs
Microsoft.JScript/VariableStatement.cs
Microsoft.JScript/VBArrayConstructor.cs
Microsoft.JScript/Visitor.cs
Microsoft.JScript/VsaEngine.cs
Microsoft.JScript/With.cs
Antlr.Runtime/antlr/ANTLRException.cs
@@ -3,20 +3,16 @@
//
// Author:
// Chris J Breisch ([email protected])
// Marco Ridoni ([email protected])
//
// (C) 2002 Chris J Breisch
// (C) 2003 Marco Ridoni
//
using System;
using System.Reflection;
using Microsoft.VisualBasic;
namespace Microsoft.VisualBasic.CompilerServices
namespace Microsoft.VisualBasic.CompilerServices
{
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute]
sealed public class LateBinding {
// Declarations
// Constructors
@@ -37,125 +33,18 @@ namespace Microsoft.VisualBasic.CompilerServices
[MonoTODO]
[System.Diagnostics.DebuggerStepThroughAttribute]
[System.Diagnostics.DebuggerHiddenAttribute]
public static System.Object LateIndexGet (System.Object o, System.Object[] args, System.String[] paramnames)
{
Type objType;
Object binderState = null;
if (o == null || args == null)
throw new ArgumentException();
objType = o.GetType();
if (objType.IsArray) {
Array a = (Array) o;
int[] idxs = new int[args.Length];
Array.Copy (args, idxs, args.Length);
return a.GetValue(idxs);
}
else
{
MemberInfo[] defaultMembers = objType.GetDefaultMembers();
if (defaultMembers == null)
throw new Exception(); // FIXME: Which exception should we throw?
// We try to find a default method/property/field we can invoke/use
VBBinder MyBinder = new VBBinder();
BindingFlags bindingFlags = BindingFlags.IgnoreCase |
BindingFlags.Instance |
BindingFlags.Static |
BindingFlags.Public |
BindingFlags.GetProperty |
BindingFlags.GetField |
BindingFlags.InvokeMethod;
MethodBase[] mb = new MethodBase[defaultMembers.Length];
try {
for (int x = 0; x < defaultMembers.Length; x++)
if (defaultMembers[x].MemberType == MemberTypes.Property)
mb[x] = ((PropertyInfo) defaultMembers[x]).GetGetMethod();
else
mb[x] = (MethodBase) defaultMembers[x];
} catch (Exception e) { }
MethodBase TheMethod = MyBinder.BindToMethod (bindingFlags,
mb,
ref args,
null,
null,
paramnames,
out binderState);
if (TheMethod == null)
throw new TargetInvocationException(new ArgumentNullException());
return TheMethod.Invoke (o, args);
}
}
public static System.Object LateIndexGet (System.Object o, System.Object[] args, System.String[] paramnames) { throw new NotImplementedException (); }
[MonoTODO]
[System.Diagnostics.DebuggerHiddenAttribute]
[System.Diagnostics.DebuggerStepThroughAttribute]
[System.Diagnostics.DebuggerHiddenAttribute]
[System.Diagnostics.DebuggerStepThroughAttribute]
public static void LateIndexSetComplex (System.Object o, System.Object[] args, System.String[] paramnames, System.Boolean OptimisticSet, System.Boolean RValueBase) { throw new NotImplementedException (); }
[MonoTODO]
[System.Diagnostics.DebuggerStepThroughAttribute]
[System.Diagnostics.DebuggerHiddenAttribute]
public static void LateIndexSet (System.Object o, System.Object[] args, System.String[] paramnames)
{
Type objType;
Object binderState = null;
Object myValue;
if (o == null || args == null)
throw new ArgumentException();
myValue = args[args.Length - 1];
objType = o.GetType();
if (objType.IsArray) {
Array a = (Array) o;
int[] idxs = new int[args.Length - 1];
Array.Copy (args, idxs, args.Length -1);
a.SetValue(myValue, idxs);
}
else
{
MemberInfo[] defaultMembers = objType.GetDefaultMembers();
if (defaultMembers == null)
throw new Exception(); // FIXME: Which exception should we throw?
// We try to find a default method/property/field we can invoke/use
VBBinder MyBinder = new VBBinder();
BindingFlags bindingFlags = BindingFlags.IgnoreCase |
BindingFlags.Instance |
BindingFlags.Static |
BindingFlags.Public |
BindingFlags.GetProperty |
BindingFlags.GetField |
BindingFlags.InvokeMethod;
MethodBase[] mb = new MethodBase[defaultMembers.Length];
try {
for (int x = 0; x < defaultMembers.Length; x++)
if (defaultMembers[x].MemberType == MemberTypes.Property)
mb[x] = ((PropertyInfo) defaultMembers[x]).GetSetMethod();
else
mb[x] = (MethodBase) defaultMembers[x];
} catch (Exception e) { }
MethodBase TheMethod = MyBinder.BindToMethod (bindingFlags,
mb,
ref args,
null,
null,
paramnames,
out binderState);
if (TheMethod == null)
throw new TargetInvocationException(new ArgumentNullException());
TheMethod.Invoke (o, args);
}
}
[System.Diagnostics.DebuggerStepThroughAttribute]
[System.Diagnostics.DebuggerHiddenAttribute]
public static void LateIndexSet (System.Object o, System.Object[] args, System.String[] paramnames) { throw new NotImplementedException (); }
[MonoTODO]
[System.Diagnostics.DebuggerStepThroughAttribute]
[System.Diagnostics.DebuggerHiddenAttribute]
[System.Diagnostics.DebuggerStepThroughAttribute]
[System.Diagnostics.DebuggerHiddenAttribute]
public static void LateCall (System.Object o, System.Type objType, System.String name, System.Object[] args, System.String[] paramnames, System.Boolean[] CopyBack) { throw new NotImplementedException (); }
// Events
};
@@ -19,7 +19,7 @@ namespace Microsoft.VisualBasic.CompilerServices {
/// Use this to decorate any element which you think is not complete
/// </remarks>
[AttributeUsage (AttributeTargets.All, AllowMultiple=true)]
internal class MonoTODOAttribute : Attribute {
public class MonoTODOAttribute : Attribute {
private string comment;
@@ -1,171 +0,0 @@
//
// LateBinding.cs
//
// Author:
// Marco Ridoni ([email protected])
//
// (C) 2003 Marco Ridoni
//
using System;
using System.Reflection;
using System.Globalization;
using Microsoft.VisualBasic;
namespace Microsoft.VisualBasic.CompilerServices
{
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute]
public class VBBinder : Binder
{
public VBBinder() : base()
{
}
private class BinderState
{
public object[] args;
}
public override FieldInfo BindToField(
BindingFlags bindingAttr,
FieldInfo[] match,
object value,
CultureInfo culture
)
{
return null;
}
public override MethodBase BindToMethod(
BindingFlags bindingAttr,
MethodBase[] match,
ref object[] args,
ParameterModifier[] modifiers,
CultureInfo culture,
string[] names,
out object state
)
{
// Store the arguments to the method in a state object.
BinderState binderState = new BinderState();
object[] arguments = new Object[args.Length];
args.CopyTo(arguments, 0);
binderState.args = arguments;
state = binderState;
if(match == null)
throw new ArgumentNullException();
for(int x = 0; x < match.Length; x++)
{
int count = 0;
ParameterInfo[] parameters = match[x].GetParameters();
if(args.Length != parameters.Length)
continue;
for(int y = 0; y < args.Length; y++)
{
if(ChangeType(args[y], parameters[y].ParameterType, culture) != null)
count++;
else
break;
}
if(count == args.Length)
return match[x];
}
return null;
}
public override object ChangeType(
object value,
Type myChangeType,
CultureInfo culture
)
{
TypeCode src_type = Type.GetTypeCode (value.GetType());
TypeCode dest_type = Type.GetTypeCode (myChangeType);
switch (dest_type) {
case TypeCode.String:
switch (src_type) {
case TypeCode.SByte:
case TypeCode.Byte:
return (StringType.FromByte ((byte)value));
case TypeCode.UInt16:
case TypeCode.Int16:
return (StringType.FromShort ((short)value));
case TypeCode.UInt32:
case TypeCode.Int32:
return (StringType.FromInteger ((int)value));
case TypeCode.UInt64:
case TypeCode.Int64:
return (StringType.FromLong ((long)value));
case TypeCode.Char:
return (StringType.FromChar ((char)value));
case TypeCode.Single:
return (StringType.FromSingle ((float)value));
case TypeCode.Double:
return (StringType.FromDouble ((double)value));
case TypeCode.Boolean:
return (StringType.FromBoolean ((bool)value));
case TypeCode.Object:
return (StringType.FromObject (value));
}
break;
case TypeCode.Int32:
case TypeCode.UInt32:
switch (src_type) {
case TypeCode.String:
return (IntegerType.FromString ((string)value));
case TypeCode.Object:
return (IntegerType.FromObject (value));
}
break;
case TypeCode.Int16:
case TypeCode.UInt16:
switch (src_type) {
case TypeCode.String:
return (ShortType.FromString ((string)value));
case TypeCode.Object:
return (ShortType.FromObject (value));
}
break;
case TypeCode.Object:
return ((Object) value);
}
return null;
}
public override void ReorderArgumentArray(
ref object[] args,
object state
)
{
}
public override MethodBase SelectMethod(
BindingFlags bindingAttr,
MethodBase[] match,
Type[] types,
ParameterModifier[] modifiers
)
{
return null;
}
public override PropertyInfo SelectProperty(
BindingFlags bindingAttr,
PropertyInfo[] match,
Type returnType,
Type[] indexes,
ParameterModifier[] modifiers
)
{
return null;
}
}
}
@@ -19,7 +19,7 @@ namespace Microsoft.VisualBasic {
/// Use this to decorate any element which you think is not complete
/// </remarks>
[AttributeUsage (AttributeTargets.All, AllowMultiple=true)]
internal class MonoTODOAttribute : Attribute {
public class MonoTODOAttribute : Attribute {
private string comment;
@@ -1,8 +1,3 @@
2003-05-13 Martin Willemoes Hansen <[email protected]>
* CollectionTest.cs ConversionTest.cs DateAndTimeTest.cs
Inherited from Assertion and removed
Assertion. prefix from assertions
2003-04-17 Nick Drochak <[email protected]>
* makefile.gnu: get the nunit dll from class/lib now.
@@ -16,7 +16,7 @@ using System.Collections;
namespace MonoTests.Microsoft.VisualBasic
{
[TestFixture]
public class CollectionTest : Assertion
public class CollectionTest
{
[SetUp]
@@ -33,8 +33,8 @@ namespace MonoTests.Microsoft.VisualBasic
c = new Collection();
AssertNotNull("#N01", c);
AssertEquals("#N02", 0, c.Count);
Assertion.AssertNotNull("#N01", c);
Assertion.AssertEquals("#N02", 0, c.Count);
}
// Test Add method with Key == null
@@ -49,10 +49,10 @@ namespace MonoTests.Microsoft.VisualBasic
c.Add(typeof(double), null, null, null);
c.Add(typeof(string), null, null, null);
AssertEquals("#ANK01", 3, c.Count);
Assertion.AssertEquals("#ANK01", 3, c.Count);
// Collection class is 1-based
AssertEquals("#ANK02", typeof(string), c[3]);
Assertion.AssertEquals("#ANK02", typeof(string), c[3]);
}
@@ -69,11 +69,11 @@ namespace MonoTests.Microsoft.VisualBasic
c.Add("Basketball", "Basket", null, null);
c.Add("Volleyball", "Volley", null, null);
AssertEquals("#AK01", 4, c.Count);
Assertion.AssertEquals("#AK01", 4, c.Count);
// Collection class is 1-based
AssertEquals("#AK02", "Baseball", c[1]);
AssertEquals("#AK03", "Volleyball", c["Volley"]);
Assertion.AssertEquals("#AK02", "Baseball", c[1]);
Assertion.AssertEquals("#AK03", "Volleyball", c["Volley"]);
}
@@ -90,12 +90,12 @@ namespace MonoTests.Microsoft.VisualBasic
c.Add(typeof(string), null, 2, null);
c.Add(typeof(object), null, 2, null);
AssertEquals("#ABNK01", 4, c.Count);
Assertion.AssertEquals("#ABNK01", 4, c.Count);
// Collection class is 1-based
AssertEquals("#ABNK02", typeof(int), c[4]);
AssertEquals("#ABNK03", typeof(double), c[1]);
AssertEquals("#ABNK04", typeof(object), c[2]);
Assertion.AssertEquals("#ABNK02", typeof(int), c[4]);
Assertion.AssertEquals("#ABNK03", typeof(double), c[1]);
Assertion.AssertEquals("#ABNK04", typeof(object), c[2]);
}
@@ -112,11 +112,11 @@ namespace MonoTests.Microsoft.VisualBasic
c.Add("Basketball", "Basket", 1, null);
c.Add("Volleyball", "Volley", 3, null);
AssertEquals("#ABK01", 4, c.Count);
AssertEquals("#ABK02", "Basketball", c[1]);
AssertEquals("#ABK03", "Baseball", c[4]);
AssertEquals("#ABK04", "Volleyball", c["Volley"]);
AssertEquals("#ABK05", "Football", c["Foot"]);
Assertion.AssertEquals("#ABK01", 4, c.Count);
Assertion.AssertEquals("#ABK02", "Basketball", c[1]);
Assertion.AssertEquals("#ABK03", "Baseball", c[4]);
Assertion.AssertEquals("#ABK04", "Volleyball", c["Volley"]);
Assertion.AssertEquals("#ABK05", "Football", c["Foot"]);
}
@@ -133,12 +133,12 @@ namespace MonoTests.Microsoft.VisualBasic
c.Add(typeof(string), null, null, 1);
c.Add(typeof(object), null, null, 3);
AssertEquals("#AANK01", 4, c.Count);
Assertion.AssertEquals("#AANK01", 4, c.Count);
// Collection class is 1-based
AssertEquals("#AANK02", typeof(object), c[4]);
AssertEquals("#AANK03", typeof(int), c[1]);
AssertEquals("#AANK04", typeof(string), c[2]);
Assertion.AssertEquals("#AANK02", typeof(object), c[4]);
Assertion.AssertEquals("#AANK03", typeof(int), c[1]);
Assertion.AssertEquals("#AANK04", typeof(string), c[2]);
}
@@ -155,13 +155,13 @@ namespace MonoTests.Microsoft.VisualBasic
c.Add("Basketball", "Basket", null, 1);
c.Add("Volleyball", "Volley", null, 2);
AssertEquals("#AAK01", 4, c.Count);
Assertion.AssertEquals("#AAK01", 4, c.Count);
// Collection class is 1-based
AssertEquals("#AAK02", "Baseball", c[1]);
AssertEquals("#AAK03", "Football", c[4]);
AssertEquals("#AAK04", "Basketball", c["Basket"]);
AssertEquals("#AAK05", "Volleyball", c["Volley"]);
Assertion.AssertEquals("#AAK02", "Baseball", c[1]);
Assertion.AssertEquals("#AAK03", "Football", c[4]);
Assertion.AssertEquals("#AAK04", "Basketball", c["Basket"]);
Assertion.AssertEquals("#AAK05", "Volleyball", c["Volley"]);
}
// Test GetEnumerator method
@@ -183,17 +183,17 @@ namespace MonoTests.Microsoft.VisualBasic
e = c.GetEnumerator();
AssertNotNull("#GE01", e);
Assertion.AssertNotNull("#GE01", e);
while (e.MoveNext()) {
AssertEquals("#GE02." + i.ToString(), o[i], e.Current);
Assertion.AssertEquals("#GE02." + i.ToString(), o[i], e.Current);
i++;
}
e.Reset();
e.MoveNext();
AssertEquals("#GE03", o[0], e.Current);
Assertion.AssertEquals("#GE03", o[0], e.Current);
}
@@ -215,7 +215,7 @@ namespace MonoTests.Microsoft.VisualBasic
foreach (object item in c) {
AssertEquals("#fe01." + i.ToString(), o[i], item);
Assertion.AssertEquals("#fe01." + i.ToString(), o[i], item);
i++;
}
@@ -234,29 +234,29 @@ namespace MonoTests.Microsoft.VisualBasic
c.Add(typeof(string), null, null, null);
c.Add(typeof(object), null, null, null);
AssertEquals("#RNK01", 4, c.Count);
Assertion.AssertEquals("#RNK01", 4, c.Count);
c.Remove(3);
AssertEquals("#RNK02", 3, c.Count);
Assertion.AssertEquals("#RNK02", 3, c.Count);
// Collection class is 1-based
AssertEquals("#RNK03", typeof(object), c[3]);
Assertion.AssertEquals("#RNK03", typeof(object), c[3]);
c.Remove(1);
AssertEquals("#RNK04", 2, c.Count);
AssertEquals("#RNK05", typeof(double), c[1]);
AssertEquals("#RNK06", typeof(object), c[2]);
Assertion.AssertEquals("#RNK04", 2, c.Count);
Assertion.AssertEquals("#RNK05", typeof(double), c[1]);
Assertion.AssertEquals("#RNK06", typeof(object), c[2]);
c.Remove(2);
AssertEquals("#RNK07", 1, c.Count);
AssertEquals("#RNK08", typeof(double), c[1]);
Assertion.AssertEquals("#RNK07", 1, c.Count);
Assertion.AssertEquals("#RNK08", typeof(double), c[1]);
c.Remove(1);
AssertEquals("#RNK09", 0, c.Count);
Assertion.AssertEquals("#RNK09", 0, c.Count);
}
@@ -273,31 +273,31 @@ namespace MonoTests.Microsoft.VisualBasic
c.Add("Basketball", "Basket", null, null);
c.Add("Volleyball", "Volley", null, null);
AssertEquals("#RK01", 4, c.Count);
Assertion.AssertEquals("#RK01", 4, c.Count);
c.Remove("Foot");
AssertEquals("#RK02", 3, c.Count);
AssertEquals("#RK03", "Basketball", c["Basket"]);
Assertion.AssertEquals("#RK02", 3, c.Count);
Assertion.AssertEquals("#RK03", "Basketball", c["Basket"]);
// Collection class is 1-based
AssertEquals("#RK04", "Volleyball", c[3]);
Assertion.AssertEquals("#RK04", "Volleyball", c[3]);
c.Remove("Base");
AssertEquals("#RK05", 2, c.Count);
AssertEquals("#RK06", "Basketball", c[1]);
AssertEquals("#RK07", "Volleyball", c["Volley"]);
Assertion.AssertEquals("#RK05", 2, c.Count);
Assertion.AssertEquals("#RK06", "Basketball", c[1]);
Assertion.AssertEquals("#RK07", "Volleyball", c["Volley"]);
c.Remove(2);
AssertEquals("#RK08", 1, c.Count);
AssertEquals("#RK09", "Basketball", c[1]);
AssertEquals("#RK10", "Basketball", c["Basket"]);
Assertion.AssertEquals("#RK08", 1, c.Count);
Assertion.AssertEquals("#RK09", "Basketball", c[1]);
Assertion.AssertEquals("#RK10", "Basketball", c["Basket"]);
c.Remove(1);
AssertEquals("#RK11", 0, c.Count);
Assertion.AssertEquals("#RK11", 0, c.Count);
}
// Test all the Exceptions we're supposed to throw
@@ -314,11 +314,11 @@ namespace MonoTests.Microsoft.VisualBasic
object o = c[0];
}
catch (Exception e) {
AssertEquals("#E01", typeof(IndexOutOfRangeException), e.GetType());
Assertion.AssertEquals("#E01", typeof(IndexOutOfRangeException), e.GetType());
caughtException = true;
}
AssertEquals("#E02", true, caughtException);
Assertion.AssertEquals("#E02", true, caughtException);
c.Add("Baseball", "Base", null, null);
c.Add("Football", "Foot", null, null);
@@ -332,11 +332,11 @@ namespace MonoTests.Microsoft.VisualBasic
object o = c[5];
}
catch (Exception e) {
AssertEquals("#E03", typeof(IndexOutOfRangeException), e.GetType());
Assertion.AssertEquals("#E03", typeof(IndexOutOfRangeException), e.GetType());
caughtException = true;
}
AssertEquals("#E04", true, caughtException);
Assertion.AssertEquals("#E04", true, caughtException);
caughtException = false;
@@ -345,11 +345,11 @@ namespace MonoTests.Microsoft.VisualBasic
object o = c[0];
}
catch (Exception e) {
AssertEquals("#E05", typeof(IndexOutOfRangeException), e.GetType());
Assertion.AssertEquals("#E05", typeof(IndexOutOfRangeException), e.GetType());
caughtException = true;
}
AssertEquals("#E06", true, caughtException);
Assertion.AssertEquals("#E06", true, caughtException);
caughtException = false;
@@ -361,12 +361,12 @@ namespace MonoTests.Microsoft.VisualBasic
// FIXME
// VB Language Reference says IndexOutOfRangeException
// here, but MS throws ArgumentException
// AssertEquals("#E07", typeof(IndexOutOfRangeException), e.GetType());
AssertEquals("#E07", typeof(ArgumentException), e.GetType());
// Assertion.AssertEquals("#E07", typeof(IndexOutOfRangeException), e.GetType());
Assertion.AssertEquals("#E07", typeof(ArgumentException), e.GetType());
caughtException = true;
}
AssertEquals("#E08", true, caughtException);
Assertion.AssertEquals("#E08", true, caughtException);
caughtException = false;
@@ -375,11 +375,11 @@ namespace MonoTests.Microsoft.VisualBasic
object o = c[typeof(int)];
}
catch (Exception e) {
AssertEquals("#E09", typeof(ArgumentException), e.GetType());
Assertion.AssertEquals("#E09", typeof(ArgumentException), e.GetType());
caughtException = true;
}
AssertEquals("#E10", true, caughtException);
Assertion.AssertEquals("#E10", true, caughtException);
caughtException = false;
@@ -388,11 +388,11 @@ namespace MonoTests.Microsoft.VisualBasic
c.Add("Kickball", "Kick", "Volley", "Foot");
}
catch (Exception e) {
AssertEquals("#E11", typeof(ArgumentException), e.GetType());
Assertion.AssertEquals("#E11", typeof(ArgumentException), e.GetType());
caughtException = true;
}
AssertEquals("#E12", true, caughtException);
Assertion.AssertEquals("#E12", true, caughtException);
caughtException = false;
@@ -401,11 +401,11 @@ namespace MonoTests.Microsoft.VisualBasic
c.Add("Kickball", "Foot", null, null);
}
catch (Exception e) {
AssertEquals("#E13", typeof(ArgumentException), e.GetType());
Assertion.AssertEquals("#E13", typeof(ArgumentException), e.GetType());
caughtException = true;
}
AssertEquals("#E14", true, caughtException);
Assertion.AssertEquals("#E14", true, caughtException);
caughtException = false;
@@ -414,11 +414,11 @@ namespace MonoTests.Microsoft.VisualBasic
c.Add("Dodgeball", "Dodge", typeof(int), null);
}
catch (Exception e) {
AssertEquals("#E15", typeof(InvalidCastException), e.GetType());
Assertion.AssertEquals("#E15", typeof(InvalidCastException), e.GetType());
caughtException = true;
}
AssertEquals("#E16", true, caughtException);
Assertion.AssertEquals("#E16", true, caughtException);
caughtException = false;
@@ -427,11 +427,11 @@ namespace MonoTests.Microsoft.VisualBasic
c.Add("Wallyball", "Wally", null, typeof(int));
}
catch (Exception e) {
AssertEquals("#E17", typeof(InvalidCastException), e.GetType());
Assertion.AssertEquals("#E17", typeof(InvalidCastException), e.GetType());
caughtException = true;
}
AssertEquals("#E18", true, caughtException);
Assertion.AssertEquals("#E18", true, caughtException);
caughtException = false;
@@ -440,11 +440,11 @@ namespace MonoTests.Microsoft.VisualBasic
c.Remove(null);
}
catch (Exception e) {
AssertEquals("#E19", typeof(ArgumentException), e.GetType());
Assertion.AssertEquals("#E19", typeof(ArgumentException), e.GetType());
caughtException = true;
}
AssertEquals("#E20", true, caughtException);
Assertion.AssertEquals("#E20", true, caughtException);
caughtException = false;
@@ -453,11 +453,11 @@ namespace MonoTests.Microsoft.VisualBasic
c.Remove("Golf");
}
catch (Exception e) {
AssertEquals("#E21", typeof(ArgumentException), e.GetType());
Assertion.AssertEquals("#E21", typeof(ArgumentException), e.GetType());
caughtException = true;
}
AssertEquals("#E22", true, caughtException);
Assertion.AssertEquals("#E22", true, caughtException);
caughtException = false;
@@ -466,11 +466,11 @@ namespace MonoTests.Microsoft.VisualBasic
c.Remove(10);
}
catch (Exception e) {
AssertEquals("#E23", typeof(IndexOutOfRangeException), e.GetType());
Assertion.AssertEquals("#E23", typeof(IndexOutOfRangeException), e.GetType());
caughtException = true;
}
AssertEquals("#E24", true, caughtException);
Assertion.AssertEquals("#E24", true, caughtException);
caughtException = false;
@@ -484,12 +484,12 @@ namespace MonoTests.Microsoft.VisualBasic
// FIXME
// On-line help says InvalidOperationException here,
// but MS throws IndexOutOfRangeException
// AssertEquals("#E25", typeof(InvalidOperationException), e.GetType());
AssertEquals("#E25", typeof(IndexOutOfRangeException), e.GetType());
// Assertion.AssertEquals("#E25", typeof(InvalidOperationException), e.GetType());
Assertion.AssertEquals("#E25", typeof(IndexOutOfRangeException), e.GetType());
caughtException = true;
}
AssertEquals("#E26", true, caughtException);
Assertion.AssertEquals("#E26", true, caughtException);
caughtException = false;
@@ -505,14 +505,14 @@ namespace MonoTests.Microsoft.VisualBasic
catch (Exception e) {
// FIXME
// On-line help says this should throw an error. MS doesn't.
AssertEquals("#E27", typeof(InvalidOperationException), e.GetType());
Assertion.AssertEquals("#E27", typeof(InvalidOperationException), e.GetType());
caughtException = true;
}
// FIXME
// What to do about this? MS doesn't throw an error
// AssertEquals("#E28", true, caughtException);
AssertEquals("#E28", false, caughtException);
// Assertion.AssertEquals("#E28", true, caughtException);
Assertion.AssertEquals("#E28", false, caughtException);
caughtException = false;
@@ -528,14 +528,14 @@ namespace MonoTests.Microsoft.VisualBasic
catch (Exception e) {
// FIXME
// On-line help says this should throw an error. MS doesn't.
AssertEquals("#E29", typeof(InvalidOperationException), e.GetType());
Assertion.AssertEquals("#E29", typeof(InvalidOperationException), e.GetType());
caughtException = true;
}
// FIXME
// What to do about this? MS doesn't throw an error
// AssertEquals("#E30", true, caughtException);
AssertEquals("#E30", false, caughtException);
// Assertion.AssertEquals("#E30", true, caughtException);
Assertion.AssertEquals("#E30", false, caughtException);
caughtException = false;
}
@@ -16,7 +16,7 @@ namespace MonoTests.Microsoft.VisualBasic
{
[TestFixture]
public class ConversionTest : Assertion
public class ConversionTest
{
[SetUp]
@@ -44,106 +44,106 @@ namespace MonoTests.Microsoft.VisualBasic
System.String S;
System.Object O;
AssertEquals("#F01", System.Int16.MaxValue, Conversion.Fix(System.Int16.MaxValue));
AssertEquals("#F02", System.Int16.MinValue, Conversion.Fix(System.Int16.MinValue));
AssertEquals("#F03", System.Int32.MaxValue, Conversion.Fix(System.Int32.MaxValue));
AssertEquals("#F04", System.Int32.MinValue, Conversion.Fix(System.Int32.MinValue));
AssertEquals("#F05", System.Int64.MaxValue, Conversion.Fix(System.Int64.MaxValue));
AssertEquals("#F06", System.Int64.MinValue, Conversion.Fix(System.Int64.MinValue));
AssertEquals("#F07", (System.Single)Math.Floor(System.Single.MaxValue), Conversion.Fix(System.Single.MaxValue));
AssertEquals("#F08", -1 * (System.Single)Math.Floor(-1 * System.Single.MinValue), Conversion.Fix(System.Single.MinValue));
AssertEquals("#F09", Math.Floor(System.Double.MaxValue), Conversion.Fix(System.Double.MaxValue));
AssertEquals("#F10", -1 * Math.Floor(-1 * System.Double.MinValue), Conversion.Fix(System.Double.MinValue));
AssertEquals("#F11", Decimal.Floor(System.Decimal.MaxValue), Conversion.Fix(System.Decimal.MaxValue));
AssertEquals("#F12", -1 * Decimal.Floor(-1 * System.Decimal.MinValue), Conversion.Fix(System.Decimal.MinValue));
Assertion.AssertEquals("#F01", System.Int16.MaxValue, Conversion.Fix(System.Int16.MaxValue));
Assertion.AssertEquals("#F02", System.Int16.MinValue, Conversion.Fix(System.Int16.MinValue));
Assertion.AssertEquals("#F03", System.Int32.MaxValue, Conversion.Fix(System.Int32.MaxValue));
Assertion.AssertEquals("#F04", System.Int32.MinValue, Conversion.Fix(System.Int32.MinValue));
Assertion.AssertEquals("#F05", System.Int64.MaxValue, Conversion.Fix(System.Int64.MaxValue));
Assertion.AssertEquals("#F06", System.Int64.MinValue, Conversion.Fix(System.Int64.MinValue));
Assertion.AssertEquals("#F07", (System.Single)Math.Floor(System.Single.MaxValue), Conversion.Fix(System.Single.MaxValue));
Assertion.AssertEquals("#F08", -1 * (System.Single)Math.Floor(-1 * System.Single.MinValue), Conversion.Fix(System.Single.MinValue));
Assertion.AssertEquals("#F09", Math.Floor(System.Double.MaxValue), Conversion.Fix(System.Double.MaxValue));
Assertion.AssertEquals("#F10", -1 * Math.Floor(-1 * System.Double.MinValue), Conversion.Fix(System.Double.MinValue));
Assertion.AssertEquals("#F11", Decimal.Floor(System.Decimal.MaxValue), Conversion.Fix(System.Decimal.MaxValue));
Assertion.AssertEquals("#F12", -1 * Decimal.Floor(-1 * System.Decimal.MinValue), Conversion.Fix(System.Decimal.MinValue));
Sng = 99.1F;
AssertEquals("#F13", 99F, Conversion.Fix(Sng));
Assertion.AssertEquals("#F13", 99F, Conversion.Fix(Sng));
Sng = 99.6F;
AssertEquals("#F14", 99F, Conversion.Fix(Sng));
Assertion.AssertEquals("#F14", 99F, Conversion.Fix(Sng));
Sng = -99.1F;
AssertEquals("#F15", -99F, Conversion.Fix(Sng));
Assertion.AssertEquals("#F15", -99F, Conversion.Fix(Sng));
Sng = -99.6F;
AssertEquals("#F16", -99F, Conversion.Fix(Sng));
Assertion.AssertEquals("#F16", -99F, Conversion.Fix(Sng));
Dbl = 99.1;
AssertEquals("#F17", 99D, Conversion.Fix(Dbl));
Assertion.AssertEquals("#F17", 99D, Conversion.Fix(Dbl));
Dbl = 99.6;
AssertEquals("#F18", 99D, Conversion.Fix(Dbl));
Assertion.AssertEquals("#F18", 99D, Conversion.Fix(Dbl));
Dbl = -99.1;
AssertEquals("#F19", -99D, Conversion.Fix(Dbl));
Assertion.AssertEquals("#F19", -99D, Conversion.Fix(Dbl));
Dbl = -99.6;
AssertEquals("#F20", -99D, Conversion.Fix(Dbl));
Assertion.AssertEquals("#F20", -99D, Conversion.Fix(Dbl));
Dec = 99.1M;
AssertEquals("#F21", 99M, Conversion.Fix(Dec));
Assertion.AssertEquals("#F21", 99M, Conversion.Fix(Dec));
Dec = 99.6M;
AssertEquals("#F22", 99M, Conversion.Fix(Dec));
Assertion.AssertEquals("#F22", 99M, Conversion.Fix(Dec));
Dec = -99.1M;
AssertEquals("#F23", -99M, Conversion.Fix(Dec));
Assertion.AssertEquals("#F23", -99M, Conversion.Fix(Dec));
Dec = -99.6M;
AssertEquals("#F24", -99M, Conversion.Fix(Dec));
Assertion.AssertEquals("#F24", -99M, Conversion.Fix(Dec));
Dbl = 99.1;
S = Dbl.ToString();
AssertEquals("#F25", 99D, Conversion.Fix(S));
Assertion.AssertEquals("#F25", 99D, Conversion.Fix(S));
Dbl = 99.6;
S = Dbl.ToString();
AssertEquals("#F26", 99D, Conversion.Fix(S));
Assertion.AssertEquals("#F26", 99D, Conversion.Fix(S));
Dbl = -99.1;
S = Dbl.ToString();
AssertEquals("#F27", -99D, Conversion.Fix(S));
Assertion.AssertEquals("#F27", -99D, Conversion.Fix(S));
Dbl = -99.6;
S = Dbl.ToString();
AssertEquals("#F28", -99D, Conversion.Fix(S));
Assertion.AssertEquals("#F28", -99D, Conversion.Fix(S));
Dbl = 99.1;
O = Dbl;
AssertEquals("#F29", 99D, Conversion.Fix(O));
Assertion.AssertEquals("#F29", 99D, Conversion.Fix(O));
Sng = 99.6F;
O = Sng;
AssertEquals("#F30", (System.Object)99F, Conversion.Fix(O));
Assertion.AssertEquals("#F30", (System.Object)99F, Conversion.Fix(O));
Dbl = -99.1;
O = Dbl;
AssertEquals("#F31", -99D, Conversion.Fix(O));
Assertion.AssertEquals("#F31", -99D, Conversion.Fix(O));
Dec = -99.6M;
O = Dec;
AssertEquals("#F32", (System.Object)(-99M), Conversion.Fix(O));
Assertion.AssertEquals("#F32", (System.Object)(-99M), Conversion.Fix(O));
O = typeof(int);
@@ -153,22 +153,22 @@ namespace MonoTests.Microsoft.VisualBasic
Conversion.Fix(O);
}
catch (Exception e) {
AssertEquals("#F33", typeof(ArgumentException), e.GetType());
Assertion.AssertEquals("#F33", typeof(ArgumentException), e.GetType());
caughtException = true;
}
AssertEquals("#F34", true, caughtException);
Assertion.AssertEquals("#F34", true, caughtException);
caughtException = false;
try {
Conversion.Fix(null);
}
catch (Exception e) {
AssertEquals("#F35", typeof(ArgumentNullException), e.GetType());
Assertion.AssertEquals("#F35", typeof(ArgumentNullException), e.GetType());
caughtException = true;
}
AssertEquals("#F36", true, caughtException);
Assertion.AssertEquals("#F36", true, caughtException);
}
@@ -181,106 +181,106 @@ namespace MonoTests.Microsoft.VisualBasic
System.String S;
System.Object O;
AssertEquals("#I01", System.Int16.MaxValue, Conversion.Int(System.Int16.MaxValue));
AssertEquals("#I02", System.Int16.MinValue, Conversion.Int(System.Int16.MinValue));
AssertEquals("#I03", System.Int32.MaxValue, Conversion.Int(System.Int32.MaxValue));
AssertEquals("#I04", System.Int32.MinValue, Conversion.Int(System.Int32.MinValue));
AssertEquals("#I05", System.Int64.MaxValue, Conversion.Int(System.Int64.MaxValue));
AssertEquals("#I06", System.Int64.MinValue, Conversion.Int(System.Int64.MinValue));
AssertEquals("#I07", (System.Single)Math.Floor(System.Single.MaxValue), Conversion.Int(System.Single.MaxValue));
AssertEquals("#I08", (System.Single)Math.Floor(System.Single.MinValue), Conversion.Int(System.Single.MinValue));
AssertEquals("#I09", Math.Floor(System.Double.MaxValue), Conversion.Int(System.Double.MaxValue));
AssertEquals("#I10", Math.Floor(System.Double.MinValue), Conversion.Int(System.Double.MinValue));
AssertEquals("#I11", Decimal.Floor(System.Decimal.MaxValue), Conversion.Int(System.Decimal.MaxValue));
AssertEquals("#I12", Decimal.Floor(System.Decimal.MinValue), Conversion.Int(System.Decimal.MinValue));
Assertion.AssertEquals("#I01", System.Int16.MaxValue, Conversion.Int(System.Int16.MaxValue));
Assertion.AssertEquals("#I02", System.Int16.MinValue, Conversion.Int(System.Int16.MinValue));
Assertion.AssertEquals("#I03", System.Int32.MaxValue, Conversion.Int(System.Int32.MaxValue));
Assertion.AssertEquals("#I04", System.Int32.MinValue, Conversion.Int(System.Int32.MinValue));
Assertion.AssertEquals("#I05", System.Int64.MaxValue, Conversion.Int(System.Int64.MaxValue));
Assertion.AssertEquals("#I06", System.Int64.MinValue, Conversion.Int(System.Int64.MinValue));
Assertion.AssertEquals("#I07", (System.Single)Math.Floor(System.Single.MaxValue), Conversion.Int(System.Single.MaxValue));
Assertion.AssertEquals("#I08", (System.Single)Math.Floor(System.Single.MinValue), Conversion.Int(System.Single.MinValue));
Assertion.AssertEquals("#I09", Math.Floor(System.Double.MaxValue), Conversion.Int(System.Double.MaxValue));
Assertion.AssertEquals("#I10", Math.Floor(System.Double.MinValue), Conversion.Int(System.Double.MinValue));
Assertion.AssertEquals("#I11", Decimal.Floor(System.Decimal.MaxValue), Conversion.Int(System.Decimal.MaxValue));
Assertion.AssertEquals("#I12", Decimal.Floor(System.Decimal.MinValue), Conversion.Int(System.Decimal.MinValue));
Sng = 99.1F;
AssertEquals("#I13", 99F, Conversion.Int(Sng));
Assertion.AssertEquals("#I13", 99F, Conversion.Int(Sng));
Sng = 99.6F;
AssertEquals("#I14", 99F, Conversion.Int(Sng));
Assertion.AssertEquals("#I14", 99F, Conversion.Int(Sng));
Sng = -99.1F;
AssertEquals("#I15", -100F, Conversion.Int(Sng));
Assertion.AssertEquals("#I15", -100F, Conversion.Int(Sng));
Sng = -99.6F;
AssertEquals("#I16", -100F, Conversion.Int(Sng));
Assertion.AssertEquals("#I16", -100F, Conversion.Int(Sng));
Dbl = 99.1;
AssertEquals("#I17", 99D, Conversion.Int(Dbl));
Assertion.AssertEquals("#I17", 99D, Conversion.Int(Dbl));
Dbl = 99.6;
AssertEquals("#I18", 99D, Conversion.Int(Dbl));
Assertion.AssertEquals("#I18", 99D, Conversion.Int(Dbl));
Dbl = -99.1;
AssertEquals("#I19", -100D, Conversion.Int(Dbl));
Assertion.AssertEquals("#I19", -100D, Conversion.Int(Dbl));
Dbl = -99.6;
AssertEquals("#I20", -100D, Conversion.Int(Dbl));
Assertion.AssertEquals("#I20", -100D, Conversion.Int(Dbl));
Dec = 99.1M;
AssertEquals("#I21", 99M, Conversion.Int(Dec));
Assertion.AssertEquals("#I21", 99M, Conversion.Int(Dec));
Dec = 99.6M;
AssertEquals("#I22", 99M, Conversion.Int(Dec));
Assertion.AssertEquals("#I22", 99M, Conversion.Int(Dec));
Dec = -99.1M;
AssertEquals("#I23", -100M, Conversion.Int(Dec));
Assertion.AssertEquals("#I23", -100M, Conversion.Int(Dec));
Dec = -99.6M;
AssertEquals("#I24", -100M, Conversion.Int(Dec));
Assertion.AssertEquals("#I24", -100M, Conversion.Int(Dec));
Dbl = 99.1;
S = Dbl.ToString();
AssertEquals("#I25", 99D, Conversion.Int(S));
Assertion.AssertEquals("#I25", 99D, Conversion.Int(S));
Dbl = 99.6;
S = Dbl.ToString();
AssertEquals("#I26", 99D, Conversion.Int(S));
Assertion.AssertEquals("#I26", 99D, Conversion.Int(S));
Dbl = -99.1;
S = Dbl.ToString();
AssertEquals("#I27", -100D, Conversion.Int(S));
Assertion.AssertEquals("#I27", -100D, Conversion.Int(S));
Dbl = -99.6;
S = Dbl.ToString();
AssertEquals("#I28", -100D, Conversion.Int(S));
Assertion.AssertEquals("#I28", -100D, Conversion.Int(S));
Dbl = 99.1;
O = Dbl;
AssertEquals("#I29", 99D, Conversion.Int(O));
Assertion.AssertEquals("#I29", 99D, Conversion.Int(O));
Sng = 99.6F;
O = Sng;
AssertEquals("#I30", 99F, Conversion.Int(O));
Assertion.AssertEquals("#I30", 99F, Conversion.Int(O));
Dbl = -99.1;
O = Dbl;
AssertEquals("#I31", -100D, Conversion.Int(O));
Assertion.AssertEquals("#I31", -100D, Conversion.Int(O));
Dec = -99.6M;
O = Dec;
AssertEquals("#I32", -100M, Conversion.Int(O));
Assertion.AssertEquals("#I32", -100M, Conversion.Int(O));
// test the exceptions it's supposed to throw
@@ -291,22 +291,22 @@ namespace MonoTests.Microsoft.VisualBasic
Conversion.Fix(O);
}
catch (Exception e) {
AssertEquals("#I33", typeof(ArgumentException), e.GetType());
Assertion.AssertEquals("#I33", typeof(ArgumentException), e.GetType());
caughtException = true;
}
AssertEquals("#I34", true, caughtException);
Assertion.AssertEquals("#I34", true, caughtException);
caughtException = false;
try {
Conversion.Int(null);
}
catch (Exception e) {
AssertEquals("#I35", typeof(ArgumentNullException), e.GetType());
Assertion.AssertEquals("#I35", typeof(ArgumentNullException), e.GetType());
caughtException = true;
}
AssertEquals("#I36", true, caughtException);
Assertion.AssertEquals("#I36", true, caughtException);
}
@@ -314,14 +314,14 @@ namespace MonoTests.Microsoft.VisualBasic
// test the Hex function
[Test]
public void Hex() {
AssertEquals("#H01", "FF", Conversion.Hex(System.Byte.MaxValue));
AssertEquals("#H02", "0", Conversion.Hex(System.Byte.MinValue));
AssertEquals("#H03", "7FFF", Conversion.Hex(System.Int16.MaxValue));
AssertEquals("#H04", "8000", Conversion.Hex(System.Int16.MinValue));
AssertEquals("#H05", "7FFFFFFF", Conversion.Hex(System.Int32.MaxValue));
AssertEquals("#H06", "80000000", Conversion.Hex(System.Int32.MinValue));
AssertEquals("#H07", "7FFFFFFFFFFFFFFF", Conversion.Hex(System.Int64.MaxValue));
AssertEquals("#H08", "8000000000000000", Conversion.Hex(System.Int64.MinValue));
Assertion.AssertEquals("#H01", "FF", Conversion.Hex(System.Byte.MaxValue));
Assertion.AssertEquals("#H02", "0", Conversion.Hex(System.Byte.MinValue));
Assertion.AssertEquals("#H03", "7FFF", Conversion.Hex(System.Int16.MaxValue));
Assertion.AssertEquals("#H04", "8000", Conversion.Hex(System.Int16.MinValue));
Assertion.AssertEquals("#H05", "7FFFFFFF", Conversion.Hex(System.Int32.MaxValue));
Assertion.AssertEquals("#H06", "80000000", Conversion.Hex(System.Int32.MinValue));
Assertion.AssertEquals("#H07", "7FFFFFFFFFFFFFFF", Conversion.Hex(System.Int64.MaxValue));
Assertion.AssertEquals("#H08", "8000000000000000", Conversion.Hex(System.Int64.MinValue));
System.Byte UI8;
System.Int16 I16;
@@ -331,107 +331,107 @@ namespace MonoTests.Microsoft.VisualBasic
System.String S;
UI8 = 15;
AssertEquals("#H09", "F", Conversion.Hex(UI8));
Assertion.AssertEquals("#H09", "F", Conversion.Hex(UI8));
I16 = System.Byte.MaxValue;
AssertEquals("#H10", "FF", Conversion.Hex(I16));
Assertion.AssertEquals("#H10", "FF", Conversion.Hex(I16));
I16 = (System.Int16)((I16 + 1) * -1);
AssertEquals("#H11", "FF00", Conversion.Hex(I16));
Assertion.AssertEquals("#H11", "FF00", Conversion.Hex(I16));
I16 = -2;
AssertEquals("#H12", "FFFE", Conversion.Hex(I16));
Assertion.AssertEquals("#H12", "FFFE", Conversion.Hex(I16));
I32 = System.UInt16.MaxValue;
AssertEquals("#H13", "FFFF", Conversion.Hex(I32));
Assertion.AssertEquals("#H13", "FFFF", Conversion.Hex(I32));
I32 = (I32 + 1) * -1;
AssertEquals("#H14", "FFFF0000", Conversion.Hex(I32));
Assertion.AssertEquals("#H14", "FFFF0000", Conversion.Hex(I32));
I32 = -2;
AssertEquals("#H15", "FFFFFFFE", Conversion.Hex(I32));
Assertion.AssertEquals("#H15", "FFFFFFFE", Conversion.Hex(I32));
I64 = System.UInt32.MaxValue;
AssertEquals("#H16", "FFFFFFFF", Conversion.Hex(I64));
Assertion.AssertEquals("#H16", "FFFFFFFF", Conversion.Hex(I64));
I64 = (I64 + 1) * -1;
AssertEquals("#H17", "FFFFFFFF00000000", Conversion.Hex(I64));
Assertion.AssertEquals("#H17", "FFFFFFFF00000000", Conversion.Hex(I64));
I64 = -2;
AssertEquals("#H18", "FFFFFFFFFFFFFFFE", Conversion.Hex(I64));
Assertion.AssertEquals("#H18", "FFFFFFFFFFFFFFFE", Conversion.Hex(I64));
I16 = System.Byte.MaxValue;
S = I16.ToString();
AssertEquals("#H19", "FF", Conversion.Hex(S));
Assertion.AssertEquals("#H19", "FF", Conversion.Hex(S));
I16 = (System.Int16)((I16 + 1) * -1);
S = I16.ToString();
AssertEquals("#H20", "FFFFFF00", Conversion.Hex(S));
Assertion.AssertEquals("#H20", "FFFFFF00", Conversion.Hex(S));
I16 = -1;
S = I16.ToString();
AssertEquals("#H21", "FFFFFFFF", Conversion.Hex(S));
Assertion.AssertEquals("#H21", "FFFFFFFF", Conversion.Hex(S));
I32 = System.UInt16.MaxValue;
S = I32.ToString();
AssertEquals("#H22", "FFFF", Conversion.Hex(S));
Assertion.AssertEquals("#H22", "FFFF", Conversion.Hex(S));
I32 = (I32 + 1) * -1;
S = I32.ToString();
AssertEquals("#H23", "FFFF0000", Conversion.Hex(S));
Assertion.AssertEquals("#H23", "FFFF0000", Conversion.Hex(S));
I32 = -2;
S = I32.ToString();
AssertEquals("#H24", "FFFFFFFE", Conversion.Hex(S));
Assertion.AssertEquals("#H24", "FFFFFFFE", Conversion.Hex(S));
I64 = System.UInt32.MaxValue;
S = I64.ToString();
AssertEquals("#H25", "FFFFFFFF", Conversion.Hex(S));
Assertion.AssertEquals("#H25", "FFFFFFFF", Conversion.Hex(S));
I64 = (I64 + 1) * -1;
S = I64.ToString();
AssertEquals("#H26", "FFFFFFFF00000000", Conversion.Hex(S));
Assertion.AssertEquals("#H26", "FFFFFFFF00000000", Conversion.Hex(S));
UI8 = System.Byte.MaxValue;
O = UI8;
AssertEquals("#H27", "FF", Conversion.Hex(O));
Assertion.AssertEquals("#H27", "FF", Conversion.Hex(O));
I16 = System.Byte.MaxValue;
O = I16;
AssertEquals("#H28", "FF", Conversion.Hex(O));
Assertion.AssertEquals("#H28", "FF", Conversion.Hex(O));
I16 = (System.Int16)((I16 + 1) * -1);
O = I16;
AssertEquals("#H29", "FF00", Conversion.Hex(O));
Assertion.AssertEquals("#H29", "FF00", Conversion.Hex(O));
I16 = -2;
O = I16;
AssertEquals("#H30", "FFFE", Conversion.Hex(O));
Assertion.AssertEquals("#H30", "FFFE", Conversion.Hex(O));
I32 = System.UInt16.MaxValue;
O = I32;
AssertEquals("#H31", "FFFF", Conversion.Hex(O));
Assertion.AssertEquals("#H31", "FFFF", Conversion.Hex(O));
I32 = (I32 + 1) * -1;
O = I32;
AssertEquals("#H32", "FFFF0000", Conversion.Hex(O));
Assertion.AssertEquals("#H32", "FFFF0000", Conversion.Hex(O));
I32 = -2;
O = I32;
AssertEquals("#H33", "FFFFFFFE", Conversion.Hex(O));
Assertion.AssertEquals("#H33", "FFFFFFFE", Conversion.Hex(O));
I64 = System.UInt32.MaxValue;
O = I64;
AssertEquals("#H34", "FFFFFFFF", Conversion.Hex(O));
Assertion.AssertEquals("#H34", "FFFFFFFF", Conversion.Hex(O));
I64 = (I64 + 1) * -1;
O = I64;
AssertEquals("#H35", "FFFFFFFF00000000", Conversion.Hex(O));
Assertion.AssertEquals("#H35", "FFFFFFFF00000000", Conversion.Hex(O));
I64 = -2;
O = I64;
// FIXME : MS doesn't pass this test
//AssertEquals("#H35", "FFFFFFFFFFFFFFFE", Conversion.Hex(O));
//Assertion.AssertEquals("#H35", "FFFFFFFFFFFFFFFE", Conversion.Hex(O));
O = typeof(int);
@@ -440,11 +440,11 @@ namespace MonoTests.Microsoft.VisualBasic
Conversion.Hex(O);
}
catch (Exception e) {
AssertEquals("#H36", typeof(ArgumentException), e.GetType());
Assertion.AssertEquals("#H36", typeof(ArgumentException), e.GetType());
caughtException = true;
}
AssertEquals("#H37", true, caughtException);
Assertion.AssertEquals("#H37", true, caughtException);
caughtException = false;
@@ -452,24 +452,24 @@ namespace MonoTests.Microsoft.VisualBasic
Conversion.Hex(null);
}
catch (Exception e) {
AssertEquals("#H38", typeof(ArgumentNullException), e.GetType());
Assertion.AssertEquals("#H38", typeof(ArgumentNullException), e.GetType());
caughtException = true;
}
AssertEquals("#H39", true, caughtException);
Assertion.AssertEquals("#H39", true, caughtException);
}
// test the Oct function
[Test]
public void Oct() {
AssertEquals("#O01", "377", Conversion.Oct(System.Byte.MaxValue));
AssertEquals("#O02", "0", Conversion.Oct(System.Byte.MinValue));
AssertEquals("#O03", "77777", Conversion.Oct(System.Int16.MaxValue));
AssertEquals("#O04", "100000", Conversion.Oct(System.Int16.MinValue));
AssertEquals("#O05", "17777777777", Conversion.Oct(System.Int32.MaxValue));
AssertEquals("#O06", "20000000000", Conversion.Oct(System.Int32.MinValue));
AssertEquals("#O07", "777777777777777777777", Conversion.Oct(System.Int64.MaxValue));
//AssertEquals("#O08", "1000000000000000000000", Conversion.Oct(System.Int64.MinValue));
Assertion.AssertEquals("#O01", "377", Conversion.Oct(System.Byte.MaxValue));
Assertion.AssertEquals("#O02", "0", Conversion.Oct(System.Byte.MinValue));
Assertion.AssertEquals("#O03", "77777", Conversion.Oct(System.Int16.MaxValue));
Assertion.AssertEquals("#O04", "100000", Conversion.Oct(System.Int16.MinValue));
Assertion.AssertEquals("#O05", "17777777777", Conversion.Oct(System.Int32.MaxValue));
Assertion.AssertEquals("#O06", "20000000000", Conversion.Oct(System.Int32.MinValue));
Assertion.AssertEquals("#O07", "777777777777777777777", Conversion.Oct(System.Int64.MaxValue));
//Assertion.AssertEquals("#O08", "1000000000000000000000", Conversion.Oct(System.Int64.MinValue));
System.Byte UI8;
System.Int16 I16;
@@ -479,108 +479,108 @@ namespace MonoTests.Microsoft.VisualBasic
System.String S;
UI8 = 15;
AssertEquals("#O09", "17", Conversion.Oct(UI8));
Assertion.AssertEquals("#O09", "17", Conversion.Oct(UI8));
I16 = System.Byte.MaxValue;
AssertEquals("#O10", "377", Conversion.Oct(I16));
Assertion.AssertEquals("#O10", "377", Conversion.Oct(I16));
I16 = (System.Int16)((I16 + 1) * -1);
AssertEquals("#O11", "177400", Conversion.Oct(I16));
Assertion.AssertEquals("#O11", "177400", Conversion.Oct(I16));
I16 = -2;
AssertEquals("#O12", "177776", Conversion.Oct(I16));
Assertion.AssertEquals("#O12", "177776", Conversion.Oct(I16));
I32 = System.UInt16.MaxValue;
AssertEquals("#O13", "177777", Conversion.Oct(I32));
Assertion.AssertEquals("#O13", "177777", Conversion.Oct(I32));
I32 = (I32 + 1) * -1;
AssertEquals("#O14", "37777600000", Conversion.Oct(I32));
Assertion.AssertEquals("#O14", "37777600000", Conversion.Oct(I32));
I32 = -2;
AssertEquals("#O15", "37777777776", Conversion.Oct(I32));
Assertion.AssertEquals("#O15", "37777777776", Conversion.Oct(I32));
I64 = System.UInt32.MaxValue;
AssertEquals("#O16", "37777777777", Conversion.Oct(I64));
Assertion.AssertEquals("#O16", "37777777777", Conversion.Oct(I64));
I64 = (I64 + 1) * -1;
AssertEquals("#O17", "1777777777740000000000", Conversion.Oct(I64));
Assertion.AssertEquals("#O17", "1777777777740000000000", Conversion.Oct(I64));
I64 = -2;
AssertEquals("#O18", "1777777777777777777776", Conversion.Oct(I64));
Assertion.AssertEquals("#O18", "1777777777777777777776", Conversion.Oct(I64));
I16 = System.Byte.MaxValue;
S = I16.ToString();
AssertEquals("#O19", "377", Conversion.Oct(S));
Assertion.AssertEquals("#O19", "377", Conversion.Oct(S));
I16 = (System.Int16)((I16 + 1) * -1);
S = I16.ToString();
AssertEquals("#O20", "37777777400", Conversion.Oct(S));
Assertion.AssertEquals("#O20", "37777777400", Conversion.Oct(S));
I16 = -2;
S = I16.ToString();
AssertEquals("#O21", "37777777776", Conversion.Oct(S));
Assertion.AssertEquals("#O21", "37777777776", Conversion.Oct(S));
I32 = System.UInt16.MaxValue;
S = I32.ToString();
AssertEquals("#O22", "177777", Conversion.Oct(S));
Assertion.AssertEquals("#O22", "177777", Conversion.Oct(S));
I32 = (I32 + 1) * -1;
S = I32.ToString();
AssertEquals("#O23", "37777600000", Conversion.Oct(S));
Assertion.AssertEquals("#O23", "37777600000", Conversion.Oct(S));
I32 = -2;
S = I32.ToString();
AssertEquals("#O24", "37777777776", Conversion.Oct(S));
Assertion.AssertEquals("#O24", "37777777776", Conversion.Oct(S));
I64 = System.UInt32.MaxValue;
S = I64.ToString();
AssertEquals("#O25", "37777777777", Conversion.Oct(S));
Assertion.AssertEquals("#O25", "37777777777", Conversion.Oct(S));
I64 = (I64 + 1) * -1;
S = I64.ToString();
AssertEquals("#O26", "1777777777740000000000", Conversion.Oct(S));
Assertion.AssertEquals("#O26", "1777777777740000000000", Conversion.Oct(S));
UI8 = System.Byte.MaxValue;
O = UI8;
AssertEquals("#O27", "377", Conversion.Oct(O));
Assertion.AssertEquals("#O27", "377", Conversion.Oct(O));
I16 = System.Byte.MaxValue;
O = I16;
AssertEquals("#O28", "377", Conversion.Oct(O));
Assertion.AssertEquals("#O28", "377", Conversion.Oct(O));
I16 = (System.Int16)((I16 + 1) * -1);
O = I16;
AssertEquals("#O29", "177400", Conversion.Oct(O));
Assertion.AssertEquals("#O29", "177400", Conversion.Oct(O));
I16 = -2;
O = I16;
AssertEquals("#O29", "177776", Conversion.Oct(O));
Assertion.AssertEquals("#O29", "177776", Conversion.Oct(O));
I32 = System.UInt16.MaxValue;
O = I32;
AssertEquals("#O30", "177777", Conversion.Oct(O));
Assertion.AssertEquals("#O30", "177777", Conversion.Oct(O));
I32 = (I32 + 1) * -1;
O = I32;
AssertEquals("#O31", "37777600000", Conversion.Oct(O));
Assertion.AssertEquals("#O31", "37777600000", Conversion.Oct(O));
I32 = -2;
O = I32;
AssertEquals("#O32", "37777777776", Conversion.Oct(O));
Assertion.AssertEquals("#O32", "37777777776", Conversion.Oct(O));
I64 = System.UInt32.MaxValue;
O = I64;
AssertEquals("#O33", "37777777777", Conversion.Oct(O));
Assertion.AssertEquals("#O33", "37777777777", Conversion.Oct(O));
I64 = (I64 + 1) * -1;
O = I64;
AssertEquals("#O34", "1777777777740000000000", Conversion.Oct(O));
Assertion.AssertEquals("#O34", "1777777777740000000000", Conversion.Oct(O));
I64 = -2;
O = I64;
// FIXME: MS doesn't pass this test
// AssertEquals("#O35", "1777777777777777777776", Conversion.Oct(O));
// Assertion.AssertEquals("#O35", "1777777777777777777776", Conversion.Oct(O));
O = typeof(int);
@@ -589,11 +589,11 @@ namespace MonoTests.Microsoft.VisualBasic
Conversion.Oct(O);
}
catch (Exception e) {
AssertEquals("#O36", typeof(ArgumentException), e.GetType());
Assertion.AssertEquals("#O36", typeof(ArgumentException), e.GetType());
caughtException = true;
}
AssertEquals("#O37", true, caughtException);
Assertion.AssertEquals("#O37", true, caughtException);
caughtException = false;
@@ -601,18 +601,18 @@ namespace MonoTests.Microsoft.VisualBasic
Conversion.Oct(null);
}
catch (Exception e) {
AssertEquals("#O38", typeof(ArgumentNullException), e.GetType());
Assertion.AssertEquals("#O38", typeof(ArgumentNullException), e.GetType());
caughtException = true;
}
AssertEquals("#O39", true, caughtException);
Assertion.AssertEquals("#O39", true, caughtException);
}
// test the Str function
[Test]
public void Str() {
AssertEquals("#S01", "-1", Conversion.Str(-1));
AssertEquals("#S02", " 1", Conversion.Str(1));
Assertion.AssertEquals("#S01", "-1", Conversion.Str(-1));
Assertion.AssertEquals("#S02", " 1", Conversion.Str(1));
bool caughtException = false;
Object O = typeof(int);
@@ -621,11 +621,11 @@ namespace MonoTests.Microsoft.VisualBasic
Conversion.Str(O);
}
catch (Exception e) {
AssertEquals("#S03", typeof(InvalidCastException), e.GetType());
Assertion.AssertEquals("#S03", typeof(InvalidCastException), e.GetType());
caughtException = true;
}
AssertEquals("#S04", true, caughtException);
Assertion.AssertEquals("#S04", true, caughtException);
caughtException = false;
@@ -633,7 +633,7 @@ namespace MonoTests.Microsoft.VisualBasic
Conversion.Str(null);
}
catch (Exception e) {
AssertEquals("#S05", typeof(ArgumentNullException), e.GetType());
Assertion.AssertEquals("#S05", typeof(ArgumentNullException), e.GetType());
caughtException = true;
}
}
@@ -641,14 +641,14 @@ namespace MonoTests.Microsoft.VisualBasic
// Test the Val function
[Test]
public void Val() {
AssertEquals("#V01", 4, Conversion.Val('4'));
AssertEquals("#V02", -3542.76, Conversion.Val(" - 3 5 .4 2 7 6E+ 0 0 2 "));
AssertEquals("#V03", 255D, Conversion.Val("&HFF"));
AssertEquals("#V04", 255D, Conversion.Val("&o377"));
Assertion.AssertEquals("#V01", 4, Conversion.Val('4'));
Assertion.AssertEquals("#V02", -3542.76, Conversion.Val(" - 3 5 .4 2 7 6E+ 0 0 2 "));
Assertion.AssertEquals("#V03", 255D, Conversion.Val("&HFF"));
Assertion.AssertEquals("#V04", 255D, Conversion.Val("&o377"));
System.Object O = " - 3 5 .4 7 6E+ 0 0 3";
AssertEquals("#V05", -35476D, Conversion.Val(O));
Assertion.AssertEquals("#V05", -35476D, Conversion.Val(O));
bool caughtException;
@@ -658,11 +658,11 @@ namespace MonoTests.Microsoft.VisualBasic
Conversion.Val("3E+9999999");
}
catch (Exception e) {
AssertEquals("#V06", typeof(OverflowException), e.GetType());
Assertion.AssertEquals("#V06", typeof(OverflowException), e.GetType());
caughtException = true;
}
AssertEquals("#V07", true, caughtException);
Assertion.AssertEquals("#V07", true, caughtException);
caughtException = false;
@@ -670,10 +670,10 @@ namespace MonoTests.Microsoft.VisualBasic
Conversion.Val(typeof(int));
}
catch (Exception e) {
AssertEquals("#V08", typeof(ArgumentException), e.GetType());
Assertion.AssertEquals("#V08", typeof(ArgumentException), e.GetType());
caughtException = true;
}
AssertEquals("#V09", true, caughtException);
Assertion.AssertEquals("#V09", true, caughtException);
}
}
}
@@ -17,7 +17,7 @@ using Microsoft.VisualBasic;
namespace MonoTests.Microsoft.VisualBasic
{
[TestFixture]
public class DateAndTimeTest : Assertion {
public class DateAndTimeTest {
private CultureInfo oldcult;
@@ -40,7 +40,7 @@ namespace MonoTests.Microsoft.VisualBasic
{
string s = DateAndTime.DateString;
DateTime dtNow = DateTime.Today;
AssertEquals("#DS01", dtNow.ToShortDateString(), DateTime.Parse(s).ToShortDateString());
Assertion.AssertEquals("#DS01", dtNow.ToShortDateString(), DateTime.Parse(s).ToShortDateString());
// TODO: Add a test for setting the date string too
}
@@ -48,7 +48,7 @@ namespace MonoTests.Microsoft.VisualBasic
[Test]
public void Today()
{
AssertEquals("#TO01", DateTime.Today, DateAndTime.Today);
Assertion.AssertEquals("#TO01", DateTime.Today, DateAndTime.Today);
// TODO: Add a test for setting Today
}
@@ -68,11 +68,11 @@ namespace MonoTests.Microsoft.VisualBasic
double secTimer3 = DateAndTime.Timer;
// should be same time within a reasonable tolerance
Assert("#TI01", secNow >= secTimer);
Assert("#TI02: SecTimer2=" + secTimer2 + " secNow=" + secNow, secTimer2 >= secNow);
Assertion.Assert("#TI01", secNow >= secTimer);
Assertion.Assert("#TI02: SecTimer2=" + secTimer2 + " secNow=" + secNow, secTimer2 >= secNow);
// third timer should be greater than the first
Assert("#TI03", secTimer3 > secTimer);
Assertion.Assert("#TI03", secTimer3 > secTimer);
}
[Test]
@@ -82,8 +82,8 @@ namespace MonoTests.Microsoft.VisualBasic
DateTime dtTest = DateAndTime.Now;
DateTime dtNow2 = DateTime.Now;
Assert("#N01", dtTest >= dtNow);
Assert("#N02", dtNow2 >= dtTest);
Assertion.Assert("#N01", dtTest >= dtNow);
Assertion.Assert("#N02", dtNow2 >= dtTest);
}
[Test]
@@ -96,8 +96,8 @@ namespace MonoTests.Microsoft.VisualBasic
DateTime dtNow2 = DateTime.Now;
TimeSpan tsNow2 = new TimeSpan(dtNow2.Hour, dtNow2.Minute, dtNow2.Second);
Assert("#TOD01", tsTest.Ticks >= tsNow.Ticks);
Assert("#TOD02", tsNow2.Ticks >= tsTest.Ticks);
Assertion.Assert("#TOD01", tsTest.Ticks >= tsNow.Ticks);
Assertion.Assert("#TOD02", tsNow2.Ticks >= tsTest.Ticks);
// TODO: add a test case for setting time of day
}
@@ -113,8 +113,8 @@ namespace MonoTests.Microsoft.VisualBasic
DateTime dtNow2 = DateTime.Now;
TimeSpan tsNow2 = new TimeSpan(dtNow2.Hour, dtNow2.Minute, dtNow2.Second);
Assert("#TS01", tsTest.Ticks >= tsNow.Ticks);
Assert("#TS02", tsNow2.Ticks >= tsTest.Ticks);
Assertion.Assert("#TS01", tsTest.Ticks >= tsNow.Ticks);
Assertion.Assert("#TS02", tsNow2.Ticks >= tsTest.Ticks);
// TODO: add a test case for setting TimeString
}
@@ -124,8 +124,8 @@ namespace MonoTests.Microsoft.VisualBasic
{
DateTime dtNow = DateTime.Now;
AssertEquals("#DA01", dtNow.AddYears(1), DateAndTime.DateAdd(DateInterval.Year, 1, dtNow));
AssertEquals("#DA02", dtNow.AddYears(-1), DateAndTime.DateAdd("yyyy", -1, dtNow));
Assertion.AssertEquals("#DA01", dtNow.AddYears(1), DateAndTime.DateAdd(DateInterval.Year, 1, dtNow));
Assertion.AssertEquals("#DA02", dtNow.AddYears(-1), DateAndTime.DateAdd("yyyy", -1, dtNow));
bool caughtException = false;
@@ -134,38 +134,38 @@ namespace MonoTests.Microsoft.VisualBasic
DateAndTime.DateAdd("foo", 1, dtNow);
}
catch (Exception e) {
AssertEquals("#DA03", e.GetType(), typeof(ArgumentException));
Assertion.AssertEquals("#DA03", e.GetType(), typeof(ArgumentException));
caughtException = true;
}
AssertEquals("#DA04", caughtException, true);
Assertion.AssertEquals("#DA04", caughtException, true);
AssertEquals("#DA05", dtNow.AddMonths(6), DateAndTime.DateAdd(DateInterval.Quarter, 2, dtNow));
AssertEquals("#DA06", dtNow.AddMonths(-6), DateAndTime.DateAdd("q", -2, dtNow));
Assertion.AssertEquals("#DA05", dtNow.AddMonths(6), DateAndTime.DateAdd(DateInterval.Quarter, 2, dtNow));
Assertion.AssertEquals("#DA06", dtNow.AddMonths(-6), DateAndTime.DateAdd("q", -2, dtNow));
AssertEquals("#DA07", dtNow.AddMonths(3), DateAndTime.DateAdd(DateInterval.Month, 3, dtNow));
AssertEquals("#DA08", dtNow.AddMonths(-3), DateAndTime.DateAdd("m", -3, dtNow));
Assertion.AssertEquals("#DA07", dtNow.AddMonths(3), DateAndTime.DateAdd(DateInterval.Month, 3, dtNow));
Assertion.AssertEquals("#DA08", dtNow.AddMonths(-3), DateAndTime.DateAdd("m", -3, dtNow));
AssertEquals("#DA09", dtNow.AddDays(28), DateAndTime.DateAdd(DateInterval.WeekOfYear, 4, dtNow));
AssertEquals("#DA10", dtNow.AddDays(-28), DateAndTime.DateAdd("ww", -4, dtNow));
Assertion.AssertEquals("#DA09", dtNow.AddDays(28), DateAndTime.DateAdd(DateInterval.WeekOfYear, 4, dtNow));
Assertion.AssertEquals("#DA10", dtNow.AddDays(-28), DateAndTime.DateAdd("ww", -4, dtNow));
AssertEquals("#DA11", dtNow.AddDays(5), DateAndTime.DateAdd(DateInterval.Weekday, 5, dtNow));
AssertEquals("#DA12", dtNow.AddDays(-5), DateAndTime.DateAdd("w", -5, dtNow));
Assertion.AssertEquals("#DA11", dtNow.AddDays(5), DateAndTime.DateAdd(DateInterval.Weekday, 5, dtNow));
Assertion.AssertEquals("#DA12", dtNow.AddDays(-5), DateAndTime.DateAdd("w", -5, dtNow));
AssertEquals("#DA13", dtNow.AddDays(6), DateAndTime.DateAdd(DateInterval.DayOfYear, 6, dtNow));
AssertEquals("#DA14", dtNow.AddDays(-6), DateAndTime.DateAdd("y", -6, dtNow));
Assertion.AssertEquals("#DA13", dtNow.AddDays(6), DateAndTime.DateAdd(DateInterval.DayOfYear, 6, dtNow));
Assertion.AssertEquals("#DA14", dtNow.AddDays(-6), DateAndTime.DateAdd("y", -6, dtNow));
AssertEquals("#DA15", dtNow.AddDays(7), DateAndTime.DateAdd(DateInterval.Day, 7, dtNow));
AssertEquals("#DA16", dtNow.AddDays(-7), DateAndTime.DateAdd("d", -7, dtNow));
Assertion.AssertEquals("#DA15", dtNow.AddDays(7), DateAndTime.DateAdd(DateInterval.Day, 7, dtNow));
Assertion.AssertEquals("#DA16", dtNow.AddDays(-7), DateAndTime.DateAdd("d", -7, dtNow));
AssertEquals("#DA17", dtNow.AddHours(8), DateAndTime.DateAdd(DateInterval.Hour, 8, dtNow));
AssertEquals("#DA18", dtNow.AddHours(-8), DateAndTime.DateAdd(DateInterval.Hour, -8, dtNow));
Assertion.AssertEquals("#DA17", dtNow.AddHours(8), DateAndTime.DateAdd(DateInterval.Hour, 8, dtNow));
Assertion.AssertEquals("#DA18", dtNow.AddHours(-8), DateAndTime.DateAdd(DateInterval.Hour, -8, dtNow));
AssertEquals("#DA19", dtNow.AddMinutes(9), DateAndTime.DateAdd(DateInterval.Minute, 9, dtNow));
AssertEquals("#DA20", dtNow.AddMinutes(-9), DateAndTime.DateAdd("n", -9, dtNow));
Assertion.AssertEquals("#DA19", dtNow.AddMinutes(9), DateAndTime.DateAdd(DateInterval.Minute, 9, dtNow));
Assertion.AssertEquals("#DA20", dtNow.AddMinutes(-9), DateAndTime.DateAdd("n", -9, dtNow));
AssertEquals("#DA21", dtNow.AddSeconds(10), DateAndTime.DateAdd(DateInterval.Second, 10, dtNow));
AssertEquals("#DA22", dtNow.AddSeconds(-10), DateAndTime.DateAdd("s", -10, dtNow));
Assertion.AssertEquals("#DA21", dtNow.AddSeconds(10), DateAndTime.DateAdd(DateInterval.Second, 10, dtNow));
Assertion.AssertEquals("#DA22", dtNow.AddSeconds(-10), DateAndTime.DateAdd("s", -10, dtNow));
caughtException = false;
@@ -174,10 +174,10 @@ namespace MonoTests.Microsoft.VisualBasic
}
catch (Exception e) {
caughtException = true;
AssertEquals("#DA23", e.GetType(), typeof(Exception));
Assertion.AssertEquals("#DA23", e.GetType(), typeof(Exception));
}
// AssertEquals("#DA24", caughtException, true);
// Assertion.AssertEquals("#DA24", caughtException, true);
}
[Test]
@@ -189,22 +189,22 @@ namespace MonoTests.Microsoft.VisualBasic
// TODO: Test this better
long diff = DateAndTime.DateDiff(DateInterval.Year, dtOld, dtNow, FirstDayOfWeek.System, FirstWeekOfYear.System);
AssertEquals("#DD01", dtNow, dtOld.AddYears((int)diff));
Assertion.AssertEquals("#DD01", dtNow, dtOld.AddYears((int)diff));
DateTime dtJan1 = new DateTime(2002, 1, 1);
DateTime dtDec31 = new DateTime(2001, 12, 31);
diff = DateAndTime.DateDiff(DateInterval.Year, dtDec31, dtJan1, FirstDayOfWeek.System, FirstWeekOfYear.System);
AssertEquals("#DD02", 1L, diff);
Assertion.AssertEquals("#DD02", 1L, diff);
diff = DateAndTime.DateDiff(DateInterval.Quarter, dtDec31, dtJan1, FirstDayOfWeek.System, FirstWeekOfYear.System);
AssertEquals("#DD03", 1L, diff);
Assertion.AssertEquals("#DD03", 1L, diff);
diff = DateAndTime.DateDiff(DateInterval.Month, dtDec31, dtJan1, FirstDayOfWeek.System, FirstWeekOfYear.System);
AssertEquals("#DD04", 1L, diff);
Assertion.AssertEquals("#DD04", 1L, diff);
DateTime dtJan4 = new DateTime(2001, 1, 4); // This is a Thursday
DateTime dtJan9 = new DateTime(2001, 1, 9); // This is the next Tuesday
@@ -212,11 +212,11 @@ namespace MonoTests.Microsoft.VisualBasic
long WD = DateAndTime.DateDiff(DateInterval.Weekday, dtJan4, dtJan9, FirstDayOfWeek.System, FirstWeekOfYear.System);
AssertEquals ("#DD05", 0L, WD);
Assertion.AssertEquals ("#DD05", 0L, WD);
long WY = DateAndTime.DateDiff(DateInterval.WeekOfYear, dtJan4, dtJan9, FirstDayOfWeek.System, FirstWeekOfYear.System);
AssertEquals ("#DD06", 1L, WY);
Assertion.AssertEquals ("#DD06", 1L, WY);
}
[Test]
@@ -226,21 +226,21 @@ namespace MonoTests.Microsoft.VisualBasic
// TODO: Test this better
AssertEquals("#DP01", 2001, DateAndTime.DatePart(DateInterval.Year, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.System));
AssertEquals("#DP02", 1, DateAndTime.DatePart(DateInterval.Quarter, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.System));
AssertEquals("#DP03", 1, DateAndTime.DatePart(DateInterval.Month, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.System));
AssertEquals("#DP04", 1, DateAndTime.DatePart(DateInterval.WeekOfYear, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.FirstFourDays));
AssertEquals("#DP05", 53, DateAndTime.DatePart(DateInterval.WeekOfYear, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.FirstFullWeek));
AssertEquals("#DP06", 1, DateAndTime.DatePart(DateInterval.WeekOfYear, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.Jan1));
AssertEquals("#DP07", 1, DateAndTime.DatePart(DateInterval.WeekOfYear, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.System));
AssertEquals("#DP08", 5, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.Friday, FirstWeekOfYear.FirstFourDays));
AssertEquals("#DP09", 5, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.Saturday, FirstWeekOfYear.FirstFourDays));
AssertEquals("#DP10", 5, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.Sunday, FirstWeekOfYear.FirstFourDays));
AssertEquals("#DP11", 5, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.Monday, FirstWeekOfYear.FirstFourDays));
AssertEquals("#DP12", 5, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.Tuesday, FirstWeekOfYear.FirstFourDays));
AssertEquals("#DP13", 5, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.Wednesday, FirstWeekOfYear.FirstFourDays));
AssertEquals("#DP14", 5, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.Thursday, FirstWeekOfYear.FirstFourDays));
AssertEquals("#DP15", 5, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.FirstFourDays));
Assertion.AssertEquals("#DP01", 2001, DateAndTime.DatePart(DateInterval.Year, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.System));
Assertion.AssertEquals("#DP02", 1, DateAndTime.DatePart(DateInterval.Quarter, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.System));
Assertion.AssertEquals("#DP03", 1, DateAndTime.DatePart(DateInterval.Month, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.System));
Assertion.AssertEquals("#DP04", 1, DateAndTime.DatePart(DateInterval.WeekOfYear, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.FirstFourDays));
Assertion.AssertEquals("#DP05", 53, DateAndTime.DatePart(DateInterval.WeekOfYear, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.FirstFullWeek));
Assertion.AssertEquals("#DP06", 1, DateAndTime.DatePart(DateInterval.WeekOfYear, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.Jan1));
Assertion.AssertEquals("#DP07", 1, DateAndTime.DatePart(DateInterval.WeekOfYear, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.System));
Assertion.AssertEquals("#DP08", 5, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.Friday, FirstWeekOfYear.FirstFourDays));
Assertion.AssertEquals("#DP09", 5, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.Saturday, FirstWeekOfYear.FirstFourDays));
Assertion.AssertEquals("#DP10", 5, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.Sunday, FirstWeekOfYear.FirstFourDays));
Assertion.AssertEquals("#DP11", 5, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.Monday, FirstWeekOfYear.FirstFourDays));
Assertion.AssertEquals("#DP12", 5, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.Tuesday, FirstWeekOfYear.FirstFourDays));
Assertion.AssertEquals("#DP13", 5, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.Wednesday, FirstWeekOfYear.FirstFourDays));
Assertion.AssertEquals("#DP14", 5, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.Thursday, FirstWeekOfYear.FirstFourDays));
Assertion.AssertEquals("#DP15", 5, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.FirstFourDays));
}
@@ -251,7 +251,7 @@ namespace MonoTests.Microsoft.VisualBasic
DateTime dtJan4 = new DateTime(2001, 1, 4);
DateTime dtSerial = DateAndTime.DateSerial(2001, 1, 4);
AssertEquals("#DS01", dtJan4, dtSerial);
Assertion.AssertEquals("#DS01", dtJan4, dtSerial);
}
[Test]
@@ -263,12 +263,12 @@ namespace MonoTests.Microsoft.VisualBasic
DateAndTime.TimeSerial(0, -1440, -1);
}
catch (Exception e) {
AssertEquals("#TS01", e.GetType(), typeof(ArgumentOutOfRangeException));
Assertion.AssertEquals("#TS01", e.GetType(), typeof(ArgumentOutOfRangeException));
caughtException = true;
}
AssertEquals("#TS02", true, caughtException);
Assertion.AssertEquals("#TS02", true, caughtException);
AssertEquals("#TS03", new DateTime(1, 1, 1, 1, 1, 1), DateAndTime.TimeSerial(1, 1, 1));
Assertion.AssertEquals("#TS03", new DateTime(1, 1, 1, 1, 1, 1), DateAndTime.TimeSerial(1, 1, 1));
}
@@ -283,9 +283,9 @@ namespace MonoTests.Microsoft.VisualBasic
/* do nothing. this is what we expect */
}
catch (Exception e) {
Fail ("Unexpected exception:" + e);
Assertion.Fail ("Unexpected exception:" + e);
}
AssertEquals("#DV03", new DateTime(1969, 2, 12), DateAndTime.DateValue("February 12, 1969"));
Assertion.AssertEquals("#DV03", new DateTime(1969, 2, 12), DateAndTime.DateValue("February 12, 1969"));
}
[Test]
@@ -298,67 +298,67 @@ namespace MonoTests.Microsoft.VisualBasic
/* do nothing. this is what we expect */
}
catch (Exception e) {
Fail ("Unexpected exception:" + e);
Assertion.Fail ("Unexpected exception:" + e);
}
AssertEquals("#TV03", new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 16, 35, 17), DateAndTime.TimeValue("4:35:17 PM"));
Assertion.AssertEquals("#TV03", new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 16, 35, 17), DateAndTime.TimeValue("4:35:17 PM"));
}
[Test]
public void Year ()
{
DateTime jan1 = new DateTime(2001, 1, 1, 1, 1, 1);
AssertEquals("#Y01", jan1.Year, DateAndTime.Year(jan1));
Assertion.AssertEquals("#Y01", jan1.Year, DateAndTime.Year(jan1));
}
[Test]
public void Month ()
{
DateTime jan1 = new DateTime(2001, 1, 1, 1, 1, 1);
AssertEquals("#MO01", jan1.Month, DateAndTime.Month(jan1));
Assertion.AssertEquals("#MO01", jan1.Month, DateAndTime.Month(jan1));
}
[Test]
public void Day ()
{
DateTime jan1 = new DateTime(2001, 1, 1, 1, 1, 1);
AssertEquals("#D01", jan1.Day, DateAndTime.Day(jan1));
Assertion.AssertEquals("#D01", jan1.Day, DateAndTime.Day(jan1));
}
[Test]
public void Hour ()
{
DateTime jan1 = new DateTime(2001, 1, 1, 1, 1, 1);
AssertEquals("#H01", jan1.Hour, DateAndTime.Hour(jan1));
Assertion.AssertEquals("#H01", jan1.Hour, DateAndTime.Hour(jan1));
}
[Test]
public void Minute ()
{
DateTime jan1 = new DateTime(2001, 1, 1, 1, 1, 1);
AssertEquals("#MI01", jan1.Minute, DateAndTime.Minute(jan1));
Assertion.AssertEquals("#MI01", jan1.Minute, DateAndTime.Minute(jan1));
}
[Test]
public void Second ()
{
DateTime jan1 = new DateTime(2001, 1, 1, 1, 1, 1);
AssertEquals("#S01", jan1.Second, DateAndTime.Second(jan1));
Assertion.AssertEquals("#S01", jan1.Second, DateAndTime.Second(jan1));
}
[Test]
public void Weekday ()
{
DateTime jan1 = new DateTime(2001, 1, 1, 1, 1, 1);
AssertEquals("#W01", (int)jan1.DayOfWeek + 1, DateAndTime.Weekday(jan1, FirstDayOfWeek.System));
Assertion.AssertEquals("#W01", (int)jan1.DayOfWeek + 1, DateAndTime.Weekday(jan1, FirstDayOfWeek.System));
}
[Test]
public void MonthName ()
{
DateTime jan1 = new DateTime(2001, 1, 1, 1, 1, 1);
AssertEquals("#MN01", CultureInfo.CurrentCulture.DateTimeFormat.GetAbbreviatedMonthName(jan1.Month),
Assertion.AssertEquals("#MN01", CultureInfo.CurrentCulture.DateTimeFormat.GetAbbreviatedMonthName(jan1.Month),
DateAndTime.MonthName(jan1.Month, true));
AssertEquals("#MN02", CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(jan1.Month),
Assertion.AssertEquals("#MN02", CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(jan1.Month),
DateAndTime.MonthName(jan1.Month, false));
bool caughtException = false;
@@ -367,10 +367,10 @@ namespace MonoTests.Microsoft.VisualBasic
DateAndTime.MonthName(0, false);
}
catch (Exception e) {
AssertEquals("#MN03", typeof(ArgumentException), e.GetType());
Assertion.AssertEquals("#MN03", typeof(ArgumentException), e.GetType());
caughtException = true;
}
AssertEquals("#MN04", true, caughtException);
Assertion.AssertEquals("#MN04", true, caughtException);
caughtException = false;
@@ -378,21 +378,21 @@ namespace MonoTests.Microsoft.VisualBasic
DateAndTime.MonthName(14, false);
}
catch (Exception e) {
AssertEquals("#MN05", typeof(ArgumentException), e.GetType());
Assertion.AssertEquals("#MN05", typeof(ArgumentException), e.GetType());
caughtException = true;
}
AssertEquals("#MN06", true, caughtException);
Assertion.AssertEquals("#MN06", true, caughtException);
//AssertEquals("#MN07", "", DateAndTime.MonthName(13, false));
//Assertion.AssertEquals("#MN07", "", DateAndTime.MonthName(13, false));
}
[Test]
public void WeekdayName ()
{
DateTime jan1 = new DateTime(2001, 1, 1, 1, 1, 1);
AssertEquals("#WN01", "Tue",
Assertion.AssertEquals("#WN01", "Tue",
DateAndTime.WeekdayName((int)jan1.DayOfWeek + 1, true, FirstDayOfWeek.System));
AssertEquals("#WN02", "Tuesday",
Assertion.AssertEquals("#WN02", "Tuesday",
DateAndTime.WeekdayName((int)jan1.DayOfWeek + 1, false, FirstDayOfWeek.System));
bool caughtException = false;
@@ -401,10 +401,10 @@ namespace MonoTests.Microsoft.VisualBasic
DateAndTime.WeekdayName(0, false, FirstDayOfWeek.System);
}
catch (Exception e) {
AssertEquals("#WN03", typeof(ArgumentException), e.GetType());
Assertion.AssertEquals("#WN03", typeof(ArgumentException), e.GetType());
caughtException = true;
}
AssertEquals("#WN04", true, caughtException);
Assertion.AssertEquals("#WN04", true, caughtException);
caughtException = false;
@@ -412,12 +412,12 @@ namespace MonoTests.Microsoft.VisualBasic
DateAndTime.WeekdayName(8, false, FirstDayOfWeek.System);
}
catch (Exception e) {
AssertEquals("#WN05", typeof(ArgumentException), e.GetType());
Assertion.AssertEquals("#WN05", typeof(ArgumentException), e.GetType());
caughtException = true;
}
AssertEquals("#WN06", true, caughtException);
Assertion.AssertEquals("#WN06", true, caughtException);
AssertEquals("#WN07", "Tuesday", DateAndTime.WeekdayName((int)jan1.DayOfWeek + 1, false, FirstDayOfWeek.System));
Assertion.AssertEquals("#WN07", "Tuesday", DateAndTime.WeekdayName((int)jan1.DayOfWeek + 1, false, FirstDayOfWeek.System));
}
}
}
-1
View File
@@ -60,4 +60,3 @@ Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/StaticLocalInitFlag
Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/StringType.cs
Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/TODOAttribute.cs
Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/Utils.cs
Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/VBBinder.cs
-4
View File
@@ -1,7 +1,3 @@
2003-06-10 Zoltan Varga <[email protected]>
* MonoSymbolFile.cs: Fix off-by-one error.
2003-03-22 Martin Baulig <[email protected]>
* MonoSymbolTable.cs (MethodEntry.LocalNamesAmbiguous): New public
@@ -430,7 +430,7 @@ namespace Mono.CSharp.Debugger
for (int i = 0; i < MethodCount; i++) {
MethodIndexEntry ie = GetMethodIndexEntry (i + 1);
method_token_hash.Add (ie.Token, i + 1);
method_token_hash.Add (ie.Token, i);
}
}
@@ -1,18 +1,3 @@
2003-06-11 Tim Coleman <[email protected]>
* SybaseConnection.cs:
Make connection parameter parsing "more correct"
and throw appropriate exceptions, similar to MS SqlClient
* SybaseBinary.cs:
* SybaseBoolean.cs:
* SybaseByte.cs:
* SybaseDateTime.cs:
* SybaseDecimal.cs:
* SybaseDouble.cs:
* SybaseMoney.cs:
* SybaseString.cs:
Mass import of code from SqlClient to make this behave
better.
2003-02-16 Daniel Morgan <[email protected]>
* SybaseConnection.cs: - parse data source for 2 possible uses:
@@ -5,7 +5,7 @@
// Tim Coleman ([email protected])
// Daniel Morgan ([email protected])
//
// Copyright (C) Tim Coleman, 2002-2003
// Copyright (C) Tim Coleman, 2002, 2003
// Copyright (C) Daniel Morgan, 2003
//
@@ -48,7 +48,7 @@ namespace Mono.Data.SybaseClient {
int minPoolSize;
int maxPoolSize;
int packetSize;
int port = 2048;
int port = 1533;
// The current state
ConnectionState state = ConnectionState.Closed;
@@ -286,7 +286,7 @@ namespace Mono.Data.SybaseClient {
public void Open ()
{
string serverName = "";
if (connectionString == null || connectionString.Equals (""))
if (connectionString == null)
throw new InvalidOperationException ("Connection string has not been initialized.");
try {
@@ -325,10 +325,10 @@ namespace Mono.Data.SybaseClient {
private void ParseDataSource (string theDataSource, out int thePort, out string theServerName)
{
theServerName = "";
thePort = 2048;
int idx = 0;
if ((idx = theDataSource.IndexOf (",")) > -1) {
thePort = 1433; // default TCP port for SQL Server
int idx = 0;
if ((idx = theDataSource.IndexOf (",")) > -1) {
theServerName = theDataSource.Substring (0, idx);
string p = theDataSource.Substring (idx + 1);
thePort = Int32.Parse (p);
@@ -338,187 +338,174 @@ namespace Mono.Data.SybaseClient {
}
}
private string ParseValue (string name, string value)
{
if (name.Length == 0 && value.Length > 0)
throw new ArgumentException ("Expected '=' delimiter while parsing connection value pair.");
if (name.Length > 0)
return value.Trim ();
return String.Empty;
}
void SetConnectionString (string connectionString)
{
connectionString += ";";
NameValueCollection parameters = new NameValueCollection ();
private void SetConnectionString (string connectionString)
{
if (connectionString == String.Empty) {
this.connectionString = connectionString;
return;
}
if (connectionString == String.Empty)
return;
NameValueCollection parameters = new NameValueCollection ();
bool inQuote = false;
bool inDQuote = false;
string name = String.Empty;
string value = String.Empty;
StringBuilder sb = new StringBuilder ();
string name = String.Empty;
string value = String.Empty;
StringBuilder sb = new StringBuilder ();
char delimiter = '\0';
foreach (char c in connectionString)
{
switch (c) {
case '\'':
inQuote = !inQuote;
break;
case '"' :
inDQuote = !inDQuote;
break;
case ';' :
if (!inDQuote && !inQuote) {
if (name != String.Empty && name != null) {
value = sb.ToString ();
parameters [name.ToUpper ().Trim ()] = value.Trim ();
}
name = String.Empty;
value = String.Empty;
sb = new StringBuilder ();
}
else
sb.Append (c);
break;
case '=' :
if (!inDQuote && !inQuote) {
name = sb.ToString ();
sb = new StringBuilder ();
}
else
sb.Append (c);
break;
default:
sb.Append (c);
break;
}
}
foreach (char c in connectionString) {
switch (c) {
case '\'' :
case '"' :
if (delimiter.Equals (c))
delimiter = '\0';
else if (delimiter.Equals ('\0'))
delimiter = c;
else
sb.Append (c);
break;
case ';' :
if (delimiter.Equals ('\0')) {
value = ParseValue (name, sb.ToString ());
if (!value.Equals (""))
parameters [name.ToUpper ().Trim ()] = value;
name = String.Empty;
sb = new StringBuilder ();
}
else
sb.Append (c);
break;
case '=' :
if (delimiter.Equals ('\0')) {
name = sb.ToString ();
sb = new StringBuilder ();
}
else
sb.Append (c);
break;
default:
sb.Append (c);
break;
}
}
if (this.ConnectionString == null)
{
SetDefaultConnectionParameters (parameters);
}
if (!delimiter.Equals ('\0'))
throw new ArgumentException (String.Format ("Matching end delimiter {0} not found in connection option value.", delimiter));
SetProperties (parameters);
value = ParseValue (name, sb.ToString ());
if (!value.Equals (""))
parameters [name.ToUpper ().Trim ()] = value;
this.connectionString = connectionString;
}
if (this.ConnectionString == null)
SetDefaultConnectionParameters (parameters);
void SetDefaultConnectionParameters (NameValueCollection parameters)
{
if (null == parameters.Get ("APPLICATION NAME"))
parameters["APPLICATION NAME"] = ".Net SybaseClient Data Provider";
if (null == parameters.Get ("CONNECT TIMEOUT") && null == parameters.Get ("CONNECTION TIMEOUT"))
parameters["CONNECT TIMEOUT"] = "15";
if (null == parameters.Get ("CONNECTION LIFETIME"))
parameters["CONNECTION LIFETIME"] = "0";
if (null == parameters.Get ("CONNECTION RESET"))
parameters["CONNECTION RESET"] = "true";
if (null == parameters.Get ("ENLIST"))
parameters["ENLIST"] = "true";
if (null == parameters.Get ("INTEGRATED SECURITY") && null == parameters.Get ("TRUSTED_CONNECTION"))
parameters["INTEGRATED SECURITY"] = "false";
if (null == parameters.Get ("MAX POOL SIZE"))
parameters["MAX POOL SIZE"] = "100";
if (null == parameters.Get ("MIN POOL SIZE"))
parameters["MIN POOL SIZE"] = "0";
if (null == parameters.Get ("NETWORK LIBRARY") && null == parameters.Get ("NET"))
parameters["NETWORK LIBRARY"] = "dbmssocn";
if (null == parameters.Get ("PACKET SIZE"))
parameters["PACKET SIZE"] = "512";
if (null == parameters.Get ("PERSIST SECURITY INFO"))
parameters["PERSIST SECURITY INFO"] = "false";
if (null == parameters.Get ("POOLING"))
parameters["POOLING"] = "true";
if (null == parameters.Get ("WORKSTATION ID"))
parameters["WORKSTATION ID"] = Dns.GetHostByName ("localhost").HostName;
}
SetProperties (parameters);
private void SetProperties (NameValueCollection parameters)
{
string value;
foreach (string name in parameters) {
value = parameters[name];
this.connectionString = connectionString;
}
private void SetDefaultConnectionParameters (NameValueCollection parameters)
{
if (null == parameters.Get ("APPLICATION NAME"))
parameters["APPLICATION NAME"] = "Mono SybaseClient Data Provider";
if (null == parameters.Get ("CONNECT TIMEOUT") && null == parameters.Get ("CONNECTION TIMEOUT"))
parameters["CONNECT TIMEOUT"] = "15";
if (null == parameters.Get ("CONNECTION LIFETIME"))
parameters["CONNECTION LIFETIME"] = "0";
if (null == parameters.Get ("CONNECTION RESET"))
parameters["CONNECTION RESET"] = "true";
if (null == parameters.Get ("ENLIST"))
parameters["ENLIST"] = "true";
if (null == parameters.Get ("INTEGRATED SECURITY") && null == parameters.Get ("TRUSTED_CONNECTION"))
parameters["INTEGRATED SECURITY"] = "false";
if (null == parameters.Get ("MAX POOL SIZE"))
parameters["MAX POOL SIZE"] = "100";
if (null == parameters.Get ("MIN POOL SIZE"))
parameters["MIN POOL SIZE"] = "0";
if (null == parameters.Get ("NETWORK LIBRARY") && null == parameters.Get ("NET"))
parameters["NETWORK LIBRARY"] = "dbmssocn";
if (null == parameters.Get ("PACKET SIZE"))
parameters["PACKET SIZE"] = "512";
if (null == parameters.Get ("PERSIST SECURITY INFO"))
parameters["PERSIST SECURITY INFO"] = "false";
if (null == parameters.Get ("POOLING"))
parameters["POOLING"] = "true";
if (null == parameters.Get ("WORKSTATION ID"))
parameters["WORKSTATION ID"] = Dns.GetHostByName ("localhost").HostName;
}
private void SetProperties (NameValueCollection parameters)
{
string value;
foreach (string name in parameters) {
value = parameters [name];
switch (name) {
case "APPLICATION NAME" :
parms.ApplicationName = value;
break;
case "ATTACHDBFILENAME" :
case "EXTENDED PROPERTIES" :
case "INITIAL FILE NAME" :
break;
case "CONNECT TIMEOUT" :
case "CONNECTION TIMEOUT" :
connectionTimeout = Int32.Parse (value);
break;
case "CONNECTION LIFETIME" :
break;
case "CONNECTION RESET" :
connectionReset = !(value.ToUpper ().Equals ("FALSE") || value.ToUpper ().Equals ("NO"));
break;
case "CURRENT LANGUAGE" :
parms.Language = value;
break;
case "DATA SOURCE" :
case "SERVER" :
case "ADDRESS" :
case "ADDR" :
case "NETWORK ADDRESS" :
dataSource = value;
break;
case "ENLIST" :
break;
case "INITIAL CATALOG" :
case "DATABASE" :
parms.Database = value;
break;
case "INTEGRATED SECURITY" :
case "TRUSTED_CONNECTION" :
break;
case "MAX POOL SIZE" :
maxPoolSize = Int32.Parse (value);
break;
case "MIN POOL SIZE" :
minPoolSize = Int32.Parse (value);
break;
case "NET" :
case "NETWORK LIBRARY" :
if (!value.ToUpper ().Equals ("DBMSSOCN"))
throw new ArgumentException ("Unsupported network library.");
break;
case "PACKET SIZE" :
packetSize = Int32.Parse (value);
break;
case "PASSWORD" :
case "PWD" :
parms.Password = value;
break;
case "PERSIST SECURITY INFO" :
break;
case "POOLING" :
pooling = !(value.ToUpper ().Equals ("FALSE") || value.ToUpper ().Equals ("NO"));
break;
case "USER ID" :
parms.User = value;
break;
case "WORKSTATION ID" :
parms.Hostname = value;
break;
}
switch (name) {
case "APPLICATION NAME" :
parms.ApplicationName = value;
break;
case "ATTACHDBFILENAME" :
case "EXTENDED PROPERTIES" :
case "INITIAL FILE NAME" :
break;
case "CONNECT TIMEOUT" :
case "CONNECTION TIMEOUT" :
connectionTimeout = Int32.Parse (value);
break;
case "CONNECTION LIFETIME" :
break;
case "CONNECTION RESET" :
connectionReset = !(value.ToUpper ().Equals ("FALSE") || value.ToUpper ().Equals ("NO"));
break;
case "CURRENT LANGUAGE" :
parms.Language = value;
break;
case "DATA SOURCE" :
case "SERVER" :
case "ADDRESS" :
case "ADDR" :
case "NETWORK ADDRESS" :
dataSource = value;
break;
case "ENLIST" :
break;
case "INITIAL CATALOG" :
case "DATABASE" :
parms.Database = value;
break;
case "INTEGRATED SECURITY" :
case "TRUSTED_CONNECTION" :
break;
case "MAX POOL SIZE" :
maxPoolSize = Int32.Parse (value);
break;
case "MIN POOL SIZE" :
minPoolSize = Int32.Parse (value);
break;
case "NET" :
case "NETWORK LIBRARY" :
if (!value.ToUpper ().Equals ("DBMSSOCN"))
throw new ArgumentException ("Unsupported network library.");
break;
case "PACKET SIZE" :
packetSize = Int32.Parse (value);
break;
case "PASSWORD" :
case "PWD" :
parms.Password = value;
break;
case "PERSIST SECURITY INFO" :
break;
case "POOLING" :
pooling = !(value.ToUpper ().Equals ("FALSE") || value.ToUpper ().Equals ("NO"));
break;
case "USER ID" :
parms.User = value;
break;
case "WORKSTATION ID" :
parms.Hostname = value;
break;
}
}
}
private static bool IsValidDatabaseName (string database)
static bool IsValidDatabaseName (string database)
{
if (database.Length > 32 || database.Length < 1)
return false;
@@ -4,10 +4,7 @@
// Author:
// Tim Coleman ([email protected])
//
// Based on System.Data.SqlTypes.SqlBinary
//
// (C) Ximian, Inc. 2002-2003
// (C) Copyright Tim Coleman, 2002-2003
// (C) Copyright Tim Coleman, 2002
//
using Mono.Data.SybaseClient;
@@ -77,16 +74,10 @@ namespace Mono.Data.SybaseTypes {
#region Methods
[MonoTODO]
public int CompareTo (object value)
{
if (value == null)
return 1;
else if (!(value is SybaseBinary))
throw new ArgumentException ("Value is not a Mono.Data.SybaseTypes.SybaseBinary.");
else if (((SybaseBinary) value).IsNull)
return 1;
else
return Compare (this, (SybaseBinary) value);
throw new NotImplementedException ();
}
public static SybaseBinary Concat (SybaseBinary x, SybaseBinary y)
@@ -107,12 +98,10 @@ namespace Mono.Data.SybaseTypes {
return (x == y);
}
[MonoTODO]
public override int GetHashCode ()
{
int result = 10;
for (int i = 0; i < value.Length; i += 1)
result = 91 * result + ((int) value [i]);
return result;
throw new NotImplementedException ();
}
#endregion
@@ -160,69 +149,64 @@ namespace Mono.Data.SybaseTypes {
#region Operators
[MonoTODO]
public static SybaseBinary operator + (SybaseBinary x, SybaseBinary y)
{
byte[] b = new byte [x.Length + y.Length];
int j = 0;
int i;
for (i = 0; i < x.Length; i += 1)
b [i] = x [i];
for (; i < x.Length + y.Length; i += 1) {
b [i] = y [j];
j += 1;
}
return new SybaseBinary (b);
throw new NotImplementedException ();
}
[MonoTODO]
public static SybaseBoolean operator == (SybaseBinary x, SybaseBinary y)
{
if (x.IsNull || y.IsNull)
return SybaseBoolean.Null;
else
return new SybaseBoolean (Compare (x, y) == 0);
throw new NotImplementedException ();
}
[MonoTODO]
public static SybaseBoolean operator > (SybaseBinary x, SybaseBinary y)
{
if (x.IsNull || y.IsNull)
return SybaseBoolean.Null;
else
return new SybaseBoolean (Compare (x, y) > 0);
throw new NotImplementedException ();
}
[MonoTODO]
public static SybaseBoolean operator >= (SybaseBinary x, SybaseBinary y)
{
if (x.IsNull || y.IsNull)
return SybaseBoolean.Null;
else
return new SybaseBoolean (Compare (x, y) >= 0);
throw new NotImplementedException ();
}
[MonoTODO]
public static SybaseBoolean operator != (SybaseBinary x, SybaseBinary y)
{
if (x.IsNull || y.IsNull)
return SybaseBoolean.Null;
else
return new SybaseBoolean (Compare (x, y) != 0);
throw new NotImplementedException ();
}
[MonoTODO]
public static SybaseBoolean operator < (SybaseBinary x, SybaseBinary y)
{
if (x.IsNull || y.IsNull)
return SybaseBoolean.Null;
else
return new SybaseBoolean (Compare (x, y) < 0);
throw new NotImplementedException ();
}
[MonoTODO]
public static SybaseBoolean operator <= (SybaseBinary x, SybaseBinary y)
{
if (x.IsNull || y.IsNull)
return SybaseBoolean.Null;
else
return new SybaseBoolean (Compare (x, y) <= 0);
throw new NotImplementedException ();
}
public static explicit operator byte[] (SybaseBinary x)
@@ -230,9 +214,10 @@ namespace Mono.Data.SybaseTypes {
return x.Value;
}
[MonoTODO]
public static explicit operator SybaseBinary (SybaseGuid x)
{
return new SybaseBinary (x.ToByteArray ());
throw new NotImplementedException ();
}
public static implicit operator SybaseBinary (byte[] x)
@@ -240,41 +225,6 @@ namespace Mono.Data.SybaseTypes {
return new SybaseBinary (x);
}
private static int Compare (SybaseBinary x, SybaseBinary y)
{
int lengthDiff = 0;
if (x.Length != y.Length) {
lengthDiff = x.Length - y.Length;
// if diff more than 0, x is longer
if (lengthDiff > 0) {
for (int i = x.Length - 1; i > x.Length - lengthDiff; i -= 1)
if (x [i] != (byte) 0)
return 1;
} else {
for (int i = y.Length - 1; i > y.Length - lengthDiff; i -= 1)
if (y [i] != (byte) 0)
return -1;
}
}
// choose shorter
int len = (lengthDiff > 0) ? y.Length : x.Length;
for (int i = len - 1; i > 0; i -= 1) {
byte bx = x [i];
byte by = y [i];
if (bx > by)
return 1;
else if (bx < by)
return -1;
}
return 0;
}
#endregion
}
}
@@ -4,15 +4,12 @@
// Author:
// Tim Coleman ([email protected])
//
// Based on System.Data.SqlTypes.SqlBoolean
//
// (C) Ximian, Inc. 2002-2003
// (C) Copyright Tim Coleman, 2002-2003
// (C) Copyright Tim Coleman, 2002
//
using Mono.Data.SybaseClient;
using System;
using System.Data.SqlTypes;
using System.Data.SqlTypes;
using System.Globalization;
namespace Mono.Data.SybaseTypes {
@@ -4,10 +4,6 @@
// Author:
// Tim Coleman <[email protected]>
//
// Based on System.Data.SqlTypes.SqlByte
//
//
// (C) Ximian, Inc. 2002-2003
// (C) Copyright Tim Coleman, 2002
//
@@ -4,10 +4,7 @@
// Author:
// Tim Coleman <[email protected]>
//
// Based on System.Data.SqlTypes.SqlDateTime
//
// (C) Ximian, Inc. 2002-2003
// (C) Copyright Tim Coleman, 2002-2003
// (C) Copyright Tim Coleman, 2002
//
using Mono.Data.SybaseClient;
@@ -21,15 +18,13 @@ namespace Mono.Data.SybaseTypes {
#region Fields
private DateTime value;
private bool notNull;
private static readonly float DateTimeTicksPerHour = 3.6E+10f;
private static readonly DateTime Epoch = new DateTime (1900, 1, 1);
public static readonly SybaseDateTime MaxValue = new SybaseDateTime (9999, 12, 31, 23, 59, 59);
public static readonly SybaseDateTime MaxValue = new SybaseDateTime (9999,12,31);
public static readonly SybaseDateTime MinValue = new SybaseDateTime (1753,1,1);
public static readonly SybaseDateTime Null;
public static readonly int SQLTicksPerHour = 1080000;
public static readonly int SQLTicksPerMinute = 18000;
public static readonly int SQLTicksPerSecond = 300;
public static readonly int SQLTicksPerHour;
public static readonly int SQLTicksPerMinute;
public static readonly int SQLTicksPerSecond;
#endregion
@@ -41,10 +36,10 @@ namespace Mono.Data.SybaseTypes {
notNull = true;
}
[MonoTODO]
public SybaseDateTime (int dayTicks, int timeTicks)
{
this.value = new DateTime (Epoch.Ticks + (long) (dayTicks + timeTicks));
notNull = true;
throw new NotImplementedException ();
}
public SybaseDateTime (int year, int month, int day)
@@ -59,40 +54,34 @@ namespace Mono.Data.SybaseTypes {
notNull = true;
}
[MonoTODO]
public SybaseDateTime (int year, int month, int day, int hour, int minute, int second, double millisecond)
{
DateTime t = new DateTime (year, month, day);
this.value = new DateTime ((long) (t.Day * 24 * SQLTicksPerHour + hour * SQLTicksPerHour + minute * SQLTicksPerMinute + second * SQLTicksPerSecond + millisecond * 1000));
notNull = true;
throw new NotImplementedException ();
}
[MonoTODO]
public SybaseDateTime (int year, int month, int day, int hour, int minute, int second, int bilisecond)
{
DateTime t = new DateTime (year, month, day);
this.value = new DateTime ((long) (t.Day * 24 * SQLTicksPerHour + hour * SQLTicksPerHour + minute * SQLTicksPerMinute + second * SQLTicksPerSecond + bilisecond));
notNull = true;
throw new NotImplementedException ();
}
#endregion
#region Properties
[MonoTODO]
public int DayTicks {
get {
return (int) ((this.Value.Ticks - Epoch.Ticks) / (24 * DateTimeTicksPerHour));
}
get { throw new NotImplementedException (); }
}
public bool IsNull {
get { return !notNull; }
}
[MonoTODO]
public int TimeTicks {
get {
if (this.IsNull)
throw new SybaseNullValueException ();
return (int) (value.Hour * SQLTicksPerHour + value.Minute * SQLTicksPerMinute + value.Second * SQLTicksPerSecond + value.Millisecond);
}
get { throw new NotImplementedException (); }
}
public DateTime Value {
@@ -133,9 +122,10 @@ namespace Mono.Data.SybaseTypes {
return (x == y);
}
[MonoTODO]
public override int GetHashCode ()
{
return value.GetHashCode ();
return 42;
}
public static SybaseBoolean GreaterThan (SybaseDateTime x, SybaseDateTime y)
@@ -163,9 +153,10 @@ namespace Mono.Data.SybaseTypes {
return (x != y);
}
[MonoTODO]
public static SybaseDateTime Parse (string s)
{
return new SybaseDateTime (DateTime.Parse (s));
throw new NotImplementedException ();
}
public SybaseString ToSybaseString ()
@@ -181,11 +172,10 @@ namespace Mono.Data.SybaseTypes {
return value.ToString ();
}
[MonoTODO]
public static SybaseDateTime operator + (SybaseDateTime x, TimeSpan t)
{
if (x.IsNull)
return SybaseDateTime.Null;
return new SybaseDateTime (x.Value + t);
throw new NotImplementedException ();
}
public static SybaseBoolean operator == (SybaseDateTime x, SybaseDateTime y)
@@ -236,11 +226,10 @@ namespace Mono.Data.SybaseTypes {
return new SybaseBoolean (x.Value <= y.Value);
}
[MonoTODO]
public static SybaseDateTime operator - (SybaseDateTime x, TimeSpan t)
{
if (x.IsNull)
return SybaseDateTime.Null;
return new SybaseDateTime (x.Value - t);
throw new NotImplementedException ();
}
public static explicit operator DateTime (SybaseDateTime x)
@@ -248,9 +237,10 @@ namespace Mono.Data.SybaseTypes {
return x.Value;
}
[MonoTODO]
public static explicit operator SybaseDateTime (SybaseString x)
{
return SybaseDateTime.Parse (x.Value);
throw new NotImplementedException();
}
public static implicit operator SybaseDateTime (DateTime x)
@@ -4,9 +4,6 @@
// Author:
// Tim Coleman <[email protected]>
//
// Based on System.Data.SqlTypes.SqlDecimal
//
// (C) Ximian, Inc. 2002-2003
// (C) Copyright Tim Coleman, 2002
//
@@ -14,7 +11,6 @@ using Mono.Data.Tds.Protocol;
using System;
using System.Data.SqlTypes;
using System.Globalization;
using System.Text;
namespace Mono.Data.SybaseTypes {
public struct SybaseDecimal : INullable, IComparable
@@ -33,14 +29,6 @@ namespace Mono.Data.SybaseTypes {
const int SCALE_SHIFT = 16;
const int SIGN_SHIFT = 31;
const int RESERVED_SS32_BITS = 0x7F00FFFF;
const ulong LIT_GUINT64_HIGHBIT = 0x8000000000000000;
const ulong LIT_GUINT32_HIGHBIT = 0x80000000;
const byte DECIMAL_MAX_INTFACTORS = 9;
static uint [] constantsDecadeInt32Factors = new uint [10]
{
1u, 10u, 100u, 1000u, 10000u, 100000u, 1000000u,
10000000u, 100000000u, 1000000000u
};
public static readonly byte MaxPrecision = 38;
public static readonly byte MaxScale = 38;
@@ -57,19 +45,19 @@ namespace Mono.Data.SybaseTypes {
{
int[] binData = Decimal.GetBits (value);
this.precision = MaxPrecision; // this value seems unclear
this.scale = (byte)(binData[3] >> SCALE_SHIFT);
if (this.scale > MaxScale || (this.scale & RESERVED_SS32_BITS) != 0)
throw new ArgumentException(Locale.GetText ("Invalid scale"));
this.positive = ((binData[3] >> SIGN_SHIFT) > 0);
this.value = new int[4];
this.value[0] = binData[0];
this.value[1] = binData[1];
this.value[2] = binData[2];
this.value[3] = 0;
notNull = true;
positive = (value >= 0);
precision = GetPrecision (value);
}
public SybaseDecimal (double value) : this ((decimal)value) { }
@@ -89,29 +77,15 @@ namespace Mono.Data.SybaseTypes {
this.value[2] = data3;
this.value[3] = data4;
notNull = true;
if (precision < scale)
throw new ArgumentException ("Invalid scale");
if (this.ToDouble () > (Math.Pow (10, 38) -1) || this.ToDouble () < -(Math.Pow (10, 38)))
throw new SybaseTypeException ("Can't convert to SybaseDecimal.");
}
#endregion
#region Properties
[MonoTODO]
public byte[] BinData {
get {
byte[] b = new byte [value.Length * 4];
int j = 0;
for (int i = 0; i < value.Length; i += 1) {
b [j++] = (byte) (0xff & value [i]);
b [j++] = (byte) (0xff & value [i] >> 8);
b [j++] = (byte) (0xff & value [i] >> 16);
b [j++] = (byte) (0xff & value [i] >> 24);
}
return b;
}
get { throw new NotImplementedException (); }
}
public int[] Data {
@@ -143,9 +117,12 @@ namespace Mono.Data.SybaseTypes {
get {
if (this.IsNull)
throw new SybaseNullValueException ();
if (this.value[3] > 0)
throw new OverflowException ();
return new decimal (value[0], value[1], value[2], !positive, scale);
else
if (this.value[3] > 0)
throw new OverflowException ();
else
System.Console.WriteLine( "boo!" );
return new decimal (value[0], value[1], value[2], !positive, scale);
}
}
@@ -153,9 +130,10 @@ namespace Mono.Data.SybaseTypes {
#region Methods
[MonoTODO]
public static SybaseDecimal Abs (SybaseDecimal n)
{
return new SybaseDecimal (n.Precision, n.Scale, true, n.BinData [0], n.BinData [1], n.BinData [2], n.BinData [3]);
throw new NotImplementedException();
}
public static SybaseDecimal Add (SybaseDecimal x, SybaseDecimal y)
@@ -163,21 +141,16 @@ namespace Mono.Data.SybaseTypes {
return (x + y);
}
[MonoTODO]
public static SybaseDecimal AdjustScale (SybaseDecimal n, int digits, bool fRound)
{
byte prec = n.Precision;
if (n.IsNull)
throw new SybaseNullValueException ();
if (digits > 0)
prec = (byte) (prec + digits);
if (fRound)
n = Round (n, digits + n.Scale);
return new SybaseDecimal (prec, (byte) (n.Scale + digits), n.IsPositive, n.Data);
throw new NotImplementedException ();
}
[MonoTODO]
public static SybaseDecimal Ceiling (SybaseDecimal n)
{
return AdjustScale (n, -(n.Scale), true);
throw new NotImplementedException();
}
public int CompareTo (object value)
@@ -192,9 +165,10 @@ namespace Mono.Data.SybaseTypes {
return this.Value.CompareTo (((SybaseDecimal)value).Value);
}
[MonoTODO]
public static SybaseDecimal ConvertToPrecScale (SybaseDecimal n, int precision, int scale)
{
return new SybaseDecimal ((byte) precision, (byte) scale, n.IsPositive, n.Data);
throw new NotImplementedException ();
}
public static SybaseDecimal Divide (SybaseDecimal x, SybaseDecimal y)
@@ -206,10 +180,6 @@ namespace Mono.Data.SybaseTypes {
{
if (!(value is SybaseDecimal))
return false;
else if (this.IsNull && ((SybaseDecimal) value).IsNull)
return true;
else if (((SybaseDecimal) value).IsNull)
return false;
else
return (bool) (this == (SybaseDecimal)value);
}
@@ -219,9 +189,10 @@ namespace Mono.Data.SybaseTypes {
return (x == y);
}
[MonoTODO]
public static SybaseDecimal Floor (SybaseDecimal n)
{
return AdjustScale (n, -(n.Scale), false);
throw new NotImplementedException ();
}
internal static SybaseDecimal FromTdsBigDecimal (TdsBigDecimal x)
@@ -234,15 +205,7 @@ namespace Mono.Data.SybaseTypes {
public override int GetHashCode ()
{
int result = 10;
result = 91 * result + this.Data [0];
result = 91 * result + this.Data [1];
result = 91 * result + this.Data [2];
result = 91 * result + this.Data [3];
result = 91 * result + (int) this.Scale;
result = 91 * result + (int) this.Precision;
return result;
return (int)this.Value;
}
public static SybaseBoolean GreaterThan (SybaseDecimal x, SybaseDecimal y)
@@ -275,38 +238,28 @@ namespace Mono.Data.SybaseTypes {
return (x != y);
}
[MonoTODO]
public static SybaseDecimal Parse (string s)
{
if (s == null)
throw new ArgumentNullException ();
else
return SybaseDouble.Parse (s).ToSybaseDecimal ();
throw new NotImplementedException ();
}
[MonoTODO]
public static SybaseDecimal Power (SybaseDecimal n, double exp)
{
if (n.IsNull)
return SybaseDecimal.Null;
return new SybaseDecimal (Math.Pow (n.ToDouble (), exp));
throw new NotImplementedException ();
}
[MonoTODO]
public static SybaseDecimal Round (SybaseDecimal n, int position)
{
if (n.IsNull)
throw new SybaseNullValueException ();
SybaseDecimal result = new SybaseDecimal (Math.Round ((double) (n.ToDouble () * Math.Pow (10, position))));
result = result / new SybaseDecimal (Math.Pow (10, position));
return result;
throw new NotImplementedException ();
}
[MonoTODO]
public static SybaseInt32 Sign (SybaseDecimal n)
{
SybaseInt32 result = 0;
if (n >= new SybaseDecimal (0))
result = 1;
else
result = -1;
return result;
throw new NotImplementedException ();
}
public static SybaseDecimal Subtract (SybaseDecimal x, SybaseDecimal y)
@@ -314,25 +267,9 @@ namespace Mono.Data.SybaseTypes {
return (x - y);
}
private static byte GetPrecision (decimal value)
{
string str = value.ToString ();
byte result = 0;
foreach (char c in str)
if (c >= '0' && c <= '9')
result ++;
return result;
}
public double ToDouble ()
{
// FIXME: This is the wrong way to do this
double d = (uint) this.Data [0];
d += ((uint) this.Data [1]) * Math.Pow (2, 32);
d += ((uint) this.Data [2]) * Math.Pow (2, 64);
d += ((uint) this.Data [3]) * Math.Pow (2, 96);
d /= Math.Pow (10, scale);
return d;
return ((double)this.Value);
}
public SybaseBoolean ToSybaseBoolean ()
@@ -384,520 +321,14 @@ namespace Mono.Data.SybaseTypes {
{
if (this.IsNull)
return String.Empty;
// convert int [4] -> ulong [2]
ulong lo = (uint) this.Data [0] + (ulong) ((ulong) this.Data [1] << 32);
ulong hi = (uint) this.Data [2] + (ulong) ((ulong) this.Data [3] << 32);
uint rest = 0;
StringBuilder result = new StringBuilder ();
for (int i = 0; lo != 0 || hi != 0; i += 1) {
Div128By32 (ref hi, ref lo, 10, ref rest);
result.Insert (0, rest.ToString ());
}
while (result.Length < Precision)
result.Append ("0");
while (result.Length > Precision)
result.Remove (result.Length - 1, 1);
if (Scale > 0)
result.Insert (result.Length - Scale, ".");
return result.ToString ();
}
// from decimal.c
private static int Div128By32 (ref ulong hi, ref ulong lo, uint divider)
{
uint t = 0;
return Div128By32 (ref hi, ref lo, divider, ref t);
}
// from decimal.c
private static int Div128By32 (ref ulong hi, ref ulong lo, uint divider, ref uint rest)
{
ulong a = 0;
ulong b = 0;
ulong c = 0;
a = (uint) (hi >> 32);
b = a / divider;
a -= b * divider;
a <<= 32;
a |= (uint) hi;
c = a / divider;
a -= c * divider;
a <<= 32;
hi = b << 32 | (uint) c;
a = (uint) (lo >> 32);
b = a / divider;
a -= b * divider;
a <<= 32;
a |= (uint) lo;
c = a / divider;
a -= c * divider;
a <<= 32;
lo = b << 32 | (uint) c;
rest = (uint) a;
a <<= 1;
return (a > divider || (a == divider && (c & 1) == 1)) ? 1 : 0;
}
[MonoTODO ("Find out what is the right way to set scale and precision")]
private static SybaseDecimal DecimalDiv (SybaseDecimal x, SybaseDecimal y)
{
ulong lo = 0;
ulong hi = 0;
int sc = 0; // scale
int texp = 0;
byte prec = 0;
prec = x.Precision >= y.Precision ? x.Precision : y.Precision;
DecimalDivSub (ref x, ref y, ref lo, ref hi, ref texp);
sc = x.Scale - y.Scale;
Rescale128 (ref lo, ref hi, ref sc, texp, 0, 38, 1);
uint r = 0;
while (prec < sc) {
Div128By32 (ref hi, ref lo, 10, ref r);
sc -= 1;
}
if (r >= 5)
lo += 1;
while ((((double) hi) * Math.Pow (2, 64) + lo) - Math.Pow (10, prec) > 0)
prec += 1;
while ((prec + sc) > MaxScale) {
Div128By32 (ref hi, ref lo, 10, ref r);
sc -= 1;
if (r >= 5)
lo += 1;
}
int resultLo = (int) lo;
int resultMi = (int) (lo >> 32);
int resultMi2 = (int) hi;
int resultHi = (int) (hi >> 32);
return new SybaseDecimal (prec, (byte) sc, true, resultLo, resultMi, resultMi2, resultHi);
}
// From decimal.c
private static void Rescale128 (ref ulong clo, ref ulong chi, ref int scale, int texp, int minScale, int maxScale, int roundFlag)
{
uint factor = 0;
uint overhang = 0;
int sc = 0;
int i = 0;
int roundBit = 0;
sc = scale;
if (texp > 0) {
// reduce exp
while (texp > 0 && sc <= maxScale) {
overhang = (uint) (chi >> 64);
while (texp > 0 && (((clo & 1) == 0) || overhang > 0)) {
if (--texp == 0)
roundBit = (int) (clo & 1);
RShift128 (ref clo, ref chi);
overhang = (uint) (chi >> 32);
}
if (texp > DECIMAL_MAX_INTFACTORS)
i = DECIMAL_MAX_INTFACTORS;
else
i = texp;
if (sc + i > maxScale)
i = maxScale - sc;
if (i == 0)
break;
texp -= i;
sc += i;
// 10^i/2^i=5^i
factor = constantsDecadeInt32Factors [i] >> i;
Mult128By32 (ref clo, ref chi, factor, 0);
}
while (texp > 0) {
if (--texp == 0)
roundBit = (int) (clo & 1);
RShift128 (ref clo, ref chi);
}
}
while (sc > maxScale) {
i = scale - maxScale;
if (i > DECIMAL_MAX_INTFACTORS)
i = DECIMAL_MAX_INTFACTORS;
sc -= i;
roundBit = Div128By32 (ref clo, ref chi, constantsDecadeInt32Factors [i]);
}
while (sc < minScale) {
if (roundFlag == 0)
roundBit = 0;
i = minScale - sc;
if (i > DECIMAL_MAX_INTFACTORS)
i = DECIMAL_MAX_INTFACTORS;
sc += i;
Mult128By32 (ref clo, ref chi, constantsDecadeInt32Factors [i], roundBit);
roundBit = 0;
}
scale = sc;
Normalize128 (ref clo, ref chi, ref sc, roundFlag, roundBit);
}
// from decimal.c
private static void Normalize128 (ref ulong clo, ref ulong chi, ref int scale, int roundFlag, int roundBit)
{
if ((roundFlag != 0) && (roundBit != 0))
RoundUp128 (ref clo, ref chi);
}
// from decimal.c
private static void RoundUp128 (ref ulong lo, ref ulong hi)
{
if ((++lo) == 0)
++hi;
}
// from decimal.c
private static void DecimalDivSub (ref SybaseDecimal x, ref SybaseDecimal y, ref ulong clo, ref ulong chi, ref int exp)
{
ulong xlo, xmi, xhi;
ulong tlo = 0;
ulong tmi = 0;
ulong thi = 0;
uint ylo = 0;
uint ymi = 0;
uint ymi2 = 0;
uint yhi = 0;
int ashift = 0;
int bshift = 0;
int extraBit = 0;
xhi = (ulong) ((ulong) x.Data [3] << 32) | (ulong) x.Data [2];
xmi = (ulong) ((ulong) x.Data [1] << 32) | (ulong) x.Data [0];
xlo = (uint) 0;
ylo = (uint) y.Data [0];
ymi = (uint) y.Data [1];
ymi2 = (uint) y.Data [2];
yhi = (uint) y.Data [3];
if (ylo == 0 && ymi == 0 && ymi2 == 0 && yhi == 0)
throw new DivideByZeroException ();
if (xmi == 0 && xhi == 0) {
clo = chi = 0;
return;
}
// enlarge dividend to get maximal precision
for (ashift = 0; (xhi & LIT_GUINT64_HIGHBIT) == 0; ++ashift)
LShift128 (ref xmi, ref xhi);
// ensure that divisor is at least 2^95
for (bshift = 0; (yhi & LIT_GUINT32_HIGHBIT) == 0; ++bshift)
LShift128 (ref ylo, ref ymi, ref ymi2, ref yhi);
thi = ((ulong) yhi) << 32 | (ulong) ymi2;
tmi = ((ulong) ymi) << 32 | (ulong) ylo;
tlo = 0;
if (xhi > thi || (xhi == thi && xmi >= tmi)) {
Sub192 (xlo, xmi, xhi, tlo, tmi, thi, ref xlo, ref xmi, ref xhi);
extraBit = 1;
} else {
extraBit = 0;
}
Div192By128To128 (xlo, xmi, xhi, ylo, ymi, ymi2, yhi, ref clo, ref chi);
exp = 128 + ashift - bshift;
if (extraBit != 0) {
RShift128 (ref clo, ref chi);
chi += LIT_GUINT64_HIGHBIT;
exp -= 1;
}
// try loss free right shift
while (exp > 0 && (clo & 1) == 0) {
RShift128 (ref clo, ref chi);
exp -= 1;
}
}
// From decimal.c
private static void RShift192 (ref ulong lo, ref ulong mi, ref ulong hi)
{
lo >>= 1;
if ((mi & 1) != 0)
lo |= LIT_GUINT64_HIGHBIT;
mi >>= 1;
if ((hi & 1) != 0)
mi |= LIT_GUINT64_HIGHBIT;
hi >>= 1;
}
// From decimal.c
private static void RShift128 (ref ulong lo, ref ulong hi)
{
lo >>= 1;
if ((hi & 1) != 0)
lo |= LIT_GUINT64_HIGHBIT;
hi >>= 1;
}
// From decimal.c
private static void LShift128 (ref ulong lo, ref ulong hi)
{
hi <<= 1;
if ((lo & LIT_GUINT64_HIGHBIT) != 0)
hi += 1;
lo <<= 1;
}
// From decimal.c
private static void LShift128 (ref uint lo, ref uint mi, ref uint mi2, ref uint hi)
{
hi <<= 1;
if ((mi2 & LIT_GUINT32_HIGHBIT) != 0)
hi += 1;
mi2 <<= 1;
if ((mi & LIT_GUINT32_HIGHBIT) != 0)
mi2 += 1;
mi <<= 1;
if ((lo & LIT_GUINT32_HIGHBIT) != 0)
mi += 1;
lo <<= 1;
}
// From decimal.c
private static void Div192By128To128 (ulong xlo, ulong xmi, ulong xhi, uint ylo, uint ymi, uint ymi2, uint yhi, ref ulong clo, ref ulong chi)
{
ulong rlo, rmi, rhi; // remainders
uint h, c;
rlo = xlo;
rmi = xmi;
rhi = xhi;
h = Div192By128To32WithRest (ref rlo, ref rmi, ref rhi, ylo, ymi, ymi2, yhi);
// mid 32 bit
rhi = (rhi << 32) | (rmi >> 32);
rmi = (rmi << 32) | (rlo >> 32);
rlo <<= 32;
chi = (((ulong)h) << 32) | Div192By128To32WithRest (ref rlo, ref rmi, ref rhi, ylo, ymi, ymi2, yhi);
// low 32 bit
rhi = (rhi << 32) | (rmi >> 32);
rmi = (rmi << 32) | (rlo >> 32);
rlo <<= 32;
h = Div192By128To32WithRest (ref rlo, ref rmi, ref rhi, ylo, ymi, ymi2, yhi);
// estimate lowest 32 bit (two last bits may be wrong)
if (rhi >= yhi)
c = 0xFFFFFFFF;
else {
rhi <<= 32;
c = (uint)(rhi / yhi);
}
clo = (((ulong)h) << 32) | c;
}
// From decimal.c
private static uint Div192By128To32WithRest (ref ulong xlo, ref ulong xmi, ref ulong xhi, uint ylo, uint ymi, uint ymi2, uint yhi)
{
ulong rlo, rmi, rhi; // remainder
ulong tlo = 0;
ulong thi = 0;
uint c;
rlo = xlo;
rmi = xmi;
rhi = xhi;
if (rhi >= (((ulong)yhi << 32)))
c = 0xFFFFFFFF;
else
c = (uint) (rhi / yhi);
Mult128By32To128 (ylo, ymi, ymi2, yhi, c, ref tlo, ref thi);
Sub192 (rlo, rmi, rhi, 0, tlo, thi, ref rlo, ref rmi, ref rhi);
while (((long)rhi) < 0) {
c--;
Add192 (rlo, rmi, rhi, 0, (((ulong)ymi) << 32) | ylo, yhi | ymi2, ref rlo, ref rmi, ref rhi);
}
xlo = rlo;
xmi = rmi;
xhi = rhi;
return c;
}
// From decimal.c
private static void Mult192By32 (ref ulong clo, ref ulong cmi, ref ulong chi, ulong factor, int roundBit)
{
ulong a = 0;
uint h0 = 0;
uint h1 = 0;
a = ((ulong)(uint)clo) * factor;
if (roundBit != 0)
a += factor / 2;
h0 = (uint)a;
a >>= 32;
a += (clo >> 32) * factor;
h1 = (uint)a;
clo = ((ulong)h1) << 32 | h0;
a >>= 32;
a += ((ulong)(uint)cmi) * factor;
h0 = (uint)a;
a >>= 32;
a += (cmi >> 32) * factor;
h1 = (uint)a;
cmi = ((ulong)h1) << 32 | h0;
a >>= 32;
a += ((ulong)(uint)chi) * factor;
h0 = (uint)a;
a >>= 32;
a += (chi >> 32) * factor;
h1 = (uint)a;
chi = ((ulong)h1) << 32 | h0;
}
// From decimal.c
private static void Mult128By32 (ref ulong clo, ref ulong chi, uint factor, int roundBit)
{
ulong a = 0;
uint h0 = 0;
uint h1 = 0;
a = ((ulong)(uint)clo) * factor;
if (roundBit != 0)
a += factor / 2;
h0 = (uint)a;
a >>= 32;
a += (clo >> 32) * factor;
h1 = (uint)a;
clo = ((ulong)h1) << 32 | h0;
a >>= 32;
a += ((ulong)(uint)chi) * factor;
h0 = (uint)a;
a >>= 32;
a += (chi >> 32) * factor;
h1 = (uint)a;
chi = ((ulong)h1) << 32 | h0;
}
// From decimal.c
private static void Mult128By32To128 (uint xlo, uint xmi, uint xmi2, uint xhi, uint factor, ref ulong clo, ref ulong chi)
{
ulong a;
uint h0, h1, h2;
a = ((ulong)xlo) * factor;
h0 = (uint)a;
a >>= 32;
a += ((ulong)xmi) * factor;
h1 = (uint)a;
a >>= 32;
a += ((ulong)xmi2) * factor;
h2 = (uint)a;
a >>= 32;
a += ((ulong)xhi) * factor;
clo = ((ulong)h1) << 32 | h0;
chi = a | h2;
}
// From decimal.c
private static void Add192 (ulong xlo, ulong xmi, ulong xhi, ulong ylo, ulong ymi, ulong yhi, ref ulong clo, ref ulong cmi, ref ulong chi)
{
xlo += ylo;
if (xlo < ylo) {
xmi++;
if (xmi == 0)
xhi++;
}
xmi += ymi;
if (xmi < ymi)
xmi++;
xhi += yhi;
clo = xlo;
cmi = xmi;
chi = xhi;
}
// From decimal.c
private static void Sub192 (ulong xlo, ulong xmi, ulong xhi, ulong ylo, ulong ymi, ulong yhi, ref ulong lo, ref ulong mi, ref ulong hi)
{
ulong clo = 0;
ulong cmi = 0;
ulong chi = 0;
clo = xlo - ylo;
cmi = xmi - ymi;
chi = xhi - yhi;
if (xlo < ylo) {
if (cmi == 0)
chi--;
cmi--;
}
if (xmi < ymi)
chi--;
lo = clo;
mi = cmi;
hi = chi;
return value.ToString ();
}
[MonoTODO]
public static SybaseDecimal Truncate (SybaseDecimal n, int position)
{
return new SybaseDecimal ((byte) n.Precision, (byte) position, n.IsPositive, n.Data);
throw new NotImplementedException ();
}
public static SybaseDecimal operator + (SybaseDecimal x, SybaseDecimal y)
@@ -946,9 +377,10 @@ namespace Mono.Data.SybaseTypes {
return new SybaseDecimal (resultPrecision, x.Scale, x.IsPositive, resultBits);
}
[MonoTODO]
public static SybaseDecimal operator / (SybaseDecimal x, SybaseDecimal y)
{
return DecimalDiv (x, y);
throw new NotImplementedException ();
}
public static SybaseBoolean operator == (SybaseDecimal x, SybaseDecimal y)
@@ -4,10 +4,7 @@
// Author:
// Tim Coleman <[email protected]>
//
// Based on System.Data.SqlTypes.SqlDouble
//
// (C) Ximian, Inc. 2002-2003
// (C) Copyright Tim Coleman, 2002-2003
// (C) Copyright Tim Coleman, 2002
//
using Mono.Data.SybaseClient;
@@ -23,8 +20,8 @@ namespace Mono.Data.SybaseTypes {
private bool notNull;
public static readonly SybaseDouble MaxValue = new SybaseDouble (1.7976931348623157E+308);
public static readonly SybaseDouble MinValue = new SybaseDouble (-1.7976931348623157E+308);
public static readonly SybaseDouble MaxValue = new SybaseDouble (1.7976931348623157e308);
public static readonly SybaseDouble MinValue = new SybaseDouble (-1.7976931348623157e308);
public static readonly SybaseDouble Null;
public static readonly SybaseDouble Zero = new SybaseDouble (0);
@@ -4,10 +4,7 @@
// Author:
// Tim Coleman <[email protected]>
//
// Based on System.Data.SqlTypes.SqlMoney
//
// (C) Ximian, Inc. 2002-2003
// (C) Copyright Tim Coleman, 2002-2003
// (C) Copyright 2002 Tim Coleman
//
using Mono.Data.SybaseClient;
@@ -61,6 +58,7 @@ namespace Mono.Data.SybaseTypes {
#region Properties
[MonoTODO]
public bool IsNull {
get { return !notNull; }
}
@@ -4,17 +4,13 @@
// Author:
// Tim Coleman ([email protected])
//
// Based on System.Data.SqlTypes.SqlString
//
// (C) Ximian, Inc. 2002-2003
// (C) Copyright Tim Coleman, 2002-2003
// (C) Copyright Tim Coleman, 2002
//
using Mono.Data.SybaseClient;
using System;
using System.Data.SqlTypes;
using System.Globalization;
using System.Text;
namespace Mono.Data.SybaseTypes {
public struct SybaseString : INullable, IComparable
@@ -25,14 +21,11 @@ namespace Mono.Data.SybaseTypes {
private bool notNull;
private CultureInfo cultureInfo;
private SybaseCompareOptions compareOptions;
public static readonly int BinarySort = 0x8000;
public static readonly int IgnoreCase = 0x1;
public static readonly int IgnoreKanaType = 0x8;
public static readonly int IgnoreNonSpace = 0x2;
public static readonly int IgnoreWidth = 0x10;
public static readonly int BinarySort;
public static readonly int IgnoreCase;
public static readonly int IgnoreKanaType;
public static readonly int IgnoreNonSpace;
public static readonly int IgnoreWidth;
public static readonly SybaseString Null;
#endregion // Fields
@@ -43,72 +36,55 @@ namespace Mono.Data.SybaseTypes {
public SybaseString (string data)
{
this.value = data;
this.cultureInfo = CultureInfo.CurrentCulture;
this.compareOptions = SybaseCompareOptions.None;
this.notNull = true;
notNull = true;
}
// init with a string data and locale id values.
[MonoTODO]
public SybaseString (string data, int lcid)
: this (data, lcid, SybaseCompareOptions.None)
{
throw new NotImplementedException ();
}
// init with locale id, compare options,
// and an array of bytes data
[MonoTODO]
public SybaseString (int lcid, SybaseCompareOptions compareOptions, byte[] data)
: this (lcid, compareOptions, data, true)
{
throw new NotImplementedException ();
}
// init with string data, locale id, and compare options
[MonoTODO]
public SybaseString (string data, int lcid, SybaseCompareOptions compareOptions)
{
this.value = data;
this.cultureInfo = new CultureInfo (lcid);
this.compareOptions = compareOptions;
this.notNull = true;
throw new NotImplementedException ();
}
// init with locale id, compare options, array of bytes data,
// and whether unicode is encoded or not
[MonoTODO]
public SybaseString (int lcid, SybaseCompareOptions compareOptions, byte[] data, bool fUnicode)
{
Encoding encoding;
if (fUnicode)
encoding = new UnicodeEncoding ();
else
encoding = new ASCIIEncoding ();
this.value = encoding.GetString (data);
this.cultureInfo = new CultureInfo (lcid);
this.compareOptions = compareOptions;
this.notNull = true;
throw new NotImplementedException ();
}
// init with locale id, compare options, array of bytes data,
// starting index in the byte array,
// and number of bytes to copy
[MonoTODO]
public SybaseString (int lcid, SybaseCompareOptions compareOptions, byte[] data, int index, int count)
: this (lcid, compareOptions, data, index, count, true)
{
throw new NotImplementedException ();
}
// init with locale id, compare options, array of bytes data,
// starting index in the byte array, number of byte to copy,
// and whether unicode is encoded or not
[MonoTODO]
public SybaseString (int lcid, SybaseCompareOptions compareOptions, byte[] data, int index, int count, bool fUnicode)
{
Encoding encoding;
if (fUnicode)
encoding = new UnicodeEncoding ();
else
encoding = new ASCIIEncoding ();
this.value = encoding.GetString (data, index, count);
this.cultureInfo = new CultureInfo (lcid);
this.compareOptions = compareOptions;
this.notNull = true;
throw new NotImplementedException ();
}
#endregion // Constructors
@@ -117,11 +93,15 @@ namespace Mono.Data.SybaseTypes {
#region Public Properties
public CompareInfo CompareInfo {
get { return cultureInfo.CompareInfo; }
[MonoTODO]
get { throw new NotImplementedException ();
}
}
public CultureInfo CultureInfo {
get { return cultureInfo; }
[MonoTODO]
get { throw new NotImplementedException ();
}
}
public bool IsNull {
@@ -130,45 +110,40 @@ namespace Mono.Data.SybaseTypes {
// geographics location and language (locale id)
public int LCID {
get { return cultureInfo.LCID; }
[MonoTODO]
get { throw new NotImplementedException ();
}
}
public SybaseCompareOptions SybaseCompareOptions {
get { return compareOptions; }
}
public string Value {
get {
if (this.IsNull)
throw new SybaseNullValueException ("The property contains Null.");
else
return value;
[MonoTODO]
get { throw new NotImplementedException ();
}
}
public string Value {
get {
if (this.IsNull)
throw new SybaseNullValueException ("The property contains Null.");
else
return value;
}
}
#endregion // Public Properties
#region Public Methods
[MonoTODO]
public SybaseString Clone()
{
return new SybaseString (value, LCID, SybaseCompareOptions);
throw new NotImplementedException ();
}
[MonoTODO]
public static CompareOptions CompareOptionsFromSybaseCompareOptions (SybaseCompareOptions compareOptions)
{
CompareOptions options = CompareOptions.None;
if ((compareOptions & SybaseCompareOptions.IgnoreCase) != 0)
options |= CompareOptions.IgnoreCase;
if ((compareOptions & SybaseCompareOptions.IgnoreKanaType) != 0)
options |= CompareOptions.IgnoreKanaType;
if ((compareOptions & SybaseCompareOptions.IgnoreNonSpace) != 0)
options |= CompareOptions.IgnoreNonSpace;
if ((compareOptions & SybaseCompareOptions.IgnoreWidth) != 0)
options |= CompareOptions.IgnoreWidth;
if ((compareOptions & SybaseCompareOptions.BinarySort) != 0)
throw new ArgumentOutOfRangeException ();
return options;
throw new NotImplementedException ();
}
// **********************************
@@ -205,33 +180,22 @@ namespace Mono.Data.SybaseTypes {
return (x == y);
}
[MonoTODO]
public override int GetHashCode()
{
int result = 10;
for (int i = 0; i < value.Length; i += 1)
result = 91 * result + (int) (value [i] ^ (value [i] >> 32));
result = 91 * result + LCID.GetHashCode ();
result = 91 * result + (int) compareOptions;
return result;
throw new NotImplementedException ();
}
[MonoTODO]
public byte[] GetNonUnicodeBytes()
{
return GetBytes (new ASCIIEncoding ());
throw new NotImplementedException ();
}
[MonoTODO]
public byte[] GetUnicodeBytes()
{
return GetBytes (new UnicodeEncoding ());
}
private byte[] GetBytes (Encoding encoding)
{
int blen = encoding.GetByteCount (value);
int clen = value.Length;
byte[] bytes = new byte [blen];
encoding.GetBytes (value, 0, clen, bytes, 0);
return bytes;
throw new NotImplementedException ();
}
public static SybaseBoolean GreaterThan(SybaseString x, SybaseString y)
Loaded 100 of 1378 files, more files were not shown because too many files have changed in this diff. Show more